@blockcerts/blockcerts-verifier 1.52.1 → 1.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ie11.js +18 -18
- package/dist/main.js +22 -22
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -242,7 +242,7 @@ function(e){var t=function(e){var t,n,r,i,o,a,s,l,u,A;for(/[^\x00-\xFF]/.test(e)
|
|
|
242
242
|
* Licensed under the MIT License.
|
|
243
243
|
* http://opensource.org/licenses/mit-license
|
|
244
244
|
*/
|
|
245
|
-
function(e){e.loadFile=function(e,t,n){return function(e,t,n){t=!1!==t,n="function"==typeof n?n:function(){};var r=void 0;try{r=function(e,t,n){var r=new XMLHttpRequest,i=0,o=function(e){var t=e.length,n=[],r=String.fromCharCode;for(i=0;i<t;i+=1)n.push(r(255&e.charCodeAt(i)));return n.join("")};if(r.open("GET",e,!t),r.overrideMimeType("text/plain; charset=x-user-defined"),!1===t&&(r.onload=function(){200===r.status?n(o(this.responseText)):n(void 0)}),r.send(null),t&&200===r.status)return o(r.responseText)}(e,t,n)}catch(e){}return r}(e,t,n)},e.loadImageFile=e.loadFile}(kn.API),function(e){function t(){return(Yt.html2canvas?Promise.resolve(Yt.html2canvas):Promise.resolve().then((function(){return pi}))).catch((function(e){return Promise.reject(new Error("Could not load html2canvas: "+e))})).then((function(e){return e.default?e.default:e}))}function n(){return(Yt.DOMPurify?Promise.resolve(Yt.DOMPurify):Promise.resolve().then((function(){return Vce}))).catch((function(e){return Promise.reject(new Error("Could not load dompurify: "+e))})).then((function(e){return e.default?e.default:e}))}var r=function(e){var t=st(e);return"undefined"===t?"undefined":"string"===t||e instanceof String?"string":"number"===t||e instanceof Number?"number":"function"===t||e instanceof Function?"function":e&&e.constructor===Array?"array":e&&1===e.nodeType?"element":"object"===t?"object":"unknown"},i=function(e,t){var n=document.createElement(e);for(var r in t.className&&(n.className=t.className),t.innerHTML&&t.dompurify&&(n.innerHTML=t.dompurify.sanitize(t.innerHTML)),t.style)n.style[r]=t.style[r];return n},o=function e(t){var n=Object.assign(e.convert(Promise.resolve()),JSON.parse(JSON.stringify(e.template))),r=e.convert(Promise.resolve(),n);return(r=r.setProgress(1,e,1,[e])).set(t)};(o.prototype=Object.create(Promise.prototype)).constructor=o,o.convert=function(e,t){return e.__proto__=t||o.prototype,e},o.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},o.prototype.from=function(e,t){return this.then((function(){switch(t=t||function(e){switch(r(e)){case"string":return"string";case"element":return"canvas"===e.nodeName.toLowerCase()?"canvas":"element";default:return"unknown"}}(e)){case"string":return this.then(n).then((function(t){return this.set({src:i("div",{innerHTML:e,dompurify:t})})}));case"element":return this.set({src:e});case"canvas":return this.set({canvas:e});case"img":return this.set({img:e});default:return this.error("Unknown source type.")}}))},o.prototype.to=function(e){switch(e){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},o.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then((function(){var e={position:"relative",display:"inline-block",width:("number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},t=function e(t,n){for(var r=3===t.nodeType?document.createTextNode(t.nodeValue):t.cloneNode(!1),i=t.firstChild;i;i=i.nextSibling)!0!==n&&1===i.nodeType&&"SCRIPT"===i.nodeName||r.appendChild(e(i,n));return 1===t.nodeType&&("CANVAS"===t.nodeName?(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(t,0,0)):"TEXTAREA"!==t.nodeName&&"SELECT"!==t.nodeName||(r.value=t.value),r.addEventListener("load",(function(){r.scrollTop=t.scrollTop,r.scrollLeft=t.scrollLeft}),!0)),r}(this.prop.src,this.opt.html2canvas.javascriptEnabled);"BODY"===t.tagName&&(e.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=i("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=i("div",{className:"html2pdf__container",style:e}),this.prop.container.appendChild(t),this.prop.container.firstChild.appendChild(i("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"}))},o.prototype.toCanvas=function(){var e=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(e).then(t).then((function(e){var t=Object.assign({},this.opt.html2canvas);return delete t.onrendered,e(this.prop.container,t)})).then((function(e){(this.opt.html2canvas.onrendered||function(){})(e),this.prop.canvas=e,document.body.removeChild(this.prop.overlay)}))},o.prototype.toContext2d=function(){var e=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(e).then(t).then((function(e){var t=this.opt.jsPDF,n=this.opt.fontFaces,r="number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,i=Object.assign({async:!0,allowTaint:!0,scale:r,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete i.onrendered,t.context2d.autoPaging=void 0===this.opt.autoPaging||this.opt.autoPaging,t.context2d.posX=this.opt.x,t.context2d.posY=this.opt.y,t.context2d.margin=this.opt.margin,t.context2d.fontFaces=n,n)for(var o=0;o<n.length;++o){var a=n[o],s=a.src.find((function(e){return"truetype"===e.format}));s&&t.addFont(s.url,a.ref.name,a.ref.style)}return i.windowHeight=i.windowHeight||0,i.windowHeight=0==i.windowHeight?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):i.windowHeight,t.context2d.save(!0),e(this.prop.container,i)})).then((function(e){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(e),this.prop.canvas=e,document.body.removeChild(this.prop.overlay)}))},o.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then((function(){var e=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=e}))},o.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then((function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF}))},o.prototype.output=function(e,t,n){return"img"===(n=n||"pdf").toLowerCase()||"image"===n.toLowerCase()?this.outputImg(e,t):this.outputPdf(e,t)},o.prototype.outputPdf=function(e,t){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then((function(){return this.prop.pdf.output(e,t)}))},o.prototype.outputImg=function(e){return this.thenList([function(){return this.prop.img||this.toImg()}]).then((function(){switch(e){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+e+'" is not supported.'}}))},o.prototype.save=function(e){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(e?{filename:e}:null).then((function(){this.prop.pdf.save(this.opt.filename)}))},o.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then((function(){this.prop.callback(this.prop.pdf)}))},o.prototype.set=function(e){if("object"!==r(e))return this;var t=Object.keys(e||{}).map((function(t){if(t in o.template.prop)return function(){this.prop[t]=e[t]};switch(t){case"margin":return this.setMargin.bind(this,e.margin);case"jsPDF":return function(){return this.opt.jsPDF=e.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,e.pageSize);default:return function(){this.opt[t]=e[t]}}}),this);return this.then((function(){return this.thenList(t)}))},o.prototype.get=function(e,t){return this.then((function(){var n=e in o.template.prop?this.prop[e]:this.opt[e];return t?t(n):n}))},o.prototype.setMargin=function(e){return this.then((function(){switch(r(e)){case"number":e=[e,e,e,e];case"array":if(2===e.length&&(e=[e[0],e[1],e[0],e[1]]),4===e.length)break;default:return this.error("Invalid margin array.")}this.opt.margin=e})).then(this.setPageSize)},o.prototype.setPageSize=function(e){function t(e,t){return Math.floor(e*t/72*96)}return this.then((function(){(e=e||kn.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(e.inner={width:e.width-this.opt.margin[1]-this.opt.margin[3],height:e.height-this.opt.margin[0]-this.opt.margin[2]},e.inner.px={width:t(e.inner.width,e.k),height:t(e.inner.height,e.k)},e.inner.ratio=e.inner.height/e.inner.width),this.prop.pageSize=e}))},o.prototype.setProgress=function(e,t,n,r){return null!=e&&(this.progress.val=e),null!=t&&(this.progress.state=t),null!=n&&(this.progress.n=n),null!=r&&(this.progress.stack=r),this.progress.ratio=this.progress.val/this.progress.state,this},o.prototype.updateProgress=function(e,t,n,r){return this.setProgress(e?this.progress.val+e:null,t||null,n?this.progress.n+n:null,r?this.progress.stack.concat(r):null)},o.prototype.then=function(e,t){var n=this;return this.thenCore(e,t,(function(e,t){return n.updateProgress(null,null,1,[e]),Promise.prototype.then.call(this,(function(t){return n.updateProgress(null,e),t})).then(e,t).then((function(e){return n.updateProgress(1),e}))}))},o.prototype.thenCore=function(e,t,n){n=n||Promise.prototype.then,e&&(e=e.bind(this)),t&&(t=t.bind(this));var r=-1!==Promise.toString().indexOf("[native code]")&&"Promise"===Promise.name?this:o.convert(Object.assign({},this),Promise.prototype),i=n.call(r,e,t);return o.convert(i,this.__proto__)},o.prototype.thenExternal=function(e,t){return Promise.prototype.then.call(this,e,t)},o.prototype.thenList=function(e){var t=this;return e.forEach((function(e){t=t.thenCore(e)})),t},o.prototype.catch=function(e){e&&(e=e.bind(this));var t=Promise.prototype.catch.call(this,e);return o.convert(t,this)},o.prototype.catchExternal=function(e){return Promise.prototype.catch.call(this,e)},o.prototype.error=function(e){return this.then((function(){throw new Error(e)}))},o.prototype.using=o.prototype.set,o.prototype.saveAs=o.prototype.save,o.prototype.export=o.prototype.output,o.prototype.run=o.prototype.then,kn.getPageSize=function(e,t,n){if("object"===st(e)){var r=e;e=r.orientation,t=r.unit||t,n=r.format||n}t=t||"mm",n=n||"a4",e=(""+(e||"P")).toLowerCase();var i,o=(""+n).toLowerCase(),a={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(t){case"pt":i=1;break;case"mm":i=72/25.4;break;case"cm":i=72/2.54;break;case"in":i=72;break;case"px":i=.75;break;case"pc":case"em":i=12;break;case"ex":i=6;break;default:throw"Invalid unit: "+t}var s,l=0,u=0;if(a.hasOwnProperty(o))l=a[o][1]/i,u=a[o][0]/i;else try{l=n[1],u=n[0]}catch(e){throw new Error("Invalid format: "+n)}if("p"===e||"portrait"===e)e="p",u>l&&(s=u,u=l,l=s);else{if("l"!==e&&"landscape"!==e)throw"Invalid orientation: "+e;e="l",l>u&&(s=u,u=l,l=s)}return{width:u,height:l,unit:t,k:i,orientation:e}},e.html=function(e,t){(t=t||{}).callback=t.callback||function(){},t.html2canvas=t.html2canvas||{},t.html2canvas.canvas=t.html2canvas.canvas||this.canvas,t.jsPDF=t.jsPDF||this,t.fontFaces=t.fontFaces?t.fontFaces.map(Br):null;var n=new o(t);return t.worker?n:n.from(e).doCallback()}}(kn.API),kn.API.addJS=function(e){return Fr=e,this.internal.events.subscribe("postPutResources",(function(){Nr=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(Nr+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),Dr=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+Fr+")"),this.internal.out(">>"),this.internal.out("endobj")})),this.internal.events.subscribe("putCatalog",(function(){void 0!==Nr&&void 0!==Dr&&this.internal.out("/Names <</JavaScript "+Nr+" 0 R>>")})),this
|
|
245
|
+
function(e){e.loadFile=function(e,t,n){return function(e,t,n){t=!1!==t,n="function"==typeof n?n:function(){};var r=void 0;try{r=function(e,t,n){var r=new XMLHttpRequest,i=0,o=function(e){var t=e.length,n=[],r=String.fromCharCode;for(i=0;i<t;i+=1)n.push(r(255&e.charCodeAt(i)));return n.join("")};if(r.open("GET",e,!t),r.overrideMimeType("text/plain; charset=x-user-defined"),!1===t&&(r.onload=function(){200===r.status?n(o(this.responseText)):n(void 0)}),r.send(null),t&&200===r.status)return o(r.responseText)}(e,t,n)}catch(e){}return r}(e,t,n)},e.loadImageFile=e.loadFile}(kn.API),function(e){function t(){return(Yt.html2canvas?Promise.resolve(Yt.html2canvas):Promise.resolve().then((function(){return pi}))).catch((function(e){return Promise.reject(new Error("Could not load html2canvas: "+e))})).then((function(e){return e.default?e.default:e}))}function n(){return(Yt.DOMPurify?Promise.resolve(Yt.DOMPurify):Promise.resolve().then((function(){return zce}))).catch((function(e){return Promise.reject(new Error("Could not load dompurify: "+e))})).then((function(e){return e.default?e.default:e}))}var r=function(e){var t=st(e);return"undefined"===t?"undefined":"string"===t||e instanceof String?"string":"number"===t||e instanceof Number?"number":"function"===t||e instanceof Function?"function":e&&e.constructor===Array?"array":e&&1===e.nodeType?"element":"object"===t?"object":"unknown"},i=function(e,t){var n=document.createElement(e);for(var r in t.className&&(n.className=t.className),t.innerHTML&&t.dompurify&&(n.innerHTML=t.dompurify.sanitize(t.innerHTML)),t.style)n.style[r]=t.style[r];return n},o=function e(t){var n=Object.assign(e.convert(Promise.resolve()),JSON.parse(JSON.stringify(e.template))),r=e.convert(Promise.resolve(),n);return(r=r.setProgress(1,e,1,[e])).set(t)};(o.prototype=Object.create(Promise.prototype)).constructor=o,o.convert=function(e,t){return e.__proto__=t||o.prototype,e},o.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},o.prototype.from=function(e,t){return this.then((function(){switch(t=t||function(e){switch(r(e)){case"string":return"string";case"element":return"canvas"===e.nodeName.toLowerCase()?"canvas":"element";default:return"unknown"}}(e)){case"string":return this.then(n).then((function(t){return this.set({src:i("div",{innerHTML:e,dompurify:t})})}));case"element":return this.set({src:e});case"canvas":return this.set({canvas:e});case"img":return this.set({img:e});default:return this.error("Unknown source type.")}}))},o.prototype.to=function(e){switch(e){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},o.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then((function(){var e={position:"relative",display:"inline-block",width:("number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},t=function e(t,n){for(var r=3===t.nodeType?document.createTextNode(t.nodeValue):t.cloneNode(!1),i=t.firstChild;i;i=i.nextSibling)!0!==n&&1===i.nodeType&&"SCRIPT"===i.nodeName||r.appendChild(e(i,n));return 1===t.nodeType&&("CANVAS"===t.nodeName?(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(t,0,0)):"TEXTAREA"!==t.nodeName&&"SELECT"!==t.nodeName||(r.value=t.value),r.addEventListener("load",(function(){r.scrollTop=t.scrollTop,r.scrollLeft=t.scrollLeft}),!0)),r}(this.prop.src,this.opt.html2canvas.javascriptEnabled);"BODY"===t.tagName&&(e.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=i("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=i("div",{className:"html2pdf__container",style:e}),this.prop.container.appendChild(t),this.prop.container.firstChild.appendChild(i("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"}))},o.prototype.toCanvas=function(){var e=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(e).then(t).then((function(e){var t=Object.assign({},this.opt.html2canvas);return delete t.onrendered,e(this.prop.container,t)})).then((function(e){(this.opt.html2canvas.onrendered||function(){})(e),this.prop.canvas=e,document.body.removeChild(this.prop.overlay)}))},o.prototype.toContext2d=function(){var e=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(e).then(t).then((function(e){var t=this.opt.jsPDF,n=this.opt.fontFaces,r="number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,i=Object.assign({async:!0,allowTaint:!0,scale:r,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete i.onrendered,t.context2d.autoPaging=void 0===this.opt.autoPaging||this.opt.autoPaging,t.context2d.posX=this.opt.x,t.context2d.posY=this.opt.y,t.context2d.margin=this.opt.margin,t.context2d.fontFaces=n,n)for(var o=0;o<n.length;++o){var a=n[o],s=a.src.find((function(e){return"truetype"===e.format}));s&&t.addFont(s.url,a.ref.name,a.ref.style)}return i.windowHeight=i.windowHeight||0,i.windowHeight=0==i.windowHeight?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):i.windowHeight,t.context2d.save(!0),e(this.prop.container,i)})).then((function(e){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(e),this.prop.canvas=e,document.body.removeChild(this.prop.overlay)}))},o.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then((function(){var e=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=e}))},o.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then((function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF}))},o.prototype.output=function(e,t,n){return"img"===(n=n||"pdf").toLowerCase()||"image"===n.toLowerCase()?this.outputImg(e,t):this.outputPdf(e,t)},o.prototype.outputPdf=function(e,t){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then((function(){return this.prop.pdf.output(e,t)}))},o.prototype.outputImg=function(e){return this.thenList([function(){return this.prop.img||this.toImg()}]).then((function(){switch(e){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+e+'" is not supported.'}}))},o.prototype.save=function(e){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(e?{filename:e}:null).then((function(){this.prop.pdf.save(this.opt.filename)}))},o.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then((function(){this.prop.callback(this.prop.pdf)}))},o.prototype.set=function(e){if("object"!==r(e))return this;var t=Object.keys(e||{}).map((function(t){if(t in o.template.prop)return function(){this.prop[t]=e[t]};switch(t){case"margin":return this.setMargin.bind(this,e.margin);case"jsPDF":return function(){return this.opt.jsPDF=e.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,e.pageSize);default:return function(){this.opt[t]=e[t]}}}),this);return this.then((function(){return this.thenList(t)}))},o.prototype.get=function(e,t){return this.then((function(){var n=e in o.template.prop?this.prop[e]:this.opt[e];return t?t(n):n}))},o.prototype.setMargin=function(e){return this.then((function(){switch(r(e)){case"number":e=[e,e,e,e];case"array":if(2===e.length&&(e=[e[0],e[1],e[0],e[1]]),4===e.length)break;default:return this.error("Invalid margin array.")}this.opt.margin=e})).then(this.setPageSize)},o.prototype.setPageSize=function(e){function t(e,t){return Math.floor(e*t/72*96)}return this.then((function(){(e=e||kn.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(e.inner={width:e.width-this.opt.margin[1]-this.opt.margin[3],height:e.height-this.opt.margin[0]-this.opt.margin[2]},e.inner.px={width:t(e.inner.width,e.k),height:t(e.inner.height,e.k)},e.inner.ratio=e.inner.height/e.inner.width),this.prop.pageSize=e}))},o.prototype.setProgress=function(e,t,n,r){return null!=e&&(this.progress.val=e),null!=t&&(this.progress.state=t),null!=n&&(this.progress.n=n),null!=r&&(this.progress.stack=r),this.progress.ratio=this.progress.val/this.progress.state,this},o.prototype.updateProgress=function(e,t,n,r){return this.setProgress(e?this.progress.val+e:null,t||null,n?this.progress.n+n:null,r?this.progress.stack.concat(r):null)},o.prototype.then=function(e,t){var n=this;return this.thenCore(e,t,(function(e,t){return n.updateProgress(null,null,1,[e]),Promise.prototype.then.call(this,(function(t){return n.updateProgress(null,e),t})).then(e,t).then((function(e){return n.updateProgress(1),e}))}))},o.prototype.thenCore=function(e,t,n){n=n||Promise.prototype.then,e&&(e=e.bind(this)),t&&(t=t.bind(this));var r=-1!==Promise.toString().indexOf("[native code]")&&"Promise"===Promise.name?this:o.convert(Object.assign({},this),Promise.prototype),i=n.call(r,e,t);return o.convert(i,this.__proto__)},o.prototype.thenExternal=function(e,t){return Promise.prototype.then.call(this,e,t)},o.prototype.thenList=function(e){var t=this;return e.forEach((function(e){t=t.thenCore(e)})),t},o.prototype.catch=function(e){e&&(e=e.bind(this));var t=Promise.prototype.catch.call(this,e);return o.convert(t,this)},o.prototype.catchExternal=function(e){return Promise.prototype.catch.call(this,e)},o.prototype.error=function(e){return this.then((function(){throw new Error(e)}))},o.prototype.using=o.prototype.set,o.prototype.saveAs=o.prototype.save,o.prototype.export=o.prototype.output,o.prototype.run=o.prototype.then,kn.getPageSize=function(e,t,n){if("object"===st(e)){var r=e;e=r.orientation,t=r.unit||t,n=r.format||n}t=t||"mm",n=n||"a4",e=(""+(e||"P")).toLowerCase();var i,o=(""+n).toLowerCase(),a={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(t){case"pt":i=1;break;case"mm":i=72/25.4;break;case"cm":i=72/2.54;break;case"in":i=72;break;case"px":i=.75;break;case"pc":case"em":i=12;break;case"ex":i=6;break;default:throw"Invalid unit: "+t}var s,l=0,u=0;if(a.hasOwnProperty(o))l=a[o][1]/i,u=a[o][0]/i;else try{l=n[1],u=n[0]}catch(e){throw new Error("Invalid format: "+n)}if("p"===e||"portrait"===e)e="p",u>l&&(s=u,u=l,l=s);else{if("l"!==e&&"landscape"!==e)throw"Invalid orientation: "+e;e="l",l>u&&(s=u,u=l,l=s)}return{width:u,height:l,unit:t,k:i,orientation:e}},e.html=function(e,t){(t=t||{}).callback=t.callback||function(){},t.html2canvas=t.html2canvas||{},t.html2canvas.canvas=t.html2canvas.canvas||this.canvas,t.jsPDF=t.jsPDF||this,t.fontFaces=t.fontFaces?t.fontFaces.map(Br):null;var n=new o(t);return t.worker?n:n.from(e).doCallback()}}(kn.API),kn.API.addJS=function(e){return Fr=e,this.internal.events.subscribe("postPutResources",(function(){Nr=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(Nr+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),Dr=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+Fr+")"),this.internal.out(">>"),this.internal.out("endobj")})),this.internal.events.subscribe("putCatalog",(function(){void 0!==Nr&&void 0!==Dr&&this.internal.out("/Names <</JavaScript "+Nr+" 0 R>>")})),this
|
|
246
246
|
/**
|
|
247
247
|
* @license
|
|
248
248
|
* Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
|
|
@@ -403,7 +403,7 @@ function(e){var t=function(e){for(var t=e.length,n=new Uint8Array(t),r=0;r<t;r++
|
|
|
403
403
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
404
404
|
* ====================================================================
|
|
405
405
|
*/
|
|
406
|
-
function(e){function t(){return(Yt.canvg?Promise.resolve(Yt.canvg):Promise.resolve().then((function(){return
|
|
406
|
+
function(e){function t(){return(Yt.canvg?Promise.resolve(Yt.canvg):Promise.resolve().then((function(){return k_e}))).catch((function(e){return Promise.reject(new Error("Could not load canvg: "+e))})).then((function(e){return e.default?e.default:e}))}kn.API.addSvgAsImage=function(e,n,r,i,o,a,s,l){if(isNaN(n)||isNaN(r))throw Wt.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(i)||isNaN(o))throw Wt.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var u=document.createElement("canvas");u.width=i,u.height=o;var A=u.getContext("2d");A.fillStyle="#fff",A.fillRect(0,0,u.width,u.height);var c={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},h=this;return t().then((function(t){return t.fromString(A,e,c)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(e){return e.render(c)})).then((function(){h.addImage(u.toDataURL("image/jpeg",1),n,r,i,o,s,l)}))}}(),kn.API.putTotalPages=function(e){var t,n=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),n=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),n=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var i=0;i<this.internal.pages[r].length;i++)this.internal.pages[r][i]=this.internal.pages[r][i].replace(t,n);return this},kn.API.viewerPreferences=function(e,t){var n;e=e||{},t=t||!1;var r,i,o,a={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},s=Object.keys(a),l=[],u=0,A=0,c=0;function h(e,t){var n,r=!1;for(n=0;n<e.length;n+=1)e[n]===t&&(r=!0);return r}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(a)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,"reset"===e||!0===t){var f=s.length;for(c=0;c<f;c+=1)n[s[c]].value=n[s[c]].defaultValue,n[s[c]].explicitSet=!1}if("object"===st(e))for(i in e)if(o=e[i],h(s,i)&&void 0!==o){if("boolean"===n[i].type&&"boolean"==typeof o)n[i].value=o;else if("name"===n[i].type&&h(n[i].valueSet,o))n[i].value=o;else if("integer"===n[i].type&&Number.isInteger(o))n[i].value=o;else if("array"===n[i].type){for(u=0;u<o.length;u+=1)if(r=!0,1===o[u].length&&"number"==typeof o[u][0])l.push(String(o[u]-1));else if(o[u].length>1){for(A=0;A<o[u].length;A+=1)"number"!=typeof o[u][A]&&(r=!1);!0===r&&l.push([o[u][0]-1,o[u][1]-1].join(" "))}n[i].value="["+l.join(" ")+"]"}else n[i].value=n[i].defaultValue;n[i].explicitSet=!0}return!1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var e,t=[];for(e in n)!0===n[e].explicitSet&&("name"===n[e].type?t.push("/"+e+" /"+n[e].value):t.push("/"+e+" "+n[e].value));0!==t.length&&this.internal.write("/ViewerPreferences\n<<\n"+t.join("\n")+"\n>>")})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this
|
|
407
407
|
/** ====================================================================
|
|
408
408
|
* @license
|
|
409
409
|
* jsPDF XMP metadata plugin
|
|
@@ -634,7 +634,7 @@ var LN=class{constructor({term:e,date:t,maxTimestampDelta:n=1/0}={}){if(void 0==
|
|
|
634
634
|
/*!
|
|
635
635
|
* Copyright (c) 2010-2018 Digital Bazaar, Inc. All rights reserved.
|
|
636
636
|
*/
|
|
637
|
-
const zN={};var JN=zN;const YN=oN;Object.assign(zN,YN);const XN=class{async add(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i}={}){if(!t)throw new TypeError('"options.suite" is required.');if(!n)throw new TypeError('"options.purpose" is required.');r=r?mN(r):vN,void 0===i?i=wN:!1===i&&(i=void 0);const o={...e};delete o.proof;const a=await t.createProof({document:o,purpose:n,documentLoader:r,expansionMap:i});return yN.addValue(e,"proof",a),e}async verify(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i}={}){if(!t)throw new TypeError('"options.suite" is required.');if(!n)throw new TypeError('"options.purpose" is required.');const o=Array.isArray(t)?t:[t];if(0===o.length)throw new TypeError("At least one suite is required.");r=r?mN(r):vN,void 0===i?i=wN:!1===i&&(i=void 0);try{e={...e};const{proofSet:t,document:a}=await async function({document:e}){let t;if(t=yN.getValues(e,"proof"),delete e.proof,0===t.length)throw new Error("No matching proofs found in the given document.");const n=e["@context"]||gN.SECURITY_CONTEXT_URL;return t=t.map((e=>({"@context":n,...e}))),{proofSet:t,document:e}}({document:e,documentLoader:r,expansionMap:i});e=a;const s=await async function({document:e,suites:t,proofSet:n,purpose:r,documentLoader:i,expansionMap:o}){const a=Array.isArray(r)?r:[r],s=new Map,l=new Map,u=new Map;if(await Promise.all(a.map((r=>async function({purposeToProofs:e,proofToSuite:t,purpose:n,proofSet:r,suites:i,suiteMatchQueue:o,document:a,documentLoader:s,expansionMap:l}){for(const u of r){if(!await n.match(u,{document:a,documentLoader:s,expansionMap:l}))continue;let r=!1;for(const e of i){let n=o.get(e);n||o.set(e,n=new Map);let i=n.get(u);if(i||(i=e.matchProof({proof:u,document:a,documentLoader:s,expansionMap:l}),n.set(u,i)),await i){r=!0,t.set(u,e);break}}if(r){const t=e.get(n);t?t.push(u):e.set(n,[u])}}}({purposeToProofs:s,proofToSuite:l,purpose:r,proofSet:n,suites:t,suiteMatchQueue:u,document:e,documentLoader:i,expansionMap:o})))),s.size<a.length)return[];const A=new Map;return await Promise.all([...l.entries()].map((async([t,n])=>{let r;try{let a;const s={validate:async(e,{verificationMethod:t})=>(a=t,{valid:!0})},{verified:l,verificationMethod:u,error:A}=await n.verifyProof({proof:t,document:e,purpose:s,documentLoader:i,expansionMap:o});a||(a=u),r={proof:t,verified:l,verificationMethod:a,error:A}}catch(e){r={proof:t,verified:!1,error:e}}r.error&&bN(r.error),A.set(t,r)}))),await Promise.all([...s.entries()].map((async([t,n])=>{for(const r of n){const n=A.get(r);if(!n.verified)continue;const{verificationMethod:a}=n,s=l.get(r);let u;try{u=await t.validate(r,{document:e,suite:s,verificationMethod:a,documentLoader:i,expansionMap:o})}catch(e){u={valid:!1,error:e}}n.purposeResult?Array.isArray(n.purposeResult)?n.purposeResult.push(u):n.purposeResult=[n.purposeResult,u]:n.purposeResult=u,u.valid||(bN(u.error),n.error||(n.verified=!1,n.error=u.error))}}))),[...A.values()]}({document:e,suites:o,proofSet:t,purpose:n,documentLoader:r,expansionMap:i});if(0===s.length){const e=new Error("Did not verify any proofs; insufficient proofs matched the acceptable suite(s) and required purpose(s).");throw e.name="NotFoundError",e}const l=s.some((e=>e.verified));if(!l){const e=[].concat(...s.filter((e=>e.error)).map((e=>e.error))),t={verified:l,results:s};return e.length>0&&(t.error=e),t}return{verified:l,results:s}}catch(e){return bN(e),{verified:!1,error:e}}}},WN=EN;function ZN(e){const t=Object.keys(jl).map((e=>jl[e])).find((t=>t.signatureValue===e));return t}function $N(e,t){const n=e.findIndex((e=>e===t));n>-1&&e.splice(n,1)}zN.sign=async function(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i,addSuiteContext:o=!0}={}){if("object"!=typeof e)throw new TypeError('The "document" parameter must be an object.');t.ensureSuiteContext({document:e,addSuiteContext:o});try{return await(new XN).add(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i})}catch(e){if(!r&&"jsonld.InvalidUrl"===e.name){const{details:{url:t}}=e,n=new Error(`A URL "${t}" could not be fetched; you need to pass "documentLoader" or resolve the URL before calling "sign".`);throw n.cause=e,n}throw e}},zN.verify=async function(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i}={}){if("object"!=typeof e)throw new TypeError('The "document" parameter must be an object.');const o=await(new XN).verify(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i}),{error:a}=o;if(a)if(r||"jsonld.InvalidUrl"!==a.name)o.error=new WN(a);else{const{details:{url:e}}=a,t=new Error(`A URL "${e}" could not be fetched; you need to pass "documentLoader" or resolve the URL before calling "verify".`);o.error=new WN(t)}return o},zN.suites=MN.suites,zN.purposes=VN.purposes,Object.assign(zN,AN);var eD={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",creator:{"@id":"dc:creator","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"sec:expiration","@type":"xsd:dateTime"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:"bc:verification",publicKeys:"bc:publicKeys",ChainpointSHA256v2:"cp:ChainpointSHA256v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"}]},tD={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"bc:created","@type":"xsd:dateTime"},name:{"@id":"schema:name"}}},nD={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType","@type":"@id"},contentEncoding:{"@id":"bc:contentEncoding","@type":"@id"},content:{"@id":"bc:content","@type":"@id"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey","@type":"@id"},url:{"@id":"schema:url","@type":"@id"},image:{"@id":"schema:image","@type":"@id"}}};function rD(e){e=e.trim();const t=[];for(let n=0;n<e.length;n+=2)t.push(parseInt(e.substring(n,n+2),16));return t}jh["https://w3id.org/blockcerts/schema/2.0-alpha/context.json"]=eD,jh["https://www.blockcerts.org/schema/2.0-alpha/context.json"]=eD,jh["https://www.blockcerts.org/schema/3.0-alpha/context.json"]=tD,jh["https://w3id.org/blockcerts/schema/3.0-alpha/context.json"]=tD,jh["https://w3id.org/blockcerts/v3.0-alpha"]=tD,jh["https://www.blockcerts.org/schema/3.0-beta/context.json"]=nD,jh["https://w3id.org/blockcerts/schema/3.0-beta/context.json"]=nD,jh["https://w3id.org/blockcerts/v3.0-beta"]=nD,jh["https://w3id.org/security/suites/ed25519-2020/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},Ed25519VerificationKey2020:{"@id":"https://w3id.org/security#Ed25519VerificationKey2020","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},Ed25519Signature2020:{"@id":"https://w3id.org/security#Ed25519Signature2020","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};class iD extends Error{constructor(e,t){super(t),this.stepCode=e}}var oD="en-US",aD={"en-US":{errors:{ensureHashesEqual:"Computed hash does not match remote hash",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},fr:{errors:{ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",identityErrorBaseMessage:"Identité de l'émetteur invalide",deriveIssuingAddressFromPublicKey:"Cette blockchain n'est pas supportée pour la vérification de l'identité décentralisée.",compareIssuingAddress:"La méthode de vérification n'a pas permis d'établir l'identité de l'émetteur.",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",noProofSpecified:"La propriété 'proof' du document est un tableau mais aucune preuve n'a été passée pour savoir ce qu'il faut vérifier"}},es:{errors:{ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",identityErrorBaseMessage:"Identitad del emisor inválida",deriveIssuingAddressFromPublicKey:"No se puede validar la identitad decentalisada con esta cadena binaria.",compareIssuingAddress:"El metodo de verificación no corresponde a la identitad del emisor.",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",noProofSpecified:"La propiedad 'proof' del documento es una lista, pero no prueba especifica ha sido declarada para conocer el punto de verificación"}},mt:{errors:{ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},"it-IT":{errors:{ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},ja:{errors:{ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}}};function sD(e,t){return e&&t?aD[oD]?aD[oD][e]?aD[oD][e][t]?aD[oD][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}var lD=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class uD extends Error{constructor(e){super(e||"This operation is not supported for this key type")}}var AD=uD;class cD extends Error{constructor(){super("This has not been implemented yet")}}var hD=cD;const fD=hD;var dD,pD=class{constructor(e){this.params=e}fromPrivatePKCS1(e){throw new fD}fromPrivatePKCS8(e){throw new fD}fromPublicPKCS1(e){throw new fD}fromPublicPKCS8(e){throw new fD}fromPrivateBlk(e){throw new fD}fromPublicBlk(e){throw new fD}fromJwk(e){throw new fD}toPrivatePKCS1(e){throw new fD}toPrivatePKCS8(e){throw new fD}toPublicPKCS1(e){throw new fD}toPublicPKCS8(e){throw new fD}toPrivateBlk(e){throw new fD}toPublicBlk(e){throw new fD}toPrivateJwk(e){throw new fD}toPublicJwk(e){throw new fD}static formatPem(e,t){return`-----BEGIN ${t} KEY-----\n`+e.match(/.{1,64}/g).join("\n")+`\n-----END ${t} KEY-----`}},gD={},yD={},mD={},vD=qo,ID=vD.Buffer,wD={};for(dD in vD)vD.hasOwnProperty(dD)&&"SlowBuffer"!==dD&&"Buffer"!==dD&&(wD[dD]=vD[dD]);var bD=wD.Buffer={};for(dD in ID)ID.hasOwnProperty(dD)&&"allocUnsafe"!==dD&&"allocUnsafeSlow"!==dD&&(bD[dD]=ID[dD]);if(wD.Buffer.prototype=ID.prototype,bD.from&&bD.from!==Uint8Array.from||(bD.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return ID(e,t,n)}),bD.alloc||(bD.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=ID(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!wD.kStringMaxLength)try{wD.kStringMaxLength=gu.binding("buffer").kStringMaxLength}catch(e){}wD.constants||(wD.constants={MAX_LENGTH:wD.kMaxLength},wD.kStringMaxLength&&(wD.constants.MAX_STRING_LENGTH=wD.kStringMaxLength));var BD=wD,ED={};const CD=Ow.exports;function SD(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function xD(e,t){this.path=e,this.rethrow(t)}ED.Reporter=SD,SD.prototype.isError=function(e){return e instanceof xD},SD.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},SD.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},SD.prototype.enterKey=function(e){return this._reporterState.path.push(e)},SD.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},SD.prototype.leaveKey=function(e,t,n){const r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[t]=n)},SD.prototype.path=function(){return this._reporterState.path.join("/")},SD.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},SD.prototype.leaveObject=function(e){const t=this._reporterState,n=t.obj;return t.obj=e,n},SD.prototype.error=function(e){let t;const n=this._reporterState,r=e instanceof xD;if(t=r?e:new xD(n.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!n.options.partial)throw t;return r||n.errors.push(t),t},SD.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},CD(xD,Error),xD.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,xD),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this};var QD={};const kD=Ow.exports,_D=ED.Reporter,ND=BD.Buffer;function DD(e,t){_D.call(this,t),ND.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function FD(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return FD.isEncoderBuffer(e)||(e=new FD(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=ND.byteLength(e);else{if(!ND.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}kD(DD,_D),QD.DecoderBuffer=DD,DD.isDecoderBuffer=function(e){return e instanceof DD||"object"==typeof e&&ND.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},DD.prototype.save=function(){return{offset:this.offset,reporter:_D.prototype.save.call(this)}},DD.prototype.restore=function(e){const t=new DD(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,_D.prototype.restore.call(this,e.reporter),t},DD.prototype.isEmpty=function(){return this.offset===this.length},DD.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},DD.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const n=new DD(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},DD.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},QD.EncoderBuffer=FD,FD.isEncoderBuffer=function(e){return e instanceof FD||"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},FD.prototype.join=function(e,t){return e||(e=ND.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(n){n.join(e,t),t+=n.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):ND.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e};const PD=ED.Reporter,UD=QD.EncoderBuffer,MD=QD.DecoderBuffer,LD=Ew,TD=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],RD=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(TD);function OD(e,t,n){const r={};this._baseState=r,r.name=n,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}var HD=OD;const KD=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];OD.prototype.clone=function(){const e=this._baseState,t={};KD.forEach((function(n){t[n]=e[n]}));const n=new this.constructor(t.parent);return n._baseState=t,n},OD.prototype._wrap=function(){const e=this._baseState;RD.forEach((function(t){this[t]=function(){const n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}}),this)},OD.prototype._init=function(e){const t=this._baseState;LD(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),LD.equal(t.children.length,1,"Root node can have only one child")},OD.prototype._useArgs=function(e){const t=this._baseState,n=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==n.length&&(LD(null===t.children),t.children=n,n.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(LD(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(n){n==(0|n)&&(n|=0);const r=e[n];t[r]=n})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){OD.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),TD.forEach((function(e){OD.prototype[e]=function(){const t=this._baseState,n=Array.prototype.slice.call(arguments);return LD(null===t.tag),t.tag=e,this._useArgs(n),this}})),OD.prototype.use=function(e){LD(e);const t=this._baseState;return LD(null===t.use),t.use=e,this},OD.prototype.optional=function(){return this._baseState.optional=!0,this},OD.prototype.def=function(e){const t=this._baseState;return LD(null===t.default),t.default=e,t.optional=!0,this},OD.prototype.explicit=function(e){const t=this._baseState;return LD(null===t.explicit&&null===t.implicit),t.explicit=e,this},OD.prototype.implicit=function(e){const t=this._baseState;return LD(null===t.explicit&&null===t.implicit),t.implicit=e,this},OD.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},OD.prototype.key=function(e){const t=this._baseState;return LD(null===t.key),t.key=e,this},OD.prototype.any=function(){return this._baseState.any=!0,this},OD.prototype.choice=function(e){const t=this._baseState;return LD(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},OD.prototype.contains=function(e){const t=this._baseState;return LD(null===t.use),t.contains=e,this},OD.prototype._decode=function(e,t){const n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));let r,i=n.default,o=!0,a=null;if(null!==n.key&&(a=e.enterKey(n.key)),n.optional){let r=null;if(null!==n.explicit?r=n.explicit:null!==n.implicit?r=n.implicit:null!==n.tag&&(r=n.tag),null!==r||n.any){if(o=this._peekTag(e,r,n.any),e.isError(o))return o}else{const r=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(r)}}if(n.obj&&o&&(r=e.enterObject()),o){if(null!==n.explicit){const t=this._decodeTag(e,n.explicit);if(e.isError(t))return t;e=t}const r=e.offset;if(null===n.use&&null===n.choice){let t;n.any&&(t=e.save());const r=this._decodeTag(e,null!==n.implicit?n.implicit:n.tag,n.any);if(e.isError(r))return r;n.any?i=e.raw(t):e=r}if(t&&t.track&&null!==n.tag&&t.track(e.path(),r,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(e,t)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const r=new MD(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(r,t)}}return n.obj&&o&&(i=e.leaveObject(r)),null===n.key||null===i&&!0!==o?null!==a&&e.exitKey(a):e.leaveKey(a,n.key,i),i},OD.prototype._decodeGeneric=function(e,t,n){const r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},OD.prototype._getUse=function(e,t){const n=this._baseState;return n.useDecoder=this._use(e,t),LD(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},OD.prototype._decodeChoice=function(e,t){const n=this._baseState;let r=null,i=!1;return Object.keys(n.choice).some((function(o){const a=e.save(),s=n.choice[o];try{const n=s._decode(e,t);if(e.isError(n))return!1;r={type:o,value:n},i=!0}catch(t){return e.restore(a),!1}return!0}),this),i?r:e.error("Choice not matched")},OD.prototype._createEncoderBuffer=function(e){return new UD(e,this.reporter)},OD.prototype._encode=function(e,t,n){const r=this._baseState;if(null!==r.default&&r.default===e)return;const i=this._encodeValue(e,t,n);return void 0===i||this._skipDefault(i,t,n)?void 0:i},OD.prototype._encodeValue=function(e,t,n){const r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new PD);let i=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}let o=null,a=!1;if(r.any)i=this._createEncoderBuffer(e);else if(r.choice)i=this._encodeChoice(e,t);else if(r.contains)o=this._getUse(r.contains,n)._encode(e,t),a=!0;else if(r.children)o=r.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");const r=t.enterKey(n._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i}),this).filter((function(e){return e})),o=this._createEncoderBuffer(o);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,o=this._createEncoderBuffer(e.map((function(n){const r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)}),n))}else null!==r.use?i=this._getUse(r.use,n)._encode(e,t):(o=this._encodePrimitive(r.tag,e),a=!0);if(!r.any&&null===r.choice){const e=null!==r.implicit?r.implicit:r.tag,n=null===r.implicit?"universal":"context";null===e?null===r.use&&t.error("Tag could be omitted only for .use()"):null===r.use&&(i=this._encodeComposite(e,a,n,o))}return null!==r.explicit&&(i=this._encodeComposite(r.explicit,!1,"context",i)),i},OD.prototype._encodeChoice=function(e,t){const n=this._baseState,r=n.choice[e.type];return r||LD(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},OD.prototype._encodePrimitive=function(e,t){const n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},OD.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},OD.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var jD={};!function(e){function t(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const r=e[n];t[r]=n})),t}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t(e.tag)}(jD);const GD=Ow.exports,qD=BD.Buffer,VD=HD,zD=jD;function JD(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new XD,this.tree._init(e.body)}var YD=JD;function XD(e){VD.call(this,"der",e)}function WD(e){return e<10?"0"+e:e}JD.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},GD(XD,VD),XD.prototype._encodeComposite=function(e,t,n,r){const i=function(e,t,n,r){let i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),zD.tagByName.hasOwnProperty(e))i=zD.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return r.error("Unknown tag: "+e);i=e}return i>=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=zD.tagClassByName[n||"universal"]<<6,i)}(e,t,n,this.reporter);if(r.length<128){const e=qD.alloc(2);return e[0]=i,e[1]=r.length,this._createEncoderBuffer([e,r])}let o=1;for(let e=r.length;e>=256;e>>=8)o++;const a=qD.alloc(2+o);a[0]=i,a[1]=128|o;for(let e=1+o,t=r.length;t>0;e--,t>>=8)a[e]=255&t;return this._createEncoderBuffer([a,r])},XD.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=qD.alloc(2*e.length);for(let n=0;n<e.length;n++)t.writeUInt16BE(e.charCodeAt(n),2*n);return this._createEncoderBuffer(t)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},XD.prototype._encodeObjid=function(e,t,n){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s.]+/g);for(let t=0;t<e.length;t++)e[t]|=0}else if(Array.isArray(e)){e=e.slice();for(let t=0;t<e.length;t++)e[t]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!n){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let r=0;for(let t=0;t<e.length;t++){let n=e[t];for(r++;n>=128;n>>=7)r++}const i=qD.alloc(r);let o=i.length-1;for(let t=e.length-1;t>=0;t--){let n=e[t];for(i[o--]=127&n;(n>>=7)>0;)i[o--]=128|127&n}return this._createEncoderBuffer(i)},XD.prototype._encodeTime=function(e,t){let n;const r=new Date(e);return"gentime"===t?n=[WD(r.getUTCFullYear()),WD(r.getUTCMonth()+1),WD(r.getUTCDate()),WD(r.getUTCHours()),WD(r.getUTCMinutes()),WD(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[WD(r.getUTCFullYear()%100),WD(r.getUTCMonth()+1),WD(r.getUTCDate()),WD(r.getUTCHours()),WD(r.getUTCMinutes()),WD(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},XD.prototype._encodeNull=function(){return this._createEncoderBuffer("")},XD.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!qD.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=qD.from(t)}if(qD.isBuffer(e)){let t=e.length;0===e.length&&t++;const n=qD.alloc(t);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let t=e;t>=256;t>>=8)n++;const r=new Array(n);for(let t=r.length-1;t>=0;t--)r[t]=255&e,e>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(qD.from(r))},XD.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},XD.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},XD.prototype._skipDefault=function(e,t,n){const r=this._baseState;let i;if(null===r.default)return!1;const o=e.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,t,n).join()),o.length!==r.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==r.defaultBuffer[i])return!1;return!0};const ZD=Ow.exports,$D=YD;function eF(e){$D.call(this,e),this.enc="pem"}ZD(eF,$D);var tF=eF;eF.prototype.encode=function(e,t){const n=$D.prototype.encode.call(this,e).toString("base64"),r=["-----BEGIN "+t.label+"-----"];for(let e=0;e<n.length;e+=64)r.push(n.slice(e,e+64));return r.push("-----END "+t.label+"-----"),r.join("\n")},function(e){const t=e;t.der=YD,t.pem=tF}(mD);var nF={};const rF=Ow.exports,iF=Bw.exports,oF=QD.DecoderBuffer,aF=HD,sF=jD;function lF(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new AF,this.tree._init(e.body)}var uF=lF;function AF(e){aF.call(this,"der",e)}function cF(e,t){let n=e.readUInt8(t);if(e.isError(n))return n;const r=sF.tagClass[n>>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:sF.tag[n]}}function hF(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;t<i;t++){r<<=8;const t=e.readUInt8(n);if(e.isError(t))return t;r|=t}return r}lF.prototype.decode=function(e,t){return oF.isDecoderBuffer(e)||(e=new oF(e,t)),this.tree._decode(e,t)},rF(AF,aF),AF.prototype._peekTag=function(e,t,n){if(e.isEmpty())return!1;const r=e.save(),i=cF(e,'Failed to peek tag: "'+t+'"');return e.isError(i)?i:(e.restore(r),i.tag===t||i.tagStr===t||i.tagStr+"of"===t||n)},AF.prototype._decodeTag=function(e,t,n){const r=cF(e,'Failed to decode tag of "'+t+'"');if(e.isError(r))return r;let i=hF(e,r.primitive,'Failed to get length of "'+t+'"');if(e.isError(i))return i;if(!n&&r.tag!==t&&r.tagStr!==t&&r.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(r.primitive||null!==i)return e.skip(i,'Failed to match body of: "'+t+'"');const o=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(i=e.offset-o.offset,e.restore(o),e.skip(i,'Failed to match body of: "'+t+'"'))},AF.prototype._skipUntilEnd=function(e,t){for(;;){const n=cF(e,t);if(e.isError(n))return n;const r=hF(e,n.primitive,t);if(e.isError(r))return r;let i;if(i=n.primitive||null!==r?e.skip(r):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===n.tagStr)break}},AF.prototype._decodeList=function(e,t,n,r){const i=[];for(;!e.isEmpty();){const t=this._peekTag(e,"end");if(e.isError(t))return t;const o=n.decode(e,"der",r);if(e.isError(o)&&t)break;i.push(o)}return i},AF.prototype._decodeStr=function(e,t){if("bitstr"===t){const t=e.readUInt8();return e.isError(t)?t:{unused:t,data:e.raw()}}if("bmpstr"===t){const t=e.raw();if(t.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");let n="";for(let e=0;e<t.length/2;e++)n+=String.fromCharCode(t.readUInt16BE(2*e));return n}if("numstr"===t){const t=e.raw().toString("ascii");return this._isNumstr(t)?t:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){const t=e.raw().toString("ascii");return this._isPrintstr(t)?t:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},AF.prototype._decodeObjid=function(e,t,n){let r;const i=[];let o=0,a=0;for(;!e.isEmpty();)a=e.readUInt8(),o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0);128&a&&i.push(o);const s=i[0]/40|0,l=i[0]%40;if(r=n?i:[s,l].concat(i.slice(1)),t){let e=t[r.join(" ")];void 0===e&&(e=t[r.join(".")]),void 0!==e&&(r=e)}return r},AF.prototype._decodeTime=function(e,t){const n=e.raw().toString();let r,i,o,a,s,l;if("gentime"===t)r=0|n.slice(0,4),i=0|n.slice(4,6),o=0|n.slice(6,8),a=0|n.slice(8,10),s=0|n.slice(10,12),l=0|n.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");r=0|n.slice(0,2),i=0|n.slice(2,4),o=0|n.slice(4,6),a=0|n.slice(6,8),s=0|n.slice(8,10),l=0|n.slice(10,12),r=r<70?2e3+r:1900+r}return Date.UTC(r,i-1,o,a,s,l,0)},AF.prototype._decodeNull=function(){return null},AF.prototype._decodeBool=function(e){const t=e.readUInt8();return e.isError(t)?t:0!==t},AF.prototype._decodeInt=function(e,t){const n=e.raw();let r=new iF(n);return t&&(r=t[r.toString(10)]||r),r},AF.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree};const fF=Ow.exports,dF=BD.Buffer,pF=uF;function gF(e){pF.call(this,e),this.enc="pem"}fF(gF,pF);var yF=gF;gF.prototype.decode=function(e,t){const n=e.toString().split(/[\r\n]+/g),r=t.label.toUpperCase(),i=/^-----(BEGIN|END) ([^-]+)-----$/;let o=-1,a=-1;for(let e=0;e<n.length;e++){const t=n[e].match(i);if(null!==t&&t[2]===r){if(-1!==o){if("END"!==t[1])break;a=e;break}if("BEGIN"!==t[1])break;o=e}}if(-1===o||-1===a)throw new Error("PEM section not found for: "+r);const s=n.slice(o+1,a).join("");s.replace(/[^a-z0-9+/=]+/gi,"");const l=dF.from(s,"base64");return pF.prototype.decode.call(this,l,t)},function(e){const t=e;t.der=uF,t.pem=yF}(nF),function(e){const t=mD,n=nF,r=Ow.exports;function i(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}e.define=function(e,t){return new i(e,t)},i.prototype._createNamed=function(e){const t=this.name;function n(e){this._initNamed(e,t)}return r(n,e),n.prototype._initNamed=function(t,n){e.call(this,t,n)},new n(this)},i.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n[e])),this.decoders[e]},i.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},i.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(t[e])),this.encoders[e]},i.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}}(yD);var mF={};!function(e){const t=mF;t.Reporter=ED.Reporter,t.DecoderBuffer=QD.DecoderBuffer,t.EncoderBuffer=QD.EncoderBuffer,t.Node=HD}();var vF={};!function(e){const t=e;t._reverse=function(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const r=e[n];t[r]=n})),t},t.der=jD}(vF),function(e){const t=gD;t.bignum=Bw.exports,t.define=yD.define,t.base=mF,t.constants=vF,t.decoders=nF,t.encoders=mD}();var IF={exports:{}},wF={},bF={};Object.defineProperty(bF,"__esModule",{value:!0}),bF.default=function(e){var t=e.length,n=t%4;if(!n)return e;var r=t,i=4-n,o=t+i,a=ao.alloc(o);for(a.write(e);i--;)a.write("=",r++);return a.toString()},Object.defineProperty(wF,"__esModule",{value:!0});var BF=bF;function EF(e,t){return void 0===t&&(t="utf8"),jo(e)?SF(e.toString("base64")):SF(ao.from(e,t).toString("base64"))}function CF(e){return e=e.toString(),BF.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function SF(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var xF=EF;xF.encode=EF,xF.decode=function(e,t){return void 0===t&&(t="utf8"),ao.from(CF(e),"base64").toString(t)},xF.toBase64=CF,xF.fromBase64=SF,xF.toBuffer=function(e){return ao.from(CF(e),"base64")},wF.default=xF,function(e){e.exports=wF.default,e.exports.default=e.exports}(IF);var QF=IF.exports;const kF=gD,_F=IF.exports;var NF=class{static convert(e,t,n){if(!e)return;if(t===n)return e;let r;if("raw"===t||e instanceof ao)r=e;else if("uint8_array"===t||Array.isArray(e))r=ao.from(e);else if("hex"===t)r=ao.from(e,"hex");else if("base64"===t)r=ao.from(e,"base64");else if("base64url"===t)r=_F.toBuffer(e);else{if("bn"!==t&&"bignum"!==t)throw new Error("Invalid fromType");r=ao.from(this.pad(e.toString(16)),"hex")}if("raw"===n)return r;if("uint8_array"===n)return Array.from(r);if("hex"===n)return r.toString("hex");if("base64"===n)return r.toString("base64");if("base64url"===n)return _F.fromBase64(r.toString("base64"));if("bn"===n||"bignum"===n)return new kF.bignum(r);throw new Error("Invalid toType")}static pad(e){return e.length%2==1?`0${e}`:e}};const DF=gD;const FF=new class{constructor(){Object.defineProperty(this,"_registry",{value:{}})}get registry(){return this._registry}define(e,t){this._registry[e]=DF.define(e,t(this))}normalize(e){return this.registry[e]}};FF.define("Version",(e=>function(){this.int({0:"two-prime",1:"multi"})})),FF.define("OtherPrimeInfos",(e=>function(){this.seq().obj(this.key("ri").int(),this.key("di").int(),this.key("ti").int())})),FF.define("AlgorithmIdentifier",(e=>function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())})),FF.define("PrivateKeyInfo",(e=>{let t=e.normalize("Version"),n=e.normalize("AlgorithmIdentifier");return function(){this.seq().obj(this.key("version").use(t),this.key("algorithm").use(n),this.key("privateKey").octstr())}})),FF.define("PublicKeyInfo",(e=>{let t=e.normalize("AlgorithmIdentifier");return function(){this.seq().obj(this.key("algorithm").use(t),this.key("publicKey").bitstr())}})),FF.define("RSAPrivateKey",(e=>{let t=e.normalize("Version"),n=e.normalize("OtherPrimeInfos");return function(){this.seq().obj(this.key("version").use(t),this.key("n").int(),this.key("e").int(),this.key("d").int(),this.key("p").int(),this.key("q").int(),this.key("dp").int(),this.key("dq").int(),this.key("qi").int(),this.key("other").optional().use(n))}})),FF.define("RSAPublicKey",(e=>function(){this.seq().obj(this.key("n").int(),this.key("e").int())})),FF.define("ECPrivateKey",(e=>function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().choice({namedCurve:this.objid()}),this.key("publicKey").explicit(1).optional().bitstr())}));var PF=FF;const UF=pD,MF=NF,LF=PF;class TF extends UF{fromPrivatePKCS1(e){let t=LF.normalize("RSAPrivateKey"),{n:n,e:r,d:i,p:o,q:a,dp:s,dq:l,qi:u}=t.decode(e,"der");return{n:MF.convert(n,"bn","raw"),e:MF.convert(r,"bn","raw"),d:MF.convert(i,"bn","raw"),p:MF.convert(o,"bn","raw"),q:MF.convert(a,"bn","raw"),dp:MF.convert(s,"bn","raw"),dq:MF.convert(l,"bn","raw"),qi:MF.convert(u,"bn","raw")}}fromPrivatePKCS8(e){let t=LF.normalize("PrivateKeyInfo"),n=LF.normalize("RSAPrivateKey"),r=t.decode(e,"der"),{n:i,e:o,d:a,p:s,q:l,dp:u,dq:A,qi:c}=n.decode(r.privateKey,"der");return{n:MF.convert(i,"bn","raw"),e:MF.convert(o,"bn","raw"),d:MF.convert(a,"bn","raw"),p:MF.convert(s,"bn","raw"),q:MF.convert(l,"bn","raw"),dp:MF.convert(u,"bn","raw"),dq:MF.convert(A,"bn","raw"),qi:MF.convert(c,"bn","raw")}}fromPublicPKCS1(e){let t=LF.normalize("RSAPublicKey"),{n:n,e:r}=t.decode(e,"der");return{n:MF.convert(n,"bn","raw"),e:MF.convert(r,"bn","raw")}}fromPublicPKCS8(e){let t=LF.normalize("PublicKeyInfo"),n=LF.normalize("RSAPublicKey"),r=t.decode(e,"der"),{n:i,e:o}=n.decode(r.publicKey.data,"der");return{n:MF.convert(i,"bn","raw"),e:MF.convert(o,"bn","raw")}}fromJwk(e){let{n:t,e:n,d:r,p:i,q:o,dp:a,dq:s,qi:l,alg:u}=e;return{n:MF.convert(t,"base64url","raw"),e:MF.convert(n,"base64url","raw"),d:MF.convert(r,"base64url","raw"),p:MF.convert(i,"base64url","raw"),q:MF.convert(o,"base64url","raw"),dp:MF.convert(a,"base64url","raw"),dq:MF.convert(s,"base64url","raw"),qi:MF.convert(l,"base64url","raw")}}toPrivatePKCS1(e){let{n:t,e:n,d:r,p:i,q:o,dp:a,dq:s,qi:l}=e,{version:u}=this.params,A=LF.normalize("RSAPrivateKey").encode({version:u,n:MF.convert(t,"raw","bn"),e:MF.convert(n,"raw","bn"),d:MF.convert(r,"raw","bn"),p:MF.convert(i,"raw","bn"),q:MF.convert(o,"raw","bn"),dp:MF.convert(a,"raw","bn"),dq:MF.convert(s,"raw","bn"),qi:MF.convert(l,"raw","bn")},"der").toString("base64");return TF.formatPem(A,"RSA PRIVATE")}toPrivatePKCS8(e){let{n:t,e:n,d:r,p:i,q:o,dp:a,dq:s,qi:l}=e,{oid:u,algParameters:A,version:c}=this.params,h=LF.normalize("PrivateKeyInfo"),f=LF.normalize("RSAPrivateKey").encode({version:c,n:MF.convert(t,"raw","bn"),e:MF.convert(n,"raw","bn"),d:MF.convert(r,"raw","bn"),p:MF.convert(i,"raw","bn"),q:MF.convert(o,"raw","bn"),dp:MF.convert(a,"raw","bn"),dq:MF.convert(s,"raw","bn"),qi:MF.convert(l,"raw","bn")},"der"),d=h.encode({version:c,algorithm:{algorithm:u.split("."),parameters:ao.from(A,"hex")},privateKey:f},"der").toString("base64");return TF.formatPem(d,"PRIVATE")}toPublicPKCS1(e){let{n:t,e:n}=e,{version:r}=this.params,i=LF.normalize("RSAPublicKey").encode({version:r,n:MF.convert(t,"raw","bn"),e:MF.convert(n,"raw","bn")},"der").toString("base64");return TF.formatPem(i,"RSA PUBLIC")}toPublicPKCS8(e){let{n:t,e:n}=e,{oid:r,algParameters:i}=this.params,o=LF.normalize("PublicKeyInfo"),a=LF.normalize("RSAPublicKey").encode({n:MF.convert(t,"raw","bn"),e:MF.convert(n,"raw","bn")},"der"),s=o.encode({algorithm:{algorithm:r.split("."),parameters:ao.from(i,"hex")},publicKey:{unused:0,data:a}},"der").toString("base64");return TF.formatPem(s,"PUBLIC")}toPrivateJwk(e){let{n:t,e:n,d:r,p:i,q:o,dp:a,dq:s,qi:l}=e,{kty:u}=this.params;return{kty:u,n:MF.convert(t,"raw","base64url"),e:MF.convert(n,"raw","base64url"),d:MF.convert(r,"raw","base64url"),p:MF.convert(i,"raw","base64url"),q:MF.convert(o,"raw","base64url"),dp:MF.convert(a,"raw","base64url"),dq:MF.convert(s,"raw","base64url"),qi:MF.convert(l,"raw","base64url")}}toPublicJwk(e){let{n:t,e:n}=e,{kty:r}=this.params;return{kty:r,n:MF.convert(t,"raw","base64url"),e:MF.convert(n,"raw","base64url")}}}var RF=TF;const OF=new ww.ec("secp256k1"),HF=pD,KF=NF,jF=PF;class GF extends HF{fromPrivatePKCS1(e){let t=jF.normalize("ECPrivateKey").decode(e,"der"),{privateKey:n,publicKey:{data:r}}=t,i=KF.convert(r,"raw","hex"),{x:o,y:a}=GF.getPoint(i);return{d:n,x:o,y:a}}fromPrivatePKCS8(e){let t=jF.normalize("PrivateKeyInfo"),n=jF.normalize("ECPrivateKey"),r=t.decode(e,"der"),i=n.decode(r.privateKey,"der"),{privateKey:o,publicKey:{data:a}}=i,s=KF.convert(a,"raw","hex"),{x:l,y:u}=GF.getPoint(s);return{d:o,x:l,y:u}}fromPublicPKCS8(e){let t=jF.normalize("PublicKeyInfo").decode(e,"der"),n=KF.convert(t.publicKey.data,"raw","hex");return GF.getPoint(n)}fromPrivateBlk(e){let t=OF.keyFromPrivate(e,"hex"),n=t.getPublic();return{d:KF.convert(t.priv,"bn","raw"),x:KF.convert(n.getX(),"bn","raw"),y:KF.convert(n.getY(),"bn","raw")}}fromPublicBlk(e){return GF.getPoint(e)}fromJwk(e){let{d:t,x:n,y:r}=e;return{d:KF.convert(t,"base64url","raw"),x:KF.convert(n,"base64url","raw"),y:KF.convert(r,"base64url","raw")}}toPrivatePKCS1(e){let{namedCurve:t,keyVersion:n}=this.params,{d:r,x:i,y:o}=e,a=jF.normalize("ECPrivateKey"),s=GF.makePoint(i,o),l=a.encode({version:n,privateKey:r,parameters:{type:"namedCurve",value:t.split(".")},publicKey:{unused:0,data:s}},"der").toString("base64");return GF.formatPem(l,"EC PRIVATE")}toPrivatePKCS8(e){let{oid:t,algParameters:n,keyVersion:r,infoVersion:i}=this.params,{d:o,x:a,y:s}=e,l=jF.normalize("PrivateKeyInfo"),u=jF.normalize("ECPrivateKey"),A=GF.makePoint(a,s),c=u.encode({version:r,privateKey:o,publicKey:{unused:0,data:A}},"der"),h=l.encode({version:i,algorithm:{algorithm:t.split("."),parameters:ao.from(n,"hex")},privateKey:c},"der").toString("base64");return GF.formatPem(h,"PRIVATE")}toPublicPKCS8(e){let{oid:t,algParameters:n}=this.params,{x:r,y:i}=e,o=jF.normalize("PublicKeyInfo"),a=GF.makePoint(r,i),s=o.encode({algorithm:{algorithm:t.split("."),parameters:ao.from(n,"hex")},publicKey:{unused:0,data:a}},"der").toString("base64");return GF.formatPem(s,"PUBLIC")}toPrivateBlk(e){return e.d.toString("hex")}toPublicBlk(e){return KF.convert(GF.makePoint(e.x,e.y),"raw","hex")}toPrivateJwk(e){let{crv:t,kty:n}=this.params,{d:r,x:i,y:o}=e;return{kty:n,crv:t,d:KF.convert(r,"raw","base64url"),x:KF.convert(i,"raw","base64url"),y:KF.convert(o,"raw","base64url")}}toPublicJwk(e){let{crv:t,kty:n}=this.params,{x:r,y:i}=e;return{kty:n,crv:t,x:KF.convert(r,"raw","base64url"),y:KF.convert(i,"raw","base64url")}}static getPoint(e){let t=e.slice(2,(e.length-2)/2+2),n=e.slice((e.length-2)/2+2);return{x:KF.convert(t,"hex","raw"),y:KF.convert(n,"hex","raw")}}static makePoint(e,t){let n=ao.from("04","hex");return ao.concat([n,e,t],n.length+e.length+t.length)}}var qF=GF;const VF=pD,zF=NF,JF=PF;class YF extends VF{fromPrivatePKCS8(e){const t=JF.normalize("PrivateKeyInfo").decode(e,"der").privateKey.slice(2);return{d:t,x:this.publicKeyFromPrivate(t)}}fromPublicPKCS8(e){const t=JF.normalize("PublicKeyInfo").decode(e,"der");return{x:zF.convert(t.publicKey.data,"hex","raw")}}fromJwk(e){let{d:t,x:n}=e;return{d:zF.convert(t,"base64url","raw"),x:zF.convert(n,"base64url","raw")}}toPrivatePKCS8(e){let{oid:t,infoVersion:n}=this.params,{d:r}=e;const i=JF.normalize("PrivateKeyInfo"),o=this.privateKeyPadding(r);let a=i.encode({version:n,algorithm:{algorithm:t.split(".")},privateKey:o},"der").toString("base64");return YF.formatPem(a,"PRIVATE")}toPublicPKCS8(e){let{oid:t}=this.params,{x:n}=e,r=JF.normalize("PublicKeyInfo").encode({algorithm:{algorithm:t.split(".")},publicKey:{unused:0,data:zF.convert(n,"hex","raw")}},"der").toString("base64");return YF.formatPem(r,"PUBLIC")}toPrivateJwk(e){let{crv:t,kty:n}=this.params,{d:r,x:i}=e;return{kty:n,crv:t,d:zF.convert(r,"raw","base64url"),x:zF.convert(i,"raw","base64url")}}toPublicJwk(e){let{crv:t,kty:n}=this.params,{x:r}=e;return{kty:n,crv:t,x:zF.convert(r,"raw","base64url")}}privateKeyPadding(e){let t;if("Ed25519"!==this.params.crv)throw new Error(`${this.params.crv} is an invalid curve for EdDSA`);return t=ao.from("0420","hex"),ao.concat([t,e],t.length+e.length)}publicKeyFromPrivate(e){if("Ed25519"===this.params.crv){const t=new ww.eddsa("ed25519");return ao.from(t.keyFromSecret(e).getPublic())}throw new Error(`${this.params.crv} is an invalid curve for EdDSA`)}}const XF=RF,WF=qF,ZF=YF,$F=new class{constructor(){this.registry=[],this.classes={}}find(e){return this.registry.find(e)}define(e,t){e.forEach((e=>{let{kty:n}=e;if(!n)throw new Error("Invalid type definition");this.classes[n]||(this.classes[n]=t),this.registry.push(e)}))}normalize(e,t,n){let r=this.classes[e],i=this.find((e=>e[t]===n));if(!r||!i)throw new Error("Invalid type");return new r(i)}};$F.define([{kty:"RSA",oid:"1.2.840.113549.1.1.1",algParameters:"0500",version:"two-prime"}],XF),$F.define([{kty:"EC",crv:"K-256",oid:"1.2.840.10045.2.1",namedCurve:"1.3.132.0.10",algParameters:"06052b8104000a",keyVersion:1,infoVersion:"two-prime"},{kty:"EC",crv:"P-256",oid:"1.2.840.10045.2.1",namedCurve:"1.2.840.10045.3.1.7",algParameters:"06082a8648ce3d030107",keyVersion:1,infoVersion:"two-prime"},{kty:"EC",crv:"P-384",oid:"1.2.840.10045.2.1",namedCurve:"1.3.132.0.34",algParameters:"06052b81040022",keyVersion:1,infoVersion:"two-prime"},{kty:"EC",crv:"P-521",oid:"1.2.840.10045.2.1",namedCurve:"1.3.132.0.35",algParameters:"06052b81040023",keyVersion:1,infoVersion:"two-prime"}],WF),$F.define([{kty:"OKP",crv:"Ed25519",oid:"1.3.101.112",infoVersion:"two-prime"}],ZF);const eP=AD,tP=hD,nP=$F,rP=PF,iP=RegExp("\r?\n","g");class oP{constructor(e,t){if(!e)throw new eP("key is required");if(!t)throw new eP("options are required");let{kty:n,format:r,selector:i,crv:o,oid:a}=t;if(!t.kty)throw new eP("options.kty is required");if(!t.format)throw new eP("options.format is required");if(!t.selector)throw new eP("options.selector is required");if(!t.crv&&!t.oid)throw new eP("options.crv or options.oid is required");this.kty=n,this.format=r,this.selector=i,this.crv=o,this.oid=a,this.key=this.parseKey(e)}static from(e,t){if(!e)throw new eP("key is required");if(!t)throw new eP("format is required");if("jwk"===t){let n;if("string"==typeof e)try{n=JSON.parse(e)}catch(e){throw new eP("key is not a valid JWK")}else"object"==typeof e&&(n=e);let r,{kty:i,crv:o}=n;if(!i)throw new eP("kty is required for JWK");if("EC"===i&&!o)throw new eP("crv is required for EC JWK");"RSA"===i&&(r=nP.find((e=>e.kty===i)).oid);let a=n.d?"private":"public";return new oP(n,{kty:i,crv:o,oid:r,format:t,selector:a})}if("pem"===t){if("string"!=typeof e)throw new eP("key is not a valid PEM string");let n=e.split(iP),r=n.splice(0,1);n.splice(n.length-1,1);let i,o,a=n.join(""),s=/^-----BEGIN ((RSA|EC) )?(PUBLIC|PRIVATE) KEY-----$/.exec(r),l=s?s[2]:void 0,u=s?s[3]:void 0,A=ao.from(a,"base64");if(!u)throw new eP("key is not a valid PEM string");if(l){if("RSA"===l)u="PRIVATE"===u?"private_pkcs1":"public_pkcs1",i=nP.find((e=>e.kty===l)).oid;else if("EC"===l){let e;if("PRIVATE"===u){let t=rP.normalize(`${l}PrivateKey`);u="private_pkcs1",e=t.decode(A,"der")}else if("PUBLIC"===u){let t=rP.normalize(`${l}PrivateKey`);u="public_pkcs1",e=t.decode(A,"der")}let{parameters:{value:t}}=e;o=nP.find((e=>e.namedCurve===t.join("."))).crv}}else{let e,t=rP.normalize("PrivateKeyInfo"),n=rP.normalize("PublicKeyInfo");"PRIVATE"===u?(u="private_pkcs8",e=t.decode(A,"der")):"PUBLIC"===u&&(u="public_pkcs8",e=n.decode(A,"der"));let{algorithm:{algorithm:r,parameters:a}}=e;r=r.join("."),a=a?a.toString("hex"):void 0;const s=nP.find((e=>e.oid===r));if(l=s?s.kty:void 0,!l)throw new eP(`${r} is not supported`);"RSA"===l||"OKP"===l?i=r:"EC"===l&&(o=nP.find((e=>e.algParameters===a)).crv)}return new oP(A,{kty:l,oid:i,crv:o,format:t,selector:u})}if("blk"===t)return new oP(e,{kty:"EC",crv:"K-256",format:t,selector:e.length>64?"public":"private"});throw new eP(`Invalid format ${t}`)}get alg(){let{kty:e,crv:t,oid:n}=this;if(!this.algorithm){if(t)Object.defineProperty(this,"algorithm",{value:nP.normalize(e,"crv",t)});else{if(!n)throw new Error("Both crv and oid are undefined");Object.defineProperty(this,"algorithm",{value:nP.normalize(e,"oid",n)})}if(!this.algorithm)throw new Error(`${this.crv||this.oid} is not implemented yet`)}return this.algorithm}parseKey(e){let{alg:t,format:n,selector:r}=this;if("pem"===n)switch(r){case"public_pkcs1":return t.fromPublicPKCS1(e);case"public_pkcs8":return t.fromPublicPKCS8(e);case"private_pkcs1":return t.fromPrivatePKCS1(e);case"private_pkcs8":return t.fromPrivatePKCS8(e);default:throw new Error("Invalid selector value")}if("jwk"===n)return t.fromJwk(e,r);if("blk"===n)switch(r){case"public":return t.fromPublicBlk(e);case"private":return t.fromPrivateBlk(e)}}toJwk(e){let{key:t,alg:n,selector:r}=this;switch(e){case"public":return n.toPublicJwk(t);case"private":if(r.includes("public"))throw new eP("Cannot export a private key from a public key");return n.toPrivateJwk(t);default:throw new Error("Invalid key selector")}}toString(e="pem",t="public_pkcs8"){let{key:n,alg:r,selector:i}=this;if("pem"===e)switch(t){case"public_pkcs1":return r.toPublicPKCS1(n);case"public_pkcs8":return r.toPublicPKCS8(n);case"private_pkcs1":if(i.includes("public"))throw new eP("Cannot export a private key from a public key");return r.toPrivatePKCS1(n);case"private_pkcs8":if(i.includes("public"))throw new eP("Cannot export a private key from a public key");return r.toPrivatePKCS8(n);default:throw new Error("Invalid key selector")}else if("jwk"===e)switch(t){case"public":return JSON.stringify(r.toPublicJwk(n));case"private":if(i.includes("public"))throw new eP("Cannot export a private key from a public key");return JSON.stringify(r.toPrivateJwk(n));default:throw new Error("Invalid key selector")}else if("blk"===e)switch(t){case"private":if(i.includes("public"))throw new eP("Cannot export a private key from a public key");return r.toPrivateBlk(n);case"public":return r.toPublicBlk(n);default:throw new Error("Invalid key selector")}throw new tP}}var aP=oP,sP=U_("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");const lP=ao;var uP={},AP={},cP={};Object.defineProperty(cP,"__esModule",{value:!0}),cP.testnet=cP.regtest=cP.bitcoin=void 0,cP.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},cP.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},cP.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var hP={},fP={},dP={},pP={};Object.defineProperty(pP,"__esModule",{value:!0}),pP.encode=pP.decode=pP.check=void 0,pP.check=function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;const t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;const n=e[5+t];return!(0===n||6+t+n!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||n>1&&0===e[t+6]&&!(128&e[t+7]))},pP.decode=function(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");const t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");const n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}},pP.encode=function(e,t){const n=e.length,r=t.length;if(0===n)throw new Error("R length is zero");if(0===r)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(r>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");const i=ao.allocUnsafe(6+n+r);return i[0]=48,i[1]=i.length-2,i[2]=2,i[3]=e.length,e.copy(i,4),i[4+n]=2,i[5+n]=t.length,t.copy(i,6+n),i};var gP={};Object.defineProperty(gP,"__esModule",{value:!0}),gP.REVERSE_OPS=gP.OPS=void 0;const yP={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};gP.OPS=yP;const mP={};gP.REVERSE_OPS=mP;for(const e of Object.keys(yP))mP[yP[e]]=e;var vP={};Object.defineProperty(vP,"__esModule",{value:!0}),vP.decode=vP.encode=vP.encodingLength=void 0;const IP=gP;function wP(e){return e<IP.OPS.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}vP.encodingLength=wP,vP.encode=function(e,t,n){const r=wP(t);return 1===r?e.writeUInt8(t,n):2===r?(e.writeUInt8(IP.OPS.OP_PUSHDATA1,n),e.writeUInt8(t,n+1)):3===r?(e.writeUInt8(IP.OPS.OP_PUSHDATA2,n),e.writeUInt16LE(t,n+1)):(e.writeUInt8(IP.OPS.OP_PUSHDATA4,n),e.writeUInt32LE(t,n+1)),r},vP.decode=function(e,t){const n=e.readUInt8(t);let r,i;if(n<IP.OPS.OP_PUSHDATA1)r=n,i=1;else if(n===IP.OPS.OP_PUSHDATA1){if(t+2>e.length)return null;r=e.readUInt8(t+1),i=2}else if(n===IP.OPS.OP_PUSHDATA2){if(t+3>e.length)return null;r=e.readUInt16LE(t+1),i=3}else{if(t+5>e.length)return null;if(n!==IP.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=e.readUInt32LE(t+1),i=5}return{opcode:n,number:r,size:i}};var bP={};Object.defineProperty(bP,"__esModule",{value:!0}),bP.encode=bP.decode=void 0,bP.decode=function(e,t,n){t=t||4,n=void 0===n||n;const r=e.length;if(0===r)return 0;if(r>t)throw new TypeError("Script number overflow");if(n&&0==(127&e[r-1])&&(r<=1||0==(128&e[r-2])))throw new Error("Non-minimally encoded script number");if(5===r){const t=e.readUInt32LE(0),n=e.readUInt8(4);return 128&n?-(4294967296*(-129&n)+t):4294967296*n+t}let i=0;for(let t=0;t<r;++t)i|=e[t]<<8*t;return 128&e[r-1]?-(i&~(128<<8*(r-1))):i},bP.encode=function(e){let t=Math.abs(e);const n=(r=t)>2147483647?5:r>8388607?4:r>32767?3:r>127?2:r>0?1:0;var r;const i=ao.allocUnsafe(n),o=e<0;for(let e=0;e<n;++e)i.writeUInt8(255&t,e),t>>=8;return 128&i[n-1]?i.writeUInt8(o?128:0,n-1):o&&(i[n-1]|=128),i};var BP={},EP={},CP={Array:function(e){return null!=e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return null==e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var SP in CP.Null=CP.Nil,CP)CP[SP].toJSON=function(e){return e}.bind(null,SP);var xP=CP,QP=xP;function kP(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function _P(e){return QP.Nil(e)?"":kP(e.constructor)}function NP(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function DP(e){return QP.Function(e)?e.toJSON?e.toJSON():kP(e):QP.Array(e)?"Array":e&&QP.Object(e)?"Object":void 0!==e?e:""}function FP(e,t,n){var r=function(e){return QP.Function(e)?"":QP.String(e)?JSON.stringify(e):e&&QP.Object(e)?"":e}(t);return"Expected "+DP(e)+", got"+(""!==n?" "+n:"")+(""!==r?" "+r:"")}function PP(e,t,n){n=n||_P(t),this.message=FP(e,t,n),NP(this,PP),this.__type=e,this.__value=t,this.__valueTypeName=n}function UP(e,t,n,r,i){e?(i=i||_P(r),this.message=function(e,t,n,r,i){var o='" of type ';return"key"===t&&(o='" with key type '),FP('property "'+DP(n)+o+DP(e),r,i)}(e,n,t,r,i)):this.message='Unexpected property "'+t+'"',NP(this,PP),this.__label=n,this.__property=t,this.__type=e,this.__value=r,this.__valueTypeName=i}PP.prototype=Object.create(Error.prototype),PP.prototype.constructor=PP,UP.prototype=Object.create(Error.prototype),UP.prototype.constructor=PP;var MP={TfTypeError:PP,TfPropertyTypeError:UP,tfCustomError:function(e,t){return new PP(e,{},t)},tfSubError:function(e,t,n){return e instanceof UP?(t=t+"."+e.__property,e=new UP(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof PP&&(e=new UP(e.__type,t,n,e.__value,e.__valueTypeName)),NP(e),e},tfJSON:DP,getValueTypeName:_P},LP=xP,TP=MP;function RP(e){return jo(e)}function OP(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function HP(e,t){var n=e.toJSON();function r(r){if(!e(r))return!1;if(r.length===t)return!0;throw TP.tfCustomError(n+"(Length: "+t+")",n+"(Length: "+r.length+")")}return r.toJSON=function(){return n},r}var KP=HP.bind(null,LP.Array),jP=HP.bind(null,RP),GP=HP.bind(null,OP),qP=HP.bind(null,LP.String),VP=Math.pow(2,53)-1,zP={ArrayN:KP,Buffer:RP,BufferN:jP,Finite:function(e){return"number"==typeof e&&isFinite(e)},Hex:OP,HexN:GP,Int8:function(e){return e<<24>>24===e},Int16:function(e){return e<<16>>16===e},Int32:function(e){return(0|e)===e},Int53:function(e){return"number"==typeof e&&e>=-VP&&e<=VP&&Math.floor(e)===e},Range:function(e,t,n){function r(r,i){return n(r,i)&&r>e&&r<t}return n=n||LP.Number,r.toJSON=function(){return`${n.toJSON()} between [${e}, ${t}]`},r},StringN:qP,UInt8:function(e){return(255&e)===e},UInt16:function(e){return(65535&e)===e},UInt32:function(e){return e>>>0===e},UInt53:function(e){return"number"==typeof e&&e>=0&&e<=VP&&Math.floor(e)===e}};for(var JP in zP)zP[JP].toJSON=function(e){return e}.bind(null,JP);var YP=zP,XP=xP,WP=MP.tfJSON,ZP=MP.TfTypeError,$P=MP.TfPropertyTypeError,eU=MP.tfSubError,tU=MP.getValueTypeName,nU={arrayOf:function(e,t){function n(n,r){return!!XP.Array(n)&&!XP.Nil(n)&&!(void 0!==t.minLength&&n.length<t.minLength)&&!(void 0!==t.maxLength&&n.length>t.maxLength)&&(void 0===t.length||n.length===t.length)&&n.every((function(t,n){try{return iU(e,t,r)}catch(e){throw eU(e,n)}}))}return e=rU(e),t=t||{},n.toJSON=function(){var n="["+WP(e)+"]";return void 0!==t.length?n+="{"+t.length+"}":void 0===t.minLength&&void 0===t.maxLength||(n+="{"+(void 0===t.minLength?0:t.minLength)+","+(void 0===t.maxLength?1/0:t.maxLength)+"}"),n},n},maybe:function e(t){function n(n,r){return XP.Nil(n)||t(n,r,e)}return t=rU(t),n.toJSON=function(){return"?"+WP(t)},n},map:function(e,t){function n(n,r){if(!XP.Object(n))return!1;if(XP.Nil(n))return!1;for(var i in n){try{t&&iU(t,i,r)}catch(e){throw eU(e,i,"key")}try{var o=n[i];iU(e,o,r)}catch(e){throw eU(e,i)}}return!0}return e=rU(e),t&&(t=rU(t)),n.toJSON=t?function(){return"{"+WP(t)+": "+WP(e)+"}"}:function(){return"{"+WP(e)+"}"},n},object:function(e){var t={};for(var n in e)t[n]=rU(e[n]);function r(e,n){if(!XP.Object(e))return!1;if(XP.Nil(e))return!1;var r;try{for(r in t)iU(t[r],e[r],n)}catch(e){throw eU(e,r)}if(n)for(r in e)if(!t[r])throw new $P(void 0,r);return!0}return r.toJSON=function(){return WP(t)},r},anyOf:function(){var e=[].slice.call(arguments).map(rU);function t(t,n){return e.some((function(e){try{return iU(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(WP).join("|")},t},allOf:function(){var e=[].slice.call(arguments).map(rU);function t(t,n){return e.every((function(e){try{return iU(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(WP).join(" & ")},t},quacksLike:function(e){function t(t){return e===tU(t)}return t.toJSON=function(){return e},t},tuple:function(){var e=[].slice.call(arguments).map(rU);function t(t,n){return!XP.Nil(t)&&!XP.Nil(t.length)&&(!n||t.length===e.length)&&e.every((function(e,r){try{return iU(e,t[r],n)}catch(e){throw eU(e,r)}}))}return t.toJSON=function(){return"("+e.map(WP).join(", ")+")"},t},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};function rU(e){if(XP.String(e))return"?"===e[0]?nU.maybe(e.slice(1)):XP[e]||nU.quacksLike(e);if(e&&XP.Object(e)){if(XP.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return nU.arrayOf(e[0])}return nU.object(e)}return XP.Function(e)?e:nU.value(e)}function iU(e,t,n,r){if(XP.Function(e)){if(e(t,n))return!0;throw new ZP(r||e,t)}return iU(rU(e),t,n)}for(var oU in nU.oneOf=nU.anyOf,XP)iU[oU]=XP[oU];for(oU in nU)iU[oU]=nU[oU];var aU=YP;for(oU in aU)iU[oU]=aU[oU];iU.compile=rU,iU.TfTypeError=ZP,iU.TfPropertyTypeError=$P;var sU=iU;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.oneOf=e.Null=e.BufferN=e.Function=e.UInt32=e.UInt8=e.tuple=e.maybe=e.Hex=e.Buffer=e.String=e.Boolean=e.Array=e.Number=e.Hash256bit=e.Hash160bit=e.Buffer256bit=e.Network=e.ECPoint=e.Satoshi=e.Signer=e.BIP32Path=e.UInt31=e.isPoint=e.typeforce=void 0;const t=qo;e.typeforce=sU;const n=t.Buffer.alloc(32,0),r=t.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");e.isPoint=function(e){if(!t.Buffer.isBuffer(e))return!1;if(e.length<33)return!1;const i=e[0],o=e.slice(1,33);if(0===o.compare(n))return!1;if(o.compare(r)>=0)return!1;if((2===i||3===i)&&33===e.length)return!0;const a=e.slice(33);return 0!==a.compare(n)&&!(a.compare(r)>=0)&&4===i&&65===e.length};const i=Math.pow(2,31)-1;function o(t){return e.typeforce.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.UInt31=function(t){return e.typeforce.UInt32(t)&&t<=i},e.BIP32Path=o,o.toJSON=()=>"BIP32 derivation path",e.Signer=function(t){return(e.typeforce.Buffer(t.publicKey)||"function"==typeof t.getPublicKey)&&"function"==typeof t.sign},e.Satoshi=function(t){return e.typeforce.UInt53(t)&&t<=21e14},e.ECPoint=e.typeforce.quacksLike("Point"),e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.Buffer256bit=e.typeforce.BufferN(32),e.Hash160bit=e.typeforce.BufferN(20),e.Hash256bit=e.typeforce.BufferN(32),e.Number=e.typeforce.Number,e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.String=e.typeforce.String,e.Buffer=e.typeforce.Buffer,e.Hex=e.typeforce.Hex,e.maybe=e.typeforce.maybe,e.tuple=e.typeforce.tuple,e.UInt8=e.typeforce.UInt8,e.UInt32=e.typeforce.UInt32,e.Function=e.typeforce.Function,e.BufferN=e.typeforce.BufferN,e.Null=e.typeforce.Null,e.oneOf=e.typeforce.oneOf}(EP),Object.defineProperty(BP,"__esModule",{value:!0}),BP.encode=BP.decode=void 0;const lU=pP,uU=EP,{typeforce:AU}=uU,cU=ao.alloc(1,0);function hU(e){let t=0;for(;0===e[t];)++t;return t===e.length?cU:128&(e=e.slice(t))[0]?ao.concat([cU,e],1+e.length):e}function fU(e){0===e[0]&&(e=e.slice(1));const t=ao.alloc(32,0),n=Math.max(0,32-e.length);return e.copy(t,n),t}BP.decode=function(e){const t=e.readUInt8(e.length-1),n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);const r=lU.decode(e.slice(0,-1)),i=fU(r.r),o=fU(r.s);return{signature:ao.concat([i,o],64),hashType:t}},BP.encode=function(e,t){AU({signature:uU.BufferN(64),hashType:uU.UInt8},{signature:e,hashType:t});const n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);const r=ao.allocUnsafe(1);r.writeUInt8(t,0);const i=hU(e.slice(0,32)),o=hU(e.slice(32,64));return ao.concat([lU.encode(i,o),r])},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.signature=e.number=e.isCanonicalScriptSignature=e.isDefinedHashType=e.isCanonicalPubKey=e.toStack=e.fromASM=e.toASM=e.decompile=e.compile=e.isPushOnly=e.OPS=void 0;const t=pP,n=gP;Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return n.OPS}});const r=vP,i=bP,o=BP,a=EP,{typeforce:s}=a,l=n.OPS.OP_RESERVED;function u(e){return a.Buffer(e)||function(e){return a.Number(e)&&(e===n.OPS.OP_0||e>=n.OPS.OP_1&&e<=n.OPS.OP_16||e===n.OPS.OP_1NEGATE)}(e)}function A(e){return a.Array(e)&&e.every(u)}function c(e){return 0===e.length?n.OPS.OP_0:1===e.length?e[0]>=1&&e[0]<=16?l+e[0]:129===e[0]?n.OPS.OP_1NEGATE:void 0:void 0}function h(e){return jo(e)}function f(e){return jo(e)}function d(e){if(h(e))return e;s(a.Array,e);const t=e.reduce(((e,t)=>f(t)?1===t.length&&void 0!==c(t)?e+1:e+r.encodingLength(t.length)+t.length:e+1),0),n=ao.allocUnsafe(t);let i=0;if(e.forEach((e=>{if(f(e)){const t=c(e);if(void 0!==t)return n.writeUInt8(t,i),void(i+=1);i+=r.encode(n,e.length,i),e.copy(n,i),i+=e.length}else n.writeUInt8(e,i),i+=1})),i!==n.length)throw new Error("Could not decode chunks");return n}function p(e){if(t=e,a.Array(t))return e;var t;s(a.Buffer,e);const i=[];let o=0;for(;o<e.length;){const t=e[o];if(t>n.OPS.OP_0&&t<=n.OPS.OP_PUSHDATA4){const t=r.decode(e,o);if(null===t)return null;if(o+=t.size,o+t.number>e.length)return null;const n=e.slice(o,o+t.number);o+=t.number;const a=c(n);void 0!==a?i.push(a):i.push(n)}else i.push(t),o+=1}return i}function g(e){const t=-129&e;return t>0&&t<4}e.isPushOnly=A,e.compile=d,e.decompile=p,e.toASM=function(e){return h(e)&&(e=p(e)),e.map((e=>{if(f(e)){const t=c(e);if(void 0===t)return e.toString("hex");e=t}return n.REVERSE_OPS[e]})).join(" ")},e.fromASM=function(e){return s(a.String,e),d(e.split(" ").map((e=>void 0!==n.OPS[e]?n.OPS[e]:(s(a.Hex,e),ao.from(e,"hex")))))},e.toStack=function(e){return e=p(e),s(A,e),e.map((e=>f(e)?e:e===n.OPS.OP_0?ao.allocUnsafe(0):i.encode(e-l)))},e.isCanonicalPubKey=function(e){return a.isPoint(e)},e.isDefinedHashType=g,e.isCanonicalScriptSignature=function(e){return!!jo(e)&&!!g(e[e.length-1])&&t.check(e.slice(0,-1))},e.number=i,e.signature=o}(dP);var dU={};Object.defineProperty(dU,"__esModule",{value:!0}),dU.value=dU.prop=void 0,dU.prop=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=n.call(this);return this[t]=e,e},set(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})},dU.value=function(e){let t;return()=>(void 0!==t||(t=e()),t)},Object.defineProperty(fP,"__esModule",{value:!0}),fP.p2data=void 0;const pU=cP,gU=dP,yU=EP,mU=dU,vU=gU.OPS;fP.p2data=function(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,yU.typeforce)({network:yU.typeforce.maybe(yU.typeforce.Object),output:yU.typeforce.maybe(yU.typeforce.Buffer),data:yU.typeforce.maybe(yU.typeforce.arrayOf(yU.typeforce.Buffer))},e);const n={name:"embed",network:e.network||pU.bitcoin};if(mU.prop(n,"output",(()=>{if(e.data)return gU.compile([vU.OP_RETURN].concat(e.data))})),mU.prop(n,"data",(()=>{if(e.output)return gU.decompile(e.output).slice(1)})),t.validate&&e.output){const t=gU.decompile(e.output);if(t[0]!==vU.OP_RETURN)throw new TypeError("Output is invalid");if(!t.slice(1).every(yU.typeforce.Buffer))throw new TypeError("Output is invalid");if(e.data&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.data,n.data))throw new TypeError("Data mismatch")}return Object.assign(n,e)};var IU={};Object.defineProperty(IU,"__esModule",{value:!0}),IU.p2ms=void 0;const wU=cP,bU=dP,BU=EP,EU=dU,CU=bU.OPS,SU=CU.OP_RESERVED;function xU(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}IU.p2ms=function(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function n(e){return bU.isCanonicalScriptSignature(e)||void 0!==(t.allowIncomplete&&e===CU.OP_0)}t=Object.assign({validate:!0},t||{}),(0,BU.typeforce)({network:BU.typeforce.maybe(BU.typeforce.Object),m:BU.typeforce.maybe(BU.typeforce.Number),n:BU.typeforce.maybe(BU.typeforce.Number),output:BU.typeforce.maybe(BU.typeforce.Buffer),pubkeys:BU.typeforce.maybe(BU.typeforce.arrayOf(BU.isPoint)),signatures:BU.typeforce.maybe(BU.typeforce.arrayOf(n)),input:BU.typeforce.maybe(BU.typeforce.Buffer)},e);const r={network:e.network||wU.bitcoin};let i=[],o=!1;function a(e){o||(o=!0,i=bU.decompile(e),r.m=i[0]-SU,r.n=i[i.length-2]-SU,r.pubkeys=i.slice(1,-2))}if(EU.prop(r,"output",(()=>{if(e.m&&r.n&&e.pubkeys)return bU.compile([].concat(SU+e.m,e.pubkeys,SU+r.n,CU.OP_CHECKMULTISIG))})),EU.prop(r,"m",(()=>{if(r.output)return a(r.output),r.m})),EU.prop(r,"n",(()=>{if(r.pubkeys)return r.pubkeys.length})),EU.prop(r,"pubkeys",(()=>{if(e.output)return a(e.output),r.pubkeys})),EU.prop(r,"signatures",(()=>{if(e.input)return bU.decompile(e.input).slice(1)})),EU.prop(r,"input",(()=>{if(e.signatures)return bU.compile([CU.OP_0].concat(e.signatures))})),EU.prop(r,"witness",(()=>{if(r.input)return[]})),EU.prop(r,"name",(()=>{if(r.m&&r.n)return`p2ms(${r.m} of ${r.n})`})),t.validate){if(e.output){if(a(e.output),!BU.typeforce.Number(i[0]))throw new TypeError("Output is invalid");if(!BU.typeforce.Number(i[i.length-2]))throw new TypeError("Output is invalid");if(i[i.length-1]!==CU.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(r.m<=0||r.n>16||r.m>r.n||r.n!==i.length-3)throw new TypeError("Output is invalid");if(!r.pubkeys.every((e=>(0,BU.isPoint)(e))))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==r.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==r.n)throw new TypeError("n mismatch");if(e.pubkeys&&!xU(e.pubkeys,r.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(r.n=e.pubkeys.length,r.n<r.m)throw new TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<r.m)throw new TypeError("Not enough signatures provided");if(e.signatures.length>r.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==CU.OP_0)throw new TypeError("Input is invalid");if(0===r.signatures.length||!r.signatures.every(n))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!xU(e.signatures,r.signatures))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(r,e)};var QU={};Object.defineProperty(QU,"__esModule",{value:!0}),QU.p2pk=void 0;const kU=cP,_U=dP,NU=EP,DU=dU,FU=_U.OPS;QU.p2pk=function(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,NU.typeforce)({network:NU.typeforce.maybe(NU.typeforce.Object),output:NU.typeforce.maybe(NU.typeforce.Buffer),pubkey:NU.typeforce.maybe(NU.isPoint),signature:NU.typeforce.maybe(_U.isCanonicalScriptSignature),input:NU.typeforce.maybe(NU.typeforce.Buffer)},e);const n=DU.value((()=>_U.decompile(e.input))),r={name:"p2pk",network:e.network||kU.bitcoin};if(DU.prop(r,"output",(()=>{if(e.pubkey)return _U.compile([e.pubkey,FU.OP_CHECKSIG])})),DU.prop(r,"pubkey",(()=>{if(e.output)return e.output.slice(1,-1)})),DU.prop(r,"signature",(()=>{if(e.input)return n()[0]})),DU.prop(r,"input",(()=>{if(e.signature)return _U.compile([e.signature])})),DU.prop(r,"witness",(()=>{if(r.input)return[]})),t.validate){if(e.output){if(e.output[e.output.length-1]!==FU.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,NU.isPoint)(r.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(r.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(r.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==n().length)throw new TypeError("Input is invalid");if(!_U.isCanonicalScriptSignature(r.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(r,e)};var PU={},UU={},MU={exports:{}},LU={},TU=ji(sc),RU=TU.EventEmitter;function OU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function HU(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var KU=qo.Buffer,jU=AI.inspect,GU=jU&&jU.custom||"inspect";function qU(e,t,n){KU.prototype.copy.call(e,t,n)}var VU=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t;return t=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return KU.alloc(0);for(var t=KU.allocUnsafe(e>>>0),n=this.head,r=0;n;)qU(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=KU.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,t}},{key:GU,value:function(e,t){return jU(this,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OU(Object(n),!0).forEach((function(t){HU(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OU(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}],t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function zU(e,t){YU(e,t),JU(e)}function JU(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function YU(e,t){e.emit("error",t)}var XU={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ru(YU,this,e)):ru(YU,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?ru(JU,n):(n._writableState.errorEmitted=!0,ru(zU,n,e)):ru(zU,n,e):t?(ru(JU,n),t(e)):ru(JU,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},WU={},ZU={};function $U(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i))||this}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,ZU[e]=r}function eM(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}$U("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),$U("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i,o;if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))o="The ".concat(e," ").concat(r," ").concat(eM(t,"type"));else{var a=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+".".length>e.length)&&-1!==e.indexOf(".",n)}(e)?"property":"argument";o='The "'.concat(e,'" ').concat(a," ").concat(r," ").concat(eM(t,"type"))}return o+". Received type ".concat(typeof n)}),TypeError),$U("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),$U("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),$U("ERR_STREAM_PREMATURE_CLOSE","Premature close"),$U("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),$U("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),$U("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),$U("ERR_STREAM_WRITE_AFTER_END","write after end"),$U("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),$U("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),$U("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),WU.codes=ZU;var tM=WU.codes.ERR_INVALID_OPT_VALUE,nM=function(e,t,n,r){var i=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new tM(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384},rM={},iM=F_.exports.Buffer,oM=iM.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function aM(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(iM.isEncoding===oM||!oM(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=uM,this.end=AM,t=4;break;case"utf8":this.fillLast=lM,t=4;break;case"base64":this.text=cM,this.end=hM,t=3;break;default:return this.write=fM,void(this.end=dM)}this.lastNeed=0,this.lastTotal=0,this.lastChar=iM.allocUnsafe(t)}function sM(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function lM(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function uM(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function AM(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function cM(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function hM(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function fM(e){return e.toString(this.encoding)}function dM(e){return e&&e.length?this.write(e):""}rM.StringDecoder=aM,aM.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},aM.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},aM.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var i=sM(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||-2===i?0:(i=sM(t[r]))>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||-2===i?0:(i=sM(t[r]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},aM.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};var pM=WU.codes.ERR_STREAM_PREMATURE_CLOSE;function gM(){}var yM,mM=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(r||gM);var i=n.readable||!1!==n.readable&&t.readable,o=n.writable||!1!==n.writable&&t.writable,a=function(){t.writable||l()},s=t._writableState&&t._writableState.finished,l=function(){o=!1,s=!0,i||r.call(t)},u=t._readableState&&t._readableState.endEmitted,A=function(){i=!1,u=!0,o||r.call(t)},c=function(e){r.call(t,e)},h=function(){var e;return i&&!u?(t._readableState&&t._readableState.ended||(e=new pM),r.call(t,e)):o&&!s?(t._writableState&&t._writableState.ended||(e=new pM),r.call(t,e)):void 0},f=function(){t.req.on("finish",l)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",l),t.on("abort",h),t.req?f():t.on("request",f)):o&&!t._writableState&&(t.on("end",a),t.on("close",a)),t.on("end",A),t.on("finish",l),!1!==n.error&&t.on("error",c),t.on("close",h),function(){t.removeListener("complete",l),t.removeListener("abort",h),t.removeListener("request",f),t.req&&t.req.removeListener("finish",l),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",l),t.removeListener("end",A),t.removeListener("error",c),t.removeListener("close",h)}};function vM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var IM=mM,wM=Symbol("lastResolve"),bM=Symbol("lastReject"),BM=Symbol("error"),EM=Symbol("ended"),CM=Symbol("lastPromise"),SM=Symbol("handlePromise"),xM=Symbol("stream");function QM(e,t){return{value:e,done:t}}function kM(e){var t=e[wM];if(null!==t){var n=e[xM].read();null!==n&&(e[CM]=null,e[wM]=null,e[bM]=null,t(QM(n,!1)))}}function _M(e){ru(kM,e)}var NM=Object.getPrototypeOf((function(){})),DM=Object.setPrototypeOf((yM={get stream(){return this[xM]},next:function(){var e=this,t=this[BM];if(null!==t)return Promise.reject(t);if(this[EM])return Promise.resolve(QM(void 0,!0));if(this[xM].destroyed)return new Promise((function(t,n){ru((function(){e[BM]?n(e[BM]):t(QM(void 0,!0))}))}));var n,r=this[CM];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[EM]?n(QM(void 0,!0)):t[SM](n,r)}),r)}}(r,this));else{var i=this[xM].read();if(null!==i)return Promise.resolve(QM(i,!1));n=new Promise(this[SM])}return this[CM]=n,n}},vM(yM,Symbol.asyncIterator,(function(){return this})),vM(yM,"return",(function(){var e=this;return new Promise((function(t,n){e[xM].destroy(null,(function(e){e?n(e):t(QM(void 0,!0))}))}))})),yM),NM),FM=function(e){var t,n=Object.create(DM,(vM(t={},xM,{value:e,writable:!0}),vM(t,wM,{value:null,writable:!0}),vM(t,bM,{value:null,writable:!0}),vM(t,BM,{value:null,writable:!0}),vM(t,EM,{value:e._readableState.endEmitted,writable:!0}),vM(t,SM,{value:function(e,t){var r=n[xM].read();r?(n[CM]=null,n[wM]=null,n[bM]=null,e(QM(r,!1))):(n[wM]=e,n[bM]=t)},writable:!0}),t));return n[CM]=null,IM(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[bM];return null!==t&&(n[CM]=null,n[wM]=null,n[bM]=null,t(e)),void(n[BM]=e)}var r=n[wM];null!==r&&(n[CM]=null,n[wM]=null,n[bM]=null,r(QM(void 0,!0))),n[EM]=!0})),e.on("readable",_M.bind(null,n)),n},PM=function(){throw new Error("Readable.from is not available in the browser")};const UM=LU;UM.Readable=nL,nL.ReadableState=tL,TU.EventEmitter;var MM,LM=function(e,t){return e.listeners(t).length},TM=RU,RM=qo.Buffer,OM=Ki.Uint8Array||function(){},HM=AI;MM=HM&&HM.debuglog?HM.debuglog("stream"):function(){};var KM,jM,GM,qM=VU,VM=XU,zM=nM,JM=WU.codes,YM=JM.ERR_INVALID_ARG_TYPE,XM=JM.ERR_STREAM_PUSH_AFTER_EOF,WM=JM.ERR_METHOD_NOT_IMPLEMENTED,ZM=JM.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Ow.exports(nL,TM);var $M=VM.errorOrDestroy,eL=["error","close","destroy","pause","resume"];function tL(e,t,n){e=e||{},"boolean"!=typeof n&&(n=t instanceof UM.Duplex),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=zM(this,e,"readableHighWaterMark",n),this.buffer=new qM,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(KM||(KM=rM.StringDecoder),this.decoder=new KM(e.encoding),this.encoding=e.encoding)}function nL(e){if(!(this instanceof nL))return new nL(e);var t=this instanceof UM.Duplex;this._readableState=new tL(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),TM.call(this)}function rL(e,t,n,r,i){MM("readableAddChunk",t);var o,a=e._readableState;if(null===t)a.reading=!1,function(e,t){if(MM("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?aL(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,sL(e)))}}(e,a);else if(i||(o=function(e,t){var n,r;return r=t,RM.isBuffer(r)||r instanceof OM||"string"==typeof t||void 0===t||e.objectMode||(n=new YM("chunk",["string","Buffer","Uint8Array"],t)),n}(a,t)),o)$M(e,o);else if(a.objectMode||t&&t.length>0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===RM.prototype||(t=function(e){return RM.from(e)}(t)),r)a.endEmitted?$M(e,new ZM):iL(e,a,t,!0);else if(a.ended)$M(e,new XM);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?iL(e,a,t,!1):lL(e,a)):iL(e,a,t,!1)}else r||(a.reading=!1,lL(e,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function iL(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&aL(e)),lL(e,t)}function oL(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function aL(e){var t=e._readableState;MM("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(MM("emitReadable",t.flowing),t.emittedReadable=!0,ru(sL,e))}function sL(e){var t=e._readableState;MM("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,fL(e)}function lL(e,t){t.readingMore||(t.readingMore=!0,ru(uL,e,t))}function uL(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(MM("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function AL(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function cL(e){MM("readable nexttick read 0"),e.read(0)}function hL(e,t){MM("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),fL(e),t.flowing&&!t.reading&&e.read(0)}function fL(e){var t=e._readableState;for(MM("flow",t.flowing);t.flowing&&null!==e.read(););}function dL(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function pL(e){var t=e._readableState;MM("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,ru(gL,t,e))}function gL(e,t){if(MM("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function yL(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}Object.defineProperty(nL.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),nL.prototype.destroy=VM.destroy,nL.prototype._undestroy=VM.undestroy,nL.prototype._destroy=function(e,t){t(e)},nL.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=RM.from(e,t),t=""),n=!0),rL(this,e,t,!1,n)},nL.prototype.unshift=function(e){return rL(this,e,null,!0,!1)},nL.prototype.isPaused=function(){return!1===this._readableState.flowing},nL.prototype.setEncoding=function(e){KM||(KM=rM.StringDecoder);var t=new KM(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this},nL.prototype.read=function(e){MM("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return MM("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?pL(this):aL(this),null;if(0===(e=oL(e,t))&&t.ended)return 0===t.length&&pL(this),null;var r,i=t.needReadable;return MM("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&MM("length less than watermark",i=!0),t.ended||t.reading?MM("reading or ended",i=!1):i&&(MM("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=oL(n,t))),null===(r=e>0?dL(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&pL(this)),null!==r&&this.emit("data",r),r},nL.prototype._read=function(e){$M(this,new WM("_read()"))},nL.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,MM("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end||e===gu.stdout||e===gu.stderr?h:o;function o(){MM("onend"),e.end()}r.endEmitted?ru(i):n.once("end",i),e.on("unpipe",(function t(i,f){MM("onunpipe"),i===n&&f&&!1===f.hasUnpiped&&(f.hasUnpiped=!0,MM("cleanup"),e.removeListener("close",A),e.removeListener("finish",c),e.removeListener("drain",a),e.removeListener("error",u),e.removeListener("unpipe",t),n.removeListener("end",o),n.removeListener("end",h),n.removeListener("data",l),s=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||a())}));var a=function(e){return function(){var t=e._readableState;MM("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&LM(e,"data")&&(t.flowing=!0,fL(e))}}(n);e.on("drain",a);var s=!1;function l(t){MM("ondata");var i=e.write(t);MM("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==yL(r.pipes,e))&&!s&&(MM("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function u(t){MM("onerror",t),h(),e.removeListener("error",u),0===LM(e,"error")&&$M(e,t)}function A(){e.removeListener("finish",c),h()}function c(){MM("onfinish"),e.removeListener("close",A),h()}function h(){MM("unpipe"),n.unpipe(e)}return n.on("data",l),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",u),e.once("close",A),e.once("finish",c),e.emit("pipe",n),r.flowing||(MM("pipe resume"),n.resume()),e},nL.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=yL(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},nL.prototype.on=function(e,t){var n=TM.prototype.on.call(this,e,t),r=this._readableState;return"data"===e?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,MM("on readable",r.length,r.reading),r.length?aL(this):r.reading||ru(cL,this))),n},nL.prototype.addListener=nL.prototype.on,nL.prototype.removeListener=function(e,t){var n=TM.prototype.removeListener.call(this,e,t);return"readable"===e&&ru(AL,this),n},nL.prototype.removeAllListeners=function(e){var t=TM.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||ru(AL,this),t},nL.prototype.resume=function(){var e=this._readableState;return e.flowing||(MM("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,ru(hL,e,t))}(this,e)),e.paused=!1,this},nL.prototype.pause=function(){return MM("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(MM("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},nL.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(MM("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){MM("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<eL.length;o++)e.on(eL[o],this.emit.bind(this,eL[o]));return this._read=function(t){MM("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(nL.prototype[Symbol.asyncIterator]=function(){return void 0===jM&&(jM=FM),jM(this)}),Object.defineProperty(nL.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(nL.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(nL.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),nL._fromList=dL,Object.defineProperty(nL.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(nL.from=function(e,t){return void 0===GM&&(GM=PM),GM(nL,e,t)});function mL(e){try{if(!Ki.localStorage)return!1}catch(e){return!1}var t=Ki.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}const vL=LU;function IL(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(undefined),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}vL.Writable=OL,OL.WritableState=RL;var wL,bL=function(e,t){if(mL("noDeprecation"))return e;var n=!1;return function(){if(!n){if(mL("throwDeprecation"))throw new Error(t);mL("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}},BL=RU,EL=qo.Buffer,CL=Ki.Uint8Array||function(){},SL=XU,xL=nM,QL=WU.codes,kL=QL.ERR_INVALID_ARG_TYPE,_L=QL.ERR_METHOD_NOT_IMPLEMENTED,NL=QL.ERR_MULTIPLE_CALLBACK,DL=QL.ERR_STREAM_CANNOT_PIPE,FL=QL.ERR_STREAM_DESTROYED,PL=QL.ERR_STREAM_NULL_VALUES,UL=QL.ERR_STREAM_WRITE_AFTER_END,ML=QL.ERR_UNKNOWN_ENCODING,LL=SL.errorOrDestroy;function TL(){}function RL(e,t,n){e=e||{},"boolean"!=typeof n&&(n=t instanceof vL.Duplex),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=xL(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var r=!1===e.decodeStrings;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new NL;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(ru(i,r),ru(VL,e,t),e._writableState.errorEmitted=!0,LL(e,r)):(i(r),e._writableState.errorEmitted=!0,LL(e,r),VL(e,t))}(e,n,r,t,i);else{var o=GL(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||jL(e,n),r?ru(KL,e,n,o,i):KL(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new IL(this)}function OL(e){var t=this instanceof vL.Duplex;if(!t&&!wL.call(OL,this))return new OL(e);this._writableState=new RL(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),BL.call(this)}function HL(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new FL("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function KL(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),VL(e,t)}function jL(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0,s=!0;n;)i[a]=n,n.isBuf||(s=!1),n=n.next,a+=1;i.allBuffers=s,HL(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new IL(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,A=n.callback;if(HL(e,t,!1,t.objectMode?1:l.length,l,u,A),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function GL(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function qL(e,t){e._final((function(n){t.pendingcb--,n&&LL(e,n),t.prefinished=!0,e.emit("prefinish"),VL(e,t)}))}function VL(e,t){var n=GL(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,ru(qL,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}Ow.exports(OL,BL),RL.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(RL.prototype,"buffer",{get:bL((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(wL=Function.prototype[Symbol.hasInstance],Object.defineProperty(OL,Symbol.hasInstance,{value:function(e){return!!wL.call(this,e)||this===OL&&e&&e._writableState instanceof RL}})):wL=function(e){return e instanceof this},OL.prototype.pipe=function(){LL(this,new DL)},OL.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,a=!i.objectMode&&(r=e,EL.isBuffer(r)||r instanceof CL);return a&&!EL.isBuffer(e)&&(e=function(e){return EL.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=TL),i.ending?function(e,t){var n=new UL;LL(e,n),ru(t,n)}(this,n):(a||function(e,t,n,r){var i;return null===n?i=new PL:"string"==typeof n||t.objectMode||(i=new kL("chunk",["string","Buffer"],n)),!i||(LL(e,i),ru(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,o){if(!n){var a=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=EL.from(t,n)),t}(t,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=t.objectMode?1:r.length;t.length+=s;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else HL(e,t,!1,s,r,i,o);return l}(this,i,a,e,t,n)),o},OL.prototype.cork=function(){this._writableState.corked++},OL.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||jL(this,e))},OL.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new ML(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(OL.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(OL.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),OL.prototype._write=function(e,t,n){n(new _L("_write()"))},OL.prototype._writev=null,OL.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,VL(e,t),n&&(t.finished?ru(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(OL.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(OL.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),OL.prototype.destroy=SL.destroy,OL.prototype._undestroy=SL.undestroy,OL.prototype._destroy=function(e,t){t(e)};var zL=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};const JL=LU;JL.Duplex=ZL,Ow.exports(ZL,JL.Readable);for(var YL=zL(JL.Writable.prototype),XL=0;XL<YL.length;XL++){var WL=YL[XL];ZL.prototype[WL]||(ZL.prototype[WL]=JL.Writable.prototype[WL])}function ZL(e){if(!(this instanceof ZL))return new ZL(e);JL.Readable.call(this,e),JL.Writable.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",$L)))}function $L(){this._writableState.ended||ru(eT,this)}function eT(e){e.end()}Object.defineProperty(ZL.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(ZL.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(ZL.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(ZL.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});const tT=LU;tT.Transform=lT;var nT=WU.codes,rT=nT.ERR_METHOD_NOT_IMPLEMENTED,iT=nT.ERR_MULTIPLE_CALLBACK,oT=nT.ERR_TRANSFORM_ALREADY_TRANSFORMING,aT=nT.ERR_TRANSFORM_WITH_LENGTH_0;function sT(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new iT);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function lT(e){if(!(this instanceof lT))return new lT(e);tT.Duplex.call(this,e),this._transformState={afterTransform:sT.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",uT)}function uT(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?AT(this,null,null):this._flush((function(t,n){AT(e,t,n)}))}function AT(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new aT;if(e._transformState.transforming)throw new oT;return e.push(null)}Ow.exports(lT,tT.Duplex),lT.prototype.push=function(e,t){return this._transformState.needTransform=!1,tT.Duplex.prototype.push.call(this,e,t)},lT.prototype._transform=function(e,t,n){n(new rT("_transform()"))},lT.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},lT.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},lT.prototype._destroy=function(e,t){tT.Duplex.prototype._destroy.call(this,e,(function(e){t(e)}))};const cT=LU;function hT(e){if(!(this instanceof hT))return new hT(e);Transform.call(this,e)}var fT;cT.PassThrough=hT,Ow.exports(hT,cT.Transform),hT.prototype._transform=function(e,t,n){n(null,e)};var dT=WU.codes,pT=dT.ERR_MISSING_ARGS,gT=dT.ERR_STREAM_DESTROYED;function yT(e){if(e)throw e}function mT(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var i=!1;e.on("close",(function(){i=!0})),void 0===fT&&(fT=mM),fT(e,{readable:t,writable:n},(function(e){if(e)return r(e);i=!0,r()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new gT("pipe"))}}function vT(e){e()}function IT(e,t){return e.pipe(t)}function wT(e){return e.length?"function"!=typeof e[e.length-1]?yT:e.pop():yT}var bT=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=wT(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new pT("streams");var o=t.map((function(e,n){var a=n<t.length-1;return mT(e,a,n>0,(function(e){r||(r=e),e&&o.forEach(vT),a||(o.forEach(vT),i(r))}))}));return t.reduce(IT)};!function(e,t){const n=LU;(t=MU.exports=n.Readable).Stream=n.Readable,t.Readable=n.Readable,t.Writable=n.Writable,t.Duplex=n.Duplex,t.Transform=n.Transform,t.PassThrough=n.PassThrough,t.finished=mM,t.pipeline=bT}(0,MU.exports);var BT=F_.exports.Buffer,ET=MU.exports;function CT(e){ET.Stream.Transform.call(this),this._block=BT.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}(0,Ow.exports)(CT,ET.Stream.Transform),CT.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},CT.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},CT.prototype.update=function(e,t){if(function(e,t){if(!BT.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");BT.isBuffer(e)||(e=BT.from(e,t));for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)n[i++]=e[r++];this._update(),this._blockOffset=0}for(;r<e.length;)n[this._blockOffset++]=e[r++];for(var o=0,a=8*e.length;a>0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},CT.prototype._update=function(){throw new Error("_update is not implemented")},CT.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},CT.prototype._digest=function(){throw new Error("_digest is not implemented")};var ST=CT,xT=Ow.exports,QT=ST,kT=F_.exports.Buffer,_T=new Array(16);function NT(){QT.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function DT(e,t){return e<<t|e>>>32-t}function FT(e,t,n,r,i,o,a){return DT(e+(t&n|~t&r)+i+o|0,a)+t|0}function PT(e,t,n,r,i,o,a){return DT(e+(t&r|n&~r)+i+o|0,a)+t|0}function UT(e,t,n,r,i,o,a){return DT(e+(t^n^r)+i+o|0,a)+t|0}function MT(e,t,n,r,i,o,a){return DT(e+(n^(t|~r))+i+o|0,a)+t|0}xT(NT,QT),NT.prototype._update=function(){for(var e=_T,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=FT(n,r,i,o,e[0],3614090360,7),o=FT(o,n,r,i,e[1],3905402710,12),i=FT(i,o,n,r,e[2],606105819,17),r=FT(r,i,o,n,e[3],3250441966,22),n=FT(n,r,i,o,e[4],4118548399,7),o=FT(o,n,r,i,e[5],1200080426,12),i=FT(i,o,n,r,e[6],2821735955,17),r=FT(r,i,o,n,e[7],4249261313,22),n=FT(n,r,i,o,e[8],1770035416,7),o=FT(o,n,r,i,e[9],2336552879,12),i=FT(i,o,n,r,e[10],4294925233,17),r=FT(r,i,o,n,e[11],2304563134,22),n=FT(n,r,i,o,e[12],1804603682,7),o=FT(o,n,r,i,e[13],4254626195,12),i=FT(i,o,n,r,e[14],2792965006,17),n=PT(n,r=FT(r,i,o,n,e[15],1236535329,22),i,o,e[1],4129170786,5),o=PT(o,n,r,i,e[6],3225465664,9),i=PT(i,o,n,r,e[11],643717713,14),r=PT(r,i,o,n,e[0],3921069994,20),n=PT(n,r,i,o,e[5],3593408605,5),o=PT(o,n,r,i,e[10],38016083,9),i=PT(i,o,n,r,e[15],3634488961,14),r=PT(r,i,o,n,e[4],3889429448,20),n=PT(n,r,i,o,e[9],568446438,5),o=PT(o,n,r,i,e[14],3275163606,9),i=PT(i,o,n,r,e[3],4107603335,14),r=PT(r,i,o,n,e[8],1163531501,20),n=PT(n,r,i,o,e[13],2850285829,5),o=PT(o,n,r,i,e[2],4243563512,9),i=PT(i,o,n,r,e[7],1735328473,14),n=UT(n,r=PT(r,i,o,n,e[12],2368359562,20),i,o,e[5],4294588738,4),o=UT(o,n,r,i,e[8],2272392833,11),i=UT(i,o,n,r,e[11],1839030562,16),r=UT(r,i,o,n,e[14],4259657740,23),n=UT(n,r,i,o,e[1],2763975236,4),o=UT(o,n,r,i,e[4],1272893353,11),i=UT(i,o,n,r,e[7],4139469664,16),r=UT(r,i,o,n,e[10],3200236656,23),n=UT(n,r,i,o,e[13],681279174,4),o=UT(o,n,r,i,e[0],3936430074,11),i=UT(i,o,n,r,e[3],3572445317,16),r=UT(r,i,o,n,e[6],76029189,23),n=UT(n,r,i,o,e[9],3654602809,4),o=UT(o,n,r,i,e[12],3873151461,11),i=UT(i,o,n,r,e[15],530742520,16),n=MT(n,r=UT(r,i,o,n,e[2],3299628645,23),i,o,e[0],4096336452,6),o=MT(o,n,r,i,e[7],1126891415,10),i=MT(i,o,n,r,e[14],2878612391,15),r=MT(r,i,o,n,e[5],4237533241,21),n=MT(n,r,i,o,e[12],1700485571,6),o=MT(o,n,r,i,e[3],2399980690,10),i=MT(i,o,n,r,e[10],4293915773,15),r=MT(r,i,o,n,e[1],2240044497,21),n=MT(n,r,i,o,e[8],1873313359,6),o=MT(o,n,r,i,e[15],4264355552,10),i=MT(i,o,n,r,e[6],2734768916,15),r=MT(r,i,o,n,e[13],1309151649,21),n=MT(n,r,i,o,e[4],4149444226,6),o=MT(o,n,r,i,e[11],3174756917,10),i=MT(i,o,n,r,e[2],718787259,15),r=MT(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},NT.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=kT.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var LT=NT,TT=qo.Buffer,RT=Ow.exports,OT=ST,HT=new Array(16),KT=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],jT=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],GT=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],qT=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],VT=[0,1518500249,1859775393,2400959708,2840853838],zT=[1352829926,1548603684,1836072691,2053994217,0];function JT(){OT.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function YT(e,t){return e<<t|e>>>32-t}function XT(e,t,n,r,i,o,a,s){return YT(e+(t^n^r)+o+a|0,s)+i|0}function WT(e,t,n,r,i,o,a,s){return YT(e+(t&n|~t&r)+o+a|0,s)+i|0}function ZT(e,t,n,r,i,o,a,s){return YT(e+((t|~n)^r)+o+a|0,s)+i|0}function $T(e,t,n,r,i,o,a,s){return YT(e+(t&r|n&~r)+o+a|0,s)+i|0}function eR(e,t,n,r,i,o,a,s){return YT(e+(t^(n|~r))+o+a|0,s)+i|0}RT(JT,OT),JT.prototype._update=function(){for(var e=HT,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,l=0|this._b,u=0|this._c,A=0|this._d,c=0|this._e,h=0;h<80;h+=1){var f,d;h<16?(f=XT(n,r,i,o,a,e[KT[h]],VT[0],GT[h]),d=eR(s,l,u,A,c,e[jT[h]],zT[0],qT[h])):h<32?(f=WT(n,r,i,o,a,e[KT[h]],VT[1],GT[h]),d=$T(s,l,u,A,c,e[jT[h]],zT[1],qT[h])):h<48?(f=ZT(n,r,i,o,a,e[KT[h]],VT[2],GT[h]),d=ZT(s,l,u,A,c,e[jT[h]],zT[2],qT[h])):h<64?(f=$T(n,r,i,o,a,e[KT[h]],VT[3],GT[h]),d=WT(s,l,u,A,c,e[jT[h]],zT[3],qT[h])):(f=eR(n,r,i,o,a,e[KT[h]],VT[4],GT[h]),d=XT(s,l,u,A,c,e[jT[h]],zT[4],qT[h])),n=a,a=o,o=YT(i,10),i=r,r=f,s=c,c=A,A=YT(u,10),u=l,l=d}var p=this._b+i+A|0;this._b=this._c+o+c|0,this._c=this._d+a+s|0,this._d=this._e+n+l|0,this._e=this._a+r+u|0,this._a=p},JT.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=TT.alloc?TT.alloc(20):new TT(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var tR=JT,nR={exports:{}},rR=F_.exports.Buffer;function iR(e,t){this._block=rR.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}iR.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=rR.from(e,t));for(var n=this._block,r=this._blockSize,i=e.length,o=this._len,a=0;a<i;){for(var s=o%r,l=Math.min(i-a,r-s),u=0;u<l;u++)n[s+u]=e[a+u];a+=l,(o+=l)%r==0&&this._update(n)}return this._len+=i,this},iR.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},iR.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var oR=iR,aR=Ow.exports,sR=oR,lR=F_.exports.Buffer,uR=[1518500249,1859775393,-1894007588,-899497514],AR=new Array(80);function cR(){this.init(),this._w=AR,sR.call(this,64,56)}function hR(e){return e<<30|e>>>2}function fR(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}aR(cR,sR),cR.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},cR.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,l=0;l<16;++l)n[l]=e.readInt32BE(4*l);for(;l<80;++l)n[l]=n[l-3]^n[l-8]^n[l-14]^n[l-16];for(var u=0;u<80;++u){var A=~~(u/20),c=0|((t=r)<<5|t>>>27)+fR(A,i,o,a)+s+n[u]+uR[A];s=a,a=o,o=hR(i),i=r,r=c}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},cR.prototype._hash=function(){var e=lR.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var dR=cR,pR=Ow.exports,gR=oR,yR=F_.exports.Buffer,mR=[1518500249,1859775393,-1894007588,-899497514],vR=new Array(80);function IR(){this.init(),this._w=vR,gR.call(this,64,56)}function wR(e){return e<<5|e>>>27}function bR(e){return e<<30|e>>>2}function BR(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}pR(IR,gR),IR.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},IR.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,l=0;l<16;++l)n[l]=e.readInt32BE(4*l);for(;l<80;++l)n[l]=(t=n[l-3]^n[l-8]^n[l-14]^n[l-16])<<1|t>>>31;for(var u=0;u<80;++u){var A=~~(u/20),c=wR(r)+BR(A,i,o,a)+s+n[u]+mR[A]|0;s=a,a=o,o=bR(i),i=r,r=c}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},IR.prototype._hash=function(){var e=yR.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var ER=IR,CR=Ow.exports,SR=oR,xR=F_.exports.Buffer,QR=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],kR=new Array(64);function _R(){this.init(),this._w=kR,SR.call(this,64,56)}function NR(e,t,n){return n^e&(t^n)}function DR(e,t,n){return e&t|n&(e|t)}function FR(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function PR(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function UR(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function MR(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}CR(_R,SR),_R.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},_R.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._f,l=0|this._g,u=0|this._h,A=0;A<16;++A)t[A]=e.readInt32BE(4*A);for(;A<64;++A)t[A]=MR(t[A-2])+t[A-7]+UR(t[A-15])+t[A-16]|0;for(var c=0;c<64;++c){var h=u+PR(a)+NR(a,s,l)+QR[c]+t[c]|0,f=FR(n)+DR(n,r,i)|0;u=l,l=s,s=a,a=o+h|0,o=i,i=r,r=n,n=h+f|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=s+this._f|0,this._g=l+this._g|0,this._h=u+this._h|0},_R.prototype._hash=function(){var e=xR.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var LR=_R,TR=Ow.exports,RR=LR,OR=oR,HR=F_.exports.Buffer,KR=new Array(64);function jR(){this.init(),this._w=KR,OR.call(this,64,56)}TR(jR,RR),jR.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},jR.prototype._hash=function(){var e=HR.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var GR=jR,qR=Ow.exports,VR=oR,zR=F_.exports.Buffer,JR=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],YR=new Array(160);function XR(){this.init(),this._w=YR,VR.call(this,128,112)}function WR(e,t,n){return n^e&(t^n)}function ZR(e,t,n){return e&t|n&(e|t)}function $R(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function eO(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function tO(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function nO(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function rO(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function iO(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function oO(e,t){return e>>>0<t>>>0?1:0}qR(XR,VR),XR.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},XR.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,l=0|this._gh,u=0|this._hh,A=0|this._al,c=0|this._bl,h=0|this._cl,f=0|this._dl,d=0|this._el,p=0|this._fl,g=0|this._gl,y=0|this._hl,m=0;m<32;m+=2)t[m]=e.readInt32BE(4*m),t[m+1]=e.readInt32BE(4*m+4);for(;m<160;m+=2){var v=t[m-30],I=t[m-30+1],w=tO(v,I),b=nO(I,v),B=rO(v=t[m-4],I=t[m-4+1]),E=iO(I,v),C=t[m-14],S=t[m-14+1],x=t[m-32],Q=t[m-32+1],k=b+S|0,_=w+C+oO(k,b)|0;_=(_=_+B+oO(k=k+E|0,E)|0)+x+oO(k=k+Q|0,Q)|0,t[m]=_,t[m+1]=k}for(var N=0;N<160;N+=2){_=t[N],k=t[N+1];var D=ZR(n,r,i),F=ZR(A,c,h),P=$R(n,A),U=$R(A,n),M=eO(a,d),L=eO(d,a),T=JR[N],R=JR[N+1],O=WR(a,s,l),H=WR(d,p,g),K=y+L|0,j=u+M+oO(K,y)|0;j=(j=(j=j+O+oO(K=K+H|0,H)|0)+T+oO(K=K+R|0,R)|0)+_+oO(K=K+k|0,k)|0;var G=U+F|0,q=P+D+oO(G,U)|0;u=l,y=g,l=s,g=p,s=a,p=d,a=o+j+oO(d=f+K|0,f)|0,o=i,f=h,i=r,h=c,r=n,c=A,n=j+q+oO(A=K+G|0,K)|0}this._al=this._al+A|0,this._bl=this._bl+c|0,this._cl=this._cl+h|0,this._dl=this._dl+f|0,this._el=this._el+d|0,this._fl=this._fl+p|0,this._gl=this._gl+g|0,this._hl=this._hl+y|0,this._ah=this._ah+n+oO(this._al,A)|0,this._bh=this._bh+r+oO(this._bl,c)|0,this._ch=this._ch+i+oO(this._cl,h)|0,this._dh=this._dh+o+oO(this._dl,f)|0,this._eh=this._eh+a+oO(this._el,d)|0,this._fh=this._fh+s+oO(this._fl,p)|0,this._gh=this._gh+l+oO(this._gl,g)|0,this._hh=this._hh+u+oO(this._hl,y)|0},XR.prototype._hash=function(){var e=zR.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var aO=XR,sO=Ow.exports,lO=aO,uO=oR,AO=F_.exports.Buffer,cO=new Array(160);function hO(){this.init(),this._w=cO,uO.call(this,128,112)}sO(hO,lO),hO.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},hO.prototype._hash=function(){var e=AO.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var fO=hO,dO=nR.exports=function(e){e=e.toLowerCase();var t=dO[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};dO.sha=dR,dO.sha1=ER,dO.sha224=GR,dO.sha256=LR,dO.sha384=fO,dO.sha512=aO;var pO=ji(dc),gO=F_.exports.Buffer,yO=LQ.Transform,mO=pO.StringDecoder;function vO(e){yO.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}(0,Ow.exports)(vO,yO),vO.prototype.update=function(e,t,n){"string"==typeof e&&(e=gO.from(e,t));var r=this._update(e);return this.hashMode?this:(n&&(r=this._toString(r,n)),r)},vO.prototype.setAutoPadding=function(){},vO.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},vO.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},vO.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},vO.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},vO.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},vO.prototype._finalOrDigest=function(e){var t=this.__final()||gO.alloc(0);return e&&(t=this._toString(t,e,!0)),t},vO.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new mO(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r};var IO=vO,wO=Ow.exports,bO=LT,BO=tR,EO=nR.exports,CO=IO;function SO(e){CO.call(this,"digest"),this._hash=e}wO(SO,CO),SO.prototype._update=function(e){this._hash.update(e)},SO.prototype._final=function(){return this._hash.digest()};var xO=function(e){return"md5"===(e=e.toLowerCase())?new bO:"rmd160"===e||"ripemd160"===e?new BO:new SO(EO(e))};Object.defineProperty(UU,"__esModule",{value:!0}),UU.taggedHash=UU.hash256=UU.hash160=UU.sha256=UU.sha1=UU.ripemd160=void 0;const QO=xO,kO=tR;function _O(e){try{return QO("rmd160").update(e).digest()}catch(t){try{return QO("ripemd160").update(e).digest()}catch(t){return(new kO).update(e).digest()}}}function NO(e){return QO("sha256").update(e).digest()}UU.ripemd160=_O,UU.sha1=function(e){return QO("sha1").update(e).digest()},UU.sha256=NO,UU.hash160=function(e){return _O(NO(e))},UU.hash256=function(e){return NO(NO(e))};const DO=Object.fromEntries(["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"].map((e=>{const t=NO(ao.from(e));return[e,ao.concat([t,t])]})));UU.taggedHash=function(e,t){return NO(ao.concat([DO[e],t]))};var FO=sP,PO=F_.exports.Buffer,UO=xO,MO=function(e){function t(t){var n=t.slice(0,-4),r=t.slice(-4),i=e(n);if(!(r[0]^i[0]|r[1]^i[1]|r[2]^i[2]|r[3]^i[3]))return n}return{encode:function(t){var n=e(t);return FO.encode(PO.concat([t,n],t.length+4))},decode:function(e){var n=t(FO.decode(e));if(!n)throw new Error("Invalid checksum");return n},decodeUnsafe:function(e){var n=FO.decodeUnsafe(e);if(n)return t(n)}}}((function(e){var t=UO("sha256").update(e).digest();return UO("sha256").update(t).digest()}));Object.defineProperty(PU,"__esModule",{value:!0}),PU.p2pkh=void 0;const LO=UU,TO=cP,RO=dP,OO=EP,HO=dU,KO=MO,jO=RO.OPS;PU.p2pkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,OO.typeforce)({network:OO.typeforce.maybe(OO.typeforce.Object),address:OO.typeforce.maybe(OO.typeforce.String),hash:OO.typeforce.maybe(OO.typeforce.BufferN(20)),output:OO.typeforce.maybe(OO.typeforce.BufferN(25)),pubkey:OO.typeforce.maybe(OO.isPoint),signature:OO.typeforce.maybe(RO.isCanonicalScriptSignature),input:OO.typeforce.maybe(OO.typeforce.Buffer)},e);const n=HO.value((()=>{const t=KO.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),r=HO.value((()=>RO.decompile(e.input))),i=e.network||TO.bitcoin,o={name:"p2pkh",network:i};if(HO.prop(o,"address",(()=>{if(!o.hash)return;const e=ao.allocUnsafe(21);return e.writeUInt8(i.pubKeyHash,0),o.hash.copy(e,1),KO.encode(e)})),HO.prop(o,"hash",(()=>e.output?e.output.slice(3,23):e.address?n().hash:e.pubkey||o.pubkey?LO.hash160(e.pubkey||o.pubkey):void 0)),HO.prop(o,"output",(()=>{if(o.hash)return RO.compile([jO.OP_DUP,jO.OP_HASH160,o.hash,jO.OP_EQUALVERIFY,jO.OP_CHECKSIG])})),HO.prop(o,"pubkey",(()=>{if(e.input)return r()[1]})),HO.prop(o,"signature",(()=>{if(e.input)return r()[0]})),HO.prop(o,"input",(()=>{if(e.pubkey&&e.signature)return RO.compile([e.signature,e.pubkey])})),HO.prop(o,"witness",(()=>{if(o.input)return[]})),t.validate){let t=ao.from([]);if(e.address){if(n().version!==i.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==n().hash.length)throw new TypeError("Invalid address");t=n().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==jO.OP_DUP||e.output[1]!==jO.OP_HASH160||20!==e.output[2]||e.output[23]!==jO.OP_EQUALVERIFY||e.output[24]!==jO.OP_CHECKSIG)throw new TypeError("Output is invalid");const n=e.output.slice(3,23);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.pubkey){const n=LO.hash160(e.pubkey);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.input){const n=r();if(2!==n.length)throw new TypeError("Input is invalid");if(!RO.isCanonicalScriptSignature(n[0]))throw new TypeError("Input has invalid signature");if(!(0,OO.isPoint)(n[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(n[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(n[1]))throw new TypeError("Pubkey mismatch");const i=LO.hash160(n[1]);if(t.length>0&&!t.equals(i))throw new TypeError("Hash mismatch")}}return Object.assign(o,e)};var GO={};Object.defineProperty(GO,"__esModule",{value:!0}),GO.p2sh=void 0;const qO=UU,VO=cP,zO=dP,JO=EP,YO=dU,XO=MO,WO=zO.OPS;GO.p2sh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,JO.typeforce)({network:JO.typeforce.maybe(JO.typeforce.Object),address:JO.typeforce.maybe(JO.typeforce.String),hash:JO.typeforce.maybe(JO.typeforce.BufferN(20)),output:JO.typeforce.maybe(JO.typeforce.BufferN(23)),redeem:JO.typeforce.maybe({network:JO.typeforce.maybe(JO.typeforce.Object),output:JO.typeforce.maybe(JO.typeforce.Buffer),input:JO.typeforce.maybe(JO.typeforce.Buffer),witness:JO.typeforce.maybe(JO.typeforce.arrayOf(JO.typeforce.Buffer))}),input:JO.typeforce.maybe(JO.typeforce.Buffer),witness:JO.typeforce.maybe(JO.typeforce.arrayOf(JO.typeforce.Buffer))},e);let n=e.network;n||(n=e.redeem&&e.redeem.network||VO.bitcoin);const r={network:n},i=YO.value((()=>{const t=XO.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),o=YO.value((()=>zO.decompile(e.input))),a=YO.value((()=>{const t=o(),r=t[t.length-1];return{network:n,output:r===WO.OP_FALSE?ao.from([]):r,input:zO.compile(t.slice(0,-1)),witness:e.witness||[]}}));if(YO.prop(r,"address",(()=>{if(!r.hash)return;const e=ao.allocUnsafe(21);return e.writeUInt8(r.network.scriptHash,0),r.hash.copy(e,1),XO.encode(e)})),YO.prop(r,"hash",(()=>e.output?e.output.slice(2,22):e.address?i().hash:r.redeem&&r.redeem.output?qO.hash160(r.redeem.output):void 0)),YO.prop(r,"output",(()=>{if(r.hash)return zO.compile([WO.OP_HASH160,r.hash,WO.OP_EQUAL])})),YO.prop(r,"redeem",(()=>{if(e.input)return a()})),YO.prop(r,"input",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.output)return zO.compile([].concat(zO.decompile(e.redeem.input),e.redeem.output))})),YO.prop(r,"witness",(()=>r.redeem&&r.redeem.witness?r.redeem.witness:r.input?[]:void 0)),YO.prop(r,"name",(()=>{const e=["p2sh"];return void 0!==r.redeem&&void 0!==r.redeem.name&&e.push(r.redeem.name),e.join("-")})),t.validate){let t=ao.from([]);if(e.address){if(i().version!==n.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==i().hash.length)throw new TypeError("Invalid address");t=i().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==WO.OP_HASH160||20!==e.output[1]||e.output[22]!==WO.OP_EQUAL)throw new TypeError("Output is invalid");const n=e.output.slice(2,22);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}const r=e=>{if(e.output){const n=zO.decompile(e.output);if(!n||n.length<1)throw new TypeError("Redeem.output too short");const r=qO.hash160(e.output);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.input){const t=e.input.length>0,n=e.witness&&e.witness.length>0;if(!t&&!n)throw new TypeError("Empty input");if(t&&n)throw new TypeError("Input and witness provided");if(t){const t=zO.decompile(e.input);if(!zO.isPushOnly(t))throw new TypeError("Non push-only scriptSig")}}};if(e.input){const e=o();if(!e||e.length<1)throw new TypeError("Input too short");if(!jo(a().output))throw new TypeError("Input is invalid");r(a())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==n)throw new TypeError("Network mismatch");if(e.input){const t=a();if(e.redeem.output&&!e.redeem.output.equals(t.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(t.input))throw new TypeError("Redeem.input mismatch")}r(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(r,e)};var ZO={},$O={};Object.defineProperty($O,"__esModule",{value:!0}),$O.bech32m=$O.bech32=void 0;const eH="qpzry9x8gf2tvdw0s3jn54khce6mua7l",tH={};for(let e=0;e<eH.length;e++){const t=eH.charAt(e);tH[t]=e}function nH(e){const t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function rH(e){let t=1;for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=nH(t)^r>>5}t=nH(t);for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);t=nH(t)^31&r}return t}function iH(e,t,n,r){let i=0,o=0;const a=(1<<n)-1,s=[];for(let r=0;r<e.length;++r)for(i=i<<t|e[r],o+=t;o>=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<<n-o&a);else{if(o>=t)return"Excess padding";if(i<<n-o&a)return"Non-zero padding"}return s}function oH(e){return iH(e,8,5,!0)}function aH(e){const t=iH(e,5,8,!1);if(Array.isArray(t))return t}function sH(e){const t=iH(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function lH(e){let t;function n(e,n){if(n=n||90,e.length<8)return e+" too short";if(e.length>n)return"Exceeds length limit";const r=e.toLowerCase(),i=e.toUpperCase();if(e!==r&&e!==i)return"Mixed-case string "+e;const o=(e=r).lastIndexOf("1");if(-1===o)return"No separator character for "+e;if(0===o)return"Missing prefix for "+e;const a=e.slice(0,o),s=e.slice(o+1);if(s.length<6)return"Data too short";let l=rH(a);if("string"==typeof l)return l;const u=[];for(let e=0;e<s.length;++e){const t=s.charAt(e),n=tH[t];if(void 0===n)return"Unknown character "+t;l=nH(l)^n,e+6>=s.length||u.push(n)}return l!==t?"Invalid checksum for "+e:{prefix:a,words:u}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=n(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=n(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,n,r){if(r=r||90,e.length+7+n.length>r)throw new TypeError("Exceeds length limit");let i=rH(e=e.toLowerCase());if("string"==typeof i)throw new Error(i);let o=e+"1";for(let e=0;e<n.length;++e){const t=n[e];if(t>>5!=0)throw new Error("Non 5-bit word");i=nH(i)^t,o+=eH.charAt(t)}for(let e=0;e<6;++e)i=nH(i);i^=t;for(let e=0;e<6;++e)o+=eH.charAt(i>>5*(5-e)&31);return o},toWords:oH,fromWordsUnsafe:aH,fromWords:sH}}$O.bech32=lH("bech32"),$O.bech32m=lH("bech32m"),Object.defineProperty(ZO,"__esModule",{value:!0}),ZO.p2wpkh=void 0;const uH=UU,AH=cP,cH=dP,hH=EP,fH=dU,dH=$O,pH=cH.OPS,gH=ao.alloc(0);ZO.p2wpkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,hH.typeforce)({address:hH.typeforce.maybe(hH.typeforce.String),hash:hH.typeforce.maybe(hH.typeforce.BufferN(20)),input:hH.typeforce.maybe(hH.typeforce.BufferN(0)),network:hH.typeforce.maybe(hH.typeforce.Object),output:hH.typeforce.maybe(hH.typeforce.BufferN(22)),pubkey:hH.typeforce.maybe(hH.isPoint),signature:hH.typeforce.maybe(cH.isCanonicalScriptSignature),witness:hH.typeforce.maybe(hH.typeforce.arrayOf(hH.typeforce.Buffer))},e);const n=fH.value((()=>{const t=dH.bech32.decode(e.address),n=t.words.shift(),r=dH.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:ao.from(r)}})),r=e.network||AH.bitcoin,i={name:"p2wpkh",network:r};if(fH.prop(i,"address",(()=>{if(!i.hash)return;const e=dH.bech32.toWords(i.hash);return e.unshift(0),dH.bech32.encode(r.bech32,e)})),fH.prop(i,"hash",(()=>e.output?e.output.slice(2,22):e.address?n().data:e.pubkey||i.pubkey?uH.hash160(e.pubkey||i.pubkey):void 0)),fH.prop(i,"output",(()=>{if(i.hash)return cH.compile([pH.OP_0,i.hash])})),fH.prop(i,"pubkey",(()=>e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0)),fH.prop(i,"signature",(()=>{if(e.witness)return e.witness[0]})),fH.prop(i,"input",(()=>{if(i.witness)return gH})),fH.prop(i,"witness",(()=>{if(e.pubkey&&e.signature)return[e.signature,e.pubkey]})),t.validate){let t=ao.from([]);if(e.address){if(r&&r.bech32!==n().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(20!==n().data.length)throw new TypeError("Invalid address data");t=n().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==pH.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(t.length>0&&!t.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");t=e.output.slice(2)}if(e.pubkey){const n=uH.hash160(e.pubkey);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");if(t=n,!(0,hH.isPoint)(e.pubkey)||33!==e.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!cH.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,hH.isPoint)(e.witness[1])||33!==e.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");const n=uH.hash160(e.witness[1]);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(i,e)};var yH={};Object.defineProperty(yH,"__esModule",{value:!0}),yH.p2wsh=void 0;const mH=UU,vH=cP,IH=dP,wH=EP,bH=dU,BH=$O,EH=IH.OPS,CH=ao.alloc(0);function SH(e){return!(!jo(e)||65!==e.length||4!==e[0]||!(0,wH.isPoint)(e))}yH.p2wsh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,wH.typeforce)({network:wH.typeforce.maybe(wH.typeforce.Object),address:wH.typeforce.maybe(wH.typeforce.String),hash:wH.typeforce.maybe(wH.typeforce.BufferN(32)),output:wH.typeforce.maybe(wH.typeforce.BufferN(34)),redeem:wH.typeforce.maybe({input:wH.typeforce.maybe(wH.typeforce.Buffer),network:wH.typeforce.maybe(wH.typeforce.Object),output:wH.typeforce.maybe(wH.typeforce.Buffer),witness:wH.typeforce.maybe(wH.typeforce.arrayOf(wH.typeforce.Buffer))}),input:wH.typeforce.maybe(wH.typeforce.BufferN(0)),witness:wH.typeforce.maybe(wH.typeforce.arrayOf(wH.typeforce.Buffer))},e);const n=bH.value((()=>{const t=BH.bech32.decode(e.address),n=t.words.shift(),r=BH.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:ao.from(r)}})),r=bH.value((()=>IH.decompile(e.redeem.input)));let i=e.network;i||(i=e.redeem&&e.redeem.network||vH.bitcoin);const o={network:i};if(bH.prop(o,"address",(()=>{if(!o.hash)return;const e=BH.bech32.toWords(o.hash);return e.unshift(0),BH.bech32.encode(i.bech32,e)})),bH.prop(o,"hash",(()=>e.output?e.output.slice(2):e.address?n().data:o.redeem&&o.redeem.output?mH.sha256(o.redeem.output):void 0)),bH.prop(o,"output",(()=>{if(o.hash)return IH.compile([EH.OP_0,o.hash])})),bH.prop(o,"redeem",(()=>{if(e.witness)return{output:e.witness[e.witness.length-1],input:CH,witness:e.witness.slice(0,-1)}})),bH.prop(o,"input",(()=>{if(o.witness)return CH})),bH.prop(o,"witness",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){const t=IH.toStack(r());return o.redeem=Object.assign({witness:t},e.redeem),o.redeem.input=CH,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)})),bH.prop(o,"name",(()=>{const e=["p2wsh"];return void 0!==o.redeem&&void 0!==o.redeem.name&&e.push(o.redeem.name),e.join("-")})),t.validate){let t=ao.from([]);if(e.address){if(n().prefix!==i.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(32!==n().data.length)throw new TypeError("Invalid address data");t=n().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==EH.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");const n=e.output.slice(2);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem){if(e.redeem.network&&e.redeem.network!==i)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){if(0===IH.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");const n=mH.sha256(e.redeem.output);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem.input&&!IH.isPushOnly(r()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&r().some(SH)||e.redeem.output&&(IH.decompile(e.redeem.output)||[]).some(SH))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){const t=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(t))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(SH)||(IH.decompile(t)||[]).some(SH))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(o,e)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.p2wsh=e.p2wpkh=e.p2sh=e.p2pkh=e.p2pk=e.p2ms=e.embed=void 0;const t=fP;Object.defineProperty(e,"embed",{enumerable:!0,get:function(){return t.p2data}});const n=IU;Object.defineProperty(e,"p2ms",{enumerable:!0,get:function(){return n.p2ms}});const r=QU;Object.defineProperty(e,"p2pk",{enumerable:!0,get:function(){return r.p2pk}});const i=PU;Object.defineProperty(e,"p2pkh",{enumerable:!0,get:function(){return i.p2pkh}});const o=GO;Object.defineProperty(e,"p2sh",{enumerable:!0,get:function(){return o.p2sh}});const a=ZO;Object.defineProperty(e,"p2wpkh",{enumerable:!0,get:function(){return a.p2wpkh}});const s=yH;Object.defineProperty(e,"p2wsh",{enumerable:!0,get:function(){return s.p2wsh}})}(hP),Object.defineProperty(AP,"__esModule",{value:!0}),AP.toOutputScript=AP.fromOutputScript=AP.toBech32=AP.toBase58Check=AP.fromBech32=AP.fromBase58Check=void 0;const xH=cP,QH=hP,kH=dP,_H=EP,NH=$O,DH=MO,{typeforce:FH}=_H,PH="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function UH(e){const t=DH.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");return{version:t.readUInt8(0),hash:t.slice(1)}}function MH(e){let t,n;try{t=NH.bech32.decode(e)}catch(e){}if(t){if(n=t.words[0],0!==n)throw new TypeError(e+" uses wrong encoding")}else if(t=NH.bech32m.decode(e),n=t.words[0],0===n)throw new TypeError(e+" uses wrong encoding");const r=NH.bech32.fromWords(t.words.slice(1));return{version:n,prefix:t.prefix,data:ao.from(r)}}function LH(e,t,n){const r=NH.bech32.toWords(e);return r.unshift(t),0===t?NH.bech32.encode(n,r):NH.bech32m.encode(n,r)}AP.fromBase58Check=UH,AP.fromBech32=MH,AP.toBase58Check=function(e,t){FH(_H.tuple(_H.Hash160bit,_H.UInt8),arguments);const n=ao.allocUnsafe(21);return n.writeUInt8(t,0),e.copy(n,1),DH.encode(n)},AP.toBech32=LH,AP.fromOutputScript=function(e,t){t=t||xH.bitcoin;try{return QH.p2pkh({output:e,network:t}).address}catch(e){}try{return QH.p2sh({output:e,network:t}).address}catch(e){}try{return QH.p2wpkh({output:e,network:t}).address}catch(e){}try{return QH.p2wsh({output:e,network:t}).address}catch(e){}try{return function(e,t){const n=e.slice(2);if(n.length<2||n.length>40)throw new TypeError("Invalid program length for segwit address");const r=e[0]-80;if(r<1||r>16)throw new TypeError("Invalid version for segwit address");if(e[1]!==n.length)throw new TypeError("Invalid script for segwit address");return console.warn(PH),LH(n,r,t.bech32)}(e,t)}catch(e){}throw new Error(kH.toASM(e)+" has no matching Address")},AP.toOutputScript=function(e,t){let n,r;t=t||xH.bitcoin;try{n=UH(e)}catch(e){}if(n){if(n.version===t.pubKeyHash)return QH.p2pkh({hash:n.hash}).output;if(n.version===t.scriptHash)return QH.p2sh({hash:n.hash}).output}else{try{r=MH(e)}catch(e){}if(r){if(r.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return QH.p2wpkh({hash:r.data}).output;if(32===r.data.length)return QH.p2wsh({hash:r.data}).output}else if(r.version>=1&&r.version<=16&&r.data.length>=2&&r.data.length<=40)return console.warn(PH),kH.compile([r.version+80,r.data])}}throw new Error(e+" has no matching Script")};var TH={},RH={},OH=F_.exports.Buffer;function HH(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function KH(e){return HH(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var jH={encode:function e(t,n,r){if(HH(t),n||(n=OH.allocUnsafe(KH(t))),!OH.isBuffer(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),e.bytes=1):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),e.bytes=3):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),e.bytes=5):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),e.bytes=9),n},decode:function e(t,n){if(!OH.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);var r=t.readUInt8(n);if(r<253)return e.bytes=1,r;if(253===r)return e.bytes=3,t.readUInt16LE(n+1);if(254===r)return e.bytes=5,t.readUInt32LE(n+1);e.bytes=9;var i=t.readUInt32LE(n+1),o=4294967296*t.readUInt32LE(n+5)+i;return HH(o),o},encodingLength:KH};Object.defineProperty(RH,"__esModule",{value:!0}),RH.BufferReader=RH.BufferWriter=RH.cloneBuffer=RH.reverseBuffer=RH.writeUInt64LE=RH.readUInt64LE=RH.varuint=void 0;const GH=EP,{typeforce:qH}=GH,VH=jH;function zH(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function JH(e,t){const n=e.readUInt32LE(t);let r=e.readUInt32LE(t+4);return r*=4294967296,zH(r+n,9007199254740991),r+n}function YH(e,t,n){return zH(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8}RH.varuint=VH,RH.readUInt64LE=JH,RH.writeUInt64LE=YH,RH.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,n=0;for(let r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},RH.cloneBuffer=function(e){const t=ao.allocUnsafe(e.length);return e.copy(t),t};class XH{constructor(e,t=0){this.buffer=e,this.offset=t,qH(GH.tuple(GH.Buffer,GH.UInt32),[e,t])}static withCapacity(e){return new XH(ao.alloc(e))}writeUInt8(e){this.offset=this.buffer.writeUInt8(e,this.offset)}writeInt32(e){this.offset=this.buffer.writeInt32LE(e,this.offset)}writeUInt32(e){this.offset=this.buffer.writeUInt32LE(e,this.offset)}writeUInt64(e){this.offset=YH(this.buffer,e,this.offset)}writeVarInt(e){VH.encode(e,this.buffer,this.offset),this.offset+=VH.encode.bytes}writeSlice(e){if(this.buffer.length<this.offset+e.length)throw new Error("Cannot write slice out of bounds");this.offset+=e.copy(this.buffer,this.offset)}writeVarSlice(e){this.writeVarInt(e.length),this.writeSlice(e)}writeVector(e){this.writeVarInt(e.length),e.forEach((e=>this.writeVarSlice(e)))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}RH.BufferWriter=XH,RH.BufferReader=class{constructor(e,t=0){this.buffer=e,this.offset=t,qH(GH.tuple(GH.Buffer,GH.UInt32),[e,t])}readUInt8(){const e=this.buffer.readUInt8(this.offset);return this.offset++,e}readInt32(){const e=this.buffer.readInt32LE(this.offset);return this.offset+=4,e}readUInt32(){const e=this.buffer.readUInt32LE(this.offset);return this.offset+=4,e}readUInt64(){const e=JH(this.buffer,this.offset);return this.offset+=8,e}readVarInt(){const e=VH.decode(this.buffer,this.offset);return this.offset+=VH.decode.bytes,e}readSlice(e){if(this.buffer.length<this.offset+e)throw new Error("Cannot read slice out of bounds");const t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const e=this.readVarInt(),t=[];for(let n=0;n<e;n++)t.push(this.readVarSlice());return t}};var WH={};Object.defineProperty(WH,"__esModule",{value:!0}),WH.fastMerkleRoot=void 0,WH.fastMerkleRoot=function(e,t){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof t)throw TypeError("Expected digest Function");let n=e.length;const r=e.concat();for(;n>1;){let e=0;for(let i=0;i<n;i+=2,++e){const o=r[i],a=i+1===n?o:r[i+1],s=ao.concat([o,a]);r[e]=t(s)}n=e}return r[0]};var ZH={};Object.defineProperty(ZH,"__esModule",{value:!0}),ZH.Transaction=void 0;const $H=RH,eK=UU,tK=dP,nK=dP,rK=EP,{typeforce:iK}=rK;function oK(e){const t=e.length;return $H.varuint.encodingLength(t)+t}const aK=ao.allocUnsafe(0),sK=[],lK=ao.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),uK=ao.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),AK=ao.from("ffffffffffffffff","hex"),cK={script:aK,valueBuffer:AK};class hK{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(e,t){const n=new $H.BufferReader(e),r=new hK;r.version=n.readInt32();const i=n.readUInt8(),o=n.readUInt8();let a=!1;i===hK.ADVANCED_TRANSACTION_MARKER&&o===hK.ADVANCED_TRANSACTION_FLAG?a=!0:n.offset-=2;const s=n.readVarInt();for(let e=0;e<s;++e)r.ins.push({hash:n.readSlice(32),index:n.readUInt32(),script:n.readVarSlice(),sequence:n.readUInt32(),witness:sK});const l=n.readVarInt();for(let e=0;e<l;++e)r.outs.push({value:n.readUInt64(),script:n.readVarSlice()});if(a){for(let e=0;e<s;++e)r.ins[e].witness=n.readVector();if(!r.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(r.locktime=n.readUInt32(),t)return r;if(n.offset!==e.length)throw new Error("Transaction has unexpected data");return r}static fromHex(e){return hK.fromBuffer(ao.from(e,"hex"),!1)}static isCoinbaseHash(e){iK(rK.Hash256bit,e);for(let t=0;t<32;++t)if(0!==e[t])return!1;return!0}isCoinbase(){return 1===this.ins.length&&hK.isCoinbaseHash(this.ins[0].hash)}addInput(e,t,n,r){return iK(rK.tuple(rK.Hash256bit,rK.UInt32,rK.maybe(rK.UInt32),rK.maybe(rK.Buffer)),arguments),rK.Null(n)&&(n=hK.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:r||aK,sequence:n,witness:sK})-1}addOutput(e,t){return iK(rK.tuple(rK.Buffer,rK.Satoshi),arguments),this.outs.push({script:e,value:t})-1}hasWitnesses(){return this.ins.some((e=>0!==e.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(e=!0){const t=e&&this.hasWitnesses();return(t?10:8)+$H.varuint.encodingLength(this.ins.length)+$H.varuint.encodingLength(this.outs.length)+this.ins.reduce(((e,t)=>e+40+oK(t.script)),0)+this.outs.reduce(((e,t)=>e+8+oK(t.script)),0)+(t?this.ins.reduce(((e,t)=>e+function(e){const t=e.length;return $H.varuint.encodingLength(t)+e.reduce(((e,t)=>e+oK(t)),0)}(t.witness)),0):0)}clone(){const e=new hK;return e.version=this.version,e.locktime=this.locktime,e.ins=this.ins.map((e=>({hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}))),e.outs=this.outs.map((e=>({script:e.script,value:e.value}))),e}hashForSignature(e,t,n){if(iK(rK.tuple(rK.UInt32,rK.Buffer,rK.Number),arguments),e>=this.ins.length)return uK;const r=tK.compile(tK.decompile(t).filter((e=>e!==nK.OPS.OP_CODESEPARATOR))),i=this.clone();if((31&n)===hK.SIGHASH_NONE)i.outs=[],i.ins.forEach(((t,n)=>{n!==e&&(t.sequence=0)}));else if((31&n)===hK.SIGHASH_SINGLE){if(e>=this.outs.length)return uK;i.outs.length=e+1;for(let t=0;t<e;t++)i.outs[t]=cK;i.ins.forEach(((t,n)=>{n!==e&&(t.sequence=0)}))}n&hK.SIGHASH_ANYONECANPAY?(i.ins=[i.ins[e]],i.ins[0].script=r):(i.ins.forEach((e=>{e.script=aK})),i.ins[e].script=r);const o=ao.allocUnsafe(i.byteLength(!1)+4);return o.writeInt32LE(n,o.length-4),i.__toBuffer(o,0,!1),eK.hash256(o)}hashForWitnessV1(e,t,n,r,i,o){if(iK(rK.tuple(rK.UInt32,iK.arrayOf(rK.Buffer),iK.arrayOf(rK.Satoshi),rK.UInt32),arguments),n.length!==this.ins.length||t.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const a=r===hK.SIGHASH_DEFAULT?hK.SIGHASH_ALL:r&hK.SIGHASH_OUTPUT_MASK,s=(r&hK.SIGHASH_INPUT_MASK)===hK.SIGHASH_ANYONECANPAY,l=a===hK.SIGHASH_NONE,u=a===hK.SIGHASH_SINGLE;let A=aK,c=aK,h=aK,f=aK,d=aK;if(!s){let e=$H.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach((t=>{e.writeSlice(t.hash),e.writeUInt32(t.index)})),A=eK.sha256(e.end()),e=$H.BufferWriter.withCapacity(8*this.ins.length),n.forEach((t=>e.writeUInt64(t))),c=eK.sha256(e.end()),e=$H.BufferWriter.withCapacity(t.map(oK).reduce(((e,t)=>e+t))),t.forEach((t=>e.writeVarSlice(t))),h=eK.sha256(e.end()),e=$H.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach((t=>e.writeUInt32(t.sequence))),f=eK.sha256(e.end())}if(l||u){if(u&&e<this.outs.length){const t=this.outs[e],n=$H.BufferWriter.withCapacity(8+oK(t.script));n.writeUInt64(t.value),n.writeVarSlice(t.script),d=eK.sha256(n.end())}}else{const e=this.outs.map((e=>8+oK(e.script))).reduce(((e,t)=>e+t)),t=$H.BufferWriter.withCapacity(e);this.outs.forEach((e=>{t.writeUInt64(e.value),t.writeVarSlice(e.script)})),d=eK.sha256(t.end())}const p=(i?2:0)+(o?1:0),g=174-(s?49:0)-(l?32:0)+(o?32:0)+(i?37:0),y=$H.BufferWriter.withCapacity(g);if(y.writeUInt8(r),y.writeInt32(this.version),y.writeUInt32(this.locktime),y.writeSlice(A),y.writeSlice(c),y.writeSlice(h),y.writeSlice(f),l||u||y.writeSlice(d),y.writeUInt8(p),s){const r=this.ins[e];y.writeSlice(r.hash),y.writeUInt32(r.index),y.writeUInt64(n[e]),y.writeVarSlice(t[e]),y.writeUInt32(r.sequence)}else y.writeUInt32(e);if(o){const e=$H.BufferWriter.withCapacity(oK(o));e.writeVarSlice(o),y.writeSlice(eK.sha256(e.end()))}return u&&y.writeSlice(d),i&&(y.writeSlice(i),y.writeUInt8(0),y.writeUInt32(4294967295)),eK.taggedHash("TapSighash",ao.concat([ao.of(0),y.end()]))}hashForWitnessV0(e,t,n,r){iK(rK.tuple(rK.UInt32,rK.Buffer,rK.Satoshi,rK.UInt32),arguments);let i,o=ao.from([]),a=lK,s=lK,l=lK;if(r&hK.SIGHASH_ANYONECANPAY||(o=ao.allocUnsafe(36*this.ins.length),i=new $H.BufferWriter(o,0),this.ins.forEach((e=>{i.writeSlice(e.hash),i.writeUInt32(e.index)})),s=eK.hash256(o)),r&hK.SIGHASH_ANYONECANPAY||(31&r)===hK.SIGHASH_SINGLE||(31&r)===hK.SIGHASH_NONE||(o=ao.allocUnsafe(4*this.ins.length),i=new $H.BufferWriter(o,0),this.ins.forEach((e=>{i.writeUInt32(e.sequence)})),l=eK.hash256(o)),(31&r)!==hK.SIGHASH_SINGLE&&(31&r)!==hK.SIGHASH_NONE){const e=this.outs.reduce(((e,t)=>e+8+oK(t.script)),0);o=ao.allocUnsafe(e),i=new $H.BufferWriter(o,0),this.outs.forEach((e=>{i.writeUInt64(e.value),i.writeVarSlice(e.script)})),a=eK.hash256(o)}else if((31&r)===hK.SIGHASH_SINGLE&&e<this.outs.length){const t=this.outs[e];o=ao.allocUnsafe(8+oK(t.script)),i=new $H.BufferWriter(o,0),i.writeUInt64(t.value),i.writeVarSlice(t.script),a=eK.hash256(o)}o=ao.allocUnsafe(156+oK(t)),i=new $H.BufferWriter(o,0);const u=this.ins[e];return i.writeInt32(this.version),i.writeSlice(s),i.writeSlice(l),i.writeSlice(u.hash),i.writeUInt32(u.index),i.writeVarSlice(t),i.writeUInt64(n),i.writeUInt32(u.sequence),i.writeSlice(a),i.writeUInt32(this.locktime),i.writeUInt32(r),eK.hash256(o)}getHash(e){return e&&this.isCoinbase()?ao.alloc(32,0):eK.hash256(this.__toBuffer(void 0,void 0,e))}getId(){return(0,$H.reverseBuffer)(this.getHash(!1)).toString("hex")}toBuffer(e,t){return this.__toBuffer(e,t,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(e,t){iK(rK.tuple(rK.Number,rK.Buffer),arguments),this.ins[e].script=t}setWitness(e,t){iK(rK.tuple(rK.Number,[rK.Buffer]),arguments),this.ins[e].witness=t}__toBuffer(e,t,n=!1){e||(e=ao.allocUnsafe(this.byteLength(n)));const r=new $H.BufferWriter(e,t||0);r.writeInt32(this.version);const i=n&&this.hasWitnesses();return i&&(r.writeUInt8(hK.ADVANCED_TRANSACTION_MARKER),r.writeUInt8(hK.ADVANCED_TRANSACTION_FLAG)),r.writeVarInt(this.ins.length),this.ins.forEach((e=>{r.writeSlice(e.hash),r.writeUInt32(e.index),r.writeVarSlice(e.script),r.writeUInt32(e.sequence)})),r.writeVarInt(this.outs.length),this.outs.forEach((e=>{void 0!==e.value?r.writeUInt64(e.value):r.writeSlice(e.valueBuffer),r.writeVarSlice(e.script)})),i&&this.ins.forEach((e=>{r.writeVector(e.witness)})),r.writeUInt32(this.locktime),void 0!==t?e.slice(t,r.offset):e}}ZH.Transaction=hK,hK.DEFAULT_SEQUENCE=4294967295,hK.SIGHASH_DEFAULT=0,hK.SIGHASH_ALL=1,hK.SIGHASH_NONE=2,hK.SIGHASH_SINGLE=3,hK.SIGHASH_ANYONECANPAY=128,hK.SIGHASH_OUTPUT_MASK=3,hK.SIGHASH_INPUT_MASK=128,hK.ADVANCED_TRANSACTION_MARKER=0,hK.ADVANCED_TRANSACTION_FLAG=1,Object.defineProperty(TH,"__esModule",{value:!0}),TH.Block=void 0;const fK=RH,dK=UU,pK=WH,gK=ZH,yK=EP,{typeforce:mK}=yK,vK=new TypeError("Cannot compute merkle root for zero transactions"),IK=new TypeError("Cannot compute witness commit for non-segwit block");class wK{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(e){if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");const t=new fK.BufferReader(e),n=new wK;if(n.version=t.readInt32(),n.prevHash=t.readSlice(32),n.merkleRoot=t.readSlice(32),n.timestamp=t.readUInt32(),n.bits=t.readUInt32(),n.nonce=t.readUInt32(),80===e.length)return n;const r=()=>{const e=gK.Transaction.fromBuffer(t.buffer.slice(t.offset),!0);return t.offset+=e.byteLength(),e},i=t.readVarInt();n.transactions=[];for(let e=0;e<i;++e){const e=r();n.transactions.push(e)}const o=n.getWitnessCommit();return o&&(n.witnessCommit=o),n}static fromHex(e){return wK.fromBuffer(ao.from(e,"hex"))}static calculateTarget(e){const t=((4278190080&e)>>24)-3,n=8388607&e,r=ao.alloc(32,0);return r.writeUIntBE(n,29-t,3),r}static calculateMerkleRoot(e,t){if(mK([{getHash:yK.Function}],e),0===e.length)throw vK;if(t&&!bK(e))throw IK;const n=e.map((e=>e.getHash(t))),r=(0,pK.fastMerkleRoot)(n,dK.hash256);return t?dK.hash256(ao.concat([r,e[0].ins[0].witness[0]])):r}getWitnessCommit(){if(!bK(this.transactions))return null;const e=this.transactions[0].outs.filter((e=>e.script.slice(0,6).equals(ao.from("6a24aa21a9ed","hex")))).map((e=>e.script.slice(6,38)));if(0===e.length)return null;const t=e[e.length-1];return t instanceof ao&&32===t.length?t:null}hasWitnessCommit(){return this.witnessCommit instanceof ao&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(e=this.transactions)instanceof Array&&e.some((e=>"object"==typeof e&&e.ins instanceof Array&&e.ins.some((e=>"object"==typeof e&&e.witness instanceof Array&&e.witness.length>0))));var e}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(e,t=!0){return e||!this.transactions?80:80+fK.varuint.encodingLength(this.transactions.length)+this.transactions.reduce(((e,n)=>e+n.byteLength(t)),0)}getHash(){return dK.hash256(this.toBuffer(!0))}getId(){return(0,fK.reverseBuffer)(this.getHash()).toString("hex")}getUTCDate(){const e=new Date(0);return e.setUTCSeconds(this.timestamp),e}toBuffer(e){const t=ao.allocUnsafe(this.byteLength(e)),n=new fK.BufferWriter(t);return n.writeInt32(this.version),n.writeSlice(this.prevHash),n.writeSlice(this.merkleRoot),n.writeUInt32(this.timestamp),n.writeUInt32(this.bits),n.writeUInt32(this.nonce),e||!this.transactions||(fK.varuint.encode(this.transactions.length,t,n.offset),n.offset+=fK.varuint.encode.bytes,this.transactions.forEach((e=>{const r=e.byteLength();e.toBuffer(t,n.offset),n.offset+=r}))),t}toHex(e){return this.toBuffer(e).toString("hex")}checkTxRoots(){const e=this.hasWitnessCommit();return!(!e&&this.hasWitness())&&this.__checkMerkleRoot()&&(!e||this.__checkWitnessCommit())}checkProofOfWork(){const e=(0,fK.reverseBuffer)(this.getHash()),t=wK.calculateTarget(this.bits);return e.compare(t)<=0}__checkMerkleRoot(){if(!this.transactions)throw vK;const e=wK.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)}__checkWitnessCommit(){if(!this.transactions)throw vK;if(!this.hasWitnessCommit())throw IK;const e=wK.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(e)}}function bK(e){return e instanceof Array&&e[0]&&e[0].ins&&e[0].ins instanceof Array&&e[0].ins[0]&&e[0].ins[0].witness&&e[0].ins[0].witness instanceof Array&&e[0].ins[0].witness.length>0}TH.Block=wK;var BK={},EK={},CK={},SK={},xK={},QK={},kK={};!function(e){var t,n,r;Object.defineProperty(e,"__esModule",{value:!0}),(t=e.GlobalTypes||(e.GlobalTypes={}))[t.UNSIGNED_TX=0]="UNSIGNED_TX",t[t.GLOBAL_XPUB=1]="GLOBAL_XPUB",e.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],(n=e.InputTypes||(e.InputTypes={}))[n.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",n[n.WITNESS_UTXO=1]="WITNESS_UTXO",n[n.PARTIAL_SIG=2]="PARTIAL_SIG",n[n.SIGHASH_TYPE=3]="SIGHASH_TYPE",n[n.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",n[n.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",n[n.BIP32_DERIVATION=6]="BIP32_DERIVATION",n[n.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",n[n.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",n[n.POR_COMMITMENT=9]="POR_COMMITMENT",n[n.TAP_KEY_SIG=19]="TAP_KEY_SIG",n[n.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",n[n.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",n[n.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",n[n.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",n[n.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT",e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],(r=e.OutputTypes||(e.OutputTypes={}))[r.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",r[r.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",r[r.BIP32_DERIVATION=2]="BIP32_DERIVATION",r[r.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",r[r.TAP_TREE=6]="TAP_TREE",r[r.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION",e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]}(kK);var _K={};Object.defineProperty(_K,"__esModule",{value:!0});const NK=kK;_K.decode=function(e){if(e.key[0]!==NK.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+e.key.toString("hex"));if(79!==e.key.length||![2,3].includes(e.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const t=e.key.slice(1),n={masterFingerprint:e.value.slice(0,4),extendedPubkey:t,path:"m"};for(const t of(r=e.value.length/4-1,[...Array(r).keys()])){const r=e.value.readUInt32LE(4*t+4),i=!!(2147483648&r),o=2147483647&r;n.path+="/"+o.toString(10)+(i?"'":"")}var r;return n},_K.encode=function(e){const t=ao.from([NK.GlobalTypes.GLOBAL_XPUB]),n=ao.concat([t,e.extendedPubkey]),r=e.path.split("/"),i=ao.allocUnsafe(4*r.length);e.masterFingerprint.copy(i,0);let o=4;return r.slice(1).forEach((e=>{const t="'"===e.slice(-1);let n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),i.writeUInt32LE(n,o),o+=4})),{key:n,value:i}},_K.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",_K.check=function(e){const t=e.extendedPubkey,n=e.masterFingerprint,r=e.path;return jo(t)&&78===t.length&&[2,3].indexOf(t[45])>-1&&jo(n)&&4===n.length&&"string"==typeof r&&!!r.match(/^m(\/\d+'?)*$/)},_K.canAddToArray=function(e,t,n){const r=t.extendedPubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.extendedPubkey.equals(t.extendedPubkey))).length)};var DK={};Object.defineProperty(DK,"__esModule",{value:!0});const FK=kK;DK.encode=function(e){return{key:ao.from([FK.GlobalTypes.UNSIGNED_TX]),value:e.toBuffer()}};var PK={};Object.defineProperty(PK,"__esModule",{value:!0});const UK=kK;PK.decode=function(e){if(e.key[0]!==UK.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+e.key.toString("hex"));return e.value},PK.encode=function(e){return{key:ao.from([UK.InputTypes.FINAL_SCRIPTSIG]),value:e}},PK.expected="Buffer",PK.check=function(e){return jo(e)},PK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptSig};var MK={};Object.defineProperty(MK,"__esModule",{value:!0});const LK=kK;MK.decode=function(e){if(e.key[0]!==LK.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+e.key.toString("hex"));return e.value},MK.encode=function(e){return{key:ao.from([LK.InputTypes.FINAL_SCRIPTWITNESS]),value:e}},MK.expected="Buffer",MK.check=function(e){return jo(e)},MK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptWitness};var TK={};Object.defineProperty(TK,"__esModule",{value:!0});const RK=kK;TK.decode=function(e){if(e.key[0]!==RK.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+e.key.toString("hex"));return e.value},TK.encode=function(e){return{key:ao.from([RK.InputTypes.NON_WITNESS_UTXO]),value:e}},TK.expected="Buffer",TK.check=function(e){return jo(e)},TK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.nonWitnessUtxo};var OK={};Object.defineProperty(OK,"__esModule",{value:!0});const HK=kK;OK.decode=function(e){if(e.key[0]!==HK.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+e.key.toString("hex"));if(34!==e.key.length&&66!==e.key.length||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1),signature:e.value}},OK.encode=function(e){const t=ao.from([HK.InputTypes.PARTIAL_SIG]);return{key:ao.concat([t,e.pubkey]),value:e.signature}},OK.expected="{ pubkey: Buffer; signature: Buffer; }",OK.check=function(e){return jo(e.pubkey)&&jo(e.signature)&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&function(e){if(!jo(e)||e.length<9)return!1;if(48!==e[0])return!1;if(e.length!==e[1]+3)return!1;if(2!==e[2])return!1;const t=e[3];if(t>33||t<1)return!1;if(2!==e[3+t+1])return!1;const n=e[3+t+2];return!(n>33||n<1)&&e.length===3+t+2+n+2}(e.signature)},OK.canAddToArray=function(e,t,n){const r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)};var KK={};Object.defineProperty(KK,"__esModule",{value:!0});const jK=kK;KK.decode=function(e){if(e.key[0]!==jK.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+e.key.toString("hex"));return e.value.toString("utf8")},KK.encode=function(e){return{key:ao.from([jK.InputTypes.POR_COMMITMENT]),value:ao.from(e,"utf8")}},KK.expected="string",KK.check=function(e){return"string"==typeof e},KK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.porCommitment};var GK={};Object.defineProperty(GK,"__esModule",{value:!0});const qK=kK;GK.decode=function(e){if(e.key[0]!==qK.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+e.key.toString("hex"));return e.value.readUInt32LE(0)},GK.encode=function(e){const t=ao.from([qK.InputTypes.SIGHASH_TYPE]),n=ao.allocUnsafe(4);return n.writeUInt32LE(e,0),{key:t,value:n}},GK.expected="number",GK.check=function(e){return"number"==typeof e},GK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.sighashType};var VK={};Object.defineProperty(VK,"__esModule",{value:!0});const zK=kK;function JK(e){return jo(e)&&(64===e.length||65===e.length)}VK.decode=function(e){if(e.key[0]!==zK.InputTypes.TAP_KEY_SIG||1!==e.key.length)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+e.key.toString("hex"));if(!JK(e.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return e.value},VK.encode=function(e){return{key:ao.from([zK.InputTypes.TAP_KEY_SIG]),value:e}},VK.expected="Buffer",VK.check=JK,VK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapKeySig};var YK={};Object.defineProperty(YK,"__esModule",{value:!0});const XK=kK;YK.decode=function(e){if(e.key[0]!==XK.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+e.key.toString("hex"));if((e.key.length-2)%32!=0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+e.key.toString("hex"));const t=e.value[e.value.length-1];if((254&e.key[1])!==t)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+e.key.toString("hex"));const n=e.value.slice(0,-1);return{controlBlock:e.key.slice(1),script:n,leafVersion:t}},YK.encode=function(e){const t=ao.from([XK.InputTypes.TAP_LEAF_SCRIPT]),n=ao.from([e.leafVersion]);return{key:ao.concat([t,e.controlBlock]),value:ao.concat([e.script,n])}},YK.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }",YK.check=function(e){return jo(e.controlBlock)&&(e.controlBlock.length-1)%32==0&&(254&e.controlBlock[0])===e.leafVersion&&jo(e.script)},YK.canAddToArray=function(e,t,n){const r=t.controlBlock.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.controlBlock.equals(t.controlBlock))).length)};var WK={};Object.defineProperty(WK,"__esModule",{value:!0});const ZK=kK;function $K(e){return jo(e)&&32===e.length}WK.decode=function(e){if(e.key[0]!==ZK.InputTypes.TAP_MERKLE_ROOT||1!==e.key.length)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+e.key.toString("hex"));if(!$K(e.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return e.value},WK.encode=function(e){return{key:ao.from([ZK.InputTypes.TAP_MERKLE_ROOT]),value:e}},WK.expected="Buffer",WK.check=$K,WK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapMerkleRoot};var ej={};Object.defineProperty(ej,"__esModule",{value:!0});const tj=kK;ej.decode=function(e){if(e.key[0]!==tj.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+e.key.toString("hex"));if(65!==e.key.length)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+e.key.toString("hex"));if(64!==e.value.length&&65!==e.value.length)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1,33),leafHash:e.key.slice(33),signature:e.value}},ej.encode=function(e){const t=ao.from([tj.InputTypes.TAP_SCRIPT_SIG]);return{key:ao.concat([t,e.pubkey,e.leafHash]),value:e.signature}},ej.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }",ej.check=function(e){return jo(e.pubkey)&&jo(e.leafHash)&&jo(e.signature)&&32===e.pubkey.length&&32===e.leafHash.length&&(64===e.signature.length||65===e.signature.length)},ej.canAddToArray=function(e,t,n){const r=t.pubkey.toString("hex")+t.leafHash.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey)&&e.leafHash.equals(t.leafHash))).length)};var nj={},rj={},ij={};function oj(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function aj(e){return oj(e),e<253?1:e<=65535?3:e<=4294967295?5:9}Object.defineProperty(ij,"__esModule",{value:!0}),ij.encode=function e(t,n,r){if(oj(t),n||(n=ao.allocUnsafe(aj(t))),!jo(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),Object.assign(e,{bytes:1})):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),Object.assign(e,{bytes:3})):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),Object.assign(e,{bytes:5})):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),Object.assign(e,{bytes:9})),n},ij.decode=function e(t,n){if(!jo(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);const r=t.readUInt8(n);if(r<253)return Object.assign(e,{bytes:1}),r;if(253===r)return Object.assign(e,{bytes:3}),t.readUInt16LE(n+1);if(254===r)return Object.assign(e,{bytes:5}),t.readUInt32LE(n+1);{Object.assign(e,{bytes:9});const r=t.readUInt32LE(n+1),i=4294967296*t.readUInt32LE(n+5)+r;return oj(i),i}},ij.encodingLength=aj,Object.defineProperty(rj,"__esModule",{value:!0});const sj=ij;function lj(e){const t=e.key.length,n=e.value.length,r=sj.encodingLength(t),i=sj.encodingLength(n),o=ao.allocUnsafe(r+t+i+n);return sj.encode(t,o,0),e.key.copy(o,r),sj.encode(n,o,r+t),e.value.copy(o,r+t+i),o}function uj(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}rj.range=e=>[...Array(e).keys()],rj.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,n=0;for(let r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},rj.keyValsToBuffer=function(e){const t=e.map(lj);return t.push(ao.from([0])),ao.concat(t)},rj.keyValToBuffer=lj,rj.readUInt64LE=function(e,t){const n=e.readUInt32LE(t);let r=e.readUInt32LE(t+4);return r*=4294967296,uj(r+n,9007199254740991),r+n},rj.writeUInt64LE=function(e,t,n){return uj(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8},Object.defineProperty(nj,"__esModule",{value:!0});const Aj=kK,cj=rj,hj=ij;nj.decode=function(e){if(e.key[0]!==Aj.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+e.key.toString("hex"));const t=cj.readUInt64LE(e.value,0);let n=8;const r=hj.decode(e.value,n);n+=hj.encodingLength(r);const i=e.value.slice(n);if(i.length!==r)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:i,value:t}},nj.encode=function(e){const{script:t,value:n}=e,r=hj.encodingLength(t.length),i=ao.allocUnsafe(8+r+t.length);return cj.writeUInt64LE(i,n,0),hj.encode(t.length,i,8),t.copy(i,8+r),{key:ao.from([Aj.InputTypes.WITNESS_UTXO]),value:i}},nj.expected="{ script: Buffer; value: number; }",nj.check=function(e){return jo(e.script)&&"number"==typeof e.value},nj.canAdd=function(e,t){return!!e&&!!t&&void 0===e.witnessUtxo};var fj={};Object.defineProperty(fj,"__esModule",{value:!0});const dj=kK,pj=ij;fj.decode=function(e){if(e.key[0]!==dj.OutputTypes.TAP_TREE||1!==e.key.length)throw new Error("Decode Error: could not decode tapTree with key 0x"+e.key.toString("hex"));let t=0;const n=[];for(;t<e.value.length;){const r=e.value[t++],i=e.value[t++],o=pj.decode(e.value,t);t+=pj.encodingLength(o),n.push({depth:r,leafVersion:i,script:e.value.slice(t,t+o)}),t+=o}return{leaves:n}},fj.encode=function(e){const t=ao.from([dj.OutputTypes.TAP_TREE]),n=[].concat(...e.leaves.map((e=>[ao.of(e.depth,e.leafVersion),pj.encode(e.script.length),e.script])));return{key:t,value:ao.concat(n)}},fj.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }",fj.check=function(e){return Array.isArray(e.leaves)&&e.leaves.every((e=>e.depth>=0&&e.depth<=128&&(254&e.leafVersion)===e.leafVersion&&jo(e.script)))},fj.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapTree};var gj={};Object.defineProperty(gj,"__esModule",{value:!0});const yj=e=>33===e.length&&[2,3].includes(e[0])||65===e.length&&4===e[0];gj.makeConverter=function(e,t=yj){return{decode:function(n){if(n.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+n.key.toString("hex"));const r=n.key.slice(1);if(!t(r))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+n.key.toString("hex"));if(n.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const i={masterFingerprint:n.value.slice(0,4),pubkey:r,path:"m"};for(const e of(o=n.value.length/4-1,[...Array(o).keys()])){const t=n.value.readUInt32LE(4*e+4),r=!!(2147483648&t),o=2147483647&t;i.path+="/"+o.toString(10)+(r?"'":"")}var o;return i},encode:function(t){const n=ao.from([e]),r=ao.concat([n,t.pubkey]),i=t.path.split("/"),o=ao.allocUnsafe(4*i.length);t.masterFingerprint.copy(o,0);let a=4;return i.slice(1).forEach((e=>{const t="'"===e.slice(-1);let n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),o.writeUInt32LE(n,a),a+=4})),{key:r,value:o}},check:function(e){return jo(e.pubkey)&&jo(e.masterFingerprint)&&"string"==typeof e.path&&t(e.pubkey)&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(e,t,n){const r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)}}};var mj={};Object.defineProperty(mj,"__esModule",{value:!0}),mj.makeChecker=function(e){return function(t){let n;if(e.includes(t.key[0])&&(n=t.key.slice(1),33!==n.length&&65!==n.length||![2,3,4].includes(n[0])))throw new Error("Format Error: invalid pubkey in key 0x"+t.key.toString("hex"));return n}};var vj={};Object.defineProperty(vj,"__esModule",{value:!0}),vj.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}};var Ij={};Object.defineProperty(Ij,"__esModule",{value:!0});const wj=ij,bj=gj,Bj=e=>32===e.length;Ij.makeConverter=function(e){const t=bj.makeConverter(e,Bj);return{decode:function(e){const n=wj.decode(e.value),r=wj.encodingLength(n),i=t.decode({key:e.key,value:e.value.slice(r+32*n)}),o=new Array(n);for(let t=0,i=r;t<n;t++,i+=32)o[t]=e.value.slice(i,i+32);return Object.assign({},i,{leafHashes:o})},encode:function(e){const n=t.encode(e),r=wj.encodingLength(e.leafHashes.length),i=ao.allocUnsafe(r);wj.encode(e.leafHashes.length,i);const o=ao.concat([i,...e.leafHashes,n.value]);return Object.assign({},n,{value:o})},check:function(e){return Array.isArray(e.leafHashes)&&e.leafHashes.every((e=>jo(e)&&32===e.length))&&t.check(e)},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; leafHashes: Buffer[]; }",canAddToArray:t.canAddToArray}};var Ej={};Object.defineProperty(Ej,"__esModule",{value:!0}),Ej.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e||1!==t.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+t.key.toString("hex"));if(32!==t.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)&&32===e.length},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.tapInternalKey}}};var Cj={};Object.defineProperty(Cj,"__esModule",{value:!0}),Cj.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}},Object.defineProperty(QK,"__esModule",{value:!0});const Sj=kK,xj=PK,Qj=MK,kj=TK,_j=OK,Nj=KK,Dj=GK,Fj=VK,Pj=YK,Uj=WK,Mj=ej,Lj=nj,Tj=fj,Rj=gj,Oj=mj,Hj=vj,Kj=Ij,jj=Ej,Gj=Cj,qj={unsignedTx:DK,globalXpub:_K,checkPubkey:Oj.makeChecker([])};QK.globals=qj;const Vj={nonWitnessUtxo:kj,partialSig:_j,sighashType:Dj,finalScriptSig:xj,finalScriptWitness:Qj,porCommitment:Nj,witnessUtxo:Lj,bip32Derivation:Rj.makeConverter(Sj.InputTypes.BIP32_DERIVATION),redeemScript:Hj.makeConverter(Sj.InputTypes.REDEEM_SCRIPT),witnessScript:Gj.makeConverter(Sj.InputTypes.WITNESS_SCRIPT),checkPubkey:Oj.makeChecker([Sj.InputTypes.PARTIAL_SIG,Sj.InputTypes.BIP32_DERIVATION]),tapKeySig:Fj,tapScriptSig:Mj,tapLeafScript:Pj,tapBip32Derivation:Kj.makeConverter(Sj.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:jj.makeConverter(Sj.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot:Uj};QK.inputs=Vj;const zj={bip32Derivation:Rj.makeConverter(Sj.OutputTypes.BIP32_DERIVATION),redeemScript:Hj.makeConverter(Sj.OutputTypes.REDEEM_SCRIPT),witnessScript:Gj.makeConverter(Sj.OutputTypes.WITNESS_SCRIPT),checkPubkey:Oj.makeChecker([Sj.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:Kj.makeConverter(Sj.OutputTypes.TAP_BIP32_DERIVATION),tapTree:Tj,tapInternalKey:jj.makeConverter(Sj.OutputTypes.TAP_INTERNAL_KEY)};QK.outputs=zj,Object.defineProperty(xK,"__esModule",{value:!0});const Jj=QK,Yj=rj,Xj=ij,Wj=kK;function Zj(e,t,n){if(!t.equals(ao.from([n])))throw new Error(`Format Error: Invalid ${e} key: ${t.toString("hex")}`)}function $j(e,{globalMapKeyVals:t,inputKeyVals:n,outputKeyVals:r}){const i={unsignedTx:e};let o=0;for(const e of t)switch(e.key[0]){case Wj.GlobalTypes.UNSIGNED_TX:if(Zj("global",e.key,Wj.GlobalTypes.UNSIGNED_TX),o>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");o++;break;case Wj.GlobalTypes.GLOBAL_XPUB:void 0===i.globalXpub&&(i.globalXpub=[]),i.globalXpub.push(Jj.globals.globalXpub.decode(e));break;default:i.unknownKeyVals||(i.unknownKeyVals=[]),i.unknownKeyVals.push(e)}const a=n.length,s=r.length,l=[],u=[];for(const e of Yj.range(a)){const t={};for(const r of n[e])switch(Jj.inputs.checkPubkey(r),r.key[0]){case Wj.InputTypes.NON_WITNESS_UTXO:if(Zj("input",r.key,Wj.InputTypes.NON_WITNESS_UTXO),void 0!==t.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");t.nonWitnessUtxo=Jj.inputs.nonWitnessUtxo.decode(r);break;case Wj.InputTypes.WITNESS_UTXO:if(Zj("input",r.key,Wj.InputTypes.WITNESS_UTXO),void 0!==t.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");t.witnessUtxo=Jj.inputs.witnessUtxo.decode(r);break;case Wj.InputTypes.PARTIAL_SIG:void 0===t.partialSig&&(t.partialSig=[]),t.partialSig.push(Jj.inputs.partialSig.decode(r));break;case Wj.InputTypes.SIGHASH_TYPE:if(Zj("input",r.key,Wj.InputTypes.SIGHASH_TYPE),void 0!==t.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");t.sighashType=Jj.inputs.sighashType.decode(r);break;case Wj.InputTypes.REDEEM_SCRIPT:if(Zj("input",r.key,Wj.InputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");t.redeemScript=Jj.inputs.redeemScript.decode(r);break;case Wj.InputTypes.WITNESS_SCRIPT:if(Zj("input",r.key,Wj.InputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");t.witnessScript=Jj.inputs.witnessScript.decode(r);break;case Wj.InputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(Jj.inputs.bip32Derivation.decode(r));break;case Wj.InputTypes.FINAL_SCRIPTSIG:Zj("input",r.key,Wj.InputTypes.FINAL_SCRIPTSIG),t.finalScriptSig=Jj.inputs.finalScriptSig.decode(r);break;case Wj.InputTypes.FINAL_SCRIPTWITNESS:Zj("input",r.key,Wj.InputTypes.FINAL_SCRIPTWITNESS),t.finalScriptWitness=Jj.inputs.finalScriptWitness.decode(r);break;case Wj.InputTypes.POR_COMMITMENT:Zj("input",r.key,Wj.InputTypes.POR_COMMITMENT),t.porCommitment=Jj.inputs.porCommitment.decode(r);break;case Wj.InputTypes.TAP_KEY_SIG:Zj("input",r.key,Wj.InputTypes.TAP_KEY_SIG),t.tapKeySig=Jj.inputs.tapKeySig.decode(r);break;case Wj.InputTypes.TAP_SCRIPT_SIG:void 0===t.tapScriptSig&&(t.tapScriptSig=[]),t.tapScriptSig.push(Jj.inputs.tapScriptSig.decode(r));break;case Wj.InputTypes.TAP_LEAF_SCRIPT:void 0===t.tapLeafScript&&(t.tapLeafScript=[]),t.tapLeafScript.push(Jj.inputs.tapLeafScript.decode(r));break;case Wj.InputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(Jj.inputs.tapBip32Derivation.decode(r));break;case Wj.InputTypes.TAP_INTERNAL_KEY:Zj("input",r.key,Wj.InputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=Jj.inputs.tapInternalKey.decode(r);break;case Wj.InputTypes.TAP_MERKLE_ROOT:Zj("input",r.key,Wj.InputTypes.TAP_MERKLE_ROOT),t.tapMerkleRoot=Jj.inputs.tapMerkleRoot.decode(r);break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(r)}l.push(t)}for(const e of Yj.range(s)){const t={};for(const n of r[e])switch(Jj.outputs.checkPubkey(n),n.key[0]){case Wj.OutputTypes.REDEEM_SCRIPT:if(Zj("output",n.key,Wj.OutputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");t.redeemScript=Jj.outputs.redeemScript.decode(n);break;case Wj.OutputTypes.WITNESS_SCRIPT:if(Zj("output",n.key,Wj.OutputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");t.witnessScript=Jj.outputs.witnessScript.decode(n);break;case Wj.OutputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(Jj.outputs.bip32Derivation.decode(n));break;case Wj.OutputTypes.TAP_INTERNAL_KEY:Zj("output",n.key,Wj.OutputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=Jj.outputs.tapInternalKey.decode(n);break;case Wj.OutputTypes.TAP_TREE:Zj("output",n.key,Wj.OutputTypes.TAP_TREE),t.tapTree=Jj.outputs.tapTree.decode(n);break;case Wj.OutputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(Jj.outputs.tapBip32Derivation.decode(n));break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(n)}u.push(t)}return{globalMap:i,inputs:l,outputs:u}}xK.psbtFromBuffer=function(e,t){let n=0;function r(){const t=Xj.decode(e,n);n+=Xj.encodingLength(t);const r=e.slice(n,n+t);return n+=t,r}function i(){return{key:r(),value:r()}}function o(){if(n>=e.length)throw new Error("Format Error: Unexpected End of PSBT");const t=0===e.readUInt8(n);return t&&n++,t}if(1886610036!==function(){const t=e.readUInt32BE(n);return n+=4,t}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const t=e.readUInt8(n);return n+=1,t}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const a=[],s={};for(;!o();){const e=i(),t=e.key.toString("hex");if(s[t])throw new Error("Format Error: Keys must be unique for global keymap: key "+t);s[t]=1,a.push(e)}const l=a.filter((e=>e.key[0]===Wj.GlobalTypes.UNSIGNED_TX));if(1!==l.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const u=t(l[0].value),{inputCount:A,outputCount:c}=u.getInputOutputCounts(),h=[],f=[];for(const e of Yj.range(A)){const t={},n=[];for(;!o();){const r=i(),o=r.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each input: input index "+e+" key "+o);t[o]=1,n.push(r)}h.push(n)}for(const e of Yj.range(c)){const t={},n=[];for(;!o();){const r=i(),o=r.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each output: output index "+e+" key "+o);t[o]=1,n.push(r)}f.push(n)}return $j(u,{globalMapKeyVals:a,inputKeyVals:h,outputKeyVals:f})},xK.checkKeyBuffer=Zj,xK.psbtFromKeyVals=$j;var eG={};Object.defineProperty(eG,"__esModule",{value:!0});const tG=QK,nG=rj;eG.psbtToBuffer=function({globalMap:e,inputs:t,outputs:n}){const{globalKeyVals:r,inputKeyVals:i,outputKeyVals:o}=oG({globalMap:e,inputs:t,outputs:n}),a=nG.keyValsToBuffer(r),s=e=>0===e.length?[ao.from([0])]:e.map(nG.keyValsToBuffer),l=s(i),u=s(o),A=ao.allocUnsafe(5);return A.writeUIntBE(482972169471,0,5),ao.concat([A,a].concat(l,u))};const rG=(e,t)=>e.key.compare(t.key);function iG(e,t){const n=new Set,r=Object.entries(e).reduce(((e,[r,i])=>{if("unknownKeyVals"===r)return e;const o=t[r];if(void 0===o)return e;const a=(Array.isArray(i)?i:[i]).map(o.encode);return a.map((e=>e.key.toString("hex"))).forEach((e=>{if(n.has(e))throw new Error("Serialize Error: Duplicate key: "+e);n.add(e)})),e.concat(a)}),[]),i=e.unknownKeyVals?e.unknownKeyVals.filter((e=>!n.has(e.key.toString("hex")))):[];return r.concat(i).sort(rG)}function oG({globalMap:e,inputs:t,outputs:n}){return{globalKeyVals:iG(e,tG.globals),inputKeyVals:t.map((e=>iG(e,tG.inputs))),outputKeyVals:n.map((e=>iG(e,tG.outputs)))}}eG.psbtToKeyVals=oG,function(e){function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),t(xK),t(eG)}(SK),Object.defineProperty(CK,"__esModule",{value:!0});const aG=SK;function sG(e,t,n){return r=>{if(e.has(r))return;const i=n.filter((e=>e.key.toString("hex")===r))[0];t.push(i),e.add(r)}}function lG(e){return e.globalMap.unsignedTx}function uG(e){const t=new Set;return e.forEach((e=>{const n=e.key.toString("hex");if(t.has(n))throw new Error("Combine: KeyValue Map keys should be unique");t.add(n)})),t}CK.combine=function(e){const t=e[0],n=aG.psbtToKeyVals(t),r=e.slice(1);if(0===r.length)throw new Error("Combine: Nothing to combine");const i=lG(t);if(void 0===i)throw new Error("Combine: Self missing transaction");const o=uG(n.globalKeyVals),a=n.inputKeyVals.map(uG),s=n.outputKeyVals.map(uG);for(const e of r){const t=lG(e);if(void 0===t||!t.toBuffer().equals(i.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const r=aG.psbtToKeyVals(e);uG(r.globalKeyVals).forEach(sG(o,n.globalKeyVals,r.globalKeyVals)),r.inputKeyVals.map(uG).forEach(((e,t)=>e.forEach(sG(a[t],n.inputKeyVals[t],r.inputKeyVals[t])))),r.outputKeyVals.map(uG).forEach(((e,t)=>e.forEach(sG(s[t],n.outputKeyVals[t],r.outputKeyVals[t]))))}return aG.psbtFromKeyVals(i,{globalMapKeyVals:n.globalKeyVals,inputKeyVals:n.inputKeyVals,outputKeyVals:n.outputKeyVals})};var AG={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=QK;function n(e,t){const n=e[t];if(void 0===n)throw new Error(`No input #${t}`);return n}function r(e,t){const n=e[t];if(void 0===n)throw new Error(`No output #${t}`);return n}function i(e,t,n,r){throw new Error(`Data for ${e} key ${t} is incorrect: Expected ${n} and got ${JSON.stringify(r)}`)}function o(e){return(n,r)=>{for(const o of Object.keys(n)){const a=n[o],{canAdd:s,canAddToArray:l,check:u,expected:A}=t[e+"s"][o]||{},c=!!l;if(u)if(c){if(!Array.isArray(a)||r[o]&&!Array.isArray(r[o]))throw new Error(`Key type ${o} must be an array`);a.every(u)||i(e,o,A,a);const t=r[o]||[],n=new Set;if(!a.every((e=>l(t,e,n))))throw new Error("Can not add duplicate data to array");r[o]=t.concat(a)}else{if(u(a)||i(e,o,A,a),!s(r,a))throw new Error(`Can not add duplicate data to ${e}`);r[o]=a}}}}e.checkForInput=n,e.checkForOutput=r,e.checkHasKey=function(e,t,n){if(e.key[0]<n)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(t&&0!==t.filter((t=>t.key.equals(e.key))).length)throw new Error(`Duplicate Key: ${e.key.toString("hex")}`)},e.getEnumLength=function(e){let t=0;return Object.keys(e).forEach((e=>{Number(isNaN(Number(e)))&&t++})),t},e.inputCheckUncleanFinalized=function(e,t){let n=!1;if(t.nonWitnessUtxo||t.witnessUtxo){const e=!!t.redeemScript,r=!!t.witnessScript,i=!e||!!t.finalScriptSig,o=!r||!!t.finalScriptWitness,a=!!t.finalScriptSig||!!t.finalScriptWitness;n=i&&o&&a}if(!1===n)throw new Error(`Input #${e} has too much or too little data to clean`)},e.updateGlobal=o("global"),e.updateInput=o("input"),e.updateOutput=o("output"),e.addInputAttributes=function(t,r){const i=n(t,t.length-1);e.updateInput(r,i)},e.addOutputAttributes=function(t,n){const i=r(t,t.length-1);e.updateOutput(n,i)},e.defaultVersionSetter=function(e,t){if(!jo(t)||t.length<4)throw new Error("Set Version: Invalid Transaction");return t.writeUInt32LE(e,0),t},e.defaultLocktimeSetter=function(e,t){if(!jo(t)||t.length<4)throw new Error("Set Locktime: Invalid Transaction");return t.writeUInt32LE(e,t.length-4),t}}(AG),Object.defineProperty(EK,"__esModule",{value:!0});const cG=CK,hG=SK,fG=kK,dG=AG;EK.Psbt=class{constructor(e){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:e}}static fromBase64(e,t){const n=ao.from(e,"base64");return this.fromBuffer(n,t)}static fromHex(e,t){const n=ao.from(e,"hex");return this.fromBuffer(n,t)}static fromBuffer(e,t){const n=hG.psbtFromBuffer(e,t),r=new this(n.globalMap.unsignedTx);return Object.assign(r,n),r}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return hG.psbtToBuffer(this)}updateGlobal(e){return dG.updateGlobal(e,this.globalMap),this}updateInput(e,t){const n=dG.checkForInput(this.inputs,e);return dG.updateInput(t,n),this}updateOutput(e,t){const n=dG.checkForOutput(this.outputs,e);return dG.updateOutput(t,n),this}addUnknownKeyValToGlobal(e){return dG.checkHasKey(e,this.globalMap.unknownKeyVals,dG.getEnumLength(fG.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(e),this}addUnknownKeyValToInput(e,t){const n=dG.checkForInput(this.inputs,e);return dG.checkHasKey(t,n.unknownKeyVals,dG.getEnumLength(fG.InputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}addUnknownKeyValToOutput(e,t){const n=dG.checkForOutput(this.outputs,e);return dG.checkHasKey(t,n.unknownKeyVals,dG.getEnumLength(fG.OutputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}addInput(e){this.globalMap.unsignedTx.addInput(e),this.inputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],n=this.inputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(n,e))),dG.addInputAttributes(this.inputs,e),this}addOutput(e){this.globalMap.unsignedTx.addOutput(e),this.outputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],n=this.outputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(n,e))),dG.addOutputAttributes(this.outputs,e),this}clearFinalizedInput(e){const t=dG.checkForInput(this.inputs,e);dG.inputCheckUncleanFinalized(e,t);for(const e of Object.keys(t))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(e)||delete t[e];return this}combine(...e){const t=cG.combine([this].concat(e));return Object.assign(this,t),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}},Object.defineProperty(BK,"__esModule",{value:!0}),BK.Psbt=void 0;const pG=EK,gG=ij,yG=AG,mG=AP,vG=RH,IG=UU,wG=hP,bG=dP,BG=ZH,EG={network:cP.bitcoin,maximumFeeRate:5e3};class CG{constructor(e={},t=new pG.Psbt(new xG)){this.data=t,this.opts=Object.assign({},EG,e),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const n=(e,t,n,r)=>Object.defineProperty(e,t,{enumerable:n,writable:r});n(this,"__CACHE",!1,!0),n(this,"opts",!1,!0)}static fromBase64(e,t={}){const n=ao.from(e,"base64");return this.fromBuffer(n,t)}static fromHex(e,t={}){const n=ao.from(e,"hex");return this.fromBuffer(n,t)}static fromBuffer(e,t={}){const n=pG.Psbt.fromBuffer(e,SG),r=new CG(t,n);return function(e,t){e.ins.forEach((e=>{HG(t,e)}))}(r.__CACHE.__TX,r.__CACHE),r}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(e){this.setVersion(e)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(e){this.setLocktime(e)}get txInputs(){return this.__CACHE.__TX.ins.map((e=>({hash:(0,vG.cloneBuffer)(e.hash),index:e.index,sequence:e.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((e=>{let t;try{t=(0,mG.fromOutputScript)(e.script,this.opts.network)}catch(e){}return{script:(0,vG.cloneBuffer)(e.script),value:e.value,address:t}}))}combine(...e){return this.data.combine(...e.map((e=>e.data))),this}clone(){const e=CG.fromBuffer(this.data.toBuffer());return e.opts=JSON.parse(JSON.stringify(this.opts)),e}setMaximumFeeRate(e){TG(e),this.opts.maximumFeeRate=e}setVersion(e){TG(e),RG(this.data.inputs,"setVersion");const t=this.__CACHE;return t.__TX.version=e,t.__EXTRACTED_TX=void 0,this}setLocktime(e){TG(e),RG(this.data.inputs,"setLocktime");const t=this.__CACHE;return t.__TX.locktime=e,t.__EXTRACTED_TX=void 0,this}setInputSequence(e,t){TG(t),RG(this.data.inputs,"setInputSequence");const n=this.__CACHE;if(n.__TX.ins.length<=e)throw new Error("Input index too high");return n.__TX.ins[e].sequence=t,n.__EXTRACTED_TX=void 0,this}addInputs(e){return e.forEach((e=>this.addInput(e))),this}addInput(e){if(arguments.length>1||!e||void 0===e.hash||void 0===e.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");RG(this.data.inputs,"addInput"),e.witnessScript&&rq(e.witnessScript);const t=this.__CACHE;this.data.addInput(e),HG(t,t.__TX.ins[t.__TX.ins.length-1]);const n=this.data.inputs.length-1,r=this.data.inputs[n];return r.nonWitnessUtxo&&WG(this.__CACHE,r,n),t.__FEE=void 0,t.__FEE_RATE=void 0,t.__EXTRACTED_TX=void 0,this}addOutputs(e){return e.forEach((e=>this.addOutput(e))),this}addOutput(e){if(arguments.length>1||!e||void 0===e.value||void 0===e.address&&void 0===e.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");RG(this.data.inputs,"addOutput");const{address:t}=e;if("string"==typeof t){const{network:n}=this.opts,r=(0,mG.toOutputScript)(t,n);e=Object.assign(e,{script:r})}const n=this.__CACHE;return this.data.addOutput(e),n.__FEE=void 0,n.__FEE_RATE=void 0,n.__EXTRACTED_TX=void 0,this}extractTransaction(e){if(!this.data.inputs.every(kG))throw new Error("Not finalized");const t=this.__CACHE;if(e||function(e,t,n){const r=t.__FEE_RATE||e.getFeeRate(),i=t.__EXTRACTED_TX.virtualSize(),o=r*i;if(r>=n.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in fees, which is ${r} satoshi per byte for a transaction with a VSize of ${i} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}(this,t,this.opts),t.__EXTRACTED_TX)return t.__EXTRACTED_TX;const n=t.__TX.clone();return ZG(this.data.inputs,n,t,!0),n}getFeeRate(){return qG("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return qG("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return(0,yG.checkForInput)(this.data.inputs,0),aq(this.data.inputs.length).forEach((e=>this.finalizeInput(e))),this}finalizeInput(e,t=VG){const n=(0,yG.checkForInput)(this.data.inputs,e),{script:r,isP2SH:i,isP2WSH:o,isSegwit:a}=function(e,t,n){const r=n.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!t.redeemScript,i.isP2WSH=!!t.witnessScript,t.witnessScript)i.script=t.witnessScript;else if(t.redeemScript)i.script=t.redeemScript;else if(t.nonWitnessUtxo){const o=$G(n,t,e),a=r.ins[e].index;i.script=o.outs[a].script}else t.witnessUtxo&&(i.script=t.witnessUtxo.script);return(t.witnessScript||PG(i.script))&&(i.isSegwit=!0),i}(e,n,this.__CACHE);if(!r)throw new Error(`No script found for input #${e}`);!function(e){if(!e.sighashType||!e.partialSig)return;const{partialSig:t,sighashType:n}=e;t.forEach((e=>{const{hashType:t}=bG.signature.decode(e.signature);if(n!==t)throw new Error("Signature sighash does not match input sighash type")}))}(n);const{finalScriptSig:s,finalScriptWitness:l}=t(e,n,r,a,i,o);if(s&&this.data.updateInput(e,{finalScriptSig:s}),l&&this.data.updateInput(e,{finalScriptWitness:l}),!s&&!l)throw new Error(`Unknown error finalizing input #${e}`);return this.data.clearFinalizedInput(e),this}getInputType(e){const t=(0,yG.checkForInput)(this.data.inputs,e),n=nq(eq(e,t,this.__CACHE),e,"input",t.redeemScript||function(e){if(!e)return;const t=bG.decompile(e);if(!t)return;const n=t[t.length-1];var r;if(jo(n)&&!tq(n)&&(r=n,!bG.isCanonicalScriptSignature(r))&&bG.decompile(n))return n}(t.finalScriptSig),t.witnessScript||function(e){if(!e)return;const t=XG(e),n=t[t.length-1];return!tq(n)&&bG.decompile(n)?n:void 0}(t.finalScriptWitness));return("raw"===n.type?"":n.type+"-")+oq(n.meaningfulScript)}inputHasPubkey(e,t){return function(e,t,n,r){const i=eq(n,t,r),{meaningfulScript:o}=nq(i,n,"input",t.redeemScript,t.witnessScript);return iq(e,o)}(t,(0,yG.checkForInput)(this.data.inputs,e),e,this.__CACHE)}inputHasHDKey(e,t){const n=(0,yG.checkForInput)(this.data.inputs,e),r=LG(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}outputHasPubkey(e,t){return function(e,t,n,r){const i=r.__TX.outs[n].script,{meaningfulScript:o}=nq(i,n,"output",t.redeemScript,t.witnessScript);return iq(e,o)}(t,(0,yG.checkForOutput)(this.data.outputs,e),e,this.__CACHE)}outputHasHDKey(e,t){const n=(0,yG.checkForOutput)(this.data.outputs,e),r=LG(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}validateSignaturesOfAllInputs(e){return(0,yG.checkForInput)(this.data.inputs,0),aq(this.data.inputs.length).map((t=>this.validateSignaturesOfInput(t,e))).reduce(((e,t)=>!0===t&&e),!0)}validateSignaturesOfInput(e,t,n){const r=this.data.inputs[e],i=(r||{}).partialSig;if(!r||!i||i.length<1)throw new Error("No signatures to validate");if("function"!=typeof t)throw new Error("Need validator function to validate signatures");const o=n?i.filter((e=>e.pubkey.equals(n))):i;if(o.length<1)throw new Error("No signatures for this pubkey");const a=[];let s,l,u;for(const n of o){const i=bG.signature.decode(n.signature),{hash:o,script:A}=u!==i.hashType?JG(e,Object.assign({},r,{sighashType:i.hashType}),this.__CACHE,!0):{hash:s,script:l};u=i.hashType,s=o,l=A,OG(n.pubkey,A,"verify"),a.push(t(n.pubkey,o,i.signature))}return a.every((e=>!0===e))}signAllInputsHD(e,t=[BG.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");const n=[];for(const r of aq(this.data.inputs.length))try{this.signInputHD(r,e,t),n.push(!0)}catch(e){n.push(!1)}if(n.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(e,t=[BG.Transaction.SIGHASH_ALL]){return new Promise(((n,r)=>{if(!e||!e.publicKey||!e.fingerprint)return r(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const n of aq(this.data.inputs.length))o.push(this.signInputHDAsync(n,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return r(new Error("No inputs were signed"));n()}))}))}signInputHD(e,t,n=[BG.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");return YG(e,this.data.inputs,t).forEach((t=>this.signInput(e,t,n))),this}signInputHDAsync(e,t,n=[BG.Transaction.SIGHASH_ALL]){return new Promise(((r,i)=>{if(!t||!t.publicKey||!t.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=YG(e,this.data.inputs,t).map((t=>this.signInputAsync(e,t,n)));return Promise.all(o).then((()=>{r()})).catch(i)}))}signAllInputs(e,t=[BG.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const n=[];for(const r of aq(this.data.inputs.length))try{this.signInput(r,e,t),n.push(!0)}catch(e){n.push(!1)}if(n.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsAsync(e,t=[BG.Transaction.SIGHASH_ALL]){return new Promise(((n,r)=>{if(!e||!e.publicKey)return r(new Error("Need Signer to sign input"));const i=[],o=[];for(const[n]of this.data.inputs.entries())o.push(this.signInputAsync(n,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return r(new Error("No inputs were signed"));n()}))}))}signInput(e,t,n=[BG.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const{hash:r,sighashType:i}=zG(this.data.inputs,e,t.publicKey,this.__CACHE,n),o=[{pubkey:t.publicKey,signature:bG.signature.encode(t.sign(r),i)}];return this.data.updateInput(e,{partialSig:o}),this}signInputAsync(e,t,n=[BG.Transaction.SIGHASH_ALL]){return Promise.resolve().then((()=>{if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const{hash:r,sighashType:i}=zG(this.data.inputs,e,t.publicKey,this.__CACHE,n);return Promise.resolve(t.sign(r)).then((n=>{const r=[{pubkey:t.publicKey,signature:bG.signature.encode(n,i)}];this.data.updateInput(e,{partialSig:r})}))}))}toBuffer(){return QG(this.__CACHE),this.data.toBuffer()}toHex(){return QG(this.__CACHE),this.data.toHex()}toBase64(){return QG(this.__CACHE),this.data.toBase64()}updateGlobal(e){return this.data.updateGlobal(e),this}updateInput(e,t){return t.witnessScript&&rq(t.witnessScript),this.data.updateInput(e,t),t.nonWitnessUtxo&&WG(this.__CACHE,this.data.inputs[e],e),this}updateOutput(e,t){return this.data.updateOutput(e,t),this}addUnknownKeyValToGlobal(e){return this.data.addUnknownKeyValToGlobal(e),this}addUnknownKeyValToInput(e,t){return this.data.addUnknownKeyValToInput(e,t),this}addUnknownKeyValToOutput(e,t){return this.data.addUnknownKeyValToOutput(e,t),this}clearFinalizedInput(e){return this.data.clearFinalizedInput(e),this}}BK.Psbt=CG;const SG=e=>new xG(e);class xG{constructor(e=ao.from([2,0,0,0,0,0,0,0,0,0])){this.tx=BG.Transaction.fromBuffer(e),function(e){if(!e.ins.every((e=>e.script&&0===e.script.length&&e.witness&&0===e.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(e){if(void 0===e.hash||void 0===e.index||!jo(e.hash)&&"string"!=typeof e.hash||"number"!=typeof e.index)throw new Error("Error adding input.");const t="string"==typeof e.hash?(0,vG.reverseBuffer)(ao.from(e.hash,"hex")):e.hash;this.tx.addInput(t,e.index,e.sequence)}addOutput(e){if(void 0===e.script||void 0===e.value||!jo(e.script)||"number"!=typeof e.value)throw new Error("Error adding output.");this.tx.addOutput(e.script,e.value)}toBuffer(){return this.tx.toBuffer()}}function QG(e){if(!1!==e.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function kG(e){return!!e.finalScriptSig||!!e.finalScriptWitness}function _G(e){return t=>{try{return e({output:t}),!0}catch(e){return!1}}}const NG=_G(wG.p2ms),DG=_G(wG.p2pk),FG=_G(wG.p2pkh),PG=_G(wG.p2wpkh),UG=_G(wG.p2wsh),MG=_G(wG.p2sh);function LG(e){return t=>!!t.masterFingerprint.equals(e.fingerprint)&&!!e.derivePath(t.path).publicKey.equals(t.pubkey)}function TG(e){if("number"!=typeof e||e!==Math.floor(e)||e>4294967295||e<0)throw new Error("Invalid 32 bit integer")}function RG(e,t){e.forEach((e=>{let n=!1,r=[];if(0===(e.partialSig||[]).length){if(!e.finalScriptSig&&!e.finalScriptWitness)return;r=function(e){const t=e.finalScriptSig&&bG.decompile(e.finalScriptSig)||[],n=e.finalScriptWitness&&bG.decompile(e.finalScriptWitness)||[];return t.concat(n).filter((e=>jo(e)&&bG.isCanonicalScriptSignature(e))).map((e=>({signature:e})))}(e)}else r=e.partialSig;if(r.forEach((e=>{const{hashType:r}=bG.signature.decode(e.signature),i=[];switch(r&BG.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&r){case BG.Transaction.SIGHASH_ALL:break;case BG.Transaction.SIGHASH_SINGLE:case BG.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(t)&&(n=!0)})),n)throw new Error("Can not modify transaction, signatures exist.")}))}function OG(e,t,n){if(!iq(e,t))throw new Error(`Can not ${n} for this input with the key ${e.toString("hex")}`)}function HG(e,t){const n=(0,vG.reverseBuffer)(ao.from(t.hash)).toString("hex")+":"+t.index;if(e.__TX_IN_CACHE[n])throw new Error("Duplicate input detected.");e.__TX_IN_CACHE[n]=1}function KG(e,t){return(n,r,i,o)=>{const a=e({redeem:{output:i}}).output;if(!r.equals(a))throw new Error(`${t} for ${o} #${n} doesn't match the scriptPubKey in the prevout`)}}const jG=KG(wG.p2sh,"Redeem script"),GG=KG(wG.p2wsh,"Witness script");function qG(e,t,n,r){if(!n.every(kG))throw new Error(`PSBT must be finalized to calculate ${t}`);if("__FEE_RATE"===e&&r.__FEE_RATE)return r.__FEE_RATE;if("__FEE"===e&&r.__FEE)return r.__FEE;let i,o=!0;return r.__EXTRACTED_TX?(i=r.__EXTRACTED_TX,o=!1):i=r.__TX.clone(),ZG(n,i,r,o),"__FEE_RATE"===e?r.__FEE_RATE:"__FEE"===e?r.__FEE:void 0}function VG(e,t,n,r,i,o){oq(n);throw new Error(`Can not finalize input #${e}`)}function zG(e,t,n,r,i){const o=(0,yG.checkForInput)(e,t),{hash:a,sighashType:s,script:l}=JG(t,o,r,!1,i);return OG(n,l,"sign"),{hash:a,sighashType:s}}function JG(e,t,n,r,i){const o=n.__TX,a=t.sighashType||BG.Transaction.SIGHASH_ALL;if(i&&i.indexOf(a)<0){const e=function(e){let t=e&BG.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&e){case BG.Transaction.SIGHASH_ALL:t+="SIGHASH_ALL";break;case BG.Transaction.SIGHASH_SINGLE:t+="SIGHASH_SINGLE";break;case BG.Transaction.SIGHASH_NONE:t+="SIGHASH_NONE"}return t}(a);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${e}`)}let s,l;if(t.nonWitnessUtxo){const r=$G(n,t,e),i=o.ins[e].hash,a=r.getHash();if(!i.equals(a))throw new Error(`Non-witness UTXO hash for input #${e} doesn't match the hash specified in the prevout`);const s=o.ins[e].index;l=r.outs[s]}else{if(!t.witnessUtxo)throw new Error("Need a Utxo input item for signing");l=t.witnessUtxo}const{meaningfulScript:u,type:A}=nq(l.script,e,"input",t.redeemScript,t.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(A)>=0)s=o.hashForWitnessV0(e,u,l.value,a);else if(PG(u)){const t=wG.p2pkh({hash:u.slice(2)}).output;s=o.hashForWitnessV0(e,t,l.value,a)}else{if(void 0===t.nonWitnessUtxo&&!1===n.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${e} has witnessUtxo but non-segwit script: ${u.toString("hex")}`);r||!1===n.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as Psbt's predecesor (TransactionBuilder - now removed) when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),s=o.hashForSignature(e,u,a)}return{script:u,sighashType:a,hash:s}}function YG(e,t,n){const r=(0,yG.checkForInput)(t,e);if(!r.bip32Derivation||0===r.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=r.bip32Derivation.map((e=>e.masterFingerprint.equals(n.fingerprint)?e:void 0)).filter((e=>!!e));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");const o=i.map((e=>{const t=n.derivePath(e.path);if(!e.pubkey.equals(t.publicKey))throw new Error("pubkey did not match bip32Derivation");return t}));return o}function XG(e){let t=0;function n(){const n=gG.decode(e,t);return t+=gG.decode.bytes,n}function r(){return r=n(),t+=r,e.slice(t-r,t);var r}return function(){const e=n(),t=[];for(let n=0;n<e;n++)t.push(r());return t}()}function WG(e,t,n){e.__NON_WITNESS_UTXO_BUF_CACHE[n]=t.nonWitnessUtxo;const r=BG.Transaction.fromBuffer(t.nonWitnessUtxo);e.__NON_WITNESS_UTXO_TX_CACHE[n]=r;const i=e,o=n;delete t.nonWitnessUtxo,Object.defineProperty(t,"nonWitnessUtxo",{enumerable:!0,get(){const e=i.__NON_WITNESS_UTXO_BUF_CACHE[o],t=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==e)return e;{const e=t.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e,e}},set(e){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e}})}function ZG(e,t,n,r){let i=0;e.forEach(((e,o)=>{if(r&&e.finalScriptSig&&(t.ins[o].script=e.finalScriptSig),r&&e.finalScriptWitness&&(t.ins[o].witness=XG(e.finalScriptWitness)),e.witnessUtxo)i+=e.witnessUtxo.value;else if(e.nonWitnessUtxo){const r=$G(n,e,o),a=t.ins[o].index,s=r.outs[a];i+=s.value}}));const o=t.outs.reduce(((e,t)=>e+t.value),0),a=i-o;if(a<0)throw new Error("Outputs are spending more than Inputs");const s=t.virtualSize();n.__FEE=a,n.__EXTRACTED_TX=t,n.__FEE_RATE=Math.floor(a/s)}function $G(e,t,n){const r=e.__NON_WITNESS_UTXO_TX_CACHE;return r[n]||WG(e,t,n),r[n]}function eq(e,t,n){if(void 0!==t.witnessUtxo)return t.witnessUtxo.script;if(void 0!==t.nonWitnessUtxo)return $G(n,t,e).outs[n.__TX.ins[e].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function tq(e){return 33===e.length&&bG.isCanonicalPubKey(e)}function nq(e,t,n,r,i){const o=MG(e),a=o&&r&&UG(r),s=UG(e);if(o&&void 0===r)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((s||a)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let l;return a?(l=i,jG(t,e,r,n),GG(t,r,i,n),rq(l)):s?(l=i,GG(t,e,i,n),rq(l)):o?(l=r,jG(t,e,r,n)):l=e,{meaningfulScript:l,type:a?"p2sh-p2wsh":o?"p2sh":s?"p2wsh":"raw"}}function rq(e){if(PG(e)||MG(e))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function iq(e,t){const n=(0,IG.hash160)(e),r=bG.decompile(t);if(null===r)throw new Error("Unknown script error");return r.some((t=>"number"!=typeof t&&(t.equals(e)||t.equals(n))))}function oq(e){return PG(e)?"witnesspubkeyhash":FG(e)?"pubkeyhash":NG(e)?"multisig":DG(e)?"pubkey":"nonstandard"}function aq(e){return[...Array(e).keys()]}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Transaction=e.opcodes=e.Psbt=e.Block=e.script=e.payments=e.networks=e.crypto=e.address=void 0;const t=AP;e.address=t;const n=UU;e.crypto=n;const r=cP;e.networks=r;const i=hP;e.payments=i;const o=dP;e.script=o;var a=TH;Object.defineProperty(e,"Block",{enumerable:!0,get:function(){return a.Block}});var s=BK;Object.defineProperty(e,"Psbt",{enumerable:!0,get:function(){return s.Psbt}});var l=gP;Object.defineProperty(e,"opcodes",{enumerable:!0,get:function(){return l.OPS}});var u=ZH;Object.defineProperty(e,"Transaction",{enumerable:!0,get:function(){return u.Transaction}})}(uP);var sq={exports:{}};function lq(e,t){const n=(e=>{const t=(e=>{const t=aP.from(Object.assign(Object.assign({},e),{crv:"K-256"}),"jwk").toString("blk","public"),n=AC.publicKeyConvert(lP.from(t,"hex"),!0);return lP.from(n).toString("hex")})(e);let n=lP.from(t,"hex"),r=32-n.length;for(;r>0;)n=lP.concat([lP.from("00","hex"),n]),r--;return n})(e.publicKeyJwk),r=sD("errors","identityErrorBaseMessage");let i="";switch(t.code){case Ol.Bitcoin:case Ol.Mocknet:case Ol.Testnet:i=function(e,t){return uP.payments.p2pkh({pubkey:e,network:uP.networks[t.code]}).address}(n,t);break;case Ol.Ethmain:case Ol.Ethropst:case Ol.Ethrinkeby:case Ol.Ethgoerli:case Ol.Ethsepolia:i=function(e,t){const n=e.toString("hex"),r=new ww.ec("secp256k1").keyFromPublic(n,"hex").getPublic().encode("hex").slice(2),i=ao;return`0x${sq.exports.keccak256(i.from(r,"hex")).slice(24).toString()}`}(n);break;default:throw new iD("deriveIssuingAddressFromPublicKey",`${r} - ${sD("errors","deriveIssuingAddressFromPublicKey")}`)}return i}function uq(e){if(e){const t="string"==typeof e?e:e.code;return!!Object.keys(jl).some((e=>e===t))&&!!jl[t].test}return!1}!function(e){!function(){var t="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof gu&&gu.versions&&gu.versions.node?r=Ki:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&e.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),l=[4,1024,262144,67108864],u=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],c=[224,256,384,512],h=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],d={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var p=function(e,t,n){return function(r){return new _(e,t,e).update(r)[n]()}},g=function(e,t,n){return function(r,i){return new _(e,t,i).update(r)[n]()}},y=function(e,t,n){return function(t,r,i,o){return b["cshake"+e].update(t,r,i,o)[n]()}},m=function(e,t,n){return function(t,r,i,o){return b["kmac"+e].update(t,r,i,o)[n]()}},v=function(e,t,n,r){for(var i=0;i<f.length;++i){var o=f[i];e[o]=t(n,r,o)}return e},I=function(e,t){var n=p(e,t,"hex");return n.create=function(){return new _(e,t,e)},n.update=function(e){return n.create().update(e)},v(n,p,e,t)},w=[{name:"keccak",padding:[1,256,65536,16777216],bits:c,createMethod:I},{name:"sha3",padding:[6,1536,393216,100663296],bits:c,createMethod:I},{name:"shake",padding:[31,7936,2031616,520093696],bits:h,createMethod:function(e,t){var n=g(e,t,"hex");return n.create=function(n){return new _(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},v(n,g,e,t)}},{name:"cshake",padding:l,bits:h,createMethod:function(e,t){var n=d[e],r=y(e,0,"hex");return r.create=function(r,i,o){return i||o?new _(e,t,r).bytepad([i,o],n):b["shake"+e].create(r)},r.update=function(e,t,n,i){return r.create(t,n,i).update(e)},v(r,y,e,t)}},{name:"kmac",padding:l,bits:h,createMethod:function(e,t){var n=d[e],r=m(e,0,"hex");return r.create=function(r,i,o){return new N(e,t,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(e,t,n,i){return r.create(e,n,i).update(t)},v(r,m,e,t)}}],b={},B=[],E=0;E<w.length;++E)for(var C=w[E],S=C.bits,x=0;x<S.length;++x){var Q=C.name+"_"+S[x];if(B.push(Q),b[Q]=C.createMethod(S[x],C.padding),"sha3"!==C.name){var k=C.name+S[x];B.push(k),b[k]=b[Q]}}function _(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function N(e,t,n){_.call(this,e,t,n)}_.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var i,o,s=this.blocks,l=this.byteCount,A=e.length,c=this.blockCount,h=0,f=this.s;h<A;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<c+1;++i)s[i]=0;if(n)for(i=this.start;h<A&&i<l;++h)s[i>>2]|=e[h]<<u[3&i++];else for(i=this.start;h<A&&i<l;++h)(o=e.charCodeAt(h))<128?s[i>>2]|=o<<u[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<u[3&i++],s[i>>2]|=(128|o>>6&63)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++h)),s[i>>2]|=(240|o>>18)<<u[3&i++],s[i>>2]|=(128|o>>12&63)<<u[3&i++],s[i>>2]|=(128|o>>6&63)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]);if(this.lastByteIndex=i,i>=l){for(this.start=i-l,this.block=s[c],i=0;i<c;++i)f[i]^=s[i];D(f),this.reset=!0}else this.start=i}return this},_.prototype.encode=function(e,t){var n=255&e,r=1,i=[n];for(n=255&(e>>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},_.prototype.encodeString=function(e){var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}var i=0,o=e.length;if(n)i=o;else for(var s=0;s<e.length;++s){var l=e.charCodeAt(s);l<128?i+=1:l<2048?i+=2:l<55296||l>=57344?i+=3:(l=65536+((1023&l)<<10|1023&e.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(e),i},_.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var i=t-n%t,o=[];return o.length=i,this.update(o),this},_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];D(r)}},_.prototype.toString=_.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,l="";a<r;){for(o=0;o<t&&a<r;++o,++a)e=n[o],l+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t==0&&(D(n),o=0)}return i&&(e=n[o],l+=s[e>>4&15]+s[15&e],i>1&&(l+=s[e>>12&15]+s[e>>8&15]),i>2&&(l+=s[e>>20&15]+s[e>>16&15])),l},_.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var l=new Uint32Array(e);a<r;){for(o=0;o<t&&a<r;++o,++a)l[a]=n[o];a%t==0&&D(n)}return i&&(l[o]=n[o],e=e.slice(0,s)),e},_.prototype.buffer=_.prototype.arrayBuffer,_.prototype.digest=_.prototype.array=function(){this.finalize();for(var e,t,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,l=[];s<i;){for(a=0;a<n&&s<i;++a,++s)e=s<<2,t=r[a],l[e]=255&t,l[e+1]=t>>8&255,l[e+2]=t>>16&255,l[e+3]=t>>24&255;s%n==0&&D(r)}return o&&(e=s<<2,t=r[a],l[e]=255&t,o>1&&(l[e+1]=t>>8&255),o>2&&(l[e+2]=t>>16&255)),l},N.prototype=new _,N.prototype.finalize=function(){return this.encode(this.outputBits,!0),_.prototype.finalize.call(this)};var D=function(e){var t,n,r,i,o,a,s,l,u,c,h,f,d,p,g,y,m,v,I,w,b,B,E,C,S,x,Q,k,_,N,D,F,P,U,M,L,T,R,O,H,K,j,G,q,V,z,J,Y,X,W,Z,$,ee,te,ne,re,ie,oe,ae,se,le,ue,Ae;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],l=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(l<<1|u>>>31),n=o^(u<<1|l>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(c<<1|h>>>31),n=s^(h<<1|c>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=l^(f<<1|d>>>31),n=u^(d<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=c^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,p=e[0],g=e[1],z=e[11]<<4|e[10]>>>28,J=e[10]<<4|e[11]>>>28,k=e[20]<<3|e[21]>>>29,_=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,le=e[30]<<9|e[31]>>>23,j=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,U=e[2]<<1|e[3]>>>31,M=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,D=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,Ae=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,T=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,I=e[24]<<11|e[25]>>>21,W=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,F=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,C=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,R=e[26]<<25|e[27]>>>7,O=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,b=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,x=e[18]<<20|e[19]>>>12,Q=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,H=e[38]<<8|e[39]>>>24,K=e[39]<<8|e[38]>>>24,B=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=g^~m&I,e[10]=C^~x&k,e[11]=S^~Q&_,e[20]=U^~L&R,e[21]=M^~T&O,e[30]=q^~z&Y,e[31]=V^~J&X,e[40]=te^~re&oe,e[41]=ne^~ie&ae,e[2]=y^~v&w,e[3]=m^~I&b,e[12]=x^~k&N,e[13]=Q^~_&D,e[22]=L^~R&H,e[23]=T^~O&K,e[32]=z^~Y&W,e[33]=J^~X&Z,e[42]=re^~oe&se,e[43]=ie^~ae&le,e[4]=v^~w&B,e[5]=I^~b&E,e[14]=k^~N&F,e[15]=_^~D&P,e[24]=R^~H&j,e[25]=O^~K&G,e[34]=Y^~W&$,e[35]=X^~Z&ee,e[44]=oe^~se&ue,e[45]=ae^~le&Ae,e[6]=w^~B&p,e[7]=b^~E&g,e[16]=N^~F&C,e[17]=D^~P&S,e[26]=H^~j&U,e[27]=K^~G&M,e[36]=W^~$&q,e[37]=Z^~ee&V,e[46]=se^~ue&te,e[47]=le^~Ae&ne,e[8]=B^~p&y,e[9]=E^~g&m,e[18]=F^~C&x,e[19]=P^~S&Q,e[28]=j^~U&L,e[29]=G^~M&T,e[38]=$^~q&z,e[39]=ee^~V&J,e[48]=ue^~te&re,e[49]=Ae^~ne&ie,e[0]^=A[r],e[1]^=A[r+1]};if(o)e.exports=b;else for(E=0;E<B.length;++E)r[B[E]]=b[B[E]]}()}(sq);var Aq=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const{LinkedDataProof:cq}=JN.suites;class hq extends cq{constructor({issuer:e=null,verificationMethod:t=null,document:n=null,proof:r=null,options:i={}}){if(super({type:"MerkleProof2019"}),this.type="MerkleProof2019",this.issuer=null,this.verificationMethod=null,this.proof=null,this.proofValue=null,this.document=null,this.explorerAPIs=[],this.documentLoader=null,this.proofVerificationProcess=["getTransactionId","computeLocalHash","fetchRemoteHash","compareHashes","checkMerkleRoot","checkReceipt"],this.identityVerificationProcess=["deriveIssuingAddressFromPublicKey","compareIssuingAddress"],this.transactionId="",!n)throw new Error("A document signed by MerkleProof2019 is required for the verification process.");this.issuer=e,this.verificationMethod=t,this.document=n,this.setProof(r),this.setOptions(i),this.getChain()}static decodeMerkleProof2019(e){return new Z_(e.proofValue).decode()}setProof(e=null){const t=null!=e?e:this.document.proof;if(!t)throw new Error("The passed document is not signed.");this.proof=t,this.proofValue=hq.decodeMerkleProof2019(this.proof)}verifyProof({documentLoader:e,verifyIdentity:t}={documentLoader:e=>{},verifyIdentity:!0}){return Aq(this,void 0,void 0,(function*(){let n;this.documentLoader=e;let r="";uq(this.chain)&&(this.adaptProofVerificationProcessToMocknet(),this.adaptIdentityVerificationProcessToMocknet());try{yield this.verifyProcess(this.proofVerificationProcess),t&&(yield this.verifyIdentity()),n=!0}catch(e){console.error(e),n=!1,r=e.message}return{verificationMethod:this.verificationMethod,verified:n,error:r}}))}verifyIdentity(){return Aq(this,void 0,void 0,(function*(){if(null!=this.verificationMethod)try{yield this.verifyProcess(this.identityVerificationProcess)}catch(e){throw new Error(e)}}))}getProofVerificationProcess(){return this.proofVerificationProcess}getIdentityVerificationProcess(){return this.identityVerificationProcess}getIssuerPublicKey(){var e,t;return uq(this.chain)?"This mock chain does not support issuing addresses":null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.issuingAddress)&&void 0!==t?t:""}getIssuanceTime(){var e,t;return null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.time)&&void 0!==t?t:""}getChain(){return this.chain||(this.chain=function(e=null){if(null==e?void 0:e.anchors){const{anchors:t}=e,n=t[0];if("string"==typeof n)return function(e){const t=e.split(":");let n;switch(t[1]){case jl.mocknet.blinkCode:return ZN(jl.mocknet.signatureValue);case jl.bitcoin.blinkCode:n=jl.bitcoin.name;break;case jl.ethmain.blinkCode:n=jl.ethmain.name;break;default:throw new Error("Could not retrieve chain.")}const r=t[2],i=n.toLowerCase()+function(e){const t=e.substr(0,1),n=e.substr(1,e.length-1);return t.toUpperCase()+n.toLowerCase()}(r);return ZN(i)}(n)}return null}(this.proofValue)),this.chain}getTxData(){return this.txData?this.txData:(console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?"),null)}adaptProofVerificationProcessToMocknet(){$N(this.proofVerificationProcess,"getTransactionId"),$N(this.proofVerificationProcess,"fetchRemoteHash"),$N(this.proofVerificationProcess,"checkMerkleRoot")}adaptIdentityVerificationProcessToMocknet(){this.identityVerificationProcess=[]}setOptions(e){var t;this.explorerAPIs=null!==(t=e.explorerAPIs)&&void 0!==t?t:[],e.executeStepMethod&&"function"==typeof e.executeStepMethod&&(this.executeStep=e.executeStepMethod)}executeStep(e,t,n=""){return Aq(this,void 0,void 0,(function*(){return yield t()}))}verifyProcess(e){return Aq(this,void 0,void 0,(function*(){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");yield this[t]()}}))}checkMerkleRoot(){return Aq(this,void 0,void 0,(function*(){yield this.executeStep("checkMerkleRoot",(()=>function(e,t){if(e!==t)throw new iD("checkMerkleRoot",sD("errors","ensureMerkleRootEqual"));return!0}(this.proofValue.merkleRoot,this.txData.remoteHash)),this.type)}))}compareHashes(){return Aq(this,void 0,void 0,(function*(){yield this.executeStep("compareHashes",(()=>function(e,t){if(e!==t)throw new iD("compareHashes",sD("errors","ensureHashesEqual"));return!0}(this.localDocumentHash,this.proofValue.targetHash)),this.type)}))}computeLocalHash(){return Aq(this,void 0,void 0,(function*(){this.localDocumentHash=yield this.executeStep("computeLocalHash",(()=>Aq(this,void 0,void 0,(function*(){return yield function(e,t=null,n=(e=>{})){return lD(this,void 0,void 0,(function*(){e["@context"].find((e=>{return(t=e)===Object(t)&&"@vocab"in e;var t}))||e["@context"].push({"@vocab":"http://fallback.org/"});const r=JSON.parse(JSON.stringify(e));if(Array.isArray(r.proof)){if(!t)throw new iD("computeLocalHash",sD("errors","noProofSpecified"));const e=r.proof.findIndex((e=>e.proofValue===t.proofValue));r.proof=r.proof.slice(0,e)}else delete r.proof;const i={algorithm:"URDNA2015",format:"application/nquads",documentLoader:function(e){return lD(this,void 0,void 0,(function*(){return null!=n&&(yield n(e)),e in jh?{contextUrl:null,document:jh[e],documentUrl:e}:ov.documentLoader(e)}))}};let o;try{o=yield ov.normalize(r,i)}catch(e){throw console.error(e),new iD("computeLocalHash",sD("errors","failedJsonLdNormalization"))}const a=function(e){const t=e.split("\n"),n=/<http:\/\/fallback\.org\/(.*)>/,r=t.map((e=>n.exec(e))).filter((e=>null!=e));if(r.length>0){const e=r.map((e=>e[1])).sort();return Array.from(new Set(e))}return null}(o);if(a)throw new iD("computeLocalHash",`${sD("errors","foundUnmappedFields")}: ${a.join(", ")}`);return lS(function(e){const t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(o))}))}(this.document,this.proof,this.documentLoader)}))),this.type)}))}checkReceipt(){return Aq(this,void 0,void 0,(function*(){yield this.executeStep("checkReceipt",(()=>function(e){let t=e.targetHash;const n=e.merkleRoot;try{const n=e.path;if(n&&t)for(const e in n){const r=n[e];let i;if(void 0!==r.left)i=rD(`${r.left}${t}`),t=lS(i);else{if(void 0===r.right)throw new iD("checkReceipt","Trigger catch error.");i=rD(`${t}${r.right}`),t=lS(i)}}}catch(e){throw new iD("checkReceipt",sD("errors","ensureValidReceipt"))}if(t!==n)throw new iD("checkReceipt",sD("errors","invalidMerkleReceipt"))}(this.proofValue)),this.type)}))}getTransactionId(){return Aq(this,void 0,void 0,(function*(){return this.transactionId=function(e=null){if(!e)throw new Error("DecodedProof is not set");const{anchors:t}=e,n=t[0];if("string"==typeof n)return n.split(":").pop();throw new Error("Could not retrieve transaction id as was provided an unexpected format")}(this.proofValue),yield this.executeStep("getTransactionId",(()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new iD("getTransactionId",sD("errors","isTransactionIdValid"))}(this.transactionId)),this.type)}))}fetchRemoteHash(){return Aq(this,void 0,void 0,(function*(){this.txData=yield this.executeStep("fetchRemoteHash",(()=>Aq(this,void 0,void 0,(function*(){var e;return yield Lh({transactionId:this.transactionId,chain:null===(e=this.chain)||void 0===e?void 0:e.code,explorerAPIs:this.explorerAPIs})}))),this.type)}))}deriveIssuingAddressFromPublicKey(){return Aq(this,void 0,void 0,(function*(){this.derivedIssuingAddress=yield this.executeStep("deriveIssuingAddressFromPublicKey",(()=>lq(this.verificationMethod,this.chain)),this.type)}))}compareIssuingAddress(){return Aq(this,void 0,void 0,(function*(){yield this.executeStep("compareIssuingAddress",(()=>function(e,t){const n=sD("errors","identityErrorBaseMessage");if(e!==t)throw new iD("compareIssuingAddress",`${n} - ${sD("errors","compareIssuingAddress")}`)}(this.getIssuerPublicKey(),this.derivedIssuingAddress)),this.type)}))}}class fq{constructor(e){}}function dq(e){return Array.isArray(e)?e.find((e=>"ChainedProof2021"!==e.type)).verificationMethod:e.verificationMethod}var pq,gq;!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkImagesIntegrity="checkImagesIntegrity",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.deriveIssuingAddressFromPublicKey="deriveIssuingAddressFromPublicKey",e.compareIssuingAddress="compareIssuingAddress",e.checkAuthenticity="checkAuthenticity"}(pq||(pq={}));class yq extends fq{proofVerificationProcess=[pq.parseIssuerKeys,pq.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;verificationMethodPublicKey;derivedIssuingAddress;hasDid;proof;type="MerkleProof2019";suite;constructor(e){var t;super(e),this.executeStep=e.executeStep,this.documentToVerify=e.document,this.explorerAPIs=e.explorerAPIs,this.proof=e.proof,this.issuer=e.issuer,this.validateProofType(),this.receipt=(t=this.proof,hq.decodeMerkleProof2019(t)),this.transactionId=zC.certificates.getTransactionId(this.receipt),this.setHasDid()}async init(){await this.setVerificationSuite(),this.chain=this.suite.getChain(),this.adaptVerificationProcessToChain()}async verifyProof(){await this.suite.verifyProof({verifyIdentity:!1}),await this.verifyProcess(this.proofVerificationProcess)}async verifyIdentity(){await this.suite.verifyIdentity()}getProofVerificationSteps(e){return[...this.suite.getProofVerificationProcess(),...this.proofVerificationProcess].map((t=>zC.verifier.convertToVerificationSubsteps(e,t)))}getIdentityVerificationSteps(e){return this.hasDid?this.suite.getIdentityVerificationProcess().map((t=>zC.verifier.convertToVerificationSubsteps(e,t))):[]}getIssuerPublicKey(){return this.suite.getIssuerPublicKey()}getIssuanceTime(){return this.suite.getIssuanceTime()}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){return new URL(this.getIssuerProfileUrl())?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.proof.created}getChain(){return this.suite.getChain()}getReceipt(){return this.receipt}getTransactionIdString(){return zC.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}async executeStep(e,t,n){throw new Error("executeStep method needs to be overwritten by injecting from Verifier")}async setVerificationSuite(){await this.setIssuerFromProofVerificationMethod(),this.verificationMethodPublicKey=gS(this.getTargetVerificationMethodContainer(),dq(this.proof)),this.suite=new hq({document:this.documentToVerify,proof:this.proof,verificationMethod:this.verificationMethodPublicKey,options:{explorerAPIs:this.explorerAPIs,executeStepMethod:this.executeStep}})}adaptVerificationProcessToChain(){zC.chains.isMockChain(this.chain)&&(sf(this.proofVerificationProcess,pq.parseIssuerKeys),sf(this.proofVerificationProcess,pq.checkAuthenticity))}getTargetVerificationMethodContainer(){return this.issuer.didDocument??this.issuer}isProofChain(){return"ChainedProof2021"===this.proof.type}async setIssuerFromProofVerificationMethod(){if(this.isProofChain()){const e=this.proof.verificationMethod.split("#")[0];this.issuer=await zC.verifier.getIssuerProfile(e)}}setHasDid(){if(this.isProofChain()){const e=this.proof.verificationMethod.split("#")[0];this.hasDid=df(e)}else this.hasDid=!!this.issuer.didDocument}validateProofType(){const e=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}async verifyProcess(e){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(pq.parseIssuerKeys,(()=>zC.verifier.parseIssuerKeys(this.issuer)),this.type)}async checkAuthenticity(){await this.executeStep(pq.checkAuthenticity,(()=>dS(this.issuerPublicKeyList,this.getIssuerPublicKey(),this.getIssuanceTime())),this.type)}}!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.checkAuthenticity="checkAuthenticity"}(gq||(gq={}));class mq extends fq{verificationProcess=[gq.getTransactionId,gq.computeLocalHash,gq.fetchRemoteHash,gq.compareHashes,gq.checkMerkleRoot,gq.checkReceipt,gq.parseIssuerKeys,gq.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;proof;type="MerkleProof2017";constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.explorerAPIs=e.explorerAPIs,this.issuer=e.issuer,this.proof=e.proof,this.validateProofType(),this.receipt=this.documentToVerify.signature,this.chain=zC.certificates.getChain("",this.receipt),this.transactionId=zC.certificates.getTransactionId(this.receipt),this.adaptVerificationProcessToChain()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(e){return this.verificationProcess.map((t=>zC.verifier.convertToVerificationSubsteps(e,t)))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return zC.chains.isMockChain(this.chain)?"This mock chain does not support issuing addresses":this.txData?this.txData.issuingAddress:void console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?")}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){return new URL(this.getIssuerProfileUrl())?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.documentToVerify.issuedOn}getChain(){return this.chain}getReceipt(){return this.receipt}getTransactionIdString(){return zC.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}validateProofType(){if(this.proof.type[0]!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${this.proof.type[0]}`)}adaptVerificationProcessToChain(){zC.chains.isMockChain(this.chain)&&(sf(this.verificationProcess,gq.getTransactionId),sf(this.verificationProcess,gq.fetchRemoteHash),sf(this.verificationProcess,gq.parseIssuerKeys),sf(this.verificationProcess,gq.checkMerkleRoot),sf(this.verificationProcess,gq.checkAuthenticity))}async executeStep(e,t,n){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}async getTransactionId(){await this.executeStep(gq.getTransactionId,(()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new tf("getTransactionId",Wh("errors","isTransactionIdValid"))}(this.transactionId)),this.type)}async computeLocalHash(){this.localHash=await this.executeStep(gq.computeLocalHash,(async()=>await fS(this.documentToVerify)),this.type)}async fetchRemoteHash(){this.txData=await this.executeStep(gq.fetchRemoteHash,(async()=>await zC.verifier.lookForTx({transactionId:this.transactionId,chain:this.chain.code,explorerAPIs:this.explorerAPIs})),this.type)}async compareHashes(){await this.executeStep(gq.compareHashes,(()=>function(e,t){if(e!==t)throw new tf("compareHashes",Wh("errors","ensureHashesEqual"));return!0}(this.localHash,this.receipt.targetHash)),this.type)}async checkMerkleRoot(){await this.executeStep(gq.checkMerkleRoot,(()=>function(e,t){if(e!==t)throw new tf("checkMerkleRoot",Wh("errors","ensureMerkleRootEqual"));return!0}(this.receipt.merkleRoot,this.txData.remoteHash)),this.type)}async checkReceipt(){await this.executeStep(gq.checkReceipt,(()=>function(e){let t=e.targetHash;const n=e.merkleRoot;try{const n=e.proof||e.path;if(n)for(const e in n){const r=n[e];let i;if(void 0!==r.left)i=uS(`${r.left}${t}`),t=lS(i);else{if(void 0===r.right)throw new tf("checkReceipt","Trigger catch error.");i=uS(`${t}${r.right}`),t=lS(i)}}}catch(e){throw new tf("checkReceipt",Wh("errors","ensureValidReceipt"))}if(t!==n)throw new tf("checkReceipt",Wh("errors","invalidMerkleReceipt"))}(this.receipt)),this.type)}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(gq.parseIssuerKeys,(()=>zC.verifier.parseIssuerKeys(this.issuer)),this.type)}async checkAuthenticity(){await this.executeStep(gq.checkAuthenticity,(()=>dS(this.issuerPublicKeyList,this.txData.issuingAddress,this.txData.time)),this.type)}}const vq={};function Iq(e,t){return function(e,t,n){if(!(e instanceof Uint8Array))throw new TypeError('"input" must be a Uint8Array.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');if(0===e.length)return"";let r="",i=0;const o=t.length,a=t.charAt(0),s=[0];for(i=0;i<e.length;++i){let t=e[i];for(let e=0;e<s.length;++e)t+=s[e]<<8,s[e]=t%o,t=t/o|0;for(;t>0;)s.push(t%o),t=t/o|0}for(i=0;0===e[i]&&i<e.length-1;++i)r+=a;for(i=s.length-1;i>=0;--i)r+=t[s[i]];if(n){const e=new RegExp(".{1,"+n+"}","g");r=r.match(e).join("\r\n")}return r}(e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",t)}function wq(e){return function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if(0===e.length)return new Uint8Array;let n=vq[t];if(!n){n=vq[t]=[];for(let e=0;e<t.length;++e)n[t.charCodeAt(e)]=e}e=e.replace(/\s/g,"");const r=t.length,i=t.charAt(0),o=[0];for(let t=0;t<e.length;t++){const i=n[e.charCodeAt(t)];if(void 0===i)return;let a=i;for(let e=0;e<o.length;++e)a+=o[e]*r,o[e]=255&a,a>>=8;for(;a>0;)o.push(255&a),a>>=8}for(let t=0;e[t]===i&&t<e.length-1;++t)o.push(0);return new Uint8Array(o.reverse())}
|
|
637
|
+
const zN={};var JN=zN;const YN=oN;Object.assign(zN,YN);const XN=class{async add(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i}={}){if(!t)throw new TypeError('"options.suite" is required.');if(!n)throw new TypeError('"options.purpose" is required.');r=r?mN(r):vN,void 0===i?i=wN:!1===i&&(i=void 0);const o={...e};delete o.proof;const a=await t.createProof({document:o,purpose:n,documentLoader:r,expansionMap:i});return yN.addValue(e,"proof",a),e}async verify(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i}={}){if(!t)throw new TypeError('"options.suite" is required.');if(!n)throw new TypeError('"options.purpose" is required.');const o=Array.isArray(t)?t:[t];if(0===o.length)throw new TypeError("At least one suite is required.");r=r?mN(r):vN,void 0===i?i=wN:!1===i&&(i=void 0);try{e={...e};const{proofSet:t,document:a}=await async function({document:e}){let t;if(t=yN.getValues(e,"proof"),delete e.proof,0===t.length)throw new Error("No matching proofs found in the given document.");const n=e["@context"]||gN.SECURITY_CONTEXT_URL;return t=t.map((e=>({"@context":n,...e}))),{proofSet:t,document:e}}({document:e,documentLoader:r,expansionMap:i});e=a;const s=await async function({document:e,suites:t,proofSet:n,purpose:r,documentLoader:i,expansionMap:o}){const a=Array.isArray(r)?r:[r],s=new Map,l=new Map,u=new Map;if(await Promise.all(a.map((r=>async function({purposeToProofs:e,proofToSuite:t,purpose:n,proofSet:r,suites:i,suiteMatchQueue:o,document:a,documentLoader:s,expansionMap:l}){for(const u of r){if(!await n.match(u,{document:a,documentLoader:s,expansionMap:l}))continue;let r=!1;for(const e of i){let n=o.get(e);n||o.set(e,n=new Map);let i=n.get(u);if(i||(i=e.matchProof({proof:u,document:a,documentLoader:s,expansionMap:l}),n.set(u,i)),await i){r=!0,t.set(u,e);break}}if(r){const t=e.get(n);t?t.push(u):e.set(n,[u])}}}({purposeToProofs:s,proofToSuite:l,purpose:r,proofSet:n,suites:t,suiteMatchQueue:u,document:e,documentLoader:i,expansionMap:o})))),s.size<a.length)return[];const A=new Map;return await Promise.all([...l.entries()].map((async([t,n])=>{let r;try{let a;const s={validate:async(e,{verificationMethod:t})=>(a=t,{valid:!0})},{verified:l,verificationMethod:u,error:A}=await n.verifyProof({proof:t,document:e,purpose:s,documentLoader:i,expansionMap:o});a||(a=u),r={proof:t,verified:l,verificationMethod:a,error:A}}catch(e){r={proof:t,verified:!1,error:e}}r.error&&bN(r.error),A.set(t,r)}))),await Promise.all([...s.entries()].map((async([t,n])=>{for(const r of n){const n=A.get(r);if(!n.verified)continue;const{verificationMethod:a}=n,s=l.get(r);let u;try{u=await t.validate(r,{document:e,suite:s,verificationMethod:a,documentLoader:i,expansionMap:o})}catch(e){u={valid:!1,error:e}}n.purposeResult?Array.isArray(n.purposeResult)?n.purposeResult.push(u):n.purposeResult=[n.purposeResult,u]:n.purposeResult=u,u.valid||(bN(u.error),n.error||(n.verified=!1,n.error=u.error))}}))),[...A.values()]}({document:e,suites:o,proofSet:t,purpose:n,documentLoader:r,expansionMap:i});if(0===s.length){const e=new Error("Did not verify any proofs; insufficient proofs matched the acceptable suite(s) and required purpose(s).");throw e.name="NotFoundError",e}const l=s.some((e=>e.verified));if(!l){const e=[].concat(...s.filter((e=>e.error)).map((e=>e.error))),t={verified:l,results:s};return e.length>0&&(t.error=e),t}return{verified:l,results:s}}catch(e){return bN(e),{verified:!1,error:e}}}},WN=EN;function ZN(e){const t=Object.keys(jl).map((e=>jl[e])).find((t=>t.signatureValue===e));return t}function $N(e,t){const n=e.findIndex((e=>e===t));n>-1&&e.splice(n,1)}zN.sign=async function(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i,addSuiteContext:o=!0}={}){if("object"!=typeof e)throw new TypeError('The "document" parameter must be an object.');t.ensureSuiteContext({document:e,addSuiteContext:o});try{return await(new XN).add(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i})}catch(e){if(!r&&"jsonld.InvalidUrl"===e.name){const{details:{url:t}}=e,n=new Error(`A URL "${t}" could not be fetched; you need to pass "documentLoader" or resolve the URL before calling "sign".`);throw n.cause=e,n}throw e}},zN.verify=async function(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i}={}){if("object"!=typeof e)throw new TypeError('The "document" parameter must be an object.');const o=await(new XN).verify(e,{suite:t,purpose:n,documentLoader:r,expansionMap:i}),{error:a}=o;if(a)if(r||"jsonld.InvalidUrl"!==a.name)o.error=new WN(a);else{const{details:{url:e}}=a,t=new Error(`A URL "${e}" could not be fetched; you need to pass "documentLoader" or resolve the URL before calling "verify".`);o.error=new WN(t)}return o},zN.suites=MN.suites,zN.purposes=VN.purposes,Object.assign(zN,AN);var eD={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",creator:{"@id":"dc:creator","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"sec:expiration","@type":"xsd:dateTime"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:"bc:verification",publicKeys:"bc:publicKeys",ChainpointSHA256v2:"cp:ChainpointSHA256v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"}]},tD={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"bc:created","@type":"xsd:dateTime"},name:{"@id":"schema:name"}}},nD={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType","@type":"@id"},contentEncoding:{"@id":"bc:contentEncoding","@type":"@id"},content:{"@id":"bc:content","@type":"@id"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey","@type":"@id"},url:{"@id":"schema:url","@type":"@id"},image:{"@id":"schema:image","@type":"@id"}}};function rD(e){e=e.trim();const t=[];for(let n=0;n<e.length;n+=2)t.push(parseInt(e.substring(n,n+2),16));return t}jh["https://w3id.org/blockcerts/schema/2.0-alpha/context.json"]=eD,jh["https://www.blockcerts.org/schema/2.0-alpha/context.json"]=eD,jh["https://www.blockcerts.org/schema/3.0-alpha/context.json"]=tD,jh["https://w3id.org/blockcerts/schema/3.0-alpha/context.json"]=tD,jh["https://w3id.org/blockcerts/v3.0-alpha"]=tD,jh["https://www.blockcerts.org/schema/3.0-beta/context.json"]=nD,jh["https://w3id.org/blockcerts/schema/3.0-beta/context.json"]=nD,jh["https://w3id.org/blockcerts/v3.0-beta"]=nD,jh["https://w3id.org/security/suites/ed25519-2020/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},Ed25519VerificationKey2020:{"@id":"https://w3id.org/security#Ed25519VerificationKey2020","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},Ed25519Signature2020:{"@id":"https://w3id.org/security#Ed25519Signature2020","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};class iD extends Error{constructor(e,t){super(t),this.stepCode=e}}var oD="en-US",aD={"en-US":{errors:{ensureHashesEqual:"Computed hash does not match remote hash",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},fr:{errors:{ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",identityErrorBaseMessage:"Identité de l'émetteur invalide",deriveIssuingAddressFromPublicKey:"Cette blockchain n'est pas supportée pour la vérification de l'identité décentralisée.",compareIssuingAddress:"La méthode de vérification n'a pas permis d'établir l'identité de l'émetteur.",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",noProofSpecified:"La propriété 'proof' du document est un tableau mais aucune preuve n'a été passée pour savoir ce qu'il faut vérifier"}},es:{errors:{ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",identityErrorBaseMessage:"Identitad del emisor inválida",deriveIssuingAddressFromPublicKey:"No se puede validar la identitad decentalisada con esta cadena binaria.",compareIssuingAddress:"El metodo de verificación no corresponde a la identitad del emisor.",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",noProofSpecified:"La propiedad 'proof' del documento es una lista, pero no prueba especifica ha sido declarada para conocer el punto de verificación"}},mt:{errors:{ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},"it-IT":{errors:{ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},ja:{errors:{ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}}};function sD(e,t){return e&&t?aD[oD]?aD[oD][e]?aD[oD][e][t]?aD[oD][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}var lD=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class uD extends Error{constructor(e){super(e||"This operation is not supported for this key type")}}var AD=uD;class cD extends Error{constructor(){super("This has not been implemented yet")}}var hD=cD;const fD=hD;var dD,pD=class{constructor(e){this.params=e}fromPrivatePKCS1(e){throw new fD}fromPrivatePKCS8(e){throw new fD}fromPublicPKCS1(e){throw new fD}fromPublicPKCS8(e){throw new fD}fromPrivateBlk(e){throw new fD}fromPublicBlk(e){throw new fD}fromJwk(e){throw new fD}toPrivatePKCS1(e){throw new fD}toPrivatePKCS8(e){throw new fD}toPublicPKCS1(e){throw new fD}toPublicPKCS8(e){throw new fD}toPrivateBlk(e){throw new fD}toPublicBlk(e){throw new fD}toPrivateJwk(e){throw new fD}toPublicJwk(e){throw new fD}static formatPem(e,t){return`-----BEGIN ${t} KEY-----\n`+e.match(/.{1,64}/g).join("\n")+`\n-----END ${t} KEY-----`}},gD={},yD={},mD={},vD=qo,ID=vD.Buffer,wD={};for(dD in vD)vD.hasOwnProperty(dD)&&"SlowBuffer"!==dD&&"Buffer"!==dD&&(wD[dD]=vD[dD]);var bD=wD.Buffer={};for(dD in ID)ID.hasOwnProperty(dD)&&"allocUnsafe"!==dD&&"allocUnsafeSlow"!==dD&&(bD[dD]=ID[dD]);if(wD.Buffer.prototype=ID.prototype,bD.from&&bD.from!==Uint8Array.from||(bD.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return ID(e,t,n)}),bD.alloc||(bD.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=ID(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!wD.kStringMaxLength)try{wD.kStringMaxLength=gu.binding("buffer").kStringMaxLength}catch(e){}wD.constants||(wD.constants={MAX_LENGTH:wD.kMaxLength},wD.kStringMaxLength&&(wD.constants.MAX_STRING_LENGTH=wD.kStringMaxLength));var BD=wD,ED={};const CD=Ow.exports;function SD(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function xD(e,t){this.path=e,this.rethrow(t)}ED.Reporter=SD,SD.prototype.isError=function(e){return e instanceof xD},SD.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},SD.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},SD.prototype.enterKey=function(e){return this._reporterState.path.push(e)},SD.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},SD.prototype.leaveKey=function(e,t,n){const r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[t]=n)},SD.prototype.path=function(){return this._reporterState.path.join("/")},SD.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},SD.prototype.leaveObject=function(e){const t=this._reporterState,n=t.obj;return t.obj=e,n},SD.prototype.error=function(e){let t;const n=this._reporterState,r=e instanceof xD;if(t=r?e:new xD(n.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!n.options.partial)throw t;return r||n.errors.push(t),t},SD.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},CD(xD,Error),xD.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,xD),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this};var QD={};const kD=Ow.exports,_D=ED.Reporter,ND=BD.Buffer;function DD(e,t){_D.call(this,t),ND.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function FD(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return FD.isEncoderBuffer(e)||(e=new FD(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=ND.byteLength(e);else{if(!ND.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}kD(DD,_D),QD.DecoderBuffer=DD,DD.isDecoderBuffer=function(e){return e instanceof DD||"object"==typeof e&&ND.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},DD.prototype.save=function(){return{offset:this.offset,reporter:_D.prototype.save.call(this)}},DD.prototype.restore=function(e){const t=new DD(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,_D.prototype.restore.call(this,e.reporter),t},DD.prototype.isEmpty=function(){return this.offset===this.length},DD.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},DD.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const n=new DD(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},DD.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},QD.EncoderBuffer=FD,FD.isEncoderBuffer=function(e){return e instanceof FD||"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},FD.prototype.join=function(e,t){return e||(e=ND.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(n){n.join(e,t),t+=n.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):ND.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e};const PD=ED.Reporter,UD=QD.EncoderBuffer,MD=QD.DecoderBuffer,LD=Ew,TD=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],RD=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(TD);function OD(e,t,n){const r={};this._baseState=r,r.name=n,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}var HD=OD;const KD=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];OD.prototype.clone=function(){const e=this._baseState,t={};KD.forEach((function(n){t[n]=e[n]}));const n=new this.constructor(t.parent);return n._baseState=t,n},OD.prototype._wrap=function(){const e=this._baseState;RD.forEach((function(t){this[t]=function(){const n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}}),this)},OD.prototype._init=function(e){const t=this._baseState;LD(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),LD.equal(t.children.length,1,"Root node can have only one child")},OD.prototype._useArgs=function(e){const t=this._baseState,n=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==n.length&&(LD(null===t.children),t.children=n,n.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(LD(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(n){n==(0|n)&&(n|=0);const r=e[n];t[r]=n})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){OD.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),TD.forEach((function(e){OD.prototype[e]=function(){const t=this._baseState,n=Array.prototype.slice.call(arguments);return LD(null===t.tag),t.tag=e,this._useArgs(n),this}})),OD.prototype.use=function(e){LD(e);const t=this._baseState;return LD(null===t.use),t.use=e,this},OD.prototype.optional=function(){return this._baseState.optional=!0,this},OD.prototype.def=function(e){const t=this._baseState;return LD(null===t.default),t.default=e,t.optional=!0,this},OD.prototype.explicit=function(e){const t=this._baseState;return LD(null===t.explicit&&null===t.implicit),t.explicit=e,this},OD.prototype.implicit=function(e){const t=this._baseState;return LD(null===t.explicit&&null===t.implicit),t.implicit=e,this},OD.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},OD.prototype.key=function(e){const t=this._baseState;return LD(null===t.key),t.key=e,this},OD.prototype.any=function(){return this._baseState.any=!0,this},OD.prototype.choice=function(e){const t=this._baseState;return LD(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},OD.prototype.contains=function(e){const t=this._baseState;return LD(null===t.use),t.contains=e,this},OD.prototype._decode=function(e,t){const n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));let r,i=n.default,o=!0,a=null;if(null!==n.key&&(a=e.enterKey(n.key)),n.optional){let r=null;if(null!==n.explicit?r=n.explicit:null!==n.implicit?r=n.implicit:null!==n.tag&&(r=n.tag),null!==r||n.any){if(o=this._peekTag(e,r,n.any),e.isError(o))return o}else{const r=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(r)}}if(n.obj&&o&&(r=e.enterObject()),o){if(null!==n.explicit){const t=this._decodeTag(e,n.explicit);if(e.isError(t))return t;e=t}const r=e.offset;if(null===n.use&&null===n.choice){let t;n.any&&(t=e.save());const r=this._decodeTag(e,null!==n.implicit?n.implicit:n.tag,n.any);if(e.isError(r))return r;n.any?i=e.raw(t):e=r}if(t&&t.track&&null!==n.tag&&t.track(e.path(),r,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(e,t)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const r=new MD(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(r,t)}}return n.obj&&o&&(i=e.leaveObject(r)),null===n.key||null===i&&!0!==o?null!==a&&e.exitKey(a):e.leaveKey(a,n.key,i),i},OD.prototype._decodeGeneric=function(e,t,n){const r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},OD.prototype._getUse=function(e,t){const n=this._baseState;return n.useDecoder=this._use(e,t),LD(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},OD.prototype._decodeChoice=function(e,t){const n=this._baseState;let r=null,i=!1;return Object.keys(n.choice).some((function(o){const a=e.save(),s=n.choice[o];try{const n=s._decode(e,t);if(e.isError(n))return!1;r={type:o,value:n},i=!0}catch(t){return e.restore(a),!1}return!0}),this),i?r:e.error("Choice not matched")},OD.prototype._createEncoderBuffer=function(e){return new UD(e,this.reporter)},OD.prototype._encode=function(e,t,n){const r=this._baseState;if(null!==r.default&&r.default===e)return;const i=this._encodeValue(e,t,n);return void 0===i||this._skipDefault(i,t,n)?void 0:i},OD.prototype._encodeValue=function(e,t,n){const r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new PD);let i=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}let o=null,a=!1;if(r.any)i=this._createEncoderBuffer(e);else if(r.choice)i=this._encodeChoice(e,t);else if(r.contains)o=this._getUse(r.contains,n)._encode(e,t),a=!0;else if(r.children)o=r.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");const r=t.enterKey(n._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i}),this).filter((function(e){return e})),o=this._createEncoderBuffer(o);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,o=this._createEncoderBuffer(e.map((function(n){const r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)}),n))}else null!==r.use?i=this._getUse(r.use,n)._encode(e,t):(o=this._encodePrimitive(r.tag,e),a=!0);if(!r.any&&null===r.choice){const e=null!==r.implicit?r.implicit:r.tag,n=null===r.implicit?"universal":"context";null===e?null===r.use&&t.error("Tag could be omitted only for .use()"):null===r.use&&(i=this._encodeComposite(e,a,n,o))}return null!==r.explicit&&(i=this._encodeComposite(r.explicit,!1,"context",i)),i},OD.prototype._encodeChoice=function(e,t){const n=this._baseState,r=n.choice[e.type];return r||LD(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},OD.prototype._encodePrimitive=function(e,t){const n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},OD.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},OD.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var jD={};!function(e){function t(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const r=e[n];t[r]=n})),t}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t(e.tag)}(jD);const GD=Ow.exports,qD=BD.Buffer,VD=HD,zD=jD;function JD(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new XD,this.tree._init(e.body)}var YD=JD;function XD(e){VD.call(this,"der",e)}function WD(e){return e<10?"0"+e:e}JD.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},GD(XD,VD),XD.prototype._encodeComposite=function(e,t,n,r){const i=function(e,t,n,r){let i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),zD.tagByName.hasOwnProperty(e))i=zD.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return r.error("Unknown tag: "+e);i=e}return i>=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=zD.tagClassByName[n||"universal"]<<6,i)}(e,t,n,this.reporter);if(r.length<128){const e=qD.alloc(2);return e[0]=i,e[1]=r.length,this._createEncoderBuffer([e,r])}let o=1;for(let e=r.length;e>=256;e>>=8)o++;const a=qD.alloc(2+o);a[0]=i,a[1]=128|o;for(let e=1+o,t=r.length;t>0;e--,t>>=8)a[e]=255&t;return this._createEncoderBuffer([a,r])},XD.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=qD.alloc(2*e.length);for(let n=0;n<e.length;n++)t.writeUInt16BE(e.charCodeAt(n),2*n);return this._createEncoderBuffer(t)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},XD.prototype._encodeObjid=function(e,t,n){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s.]+/g);for(let t=0;t<e.length;t++)e[t]|=0}else if(Array.isArray(e)){e=e.slice();for(let t=0;t<e.length;t++)e[t]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!n){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let r=0;for(let t=0;t<e.length;t++){let n=e[t];for(r++;n>=128;n>>=7)r++}const i=qD.alloc(r);let o=i.length-1;for(let t=e.length-1;t>=0;t--){let n=e[t];for(i[o--]=127&n;(n>>=7)>0;)i[o--]=128|127&n}return this._createEncoderBuffer(i)},XD.prototype._encodeTime=function(e,t){let n;const r=new Date(e);return"gentime"===t?n=[WD(r.getUTCFullYear()),WD(r.getUTCMonth()+1),WD(r.getUTCDate()),WD(r.getUTCHours()),WD(r.getUTCMinutes()),WD(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[WD(r.getUTCFullYear()%100),WD(r.getUTCMonth()+1),WD(r.getUTCDate()),WD(r.getUTCHours()),WD(r.getUTCMinutes()),WD(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},XD.prototype._encodeNull=function(){return this._createEncoderBuffer("")},XD.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!qD.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=qD.from(t)}if(qD.isBuffer(e)){let t=e.length;0===e.length&&t++;const n=qD.alloc(t);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let t=e;t>=256;t>>=8)n++;const r=new Array(n);for(let t=r.length-1;t>=0;t--)r[t]=255&e,e>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(qD.from(r))},XD.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},XD.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},XD.prototype._skipDefault=function(e,t,n){const r=this._baseState;let i;if(null===r.default)return!1;const o=e.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,t,n).join()),o.length!==r.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==r.defaultBuffer[i])return!1;return!0};const ZD=Ow.exports,$D=YD;function eF(e){$D.call(this,e),this.enc="pem"}ZD(eF,$D);var tF=eF;eF.prototype.encode=function(e,t){const n=$D.prototype.encode.call(this,e).toString("base64"),r=["-----BEGIN "+t.label+"-----"];for(let e=0;e<n.length;e+=64)r.push(n.slice(e,e+64));return r.push("-----END "+t.label+"-----"),r.join("\n")},function(e){const t=e;t.der=YD,t.pem=tF}(mD);var nF={};const rF=Ow.exports,iF=Bw.exports,oF=QD.DecoderBuffer,aF=HD,sF=jD;function lF(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new AF,this.tree._init(e.body)}var uF=lF;function AF(e){aF.call(this,"der",e)}function cF(e,t){let n=e.readUInt8(t);if(e.isError(n))return n;const r=sF.tagClass[n>>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:sF.tag[n]}}function hF(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;t<i;t++){r<<=8;const t=e.readUInt8(n);if(e.isError(t))return t;r|=t}return r}lF.prototype.decode=function(e,t){return oF.isDecoderBuffer(e)||(e=new oF(e,t)),this.tree._decode(e,t)},rF(AF,aF),AF.prototype._peekTag=function(e,t,n){if(e.isEmpty())return!1;const r=e.save(),i=cF(e,'Failed to peek tag: "'+t+'"');return e.isError(i)?i:(e.restore(r),i.tag===t||i.tagStr===t||i.tagStr+"of"===t||n)},AF.prototype._decodeTag=function(e,t,n){const r=cF(e,'Failed to decode tag of "'+t+'"');if(e.isError(r))return r;let i=hF(e,r.primitive,'Failed to get length of "'+t+'"');if(e.isError(i))return i;if(!n&&r.tag!==t&&r.tagStr!==t&&r.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(r.primitive||null!==i)return e.skip(i,'Failed to match body of: "'+t+'"');const o=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(i=e.offset-o.offset,e.restore(o),e.skip(i,'Failed to match body of: "'+t+'"'))},AF.prototype._skipUntilEnd=function(e,t){for(;;){const n=cF(e,t);if(e.isError(n))return n;const r=hF(e,n.primitive,t);if(e.isError(r))return r;let i;if(i=n.primitive||null!==r?e.skip(r):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===n.tagStr)break}},AF.prototype._decodeList=function(e,t,n,r){const i=[];for(;!e.isEmpty();){const t=this._peekTag(e,"end");if(e.isError(t))return t;const o=n.decode(e,"der",r);if(e.isError(o)&&t)break;i.push(o)}return i},AF.prototype._decodeStr=function(e,t){if("bitstr"===t){const t=e.readUInt8();return e.isError(t)?t:{unused:t,data:e.raw()}}if("bmpstr"===t){const t=e.raw();if(t.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");let n="";for(let e=0;e<t.length/2;e++)n+=String.fromCharCode(t.readUInt16BE(2*e));return n}if("numstr"===t){const t=e.raw().toString("ascii");return this._isNumstr(t)?t:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){const t=e.raw().toString("ascii");return this._isPrintstr(t)?t:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},AF.prototype._decodeObjid=function(e,t,n){let r;const i=[];let o=0,a=0;for(;!e.isEmpty();)a=e.readUInt8(),o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0);128&a&&i.push(o);const s=i[0]/40|0,l=i[0]%40;if(r=n?i:[s,l].concat(i.slice(1)),t){let e=t[r.join(" ")];void 0===e&&(e=t[r.join(".")]),void 0!==e&&(r=e)}return r},AF.prototype._decodeTime=function(e,t){const n=e.raw().toString();let r,i,o,a,s,l;if("gentime"===t)r=0|n.slice(0,4),i=0|n.slice(4,6),o=0|n.slice(6,8),a=0|n.slice(8,10),s=0|n.slice(10,12),l=0|n.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");r=0|n.slice(0,2),i=0|n.slice(2,4),o=0|n.slice(4,6),a=0|n.slice(6,8),s=0|n.slice(8,10),l=0|n.slice(10,12),r=r<70?2e3+r:1900+r}return Date.UTC(r,i-1,o,a,s,l,0)},AF.prototype._decodeNull=function(){return null},AF.prototype._decodeBool=function(e){const t=e.readUInt8();return e.isError(t)?t:0!==t},AF.prototype._decodeInt=function(e,t){const n=e.raw();let r=new iF(n);return t&&(r=t[r.toString(10)]||r),r},AF.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree};const fF=Ow.exports,dF=BD.Buffer,pF=uF;function gF(e){pF.call(this,e),this.enc="pem"}fF(gF,pF);var yF=gF;gF.prototype.decode=function(e,t){const n=e.toString().split(/[\r\n]+/g),r=t.label.toUpperCase(),i=/^-----(BEGIN|END) ([^-]+)-----$/;let o=-1,a=-1;for(let e=0;e<n.length;e++){const t=n[e].match(i);if(null!==t&&t[2]===r){if(-1!==o){if("END"!==t[1])break;a=e;break}if("BEGIN"!==t[1])break;o=e}}if(-1===o||-1===a)throw new Error("PEM section not found for: "+r);const s=n.slice(o+1,a).join("");s.replace(/[^a-z0-9+/=]+/gi,"");const l=dF.from(s,"base64");return pF.prototype.decode.call(this,l,t)},function(e){const t=e;t.der=uF,t.pem=yF}(nF),function(e){const t=mD,n=nF,r=Ow.exports;function i(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}e.define=function(e,t){return new i(e,t)},i.prototype._createNamed=function(e){const t=this.name;function n(e){this._initNamed(e,t)}return r(n,e),n.prototype._initNamed=function(t,n){e.call(this,t,n)},new n(this)},i.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n[e])),this.decoders[e]},i.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},i.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(t[e])),this.encoders[e]},i.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}}(yD);var mF={};!function(e){const t=mF;t.Reporter=ED.Reporter,t.DecoderBuffer=QD.DecoderBuffer,t.EncoderBuffer=QD.EncoderBuffer,t.Node=HD}();var vF={};!function(e){const t=e;t._reverse=function(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const r=e[n];t[r]=n})),t},t.der=jD}(vF),function(e){const t=gD;t.bignum=Bw.exports,t.define=yD.define,t.base=mF,t.constants=vF,t.decoders=nF,t.encoders=mD}();var IF={exports:{}},wF={},bF={};Object.defineProperty(bF,"__esModule",{value:!0}),bF.default=function(e){var t=e.length,n=t%4;if(!n)return e;var r=t,i=4-n,o=t+i,a=ao.alloc(o);for(a.write(e);i--;)a.write("=",r++);return a.toString()},Object.defineProperty(wF,"__esModule",{value:!0});var BF=bF;function EF(e,t){return void 0===t&&(t="utf8"),jo(e)?SF(e.toString("base64")):SF(ao.from(e,t).toString("base64"))}function CF(e){return e=e.toString(),BF.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function SF(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var xF=EF;xF.encode=EF,xF.decode=function(e,t){return void 0===t&&(t="utf8"),ao.from(CF(e),"base64").toString(t)},xF.toBase64=CF,xF.fromBase64=SF,xF.toBuffer=function(e){return ao.from(CF(e),"base64")},wF.default=xF,function(e){e.exports=wF.default,e.exports.default=e.exports}(IF);var QF=IF.exports;const kF=gD,_F=IF.exports;var NF=class{static convert(e,t,n){if(!e)return;if(t===n)return e;let r;if("raw"===t||e instanceof ao)r=e;else if("uint8_array"===t||Array.isArray(e))r=ao.from(e);else if("hex"===t)r=ao.from(e,"hex");else if("base64"===t)r=ao.from(e,"base64");else if("base64url"===t)r=_F.toBuffer(e);else{if("bn"!==t&&"bignum"!==t)throw new Error("Invalid fromType");r=ao.from(this.pad(e.toString(16)),"hex")}if("raw"===n)return r;if("uint8_array"===n)return Array.from(r);if("hex"===n)return r.toString("hex");if("base64"===n)return r.toString("base64");if("base64url"===n)return _F.fromBase64(r.toString("base64"));if("bn"===n||"bignum"===n)return new kF.bignum(r);throw new Error("Invalid toType")}static pad(e){return e.length%2==1?`0${e}`:e}};const DF=gD;const FF=new class{constructor(){Object.defineProperty(this,"_registry",{value:{}})}get registry(){return this._registry}define(e,t){this._registry[e]=DF.define(e,t(this))}normalize(e){return this.registry[e]}};FF.define("Version",(e=>function(){this.int({0:"two-prime",1:"multi"})})),FF.define("OtherPrimeInfos",(e=>function(){this.seq().obj(this.key("ri").int(),this.key("di").int(),this.key("ti").int())})),FF.define("AlgorithmIdentifier",(e=>function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())})),FF.define("PrivateKeyInfo",(e=>{let t=e.normalize("Version"),n=e.normalize("AlgorithmIdentifier");return function(){this.seq().obj(this.key("version").use(t),this.key("algorithm").use(n),this.key("privateKey").octstr())}})),FF.define("PublicKeyInfo",(e=>{let t=e.normalize("AlgorithmIdentifier");return function(){this.seq().obj(this.key("algorithm").use(t),this.key("publicKey").bitstr())}})),FF.define("RSAPrivateKey",(e=>{let t=e.normalize("Version"),n=e.normalize("OtherPrimeInfos");return function(){this.seq().obj(this.key("version").use(t),this.key("n").int(),this.key("e").int(),this.key("d").int(),this.key("p").int(),this.key("q").int(),this.key("dp").int(),this.key("dq").int(),this.key("qi").int(),this.key("other").optional().use(n))}})),FF.define("RSAPublicKey",(e=>function(){this.seq().obj(this.key("n").int(),this.key("e").int())})),FF.define("ECPrivateKey",(e=>function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().choice({namedCurve:this.objid()}),this.key("publicKey").explicit(1).optional().bitstr())}));var PF=FF;const UF=pD,MF=NF,LF=PF;class TF extends UF{fromPrivatePKCS1(e){let t=LF.normalize("RSAPrivateKey"),{n:n,e:r,d:i,p:o,q:a,dp:s,dq:l,qi:u}=t.decode(e,"der");return{n:MF.convert(n,"bn","raw"),e:MF.convert(r,"bn","raw"),d:MF.convert(i,"bn","raw"),p:MF.convert(o,"bn","raw"),q:MF.convert(a,"bn","raw"),dp:MF.convert(s,"bn","raw"),dq:MF.convert(l,"bn","raw"),qi:MF.convert(u,"bn","raw")}}fromPrivatePKCS8(e){let t=LF.normalize("PrivateKeyInfo"),n=LF.normalize("RSAPrivateKey"),r=t.decode(e,"der"),{n:i,e:o,d:a,p:s,q:l,dp:u,dq:A,qi:c}=n.decode(r.privateKey,"der");return{n:MF.convert(i,"bn","raw"),e:MF.convert(o,"bn","raw"),d:MF.convert(a,"bn","raw"),p:MF.convert(s,"bn","raw"),q:MF.convert(l,"bn","raw"),dp:MF.convert(u,"bn","raw"),dq:MF.convert(A,"bn","raw"),qi:MF.convert(c,"bn","raw")}}fromPublicPKCS1(e){let t=LF.normalize("RSAPublicKey"),{n:n,e:r}=t.decode(e,"der");return{n:MF.convert(n,"bn","raw"),e:MF.convert(r,"bn","raw")}}fromPublicPKCS8(e){let t=LF.normalize("PublicKeyInfo"),n=LF.normalize("RSAPublicKey"),r=t.decode(e,"der"),{n:i,e:o}=n.decode(r.publicKey.data,"der");return{n:MF.convert(i,"bn","raw"),e:MF.convert(o,"bn","raw")}}fromJwk(e){let{n:t,e:n,d:r,p:i,q:o,dp:a,dq:s,qi:l,alg:u}=e;return{n:MF.convert(t,"base64url","raw"),e:MF.convert(n,"base64url","raw"),d:MF.convert(r,"base64url","raw"),p:MF.convert(i,"base64url","raw"),q:MF.convert(o,"base64url","raw"),dp:MF.convert(a,"base64url","raw"),dq:MF.convert(s,"base64url","raw"),qi:MF.convert(l,"base64url","raw")}}toPrivatePKCS1(e){let{n:t,e:n,d:r,p:i,q:o,dp:a,dq:s,qi:l}=e,{version:u}=this.params,A=LF.normalize("RSAPrivateKey").encode({version:u,n:MF.convert(t,"raw","bn"),e:MF.convert(n,"raw","bn"),d:MF.convert(r,"raw","bn"),p:MF.convert(i,"raw","bn"),q:MF.convert(o,"raw","bn"),dp:MF.convert(a,"raw","bn"),dq:MF.convert(s,"raw","bn"),qi:MF.convert(l,"raw","bn")},"der").toString("base64");return TF.formatPem(A,"RSA PRIVATE")}toPrivatePKCS8(e){let{n:t,e:n,d:r,p:i,q:o,dp:a,dq:s,qi:l}=e,{oid:u,algParameters:A,version:c}=this.params,h=LF.normalize("PrivateKeyInfo"),f=LF.normalize("RSAPrivateKey").encode({version:c,n:MF.convert(t,"raw","bn"),e:MF.convert(n,"raw","bn"),d:MF.convert(r,"raw","bn"),p:MF.convert(i,"raw","bn"),q:MF.convert(o,"raw","bn"),dp:MF.convert(a,"raw","bn"),dq:MF.convert(s,"raw","bn"),qi:MF.convert(l,"raw","bn")},"der"),d=h.encode({version:c,algorithm:{algorithm:u.split("."),parameters:ao.from(A,"hex")},privateKey:f},"der").toString("base64");return TF.formatPem(d,"PRIVATE")}toPublicPKCS1(e){let{n:t,e:n}=e,{version:r}=this.params,i=LF.normalize("RSAPublicKey").encode({version:r,n:MF.convert(t,"raw","bn"),e:MF.convert(n,"raw","bn")},"der").toString("base64");return TF.formatPem(i,"RSA PUBLIC")}toPublicPKCS8(e){let{n:t,e:n}=e,{oid:r,algParameters:i}=this.params,o=LF.normalize("PublicKeyInfo"),a=LF.normalize("RSAPublicKey").encode({n:MF.convert(t,"raw","bn"),e:MF.convert(n,"raw","bn")},"der"),s=o.encode({algorithm:{algorithm:r.split("."),parameters:ao.from(i,"hex")},publicKey:{unused:0,data:a}},"der").toString("base64");return TF.formatPem(s,"PUBLIC")}toPrivateJwk(e){let{n:t,e:n,d:r,p:i,q:o,dp:a,dq:s,qi:l}=e,{kty:u}=this.params;return{kty:u,n:MF.convert(t,"raw","base64url"),e:MF.convert(n,"raw","base64url"),d:MF.convert(r,"raw","base64url"),p:MF.convert(i,"raw","base64url"),q:MF.convert(o,"raw","base64url"),dp:MF.convert(a,"raw","base64url"),dq:MF.convert(s,"raw","base64url"),qi:MF.convert(l,"raw","base64url")}}toPublicJwk(e){let{n:t,e:n}=e,{kty:r}=this.params;return{kty:r,n:MF.convert(t,"raw","base64url"),e:MF.convert(n,"raw","base64url")}}}var RF=TF;const OF=new ww.ec("secp256k1"),HF=pD,KF=NF,jF=PF;class GF extends HF{fromPrivatePKCS1(e){let t=jF.normalize("ECPrivateKey").decode(e,"der"),{privateKey:n,publicKey:{data:r}}=t,i=KF.convert(r,"raw","hex"),{x:o,y:a}=GF.getPoint(i);return{d:n,x:o,y:a}}fromPrivatePKCS8(e){let t=jF.normalize("PrivateKeyInfo"),n=jF.normalize("ECPrivateKey"),r=t.decode(e,"der"),i=n.decode(r.privateKey,"der"),{privateKey:o,publicKey:{data:a}}=i,s=KF.convert(a,"raw","hex"),{x:l,y:u}=GF.getPoint(s);return{d:o,x:l,y:u}}fromPublicPKCS8(e){let t=jF.normalize("PublicKeyInfo").decode(e,"der"),n=KF.convert(t.publicKey.data,"raw","hex");return GF.getPoint(n)}fromPrivateBlk(e){let t=OF.keyFromPrivate(e,"hex"),n=t.getPublic();return{d:KF.convert(t.priv,"bn","raw"),x:KF.convert(n.getX(),"bn","raw"),y:KF.convert(n.getY(),"bn","raw")}}fromPublicBlk(e){return GF.getPoint(e)}fromJwk(e){let{d:t,x:n,y:r}=e;return{d:KF.convert(t,"base64url","raw"),x:KF.convert(n,"base64url","raw"),y:KF.convert(r,"base64url","raw")}}toPrivatePKCS1(e){let{namedCurve:t,keyVersion:n}=this.params,{d:r,x:i,y:o}=e,a=jF.normalize("ECPrivateKey"),s=GF.makePoint(i,o),l=a.encode({version:n,privateKey:r,parameters:{type:"namedCurve",value:t.split(".")},publicKey:{unused:0,data:s}},"der").toString("base64");return GF.formatPem(l,"EC PRIVATE")}toPrivatePKCS8(e){let{oid:t,algParameters:n,keyVersion:r,infoVersion:i}=this.params,{d:o,x:a,y:s}=e,l=jF.normalize("PrivateKeyInfo"),u=jF.normalize("ECPrivateKey"),A=GF.makePoint(a,s),c=u.encode({version:r,privateKey:o,publicKey:{unused:0,data:A}},"der"),h=l.encode({version:i,algorithm:{algorithm:t.split("."),parameters:ao.from(n,"hex")},privateKey:c},"der").toString("base64");return GF.formatPem(h,"PRIVATE")}toPublicPKCS8(e){let{oid:t,algParameters:n}=this.params,{x:r,y:i}=e,o=jF.normalize("PublicKeyInfo"),a=GF.makePoint(r,i),s=o.encode({algorithm:{algorithm:t.split("."),parameters:ao.from(n,"hex")},publicKey:{unused:0,data:a}},"der").toString("base64");return GF.formatPem(s,"PUBLIC")}toPrivateBlk(e){return e.d.toString("hex")}toPublicBlk(e){return KF.convert(GF.makePoint(e.x,e.y),"raw","hex")}toPrivateJwk(e){let{crv:t,kty:n}=this.params,{d:r,x:i,y:o}=e;return{kty:n,crv:t,d:KF.convert(r,"raw","base64url"),x:KF.convert(i,"raw","base64url"),y:KF.convert(o,"raw","base64url")}}toPublicJwk(e){let{crv:t,kty:n}=this.params,{x:r,y:i}=e;return{kty:n,crv:t,x:KF.convert(r,"raw","base64url"),y:KF.convert(i,"raw","base64url")}}static getPoint(e){let t=e.slice(2,(e.length-2)/2+2),n=e.slice((e.length-2)/2+2);return{x:KF.convert(t,"hex","raw"),y:KF.convert(n,"hex","raw")}}static makePoint(e,t){let n=ao.from("04","hex");return ao.concat([n,e,t],n.length+e.length+t.length)}}var qF=GF;const VF=pD,zF=NF,JF=PF;class YF extends VF{fromPrivatePKCS8(e){const t=JF.normalize("PrivateKeyInfo").decode(e,"der").privateKey.slice(2);return{d:t,x:this.publicKeyFromPrivate(t)}}fromPublicPKCS8(e){const t=JF.normalize("PublicKeyInfo").decode(e,"der");return{x:zF.convert(t.publicKey.data,"hex","raw")}}fromJwk(e){let{d:t,x:n}=e;return{d:zF.convert(t,"base64url","raw"),x:zF.convert(n,"base64url","raw")}}toPrivatePKCS8(e){let{oid:t,infoVersion:n}=this.params,{d:r}=e;const i=JF.normalize("PrivateKeyInfo"),o=this.privateKeyPadding(r);let a=i.encode({version:n,algorithm:{algorithm:t.split(".")},privateKey:o},"der").toString("base64");return YF.formatPem(a,"PRIVATE")}toPublicPKCS8(e){let{oid:t}=this.params,{x:n}=e,r=JF.normalize("PublicKeyInfo").encode({algorithm:{algorithm:t.split(".")},publicKey:{unused:0,data:zF.convert(n,"hex","raw")}},"der").toString("base64");return YF.formatPem(r,"PUBLIC")}toPrivateJwk(e){let{crv:t,kty:n}=this.params,{d:r,x:i}=e;return{kty:n,crv:t,d:zF.convert(r,"raw","base64url"),x:zF.convert(i,"raw","base64url")}}toPublicJwk(e){let{crv:t,kty:n}=this.params,{x:r}=e;return{kty:n,crv:t,x:zF.convert(r,"raw","base64url")}}privateKeyPadding(e){let t;if("Ed25519"!==this.params.crv)throw new Error(`${this.params.crv} is an invalid curve for EdDSA`);return t=ao.from("0420","hex"),ao.concat([t,e],t.length+e.length)}publicKeyFromPrivate(e){if("Ed25519"===this.params.crv){const t=new ww.eddsa("ed25519");return ao.from(t.keyFromSecret(e).getPublic())}throw new Error(`${this.params.crv} is an invalid curve for EdDSA`)}}const XF=RF,WF=qF,ZF=YF,$F=new class{constructor(){this.registry=[],this.classes={}}find(e){return this.registry.find(e)}define(e,t){e.forEach((e=>{let{kty:n}=e;if(!n)throw new Error("Invalid type definition");this.classes[n]||(this.classes[n]=t),this.registry.push(e)}))}normalize(e,t,n){let r=this.classes[e],i=this.find((e=>e[t]===n));if(!r||!i)throw new Error("Invalid type");return new r(i)}};$F.define([{kty:"RSA",oid:"1.2.840.113549.1.1.1",algParameters:"0500",version:"two-prime"}],XF),$F.define([{kty:"EC",crv:"K-256",oid:"1.2.840.10045.2.1",namedCurve:"1.3.132.0.10",algParameters:"06052b8104000a",keyVersion:1,infoVersion:"two-prime"},{kty:"EC",crv:"P-256",oid:"1.2.840.10045.2.1",namedCurve:"1.2.840.10045.3.1.7",algParameters:"06082a8648ce3d030107",keyVersion:1,infoVersion:"two-prime"},{kty:"EC",crv:"P-384",oid:"1.2.840.10045.2.1",namedCurve:"1.3.132.0.34",algParameters:"06052b81040022",keyVersion:1,infoVersion:"two-prime"},{kty:"EC",crv:"P-521",oid:"1.2.840.10045.2.1",namedCurve:"1.3.132.0.35",algParameters:"06052b81040023",keyVersion:1,infoVersion:"two-prime"}],WF),$F.define([{kty:"OKP",crv:"Ed25519",oid:"1.3.101.112",infoVersion:"two-prime"}],ZF);const eP=AD,tP=hD,nP=$F,rP=PF,iP=RegExp("\r?\n","g");class oP{constructor(e,t){if(!e)throw new eP("key is required");if(!t)throw new eP("options are required");let{kty:n,format:r,selector:i,crv:o,oid:a}=t;if(!t.kty)throw new eP("options.kty is required");if(!t.format)throw new eP("options.format is required");if(!t.selector)throw new eP("options.selector is required");if(!t.crv&&!t.oid)throw new eP("options.crv or options.oid is required");this.kty=n,this.format=r,this.selector=i,this.crv=o,this.oid=a,this.key=this.parseKey(e)}static from(e,t){if(!e)throw new eP("key is required");if(!t)throw new eP("format is required");if("jwk"===t){let n;if("string"==typeof e)try{n=JSON.parse(e)}catch(e){throw new eP("key is not a valid JWK")}else"object"==typeof e&&(n=e);let r,{kty:i,crv:o}=n;if(!i)throw new eP("kty is required for JWK");if("EC"===i&&!o)throw new eP("crv is required for EC JWK");"RSA"===i&&(r=nP.find((e=>e.kty===i)).oid);let a=n.d?"private":"public";return new oP(n,{kty:i,crv:o,oid:r,format:t,selector:a})}if("pem"===t){if("string"!=typeof e)throw new eP("key is not a valid PEM string");let n=e.split(iP),r=n.splice(0,1);n.splice(n.length-1,1);let i,o,a=n.join(""),s=/^-----BEGIN ((RSA|EC) )?(PUBLIC|PRIVATE) KEY-----$/.exec(r),l=s?s[2]:void 0,u=s?s[3]:void 0,A=ao.from(a,"base64");if(!u)throw new eP("key is not a valid PEM string");if(l){if("RSA"===l)u="PRIVATE"===u?"private_pkcs1":"public_pkcs1",i=nP.find((e=>e.kty===l)).oid;else if("EC"===l){let e;if("PRIVATE"===u){let t=rP.normalize(`${l}PrivateKey`);u="private_pkcs1",e=t.decode(A,"der")}else if("PUBLIC"===u){let t=rP.normalize(`${l}PrivateKey`);u="public_pkcs1",e=t.decode(A,"der")}let{parameters:{value:t}}=e;o=nP.find((e=>e.namedCurve===t.join("."))).crv}}else{let e,t=rP.normalize("PrivateKeyInfo"),n=rP.normalize("PublicKeyInfo");"PRIVATE"===u?(u="private_pkcs8",e=t.decode(A,"der")):"PUBLIC"===u&&(u="public_pkcs8",e=n.decode(A,"der"));let{algorithm:{algorithm:r,parameters:a}}=e;r=r.join("."),a=a?a.toString("hex"):void 0;const s=nP.find((e=>e.oid===r));if(l=s?s.kty:void 0,!l)throw new eP(`${r} is not supported`);"RSA"===l||"OKP"===l?i=r:"EC"===l&&(o=nP.find((e=>e.algParameters===a)).crv)}return new oP(A,{kty:l,oid:i,crv:o,format:t,selector:u})}if("blk"===t)return new oP(e,{kty:"EC",crv:"K-256",format:t,selector:e.length>64?"public":"private"});throw new eP(`Invalid format ${t}`)}get alg(){let{kty:e,crv:t,oid:n}=this;if(!this.algorithm){if(t)Object.defineProperty(this,"algorithm",{value:nP.normalize(e,"crv",t)});else{if(!n)throw new Error("Both crv and oid are undefined");Object.defineProperty(this,"algorithm",{value:nP.normalize(e,"oid",n)})}if(!this.algorithm)throw new Error(`${this.crv||this.oid} is not implemented yet`)}return this.algorithm}parseKey(e){let{alg:t,format:n,selector:r}=this;if("pem"===n)switch(r){case"public_pkcs1":return t.fromPublicPKCS1(e);case"public_pkcs8":return t.fromPublicPKCS8(e);case"private_pkcs1":return t.fromPrivatePKCS1(e);case"private_pkcs8":return t.fromPrivatePKCS8(e);default:throw new Error("Invalid selector value")}if("jwk"===n)return t.fromJwk(e,r);if("blk"===n)switch(r){case"public":return t.fromPublicBlk(e);case"private":return t.fromPrivateBlk(e)}}toJwk(e){let{key:t,alg:n,selector:r}=this;switch(e){case"public":return n.toPublicJwk(t);case"private":if(r.includes("public"))throw new eP("Cannot export a private key from a public key");return n.toPrivateJwk(t);default:throw new Error("Invalid key selector")}}toString(e="pem",t="public_pkcs8"){let{key:n,alg:r,selector:i}=this;if("pem"===e)switch(t){case"public_pkcs1":return r.toPublicPKCS1(n);case"public_pkcs8":return r.toPublicPKCS8(n);case"private_pkcs1":if(i.includes("public"))throw new eP("Cannot export a private key from a public key");return r.toPrivatePKCS1(n);case"private_pkcs8":if(i.includes("public"))throw new eP("Cannot export a private key from a public key");return r.toPrivatePKCS8(n);default:throw new Error("Invalid key selector")}else if("jwk"===e)switch(t){case"public":return JSON.stringify(r.toPublicJwk(n));case"private":if(i.includes("public"))throw new eP("Cannot export a private key from a public key");return JSON.stringify(r.toPrivateJwk(n));default:throw new Error("Invalid key selector")}else if("blk"===e)switch(t){case"private":if(i.includes("public"))throw new eP("Cannot export a private key from a public key");return r.toPrivateBlk(n);case"public":return r.toPublicBlk(n);default:throw new Error("Invalid key selector")}throw new tP}}var aP=oP,sP=U_("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");const lP=ao;var uP={},AP={},cP={};Object.defineProperty(cP,"__esModule",{value:!0}),cP.testnet=cP.regtest=cP.bitcoin=void 0,cP.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},cP.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},cP.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var hP={},fP={},dP={},pP={};Object.defineProperty(pP,"__esModule",{value:!0}),pP.encode=pP.decode=pP.check=void 0,pP.check=function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;const t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;const n=e[5+t];return!(0===n||6+t+n!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||n>1&&0===e[t+6]&&!(128&e[t+7]))},pP.decode=function(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");const t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");const n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}},pP.encode=function(e,t){const n=e.length,r=t.length;if(0===n)throw new Error("R length is zero");if(0===r)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(r>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");const i=ao.allocUnsafe(6+n+r);return i[0]=48,i[1]=i.length-2,i[2]=2,i[3]=e.length,e.copy(i,4),i[4+n]=2,i[5+n]=t.length,t.copy(i,6+n),i};var gP={};Object.defineProperty(gP,"__esModule",{value:!0}),gP.REVERSE_OPS=gP.OPS=void 0;const yP={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};gP.OPS=yP;const mP={};gP.REVERSE_OPS=mP;for(const e of Object.keys(yP))mP[yP[e]]=e;var vP={};Object.defineProperty(vP,"__esModule",{value:!0}),vP.decode=vP.encode=vP.encodingLength=void 0;const IP=gP;function wP(e){return e<IP.OPS.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}vP.encodingLength=wP,vP.encode=function(e,t,n){const r=wP(t);return 1===r?e.writeUInt8(t,n):2===r?(e.writeUInt8(IP.OPS.OP_PUSHDATA1,n),e.writeUInt8(t,n+1)):3===r?(e.writeUInt8(IP.OPS.OP_PUSHDATA2,n),e.writeUInt16LE(t,n+1)):(e.writeUInt8(IP.OPS.OP_PUSHDATA4,n),e.writeUInt32LE(t,n+1)),r},vP.decode=function(e,t){const n=e.readUInt8(t);let r,i;if(n<IP.OPS.OP_PUSHDATA1)r=n,i=1;else if(n===IP.OPS.OP_PUSHDATA1){if(t+2>e.length)return null;r=e.readUInt8(t+1),i=2}else if(n===IP.OPS.OP_PUSHDATA2){if(t+3>e.length)return null;r=e.readUInt16LE(t+1),i=3}else{if(t+5>e.length)return null;if(n!==IP.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=e.readUInt32LE(t+1),i=5}return{opcode:n,number:r,size:i}};var bP={};Object.defineProperty(bP,"__esModule",{value:!0}),bP.encode=bP.decode=void 0,bP.decode=function(e,t,n){t=t||4,n=void 0===n||n;const r=e.length;if(0===r)return 0;if(r>t)throw new TypeError("Script number overflow");if(n&&0==(127&e[r-1])&&(r<=1||0==(128&e[r-2])))throw new Error("Non-minimally encoded script number");if(5===r){const t=e.readUInt32LE(0),n=e.readUInt8(4);return 128&n?-(4294967296*(-129&n)+t):4294967296*n+t}let i=0;for(let t=0;t<r;++t)i|=e[t]<<8*t;return 128&e[r-1]?-(i&~(128<<8*(r-1))):i},bP.encode=function(e){let t=Math.abs(e);const n=(r=t)>2147483647?5:r>8388607?4:r>32767?3:r>127?2:r>0?1:0;var r;const i=ao.allocUnsafe(n),o=e<0;for(let e=0;e<n;++e)i.writeUInt8(255&t,e),t>>=8;return 128&i[n-1]?i.writeUInt8(o?128:0,n-1):o&&(i[n-1]|=128),i};var BP={},EP={},CP={Array:function(e){return null!=e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return null==e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var SP in CP.Null=CP.Nil,CP)CP[SP].toJSON=function(e){return e}.bind(null,SP);var xP=CP,QP=xP;function kP(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function _P(e){return QP.Nil(e)?"":kP(e.constructor)}function NP(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function DP(e){return QP.Function(e)?e.toJSON?e.toJSON():kP(e):QP.Array(e)?"Array":e&&QP.Object(e)?"Object":void 0!==e?e:""}function FP(e,t,n){var r=function(e){return QP.Function(e)?"":QP.String(e)?JSON.stringify(e):e&&QP.Object(e)?"":e}(t);return"Expected "+DP(e)+", got"+(""!==n?" "+n:"")+(""!==r?" "+r:"")}function PP(e,t,n){n=n||_P(t),this.message=FP(e,t,n),NP(this,PP),this.__type=e,this.__value=t,this.__valueTypeName=n}function UP(e,t,n,r,i){e?(i=i||_P(r),this.message=function(e,t,n,r,i){var o='" of type ';return"key"===t&&(o='" with key type '),FP('property "'+DP(n)+o+DP(e),r,i)}(e,n,t,r,i)):this.message='Unexpected property "'+t+'"',NP(this,PP),this.__label=n,this.__property=t,this.__type=e,this.__value=r,this.__valueTypeName=i}PP.prototype=Object.create(Error.prototype),PP.prototype.constructor=PP,UP.prototype=Object.create(Error.prototype),UP.prototype.constructor=PP;var MP={TfTypeError:PP,TfPropertyTypeError:UP,tfCustomError:function(e,t){return new PP(e,{},t)},tfSubError:function(e,t,n){return e instanceof UP?(t=t+"."+e.__property,e=new UP(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof PP&&(e=new UP(e.__type,t,n,e.__value,e.__valueTypeName)),NP(e),e},tfJSON:DP,getValueTypeName:_P},LP=xP,TP=MP;function RP(e){return jo(e)}function OP(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function HP(e,t){var n=e.toJSON();function r(r){if(!e(r))return!1;if(r.length===t)return!0;throw TP.tfCustomError(n+"(Length: "+t+")",n+"(Length: "+r.length+")")}return r.toJSON=function(){return n},r}var KP=HP.bind(null,LP.Array),jP=HP.bind(null,RP),GP=HP.bind(null,OP),qP=HP.bind(null,LP.String),VP=Math.pow(2,53)-1,zP={ArrayN:KP,Buffer:RP,BufferN:jP,Finite:function(e){return"number"==typeof e&&isFinite(e)},Hex:OP,HexN:GP,Int8:function(e){return e<<24>>24===e},Int16:function(e){return e<<16>>16===e},Int32:function(e){return(0|e)===e},Int53:function(e){return"number"==typeof e&&e>=-VP&&e<=VP&&Math.floor(e)===e},Range:function(e,t,n){function r(r,i){return n(r,i)&&r>e&&r<t}return n=n||LP.Number,r.toJSON=function(){return`${n.toJSON()} between [${e}, ${t}]`},r},StringN:qP,UInt8:function(e){return(255&e)===e},UInt16:function(e){return(65535&e)===e},UInt32:function(e){return e>>>0===e},UInt53:function(e){return"number"==typeof e&&e>=0&&e<=VP&&Math.floor(e)===e}};for(var JP in zP)zP[JP].toJSON=function(e){return e}.bind(null,JP);var YP=zP,XP=xP,WP=MP.tfJSON,ZP=MP.TfTypeError,$P=MP.TfPropertyTypeError,eU=MP.tfSubError,tU=MP.getValueTypeName,nU={arrayOf:function(e,t){function n(n,r){return!!XP.Array(n)&&!XP.Nil(n)&&!(void 0!==t.minLength&&n.length<t.minLength)&&!(void 0!==t.maxLength&&n.length>t.maxLength)&&(void 0===t.length||n.length===t.length)&&n.every((function(t,n){try{return iU(e,t,r)}catch(e){throw eU(e,n)}}))}return e=rU(e),t=t||{},n.toJSON=function(){var n="["+WP(e)+"]";return void 0!==t.length?n+="{"+t.length+"}":void 0===t.minLength&&void 0===t.maxLength||(n+="{"+(void 0===t.minLength?0:t.minLength)+","+(void 0===t.maxLength?1/0:t.maxLength)+"}"),n},n},maybe:function e(t){function n(n,r){return XP.Nil(n)||t(n,r,e)}return t=rU(t),n.toJSON=function(){return"?"+WP(t)},n},map:function(e,t){function n(n,r){if(!XP.Object(n))return!1;if(XP.Nil(n))return!1;for(var i in n){try{t&&iU(t,i,r)}catch(e){throw eU(e,i,"key")}try{var o=n[i];iU(e,o,r)}catch(e){throw eU(e,i)}}return!0}return e=rU(e),t&&(t=rU(t)),n.toJSON=t?function(){return"{"+WP(t)+": "+WP(e)+"}"}:function(){return"{"+WP(e)+"}"},n},object:function(e){var t={};for(var n in e)t[n]=rU(e[n]);function r(e,n){if(!XP.Object(e))return!1;if(XP.Nil(e))return!1;var r;try{for(r in t)iU(t[r],e[r],n)}catch(e){throw eU(e,r)}if(n)for(r in e)if(!t[r])throw new $P(void 0,r);return!0}return r.toJSON=function(){return WP(t)},r},anyOf:function(){var e=[].slice.call(arguments).map(rU);function t(t,n){return e.some((function(e){try{return iU(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(WP).join("|")},t},allOf:function(){var e=[].slice.call(arguments).map(rU);function t(t,n){return e.every((function(e){try{return iU(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(WP).join(" & ")},t},quacksLike:function(e){function t(t){return e===tU(t)}return t.toJSON=function(){return e},t},tuple:function(){var e=[].slice.call(arguments).map(rU);function t(t,n){return!XP.Nil(t)&&!XP.Nil(t.length)&&(!n||t.length===e.length)&&e.every((function(e,r){try{return iU(e,t[r],n)}catch(e){throw eU(e,r)}}))}return t.toJSON=function(){return"("+e.map(WP).join(", ")+")"},t},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};function rU(e){if(XP.String(e))return"?"===e[0]?nU.maybe(e.slice(1)):XP[e]||nU.quacksLike(e);if(e&&XP.Object(e)){if(XP.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return nU.arrayOf(e[0])}return nU.object(e)}return XP.Function(e)?e:nU.value(e)}function iU(e,t,n,r){if(XP.Function(e)){if(e(t,n))return!0;throw new ZP(r||e,t)}return iU(rU(e),t,n)}for(var oU in nU.oneOf=nU.anyOf,XP)iU[oU]=XP[oU];for(oU in nU)iU[oU]=nU[oU];var aU=YP;for(oU in aU)iU[oU]=aU[oU];iU.compile=rU,iU.TfTypeError=ZP,iU.TfPropertyTypeError=$P;var sU=iU;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.oneOf=e.Null=e.BufferN=e.Function=e.UInt32=e.UInt8=e.tuple=e.maybe=e.Hex=e.Buffer=e.String=e.Boolean=e.Array=e.Number=e.Hash256bit=e.Hash160bit=e.Buffer256bit=e.Network=e.ECPoint=e.Satoshi=e.Signer=e.BIP32Path=e.UInt31=e.isPoint=e.typeforce=void 0;const t=qo;e.typeforce=sU;const n=t.Buffer.alloc(32,0),r=t.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");e.isPoint=function(e){if(!t.Buffer.isBuffer(e))return!1;if(e.length<33)return!1;const i=e[0],o=e.slice(1,33);if(0===o.compare(n))return!1;if(o.compare(r)>=0)return!1;if((2===i||3===i)&&33===e.length)return!0;const a=e.slice(33);return 0!==a.compare(n)&&!(a.compare(r)>=0)&&4===i&&65===e.length};const i=Math.pow(2,31)-1;function o(t){return e.typeforce.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.UInt31=function(t){return e.typeforce.UInt32(t)&&t<=i},e.BIP32Path=o,o.toJSON=()=>"BIP32 derivation path",e.Signer=function(t){return(e.typeforce.Buffer(t.publicKey)||"function"==typeof t.getPublicKey)&&"function"==typeof t.sign},e.Satoshi=function(t){return e.typeforce.UInt53(t)&&t<=21e14},e.ECPoint=e.typeforce.quacksLike("Point"),e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.Buffer256bit=e.typeforce.BufferN(32),e.Hash160bit=e.typeforce.BufferN(20),e.Hash256bit=e.typeforce.BufferN(32),e.Number=e.typeforce.Number,e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.String=e.typeforce.String,e.Buffer=e.typeforce.Buffer,e.Hex=e.typeforce.Hex,e.maybe=e.typeforce.maybe,e.tuple=e.typeforce.tuple,e.UInt8=e.typeforce.UInt8,e.UInt32=e.typeforce.UInt32,e.Function=e.typeforce.Function,e.BufferN=e.typeforce.BufferN,e.Null=e.typeforce.Null,e.oneOf=e.typeforce.oneOf}(EP),Object.defineProperty(BP,"__esModule",{value:!0}),BP.encode=BP.decode=void 0;const lU=pP,uU=EP,{typeforce:AU}=uU,cU=ao.alloc(1,0);function hU(e){let t=0;for(;0===e[t];)++t;return t===e.length?cU:128&(e=e.slice(t))[0]?ao.concat([cU,e],1+e.length):e}function fU(e){0===e[0]&&(e=e.slice(1));const t=ao.alloc(32,0),n=Math.max(0,32-e.length);return e.copy(t,n),t}BP.decode=function(e){const t=e.readUInt8(e.length-1),n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);const r=lU.decode(e.slice(0,-1)),i=fU(r.r),o=fU(r.s);return{signature:ao.concat([i,o],64),hashType:t}},BP.encode=function(e,t){AU({signature:uU.BufferN(64),hashType:uU.UInt8},{signature:e,hashType:t});const n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);const r=ao.allocUnsafe(1);r.writeUInt8(t,0);const i=hU(e.slice(0,32)),o=hU(e.slice(32,64));return ao.concat([lU.encode(i,o),r])},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.signature=e.number=e.isCanonicalScriptSignature=e.isDefinedHashType=e.isCanonicalPubKey=e.toStack=e.fromASM=e.toASM=e.decompile=e.compile=e.isPushOnly=e.OPS=void 0;const t=pP,n=gP;Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return n.OPS}});const r=vP,i=bP,o=BP,a=EP,{typeforce:s}=a,l=n.OPS.OP_RESERVED;function u(e){return a.Buffer(e)||function(e){return a.Number(e)&&(e===n.OPS.OP_0||e>=n.OPS.OP_1&&e<=n.OPS.OP_16||e===n.OPS.OP_1NEGATE)}(e)}function A(e){return a.Array(e)&&e.every(u)}function c(e){return 0===e.length?n.OPS.OP_0:1===e.length?e[0]>=1&&e[0]<=16?l+e[0]:129===e[0]?n.OPS.OP_1NEGATE:void 0:void 0}function h(e){return jo(e)}function f(e){return jo(e)}function d(e){if(h(e))return e;s(a.Array,e);const t=e.reduce(((e,t)=>f(t)?1===t.length&&void 0!==c(t)?e+1:e+r.encodingLength(t.length)+t.length:e+1),0),n=ao.allocUnsafe(t);let i=0;if(e.forEach((e=>{if(f(e)){const t=c(e);if(void 0!==t)return n.writeUInt8(t,i),void(i+=1);i+=r.encode(n,e.length,i),e.copy(n,i),i+=e.length}else n.writeUInt8(e,i),i+=1})),i!==n.length)throw new Error("Could not decode chunks");return n}function p(e){if(t=e,a.Array(t))return e;var t;s(a.Buffer,e);const i=[];let o=0;for(;o<e.length;){const t=e[o];if(t>n.OPS.OP_0&&t<=n.OPS.OP_PUSHDATA4){const t=r.decode(e,o);if(null===t)return null;if(o+=t.size,o+t.number>e.length)return null;const n=e.slice(o,o+t.number);o+=t.number;const a=c(n);void 0!==a?i.push(a):i.push(n)}else i.push(t),o+=1}return i}function g(e){const t=-129&e;return t>0&&t<4}e.isPushOnly=A,e.compile=d,e.decompile=p,e.toASM=function(e){return h(e)&&(e=p(e)),e.map((e=>{if(f(e)){const t=c(e);if(void 0===t)return e.toString("hex");e=t}return n.REVERSE_OPS[e]})).join(" ")},e.fromASM=function(e){return s(a.String,e),d(e.split(" ").map((e=>void 0!==n.OPS[e]?n.OPS[e]:(s(a.Hex,e),ao.from(e,"hex")))))},e.toStack=function(e){return e=p(e),s(A,e),e.map((e=>f(e)?e:e===n.OPS.OP_0?ao.allocUnsafe(0):i.encode(e-l)))},e.isCanonicalPubKey=function(e){return a.isPoint(e)},e.isDefinedHashType=g,e.isCanonicalScriptSignature=function(e){return!!jo(e)&&!!g(e[e.length-1])&&t.check(e.slice(0,-1))},e.number=i,e.signature=o}(dP);var dU={};Object.defineProperty(dU,"__esModule",{value:!0}),dU.value=dU.prop=void 0,dU.prop=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=n.call(this);return this[t]=e,e},set(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})},dU.value=function(e){let t;return()=>(void 0!==t||(t=e()),t)},Object.defineProperty(fP,"__esModule",{value:!0}),fP.p2data=void 0;const pU=cP,gU=dP,yU=EP,mU=dU,vU=gU.OPS;fP.p2data=function(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,yU.typeforce)({network:yU.typeforce.maybe(yU.typeforce.Object),output:yU.typeforce.maybe(yU.typeforce.Buffer),data:yU.typeforce.maybe(yU.typeforce.arrayOf(yU.typeforce.Buffer))},e);const n={name:"embed",network:e.network||pU.bitcoin};if(mU.prop(n,"output",(()=>{if(e.data)return gU.compile([vU.OP_RETURN].concat(e.data))})),mU.prop(n,"data",(()=>{if(e.output)return gU.decompile(e.output).slice(1)})),t.validate&&e.output){const t=gU.decompile(e.output);if(t[0]!==vU.OP_RETURN)throw new TypeError("Output is invalid");if(!t.slice(1).every(yU.typeforce.Buffer))throw new TypeError("Output is invalid");if(e.data&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.data,n.data))throw new TypeError("Data mismatch")}return Object.assign(n,e)};var IU={};Object.defineProperty(IU,"__esModule",{value:!0}),IU.p2ms=void 0;const wU=cP,bU=dP,BU=EP,EU=dU,CU=bU.OPS,SU=CU.OP_RESERVED;function xU(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}IU.p2ms=function(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function n(e){return bU.isCanonicalScriptSignature(e)||void 0!==(t.allowIncomplete&&e===CU.OP_0)}t=Object.assign({validate:!0},t||{}),(0,BU.typeforce)({network:BU.typeforce.maybe(BU.typeforce.Object),m:BU.typeforce.maybe(BU.typeforce.Number),n:BU.typeforce.maybe(BU.typeforce.Number),output:BU.typeforce.maybe(BU.typeforce.Buffer),pubkeys:BU.typeforce.maybe(BU.typeforce.arrayOf(BU.isPoint)),signatures:BU.typeforce.maybe(BU.typeforce.arrayOf(n)),input:BU.typeforce.maybe(BU.typeforce.Buffer)},e);const r={network:e.network||wU.bitcoin};let i=[],o=!1;function a(e){o||(o=!0,i=bU.decompile(e),r.m=i[0]-SU,r.n=i[i.length-2]-SU,r.pubkeys=i.slice(1,-2))}if(EU.prop(r,"output",(()=>{if(e.m&&r.n&&e.pubkeys)return bU.compile([].concat(SU+e.m,e.pubkeys,SU+r.n,CU.OP_CHECKMULTISIG))})),EU.prop(r,"m",(()=>{if(r.output)return a(r.output),r.m})),EU.prop(r,"n",(()=>{if(r.pubkeys)return r.pubkeys.length})),EU.prop(r,"pubkeys",(()=>{if(e.output)return a(e.output),r.pubkeys})),EU.prop(r,"signatures",(()=>{if(e.input)return bU.decompile(e.input).slice(1)})),EU.prop(r,"input",(()=>{if(e.signatures)return bU.compile([CU.OP_0].concat(e.signatures))})),EU.prop(r,"witness",(()=>{if(r.input)return[]})),EU.prop(r,"name",(()=>{if(r.m&&r.n)return`p2ms(${r.m} of ${r.n})`})),t.validate){if(e.output){if(a(e.output),!BU.typeforce.Number(i[0]))throw new TypeError("Output is invalid");if(!BU.typeforce.Number(i[i.length-2]))throw new TypeError("Output is invalid");if(i[i.length-1]!==CU.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(r.m<=0||r.n>16||r.m>r.n||r.n!==i.length-3)throw new TypeError("Output is invalid");if(!r.pubkeys.every((e=>(0,BU.isPoint)(e))))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==r.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==r.n)throw new TypeError("n mismatch");if(e.pubkeys&&!xU(e.pubkeys,r.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(r.n=e.pubkeys.length,r.n<r.m)throw new TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<r.m)throw new TypeError("Not enough signatures provided");if(e.signatures.length>r.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==CU.OP_0)throw new TypeError("Input is invalid");if(0===r.signatures.length||!r.signatures.every(n))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!xU(e.signatures,r.signatures))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(r,e)};var QU={};Object.defineProperty(QU,"__esModule",{value:!0}),QU.p2pk=void 0;const kU=cP,_U=dP,NU=EP,DU=dU,FU=_U.OPS;QU.p2pk=function(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,NU.typeforce)({network:NU.typeforce.maybe(NU.typeforce.Object),output:NU.typeforce.maybe(NU.typeforce.Buffer),pubkey:NU.typeforce.maybe(NU.isPoint),signature:NU.typeforce.maybe(_U.isCanonicalScriptSignature),input:NU.typeforce.maybe(NU.typeforce.Buffer)},e);const n=DU.value((()=>_U.decompile(e.input))),r={name:"p2pk",network:e.network||kU.bitcoin};if(DU.prop(r,"output",(()=>{if(e.pubkey)return _U.compile([e.pubkey,FU.OP_CHECKSIG])})),DU.prop(r,"pubkey",(()=>{if(e.output)return e.output.slice(1,-1)})),DU.prop(r,"signature",(()=>{if(e.input)return n()[0]})),DU.prop(r,"input",(()=>{if(e.signature)return _U.compile([e.signature])})),DU.prop(r,"witness",(()=>{if(r.input)return[]})),t.validate){if(e.output){if(e.output[e.output.length-1]!==FU.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,NU.isPoint)(r.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(r.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(r.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==n().length)throw new TypeError("Input is invalid");if(!_U.isCanonicalScriptSignature(r.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(r,e)};var PU={},UU={},MU={exports:{}},LU={},TU=ji(sc),RU=TU.EventEmitter;function OU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function HU(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var KU=qo.Buffer,jU=AI.inspect,GU=jU&&jU.custom||"inspect";function qU(e,t,n){KU.prototype.copy.call(e,t,n)}var VU=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t;return t=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return KU.alloc(0);for(var t=KU.allocUnsafe(e>>>0),n=this.head,r=0;n;)qU(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=KU.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,t}},{key:GU,value:function(e,t){return jU(this,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OU(Object(n),!0).forEach((function(t){HU(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OU(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}],t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function zU(e,t){YU(e,t),JU(e)}function JU(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function YU(e,t){e.emit("error",t)}var XU={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ru(YU,this,e)):ru(YU,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?ru(JU,n):(n._writableState.errorEmitted=!0,ru(zU,n,e)):ru(zU,n,e):t?(ru(JU,n),t(e)):ru(JU,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},WU={},ZU={};function $U(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i))||this}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,ZU[e]=r}function eM(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}$U("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),$U("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i,o;if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))o="The ".concat(e," ").concat(r," ").concat(eM(t,"type"));else{var a=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+".".length>e.length)&&-1!==e.indexOf(".",n)}(e)?"property":"argument";o='The "'.concat(e,'" ').concat(a," ").concat(r," ").concat(eM(t,"type"))}return o+". Received type ".concat(typeof n)}),TypeError),$U("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),$U("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),$U("ERR_STREAM_PREMATURE_CLOSE","Premature close"),$U("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),$U("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),$U("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),$U("ERR_STREAM_WRITE_AFTER_END","write after end"),$U("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),$U("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),$U("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),WU.codes=ZU;var tM=WU.codes.ERR_INVALID_OPT_VALUE,nM=function(e,t,n,r){var i=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new tM(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384},rM={},iM=F_.exports.Buffer,oM=iM.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function aM(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(iM.isEncoding===oM||!oM(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=uM,this.end=AM,t=4;break;case"utf8":this.fillLast=lM,t=4;break;case"base64":this.text=cM,this.end=hM,t=3;break;default:return this.write=fM,void(this.end=dM)}this.lastNeed=0,this.lastTotal=0,this.lastChar=iM.allocUnsafe(t)}function sM(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function lM(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function uM(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function AM(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function cM(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function hM(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function fM(e){return e.toString(this.encoding)}function dM(e){return e&&e.length?this.write(e):""}rM.StringDecoder=aM,aM.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},aM.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},aM.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var i=sM(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||-2===i?0:(i=sM(t[r]))>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||-2===i?0:(i=sM(t[r]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},aM.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};var pM=WU.codes.ERR_STREAM_PREMATURE_CLOSE;function gM(){}var yM,mM=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(r||gM);var i=n.readable||!1!==n.readable&&t.readable,o=n.writable||!1!==n.writable&&t.writable,a=function(){t.writable||l()},s=t._writableState&&t._writableState.finished,l=function(){o=!1,s=!0,i||r.call(t)},u=t._readableState&&t._readableState.endEmitted,A=function(){i=!1,u=!0,o||r.call(t)},c=function(e){r.call(t,e)},h=function(){var e;return i&&!u?(t._readableState&&t._readableState.ended||(e=new pM),r.call(t,e)):o&&!s?(t._writableState&&t._writableState.ended||(e=new pM),r.call(t,e)):void 0},f=function(){t.req.on("finish",l)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",l),t.on("abort",h),t.req?f():t.on("request",f)):o&&!t._writableState&&(t.on("end",a),t.on("close",a)),t.on("end",A),t.on("finish",l),!1!==n.error&&t.on("error",c),t.on("close",h),function(){t.removeListener("complete",l),t.removeListener("abort",h),t.removeListener("request",f),t.req&&t.req.removeListener("finish",l),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",l),t.removeListener("end",A),t.removeListener("error",c),t.removeListener("close",h)}};function vM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var IM=mM,wM=Symbol("lastResolve"),bM=Symbol("lastReject"),BM=Symbol("error"),EM=Symbol("ended"),CM=Symbol("lastPromise"),SM=Symbol("handlePromise"),xM=Symbol("stream");function QM(e,t){return{value:e,done:t}}function kM(e){var t=e[wM];if(null!==t){var n=e[xM].read();null!==n&&(e[CM]=null,e[wM]=null,e[bM]=null,t(QM(n,!1)))}}function _M(e){ru(kM,e)}var NM=Object.getPrototypeOf((function(){})),DM=Object.setPrototypeOf((yM={get stream(){return this[xM]},next:function(){var e=this,t=this[BM];if(null!==t)return Promise.reject(t);if(this[EM])return Promise.resolve(QM(void 0,!0));if(this[xM].destroyed)return new Promise((function(t,n){ru((function(){e[BM]?n(e[BM]):t(QM(void 0,!0))}))}));var n,r=this[CM];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[EM]?n(QM(void 0,!0)):t[SM](n,r)}),r)}}(r,this));else{var i=this[xM].read();if(null!==i)return Promise.resolve(QM(i,!1));n=new Promise(this[SM])}return this[CM]=n,n}},vM(yM,Symbol.asyncIterator,(function(){return this})),vM(yM,"return",(function(){var e=this;return new Promise((function(t,n){e[xM].destroy(null,(function(e){e?n(e):t(QM(void 0,!0))}))}))})),yM),NM),FM=function(e){var t,n=Object.create(DM,(vM(t={},xM,{value:e,writable:!0}),vM(t,wM,{value:null,writable:!0}),vM(t,bM,{value:null,writable:!0}),vM(t,BM,{value:null,writable:!0}),vM(t,EM,{value:e._readableState.endEmitted,writable:!0}),vM(t,SM,{value:function(e,t){var r=n[xM].read();r?(n[CM]=null,n[wM]=null,n[bM]=null,e(QM(r,!1))):(n[wM]=e,n[bM]=t)},writable:!0}),t));return n[CM]=null,IM(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[bM];return null!==t&&(n[CM]=null,n[wM]=null,n[bM]=null,t(e)),void(n[BM]=e)}var r=n[wM];null!==r&&(n[CM]=null,n[wM]=null,n[bM]=null,r(QM(void 0,!0))),n[EM]=!0})),e.on("readable",_M.bind(null,n)),n},PM=function(){throw new Error("Readable.from is not available in the browser")};const UM=LU;UM.Readable=nL,nL.ReadableState=tL,TU.EventEmitter;var MM,LM=function(e,t){return e.listeners(t).length},TM=RU,RM=qo.Buffer,OM=Ki.Uint8Array||function(){},HM=AI;MM=HM&&HM.debuglog?HM.debuglog("stream"):function(){};var KM,jM,GM,qM=VU,VM=XU,zM=nM,JM=WU.codes,YM=JM.ERR_INVALID_ARG_TYPE,XM=JM.ERR_STREAM_PUSH_AFTER_EOF,WM=JM.ERR_METHOD_NOT_IMPLEMENTED,ZM=JM.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Ow.exports(nL,TM);var $M=VM.errorOrDestroy,eL=["error","close","destroy","pause","resume"];function tL(e,t,n){e=e||{},"boolean"!=typeof n&&(n=t instanceof UM.Duplex),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=zM(this,e,"readableHighWaterMark",n),this.buffer=new qM,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(KM||(KM=rM.StringDecoder),this.decoder=new KM(e.encoding),this.encoding=e.encoding)}function nL(e){if(!(this instanceof nL))return new nL(e);var t=this instanceof UM.Duplex;this._readableState=new tL(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),TM.call(this)}function rL(e,t,n,r,i){MM("readableAddChunk",t);var o,a=e._readableState;if(null===t)a.reading=!1,function(e,t){if(MM("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?aL(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,sL(e)))}}(e,a);else if(i||(o=function(e,t){var n,r;return r=t,RM.isBuffer(r)||r instanceof OM||"string"==typeof t||void 0===t||e.objectMode||(n=new YM("chunk",["string","Buffer","Uint8Array"],t)),n}(a,t)),o)$M(e,o);else if(a.objectMode||t&&t.length>0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===RM.prototype||(t=function(e){return RM.from(e)}(t)),r)a.endEmitted?$M(e,new ZM):iL(e,a,t,!0);else if(a.ended)$M(e,new XM);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?iL(e,a,t,!1):lL(e,a)):iL(e,a,t,!1)}else r||(a.reading=!1,lL(e,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function iL(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&aL(e)),lL(e,t)}function oL(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function aL(e){var t=e._readableState;MM("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(MM("emitReadable",t.flowing),t.emittedReadable=!0,ru(sL,e))}function sL(e){var t=e._readableState;MM("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,fL(e)}function lL(e,t){t.readingMore||(t.readingMore=!0,ru(uL,e,t))}function uL(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(MM("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function AL(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function cL(e){MM("readable nexttick read 0"),e.read(0)}function hL(e,t){MM("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),fL(e),t.flowing&&!t.reading&&e.read(0)}function fL(e){var t=e._readableState;for(MM("flow",t.flowing);t.flowing&&null!==e.read(););}function dL(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function pL(e){var t=e._readableState;MM("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,ru(gL,t,e))}function gL(e,t){if(MM("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function yL(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}Object.defineProperty(nL.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),nL.prototype.destroy=VM.destroy,nL.prototype._undestroy=VM.undestroy,nL.prototype._destroy=function(e,t){t(e)},nL.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=RM.from(e,t),t=""),n=!0),rL(this,e,t,!1,n)},nL.prototype.unshift=function(e){return rL(this,e,null,!0,!1)},nL.prototype.isPaused=function(){return!1===this._readableState.flowing},nL.prototype.setEncoding=function(e){KM||(KM=rM.StringDecoder);var t=new KM(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this},nL.prototype.read=function(e){MM("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return MM("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?pL(this):aL(this),null;if(0===(e=oL(e,t))&&t.ended)return 0===t.length&&pL(this),null;var r,i=t.needReadable;return MM("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&MM("length less than watermark",i=!0),t.ended||t.reading?MM("reading or ended",i=!1):i&&(MM("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=oL(n,t))),null===(r=e>0?dL(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&pL(this)),null!==r&&this.emit("data",r),r},nL.prototype._read=function(e){$M(this,new WM("_read()"))},nL.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,MM("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end||e===gu.stdout||e===gu.stderr?h:o;function o(){MM("onend"),e.end()}r.endEmitted?ru(i):n.once("end",i),e.on("unpipe",(function t(i,f){MM("onunpipe"),i===n&&f&&!1===f.hasUnpiped&&(f.hasUnpiped=!0,MM("cleanup"),e.removeListener("close",A),e.removeListener("finish",c),e.removeListener("drain",a),e.removeListener("error",u),e.removeListener("unpipe",t),n.removeListener("end",o),n.removeListener("end",h),n.removeListener("data",l),s=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||a())}));var a=function(e){return function(){var t=e._readableState;MM("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&LM(e,"data")&&(t.flowing=!0,fL(e))}}(n);e.on("drain",a);var s=!1;function l(t){MM("ondata");var i=e.write(t);MM("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==yL(r.pipes,e))&&!s&&(MM("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function u(t){MM("onerror",t),h(),e.removeListener("error",u),0===LM(e,"error")&&$M(e,t)}function A(){e.removeListener("finish",c),h()}function c(){MM("onfinish"),e.removeListener("close",A),h()}function h(){MM("unpipe"),n.unpipe(e)}return n.on("data",l),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",u),e.once("close",A),e.once("finish",c),e.emit("pipe",n),r.flowing||(MM("pipe resume"),n.resume()),e},nL.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=yL(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},nL.prototype.on=function(e,t){var n=TM.prototype.on.call(this,e,t),r=this._readableState;return"data"===e?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,MM("on readable",r.length,r.reading),r.length?aL(this):r.reading||ru(cL,this))),n},nL.prototype.addListener=nL.prototype.on,nL.prototype.removeListener=function(e,t){var n=TM.prototype.removeListener.call(this,e,t);return"readable"===e&&ru(AL,this),n},nL.prototype.removeAllListeners=function(e){var t=TM.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||ru(AL,this),t},nL.prototype.resume=function(){var e=this._readableState;return e.flowing||(MM("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,ru(hL,e,t))}(this,e)),e.paused=!1,this},nL.prototype.pause=function(){return MM("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(MM("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},nL.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(MM("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){MM("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<eL.length;o++)e.on(eL[o],this.emit.bind(this,eL[o]));return this._read=function(t){MM("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(nL.prototype[Symbol.asyncIterator]=function(){return void 0===jM&&(jM=FM),jM(this)}),Object.defineProperty(nL.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(nL.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(nL.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),nL._fromList=dL,Object.defineProperty(nL.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(nL.from=function(e,t){return void 0===GM&&(GM=PM),GM(nL,e,t)});function mL(e){try{if(!Ki.localStorage)return!1}catch(e){return!1}var t=Ki.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}const vL=LU;function IL(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(undefined),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}vL.Writable=OL,OL.WritableState=RL;var wL,bL=function(e,t){if(mL("noDeprecation"))return e;var n=!1;return function(){if(!n){if(mL("throwDeprecation"))throw new Error(t);mL("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}},BL=RU,EL=qo.Buffer,CL=Ki.Uint8Array||function(){},SL=XU,xL=nM,QL=WU.codes,kL=QL.ERR_INVALID_ARG_TYPE,_L=QL.ERR_METHOD_NOT_IMPLEMENTED,NL=QL.ERR_MULTIPLE_CALLBACK,DL=QL.ERR_STREAM_CANNOT_PIPE,FL=QL.ERR_STREAM_DESTROYED,PL=QL.ERR_STREAM_NULL_VALUES,UL=QL.ERR_STREAM_WRITE_AFTER_END,ML=QL.ERR_UNKNOWN_ENCODING,LL=SL.errorOrDestroy;function TL(){}function RL(e,t,n){e=e||{},"boolean"!=typeof n&&(n=t instanceof vL.Duplex),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=xL(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var r=!1===e.decodeStrings;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new NL;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(ru(i,r),ru(VL,e,t),e._writableState.errorEmitted=!0,LL(e,r)):(i(r),e._writableState.errorEmitted=!0,LL(e,r),VL(e,t))}(e,n,r,t,i);else{var o=GL(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||jL(e,n),r?ru(KL,e,n,o,i):KL(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new IL(this)}function OL(e){var t=this instanceof vL.Duplex;if(!t&&!wL.call(OL,this))return new OL(e);this._writableState=new RL(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),BL.call(this)}function HL(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new FL("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function KL(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),VL(e,t)}function jL(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0,s=!0;n;)i[a]=n,n.isBuf||(s=!1),n=n.next,a+=1;i.allBuffers=s,HL(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new IL(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,A=n.callback;if(HL(e,t,!1,t.objectMode?1:l.length,l,u,A),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function GL(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function qL(e,t){e._final((function(n){t.pendingcb--,n&&LL(e,n),t.prefinished=!0,e.emit("prefinish"),VL(e,t)}))}function VL(e,t){var n=GL(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,ru(qL,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}Ow.exports(OL,BL),RL.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(RL.prototype,"buffer",{get:bL((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(wL=Function.prototype[Symbol.hasInstance],Object.defineProperty(OL,Symbol.hasInstance,{value:function(e){return!!wL.call(this,e)||this===OL&&e&&e._writableState instanceof RL}})):wL=function(e){return e instanceof this},OL.prototype.pipe=function(){LL(this,new DL)},OL.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,a=!i.objectMode&&(r=e,EL.isBuffer(r)||r instanceof CL);return a&&!EL.isBuffer(e)&&(e=function(e){return EL.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=TL),i.ending?function(e,t){var n=new UL;LL(e,n),ru(t,n)}(this,n):(a||function(e,t,n,r){var i;return null===n?i=new PL:"string"==typeof n||t.objectMode||(i=new kL("chunk",["string","Buffer"],n)),!i||(LL(e,i),ru(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,o){if(!n){var a=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=EL.from(t,n)),t}(t,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=t.objectMode?1:r.length;t.length+=s;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else HL(e,t,!1,s,r,i,o);return l}(this,i,a,e,t,n)),o},OL.prototype.cork=function(){this._writableState.corked++},OL.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||jL(this,e))},OL.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new ML(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(OL.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(OL.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),OL.prototype._write=function(e,t,n){n(new _L("_write()"))},OL.prototype._writev=null,OL.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,VL(e,t),n&&(t.finished?ru(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(OL.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(OL.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),OL.prototype.destroy=SL.destroy,OL.prototype._undestroy=SL.undestroy,OL.prototype._destroy=function(e,t){t(e)};var zL=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};const JL=LU;JL.Duplex=ZL,Ow.exports(ZL,JL.Readable);for(var YL=zL(JL.Writable.prototype),XL=0;XL<YL.length;XL++){var WL=YL[XL];ZL.prototype[WL]||(ZL.prototype[WL]=JL.Writable.prototype[WL])}function ZL(e){if(!(this instanceof ZL))return new ZL(e);JL.Readable.call(this,e),JL.Writable.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",$L)))}function $L(){this._writableState.ended||ru(eT,this)}function eT(e){e.end()}Object.defineProperty(ZL.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(ZL.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(ZL.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(ZL.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});const tT=LU;tT.Transform=lT;var nT=WU.codes,rT=nT.ERR_METHOD_NOT_IMPLEMENTED,iT=nT.ERR_MULTIPLE_CALLBACK,oT=nT.ERR_TRANSFORM_ALREADY_TRANSFORMING,aT=nT.ERR_TRANSFORM_WITH_LENGTH_0;function sT(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new iT);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function lT(e){if(!(this instanceof lT))return new lT(e);tT.Duplex.call(this,e),this._transformState={afterTransform:sT.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",uT)}function uT(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?AT(this,null,null):this._flush((function(t,n){AT(e,t,n)}))}function AT(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new aT;if(e._transformState.transforming)throw new oT;return e.push(null)}Ow.exports(lT,tT.Duplex),lT.prototype.push=function(e,t){return this._transformState.needTransform=!1,tT.Duplex.prototype.push.call(this,e,t)},lT.prototype._transform=function(e,t,n){n(new rT("_transform()"))},lT.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},lT.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},lT.prototype._destroy=function(e,t){tT.Duplex.prototype._destroy.call(this,e,(function(e){t(e)}))};const cT=LU;function hT(e){if(!(this instanceof hT))return new hT(e);Transform.call(this,e)}var fT;cT.PassThrough=hT,Ow.exports(hT,cT.Transform),hT.prototype._transform=function(e,t,n){n(null,e)};var dT=WU.codes,pT=dT.ERR_MISSING_ARGS,gT=dT.ERR_STREAM_DESTROYED;function yT(e){if(e)throw e}function mT(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var i=!1;e.on("close",(function(){i=!0})),void 0===fT&&(fT=mM),fT(e,{readable:t,writable:n},(function(e){if(e)return r(e);i=!0,r()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new gT("pipe"))}}function vT(e){e()}function IT(e,t){return e.pipe(t)}function wT(e){return e.length?"function"!=typeof e[e.length-1]?yT:e.pop():yT}var bT=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=wT(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new pT("streams");var o=t.map((function(e,n){var a=n<t.length-1;return mT(e,a,n>0,(function(e){r||(r=e),e&&o.forEach(vT),a||(o.forEach(vT),i(r))}))}));return t.reduce(IT)};!function(e,t){const n=LU;(t=MU.exports=n.Readable).Stream=n.Readable,t.Readable=n.Readable,t.Writable=n.Writable,t.Duplex=n.Duplex,t.Transform=n.Transform,t.PassThrough=n.PassThrough,t.finished=mM,t.pipeline=bT}(0,MU.exports);var BT=F_.exports.Buffer,ET=MU.exports;function CT(e){ET.Stream.Transform.call(this),this._block=BT.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}(0,Ow.exports)(CT,ET.Stream.Transform),CT.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},CT.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},CT.prototype.update=function(e,t){if(function(e,t){if(!BT.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");BT.isBuffer(e)||(e=BT.from(e,t));for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)n[i++]=e[r++];this._update(),this._blockOffset=0}for(;r<e.length;)n[this._blockOffset++]=e[r++];for(var o=0,a=8*e.length;a>0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},CT.prototype._update=function(){throw new Error("_update is not implemented")},CT.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},CT.prototype._digest=function(){throw new Error("_digest is not implemented")};var ST=CT,xT=Ow.exports,QT=ST,kT=F_.exports.Buffer,_T=new Array(16);function NT(){QT.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function DT(e,t){return e<<t|e>>>32-t}function FT(e,t,n,r,i,o,a){return DT(e+(t&n|~t&r)+i+o|0,a)+t|0}function PT(e,t,n,r,i,o,a){return DT(e+(t&r|n&~r)+i+o|0,a)+t|0}function UT(e,t,n,r,i,o,a){return DT(e+(t^n^r)+i+o|0,a)+t|0}function MT(e,t,n,r,i,o,a){return DT(e+(n^(t|~r))+i+o|0,a)+t|0}xT(NT,QT),NT.prototype._update=function(){for(var e=_T,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=FT(n,r,i,o,e[0],3614090360,7),o=FT(o,n,r,i,e[1],3905402710,12),i=FT(i,o,n,r,e[2],606105819,17),r=FT(r,i,o,n,e[3],3250441966,22),n=FT(n,r,i,o,e[4],4118548399,7),o=FT(o,n,r,i,e[5],1200080426,12),i=FT(i,o,n,r,e[6],2821735955,17),r=FT(r,i,o,n,e[7],4249261313,22),n=FT(n,r,i,o,e[8],1770035416,7),o=FT(o,n,r,i,e[9],2336552879,12),i=FT(i,o,n,r,e[10],4294925233,17),r=FT(r,i,o,n,e[11],2304563134,22),n=FT(n,r,i,o,e[12],1804603682,7),o=FT(o,n,r,i,e[13],4254626195,12),i=FT(i,o,n,r,e[14],2792965006,17),n=PT(n,r=FT(r,i,o,n,e[15],1236535329,22),i,o,e[1],4129170786,5),o=PT(o,n,r,i,e[6],3225465664,9),i=PT(i,o,n,r,e[11],643717713,14),r=PT(r,i,o,n,e[0],3921069994,20),n=PT(n,r,i,o,e[5],3593408605,5),o=PT(o,n,r,i,e[10],38016083,9),i=PT(i,o,n,r,e[15],3634488961,14),r=PT(r,i,o,n,e[4],3889429448,20),n=PT(n,r,i,o,e[9],568446438,5),o=PT(o,n,r,i,e[14],3275163606,9),i=PT(i,o,n,r,e[3],4107603335,14),r=PT(r,i,o,n,e[8],1163531501,20),n=PT(n,r,i,o,e[13],2850285829,5),o=PT(o,n,r,i,e[2],4243563512,9),i=PT(i,o,n,r,e[7],1735328473,14),n=UT(n,r=PT(r,i,o,n,e[12],2368359562,20),i,o,e[5],4294588738,4),o=UT(o,n,r,i,e[8],2272392833,11),i=UT(i,o,n,r,e[11],1839030562,16),r=UT(r,i,o,n,e[14],4259657740,23),n=UT(n,r,i,o,e[1],2763975236,4),o=UT(o,n,r,i,e[4],1272893353,11),i=UT(i,o,n,r,e[7],4139469664,16),r=UT(r,i,o,n,e[10],3200236656,23),n=UT(n,r,i,o,e[13],681279174,4),o=UT(o,n,r,i,e[0],3936430074,11),i=UT(i,o,n,r,e[3],3572445317,16),r=UT(r,i,o,n,e[6],76029189,23),n=UT(n,r,i,o,e[9],3654602809,4),o=UT(o,n,r,i,e[12],3873151461,11),i=UT(i,o,n,r,e[15],530742520,16),n=MT(n,r=UT(r,i,o,n,e[2],3299628645,23),i,o,e[0],4096336452,6),o=MT(o,n,r,i,e[7],1126891415,10),i=MT(i,o,n,r,e[14],2878612391,15),r=MT(r,i,o,n,e[5],4237533241,21),n=MT(n,r,i,o,e[12],1700485571,6),o=MT(o,n,r,i,e[3],2399980690,10),i=MT(i,o,n,r,e[10],4293915773,15),r=MT(r,i,o,n,e[1],2240044497,21),n=MT(n,r,i,o,e[8],1873313359,6),o=MT(o,n,r,i,e[15],4264355552,10),i=MT(i,o,n,r,e[6],2734768916,15),r=MT(r,i,o,n,e[13],1309151649,21),n=MT(n,r,i,o,e[4],4149444226,6),o=MT(o,n,r,i,e[11],3174756917,10),i=MT(i,o,n,r,e[2],718787259,15),r=MT(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},NT.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=kT.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var LT=NT,TT=qo.Buffer,RT=Ow.exports,OT=ST,HT=new Array(16),KT=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],jT=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],GT=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],qT=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],VT=[0,1518500249,1859775393,2400959708,2840853838],zT=[1352829926,1548603684,1836072691,2053994217,0];function JT(){OT.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function YT(e,t){return e<<t|e>>>32-t}function XT(e,t,n,r,i,o,a,s){return YT(e+(t^n^r)+o+a|0,s)+i|0}function WT(e,t,n,r,i,o,a,s){return YT(e+(t&n|~t&r)+o+a|0,s)+i|0}function ZT(e,t,n,r,i,o,a,s){return YT(e+((t|~n)^r)+o+a|0,s)+i|0}function $T(e,t,n,r,i,o,a,s){return YT(e+(t&r|n&~r)+o+a|0,s)+i|0}function eR(e,t,n,r,i,o,a,s){return YT(e+(t^(n|~r))+o+a|0,s)+i|0}RT(JT,OT),JT.prototype._update=function(){for(var e=HT,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,l=0|this._b,u=0|this._c,A=0|this._d,c=0|this._e,h=0;h<80;h+=1){var f,d;h<16?(f=XT(n,r,i,o,a,e[KT[h]],VT[0],GT[h]),d=eR(s,l,u,A,c,e[jT[h]],zT[0],qT[h])):h<32?(f=WT(n,r,i,o,a,e[KT[h]],VT[1],GT[h]),d=$T(s,l,u,A,c,e[jT[h]],zT[1],qT[h])):h<48?(f=ZT(n,r,i,o,a,e[KT[h]],VT[2],GT[h]),d=ZT(s,l,u,A,c,e[jT[h]],zT[2],qT[h])):h<64?(f=$T(n,r,i,o,a,e[KT[h]],VT[3],GT[h]),d=WT(s,l,u,A,c,e[jT[h]],zT[3],qT[h])):(f=eR(n,r,i,o,a,e[KT[h]],VT[4],GT[h]),d=XT(s,l,u,A,c,e[jT[h]],zT[4],qT[h])),n=a,a=o,o=YT(i,10),i=r,r=f,s=c,c=A,A=YT(u,10),u=l,l=d}var p=this._b+i+A|0;this._b=this._c+o+c|0,this._c=this._d+a+s|0,this._d=this._e+n+l|0,this._e=this._a+r+u|0,this._a=p},JT.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=TT.alloc?TT.alloc(20):new TT(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var tR=JT,nR={exports:{}},rR=F_.exports.Buffer;function iR(e,t){this._block=rR.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}iR.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=rR.from(e,t));for(var n=this._block,r=this._blockSize,i=e.length,o=this._len,a=0;a<i;){for(var s=o%r,l=Math.min(i-a,r-s),u=0;u<l;u++)n[s+u]=e[a+u];a+=l,(o+=l)%r==0&&this._update(n)}return this._len+=i,this},iR.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},iR.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var oR=iR,aR=Ow.exports,sR=oR,lR=F_.exports.Buffer,uR=[1518500249,1859775393,-1894007588,-899497514],AR=new Array(80);function cR(){this.init(),this._w=AR,sR.call(this,64,56)}function hR(e){return e<<30|e>>>2}function fR(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}aR(cR,sR),cR.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},cR.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,l=0;l<16;++l)n[l]=e.readInt32BE(4*l);for(;l<80;++l)n[l]=n[l-3]^n[l-8]^n[l-14]^n[l-16];for(var u=0;u<80;++u){var A=~~(u/20),c=0|((t=r)<<5|t>>>27)+fR(A,i,o,a)+s+n[u]+uR[A];s=a,a=o,o=hR(i),i=r,r=c}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},cR.prototype._hash=function(){var e=lR.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var dR=cR,pR=Ow.exports,gR=oR,yR=F_.exports.Buffer,mR=[1518500249,1859775393,-1894007588,-899497514],vR=new Array(80);function IR(){this.init(),this._w=vR,gR.call(this,64,56)}function wR(e){return e<<5|e>>>27}function bR(e){return e<<30|e>>>2}function BR(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}pR(IR,gR),IR.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},IR.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,l=0;l<16;++l)n[l]=e.readInt32BE(4*l);for(;l<80;++l)n[l]=(t=n[l-3]^n[l-8]^n[l-14]^n[l-16])<<1|t>>>31;for(var u=0;u<80;++u){var A=~~(u/20),c=wR(r)+BR(A,i,o,a)+s+n[u]+mR[A]|0;s=a,a=o,o=bR(i),i=r,r=c}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},IR.prototype._hash=function(){var e=yR.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var ER=IR,CR=Ow.exports,SR=oR,xR=F_.exports.Buffer,QR=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],kR=new Array(64);function _R(){this.init(),this._w=kR,SR.call(this,64,56)}function NR(e,t,n){return n^e&(t^n)}function DR(e,t,n){return e&t|n&(e|t)}function FR(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function PR(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function UR(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function MR(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}CR(_R,SR),_R.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},_R.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._f,l=0|this._g,u=0|this._h,A=0;A<16;++A)t[A]=e.readInt32BE(4*A);for(;A<64;++A)t[A]=MR(t[A-2])+t[A-7]+UR(t[A-15])+t[A-16]|0;for(var c=0;c<64;++c){var h=u+PR(a)+NR(a,s,l)+QR[c]+t[c]|0,f=FR(n)+DR(n,r,i)|0;u=l,l=s,s=a,a=o+h|0,o=i,i=r,r=n,n=h+f|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=s+this._f|0,this._g=l+this._g|0,this._h=u+this._h|0},_R.prototype._hash=function(){var e=xR.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var LR=_R,TR=Ow.exports,RR=LR,OR=oR,HR=F_.exports.Buffer,KR=new Array(64);function jR(){this.init(),this._w=KR,OR.call(this,64,56)}TR(jR,RR),jR.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},jR.prototype._hash=function(){var e=HR.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var GR=jR,qR=Ow.exports,VR=oR,zR=F_.exports.Buffer,JR=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],YR=new Array(160);function XR(){this.init(),this._w=YR,VR.call(this,128,112)}function WR(e,t,n){return n^e&(t^n)}function ZR(e,t,n){return e&t|n&(e|t)}function $R(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function eO(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function tO(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function nO(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function rO(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function iO(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function oO(e,t){return e>>>0<t>>>0?1:0}qR(XR,VR),XR.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},XR.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,l=0|this._gh,u=0|this._hh,A=0|this._al,c=0|this._bl,h=0|this._cl,f=0|this._dl,d=0|this._el,p=0|this._fl,g=0|this._gl,y=0|this._hl,m=0;m<32;m+=2)t[m]=e.readInt32BE(4*m),t[m+1]=e.readInt32BE(4*m+4);for(;m<160;m+=2){var v=t[m-30],I=t[m-30+1],w=tO(v,I),b=nO(I,v),B=rO(v=t[m-4],I=t[m-4+1]),E=iO(I,v),C=t[m-14],S=t[m-14+1],x=t[m-32],Q=t[m-32+1],k=b+S|0,_=w+C+oO(k,b)|0;_=(_=_+B+oO(k=k+E|0,E)|0)+x+oO(k=k+Q|0,Q)|0,t[m]=_,t[m+1]=k}for(var N=0;N<160;N+=2){_=t[N],k=t[N+1];var D=ZR(n,r,i),F=ZR(A,c,h),P=$R(n,A),U=$R(A,n),M=eO(a,d),L=eO(d,a),T=JR[N],R=JR[N+1],O=WR(a,s,l),H=WR(d,p,g),K=y+L|0,j=u+M+oO(K,y)|0;j=(j=(j=j+O+oO(K=K+H|0,H)|0)+T+oO(K=K+R|0,R)|0)+_+oO(K=K+k|0,k)|0;var G=U+F|0,q=P+D+oO(G,U)|0;u=l,y=g,l=s,g=p,s=a,p=d,a=o+j+oO(d=f+K|0,f)|0,o=i,f=h,i=r,h=c,r=n,c=A,n=j+q+oO(A=K+G|0,K)|0}this._al=this._al+A|0,this._bl=this._bl+c|0,this._cl=this._cl+h|0,this._dl=this._dl+f|0,this._el=this._el+d|0,this._fl=this._fl+p|0,this._gl=this._gl+g|0,this._hl=this._hl+y|0,this._ah=this._ah+n+oO(this._al,A)|0,this._bh=this._bh+r+oO(this._bl,c)|0,this._ch=this._ch+i+oO(this._cl,h)|0,this._dh=this._dh+o+oO(this._dl,f)|0,this._eh=this._eh+a+oO(this._el,d)|0,this._fh=this._fh+s+oO(this._fl,p)|0,this._gh=this._gh+l+oO(this._gl,g)|0,this._hh=this._hh+u+oO(this._hl,y)|0},XR.prototype._hash=function(){var e=zR.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var aO=XR,sO=Ow.exports,lO=aO,uO=oR,AO=F_.exports.Buffer,cO=new Array(160);function hO(){this.init(),this._w=cO,uO.call(this,128,112)}sO(hO,lO),hO.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},hO.prototype._hash=function(){var e=AO.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var fO=hO,dO=nR.exports=function(e){e=e.toLowerCase();var t=dO[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};dO.sha=dR,dO.sha1=ER,dO.sha224=GR,dO.sha256=LR,dO.sha384=fO,dO.sha512=aO;var pO=ji(dc),gO=F_.exports.Buffer,yO=LQ.Transform,mO=pO.StringDecoder;function vO(e){yO.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}(0,Ow.exports)(vO,yO),vO.prototype.update=function(e,t,n){"string"==typeof e&&(e=gO.from(e,t));var r=this._update(e);return this.hashMode?this:(n&&(r=this._toString(r,n)),r)},vO.prototype.setAutoPadding=function(){},vO.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},vO.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},vO.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},vO.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},vO.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},vO.prototype._finalOrDigest=function(e){var t=this.__final()||gO.alloc(0);return e&&(t=this._toString(t,e,!0)),t},vO.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new mO(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r};var IO=vO,wO=Ow.exports,bO=LT,BO=tR,EO=nR.exports,CO=IO;function SO(e){CO.call(this,"digest"),this._hash=e}wO(SO,CO),SO.prototype._update=function(e){this._hash.update(e)},SO.prototype._final=function(){return this._hash.digest()};var xO=function(e){return"md5"===(e=e.toLowerCase())?new bO:"rmd160"===e||"ripemd160"===e?new BO:new SO(EO(e))};Object.defineProperty(UU,"__esModule",{value:!0}),UU.taggedHash=UU.hash256=UU.hash160=UU.sha256=UU.sha1=UU.ripemd160=void 0;const QO=xO,kO=tR;function _O(e){try{return QO("rmd160").update(e).digest()}catch(t){try{return QO("ripemd160").update(e).digest()}catch(t){return(new kO).update(e).digest()}}}function NO(e){return QO("sha256").update(e).digest()}UU.ripemd160=_O,UU.sha1=function(e){return QO("sha1").update(e).digest()},UU.sha256=NO,UU.hash160=function(e){return _O(NO(e))},UU.hash256=function(e){return NO(NO(e))};const DO=Object.fromEntries(["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"].map((e=>{const t=NO(ao.from(e));return[e,ao.concat([t,t])]})));UU.taggedHash=function(e,t){return NO(ao.concat([DO[e],t]))};var FO=sP,PO=F_.exports.Buffer,UO=xO,MO=function(e){function t(t){var n=t.slice(0,-4),r=t.slice(-4),i=e(n);if(!(r[0]^i[0]|r[1]^i[1]|r[2]^i[2]|r[3]^i[3]))return n}return{encode:function(t){var n=e(t);return FO.encode(PO.concat([t,n],t.length+4))},decode:function(e){var n=t(FO.decode(e));if(!n)throw new Error("Invalid checksum");return n},decodeUnsafe:function(e){var n=FO.decodeUnsafe(e);if(n)return t(n)}}}((function(e){var t=UO("sha256").update(e).digest();return UO("sha256").update(t).digest()}));Object.defineProperty(PU,"__esModule",{value:!0}),PU.p2pkh=void 0;const LO=UU,TO=cP,RO=dP,OO=EP,HO=dU,KO=MO,jO=RO.OPS;PU.p2pkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,OO.typeforce)({network:OO.typeforce.maybe(OO.typeforce.Object),address:OO.typeforce.maybe(OO.typeforce.String),hash:OO.typeforce.maybe(OO.typeforce.BufferN(20)),output:OO.typeforce.maybe(OO.typeforce.BufferN(25)),pubkey:OO.typeforce.maybe(OO.isPoint),signature:OO.typeforce.maybe(RO.isCanonicalScriptSignature),input:OO.typeforce.maybe(OO.typeforce.Buffer)},e);const n=HO.value((()=>{const t=KO.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),r=HO.value((()=>RO.decompile(e.input))),i=e.network||TO.bitcoin,o={name:"p2pkh",network:i};if(HO.prop(o,"address",(()=>{if(!o.hash)return;const e=ao.allocUnsafe(21);return e.writeUInt8(i.pubKeyHash,0),o.hash.copy(e,1),KO.encode(e)})),HO.prop(o,"hash",(()=>e.output?e.output.slice(3,23):e.address?n().hash:e.pubkey||o.pubkey?LO.hash160(e.pubkey||o.pubkey):void 0)),HO.prop(o,"output",(()=>{if(o.hash)return RO.compile([jO.OP_DUP,jO.OP_HASH160,o.hash,jO.OP_EQUALVERIFY,jO.OP_CHECKSIG])})),HO.prop(o,"pubkey",(()=>{if(e.input)return r()[1]})),HO.prop(o,"signature",(()=>{if(e.input)return r()[0]})),HO.prop(o,"input",(()=>{if(e.pubkey&&e.signature)return RO.compile([e.signature,e.pubkey])})),HO.prop(o,"witness",(()=>{if(o.input)return[]})),t.validate){let t=ao.from([]);if(e.address){if(n().version!==i.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==n().hash.length)throw new TypeError("Invalid address");t=n().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==jO.OP_DUP||e.output[1]!==jO.OP_HASH160||20!==e.output[2]||e.output[23]!==jO.OP_EQUALVERIFY||e.output[24]!==jO.OP_CHECKSIG)throw new TypeError("Output is invalid");const n=e.output.slice(3,23);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.pubkey){const n=LO.hash160(e.pubkey);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.input){const n=r();if(2!==n.length)throw new TypeError("Input is invalid");if(!RO.isCanonicalScriptSignature(n[0]))throw new TypeError("Input has invalid signature");if(!(0,OO.isPoint)(n[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(n[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(n[1]))throw new TypeError("Pubkey mismatch");const i=LO.hash160(n[1]);if(t.length>0&&!t.equals(i))throw new TypeError("Hash mismatch")}}return Object.assign(o,e)};var GO={};Object.defineProperty(GO,"__esModule",{value:!0}),GO.p2sh=void 0;const qO=UU,VO=cP,zO=dP,JO=EP,YO=dU,XO=MO,WO=zO.OPS;GO.p2sh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,JO.typeforce)({network:JO.typeforce.maybe(JO.typeforce.Object),address:JO.typeforce.maybe(JO.typeforce.String),hash:JO.typeforce.maybe(JO.typeforce.BufferN(20)),output:JO.typeforce.maybe(JO.typeforce.BufferN(23)),redeem:JO.typeforce.maybe({network:JO.typeforce.maybe(JO.typeforce.Object),output:JO.typeforce.maybe(JO.typeforce.Buffer),input:JO.typeforce.maybe(JO.typeforce.Buffer),witness:JO.typeforce.maybe(JO.typeforce.arrayOf(JO.typeforce.Buffer))}),input:JO.typeforce.maybe(JO.typeforce.Buffer),witness:JO.typeforce.maybe(JO.typeforce.arrayOf(JO.typeforce.Buffer))},e);let n=e.network;n||(n=e.redeem&&e.redeem.network||VO.bitcoin);const r={network:n},i=YO.value((()=>{const t=XO.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),o=YO.value((()=>zO.decompile(e.input))),a=YO.value((()=>{const t=o(),r=t[t.length-1];return{network:n,output:r===WO.OP_FALSE?ao.from([]):r,input:zO.compile(t.slice(0,-1)),witness:e.witness||[]}}));if(YO.prop(r,"address",(()=>{if(!r.hash)return;const e=ao.allocUnsafe(21);return e.writeUInt8(r.network.scriptHash,0),r.hash.copy(e,1),XO.encode(e)})),YO.prop(r,"hash",(()=>e.output?e.output.slice(2,22):e.address?i().hash:r.redeem&&r.redeem.output?qO.hash160(r.redeem.output):void 0)),YO.prop(r,"output",(()=>{if(r.hash)return zO.compile([WO.OP_HASH160,r.hash,WO.OP_EQUAL])})),YO.prop(r,"redeem",(()=>{if(e.input)return a()})),YO.prop(r,"input",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.output)return zO.compile([].concat(zO.decompile(e.redeem.input),e.redeem.output))})),YO.prop(r,"witness",(()=>r.redeem&&r.redeem.witness?r.redeem.witness:r.input?[]:void 0)),YO.prop(r,"name",(()=>{const e=["p2sh"];return void 0!==r.redeem&&void 0!==r.redeem.name&&e.push(r.redeem.name),e.join("-")})),t.validate){let t=ao.from([]);if(e.address){if(i().version!==n.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==i().hash.length)throw new TypeError("Invalid address");t=i().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==WO.OP_HASH160||20!==e.output[1]||e.output[22]!==WO.OP_EQUAL)throw new TypeError("Output is invalid");const n=e.output.slice(2,22);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}const r=e=>{if(e.output){const n=zO.decompile(e.output);if(!n||n.length<1)throw new TypeError("Redeem.output too short");const r=qO.hash160(e.output);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.input){const t=e.input.length>0,n=e.witness&&e.witness.length>0;if(!t&&!n)throw new TypeError("Empty input");if(t&&n)throw new TypeError("Input and witness provided");if(t){const t=zO.decompile(e.input);if(!zO.isPushOnly(t))throw new TypeError("Non push-only scriptSig")}}};if(e.input){const e=o();if(!e||e.length<1)throw new TypeError("Input too short");if(!jo(a().output))throw new TypeError("Input is invalid");r(a())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==n)throw new TypeError("Network mismatch");if(e.input){const t=a();if(e.redeem.output&&!e.redeem.output.equals(t.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(t.input))throw new TypeError("Redeem.input mismatch")}r(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(r,e)};var ZO={},$O={};Object.defineProperty($O,"__esModule",{value:!0}),$O.bech32m=$O.bech32=void 0;const eH="qpzry9x8gf2tvdw0s3jn54khce6mua7l",tH={};for(let e=0;e<eH.length;e++){const t=eH.charAt(e);tH[t]=e}function nH(e){const t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function rH(e){let t=1;for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=nH(t)^r>>5}t=nH(t);for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);t=nH(t)^31&r}return t}function iH(e,t,n,r){let i=0,o=0;const a=(1<<n)-1,s=[];for(let r=0;r<e.length;++r)for(i=i<<t|e[r],o+=t;o>=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<<n-o&a);else{if(o>=t)return"Excess padding";if(i<<n-o&a)return"Non-zero padding"}return s}function oH(e){return iH(e,8,5,!0)}function aH(e){const t=iH(e,5,8,!1);if(Array.isArray(t))return t}function sH(e){const t=iH(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function lH(e){let t;function n(e,n){if(n=n||90,e.length<8)return e+" too short";if(e.length>n)return"Exceeds length limit";const r=e.toLowerCase(),i=e.toUpperCase();if(e!==r&&e!==i)return"Mixed-case string "+e;const o=(e=r).lastIndexOf("1");if(-1===o)return"No separator character for "+e;if(0===o)return"Missing prefix for "+e;const a=e.slice(0,o),s=e.slice(o+1);if(s.length<6)return"Data too short";let l=rH(a);if("string"==typeof l)return l;const u=[];for(let e=0;e<s.length;++e){const t=s.charAt(e),n=tH[t];if(void 0===n)return"Unknown character "+t;l=nH(l)^n,e+6>=s.length||u.push(n)}return l!==t?"Invalid checksum for "+e:{prefix:a,words:u}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=n(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=n(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,n,r){if(r=r||90,e.length+7+n.length>r)throw new TypeError("Exceeds length limit");let i=rH(e=e.toLowerCase());if("string"==typeof i)throw new Error(i);let o=e+"1";for(let e=0;e<n.length;++e){const t=n[e];if(t>>5!=0)throw new Error("Non 5-bit word");i=nH(i)^t,o+=eH.charAt(t)}for(let e=0;e<6;++e)i=nH(i);i^=t;for(let e=0;e<6;++e)o+=eH.charAt(i>>5*(5-e)&31);return o},toWords:oH,fromWordsUnsafe:aH,fromWords:sH}}$O.bech32=lH("bech32"),$O.bech32m=lH("bech32m"),Object.defineProperty(ZO,"__esModule",{value:!0}),ZO.p2wpkh=void 0;const uH=UU,AH=cP,cH=dP,hH=EP,fH=dU,dH=$O,pH=cH.OPS,gH=ao.alloc(0);ZO.p2wpkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,hH.typeforce)({address:hH.typeforce.maybe(hH.typeforce.String),hash:hH.typeforce.maybe(hH.typeforce.BufferN(20)),input:hH.typeforce.maybe(hH.typeforce.BufferN(0)),network:hH.typeforce.maybe(hH.typeforce.Object),output:hH.typeforce.maybe(hH.typeforce.BufferN(22)),pubkey:hH.typeforce.maybe(hH.isPoint),signature:hH.typeforce.maybe(cH.isCanonicalScriptSignature),witness:hH.typeforce.maybe(hH.typeforce.arrayOf(hH.typeforce.Buffer))},e);const n=fH.value((()=>{const t=dH.bech32.decode(e.address),n=t.words.shift(),r=dH.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:ao.from(r)}})),r=e.network||AH.bitcoin,i={name:"p2wpkh",network:r};if(fH.prop(i,"address",(()=>{if(!i.hash)return;const e=dH.bech32.toWords(i.hash);return e.unshift(0),dH.bech32.encode(r.bech32,e)})),fH.prop(i,"hash",(()=>e.output?e.output.slice(2,22):e.address?n().data:e.pubkey||i.pubkey?uH.hash160(e.pubkey||i.pubkey):void 0)),fH.prop(i,"output",(()=>{if(i.hash)return cH.compile([pH.OP_0,i.hash])})),fH.prop(i,"pubkey",(()=>e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0)),fH.prop(i,"signature",(()=>{if(e.witness)return e.witness[0]})),fH.prop(i,"input",(()=>{if(i.witness)return gH})),fH.prop(i,"witness",(()=>{if(e.pubkey&&e.signature)return[e.signature,e.pubkey]})),t.validate){let t=ao.from([]);if(e.address){if(r&&r.bech32!==n().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(20!==n().data.length)throw new TypeError("Invalid address data");t=n().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==pH.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(t.length>0&&!t.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");t=e.output.slice(2)}if(e.pubkey){const n=uH.hash160(e.pubkey);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");if(t=n,!(0,hH.isPoint)(e.pubkey)||33!==e.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!cH.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,hH.isPoint)(e.witness[1])||33!==e.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");const n=uH.hash160(e.witness[1]);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(i,e)};var yH={};Object.defineProperty(yH,"__esModule",{value:!0}),yH.p2wsh=void 0;const mH=UU,vH=cP,IH=dP,wH=EP,bH=dU,BH=$O,EH=IH.OPS,CH=ao.alloc(0);function SH(e){return!(!jo(e)||65!==e.length||4!==e[0]||!(0,wH.isPoint)(e))}yH.p2wsh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,wH.typeforce)({network:wH.typeforce.maybe(wH.typeforce.Object),address:wH.typeforce.maybe(wH.typeforce.String),hash:wH.typeforce.maybe(wH.typeforce.BufferN(32)),output:wH.typeforce.maybe(wH.typeforce.BufferN(34)),redeem:wH.typeforce.maybe({input:wH.typeforce.maybe(wH.typeforce.Buffer),network:wH.typeforce.maybe(wH.typeforce.Object),output:wH.typeforce.maybe(wH.typeforce.Buffer),witness:wH.typeforce.maybe(wH.typeforce.arrayOf(wH.typeforce.Buffer))}),input:wH.typeforce.maybe(wH.typeforce.BufferN(0)),witness:wH.typeforce.maybe(wH.typeforce.arrayOf(wH.typeforce.Buffer))},e);const n=bH.value((()=>{const t=BH.bech32.decode(e.address),n=t.words.shift(),r=BH.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:ao.from(r)}})),r=bH.value((()=>IH.decompile(e.redeem.input)));let i=e.network;i||(i=e.redeem&&e.redeem.network||vH.bitcoin);const o={network:i};if(bH.prop(o,"address",(()=>{if(!o.hash)return;const e=BH.bech32.toWords(o.hash);return e.unshift(0),BH.bech32.encode(i.bech32,e)})),bH.prop(o,"hash",(()=>e.output?e.output.slice(2):e.address?n().data:o.redeem&&o.redeem.output?mH.sha256(o.redeem.output):void 0)),bH.prop(o,"output",(()=>{if(o.hash)return IH.compile([EH.OP_0,o.hash])})),bH.prop(o,"redeem",(()=>{if(e.witness)return{output:e.witness[e.witness.length-1],input:CH,witness:e.witness.slice(0,-1)}})),bH.prop(o,"input",(()=>{if(o.witness)return CH})),bH.prop(o,"witness",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){const t=IH.toStack(r());return o.redeem=Object.assign({witness:t},e.redeem),o.redeem.input=CH,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)})),bH.prop(o,"name",(()=>{const e=["p2wsh"];return void 0!==o.redeem&&void 0!==o.redeem.name&&e.push(o.redeem.name),e.join("-")})),t.validate){let t=ao.from([]);if(e.address){if(n().prefix!==i.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(32!==n().data.length)throw new TypeError("Invalid address data");t=n().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==EH.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");const n=e.output.slice(2);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem){if(e.redeem.network&&e.redeem.network!==i)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){if(0===IH.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");const n=mH.sha256(e.redeem.output);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem.input&&!IH.isPushOnly(r()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&r().some(SH)||e.redeem.output&&(IH.decompile(e.redeem.output)||[]).some(SH))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){const t=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(t))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(SH)||(IH.decompile(t)||[]).some(SH))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(o,e)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.p2wsh=e.p2wpkh=e.p2sh=e.p2pkh=e.p2pk=e.p2ms=e.embed=void 0;const t=fP;Object.defineProperty(e,"embed",{enumerable:!0,get:function(){return t.p2data}});const n=IU;Object.defineProperty(e,"p2ms",{enumerable:!0,get:function(){return n.p2ms}});const r=QU;Object.defineProperty(e,"p2pk",{enumerable:!0,get:function(){return r.p2pk}});const i=PU;Object.defineProperty(e,"p2pkh",{enumerable:!0,get:function(){return i.p2pkh}});const o=GO;Object.defineProperty(e,"p2sh",{enumerable:!0,get:function(){return o.p2sh}});const a=ZO;Object.defineProperty(e,"p2wpkh",{enumerable:!0,get:function(){return a.p2wpkh}});const s=yH;Object.defineProperty(e,"p2wsh",{enumerable:!0,get:function(){return s.p2wsh}})}(hP),Object.defineProperty(AP,"__esModule",{value:!0}),AP.toOutputScript=AP.fromOutputScript=AP.toBech32=AP.toBase58Check=AP.fromBech32=AP.fromBase58Check=void 0;const xH=cP,QH=hP,kH=dP,_H=EP,NH=$O,DH=MO,{typeforce:FH}=_H,PH="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function UH(e){const t=DH.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");return{version:t.readUInt8(0),hash:t.slice(1)}}function MH(e){let t,n;try{t=NH.bech32.decode(e)}catch(e){}if(t){if(n=t.words[0],0!==n)throw new TypeError(e+" uses wrong encoding")}else if(t=NH.bech32m.decode(e),n=t.words[0],0===n)throw new TypeError(e+" uses wrong encoding");const r=NH.bech32.fromWords(t.words.slice(1));return{version:n,prefix:t.prefix,data:ao.from(r)}}function LH(e,t,n){const r=NH.bech32.toWords(e);return r.unshift(t),0===t?NH.bech32.encode(n,r):NH.bech32m.encode(n,r)}AP.fromBase58Check=UH,AP.fromBech32=MH,AP.toBase58Check=function(e,t){FH(_H.tuple(_H.Hash160bit,_H.UInt8),arguments);const n=ao.allocUnsafe(21);return n.writeUInt8(t,0),e.copy(n,1),DH.encode(n)},AP.toBech32=LH,AP.fromOutputScript=function(e,t){t=t||xH.bitcoin;try{return QH.p2pkh({output:e,network:t}).address}catch(e){}try{return QH.p2sh({output:e,network:t}).address}catch(e){}try{return QH.p2wpkh({output:e,network:t}).address}catch(e){}try{return QH.p2wsh({output:e,network:t}).address}catch(e){}try{return function(e,t){const n=e.slice(2);if(n.length<2||n.length>40)throw new TypeError("Invalid program length for segwit address");const r=e[0]-80;if(r<1||r>16)throw new TypeError("Invalid version for segwit address");if(e[1]!==n.length)throw new TypeError("Invalid script for segwit address");return console.warn(PH),LH(n,r,t.bech32)}(e,t)}catch(e){}throw new Error(kH.toASM(e)+" has no matching Address")},AP.toOutputScript=function(e,t){let n,r;t=t||xH.bitcoin;try{n=UH(e)}catch(e){}if(n){if(n.version===t.pubKeyHash)return QH.p2pkh({hash:n.hash}).output;if(n.version===t.scriptHash)return QH.p2sh({hash:n.hash}).output}else{try{r=MH(e)}catch(e){}if(r){if(r.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return QH.p2wpkh({hash:r.data}).output;if(32===r.data.length)return QH.p2wsh({hash:r.data}).output}else if(r.version>=1&&r.version<=16&&r.data.length>=2&&r.data.length<=40)return console.warn(PH),kH.compile([r.version+80,r.data])}}throw new Error(e+" has no matching Script")};var TH={},RH={},OH=F_.exports.Buffer;function HH(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function KH(e){return HH(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var jH={encode:function e(t,n,r){if(HH(t),n||(n=OH.allocUnsafe(KH(t))),!OH.isBuffer(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),e.bytes=1):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),e.bytes=3):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),e.bytes=5):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),e.bytes=9),n},decode:function e(t,n){if(!OH.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);var r=t.readUInt8(n);if(r<253)return e.bytes=1,r;if(253===r)return e.bytes=3,t.readUInt16LE(n+1);if(254===r)return e.bytes=5,t.readUInt32LE(n+1);e.bytes=9;var i=t.readUInt32LE(n+1),o=4294967296*t.readUInt32LE(n+5)+i;return HH(o),o},encodingLength:KH};Object.defineProperty(RH,"__esModule",{value:!0}),RH.BufferReader=RH.BufferWriter=RH.cloneBuffer=RH.reverseBuffer=RH.writeUInt64LE=RH.readUInt64LE=RH.varuint=void 0;const GH=EP,{typeforce:qH}=GH,VH=jH;function zH(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function JH(e,t){const n=e.readUInt32LE(t);let r=e.readUInt32LE(t+4);return r*=4294967296,zH(r+n,9007199254740991),r+n}function YH(e,t,n){return zH(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8}RH.varuint=VH,RH.readUInt64LE=JH,RH.writeUInt64LE=YH,RH.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,n=0;for(let r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},RH.cloneBuffer=function(e){const t=ao.allocUnsafe(e.length);return e.copy(t),t};class XH{constructor(e,t=0){this.buffer=e,this.offset=t,qH(GH.tuple(GH.Buffer,GH.UInt32),[e,t])}static withCapacity(e){return new XH(ao.alloc(e))}writeUInt8(e){this.offset=this.buffer.writeUInt8(e,this.offset)}writeInt32(e){this.offset=this.buffer.writeInt32LE(e,this.offset)}writeUInt32(e){this.offset=this.buffer.writeUInt32LE(e,this.offset)}writeUInt64(e){this.offset=YH(this.buffer,e,this.offset)}writeVarInt(e){VH.encode(e,this.buffer,this.offset),this.offset+=VH.encode.bytes}writeSlice(e){if(this.buffer.length<this.offset+e.length)throw new Error("Cannot write slice out of bounds");this.offset+=e.copy(this.buffer,this.offset)}writeVarSlice(e){this.writeVarInt(e.length),this.writeSlice(e)}writeVector(e){this.writeVarInt(e.length),e.forEach((e=>this.writeVarSlice(e)))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}RH.BufferWriter=XH,RH.BufferReader=class{constructor(e,t=0){this.buffer=e,this.offset=t,qH(GH.tuple(GH.Buffer,GH.UInt32),[e,t])}readUInt8(){const e=this.buffer.readUInt8(this.offset);return this.offset++,e}readInt32(){const e=this.buffer.readInt32LE(this.offset);return this.offset+=4,e}readUInt32(){const e=this.buffer.readUInt32LE(this.offset);return this.offset+=4,e}readUInt64(){const e=JH(this.buffer,this.offset);return this.offset+=8,e}readVarInt(){const e=VH.decode(this.buffer,this.offset);return this.offset+=VH.decode.bytes,e}readSlice(e){if(this.buffer.length<this.offset+e)throw new Error("Cannot read slice out of bounds");const t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const e=this.readVarInt(),t=[];for(let n=0;n<e;n++)t.push(this.readVarSlice());return t}};var WH={};Object.defineProperty(WH,"__esModule",{value:!0}),WH.fastMerkleRoot=void 0,WH.fastMerkleRoot=function(e,t){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof t)throw TypeError("Expected digest Function");let n=e.length;const r=e.concat();for(;n>1;){let e=0;for(let i=0;i<n;i+=2,++e){const o=r[i],a=i+1===n?o:r[i+1],s=ao.concat([o,a]);r[e]=t(s)}n=e}return r[0]};var ZH={};Object.defineProperty(ZH,"__esModule",{value:!0}),ZH.Transaction=void 0;const $H=RH,eK=UU,tK=dP,nK=dP,rK=EP,{typeforce:iK}=rK;function oK(e){const t=e.length;return $H.varuint.encodingLength(t)+t}const aK=ao.allocUnsafe(0),sK=[],lK=ao.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),uK=ao.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),AK=ao.from("ffffffffffffffff","hex"),cK={script:aK,valueBuffer:AK};class hK{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(e,t){const n=new $H.BufferReader(e),r=new hK;r.version=n.readInt32();const i=n.readUInt8(),o=n.readUInt8();let a=!1;i===hK.ADVANCED_TRANSACTION_MARKER&&o===hK.ADVANCED_TRANSACTION_FLAG?a=!0:n.offset-=2;const s=n.readVarInt();for(let e=0;e<s;++e)r.ins.push({hash:n.readSlice(32),index:n.readUInt32(),script:n.readVarSlice(),sequence:n.readUInt32(),witness:sK});const l=n.readVarInt();for(let e=0;e<l;++e)r.outs.push({value:n.readUInt64(),script:n.readVarSlice()});if(a){for(let e=0;e<s;++e)r.ins[e].witness=n.readVector();if(!r.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(r.locktime=n.readUInt32(),t)return r;if(n.offset!==e.length)throw new Error("Transaction has unexpected data");return r}static fromHex(e){return hK.fromBuffer(ao.from(e,"hex"),!1)}static isCoinbaseHash(e){iK(rK.Hash256bit,e);for(let t=0;t<32;++t)if(0!==e[t])return!1;return!0}isCoinbase(){return 1===this.ins.length&&hK.isCoinbaseHash(this.ins[0].hash)}addInput(e,t,n,r){return iK(rK.tuple(rK.Hash256bit,rK.UInt32,rK.maybe(rK.UInt32),rK.maybe(rK.Buffer)),arguments),rK.Null(n)&&(n=hK.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:r||aK,sequence:n,witness:sK})-1}addOutput(e,t){return iK(rK.tuple(rK.Buffer,rK.Satoshi),arguments),this.outs.push({script:e,value:t})-1}hasWitnesses(){return this.ins.some((e=>0!==e.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(e=!0){const t=e&&this.hasWitnesses();return(t?10:8)+$H.varuint.encodingLength(this.ins.length)+$H.varuint.encodingLength(this.outs.length)+this.ins.reduce(((e,t)=>e+40+oK(t.script)),0)+this.outs.reduce(((e,t)=>e+8+oK(t.script)),0)+(t?this.ins.reduce(((e,t)=>e+function(e){const t=e.length;return $H.varuint.encodingLength(t)+e.reduce(((e,t)=>e+oK(t)),0)}(t.witness)),0):0)}clone(){const e=new hK;return e.version=this.version,e.locktime=this.locktime,e.ins=this.ins.map((e=>({hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}))),e.outs=this.outs.map((e=>({script:e.script,value:e.value}))),e}hashForSignature(e,t,n){if(iK(rK.tuple(rK.UInt32,rK.Buffer,rK.Number),arguments),e>=this.ins.length)return uK;const r=tK.compile(tK.decompile(t).filter((e=>e!==nK.OPS.OP_CODESEPARATOR))),i=this.clone();if((31&n)===hK.SIGHASH_NONE)i.outs=[],i.ins.forEach(((t,n)=>{n!==e&&(t.sequence=0)}));else if((31&n)===hK.SIGHASH_SINGLE){if(e>=this.outs.length)return uK;i.outs.length=e+1;for(let t=0;t<e;t++)i.outs[t]=cK;i.ins.forEach(((t,n)=>{n!==e&&(t.sequence=0)}))}n&hK.SIGHASH_ANYONECANPAY?(i.ins=[i.ins[e]],i.ins[0].script=r):(i.ins.forEach((e=>{e.script=aK})),i.ins[e].script=r);const o=ao.allocUnsafe(i.byteLength(!1)+4);return o.writeInt32LE(n,o.length-4),i.__toBuffer(o,0,!1),eK.hash256(o)}hashForWitnessV1(e,t,n,r,i,o){if(iK(rK.tuple(rK.UInt32,iK.arrayOf(rK.Buffer),iK.arrayOf(rK.Satoshi),rK.UInt32),arguments),n.length!==this.ins.length||t.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const a=r===hK.SIGHASH_DEFAULT?hK.SIGHASH_ALL:r&hK.SIGHASH_OUTPUT_MASK,s=(r&hK.SIGHASH_INPUT_MASK)===hK.SIGHASH_ANYONECANPAY,l=a===hK.SIGHASH_NONE,u=a===hK.SIGHASH_SINGLE;let A=aK,c=aK,h=aK,f=aK,d=aK;if(!s){let e=$H.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach((t=>{e.writeSlice(t.hash),e.writeUInt32(t.index)})),A=eK.sha256(e.end()),e=$H.BufferWriter.withCapacity(8*this.ins.length),n.forEach((t=>e.writeUInt64(t))),c=eK.sha256(e.end()),e=$H.BufferWriter.withCapacity(t.map(oK).reduce(((e,t)=>e+t))),t.forEach((t=>e.writeVarSlice(t))),h=eK.sha256(e.end()),e=$H.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach((t=>e.writeUInt32(t.sequence))),f=eK.sha256(e.end())}if(l||u){if(u&&e<this.outs.length){const t=this.outs[e],n=$H.BufferWriter.withCapacity(8+oK(t.script));n.writeUInt64(t.value),n.writeVarSlice(t.script),d=eK.sha256(n.end())}}else{const e=this.outs.map((e=>8+oK(e.script))).reduce(((e,t)=>e+t)),t=$H.BufferWriter.withCapacity(e);this.outs.forEach((e=>{t.writeUInt64(e.value),t.writeVarSlice(e.script)})),d=eK.sha256(t.end())}const p=(i?2:0)+(o?1:0),g=174-(s?49:0)-(l?32:0)+(o?32:0)+(i?37:0),y=$H.BufferWriter.withCapacity(g);if(y.writeUInt8(r),y.writeInt32(this.version),y.writeUInt32(this.locktime),y.writeSlice(A),y.writeSlice(c),y.writeSlice(h),y.writeSlice(f),l||u||y.writeSlice(d),y.writeUInt8(p),s){const r=this.ins[e];y.writeSlice(r.hash),y.writeUInt32(r.index),y.writeUInt64(n[e]),y.writeVarSlice(t[e]),y.writeUInt32(r.sequence)}else y.writeUInt32(e);if(o){const e=$H.BufferWriter.withCapacity(oK(o));e.writeVarSlice(o),y.writeSlice(eK.sha256(e.end()))}return u&&y.writeSlice(d),i&&(y.writeSlice(i),y.writeUInt8(0),y.writeUInt32(4294967295)),eK.taggedHash("TapSighash",ao.concat([ao.of(0),y.end()]))}hashForWitnessV0(e,t,n,r){iK(rK.tuple(rK.UInt32,rK.Buffer,rK.Satoshi,rK.UInt32),arguments);let i,o=ao.from([]),a=lK,s=lK,l=lK;if(r&hK.SIGHASH_ANYONECANPAY||(o=ao.allocUnsafe(36*this.ins.length),i=new $H.BufferWriter(o,0),this.ins.forEach((e=>{i.writeSlice(e.hash),i.writeUInt32(e.index)})),s=eK.hash256(o)),r&hK.SIGHASH_ANYONECANPAY||(31&r)===hK.SIGHASH_SINGLE||(31&r)===hK.SIGHASH_NONE||(o=ao.allocUnsafe(4*this.ins.length),i=new $H.BufferWriter(o,0),this.ins.forEach((e=>{i.writeUInt32(e.sequence)})),l=eK.hash256(o)),(31&r)!==hK.SIGHASH_SINGLE&&(31&r)!==hK.SIGHASH_NONE){const e=this.outs.reduce(((e,t)=>e+8+oK(t.script)),0);o=ao.allocUnsafe(e),i=new $H.BufferWriter(o,0),this.outs.forEach((e=>{i.writeUInt64(e.value),i.writeVarSlice(e.script)})),a=eK.hash256(o)}else if((31&r)===hK.SIGHASH_SINGLE&&e<this.outs.length){const t=this.outs[e];o=ao.allocUnsafe(8+oK(t.script)),i=new $H.BufferWriter(o,0),i.writeUInt64(t.value),i.writeVarSlice(t.script),a=eK.hash256(o)}o=ao.allocUnsafe(156+oK(t)),i=new $H.BufferWriter(o,0);const u=this.ins[e];return i.writeInt32(this.version),i.writeSlice(s),i.writeSlice(l),i.writeSlice(u.hash),i.writeUInt32(u.index),i.writeVarSlice(t),i.writeUInt64(n),i.writeUInt32(u.sequence),i.writeSlice(a),i.writeUInt32(this.locktime),i.writeUInt32(r),eK.hash256(o)}getHash(e){return e&&this.isCoinbase()?ao.alloc(32,0):eK.hash256(this.__toBuffer(void 0,void 0,e))}getId(){return(0,$H.reverseBuffer)(this.getHash(!1)).toString("hex")}toBuffer(e,t){return this.__toBuffer(e,t,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(e,t){iK(rK.tuple(rK.Number,rK.Buffer),arguments),this.ins[e].script=t}setWitness(e,t){iK(rK.tuple(rK.Number,[rK.Buffer]),arguments),this.ins[e].witness=t}__toBuffer(e,t,n=!1){e||(e=ao.allocUnsafe(this.byteLength(n)));const r=new $H.BufferWriter(e,t||0);r.writeInt32(this.version);const i=n&&this.hasWitnesses();return i&&(r.writeUInt8(hK.ADVANCED_TRANSACTION_MARKER),r.writeUInt8(hK.ADVANCED_TRANSACTION_FLAG)),r.writeVarInt(this.ins.length),this.ins.forEach((e=>{r.writeSlice(e.hash),r.writeUInt32(e.index),r.writeVarSlice(e.script),r.writeUInt32(e.sequence)})),r.writeVarInt(this.outs.length),this.outs.forEach((e=>{void 0!==e.value?r.writeUInt64(e.value):r.writeSlice(e.valueBuffer),r.writeVarSlice(e.script)})),i&&this.ins.forEach((e=>{r.writeVector(e.witness)})),r.writeUInt32(this.locktime),void 0!==t?e.slice(t,r.offset):e}}ZH.Transaction=hK,hK.DEFAULT_SEQUENCE=4294967295,hK.SIGHASH_DEFAULT=0,hK.SIGHASH_ALL=1,hK.SIGHASH_NONE=2,hK.SIGHASH_SINGLE=3,hK.SIGHASH_ANYONECANPAY=128,hK.SIGHASH_OUTPUT_MASK=3,hK.SIGHASH_INPUT_MASK=128,hK.ADVANCED_TRANSACTION_MARKER=0,hK.ADVANCED_TRANSACTION_FLAG=1,Object.defineProperty(TH,"__esModule",{value:!0}),TH.Block=void 0;const fK=RH,dK=UU,pK=WH,gK=ZH,yK=EP,{typeforce:mK}=yK,vK=new TypeError("Cannot compute merkle root for zero transactions"),IK=new TypeError("Cannot compute witness commit for non-segwit block");class wK{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(e){if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");const t=new fK.BufferReader(e),n=new wK;if(n.version=t.readInt32(),n.prevHash=t.readSlice(32),n.merkleRoot=t.readSlice(32),n.timestamp=t.readUInt32(),n.bits=t.readUInt32(),n.nonce=t.readUInt32(),80===e.length)return n;const r=()=>{const e=gK.Transaction.fromBuffer(t.buffer.slice(t.offset),!0);return t.offset+=e.byteLength(),e},i=t.readVarInt();n.transactions=[];for(let e=0;e<i;++e){const e=r();n.transactions.push(e)}const o=n.getWitnessCommit();return o&&(n.witnessCommit=o),n}static fromHex(e){return wK.fromBuffer(ao.from(e,"hex"))}static calculateTarget(e){const t=((4278190080&e)>>24)-3,n=8388607&e,r=ao.alloc(32,0);return r.writeUIntBE(n,29-t,3),r}static calculateMerkleRoot(e,t){if(mK([{getHash:yK.Function}],e),0===e.length)throw vK;if(t&&!bK(e))throw IK;const n=e.map((e=>e.getHash(t))),r=(0,pK.fastMerkleRoot)(n,dK.hash256);return t?dK.hash256(ao.concat([r,e[0].ins[0].witness[0]])):r}getWitnessCommit(){if(!bK(this.transactions))return null;const e=this.transactions[0].outs.filter((e=>e.script.slice(0,6).equals(ao.from("6a24aa21a9ed","hex")))).map((e=>e.script.slice(6,38)));if(0===e.length)return null;const t=e[e.length-1];return t instanceof ao&&32===t.length?t:null}hasWitnessCommit(){return this.witnessCommit instanceof ao&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(e=this.transactions)instanceof Array&&e.some((e=>"object"==typeof e&&e.ins instanceof Array&&e.ins.some((e=>"object"==typeof e&&e.witness instanceof Array&&e.witness.length>0))));var e}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(e,t=!0){return e||!this.transactions?80:80+fK.varuint.encodingLength(this.transactions.length)+this.transactions.reduce(((e,n)=>e+n.byteLength(t)),0)}getHash(){return dK.hash256(this.toBuffer(!0))}getId(){return(0,fK.reverseBuffer)(this.getHash()).toString("hex")}getUTCDate(){const e=new Date(0);return e.setUTCSeconds(this.timestamp),e}toBuffer(e){const t=ao.allocUnsafe(this.byteLength(e)),n=new fK.BufferWriter(t);return n.writeInt32(this.version),n.writeSlice(this.prevHash),n.writeSlice(this.merkleRoot),n.writeUInt32(this.timestamp),n.writeUInt32(this.bits),n.writeUInt32(this.nonce),e||!this.transactions||(fK.varuint.encode(this.transactions.length,t,n.offset),n.offset+=fK.varuint.encode.bytes,this.transactions.forEach((e=>{const r=e.byteLength();e.toBuffer(t,n.offset),n.offset+=r}))),t}toHex(e){return this.toBuffer(e).toString("hex")}checkTxRoots(){const e=this.hasWitnessCommit();return!(!e&&this.hasWitness())&&this.__checkMerkleRoot()&&(!e||this.__checkWitnessCommit())}checkProofOfWork(){const e=(0,fK.reverseBuffer)(this.getHash()),t=wK.calculateTarget(this.bits);return e.compare(t)<=0}__checkMerkleRoot(){if(!this.transactions)throw vK;const e=wK.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)}__checkWitnessCommit(){if(!this.transactions)throw vK;if(!this.hasWitnessCommit())throw IK;const e=wK.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(e)}}function bK(e){return e instanceof Array&&e[0]&&e[0].ins&&e[0].ins instanceof Array&&e[0].ins[0]&&e[0].ins[0].witness&&e[0].ins[0].witness instanceof Array&&e[0].ins[0].witness.length>0}TH.Block=wK;var BK={},EK={},CK={},SK={},xK={},QK={},kK={};!function(e){var t,n,r;Object.defineProperty(e,"__esModule",{value:!0}),(t=e.GlobalTypes||(e.GlobalTypes={}))[t.UNSIGNED_TX=0]="UNSIGNED_TX",t[t.GLOBAL_XPUB=1]="GLOBAL_XPUB",e.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],(n=e.InputTypes||(e.InputTypes={}))[n.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",n[n.WITNESS_UTXO=1]="WITNESS_UTXO",n[n.PARTIAL_SIG=2]="PARTIAL_SIG",n[n.SIGHASH_TYPE=3]="SIGHASH_TYPE",n[n.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",n[n.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",n[n.BIP32_DERIVATION=6]="BIP32_DERIVATION",n[n.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",n[n.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",n[n.POR_COMMITMENT=9]="POR_COMMITMENT",n[n.TAP_KEY_SIG=19]="TAP_KEY_SIG",n[n.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",n[n.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",n[n.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",n[n.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",n[n.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT",e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],(r=e.OutputTypes||(e.OutputTypes={}))[r.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",r[r.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",r[r.BIP32_DERIVATION=2]="BIP32_DERIVATION",r[r.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",r[r.TAP_TREE=6]="TAP_TREE",r[r.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION",e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]}(kK);var _K={};Object.defineProperty(_K,"__esModule",{value:!0});const NK=kK;_K.decode=function(e){if(e.key[0]!==NK.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+e.key.toString("hex"));if(79!==e.key.length||![2,3].includes(e.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const t=e.key.slice(1),n={masterFingerprint:e.value.slice(0,4),extendedPubkey:t,path:"m"};for(const t of(r=e.value.length/4-1,[...Array(r).keys()])){const r=e.value.readUInt32LE(4*t+4),i=!!(2147483648&r),o=2147483647&r;n.path+="/"+o.toString(10)+(i?"'":"")}var r;return n},_K.encode=function(e){const t=ao.from([NK.GlobalTypes.GLOBAL_XPUB]),n=ao.concat([t,e.extendedPubkey]),r=e.path.split("/"),i=ao.allocUnsafe(4*r.length);e.masterFingerprint.copy(i,0);let o=4;return r.slice(1).forEach((e=>{const t="'"===e.slice(-1);let n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),i.writeUInt32LE(n,o),o+=4})),{key:n,value:i}},_K.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",_K.check=function(e){const t=e.extendedPubkey,n=e.masterFingerprint,r=e.path;return jo(t)&&78===t.length&&[2,3].indexOf(t[45])>-1&&jo(n)&&4===n.length&&"string"==typeof r&&!!r.match(/^m(\/\d+'?)*$/)},_K.canAddToArray=function(e,t,n){const r=t.extendedPubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.extendedPubkey.equals(t.extendedPubkey))).length)};var DK={};Object.defineProperty(DK,"__esModule",{value:!0});const FK=kK;DK.encode=function(e){return{key:ao.from([FK.GlobalTypes.UNSIGNED_TX]),value:e.toBuffer()}};var PK={};Object.defineProperty(PK,"__esModule",{value:!0});const UK=kK;PK.decode=function(e){if(e.key[0]!==UK.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+e.key.toString("hex"));return e.value},PK.encode=function(e){return{key:ao.from([UK.InputTypes.FINAL_SCRIPTSIG]),value:e}},PK.expected="Buffer",PK.check=function(e){return jo(e)},PK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptSig};var MK={};Object.defineProperty(MK,"__esModule",{value:!0});const LK=kK;MK.decode=function(e){if(e.key[0]!==LK.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+e.key.toString("hex"));return e.value},MK.encode=function(e){return{key:ao.from([LK.InputTypes.FINAL_SCRIPTWITNESS]),value:e}},MK.expected="Buffer",MK.check=function(e){return jo(e)},MK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptWitness};var TK={};Object.defineProperty(TK,"__esModule",{value:!0});const RK=kK;TK.decode=function(e){if(e.key[0]!==RK.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+e.key.toString("hex"));return e.value},TK.encode=function(e){return{key:ao.from([RK.InputTypes.NON_WITNESS_UTXO]),value:e}},TK.expected="Buffer",TK.check=function(e){return jo(e)},TK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.nonWitnessUtxo};var OK={};Object.defineProperty(OK,"__esModule",{value:!0});const HK=kK;OK.decode=function(e){if(e.key[0]!==HK.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+e.key.toString("hex"));if(34!==e.key.length&&66!==e.key.length||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1),signature:e.value}},OK.encode=function(e){const t=ao.from([HK.InputTypes.PARTIAL_SIG]);return{key:ao.concat([t,e.pubkey]),value:e.signature}},OK.expected="{ pubkey: Buffer; signature: Buffer; }",OK.check=function(e){return jo(e.pubkey)&&jo(e.signature)&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&function(e){if(!jo(e)||e.length<9)return!1;if(48!==e[0])return!1;if(e.length!==e[1]+3)return!1;if(2!==e[2])return!1;const t=e[3];if(t>33||t<1)return!1;if(2!==e[3+t+1])return!1;const n=e[3+t+2];return!(n>33||n<1)&&e.length===3+t+2+n+2}(e.signature)},OK.canAddToArray=function(e,t,n){const r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)};var KK={};Object.defineProperty(KK,"__esModule",{value:!0});const jK=kK;KK.decode=function(e){if(e.key[0]!==jK.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+e.key.toString("hex"));return e.value.toString("utf8")},KK.encode=function(e){return{key:ao.from([jK.InputTypes.POR_COMMITMENT]),value:ao.from(e,"utf8")}},KK.expected="string",KK.check=function(e){return"string"==typeof e},KK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.porCommitment};var GK={};Object.defineProperty(GK,"__esModule",{value:!0});const qK=kK;GK.decode=function(e){if(e.key[0]!==qK.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+e.key.toString("hex"));return e.value.readUInt32LE(0)},GK.encode=function(e){const t=ao.from([qK.InputTypes.SIGHASH_TYPE]),n=ao.allocUnsafe(4);return n.writeUInt32LE(e,0),{key:t,value:n}},GK.expected="number",GK.check=function(e){return"number"==typeof e},GK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.sighashType};var VK={};Object.defineProperty(VK,"__esModule",{value:!0});const zK=kK;function JK(e){return jo(e)&&(64===e.length||65===e.length)}VK.decode=function(e){if(e.key[0]!==zK.InputTypes.TAP_KEY_SIG||1!==e.key.length)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+e.key.toString("hex"));if(!JK(e.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return e.value},VK.encode=function(e){return{key:ao.from([zK.InputTypes.TAP_KEY_SIG]),value:e}},VK.expected="Buffer",VK.check=JK,VK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapKeySig};var YK={};Object.defineProperty(YK,"__esModule",{value:!0});const XK=kK;YK.decode=function(e){if(e.key[0]!==XK.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+e.key.toString("hex"));if((e.key.length-2)%32!=0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+e.key.toString("hex"));const t=e.value[e.value.length-1];if((254&e.key[1])!==t)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+e.key.toString("hex"));const n=e.value.slice(0,-1);return{controlBlock:e.key.slice(1),script:n,leafVersion:t}},YK.encode=function(e){const t=ao.from([XK.InputTypes.TAP_LEAF_SCRIPT]),n=ao.from([e.leafVersion]);return{key:ao.concat([t,e.controlBlock]),value:ao.concat([e.script,n])}},YK.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }",YK.check=function(e){return jo(e.controlBlock)&&(e.controlBlock.length-1)%32==0&&(254&e.controlBlock[0])===e.leafVersion&&jo(e.script)},YK.canAddToArray=function(e,t,n){const r=t.controlBlock.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.controlBlock.equals(t.controlBlock))).length)};var WK={};Object.defineProperty(WK,"__esModule",{value:!0});const ZK=kK;function $K(e){return jo(e)&&32===e.length}WK.decode=function(e){if(e.key[0]!==ZK.InputTypes.TAP_MERKLE_ROOT||1!==e.key.length)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+e.key.toString("hex"));if(!$K(e.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return e.value},WK.encode=function(e){return{key:ao.from([ZK.InputTypes.TAP_MERKLE_ROOT]),value:e}},WK.expected="Buffer",WK.check=$K,WK.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapMerkleRoot};var ej={};Object.defineProperty(ej,"__esModule",{value:!0});const tj=kK;ej.decode=function(e){if(e.key[0]!==tj.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+e.key.toString("hex"));if(65!==e.key.length)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+e.key.toString("hex"));if(64!==e.value.length&&65!==e.value.length)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1,33),leafHash:e.key.slice(33),signature:e.value}},ej.encode=function(e){const t=ao.from([tj.InputTypes.TAP_SCRIPT_SIG]);return{key:ao.concat([t,e.pubkey,e.leafHash]),value:e.signature}},ej.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }",ej.check=function(e){return jo(e.pubkey)&&jo(e.leafHash)&&jo(e.signature)&&32===e.pubkey.length&&32===e.leafHash.length&&(64===e.signature.length||65===e.signature.length)},ej.canAddToArray=function(e,t,n){const r=t.pubkey.toString("hex")+t.leafHash.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey)&&e.leafHash.equals(t.leafHash))).length)};var nj={},rj={},ij={};function oj(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function aj(e){return oj(e),e<253?1:e<=65535?3:e<=4294967295?5:9}Object.defineProperty(ij,"__esModule",{value:!0}),ij.encode=function e(t,n,r){if(oj(t),n||(n=ao.allocUnsafe(aj(t))),!jo(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),Object.assign(e,{bytes:1})):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),Object.assign(e,{bytes:3})):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),Object.assign(e,{bytes:5})):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),Object.assign(e,{bytes:9})),n},ij.decode=function e(t,n){if(!jo(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);const r=t.readUInt8(n);if(r<253)return Object.assign(e,{bytes:1}),r;if(253===r)return Object.assign(e,{bytes:3}),t.readUInt16LE(n+1);if(254===r)return Object.assign(e,{bytes:5}),t.readUInt32LE(n+1);{Object.assign(e,{bytes:9});const r=t.readUInt32LE(n+1),i=4294967296*t.readUInt32LE(n+5)+r;return oj(i),i}},ij.encodingLength=aj,Object.defineProperty(rj,"__esModule",{value:!0});const sj=ij;function lj(e){const t=e.key.length,n=e.value.length,r=sj.encodingLength(t),i=sj.encodingLength(n),o=ao.allocUnsafe(r+t+i+n);return sj.encode(t,o,0),e.key.copy(o,r),sj.encode(n,o,r+t),e.value.copy(o,r+t+i),o}function uj(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}rj.range=e=>[...Array(e).keys()],rj.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,n=0;for(let r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},rj.keyValsToBuffer=function(e){const t=e.map(lj);return t.push(ao.from([0])),ao.concat(t)},rj.keyValToBuffer=lj,rj.readUInt64LE=function(e,t){const n=e.readUInt32LE(t);let r=e.readUInt32LE(t+4);return r*=4294967296,uj(r+n,9007199254740991),r+n},rj.writeUInt64LE=function(e,t,n){return uj(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8},Object.defineProperty(nj,"__esModule",{value:!0});const Aj=kK,cj=rj,hj=ij;nj.decode=function(e){if(e.key[0]!==Aj.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+e.key.toString("hex"));const t=cj.readUInt64LE(e.value,0);let n=8;const r=hj.decode(e.value,n);n+=hj.encodingLength(r);const i=e.value.slice(n);if(i.length!==r)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:i,value:t}},nj.encode=function(e){const{script:t,value:n}=e,r=hj.encodingLength(t.length),i=ao.allocUnsafe(8+r+t.length);return cj.writeUInt64LE(i,n,0),hj.encode(t.length,i,8),t.copy(i,8+r),{key:ao.from([Aj.InputTypes.WITNESS_UTXO]),value:i}},nj.expected="{ script: Buffer; value: number; }",nj.check=function(e){return jo(e.script)&&"number"==typeof e.value},nj.canAdd=function(e,t){return!!e&&!!t&&void 0===e.witnessUtxo};var fj={};Object.defineProperty(fj,"__esModule",{value:!0});const dj=kK,pj=ij;fj.decode=function(e){if(e.key[0]!==dj.OutputTypes.TAP_TREE||1!==e.key.length)throw new Error("Decode Error: could not decode tapTree with key 0x"+e.key.toString("hex"));let t=0;const n=[];for(;t<e.value.length;){const r=e.value[t++],i=e.value[t++],o=pj.decode(e.value,t);t+=pj.encodingLength(o),n.push({depth:r,leafVersion:i,script:e.value.slice(t,t+o)}),t+=o}return{leaves:n}},fj.encode=function(e){const t=ao.from([dj.OutputTypes.TAP_TREE]),n=[].concat(...e.leaves.map((e=>[ao.of(e.depth,e.leafVersion),pj.encode(e.script.length),e.script])));return{key:t,value:ao.concat(n)}},fj.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }",fj.check=function(e){return Array.isArray(e.leaves)&&e.leaves.every((e=>e.depth>=0&&e.depth<=128&&(254&e.leafVersion)===e.leafVersion&&jo(e.script)))},fj.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapTree};var gj={};Object.defineProperty(gj,"__esModule",{value:!0});const yj=e=>33===e.length&&[2,3].includes(e[0])||65===e.length&&4===e[0];gj.makeConverter=function(e,t=yj){return{decode:function(n){if(n.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+n.key.toString("hex"));const r=n.key.slice(1);if(!t(r))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+n.key.toString("hex"));if(n.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const i={masterFingerprint:n.value.slice(0,4),pubkey:r,path:"m"};for(const e of(o=n.value.length/4-1,[...Array(o).keys()])){const t=n.value.readUInt32LE(4*e+4),r=!!(2147483648&t),o=2147483647&t;i.path+="/"+o.toString(10)+(r?"'":"")}var o;return i},encode:function(t){const n=ao.from([e]),r=ao.concat([n,t.pubkey]),i=t.path.split("/"),o=ao.allocUnsafe(4*i.length);t.masterFingerprint.copy(o,0);let a=4;return i.slice(1).forEach((e=>{const t="'"===e.slice(-1);let n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),o.writeUInt32LE(n,a),a+=4})),{key:r,value:o}},check:function(e){return jo(e.pubkey)&&jo(e.masterFingerprint)&&"string"==typeof e.path&&t(e.pubkey)&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(e,t,n){const r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)}}};var mj={};Object.defineProperty(mj,"__esModule",{value:!0}),mj.makeChecker=function(e){return function(t){let n;if(e.includes(t.key[0])&&(n=t.key.slice(1),33!==n.length&&65!==n.length||![2,3,4].includes(n[0])))throw new Error("Format Error: invalid pubkey in key 0x"+t.key.toString("hex"));return n}};var vj={};Object.defineProperty(vj,"__esModule",{value:!0}),vj.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}};var Ij={};Object.defineProperty(Ij,"__esModule",{value:!0});const wj=ij,bj=gj,Bj=e=>32===e.length;Ij.makeConverter=function(e){const t=bj.makeConverter(e,Bj);return{decode:function(e){const n=wj.decode(e.value),r=wj.encodingLength(n),i=t.decode({key:e.key,value:e.value.slice(r+32*n)}),o=new Array(n);for(let t=0,i=r;t<n;t++,i+=32)o[t]=e.value.slice(i,i+32);return Object.assign({},i,{leafHashes:o})},encode:function(e){const n=t.encode(e),r=wj.encodingLength(e.leafHashes.length),i=ao.allocUnsafe(r);wj.encode(e.leafHashes.length,i);const o=ao.concat([i,...e.leafHashes,n.value]);return Object.assign({},n,{value:o})},check:function(e){return Array.isArray(e.leafHashes)&&e.leafHashes.every((e=>jo(e)&&32===e.length))&&t.check(e)},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; leafHashes: Buffer[]; }",canAddToArray:t.canAddToArray}};var Ej={};Object.defineProperty(Ej,"__esModule",{value:!0}),Ej.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e||1!==t.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+t.key.toString("hex"));if(32!==t.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)&&32===e.length},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.tapInternalKey}}};var Cj={};Object.defineProperty(Cj,"__esModule",{value:!0}),Cj.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}},Object.defineProperty(QK,"__esModule",{value:!0});const Sj=kK,xj=PK,Qj=MK,kj=TK,_j=OK,Nj=KK,Dj=GK,Fj=VK,Pj=YK,Uj=WK,Mj=ej,Lj=nj,Tj=fj,Rj=gj,Oj=mj,Hj=vj,Kj=Ij,jj=Ej,Gj=Cj,qj={unsignedTx:DK,globalXpub:_K,checkPubkey:Oj.makeChecker([])};QK.globals=qj;const Vj={nonWitnessUtxo:kj,partialSig:_j,sighashType:Dj,finalScriptSig:xj,finalScriptWitness:Qj,porCommitment:Nj,witnessUtxo:Lj,bip32Derivation:Rj.makeConverter(Sj.InputTypes.BIP32_DERIVATION),redeemScript:Hj.makeConverter(Sj.InputTypes.REDEEM_SCRIPT),witnessScript:Gj.makeConverter(Sj.InputTypes.WITNESS_SCRIPT),checkPubkey:Oj.makeChecker([Sj.InputTypes.PARTIAL_SIG,Sj.InputTypes.BIP32_DERIVATION]),tapKeySig:Fj,tapScriptSig:Mj,tapLeafScript:Pj,tapBip32Derivation:Kj.makeConverter(Sj.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:jj.makeConverter(Sj.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot:Uj};QK.inputs=Vj;const zj={bip32Derivation:Rj.makeConverter(Sj.OutputTypes.BIP32_DERIVATION),redeemScript:Hj.makeConverter(Sj.OutputTypes.REDEEM_SCRIPT),witnessScript:Gj.makeConverter(Sj.OutputTypes.WITNESS_SCRIPT),checkPubkey:Oj.makeChecker([Sj.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:Kj.makeConverter(Sj.OutputTypes.TAP_BIP32_DERIVATION),tapTree:Tj,tapInternalKey:jj.makeConverter(Sj.OutputTypes.TAP_INTERNAL_KEY)};QK.outputs=zj,Object.defineProperty(xK,"__esModule",{value:!0});const Jj=QK,Yj=rj,Xj=ij,Wj=kK;function Zj(e,t,n){if(!t.equals(ao.from([n])))throw new Error(`Format Error: Invalid ${e} key: ${t.toString("hex")}`)}function $j(e,{globalMapKeyVals:t,inputKeyVals:n,outputKeyVals:r}){const i={unsignedTx:e};let o=0;for(const e of t)switch(e.key[0]){case Wj.GlobalTypes.UNSIGNED_TX:if(Zj("global",e.key,Wj.GlobalTypes.UNSIGNED_TX),o>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");o++;break;case Wj.GlobalTypes.GLOBAL_XPUB:void 0===i.globalXpub&&(i.globalXpub=[]),i.globalXpub.push(Jj.globals.globalXpub.decode(e));break;default:i.unknownKeyVals||(i.unknownKeyVals=[]),i.unknownKeyVals.push(e)}const a=n.length,s=r.length,l=[],u=[];for(const e of Yj.range(a)){const t={};for(const r of n[e])switch(Jj.inputs.checkPubkey(r),r.key[0]){case Wj.InputTypes.NON_WITNESS_UTXO:if(Zj("input",r.key,Wj.InputTypes.NON_WITNESS_UTXO),void 0!==t.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");t.nonWitnessUtxo=Jj.inputs.nonWitnessUtxo.decode(r);break;case Wj.InputTypes.WITNESS_UTXO:if(Zj("input",r.key,Wj.InputTypes.WITNESS_UTXO),void 0!==t.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");t.witnessUtxo=Jj.inputs.witnessUtxo.decode(r);break;case Wj.InputTypes.PARTIAL_SIG:void 0===t.partialSig&&(t.partialSig=[]),t.partialSig.push(Jj.inputs.partialSig.decode(r));break;case Wj.InputTypes.SIGHASH_TYPE:if(Zj("input",r.key,Wj.InputTypes.SIGHASH_TYPE),void 0!==t.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");t.sighashType=Jj.inputs.sighashType.decode(r);break;case Wj.InputTypes.REDEEM_SCRIPT:if(Zj("input",r.key,Wj.InputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");t.redeemScript=Jj.inputs.redeemScript.decode(r);break;case Wj.InputTypes.WITNESS_SCRIPT:if(Zj("input",r.key,Wj.InputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");t.witnessScript=Jj.inputs.witnessScript.decode(r);break;case Wj.InputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(Jj.inputs.bip32Derivation.decode(r));break;case Wj.InputTypes.FINAL_SCRIPTSIG:Zj("input",r.key,Wj.InputTypes.FINAL_SCRIPTSIG),t.finalScriptSig=Jj.inputs.finalScriptSig.decode(r);break;case Wj.InputTypes.FINAL_SCRIPTWITNESS:Zj("input",r.key,Wj.InputTypes.FINAL_SCRIPTWITNESS),t.finalScriptWitness=Jj.inputs.finalScriptWitness.decode(r);break;case Wj.InputTypes.POR_COMMITMENT:Zj("input",r.key,Wj.InputTypes.POR_COMMITMENT),t.porCommitment=Jj.inputs.porCommitment.decode(r);break;case Wj.InputTypes.TAP_KEY_SIG:Zj("input",r.key,Wj.InputTypes.TAP_KEY_SIG),t.tapKeySig=Jj.inputs.tapKeySig.decode(r);break;case Wj.InputTypes.TAP_SCRIPT_SIG:void 0===t.tapScriptSig&&(t.tapScriptSig=[]),t.tapScriptSig.push(Jj.inputs.tapScriptSig.decode(r));break;case Wj.InputTypes.TAP_LEAF_SCRIPT:void 0===t.tapLeafScript&&(t.tapLeafScript=[]),t.tapLeafScript.push(Jj.inputs.tapLeafScript.decode(r));break;case Wj.InputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(Jj.inputs.tapBip32Derivation.decode(r));break;case Wj.InputTypes.TAP_INTERNAL_KEY:Zj("input",r.key,Wj.InputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=Jj.inputs.tapInternalKey.decode(r);break;case Wj.InputTypes.TAP_MERKLE_ROOT:Zj("input",r.key,Wj.InputTypes.TAP_MERKLE_ROOT),t.tapMerkleRoot=Jj.inputs.tapMerkleRoot.decode(r);break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(r)}l.push(t)}for(const e of Yj.range(s)){const t={};for(const n of r[e])switch(Jj.outputs.checkPubkey(n),n.key[0]){case Wj.OutputTypes.REDEEM_SCRIPT:if(Zj("output",n.key,Wj.OutputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");t.redeemScript=Jj.outputs.redeemScript.decode(n);break;case Wj.OutputTypes.WITNESS_SCRIPT:if(Zj("output",n.key,Wj.OutputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");t.witnessScript=Jj.outputs.witnessScript.decode(n);break;case Wj.OutputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(Jj.outputs.bip32Derivation.decode(n));break;case Wj.OutputTypes.TAP_INTERNAL_KEY:Zj("output",n.key,Wj.OutputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=Jj.outputs.tapInternalKey.decode(n);break;case Wj.OutputTypes.TAP_TREE:Zj("output",n.key,Wj.OutputTypes.TAP_TREE),t.tapTree=Jj.outputs.tapTree.decode(n);break;case Wj.OutputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(Jj.outputs.tapBip32Derivation.decode(n));break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(n)}u.push(t)}return{globalMap:i,inputs:l,outputs:u}}xK.psbtFromBuffer=function(e,t){let n=0;function r(){const t=Xj.decode(e,n);n+=Xj.encodingLength(t);const r=e.slice(n,n+t);return n+=t,r}function i(){return{key:r(),value:r()}}function o(){if(n>=e.length)throw new Error("Format Error: Unexpected End of PSBT");const t=0===e.readUInt8(n);return t&&n++,t}if(1886610036!==function(){const t=e.readUInt32BE(n);return n+=4,t}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const t=e.readUInt8(n);return n+=1,t}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const a=[],s={};for(;!o();){const e=i(),t=e.key.toString("hex");if(s[t])throw new Error("Format Error: Keys must be unique for global keymap: key "+t);s[t]=1,a.push(e)}const l=a.filter((e=>e.key[0]===Wj.GlobalTypes.UNSIGNED_TX));if(1!==l.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const u=t(l[0].value),{inputCount:A,outputCount:c}=u.getInputOutputCounts(),h=[],f=[];for(const e of Yj.range(A)){const t={},n=[];for(;!o();){const r=i(),o=r.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each input: input index "+e+" key "+o);t[o]=1,n.push(r)}h.push(n)}for(const e of Yj.range(c)){const t={},n=[];for(;!o();){const r=i(),o=r.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each output: output index "+e+" key "+o);t[o]=1,n.push(r)}f.push(n)}return $j(u,{globalMapKeyVals:a,inputKeyVals:h,outputKeyVals:f})},xK.checkKeyBuffer=Zj,xK.psbtFromKeyVals=$j;var eG={};Object.defineProperty(eG,"__esModule",{value:!0});const tG=QK,nG=rj;eG.psbtToBuffer=function({globalMap:e,inputs:t,outputs:n}){const{globalKeyVals:r,inputKeyVals:i,outputKeyVals:o}=oG({globalMap:e,inputs:t,outputs:n}),a=nG.keyValsToBuffer(r),s=e=>0===e.length?[ao.from([0])]:e.map(nG.keyValsToBuffer),l=s(i),u=s(o),A=ao.allocUnsafe(5);return A.writeUIntBE(482972169471,0,5),ao.concat([A,a].concat(l,u))};const rG=(e,t)=>e.key.compare(t.key);function iG(e,t){const n=new Set,r=Object.entries(e).reduce(((e,[r,i])=>{if("unknownKeyVals"===r)return e;const o=t[r];if(void 0===o)return e;const a=(Array.isArray(i)?i:[i]).map(o.encode);return a.map((e=>e.key.toString("hex"))).forEach((e=>{if(n.has(e))throw new Error("Serialize Error: Duplicate key: "+e);n.add(e)})),e.concat(a)}),[]),i=e.unknownKeyVals?e.unknownKeyVals.filter((e=>!n.has(e.key.toString("hex")))):[];return r.concat(i).sort(rG)}function oG({globalMap:e,inputs:t,outputs:n}){return{globalKeyVals:iG(e,tG.globals),inputKeyVals:t.map((e=>iG(e,tG.inputs))),outputKeyVals:n.map((e=>iG(e,tG.outputs)))}}eG.psbtToKeyVals=oG,function(e){function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),t(xK),t(eG)}(SK),Object.defineProperty(CK,"__esModule",{value:!0});const aG=SK;function sG(e,t,n){return r=>{if(e.has(r))return;const i=n.filter((e=>e.key.toString("hex")===r))[0];t.push(i),e.add(r)}}function lG(e){return e.globalMap.unsignedTx}function uG(e){const t=new Set;return e.forEach((e=>{const n=e.key.toString("hex");if(t.has(n))throw new Error("Combine: KeyValue Map keys should be unique");t.add(n)})),t}CK.combine=function(e){const t=e[0],n=aG.psbtToKeyVals(t),r=e.slice(1);if(0===r.length)throw new Error("Combine: Nothing to combine");const i=lG(t);if(void 0===i)throw new Error("Combine: Self missing transaction");const o=uG(n.globalKeyVals),a=n.inputKeyVals.map(uG),s=n.outputKeyVals.map(uG);for(const e of r){const t=lG(e);if(void 0===t||!t.toBuffer().equals(i.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const r=aG.psbtToKeyVals(e);uG(r.globalKeyVals).forEach(sG(o,n.globalKeyVals,r.globalKeyVals)),r.inputKeyVals.map(uG).forEach(((e,t)=>e.forEach(sG(a[t],n.inputKeyVals[t],r.inputKeyVals[t])))),r.outputKeyVals.map(uG).forEach(((e,t)=>e.forEach(sG(s[t],n.outputKeyVals[t],r.outputKeyVals[t]))))}return aG.psbtFromKeyVals(i,{globalMapKeyVals:n.globalKeyVals,inputKeyVals:n.inputKeyVals,outputKeyVals:n.outputKeyVals})};var AG={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=QK;function n(e,t){const n=e[t];if(void 0===n)throw new Error(`No input #${t}`);return n}function r(e,t){const n=e[t];if(void 0===n)throw new Error(`No output #${t}`);return n}function i(e,t,n,r){throw new Error(`Data for ${e} key ${t} is incorrect: Expected ${n} and got ${JSON.stringify(r)}`)}function o(e){return(n,r)=>{for(const o of Object.keys(n)){const a=n[o],{canAdd:s,canAddToArray:l,check:u,expected:A}=t[e+"s"][o]||{},c=!!l;if(u)if(c){if(!Array.isArray(a)||r[o]&&!Array.isArray(r[o]))throw new Error(`Key type ${o} must be an array`);a.every(u)||i(e,o,A,a);const t=r[o]||[],n=new Set;if(!a.every((e=>l(t,e,n))))throw new Error("Can not add duplicate data to array");r[o]=t.concat(a)}else{if(u(a)||i(e,o,A,a),!s(r,a))throw new Error(`Can not add duplicate data to ${e}`);r[o]=a}}}}e.checkForInput=n,e.checkForOutput=r,e.checkHasKey=function(e,t,n){if(e.key[0]<n)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(t&&0!==t.filter((t=>t.key.equals(e.key))).length)throw new Error(`Duplicate Key: ${e.key.toString("hex")}`)},e.getEnumLength=function(e){let t=0;return Object.keys(e).forEach((e=>{Number(isNaN(Number(e)))&&t++})),t},e.inputCheckUncleanFinalized=function(e,t){let n=!1;if(t.nonWitnessUtxo||t.witnessUtxo){const e=!!t.redeemScript,r=!!t.witnessScript,i=!e||!!t.finalScriptSig,o=!r||!!t.finalScriptWitness,a=!!t.finalScriptSig||!!t.finalScriptWitness;n=i&&o&&a}if(!1===n)throw new Error(`Input #${e} has too much or too little data to clean`)},e.updateGlobal=o("global"),e.updateInput=o("input"),e.updateOutput=o("output"),e.addInputAttributes=function(t,r){const i=n(t,t.length-1);e.updateInput(r,i)},e.addOutputAttributes=function(t,n){const i=r(t,t.length-1);e.updateOutput(n,i)},e.defaultVersionSetter=function(e,t){if(!jo(t)||t.length<4)throw new Error("Set Version: Invalid Transaction");return t.writeUInt32LE(e,0),t},e.defaultLocktimeSetter=function(e,t){if(!jo(t)||t.length<4)throw new Error("Set Locktime: Invalid Transaction");return t.writeUInt32LE(e,t.length-4),t}}(AG),Object.defineProperty(EK,"__esModule",{value:!0});const cG=CK,hG=SK,fG=kK,dG=AG;EK.Psbt=class{constructor(e){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:e}}static fromBase64(e,t){const n=ao.from(e,"base64");return this.fromBuffer(n,t)}static fromHex(e,t){const n=ao.from(e,"hex");return this.fromBuffer(n,t)}static fromBuffer(e,t){const n=hG.psbtFromBuffer(e,t),r=new this(n.globalMap.unsignedTx);return Object.assign(r,n),r}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return hG.psbtToBuffer(this)}updateGlobal(e){return dG.updateGlobal(e,this.globalMap),this}updateInput(e,t){const n=dG.checkForInput(this.inputs,e);return dG.updateInput(t,n),this}updateOutput(e,t){const n=dG.checkForOutput(this.outputs,e);return dG.updateOutput(t,n),this}addUnknownKeyValToGlobal(e){return dG.checkHasKey(e,this.globalMap.unknownKeyVals,dG.getEnumLength(fG.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(e),this}addUnknownKeyValToInput(e,t){const n=dG.checkForInput(this.inputs,e);return dG.checkHasKey(t,n.unknownKeyVals,dG.getEnumLength(fG.InputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}addUnknownKeyValToOutput(e,t){const n=dG.checkForOutput(this.outputs,e);return dG.checkHasKey(t,n.unknownKeyVals,dG.getEnumLength(fG.OutputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}addInput(e){this.globalMap.unsignedTx.addInput(e),this.inputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],n=this.inputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(n,e))),dG.addInputAttributes(this.inputs,e),this}addOutput(e){this.globalMap.unsignedTx.addOutput(e),this.outputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],n=this.outputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(n,e))),dG.addOutputAttributes(this.outputs,e),this}clearFinalizedInput(e){const t=dG.checkForInput(this.inputs,e);dG.inputCheckUncleanFinalized(e,t);for(const e of Object.keys(t))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(e)||delete t[e];return this}combine(...e){const t=cG.combine([this].concat(e));return Object.assign(this,t),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}},Object.defineProperty(BK,"__esModule",{value:!0}),BK.Psbt=void 0;const pG=EK,gG=ij,yG=AG,mG=AP,vG=RH,IG=UU,wG=hP,bG=dP,BG=ZH,EG={network:cP.bitcoin,maximumFeeRate:5e3};class CG{constructor(e={},t=new pG.Psbt(new xG)){this.data=t,this.opts=Object.assign({},EG,e),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const n=(e,t,n,r)=>Object.defineProperty(e,t,{enumerable:n,writable:r});n(this,"__CACHE",!1,!0),n(this,"opts",!1,!0)}static fromBase64(e,t={}){const n=ao.from(e,"base64");return this.fromBuffer(n,t)}static fromHex(e,t={}){const n=ao.from(e,"hex");return this.fromBuffer(n,t)}static fromBuffer(e,t={}){const n=pG.Psbt.fromBuffer(e,SG),r=new CG(t,n);return function(e,t){e.ins.forEach((e=>{HG(t,e)}))}(r.__CACHE.__TX,r.__CACHE),r}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(e){this.setVersion(e)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(e){this.setLocktime(e)}get txInputs(){return this.__CACHE.__TX.ins.map((e=>({hash:(0,vG.cloneBuffer)(e.hash),index:e.index,sequence:e.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((e=>{let t;try{t=(0,mG.fromOutputScript)(e.script,this.opts.network)}catch(e){}return{script:(0,vG.cloneBuffer)(e.script),value:e.value,address:t}}))}combine(...e){return this.data.combine(...e.map((e=>e.data))),this}clone(){const e=CG.fromBuffer(this.data.toBuffer());return e.opts=JSON.parse(JSON.stringify(this.opts)),e}setMaximumFeeRate(e){TG(e),this.opts.maximumFeeRate=e}setVersion(e){TG(e),RG(this.data.inputs,"setVersion");const t=this.__CACHE;return t.__TX.version=e,t.__EXTRACTED_TX=void 0,this}setLocktime(e){TG(e),RG(this.data.inputs,"setLocktime");const t=this.__CACHE;return t.__TX.locktime=e,t.__EXTRACTED_TX=void 0,this}setInputSequence(e,t){TG(t),RG(this.data.inputs,"setInputSequence");const n=this.__CACHE;if(n.__TX.ins.length<=e)throw new Error("Input index too high");return n.__TX.ins[e].sequence=t,n.__EXTRACTED_TX=void 0,this}addInputs(e){return e.forEach((e=>this.addInput(e))),this}addInput(e){if(arguments.length>1||!e||void 0===e.hash||void 0===e.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");RG(this.data.inputs,"addInput"),e.witnessScript&&rq(e.witnessScript);const t=this.__CACHE;this.data.addInput(e),HG(t,t.__TX.ins[t.__TX.ins.length-1]);const n=this.data.inputs.length-1,r=this.data.inputs[n];return r.nonWitnessUtxo&&WG(this.__CACHE,r,n),t.__FEE=void 0,t.__FEE_RATE=void 0,t.__EXTRACTED_TX=void 0,this}addOutputs(e){return e.forEach((e=>this.addOutput(e))),this}addOutput(e){if(arguments.length>1||!e||void 0===e.value||void 0===e.address&&void 0===e.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");RG(this.data.inputs,"addOutput");const{address:t}=e;if("string"==typeof t){const{network:n}=this.opts,r=(0,mG.toOutputScript)(t,n);e=Object.assign(e,{script:r})}const n=this.__CACHE;return this.data.addOutput(e),n.__FEE=void 0,n.__FEE_RATE=void 0,n.__EXTRACTED_TX=void 0,this}extractTransaction(e){if(!this.data.inputs.every(kG))throw new Error("Not finalized");const t=this.__CACHE;if(e||function(e,t,n){const r=t.__FEE_RATE||e.getFeeRate(),i=t.__EXTRACTED_TX.virtualSize(),o=r*i;if(r>=n.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in fees, which is ${r} satoshi per byte for a transaction with a VSize of ${i} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}(this,t,this.opts),t.__EXTRACTED_TX)return t.__EXTRACTED_TX;const n=t.__TX.clone();return ZG(this.data.inputs,n,t,!0),n}getFeeRate(){return qG("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return qG("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return(0,yG.checkForInput)(this.data.inputs,0),aq(this.data.inputs.length).forEach((e=>this.finalizeInput(e))),this}finalizeInput(e,t=VG){const n=(0,yG.checkForInput)(this.data.inputs,e),{script:r,isP2SH:i,isP2WSH:o,isSegwit:a}=function(e,t,n){const r=n.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!t.redeemScript,i.isP2WSH=!!t.witnessScript,t.witnessScript)i.script=t.witnessScript;else if(t.redeemScript)i.script=t.redeemScript;else if(t.nonWitnessUtxo){const o=$G(n,t,e),a=r.ins[e].index;i.script=o.outs[a].script}else t.witnessUtxo&&(i.script=t.witnessUtxo.script);return(t.witnessScript||PG(i.script))&&(i.isSegwit=!0),i}(e,n,this.__CACHE);if(!r)throw new Error(`No script found for input #${e}`);!function(e){if(!e.sighashType||!e.partialSig)return;const{partialSig:t,sighashType:n}=e;t.forEach((e=>{const{hashType:t}=bG.signature.decode(e.signature);if(n!==t)throw new Error("Signature sighash does not match input sighash type")}))}(n);const{finalScriptSig:s,finalScriptWitness:l}=t(e,n,r,a,i,o);if(s&&this.data.updateInput(e,{finalScriptSig:s}),l&&this.data.updateInput(e,{finalScriptWitness:l}),!s&&!l)throw new Error(`Unknown error finalizing input #${e}`);return this.data.clearFinalizedInput(e),this}getInputType(e){const t=(0,yG.checkForInput)(this.data.inputs,e),n=nq(eq(e,t,this.__CACHE),e,"input",t.redeemScript||function(e){if(!e)return;const t=bG.decompile(e);if(!t)return;const n=t[t.length-1];var r;if(jo(n)&&!tq(n)&&(r=n,!bG.isCanonicalScriptSignature(r))&&bG.decompile(n))return n}(t.finalScriptSig),t.witnessScript||function(e){if(!e)return;const t=XG(e),n=t[t.length-1];return!tq(n)&&bG.decompile(n)?n:void 0}(t.finalScriptWitness));return("raw"===n.type?"":n.type+"-")+oq(n.meaningfulScript)}inputHasPubkey(e,t){return function(e,t,n,r){const i=eq(n,t,r),{meaningfulScript:o}=nq(i,n,"input",t.redeemScript,t.witnessScript);return iq(e,o)}(t,(0,yG.checkForInput)(this.data.inputs,e),e,this.__CACHE)}inputHasHDKey(e,t){const n=(0,yG.checkForInput)(this.data.inputs,e),r=LG(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}outputHasPubkey(e,t){return function(e,t,n,r){const i=r.__TX.outs[n].script,{meaningfulScript:o}=nq(i,n,"output",t.redeemScript,t.witnessScript);return iq(e,o)}(t,(0,yG.checkForOutput)(this.data.outputs,e),e,this.__CACHE)}outputHasHDKey(e,t){const n=(0,yG.checkForOutput)(this.data.outputs,e),r=LG(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}validateSignaturesOfAllInputs(e){return(0,yG.checkForInput)(this.data.inputs,0),aq(this.data.inputs.length).map((t=>this.validateSignaturesOfInput(t,e))).reduce(((e,t)=>!0===t&&e),!0)}validateSignaturesOfInput(e,t,n){const r=this.data.inputs[e],i=(r||{}).partialSig;if(!r||!i||i.length<1)throw new Error("No signatures to validate");if("function"!=typeof t)throw new Error("Need validator function to validate signatures");const o=n?i.filter((e=>e.pubkey.equals(n))):i;if(o.length<1)throw new Error("No signatures for this pubkey");const a=[];let s,l,u;for(const n of o){const i=bG.signature.decode(n.signature),{hash:o,script:A}=u!==i.hashType?JG(e,Object.assign({},r,{sighashType:i.hashType}),this.__CACHE,!0):{hash:s,script:l};u=i.hashType,s=o,l=A,OG(n.pubkey,A,"verify"),a.push(t(n.pubkey,o,i.signature))}return a.every((e=>!0===e))}signAllInputsHD(e,t=[BG.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");const n=[];for(const r of aq(this.data.inputs.length))try{this.signInputHD(r,e,t),n.push(!0)}catch(e){n.push(!1)}if(n.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(e,t=[BG.Transaction.SIGHASH_ALL]){return new Promise(((n,r)=>{if(!e||!e.publicKey||!e.fingerprint)return r(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const n of aq(this.data.inputs.length))o.push(this.signInputHDAsync(n,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return r(new Error("No inputs were signed"));n()}))}))}signInputHD(e,t,n=[BG.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");return YG(e,this.data.inputs,t).forEach((t=>this.signInput(e,t,n))),this}signInputHDAsync(e,t,n=[BG.Transaction.SIGHASH_ALL]){return new Promise(((r,i)=>{if(!t||!t.publicKey||!t.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=YG(e,this.data.inputs,t).map((t=>this.signInputAsync(e,t,n)));return Promise.all(o).then((()=>{r()})).catch(i)}))}signAllInputs(e,t=[BG.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const n=[];for(const r of aq(this.data.inputs.length))try{this.signInput(r,e,t),n.push(!0)}catch(e){n.push(!1)}if(n.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsAsync(e,t=[BG.Transaction.SIGHASH_ALL]){return new Promise(((n,r)=>{if(!e||!e.publicKey)return r(new Error("Need Signer to sign input"));const i=[],o=[];for(const[n]of this.data.inputs.entries())o.push(this.signInputAsync(n,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return r(new Error("No inputs were signed"));n()}))}))}signInput(e,t,n=[BG.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const{hash:r,sighashType:i}=zG(this.data.inputs,e,t.publicKey,this.__CACHE,n),o=[{pubkey:t.publicKey,signature:bG.signature.encode(t.sign(r),i)}];return this.data.updateInput(e,{partialSig:o}),this}signInputAsync(e,t,n=[BG.Transaction.SIGHASH_ALL]){return Promise.resolve().then((()=>{if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const{hash:r,sighashType:i}=zG(this.data.inputs,e,t.publicKey,this.__CACHE,n);return Promise.resolve(t.sign(r)).then((n=>{const r=[{pubkey:t.publicKey,signature:bG.signature.encode(n,i)}];this.data.updateInput(e,{partialSig:r})}))}))}toBuffer(){return QG(this.__CACHE),this.data.toBuffer()}toHex(){return QG(this.__CACHE),this.data.toHex()}toBase64(){return QG(this.__CACHE),this.data.toBase64()}updateGlobal(e){return this.data.updateGlobal(e),this}updateInput(e,t){return t.witnessScript&&rq(t.witnessScript),this.data.updateInput(e,t),t.nonWitnessUtxo&&WG(this.__CACHE,this.data.inputs[e],e),this}updateOutput(e,t){return this.data.updateOutput(e,t),this}addUnknownKeyValToGlobal(e){return this.data.addUnknownKeyValToGlobal(e),this}addUnknownKeyValToInput(e,t){return this.data.addUnknownKeyValToInput(e,t),this}addUnknownKeyValToOutput(e,t){return this.data.addUnknownKeyValToOutput(e,t),this}clearFinalizedInput(e){return this.data.clearFinalizedInput(e),this}}BK.Psbt=CG;const SG=e=>new xG(e);class xG{constructor(e=ao.from([2,0,0,0,0,0,0,0,0,0])){this.tx=BG.Transaction.fromBuffer(e),function(e){if(!e.ins.every((e=>e.script&&0===e.script.length&&e.witness&&0===e.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(e){if(void 0===e.hash||void 0===e.index||!jo(e.hash)&&"string"!=typeof e.hash||"number"!=typeof e.index)throw new Error("Error adding input.");const t="string"==typeof e.hash?(0,vG.reverseBuffer)(ao.from(e.hash,"hex")):e.hash;this.tx.addInput(t,e.index,e.sequence)}addOutput(e){if(void 0===e.script||void 0===e.value||!jo(e.script)||"number"!=typeof e.value)throw new Error("Error adding output.");this.tx.addOutput(e.script,e.value)}toBuffer(){return this.tx.toBuffer()}}function QG(e){if(!1!==e.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function kG(e){return!!e.finalScriptSig||!!e.finalScriptWitness}function _G(e){return t=>{try{return e({output:t}),!0}catch(e){return!1}}}const NG=_G(wG.p2ms),DG=_G(wG.p2pk),FG=_G(wG.p2pkh),PG=_G(wG.p2wpkh),UG=_G(wG.p2wsh),MG=_G(wG.p2sh);function LG(e){return t=>!!t.masterFingerprint.equals(e.fingerprint)&&!!e.derivePath(t.path).publicKey.equals(t.pubkey)}function TG(e){if("number"!=typeof e||e!==Math.floor(e)||e>4294967295||e<0)throw new Error("Invalid 32 bit integer")}function RG(e,t){e.forEach((e=>{let n=!1,r=[];if(0===(e.partialSig||[]).length){if(!e.finalScriptSig&&!e.finalScriptWitness)return;r=function(e){const t=e.finalScriptSig&&bG.decompile(e.finalScriptSig)||[],n=e.finalScriptWitness&&bG.decompile(e.finalScriptWitness)||[];return t.concat(n).filter((e=>jo(e)&&bG.isCanonicalScriptSignature(e))).map((e=>({signature:e})))}(e)}else r=e.partialSig;if(r.forEach((e=>{const{hashType:r}=bG.signature.decode(e.signature),i=[];switch(r&BG.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&r){case BG.Transaction.SIGHASH_ALL:break;case BG.Transaction.SIGHASH_SINGLE:case BG.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(t)&&(n=!0)})),n)throw new Error("Can not modify transaction, signatures exist.")}))}function OG(e,t,n){if(!iq(e,t))throw new Error(`Can not ${n} for this input with the key ${e.toString("hex")}`)}function HG(e,t){const n=(0,vG.reverseBuffer)(ao.from(t.hash)).toString("hex")+":"+t.index;if(e.__TX_IN_CACHE[n])throw new Error("Duplicate input detected.");e.__TX_IN_CACHE[n]=1}function KG(e,t){return(n,r,i,o)=>{const a=e({redeem:{output:i}}).output;if(!r.equals(a))throw new Error(`${t} for ${o} #${n} doesn't match the scriptPubKey in the prevout`)}}const jG=KG(wG.p2sh,"Redeem script"),GG=KG(wG.p2wsh,"Witness script");function qG(e,t,n,r){if(!n.every(kG))throw new Error(`PSBT must be finalized to calculate ${t}`);if("__FEE_RATE"===e&&r.__FEE_RATE)return r.__FEE_RATE;if("__FEE"===e&&r.__FEE)return r.__FEE;let i,o=!0;return r.__EXTRACTED_TX?(i=r.__EXTRACTED_TX,o=!1):i=r.__TX.clone(),ZG(n,i,r,o),"__FEE_RATE"===e?r.__FEE_RATE:"__FEE"===e?r.__FEE:void 0}function VG(e,t,n,r,i,o){oq(n);throw new Error(`Can not finalize input #${e}`)}function zG(e,t,n,r,i){const o=(0,yG.checkForInput)(e,t),{hash:a,sighashType:s,script:l}=JG(t,o,r,!1,i);return OG(n,l,"sign"),{hash:a,sighashType:s}}function JG(e,t,n,r,i){const o=n.__TX,a=t.sighashType||BG.Transaction.SIGHASH_ALL;if(i&&i.indexOf(a)<0){const e=function(e){let t=e&BG.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&e){case BG.Transaction.SIGHASH_ALL:t+="SIGHASH_ALL";break;case BG.Transaction.SIGHASH_SINGLE:t+="SIGHASH_SINGLE";break;case BG.Transaction.SIGHASH_NONE:t+="SIGHASH_NONE"}return t}(a);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${e}`)}let s,l;if(t.nonWitnessUtxo){const r=$G(n,t,e),i=o.ins[e].hash,a=r.getHash();if(!i.equals(a))throw new Error(`Non-witness UTXO hash for input #${e} doesn't match the hash specified in the prevout`);const s=o.ins[e].index;l=r.outs[s]}else{if(!t.witnessUtxo)throw new Error("Need a Utxo input item for signing");l=t.witnessUtxo}const{meaningfulScript:u,type:A}=nq(l.script,e,"input",t.redeemScript,t.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(A)>=0)s=o.hashForWitnessV0(e,u,l.value,a);else if(PG(u)){const t=wG.p2pkh({hash:u.slice(2)}).output;s=o.hashForWitnessV0(e,t,l.value,a)}else{if(void 0===t.nonWitnessUtxo&&!1===n.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${e} has witnessUtxo but non-segwit script: ${u.toString("hex")}`);r||!1===n.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as Psbt's predecesor (TransactionBuilder - now removed) when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),s=o.hashForSignature(e,u,a)}return{script:u,sighashType:a,hash:s}}function YG(e,t,n){const r=(0,yG.checkForInput)(t,e);if(!r.bip32Derivation||0===r.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=r.bip32Derivation.map((e=>e.masterFingerprint.equals(n.fingerprint)?e:void 0)).filter((e=>!!e));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");const o=i.map((e=>{const t=n.derivePath(e.path);if(!e.pubkey.equals(t.publicKey))throw new Error("pubkey did not match bip32Derivation");return t}));return o}function XG(e){let t=0;function n(){const n=gG.decode(e,t);return t+=gG.decode.bytes,n}function r(){return r=n(),t+=r,e.slice(t-r,t);var r}return function(){const e=n(),t=[];for(let n=0;n<e;n++)t.push(r());return t}()}function WG(e,t,n){e.__NON_WITNESS_UTXO_BUF_CACHE[n]=t.nonWitnessUtxo;const r=BG.Transaction.fromBuffer(t.nonWitnessUtxo);e.__NON_WITNESS_UTXO_TX_CACHE[n]=r;const i=e,o=n;delete t.nonWitnessUtxo,Object.defineProperty(t,"nonWitnessUtxo",{enumerable:!0,get(){const e=i.__NON_WITNESS_UTXO_BUF_CACHE[o],t=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==e)return e;{const e=t.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e,e}},set(e){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e}})}function ZG(e,t,n,r){let i=0;e.forEach(((e,o)=>{if(r&&e.finalScriptSig&&(t.ins[o].script=e.finalScriptSig),r&&e.finalScriptWitness&&(t.ins[o].witness=XG(e.finalScriptWitness)),e.witnessUtxo)i+=e.witnessUtxo.value;else if(e.nonWitnessUtxo){const r=$G(n,e,o),a=t.ins[o].index,s=r.outs[a];i+=s.value}}));const o=t.outs.reduce(((e,t)=>e+t.value),0),a=i-o;if(a<0)throw new Error("Outputs are spending more than Inputs");const s=t.virtualSize();n.__FEE=a,n.__EXTRACTED_TX=t,n.__FEE_RATE=Math.floor(a/s)}function $G(e,t,n){const r=e.__NON_WITNESS_UTXO_TX_CACHE;return r[n]||WG(e,t,n),r[n]}function eq(e,t,n){if(void 0!==t.witnessUtxo)return t.witnessUtxo.script;if(void 0!==t.nonWitnessUtxo)return $G(n,t,e).outs[n.__TX.ins[e].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function tq(e){return 33===e.length&&bG.isCanonicalPubKey(e)}function nq(e,t,n,r,i){const o=MG(e),a=o&&r&&UG(r),s=UG(e);if(o&&void 0===r)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((s||a)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let l;return a?(l=i,jG(t,e,r,n),GG(t,r,i,n),rq(l)):s?(l=i,GG(t,e,i,n),rq(l)):o?(l=r,jG(t,e,r,n)):l=e,{meaningfulScript:l,type:a?"p2sh-p2wsh":o?"p2sh":s?"p2wsh":"raw"}}function rq(e){if(PG(e)||MG(e))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function iq(e,t){const n=(0,IG.hash160)(e),r=bG.decompile(t);if(null===r)throw new Error("Unknown script error");return r.some((t=>"number"!=typeof t&&(t.equals(e)||t.equals(n))))}function oq(e){return PG(e)?"witnesspubkeyhash":FG(e)?"pubkeyhash":NG(e)?"multisig":DG(e)?"pubkey":"nonstandard"}function aq(e){return[...Array(e).keys()]}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Transaction=e.opcodes=e.Psbt=e.Block=e.script=e.payments=e.networks=e.crypto=e.address=void 0;const t=AP;e.address=t;const n=UU;e.crypto=n;const r=cP;e.networks=r;const i=hP;e.payments=i;const o=dP;e.script=o;var a=TH;Object.defineProperty(e,"Block",{enumerable:!0,get:function(){return a.Block}});var s=BK;Object.defineProperty(e,"Psbt",{enumerable:!0,get:function(){return s.Psbt}});var l=gP;Object.defineProperty(e,"opcodes",{enumerable:!0,get:function(){return l.OPS}});var u=ZH;Object.defineProperty(e,"Transaction",{enumerable:!0,get:function(){return u.Transaction}})}(uP);var sq={exports:{}};function lq(e,t){const n=(e=>{const t=(e=>{const t=aP.from(Object.assign(Object.assign({},e),{crv:"K-256"}),"jwk").toString("blk","public"),n=AC.publicKeyConvert(lP.from(t,"hex"),!0);return lP.from(n).toString("hex")})(e);let n=lP.from(t,"hex"),r=32-n.length;for(;r>0;)n=lP.concat([lP.from("00","hex"),n]),r--;return n})(e.publicKeyJwk),r=sD("errors","identityErrorBaseMessage");let i="";switch(t.code){case Ol.Bitcoin:case Ol.Mocknet:case Ol.Testnet:i=function(e,t){return uP.payments.p2pkh({pubkey:e,network:uP.networks[t.code]}).address}(n,t);break;case Ol.Ethmain:case Ol.Ethropst:case Ol.Ethrinkeby:case Ol.Ethgoerli:case Ol.Ethsepolia:i=function(e,t){const n=e.toString("hex"),r=new ww.ec("secp256k1").keyFromPublic(n,"hex").getPublic().encode("hex").slice(2),i=ao;return`0x${sq.exports.keccak256(i.from(r,"hex")).slice(24).toString()}`}(n);break;default:throw new iD("deriveIssuingAddressFromPublicKey",`${r} - ${sD("errors","deriveIssuingAddressFromPublicKey")}`)}return i}function uq(e){if(e){const t="string"==typeof e?e:e.code;return!!Object.keys(jl).some((e=>e===t))&&!!jl[t].test}return!1}!function(e){!function(){var t="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof gu&&gu.versions&&gu.versions.node?r=Ki:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&e.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),l=[4,1024,262144,67108864],u=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],c=[224,256,384,512],h=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],d={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var p=function(e,t,n){return function(r){return new _(e,t,e).update(r)[n]()}},g=function(e,t,n){return function(r,i){return new _(e,t,i).update(r)[n]()}},y=function(e,t,n){return function(t,r,i,o){return b["cshake"+e].update(t,r,i,o)[n]()}},m=function(e,t,n){return function(t,r,i,o){return b["kmac"+e].update(t,r,i,o)[n]()}},v=function(e,t,n,r){for(var i=0;i<f.length;++i){var o=f[i];e[o]=t(n,r,o)}return e},I=function(e,t){var n=p(e,t,"hex");return n.create=function(){return new _(e,t,e)},n.update=function(e){return n.create().update(e)},v(n,p,e,t)},w=[{name:"keccak",padding:[1,256,65536,16777216],bits:c,createMethod:I},{name:"sha3",padding:[6,1536,393216,100663296],bits:c,createMethod:I},{name:"shake",padding:[31,7936,2031616,520093696],bits:h,createMethod:function(e,t){var n=g(e,t,"hex");return n.create=function(n){return new _(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},v(n,g,e,t)}},{name:"cshake",padding:l,bits:h,createMethod:function(e,t){var n=d[e],r=y(e,0,"hex");return r.create=function(r,i,o){return i||o?new _(e,t,r).bytepad([i,o],n):b["shake"+e].create(r)},r.update=function(e,t,n,i){return r.create(t,n,i).update(e)},v(r,y,e,t)}},{name:"kmac",padding:l,bits:h,createMethod:function(e,t){var n=d[e],r=m(e,0,"hex");return r.create=function(r,i,o){return new N(e,t,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(e,t,n,i){return r.create(e,n,i).update(t)},v(r,m,e,t)}}],b={},B=[],E=0;E<w.length;++E)for(var C=w[E],S=C.bits,x=0;x<S.length;++x){var Q=C.name+"_"+S[x];if(B.push(Q),b[Q]=C.createMethod(S[x],C.padding),"sha3"!==C.name){var k=C.name+S[x];B.push(k),b[k]=b[Q]}}function _(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function N(e,t,n){_.call(this,e,t,n)}_.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var i,o,s=this.blocks,l=this.byteCount,A=e.length,c=this.blockCount,h=0,f=this.s;h<A;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<c+1;++i)s[i]=0;if(n)for(i=this.start;h<A&&i<l;++h)s[i>>2]|=e[h]<<u[3&i++];else for(i=this.start;h<A&&i<l;++h)(o=e.charCodeAt(h))<128?s[i>>2]|=o<<u[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<u[3&i++],s[i>>2]|=(128|o>>6&63)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++h)),s[i>>2]|=(240|o>>18)<<u[3&i++],s[i>>2]|=(128|o>>12&63)<<u[3&i++],s[i>>2]|=(128|o>>6&63)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]);if(this.lastByteIndex=i,i>=l){for(this.start=i-l,this.block=s[c],i=0;i<c;++i)f[i]^=s[i];D(f),this.reset=!0}else this.start=i}return this},_.prototype.encode=function(e,t){var n=255&e,r=1,i=[n];for(n=255&(e>>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},_.prototype.encodeString=function(e){var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}var i=0,o=e.length;if(n)i=o;else for(var s=0;s<e.length;++s){var l=e.charCodeAt(s);l<128?i+=1:l<2048?i+=2:l<55296||l>=57344?i+=3:(l=65536+((1023&l)<<10|1023&e.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(e),i},_.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var i=t-n%t,o=[];return o.length=i,this.update(o),this},_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];D(r)}},_.prototype.toString=_.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,l="";a<r;){for(o=0;o<t&&a<r;++o,++a)e=n[o],l+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t==0&&(D(n),o=0)}return i&&(e=n[o],l+=s[e>>4&15]+s[15&e],i>1&&(l+=s[e>>12&15]+s[e>>8&15]),i>2&&(l+=s[e>>20&15]+s[e>>16&15])),l},_.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var l=new Uint32Array(e);a<r;){for(o=0;o<t&&a<r;++o,++a)l[a]=n[o];a%t==0&&D(n)}return i&&(l[o]=n[o],e=e.slice(0,s)),e},_.prototype.buffer=_.prototype.arrayBuffer,_.prototype.digest=_.prototype.array=function(){this.finalize();for(var e,t,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,l=[];s<i;){for(a=0;a<n&&s<i;++a,++s)e=s<<2,t=r[a],l[e]=255&t,l[e+1]=t>>8&255,l[e+2]=t>>16&255,l[e+3]=t>>24&255;s%n==0&&D(r)}return o&&(e=s<<2,t=r[a],l[e]=255&t,o>1&&(l[e+1]=t>>8&255),o>2&&(l[e+2]=t>>16&255)),l},N.prototype=new _,N.prototype.finalize=function(){return this.encode(this.outputBits,!0),_.prototype.finalize.call(this)};var D=function(e){var t,n,r,i,o,a,s,l,u,c,h,f,d,p,g,y,m,v,I,w,b,B,E,C,S,x,Q,k,_,N,D,F,P,U,M,L,T,R,O,H,K,j,G,q,V,z,J,Y,X,W,Z,$,ee,te,ne,re,ie,oe,ae,se,le,ue,Ae;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],l=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(l<<1|u>>>31),n=o^(u<<1|l>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(c<<1|h>>>31),n=s^(h<<1|c>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=l^(f<<1|d>>>31),n=u^(d<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=c^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,p=e[0],g=e[1],z=e[11]<<4|e[10]>>>28,J=e[10]<<4|e[11]>>>28,k=e[20]<<3|e[21]>>>29,_=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,le=e[30]<<9|e[31]>>>23,j=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,U=e[2]<<1|e[3]>>>31,M=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,D=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,Ae=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,T=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,I=e[24]<<11|e[25]>>>21,W=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,F=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,C=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,R=e[26]<<25|e[27]>>>7,O=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,b=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,x=e[18]<<20|e[19]>>>12,Q=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,H=e[38]<<8|e[39]>>>24,K=e[39]<<8|e[38]>>>24,B=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=g^~m&I,e[10]=C^~x&k,e[11]=S^~Q&_,e[20]=U^~L&R,e[21]=M^~T&O,e[30]=q^~z&Y,e[31]=V^~J&X,e[40]=te^~re&oe,e[41]=ne^~ie&ae,e[2]=y^~v&w,e[3]=m^~I&b,e[12]=x^~k&N,e[13]=Q^~_&D,e[22]=L^~R&H,e[23]=T^~O&K,e[32]=z^~Y&W,e[33]=J^~X&Z,e[42]=re^~oe&se,e[43]=ie^~ae&le,e[4]=v^~w&B,e[5]=I^~b&E,e[14]=k^~N&F,e[15]=_^~D&P,e[24]=R^~H&j,e[25]=O^~K&G,e[34]=Y^~W&$,e[35]=X^~Z&ee,e[44]=oe^~se&ue,e[45]=ae^~le&Ae,e[6]=w^~B&p,e[7]=b^~E&g,e[16]=N^~F&C,e[17]=D^~P&S,e[26]=H^~j&U,e[27]=K^~G&M,e[36]=W^~$&q,e[37]=Z^~ee&V,e[46]=se^~ue&te,e[47]=le^~Ae&ne,e[8]=B^~p&y,e[9]=E^~g&m,e[18]=F^~C&x,e[19]=P^~S&Q,e[28]=j^~U&L,e[29]=G^~M&T,e[38]=$^~q&z,e[39]=ee^~V&J,e[48]=ue^~te&re,e[49]=Ae^~ne&ie,e[0]^=A[r],e[1]^=A[r+1]};if(o)e.exports=b;else for(E=0;E<B.length;++E)r[B[E]]=b[B[E]]}()}(sq);var Aq=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const{LinkedDataProof:cq}=JN.suites;class hq extends cq{constructor({issuer:e=null,verificationMethod:t=null,document:n=null,proof:r=null,options:i={}}){if(super({type:"MerkleProof2019"}),this.type="MerkleProof2019",this.issuer=null,this.verificationMethod=null,this.proof=null,this.proofValue=null,this.document=null,this.explorerAPIs=[],this.documentLoader=null,this.proofVerificationProcess=["getTransactionId","computeLocalHash","fetchRemoteHash","compareHashes","checkMerkleRoot","checkReceipt"],this.identityVerificationProcess=["deriveIssuingAddressFromPublicKey","compareIssuingAddress"],this.transactionId="",!n)throw new Error("A document signed by MerkleProof2019 is required for the verification process.");this.issuer=e,this.verificationMethod=t,this.document=n,this.setProof(r),this.setOptions(i),this.getChain(),uq(this.chain)&&(this.adaptProofVerificationProcessToMocknet(),this.adaptIdentityVerificationProcessToMocknet())}static decodeMerkleProof2019(e){return new Z_(e.proofValue).decode()}setProof(e=null){const t=null!=e?e:this.document.proof;if(!t)throw new Error("The passed document is not signed.");this.proof=t,this.proofValue=hq.decodeMerkleProof2019(this.proof)}verifyProof({documentLoader:e,verifyIdentity:t}={documentLoader:e=>{},verifyIdentity:!0}){return Aq(this,void 0,void 0,(function*(){let n;this.documentLoader=e;let r="";try{yield this.verifyProcess(this.proofVerificationProcess),t&&(yield this.verifyIdentity()),n=!0}catch(e){console.error(e),n=!1,r=e.message}return{verificationMethod:this.verificationMethod,verified:n,error:r}}))}verifyIdentity(){return Aq(this,void 0,void 0,(function*(){if(null!=this.verificationMethod)try{yield this.verifyProcess(this.identityVerificationProcess)}catch(e){throw new Error(e)}}))}getProofVerificationProcess(){return this.proofVerificationProcess}getIdentityVerificationProcess(){return this.identityVerificationProcess}getIssuerPublicKey(){var e,t;return uq(this.chain)?"This mock chain does not support issuing addresses":null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.issuingAddress)&&void 0!==t?t:""}getIssuanceTime(){var e,t;return null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.time)&&void 0!==t?t:""}getChain(){return this.chain||(this.chain=function(e=null){if(null==e?void 0:e.anchors){const{anchors:t}=e,n=t[0];if("string"==typeof n)return function(e){const t=e.split(":");let n;switch(t[1]){case jl.mocknet.blinkCode:return ZN(jl.mocknet.signatureValue);case jl.bitcoin.blinkCode:n=jl.bitcoin.name;break;case jl.ethmain.blinkCode:n=jl.ethmain.name;break;default:throw new Error("Could not retrieve chain.")}const r=t[2],i=n.toLowerCase()+function(e){const t=e.substr(0,1),n=e.substr(1,e.length-1);return t.toUpperCase()+n.toLowerCase()}(r);return ZN(i)}(n)}return null}(this.proofValue)),this.chain}getTxData(){return this.txData?this.txData:(console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?"),null)}adaptProofVerificationProcessToMocknet(){$N(this.proofVerificationProcess,"getTransactionId"),$N(this.proofVerificationProcess,"fetchRemoteHash"),$N(this.proofVerificationProcess,"checkMerkleRoot")}adaptIdentityVerificationProcessToMocknet(){this.identityVerificationProcess=[]}setOptions(e){var t;this.explorerAPIs=null!==(t=e.explorerAPIs)&&void 0!==t?t:[],e.executeStepMethod&&"function"==typeof e.executeStepMethod&&(this.executeStep=e.executeStepMethod)}executeStep(e,t,n=""){return Aq(this,void 0,void 0,(function*(){return yield t()}))}verifyProcess(e){return Aq(this,void 0,void 0,(function*(){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");yield this[t]()}}))}checkMerkleRoot(){return Aq(this,void 0,void 0,(function*(){yield this.executeStep("checkMerkleRoot",(()=>function(e,t){if(e!==t)throw new iD("checkMerkleRoot",sD("errors","ensureMerkleRootEqual"));return!0}(this.proofValue.merkleRoot,this.txData.remoteHash)),this.type)}))}compareHashes(){return Aq(this,void 0,void 0,(function*(){yield this.executeStep("compareHashes",(()=>function(e,t){if(e!==t)throw new iD("compareHashes",sD("errors","ensureHashesEqual"));return!0}(this.localDocumentHash,this.proofValue.targetHash)),this.type)}))}computeLocalHash(){return Aq(this,void 0,void 0,(function*(){this.localDocumentHash=yield this.executeStep("computeLocalHash",(()=>Aq(this,void 0,void 0,(function*(){return yield function(e,t=null,n=(e=>{})){return lD(this,void 0,void 0,(function*(){e["@context"].find((e=>{return(t=e)===Object(t)&&"@vocab"in e;var t}))||e["@context"].push({"@vocab":"http://fallback.org/"});const r=JSON.parse(JSON.stringify(e));if(Array.isArray(r.proof)){if(!t)throw new iD("computeLocalHash",sD("errors","noProofSpecified"));const e=r.proof.findIndex((e=>e.proofValue===t.proofValue));r.proof=r.proof.slice(0,e)}else delete r.proof;const i={algorithm:"URDNA2015",format:"application/nquads",documentLoader:function(e){return lD(this,void 0,void 0,(function*(){return null!=n&&(yield n(e)),e in jh?{contextUrl:null,document:jh[e],documentUrl:e}:ov.documentLoader(e)}))}};let o;try{o=yield ov.normalize(r,i)}catch(e){throw console.error(e),new iD("computeLocalHash",sD("errors","failedJsonLdNormalization"))}const a=function(e){const t=e.split("\n"),n=/<http:\/\/fallback\.org\/(.*)>/,r=t.map((e=>n.exec(e))).filter((e=>null!=e));if(r.length>0){const e=r.map((e=>e[1])).sort();return Array.from(new Set(e))}return null}(o);if(a)throw new iD("computeLocalHash",`${sD("errors","foundUnmappedFields")}: ${a.join(", ")}`);return lS(function(e){const t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(o))}))}(this.document,this.proof,this.documentLoader)}))),this.type)}))}checkReceipt(){return Aq(this,void 0,void 0,(function*(){yield this.executeStep("checkReceipt",(()=>function(e){let t=e.targetHash;const n=e.merkleRoot;try{const n=e.path;if(n&&t)for(const e in n){const r=n[e];let i;if(void 0!==r.left)i=rD(`${r.left}${t}`),t=lS(i);else{if(void 0===r.right)throw new iD("checkReceipt","Trigger catch error.");i=rD(`${t}${r.right}`),t=lS(i)}}}catch(e){throw new iD("checkReceipt",sD("errors","ensureValidReceipt"))}if(t!==n)throw new iD("checkReceipt",sD("errors","invalidMerkleReceipt"))}(this.proofValue)),this.type)}))}getTransactionId(){return Aq(this,void 0,void 0,(function*(){return this.transactionId=function(e=null){if(!e)throw new Error("DecodedProof is not set");const{anchors:t}=e,n=t[0];if("string"==typeof n)return n.split(":").pop();throw new Error("Could not retrieve transaction id as was provided an unexpected format")}(this.proofValue),yield this.executeStep("getTransactionId",(()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new iD("getTransactionId",sD("errors","isTransactionIdValid"))}(this.transactionId)),this.type)}))}fetchRemoteHash(){return Aq(this,void 0,void 0,(function*(){this.txData=yield this.executeStep("fetchRemoteHash",(()=>Aq(this,void 0,void 0,(function*(){var e;return yield Lh({transactionId:this.transactionId,chain:null===(e=this.chain)||void 0===e?void 0:e.code,explorerAPIs:this.explorerAPIs})}))),this.type)}))}deriveIssuingAddressFromPublicKey(){return Aq(this,void 0,void 0,(function*(){this.derivedIssuingAddress=yield this.executeStep("deriveIssuingAddressFromPublicKey",(()=>lq(this.verificationMethod,this.chain)),this.type)}))}compareIssuingAddress(){return Aq(this,void 0,void 0,(function*(){yield this.executeStep("compareIssuingAddress",(()=>function(e,t){const n=sD("errors","identityErrorBaseMessage");if(e!==t)throw new iD("compareIssuingAddress",`${n} - ${sD("errors","compareIssuingAddress")}`)}(this.getIssuerPublicKey(),this.derivedIssuingAddress)),this.type)}))}}class fq{constructor(e){}}function dq(e){return Array.isArray(e)?e.find((e=>"ChainedProof2021"!==e.type)).verificationMethod:e.verificationMethod}var pq,gq;!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkImagesIntegrity="checkImagesIntegrity",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.deriveIssuingAddressFromPublicKey="deriveIssuingAddressFromPublicKey",e.compareIssuingAddress="compareIssuingAddress",e.checkAuthenticity="checkAuthenticity"}(pq||(pq={}));class yq extends fq{proofVerificationProcess=[pq.parseIssuerKeys,pq.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;verificationMethodPublicKey;derivedIssuingAddress;hasDid;proof;type="MerkleProof2019";suite;constructor(e){var t;super(e),this.executeStep=e.executeStep,this.documentToVerify=e.document,this.explorerAPIs=e.explorerAPIs,this.proof=e.proof,this.issuer=e.issuer,this.validateProofType(),this.receipt=(t=this.proof,hq.decodeMerkleProof2019(t)),this.transactionId=zC.certificates.getTransactionId(this.receipt),this.setHasDid()}async init(){await this.setVerificationSuite(),this.chain=this.suite.getChain(),this.adaptVerificationProcessToChain()}async verifyProof(){await this.suite.verifyProof({verifyIdentity:!1}),await this.verifyProcess(this.proofVerificationProcess)}async verifyIdentity(){await this.suite.verifyIdentity()}getProofVerificationSteps(e){return[...this.suite.getProofVerificationProcess(),...this.proofVerificationProcess].map((t=>zC.verifier.convertToVerificationSubsteps(e,t)))}getIdentityVerificationSteps(e){return this.hasDid?this.suite.getIdentityVerificationProcess().map((t=>zC.verifier.convertToVerificationSubsteps(e,t))):[]}getIssuerPublicKey(){return this.suite.getIssuerPublicKey()}getIssuanceTime(){return this.suite.getIssuanceTime()}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){return new URL(this.getIssuerProfileUrl())?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.proof.created}getChain(){return this.suite.getChain()}getReceipt(){return this.receipt}getTransactionIdString(){return zC.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}async executeStep(e,t,n){throw new Error("executeStep method needs to be overwritten by injecting from Verifier")}async setVerificationSuite(){await this.setIssuerFromProofVerificationMethod(),this.verificationMethodPublicKey=gS(this.getTargetVerificationMethodContainer(),dq(this.proof)),this.suite=new hq({document:this.documentToVerify,proof:this.proof,verificationMethod:this.verificationMethodPublicKey,options:{explorerAPIs:this.explorerAPIs,executeStepMethod:this.executeStep}})}adaptVerificationProcessToChain(){zC.chains.isMockChain(this.chain)&&(sf(this.proofVerificationProcess,pq.parseIssuerKeys),sf(this.proofVerificationProcess,pq.checkAuthenticity))}getTargetVerificationMethodContainer(){return this.issuer.didDocument??this.issuer}isProofChain(){return"ChainedProof2021"===this.proof.type}async setIssuerFromProofVerificationMethod(){if(this.isProofChain()){const e=this.proof.verificationMethod.split("#")[0];this.issuer=await zC.verifier.getIssuerProfile(e)}}setHasDid(){if(this.isProofChain()){const e=this.proof.verificationMethod.split("#")[0];this.hasDid=df(e)}else this.hasDid=!!this.issuer.didDocument}validateProofType(){const e=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}async verifyProcess(e){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(pq.parseIssuerKeys,(()=>zC.verifier.parseIssuerKeys(this.issuer)),this.type)}async checkAuthenticity(){await this.executeStep(pq.checkAuthenticity,(()=>dS(this.issuerPublicKeyList,this.getIssuerPublicKey(),this.getIssuanceTime())),this.type)}}!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.checkAuthenticity="checkAuthenticity"}(gq||(gq={}));class mq extends fq{verificationProcess=[gq.getTransactionId,gq.computeLocalHash,gq.fetchRemoteHash,gq.compareHashes,gq.checkMerkleRoot,gq.checkReceipt,gq.parseIssuerKeys,gq.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;proof;type="MerkleProof2017";constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.explorerAPIs=e.explorerAPIs,this.issuer=e.issuer,this.proof=e.proof,this.validateProofType(),this.receipt=this.documentToVerify.signature,this.chain=zC.certificates.getChain("",this.receipt),this.transactionId=zC.certificates.getTransactionId(this.receipt),this.adaptVerificationProcessToChain()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(e){return this.verificationProcess.map((t=>zC.verifier.convertToVerificationSubsteps(e,t)))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return zC.chains.isMockChain(this.chain)?"This mock chain does not support issuing addresses":this.txData?this.txData.issuingAddress:void console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?")}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){return new URL(this.getIssuerProfileUrl())?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.documentToVerify.issuedOn}getChain(){return this.chain}getReceipt(){return this.receipt}getTransactionIdString(){return zC.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}validateProofType(){if(this.proof.type[0]!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${this.proof.type[0]}`)}adaptVerificationProcessToChain(){zC.chains.isMockChain(this.chain)&&(sf(this.verificationProcess,gq.getTransactionId),sf(this.verificationProcess,gq.fetchRemoteHash),sf(this.verificationProcess,gq.parseIssuerKeys),sf(this.verificationProcess,gq.checkMerkleRoot),sf(this.verificationProcess,gq.checkAuthenticity))}async executeStep(e,t,n){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}async getTransactionId(){await this.executeStep(gq.getTransactionId,(()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new tf("getTransactionId",Wh("errors","isTransactionIdValid"))}(this.transactionId)),this.type)}async computeLocalHash(){this.localHash=await this.executeStep(gq.computeLocalHash,(async()=>await fS(this.documentToVerify)),this.type)}async fetchRemoteHash(){this.txData=await this.executeStep(gq.fetchRemoteHash,(async()=>await zC.verifier.lookForTx({transactionId:this.transactionId,chain:this.chain.code,explorerAPIs:this.explorerAPIs})),this.type)}async compareHashes(){await this.executeStep(gq.compareHashes,(()=>function(e,t){if(e!==t)throw new tf("compareHashes",Wh("errors","ensureHashesEqual"));return!0}(this.localHash,this.receipt.targetHash)),this.type)}async checkMerkleRoot(){await this.executeStep(gq.checkMerkleRoot,(()=>function(e,t){if(e!==t)throw new tf("checkMerkleRoot",Wh("errors","ensureMerkleRootEqual"));return!0}(this.receipt.merkleRoot,this.txData.remoteHash)),this.type)}async checkReceipt(){await this.executeStep(gq.checkReceipt,(()=>function(e){let t=e.targetHash;const n=e.merkleRoot;try{const n=e.proof||e.path;if(n)for(const e in n){const r=n[e];let i;if(void 0!==r.left)i=uS(`${r.left}${t}`),t=lS(i);else{if(void 0===r.right)throw new tf("checkReceipt","Trigger catch error.");i=uS(`${t}${r.right}`),t=lS(i)}}}catch(e){throw new tf("checkReceipt",Wh("errors","ensureValidReceipt"))}if(t!==n)throw new tf("checkReceipt",Wh("errors","invalidMerkleReceipt"))}(this.receipt)),this.type)}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(gq.parseIssuerKeys,(()=>zC.verifier.parseIssuerKeys(this.issuer)),this.type)}async checkAuthenticity(){await this.executeStep(gq.checkAuthenticity,(()=>dS(this.issuerPublicKeyList,this.txData.issuingAddress,this.txData.time)),this.type)}}const vq={};function Iq(e,t){return function(e,t,n){if(!(e instanceof Uint8Array))throw new TypeError('"input" must be a Uint8Array.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');if(0===e.length)return"";let r="",i=0;const o=t.length,a=t.charAt(0),s=[0];for(i=0;i<e.length;++i){let t=e[i];for(let e=0;e<s.length;++e)t+=s[e]<<8,s[e]=t%o,t=t/o|0;for(;t>0;)s.push(t%o),t=t/o|0}for(i=0;0===e[i]&&i<e.length-1;++i)r+=a;for(i=s.length-1;i>=0;--i)r+=t[s[i]];if(n){const e=new RegExp(".{1,"+n+"}","g");r=r.match(e).join("\r\n")}return r}(e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",t)}function wq(e){return function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if(0===e.length)return new Uint8Array;let n=vq[t];if(!n){n=vq[t]=[];for(let e=0;e<t.length;++e)n[t.charCodeAt(e)]=e}e=e.replace(/\s/g,"");const r=t.length,i=t.charAt(0),o=[0];for(let t=0;t<e.length;t++){const i=n[e.charCodeAt(t)];if(void 0===i)return;let a=i;for(let e=0;e<o.length;++e)a+=o[e]*r,o[e]=255&a,a>>=8;for(;a>0;)o.push(255&a),a>>=8}for(let t=0;e[t]===i&&t<e.length-1;++t)o.push(0);return new Uint8Array(o.reverse())}
|
|
638
638
|
/*!
|
|
639
639
|
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
|
640
640
|
*/(e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")}
|
|
@@ -1070,23 +1070,23 @@ const NAe=e=>(e=>(e.__litDirective=!0,e))((t=>{const n=document.createElement("t
|
|
|
1070
1070
|
<span class='buv-u-visually-hidden'>${r}</span>
|
|
1071
1071
|
<slot></slot>
|
|
1072
1072
|
</a>
|
|
1073
|
-
`}),{mapStateToProps:(e,t)=>({isTestChain:Fle(e,parseInt(t.index,10)),status:vAe(e,t.suiteType)}),ownProps:{suiteType:String,index:String}});window.customElements.define("buv-suite-verification-status",UAe);const
|
|
1074
|
-
${A[e]}
|
|
1075
|
-
</buv-suite-verification-status>`}),i[e]&&
|
|
1073
|
+
`}),{mapStateToProps:(e,t)=>({isTestChain:Fle(e,parseInt(t.index,10)),status:vAe(e,t.suiteType)}),ownProps:{suiteType:String,index:String}});function MAe(e){return e?` (${e})`:""}window.customElements.define("buv-suite-verification-status",UAe);const LAe=eue((function({recipientName:e,issuedOn:t,issueDate:n,issuerName:r,issuerProfileDomain:i=[],issuerProfileUrl:o=[],issuerPublicKey:a=[],transactionId:s=[],direction:l,hideRecipientName:u,signatureSuiteType:A=[],chain:c=[]}){const h=[];u||h.push({title:Si("text.recipient"),value:e}),h.push({title:Si("text.issueDate"),value:he`<time datetime$='${t}'>${n}</time>`},{title:Si("text.issuerName"),value:r||Si("errors.noIssuerName")});for(let e=0;e<a.length;e++){let t="";a.length>1&&(t=`${_i(e+1)} `),A[e]&&h.push({title:`${t}${Si("text.signatureSuiteType")}`,value:he`<buv-suite-verification-status suiteType$='${A[e]}' index$='${e}'>
|
|
1074
|
+
${A[e]}${MAe(c[e])}
|
|
1075
|
+
</buv-suite-verification-status>`}),i[e]&&h.push({title:`${t}${Si("text.issuerProfileDomain")}`,value:he`<a href$='${o[e]}' target="_blank">${i[e]}</a>`}),a[e]&&h.push({title:`${t}${Si("text.issuerPublicKey")}`,value:a[e]}),s[e]&&h.push({title:`${t}${Si("text.transactionId")}`,value:s[e]})}const f="column"===l,d=h.map((e=>function({title:e,value:t,isDisplayColumn:n,renderInline:r=!1}){const i=["buv-c-certificate-details__group",n?"":"buv-c-certificate-details__group--row"].join(" "),o=["buv-c-certificate-details__title",n?"":"buv-o-text-11"].join(" "),a=["buv-c-certificate-details__value",r?"buv-c-certificate-details--inline":""].join(" ");return he`<div class$='${i}'>
|
|
1076
1076
|
<dt class$='${o}'>${e}</dt>
|
|
1077
1077
|
<dd class$='${a}'>${t}</dd>
|
|
1078
|
-
</div>`}(Object.assign(Object.assign({},e),{isDisplayColumn:
|
|
1078
|
+
</div>`}(Object.assign(Object.assign({},e),{isDisplayColumn:f})))),p=["buv-c-certificate-details","buv-o-text-13",f?"buv-c-certificate-details--column":""].join(" ");return he`
|
|
1079
1079
|
${FAe}
|
|
1080
|
-
<dl class$='${
|
|
1081
|
-
${
|
|
1080
|
+
<dl class$='${p}'>
|
|
1081
|
+
${d}
|
|
1082
1082
|
</dl>
|
|
1083
|
-
`}),{mapStateToProps:e=>({recipientName:wle(e),issueDate:Ile(e),issuedOn:vle(e),issuerName:Ble(e),transactionId:_le(e),issuerPublicKey:Tle(e),issuerProfileDomain:Ole(e),issuerProfileUrl:Rle(e),signatureSuiteType:Hle(e)}),ownProps:{direction:String,hideRecipientName:Boolean}});window.customElements.define("buv-certificate-details",
|
|
1083
|
+
`}),{mapStateToProps:e=>({recipientName:wle(e),issueDate:Ile(e),issuedOn:vle(e),issuerName:Ble(e),transactionId:_le(e),issuerPublicKey:Tle(e),issuerProfileDomain:Ole(e),issuerProfileUrl:Rle(e),signatureSuiteType:Hle(e),chain:Nle(e)}),ownProps:{direction:String,hideRecipientName:Boolean}});window.customElements.define("buv-certificate-details",LAe);var TAe=he`<style>.buv-o-text-11{font-size:11px}.buv-o-text-12{font-size:12px}.buv-o-text-13{font-size:13px}.buv-o-text-15{font-size:15px;line-height:20px}.buv-o-text-bold{font-weight:bold}.buv-o-text-11{font-size:11px}.buv-o-text-12{font-size:12px}.buv-o-text-13{font-size:13px}.buv-o-text-15{font-size:15px;line-height:20px}.buv-o-text-bold{font-weight:bold}.buv-c-certificate--fixed-width{max-width:460px;min-width:0;margin:0 auto}.buv-c-full-certificate{box-shadow:0 1px 5px rgba(0,0,0,.15);padding:20px;background-color:#fff;display:block;font-family:serif;text-align:center;color:#49555f;font-size:12px;overflow:auto;word-wrap:break-word;height:100vh;max-height:calc(100vh - 150px);line-height:initial}.buv-c-full-certificate section{max-width:100%;padding:0}.buv-c-full-certificate img{max-width:100%;height:auto;width:inherit}@media only screen and (min-width: 640px){.buv-c-full-certificate{font-size:16px}}.buv-c-full-certificate__button{margin-top:15px}.buv-c-full-certificate__details{display:flex;justify-content:space-between;margin-top:15px}.buv-c-full-certificate__details-list{min-width:calc(100% - 190px);width:calc(100% - 105px)}.buv-c-full-certificate .buv-c-full-certificate-img{max-width:125px;max-height:125px}.buv-c-full-certificate__titles::before,.buv-c-full-certificate__titles::after{content:" ";display:block;background-color:#edf1f4;width:30%;text-align:center;margin:20px auto;height:2px}.buv-c-full-certificate__title{font-weight:normal;margin:0}.buv-c-full-certificate__title--name{color:#000;font-size:30px;margin-bottom:10px}.buv-c-full-certificate__title--main{font-size:21px;margin-bottom:10px}.buv-c-full-certificate__title--sub{font-size:16px;font-style:italic}.buv-c-full-certificate__description{margin:0 0 40px;line-height:1.5}.buv-c-full-certificate-signatures{list-style-type:none;display:flex;justify-content:space-around;width:100%;margin:0 0 20px;padding:0}.buv-c-full-certificate-signatures__signature{margin-right:30px;display:flex;flex-direction:column;justify-content:center}.buv-c-full-certificate-signatures__signature:last-child{margin:0}.buv-c-full-certificate-img--secondary{max-width:150px;max-height:150px}</style>`;const RAe=eue((function({hasCertificateDefinition:e,certificateImage:t,certificateTitle:n,certificateSeal:r,certificateSignatures:i,certificateSubtitle:o,certificateDescription:a,recipientName:s,issuerName:l}){if(!e)return null;const u=i.map((e=>he`
|
|
1084
1084
|
<li class='buv-c-full-certificate-signatures__signature'>
|
|
1085
1085
|
<img class='buv-c-full-certificate-img--secondary' src='${e.image}' alt='${Si("text.signed")} ${e.jobTitle}'/>
|
|
1086
1086
|
<span class='buv-o-text-12'>${e.jobTitle}</span>
|
|
1087
1087
|
</li>
|
|
1088
1088
|
`));return he`
|
|
1089
|
-
${
|
|
1089
|
+
${TAe}
|
|
1090
1090
|
<section class='buv-c-full-certificate'>
|
|
1091
1091
|
<img class='buv-c-full-certificate-img' src='${t}' alt='${n}'/>
|
|
1092
1092
|
<div class='buv-c-full-certificate__titles'>
|
|
@@ -1100,17 +1100,17 @@ const NAe=e=>(e=>(e.__litDirective=!0,e))((t=>{const n=document.createElement("t
|
|
|
1100
1100
|
</ul>
|
|
1101
1101
|
<img class='buv-c-full-certificate-img--secondary' src='${r}' alt='${Si("text.certified")} ${l}'/>
|
|
1102
1102
|
</section>
|
|
1103
|
-
`}),{mapStateToProps:e=>({hasCertificateDefinition:!!yle(e),certificateImage:jle(e),certificateTitle:ble(e),certificateSubtitle:Gle(e),certificateDescription:qle(e),certificateSeal:zle(e),certificateSignatures:Vle(e),recipientName:wle(e),issuerName:Ble(e)})});function RAe(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function OAe(e,t){for(var n=e.length-1;n>=0;n--)!0===t(e[n])&&e.splice(n,1)}function HAe(e){throw new Error("Unhandled case for value: '".concat(e,"'"))}window.customElements.define("buv-full-certificate-v1",TAe);var KAe=function(){function e(e){void 0===e&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return e.prototype.setTagName=function(e){return this.tagName=e,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(e,t){return this.getAttrs()[e]=t,this},e.prototype.getAttr=function(e){return this.getAttrs()[e]},e.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(e){return this.setAttr("class",e)},e.prototype.addClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],o=e.split(r);t=o.shift();)-1===RAe(i,t)&&i.push(t);return this.getAttrs().class=i.join(" "),this},e.prototype.removeClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],o=e.split(r);i.length&&(t=o.shift());){var a=RAe(i,t);-1!==a&&i.splice(a,1)}return this.getAttrs().class=i.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},e.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},e.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var e=this.getTagName(),t=this.buildAttrsStr();return["<",e,t=t?" "+t:"",">",this.getInnerHtml(),"</",e,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n+'="'+e[n]+'"');return t.join(" ")},e}();var jAe,GAe=function(){function e(e){void 0===e&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return e.prototype.build=function(e){return new KAe({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},e.prototype.createAttrs=function(e){var t={href:e.getAnchorHref()},n=this.createCssClass(e);return n&&(t.class=n),this.newWindow&&(t.target="_blank",t.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(t.title=e.getAnchorHref()),t},e.prototype.createCssClass=function(e){var t=this.className;if(t){for(var n=[t],r=e.getCssClassSuffixes(),i=0,o=r.length;i<o;i++)n.push(t+"-"+r[i]);return n.join(" ")}return""},e.prototype.processAnchorText=function(e){return e=this.doTruncate(e)},e.prototype.doTruncate=function(e){var t=this.truncate;if(!t||!t.length)return e;var n=t.length,r=t.location;return"smart"===r?function(e,t,n){var r,i;null==n?(n="…",i=3,r=8):(i=n.length,r=n.length);var o=function(e){var t="";return e.scheme&&e.host&&(t+=e.scheme+"://"),e.host&&(t+=e.host),e.path&&(t+="/"+e.path),e.query&&(t+="?"+e.query),e.fragment&&(t+="#"+e.fragment),t},a=function(e,t){var r=t/2,i=Math.ceil(r),o=-1*Math.floor(r),a="";return o<0&&(a=e.substr(o)),e.substr(0,i)+n+a};if(e.length<=t)return e;var s=t-i,l=function(e){var t={},n=e,r=n.match(/^([a-z]+):\/\//i);return r&&(t.scheme=r[1],n=n.substr(r[0].length)),(r=n.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(t.host=r[1],n=n.substr(r[0].length)),(r=n.match(/^\/(.*?)(?=(\?|#|$))/i))&&(t.path=r[1],n=n.substr(r[0].length)),(r=n.match(/^\?(.*?)(?=(#|$))/i))&&(t.query=r[1],n=n.substr(r[0].length)),(r=n.match(/^#(.*?)$/i))&&(t.fragment=r[1]),t}(e);if(l.query){var u=l.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);u&&(l.query=l.query.substr(0,u[1].length),e=o(l))}if(e.length<=t)return e;if(l.host&&(l.host=l.host.replace(/^www\./,""),e=o(l)),e.length<=t)return e;var A="";if(l.host&&(A+=l.host),A.length>=s)return l.host.length==t?(l.host.substr(0,t-i)+n).substr(0,s+r):a(A,s).substr(0,s+r);var c="";if(l.path&&(c+="/"+l.path),l.query&&(c+="?"+l.query),c){if((A+c).length>=s)return(A+c).length==t?(A+c).substr(0,t):(A+a(c,s-A.length)).substr(0,s+r);A+=c}if(l.fragment){var h="#"+l.fragment;if((A+h).length>=s)return(A+h).length==t?(A+h).substr(0,t):(A+a(h,s-A.length)).substr(0,s+r);A+=h}if(l.scheme&&l.host){var f=l.scheme+"://";if((A+f).length<s)return(f+A).substr(0,t)}if(A.length<=t)return A;var d="";return s>0&&(d=A.substr(-1*Math.floor(s/2))),(A.substr(0,Math.ceil(s/2))+n+d).substr(0,s+r)}(e,n):"middle"===r?function(e,t,n){if(e.length<=t)return e;var r,i;null==n?(n="…",r=8,i=3):(r=n.length,i=n.length);var o=t-i,a="";return o>0&&(a=e.substr(-1*Math.floor(o/2))),(e.substr(0,Math.ceil(o/2))+n+a).substr(0,o+r)}(e,n):function(e,t,n){return function(e,t,n){var r;return e.length>t&&(null==n?(n="…",r=3):r=n.length,e=e.substring(0,t-r)+n),e}(e,t,n)}(e,n)},e}(),qAe=function(){function e(e){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return e.prototype.getMatchedText=function(){return this.matchedText},e.prototype.setOffset=function(e){this.offset=e},e.prototype.getOffset=function(){return this.offset},e.prototype.getCssClassSuffixes=function(){return[this.getType()]},e.prototype.buildTag=function(){return this.tagBuilder.build(this)},e}(),VAe=function(e){function t(t){var n=e.call(this,t)||this;return n.email="",n.email=t.email,n}return et(t,e),t.prototype.getType=function(){return"email"},t.prototype.getEmail=function(){return this.email},t.prototype.getAnchorHref=function(){return"mailto:"+this.email},t.prototype.getAnchorText=function(){return this.email},t}(qAe),zAe=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="",n.hashtag="",n.serviceName=t.serviceName,n.hashtag=t.hashtag,n}return et(t,e),t.prototype.getType=function(){return"hashtag"},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getHashtag=function(){return this.hashtag},t.prototype.getAnchorHref=function(){var e=this.serviceName,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;case"instagram":return"https://instagram.com/explore/tags/"+t;case"tiktok":return"https://www.tiktok.com/tag/"+t;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(qAe),JAe=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.mention="",n.mention=t.mention,n.serviceName=t.serviceName,n}return et(t,e),t.prototype.getType=function(){return"mention"},t.prototype.getMention=function(){return this.mention},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;case"tiktok":return"https://www.tiktok.com/@"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},t.prototype.getAnchorText=function(){return"@"+this.mention},t.prototype.getCssClassSuffixes=function(){var t=e.prototype.getCssClassSuffixes.call(this),n=this.getServiceName();return n&&t.push(n),t},t}(qAe),YAe=function(e){function t(t){var n=e.call(this,t)||this;return n.number="",n.plusSign=!1,n.number=t.number,n.plusSign=t.plusSign,n}return et(t,e),t.prototype.getType=function(){return"phone"},t.prototype.getPhoneNumber=function(){return this.number},t.prototype.getNumber=function(){return this.getPhoneNumber()},t.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},t.prototype.getAnchorText=function(){return this.matchedText},t}(qAe),XAe=function(e){function t(t){var n=e.call(this,t)||this;return n.url="",n.urlMatchType="scheme",n.protocolUrlMatch=!1,n.protocolRelativeMatch=!1,n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.schemePrefixRegex=/^(https?:\/\/)?/i,n.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,n.protocolRelativeRegex=/^\/\//,n.protocolPrepended=!1,n.urlMatchType=t.urlMatchType,n.url=t.url,n.protocolUrlMatch=t.protocolUrlMatch,n.protocolRelativeMatch=t.protocolRelativeMatch,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return et(t,e),t.prototype.getType=function(){return"url"},t.prototype.getUrlMatchType=function(){return this.urlMatchType},t.prototype.getUrl=function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},t.prototype.getAnchorHref=function(){return this.getUrl().replace(/&/g,"&")},t.prototype.getAnchorText=function(){var e=this.getMatchedText();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix.scheme&&(e=this.stripSchemePrefix(e)),this.stripPrefix.www&&(e=this.stripWwwPrefix(e)),this.stripTrailingSlash&&(e=this.removeTrailingSlash(e)),this.decodePercentEncoding&&(e=this.removePercentEncoding(e)),e},t.prototype.stripSchemePrefix=function(e){return e.replace(this.schemePrefixRegex,"")},t.prototype.stripWwwPrefix=function(e){return e.replace(this.wwwPrefixRegex,"$1")},t.prototype.stripProtocolRelativePrefix=function(e){return e.replace(this.protocolRelativeRegex,"")},t.prototype.removeTrailingSlash=function(e){return"/"===e.charAt(e.length-1)&&(e=e.slice(0,-1)),e},t.prototype.removePercentEncoding=function(e){var t=e.replace(/%22/gi,""").replace(/%26/gi,"&").replace(/%27/gi,"'").replace(/%3C/gi,"<").replace(/%3E/gi,">");try{return decodeURIComponent(t)}catch(e){return t}},t}(qAe),WAe=function(e){this.__jsduckDummyDocProp=null,this.tagBuilder=e.tagBuilder},ZAe=/[A-Za-z]/,$Ae=/[\d]/,ece=/[\D]/,tce=/\s/,nce=/['"]/,rce=/[\x00-\x1F\x7F]/,ice=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,oce=ice+/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source+/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,ace=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,sce=oce+ace,lce=oce+ace,uce="(?:["+ace+"]{1,3}\\.){3}["+ace+"]{1,3}",Ace="["+lce+"](?:["+lce+"\\-]{0,61}["+lce+"])?",cce=function(e){return"(?=("+Ace+"))\\"+e},hce=function(e){return"(?:"+cce(e)+"(?:\\."+cce(e+1)+"){0,126}|"+uce+")"},fce=new RegExp("[".concat(lce,"]")),dce=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbah1a3hjkrd|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--mgbcpq6gpa1a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq480n2rg|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|travelchannel|wolterskluwer|xn--cckwcxetd|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--4dbrk0ce|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nextdirect|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--q7ce6a|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--qxa6a|xn--tckwe|xn--vhquv|yodobashi|موريتانيا|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|البحرين|الجزائر|العليان|پاکستان|كاثوليك|இந்தியா|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|ישראל|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|アマゾン|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ລາວ|ストア|セール|みんな|中文网|亚马逊|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|ευ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|广东|微博|慈善|手机|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,pce=new RegExp("[".concat(lce,"!#$%&'*+/=?^_`{|}~-]")),gce=new RegExp("^".concat(dce.source,"$")),yce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.localPartCharRegex=pce,t.strictTldRegex=gce,t}return et(t,e),t.prototype.parseMatches=function(e){for(var t=this.tagBuilder,n=this.localPartCharRegex,r=this.strictTldRegex,i=[],o=e.length,a=new mce,s={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},l=0,u=0,A=a;l<o;){var c=e.charAt(l);switch(u){case 0:h(c);break;case 1:f(e.charAt(l-1),c);break;case 2:d(c);break;case 3:p(c);break;case 4:g(c);break;case 5:y(c);break;case 6:m(c);break;case 7:v(c);break;default:HAe(u)}l++}return b(),i;function h(e){"m"===e?I(1):n.test(e)&&I()}function f(e,t){":"===e?n.test(t)?(u=2,A=new mce(tt(tt({},A),{hasMailtoPrefix:!0}))):w():s[e]===t||(n.test(t)?u=2:"."===t?u=3:"@"===t?u=4:w())}function d(e){"."===e?u=3:"@"===e?u=4:n.test(e)||w()}function p(e){"."===e||"@"===e?w():n.test(e)?u=2:w()}function g(e){fce.test(e)?u=5:w()}function y(e){"."===e?u=7:"-"===e?u=6:fce.test(e)||b()}function m(e){"-"===e||"."===e?b():fce.test(e)?u=5:b()}function v(e){"."===e||"-"===e?b():fce.test(e)?(u=5,A=new mce(tt(tt({},A),{hasDomainDot:!0}))):b()}function I(e){void 0===e&&(e=2),u=e,A=new mce({idx:l})}function w(){u=0,A=a}function b(){if(A.hasDomainDot){var n=e.slice(A.idx,l);/[-.]$/.test(n)&&(n=n.slice(0,-1));var o=A.hasMailtoPrefix?n.slice("mailto:".length):n;(function(e){var t=(e.split(".").pop()||"").toLowerCase();return r.test(t)})(o)&&i.push(new VAe({tagBuilder:t,matchedText:n,offset:A.idx,email:o}))}w()}},t}(WAe),mce=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.hasMailtoPrefix=!!e.hasMailtoPrefix,this.hasDomainDot=!!e.hasDomainDot},vce=function(){function e(){}return e.isValid=function(e,t){return!(t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)&&!this.isValidIpAddress(e)||this.containsMultipleDots(e))},e.isValidIpAddress=function(e){var t=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return null!==e.match(t)},e.containsMultipleDots=function(e){var t=e;return this.hasFullProtocolRegex.test(e)&&(t=e.split("://")[1]),t.split("/")[0].indexOf("..")>-1},e.isValidUriScheme=function(e){var t=e.match(this.uriSchemeRegex),n=t&&t[0].toLowerCase();return"javascript:"!==n&&"vbscript:"!==n},e.urlMatchDoesNotHaveProtocolOrDot=function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},e.urlMatchDoesNotHaveAtLeastOneWordChar=function(e,t){return!(!e||!t)&&(!this.hasFullProtocolRegex.test(t)&&!this.hasWordCharAfterProtocolRegex.test(e))},e.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,e.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,e.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+ice+"]"),e.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/,e}(),Ice=(jAe=new RegExp("[/?#](?:["+lce+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+lce+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,hce(2),")","|","(","(//)?",/(?:www\.)/.source,hce(6),")","|","(","(//)?",hce(10)+"\\.",dce.source,"(?![-"+sce+"])",")",")","(?::[0-9]+)?","(?:"+jAe.source+")?"].join(""),"gi")),wce=new RegExp("["+lce+"]"),bce=function(e){function t(t){var n=e.call(this,t)||this;return n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.matcherRegex=Ice,n.wordCharRegExp=wce,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return et(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.stripPrefix,i=this.stripTrailingSlash,o=this.decodePercentEncoding,a=this.tagBuilder,s=[],l=function(){var n=t[0],l=t[1],A=t[4],c=t[5],h=t[9],f=t.index,d=c||h,p=e.charAt(f-1);if(!vce.isValid(n,l))return"continue";if(f>0&&"@"===p)return"continue";if(f>0&&d&&u.wordCharRegExp.test(p))return"continue";if(/\?$/.test(n)&&(n=n.substr(0,n.length-1)),u.matchHasUnbalancedClosingParen(n))n=n.substr(0,n.length-1);else{var g=u.matchHasInvalidCharAfterTld(n,l);g>-1&&(n=n.substr(0,g))}var y=["http://","https://"].find((function(e){return!!l&&-1!==l.indexOf(e)}));if(y){var m=n.indexOf(y);n=n.substr(m),l=l.substr(m),f+=m}var v=l?"scheme":A?"www":"tld",I=!!l;s.push(new XAe({tagBuilder:a,matchedText:n,offset:f,urlMatchType:v,url:n,protocolUrlMatch:I,protocolRelativeMatch:!!d,stripPrefix:r,stripTrailingSlash:i,decodePercentEncoding:o}))},u=this;null!==(t=n.exec(e));)l();return s},t.prototype.matchHasUnbalancedClosingParen=function(e){var t,n=e.charAt(e.length-1);if(")"===n)t="(";else if("]"===n)t="[";else{if("}"!==n)return!1;t="{"}for(var r=0,i=0,o=e.length-1;i<o;i++){var a=e.charAt(i);a===t?r++:a===n&&(r=Math.max(r-1,0))}return 0===r},t.prototype.matchHasInvalidCharAfterTld=function(e,t){if(!e)return-1;var n=0;t&&(n=e.indexOf(":"),e=e.slice(n));var r=new RegExp("^((.?//)?[-."+lce+"]*[-"+lce+"]\\.[-"+lce+"]+)").exec(e);return null===r?-1:(n+=r[1].length,e=e.slice(r[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?n:-1)},t}(WAe),Bce=new RegExp("#[_".concat(lce,"]{1,139}(?![_").concat(lce,"])"),"g"),Ece=new RegExp("[^"+lce+"]"),Cce=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegex=Bce,n.nonWordCharRegex=Ece,n.serviceName=t.serviceName,n}return et(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.nonWordCharRegex,i=this.serviceName,o=this.tagBuilder,a=[];null!==(t=n.exec(e));){var s=t.index,l=e.charAt(s-1);if(0===s||r.test(l)){var u=t[0],A=t[0].slice(1);a.push(new zAe({tagBuilder:o,matchedText:u,offset:s,serviceName:i,hashtag:A}))}}return a},t}(WAe),Sce=new RegExp("".concat(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source,"|").concat(/(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source),"g"),xce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.matcherRegex=Sce,t}return et(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.tagBuilder,i=[];null!==(t=n.exec(e));){var o=t[0],a=o.replace(/[^0-9,;#]/g,""),s=!(!t[1]&&!t[2]),l=0==t.index?"":e.substr(t.index-1,1),u=e.substr(t.index+o.length,1),A=!l.match(/\d/)&&!u.match(/\d/);this.testMatch(t[3])&&this.testMatch(o)&&A&&i.push(new YAe({tagBuilder:r,matchedText:o,offset:t.index,number:a,plusSign:s}))}return i},t.prototype.testMatch=function(e){return ece.test(e)},t}(WAe),Qce=new RegExp("@[_".concat(lce,"]{1,50}(?![_").concat(lce,"])"),"g"),kce=new RegExp("@[_.".concat(lce,"]{1,30}(?![_").concat(lce,"])"),"g"),_ce=new RegExp("@[-_.".concat(lce,"]{1,50}(?![-_").concat(lce,"])"),"g"),Nce=new RegExp("@[_.".concat(lce,"]{1,23}[_").concat(lce,"](?![_").concat(lce,"])"),"g"),Dce=new RegExp("[^"+lce+"]"),Fce=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegexes={twitter:Qce,instagram:kce,soundcloud:_ce,tiktok:Nce},n.nonWordCharRegex=Dce,n.serviceName=t.serviceName,n}return et(t,e),t.prototype.parseMatches=function(e){var t,n=this.serviceName,r=this.matcherRegexes[this.serviceName],i=this.nonWordCharRegex,o=this.tagBuilder,a=[];if(!r)return a;for(;null!==(t=r.exec(e));){var s=t.index,l=e.charAt(s-1);if(0===s||i.test(l)){var u=t[0].replace(/\.+$/g,""),A=u.slice(1);a.push(new JAe({tagBuilder:o,matchedText:u,offset:s,serviceName:n,mention:A}))}}return a},t}(WAe);function Pce(e,t){for(var n,r=t.onOpenTag,i=t.onCloseTag,o=t.onText,a=t.onComment,s=t.onDoctype,l=new Uce,u=0,A=e.length,c=0,h=0,f=l;u<A;){var d=e.charAt(u);switch(c){case 0:p(d);break;case 1:g(d);break;case 2:m(d);break;case 3:y(d);break;case 4:v(d);break;case 5:I(d);break;case 6:w(d);break;case 7:b(d);break;case 8:B(d);break;case 9:E(d);break;case 10:C(d);break;case 11:S(d);break;case 12:x(d);break;case 13:Q();break;case 14:k(d);break;case 15:_(d);break;case 16:N(d);break;case 17:D(d);break;case 18:F(d);break;case 19:P(d);break;case 20:U(d);break;default:HAe(c)}u++}function p(e){"<"===e&&L()}function g(e){"!"===e?c=13:"/"===e?(c=2,f=new Uce(tt(tt({},f),{isClosing:!0}))):"<"===e?L():ZAe.test(e)?(c=3,f=new Uce(tt(tt({},f),{isOpening:!0}))):(c=0,f=l)}function y(e){tce.test(e)?(f=new Uce(tt(tt({},f),{name:R()})),c=4):"<"===e?L():"/"===e?(f=new Uce(tt(tt({},f),{name:R()})),c=12):">"===e?(f=new Uce(tt(tt({},f),{name:R()})),T()):ZAe.test(e)||$Ae.test(e)||":"===e||M()}function m(e){">"===e?M():ZAe.test(e)?c=3:M()}function v(e){tce.test(e)||("/"===e?c=12:">"===e?T():"<"===e?L():"="===e||nce.test(e)||rce.test(e)?M():c=5)}function I(e){tce.test(e)?c=6:"/"===e?c=12:"="===e?c=7:">"===e?T():"<"===e?L():nce.test(e)&&M()}function w(e){tce.test(e)||("/"===e?c=12:"="===e?c=7:">"===e?T():"<"===e?L():nce.test(e)?M():c=5)}function b(e){tce.test(e)||('"'===e?c=8:"'"===e?c=9:/[>=`]/.test(e)?M():"<"===e?L():c=10)}function B(e){'"'===e&&(c=11)}function E(e){"'"===e&&(c=11)}function C(e){tce.test(e)?c=4:">"===e?T():"<"===e&&L()}function S(e){tce.test(e)?c=4:"/"===e?c=12:">"===e?T():"<"===e?L():(c=4,u--)}function x(e){">"===e?(f=new Uce(tt(tt({},f),{isClosing:!0})),T()):c=4}function Q(t){"--"===e.substr(u,2)?(u+=2,f=new Uce(tt(tt({},f),{type:"comment"})),c=14):"DOCTYPE"===e.substr(u,7).toUpperCase()?(u+=7,f=new Uce(tt(tt({},f),{type:"doctype"})),c=20):M()}function k(e){"-"===e?c=15:">"===e?M():c=16}function _(e){"-"===e?c=18:">"===e?M():c=16}function N(e){"-"===e&&(c=17)}function D(e){c="-"===e?18:16}function F(e){">"===e?T():"!"===e?c=19:"-"===e||(c=16)}function P(e){"-"===e?c=17:">"===e?T():c=16}function U(e){">"===e?T():"<"===e&&L()}function M(){c=0,f=l}function L(){c=1,f=new Uce({idx:u})}function T(){var t=e.slice(h,f.idx);t&&o(t,h),"comment"===f.type?a(f.idx):"doctype"===f.type?s(f.idx):(f.isOpening&&r(f.name,f.idx),f.isClosing&&i(f.name,f.idx)),M(),h=u+1}function R(){var t=f.idx+(f.isClosing?2:1);return e.slice(t,u).toLowerCase()}h<u&&(n=e.slice(h,u),o(n,h),h=u+1)}var Uce=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.type=e.type||"tag",this.name=e.name||"",this.isOpening=!!e.isOpening,this.isClosing=!!e.isClosing},Mce=function(){function e(t){void 0===t&&(t={}),this.version=e.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.matchers=null,this.tagBuilder=null,this.urls=this.normalizeUrlsCfg(t.urls),this.email="boolean"==typeof t.email?t.email:this.email,this.phone="boolean"==typeof t.phone?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow="boolean"==typeof t.newWindow?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash="boolean"==typeof t.stripTrailingSlash?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding="boolean"==typeof t.decodePercentEncoding?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var n=this.mention;if(!1!==n&&-1===["twitter","instagram","soundcloud","tiktok"].indexOf(n))throw new Error("invalid `mention` cfg '".concat(n,"' - see docs"));var r=this.hashtag;if(!1!==r&&-1===["twitter","facebook","instagram","tiktok"].indexOf(r))throw new Error("invalid `hashtag` cfg '".concat(r,"' - see docs"));this.truncate=this.normalizeTruncateCfg(t.truncate),this.className=t.className||this.className,this.replaceFn=t.replaceFn||this.replaceFn,this.context=t.context||this}return e.link=function(t,n){return new e(n).link(t)},e.parse=function(t,n){return new e(n).parse(t)},e.prototype.normalizeUrlsCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{schemeMatches:e,wwwMatches:e,tldMatches:e}:{schemeMatches:"boolean"!=typeof e.schemeMatches||e.schemeMatches,wwwMatches:"boolean"!=typeof e.wwwMatches||e.wwwMatches,tldMatches:"boolean"!=typeof e.tldMatches||e.tldMatches}},e.prototype.normalizeStripPrefixCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{scheme:e,www:e}:{scheme:"boolean"!=typeof e.scheme||e.scheme,www:"boolean"!=typeof e.www||e.www}},e.prototype.normalizeTruncateCfg=function(e){return"number"==typeof e?{length:e,location:"end"}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&void 0===e[n]&&(e[n]=t[n]);return e}(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})},e.prototype.parse=function(e){var t=this,n=["a","style","script"],r=0,i=[];return Pce(e,{onOpenTag:function(e){n.indexOf(e)>=0&&r++},onText:function(e,n){if(0===r){var o=function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var n,r=[],i=0;n=t.exec(e);)r.push(e.substring(i,n.index)),r.push(n[0]),i=n.index+n[0].length;return r.push(e.substring(i)),r}(e,/( | |<|<|>|>|"|"|')/gi),a=n;o.forEach((function(e,n){if(n%2==0){var r=t.parseText(e,a);i.push.apply(i,r)}a+=e.length}))}},onCloseTag:function(e){n.indexOf(e)>=0&&(r=Math.max(r-1,0))},onComment:function(e){},onDoctype:function(e){}}),i=this.compactMatches(i),i=this.removeUnwantedMatches(i)},e.prototype.compactMatches=function(e){e.sort((function(e,t){return e.getOffset()-t.getOffset()}));for(var t=0;t<e.length-1;){var n=e[t],r=n.getOffset(),i=n.getMatchedText().length,o=r+i;if(t+1<e.length){if(e[t+1].getOffset()===r){var a=e[t+1].getMatchedText().length>i?t:t+1;e.splice(a,1);continue}if(e[t+1].getOffset()<o){e.splice(t+1,1);continue}}t++}return e},e.prototype.removeUnwantedMatches=function(e){return this.hashtag||OAe(e,(function(e){return"hashtag"===e.getType()})),this.email||OAe(e,(function(e){return"email"===e.getType()})),this.phone||OAe(e,(function(e){return"phone"===e.getType()})),this.mention||OAe(e,(function(e){return"mention"===e.getType()})),this.urls.schemeMatches||OAe(e,(function(e){return"url"===e.getType()&&"scheme"===e.getUrlMatchType()})),this.urls.wwwMatches||OAe(e,(function(e){return"url"===e.getType()&&"www"===e.getUrlMatchType()})),this.urls.tldMatches||OAe(e,(function(e){return"url"===e.getType()&&"tld"===e.getUrlMatchType()})),e},e.prototype.parseText=function(e,t){void 0===t&&(t=0),t=t||0;for(var n=this.getMatchers(),r=[],i=0,o=n.length;i<o;i++){for(var a=n[i].parseMatches(e),s=0,l=a.length;s<l;s++)a[s].setOffset(t+a[s].getOffset());r.push.apply(r,a)}return r},e.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"<").replace(/>/g,">"));for(var t=this.parse(e),n=[],r=0,i=0,o=t.length;i<o;i++){var a=t[i];n.push(e.substring(r,a.getOffset())),n.push(this.createMatchReturnVal(a)),r=a.getOffset()+a.getMatchedText().length}return n.push(e.substring(r)),n.join("")},e.prototype.createMatchReturnVal=function(e){var t;return this.replaceFn&&(t=this.replaceFn.call(this.context,e)),"string"==typeof t?t:!1===t?e.getMatchedText():t instanceof KAe?t.toAnchorString():e.buildTag().toAnchorString()},e.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var e=this.getTagBuilder(),t=[new Cce({tagBuilder:e,serviceName:this.hashtag}),new yce({tagBuilder:e}),new xce({tagBuilder:e}),new Fce({tagBuilder:e,serviceName:this.mention}),new bce({tagBuilder:e,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=t},e.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new GAe({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},e.version="3.15.0",e.AnchorTagBuilder=GAe,e.HtmlTag=KAe,e.matcher={Email:yce,Hashtag:Cce,Matcher:WAe,Mention:Fce,Phone:xce,Url:bce},e.match={Email:VAe,Hashtag:zAe,Match:qAe,Mention:JAe,Phone:YAe,Url:XAe},e}();function Lce(e){return Mce.link(e,{stripPrefix:!1,email:!1,phone:!1})}const Tce=eue((function({clickableUrls:e,hasCertificateDefinition:t,displayHTML:n}){return t?he`
|
|
1103
|
+
`}),{mapStateToProps:e=>({hasCertificateDefinition:!!yle(e),certificateImage:jle(e),certificateTitle:ble(e),certificateSubtitle:Gle(e),certificateDescription:qle(e),certificateSeal:zle(e),certificateSignatures:Vle(e),recipientName:wle(e),issuerName:Ble(e)})});function OAe(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function HAe(e,t){for(var n=e.length-1;n>=0;n--)!0===t(e[n])&&e.splice(n,1)}function KAe(e){throw new Error("Unhandled case for value: '".concat(e,"'"))}window.customElements.define("buv-full-certificate-v1",RAe);var jAe=function(){function e(e){void 0===e&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return e.prototype.setTagName=function(e){return this.tagName=e,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(e,t){return this.getAttrs()[e]=t,this},e.prototype.getAttr=function(e){return this.getAttrs()[e]},e.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(e){return this.setAttr("class",e)},e.prototype.addClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],o=e.split(r);t=o.shift();)-1===OAe(i,t)&&i.push(t);return this.getAttrs().class=i.join(" "),this},e.prototype.removeClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],o=e.split(r);i.length&&(t=o.shift());){var a=OAe(i,t);-1!==a&&i.splice(a,1)}return this.getAttrs().class=i.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},e.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},e.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var e=this.getTagName(),t=this.buildAttrsStr();return["<",e,t=t?" "+t:"",">",this.getInnerHtml(),"</",e,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n+'="'+e[n]+'"');return t.join(" ")},e}();var GAe,qAe=function(){function e(e){void 0===e&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return e.prototype.build=function(e){return new jAe({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},e.prototype.createAttrs=function(e){var t={href:e.getAnchorHref()},n=this.createCssClass(e);return n&&(t.class=n),this.newWindow&&(t.target="_blank",t.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(t.title=e.getAnchorHref()),t},e.prototype.createCssClass=function(e){var t=this.className;if(t){for(var n=[t],r=e.getCssClassSuffixes(),i=0,o=r.length;i<o;i++)n.push(t+"-"+r[i]);return n.join(" ")}return""},e.prototype.processAnchorText=function(e){return e=this.doTruncate(e)},e.prototype.doTruncate=function(e){var t=this.truncate;if(!t||!t.length)return e;var n=t.length,r=t.location;return"smart"===r?function(e,t,n){var r,i;null==n?(n="…",i=3,r=8):(i=n.length,r=n.length);var o=function(e){var t="";return e.scheme&&e.host&&(t+=e.scheme+"://"),e.host&&(t+=e.host),e.path&&(t+="/"+e.path),e.query&&(t+="?"+e.query),e.fragment&&(t+="#"+e.fragment),t},a=function(e,t){var r=t/2,i=Math.ceil(r),o=-1*Math.floor(r),a="";return o<0&&(a=e.substr(o)),e.substr(0,i)+n+a};if(e.length<=t)return e;var s=t-i,l=function(e){var t={},n=e,r=n.match(/^([a-z]+):\/\//i);return r&&(t.scheme=r[1],n=n.substr(r[0].length)),(r=n.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(t.host=r[1],n=n.substr(r[0].length)),(r=n.match(/^\/(.*?)(?=(\?|#|$))/i))&&(t.path=r[1],n=n.substr(r[0].length)),(r=n.match(/^\?(.*?)(?=(#|$))/i))&&(t.query=r[1],n=n.substr(r[0].length)),(r=n.match(/^#(.*?)$/i))&&(t.fragment=r[1]),t}(e);if(l.query){var u=l.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);u&&(l.query=l.query.substr(0,u[1].length),e=o(l))}if(e.length<=t)return e;if(l.host&&(l.host=l.host.replace(/^www\./,""),e=o(l)),e.length<=t)return e;var A="";if(l.host&&(A+=l.host),A.length>=s)return l.host.length==t?(l.host.substr(0,t-i)+n).substr(0,s+r):a(A,s).substr(0,s+r);var c="";if(l.path&&(c+="/"+l.path),l.query&&(c+="?"+l.query),c){if((A+c).length>=s)return(A+c).length==t?(A+c).substr(0,t):(A+a(c,s-A.length)).substr(0,s+r);A+=c}if(l.fragment){var h="#"+l.fragment;if((A+h).length>=s)return(A+h).length==t?(A+h).substr(0,t):(A+a(h,s-A.length)).substr(0,s+r);A+=h}if(l.scheme&&l.host){var f=l.scheme+"://";if((A+f).length<s)return(f+A).substr(0,t)}if(A.length<=t)return A;var d="";return s>0&&(d=A.substr(-1*Math.floor(s/2))),(A.substr(0,Math.ceil(s/2))+n+d).substr(0,s+r)}(e,n):"middle"===r?function(e,t,n){if(e.length<=t)return e;var r,i;null==n?(n="…",r=8,i=3):(r=n.length,i=n.length);var o=t-i,a="";return o>0&&(a=e.substr(-1*Math.floor(o/2))),(e.substr(0,Math.ceil(o/2))+n+a).substr(0,o+r)}(e,n):function(e,t,n){return function(e,t,n){var r;return e.length>t&&(null==n?(n="…",r=3):r=n.length,e=e.substring(0,t-r)+n),e}(e,t,n)}(e,n)},e}(),VAe=function(){function e(e){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return e.prototype.getMatchedText=function(){return this.matchedText},e.prototype.setOffset=function(e){this.offset=e},e.prototype.getOffset=function(){return this.offset},e.prototype.getCssClassSuffixes=function(){return[this.getType()]},e.prototype.buildTag=function(){return this.tagBuilder.build(this)},e}(),zAe=function(e){function t(t){var n=e.call(this,t)||this;return n.email="",n.email=t.email,n}return et(t,e),t.prototype.getType=function(){return"email"},t.prototype.getEmail=function(){return this.email},t.prototype.getAnchorHref=function(){return"mailto:"+this.email},t.prototype.getAnchorText=function(){return this.email},t}(VAe),JAe=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="",n.hashtag="",n.serviceName=t.serviceName,n.hashtag=t.hashtag,n}return et(t,e),t.prototype.getType=function(){return"hashtag"},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getHashtag=function(){return this.hashtag},t.prototype.getAnchorHref=function(){var e=this.serviceName,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;case"instagram":return"https://instagram.com/explore/tags/"+t;case"tiktok":return"https://www.tiktok.com/tag/"+t;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(VAe),YAe=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.mention="",n.mention=t.mention,n.serviceName=t.serviceName,n}return et(t,e),t.prototype.getType=function(){return"mention"},t.prototype.getMention=function(){return this.mention},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;case"tiktok":return"https://www.tiktok.com/@"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},t.prototype.getAnchorText=function(){return"@"+this.mention},t.prototype.getCssClassSuffixes=function(){var t=e.prototype.getCssClassSuffixes.call(this),n=this.getServiceName();return n&&t.push(n),t},t}(VAe),XAe=function(e){function t(t){var n=e.call(this,t)||this;return n.number="",n.plusSign=!1,n.number=t.number,n.plusSign=t.plusSign,n}return et(t,e),t.prototype.getType=function(){return"phone"},t.prototype.getPhoneNumber=function(){return this.number},t.prototype.getNumber=function(){return this.getPhoneNumber()},t.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},t.prototype.getAnchorText=function(){return this.matchedText},t}(VAe),WAe=function(e){function t(t){var n=e.call(this,t)||this;return n.url="",n.urlMatchType="scheme",n.protocolUrlMatch=!1,n.protocolRelativeMatch=!1,n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.schemePrefixRegex=/^(https?:\/\/)?/i,n.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,n.protocolRelativeRegex=/^\/\//,n.protocolPrepended=!1,n.urlMatchType=t.urlMatchType,n.url=t.url,n.protocolUrlMatch=t.protocolUrlMatch,n.protocolRelativeMatch=t.protocolRelativeMatch,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return et(t,e),t.prototype.getType=function(){return"url"},t.prototype.getUrlMatchType=function(){return this.urlMatchType},t.prototype.getUrl=function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},t.prototype.getAnchorHref=function(){return this.getUrl().replace(/&/g,"&")},t.prototype.getAnchorText=function(){var e=this.getMatchedText();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix.scheme&&(e=this.stripSchemePrefix(e)),this.stripPrefix.www&&(e=this.stripWwwPrefix(e)),this.stripTrailingSlash&&(e=this.removeTrailingSlash(e)),this.decodePercentEncoding&&(e=this.removePercentEncoding(e)),e},t.prototype.stripSchemePrefix=function(e){return e.replace(this.schemePrefixRegex,"")},t.prototype.stripWwwPrefix=function(e){return e.replace(this.wwwPrefixRegex,"$1")},t.prototype.stripProtocolRelativePrefix=function(e){return e.replace(this.protocolRelativeRegex,"")},t.prototype.removeTrailingSlash=function(e){return"/"===e.charAt(e.length-1)&&(e=e.slice(0,-1)),e},t.prototype.removePercentEncoding=function(e){var t=e.replace(/%22/gi,""").replace(/%26/gi,"&").replace(/%27/gi,"'").replace(/%3C/gi,"<").replace(/%3E/gi,">");try{return decodeURIComponent(t)}catch(e){return t}},t}(VAe),ZAe=function(e){this.__jsduckDummyDocProp=null,this.tagBuilder=e.tagBuilder},$Ae=/[A-Za-z]/,ece=/[\d]/,tce=/[\D]/,nce=/\s/,rce=/['"]/,ice=/[\x00-\x1F\x7F]/,oce=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,ace=oce+/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source+/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,sce=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,lce=ace+sce,uce=ace+sce,Ace="(?:["+sce+"]{1,3}\\.){3}["+sce+"]{1,3}",cce="["+uce+"](?:["+uce+"\\-]{0,61}["+uce+"])?",hce=function(e){return"(?=("+cce+"))\\"+e},fce=function(e){return"(?:"+hce(e)+"(?:\\."+hce(e+1)+"){0,126}|"+Ace+")"},dce=new RegExp("[".concat(uce,"]")),pce=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbah1a3hjkrd|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--mgbcpq6gpa1a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq480n2rg|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|travelchannel|wolterskluwer|xn--cckwcxetd|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--4dbrk0ce|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nextdirect|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--q7ce6a|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--qxa6a|xn--tckwe|xn--vhquv|yodobashi|موريتانيا|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|البحرين|الجزائر|العليان|پاکستان|كاثوليك|இந்தியா|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|ישראל|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|アマゾン|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ລາວ|ストア|セール|みんな|中文网|亚马逊|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|ευ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|广东|微博|慈善|手机|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,gce=new RegExp("[".concat(uce,"!#$%&'*+/=?^_`{|}~-]")),yce=new RegExp("^".concat(pce.source,"$")),mce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.localPartCharRegex=gce,t.strictTldRegex=yce,t}return et(t,e),t.prototype.parseMatches=function(e){for(var t=this.tagBuilder,n=this.localPartCharRegex,r=this.strictTldRegex,i=[],o=e.length,a=new vce,s={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},l=0,u=0,A=a;l<o;){var c=e.charAt(l);switch(u){case 0:h(c);break;case 1:f(e.charAt(l-1),c);break;case 2:d(c);break;case 3:p(c);break;case 4:g(c);break;case 5:y(c);break;case 6:m(c);break;case 7:v(c);break;default:KAe(u)}l++}return b(),i;function h(e){"m"===e?I(1):n.test(e)&&I()}function f(e,t){":"===e?n.test(t)?(u=2,A=new vce(tt(tt({},A),{hasMailtoPrefix:!0}))):w():s[e]===t||(n.test(t)?u=2:"."===t?u=3:"@"===t?u=4:w())}function d(e){"."===e?u=3:"@"===e?u=4:n.test(e)||w()}function p(e){"."===e||"@"===e?w():n.test(e)?u=2:w()}function g(e){dce.test(e)?u=5:w()}function y(e){"."===e?u=7:"-"===e?u=6:dce.test(e)||b()}function m(e){"-"===e||"."===e?b():dce.test(e)?u=5:b()}function v(e){"."===e||"-"===e?b():dce.test(e)?(u=5,A=new vce(tt(tt({},A),{hasDomainDot:!0}))):b()}function I(e){void 0===e&&(e=2),u=e,A=new vce({idx:l})}function w(){u=0,A=a}function b(){if(A.hasDomainDot){var n=e.slice(A.idx,l);/[-.]$/.test(n)&&(n=n.slice(0,-1));var o=A.hasMailtoPrefix?n.slice("mailto:".length):n;(function(e){var t=(e.split(".").pop()||"").toLowerCase();return r.test(t)})(o)&&i.push(new zAe({tagBuilder:t,matchedText:n,offset:A.idx,email:o}))}w()}},t}(ZAe),vce=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.hasMailtoPrefix=!!e.hasMailtoPrefix,this.hasDomainDot=!!e.hasDomainDot},Ice=function(){function e(){}return e.isValid=function(e,t){return!(t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)&&!this.isValidIpAddress(e)||this.containsMultipleDots(e))},e.isValidIpAddress=function(e){var t=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return null!==e.match(t)},e.containsMultipleDots=function(e){var t=e;return this.hasFullProtocolRegex.test(e)&&(t=e.split("://")[1]),t.split("/")[0].indexOf("..")>-1},e.isValidUriScheme=function(e){var t=e.match(this.uriSchemeRegex),n=t&&t[0].toLowerCase();return"javascript:"!==n&&"vbscript:"!==n},e.urlMatchDoesNotHaveProtocolOrDot=function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},e.urlMatchDoesNotHaveAtLeastOneWordChar=function(e,t){return!(!e||!t)&&(!this.hasFullProtocolRegex.test(t)&&!this.hasWordCharAfterProtocolRegex.test(e))},e.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,e.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,e.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+oce+"]"),e.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/,e}(),wce=(GAe=new RegExp("[/?#](?:["+uce+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+uce+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,fce(2),")","|","(","(//)?",/(?:www\.)/.source,fce(6),")","|","(","(//)?",fce(10)+"\\.",pce.source,"(?![-"+lce+"])",")",")","(?::[0-9]+)?","(?:"+GAe.source+")?"].join(""),"gi")),bce=new RegExp("["+uce+"]"),Bce=function(e){function t(t){var n=e.call(this,t)||this;return n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.matcherRegex=wce,n.wordCharRegExp=bce,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return et(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.stripPrefix,i=this.stripTrailingSlash,o=this.decodePercentEncoding,a=this.tagBuilder,s=[],l=function(){var n=t[0],l=t[1],A=t[4],c=t[5],h=t[9],f=t.index,d=c||h,p=e.charAt(f-1);if(!Ice.isValid(n,l))return"continue";if(f>0&&"@"===p)return"continue";if(f>0&&d&&u.wordCharRegExp.test(p))return"continue";if(/\?$/.test(n)&&(n=n.substr(0,n.length-1)),u.matchHasUnbalancedClosingParen(n))n=n.substr(0,n.length-1);else{var g=u.matchHasInvalidCharAfterTld(n,l);g>-1&&(n=n.substr(0,g))}var y=["http://","https://"].find((function(e){return!!l&&-1!==l.indexOf(e)}));if(y){var m=n.indexOf(y);n=n.substr(m),l=l.substr(m),f+=m}var v=l?"scheme":A?"www":"tld",I=!!l;s.push(new WAe({tagBuilder:a,matchedText:n,offset:f,urlMatchType:v,url:n,protocolUrlMatch:I,protocolRelativeMatch:!!d,stripPrefix:r,stripTrailingSlash:i,decodePercentEncoding:o}))},u=this;null!==(t=n.exec(e));)l();return s},t.prototype.matchHasUnbalancedClosingParen=function(e){var t,n=e.charAt(e.length-1);if(")"===n)t="(";else if("]"===n)t="[";else{if("}"!==n)return!1;t="{"}for(var r=0,i=0,o=e.length-1;i<o;i++){var a=e.charAt(i);a===t?r++:a===n&&(r=Math.max(r-1,0))}return 0===r},t.prototype.matchHasInvalidCharAfterTld=function(e,t){if(!e)return-1;var n=0;t&&(n=e.indexOf(":"),e=e.slice(n));var r=new RegExp("^((.?//)?[-."+uce+"]*[-"+uce+"]\\.[-"+uce+"]+)").exec(e);return null===r?-1:(n+=r[1].length,e=e.slice(r[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?n:-1)},t}(ZAe),Ece=new RegExp("#[_".concat(uce,"]{1,139}(?![_").concat(uce,"])"),"g"),Cce=new RegExp("[^"+uce+"]"),Sce=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegex=Ece,n.nonWordCharRegex=Cce,n.serviceName=t.serviceName,n}return et(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.nonWordCharRegex,i=this.serviceName,o=this.tagBuilder,a=[];null!==(t=n.exec(e));){var s=t.index,l=e.charAt(s-1);if(0===s||r.test(l)){var u=t[0],A=t[0].slice(1);a.push(new JAe({tagBuilder:o,matchedText:u,offset:s,serviceName:i,hashtag:A}))}}return a},t}(ZAe),xce=new RegExp("".concat(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source,"|").concat(/(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source),"g"),Qce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.matcherRegex=xce,t}return et(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.tagBuilder,i=[];null!==(t=n.exec(e));){var o=t[0],a=o.replace(/[^0-9,;#]/g,""),s=!(!t[1]&&!t[2]),l=0==t.index?"":e.substr(t.index-1,1),u=e.substr(t.index+o.length,1),A=!l.match(/\d/)&&!u.match(/\d/);this.testMatch(t[3])&&this.testMatch(o)&&A&&i.push(new XAe({tagBuilder:r,matchedText:o,offset:t.index,number:a,plusSign:s}))}return i},t.prototype.testMatch=function(e){return tce.test(e)},t}(ZAe),kce=new RegExp("@[_".concat(uce,"]{1,50}(?![_").concat(uce,"])"),"g"),_ce=new RegExp("@[_.".concat(uce,"]{1,30}(?![_").concat(uce,"])"),"g"),Nce=new RegExp("@[-_.".concat(uce,"]{1,50}(?![-_").concat(uce,"])"),"g"),Dce=new RegExp("@[_.".concat(uce,"]{1,23}[_").concat(uce,"](?![_").concat(uce,"])"),"g"),Fce=new RegExp("[^"+uce+"]"),Pce=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegexes={twitter:kce,instagram:_ce,soundcloud:Nce,tiktok:Dce},n.nonWordCharRegex=Fce,n.serviceName=t.serviceName,n}return et(t,e),t.prototype.parseMatches=function(e){var t,n=this.serviceName,r=this.matcherRegexes[this.serviceName],i=this.nonWordCharRegex,o=this.tagBuilder,a=[];if(!r)return a;for(;null!==(t=r.exec(e));){var s=t.index,l=e.charAt(s-1);if(0===s||i.test(l)){var u=t[0].replace(/\.+$/g,""),A=u.slice(1);a.push(new YAe({tagBuilder:o,matchedText:u,offset:s,serviceName:n,mention:A}))}}return a},t}(ZAe);function Uce(e,t){for(var n,r=t.onOpenTag,i=t.onCloseTag,o=t.onText,a=t.onComment,s=t.onDoctype,l=new Mce,u=0,A=e.length,c=0,h=0,f=l;u<A;){var d=e.charAt(u);switch(c){case 0:p(d);break;case 1:g(d);break;case 2:m(d);break;case 3:y(d);break;case 4:v(d);break;case 5:I(d);break;case 6:w(d);break;case 7:b(d);break;case 8:B(d);break;case 9:E(d);break;case 10:C(d);break;case 11:S(d);break;case 12:x(d);break;case 13:Q();break;case 14:k(d);break;case 15:_(d);break;case 16:N(d);break;case 17:D(d);break;case 18:F(d);break;case 19:P(d);break;case 20:U(d);break;default:KAe(c)}u++}function p(e){"<"===e&&L()}function g(e){"!"===e?c=13:"/"===e?(c=2,f=new Mce(tt(tt({},f),{isClosing:!0}))):"<"===e?L():$Ae.test(e)?(c=3,f=new Mce(tt(tt({},f),{isOpening:!0}))):(c=0,f=l)}function y(e){nce.test(e)?(f=new Mce(tt(tt({},f),{name:R()})),c=4):"<"===e?L():"/"===e?(f=new Mce(tt(tt({},f),{name:R()})),c=12):">"===e?(f=new Mce(tt(tt({},f),{name:R()})),T()):$Ae.test(e)||ece.test(e)||":"===e||M()}function m(e){">"===e?M():$Ae.test(e)?c=3:M()}function v(e){nce.test(e)||("/"===e?c=12:">"===e?T():"<"===e?L():"="===e||rce.test(e)||ice.test(e)?M():c=5)}function I(e){nce.test(e)?c=6:"/"===e?c=12:"="===e?c=7:">"===e?T():"<"===e?L():rce.test(e)&&M()}function w(e){nce.test(e)||("/"===e?c=12:"="===e?c=7:">"===e?T():"<"===e?L():rce.test(e)?M():c=5)}function b(e){nce.test(e)||('"'===e?c=8:"'"===e?c=9:/[>=`]/.test(e)?M():"<"===e?L():c=10)}function B(e){'"'===e&&(c=11)}function E(e){"'"===e&&(c=11)}function C(e){nce.test(e)?c=4:">"===e?T():"<"===e&&L()}function S(e){nce.test(e)?c=4:"/"===e?c=12:">"===e?T():"<"===e?L():(c=4,u--)}function x(e){">"===e?(f=new Mce(tt(tt({},f),{isClosing:!0})),T()):c=4}function Q(t){"--"===e.substr(u,2)?(u+=2,f=new Mce(tt(tt({},f),{type:"comment"})),c=14):"DOCTYPE"===e.substr(u,7).toUpperCase()?(u+=7,f=new Mce(tt(tt({},f),{type:"doctype"})),c=20):M()}function k(e){"-"===e?c=15:">"===e?M():c=16}function _(e){"-"===e?c=18:">"===e?M():c=16}function N(e){"-"===e&&(c=17)}function D(e){c="-"===e?18:16}function F(e){">"===e?T():"!"===e?c=19:"-"===e||(c=16)}function P(e){"-"===e?c=17:">"===e?T():c=16}function U(e){">"===e?T():"<"===e&&L()}function M(){c=0,f=l}function L(){c=1,f=new Mce({idx:u})}function T(){var t=e.slice(h,f.idx);t&&o(t,h),"comment"===f.type?a(f.idx):"doctype"===f.type?s(f.idx):(f.isOpening&&r(f.name,f.idx),f.isClosing&&i(f.name,f.idx)),M(),h=u+1}function R(){var t=f.idx+(f.isClosing?2:1);return e.slice(t,u).toLowerCase()}h<u&&(n=e.slice(h,u),o(n,h),h=u+1)}var Mce=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.type=e.type||"tag",this.name=e.name||"",this.isOpening=!!e.isOpening,this.isClosing=!!e.isClosing},Lce=function(){function e(t){void 0===t&&(t={}),this.version=e.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.matchers=null,this.tagBuilder=null,this.urls=this.normalizeUrlsCfg(t.urls),this.email="boolean"==typeof t.email?t.email:this.email,this.phone="boolean"==typeof t.phone?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow="boolean"==typeof t.newWindow?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash="boolean"==typeof t.stripTrailingSlash?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding="boolean"==typeof t.decodePercentEncoding?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var n=this.mention;if(!1!==n&&-1===["twitter","instagram","soundcloud","tiktok"].indexOf(n))throw new Error("invalid `mention` cfg '".concat(n,"' - see docs"));var r=this.hashtag;if(!1!==r&&-1===["twitter","facebook","instagram","tiktok"].indexOf(r))throw new Error("invalid `hashtag` cfg '".concat(r,"' - see docs"));this.truncate=this.normalizeTruncateCfg(t.truncate),this.className=t.className||this.className,this.replaceFn=t.replaceFn||this.replaceFn,this.context=t.context||this}return e.link=function(t,n){return new e(n).link(t)},e.parse=function(t,n){return new e(n).parse(t)},e.prototype.normalizeUrlsCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{schemeMatches:e,wwwMatches:e,tldMatches:e}:{schemeMatches:"boolean"!=typeof e.schemeMatches||e.schemeMatches,wwwMatches:"boolean"!=typeof e.wwwMatches||e.wwwMatches,tldMatches:"boolean"!=typeof e.tldMatches||e.tldMatches}},e.prototype.normalizeStripPrefixCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{scheme:e,www:e}:{scheme:"boolean"!=typeof e.scheme||e.scheme,www:"boolean"!=typeof e.www||e.www}},e.prototype.normalizeTruncateCfg=function(e){return"number"==typeof e?{length:e,location:"end"}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&void 0===e[n]&&(e[n]=t[n]);return e}(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})},e.prototype.parse=function(e){var t=this,n=["a","style","script"],r=0,i=[];return Uce(e,{onOpenTag:function(e){n.indexOf(e)>=0&&r++},onText:function(e,n){if(0===r){var o=function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var n,r=[],i=0;n=t.exec(e);)r.push(e.substring(i,n.index)),r.push(n[0]),i=n.index+n[0].length;return r.push(e.substring(i)),r}(e,/( | |<|<|>|>|"|"|')/gi),a=n;o.forEach((function(e,n){if(n%2==0){var r=t.parseText(e,a);i.push.apply(i,r)}a+=e.length}))}},onCloseTag:function(e){n.indexOf(e)>=0&&(r=Math.max(r-1,0))},onComment:function(e){},onDoctype:function(e){}}),i=this.compactMatches(i),i=this.removeUnwantedMatches(i)},e.prototype.compactMatches=function(e){e.sort((function(e,t){return e.getOffset()-t.getOffset()}));for(var t=0;t<e.length-1;){var n=e[t],r=n.getOffset(),i=n.getMatchedText().length,o=r+i;if(t+1<e.length){if(e[t+1].getOffset()===r){var a=e[t+1].getMatchedText().length>i?t:t+1;e.splice(a,1);continue}if(e[t+1].getOffset()<o){e.splice(t+1,1);continue}}t++}return e},e.prototype.removeUnwantedMatches=function(e){return this.hashtag||HAe(e,(function(e){return"hashtag"===e.getType()})),this.email||HAe(e,(function(e){return"email"===e.getType()})),this.phone||HAe(e,(function(e){return"phone"===e.getType()})),this.mention||HAe(e,(function(e){return"mention"===e.getType()})),this.urls.schemeMatches||HAe(e,(function(e){return"url"===e.getType()&&"scheme"===e.getUrlMatchType()})),this.urls.wwwMatches||HAe(e,(function(e){return"url"===e.getType()&&"www"===e.getUrlMatchType()})),this.urls.tldMatches||HAe(e,(function(e){return"url"===e.getType()&&"tld"===e.getUrlMatchType()})),e},e.prototype.parseText=function(e,t){void 0===t&&(t=0),t=t||0;for(var n=this.getMatchers(),r=[],i=0,o=n.length;i<o;i++){for(var a=n[i].parseMatches(e),s=0,l=a.length;s<l;s++)a[s].setOffset(t+a[s].getOffset());r.push.apply(r,a)}return r},e.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"<").replace(/>/g,">"));for(var t=this.parse(e),n=[],r=0,i=0,o=t.length;i<o;i++){var a=t[i];n.push(e.substring(r,a.getOffset())),n.push(this.createMatchReturnVal(a)),r=a.getOffset()+a.getMatchedText().length}return n.push(e.substring(r)),n.join("")},e.prototype.createMatchReturnVal=function(e){var t;return this.replaceFn&&(t=this.replaceFn.call(this.context,e)),"string"==typeof t?t:!1===t?e.getMatchedText():t instanceof jAe?t.toAnchorString():e.buildTag().toAnchorString()},e.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var e=this.getTagBuilder(),t=[new Sce({tagBuilder:e,serviceName:this.hashtag}),new mce({tagBuilder:e}),new Qce({tagBuilder:e}),new Pce({tagBuilder:e,serviceName:this.mention}),new Bce({tagBuilder:e,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=t},e.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new qAe({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},e.version="3.15.0",e.AnchorTagBuilder=qAe,e.HtmlTag=jAe,e.matcher={Email:mce,Hashtag:Sce,Matcher:ZAe,Mention:Pce,Phone:Qce,Url:Bce},e.match={Email:zAe,Hashtag:JAe,Match:VAe,Mention:YAe,Phone:XAe,Url:WAe},e}();function Tce(e){return Lce.link(e,{stripPrefix:!1,email:!1,phone:!1})}const Rce=eue((function({clickableUrls:e,hasCertificateDefinition:t,displayHTML:n}){return t?he`
|
|
1104
1104
|
${DAe}
|
|
1105
|
-
${n?function(e,t){const n=["buv-c-full-certificate","qa-fullscreen-certificate"];ise.certificates.displayHtmlHasNoWidthConstraint(e)&&n.push("buv-c-certificate--fixed-width");const r=t?
|
|
1105
|
+
${n?function(e,t){const n=["buv-c-full-certificate","qa-fullscreen-certificate"];ise.certificates.displayHtmlHasNoWidthConstraint(e)&&n.push("buv-c-certificate--fixed-width");const r=t?Tce(e):e;return he`<section class$=${n.join(" ")}>${NAe(r)}</section>`}(n,e):he`<buv-full-certificate-v1></buv-full-certificate-v1>`}
|
|
1106
1106
|
<div class='buv-c-full-certificate__details'>
|
|
1107
1107
|
<buv-certificate-details class='buv-c-full-certificate__details-list'></buv-certificate-details>
|
|
1108
1108
|
<buv-final-verification-step class='buv-c-fullscreen-certificate__verification-status' isVisible hideLink standalone>
|
|
1109
1109
|
<buv-verify-button type='link'>${Si("text.verifyAgain")}</buv-verify-button>
|
|
1110
1110
|
</buv-final-verification-step>
|
|
1111
1111
|
</div>
|
|
1112
|
-
`:null}),{mapStateToProps:e=>({hasCertificateDefinition:!!yle(e),displayHTML:Cle(e),clickableUrls:vue(e)})});window.customElements.define("buv-full-certificate",
|
|
1113
|
-
${
|
|
1112
|
+
`:null}),{mapStateToProps:e=>({hasCertificateDefinition:!!yle(e),displayHTML:Cle(e),clickableUrls:vue(e)})});window.customElements.define("buv-full-certificate",Rce);var Oce=he`<style>.buv-o-text-11{font-size:11px}.buv-o-text-12{font-size:12px}.buv-o-text-13{font-size:13px}.buv-o-text-15{font-size:15px;line-height:20px}.buv-o-text-bold{font-weight:bold}.buv-c-certificate--fixed-width{max-width:460px;min-width:0;margin:0 auto}.buv-c-fullscreen-certificate{z-index:200;position:fixed;top:0;left:0;background-color:#fff;width:100vw;height:100vh;overflow:auto;box-sizing:border-box}@media only screen and (max-width: 750px){.buv-c-fullscreen-certificate{padding-top:170px}}.buv-c-fullscreen-certificate-header{box-shadow:0 1px 5px rgba(0,0,0,.15);width:100%;background-color:#fff}@media only screen and (max-width: 750px){.buv-c-fullscreen-certificate-header{position:fixed;top:0;z-index:10}}.buv-c-fullscreen-certificate-header__content{max-width:1440px;margin:0 auto;padding:20px;display:flex;align-items:center;position:relative;box-sizing:border-box}@media only screen and (max-width: 750px){.buv-c-fullscreen-certificate-header__content{flex-direction:column;justify-content:left;align-items:unset}}.buv-c-fullscreen-certificate__title{margin:0 30px 0 0}@media only screen and (max-width: 750px){.buv-c-fullscreen-certificate__title{margin-bottom:10px}}.buv-c-fullscreen-certificate__close{top:27px;right:20px}.buv-c-fullscreen-certificate__content{padding:20px;display:flex;max-width:1440px;margin:20px auto 0}@media only screen and (max-width: 750px){.buv-c-fullscreen-certificate__content{flex-direction:column-reverse;margin-top:0}}.buv-c-fullscreen-certificate__details{display:flex;flex-grow:1;flex-direction:column;max-width:280px;min-width:220px;margin-right:20px}@media only screen and (max-width: 750px){.buv-c-fullscreen-certificate__details{max-width:100vw;margin:20px 0 0}}.buv-c-fullscreen-certificate__verification-status{margin-bottom:15px}@media only screen and (max-width: 750px){.buv-c-fullscreen-certificate__verification-status{position:absolute;top:90px;width:calc(100% - 40px);margin:0}}.buv-c-fullscreen-certificate__details-item{margin-top:5px}.buv-c-fullscreen-certificate__separator{margin-top:30px;padding-top:30px;border-top:1px solid #f1f2f3}.buv-c-fullscreen-certificate__certificate{box-shadow:0 1px 5px rgba(0,0,0,.15);padding:20px;background-color:#fff;font-family:serif;text-align:center;color:#49555f;font-size:12px;word-wrap:break-word;min-height:calc(100vh - 145px);box-sizing:border-box;margin:0 auto;min-width:600px;line-height:initial}@media only screen and (max-width: 750px){.buv-c-fullscreen-certificate__certificate{min-width:unset;width:100%;overflow:auto}}.buv-c-fullscreen-certificate__verify-other{margin-top:20px}</style>`;const Hce=eue((function({clickableUrls:e,hasCertificateDefinition:t,recipientName:n,displayHTML:r,onClose:i,disableDownloadPdf:o}){if(!t)return null;const a=["buv-c-fullscreen-certificate__certificate","qa-fullscreen-certificate"];return r&&ise.certificates.displayHtmlHasNoWidthConstraint(r)&&a.push("buv-c-certificate--fixed-width"),he`
|
|
1113
|
+
${Oce}
|
|
1114
1114
|
<section class='buv-c-fullscreen-certificate'>
|
|
1115
1115
|
<header class='buv-c-fullscreen-certificate-header'>
|
|
1116
1116
|
<div class='buv-c-fullscreen-certificate-header__content'>
|
|
@@ -1132,11 +1132,11 @@ const NAe=e=>(e=>(e.__litDirective=!0,e))((t=>{const n=document.createElement("t
|
|
|
1132
1132
|
<buv-verify-other-certificate class='buv-c-fullscreen-certificate__verify-other'></buv-verify-other-certificate>
|
|
1133
1133
|
</div>
|
|
1134
1134
|
<div class$=${a.join(" ")}>
|
|
1135
|
-
${r?function(e,t){const n=t?
|
|
1135
|
+
${r?function(e,t){const n=t?Tce(e):e;return he`${NAe(n)}`}(r,e):he`<buv-full-certificate-v1></buv-full-certificate-v1>`}
|
|
1136
1136
|
</div>
|
|
1137
1137
|
</section>
|
|
1138
1138
|
</section>
|
|
1139
|
-
`}),{mapDispatchToProps:{onClose:sAe},mapStateToProps:e=>({recipientName:wle(e),hasCertificateDefinition:!!yle(e),displayHTML:Cle(e),clickableUrls:vue(e),disableDownloadPdf:hue(e)})});window.customElements.define("buv-fullscreen-certificate",
|
|
1139
|
+
`}),{mapDispatchToProps:{onClose:sAe},mapStateToProps:e=>({recipientName:wle(e),hasCertificateDefinition:!!yle(e),displayHTML:Cle(e),clickableUrls:vue(e),disableDownloadPdf:hue(e)})});window.customElements.define("buv-fullscreen-certificate",Hce);class Kce extends ye{constructor(){super(),this.hasRenderedOnce=!1}static get properties(){return{onLoad:Function,errorMessage:String,hasCertificate:Boolean,...kue}}_firstRendered(){this.onLoad(this._props),this.hasRenderedOnce=!0}_propertiesChanged(e,t,n){this._props=e,super._propertiesChanged(e,t,n),t.src!==n.src&&this.hasRenderedOnce&&this.onLoad({src:t.src}),t.explorerAPIs&&!n.explorerAPIs&&this.onLoad({explorerAPIs:t.explorerAPIs})}renderCertificate(e){switch(e.displayMode){case Xle:return he`<buv-full-certificate></buv-full-certificate>`;case"fullscreen":return he`<buv-fullscreen-certificate></buv-fullscreen-certificate>`;default:return he`<buv-card-certificate></buv-card-certificate>`}}_render(e){const t=e.hasCertificate?"buv-c-verifier-body buv-c-verifier-body--padded":"";return he`
|
|
1140
1140
|
${QAe}
|
|
1141
1141
|
<section class='buv-c-verifier-main'>
|
|
1142
1142
|
<buv-drag-and-drop>
|
|
@@ -1152,7 +1152,7 @@ const NAe=e=>(e=>(e.__litDirective=!0,e))((t=>{const n=document.createElement("t
|
|
|
1152
1152
|
</div>
|
|
1153
1153
|
</buv-drag-and-drop>
|
|
1154
1154
|
</section>
|
|
1155
|
-
`}}function
|
|
1155
|
+
`}}function jce(e){return e.errorMessage}window.customElements.define("buv-raw",Kce);const Gce={onLoad:function(e={}){return function(t){const n=function(e){return Object.keys(kue).reduce(((t,n)=>(e[n]&&(t[n]=e[n]),t)),{})}(e),{src:r,locale:i}=n;t({type:Ue,payload:{options:n}}),ise.certificates.isPathToCertificateValidURI(r)?t(Cue(r)):function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(r)&&t(Eue(JSON.parse(r))),Nue(i)}}},qce=eue((function(e={}){return he`<buv-raw
|
|
1156
1156
|
src='${e.src}'
|
|
1157
1157
|
onLoad='${e.onLoad}'
|
|
1158
1158
|
errorMessage='${e.errorMessage}'
|
|
@@ -1169,8 +1169,8 @@ const NAe=e=>(e=>(e.__litDirective=!0,e))((t=>{const n=document.createElement("t
|
|
|
1169
1169
|
locale='${e.locale}'
|
|
1170
1170
|
explorerAPIs='${e.explorerAPIs}'
|
|
1171
1171
|
didResolverUrl='${e["did-resolver-url"]}'
|
|
1172
|
-
></buv-raw>`}),{mapDispatchToProps:
|
|
1173
|
-
/*! @license DOMPurify 2.3.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.8/LICENSE */!function(e,t){e.exports=function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function r(e,i,o){return r=n()?Reflect.construct:function(e,n,r){var i=[null];i.push.apply(i,n);var o=new(Function.bind.apply(e,i));return r&&t(o,r.prototype),o},r.apply(null,arguments)}function i(e){return o(e)||a(e)||s(e)||u()}function o(e){if(Array.isArray(e))return l(e)}function a(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var A=Object.hasOwnProperty,c=Object.setPrototypeOf,h=Object.isFrozen,f=Object.getPrototypeOf,d=Object.getOwnPropertyDescriptor,p=Object.freeze,g=Object.seal,y=Object.create,m="undefined"!=typeof Reflect&&Reflect,v=m.apply,I=m.construct;v||(v=function(e,t,n){return e.apply(t,n)}),p||(p=function(e){return e}),g||(g=function(e){return e}),I||(I=function(e,t){return r(e,i(t))});var w=N(Array.prototype.forEach),b=N(Array.prototype.pop),B=N(Array.prototype.push),E=N(String.prototype.toLowerCase),C=N(String.prototype.match),S=N(String.prototype.replace),x=N(String.prototype.indexOf),Q=N(String.prototype.trim),k=N(RegExp.prototype.test),_=D(TypeError);function N(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return v(e,t,r)}}function D(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return I(e,n)}}function F(e,t){c&&c(e,null);for(var n=t.length;n--;){var r=t[n];if("string"==typeof r){var i=E(r);i!==r&&(h(t)||(t[n]=i),r=i)}e[r]=!0}return e}function P(e){var t,n=y(null);for(t in e)v(A,e,[t])&&(n[t]=e[t]);return n}function U(e,t){for(;null!==e;){var n=d(e,t);if(n){if(n.get)return N(n.get);if("function"==typeof n.value)return N(n.value)}e=f(e)}function r(e){return console.warn("fallback value for",e),null}return r}var M=p(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),L=p(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),T=p(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),R=p(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),O=p(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),H=p(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),K=p(["#text"]),j=p(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),G=p(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),q=p(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),V=p(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),z=g(/\{\{[\w\W]*|[\w\W]*\}\}/gm),J=g(/<%[\w\W]*|[\w\W]*%>/gm),Y=g(/^data-[\-\w.\u00B7-\uFFFF]/),X=g(/^aria-[\-\w]+$/),W=g(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Z=g(/^(?:\w+script|data):/i),$=g(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ee=g(/^html$/i),te=function(){return"undefined"==typeof window?null:window},ne=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null,i="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(i)&&(r=n.currentScript.getAttribute(i));var o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};function re(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:te(),n=function(e){return re(e)};if(n.version="2.3.8",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,o=t.document,a=t.DocumentFragment,s=t.HTMLTemplateElement,l=t.Node,u=t.Element,A=t.NodeFilter,c=t.NamedNodeMap,h=void 0===c?t.NamedNodeMap||t.MozNamedAttrMap:c,f=t.HTMLFormElement,d=t.DOMParser,g=t.trustedTypes,y=u.prototype,m=U(y,"cloneNode"),v=U(y,"nextSibling"),I=U(y,"childNodes"),N=U(y,"parentNode");if("function"==typeof s){var D=o.createElement("template");D.content&&D.content.ownerDocument&&(o=D.content.ownerDocument)}var ie=ne(g,r),oe=ie?ie.createHTML(""):"",ae=o,se=ae.implementation,le=ae.createNodeIterator,ue=ae.createDocumentFragment,Ae=ae.getElementsByTagName,ce=r.importNode,he={};try{he=P(o).documentMode?o.documentMode:{}}catch(e){}var fe={};n.isSupported="function"==typeof N&&se&&void 0!==se.createHTMLDocument&&9!==he;var de,pe,ge=z,ye=J,me=Y,ve=X,Ie=Z,we=$,be=W,Be=null,Ee=F({},[].concat(i(M),i(L),i(T),i(O),i(K))),Ce=null,Se=F({},[].concat(i(j),i(G),i(q),i(V))),xe=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Qe=null,ke=null,_e=!0,Ne=!0,De=!1,Fe=!1,Pe=!1,Ue=!1,Me=!1,Le=!1,Te=!1,Re=!1,Oe=!0,He=!0,Ke=!1,je={},Ge=null,qe=F({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ve=null,ze=F({},["audio","video","img","source","image","track"]),Je=null,Ye=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xe="http://www.w3.org/1998/Math/MathML",We="http://www.w3.org/2000/svg",Ze="http://www.w3.org/1999/xhtml",$e=Ze,et=!1,tt=["application/xhtml+xml","text/html"],nt="text/html",rt=null,it=o.createElement("form"),ot=function(e){return e instanceof RegExp||e instanceof Function},at=function(t){rt&&rt===t||(t&&"object"===e(t)||(t={}),t=P(t),Be="ALLOWED_TAGS"in t?F({},t.ALLOWED_TAGS):Ee,Ce="ALLOWED_ATTR"in t?F({},t.ALLOWED_ATTR):Se,Je="ADD_URI_SAFE_ATTR"in t?F(P(Ye),t.ADD_URI_SAFE_ATTR):Ye,Ve="ADD_DATA_URI_TAGS"in t?F(P(ze),t.ADD_DATA_URI_TAGS):ze,Ge="FORBID_CONTENTS"in t?F({},t.FORBID_CONTENTS):qe,Qe="FORBID_TAGS"in t?F({},t.FORBID_TAGS):{},ke="FORBID_ATTR"in t?F({},t.FORBID_ATTR):{},je="USE_PROFILES"in t&&t.USE_PROFILES,_e=!1!==t.ALLOW_ARIA_ATTR,Ne=!1!==t.ALLOW_DATA_ATTR,De=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Fe=t.SAFE_FOR_TEMPLATES||!1,Pe=t.WHOLE_DOCUMENT||!1,Le=t.RETURN_DOM||!1,Te=t.RETURN_DOM_FRAGMENT||!1,Re=t.RETURN_TRUSTED_TYPE||!1,Me=t.FORCE_BODY||!1,Oe=!1!==t.SANITIZE_DOM,He=!1!==t.KEEP_CONTENT,Ke=t.IN_PLACE||!1,be=t.ALLOWED_URI_REGEXP||be,$e=t.NAMESPACE||Ze,t.CUSTOM_ELEMENT_HANDLING&&ot(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(xe.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&ot(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(xe.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(xe.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),de=de=-1===tt.indexOf(t.PARSER_MEDIA_TYPE)?nt:t.PARSER_MEDIA_TYPE,pe="application/xhtml+xml"===de?function(e){return e}:E,Fe&&(Ne=!1),Te&&(Le=!0),je&&(Be=F({},i(K)),Ce=[],!0===je.html&&(F(Be,M),F(Ce,j)),!0===je.svg&&(F(Be,L),F(Ce,G),F(Ce,V)),!0===je.svgFilters&&(F(Be,T),F(Ce,G),F(Ce,V)),!0===je.mathMl&&(F(Be,O),F(Ce,q),F(Ce,V))),t.ADD_TAGS&&(Be===Ee&&(Be=P(Be)),F(Be,t.ADD_TAGS)),t.ADD_ATTR&&(Ce===Se&&(Ce=P(Ce)),F(Ce,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&F(Je,t.ADD_URI_SAFE_ATTR),t.FORBID_CONTENTS&&(Ge===qe&&(Ge=P(Ge)),F(Ge,t.FORBID_CONTENTS)),He&&(Be["#text"]=!0),Pe&&F(Be,["html","head","body"]),Be.table&&(F(Be,["tbody"]),delete Qe.tbody),p&&p(t),rt=t)},st=F({},["mi","mo","mn","ms","mtext"]),lt=F({},["foreignobject","desc","title","annotation-xml"]),ut=F({},["title","style","font","a","script"]),At=F({},L);F(At,T),F(At,R);var ct=F({},O);F(ct,H);var ht=function(e){var t=N(e);t&&t.tagName||(t={namespaceURI:Ze,tagName:"template"});var n=E(e.tagName),r=E(t.tagName);return e.namespaceURI===We?t.namespaceURI===Ze?"svg"===n:t.namespaceURI===Xe?"svg"===n&&("annotation-xml"===r||st[r]):Boolean(At[n]):e.namespaceURI===Xe?t.namespaceURI===Ze?"math"===n:t.namespaceURI===We?"math"===n&<[r]:Boolean(ct[n]):e.namespaceURI===Ze&&!(t.namespaceURI===We&&!lt[r])&&!(t.namespaceURI===Xe&&!st[r])&&!ct[n]&&(ut[n]||!At[n])},ft=function(e){B(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=oe}catch(t){e.remove()}}},dt=function(e,t){try{B(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){B(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Ce[e])if(Le||Te)try{ft(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},pt=function(e){var t,n;if(Me)e="<remove></remove>"+e;else{var r=C(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===de&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var i=ie?ie.createHTML(e):e;if($e===Ze)try{t=(new d).parseFromString(i,de)}catch(e){}if(!t||!t.documentElement){t=se.createDocument($e,"template",null);try{t.documentElement.innerHTML=et?"":i}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),$e===Ze?Ae.call(t,Pe?"html":"body")[0]:Pe?t.documentElement:a},gt=function(e){return le.call(e.ownerDocument||e,e,A.SHOW_ELEMENT|A.SHOW_COMMENT|A.SHOW_TEXT,null,!1)},yt=function(e){return e instanceof f&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},mt=function(t){return"object"===e(l)?t instanceof l:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},vt=function(e,t,r){fe[e]&&w(fe[e],(function(e){e.call(n,t,r,rt)}))},It=function(e){var t;if(vt("beforeSanitizeElements",e,null),yt(e))return ft(e),!0;if(k(/[\u0080-\uFFFF]/,e.nodeName))return ft(e),!0;var r=pe(e.nodeName);if(vt("uponSanitizeElement",e,{tagName:r,allowedTags:Be}),e.hasChildNodes()&&!mt(e.firstElementChild)&&(!mt(e.content)||!mt(e.content.firstElementChild))&&k(/<[/\w]/g,e.innerHTML)&&k(/<[/\w]/g,e.textContent))return ft(e),!0;if("select"===r&&k(/<template/i,e.innerHTML))return ft(e),!0;if(!Be[r]||Qe[r]){if(!Qe[r]&&bt(r)){if(xe.tagNameCheck instanceof RegExp&&k(xe.tagNameCheck,r))return!1;if(xe.tagNameCheck instanceof Function&&xe.tagNameCheck(r))return!1}if(He&&!Ge[r]){var i=N(e)||e.parentNode,o=I(e)||e.childNodes;if(o&&i)for(var a=o.length-1;a>=0;--a)i.insertBefore(m(o[a],!0),v(e))}return ft(e),!0}return e instanceof u&&!ht(e)?(ft(e),!0):"noscript"!==r&&"noembed"!==r||!k(/<\/no(script|embed)/i,e.innerHTML)?(Fe&&3===e.nodeType&&(t=e.textContent,t=S(t,ge," "),t=S(t,ye," "),e.textContent!==t&&(B(n.removed,{element:e.cloneNode()}),e.textContent=t)),vt("afterSanitizeElements",e,null),!1):(ft(e),!0)},wt=function(e,t,n){if(Oe&&("id"===t||"name"===t)&&(n in o||n in it))return!1;if(Ne&&!ke[t]&&k(me,t));else if(_e&&k(ve,t));else if(!Ce[t]||ke[t]){if(!(bt(e)&&(xe.tagNameCheck instanceof RegExp&&k(xe.tagNameCheck,e)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(e))&&(xe.attributeNameCheck instanceof RegExp&&k(xe.attributeNameCheck,t)||xe.attributeNameCheck instanceof Function&&xe.attributeNameCheck(t))||"is"===t&&xe.allowCustomizedBuiltInElements&&(xe.tagNameCheck instanceof RegExp&&k(xe.tagNameCheck,n)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(n))))return!1}else if(Je[t]);else if(k(be,S(n,we,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==x(n,"data:")||!Ve[e])if(De&&!k(Ie,S(n,we,"")));else if(n)return!1;return!0},bt=function(e){return e.indexOf("-")>0},Bt=function(e){var t,r,i,o;vt("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ce};for(o=a.length;o--;){var l=t=a[o],u=l.name,A=l.namespaceURI;if(r="value"===u?t.value:Q(t.value),i=pe(u),s.attrName=i,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,vt("uponSanitizeAttribute",e,s),r=s.attrValue,!s.forceKeepAttr&&(dt(u,e),s.keepAttr))if(k(/\/>/i,r))dt(u,e);else{Fe&&(r=S(r,ge," "),r=S(r,ye," "));var c=pe(e.nodeName);if(wt(c,i,r))try{A?e.setAttributeNS(A,u,r):e.setAttribute(u,r),b(n.removed)}catch(e){}}}vt("afterSanitizeAttributes",e,null)}},Et=function e(t){var n,r=gt(t);for(vt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)vt("uponSanitizeShadowNode",n,null),It(n)||(n.content instanceof a&&e(n.content),Bt(n));vt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(i,o){var s,u,A,c,h;if((et=!i)&&(i="\x3c!--\x3e"),"string"!=typeof i&&!mt(i)){if("function"!=typeof i.toString)throw _("toString is not a function");if("string"!=typeof(i=i.toString()))throw _("dirty is not a string, aborting")}if(!n.isSupported){if("object"===e(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof i)return t.toStaticHTML(i);if(mt(i))return t.toStaticHTML(i.outerHTML)}return i}if(Ue||at(o),n.removed=[],"string"==typeof i&&(Ke=!1),Ke){if(i.nodeName){var f=pe(i.nodeName);if(!Be[f]||Qe[f])throw _("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof l)1===(u=(s=pt("\x3c!----\x3e")).ownerDocument.importNode(i,!0)).nodeType&&"BODY"===u.nodeName||"HTML"===u.nodeName?s=u:s.appendChild(u);else{if(!Le&&!Fe&&!Pe&&-1===i.indexOf("<"))return ie&&Re?ie.createHTML(i):i;if(!(s=pt(i)))return Le?null:Re?oe:""}s&&Me&&ft(s.firstChild);for(var d=gt(Ke?i:s);A=d.nextNode();)3===A.nodeType&&A===c||It(A)||(A.content instanceof a&&Et(A.content),Bt(A),c=A);if(c=null,Ke)return i;if(Le){if(Te)for(h=ue.call(s.ownerDocument);s.firstChild;)h.appendChild(s.firstChild);else h=s;return Ce.shadowroot&&(h=ce.call(r,h,!0)),h}var p=Pe?s.outerHTML:s.innerHTML;return Pe&&Be["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&k(ee,s.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+s.ownerDocument.doctype.name+">\n"+p),Fe&&(p=S(p,ge," "),p=S(p,ye," ")),ie&&Re?ie.createHTML(p):p},n.setConfig=function(e){at(e),Ue=!0},n.clearConfig=function(){rt=null,Ue=!1},n.isValidAttribute=function(e,t,n){rt||at({});var r=pe(e),i=pe(t);return wt(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&(fe[e]=fe[e]||[],B(fe[e],t))},n.removeHook=function(e){if(fe[e])return b(fe[e])},n.removeHooks=function(e){fe[e]&&(fe[e]=[])},n.removeAllHooks=function(){fe={}},n}return re()}()}(qce);var Vce=e({__proto__:null,default:qce.exports},[qce.exports]),zce=function(e){return e&&e.Math==Math&&e},Jce=zce("object"==typeof globalThis&&globalThis)||zce("object"==typeof window&&window)||zce("object"==typeof self&&self)||zce("object"==typeof it&&it)||function(){return this}()||Function("return this")(),Yce={},Xce=function(e){try{return!!e()}catch(e){return!0}},Wce=!Xce((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Zce=!Xce((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),$ce=Zce,ehe=Function.prototype.call,the=$ce?ehe.bind(ehe):function(){return ehe.apply(ehe,arguments)},nhe={},rhe={}.propertyIsEnumerable,ihe=Object.getOwnPropertyDescriptor,ohe=ihe&&!rhe.call({1:2},1);nhe.f=ohe?function(e){var t=ihe(this,e);return!!t&&t.enumerable}:rhe;var ahe,she,lhe=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},uhe=Zce,Ahe=Function.prototype,che=Ahe.bind,hhe=Ahe.call,fhe=uhe&&che.bind(hhe,hhe),dhe=uhe?function(e){return e&&fhe(e)}:function(e){return e&&function(){return hhe.apply(e,arguments)}},phe=dhe,ghe=phe({}.toString),yhe=phe("".slice),mhe=function(e){return yhe(ghe(e),8,-1)},vhe=Xce,Ihe=mhe,whe=Object,bhe=dhe("".split),Bhe=vhe((function(){return!whe("z").propertyIsEnumerable(0)}))?function(e){return"String"==Ihe(e)?bhe(e,""):whe(e)}:whe,Ehe=TypeError,Che=function(e){if(null==e)throw Ehe("Can't call method on "+e);return e},She=Bhe,xhe=Che,Qhe=function(e){return She(xhe(e))},khe=function(e){return"function"==typeof e},_he=khe,Nhe=function(e){return"object"==typeof e?null!==e:_he(e)},Dhe=Jce,Fhe=khe,Phe=function(e){return Fhe(e)?e:void 0},Uhe=function(e,t){return arguments.length<2?Phe(Dhe[e]):Dhe[e]&&Dhe[e][t]},Mhe=dhe({}.isPrototypeOf),Lhe=Uhe("navigator","userAgent")||"",The=Jce,Rhe=Lhe,Ohe=The.process,Hhe=The.Deno,Khe=Ohe&&Ohe.versions||Hhe&&Hhe.version,jhe=Khe&&Khe.v8;jhe&&(she=(ahe=jhe.split("."))[0]>0&&ahe[0]<4?1:+(ahe[0]+ahe[1])),!she&&Rhe&&(!(ahe=Rhe.match(/Edge\/(\d+)/))||ahe[1]>=74)&&(ahe=Rhe.match(/Chrome\/(\d+)/))&&(she=+ahe[1]);var Ghe=she,qhe=Ghe,Vhe=Xce,zhe=!!Object.getOwnPropertySymbols&&!Vhe((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&qhe&&qhe<41})),Jhe=zhe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Yhe=Uhe,Xhe=khe,Whe=Mhe,Zhe=Object,$he=Jhe?function(e){return"symbol"==typeof e}:function(e){var t=Yhe("Symbol");return Xhe(t)&&Whe(t.prototype,Zhe(e))},efe=String,tfe=function(e){try{return efe(e)}catch(e){return"Object"}},nfe=khe,rfe=tfe,ife=TypeError,ofe=function(e){if(nfe(e))return e;throw ife(rfe(e)+" is not a function")},afe=ofe,sfe=function(e,t){var n=e[t];return null==n?void 0:afe(n)},lfe=the,ufe=khe,Afe=Nhe,cfe=TypeError,hfe={exports:{}},ffe=Jce,dfe=Object.defineProperty,pfe=function(e,t){try{dfe(ffe,e,{value:t,configurable:!0,writable:!0})}catch(n){ffe[e]=t}return t},gfe=pfe,yfe="__core-js_shared__",mfe=Jce[yfe]||gfe(yfe,{}),vfe=mfe;(hfe.exports=function(e,t){return vfe[e]||(vfe[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.24.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Ife=Che,wfe=Object,bfe=function(e){return wfe(Ife(e))},Bfe=bfe,Efe=dhe({}.hasOwnProperty),Cfe=Object.hasOwn||function(e,t){return Efe(Bfe(e),t)},Sfe=dhe,xfe=0,Qfe=Math.random(),kfe=Sfe(1..toString),_fe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+kfe(++xfe+Qfe,36)},Nfe=Jce,Dfe=hfe.exports,Ffe=Cfe,Pfe=_fe,Ufe=zhe,Mfe=Jhe,Lfe=Dfe("wks"),Tfe=Nfe.Symbol,Rfe=Tfe&&Tfe.for,Ofe=Mfe?Tfe:Tfe&&Tfe.withoutSetter||Pfe,Hfe=function(e){if(!Ffe(Lfe,e)||!Ufe&&"string"!=typeof Lfe[e]){var t="Symbol."+e;Ufe&&Ffe(Tfe,e)?Lfe[e]=Tfe[e]:Lfe[e]=Mfe&&Rfe?Rfe(t):Ofe(t)}return Lfe[e]},Kfe=the,jfe=Nhe,Gfe=$he,qfe=sfe,Vfe=function(e,t){var n,r;if("string"===t&&ufe(n=e.toString)&&!Afe(r=lfe(n,e)))return r;if(ufe(n=e.valueOf)&&!Afe(r=lfe(n,e)))return r;if("string"!==t&&ufe(n=e.toString)&&!Afe(r=lfe(n,e)))return r;throw cfe("Can't convert object to primitive value")},zfe=TypeError,Jfe=Hfe("toPrimitive"),Yfe=function(e,t){if(!jfe(e)||Gfe(e))return e;var n,r=qfe(e,Jfe);if(r){if(void 0===t&&(t="default"),n=Kfe(r,e,t),!jfe(n)||Gfe(n))return n;throw zfe("Can't convert object to primitive value")}return void 0===t&&(t="number"),Vfe(e,t)},Xfe=$he,Wfe=function(e){var t=Yfe(e,"string");return Xfe(t)?t:t+""},Zfe=Nhe,$fe=Jce.document,ede=Zfe($fe)&&Zfe($fe.createElement),tde=function(e){return ede?$fe.createElement(e):{}},nde=tde,rde=!Wce&&!Xce((function(){return 7!=Object.defineProperty(nde("div"),"a",{get:function(){return 7}}).a})),ide=Wce,ode=the,ade=nhe,sde=lhe,lde=Qhe,ude=Wfe,Ade=Cfe,cde=rde,hde=Object.getOwnPropertyDescriptor;Yce.f=ide?hde:function(e,t){if(e=lde(e),t=ude(t),cde)try{return hde(e,t)}catch(e){}if(Ade(e,t))return sde(!ode(ade.f,e,t),e[t])};var fde={},dde=Wce&&Xce((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),pde=Nhe,gde=String,yde=TypeError,mde=function(e){if(pde(e))return e;throw yde(gde(e)+" is not an object")},vde=Wce,Ide=rde,wde=dde,bde=mde,Bde=Wfe,Ede=TypeError,Cde=Object.defineProperty,Sde=Object.getOwnPropertyDescriptor,xde="enumerable",Qde="configurable",kde="writable";fde.f=vde?wde?function(e,t,n){if(bde(e),t=Bde(t),bde(n),"function"==typeof e&&"prototype"===t&&"value"in n&&kde in n&&!n.writable){var r=Sde(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:Qde in n?n.configurable:r.configurable,enumerable:xde in n?n.enumerable:r.enumerable,writable:!1})}return Cde(e,t,n)}:Cde:function(e,t,n){if(bde(e),t=Bde(t),bde(n),Ide)try{return Cde(e,t,n)}catch(e){}if("get"in n||"set"in n)throw Ede("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var _de=fde,Nde=lhe,Dde=Wce?function(e,t,n){return _de.f(e,t,Nde(1,n))}:function(e,t,n){return e[t]=n,e},Fde={exports:{}},Pde=Wce,Ude=Cfe,Mde=Function.prototype,Lde=Pde&&Object.getOwnPropertyDescriptor,Tde=Ude(Mde,"name"),Rde={EXISTS:Tde,PROPER:Tde&&"something"===function(){}.name,CONFIGURABLE:Tde&&(!Pde||Pde&&Lde(Mde,"name").configurable)},Ode=khe,Hde=mfe,Kde=dhe(Function.toString);Ode(Hde.inspectSource)||(Hde.inspectSource=function(e){return Kde(e)});var jde,Gde,qde,Vde=Hde.inspectSource,zde=khe,Jde=Vde,Yde=Jce.WeakMap,Xde=zde(Yde)&&/native code/.test(Jde(Yde)),Wde=hfe.exports,Zde=_fe,$de=Wde("keys"),epe=function(e){return $de[e]||($de[e]=Zde(e))},tpe={},npe=Xde,rpe=Jce,ipe=dhe,ope=Nhe,ape=Dde,spe=Cfe,lpe=mfe,upe=epe,Ape=tpe,cpe="Object already initialized",hpe=rpe.TypeError,fpe=rpe.WeakMap;if(npe||lpe.state){var dpe=lpe.state||(lpe.state=new fpe),ppe=ipe(dpe.get),gpe=ipe(dpe.has),ype=ipe(dpe.set);jde=function(e,t){if(gpe(dpe,e))throw new hpe(cpe);return t.facade=e,ype(dpe,e,t),t},Gde=function(e){return ppe(dpe,e)||{}},qde=function(e){return gpe(dpe,e)}}else{var mpe=upe("state");Ape[mpe]=!0,jde=function(e,t){if(spe(e,mpe))throw new hpe(cpe);return t.facade=e,ape(e,mpe,t),t},Gde=function(e){return spe(e,mpe)?e[mpe]:{}},qde=function(e){return spe(e,mpe)}}var vpe={set:jde,get:Gde,has:qde,enforce:function(e){return qde(e)?Gde(e):jde(e,{})},getterFor:function(e){return function(t){var n;if(!ope(t)||(n=Gde(t)).type!==e)throw hpe("Incompatible receiver, "+e+" required");return n}}},Ipe=Xce,wpe=khe,bpe=Cfe,Bpe=Wce,Epe=Rde.CONFIGURABLE,Cpe=Vde,Spe=vpe.enforce,xpe=vpe.get,Qpe=Object.defineProperty,kpe=Bpe&&!Ipe((function(){return 8!==Qpe((function(){}),"length",{value:8}).length})),_pe=String(String).split("String"),Npe=Fde.exports=function(e,t,n){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!bpe(e,"name")||Epe&&e.name!==t)&&(Bpe?Qpe(e,"name",{value:t,configurable:!0}):e.name=t),kpe&&n&&bpe(n,"arity")&&e.length!==n.arity&&Qpe(e,"length",{value:n.arity});try{n&&bpe(n,"constructor")&&n.constructor?Bpe&&Qpe(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=Spe(e);return bpe(r,"source")||(r.source=_pe.join("string"==typeof t?t:"")),e};Function.prototype.toString=Npe((function(){return wpe(this)&&xpe(this).source||Cpe(this)}),"toString");var Dpe=khe,Fpe=fde,Ppe=Fde.exports,Upe=pfe,Mpe=function(e,t,n,r){r||(r={});var i=r.enumerable,o=void 0!==r.name?r.name:t;if(Dpe(n)&&Ppe(n,o,r),r.global)i?e[t]=n:Upe(t,n);else{try{r.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=n:Fpe.f(e,t,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},Lpe={},Tpe=Math.ceil,Rpe=Math.floor,Ope=Math.trunc||function(e){var t=+e;return(t>0?Rpe:Tpe)(t)},Hpe=Ope,Kpe=function(e){var t=+e;return t!=t||0===t?0:Hpe(t)},jpe=Kpe,Gpe=Math.max,qpe=Math.min,Vpe=function(e,t){var n=jpe(e);return n<0?Gpe(n+t,0):qpe(n,t)},zpe=Kpe,Jpe=Math.min,Ype=function(e){return e>0?Jpe(zpe(e),9007199254740991):0},Xpe=Ype,Wpe=function(e){return Xpe(e.length)},Zpe=Qhe,$pe=Vpe,ege=Wpe,tge=function(e){return function(t,n,r){var i,o=Zpe(t),a=ege(o),s=$pe(r,a);if(e&&n!=n){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===n)return e||s||0;return!e&&-1}},nge={includes:tge(!0),indexOf:tge(!1)},rge=Cfe,ige=Qhe,oge=nge.indexOf,age=tpe,sge=dhe([].push),lge=function(e,t){var n,r=ige(e),i=0,o=[];for(n in r)!rge(age,n)&&rge(r,n)&&sge(o,n);for(;t.length>i;)rge(r,n=t[i++])&&(~oge(o,n)||sge(o,n));return o},uge=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Age=lge,cge=uge.concat("length","prototype");Lpe.f=Object.getOwnPropertyNames||function(e){return Age(e,cge)};var hge={};hge.f=Object.getOwnPropertySymbols;var fge=Uhe,dge=Lpe,pge=hge,gge=mde,yge=dhe([].concat),mge=fge("Reflect","ownKeys")||function(e){var t=dge.f(gge(e)),n=pge.f;return n?yge(t,n(e)):t},vge=Cfe,Ige=mge,wge=Yce,bge=fde,Bge=Xce,Ege=khe,Cge=/#|\.prototype\./,Sge=function(e,t){var n=Qge[xge(e)];return n==_ge||n!=kge&&(Ege(t)?Bge(t):!!t)},xge=Sge.normalize=function(e){return String(e).replace(Cge,".").toLowerCase()},Qge=Sge.data={},kge=Sge.NATIVE="N",_ge=Sge.POLYFILL="P",Nge=Sge,Dge=Jce,Fge=Yce.f,Pge=Dde,Uge=Mpe,Mge=pfe,Lge=function(e,t,n){for(var r=Ige(t),i=bge.f,o=wge.f,a=0;a<r.length;a++){var s=r[a];vge(e,s)||n&&vge(n,s)||i(e,s,o(t,s))}},Tge=Nge,Rge=function(e,t){var n,r,i,o,a,s=e.target,l=e.global,u=e.stat;if(n=l?Dge:u?Dge[s]||Mge(s,{}):(Dge[s]||{}).prototype)for(r in t){if(o=t[r],i=e.dontCallGetSet?(a=Fge(n,r))&&a.value:n[r],!Tge(l?r:s+(u?".":"#")+r,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Lge(o,i)}(e.sham||i&&i.sham)&&Pge(o,"sham",!0),Uge(n,r,o,e)}},Oge="process"==mhe(Jce.process),Hge=khe,Kge=String,jge=TypeError,Gge=dhe,qge=mde,Vge=function(e){if("object"==typeof e||Hge(e))return e;throw jge("Can't set "+Kge(e)+" as a prototype")},zge=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Gge(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return qge(n),Vge(r),t?e(n,r):n.__proto__=r,n}}():void 0),Jge=fde.f,Yge=Cfe,Xge=Hfe("toStringTag"),Wge=function(e,t,n){e&&!n&&(e=e.prototype),e&&!Yge(e,Xge)&&Jge(e,Xge,{configurable:!0,value:t})},Zge=Uhe,$ge=fde,eye=Wce,tye=Hfe("species"),nye=Mhe,rye=TypeError,iye={};iye[Hfe("toStringTag")]="z";var oye="[object z]"===String(iye),aye=khe,sye=mhe,lye=Hfe("toStringTag"),uye=Object,Aye="Arguments"==sye(function(){return arguments}()),cye=oye?sye:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=uye(e),lye))?n:Aye?sye(t):"Object"==(r=sye(t))&&aye(t.callee)?"Arguments":r},hye=dhe,fye=Xce,dye=khe,pye=cye,gye=Vde,yye=function(){},mye=[],vye=Uhe("Reflect","construct"),Iye=/^\s*(?:class|function)\b/,wye=hye(Iye.exec),bye=!Iye.exec(yye),Bye=function(e){if(!dye(e))return!1;try{return vye(yye,mye,e),!0}catch(e){return!1}},Eye=function(e){if(!dye(e))return!1;switch(pye(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return bye||!!wye(Iye,gye(e))}catch(e){return!0}};Eye.sham=!0;var Cye,Sye,xye,Qye,kye=!vye||fye((function(){var e;return Bye(Bye.call)||!Bye(Object)||!Bye((function(){e=!0}))||e}))?Eye:Bye,_ye=kye,Nye=tfe,Dye=TypeError,Fye=mde,Pye=function(e){if(_ye(e))return e;throw Dye(Nye(e)+" is not a constructor")},Uye=Hfe("species"),Mye=function(e,t){var n,r=Fye(e).constructor;return void 0===r||null==(n=Fye(r)[Uye])?t:Pye(n)},Lye=Zce,Tye=Function.prototype,Rye=Tye.apply,Oye=Tye.call,Hye="object"==typeof Reflect&&Reflect.apply||(Lye?Oye.bind(Rye):function(){return Oye.apply(Rye,arguments)}),Kye=ofe,jye=Zce,Gye=dhe(dhe.bind),qye=function(e,t){return Kye(e),void 0===t?e:jye?Gye(e,t):function(){return e.apply(t,arguments)}},Vye=Uhe("document","documentElement"),zye=dhe([].slice),Jye=TypeError,Yye=/(?:ipad|iphone|ipod).*applewebkit/i.test(Lhe),Xye=Jce,Wye=Hye,Zye=qye,$ye=khe,eme=Cfe,tme=Xce,nme=Vye,rme=zye,ime=tde,ome=function(e,t){if(e<t)throw Jye("Not enough arguments");return e},ame=Yye,sme=Oge,lme=Xye.setImmediate,ume=Xye.clearImmediate,Ame=Xye.process,cme=Xye.Dispatch,hme=Xye.Function,fme=Xye.MessageChannel,dme=Xye.String,pme=0,gme={},yme="onreadystatechange";try{Cye=Xye.location}catch(e){}var mme=function(e){if(eme(gme,e)){var t=gme[e];delete gme[e],t()}},vme=function(e){return function(){mme(e)}},Ime=function(e){mme(e.data)},wme=function(e){Xye.postMessage(dme(e),Cye.protocol+"//"+Cye.host)};lme&&ume||(lme=function(e){ome(arguments.length,1);var t=$ye(e)?e:hme(e),n=rme(arguments,1);return gme[++pme]=function(){Wye(t,void 0,n)},Sye(pme),pme},ume=function(e){delete gme[e]},sme?Sye=function(e){Ame.nextTick(vme(e))}:cme&&cme.now?Sye=function(e){cme.now(vme(e))}:fme&&!ame?(Qye=(xye=new fme).port2,xye.port1.onmessage=Ime,Sye=Zye(Qye.postMessage,Qye)):Xye.addEventListener&&$ye(Xye.postMessage)&&!Xye.importScripts&&Cye&&"file:"!==Cye.protocol&&!tme(wme)?(Sye=wme,Xye.addEventListener("message",Ime,!1)):Sye=yme in ime("script")?function(e){nme.appendChild(ime("script")).onreadystatechange=function(){nme.removeChild(this),mme(e)}}:function(e){setTimeout(vme(e),0)});var bme,Bme,Eme,Cme,Sme,xme,Qme,kme,_me={set:lme,clear:ume},Nme=Jce,Dme=/ipad|iphone|ipod/i.test(Lhe)&&void 0!==Nme.Pebble,Fme=/web0s(?!.*chrome)/i.test(Lhe),Pme=Jce,Ume=qye,Mme=Yce.f,Lme=_me.set,Tme=Yye,Rme=Dme,Ome=Fme,Hme=Oge,Kme=Pme.MutationObserver||Pme.WebKitMutationObserver,jme=Pme.document,Gme=Pme.process,qme=Pme.Promise,Vme=Mme(Pme,"queueMicrotask"),zme=Vme&&Vme.value;zme||(bme=function(){var e,t;for(Hme&&(e=Gme.domain)&&e.exit();Bme;){t=Bme.fn,Bme=Bme.next;try{t()}catch(e){throw Bme?Cme():Eme=void 0,e}}Eme=void 0,e&&e.enter()},Tme||Hme||Ome||!Kme||!jme?!Rme&&qme&&qme.resolve?((Qme=qme.resolve(void 0)).constructor=qme,kme=Ume(Qme.then,Qme),Cme=function(){kme(bme)}):Hme?Cme=function(){Gme.nextTick(bme)}:(Lme=Ume(Lme,Pme),Cme=function(){Lme(bme)}):(Sme=!0,xme=jme.createTextNode(""),new Kme(bme).observe(xme,{characterData:!0}),Cme=function(){xme.data=Sme=!Sme}));var Jme=zme||function(e){var t={fn:e,next:void 0};Eme&&(Eme.next=t),Bme||(Bme=t,Cme()),Eme=t},Yme=Jce,Xme=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Wme=function(){this.head=null,this.tail=null};Wme.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var Zme=Wme,$me=Jce.Promise,eve="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,tve=!eve&&!Oge&&"object"==typeof window&&"object"==typeof document,nve=Jce,rve=$me,ive=khe,ove=Nge,ave=Vde,sve=Hfe,lve=tve,uve=eve,Ave=Ghe;rve&&rve.prototype;var cve=sve("species"),hve=!1,fve=ive(nve.PromiseRejectionEvent),dve=ove("Promise",(function(){var e=ave(rve),t=e!==String(rve);if(!t&&66===Ave)return!0;if(!Ave||Ave<51||!/native code/.test(e)){var n=new rve((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((n.constructor={})[cve]=r,!(hve=n.then((function(){}))instanceof r))return!0}return!t&&(lve||uve)&&!fve})),pve={CONSTRUCTOR:dve,REJECTION_EVENT:fve,SUBCLASSING:hve},gve={},yve=ofe,mve=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=yve(t),this.reject=yve(n)};gve.f=function(e){return new mve(e)};var vve,Ive,wve,bve=Rge,Bve=Oge,Eve=Jce,Cve=the,Sve=Mpe,xve=zge,Qve=Wge,kve=function(e){var t=Zge(e),n=$ge.f;eye&&t&&!t[tye]&&n(t,tye,{configurable:!0,get:function(){return this}})},_ve=ofe,Nve=khe,Dve=Nhe,Fve=function(e,t){if(nye(t,e))return e;throw rye("Incorrect invocation")},Pve=Mye,Uve=_me.set,Mve=Jme,Lve=function(e,t){var n=Yme.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t))},Tve=Xme,Rve=Zme,Ove=vpe,Hve=$me,Kve=gve,jve="Promise",Gve=pve.CONSTRUCTOR,qve=pve.REJECTION_EVENT,Vve=pve.SUBCLASSING,zve=Ove.getterFor(jve),Jve=Ove.set,Yve=Hve&&Hve.prototype,Xve=Hve,Wve=Yve,Zve=Eve.TypeError,$ve=Eve.document,eIe=Eve.process,tIe=Kve.f,nIe=tIe,rIe=!!($ve&&$ve.createEvent&&Eve.dispatchEvent),iIe="unhandledrejection",oIe=function(e){var t;return!(!Dve(e)||!Nve(t=e.then))&&t},aIe=function(e,t){var n,r,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,l=e.resolve,u=e.reject,A=e.domain;try{s?(a||(2===t.rejection&&cIe(t),t.rejection=1),!0===s?n=o:(A&&A.enter(),n=s(o),A&&(A.exit(),i=!0)),n===e.promise?u(Zve("Promise-chain cycle")):(r=oIe(n))?Cve(r,n,l,u):l(n)):u(o)}catch(e){A&&!i&&A.exit(),u(e)}},sIe=function(e,t){e.notified||(e.notified=!0,Mve((function(){for(var n,r=e.reactions;n=r.get();)aIe(n,e);e.notified=!1,t&&!e.rejection&&uIe(e)})))},lIe=function(e,t,n){var r,i;rIe?((r=$ve.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),Eve.dispatchEvent(r)):r={promise:t,reason:n},!qve&&(i=Eve["on"+e])?i(r):e===iIe&&Lve("Unhandled promise rejection",n)},uIe=function(e){Cve(Uve,Eve,(function(){var t,n=e.facade,r=e.value;if(AIe(e)&&(t=Tve((function(){Bve?eIe.emit("unhandledRejection",r,n):lIe(iIe,n,r)})),e.rejection=Bve||AIe(e)?2:1,t.error))throw t.value}))},AIe=function(e){return 1!==e.rejection&&!e.parent},cIe=function(e){Cve(Uve,Eve,(function(){var t=e.facade;Bve?eIe.emit("rejectionHandled",t):lIe("rejectionhandled",t,e.value)}))},hIe=function(e,t,n){return function(r){e(t,r,n)}},fIe=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,sIe(e,!0))},dIe=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Zve("Promise can't be resolved itself");var r=oIe(t);r?Mve((function(){var n={done:!1};try{Cve(r,t,hIe(dIe,n,e),hIe(fIe,n,e))}catch(t){fIe(n,t,e)}})):(e.value=t,e.state=1,sIe(e,!1))}catch(t){fIe({done:!1},t,e)}}};if(Gve&&(Wve=(Xve=function(e){Fve(this,Wve),_ve(e),Cve(vve,this);var t=zve(this);try{e(hIe(dIe,t),hIe(fIe,t))}catch(e){fIe(t,e)}}).prototype,(vve=function(e){Jve(this,{type:jve,done:!1,notified:!1,parent:!1,reactions:new Rve,rejection:!1,state:0,value:void 0})}).prototype=Sve(Wve,"then",(function(e,t){var n=zve(this),r=tIe(Pve(this,Xve));return n.parent=!0,r.ok=!Nve(e)||e,r.fail=Nve(t)&&t,r.domain=Bve?eIe.domain:void 0,0==n.state?n.reactions.add(r):Mve((function(){aIe(r,n)})),r.promise})),Ive=function(){var e=new vve,t=zve(e);this.promise=e,this.resolve=hIe(dIe,t),this.reject=hIe(fIe,t)},Kve.f=tIe=function(e){return e===Xve||undefined===e?new Ive(e):nIe(e)},Nve(Hve)&&Yve!==Object.prototype)){wve=Yve.then,Vve||Sve(Yve,"then",(function(e,t){var n=this;return new Xve((function(e,t){Cve(wve,n,e,t)})).then(e,t)}),{unsafe:!0});try{delete Yve.constructor}catch(e){}xve&&xve(Yve,Wve)}bve({global:!0,constructor:!0,wrap:!0,forced:Gve},{Promise:Xve}),Qve(Xve,jve,!1),kve(jve);var pIe={},gIe=pIe,yIe=Hfe("iterator"),mIe=Array.prototype,vIe=cye,IIe=sfe,wIe=pIe,bIe=Hfe("iterator"),BIe=function(e){if(null!=e)return IIe(e,bIe)||IIe(e,"@@iterator")||wIe[vIe(e)]},EIe=the,CIe=ofe,SIe=mde,xIe=tfe,QIe=BIe,kIe=TypeError,_Ie=the,NIe=mde,DIe=sfe,FIe=qye,PIe=the,UIe=mde,MIe=tfe,LIe=function(e){return void 0!==e&&(gIe.Array===e||mIe[yIe]===e)},TIe=Wpe,RIe=Mhe,OIe=function(e,t){var n=arguments.length<2?QIe(e):t;if(CIe(n))return SIe(EIe(n,e));throw kIe(xIe(e)+" is not iterable")},HIe=BIe,KIe=function(e,t,n){var r,i;NIe(e);try{if(!(r=DIe(e,"return"))){if("throw"===t)throw n;return n}r=_Ie(r,e)}catch(e){i=!0,r=e}if("throw"===t)throw n;if(i)throw r;return NIe(r),n},jIe=TypeError,GIe=function(e,t){this.stopped=e,this.result=t},qIe=GIe.prototype,VIe=function(e,t,n){var r,i,o,a,s,l,u,A=n&&n.that,c=!(!n||!n.AS_ENTRIES),h=!(!n||!n.IS_RECORD),f=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),p=FIe(t,A),g=function(e){return r&&KIe(r,"normal",e),new GIe(!0,e)},y=function(e){return c?(UIe(e),d?p(e[0],e[1],g):p(e[0],e[1])):d?p(e,g):p(e)};if(h)r=e.iterator;else if(f)r=e;else{if(!(i=HIe(e)))throw jIe(MIe(e)+" is not iterable");if(LIe(i)){for(o=0,a=TIe(e);a>o;o++)if((s=y(e[o]))&&RIe(qIe,s))return s;return new GIe(!1)}r=OIe(e,i)}for(l=h?e.next:r.next;!(u=PIe(l,r)).done;){try{s=y(u.value)}catch(e){KIe(r,"throw",e)}if("object"==typeof s&&s&&RIe(qIe,s))return s}return new GIe(!1)},zIe=Hfe("iterator"),JIe=!1;try{var YIe=0,XIe={next:function(){return{done:!!YIe++}},return:function(){JIe=!0}};XIe[zIe]=function(){return this},Array.from(XIe,(function(){throw 2}))}catch(e){}var WIe=$me,ZIe=function(e,t){if(!t&&!JIe)return!1;var n=!1;try{var r={};r[zIe]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},$Ie=pve.CONSTRUCTOR||!ZIe((function(e){WIe.all(e).then(void 0,(function(){}))})),ewe=the,twe=ofe,nwe=gve,rwe=Xme,iwe=VIe;Rge({target:"Promise",stat:!0,forced:$Ie},{all:function(e){var t=this,n=nwe.f(t),r=n.resolve,i=n.reject,o=rwe((function(){var n=twe(t.resolve),o=[],a=0,s=1;iwe(e,(function(e){var l=a++,u=!1;s++,ewe(n,t,e).then((function(e){u||(u=!0,o[l]=e,--s||r(o))}),i)})),--s||r(o)}));return o.error&&i(o.value),n.promise}});var owe=Rge,awe=pve.CONSTRUCTOR,swe=$me,lwe=Uhe,uwe=khe,Awe=Mpe,cwe=swe&&swe.prototype;if(owe({target:"Promise",proto:!0,forced:awe,real:!0},{catch:function(e){return this.then(void 0,e)}}),uwe(swe)){var hwe=lwe("Promise").prototype.catch;cwe.catch!==hwe&&Awe(cwe,"catch",hwe,{unsafe:!0})}var fwe=the,dwe=ofe,pwe=gve,gwe=Xme,ywe=VIe;Rge({target:"Promise",stat:!0,forced:$Ie},{race:function(e){var t=this,n=pwe.f(t),r=n.reject,i=gwe((function(){var i=dwe(t.resolve);ywe(e,(function(e){fwe(i,t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var mwe=the,vwe=gve;Rge({target:"Promise",stat:!0,forced:pve.CONSTRUCTOR},{reject:function(e){var t=vwe.f(this);return mwe(t.reject,void 0,e),t.promise}});var Iwe=mde,wwe=Nhe,bwe=gve,Bwe=Rge,Ewe=pve.CONSTRUCTOR,Cwe=function(e,t){if(Iwe(e),wwe(t)&&t.constructor===e)return t;var n=bwe.f(e);return(0,n.resolve)(t),n.promise};Uhe("Promise"),Bwe({target:"Promise",stat:!0,forced:Ewe},{resolve:function(e){return Cwe(this,e)}});var Swe={exports:{}};!function(e){function t(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=e.apply(n,r);function s(e){t(a,i,o,s,l,"next",e)}function l(e){t(a,i,o,s,l,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports}(Swe);var xwe=ot(Swe.exports),Qwe=cye,kwe=String,_we=function(e){if("Symbol"===Qwe(e))throw TypeError("Cannot convert a Symbol value to a string");return kwe(e)},Nwe=mde,Dwe=function(){var e=Nwe(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Fwe=Xce,Pwe=Jce.RegExp,Uwe=Fwe((function(){var e=Pwe("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Mwe=Uwe||Fwe((function(){return!Pwe("a","y").sticky})),Lwe=Uwe||Fwe((function(){var e=Pwe("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),Twe={BROKEN_CARET:Lwe,MISSED_STICKY:Mwe,UNSUPPORTED_Y:Uwe},Rwe={},Owe=lge,Hwe=uge,Kwe=Object.keys||function(e){return Owe(e,Hwe)},jwe=Wce,Gwe=dde,qwe=fde,Vwe=mde,zwe=Qhe,Jwe=Kwe;Rwe.f=jwe&&!Gwe?Object.defineProperties:function(e,t){Vwe(e);for(var n,r=zwe(t),i=Jwe(t),o=i.length,a=0;o>a;)qwe.f(e,n=i[a++],r[n]);return e};var Ywe,Xwe=mde,Wwe=Rwe,Zwe=uge,$we=tpe,ebe=Vye,tbe=tde,nbe=epe("IE_PROTO"),rbe=function(){},ibe=function(e){return"<script>"+e+"</"+"script>"},obe=function(e){e.write(ibe("")),e.close();var t=e.parentWindow.Object;return e=null,t},abe=function(){try{Ywe=new ActiveXObject("htmlfile")}catch(e){}var e,t;abe="undefined"!=typeof document?document.domain&&Ywe?obe(Ywe):((t=tbe("iframe")).style.display="none",ebe.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(ibe("document.F=Object")),e.close(),e.F):obe(Ywe);for(var n=Zwe.length;n--;)delete abe.prototype[Zwe[n]];return abe()};$we[nbe]=!0;var sbe,lbe,ube=Object.create||function(e,t){var n;return null!==e?(rbe.prototype=Xwe(e),n=new rbe,rbe.prototype=null,n[nbe]=e):n=abe(),void 0===t?n:Wwe.f(n,t)},Abe=Xce,cbe=Jce.RegExp,hbe=Abe((function(){var e=cbe(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),fbe=Xce,dbe=Jce.RegExp,pbe=fbe((function(){var e=dbe("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),gbe=the,ybe=dhe,mbe=_we,vbe=Dwe,Ibe=Twe,wbe=hfe.exports,bbe=ube,Bbe=vpe.get,Ebe=hbe,Cbe=pbe,Sbe=wbe("native-string-replace",String.prototype.replace),xbe=RegExp.prototype.exec,Qbe=xbe,kbe=ybe("".charAt),_be=ybe("".indexOf),Nbe=ybe("".replace),Dbe=ybe("".slice),Fbe=(lbe=/b*/g,gbe(xbe,sbe=/a/,"a"),gbe(xbe,lbe,"a"),0!==sbe.lastIndex||0!==lbe.lastIndex),Pbe=Ibe.BROKEN_CARET,Ube=void 0!==/()??/.exec("")[1];(Fbe||Ube||Pbe||Ebe||Cbe)&&(Qbe=function(e){var t,n,r,i,o,a,s,l=this,u=Bbe(l),A=mbe(e),c=u.raw;if(c)return c.lastIndex=l.lastIndex,t=gbe(Qbe,c,A),l.lastIndex=c.lastIndex,t;var h=u.groups,f=Pbe&&l.sticky,d=gbe(vbe,l),p=l.source,g=0,y=A;if(f&&(d=Nbe(d,"y",""),-1===_be(d,"g")&&(d+="g"),y=Dbe(A,l.lastIndex),l.lastIndex>0&&(!l.multiline||l.multiline&&"\n"!==kbe(A,l.lastIndex-1))&&(p="(?: "+p+")",y=" "+y,g++),n=new RegExp("^(?:"+p+")",d)),Ube&&(n=new RegExp("^"+p+"$(?!\\s)",d)),Fbe&&(r=l.lastIndex),i=gbe(xbe,f?n:l,y),f?i?(i.input=Dbe(i.input,g),i[0]=Dbe(i[0],g),i.index=l.lastIndex,l.lastIndex+=i[0].length):l.lastIndex=0:Fbe&&i&&(l.lastIndex=l.global?i.index+i[0].length:r),Ube&&i&&i.length>1&&gbe(Sbe,i[0],n,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=bbe(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var Mbe=Qbe;Rge({target:"RegExp",proto:!0,forced:/./.exec!==Mbe},{exec:Mbe});var Lbe=dhe,Tbe=Mpe,Rbe=Mbe,Obe=Xce,Hbe=Hfe,Kbe=Dde,jbe=Hbe("species"),Gbe=RegExp.prototype,qbe=function(e,t,n,r){var i=Hbe(e),o=!Obe((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Obe((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[jbe]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!o||!a||n){var s=Lbe(/./[i]),l=t(i,""[e],(function(e,t,n,r,i){var a=Lbe(e),l=t.exec;return l===Rbe||l===Gbe.exec?o&&!i?{done:!0,value:s(t,n,r)}:{done:!0,value:a(n,t,r)}:{done:!1}}));Tbe(String.prototype,e,l[0]),Tbe(Gbe,i,l[1])}r&&Kbe(Gbe[i],"sham",!0)},Vbe=dhe,zbe=Kpe,Jbe=_we,Ybe=Che,Xbe=Vbe("".charAt),Wbe=Vbe("".charCodeAt),Zbe=Vbe("".slice),$be=function(e){return function(t,n){var r,i,o=Jbe(Ybe(t)),a=zbe(n),s=o.length;return a<0||a>=s?e?"":void 0:(r=Wbe(o,a))<55296||r>56319||a+1===s||(i=Wbe(o,a+1))<56320||i>57343?e?Xbe(o,a):r:e?Zbe(o,a,a+2):i-56320+(r-55296<<10)+65536}},eBe={codeAt:$be(!1),charAt:$be(!0)}.charAt,tBe=function(e,t,n){return t+(n?eBe(e,t).length:1)},nBe=the,rBe=mde,iBe=khe,oBe=mhe,aBe=Mbe,sBe=TypeError,lBe=function(e,t){var n=e.exec;if(iBe(n)){var r=nBe(n,e,t);return null!==r&&rBe(r),r}if("RegExp"===oBe(e))return nBe(aBe,e,t);throw sBe("RegExp#exec called on incompatible receiver")},uBe=the,ABe=mde,cBe=Ype,hBe=_we,fBe=Che,dBe=sfe,pBe=tBe,gBe=lBe;qbe("match",(function(e,t,n){return[function(t){var n=fBe(this),r=null==t?void 0:dBe(t,e);return r?uBe(r,t,n):new RegExp(t)[e](hBe(n))},function(e){var r=ABe(this),i=hBe(e),o=n(t,r,i);if(o.done)return o.value;if(!r.global)return gBe(r,i);var a=r.unicode;r.lastIndex=0;for(var s,l=[],u=0;null!==(s=gBe(r,i));){var A=hBe(s[0]);l[u]=A,""===A&&(r.lastIndex=pBe(i,cBe(r.lastIndex),a)),u++}return 0===u?null:l}]}));var yBe=dhe,mBe=bfe,vBe=Math.floor,IBe=yBe("".charAt),wBe=yBe("".replace),bBe=yBe("".slice),BBe=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,EBe=/\$([$&'`]|\d{1,2})/g,CBe=Hye,SBe=the,xBe=dhe,QBe=qbe,kBe=Xce,_Be=mde,NBe=khe,DBe=Kpe,FBe=Ype,PBe=_we,UBe=Che,MBe=tBe,LBe=sfe,TBe=function(e,t,n,r,i,o){var a=n+e.length,s=r.length,l=EBe;return void 0!==i&&(i=mBe(i),l=BBe),wBe(o,l,(function(o,l){var u;switch(IBe(l,0)){case"$":return"$";case"&":return e;case"`":return bBe(t,0,n);case"'":return bBe(t,a);case"<":u=i[bBe(l,1,-1)];break;default:var A=+l;if(0===A)return o;if(A>s){var c=vBe(A/10);return 0===c?o:c<=s?void 0===r[c-1]?IBe(l,1):r[c-1]+IBe(l,1):o}u=r[A-1]}return void 0===u?"":u}))},RBe=lBe,OBe=Hfe("replace"),HBe=Math.max,KBe=Math.min,jBe=xBe([].concat),GBe=xBe([].push),qBe=xBe("".indexOf),VBe=xBe("".slice),zBe=function(e){return void 0===e?e:String(e)},JBe="$0"==="a".replace(/./,"$0"),YBe=!!/./[OBe]&&""===/./[OBe]("a","$0"),XBe=!kBe((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));QBe("replace",(function(e,t,n){var r=YBe?"$":"$0";return[function(e,n){var r=UBe(this),i=null==e?void 0:LBe(e,OBe);return i?SBe(i,e,r,n):SBe(t,PBe(r),e,n)},function(e,i){var o=_Be(this),a=PBe(e);if("string"==typeof i&&-1===qBe(i,r)&&-1===qBe(i,"$<")){var s=n(t,o,a,i);if(s.done)return s.value}var l=NBe(i);l||(i=PBe(i));var u=o.global;if(u){var A=o.unicode;o.lastIndex=0}for(var c=[];;){var h=RBe(o,a);if(null===h)break;if(GBe(c,h),!u)break;""===PBe(h[0])&&(o.lastIndex=MBe(a,FBe(o.lastIndex),A))}for(var f="",d=0,p=0;p<c.length;p++){for(var g=PBe((h=c[p])[0]),y=HBe(KBe(DBe(h.index),a.length),0),m=[],v=1;v<h.length;v++)GBe(m,zBe(h[v]));var I=h.groups;if(l){var w=jBe([g],m,y,a);void 0!==I&&GBe(w,I);var b=PBe(CBe(i,void 0,w))}else b=TBe(g,a,y,m,I,i);y>=d&&(f+=VBe(a,d,y)+b,d=y+g.length)}return f+VBe(a,d)}]}),!XBe||!JBe||YBe);var WBe,ZBe=Nhe,$Be=mhe,eEe=Hfe("match"),tEe=function(e){var t;return ZBe(e)&&(void 0!==(t=e[eEe])?!!t:"RegExp"==$Be(e))},nEe=tEe,rEe=TypeError,iEe=function(e){if(nEe(e))throw rEe("The method doesn't accept regular expressions");return e},oEe=Hfe("match"),aEe=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[oEe]=!1,"/./"[e](t)}catch(e){}}return!1},sEe=Rge,lEe=dhe,uEe=Yce.f,AEe=Ype,cEe=_we,hEe=iEe,fEe=Che,dEe=aEe,pEe=lEe("".startsWith),gEe=lEe("".slice),yEe=Math.min,mEe=dEe("startsWith");sEe({target:"String",proto:!0,forced:!!(mEe||(WBe=uEe(String.prototype,"startsWith"),!WBe||WBe.writable))&&!mEe},{startsWith:function(e){var t=cEe(fEe(this));hEe(e);var n=AEe(yEe(arguments.length>1?arguments[1]:void 0,t.length)),r=cEe(e);return pEe?pEe(t,r,n):gEe(t,n,n+r.length)===r}});var vEe=Hfe,IEe=ube,wEe=fde.f,bEe=vEe("unscopables"),BEe=Array.prototype;null==BEe[bEe]&&wEe(BEe,bEe,{configurable:!0,value:IEe(null)});var EEe,CEe,SEe,xEe=!Xce((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),QEe=Cfe,kEe=khe,_Ee=bfe,NEe=xEe,DEe=epe("IE_PROTO"),FEe=Object,PEe=FEe.prototype,UEe=NEe?FEe.getPrototypeOf:function(e){var t=_Ee(e);if(QEe(t,DEe))return t[DEe];var n=t.constructor;return kEe(n)&&t instanceof n?n.prototype:t instanceof FEe?PEe:null},MEe=Xce,LEe=khe,TEe=UEe,REe=Mpe,OEe=Hfe("iterator"),HEe=!1;[].keys&&("next"in(SEe=[].keys())?(CEe=TEe(TEe(SEe)))!==Object.prototype&&(EEe=CEe):HEe=!0);var KEe=null==EEe||MEe((function(){var e={};return EEe[OEe].call(e)!==e}));KEe&&(EEe={}),LEe(EEe[OEe])||REe(EEe,OEe,(function(){return this}));var jEe={IteratorPrototype:EEe,BUGGY_SAFARI_ITERATORS:HEe},GEe=jEe.IteratorPrototype,qEe=ube,VEe=lhe,zEe=Wge,JEe=pIe,YEe=function(){return this},XEe=Rge,WEe=the,ZEe=khe,$Ee=function(e,t,n,r){var i=t+" Iterator";return e.prototype=qEe(GEe,{next:VEe(+!r,n)}),zEe(e,i,!1),JEe[i]=YEe,e},eCe=UEe,tCe=zge,nCe=Wge,rCe=Dde,iCe=Mpe,oCe=pIe,aCe=Rde.PROPER,sCe=Rde.CONFIGURABLE,lCe=jEe.IteratorPrototype,uCe=jEe.BUGGY_SAFARI_ITERATORS,ACe=Hfe("iterator"),cCe="keys",hCe="values",fCe="entries",dCe=function(){return this},pCe=Qhe,gCe=function(e){BEe[bEe][e]=!0},yCe=pIe,mCe=vpe,vCe=fde.f,ICe=function(e,t,n,r,i,o,a){$Ee(n,t,r);var s,l,u,A=function(e){if(e===i&&p)return p;if(!uCe&&e in f)return f[e];switch(e){case cCe:case hCe:case fCe:return function(){return new n(this,e)}}return function(){return new n(this)}},c=t+" Iterator",h=!1,f=e.prototype,d=f[ACe]||f["@@iterator"]||i&&f[i],p=!uCe&&d||A(i),g="Array"==t&&f.entries||d;if(g&&(s=eCe(g.call(new e)))!==Object.prototype&&s.next&&(eCe(s)!==lCe&&(tCe?tCe(s,lCe):ZEe(s[ACe])||iCe(s,ACe,dCe)),nCe(s,c,!0)),aCe&&i==hCe&&d&&d.name!==hCe&&(sCe?rCe(f,"name",hCe):(h=!0,p=function(){return WEe(d,this)})),i)if(l={values:A(hCe),keys:o?p:A(cCe),entries:A(fCe)},a)for(u in l)(uCe||h||!(u in f))&&iCe(f,u,l[u]);else XEe({target:t,proto:!0,forced:uCe||h},l);return f[ACe]!==p&&iCe(f,ACe,p,{name:i}),oCe[t]=p,l},wCe=Wce,bCe="Array Iterator",BCe=mCe.set,ECe=mCe.getterFor(bCe),CCe=ICe(Array,"Array",(function(e,t){BCe(this,{type:bCe,target:pCe(e),index:0,kind:t})}),(function(){var e=ECe(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),SCe=yCe.Arguments=yCe.Array;if(gCe("keys"),gCe("values"),gCe("entries"),wCe&&"values"!==SCe.name)try{vCe(SCe,"name",{value:"values"})}catch(e){}var xCe=tde("span").classList,QCe=xCe&&xCe.constructor&&xCe.constructor.prototype,kCe=QCe===Object.prototype?void 0:QCe,_Ce=Jce,NCe={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},DCe=kCe,FCe=CCe,PCe=Dde,UCe=Hfe,MCe=UCe("iterator"),LCe=UCe("toStringTag"),TCe=FCe.values,RCe=function(e,t){if(e){if(e[MCe]!==TCe)try{PCe(e,MCe,TCe)}catch(t){e[MCe]=TCe}if(e[LCe]||PCe(e,LCe,t),NCe[t])for(var n in FCe)if(e[n]!==FCe[n])try{PCe(e,n,FCe[n])}catch(t){e[n]=FCe[n]}}};for(var OCe in NCe)RCe(_Ce[OCe]&&_Ce[OCe].prototype,OCe);RCe(DCe,"DOMTokenList");var HCe={exports:{}};!function(e){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports}(HCe);var KCe=ot(HCe.exports),jCe=ofe,GCe=bfe,qCe=Bhe,VCe=Wpe,zCe=TypeError,JCe=function(e){return function(t,n,r,i){jCe(n);var o=GCe(t),a=qCe(o),s=VCe(o),l=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(l in a){i=a[l],l+=u;break}if(l+=u,e?l<0:s<=l)throw zCe("Reduce of empty array with no initial value")}for(;e?l>=0:s>l;l+=u)l in a&&(i=n(i,a[l],l,o));return i}},YCe={left:JCe(!1),right:JCe(!0)},XCe=Xce,WCe=function(e,t){var n=[][e];return!!n&&XCe((function(){n.call(null,t||function(){return 1},1)}))},ZCe=YCe.left,$Ce=Ghe,eSe=Oge;Rge({target:"Array",proto:!0,forced:!WCe("reduce")||!eSe&&$Ce>79&&$Ce<83},{reduce:function(e){var t=arguments.length;return ZCe(this,e,t,t>1?arguments[1]:void 0)}});var tSe=Rge,nSe=dhe,rSe=Yce.f,iSe=Ype,oSe=_we,aSe=iEe,sSe=Che,lSe=aEe,uSe=nSe("".endsWith),ASe=nSe("".slice),cSe=Math.min,hSe=lSe("endsWith"),fSe=!hSe&&!!function(){var e=rSe(String.prototype,"endsWith");return e&&!e.writable}();tSe({target:"String",proto:!0,forced:!fSe&&!hSe},{endsWith:function(e){var t=oSe(sSe(this));aSe(e);var n=arguments.length>1?arguments[1]:void 0,r=t.length,i=void 0===n?r:cSe(iSe(n),r),o=oSe(e);return uSe?uSe(t,o,i):ASe(t,i-o.length,i)===o}});var dSe=Wfe,pSe=fde,gSe=lhe,ySe=Vpe,mSe=Wpe,vSe=function(e,t,n){var r=dSe(t);r in e?pSe.f(e,r,gSe(0,n)):e[r]=n},ISe=Array,wSe=Math.max,bSe=Hye,BSe=the,ESe=dhe,CSe=qbe,SSe=tEe,xSe=mde,QSe=Che,kSe=Mye,_Se=tBe,NSe=Ype,DSe=_we,FSe=sfe,PSe=function(e,t,n){for(var r=mSe(e),i=ySe(t,r),o=ySe(void 0===n?r:n,r),a=ISe(wSe(o-i,0)),s=0;i<o;i++,s++)vSe(a,s,e[i]);return a.length=s,a},USe=lBe,MSe=Mbe,LSe=Xce,TSe=Twe.UNSUPPORTED_Y,RSe=4294967295,OSe=Math.min,HSe=[].push,KSe=ESe(/./.exec),jSe=ESe(HSe),GSe=ESe("".slice),qSe=!LSe((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));CSe("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=DSe(QSe(this)),i=void 0===n?RSe:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!SSe(e))return BSe(t,r,e,i);for(var o,a,s,l=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),A=0,c=new RegExp(e.source,u+"g");(o=BSe(MSe,c,r))&&!((a=c.lastIndex)>A&&(jSe(l,GSe(r,A,o.index)),o.length>1&&o.index<r.length&&bSe(HSe,l,PSe(o,1)),s=o[0].length,A=a,l.length>=i));)c.lastIndex===o.index&&c.lastIndex++;return A===r.length?!s&&KSe(c,"")||jSe(l,""):jSe(l,GSe(r,A)),l.length>i?PSe(l,0,i):l}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:BSe(t,this,e,n)}:t,[function(t,n){var i=QSe(this),o=null==t?void 0:FSe(t,e);return o?BSe(o,t,i,n):BSe(r,DSe(i),t,n)},function(e,i){var o=xSe(this),a=DSe(e),s=n(r,o,a,i,r!==t);if(s.done)return s.value;var l=kSe(o,RegExp),u=o.unicode,A=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(TSe?"g":"y"),c=new l(TSe?"^(?:"+o.source+")":o,A),h=void 0===i?RSe:i>>>0;if(0===h)return[];if(0===a.length)return null===USe(c,a)?[a]:[];for(var f=0,d=0,p=[];d<a.length;){c.lastIndex=TSe?0:d;var g,y=USe(c,TSe?GSe(a,d):a);if(null===y||(g=OSe(NSe(c.lastIndex+(TSe?d:0)),a.length))===f)d=_Se(a,d,u);else{if(jSe(p,GSe(a,f,d)),p.length===h)return p;for(var m=1;m<=y.length-1;m++)if(jSe(p,y[m]),p.length===h)return p;d=f=g}}return jSe(p,GSe(a,f)),p}]}),!qSe,TSe);var VSe={exports:{}},zSe={exports:{}};(function(){var e,t,n,r,i,o;"undefined"!=typeof performance&&null!==performance&&performance.now?zSe.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(zSe.exports=function(){return(e()-i)/1e6},t=process.hrtime,e=function(){var e;return 1e9*(e=t())[0]+e[1]},r=e(),o=1e9*process.uptime(),i=r-o):Date.now?(zSe.exports=function(){return Date.now()-n},n=Date.now()):(zSe.exports=function(){return(new Date).getTime()-n},n=(new Date).getTime())}).call(it);for(var JSe=zSe.exports,YSe="undefined"==typeof window?it:window,XSe=["moz","webkit"],WSe="AnimationFrame",ZSe=YSe["request"+WSe],$Se=YSe["cancel"+WSe]||YSe["cancelRequest"+WSe],exe=0;!ZSe&&exe<XSe.length;exe++)ZSe=YSe[XSe[exe]+"Request"+WSe],$Se=YSe[XSe[exe]+"Cancel"+WSe]||YSe[XSe[exe]+"CancelRequest"+WSe];if(!ZSe||!$Se){var txe=0,nxe=0,rxe=[];ZSe=function(e){if(0===rxe.length){var t=JSe(),n=Math.max(0,16.666666666666668-(t-txe));txe=n+t,setTimeout((function(){var e=rxe.slice(0);rxe.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(txe)}catch(e){setTimeout((function(){throw e}),0)}}),Math.round(n))}return rxe.push({handle:++nxe,callback:e,cancelled:!1}),nxe},$Se=function(e){for(var t=0;t<rxe.length;t++)rxe[t].handle===e&&(rxe[t].cancelled=!0)}}VSe.exports=function(e){return ZSe.call(YSe,e)},VSe.exports.cancel=function(){$Se.apply(YSe,arguments)},VSe.exports.polyfill=function(e){e||(e=YSe),e.requestAnimationFrame=ZSe,e.cancelAnimationFrame=$Se};var ixe="\t\n\v\f\r \u2028\u2029\ufeff",oxe=Che,axe=_we,sxe=dhe("".replace),lxe="[\t\n\v\f\r \u2028\u2029\ufeff]",uxe=RegExp("^"+lxe+lxe+"*"),Axe=RegExp(lxe+lxe+"*$"),cxe=function(e){return function(t){var n=axe(oxe(t));return 1&e&&(n=sxe(n,uxe,"")),2&e&&(n=sxe(n,Axe,"")),n}},hxe={start:cxe(1),end:cxe(2),trim:cxe(3)},fxe=Rde.PROPER,dxe=Xce,pxe=ixe,gxe=hxe.trim;Rge({target:"String",proto:!0,forced:function(e){return dxe((function(){return!!pxe[e]()||"
"!=="
"[e]()||fxe&&pxe[e].name!==e}))}("trim")},{trim:function(){return gxe(this)}});var yxe=function(e){this.ok=!1,this.alpha=1,"#"==e.charAt(0)&&(e=e.substr(1,6)),e=(e=e.replace(/ /g,"")).toLowerCase();var t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};e=t[e]||e;for(var n=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),parseFloat(e[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}],r=0;r<n.length;r++){var i=n[r].re,o=n[r].process,a=i.exec(e);if(a){var s=o(a);this.r=s[0],this.g=s[1],this.b=s[2],s.length>3&&(this.alpha=s[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var e=this.r.toString(16),t=this.g.toString(16),n=this.b.toString(16);return 1==e.length&&(e="0"+e),1==t.length&&(t="0"+t),1==n.length&&(n="0"+n),"#"+e+t+n},this.getHelpXML=function(){for(var e=new Array,r=0;r<n.length;r++)for(var i=n[r].example,o=0;o<i.length;o++)e[e.length]=i[o];for(var a in t)e[e.length]=a;var s=document.createElement("ul");s.setAttribute("id","rgbcolor-examples");for(r=0;r<e.length;r++)try{var l=document.createElement("li"),u=new RGBColor(e[r]),A=document.createElement("div");A.style.cssText="margin: 3px; border: 1px solid black; background:"+u.toHex()+"; color:"+u.toHex(),A.appendChild(document.createTextNode("test"));var c=document.createTextNode(" "+e[r]+" -> "+u.toRGB()+" -> "+u.toHex());l.appendChild(A),l.appendChild(c),s.appendChild(l)}catch(e){}return s}},mxe=Rge,vxe=nge.indexOf,Ixe=WCe,wxe=dhe([].indexOf),bxe=!!wxe&&1/wxe([1],1,-0)<0,Bxe=Ixe("indexOf");mxe({target:"Array",proto:!0,forced:bxe||!Bxe},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return bxe?wxe(this,e,t)||0:vxe(this,e,t)}});var Exe=Rge,Cxe=iEe,Sxe=Che,xxe=_we,Qxe=aEe,kxe=dhe("".indexOf);Exe({target:"String",proto:!0,forced:!Qxe("includes")},{includes:function(e){return!!~kxe(xxe(Sxe(this)),xxe(Cxe(e)),arguments.length>1?arguments[1]:void 0)}});var _xe=mhe,Nxe=Rge,Dxe=Array.isArray||function(e){return"Array"==_xe(e)},Fxe=dhe([].reverse),Pxe=[1,2];Nxe({target:"Array",proto:!0,forced:String(Pxe)===String(Pxe.reverse())},{reverse:function(){return Dxe(this)&&(this.length=this.length),Fxe(this)}});
|
|
1172
|
+
></buv-raw>`}),{mapDispatchToProps:Gce,mapStateToProps:e=>({errorMessage:jce(e),hasCertificate:!!yle(e)}),ownProps:Object.assign(Object.assign({},Kce.properties),Que)});window.customElements.define("blockcerts-verifier",qce);var Vce={exports:{}};
|
|
1173
|
+
/*! @license DOMPurify 2.3.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.8/LICENSE */!function(e,t){e.exports=function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function r(e,i,o){return r=n()?Reflect.construct:function(e,n,r){var i=[null];i.push.apply(i,n);var o=new(Function.bind.apply(e,i));return r&&t(o,r.prototype),o},r.apply(null,arguments)}function i(e){return o(e)||a(e)||s(e)||u()}function o(e){if(Array.isArray(e))return l(e)}function a(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var A=Object.hasOwnProperty,c=Object.setPrototypeOf,h=Object.isFrozen,f=Object.getPrototypeOf,d=Object.getOwnPropertyDescriptor,p=Object.freeze,g=Object.seal,y=Object.create,m="undefined"!=typeof Reflect&&Reflect,v=m.apply,I=m.construct;v||(v=function(e,t,n){return e.apply(t,n)}),p||(p=function(e){return e}),g||(g=function(e){return e}),I||(I=function(e,t){return r(e,i(t))});var w=N(Array.prototype.forEach),b=N(Array.prototype.pop),B=N(Array.prototype.push),E=N(String.prototype.toLowerCase),C=N(String.prototype.match),S=N(String.prototype.replace),x=N(String.prototype.indexOf),Q=N(String.prototype.trim),k=N(RegExp.prototype.test),_=D(TypeError);function N(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return v(e,t,r)}}function D(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return I(e,n)}}function F(e,t){c&&c(e,null);for(var n=t.length;n--;){var r=t[n];if("string"==typeof r){var i=E(r);i!==r&&(h(t)||(t[n]=i),r=i)}e[r]=!0}return e}function P(e){var t,n=y(null);for(t in e)v(A,e,[t])&&(n[t]=e[t]);return n}function U(e,t){for(;null!==e;){var n=d(e,t);if(n){if(n.get)return N(n.get);if("function"==typeof n.value)return N(n.value)}e=f(e)}function r(e){return console.warn("fallback value for",e),null}return r}var M=p(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),L=p(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),T=p(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),R=p(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),O=p(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),H=p(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),K=p(["#text"]),j=p(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),G=p(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),q=p(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),V=p(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),z=g(/\{\{[\w\W]*|[\w\W]*\}\}/gm),J=g(/<%[\w\W]*|[\w\W]*%>/gm),Y=g(/^data-[\-\w.\u00B7-\uFFFF]/),X=g(/^aria-[\-\w]+$/),W=g(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Z=g(/^(?:\w+script|data):/i),$=g(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ee=g(/^html$/i),te=function(){return"undefined"==typeof window?null:window},ne=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null,i="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(i)&&(r=n.currentScript.getAttribute(i));var o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};function re(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:te(),n=function(e){return re(e)};if(n.version="2.3.8",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,o=t.document,a=t.DocumentFragment,s=t.HTMLTemplateElement,l=t.Node,u=t.Element,A=t.NodeFilter,c=t.NamedNodeMap,h=void 0===c?t.NamedNodeMap||t.MozNamedAttrMap:c,f=t.HTMLFormElement,d=t.DOMParser,g=t.trustedTypes,y=u.prototype,m=U(y,"cloneNode"),v=U(y,"nextSibling"),I=U(y,"childNodes"),N=U(y,"parentNode");if("function"==typeof s){var D=o.createElement("template");D.content&&D.content.ownerDocument&&(o=D.content.ownerDocument)}var ie=ne(g,r),oe=ie?ie.createHTML(""):"",ae=o,se=ae.implementation,le=ae.createNodeIterator,ue=ae.createDocumentFragment,Ae=ae.getElementsByTagName,ce=r.importNode,he={};try{he=P(o).documentMode?o.documentMode:{}}catch(e){}var fe={};n.isSupported="function"==typeof N&&se&&void 0!==se.createHTMLDocument&&9!==he;var de,pe,ge=z,ye=J,me=Y,ve=X,Ie=Z,we=$,be=W,Be=null,Ee=F({},[].concat(i(M),i(L),i(T),i(O),i(K))),Ce=null,Se=F({},[].concat(i(j),i(G),i(q),i(V))),xe=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Qe=null,ke=null,_e=!0,Ne=!0,De=!1,Fe=!1,Pe=!1,Ue=!1,Me=!1,Le=!1,Te=!1,Re=!1,Oe=!0,He=!0,Ke=!1,je={},Ge=null,qe=F({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ve=null,ze=F({},["audio","video","img","source","image","track"]),Je=null,Ye=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xe="http://www.w3.org/1998/Math/MathML",We="http://www.w3.org/2000/svg",Ze="http://www.w3.org/1999/xhtml",$e=Ze,et=!1,tt=["application/xhtml+xml","text/html"],nt="text/html",rt=null,it=o.createElement("form"),ot=function(e){return e instanceof RegExp||e instanceof Function},at=function(t){rt&&rt===t||(t&&"object"===e(t)||(t={}),t=P(t),Be="ALLOWED_TAGS"in t?F({},t.ALLOWED_TAGS):Ee,Ce="ALLOWED_ATTR"in t?F({},t.ALLOWED_ATTR):Se,Je="ADD_URI_SAFE_ATTR"in t?F(P(Ye),t.ADD_URI_SAFE_ATTR):Ye,Ve="ADD_DATA_URI_TAGS"in t?F(P(ze),t.ADD_DATA_URI_TAGS):ze,Ge="FORBID_CONTENTS"in t?F({},t.FORBID_CONTENTS):qe,Qe="FORBID_TAGS"in t?F({},t.FORBID_TAGS):{},ke="FORBID_ATTR"in t?F({},t.FORBID_ATTR):{},je="USE_PROFILES"in t&&t.USE_PROFILES,_e=!1!==t.ALLOW_ARIA_ATTR,Ne=!1!==t.ALLOW_DATA_ATTR,De=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Fe=t.SAFE_FOR_TEMPLATES||!1,Pe=t.WHOLE_DOCUMENT||!1,Le=t.RETURN_DOM||!1,Te=t.RETURN_DOM_FRAGMENT||!1,Re=t.RETURN_TRUSTED_TYPE||!1,Me=t.FORCE_BODY||!1,Oe=!1!==t.SANITIZE_DOM,He=!1!==t.KEEP_CONTENT,Ke=t.IN_PLACE||!1,be=t.ALLOWED_URI_REGEXP||be,$e=t.NAMESPACE||Ze,t.CUSTOM_ELEMENT_HANDLING&&ot(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(xe.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&ot(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(xe.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(xe.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),de=de=-1===tt.indexOf(t.PARSER_MEDIA_TYPE)?nt:t.PARSER_MEDIA_TYPE,pe="application/xhtml+xml"===de?function(e){return e}:E,Fe&&(Ne=!1),Te&&(Le=!0),je&&(Be=F({},i(K)),Ce=[],!0===je.html&&(F(Be,M),F(Ce,j)),!0===je.svg&&(F(Be,L),F(Ce,G),F(Ce,V)),!0===je.svgFilters&&(F(Be,T),F(Ce,G),F(Ce,V)),!0===je.mathMl&&(F(Be,O),F(Ce,q),F(Ce,V))),t.ADD_TAGS&&(Be===Ee&&(Be=P(Be)),F(Be,t.ADD_TAGS)),t.ADD_ATTR&&(Ce===Se&&(Ce=P(Ce)),F(Ce,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&F(Je,t.ADD_URI_SAFE_ATTR),t.FORBID_CONTENTS&&(Ge===qe&&(Ge=P(Ge)),F(Ge,t.FORBID_CONTENTS)),He&&(Be["#text"]=!0),Pe&&F(Be,["html","head","body"]),Be.table&&(F(Be,["tbody"]),delete Qe.tbody),p&&p(t),rt=t)},st=F({},["mi","mo","mn","ms","mtext"]),lt=F({},["foreignobject","desc","title","annotation-xml"]),ut=F({},["title","style","font","a","script"]),At=F({},L);F(At,T),F(At,R);var ct=F({},O);F(ct,H);var ht=function(e){var t=N(e);t&&t.tagName||(t={namespaceURI:Ze,tagName:"template"});var n=E(e.tagName),r=E(t.tagName);return e.namespaceURI===We?t.namespaceURI===Ze?"svg"===n:t.namespaceURI===Xe?"svg"===n&&("annotation-xml"===r||st[r]):Boolean(At[n]):e.namespaceURI===Xe?t.namespaceURI===Ze?"math"===n:t.namespaceURI===We?"math"===n&<[r]:Boolean(ct[n]):e.namespaceURI===Ze&&!(t.namespaceURI===We&&!lt[r])&&!(t.namespaceURI===Xe&&!st[r])&&!ct[n]&&(ut[n]||!At[n])},ft=function(e){B(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=oe}catch(t){e.remove()}}},dt=function(e,t){try{B(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){B(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Ce[e])if(Le||Te)try{ft(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},pt=function(e){var t,n;if(Me)e="<remove></remove>"+e;else{var r=C(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===de&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var i=ie?ie.createHTML(e):e;if($e===Ze)try{t=(new d).parseFromString(i,de)}catch(e){}if(!t||!t.documentElement){t=se.createDocument($e,"template",null);try{t.documentElement.innerHTML=et?"":i}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),$e===Ze?Ae.call(t,Pe?"html":"body")[0]:Pe?t.documentElement:a},gt=function(e){return le.call(e.ownerDocument||e,e,A.SHOW_ELEMENT|A.SHOW_COMMENT|A.SHOW_TEXT,null,!1)},yt=function(e){return e instanceof f&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},mt=function(t){return"object"===e(l)?t instanceof l:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},vt=function(e,t,r){fe[e]&&w(fe[e],(function(e){e.call(n,t,r,rt)}))},It=function(e){var t;if(vt("beforeSanitizeElements",e,null),yt(e))return ft(e),!0;if(k(/[\u0080-\uFFFF]/,e.nodeName))return ft(e),!0;var r=pe(e.nodeName);if(vt("uponSanitizeElement",e,{tagName:r,allowedTags:Be}),e.hasChildNodes()&&!mt(e.firstElementChild)&&(!mt(e.content)||!mt(e.content.firstElementChild))&&k(/<[/\w]/g,e.innerHTML)&&k(/<[/\w]/g,e.textContent))return ft(e),!0;if("select"===r&&k(/<template/i,e.innerHTML))return ft(e),!0;if(!Be[r]||Qe[r]){if(!Qe[r]&&bt(r)){if(xe.tagNameCheck instanceof RegExp&&k(xe.tagNameCheck,r))return!1;if(xe.tagNameCheck instanceof Function&&xe.tagNameCheck(r))return!1}if(He&&!Ge[r]){var i=N(e)||e.parentNode,o=I(e)||e.childNodes;if(o&&i)for(var a=o.length-1;a>=0;--a)i.insertBefore(m(o[a],!0),v(e))}return ft(e),!0}return e instanceof u&&!ht(e)?(ft(e),!0):"noscript"!==r&&"noembed"!==r||!k(/<\/no(script|embed)/i,e.innerHTML)?(Fe&&3===e.nodeType&&(t=e.textContent,t=S(t,ge," "),t=S(t,ye," "),e.textContent!==t&&(B(n.removed,{element:e.cloneNode()}),e.textContent=t)),vt("afterSanitizeElements",e,null),!1):(ft(e),!0)},wt=function(e,t,n){if(Oe&&("id"===t||"name"===t)&&(n in o||n in it))return!1;if(Ne&&!ke[t]&&k(me,t));else if(_e&&k(ve,t));else if(!Ce[t]||ke[t]){if(!(bt(e)&&(xe.tagNameCheck instanceof RegExp&&k(xe.tagNameCheck,e)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(e))&&(xe.attributeNameCheck instanceof RegExp&&k(xe.attributeNameCheck,t)||xe.attributeNameCheck instanceof Function&&xe.attributeNameCheck(t))||"is"===t&&xe.allowCustomizedBuiltInElements&&(xe.tagNameCheck instanceof RegExp&&k(xe.tagNameCheck,n)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(n))))return!1}else if(Je[t]);else if(k(be,S(n,we,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==x(n,"data:")||!Ve[e])if(De&&!k(Ie,S(n,we,"")));else if(n)return!1;return!0},bt=function(e){return e.indexOf("-")>0},Bt=function(e){var t,r,i,o;vt("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ce};for(o=a.length;o--;){var l=t=a[o],u=l.name,A=l.namespaceURI;if(r="value"===u?t.value:Q(t.value),i=pe(u),s.attrName=i,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,vt("uponSanitizeAttribute",e,s),r=s.attrValue,!s.forceKeepAttr&&(dt(u,e),s.keepAttr))if(k(/\/>/i,r))dt(u,e);else{Fe&&(r=S(r,ge," "),r=S(r,ye," "));var c=pe(e.nodeName);if(wt(c,i,r))try{A?e.setAttributeNS(A,u,r):e.setAttribute(u,r),b(n.removed)}catch(e){}}}vt("afterSanitizeAttributes",e,null)}},Et=function e(t){var n,r=gt(t);for(vt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)vt("uponSanitizeShadowNode",n,null),It(n)||(n.content instanceof a&&e(n.content),Bt(n));vt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(i,o){var s,u,A,c,h;if((et=!i)&&(i="\x3c!--\x3e"),"string"!=typeof i&&!mt(i)){if("function"!=typeof i.toString)throw _("toString is not a function");if("string"!=typeof(i=i.toString()))throw _("dirty is not a string, aborting")}if(!n.isSupported){if("object"===e(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof i)return t.toStaticHTML(i);if(mt(i))return t.toStaticHTML(i.outerHTML)}return i}if(Ue||at(o),n.removed=[],"string"==typeof i&&(Ke=!1),Ke){if(i.nodeName){var f=pe(i.nodeName);if(!Be[f]||Qe[f])throw _("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof l)1===(u=(s=pt("\x3c!----\x3e")).ownerDocument.importNode(i,!0)).nodeType&&"BODY"===u.nodeName||"HTML"===u.nodeName?s=u:s.appendChild(u);else{if(!Le&&!Fe&&!Pe&&-1===i.indexOf("<"))return ie&&Re?ie.createHTML(i):i;if(!(s=pt(i)))return Le?null:Re?oe:""}s&&Me&&ft(s.firstChild);for(var d=gt(Ke?i:s);A=d.nextNode();)3===A.nodeType&&A===c||It(A)||(A.content instanceof a&&Et(A.content),Bt(A),c=A);if(c=null,Ke)return i;if(Le){if(Te)for(h=ue.call(s.ownerDocument);s.firstChild;)h.appendChild(s.firstChild);else h=s;return Ce.shadowroot&&(h=ce.call(r,h,!0)),h}var p=Pe?s.outerHTML:s.innerHTML;return Pe&&Be["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&k(ee,s.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+s.ownerDocument.doctype.name+">\n"+p),Fe&&(p=S(p,ge," "),p=S(p,ye," ")),ie&&Re?ie.createHTML(p):p},n.setConfig=function(e){at(e),Ue=!0},n.clearConfig=function(){rt=null,Ue=!1},n.isValidAttribute=function(e,t,n){rt||at({});var r=pe(e),i=pe(t);return wt(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&(fe[e]=fe[e]||[],B(fe[e],t))},n.removeHook=function(e){if(fe[e])return b(fe[e])},n.removeHooks=function(e){fe[e]&&(fe[e]=[])},n.removeAllHooks=function(){fe={}},n}return re()}()}(Vce);var zce=e({__proto__:null,default:Vce.exports},[Vce.exports]),Jce=function(e){return e&&e.Math==Math&&e},Yce=Jce("object"==typeof globalThis&&globalThis)||Jce("object"==typeof window&&window)||Jce("object"==typeof self&&self)||Jce("object"==typeof it&&it)||function(){return this}()||Function("return this")(),Xce={},Wce=function(e){try{return!!e()}catch(e){return!0}},Zce=!Wce((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),$ce=!Wce((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),ehe=$ce,the=Function.prototype.call,nhe=ehe?the.bind(the):function(){return the.apply(the,arguments)},rhe={},ihe={}.propertyIsEnumerable,ohe=Object.getOwnPropertyDescriptor,ahe=ohe&&!ihe.call({1:2},1);rhe.f=ahe?function(e){var t=ohe(this,e);return!!t&&t.enumerable}:ihe;var she,lhe,uhe=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Ahe=$ce,che=Function.prototype,hhe=che.bind,fhe=che.call,dhe=Ahe&&hhe.bind(fhe,fhe),phe=Ahe?function(e){return e&&dhe(e)}:function(e){return e&&function(){return fhe.apply(e,arguments)}},ghe=phe,yhe=ghe({}.toString),mhe=ghe("".slice),vhe=function(e){return mhe(yhe(e),8,-1)},Ihe=Wce,whe=vhe,bhe=Object,Bhe=phe("".split),Ehe=Ihe((function(){return!bhe("z").propertyIsEnumerable(0)}))?function(e){return"String"==whe(e)?Bhe(e,""):bhe(e)}:bhe,Che=TypeError,She=function(e){if(null==e)throw Che("Can't call method on "+e);return e},xhe=Ehe,Qhe=She,khe=function(e){return xhe(Qhe(e))},_he=function(e){return"function"==typeof e},Nhe=_he,Dhe=function(e){return"object"==typeof e?null!==e:Nhe(e)},Fhe=Yce,Phe=_he,Uhe=function(e){return Phe(e)?e:void 0},Mhe=function(e,t){return arguments.length<2?Uhe(Fhe[e]):Fhe[e]&&Fhe[e][t]},Lhe=phe({}.isPrototypeOf),The=Mhe("navigator","userAgent")||"",Rhe=Yce,Ohe=The,Hhe=Rhe.process,Khe=Rhe.Deno,jhe=Hhe&&Hhe.versions||Khe&&Khe.version,Ghe=jhe&&jhe.v8;Ghe&&(lhe=(she=Ghe.split("."))[0]>0&&she[0]<4?1:+(she[0]+she[1])),!lhe&&Ohe&&(!(she=Ohe.match(/Edge\/(\d+)/))||she[1]>=74)&&(she=Ohe.match(/Chrome\/(\d+)/))&&(lhe=+she[1]);var qhe=lhe,Vhe=qhe,zhe=Wce,Jhe=!!Object.getOwnPropertySymbols&&!zhe((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Vhe&&Vhe<41})),Yhe=Jhe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Xhe=Mhe,Whe=_he,Zhe=Lhe,$he=Object,efe=Yhe?function(e){return"symbol"==typeof e}:function(e){var t=Xhe("Symbol");return Whe(t)&&Zhe(t.prototype,$he(e))},tfe=String,nfe=function(e){try{return tfe(e)}catch(e){return"Object"}},rfe=_he,ife=nfe,ofe=TypeError,afe=function(e){if(rfe(e))return e;throw ofe(ife(e)+" is not a function")},sfe=afe,lfe=function(e,t){var n=e[t];return null==n?void 0:sfe(n)},ufe=nhe,Afe=_he,cfe=Dhe,hfe=TypeError,ffe={exports:{}},dfe=Yce,pfe=Object.defineProperty,gfe=function(e,t){try{pfe(dfe,e,{value:t,configurable:!0,writable:!0})}catch(n){dfe[e]=t}return t},yfe=gfe,mfe="__core-js_shared__",vfe=Yce[mfe]||yfe(mfe,{}),Ife=vfe;(ffe.exports=function(e,t){return Ife[e]||(Ife[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.24.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE",source:"https://github.com/zloirock/core-js"});var wfe=She,bfe=Object,Bfe=function(e){return bfe(wfe(e))},Efe=Bfe,Cfe=phe({}.hasOwnProperty),Sfe=Object.hasOwn||function(e,t){return Cfe(Efe(e),t)},xfe=phe,Qfe=0,kfe=Math.random(),_fe=xfe(1..toString),Nfe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+_fe(++Qfe+kfe,36)},Dfe=Yce,Ffe=ffe.exports,Pfe=Sfe,Ufe=Nfe,Mfe=Jhe,Lfe=Yhe,Tfe=Ffe("wks"),Rfe=Dfe.Symbol,Ofe=Rfe&&Rfe.for,Hfe=Lfe?Rfe:Rfe&&Rfe.withoutSetter||Ufe,Kfe=function(e){if(!Pfe(Tfe,e)||!Mfe&&"string"!=typeof Tfe[e]){var t="Symbol."+e;Mfe&&Pfe(Rfe,e)?Tfe[e]=Rfe[e]:Tfe[e]=Lfe&&Ofe?Ofe(t):Hfe(t)}return Tfe[e]},jfe=nhe,Gfe=Dhe,qfe=efe,Vfe=lfe,zfe=function(e,t){var n,r;if("string"===t&&Afe(n=e.toString)&&!cfe(r=ufe(n,e)))return r;if(Afe(n=e.valueOf)&&!cfe(r=ufe(n,e)))return r;if("string"!==t&&Afe(n=e.toString)&&!cfe(r=ufe(n,e)))return r;throw hfe("Can't convert object to primitive value")},Jfe=TypeError,Yfe=Kfe("toPrimitive"),Xfe=function(e,t){if(!Gfe(e)||qfe(e))return e;var n,r=Vfe(e,Yfe);if(r){if(void 0===t&&(t="default"),n=jfe(r,e,t),!Gfe(n)||qfe(n))return n;throw Jfe("Can't convert object to primitive value")}return void 0===t&&(t="number"),zfe(e,t)},Wfe=efe,Zfe=function(e){var t=Xfe(e,"string");return Wfe(t)?t:t+""},$fe=Dhe,ede=Yce.document,tde=$fe(ede)&&$fe(ede.createElement),nde=function(e){return tde?ede.createElement(e):{}},rde=nde,ide=!Zce&&!Wce((function(){return 7!=Object.defineProperty(rde("div"),"a",{get:function(){return 7}}).a})),ode=Zce,ade=nhe,sde=rhe,lde=uhe,ude=khe,Ade=Zfe,cde=Sfe,hde=ide,fde=Object.getOwnPropertyDescriptor;Xce.f=ode?fde:function(e,t){if(e=ude(e),t=Ade(t),hde)try{return fde(e,t)}catch(e){}if(cde(e,t))return lde(!ade(sde.f,e,t),e[t])};var dde={},pde=Zce&&Wce((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),gde=Dhe,yde=String,mde=TypeError,vde=function(e){if(gde(e))return e;throw mde(yde(e)+" is not an object")},Ide=Zce,wde=ide,bde=pde,Bde=vde,Ede=Zfe,Cde=TypeError,Sde=Object.defineProperty,xde=Object.getOwnPropertyDescriptor,Qde="enumerable",kde="configurable",_de="writable";dde.f=Ide?bde?function(e,t,n){if(Bde(e),t=Ede(t),Bde(n),"function"==typeof e&&"prototype"===t&&"value"in n&&_de in n&&!n.writable){var r=xde(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:kde in n?n.configurable:r.configurable,enumerable:Qde in n?n.enumerable:r.enumerable,writable:!1})}return Sde(e,t,n)}:Sde:function(e,t,n){if(Bde(e),t=Ede(t),Bde(n),wde)try{return Sde(e,t,n)}catch(e){}if("get"in n||"set"in n)throw Cde("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var Nde=dde,Dde=uhe,Fde=Zce?function(e,t,n){return Nde.f(e,t,Dde(1,n))}:function(e,t,n){return e[t]=n,e},Pde={exports:{}},Ude=Zce,Mde=Sfe,Lde=Function.prototype,Tde=Ude&&Object.getOwnPropertyDescriptor,Rde=Mde(Lde,"name"),Ode={EXISTS:Rde,PROPER:Rde&&"something"===function(){}.name,CONFIGURABLE:Rde&&(!Ude||Ude&&Tde(Lde,"name").configurable)},Hde=_he,Kde=vfe,jde=phe(Function.toString);Hde(Kde.inspectSource)||(Kde.inspectSource=function(e){return jde(e)});var Gde,qde,Vde,zde=Kde.inspectSource,Jde=_he,Yde=zde,Xde=Yce.WeakMap,Wde=Jde(Xde)&&/native code/.test(Yde(Xde)),Zde=ffe.exports,$de=Nfe,epe=Zde("keys"),tpe=function(e){return epe[e]||(epe[e]=$de(e))},npe={},rpe=Wde,ipe=Yce,ope=phe,ape=Dhe,spe=Fde,lpe=Sfe,upe=vfe,Ape=tpe,cpe=npe,hpe="Object already initialized",fpe=ipe.TypeError,dpe=ipe.WeakMap;if(rpe||upe.state){var ppe=upe.state||(upe.state=new dpe),gpe=ope(ppe.get),ype=ope(ppe.has),mpe=ope(ppe.set);Gde=function(e,t){if(ype(ppe,e))throw new fpe(hpe);return t.facade=e,mpe(ppe,e,t),t},qde=function(e){return gpe(ppe,e)||{}},Vde=function(e){return ype(ppe,e)}}else{var vpe=Ape("state");cpe[vpe]=!0,Gde=function(e,t){if(lpe(e,vpe))throw new fpe(hpe);return t.facade=e,spe(e,vpe,t),t},qde=function(e){return lpe(e,vpe)?e[vpe]:{}},Vde=function(e){return lpe(e,vpe)}}var Ipe={set:Gde,get:qde,has:Vde,enforce:function(e){return Vde(e)?qde(e):Gde(e,{})},getterFor:function(e){return function(t){var n;if(!ape(t)||(n=qde(t)).type!==e)throw fpe("Incompatible receiver, "+e+" required");return n}}},wpe=Wce,bpe=_he,Bpe=Sfe,Epe=Zce,Cpe=Ode.CONFIGURABLE,Spe=zde,xpe=Ipe.enforce,Qpe=Ipe.get,kpe=Object.defineProperty,_pe=Epe&&!wpe((function(){return 8!==kpe((function(){}),"length",{value:8}).length})),Npe=String(String).split("String"),Dpe=Pde.exports=function(e,t,n){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!Bpe(e,"name")||Cpe&&e.name!==t)&&(Epe?kpe(e,"name",{value:t,configurable:!0}):e.name=t),_pe&&n&&Bpe(n,"arity")&&e.length!==n.arity&&kpe(e,"length",{value:n.arity});try{n&&Bpe(n,"constructor")&&n.constructor?Epe&&kpe(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=xpe(e);return Bpe(r,"source")||(r.source=Npe.join("string"==typeof t?t:"")),e};Function.prototype.toString=Dpe((function(){return bpe(this)&&Qpe(this).source||Spe(this)}),"toString");var Fpe=_he,Ppe=dde,Upe=Pde.exports,Mpe=gfe,Lpe=function(e,t,n,r){r||(r={});var i=r.enumerable,o=void 0!==r.name?r.name:t;if(Fpe(n)&&Upe(n,o,r),r.global)i?e[t]=n:Mpe(t,n);else{try{r.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=n:Ppe.f(e,t,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},Tpe={},Rpe=Math.ceil,Ope=Math.floor,Hpe=Math.trunc||function(e){var t=+e;return(t>0?Ope:Rpe)(t)},Kpe=Hpe,jpe=function(e){var t=+e;return t!=t||0===t?0:Kpe(t)},Gpe=jpe,qpe=Math.max,Vpe=Math.min,zpe=function(e,t){var n=Gpe(e);return n<0?qpe(n+t,0):Vpe(n,t)},Jpe=jpe,Ype=Math.min,Xpe=function(e){return e>0?Ype(Jpe(e),9007199254740991):0},Wpe=Xpe,Zpe=function(e){return Wpe(e.length)},$pe=khe,ege=zpe,tge=Zpe,nge=function(e){return function(t,n,r){var i,o=$pe(t),a=tge(o),s=ege(r,a);if(e&&n!=n){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===n)return e||s||0;return!e&&-1}},rge={includes:nge(!0),indexOf:nge(!1)},ige=Sfe,oge=khe,age=rge.indexOf,sge=npe,lge=phe([].push),uge=function(e,t){var n,r=oge(e),i=0,o=[];for(n in r)!ige(sge,n)&&ige(r,n)&&lge(o,n);for(;t.length>i;)ige(r,n=t[i++])&&(~age(o,n)||lge(o,n));return o},Age=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],cge=uge,hge=Age.concat("length","prototype");Tpe.f=Object.getOwnPropertyNames||function(e){return cge(e,hge)};var fge={};fge.f=Object.getOwnPropertySymbols;var dge=Mhe,pge=Tpe,gge=fge,yge=vde,mge=phe([].concat),vge=dge("Reflect","ownKeys")||function(e){var t=pge.f(yge(e)),n=gge.f;return n?mge(t,n(e)):t},Ige=Sfe,wge=vge,bge=Xce,Bge=dde,Ege=Wce,Cge=_he,Sge=/#|\.prototype\./,xge=function(e,t){var n=kge[Qge(e)];return n==Nge||n!=_ge&&(Cge(t)?Ege(t):!!t)},Qge=xge.normalize=function(e){return String(e).replace(Sge,".").toLowerCase()},kge=xge.data={},_ge=xge.NATIVE="N",Nge=xge.POLYFILL="P",Dge=xge,Fge=Yce,Pge=Xce.f,Uge=Fde,Mge=Lpe,Lge=gfe,Tge=function(e,t,n){for(var r=wge(t),i=Bge.f,o=bge.f,a=0;a<r.length;a++){var s=r[a];Ige(e,s)||n&&Ige(n,s)||i(e,s,o(t,s))}},Rge=Dge,Oge=function(e,t){var n,r,i,o,a,s=e.target,l=e.global,u=e.stat;if(n=l?Fge:u?Fge[s]||Lge(s,{}):(Fge[s]||{}).prototype)for(r in t){if(o=t[r],i=e.dontCallGetSet?(a=Pge(n,r))&&a.value:n[r],!Rge(l?r:s+(u?".":"#")+r,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Tge(o,i)}(e.sham||i&&i.sham)&&Uge(o,"sham",!0),Mge(n,r,o,e)}},Hge="process"==vhe(Yce.process),Kge=_he,jge=String,Gge=TypeError,qge=phe,Vge=vde,zge=function(e){if("object"==typeof e||Kge(e))return e;throw Gge("Can't set "+jge(e)+" as a prototype")},Jge=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=qge(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return Vge(n),zge(r),t?e(n,r):n.__proto__=r,n}}():void 0),Yge=dde.f,Xge=Sfe,Wge=Kfe("toStringTag"),Zge=function(e,t,n){e&&!n&&(e=e.prototype),e&&!Xge(e,Wge)&&Yge(e,Wge,{configurable:!0,value:t})},$ge=Mhe,eye=dde,tye=Zce,nye=Kfe("species"),rye=Lhe,iye=TypeError,oye={};oye[Kfe("toStringTag")]="z";var aye="[object z]"===String(oye),sye=_he,lye=vhe,uye=Kfe("toStringTag"),Aye=Object,cye="Arguments"==lye(function(){return arguments}()),hye=aye?lye:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Aye(e),uye))?n:cye?lye(t):"Object"==(r=lye(t))&&sye(t.callee)?"Arguments":r},fye=phe,dye=Wce,pye=_he,gye=hye,yye=zde,mye=function(){},vye=[],Iye=Mhe("Reflect","construct"),wye=/^\s*(?:class|function)\b/,bye=fye(wye.exec),Bye=!wye.exec(mye),Eye=function(e){if(!pye(e))return!1;try{return Iye(mye,vye,e),!0}catch(e){return!1}},Cye=function(e){if(!pye(e))return!1;switch(gye(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Bye||!!bye(wye,yye(e))}catch(e){return!0}};Cye.sham=!0;var Sye,xye,Qye,kye,_ye=!Iye||dye((function(){var e;return Eye(Eye.call)||!Eye(Object)||!Eye((function(){e=!0}))||e}))?Cye:Eye,Nye=_ye,Dye=nfe,Fye=TypeError,Pye=vde,Uye=function(e){if(Nye(e))return e;throw Fye(Dye(e)+" is not a constructor")},Mye=Kfe("species"),Lye=function(e,t){var n,r=Pye(e).constructor;return void 0===r||null==(n=Pye(r)[Mye])?t:Uye(n)},Tye=$ce,Rye=Function.prototype,Oye=Rye.apply,Hye=Rye.call,Kye="object"==typeof Reflect&&Reflect.apply||(Tye?Hye.bind(Oye):function(){return Hye.apply(Oye,arguments)}),jye=afe,Gye=$ce,qye=phe(phe.bind),Vye=function(e,t){return jye(e),void 0===t?e:Gye?qye(e,t):function(){return e.apply(t,arguments)}},zye=Mhe("document","documentElement"),Jye=phe([].slice),Yye=TypeError,Xye=/(?:ipad|iphone|ipod).*applewebkit/i.test(The),Wye=Yce,Zye=Kye,$ye=Vye,eme=_he,tme=Sfe,nme=Wce,rme=zye,ime=Jye,ome=nde,ame=function(e,t){if(e<t)throw Yye("Not enough arguments");return e},sme=Xye,lme=Hge,ume=Wye.setImmediate,Ame=Wye.clearImmediate,cme=Wye.process,hme=Wye.Dispatch,fme=Wye.Function,dme=Wye.MessageChannel,pme=Wye.String,gme=0,yme={},mme="onreadystatechange";try{Sye=Wye.location}catch(e){}var vme=function(e){if(tme(yme,e)){var t=yme[e];delete yme[e],t()}},Ime=function(e){return function(){vme(e)}},wme=function(e){vme(e.data)},bme=function(e){Wye.postMessage(pme(e),Sye.protocol+"//"+Sye.host)};ume&&Ame||(ume=function(e){ame(arguments.length,1);var t=eme(e)?e:fme(e),n=ime(arguments,1);return yme[++gme]=function(){Zye(t,void 0,n)},xye(gme),gme},Ame=function(e){delete yme[e]},lme?xye=function(e){cme.nextTick(Ime(e))}:hme&&hme.now?xye=function(e){hme.now(Ime(e))}:dme&&!sme?(kye=(Qye=new dme).port2,Qye.port1.onmessage=wme,xye=$ye(kye.postMessage,kye)):Wye.addEventListener&&eme(Wye.postMessage)&&!Wye.importScripts&&Sye&&"file:"!==Sye.protocol&&!nme(bme)?(xye=bme,Wye.addEventListener("message",wme,!1)):xye=mme in ome("script")?function(e){rme.appendChild(ome("script")).onreadystatechange=function(){rme.removeChild(this),vme(e)}}:function(e){setTimeout(Ime(e),0)});var Bme,Eme,Cme,Sme,xme,Qme,kme,_me,Nme={set:ume,clear:Ame},Dme=Yce,Fme=/ipad|iphone|ipod/i.test(The)&&void 0!==Dme.Pebble,Pme=/web0s(?!.*chrome)/i.test(The),Ume=Yce,Mme=Vye,Lme=Xce.f,Tme=Nme.set,Rme=Xye,Ome=Fme,Hme=Pme,Kme=Hge,jme=Ume.MutationObserver||Ume.WebKitMutationObserver,Gme=Ume.document,qme=Ume.process,Vme=Ume.Promise,zme=Lme(Ume,"queueMicrotask"),Jme=zme&&zme.value;Jme||(Bme=function(){var e,t;for(Kme&&(e=qme.domain)&&e.exit();Eme;){t=Eme.fn,Eme=Eme.next;try{t()}catch(e){throw Eme?Sme():Cme=void 0,e}}Cme=void 0,e&&e.enter()},Rme||Kme||Hme||!jme||!Gme?!Ome&&Vme&&Vme.resolve?((kme=Vme.resolve(void 0)).constructor=Vme,_me=Mme(kme.then,kme),Sme=function(){_me(Bme)}):Kme?Sme=function(){qme.nextTick(Bme)}:(Tme=Mme(Tme,Ume),Sme=function(){Tme(Bme)}):(xme=!0,Qme=Gme.createTextNode(""),new jme(Bme).observe(Qme,{characterData:!0}),Sme=function(){Qme.data=xme=!xme}));var Yme=Jme||function(e){var t={fn:e,next:void 0};Cme&&(Cme.next=t),Eme||(Eme=t,Sme()),Cme=t},Xme=Yce,Wme=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Zme=function(){this.head=null,this.tail=null};Zme.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var $me=Zme,eve=Yce.Promise,tve="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,nve=!tve&&!Hge&&"object"==typeof window&&"object"==typeof document,rve=Yce,ive=eve,ove=_he,ave=Dge,sve=zde,lve=Kfe,uve=nve,Ave=tve,cve=qhe;ive&&ive.prototype;var hve=lve("species"),fve=!1,dve=ove(rve.PromiseRejectionEvent),pve=ave("Promise",(function(){var e=sve(ive),t=e!==String(ive);if(!t&&66===cve)return!0;if(!cve||cve<51||!/native code/.test(e)){var n=new ive((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((n.constructor={})[hve]=r,!(fve=n.then((function(){}))instanceof r))return!0}return!t&&(uve||Ave)&&!dve})),gve={CONSTRUCTOR:pve,REJECTION_EVENT:dve,SUBCLASSING:fve},yve={},mve=afe,vve=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=mve(t),this.reject=mve(n)};yve.f=function(e){return new vve(e)};var Ive,wve,bve,Bve=Oge,Eve=Hge,Cve=Yce,Sve=nhe,xve=Lpe,Qve=Jge,kve=Zge,_ve=function(e){var t=$ge(e),n=eye.f;tye&&t&&!t[nye]&&n(t,nye,{configurable:!0,get:function(){return this}})},Nve=afe,Dve=_he,Fve=Dhe,Pve=function(e,t){if(rye(t,e))return e;throw iye("Incorrect invocation")},Uve=Lye,Mve=Nme.set,Lve=Yme,Tve=function(e,t){var n=Xme.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t))},Rve=Wme,Ove=$me,Hve=Ipe,Kve=eve,jve=yve,Gve="Promise",qve=gve.CONSTRUCTOR,Vve=gve.REJECTION_EVENT,zve=gve.SUBCLASSING,Jve=Hve.getterFor(Gve),Yve=Hve.set,Xve=Kve&&Kve.prototype,Wve=Kve,Zve=Xve,$ve=Cve.TypeError,eIe=Cve.document,tIe=Cve.process,nIe=jve.f,rIe=nIe,iIe=!!(eIe&&eIe.createEvent&&Cve.dispatchEvent),oIe="unhandledrejection",aIe=function(e){var t;return!(!Fve(e)||!Dve(t=e.then))&&t},sIe=function(e,t){var n,r,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,l=e.resolve,u=e.reject,A=e.domain;try{s?(a||(2===t.rejection&&hIe(t),t.rejection=1),!0===s?n=o:(A&&A.enter(),n=s(o),A&&(A.exit(),i=!0)),n===e.promise?u($ve("Promise-chain cycle")):(r=aIe(n))?Sve(r,n,l,u):l(n)):u(o)}catch(e){A&&!i&&A.exit(),u(e)}},lIe=function(e,t){e.notified||(e.notified=!0,Lve((function(){for(var n,r=e.reactions;n=r.get();)sIe(n,e);e.notified=!1,t&&!e.rejection&&AIe(e)})))},uIe=function(e,t,n){var r,i;iIe?((r=eIe.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),Cve.dispatchEvent(r)):r={promise:t,reason:n},!Vve&&(i=Cve["on"+e])?i(r):e===oIe&&Tve("Unhandled promise rejection",n)},AIe=function(e){Sve(Mve,Cve,(function(){var t,n=e.facade,r=e.value;if(cIe(e)&&(t=Rve((function(){Eve?tIe.emit("unhandledRejection",r,n):uIe(oIe,n,r)})),e.rejection=Eve||cIe(e)?2:1,t.error))throw t.value}))},cIe=function(e){return 1!==e.rejection&&!e.parent},hIe=function(e){Sve(Mve,Cve,(function(){var t=e.facade;Eve?tIe.emit("rejectionHandled",t):uIe("rejectionhandled",t,e.value)}))},fIe=function(e,t,n){return function(r){e(t,r,n)}},dIe=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,lIe(e,!0))},pIe=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw $ve("Promise can't be resolved itself");var r=aIe(t);r?Lve((function(){var n={done:!1};try{Sve(r,t,fIe(pIe,n,e),fIe(dIe,n,e))}catch(t){dIe(n,t,e)}})):(e.value=t,e.state=1,lIe(e,!1))}catch(t){dIe({done:!1},t,e)}}};if(qve&&(Zve=(Wve=function(e){Pve(this,Zve),Nve(e),Sve(Ive,this);var t=Jve(this);try{e(fIe(pIe,t),fIe(dIe,t))}catch(e){dIe(t,e)}}).prototype,(Ive=function(e){Yve(this,{type:Gve,done:!1,notified:!1,parent:!1,reactions:new Ove,rejection:!1,state:0,value:void 0})}).prototype=xve(Zve,"then",(function(e,t){var n=Jve(this),r=nIe(Uve(this,Wve));return n.parent=!0,r.ok=!Dve(e)||e,r.fail=Dve(t)&&t,r.domain=Eve?tIe.domain:void 0,0==n.state?n.reactions.add(r):Lve((function(){sIe(r,n)})),r.promise})),wve=function(){var e=new Ive,t=Jve(e);this.promise=e,this.resolve=fIe(pIe,t),this.reject=fIe(dIe,t)},jve.f=nIe=function(e){return e===Wve||undefined===e?new wve(e):rIe(e)},Dve(Kve)&&Xve!==Object.prototype)){bve=Xve.then,zve||xve(Xve,"then",(function(e,t){var n=this;return new Wve((function(e,t){Sve(bve,n,e,t)})).then(e,t)}),{unsafe:!0});try{delete Xve.constructor}catch(e){}Qve&&Qve(Xve,Zve)}Bve({global:!0,constructor:!0,wrap:!0,forced:qve},{Promise:Wve}),kve(Wve,Gve,!1),_ve(Gve);var gIe={},yIe=gIe,mIe=Kfe("iterator"),vIe=Array.prototype,IIe=hye,wIe=lfe,bIe=gIe,BIe=Kfe("iterator"),EIe=function(e){if(null!=e)return wIe(e,BIe)||wIe(e,"@@iterator")||bIe[IIe(e)]},CIe=nhe,SIe=afe,xIe=vde,QIe=nfe,kIe=EIe,_Ie=TypeError,NIe=nhe,DIe=vde,FIe=lfe,PIe=Vye,UIe=nhe,MIe=vde,LIe=nfe,TIe=function(e){return void 0!==e&&(yIe.Array===e||vIe[mIe]===e)},RIe=Zpe,OIe=Lhe,HIe=function(e,t){var n=arguments.length<2?kIe(e):t;if(SIe(n))return xIe(CIe(n,e));throw _Ie(QIe(e)+" is not iterable")},KIe=EIe,jIe=function(e,t,n){var r,i;DIe(e);try{if(!(r=FIe(e,"return"))){if("throw"===t)throw n;return n}r=NIe(r,e)}catch(e){i=!0,r=e}if("throw"===t)throw n;if(i)throw r;return DIe(r),n},GIe=TypeError,qIe=function(e,t){this.stopped=e,this.result=t},VIe=qIe.prototype,zIe=function(e,t,n){var r,i,o,a,s,l,u,A=n&&n.that,c=!(!n||!n.AS_ENTRIES),h=!(!n||!n.IS_RECORD),f=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),p=PIe(t,A),g=function(e){return r&&jIe(r,"normal",e),new qIe(!0,e)},y=function(e){return c?(MIe(e),d?p(e[0],e[1],g):p(e[0],e[1])):d?p(e,g):p(e)};if(h)r=e.iterator;else if(f)r=e;else{if(!(i=KIe(e)))throw GIe(LIe(e)+" is not iterable");if(TIe(i)){for(o=0,a=RIe(e);a>o;o++)if((s=y(e[o]))&&OIe(VIe,s))return s;return new qIe(!1)}r=HIe(e,i)}for(l=h?e.next:r.next;!(u=UIe(l,r)).done;){try{s=y(u.value)}catch(e){jIe(r,"throw",e)}if("object"==typeof s&&s&&OIe(VIe,s))return s}return new qIe(!1)},JIe=Kfe("iterator"),YIe=!1;try{var XIe=0,WIe={next:function(){return{done:!!XIe++}},return:function(){YIe=!0}};WIe[JIe]=function(){return this},Array.from(WIe,(function(){throw 2}))}catch(e){}var ZIe=eve,$Ie=function(e,t){if(!t&&!YIe)return!1;var n=!1;try{var r={};r[JIe]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},ewe=gve.CONSTRUCTOR||!$Ie((function(e){ZIe.all(e).then(void 0,(function(){}))})),twe=nhe,nwe=afe,rwe=yve,iwe=Wme,owe=zIe;Oge({target:"Promise",stat:!0,forced:ewe},{all:function(e){var t=this,n=rwe.f(t),r=n.resolve,i=n.reject,o=iwe((function(){var n=nwe(t.resolve),o=[],a=0,s=1;owe(e,(function(e){var l=a++,u=!1;s++,twe(n,t,e).then((function(e){u||(u=!0,o[l]=e,--s||r(o))}),i)})),--s||r(o)}));return o.error&&i(o.value),n.promise}});var awe=Oge,swe=gve.CONSTRUCTOR,lwe=eve,uwe=Mhe,Awe=_he,cwe=Lpe,hwe=lwe&&lwe.prototype;if(awe({target:"Promise",proto:!0,forced:swe,real:!0},{catch:function(e){return this.then(void 0,e)}}),Awe(lwe)){var fwe=uwe("Promise").prototype.catch;hwe.catch!==fwe&&cwe(hwe,"catch",fwe,{unsafe:!0})}var dwe=nhe,pwe=afe,gwe=yve,ywe=Wme,mwe=zIe;Oge({target:"Promise",stat:!0,forced:ewe},{race:function(e){var t=this,n=gwe.f(t),r=n.reject,i=ywe((function(){var i=pwe(t.resolve);mwe(e,(function(e){dwe(i,t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var vwe=nhe,Iwe=yve;Oge({target:"Promise",stat:!0,forced:gve.CONSTRUCTOR},{reject:function(e){var t=Iwe.f(this);return vwe(t.reject,void 0,e),t.promise}});var wwe=vde,bwe=Dhe,Bwe=yve,Ewe=Oge,Cwe=gve.CONSTRUCTOR,Swe=function(e,t){if(wwe(e),bwe(t)&&t.constructor===e)return t;var n=Bwe.f(e);return(0,n.resolve)(t),n.promise};Mhe("Promise"),Ewe({target:"Promise",stat:!0,forced:Cwe},{resolve:function(e){return Swe(this,e)}});var xwe={exports:{}};!function(e){function t(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=e.apply(n,r);function s(e){t(a,i,o,s,l,"next",e)}function l(e){t(a,i,o,s,l,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports}(xwe);var Qwe=ot(xwe.exports),kwe=hye,_we=String,Nwe=function(e){if("Symbol"===kwe(e))throw TypeError("Cannot convert a Symbol value to a string");return _we(e)},Dwe=vde,Fwe=function(){var e=Dwe(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Pwe=Wce,Uwe=Yce.RegExp,Mwe=Pwe((function(){var e=Uwe("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Lwe=Mwe||Pwe((function(){return!Uwe("a","y").sticky})),Twe=Mwe||Pwe((function(){var e=Uwe("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),Rwe={BROKEN_CARET:Twe,MISSED_STICKY:Lwe,UNSUPPORTED_Y:Mwe},Owe={},Hwe=uge,Kwe=Age,jwe=Object.keys||function(e){return Hwe(e,Kwe)},Gwe=Zce,qwe=pde,Vwe=dde,zwe=vde,Jwe=khe,Ywe=jwe;Owe.f=Gwe&&!qwe?Object.defineProperties:function(e,t){zwe(e);for(var n,r=Jwe(t),i=Ywe(t),o=i.length,a=0;o>a;)Vwe.f(e,n=i[a++],r[n]);return e};var Xwe,Wwe=vde,Zwe=Owe,$we=Age,ebe=npe,tbe=zye,nbe=nde,rbe=tpe("IE_PROTO"),ibe=function(){},obe=function(e){return"<script>"+e+"</"+"script>"},abe=function(e){e.write(obe("")),e.close();var t=e.parentWindow.Object;return e=null,t},sbe=function(){try{Xwe=new ActiveXObject("htmlfile")}catch(e){}var e,t;sbe="undefined"!=typeof document?document.domain&&Xwe?abe(Xwe):((t=nbe("iframe")).style.display="none",tbe.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(obe("document.F=Object")),e.close(),e.F):abe(Xwe);for(var n=$we.length;n--;)delete sbe.prototype[$we[n]];return sbe()};ebe[rbe]=!0;var lbe,ube,Abe=Object.create||function(e,t){var n;return null!==e?(ibe.prototype=Wwe(e),n=new ibe,ibe.prototype=null,n[rbe]=e):n=sbe(),void 0===t?n:Zwe.f(n,t)},cbe=Wce,hbe=Yce.RegExp,fbe=cbe((function(){var e=hbe(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),dbe=Wce,pbe=Yce.RegExp,gbe=dbe((function(){var e=pbe("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),ybe=nhe,mbe=phe,vbe=Nwe,Ibe=Fwe,wbe=Rwe,bbe=ffe.exports,Bbe=Abe,Ebe=Ipe.get,Cbe=fbe,Sbe=gbe,xbe=bbe("native-string-replace",String.prototype.replace),Qbe=RegExp.prototype.exec,kbe=Qbe,_be=mbe("".charAt),Nbe=mbe("".indexOf),Dbe=mbe("".replace),Fbe=mbe("".slice),Pbe=(ube=/b*/g,ybe(Qbe,lbe=/a/,"a"),ybe(Qbe,ube,"a"),0!==lbe.lastIndex||0!==ube.lastIndex),Ube=wbe.BROKEN_CARET,Mbe=void 0!==/()??/.exec("")[1];(Pbe||Mbe||Ube||Cbe||Sbe)&&(kbe=function(e){var t,n,r,i,o,a,s,l=this,u=Ebe(l),A=vbe(e),c=u.raw;if(c)return c.lastIndex=l.lastIndex,t=ybe(kbe,c,A),l.lastIndex=c.lastIndex,t;var h=u.groups,f=Ube&&l.sticky,d=ybe(Ibe,l),p=l.source,g=0,y=A;if(f&&(d=Dbe(d,"y",""),-1===Nbe(d,"g")&&(d+="g"),y=Fbe(A,l.lastIndex),l.lastIndex>0&&(!l.multiline||l.multiline&&"\n"!==_be(A,l.lastIndex-1))&&(p="(?: "+p+")",y=" "+y,g++),n=new RegExp("^(?:"+p+")",d)),Mbe&&(n=new RegExp("^"+p+"$(?!\\s)",d)),Pbe&&(r=l.lastIndex),i=ybe(Qbe,f?n:l,y),f?i?(i.input=Fbe(i.input,g),i[0]=Fbe(i[0],g),i.index=l.lastIndex,l.lastIndex+=i[0].length):l.lastIndex=0:Pbe&&i&&(l.lastIndex=l.global?i.index+i[0].length:r),Mbe&&i&&i.length>1&&ybe(xbe,i[0],n,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=Bbe(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var Lbe=kbe;Oge({target:"RegExp",proto:!0,forced:/./.exec!==Lbe},{exec:Lbe});var Tbe=phe,Rbe=Lpe,Obe=Lbe,Hbe=Wce,Kbe=Kfe,jbe=Fde,Gbe=Kbe("species"),qbe=RegExp.prototype,Vbe=function(e,t,n,r){var i=Kbe(e),o=!Hbe((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Hbe((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[Gbe]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!o||!a||n){var s=Tbe(/./[i]),l=t(i,""[e],(function(e,t,n,r,i){var a=Tbe(e),l=t.exec;return l===Obe||l===qbe.exec?o&&!i?{done:!0,value:s(t,n,r)}:{done:!0,value:a(n,t,r)}:{done:!1}}));Rbe(String.prototype,e,l[0]),Rbe(qbe,i,l[1])}r&&jbe(qbe[i],"sham",!0)},zbe=phe,Jbe=jpe,Ybe=Nwe,Xbe=She,Wbe=zbe("".charAt),Zbe=zbe("".charCodeAt),$be=zbe("".slice),eBe=function(e){return function(t,n){var r,i,o=Ybe(Xbe(t)),a=Jbe(n),s=o.length;return a<0||a>=s?e?"":void 0:(r=Zbe(o,a))<55296||r>56319||a+1===s||(i=Zbe(o,a+1))<56320||i>57343?e?Wbe(o,a):r:e?$be(o,a,a+2):i-56320+(r-55296<<10)+65536}},tBe={codeAt:eBe(!1),charAt:eBe(!0)}.charAt,nBe=function(e,t,n){return t+(n?tBe(e,t).length:1)},rBe=nhe,iBe=vde,oBe=_he,aBe=vhe,sBe=Lbe,lBe=TypeError,uBe=function(e,t){var n=e.exec;if(oBe(n)){var r=rBe(n,e,t);return null!==r&&iBe(r),r}if("RegExp"===aBe(e))return rBe(sBe,e,t);throw lBe("RegExp#exec called on incompatible receiver")},ABe=nhe,cBe=vde,hBe=Xpe,fBe=Nwe,dBe=She,pBe=lfe,gBe=nBe,yBe=uBe;Vbe("match",(function(e,t,n){return[function(t){var n=dBe(this),r=null==t?void 0:pBe(t,e);return r?ABe(r,t,n):new RegExp(t)[e](fBe(n))},function(e){var r=cBe(this),i=fBe(e),o=n(t,r,i);if(o.done)return o.value;if(!r.global)return yBe(r,i);var a=r.unicode;r.lastIndex=0;for(var s,l=[],u=0;null!==(s=yBe(r,i));){var A=fBe(s[0]);l[u]=A,""===A&&(r.lastIndex=gBe(i,hBe(r.lastIndex),a)),u++}return 0===u?null:l}]}));var mBe=phe,vBe=Bfe,IBe=Math.floor,wBe=mBe("".charAt),bBe=mBe("".replace),BBe=mBe("".slice),EBe=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,CBe=/\$([$&'`]|\d{1,2})/g,SBe=Kye,xBe=nhe,QBe=phe,kBe=Vbe,_Be=Wce,NBe=vde,DBe=_he,FBe=jpe,PBe=Xpe,UBe=Nwe,MBe=She,LBe=nBe,TBe=lfe,RBe=function(e,t,n,r,i,o){var a=n+e.length,s=r.length,l=CBe;return void 0!==i&&(i=vBe(i),l=EBe),bBe(o,l,(function(o,l){var u;switch(wBe(l,0)){case"$":return"$";case"&":return e;case"`":return BBe(t,0,n);case"'":return BBe(t,a);case"<":u=i[BBe(l,1,-1)];break;default:var A=+l;if(0===A)return o;if(A>s){var c=IBe(A/10);return 0===c?o:c<=s?void 0===r[c-1]?wBe(l,1):r[c-1]+wBe(l,1):o}u=r[A-1]}return void 0===u?"":u}))},OBe=uBe,HBe=Kfe("replace"),KBe=Math.max,jBe=Math.min,GBe=QBe([].concat),qBe=QBe([].push),VBe=QBe("".indexOf),zBe=QBe("".slice),JBe=function(e){return void 0===e?e:String(e)},YBe="$0"==="a".replace(/./,"$0"),XBe=!!/./[HBe]&&""===/./[HBe]("a","$0"),WBe=!_Be((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));kBe("replace",(function(e,t,n){var r=XBe?"$":"$0";return[function(e,n){var r=MBe(this),i=null==e?void 0:TBe(e,HBe);return i?xBe(i,e,r,n):xBe(t,UBe(r),e,n)},function(e,i){var o=NBe(this),a=UBe(e);if("string"==typeof i&&-1===VBe(i,r)&&-1===VBe(i,"$<")){var s=n(t,o,a,i);if(s.done)return s.value}var l=DBe(i);l||(i=UBe(i));var u=o.global;if(u){var A=o.unicode;o.lastIndex=0}for(var c=[];;){var h=OBe(o,a);if(null===h)break;if(qBe(c,h),!u)break;""===UBe(h[0])&&(o.lastIndex=LBe(a,PBe(o.lastIndex),A))}for(var f="",d=0,p=0;p<c.length;p++){for(var g=UBe((h=c[p])[0]),y=KBe(jBe(FBe(h.index),a.length),0),m=[],v=1;v<h.length;v++)qBe(m,JBe(h[v]));var I=h.groups;if(l){var w=GBe([g],m,y,a);void 0!==I&&qBe(w,I);var b=UBe(SBe(i,void 0,w))}else b=RBe(g,a,y,m,I,i);y>=d&&(f+=zBe(a,d,y)+b,d=y+g.length)}return f+zBe(a,d)}]}),!WBe||!YBe||XBe);var ZBe,$Be=Dhe,eEe=vhe,tEe=Kfe("match"),nEe=function(e){var t;return $Be(e)&&(void 0!==(t=e[tEe])?!!t:"RegExp"==eEe(e))},rEe=nEe,iEe=TypeError,oEe=function(e){if(rEe(e))throw iEe("The method doesn't accept regular expressions");return e},aEe=Kfe("match"),sEe=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[aEe]=!1,"/./"[e](t)}catch(e){}}return!1},lEe=Oge,uEe=phe,AEe=Xce.f,cEe=Xpe,hEe=Nwe,fEe=oEe,dEe=She,pEe=sEe,gEe=uEe("".startsWith),yEe=uEe("".slice),mEe=Math.min,vEe=pEe("startsWith");lEe({target:"String",proto:!0,forced:!!(vEe||(ZBe=AEe(String.prototype,"startsWith"),!ZBe||ZBe.writable))&&!vEe},{startsWith:function(e){var t=hEe(dEe(this));fEe(e);var n=cEe(mEe(arguments.length>1?arguments[1]:void 0,t.length)),r=hEe(e);return gEe?gEe(t,r,n):yEe(t,n,n+r.length)===r}});var IEe=Kfe,wEe=Abe,bEe=dde.f,BEe=IEe("unscopables"),EEe=Array.prototype;null==EEe[BEe]&&bEe(EEe,BEe,{configurable:!0,value:wEe(null)});var CEe,SEe,xEe,QEe=!Wce((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),kEe=Sfe,_Ee=_he,NEe=Bfe,DEe=QEe,FEe=tpe("IE_PROTO"),PEe=Object,UEe=PEe.prototype,MEe=DEe?PEe.getPrototypeOf:function(e){var t=NEe(e);if(kEe(t,FEe))return t[FEe];var n=t.constructor;return _Ee(n)&&t instanceof n?n.prototype:t instanceof PEe?UEe:null},LEe=Wce,TEe=_he,REe=MEe,OEe=Lpe,HEe=Kfe("iterator"),KEe=!1;[].keys&&("next"in(xEe=[].keys())?(SEe=REe(REe(xEe)))!==Object.prototype&&(CEe=SEe):KEe=!0);var jEe=null==CEe||LEe((function(){var e={};return CEe[HEe].call(e)!==e}));jEe&&(CEe={}),TEe(CEe[HEe])||OEe(CEe,HEe,(function(){return this}));var GEe={IteratorPrototype:CEe,BUGGY_SAFARI_ITERATORS:KEe},qEe=GEe.IteratorPrototype,VEe=Abe,zEe=uhe,JEe=Zge,YEe=gIe,XEe=function(){return this},WEe=Oge,ZEe=nhe,$Ee=_he,eCe=function(e,t,n,r){var i=t+" Iterator";return e.prototype=VEe(qEe,{next:zEe(+!r,n)}),JEe(e,i,!1),YEe[i]=XEe,e},tCe=MEe,nCe=Jge,rCe=Zge,iCe=Fde,oCe=Lpe,aCe=gIe,sCe=Ode.PROPER,lCe=Ode.CONFIGURABLE,uCe=GEe.IteratorPrototype,ACe=GEe.BUGGY_SAFARI_ITERATORS,cCe=Kfe("iterator"),hCe="keys",fCe="values",dCe="entries",pCe=function(){return this},gCe=khe,yCe=function(e){EEe[BEe][e]=!0},mCe=gIe,vCe=Ipe,ICe=dde.f,wCe=function(e,t,n,r,i,o,a){eCe(n,t,r);var s,l,u,A=function(e){if(e===i&&p)return p;if(!ACe&&e in f)return f[e];switch(e){case hCe:case fCe:case dCe:return function(){return new n(this,e)}}return function(){return new n(this)}},c=t+" Iterator",h=!1,f=e.prototype,d=f[cCe]||f["@@iterator"]||i&&f[i],p=!ACe&&d||A(i),g="Array"==t&&f.entries||d;if(g&&(s=tCe(g.call(new e)))!==Object.prototype&&s.next&&(tCe(s)!==uCe&&(nCe?nCe(s,uCe):$Ee(s[cCe])||oCe(s,cCe,pCe)),rCe(s,c,!0)),sCe&&i==fCe&&d&&d.name!==fCe&&(lCe?iCe(f,"name",fCe):(h=!0,p=function(){return ZEe(d,this)})),i)if(l={values:A(fCe),keys:o?p:A(hCe),entries:A(dCe)},a)for(u in l)(ACe||h||!(u in f))&&oCe(f,u,l[u]);else WEe({target:t,proto:!0,forced:ACe||h},l);return f[cCe]!==p&&oCe(f,cCe,p,{name:i}),aCe[t]=p,l},bCe=Zce,BCe="Array Iterator",ECe=vCe.set,CCe=vCe.getterFor(BCe),SCe=wCe(Array,"Array",(function(e,t){ECe(this,{type:BCe,target:gCe(e),index:0,kind:t})}),(function(){var e=CCe(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),xCe=mCe.Arguments=mCe.Array;if(yCe("keys"),yCe("values"),yCe("entries"),bCe&&"values"!==xCe.name)try{ICe(xCe,"name",{value:"values"})}catch(e){}var QCe=nde("span").classList,kCe=QCe&&QCe.constructor&&QCe.constructor.prototype,_Ce=kCe===Object.prototype?void 0:kCe,NCe=Yce,DCe={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},FCe=_Ce,PCe=SCe,UCe=Fde,MCe=Kfe,LCe=MCe("iterator"),TCe=MCe("toStringTag"),RCe=PCe.values,OCe=function(e,t){if(e){if(e[LCe]!==RCe)try{UCe(e,LCe,RCe)}catch(t){e[LCe]=RCe}if(e[TCe]||UCe(e,TCe,t),DCe[t])for(var n in PCe)if(e[n]!==PCe[n])try{UCe(e,n,PCe[n])}catch(t){e[n]=PCe[n]}}};for(var HCe in DCe)OCe(NCe[HCe]&&NCe[HCe].prototype,HCe);OCe(FCe,"DOMTokenList");var KCe={exports:{}};!function(e){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports}(KCe);var jCe=ot(KCe.exports),GCe=afe,qCe=Bfe,VCe=Ehe,zCe=Zpe,JCe=TypeError,YCe=function(e){return function(t,n,r,i){GCe(n);var o=qCe(t),a=VCe(o),s=zCe(o),l=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(l in a){i=a[l],l+=u;break}if(l+=u,e?l<0:s<=l)throw JCe("Reduce of empty array with no initial value")}for(;e?l>=0:s>l;l+=u)l in a&&(i=n(i,a[l],l,o));return i}},XCe={left:YCe(!1),right:YCe(!0)},WCe=Wce,ZCe=function(e,t){var n=[][e];return!!n&&WCe((function(){n.call(null,t||function(){return 1},1)}))},$Ce=XCe.left,eSe=qhe,tSe=Hge;Oge({target:"Array",proto:!0,forced:!ZCe("reduce")||!tSe&&eSe>79&&eSe<83},{reduce:function(e){var t=arguments.length;return $Ce(this,e,t,t>1?arguments[1]:void 0)}});var nSe=Oge,rSe=phe,iSe=Xce.f,oSe=Xpe,aSe=Nwe,sSe=oEe,lSe=She,uSe=sEe,ASe=rSe("".endsWith),cSe=rSe("".slice),hSe=Math.min,fSe=uSe("endsWith"),dSe=!fSe&&!!function(){var e=iSe(String.prototype,"endsWith");return e&&!e.writable}();nSe({target:"String",proto:!0,forced:!dSe&&!fSe},{endsWith:function(e){var t=aSe(lSe(this));sSe(e);var n=arguments.length>1?arguments[1]:void 0,r=t.length,i=void 0===n?r:hSe(oSe(n),r),o=aSe(e);return ASe?ASe(t,o,i):cSe(t,i-o.length,i)===o}});var pSe=Zfe,gSe=dde,ySe=uhe,mSe=zpe,vSe=Zpe,ISe=function(e,t,n){var r=pSe(t);r in e?gSe.f(e,r,ySe(0,n)):e[r]=n},wSe=Array,bSe=Math.max,BSe=Kye,ESe=nhe,CSe=phe,SSe=Vbe,xSe=nEe,QSe=vde,kSe=She,_Se=Lye,NSe=nBe,DSe=Xpe,FSe=Nwe,PSe=lfe,USe=function(e,t,n){for(var r=vSe(e),i=mSe(t,r),o=mSe(void 0===n?r:n,r),a=wSe(bSe(o-i,0)),s=0;i<o;i++,s++)ISe(a,s,e[i]);return a.length=s,a},MSe=uBe,LSe=Lbe,TSe=Wce,RSe=Rwe.UNSUPPORTED_Y,OSe=4294967295,HSe=Math.min,KSe=[].push,jSe=CSe(/./.exec),GSe=CSe(KSe),qSe=CSe("".slice),VSe=!TSe((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));SSe("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=FSe(kSe(this)),i=void 0===n?OSe:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!xSe(e))return ESe(t,r,e,i);for(var o,a,s,l=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),A=0,c=new RegExp(e.source,u+"g");(o=ESe(LSe,c,r))&&!((a=c.lastIndex)>A&&(GSe(l,qSe(r,A,o.index)),o.length>1&&o.index<r.length&&BSe(KSe,l,USe(o,1)),s=o[0].length,A=a,l.length>=i));)c.lastIndex===o.index&&c.lastIndex++;return A===r.length?!s&&jSe(c,"")||GSe(l,""):GSe(l,qSe(r,A)),l.length>i?USe(l,0,i):l}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:ESe(t,this,e,n)}:t,[function(t,n){var i=kSe(this),o=null==t?void 0:PSe(t,e);return o?ESe(o,t,i,n):ESe(r,FSe(i),t,n)},function(e,i){var o=QSe(this),a=FSe(e),s=n(r,o,a,i,r!==t);if(s.done)return s.value;var l=_Se(o,RegExp),u=o.unicode,A=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(RSe?"g":"y"),c=new l(RSe?"^(?:"+o.source+")":o,A),h=void 0===i?OSe:i>>>0;if(0===h)return[];if(0===a.length)return null===MSe(c,a)?[a]:[];for(var f=0,d=0,p=[];d<a.length;){c.lastIndex=RSe?0:d;var g,y=MSe(c,RSe?qSe(a,d):a);if(null===y||(g=HSe(DSe(c.lastIndex+(RSe?d:0)),a.length))===f)d=NSe(a,d,u);else{if(GSe(p,qSe(a,f,d)),p.length===h)return p;for(var m=1;m<=y.length-1;m++)if(GSe(p,y[m]),p.length===h)return p;d=f=g}}return GSe(p,qSe(a,f)),p}]}),!VSe,RSe);var zSe={exports:{}},JSe={exports:{}};(function(){var e,t,n,r,i,o;"undefined"!=typeof performance&&null!==performance&&performance.now?JSe.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(JSe.exports=function(){return(e()-i)/1e6},t=process.hrtime,e=function(){var e;return 1e9*(e=t())[0]+e[1]},r=e(),o=1e9*process.uptime(),i=r-o):Date.now?(JSe.exports=function(){return Date.now()-n},n=Date.now()):(JSe.exports=function(){return(new Date).getTime()-n},n=(new Date).getTime())}).call(it);for(var YSe=JSe.exports,XSe="undefined"==typeof window?it:window,WSe=["moz","webkit"],ZSe="AnimationFrame",$Se=XSe["request"+ZSe],exe=XSe["cancel"+ZSe]||XSe["cancelRequest"+ZSe],txe=0;!$Se&&txe<WSe.length;txe++)$Se=XSe[WSe[txe]+"Request"+ZSe],exe=XSe[WSe[txe]+"Cancel"+ZSe]||XSe[WSe[txe]+"CancelRequest"+ZSe];if(!$Se||!exe){var nxe=0,rxe=0,ixe=[];$Se=function(e){if(0===ixe.length){var t=YSe(),n=Math.max(0,16.666666666666668-(t-nxe));nxe=n+t,setTimeout((function(){var e=ixe.slice(0);ixe.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(nxe)}catch(e){setTimeout((function(){throw e}),0)}}),Math.round(n))}return ixe.push({handle:++rxe,callback:e,cancelled:!1}),rxe},exe=function(e){for(var t=0;t<ixe.length;t++)ixe[t].handle===e&&(ixe[t].cancelled=!0)}}zSe.exports=function(e){return $Se.call(XSe,e)},zSe.exports.cancel=function(){exe.apply(XSe,arguments)},zSe.exports.polyfill=function(e){e||(e=XSe),e.requestAnimationFrame=$Se,e.cancelAnimationFrame=exe};var oxe="\t\n\v\f\r \u2028\u2029\ufeff",axe=She,sxe=Nwe,lxe=phe("".replace),uxe="[\t\n\v\f\r \u2028\u2029\ufeff]",Axe=RegExp("^"+uxe+uxe+"*"),cxe=RegExp(uxe+uxe+"*$"),hxe=function(e){return function(t){var n=sxe(axe(t));return 1&e&&(n=lxe(n,Axe,"")),2&e&&(n=lxe(n,cxe,"")),n}},fxe={start:hxe(1),end:hxe(2),trim:hxe(3)},dxe=Ode.PROPER,pxe=Wce,gxe=oxe,yxe=fxe.trim;Oge({target:"String",proto:!0,forced:function(e){return pxe((function(){return!!gxe[e]()||"
"!=="
"[e]()||dxe&&gxe[e].name!==e}))}("trim")},{trim:function(){return yxe(this)}});var mxe=function(e){this.ok=!1,this.alpha=1,"#"==e.charAt(0)&&(e=e.substr(1,6)),e=(e=e.replace(/ /g,"")).toLowerCase();var t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};e=t[e]||e;for(var n=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),parseFloat(e[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}],r=0;r<n.length;r++){var i=n[r].re,o=n[r].process,a=i.exec(e);if(a){var s=o(a);this.r=s[0],this.g=s[1],this.b=s[2],s.length>3&&(this.alpha=s[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var e=this.r.toString(16),t=this.g.toString(16),n=this.b.toString(16);return 1==e.length&&(e="0"+e),1==t.length&&(t="0"+t),1==n.length&&(n="0"+n),"#"+e+t+n},this.getHelpXML=function(){for(var e=new Array,r=0;r<n.length;r++)for(var i=n[r].example,o=0;o<i.length;o++)e[e.length]=i[o];for(var a in t)e[e.length]=a;var s=document.createElement("ul");s.setAttribute("id","rgbcolor-examples");for(r=0;r<e.length;r++)try{var l=document.createElement("li"),u=new RGBColor(e[r]),A=document.createElement("div");A.style.cssText="margin: 3px; border: 1px solid black; background:"+u.toHex()+"; color:"+u.toHex(),A.appendChild(document.createTextNode("test"));var c=document.createTextNode(" "+e[r]+" -> "+u.toRGB()+" -> "+u.toHex());l.appendChild(A),l.appendChild(c),s.appendChild(l)}catch(e){}return s}},vxe=Oge,Ixe=rge.indexOf,wxe=ZCe,bxe=phe([].indexOf),Bxe=!!bxe&&1/bxe([1],1,-0)<0,Exe=wxe("indexOf");vxe({target:"Array",proto:!0,forced:Bxe||!Exe},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Bxe?bxe(this,e,t)||0:Ixe(this,e,t)}});var Cxe=Oge,Sxe=oEe,xxe=She,Qxe=Nwe,kxe=sEe,_xe=phe("".indexOf);Cxe({target:"String",proto:!0,forced:!kxe("includes")},{includes:function(e){return!!~_xe(Qxe(xxe(this)),Qxe(Sxe(e)),arguments.length>1?arguments[1]:void 0)}});var Nxe=vhe,Dxe=Oge,Fxe=Array.isArray||function(e){return"Array"==Nxe(e)},Pxe=phe([].reverse),Uxe=[1,2];Dxe({target:"Array",proto:!0,forced:String(Uxe)===String(Uxe.reverse())},{reverse:function(){return Fxe(this)&&(this.length=this.length),Pxe(this)}});
|
|
1174
1174
|
/*! *****************************************************************************
|
|
1175
1175
|
Copyright (c) Microsoft Corporation.
|
|
1176
1176
|
|
|
@@ -1185,7 +1185,7 @@ const NAe=e=>(e=>(e.__litDirective=!0,e))((t=>{const n=document.createElement("t
|
|
|
1185
1185
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1186
1186
|
PERFORMANCE OF THIS SOFTWARE.
|
|
1187
1187
|
***************************************************************************** */
|
|
1188
|
-
var Uxe=function(e,t){return(Uxe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function Mxe(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Uxe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Lxe(e,t){var n=e[0],r=e[1];return[n*Math.cos(t)-r*Math.sin(t),n*Math.sin(t)+r*Math.cos(t)]}function Txe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0;n<e.length;n++)if("number"!=typeof e[n])throw new Error("assertNumbers arguments["+n+"] is not a number. "+typeof e[n]+" == typeof "+e[n]);return!0}var Rxe=Math.PI;function Oxe(e,t,n){e.lArcFlag=0===e.lArcFlag?0:1,e.sweepFlag=0===e.sweepFlag?0:1;var r=e.rX,i=e.rY,o=e.x,a=e.y;r=Math.abs(e.rX),i=Math.abs(e.rY);var s=Lxe([(t-o)/2,(n-a)/2],-e.xRot/180*Rxe),l=s[0],u=s[1],A=Math.pow(l,2)/Math.pow(r,2)+Math.pow(u,2)/Math.pow(i,2);1<A&&(r*=Math.sqrt(A),i*=Math.sqrt(A)),e.rX=r,e.rY=i;var c=Math.pow(r,2)*Math.pow(u,2)+Math.pow(i,2)*Math.pow(l,2),h=(e.lArcFlag!==e.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(i,2)-c)/c)),f=r*u/i*h,d=-i*l/r*h,p=Lxe([f,d],e.xRot/180*Rxe);e.cX=p[0]+(t+o)/2,e.cY=p[1]+(n+a)/2,e.phi1=Math.atan2((u-d)/i,(l-f)/r),e.phi2=Math.atan2((-u-d)/i,(-l-f)/r),0===e.sweepFlag&&e.phi2>e.phi1&&(e.phi2-=2*Rxe),1===e.sweepFlag&&e.phi2<e.phi1&&(e.phi2+=2*Rxe),e.phi1*=180/Rxe,e.phi2*=180/Rxe}function Hxe(e,t,n){Txe(e,t,n);var r=e*e+t*t-n*n;if(0>r)return[];if(0===r)return[[e*n/(e*e+t*t),t*n/(e*e+t*t)]];var i=Math.sqrt(r);return[[(e*n+t*i)/(e*e+t*t),(t*n-e*i)/(e*e+t*t)],[(e*n-t*i)/(e*e+t*t),(t*n+e*i)/(e*e+t*t)]]}var Kxe,jxe=Math.PI/180;function Gxe(e,t,n){return(1-n)*e+n*t}function qxe(e,t,n,r){return e+Math.cos(r/180*Rxe)*t+Math.sin(r/180*Rxe)*n}function Vxe(e,t,n,r){var i=1e-6,o=t-e,a=n-t,s=3*o+3*(r-n)-6*a,l=6*(a-o),u=3*o;return Math.abs(s)<i?[-u/l]:function(e,t,n){void 0===n&&(n=1e-6);var r=e*e/4-t;if(r<-n)return[];if(r<=n)return[-e/2];var i=Math.sqrt(r);return[-e/2-i,-e/2+i]}(l/s,u/s,i)}function zxe(e,t,n,r,i){var o=1-i;return e*(o*o*o)+t*(3*o*o*i)+n*(3*o*i*i)+r*(i*i*i)}!function(e){function t(){return i((function(e,t,n){return e.relative&&(void 0!==e.x1&&(e.x1+=t),void 0!==e.y1&&(e.y1+=n),void 0!==e.x2&&(e.x2+=t),void 0!==e.y2&&(e.y2+=n),void 0!==e.x&&(e.x+=t),void 0!==e.y&&(e.y+=n),e.relative=!1),e}))}function n(){var e=NaN,t=NaN,n=NaN,r=NaN;return i((function(i,o,a){return i.type&$xe.SMOOTH_CURVE_TO&&(i.type=$xe.CURVE_TO,e=isNaN(e)?o:e,t=isNaN(t)?a:t,i.x1=i.relative?o-e:2*o-e,i.y1=i.relative?a-t:2*a-t),i.type&$xe.CURVE_TO?(e=i.relative?o+i.x2:i.x2,t=i.relative?a+i.y2:i.y2):(e=NaN,t=NaN),i.type&$xe.SMOOTH_QUAD_TO&&(i.type=$xe.QUAD_TO,n=isNaN(n)?o:n,r=isNaN(r)?a:r,i.x1=i.relative?o-n:2*o-n,i.y1=i.relative?a-r:2*a-r),i.type&$xe.QUAD_TO?(n=i.relative?o+i.x1:i.x1,r=i.relative?a+i.y1:i.y1):(n=NaN,r=NaN),i}))}function r(){var e=NaN,t=NaN;return i((function(n,r,i){if(n.type&$xe.SMOOTH_QUAD_TO&&(n.type=$xe.QUAD_TO,e=isNaN(e)?r:e,t=isNaN(t)?i:t,n.x1=n.relative?r-e:2*r-e,n.y1=n.relative?i-t:2*i-t),n.type&$xe.QUAD_TO){e=n.relative?r+n.x1:n.x1,t=n.relative?i+n.y1:n.y1;var o=n.x1,a=n.y1;n.type=$xe.CURVE_TO,n.x1=((n.relative?0:r)+2*o)/3,n.y1=((n.relative?0:i)+2*a)/3,n.x2=(n.x+2*o)/3,n.y2=(n.y+2*a)/3}else e=NaN,t=NaN;return n}))}function i(e){var t=0,n=0,r=NaN,i=NaN;return function(o){if(isNaN(r)&&!(o.type&$xe.MOVE_TO))throw new Error("path must start with moveto");var a=e(o,t,n,r,i);return o.type&$xe.CLOSE_PATH&&(t=r,n=i),void 0!==o.x&&(t=o.relative?t+o.x:o.x),void 0!==o.y&&(n=o.relative?n+o.y:o.y),o.type&$xe.MOVE_TO&&(r=t,i=n),a}}function o(e,t,n,r,o,a){return Txe(e,t,n,r,o,a),i((function(i,s,l,u){var A=i.x1,c=i.x2,h=i.relative&&!isNaN(u),f=void 0!==i.x?i.x:h?0:s,d=void 0!==i.y?i.y:h?0:l;function p(e){return e*e}i.type&$xe.HORIZ_LINE_TO&&0!==t&&(i.type=$xe.LINE_TO,i.y=i.relative?0:l),i.type&$xe.VERT_LINE_TO&&0!==n&&(i.type=$xe.LINE_TO,i.x=i.relative?0:s),void 0!==i.x&&(i.x=i.x*e+d*n+(h?0:o)),void 0!==i.y&&(i.y=f*t+i.y*r+(h?0:a)),void 0!==i.x1&&(i.x1=i.x1*e+i.y1*n+(h?0:o)),void 0!==i.y1&&(i.y1=A*t+i.y1*r+(h?0:a)),void 0!==i.x2&&(i.x2=i.x2*e+i.y2*n+(h?0:o)),void 0!==i.y2&&(i.y2=c*t+i.y2*r+(h?0:a));var g=e*r-t*n;if(void 0!==i.xRot&&(1!==e||0!==t||0!==n||1!==r))if(0===g)delete i.rX,delete i.rY,delete i.xRot,delete i.lArcFlag,delete i.sweepFlag,i.type=$xe.LINE_TO;else{var y=i.xRot*Math.PI/180,m=Math.sin(y),v=Math.cos(y),I=1/p(i.rX),w=1/p(i.rY),b=p(v)*I+p(m)*w,B=2*m*v*(I-w),E=p(m)*I+p(v)*w,C=b*r*r-B*t*r+E*t*t,S=B*(e*r+t*n)-2*(b*n*r+E*e*t),x=b*n*n-B*e*n+E*e*e,Q=(Math.atan2(S,C-x)+Math.PI)%Math.PI/2,k=Math.sin(Q),_=Math.cos(Q);i.rX=Math.abs(g)/Math.sqrt(C*p(_)+S*k*_+x*p(k)),i.rY=Math.abs(g)/Math.sqrt(C*p(k)-S*k*_+x*p(_)),i.xRot=180*Q/Math.PI}return void 0!==i.sweepFlag&&0>g&&(i.sweepFlag=+!i.sweepFlag),i}))}e.ROUND=function(e){function t(t){return Math.round(t*e)/e}return void 0===e&&(e=1e13),Txe(e),function(e){return void 0!==e.x1&&(e.x1=t(e.x1)),void 0!==e.y1&&(e.y1=t(e.y1)),void 0!==e.x2&&(e.x2=t(e.x2)),void 0!==e.y2&&(e.y2=t(e.y2)),void 0!==e.x&&(e.x=t(e.x)),void 0!==e.y&&(e.y=t(e.y)),void 0!==e.rX&&(e.rX=t(e.rX)),void 0!==e.rY&&(e.rY=t(e.rY)),e}},e.TO_ABS=t,e.TO_REL=function(){return i((function(e,t,n){return e.relative||(void 0!==e.x1&&(e.x1-=t),void 0!==e.y1&&(e.y1-=n),void 0!==e.x2&&(e.x2-=t),void 0!==e.y2&&(e.y2-=n),void 0!==e.x&&(e.x-=t),void 0!==e.y&&(e.y-=n),e.relative=!0),e}))},e.NORMALIZE_HVZ=function(e,t,n){return void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===n&&(n=!0),i((function(r,i,o,a,s){if(isNaN(a)&&!(r.type&$xe.MOVE_TO))throw new Error("path must start with moveto");return t&&r.type&$xe.HORIZ_LINE_TO&&(r.type=$xe.LINE_TO,r.y=r.relative?0:o),n&&r.type&$xe.VERT_LINE_TO&&(r.type=$xe.LINE_TO,r.x=r.relative?0:i),e&&r.type&$xe.CLOSE_PATH&&(r.type=$xe.LINE_TO,r.x=r.relative?a-i:a,r.y=r.relative?s-o:s),r.type&$xe.ARC&&(0===r.rX||0===r.rY)&&(r.type=$xe.LINE_TO,delete r.rX,delete r.rY,delete r.xRot,delete r.lArcFlag,delete r.sweepFlag),r}))},e.NORMALIZE_ST=n,e.QT_TO_C=r,e.INFO=i,e.SANITIZE=function(e){void 0===e&&(e=0),Txe(e);var t=NaN,n=NaN,r=NaN,o=NaN;return i((function(i,a,s,l,u){var A=Math.abs,c=!1,h=0,f=0;if(i.type&$xe.SMOOTH_CURVE_TO&&(h=isNaN(t)?0:a-t,f=isNaN(n)?0:s-n),i.type&($xe.CURVE_TO|$xe.SMOOTH_CURVE_TO)?(t=i.relative?a+i.x2:i.x2,n=i.relative?s+i.y2:i.y2):(t=NaN,n=NaN),i.type&$xe.SMOOTH_QUAD_TO?(r=isNaN(r)?a:2*a-r,o=isNaN(o)?s:2*s-o):i.type&$xe.QUAD_TO?(r=i.relative?a+i.x1:i.x1,o=i.relative?s+i.y1:i.y2):(r=NaN,o=NaN),i.type&$xe.LINE_COMMANDS||i.type&$xe.ARC&&(0===i.rX||0===i.rY||!i.lArcFlag)||i.type&$xe.CURVE_TO||i.type&$xe.SMOOTH_CURVE_TO||i.type&$xe.QUAD_TO||i.type&$xe.SMOOTH_QUAD_TO){var d=void 0===i.x?0:i.relative?i.x:i.x-a,p=void 0===i.y?0:i.relative?i.y:i.y-s;h=isNaN(r)?void 0===i.x1?h:i.relative?i.x:i.x1-a:r-a,f=isNaN(o)?void 0===i.y1?f:i.relative?i.y:i.y1-s:o-s;var g=void 0===i.x2?0:i.relative?i.x:i.x2-a,y=void 0===i.y2?0:i.relative?i.y:i.y2-s;A(d)<=e&&A(p)<=e&&A(h)<=e&&A(f)<=e&&A(g)<=e&&A(y)<=e&&(c=!0)}return i.type&$xe.CLOSE_PATH&&A(a-l)<=e&&A(s-u)<=e&&(c=!0),c?[]:i}))},e.MATRIX=o,e.ROTATE=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=0),Txe(e,t,n);var r=Math.sin(e),i=Math.cos(e);return o(i,r,-r,i,t-t*i+n*r,n-t*r-n*i)},e.TRANSLATE=function(e,t){return void 0===t&&(t=0),Txe(e,t),o(1,0,0,1,e,t)},e.SCALE=function(e,t){return void 0===t&&(t=e),Txe(e,t),o(e,0,0,t,0,0)},e.SKEW_X=function(e){return Txe(e),o(1,0,Math.atan(e),1,0,0)},e.SKEW_Y=function(e){return Txe(e),o(1,Math.atan(e),0,1,0,0)},e.X_AXIS_SYMMETRY=function(e){return void 0===e&&(e=0),Txe(e),o(-1,0,0,1,e,0)},e.Y_AXIS_SYMMETRY=function(e){return void 0===e&&(e=0),Txe(e),o(1,0,0,-1,0,e)},e.A_TO_C=function(){return i((function(e,t,n){return $xe.ARC===e.type?function(e,t,n){var r,i,o,a;e.cX||Oxe(e,t,n);for(var s=Math.min(e.phi1,e.phi2),l=Math.max(e.phi1,e.phi2)-s,u=Math.ceil(l/90),A=new Array(u),c=t,h=n,f=0;f<u;f++){var d=Gxe(e.phi1,e.phi2,f/u),p=Gxe(e.phi1,e.phi2,(f+1)/u),g=p-d,y=4/3*Math.tan(g*jxe/4),m=[Math.cos(d*jxe)-y*Math.sin(d*jxe),Math.sin(d*jxe)+y*Math.cos(d*jxe)],v=m[0],I=m[1],w=[Math.cos(p*jxe),Math.sin(p*jxe)],b=w[0],B=w[1],E=[b+y*Math.sin(p*jxe),B-y*Math.cos(p*jxe)],C=E[0],S=E[1];A[f]={relative:e.relative,type:$xe.CURVE_TO};var x=function(t,n){var r=Lxe([t*e.rX,n*e.rY],e.xRot),i=r[0],o=r[1];return[e.cX+i,e.cY+o]};r=x(v,I),A[f].x1=r[0],A[f].y1=r[1],i=x(C,S),A[f].x2=i[0],A[f].y2=i[1],o=x(b,B),A[f].x=o[0],A[f].y=o[1],e.relative&&(A[f].x1-=c,A[f].y1-=h,A[f].x2-=c,A[f].y2-=h,A[f].x-=c,A[f].y-=h),c=(a=[A[f].x,A[f].y])[0],h=a[1]}return A}(e,e.relative?0:t,e.relative?0:n):e}))},e.ANNOTATE_ARCS=function(){return i((function(e,t,n){return e.relative&&(t=0,n=0),$xe.ARC===e.type&&Oxe(e,t,n),e}))},e.CLONE=function(){return function(e){var t={};for(var n in e)t[n]=e[n];return t}},e.CALCULATE_BOUNDS=function(){var e=t(),o=r(),a=n(),s=i((function(t,n,r){var i=a(o(e(function(e){var t={};for(var n in e)t[n]=e[n];return t}(t))));function l(e){e>s.maxX&&(s.maxX=e),e<s.minX&&(s.minX=e)}function u(e){e>s.maxY&&(s.maxY=e),e<s.minY&&(s.minY=e)}if(i.type&$xe.DRAWING_COMMANDS&&(l(n),u(r)),i.type&$xe.HORIZ_LINE_TO&&l(i.x),i.type&$xe.VERT_LINE_TO&&u(i.y),i.type&$xe.LINE_TO&&(l(i.x),u(i.y)),i.type&$xe.CURVE_TO){l(i.x),u(i.y);for(var A=0,c=Vxe(n,i.x1,i.x2,i.x);A<c.length;A++)0<(x=c[A])&&1>x&&l(zxe(n,i.x1,i.x2,i.x,x));for(var h=0,f=Vxe(r,i.y1,i.y2,i.y);h<f.length;h++)0<(x=f[h])&&1>x&&u(zxe(r,i.y1,i.y2,i.y,x))}if(i.type&$xe.ARC){l(i.x),u(i.y),Oxe(i,n,r);for(var d=i.xRot/180*Math.PI,p=Math.cos(d)*i.rX,g=Math.sin(d)*i.rX,y=-Math.sin(d)*i.rY,m=Math.cos(d)*i.rY,v=i.phi1<i.phi2?[i.phi1,i.phi2]:-180>i.phi2?[i.phi2+360,i.phi1+360]:[i.phi2,i.phi1],I=v[0],w=v[1],b=function(e){var t=e[0],n=e[1],r=180*Math.atan2(n,t)/Math.PI;return r<I?r+360:r},B=0,E=Hxe(y,-p,0).map(b);B<E.length;B++)(x=E[B])>I&&x<w&&l(qxe(i.cX,p,y,x));for(var C=0,S=Hxe(m,-g,0).map(b);C<S.length;C++){var x;(x=S[C])>I&&x<w&&u(qxe(i.cY,g,m,x))}}return t}));return s.minX=1/0,s.maxX=-1/0,s.minY=1/0,s.maxY=-1/0,s}}(Kxe||(Kxe={}));var Jxe,Yxe=function(){function e(){}return e.prototype.round=function(e){return this.transform(Kxe.ROUND(e))},e.prototype.toAbs=function(){return this.transform(Kxe.TO_ABS())},e.prototype.toRel=function(){return this.transform(Kxe.TO_REL())},e.prototype.normalizeHVZ=function(e,t,n){return this.transform(Kxe.NORMALIZE_HVZ(e,t,n))},e.prototype.normalizeST=function(){return this.transform(Kxe.NORMALIZE_ST())},e.prototype.qtToC=function(){return this.transform(Kxe.QT_TO_C())},e.prototype.aToC=function(){return this.transform(Kxe.A_TO_C())},e.prototype.sanitize=function(e){return this.transform(Kxe.SANITIZE(e))},e.prototype.translate=function(e,t){return this.transform(Kxe.TRANSLATE(e,t))},e.prototype.scale=function(e,t){return this.transform(Kxe.SCALE(e,t))},e.prototype.rotate=function(e,t,n){return this.transform(Kxe.ROTATE(e,t,n))},e.prototype.matrix=function(e,t,n,r,i,o){return this.transform(Kxe.MATRIX(e,t,n,r,i,o))},e.prototype.skewX=function(e){return this.transform(Kxe.SKEW_X(e))},e.prototype.skewY=function(e){return this.transform(Kxe.SKEW_Y(e))},e.prototype.xSymmetry=function(e){return this.transform(Kxe.X_AXIS_SYMMETRY(e))},e.prototype.ySymmetry=function(e){return this.transform(Kxe.Y_AXIS_SYMMETRY(e))},e.prototype.annotateArcs=function(){return this.transform(Kxe.ANNOTATE_ARCS())},e}(),Xxe=function(e){return" "===e||"\t"===e||"\r"===e||"\n"===e},Wxe=function(e){return"0".charCodeAt(0)<=e.charCodeAt(0)&&e.charCodeAt(0)<="9".charCodeAt(0)},Zxe=function(e){function t(){var t=e.call(this)||this;return t.curNumber="",t.curCommandType=-1,t.curCommandRelative=!1,t.canParseCommandOrComma=!0,t.curNumberHasExp=!1,t.curNumberHasExpDigits=!1,t.curNumberHasDecimal=!1,t.curArgs=[],t}return Mxe(t,e),t.prototype.finish=function(e){if(void 0===e&&(e=[]),this.parse(" ",e),0!==this.curArgs.length||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return e},t.prototype.parse=function(e,t){var n=this;void 0===t&&(t=[]);for(var r=function(e){t.push(e),n.curArgs.length=0,n.canParseCommandOrComma=!0},i=0;i<e.length;i++){var o=e[i],a=!(this.curCommandType!==$xe.ARC||3!==this.curArgs.length&&4!==this.curArgs.length||1!==this.curNumber.length||"0"!==this.curNumber&&"1"!==this.curNumber),s=Wxe(o)&&("0"===this.curNumber&&"0"===o||a);if(!Wxe(o)||s)if("e"!==o&&"E"!==o)if("-"!==o&&"+"!==o||!this.curNumberHasExp||this.curNumberHasExpDigits)if("."!==o||this.curNumberHasExp||this.curNumberHasDecimal||a){if(this.curNumber&&-1!==this.curCommandType){var l=Number(this.curNumber);if(isNaN(l))throw new SyntaxError("Invalid number ending at "+i);if(this.curCommandType===$xe.ARC)if(0===this.curArgs.length||1===this.curArgs.length){if(0>l)throw new SyntaxError('Expected positive number, got "'+l+'" at index "'+i+'"')}else if((3===this.curArgs.length||4===this.curArgs.length)&&"0"!==this.curNumber&&"1"!==this.curNumber)throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+i+'"');this.curArgs.push(l),this.curArgs.length===eQe[this.curCommandType]&&($xe.HORIZ_LINE_TO===this.curCommandType?r({type:$xe.HORIZ_LINE_TO,relative:this.curCommandRelative,x:l}):$xe.VERT_LINE_TO===this.curCommandType?r({type:$xe.VERT_LINE_TO,relative:this.curCommandRelative,y:l}):this.curCommandType===$xe.MOVE_TO||this.curCommandType===$xe.LINE_TO||this.curCommandType===$xe.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),$xe.MOVE_TO===this.curCommandType&&(this.curCommandType=$xe.LINE_TO)):this.curCommandType===$xe.CURVE_TO?r({type:$xe.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===$xe.SMOOTH_CURVE_TO?r({type:$xe.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===$xe.QUAD_TO?r({type:$xe.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===$xe.ARC&&r({type:$xe.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!Xxe(o))if(","===o&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==o&&"-"!==o&&"."!==o)if(s)this.curNumber=o,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError("Unterminated command at index "+i+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+o+'" at index '+i+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,"z"!==o&&"Z"!==o)if("h"===o||"H"===o)this.curCommandType=$xe.HORIZ_LINE_TO,this.curCommandRelative="h"===o;else if("v"===o||"V"===o)this.curCommandType=$xe.VERT_LINE_TO,this.curCommandRelative="v"===o;else if("m"===o||"M"===o)this.curCommandType=$xe.MOVE_TO,this.curCommandRelative="m"===o;else if("l"===o||"L"===o)this.curCommandType=$xe.LINE_TO,this.curCommandRelative="l"===o;else if("c"===o||"C"===o)this.curCommandType=$xe.CURVE_TO,this.curCommandRelative="c"===o;else if("s"===o||"S"===o)this.curCommandType=$xe.SMOOTH_CURVE_TO,this.curCommandRelative="s"===o;else if("q"===o||"Q"===o)this.curCommandType=$xe.QUAD_TO,this.curCommandRelative="q"===o;else if("t"===o||"T"===o)this.curCommandType=$xe.SMOOTH_QUAD_TO,this.curCommandRelative="t"===o;else{if("a"!==o&&"A"!==o)throw new SyntaxError('Unexpected character "'+o+'" at index '+i+".");this.curCommandType=$xe.ARC,this.curCommandRelative="a"===o}else t.push({type:$xe.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=o,this.curNumberHasDecimal="."===o}else this.curNumber+=o,this.curNumberHasDecimal=!0;else this.curNumber+=o;else this.curNumber+=o,this.curNumberHasExp=!0;else this.curNumber+=o,this.curNumberHasExpDigits=this.curNumberHasExp}return t},t.prototype.transform=function(e){return Object.create(this,{parse:{value:function(t,n){void 0===n&&(n=[]);for(var r=0,i=Object.getPrototypeOf(this).parse.call(this,t);r<i.length;r++){var o=i[r],a=e(o);Array.isArray(a)?n.push.apply(n,a):n.push(a)}return n}}})},t}(Yxe),$xe=function(e){function t(n){var r=e.call(this)||this;return r.commands="string"==typeof n?t.parse(n):n,r}return Mxe(t,e),t.prototype.encode=function(){return t.encode(this.commands)},t.prototype.getBounds=function(){var e=Kxe.CALCULATE_BOUNDS();return this.transform(e),e},t.prototype.transform=function(e){for(var t=[],n=0,r=this.commands;n<r.length;n++){var i=e(r[n]);Array.isArray(i)?t.push.apply(t,i):t.push(i)}return this.commands=t,this},t.encode=function(e){return function(e){var t="";Array.isArray(e)||(e=[e]);for(var n=0;n<e.length;n++){var r=e[n];if(r.type===$xe.CLOSE_PATH)t+="z";else if(r.type===$xe.HORIZ_LINE_TO)t+=(r.relative?"h":"H")+r.x;else if(r.type===$xe.VERT_LINE_TO)t+=(r.relative?"v":"V")+r.y;else if(r.type===$xe.MOVE_TO)t+=(r.relative?"m":"M")+r.x+" "+r.y;else if(r.type===$xe.LINE_TO)t+=(r.relative?"l":"L")+r.x+" "+r.y;else if(r.type===$xe.CURVE_TO)t+=(r.relative?"c":"C")+r.x1+" "+r.y1+" "+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===$xe.SMOOTH_CURVE_TO)t+=(r.relative?"s":"S")+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===$xe.QUAD_TO)t+=(r.relative?"q":"Q")+r.x1+" "+r.y1+" "+r.x+" "+r.y;else if(r.type===$xe.SMOOTH_QUAD_TO)t+=(r.relative?"t":"T")+r.x+" "+r.y;else{if(r.type!==$xe.ARC)throw new Error('Unexpected command type "'+r.type+'" at index '+n+".");t+=(r.relative?"a":"A")+r.rX+" "+r.rY+" "+r.xRot+" "+ +r.lArcFlag+" "+ +r.sweepFlag+" "+r.x+" "+r.y}}return t}(e)},t.parse=function(e){var t=new Zxe,n=[];return t.parse(e,n),t.finish(n),n},t.CLOSE_PATH=1,t.MOVE_TO=2,t.HORIZ_LINE_TO=4,t.VERT_LINE_TO=8,t.LINE_TO=16,t.CURVE_TO=32,t.SMOOTH_CURVE_TO=64,t.QUAD_TO=128,t.SMOOTH_QUAD_TO=256,t.ARC=512,t.LINE_COMMANDS=t.LINE_TO|t.HORIZ_LINE_TO|t.VERT_LINE_TO,t.DRAWING_COMMANDS=t.HORIZ_LINE_TO|t.VERT_LINE_TO|t.LINE_TO|t.CURVE_TO|t.SMOOTH_CURVE_TO|t.QUAD_TO|t.SMOOTH_QUAD_TO|t.ARC,t}(Yxe),eQe=((Jxe={})[$xe.MOVE_TO]=2,Jxe[$xe.LINE_TO]=2,Jxe[$xe.HORIZ_LINE_TO]=1,Jxe[$xe.VERT_LINE_TO]=1,Jxe[$xe.CLOSE_PATH]=0,Jxe[$xe.QUAD_TO]=4,Jxe[$xe.SMOOTH_QUAD_TO]=2,Jxe[$xe.CURVE_TO]=6,Jxe[$xe.SMOOTH_CURVE_TO]=4,Jxe[$xe.ARC]=7,Jxe),tQe=the,nQe=Cfe,rQe=Mhe,iQe=Dwe,oQe=RegExp.prototype,aQe=Rde.PROPER,sQe=Mpe,lQe=mde,uQe=_we,AQe=Xce,cQe=function(e){var t=e.flags;return void 0!==t||"flags"in oQe||nQe(e,"flags")||!rQe(oQe,e)?t:tQe(iQe,e)},hQe="toString",fQe=RegExp.prototype.toString,dQe=AQe((function(){return"/a/b"!=fQe.call({source:"a",flags:"b"})})),pQe=aQe&&fQe.name!=hQe;function gQe(e){return gQe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gQe(e)}(dQe||pQe)&&sQe(RegExp.prototype,hQe,(function(){var e=lQe(this);return"/"+uQe(e.source)+"/"+uQe(cQe(e))}),{unsafe:!0});
|
|
1188
|
+
var Mxe=function(e,t){return(Mxe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function Lxe(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Mxe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Txe(e,t){var n=e[0],r=e[1];return[n*Math.cos(t)-r*Math.sin(t),n*Math.sin(t)+r*Math.cos(t)]}function Rxe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0;n<e.length;n++)if("number"!=typeof e[n])throw new Error("assertNumbers arguments["+n+"] is not a number. "+typeof e[n]+" == typeof "+e[n]);return!0}var Oxe=Math.PI;function Hxe(e,t,n){e.lArcFlag=0===e.lArcFlag?0:1,e.sweepFlag=0===e.sweepFlag?0:1;var r=e.rX,i=e.rY,o=e.x,a=e.y;r=Math.abs(e.rX),i=Math.abs(e.rY);var s=Txe([(t-o)/2,(n-a)/2],-e.xRot/180*Oxe),l=s[0],u=s[1],A=Math.pow(l,2)/Math.pow(r,2)+Math.pow(u,2)/Math.pow(i,2);1<A&&(r*=Math.sqrt(A),i*=Math.sqrt(A)),e.rX=r,e.rY=i;var c=Math.pow(r,2)*Math.pow(u,2)+Math.pow(i,2)*Math.pow(l,2),h=(e.lArcFlag!==e.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(i,2)-c)/c)),f=r*u/i*h,d=-i*l/r*h,p=Txe([f,d],e.xRot/180*Oxe);e.cX=p[0]+(t+o)/2,e.cY=p[1]+(n+a)/2,e.phi1=Math.atan2((u-d)/i,(l-f)/r),e.phi2=Math.atan2((-u-d)/i,(-l-f)/r),0===e.sweepFlag&&e.phi2>e.phi1&&(e.phi2-=2*Oxe),1===e.sweepFlag&&e.phi2<e.phi1&&(e.phi2+=2*Oxe),e.phi1*=180/Oxe,e.phi2*=180/Oxe}function Kxe(e,t,n){Rxe(e,t,n);var r=e*e+t*t-n*n;if(0>r)return[];if(0===r)return[[e*n/(e*e+t*t),t*n/(e*e+t*t)]];var i=Math.sqrt(r);return[[(e*n+t*i)/(e*e+t*t),(t*n-e*i)/(e*e+t*t)],[(e*n-t*i)/(e*e+t*t),(t*n+e*i)/(e*e+t*t)]]}var jxe,Gxe=Math.PI/180;function qxe(e,t,n){return(1-n)*e+n*t}function Vxe(e,t,n,r){return e+Math.cos(r/180*Oxe)*t+Math.sin(r/180*Oxe)*n}function zxe(e,t,n,r){var i=1e-6,o=t-e,a=n-t,s=3*o+3*(r-n)-6*a,l=6*(a-o),u=3*o;return Math.abs(s)<i?[-u/l]:function(e,t,n){void 0===n&&(n=1e-6);var r=e*e/4-t;if(r<-n)return[];if(r<=n)return[-e/2];var i=Math.sqrt(r);return[-e/2-i,-e/2+i]}(l/s,u/s,i)}function Jxe(e,t,n,r,i){var o=1-i;return e*(o*o*o)+t*(3*o*o*i)+n*(3*o*i*i)+r*(i*i*i)}!function(e){function t(){return i((function(e,t,n){return e.relative&&(void 0!==e.x1&&(e.x1+=t),void 0!==e.y1&&(e.y1+=n),void 0!==e.x2&&(e.x2+=t),void 0!==e.y2&&(e.y2+=n),void 0!==e.x&&(e.x+=t),void 0!==e.y&&(e.y+=n),e.relative=!1),e}))}function n(){var e=NaN,t=NaN,n=NaN,r=NaN;return i((function(i,o,a){return i.type&eQe.SMOOTH_CURVE_TO&&(i.type=eQe.CURVE_TO,e=isNaN(e)?o:e,t=isNaN(t)?a:t,i.x1=i.relative?o-e:2*o-e,i.y1=i.relative?a-t:2*a-t),i.type&eQe.CURVE_TO?(e=i.relative?o+i.x2:i.x2,t=i.relative?a+i.y2:i.y2):(e=NaN,t=NaN),i.type&eQe.SMOOTH_QUAD_TO&&(i.type=eQe.QUAD_TO,n=isNaN(n)?o:n,r=isNaN(r)?a:r,i.x1=i.relative?o-n:2*o-n,i.y1=i.relative?a-r:2*a-r),i.type&eQe.QUAD_TO?(n=i.relative?o+i.x1:i.x1,r=i.relative?a+i.y1:i.y1):(n=NaN,r=NaN),i}))}function r(){var e=NaN,t=NaN;return i((function(n,r,i){if(n.type&eQe.SMOOTH_QUAD_TO&&(n.type=eQe.QUAD_TO,e=isNaN(e)?r:e,t=isNaN(t)?i:t,n.x1=n.relative?r-e:2*r-e,n.y1=n.relative?i-t:2*i-t),n.type&eQe.QUAD_TO){e=n.relative?r+n.x1:n.x1,t=n.relative?i+n.y1:n.y1;var o=n.x1,a=n.y1;n.type=eQe.CURVE_TO,n.x1=((n.relative?0:r)+2*o)/3,n.y1=((n.relative?0:i)+2*a)/3,n.x2=(n.x+2*o)/3,n.y2=(n.y+2*a)/3}else e=NaN,t=NaN;return n}))}function i(e){var t=0,n=0,r=NaN,i=NaN;return function(o){if(isNaN(r)&&!(o.type&eQe.MOVE_TO))throw new Error("path must start with moveto");var a=e(o,t,n,r,i);return o.type&eQe.CLOSE_PATH&&(t=r,n=i),void 0!==o.x&&(t=o.relative?t+o.x:o.x),void 0!==o.y&&(n=o.relative?n+o.y:o.y),o.type&eQe.MOVE_TO&&(r=t,i=n),a}}function o(e,t,n,r,o,a){return Rxe(e,t,n,r,o,a),i((function(i,s,l,u){var A=i.x1,c=i.x2,h=i.relative&&!isNaN(u),f=void 0!==i.x?i.x:h?0:s,d=void 0!==i.y?i.y:h?0:l;function p(e){return e*e}i.type&eQe.HORIZ_LINE_TO&&0!==t&&(i.type=eQe.LINE_TO,i.y=i.relative?0:l),i.type&eQe.VERT_LINE_TO&&0!==n&&(i.type=eQe.LINE_TO,i.x=i.relative?0:s),void 0!==i.x&&(i.x=i.x*e+d*n+(h?0:o)),void 0!==i.y&&(i.y=f*t+i.y*r+(h?0:a)),void 0!==i.x1&&(i.x1=i.x1*e+i.y1*n+(h?0:o)),void 0!==i.y1&&(i.y1=A*t+i.y1*r+(h?0:a)),void 0!==i.x2&&(i.x2=i.x2*e+i.y2*n+(h?0:o)),void 0!==i.y2&&(i.y2=c*t+i.y2*r+(h?0:a));var g=e*r-t*n;if(void 0!==i.xRot&&(1!==e||0!==t||0!==n||1!==r))if(0===g)delete i.rX,delete i.rY,delete i.xRot,delete i.lArcFlag,delete i.sweepFlag,i.type=eQe.LINE_TO;else{var y=i.xRot*Math.PI/180,m=Math.sin(y),v=Math.cos(y),I=1/p(i.rX),w=1/p(i.rY),b=p(v)*I+p(m)*w,B=2*m*v*(I-w),E=p(m)*I+p(v)*w,C=b*r*r-B*t*r+E*t*t,S=B*(e*r+t*n)-2*(b*n*r+E*e*t),x=b*n*n-B*e*n+E*e*e,Q=(Math.atan2(S,C-x)+Math.PI)%Math.PI/2,k=Math.sin(Q),_=Math.cos(Q);i.rX=Math.abs(g)/Math.sqrt(C*p(_)+S*k*_+x*p(k)),i.rY=Math.abs(g)/Math.sqrt(C*p(k)-S*k*_+x*p(_)),i.xRot=180*Q/Math.PI}return void 0!==i.sweepFlag&&0>g&&(i.sweepFlag=+!i.sweepFlag),i}))}e.ROUND=function(e){function t(t){return Math.round(t*e)/e}return void 0===e&&(e=1e13),Rxe(e),function(e){return void 0!==e.x1&&(e.x1=t(e.x1)),void 0!==e.y1&&(e.y1=t(e.y1)),void 0!==e.x2&&(e.x2=t(e.x2)),void 0!==e.y2&&(e.y2=t(e.y2)),void 0!==e.x&&(e.x=t(e.x)),void 0!==e.y&&(e.y=t(e.y)),void 0!==e.rX&&(e.rX=t(e.rX)),void 0!==e.rY&&(e.rY=t(e.rY)),e}},e.TO_ABS=t,e.TO_REL=function(){return i((function(e,t,n){return e.relative||(void 0!==e.x1&&(e.x1-=t),void 0!==e.y1&&(e.y1-=n),void 0!==e.x2&&(e.x2-=t),void 0!==e.y2&&(e.y2-=n),void 0!==e.x&&(e.x-=t),void 0!==e.y&&(e.y-=n),e.relative=!0),e}))},e.NORMALIZE_HVZ=function(e,t,n){return void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===n&&(n=!0),i((function(r,i,o,a,s){if(isNaN(a)&&!(r.type&eQe.MOVE_TO))throw new Error("path must start with moveto");return t&&r.type&eQe.HORIZ_LINE_TO&&(r.type=eQe.LINE_TO,r.y=r.relative?0:o),n&&r.type&eQe.VERT_LINE_TO&&(r.type=eQe.LINE_TO,r.x=r.relative?0:i),e&&r.type&eQe.CLOSE_PATH&&(r.type=eQe.LINE_TO,r.x=r.relative?a-i:a,r.y=r.relative?s-o:s),r.type&eQe.ARC&&(0===r.rX||0===r.rY)&&(r.type=eQe.LINE_TO,delete r.rX,delete r.rY,delete r.xRot,delete r.lArcFlag,delete r.sweepFlag),r}))},e.NORMALIZE_ST=n,e.QT_TO_C=r,e.INFO=i,e.SANITIZE=function(e){void 0===e&&(e=0),Rxe(e);var t=NaN,n=NaN,r=NaN,o=NaN;return i((function(i,a,s,l,u){var A=Math.abs,c=!1,h=0,f=0;if(i.type&eQe.SMOOTH_CURVE_TO&&(h=isNaN(t)?0:a-t,f=isNaN(n)?0:s-n),i.type&(eQe.CURVE_TO|eQe.SMOOTH_CURVE_TO)?(t=i.relative?a+i.x2:i.x2,n=i.relative?s+i.y2:i.y2):(t=NaN,n=NaN),i.type&eQe.SMOOTH_QUAD_TO?(r=isNaN(r)?a:2*a-r,o=isNaN(o)?s:2*s-o):i.type&eQe.QUAD_TO?(r=i.relative?a+i.x1:i.x1,o=i.relative?s+i.y1:i.y2):(r=NaN,o=NaN),i.type&eQe.LINE_COMMANDS||i.type&eQe.ARC&&(0===i.rX||0===i.rY||!i.lArcFlag)||i.type&eQe.CURVE_TO||i.type&eQe.SMOOTH_CURVE_TO||i.type&eQe.QUAD_TO||i.type&eQe.SMOOTH_QUAD_TO){var d=void 0===i.x?0:i.relative?i.x:i.x-a,p=void 0===i.y?0:i.relative?i.y:i.y-s;h=isNaN(r)?void 0===i.x1?h:i.relative?i.x:i.x1-a:r-a,f=isNaN(o)?void 0===i.y1?f:i.relative?i.y:i.y1-s:o-s;var g=void 0===i.x2?0:i.relative?i.x:i.x2-a,y=void 0===i.y2?0:i.relative?i.y:i.y2-s;A(d)<=e&&A(p)<=e&&A(h)<=e&&A(f)<=e&&A(g)<=e&&A(y)<=e&&(c=!0)}return i.type&eQe.CLOSE_PATH&&A(a-l)<=e&&A(s-u)<=e&&(c=!0),c?[]:i}))},e.MATRIX=o,e.ROTATE=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=0),Rxe(e,t,n);var r=Math.sin(e),i=Math.cos(e);return o(i,r,-r,i,t-t*i+n*r,n-t*r-n*i)},e.TRANSLATE=function(e,t){return void 0===t&&(t=0),Rxe(e,t),o(1,0,0,1,e,t)},e.SCALE=function(e,t){return void 0===t&&(t=e),Rxe(e,t),o(e,0,0,t,0,0)},e.SKEW_X=function(e){return Rxe(e),o(1,0,Math.atan(e),1,0,0)},e.SKEW_Y=function(e){return Rxe(e),o(1,Math.atan(e),0,1,0,0)},e.X_AXIS_SYMMETRY=function(e){return void 0===e&&(e=0),Rxe(e),o(-1,0,0,1,e,0)},e.Y_AXIS_SYMMETRY=function(e){return void 0===e&&(e=0),Rxe(e),o(1,0,0,-1,0,e)},e.A_TO_C=function(){return i((function(e,t,n){return eQe.ARC===e.type?function(e,t,n){var r,i,o,a;e.cX||Hxe(e,t,n);for(var s=Math.min(e.phi1,e.phi2),l=Math.max(e.phi1,e.phi2)-s,u=Math.ceil(l/90),A=new Array(u),c=t,h=n,f=0;f<u;f++){var d=qxe(e.phi1,e.phi2,f/u),p=qxe(e.phi1,e.phi2,(f+1)/u),g=p-d,y=4/3*Math.tan(g*Gxe/4),m=[Math.cos(d*Gxe)-y*Math.sin(d*Gxe),Math.sin(d*Gxe)+y*Math.cos(d*Gxe)],v=m[0],I=m[1],w=[Math.cos(p*Gxe),Math.sin(p*Gxe)],b=w[0],B=w[1],E=[b+y*Math.sin(p*Gxe),B-y*Math.cos(p*Gxe)],C=E[0],S=E[1];A[f]={relative:e.relative,type:eQe.CURVE_TO};var x=function(t,n){var r=Txe([t*e.rX,n*e.rY],e.xRot),i=r[0],o=r[1];return[e.cX+i,e.cY+o]};r=x(v,I),A[f].x1=r[0],A[f].y1=r[1],i=x(C,S),A[f].x2=i[0],A[f].y2=i[1],o=x(b,B),A[f].x=o[0],A[f].y=o[1],e.relative&&(A[f].x1-=c,A[f].y1-=h,A[f].x2-=c,A[f].y2-=h,A[f].x-=c,A[f].y-=h),c=(a=[A[f].x,A[f].y])[0],h=a[1]}return A}(e,e.relative?0:t,e.relative?0:n):e}))},e.ANNOTATE_ARCS=function(){return i((function(e,t,n){return e.relative&&(t=0,n=0),eQe.ARC===e.type&&Hxe(e,t,n),e}))},e.CLONE=function(){return function(e){var t={};for(var n in e)t[n]=e[n];return t}},e.CALCULATE_BOUNDS=function(){var e=t(),o=r(),a=n(),s=i((function(t,n,r){var i=a(o(e(function(e){var t={};for(var n in e)t[n]=e[n];return t}(t))));function l(e){e>s.maxX&&(s.maxX=e),e<s.minX&&(s.minX=e)}function u(e){e>s.maxY&&(s.maxY=e),e<s.minY&&(s.minY=e)}if(i.type&eQe.DRAWING_COMMANDS&&(l(n),u(r)),i.type&eQe.HORIZ_LINE_TO&&l(i.x),i.type&eQe.VERT_LINE_TO&&u(i.y),i.type&eQe.LINE_TO&&(l(i.x),u(i.y)),i.type&eQe.CURVE_TO){l(i.x),u(i.y);for(var A=0,c=zxe(n,i.x1,i.x2,i.x);A<c.length;A++)0<(x=c[A])&&1>x&&l(Jxe(n,i.x1,i.x2,i.x,x));for(var h=0,f=zxe(r,i.y1,i.y2,i.y);h<f.length;h++)0<(x=f[h])&&1>x&&u(Jxe(r,i.y1,i.y2,i.y,x))}if(i.type&eQe.ARC){l(i.x),u(i.y),Hxe(i,n,r);for(var d=i.xRot/180*Math.PI,p=Math.cos(d)*i.rX,g=Math.sin(d)*i.rX,y=-Math.sin(d)*i.rY,m=Math.cos(d)*i.rY,v=i.phi1<i.phi2?[i.phi1,i.phi2]:-180>i.phi2?[i.phi2+360,i.phi1+360]:[i.phi2,i.phi1],I=v[0],w=v[1],b=function(e){var t=e[0],n=e[1],r=180*Math.atan2(n,t)/Math.PI;return r<I?r+360:r},B=0,E=Kxe(y,-p,0).map(b);B<E.length;B++)(x=E[B])>I&&x<w&&l(Vxe(i.cX,p,y,x));for(var C=0,S=Kxe(m,-g,0).map(b);C<S.length;C++){var x;(x=S[C])>I&&x<w&&u(Vxe(i.cY,g,m,x))}}return t}));return s.minX=1/0,s.maxX=-1/0,s.minY=1/0,s.maxY=-1/0,s}}(jxe||(jxe={}));var Yxe,Xxe=function(){function e(){}return e.prototype.round=function(e){return this.transform(jxe.ROUND(e))},e.prototype.toAbs=function(){return this.transform(jxe.TO_ABS())},e.prototype.toRel=function(){return this.transform(jxe.TO_REL())},e.prototype.normalizeHVZ=function(e,t,n){return this.transform(jxe.NORMALIZE_HVZ(e,t,n))},e.prototype.normalizeST=function(){return this.transform(jxe.NORMALIZE_ST())},e.prototype.qtToC=function(){return this.transform(jxe.QT_TO_C())},e.prototype.aToC=function(){return this.transform(jxe.A_TO_C())},e.prototype.sanitize=function(e){return this.transform(jxe.SANITIZE(e))},e.prototype.translate=function(e,t){return this.transform(jxe.TRANSLATE(e,t))},e.prototype.scale=function(e,t){return this.transform(jxe.SCALE(e,t))},e.prototype.rotate=function(e,t,n){return this.transform(jxe.ROTATE(e,t,n))},e.prototype.matrix=function(e,t,n,r,i,o){return this.transform(jxe.MATRIX(e,t,n,r,i,o))},e.prototype.skewX=function(e){return this.transform(jxe.SKEW_X(e))},e.prototype.skewY=function(e){return this.transform(jxe.SKEW_Y(e))},e.prototype.xSymmetry=function(e){return this.transform(jxe.X_AXIS_SYMMETRY(e))},e.prototype.ySymmetry=function(e){return this.transform(jxe.Y_AXIS_SYMMETRY(e))},e.prototype.annotateArcs=function(){return this.transform(jxe.ANNOTATE_ARCS())},e}(),Wxe=function(e){return" "===e||"\t"===e||"\r"===e||"\n"===e},Zxe=function(e){return"0".charCodeAt(0)<=e.charCodeAt(0)&&e.charCodeAt(0)<="9".charCodeAt(0)},$xe=function(e){function t(){var t=e.call(this)||this;return t.curNumber="",t.curCommandType=-1,t.curCommandRelative=!1,t.canParseCommandOrComma=!0,t.curNumberHasExp=!1,t.curNumberHasExpDigits=!1,t.curNumberHasDecimal=!1,t.curArgs=[],t}return Lxe(t,e),t.prototype.finish=function(e){if(void 0===e&&(e=[]),this.parse(" ",e),0!==this.curArgs.length||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return e},t.prototype.parse=function(e,t){var n=this;void 0===t&&(t=[]);for(var r=function(e){t.push(e),n.curArgs.length=0,n.canParseCommandOrComma=!0},i=0;i<e.length;i++){var o=e[i],a=!(this.curCommandType!==eQe.ARC||3!==this.curArgs.length&&4!==this.curArgs.length||1!==this.curNumber.length||"0"!==this.curNumber&&"1"!==this.curNumber),s=Zxe(o)&&("0"===this.curNumber&&"0"===o||a);if(!Zxe(o)||s)if("e"!==o&&"E"!==o)if("-"!==o&&"+"!==o||!this.curNumberHasExp||this.curNumberHasExpDigits)if("."!==o||this.curNumberHasExp||this.curNumberHasDecimal||a){if(this.curNumber&&-1!==this.curCommandType){var l=Number(this.curNumber);if(isNaN(l))throw new SyntaxError("Invalid number ending at "+i);if(this.curCommandType===eQe.ARC)if(0===this.curArgs.length||1===this.curArgs.length){if(0>l)throw new SyntaxError('Expected positive number, got "'+l+'" at index "'+i+'"')}else if((3===this.curArgs.length||4===this.curArgs.length)&&"0"!==this.curNumber&&"1"!==this.curNumber)throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+i+'"');this.curArgs.push(l),this.curArgs.length===tQe[this.curCommandType]&&(eQe.HORIZ_LINE_TO===this.curCommandType?r({type:eQe.HORIZ_LINE_TO,relative:this.curCommandRelative,x:l}):eQe.VERT_LINE_TO===this.curCommandType?r({type:eQe.VERT_LINE_TO,relative:this.curCommandRelative,y:l}):this.curCommandType===eQe.MOVE_TO||this.curCommandType===eQe.LINE_TO||this.curCommandType===eQe.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),eQe.MOVE_TO===this.curCommandType&&(this.curCommandType=eQe.LINE_TO)):this.curCommandType===eQe.CURVE_TO?r({type:eQe.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===eQe.SMOOTH_CURVE_TO?r({type:eQe.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===eQe.QUAD_TO?r({type:eQe.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===eQe.ARC&&r({type:eQe.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!Wxe(o))if(","===o&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==o&&"-"!==o&&"."!==o)if(s)this.curNumber=o,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError("Unterminated command at index "+i+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+o+'" at index '+i+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,"z"!==o&&"Z"!==o)if("h"===o||"H"===o)this.curCommandType=eQe.HORIZ_LINE_TO,this.curCommandRelative="h"===o;else if("v"===o||"V"===o)this.curCommandType=eQe.VERT_LINE_TO,this.curCommandRelative="v"===o;else if("m"===o||"M"===o)this.curCommandType=eQe.MOVE_TO,this.curCommandRelative="m"===o;else if("l"===o||"L"===o)this.curCommandType=eQe.LINE_TO,this.curCommandRelative="l"===o;else if("c"===o||"C"===o)this.curCommandType=eQe.CURVE_TO,this.curCommandRelative="c"===o;else if("s"===o||"S"===o)this.curCommandType=eQe.SMOOTH_CURVE_TO,this.curCommandRelative="s"===o;else if("q"===o||"Q"===o)this.curCommandType=eQe.QUAD_TO,this.curCommandRelative="q"===o;else if("t"===o||"T"===o)this.curCommandType=eQe.SMOOTH_QUAD_TO,this.curCommandRelative="t"===o;else{if("a"!==o&&"A"!==o)throw new SyntaxError('Unexpected character "'+o+'" at index '+i+".");this.curCommandType=eQe.ARC,this.curCommandRelative="a"===o}else t.push({type:eQe.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=o,this.curNumberHasDecimal="."===o}else this.curNumber+=o,this.curNumberHasDecimal=!0;else this.curNumber+=o;else this.curNumber+=o,this.curNumberHasExp=!0;else this.curNumber+=o,this.curNumberHasExpDigits=this.curNumberHasExp}return t},t.prototype.transform=function(e){return Object.create(this,{parse:{value:function(t,n){void 0===n&&(n=[]);for(var r=0,i=Object.getPrototypeOf(this).parse.call(this,t);r<i.length;r++){var o=i[r],a=e(o);Array.isArray(a)?n.push.apply(n,a):n.push(a)}return n}}})},t}(Xxe),eQe=function(e){function t(n){var r=e.call(this)||this;return r.commands="string"==typeof n?t.parse(n):n,r}return Lxe(t,e),t.prototype.encode=function(){return t.encode(this.commands)},t.prototype.getBounds=function(){var e=jxe.CALCULATE_BOUNDS();return this.transform(e),e},t.prototype.transform=function(e){for(var t=[],n=0,r=this.commands;n<r.length;n++){var i=e(r[n]);Array.isArray(i)?t.push.apply(t,i):t.push(i)}return this.commands=t,this},t.encode=function(e){return function(e){var t="";Array.isArray(e)||(e=[e]);for(var n=0;n<e.length;n++){var r=e[n];if(r.type===eQe.CLOSE_PATH)t+="z";else if(r.type===eQe.HORIZ_LINE_TO)t+=(r.relative?"h":"H")+r.x;else if(r.type===eQe.VERT_LINE_TO)t+=(r.relative?"v":"V")+r.y;else if(r.type===eQe.MOVE_TO)t+=(r.relative?"m":"M")+r.x+" "+r.y;else if(r.type===eQe.LINE_TO)t+=(r.relative?"l":"L")+r.x+" "+r.y;else if(r.type===eQe.CURVE_TO)t+=(r.relative?"c":"C")+r.x1+" "+r.y1+" "+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===eQe.SMOOTH_CURVE_TO)t+=(r.relative?"s":"S")+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===eQe.QUAD_TO)t+=(r.relative?"q":"Q")+r.x1+" "+r.y1+" "+r.x+" "+r.y;else if(r.type===eQe.SMOOTH_QUAD_TO)t+=(r.relative?"t":"T")+r.x+" "+r.y;else{if(r.type!==eQe.ARC)throw new Error('Unexpected command type "'+r.type+'" at index '+n+".");t+=(r.relative?"a":"A")+r.rX+" "+r.rY+" "+r.xRot+" "+ +r.lArcFlag+" "+ +r.sweepFlag+" "+r.x+" "+r.y}}return t}(e)},t.parse=function(e){var t=new $xe,n=[];return t.parse(e,n),t.finish(n),n},t.CLOSE_PATH=1,t.MOVE_TO=2,t.HORIZ_LINE_TO=4,t.VERT_LINE_TO=8,t.LINE_TO=16,t.CURVE_TO=32,t.SMOOTH_CURVE_TO=64,t.QUAD_TO=128,t.SMOOTH_QUAD_TO=256,t.ARC=512,t.LINE_COMMANDS=t.LINE_TO|t.HORIZ_LINE_TO|t.VERT_LINE_TO,t.DRAWING_COMMANDS=t.HORIZ_LINE_TO|t.VERT_LINE_TO|t.LINE_TO|t.CURVE_TO|t.SMOOTH_CURVE_TO|t.QUAD_TO|t.SMOOTH_QUAD_TO|t.ARC,t}(Xxe),tQe=((Yxe={})[eQe.MOVE_TO]=2,Yxe[eQe.LINE_TO]=2,Yxe[eQe.HORIZ_LINE_TO]=1,Yxe[eQe.VERT_LINE_TO]=1,Yxe[eQe.CLOSE_PATH]=0,Yxe[eQe.QUAD_TO]=4,Yxe[eQe.SMOOTH_QUAD_TO]=2,Yxe[eQe.CURVE_TO]=6,Yxe[eQe.SMOOTH_CURVE_TO]=4,Yxe[eQe.ARC]=7,Yxe),nQe=nhe,rQe=Sfe,iQe=Lhe,oQe=Fwe,aQe=RegExp.prototype,sQe=Ode.PROPER,lQe=Lpe,uQe=vde,AQe=Nwe,cQe=Wce,hQe=function(e){var t=e.flags;return void 0!==t||"flags"in aQe||rQe(e,"flags")||!iQe(aQe,e)?t:nQe(oQe,e)},fQe="toString",dQe=RegExp.prototype.toString,pQe=cQe((function(){return"/a/b"!=dQe.call({source:"a",flags:"b"})})),gQe=sQe&&dQe.name!=fQe;function yQe(e){return yQe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yQe(e)}(pQe||gQe)&&lQe(RegExp.prototype,fQe,(function(){var e=uQe(this);return"/"+AQe(e.source)+"/"+AQe(hQe(e))}),{unsafe:!0});
|
|
1189
1189
|
/**
|
|
1190
1190
|
* StackBlur - a fast almost Gaussian Blur For Canvas
|
|
1191
1191
|
*
|
|
@@ -1225,4 +1225,4 @@ var Uxe=function(e,t){return(Uxe=Object.setPrototypeOf||{__proto__:[]}instanceof
|
|
|
1225
1225
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
1226
1226
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
1227
1227
|
*/
|
|
1228
|
-
var yQe=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],mQe=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function vQe(e,t,n,r,i,o){if(!(isNaN(o)||o<1)){o|=0;var a=function(e,t,n,r,i){if("string"==typeof e&&(e=document.getElementById(e)),!e||"object"!==gQe(e)||!("getContext"in e))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var o=e.getContext("2d");try{return o.getImageData(t,n,r,i)}catch(e){throw new Error("unable to access image data: "+e)}}(e,t,n,r,i);a=function(e,t,n,r,i,o){for(var a,s=e.data,l=2*o+1,u=r-1,A=i-1,c=o+1,h=c*(c+1)/2,f=new IQe,d=f,p=1;p<l;p++)d=d.next=new IQe,p===c&&(a=d);d.next=f;for(var g=null,y=null,m=0,v=0,I=yQe[o],w=mQe[o],b=0;b<i;b++){d=f;for(var B=s[v],E=s[v+1],C=s[v+2],S=s[v+3],x=0;x<c;x++)d.r=B,d.g=E,d.b=C,d.a=S,d=d.next;for(var Q=0,k=0,_=0,N=0,D=c*B,F=c*E,P=c*C,U=c*S,M=h*B,L=h*E,T=h*C,R=h*S,O=1;O<c;O++){var H=v+((u<O?u:O)<<2),K=s[H],j=s[H+1],G=s[H+2],q=s[H+3],V=c-O;M+=(d.r=K)*V,L+=(d.g=j)*V,T+=(d.b=G)*V,R+=(d.a=q)*V,Q+=K,k+=j,_+=G,N+=q,d=d.next}g=f,y=a;for(var z=0;z<r;z++){var J=R*I>>w;if(s[v+3]=J,0!==J){var Y=255/J;s[v]=(M*I>>w)*Y,s[v+1]=(L*I>>w)*Y,s[v+2]=(T*I>>w)*Y}else s[v]=s[v+1]=s[v+2]=0;M-=D,L-=F,T-=P,R-=U,D-=g.r,F-=g.g,P-=g.b,U-=g.a;var X=z+o+1;X=m+(X<u?X:u)<<2,M+=Q+=g.r=s[X],L+=k+=g.g=s[X+1],T+=_+=g.b=s[X+2],R+=N+=g.a=s[X+3],g=g.next;var W=y,Z=W.r,$=W.g,ee=W.b,te=W.a;D+=Z,F+=$,P+=ee,U+=te,Q-=Z,k-=$,_-=ee,N-=te,y=y.next,v+=4}m+=r}for(var ne=0;ne<r;ne++){var re=s[v=ne<<2],ie=s[v+1],oe=s[v+2],ae=s[v+3],se=c*re,le=c*ie,ue=c*oe,Ae=c*ae,ce=h*re,he=h*ie,fe=h*oe,de=h*ae;d=f;for(var pe=0;pe<c;pe++)d.r=re,d.g=ie,d.b=oe,d.a=ae,d=d.next;for(var ge=r,ye=0,me=0,ve=0,Ie=0,we=1;we<=o;we++){v=ge+ne<<2;var be=c-we;ce+=(d.r=re=s[v])*be,he+=(d.g=ie=s[v+1])*be,fe+=(d.b=oe=s[v+2])*be,de+=(d.a=ae=s[v+3])*be,Ie+=re,ye+=ie,me+=oe,ve+=ae,d=d.next,we<A&&(ge+=r)}v=ne,g=f,y=a;for(var Be=0;Be<i;Be++){var Ee=v<<2;s[Ee+3]=ae=de*I>>w,ae>0?(ae=255/ae,s[Ee]=(ce*I>>w)*ae,s[Ee+1]=(he*I>>w)*ae,s[Ee+2]=(fe*I>>w)*ae):s[Ee]=s[Ee+1]=s[Ee+2]=0,ce-=se,he-=le,fe-=ue,de-=Ae,se-=g.r,le-=g.g,ue-=g.b,Ae-=g.a,Ee=ne+((Ee=Be+c)<A?Ee:A)*r<<2,ce+=Ie+=g.r=s[Ee],he+=ye+=g.g=s[Ee+1],fe+=me+=g.b=s[Ee+2],de+=ve+=g.a=s[Ee+3],g=g.next,se+=re=y.r,le+=ie=y.g,ue+=oe=y.b,Ae+=ae=y.a,Ie-=re,ye-=ie,me-=oe,ve-=ae,y=y.next,v+=r}}return e}(a,0,0,r,i,o),e.getContext("2d").putImageData(a,t,n)}}var IQe=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};var wQe=Object.freeze({__proto__:null,offscreen:function(){var{DOMParser:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,createCanvas:(e,t)=>new OffscreenCanvas(e,t),createImage:e=>xwe((function*(){var t=yield fetch(e),n=yield t.blob();return yield createImageBitmap(n)}))()};return"undefined"==typeof DOMParser&&void 0!==e||Reflect.deleteProperty(t,"DOMParser"),t},node:function(e){var{DOMParser:t,canvas:n,fetch:r}=e;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:t,fetch:r,createCanvas:n.createCanvas,createImage:n.loadImage}}});function bQe(e){return e.replace(/(?!\u3000)\s+/gm," ")}function BQe(e){return e.replace(/^[\n \t]+/,"")}function EQe(e){return e.replace(/[\n \t]+$/,"")}function CQe(e){return((e||"").match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm)||[]).map(parseFloat)}var SQe=/^[A-Z-]+$/;function xQe(e){return SQe.test(e)?e.toLowerCase():e}function QQe(e){var t=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(e)||[];return t[2]||t[3]||t[4]}function kQe(e){if(!e.startsWith("rgb"))return e;var t=3;return e.replace(/\d+(\.\d+)?/g,((e,n)=>t--&&n?String(Math.round(parseFloat(e))):e))}var _Qe=/(\[[^\]]+\])/g,NQe=/(#[^\s+>~.[:]+)/g,DQe=/(\.[^\s+>~.[:]+)/g,FQe=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,PQe=/(:[\w-]+\([^)]*\))/gi,UQe=/(:[^\s+>~.[:]+)/g,MQe=/([^\s+>~.[:]+)/g;function LQe(e,t){var n=t.exec(e);return n?[e.replace(t," "),n.length]:[e,0]}function TQe(e){var t=[0,0,0],n=e.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),r=0;return[n,r]=LQe(n,_Qe),t[1]+=r,[n,r]=LQe(n,NQe),t[0]+=r,[n,r]=LQe(n,DQe),t[1]+=r,[n,r]=LQe(n,FQe),t[2]+=r,[n,r]=LQe(n,PQe),t[1]+=r,[n,r]=LQe(n,UQe),t[1]+=r,n=n.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[n,r]=LQe(n,MQe),t[2]+=r,t.join("")}var RQe=1e-8;function OQe(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2))}function HQe(e,t){return(e[0]*t[0]+e[1]*t[1])/(OQe(e)*OQe(t))}function KQe(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(HQe(e,t))}function jQe(e){return e*e*e}function GQe(e){return 3*e*e*(1-e)}function qQe(e){return 3*e*(1-e)*(1-e)}function VQe(e){return(1-e)*(1-e)*(1-e)}function zQe(e){return e*e}function JQe(e){return 2*e*(1-e)}function YQe(e){return(1-e)*(1-e)}class XQe{constructor(e,t,n){this.document=e,this.name=t,this.value=n,this.isNormalizedColor=!1}static empty(e){return new XQe(e,"EMPTY","")}split(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:" ",{document:t,name:n}=this;return bQe(this.getString()).trim().split(e).map((e=>new XQe(t,n,e)))}hasValue(e){var{value:t}=this;return null!==t&&""!==t&&(e||0!==t)&&void 0!==t}isString(e){var{value:t}=this,n="string"==typeof t;return n&&e?e.test(t):n}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;var e=this.getString();switch(!0){case e.endsWith("px"):case/^[0-9]+$/.test(e):return!0;default:return!1}}setValue(e){return this.value=e,this}getValue(e){return void 0===e||this.hasValue()?this.value:e}getNumber(e){if(!this.hasValue())return void 0===e?0:parseFloat(e);var{value:t}=this,n=parseFloat(t);return this.isString(/%$/)&&(n/=100),n}getString(e){return void 0===e||this.hasValue()?void 0===this.value?"":String(this.value):String(e)}getColor(e){var t=this.getString(e);return this.isNormalizedColor||(this.isNormalizedColor=!0,t=kQe(t),this.value=t),t}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;var[n,r]="boolean"==typeof e?[void 0,e]:[e],{viewPort:i}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(i.computeSize("x"),i.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(i.computeSize("x"),i.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*i.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*i.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return 15*this.getNumber();case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case this.isString(/%$/)&&r:return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*i.computeSize(n);default:var o=this.getNumber();return t&&o<1?o*i.computeSize(n):o}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():1e3*this.getNumber():0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){var e=this.getString(),t=/#([^)'"]+)/.exec(e);return t&&(t=t[1]),t||(t=e),this.document.definitions[t]}getFillStyleDefinition(e,t){var n=this.getDefinition();if(!n)return null;if("function"==typeof n.createGradient)return n.createGradient(this.document.ctx,e,t);if("function"==typeof n.createPattern){if(n.getHrefAttribute().hasValue()){var r=n.getAttribute("patternTransform");n=n.getHrefAttribute().getDefinition(),r.hasValue()&&n.getAttribute("patternTransform",!0).setValue(r.value)}return n.createPattern(this.document.ctx,e,t)}return null}getTextBaseline(){return this.hasValue()?XQe.textBaselineMapping[this.getString()]:null}addOpacity(e){for(var t=this.getColor(),n=t.length,r=0,i=0;i<n&&(","===t[i]&&r++,3!==r);i++);if(e.hasValue()&&this.isString()&&3!==r){var o=new yxe(t);o.ok&&(o.alpha=e.getNumber(),t=o.toRGBA())}return new XQe(this.document,this.name,t)}}XQe.textBaselineMapping={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};class WQe{constructor(){this.viewPorts=[]}clear(){this.viewPorts=[]}setCurrent(e,t){this.viewPorts.push({width:e,height:t})}removeCurrent(){this.viewPorts.pop()}getCurrent(){var{viewPorts:e}=this;return e[e.length-1]}get width(){return this.getCurrent().width}get height(){return this.getCurrent().height}computeSize(e){return"number"==typeof e?e:"x"===e?this.width:"y"===e?this.height:Math.sqrt(Math.pow(this.width,2)+Math.pow(this.height,2))/Math.sqrt(2)}}class ZQe{constructor(e,t){this.x=e,this.y=t}static parse(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,[n=t,r=t]=CQe(e);return new ZQe(n,r)}static parseScale(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,[n=t,r=n]=CQe(e);return new ZQe(n,r)}static parsePath(e){for(var t=CQe(e),n=t.length,r=[],i=0;i<n;i+=2)r.push(new ZQe(t[i],t[i+1]));return r}angleTo(e){return Math.atan2(e.y-this.y,e.x-this.x)}applyTransform(e){var{x:t,y:n}=this,r=t*e[0]+n*e[2]+e[4],i=t*e[1]+n*e[3]+e[5];this.x=r,this.y=i}}class $Qe{constructor(e){this.screen=e,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}isWorking(){return this.working}start(){if(!this.working){var{screen:e,onClick:t,onMouseMove:n}=this,r=e.ctx.canvas;r.onclick=t,r.onmousemove=n,this.working=!0}}stop(){if(this.working){var e=this.screen.ctx.canvas;this.working=!1,e.onclick=null,e.onmousemove=null}}hasEvents(){return this.working&&this.events.length>0}runEvents(){if(this.working){var{screen:e,events:t,eventElements:n}=this,{style:r}=e.ctx.canvas;r&&(r.cursor=""),t.forEach(((e,t)=>{for(var{run:r}=e,i=n[t];i;)r(i),i=i.parent})),this.events=[],this.eventElements=[]}}checkPath(e,t){if(this.working&&t){var{events:n,eventElements:r}=this;n.forEach(((n,i)=>{var{x:o,y:a}=n;!r[i]&&t.isPointInPath&&t.isPointInPath(o,a)&&(r[i]=e)}))}}checkBoundingBox(e,t){if(this.working&&t){var{events:n,eventElements:r}=this;n.forEach(((n,i)=>{var{x:o,y:a}=n;!r[i]&&t.isPointInBox(o,a)&&(r[i]=e)}))}}mapXY(e,t){for(var{window:n,ctx:r}=this.screen,i=new ZQe(e,t),o=r.canvas;o;)i.x-=o.offsetLeft,i.y-=o.offsetTop,o=o.offsetParent;return n.scrollX&&(i.x+=n.scrollX),n.scrollY&&(i.y+=n.scrollY),i}onClick(e){var{x:t,y:n}=this.mapXY(e.clientX,e.clientY);this.events.push({type:"onclick",x:t,y:n,run(e){e.onClick&&e.onClick()}})}onMouseMove(e){var{x:t,y:n}=this.mapXY(e.clientX,e.clientY);this.events.push({type:"onmousemove",x:t,y:n,run(e){e.onMouseMove&&e.onMouseMove()}})}}var eke="undefined"!=typeof window?window:null,tke="undefined"!=typeof fetch?fetch.bind(void 0):null;class nke{constructor(e){var{fetch:t=tke,window:n=eke}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.ctx=e,this.FRAMERATE=30,this.MAX_VIRTUAL_PIXELS=3e4,this.CLIENT_WIDTH=800,this.CLIENT_HEIGHT=600,this.viewPort=new WQe,this.mouse=new $Qe(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=n,this.fetch=t}wait(e){this.waits.push(e)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;var e=this.waits.every((e=>e()));return e&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=e,e}setDefaults(e){e.strokeStyle="rgba(0,0,0,0)",e.lineCap="butt",e.lineJoin="miter",e.miterLimit=4}setViewBox(e){var{document:t,ctx:n,aspectRatio:r,width:i,desiredWidth:o,height:a,desiredHeight:s,minX:l=0,minY:u=0,refX:A,refY:c,clip:h=!1,clipX:f=0,clipY:d=0}=e,p=bQe(r).replace(/^defer\s/,""),[g,y]=p.split(" "),m=g||"xMidYMid",v=y||"meet",I=i/o,w=a/s,b=Math.min(I,w),B=Math.max(I,w),E=o,C=s;"meet"===v&&(E*=b,C*=b),"slice"===v&&(E*=B,C*=B);var S=new XQe(t,"refX",A),x=new XQe(t,"refY",c),Q=S.hasValue()&&x.hasValue();if(Q&&n.translate(-b*S.getPixels("x"),-b*x.getPixels("y")),h){var k=b*f,_=b*d;n.beginPath(),n.moveTo(k,_),n.lineTo(i,_),n.lineTo(i,a),n.lineTo(k,a),n.closePath(),n.clip()}if(!Q){var N="meet"===v&&b===w,D="slice"===v&&B===w,F="meet"===v&&b===I,P="slice"===v&&B===I;m.startsWith("xMid")&&(N||D)&&n.translate(i/2-E/2,0),m.endsWith("YMid")&&(F||P)&&n.translate(0,a/2-C/2),m.startsWith("xMax")&&(N||D)&&n.translate(i-E,0),m.endsWith("YMax")&&(F||P)&&n.translate(0,a-C)}switch(!0){case"none"===m:n.scale(I,w);break;case"meet"===v:n.scale(b,b);break;case"slice"===v:n.scale(B,B)}n.translate(-l,-u)}start(e){var{enableRedraw:t=!1,ignoreMouse:n=!1,ignoreAnimation:r=!1,ignoreDimensions:i=!1,ignoreClear:o=!1,forceRedraw:a,scaleWidth:s,scaleHeight:l,offsetX:u,offsetY:A}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{FRAMERATE:c,mouse:h}=this,f=1e3/c;if(this.frameDuration=f,this.readyPromise=new Promise((e=>{this.resolveReady=e})),this.isReady()&&this.render(e,i,o,s,l,u,A),t){var d=Date.now(),p=d,g=0,y=()=>{d=Date.now(),(g=d-p)>=f&&(p=d-g%f,this.shouldUpdate(r,a)&&(this.render(e,i,o,s,l,u,A),h.runEvents())),this.intervalId=VSe.exports(y)};n||h.start(),this.intervalId=VSe.exports(y)}}stop(){this.intervalId&&(VSe.exports.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(e,t){if(!e){var{frameDuration:n}=this;if(this.animations.reduce(((e,t)=>t.update(n)||e),!1))return!0}return!("function"!=typeof t||!t())||(!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents())}render(e,t,n,r,i,o,a){var{CLIENT_WIDTH:s,CLIENT_HEIGHT:l,viewPort:u,ctx:A,isFirstRender:c}=this,h=A.canvas;u.clear(),h.width&&h.height?u.setCurrent(h.width,h.height):u.setCurrent(s,l);var f=e.getStyle("width"),d=e.getStyle("height");!t&&(c||"number"!=typeof r&&"number"!=typeof i)&&(f.hasValue()&&(h.width=f.getPixels("x"),h.style&&(h.style.width="".concat(h.width,"px"))),d.hasValue()&&(h.height=d.getPixels("y"),h.style&&(h.style.height="".concat(h.height,"px"))));var p=h.clientWidth||h.width,g=h.clientHeight||h.height;if(t&&f.hasValue()&&d.hasValue()&&(p=f.getPixels("x"),g=d.getPixels("y")),u.setCurrent(p,g),"number"==typeof o&&e.getAttribute("x",!0).setValue(o),"number"==typeof a&&e.getAttribute("y",!0).setValue(a),"number"==typeof r||"number"==typeof i){var y=CQe(e.getAttribute("viewBox").getString()),m=0,v=0;if("number"==typeof r){var I=e.getStyle("width");I.hasValue()?m=I.getPixels("x")/r:isNaN(y[2])||(m=y[2]/r)}if("number"==typeof i){var w=e.getStyle("height");w.hasValue()?v=w.getPixels("y")/i:isNaN(y[3])||(v=y[3]/i)}m||(m=v),v||(v=m),e.getAttribute("width",!0).setValue(r),e.getAttribute("height",!0).setValue(i);var b=e.getStyle("transform",!0,!0);b.setValue("".concat(b.getString()," scale(").concat(1/m,", ").concat(1/v,")"))}n||A.clearRect(0,0,p,g),e.render(A),c&&(this.isFirstRender=!1)}}nke.defaultWindow=eke,nke.defaultFetch=tke;var{defaultFetch:rke}=nke,ike="undefined"!=typeof DOMParser?DOMParser:null;class oke{constructor(){var{fetch:e=rke,DOMParser:t=ike}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fetch=e,this.DOMParser=t}parse(e){var t=this;return xwe((function*(){return e.startsWith("<")?t.parseFromString(e):t.load(e)}))()}parseFromString(e){var t=new this.DOMParser;try{return this.checkDocument(t.parseFromString(e,"image/svg+xml"))}catch(n){return this.checkDocument(t.parseFromString(e,"text/xml"))}}checkDocument(e){var t=e.getElementsByTagName("parsererror")[0];if(t)throw new Error(t.textContent);return e}load(e){var t=this;return xwe((function*(){var n=yield t.fetch(e),r=yield n.text();return t.parseFromString(r)}))()}}class ake{constructor(e,t){this.type="translate",this.point=null,this.point=ZQe.parse(t)}apply(e){var{x:t,y:n}=this.point;e.translate(t||0,n||0)}unapply(e){var{x:t,y:n}=this.point;e.translate(-1*t||0,-1*n||0)}applyToPoint(e){var{x:t,y:n}=this.point;e.applyTransform([1,0,0,1,t||0,n||0])}}class ske{constructor(e,t,n){this.type="rotate",this.angle=null,this.originX=null,this.originY=null,this.cx=0,this.cy=0;var r=CQe(t);this.angle=new XQe(e,"angle",r[0]),this.originX=n[0],this.originY=n[1],this.cx=r[1]||0,this.cy=r[2]||0}apply(e){var{cx:t,cy:n,originX:r,originY:i,angle:o}=this,a=t+r.getPixels("x"),s=n+i.getPixels("y");e.translate(a,s),e.rotate(o.getRadians()),e.translate(-a,-s)}unapply(e){var{cx:t,cy:n,originX:r,originY:i,angle:o}=this,a=t+r.getPixels("x"),s=n+i.getPixels("y");e.translate(a,s),e.rotate(-1*o.getRadians()),e.translate(-a,-s)}applyToPoint(e){var{cx:t,cy:n,angle:r}=this,i=r.getRadians();e.applyTransform([1,0,0,1,t||0,n||0]),e.applyTransform([Math.cos(i),Math.sin(i),-Math.sin(i),Math.cos(i),0,0]),e.applyTransform([1,0,0,1,-t||0,-n||0])}}class lke{constructor(e,t,n){this.type="scale",this.scale=null,this.originX=null,this.originY=null;var r=ZQe.parseScale(t);0!==r.x&&0!==r.y||(r.x=RQe,r.y=RQe),this.scale=r,this.originX=n[0],this.originY=n[1]}apply(e){var{scale:{x:t,y:n},originX:r,originY:i}=this,o=r.getPixels("x"),a=i.getPixels("y");e.translate(o,a),e.scale(t,n||t),e.translate(-o,-a)}unapply(e){var{scale:{x:t,y:n},originX:r,originY:i}=this,o=r.getPixels("x"),a=i.getPixels("y");e.translate(o,a),e.scale(1/t,1/n||t),e.translate(-o,-a)}applyToPoint(e){var{x:t,y:n}=this.scale;e.applyTransform([t||0,0,0,n||0,0,0])}}class uke{constructor(e,t,n){this.type="matrix",this.matrix=[],this.originX=null,this.originY=null,this.matrix=CQe(t),this.originX=n[0],this.originY=n[1]}apply(e){var{originX:t,originY:n,matrix:r}=this,i=t.getPixels("x"),o=n.getPixels("y");e.translate(i,o),e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),e.translate(-i,-o)}unapply(e){var{originX:t,originY:n,matrix:r}=this,i=r[0],o=r[2],a=r[4],s=r[1],l=r[3],u=r[5],A=1/(i*(1*l-0*u)-o*(1*s-0*u)+a*(0*s-0*l)),c=t.getPixels("x"),h=n.getPixels("y");e.translate(c,h),e.transform(A*(1*l-0*u),A*(0*u-1*s),A*(0*a-1*o),A*(1*i-0*a),A*(o*u-a*l),A*(a*s-i*u)),e.translate(-c,-h)}applyToPoint(e){e.applyTransform(this.matrix)}}class Ake extends uke{constructor(e,t,n){super(e,t,n),this.type="skew",this.angle=null,this.angle=new XQe(e,"angle",t)}}class cke extends Ake{constructor(e,t,n){super(e,t,n),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class hke extends Ake{constructor(e,t,n){super(e,t,n),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}class fke{constructor(e,t,n){this.document=e,this.transforms=[];var r=function(e){return bQe(e).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}(t);r.forEach((e=>{if("none"!==e){var[t,r]=function(e){var[t,n]=e.split("(");return[t.trim(),n.trim().replace(")","")]}(e),i=fke.transformTypes[t];void 0!==i&&this.transforms.push(new i(this.document,r,n))}}))}static fromElement(e,t){var n=t.getStyle("transform",!1,!0),[r,i=r]=t.getStyle("transform-origin",!1,!0).split(),o=[r,i];return n.hasValue()?new fke(e,n.getString(),o):null}apply(e){for(var{transforms:t}=this,n=t.length,r=0;r<n;r++)t[r].apply(e)}unapply(e){for(var{transforms:t}=this,n=t.length-1;n>=0;n--)t[n].unapply(e)}applyToPoint(e){for(var{transforms:t}=this,n=t.length,r=0;r<n;r++)t[r].applyToPoint(e)}}fke.transformTypes={translate:ake,rotate:ske,scale:lke,matrix:uke,skewX:cke,skewY:hke};class dke{constructor(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.document=e,this.node=t,this.captureTextNodes=n,this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],t&&1===t.nodeType){if(Array.from(t.attributes).forEach((t=>{var n=xQe(t.nodeName);this.attributes[n]=new XQe(e,n,t.value)})),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()){var r=this.getAttribute("style").getString().split(";").map((e=>e.trim()));r.forEach((t=>{if(t){var[n,r]=t.split(":").map((e=>e.trim()));this.styles[n]=new XQe(e,n,r)}}))}var{definitions:i}=e,o=this.getAttribute("id");o.hasValue()&&(i[o.getString()]||(i[o.getString()]=this)),Array.from(t.childNodes).forEach((t=>{if(1===t.nodeType)this.addChild(t);else if(n&&(3===t.nodeType||4===t.nodeType)){var r=e.createTextNode(t);r.getText().length>0&&this.addChild(r)}}))}}getAttribute(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.attributes[e];if(!n&&t){var r=new XQe(this.document,e,"");return this.attributes[e]=r,r}return n||XQe.empty(this.document)}getHrefAttribute(){for(var e in this.attributes)if("href"===e||e.endsWith(":href"))return this.attributes[e];return XQe.empty(this.document)}getStyle(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.styles[e];if(r)return r;var i=this.getAttribute(e);if(null!=i&&i.hasValue())return this.styles[e]=i,i;if(!n){var{parent:o}=this;if(o){var a=o.getStyle(e);if(null!=a&&a.hasValue())return a}}if(t){var s=new XQe(this.document,e,"");return this.styles[e]=s,s}return r||XQe.empty(this.document)}render(e){if("none"!==this.getStyle("display").getString()&&"hidden"!==this.getStyle("visibility").getString()){if(e.save(),this.getStyle("mask").hasValue()){var t=this.getStyle("mask").getDefinition();t&&(this.applyEffects(e),t.apply(e,this))}else if("none"!==this.getStyle("filter").getValue("none")){var n=this.getStyle("filter").getDefinition();n&&(this.applyEffects(e),n.apply(e,this))}else this.setContext(e),this.renderChildren(e),this.clearContext(e);e.restore()}}setContext(e){}applyEffects(e){var t=fke.fromElement(this.document,this);t&&t.apply(e);var n=this.getStyle("clip-path",!1,!0);if(n.hasValue()){var r=n.getDefinition();r&&r.apply(e)}}clearContext(e){}renderChildren(e){this.children.forEach((t=>{t.render(e)}))}addChild(e){var t=e instanceof dke?e:this.document.createElement(e);t.parent=this,dke.ignoreChildTypes.includes(t.type)||this.children.push(t)}matchesSelector(e){var t,{node:n}=this;if("function"==typeof n.matches)return n.matches(e);var r=null===(t=n.getAttribute)||void 0===t?void 0:t.call(n,"class");return!(!r||""===r)&&r.split(" ").some((t=>".".concat(t)===e))}addStylesFromStyleDefinition(){var{styles:e,stylesSpecificity:t}=this.document;for(var n in e)if(!n.startsWith("@")&&this.matchesSelector(n)){var r=e[n],i=t[n];if(r)for(var o in r){var a=this.stylesSpecificity[o];void 0===a&&(a="000"),i>=a&&(this.styles[o]=r[o],this.stylesSpecificity[o]=i)}}}removeStyles(e,t){return t.reduce(((t,n)=>{var r=e.getStyle(n);if(!r.hasValue())return t;var i=r.getString();return r.setValue(""),[...t,[n,i]]}),[])}restoreStyles(e,t){t.forEach((t=>{var[n,r]=t;e.getStyle(n,!0).setValue(r)}))}isFirstChild(){var e;return 0===(null===(e=this.parent)||void 0===e?void 0:e.children.indexOf(this))}}dke.ignoreChildTypes=["title"];class pke extends dke{constructor(e,t,n){super(e,t,n)}}function gke(e){var t=e.trim();return/^('|")/.test(t)?t:'"'.concat(t,'"')}function yke(e){if(!e)return"";var t=e.trim().toLowerCase();switch(t){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return t;default:return/^oblique\s+(-|)\d+deg$/.test(t)?t:""}}function mke(e){if(!e)return"";var t=e.trim().toLowerCase();switch(t){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return t;default:return/^[\d.]+$/.test(t)?t:""}}class vke{constructor(e,t,n,r,i,o){var a=o?"string"==typeof o?vke.parse(o):o:{};this.fontFamily=i||a.fontFamily,this.fontSize=r||a.fontSize,this.fontStyle=e||a.fontStyle,this.fontWeight=n||a.fontWeight,this.fontVariant=t||a.fontVariant}static parse(){var e=arguments.length>1?arguments[1]:void 0,t="",n="",r="",i="",o="",a=bQe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").trim().split(" "),s={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return a.forEach((e=>{switch(!0){case!s.fontStyle&&vke.styles.includes(e):"inherit"!==e&&(t=e),s.fontStyle=!0;break;case!s.fontVariant&&vke.variants.includes(e):"inherit"!==e&&(n=e),s.fontStyle=!0,s.fontVariant=!0;break;case!s.fontWeight&&vke.weights.includes(e):"inherit"!==e&&(r=e),s.fontStyle=!0,s.fontVariant=!0,s.fontWeight=!0;break;case!s.fontSize:"inherit"!==e&&([i]=e.split("/")),s.fontStyle=!0,s.fontVariant=!0,s.fontWeight=!0,s.fontSize=!0;break;default:"inherit"!==e&&(o+=e)}})),new vke(t,n,r,i,o,e)}toString(){return[yke(this.fontStyle),this.fontVariant,mke(this.fontWeight),this.fontSize,(e=this.fontFamily,"undefined"==typeof process?e:e.trim().split(",").map(gke).join(","))].join(" ").trim();var e}}vke.styles="normal|italic|oblique|inherit",vke.variants="normal|small-caps|inherit",vke.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class Ike{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.NaN,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.NaN,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.NaN,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.NaN;this.x1=e,this.y1=t,this.x2=n,this.y2=r,this.addPoint(e,t),this.addPoint(n,r)}get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(e,t){void 0!==e&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),void 0!==t&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))}addX(e){this.addPoint(e,null)}addY(e){this.addPoint(null,e)}addBoundingBox(e){if(e){var{x1:t,y1:n,x2:r,y2:i}=e;this.addPoint(t,n),this.addPoint(r,i)}}sumCubic(e,t,n,r,i){return Math.pow(1-e,3)*t+3*Math.pow(1-e,2)*e*n+3*(1-e)*Math.pow(e,2)*r+Math.pow(e,3)*i}bezierCurveAdd(e,t,n,r,i){var o=6*t-12*n+6*r,a=-3*t+9*n-9*r+3*i,s=3*n-3*t;if(0!==a){var l=Math.pow(o,2)-4*s*a;if(!(l<0)){var u=(-o+Math.sqrt(l))/(2*a);0<u&&u<1&&(e?this.addX(this.sumCubic(u,t,n,r,i)):this.addY(this.sumCubic(u,t,n,r,i)));var A=(-o-Math.sqrt(l))/(2*a);0<A&&A<1&&(e?this.addX(this.sumCubic(A,t,n,r,i)):this.addY(this.sumCubic(A,t,n,r,i)))}}else{if(0===o)return;var c=-s/o;0<c&&c<1&&(e?this.addX(this.sumCubic(c,t,n,r,i)):this.addY(this.sumCubic(c,t,n,r,i)))}}addBezierCurve(e,t,n,r,i,o,a,s){this.addPoint(e,t),this.addPoint(a,s),this.bezierCurveAdd(!0,e,n,i,a),this.bezierCurveAdd(!1,t,r,o,s)}addQuadraticCurve(e,t,n,r,i,o){var a=e+2/3*(n-e),s=t+2/3*(r-t),l=a+1/3*(i-e),u=s+1/3*(o-t);this.addBezierCurve(e,t,a,l,s,u,i,o)}isPointInBox(e,t){var{x1:n,y1:r,x2:i,y2:o}=this;return n<=e&&e<=i&&r<=t&&t<=o}}class wke extends $xe{constructor(e){super(e.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,"")),this.control=null,this.start=null,this.current=null,this.command=null,this.commands=this.commands,this.i=-1,this.previousCommand=null,this.points=[],this.angles=[]}reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new ZQe(0,0),this.control=new ZQe(0,0),this.current=new ZQe(0,0),this.points=[],this.angles=[]}isEnd(){var{i:e,commands:t}=this;return e>=t.length-1}next(){var e=this.commands[++this.i];return this.previousCommand=this.command,this.command=e,e}getPoint(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"x",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y",n=new ZQe(this.command[e],this.command[t]);return this.makeAbsolute(n)}getAsControlPoint(e,t){var n=this.getPoint(e,t);return this.control=n,n}getAsCurrentPoint(e,t){var n=this.getPoint(e,t);return this.current=n,n}getReflectedControlPoint(){var e=this.previousCommand.type;if(e!==$xe.CURVE_TO&&e!==$xe.SMOOTH_CURVE_TO&&e!==$xe.QUAD_TO&&e!==$xe.SMOOTH_QUAD_TO)return this.current;var{current:{x:t,y:n},control:{x:r,y:i}}=this;return new ZQe(2*t-r,2*n-i)}makeAbsolute(e){if(this.command.relative){var{x:t,y:n}=this.current;e.x+=t,e.y+=n}return e}addMarker(e,t,n){var{points:r,angles:i}=this;n&&i.length>0&&!i[i.length-1]&&(i[i.length-1]=r[r.length-1].angleTo(n)),this.addMarkerAngle(e,t?t.angleTo(e):null)}addMarkerAngle(e,t){this.points.push(e),this.angles.push(t)}getMarkerPoints(){return this.points}getMarkerAngles(){for(var{angles:e}=this,t=e.length,n=0;n<t;n++)if(!e[n])for(var r=n+1;r<t;r++)if(e[r]){e[n]=e[r];break}return e}}class bke extends dke{constructor(){super(...arguments),this.modifiedEmSizeStack=!1}calculateOpacity(){for(var e=1,t=this;t;){var n=t.getStyle("opacity",!1,!0);n.hasValue(!0)&&(e*=n.getNumber()),t=t.parent}return e}setContext(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t){var n=this.getStyle("fill"),r=this.getStyle("fill-opacity"),i=this.getStyle("stroke"),o=this.getStyle("stroke-opacity");if(n.isUrlDefinition()){var a=n.getFillStyleDefinition(this,r);a&&(e.fillStyle=a)}else if(n.hasValue()){"currentColor"===n.getString()&&n.setValue(this.getStyle("color").getColor());var s=n.getColor();"inherit"!==s&&(e.fillStyle="none"===s?"rgba(0,0,0,0)":s)}if(r.hasValue()){var l=new XQe(this.document,"fill",e.fillStyle).addOpacity(r).getColor();e.fillStyle=l}if(i.isUrlDefinition()){var u=i.getFillStyleDefinition(this,o);u&&(e.strokeStyle=u)}else if(i.hasValue()){"currentColor"===i.getString()&&i.setValue(this.getStyle("color").getColor());var A=i.getString();"inherit"!==A&&(e.strokeStyle="none"===A?"rgba(0,0,0,0)":A)}if(o.hasValue()){var c=new XQe(this.document,"stroke",e.strokeStyle).addOpacity(o).getString();e.strokeStyle=c}var h=this.getStyle("stroke-width");if(h.hasValue()){var f=h.getPixels();e.lineWidth=f||RQe}var d=this.getStyle("stroke-linecap"),p=this.getStyle("stroke-linejoin"),g=this.getStyle("stroke-miterlimit"),y=this.getStyle("stroke-dasharray"),m=this.getStyle("stroke-dashoffset");if(d.hasValue()&&(e.lineCap=d.getString()),p.hasValue()&&(e.lineJoin=p.getString()),g.hasValue()&&(e.miterLimit=g.getNumber()),y.hasValue()&&"none"!==y.getString()){var v=CQe(y.getString());void 0!==e.setLineDash?e.setLineDash(v):void 0!==e.webkitLineDash?e.webkitLineDash=v:void 0===e.mozDash||1===v.length&&0===v[0]||(e.mozDash=v);var I=m.getPixels();void 0!==e.lineDashOffset?e.lineDashOffset=I:void 0!==e.webkitLineDashOffset?e.webkitLineDashOffset=I:void 0!==e.mozDashOffset&&(e.mozDashOffset=I)}}if(this.modifiedEmSizeStack=!1,void 0!==e.font){var w=this.getStyle("font"),b=this.getStyle("font-style"),B=this.getStyle("font-variant"),E=this.getStyle("font-weight"),C=this.getStyle("font-size"),S=this.getStyle("font-family"),x=new vke(b.getString(),B.getString(),E.getString(),C.hasValue()?"".concat(C.getPixels(!0),"px"):"",S.getString(),vke.parse(w.getString(),e.font));b.setValue(x.fontStyle),B.setValue(x.fontVariant),E.setValue(x.fontWeight),C.setValue(x.fontSize),S.setValue(x.fontFamily),e.font=x.toString(),C.isPixels()&&(this.document.emSize=C.getPixels(),this.modifiedEmSizeStack=!0)}t||(this.applyEffects(e),e.globalAlpha=this.calculateOpacity())}clearContext(e){super.clearContext(e),this.modifiedEmSizeStack&&this.document.popEmSize()}}class Bke extends bke{constructor(e,t,n){super(e,t,n),this.type="path",this.pathParser=null,this.pathParser=new wke(this.getAttribute("d").getString())}path(e){var{pathParser:t}=this,n=new Ike;for(t.reset(),e&&e.beginPath();!t.isEnd();)switch(t.next().type){case wke.MOVE_TO:this.pathM(e,n);break;case wke.LINE_TO:this.pathL(e,n);break;case wke.HORIZ_LINE_TO:this.pathH(e,n);break;case wke.VERT_LINE_TO:this.pathV(e,n);break;case wke.CURVE_TO:this.pathC(e,n);break;case wke.SMOOTH_CURVE_TO:this.pathS(e,n);break;case wke.QUAD_TO:this.pathQ(e,n);break;case wke.SMOOTH_QUAD_TO:this.pathT(e,n);break;case wke.ARC:this.pathA(e,n);break;case wke.CLOSE_PATH:this.pathZ(e,n)}return n}getBoundingBox(e){return this.path()}getMarkers(){var{pathParser:e}=this,t=e.getMarkerPoints(),n=e.getMarkerAngles(),r=t.map(((e,t)=>[e,n[t]]));return r}renderChildren(e){this.path(e),this.document.screen.mouse.checkPath(this,e);var t=this.getStyle("fill-rule");""!==e.fillStyle&&("inherit"!==t.getString("inherit")?e.fill(t.getString()):e.fill()),""!==e.strokeStyle&&("non-scaling-stroke"===this.getAttribute("vector-effect").getString()?(e.save(),e.setTransform(1,0,0,1,0,0),e.stroke(),e.restore()):e.stroke());var n=this.getMarkers();if(n){var r=n.length-1,i=this.getStyle("marker-start"),o=this.getStyle("marker-mid"),a=this.getStyle("marker-end");if(i.isUrlDefinition()){var s=i.getDefinition(),[l,u]=n[0];s.render(e,l,u)}if(o.isUrlDefinition())for(var A=o.getDefinition(),c=1;c<r;c++){var[h,f]=n[c];A.render(e,h,f)}if(a.isUrlDefinition()){var d=a.getDefinition(),[p,g]=n[r];d.render(e,p,g)}}}static pathM(e){var t=e.getAsCurrentPoint();return e.start=e.current,{point:t}}pathM(e,t){var{pathParser:n}=this,{point:r}=Bke.pathM(n),{x:i,y:o}=r;n.addMarker(r),t.addPoint(i,o),e&&e.moveTo(i,o)}static pathL(e){var{current:t}=e;return{current:t,point:e.getAsCurrentPoint()}}pathL(e,t){var{pathParser:n}=this,{current:r,point:i}=Bke.pathL(n),{x:o,y:a}=i;n.addMarker(i,r),t.addPoint(o,a),e&&e.lineTo(o,a)}static pathH(e){var{current:t,command:n}=e,r=new ZQe((n.relative?t.x:0)+n.x,t.y);return e.current=r,{current:t,point:r}}pathH(e,t){var{pathParser:n}=this,{current:r,point:i}=Bke.pathH(n),{x:o,y:a}=i;n.addMarker(i,r),t.addPoint(o,a),e&&e.lineTo(o,a)}static pathV(e){var{current:t,command:n}=e,r=new ZQe(t.x,(n.relative?t.y:0)+n.y);return e.current=r,{current:t,point:r}}pathV(e,t){var{pathParser:n}=this,{current:r,point:i}=Bke.pathV(n),{x:o,y:a}=i;n.addMarker(i,r),t.addPoint(o,a),e&&e.lineTo(o,a)}static pathC(e){var{current:t}=e;return{current:t,point:e.getPoint("x1","y1"),controlPoint:e.getAsControlPoint("x2","y2"),currentPoint:e.getAsCurrentPoint()}}pathC(e,t){var{pathParser:n}=this,{current:r,point:i,controlPoint:o,currentPoint:a}=Bke.pathC(n);n.addMarker(a,o,i),t.addBezierCurve(r.x,r.y,i.x,i.y,o.x,o.y,a.x,a.y),e&&e.bezierCurveTo(i.x,i.y,o.x,o.y,a.x,a.y)}static pathS(e){var{current:t}=e;return{current:t,point:e.getReflectedControlPoint(),controlPoint:e.getAsControlPoint("x2","y2"),currentPoint:e.getAsCurrentPoint()}}pathS(e,t){var{pathParser:n}=this,{current:r,point:i,controlPoint:o,currentPoint:a}=Bke.pathS(n);n.addMarker(a,o,i),t.addBezierCurve(r.x,r.y,i.x,i.y,o.x,o.y,a.x,a.y),e&&e.bezierCurveTo(i.x,i.y,o.x,o.y,a.x,a.y)}static pathQ(e){var{current:t}=e;return{current:t,controlPoint:e.getAsControlPoint("x1","y1"),currentPoint:e.getAsCurrentPoint()}}pathQ(e,t){var{pathParser:n}=this,{current:r,controlPoint:i,currentPoint:o}=Bke.pathQ(n);n.addMarker(o,i,i),t.addQuadraticCurve(r.x,r.y,i.x,i.y,o.x,o.y),e&&e.quadraticCurveTo(i.x,i.y,o.x,o.y)}static pathT(e){var{current:t}=e,n=e.getReflectedControlPoint();return e.control=n,{current:t,controlPoint:n,currentPoint:e.getAsCurrentPoint()}}pathT(e,t){var{pathParser:n}=this,{current:r,controlPoint:i,currentPoint:o}=Bke.pathT(n);n.addMarker(o,i,i),t.addQuadraticCurve(r.x,r.y,i.x,i.y,o.x,o.y),e&&e.quadraticCurveTo(i.x,i.y,o.x,o.y)}static pathA(e){var{current:t,command:n}=e,{rX:r,rY:i,xRot:o,lArcFlag:a,sweepFlag:s}=n,l=o*(Math.PI/180),u=e.getAsCurrentPoint(),A=new ZQe(Math.cos(l)*(t.x-u.x)/2+Math.sin(l)*(t.y-u.y)/2,-Math.sin(l)*(t.x-u.x)/2+Math.cos(l)*(t.y-u.y)/2),c=Math.pow(A.x,2)/Math.pow(r,2)+Math.pow(A.y,2)/Math.pow(i,2);c>1&&(r*=Math.sqrt(c),i*=Math.sqrt(c));var h=(a===s?-1:1)*Math.sqrt((Math.pow(r,2)*Math.pow(i,2)-Math.pow(r,2)*Math.pow(A.y,2)-Math.pow(i,2)*Math.pow(A.x,2))/(Math.pow(r,2)*Math.pow(A.y,2)+Math.pow(i,2)*Math.pow(A.x,2)));isNaN(h)&&(h=0);var f=new ZQe(h*r*A.y/i,h*-i*A.x/r),d=new ZQe((t.x+u.x)/2+Math.cos(l)*f.x-Math.sin(l)*f.y,(t.y+u.y)/2+Math.sin(l)*f.x+Math.cos(l)*f.y),p=KQe([1,0],[(A.x-f.x)/r,(A.y-f.y)/i]),g=[(A.x-f.x)/r,(A.y-f.y)/i],y=[(-A.x-f.x)/r,(-A.y-f.y)/i],m=KQe(g,y);return HQe(g,y)<=-1&&(m=Math.PI),HQe(g,y)>=1&&(m=0),{currentPoint:u,rX:r,rY:i,sweepFlag:s,xAxisRotation:l,centp:d,a1:p,ad:m}}pathA(e,t){var{pathParser:n}=this,{currentPoint:r,rX:i,rY:o,sweepFlag:a,xAxisRotation:s,centp:l,a1:u,ad:A}=Bke.pathA(n),c=1-a?1:-1,h=u+c*(A/2),f=new ZQe(l.x+i*Math.cos(h),l.y+o*Math.sin(h));if(n.addMarkerAngle(f,h-c*Math.PI/2),n.addMarkerAngle(r,h-c*Math.PI),t.addPoint(r.x,r.y),e&&!isNaN(u)&&!isNaN(A)){var d=i>o?i:o,p=i>o?1:i/o,g=i>o?o/i:1;e.translate(l.x,l.y),e.rotate(s),e.scale(p,g),e.arc(0,0,d,u,u+A,Boolean(1-a)),e.scale(1/p,1/g),e.rotate(-s),e.translate(-l.x,-l.y)}}static pathZ(e){e.current=e.start}pathZ(e,t){Bke.pathZ(this.pathParser),e&&t.x1!==t.x2&&t.y1!==t.y2&&e.closePath()}}class Eke extends Bke{constructor(e,t,n){super(e,t,n),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class Cke extends bke{constructor(e,t,n){super(e,t,new.target===Cke||n),this.type="text",this.x=0,this.y=0,this.measureCache=-1}setContext(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.setContext(e,t);var n=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();n&&(e.textBaseline=n)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(e){if("text"!==this.type)return this.getTElementBoundingBox(e);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(e);var t=null;return this.children.forEach(((n,r)=>{var i=this.getChildBoundingBox(e,this,this,r);t?t.addBoundingBox(i):t=i})),t}getFontSize(){var{document:e,parent:t}=this,n=vke.parse(e.ctx.font).fontSize;return t.getStyle("font-size").getNumber(n)}getTElementBoundingBox(e){var t=this.getFontSize();return new Ike(this.x,this.y-t,this.x+this.measureText(e),this.y)}getGlyph(e,t,n){var r=t[n],i=null;if(e.isArabic){var o=t.length,a=t[n-1],s=t[n+1],l="isolated";if((0===n||" "===a)&&n<o-1&&" "!==s&&(l="terminal"),n>0&&" "!==a&&n<o-1&&" "!==s&&(l="medial"),n>0&&" "!==a&&(n===o-1||" "===s)&&(l="initial"),void 0!==e.glyphs[r]){var u=e.glyphs[r];i=u instanceof Eke?u:u[l]}}else i=e.glyphs[r];return i||(i=e.missingGlyph),i}getText(){return""}getTextFromNode(e){var t=e||this.node,n=Array.from(t.parentNode.childNodes),r=n.indexOf(t),i=n.length-1,o=bQe(t.textContent||"");return 0===r&&(o=BQe(o)),r===i&&(o=EQe(o)),o}renderChildren(e){if("text"===this.type){this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(e),this.children.forEach(((t,n)=>{this.renderChild(e,this,this,n)}));var{mouse:t}=this.document.screen;t.isWorking()&&t.checkBoundingBox(this,this.getBoundingBox(e))}else this.renderTElementChildren(e)}renderTElementChildren(e){var{document:t,parent:n}=this,r=this.getText(),i=n.getStyle("font-family").getDefinition();if(i)for(var{unitsPerEm:o}=i.fontFace,a=vke.parse(t.ctx.font),s=n.getStyle("font-size").getNumber(a.fontSize),l=n.getStyle("font-style").getString(a.fontStyle),u=s/o,A=i.isRTL?r.split("").reverse().join(""):r,c=CQe(n.getAttribute("dx").getString()),h=A.length,f=0;f<h;f++){var d=this.getGlyph(i,A,f);e.translate(this.x,this.y),e.scale(u,-u);var p=e.lineWidth;e.lineWidth=e.lineWidth*o/s,"italic"===l&&e.transform(1,0,.4,1,0,0),d.render(e),"italic"===l&&e.transform(1,0,-.4,1,0,0),e.lineWidth=p,e.scale(1/u,-1/u),e.translate(-this.x,-this.y),this.x+=s*(d.horizAdvX||i.horizAdvX)/o,void 0===c[f]||isNaN(c[f])||(this.x+=c[f])}else{var{x:g,y:y}=this;e.fillStyle&&e.fillText(r,g,y),e.strokeStyle&&e.strokeText(r,g,y)}}applyAnchoring(){if(!(this.textChunkStart>=this.leafTexts.length)){var e=this.leafTexts[this.textChunkStart],t=e.getStyle("text-anchor").getString("start"),n=0;n="start"===t?e.x-this.minX:"end"===t?e.x-this.maxX:e.x-(this.minX+this.maxX)/2;for(var r=this.textChunkStart;r<this.leafTexts.length;r++)this.leafTexts[r].x+=n;this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.textChunkStart=this.leafTexts.length}}adjustChildCoordinatesRecursive(e){this.children.forEach(((t,n)=>{this.adjustChildCoordinatesRecursiveCore(e,this,this,n)})),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(e,t,n,r){var i=n.children[r];i.children.length>0?i.children.forEach(((n,r)=>{t.adjustChildCoordinatesRecursiveCore(e,t,i,r)})):this.adjustChildCoordinates(e,t,n,r)}adjustChildCoordinates(e,t,n,r){var i=n.children[r];if("function"!=typeof i.measureText)return i;e.save(),i.setContext(e,!0);var o=i.getAttribute("x"),a=i.getAttribute("y"),s=i.getAttribute("dx"),l=i.getAttribute("dy"),u=i.getStyle("font-family").getDefinition(),A=Boolean(u)&&u.isRTL;0===r&&(o.hasValue()||o.setValue(i.getInheritedAttribute("x")),a.hasValue()||a.setValue(i.getInheritedAttribute("y")),s.hasValue()||s.setValue(i.getInheritedAttribute("dx")),l.hasValue()||l.setValue(i.getInheritedAttribute("dy")));var c=i.measureText(e);return A&&(t.x-=c),o.hasValue()?(t.applyAnchoring(),i.x=o.getPixels("x"),s.hasValue()&&(i.x+=s.getPixels("x"))):(s.hasValue()&&(t.x+=s.getPixels("x")),i.x=t.x),t.x=i.x,A||(t.x+=c),a.hasValue()?(i.y=a.getPixels("y"),l.hasValue()&&(i.y+=l.getPixels("y"))):(l.hasValue()&&(t.y+=l.getPixels("y")),i.y=t.y),t.y=i.y,t.leafTexts.push(i),t.minX=Math.min(t.minX,i.x,i.x+c),t.maxX=Math.max(t.maxX,i.x,i.x+c),i.clearContext(e),e.restore(),i}getChildBoundingBox(e,t,n,r){var i=n.children[r];if("function"!=typeof i.getBoundingBox)return null;var o=i.getBoundingBox(e);return o?(i.children.forEach(((n,r)=>{var a=t.getChildBoundingBox(e,t,i,r);o.addBoundingBox(a)})),o):null}renderChild(e,t,n,r){var i=n.children[r];i.render(e),i.children.forEach(((n,r)=>{t.renderChild(e,t,i,r)}))}measureText(e){var{measureCache:t}=this;if(~t)return t;var n=this.getText(),r=this.measureTargetText(e,n);return this.measureCache=r,r}measureTargetText(e,t){if(!t.length)return 0;var{parent:n}=this,r=n.getStyle("font-family").getDefinition();if(r){for(var i=this.getFontSize(),o=r.isRTL?t.split("").reverse().join(""):t,a=CQe(n.getAttribute("dx").getString()),s=o.length,l=0,u=0;u<s;u++){l+=(this.getGlyph(r,o,u).horizAdvX||r.horizAdvX)*i/r.fontFace.unitsPerEm,void 0===a[u]||isNaN(a[u])||(l+=a[u])}return l}if(!e.measureText)return 10*t.length;e.save(),this.setContext(e,!0);var{width:A}=e.measureText(t);return this.clearContext(e),e.restore(),A}getInheritedAttribute(e){for(var t=this;t instanceof Cke&&t.isFirstChild();){var n=t.parent.getAttribute(e);if(n.hasValue(!0))return n.getValue("0");t=t.parent}return null}}class Ske extends Cke{constructor(e,t,n){super(e,t,new.target===Ske||n),this.type="tspan",this.text=this.children.length>0?"":this.getTextFromNode()}getText(){return this.text}}class xke extends Ske{constructor(){super(...arguments),this.type="textNode"}}class Qke extends bke{constructor(){super(...arguments),this.type="svg",this.root=!1}setContext(e){var t,{document:n}=this,{screen:r,window:i}=n,o=e.canvas;if(r.setDefaults(e),o.style&&void 0!==e.font&&i&&void 0!==i.getComputedStyle){e.font=i.getComputedStyle(o).getPropertyValue("font");var a=new XQe(n,"fontSize",vke.parse(e.font).fontSize);a.hasValue()&&(n.rootEmSize=a.getPixels("y"),n.emSize=n.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);var{width:s,height:l}=r.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");var u=this.getAttribute("refX"),A=this.getAttribute("refY"),c=this.getAttribute("viewBox"),h=c.hasValue()?CQe(c.getString()):null,f=!this.root&&"visible"!==this.getStyle("overflow").getValue("hidden"),d=0,p=0,g=0,y=0;h&&(d=h[0],p=h[1]),this.root||(s=this.getStyle("width").getPixels("x"),l=this.getStyle("height").getPixels("y"),"marker"===this.type&&(g=d,y=p,d=0,p=0)),r.viewPort.setCurrent(s,l),!this.node||this.parent&&"foreignObject"!==(null===(t=this.node.parentNode)||void 0===t?void 0:t.nodeName)||!this.getStyle("transform",!1,!0).hasValue()||this.getStyle("transform-origin",!1,!0).hasValue()||this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(e),e.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),h&&(s=h[2],l=h[3]),n.setViewBox({ctx:e,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:r.viewPort.width,desiredWidth:s,height:r.viewPort.height,desiredHeight:l,minX:d,minY:p,refX:u.getValue(),refY:A.getValue(),clip:f,clipX:g,clipY:y}),h&&(r.viewPort.removeCurrent(),r.viewPort.setCurrent(s,l))}clearContext(e){super.clearContext(e),this.document.screen.viewPort.removeCurrent()}resize(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.getAttribute("width",!0),i=this.getAttribute("height",!0),o=this.getAttribute("viewBox"),a=this.getAttribute("style"),s=r.getNumber(0),l=i.getNumber(0);if(n)if("string"==typeof n)this.getAttribute("preserveAspectRatio",!0).setValue(n);else{var u=this.getAttribute("preserveAspectRatio");u.hasValue()&&u.setValue(u.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(r.setValue(e),i.setValue(t),o.hasValue()||o.setValue("0 0 ".concat(s||e," ").concat(l||t)),a.hasValue()){var A=this.getStyle("width"),c=this.getStyle("height");A.hasValue()&&A.setValue("".concat(e,"px")),c.hasValue()&&c.setValue("".concat(t,"px"))}}}class kke extends Bke{constructor(){super(...arguments),this.type="rect"}path(e){var t=this.getAttribute("x").getPixels("x"),n=this.getAttribute("y").getPixels("y"),r=this.getStyle("width",!1,!0).getPixels("x"),i=this.getStyle("height",!1,!0).getPixels("y"),o=this.getAttribute("rx"),a=this.getAttribute("ry"),s=o.getPixels("x"),l=a.getPixels("y");if(o.hasValue()&&!a.hasValue()&&(l=s),a.hasValue()&&!o.hasValue()&&(s=l),s=Math.min(s,r/2),l=Math.min(l,i/2),e){var u=(Math.sqrt(2)-1)/3*4;e.beginPath(),i>0&&r>0&&(e.moveTo(t+s,n),e.lineTo(t+r-s,n),e.bezierCurveTo(t+r-s+u*s,n,t+r,n+l-u*l,t+r,n+l),e.lineTo(t+r,n+i-l),e.bezierCurveTo(t+r,n+i-l+u*l,t+r-s+u*s,n+i,t+r-s,n+i),e.lineTo(t+s,n+i),e.bezierCurveTo(t+s-u*s,n+i,t,n+i-l+u*l,t,n+i-l),e.lineTo(t,n+l),e.bezierCurveTo(t,n+l-u*l,t+s-u*s,n,t+s,n),e.closePath())}return new Ike(t,n,t+r,n+i)}getMarkers(){return null}}class _ke extends Bke{constructor(){super(...arguments),this.type="circle"}path(e){var t=this.getAttribute("cx").getPixels("x"),n=this.getAttribute("cy").getPixels("y"),r=this.getAttribute("r").getPixels();return e&&r>0&&(e.beginPath(),e.arc(t,n,r,0,2*Math.PI,!1),e.closePath()),new Ike(t-r,n-r,t+r,n+r)}getMarkers(){return null}}class Nke extends Bke{constructor(){super(...arguments),this.type="ellipse"}path(e){var t=(Math.sqrt(2)-1)/3*4,n=this.getAttribute("rx").getPixels("x"),r=this.getAttribute("ry").getPixels("y"),i=this.getAttribute("cx").getPixels("x"),o=this.getAttribute("cy").getPixels("y");return e&&n>0&&r>0&&(e.beginPath(),e.moveTo(i+n,o),e.bezierCurveTo(i+n,o+t*r,i+t*n,o+r,i,o+r),e.bezierCurveTo(i-t*n,o+r,i-n,o+t*r,i-n,o),e.bezierCurveTo(i-n,o-t*r,i-t*n,o-r,i,o-r),e.bezierCurveTo(i+t*n,o-r,i+n,o-t*r,i+n,o),e.closePath()),new Ike(i-n,o-r,i+n,o+r)}getMarkers(){return null}}class Dke extends Bke{constructor(){super(...arguments),this.type="line"}getPoints(){return[new ZQe(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new ZQe(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(e){var[{x:t,y:n},{x:r,y:i}]=this.getPoints();return e&&(e.beginPath(),e.moveTo(t,n),e.lineTo(r,i)),new Ike(t,n,r,i)}getMarkers(){var[e,t]=this.getPoints(),n=e.angleTo(t);return[[e,n],[t,n]]}}class Fke extends Bke{constructor(e,t,n){super(e,t,n),this.type="polyline",this.points=[],this.points=ZQe.parsePath(this.getAttribute("points").getString())}path(e){var{points:t}=this,[{x:n,y:r}]=t,i=new Ike(n,r);return e&&(e.beginPath(),e.moveTo(n,r)),t.forEach((t=>{var{x:n,y:r}=t;i.addPoint(n,r),e&&e.lineTo(n,r)})),i}getMarkers(){var{points:e}=this,t=e.length-1,n=[];return e.forEach(((r,i)=>{i!==t&&n.push([r,r.angleTo(e[i+1])])})),n.length>0&&n.push([e[e.length-1],n[n.length-1][1]]),n}}class Pke extends Fke{constructor(){super(...arguments),this.type="polygon"}path(e){var t=super.path(e),[{x:n,y:r}]=this.points;return e&&(e.lineTo(n,r),e.closePath()),t}}class Uke extends dke{constructor(){super(...arguments),this.type="pattern"}createPattern(e,t,n){var r=this.getStyle("width").getPixels("x",!0),i=this.getStyle("height").getPixels("y",!0),o=new Qke(this.document,null);o.attributes.viewBox=new XQe(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.width=new XQe(this.document,"width","".concat(r,"px")),o.attributes.height=new XQe(this.document,"height","".concat(i,"px")),o.attributes.transform=new XQe(this.document,"transform",this.getAttribute("patternTransform").getValue()),o.children=this.children;var a=this.document.createCanvas(r,i),s=a.getContext("2d"),l=this.getAttribute("x"),u=this.getAttribute("y");l.hasValue()&&u.hasValue()&&s.translate(l.getPixels("x",!0),u.getPixels("y",!0)),n.hasValue()?this.styles["fill-opacity"]=n:Reflect.deleteProperty(this.styles,"fill-opacity");for(var A=-1;A<=1;A++)for(var c=-1;c<=1;c++)s.save(),o.attributes.x=new XQe(this.document,"x",A*a.width),o.attributes.y=new XQe(this.document,"y",c*a.height),o.render(s),s.restore();return e.createPattern(a,"repeat")}}class Mke extends dke{constructor(){super(...arguments),this.type="marker"}render(e,t,n){if(t){var{x:r,y:i}=t,o=this.getAttribute("orient").getString("auto"),a=this.getAttribute("markerUnits").getString("strokeWidth");e.translate(r,i),"auto"===o&&e.rotate(n),"strokeWidth"===a&&e.scale(e.lineWidth,e.lineWidth),e.save();var s=new Qke(this.document,null);s.type=this.type,s.attributes.viewBox=new XQe(this.document,"viewBox",this.getAttribute("viewBox").getValue()),s.attributes.refX=new XQe(this.document,"refX",this.getAttribute("refX").getValue()),s.attributes.refY=new XQe(this.document,"refY",this.getAttribute("refY").getValue()),s.attributes.width=new XQe(this.document,"width",this.getAttribute("markerWidth").getValue()),s.attributes.height=new XQe(this.document,"height",this.getAttribute("markerHeight").getValue()),s.attributes.overflow=new XQe(this.document,"overflow",this.getAttribute("overflow").getValue()),s.attributes.fill=new XQe(this.document,"fill",this.getAttribute("fill").getColor("black")),s.attributes.stroke=new XQe(this.document,"stroke",this.getAttribute("stroke").getValue("none")),s.children=this.children,s.render(e),e.restore(),"strokeWidth"===a&&e.scale(1/e.lineWidth,1/e.lineWidth),"auto"===o&&e.rotate(-n),e.translate(-r,-i)}}}class Lke extends dke{constructor(){super(...arguments),this.type="defs"}render(){}}class Tke extends bke{constructor(){super(...arguments),this.type="g"}getBoundingBox(e){var t=new Ike;return this.children.forEach((n=>{t.addBoundingBox(n.getBoundingBox(e))})),t}}class Rke extends dke{constructor(e,t,n){super(e,t,n),this.attributesToInherit=["gradientUnits"],this.stops=[];var{stops:r,children:i}=this;i.forEach((e=>{"stop"===e.type&&r.push(e)}))}getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(e,t,n){var r=this;this.getHrefAttribute().hasValue()&&(r=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(r));var{stops:i}=r,o=this.getGradient(e,t);if(!o)return this.addParentOpacity(n,i[i.length-1].color);if(i.forEach((e=>{o.addColorStop(e.offset,this.addParentOpacity(n,e.color))})),this.getAttribute("gradientTransform").hasValue()){var{document:a}=this,{MAX_VIRTUAL_PIXELS:s,viewPort:l}=a.screen,[u]=l.viewPorts,A=new kke(a,null);A.attributes.x=new XQe(a,"x",-s/3),A.attributes.y=new XQe(a,"y",-s/3),A.attributes.width=new XQe(a,"width",s),A.attributes.height=new XQe(a,"height",s);var c=new Tke(a,null);c.attributes.transform=new XQe(a,"transform",this.getAttribute("gradientTransform").getValue()),c.children=[A];var h=new Qke(a,null);h.attributes.x=new XQe(a,"x",0),h.attributes.y=new XQe(a,"y",0),h.attributes.width=new XQe(a,"width",u.width),h.attributes.height=new XQe(a,"height",u.height),h.children=[c];var f=a.createCanvas(u.width,u.height),d=f.getContext("2d");return d.fillStyle=o,h.render(d),d.createPattern(f,"no-repeat")}return o}inheritStopContainer(e){this.attributesToInherit.forEach((t=>{!this.getAttribute(t).hasValue()&&e.getAttribute(t).hasValue()&&this.getAttribute(t,!0).setValue(e.getAttribute(t).getValue())}))}addParentOpacity(e,t){return e.hasValue()?new XQe(this.document,"color",t).addOpacity(e).getColor():t}}class Oke extends Rke{constructor(e,t,n){super(e,t,n),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}getGradient(e,t){var n="objectBoundingBox"===this.getGradientUnits(),r=n?t.getBoundingBox(e):null;if(n&&!r)return null;this.getAttribute("x1").hasValue()||this.getAttribute("y1").hasValue()||this.getAttribute("x2").hasValue()||this.getAttribute("y2").hasValue()||(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));var i=n?r.x+r.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),o=n?r.y+r.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),a=n?r.x+r.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),s=n?r.y+r.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return i===a&&o===s?null:e.createLinearGradient(i,o,a,s)}}class Hke extends Rke{constructor(e,t,n){super(e,t,n),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}getGradient(e,t){var n="objectBoundingBox"===this.getGradientUnits(),r=t.getBoundingBox(e);if(n&&!r)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");var i=n?r.x+r.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),o=n?r.y+r.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y"),a=i,s=o;this.getAttribute("fx").hasValue()&&(a=n?r.x+r.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(s=n?r.y+r.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));var l=n?(r.width+r.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),u=this.getAttribute("fr").getPixels();return e.createRadialGradient(a,s,u,i,o,l)}}class Kke extends dke{constructor(e,t,n){super(e,t,n),this.type="stop";var r=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),i=this.getStyle("stop-opacity"),o=this.getStyle("stop-color",!0);""===o.getString()&&o.setValue("#000"),i.hasValue()&&(o=o.addOpacity(i)),this.offset=r,this.color=o.getColor()}}class jke extends dke{constructor(e,t,n){super(e,t,n),this.type="animate",this.duration=0,this.initialValue=null,this.initialUnits="",this.removed=!1,this.frozen=!1,e.screen.animations.push(this),this.begin=this.getAttribute("begin").getMilliseconds(),this.maxDuration=this.begin+this.getAttribute("dur").getMilliseconds(),this.from=this.getAttribute("from"),this.to=this.getAttribute("to"),this.values=new XQe(e,"values",null);var r=this.getAttribute("values");r.hasValue()&&this.values.setValue(r.getString().split(";"))}getProperty(){var e=this.getAttribute("attributeType").getString(),t=this.getAttribute("attributeName").getString();return"CSS"===e?this.parent.getStyle(t,!0):this.parent.getAttribute(t,!0)}calcValue(){var{initialUnits:e}=this,{progress:t,from:n,to:r}=this.getProgress(),i=n.getNumber()+(r.getNumber()-n.getNumber())*t;return"%"===e&&(i*=100),"".concat(i).concat(e)}update(e){var{parent:t}=this,n=this.getProperty();if(this.initialValue||(this.initialValue=n.getString(),this.initialUnits=n.getUnits()),this.duration>this.maxDuration){var r=this.getAttribute("fill").getString("remove");if("indefinite"===this.getAttribute("repeatCount").getString()||"indefinite"===this.getAttribute("repeatDur").getString())this.duration=0;else if("freeze"!==r||this.frozen){if("remove"===r&&!this.removed)return this.removed=!0,n.setValue(t.animationFrozen?t.animationFrozenValue:this.initialValue),!0}else this.frozen=!0,t.animationFrozen=!0,t.animationFrozenValue=n.getString();return!1}this.duration+=e;var i=!1;if(this.begin<this.duration){var o=this.calcValue(),a=this.getAttribute("type");if(a.hasValue()){var s=a.getString();o="".concat(s,"(").concat(o,")")}n.setValue(o),i=!0}return i}getProgress(){var{document:e,values:t}=this,n={progress:(this.duration-this.begin)/(this.maxDuration-this.begin)};if(t.hasValue()){var r=n.progress*(t.getValue().length-1),i=Math.floor(r),o=Math.ceil(r);n.from=new XQe(e,"from",parseFloat(t.getValue()[i])),n.to=new XQe(e,"to",parseFloat(t.getValue()[o])),n.progress=(r-i)/(o-i)}else n.from=this.from,n.to=this.to;return n}}class Gke extends jke{constructor(){super(...arguments),this.type="animateColor"}calcValue(){var{progress:e,from:t,to:n}=this.getProgress(),r=new yxe(t.getColor()),i=new yxe(n.getColor());if(r.ok&&i.ok){var o=r.r+(i.r-r.r)*e,a=r.g+(i.g-r.g)*e,s=r.b+(i.b-r.b)*e;return"rgb(".concat(Math.floor(o),", ").concat(Math.floor(a),", ").concat(Math.floor(s),")")}return this.getAttribute("from").getColor()}}class qke extends jke{constructor(){super(...arguments),this.type="animateTransform"}calcValue(){var{progress:e,from:t,to:n}=this.getProgress(),r=CQe(t.getString()),i=CQe(n.getString()),o=r.map(((t,n)=>t+(i[n]-t)*e)).join(" ");return o}}class Vke extends dke{constructor(e,t,n){super(e,t,n),this.type="font",this.glyphs={},this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();var{definitions:r}=e,{children:i}=this;for(var o of i)switch(o.type){case"font-face":this.fontFace=o;var a=o.getStyle("font-family");a.hasValue()&&(r[a.getString()]=this);break;case"missing-glyph":this.missingGlyph=o;break;case"glyph":var s=o;s.arabicForm?(this.isRTL=!0,this.isArabic=!0,void 0===this.glyphs[s.unicode]&&(this.glyphs[s.unicode]={}),this.glyphs[s.unicode][s.arabicForm]=s):this.glyphs[s.unicode]=s}}render(){}}class zke extends dke{constructor(e,t,n){super(e,t,n),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class Jke extends Bke{constructor(){super(...arguments),this.type="missing-glyph",this.horizAdvX=0}}class Yke extends Cke{constructor(){super(...arguments),this.type="tref"}getText(){var e=this.getHrefAttribute().getDefinition();if(e){var t=e.children[0];if(t)return t.getText()}return""}}class Xke extends Cke{constructor(e,t,n){super(e,t,n),this.type="a";var{childNodes:r}=t,i=r[0],o=r.length>0&&Array.from(r).every((e=>3===e.nodeType));this.hasText=o,this.text=o?this.getTextFromNode(i):""}getText(){return this.text}renderChildren(e){if(this.hasText){super.renderChildren(e);var{document:t,x:n,y:r}=this,{mouse:i}=t.screen,o=new XQe(t,"fontSize",vke.parse(t.ctx.font).fontSize);i.isWorking()&&i.checkBoundingBox(this,new Ike(n,r-o.getPixels("y"),n+this.measureText(e),r))}else if(this.children.length>0){var a=new Tke(this.document,null);a.children=this.children,a.parent=this,a.render(e)}}onClick(){var{window:e}=this.document;e&&e.open(this.getHrefAttribute().getString())}onMouseMove(){this.document.ctx.canvas.style.cursor="pointer"}}function Wke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zke(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wke(Object(n),!0).forEach((function(t){KCe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wke(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}class $ke extends Cke{constructor(e,t,n){super(e,t,n),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);var r=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(r)}getText(){return this.text}path(e){var{dataArray:t}=this;e&&e.beginPath(),t.forEach((t=>{var{type:n,points:r}=t;switch(n){case wke.LINE_TO:e&&e.lineTo(r[0],r[1]);break;case wke.MOVE_TO:e&&e.moveTo(r[0],r[1]);break;case wke.CURVE_TO:e&&e.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case wke.QUAD_TO:e&&e.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case wke.ARC:var[i,o,a,s,l,u,A,c]=r,h=a>s?a:s,f=a>s?1:a/s,d=a>s?s/a:1;e&&(e.translate(i,o),e.rotate(A),e.scale(f,d),e.arc(0,0,h,l,l+u,Boolean(1-c)),e.scale(1/f,1/d),e.rotate(-A),e.translate(-i,-o));break;case wke.CLOSE_PATH:e&&e.closePath()}}))}renderChildren(e){this.setTextData(e),e.save();var t=this.parent.getStyle("text-decoration").getString(),n=this.getFontSize(),{glyphInfo:r}=this,i=e.fillStyle;"underline"===t&&e.beginPath(),r.forEach(((r,i)=>{var{p0:o,p1:a,rotation:s,text:l}=r;e.save(),e.translate(o.x,o.y),e.rotate(s),e.fillStyle&&e.fillText(l,0,0),e.strokeStyle&&e.strokeText(l,0,0),e.restore(),"underline"===t&&(0===i&&e.moveTo(o.x,o.y+n/8),e.lineTo(a.x,a.y+n/5))})),"underline"===t&&(e.lineWidth=n/20,e.strokeStyle=i,e.stroke(),e.closePath()),e.restore()}getLetterSpacingAt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.letterSpacingCache[e]||0}findSegmentToFitChar(e,t,n,r,i,o,a,s,l){var u=o,A=this.measureText(e,s);" "===s&&"justify"===t&&n<r&&(A+=(r-n)/i),l>-1&&(u+=this.getLetterSpacingAt(l));var c=this.textHeight/20,h=this.getEquidistantPointOnPath(u,c,0),f=this.getEquidistantPointOnPath(u+A,c,0),d={p0:h,p1:f},p=h&&f?Math.atan2(f.y-h.y,f.x-h.x):0;if(a){var g=Math.cos(Math.PI/2+p)*a,y=Math.cos(-p)*a;d.p0=Zke(Zke({},h),{},{x:h.x+g,y:h.y+y}),d.p1=Zke(Zke({},f),{},{x:f.x+g,y:f.y+y})}return{offset:u+=A,segment:d,rotation:p}}measureText(e,t){var{measuresCache:n}=this,r=t||this.getText();if(n.has(r))return n.get(r);var i=this.measureTargetText(e,r);return n.set(r,i),i}setTextData(e){if(!this.glyphInfo){var t=this.getText(),n=t.split(""),r=t.split(" ").length-1,i=this.parent.getAttribute("dx").split().map((e=>e.getPixels("x"))),o=this.parent.getAttribute("dy").getPixels("y"),a=this.parent.getStyle("text-anchor").getString("start"),s=this.getStyle("letter-spacing"),l=this.parent.getStyle("letter-spacing"),u=0;s.hasValue()&&"inherit"!==s.getValue()?s.hasValue()&&"initial"!==s.getValue()&&"unset"!==s.getValue()&&(u=s.getPixels()):u=l.getPixels();var A=[],c=t.length;this.letterSpacingCache=A;for(var h=0;h<c;h++)A.push(void 0!==i[h]?i[h]:u);var f=A.reduce(((e,t,n)=>0===n?0:e+t||0),0),d=this.measureText(e),p=Math.max(d+f,0);this.textWidth=d,this.textHeight=this.getFontSize(),this.glyphInfo=[];var g=this.getPathLength(),y=this.getStyle("startOffset").getNumber(0)*g,m=0;"middle"!==a&&"center"!==a||(m=-p/2),"end"!==a&&"right"!==a||(m=-p),m+=y,n.forEach(((t,i)=>{var{offset:s,segment:l,rotation:u}=this.findSegmentToFitChar(e,a,p,g,r,m,o,t,i);m=s,l.p0&&l.p1&&this.glyphInfo.push({text:n[i],p0:l.p0,p1:l.p1,rotation:u})}))}}parsePathData(e){if(this.pathLength=-1,!e)return[];var t=[],{pathParser:n}=e;for(n.reset();!n.isEnd();){var{current:r}=n,i=r?r.x:0,o=r?r.y:0,a=n.next(),s=a.type,l=[];switch(a.type){case wke.MOVE_TO:this.pathM(n,l);break;case wke.LINE_TO:s=this.pathL(n,l);break;case wke.HORIZ_LINE_TO:s=this.pathH(n,l);break;case wke.VERT_LINE_TO:s=this.pathV(n,l);break;case wke.CURVE_TO:this.pathC(n,l);break;case wke.SMOOTH_CURVE_TO:s=this.pathS(n,l);break;case wke.QUAD_TO:this.pathQ(n,l);break;case wke.SMOOTH_QUAD_TO:s=this.pathT(n,l);break;case wke.ARC:l=this.pathA(n);break;case wke.CLOSE_PATH:Bke.pathZ(n)}a.type!==wke.CLOSE_PATH?t.push({type:s,points:l,start:{x:i,y:o},pathLength:this.calcLength(i,o,s,l)}):t.push({type:wke.CLOSE_PATH,points:[],pathLength:0})}return t}pathM(e,t){var{x:n,y:r}=Bke.pathM(e).point;t.push(n,r)}pathL(e,t){var{x:n,y:r}=Bke.pathL(e).point;return t.push(n,r),wke.LINE_TO}pathH(e,t){var{x:n,y:r}=Bke.pathH(e).point;return t.push(n,r),wke.LINE_TO}pathV(e,t){var{x:n,y:r}=Bke.pathV(e).point;return t.push(n,r),wke.LINE_TO}pathC(e,t){var{point:n,controlPoint:r,currentPoint:i}=Bke.pathC(e);t.push(n.x,n.y,r.x,r.y,i.x,i.y)}pathS(e,t){var{point:n,controlPoint:r,currentPoint:i}=Bke.pathS(e);return t.push(n.x,n.y,r.x,r.y,i.x,i.y),wke.CURVE_TO}pathQ(e,t){var{controlPoint:n,currentPoint:r}=Bke.pathQ(e);t.push(n.x,n.y,r.x,r.y)}pathT(e,t){var{controlPoint:n,currentPoint:r}=Bke.pathT(e);return t.push(n.x,n.y,r.x,r.y),wke.QUAD_TO}pathA(e){var{rX:t,rY:n,sweepFlag:r,xAxisRotation:i,centp:o,a1:a,ad:s}=Bke.pathA(e);return 0===r&&s>0&&(s-=2*Math.PI),1===r&&s<0&&(s+=2*Math.PI),[o.x,o.y,t,n,a,s,i,r]}calcLength(e,t,n,r){var i=0,o=null,a=null,s=0;switch(n){case wke.LINE_TO:return this.getLineLength(e,t,r[0],r[1]);case wke.CURVE_TO:for(i=0,o=this.getPointOnCubicBezier(0,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),s=.01;s<=1;s+=.01)a=this.getPointOnCubicBezier(s,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),i+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;return i;case wke.QUAD_TO:for(i=0,o=this.getPointOnQuadraticBezier(0,e,t,r[0],r[1],r[2],r[3]),s=.01;s<=1;s+=.01)a=this.getPointOnQuadraticBezier(s,e,t,r[0],r[1],r[2],r[3]),i+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;return i;case wke.ARC:i=0;var l=r[4],u=r[5],A=r[4]+u,c=Math.PI/180;if(Math.abs(l-A)<c&&(c=Math.abs(l-A)),o=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),u<0)for(s=l-c;s>A;s-=c)a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],s,0),i+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;else for(s=l+c;s<A;s+=c)a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],s,0),i+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;return a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],A,0),i+=this.getLineLength(o.x,o.y,a.x,a.y)}return 0}getPointOnLine(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:t,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:n,s=(i-n)/(r-t+RQe),l=Math.sqrt(e*e/(1+s*s));r<t&&(l*=-1);var u=s*l,A=null;if(r===t)A={x:o,y:a+u};else if((a-n)/(o-t+RQe)===s)A={x:o+l,y:a+u};else{var c,h,f=this.getLineLength(t,n,r,i);if(f<RQe)return null;var d=(o-t)*(r-t)+(a-n)*(i-n);c=t+(d/=f*f)*(r-t),h=n+d*(i-n);var p=this.getLineLength(o,a,c,h),g=Math.sqrt(e*e-p*p);l=Math.sqrt(g*g/(1+s*s)),r<t&&(l*=-1),A={x:c+l,y:h+(u=s*l)}}return A}getPointOnPath(e){var t=this.getPathLength(),n=0,r=null;if(e<-5e-5||e-5e-5>t)return null;var{dataArray:i}=this;for(var o of i){if(!o||!(o.pathLength<5e-5||n+o.pathLength+5e-5<e)){var a=e-n,s=0;switch(o.type){case wke.LINE_TO:r=this.getPointOnLine(a,o.start.x,o.start.y,o.points[0],o.points[1],o.start.x,o.start.y);break;case wke.ARC:var l=o.points[4],u=o.points[5],A=o.points[4]+u;if(s=l+a/o.pathLength*u,u<0&&s<A||u>=0&&s>A)break;r=this.getPointOnEllipticalArc(o.points[0],o.points[1],o.points[2],o.points[3],s,o.points[6]);break;case wke.CURVE_TO:(s=a/o.pathLength)>1&&(s=1),r=this.getPointOnCubicBezier(s,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3],o.points[4],o.points[5]);break;case wke.QUAD_TO:(s=a/o.pathLength)>1&&(s=1),r=this.getPointOnQuadraticBezier(s,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3])}if(r)return r;break}n+=o.pathLength}return null}getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}getPathLength(){return-1===this.pathLength&&(this.pathLength=this.dataArray.reduce(((e,t)=>t.pathLength>0?e+t.pathLength:e),0)),this.pathLength}getPointOnCubicBezier(e,t,n,r,i,o,a,s,l){return{x:s*jQe(e)+o*GQe(e)+r*qQe(e)+t*VQe(e),y:l*jQe(e)+a*GQe(e)+i*qQe(e)+n*VQe(e)}}getPointOnQuadraticBezier(e,t,n,r,i,o,a){return{x:o*zQe(e)+r*JQe(e)+t*YQe(e),y:a*zQe(e)+i*JQe(e)+n*YQe(e)}}getPointOnEllipticalArc(e,t,n,r,i,o){var a=Math.cos(o),s=Math.sin(o),l=n*Math.cos(i),u=r*Math.sin(i);return{x:e+(l*a-u*s),y:t+(l*s+u*a)}}buildEquidistantCache(e,t){var n=this.getPathLength(),r=t||.25,i=e||n/100;if(!this.equidistantCache||this.equidistantCache.step!==i||this.equidistantCache.precision!==r){this.equidistantCache={step:i,precision:r,points:[]};for(var o=0,a=0;a<=n;a+=r){var s=this.getPointOnPath(a),l=this.getPointOnPath(a+r);s&&l&&((o+=this.getLineLength(s.x,s.y,l.x,l.y))>=i&&(this.equidistantCache.points.push({x:s.x,y:s.y,distance:a}),o-=i))}}}getEquidistantPointOnPath(e,t,n){if(this.buildEquidistantCache(t,n),e<0||e-this.getPathLength()>5e-5)return null;var r=Math.round(e/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[r]||null}}var e_e=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class t_e extends bke{constructor(e,t,n){super(e,t,n),this.type="image",this.loaded=!1;var r=this.getHrefAttribute().getString();if(r){var i=r.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(r);e.images.push(this),i?this.loadSvg(r):this.loadImage(r),this.isSvg=i}}loadImage(e){var t=this;return xwe((function*(){try{var n=yield t.document.createImage(e);t.image=n}catch(t){console.error('Error while loading image "'.concat(e,'":'),t)}t.loaded=!0}))()}loadSvg(e){var t=this;return xwe((function*(){var n=e_e.exec(e);if(n){var r=n[5];"base64"===n[4]?t.image=atob(r):t.image=decodeURIComponent(r)}else try{var i=yield t.document.fetch(e),o=yield i.text();t.image=o}catch(t){console.error('Error while loading image "'.concat(e,'":'),t)}t.loaded=!0}))()}renderChildren(e){var{document:t,image:n,loaded:r}=this,i=this.getAttribute("x").getPixels("x"),o=this.getAttribute("y").getPixels("y"),a=this.getStyle("width").getPixels("x"),s=this.getStyle("height").getPixels("y");if(r&&n&&a&&s){if(e.save(),e.translate(i,o),this.isSvg){var l=t.canvg.forkString(e,this.image,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:a,scaleHeight:s});l.document.documentElement.parent=this,l.render()}else{var u=this.image;t.setViewBox({ctx:e,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:a,desiredWidth:u.width,height:s,desiredHeight:u.height}),this.loaded&&(void 0===u.complete||u.complete)&&e.drawImage(u,0,0)}e.restore()}}getBoundingBox(){var e=this.getAttribute("x").getPixels("x"),t=this.getAttribute("y").getPixels("y"),n=this.getStyle("width").getPixels("x"),r=this.getStyle("height").getPixels("y");return new Ike(e,t,e+n,t+r)}}class n_e extends bke{constructor(){super(...arguments),this.type="symbol"}render(e){}}class r_e{constructor(e){this.document=e,this.loaded=!1,e.fonts.push(this)}load(e,t){var n=this;return xwe((function*(){try{var{document:r}=n,i=(yield r.canvg.parser.load(t)).getElementsByTagName("font");Array.from(i).forEach((t=>{var n=r.createElement(t);r.definitions[e]=n}))}catch(e){console.error('Error while loading font "'.concat(t,'":'),e)}n.loaded=!0}))()}}class i_e extends dke{constructor(e,t,n){super(e,t,n),this.type="style";var r=bQe(Array.from(t.childNodes).map((e=>e.textContent)).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,""));r.split("}").forEach((t=>{var n=t.trim();if(n){var r=n.split("{"),i=r[0].split(","),o=r[1].split(";");i.forEach((t=>{var n=t.trim();if(n){var r=e.styles[n]||{};if(o.forEach((t=>{var n=t.indexOf(":"),i=t.substr(0,n).trim(),o=t.substr(n+1,t.length-n).trim();i&&o&&(r[i]=new XQe(e,i,o))})),e.styles[n]=r,e.stylesSpecificity[n]=TQe(n),"@font-face"===n){var i=r["font-family"].getString().replace(/"|'/g,"");r.src.getString().split(",").forEach((t=>{if(t.indexOf('format("svg")')>0){var n=QQe(t);n&&new r_e(e).load(i,n)}}))}}}))}}))}}i_e.parseExternalUrl=QQe;class o_e extends bke{constructor(){super(...arguments),this.type="use"}setContext(e){super.setContext(e);var t=this.getAttribute("x"),n=this.getAttribute("y");t.hasValue()&&e.translate(t.getPixels("x"),0),n.hasValue()&&e.translate(0,n.getPixels("y"))}path(e){var{element:t}=this;t&&t.path(e)}renderChildren(e){var{document:t,element:n}=this;if(n){var r=n;if("symbol"===n.type&&((r=new Qke(t,null)).attributes.viewBox=new XQe(t,"viewBox",n.getAttribute("viewBox").getString()),r.attributes.preserveAspectRatio=new XQe(t,"preserveAspectRatio",n.getAttribute("preserveAspectRatio").getString()),r.attributes.overflow=new XQe(t,"overflow",n.getAttribute("overflow").getString()),r.children=n.children,n.styles.opacity=new XQe(t,"opacity",this.calculateOpacity())),"svg"===r.type){var i=this.getStyle("width",!1,!0),o=this.getStyle("height",!1,!0);i.hasValue()&&(r.attributes.width=new XQe(t,"width",i.getString())),o.hasValue()&&(r.attributes.height=new XQe(t,"height",o.getString()))}var a=r.parent;r.parent=this,r.render(e),r.parent=a}}getBoundingBox(e){var{element:t}=this;return t?t.getBoundingBox(e):null}elementTransform(){var{document:e,element:t}=this;return fke.fromElement(e,t)}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}}function a_e(e,t,n,r,i,o){return e[n*r*4+4*t+o]}function s_e(e,t,n,r,i,o,a){e[n*r*4+4*t+o]=a}function l_e(e,t,n){return e[t]*n}function u_e(e,t,n,r){return t+Math.cos(e)*n+Math.sin(e)*r}class A_e extends dke{constructor(e,t,n){super(e,t,n),this.type="feColorMatrix";var r=CQe(this.getAttribute("values").getString());switch(this.getAttribute("type").getString("matrix")){case"saturate":var i=r[0];r=[.213+.787*i,.715-.715*i,.072-.072*i,0,0,.213-.213*i,.715+.285*i,.072-.072*i,0,0,.213-.213*i,.715-.715*i,.072+.928*i,0,0,0,0,0,1,0,0,0,0,0,1];break;case"hueRotate":var o=r[0]*Math.PI/180;r=[u_e(o,.213,.787,-.213),u_e(o,.715,-.715,-.715),u_e(o,.072,-.072,.928),0,0,u_e(o,.213,-.213,.143),u_e(o,.715,.285,.14),u_e(o,.072,-.072,-.283),0,0,u_e(o,.213,-.213,-.787),u_e(o,.715,-.715,.715),u_e(o,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}this.matrix=r,this.includeOpacity=this.getAttribute("includeOpacity").hasValue()}apply(e,t,n,r,i){for(var{includeOpacity:o,matrix:a}=this,s=e.getImageData(0,0,r,i),l=0;l<i;l++)for(var u=0;u<r;u++){var A=a_e(s.data,u,l,r,0,0),c=a_e(s.data,u,l,r,0,1),h=a_e(s.data,u,l,r,0,2),f=a_e(s.data,u,l,r,0,3),d=l_e(a,0,A)+l_e(a,1,c)+l_e(a,2,h)+l_e(a,3,f)+l_e(a,4,1),p=l_e(a,5,A)+l_e(a,6,c)+l_e(a,7,h)+l_e(a,8,f)+l_e(a,9,1),g=l_e(a,10,A)+l_e(a,11,c)+l_e(a,12,h)+l_e(a,13,f)+l_e(a,14,1),y=l_e(a,15,A)+l_e(a,16,c)+l_e(a,17,h)+l_e(a,18,f)+l_e(a,19,1);o&&(d=0,p=0,g=0,y*=f/255),s_e(s.data,u,l,r,0,0,d),s_e(s.data,u,l,r,0,1,p),s_e(s.data,u,l,r,0,2,g),s_e(s.data,u,l,r,0,3,y)}e.clearRect(0,0,r,i),e.putImageData(s,0,0)}}class c_e extends dke{constructor(){super(...arguments),this.type="mask"}apply(e,t){var{document:n}=this,r=this.getAttribute("x").getPixels("x"),i=this.getAttribute("y").getPixels("y"),o=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y");if(!o&&!a){var s=new Ike;this.children.forEach((t=>{s.addBoundingBox(t.getBoundingBox(e))})),r=Math.floor(s.x1),i=Math.floor(s.y1),o=Math.floor(s.width),a=Math.floor(s.height)}var l=this.removeStyles(t,c_e.ignoreStyles),u=n.createCanvas(r+o,i+a),A=u.getContext("2d");n.screen.setDefaults(A),this.renderChildren(A),new A_e(n,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(A,0,0,r+o,i+a);var c=n.createCanvas(r+o,i+a),h=c.getContext("2d");n.screen.setDefaults(h),t.render(h),h.globalCompositeOperation="destination-in",h.fillStyle=A.createPattern(u,"no-repeat"),h.fillRect(0,0,r+o,i+a),e.fillStyle=h.createPattern(c,"no-repeat"),e.fillRect(0,0,r+o,i+a),this.restoreStyles(t,l)}render(e){}}c_e.ignoreStyles=["mask","transform","clip-path"];var h_e=()=>{};class f_e extends dke{constructor(){super(...arguments),this.type="clipPath"}apply(e){var{document:t}=this,n=Reflect.getPrototypeOf(e),{beginPath:r,closePath:i}=e;n&&(n.beginPath=h_e,n.closePath=h_e),Reflect.apply(r,e,[]),this.children.forEach((r=>{if(void 0!==r.path){var o=void 0!==r.elementTransform?r.elementTransform():null;o||(o=fke.fromElement(t,r)),o&&o.apply(e),r.path(e),n&&(n.closePath=i),o&&o.unapply(e)}})),Reflect.apply(i,e,[]),e.clip(),n&&(n.beginPath=r,n.closePath=i)}render(e){}}class d_e extends dke{constructor(){super(...arguments),this.type="filter"}apply(e,t){var{document:n,children:r}=this,i=t.getBoundingBox(e);if(i){var o=0,a=0;r.forEach((e=>{var t=e.extraFilterDistance||0;o=Math.max(o,t),a=Math.max(a,t)}));var s=Math.floor(i.width),l=Math.floor(i.height),u=s+2*o,A=l+2*a;if(!(u<1||A<1)){var c=Math.floor(i.x),h=Math.floor(i.y),f=this.removeStyles(t,d_e.ignoreStyles),d=n.createCanvas(u,A),p=d.getContext("2d");n.screen.setDefaults(p),p.translate(-c+o,-h+a),t.render(p),r.forEach((e=>{"function"==typeof e.apply&&e.apply(p,0,0,u,A)})),e.drawImage(d,0,0,u,A,c-o,h-a,u,A),this.restoreStyles(t,f)}}}render(e){}}d_e.ignoreStyles=["filter","transform","clip-path"];class p_e extends dke{constructor(e,t,n){super(e,t,n),this.type="feDropShadow",this.addStylesFromStyleDefinition()}apply(e,t,n,r,i){}}class g_e extends dke{constructor(){super(...arguments),this.type="feMorphology"}apply(e,t,n,r,i){}}class y_e extends dke{constructor(){super(...arguments),this.type="feComposite"}apply(e,t,n,r,i){}}class m_e extends dke{constructor(e,t,n){super(e,t,n),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}apply(e,t,n,r,i){var{document:o,blurRadius:a}=this,s=o.window?o.window.document.body:null,l=e.canvas;l.id=o.getUniqueId(),s&&(l.style.display="none",s.appendChild(l)),vQe(l,t,n,r,i,a),s&&s.removeChild(l)}}class v_e extends dke{constructor(){super(...arguments),this.type="title"}}class I_e extends dke{constructor(){super(...arguments),this.type="desc"}}var w_e={svg:Qke,rect:kke,circle:_ke,ellipse:Nke,line:Dke,polyline:Fke,polygon:Pke,path:Bke,pattern:Uke,marker:Mke,defs:Lke,linearGradient:Oke,radialGradient:Hke,stop:Kke,animate:jke,animateColor:Gke,animateTransform:qke,font:Vke,"font-face":zke,"missing-glyph":Jke,glyph:Eke,text:Cke,tspan:Ske,tref:Yke,a:Xke,textPath:$ke,image:t_e,g:Tke,symbol:n_e,style:i_e,use:o_e,mask:c_e,clipPath:f_e,filter:d_e,feDropShadow:p_e,feMorphology:g_e,feComposite:y_e,feColorMatrix:A_e,feGaussianBlur:m_e,title:v_e,desc:I_e};function b_e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function B_e(){return B_e=xwe((function*(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=document.createElement("img");return t&&(n.crossOrigin="Anonymous"),new Promise(((t,r)=>{n.onload=()=>{t(n)},n.onerror=(e,t,n,i,o)=>{r(o)},n.src=e}))})),B_e.apply(this,arguments)}class E_e{constructor(e){var{rootEmSize:t=12,emSize:n=12,createCanvas:r=E_e.createCanvas,createImage:i=E_e.createImage,anonymousCrossOrigin:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.canvg=e,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=e.screen,this.rootEmSize=t,this.emSize=n,this.createCanvas=r,this.createImage=this.bindCreateImage(i,o),this.screen.wait(this.isImagesLoaded.bind(this)),this.screen.wait(this.isFontsLoaded.bind(this))}bindCreateImage(e,t){return"boolean"==typeof t?(n,r)=>e(n,"boolean"==typeof r?r:t):e}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){var{emSizeStack:e}=this;return e[e.length-1]}set emSize(e){var{emSizeStack:t}=this;t.push(e)}popEmSize(){var{emSizeStack:e}=this;e.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every((e=>e.loaded))}isFontsLoaded(){return this.fonts.every((e=>e.loaded))}createDocumentElement(e){var t=this.createElement(e.documentElement);return t.root=!0,t.addStylesFromStyleDefinition(),this.documentElement=t,t}createElement(e){var t=e.nodeName.replace(/^[^:]+:/,""),n=E_e.elementTypes[t];return void 0!==n?new n(this,e):new pke(this,e)}createTextNode(e){return new xke(this,e)}setViewBox(e){this.screen.setViewBox(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b_e(Object(n),!0).forEach((function(t){KCe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({document:this},e))}}function C_e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function S_e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C_e(Object(n),!0).forEach((function(t){KCe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}E_e.createCanvas=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,n},E_e.createImage=function(e){return B_e.apply(this,arguments)},E_e.elementTypes=w_e;class x_e{constructor(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.parser=new oke(n),this.screen=new nke(e,n),this.options=n;var r=new E_e(this,n),i=r.createDocumentElement(t);this.document=r,this.documentElement=i}static from(e,t){var n=arguments;return xwe((function*(){var r=n.length>2&&void 0!==n[2]?n[2]:{},i=new oke(r),o=yield i.parse(t);return new x_e(e,o,r)}))()}static fromString(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new oke(n).parseFromString(t);return new x_e(e,r,n)}fork(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return x_e.from(e,t,S_e(S_e({},this.options),n))}forkString(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return x_e.fromString(e,t,S_e(S_e({},this.options),n))}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}render(){var e=arguments,t=this;return xwe((function*(){var n=e.length>0&&void 0!==e[0]?e[0]:{};t.start(S_e({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0},n)),yield t.ready(),t.stop()}))()}start(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{documentElement:t,screen:n,options:r}=this;n.start(t,S_e(S_e({enableRedraw:!0},r),e))}stop(){this.screen.stop()}resize(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.documentElement.resize(e,t,n)}}var Q_e=Object.freeze({__proto__:null,AElement:Xke,AnimateColorElement:Gke,AnimateElement:jke,AnimateTransformElement:qke,BoundingBox:Ike,CB1:jQe,CB2:GQe,CB3:qQe,CB4:VQe,Canvg:x_e,CircleElement:_ke,ClipPathElement:f_e,DefsElement:Lke,DescElement:I_e,Document:E_e,Element:dke,EllipseElement:Nke,FeColorMatrixElement:A_e,FeCompositeElement:y_e,FeDropShadowElement:p_e,FeGaussianBlurElement:m_e,FeMorphologyElement:g_e,FilterElement:d_e,Font:vke,FontElement:Vke,FontFaceElement:zke,GElement:Tke,GlyphElement:Eke,GradientElement:Rke,ImageElement:t_e,LineElement:Dke,LinearGradientElement:Oke,MarkerElement:Mke,MaskElement:c_e,Matrix:uke,MissingGlyphElement:Jke,Mouse:$Qe,PSEUDO_ZERO:RQe,Parser:oke,PathElement:Bke,PathParser:wke,PatternElement:Uke,Point:ZQe,PolygonElement:Pke,PolylineElement:Fke,Property:XQe,QB1:zQe,QB2:JQe,QB3:YQe,RadialGradientElement:Hke,RectElement:kke,RenderedElement:bke,Rotate:ske,SVGElement:Qke,SVGFontLoader:r_e,Scale:lke,Screen:nke,Skew:Ake,SkewX:cke,SkewY:hke,StopElement:Kke,StyleElement:i_e,SymbolElement:n_e,TRefElement:Yke,TSpanElement:Ske,TextElement:Cke,TextPathElement:$ke,TitleElement:v_e,Transform:fke,Translate:ake,UnknownElement:pke,UseElement:o_e,ViewPort:WQe,compressSpaces:bQe,default:x_e,getSelectorSpecificity:TQe,normalizeAttributeName:xQe,normalizeColor:kQe,parseExternalUrl:QQe,presets:wQe,toNumbers:CQe,trimLeft:BQe,trimRight:EQe,vectorMagnitude:OQe,vectorsAngle:KQe,vectorsRatio:HQe})}();
|
|
1228
|
+
var mQe=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],vQe=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function IQe(e,t,n,r,i,o){if(!(isNaN(o)||o<1)){o|=0;var a=function(e,t,n,r,i){if("string"==typeof e&&(e=document.getElementById(e)),!e||"object"!==yQe(e)||!("getContext"in e))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var o=e.getContext("2d");try{return o.getImageData(t,n,r,i)}catch(e){throw new Error("unable to access image data: "+e)}}(e,t,n,r,i);a=function(e,t,n,r,i,o){for(var a,s=e.data,l=2*o+1,u=r-1,A=i-1,c=o+1,h=c*(c+1)/2,f=new wQe,d=f,p=1;p<l;p++)d=d.next=new wQe,p===c&&(a=d);d.next=f;for(var g=null,y=null,m=0,v=0,I=mQe[o],w=vQe[o],b=0;b<i;b++){d=f;for(var B=s[v],E=s[v+1],C=s[v+2],S=s[v+3],x=0;x<c;x++)d.r=B,d.g=E,d.b=C,d.a=S,d=d.next;for(var Q=0,k=0,_=0,N=0,D=c*B,F=c*E,P=c*C,U=c*S,M=h*B,L=h*E,T=h*C,R=h*S,O=1;O<c;O++){var H=v+((u<O?u:O)<<2),K=s[H],j=s[H+1],G=s[H+2],q=s[H+3],V=c-O;M+=(d.r=K)*V,L+=(d.g=j)*V,T+=(d.b=G)*V,R+=(d.a=q)*V,Q+=K,k+=j,_+=G,N+=q,d=d.next}g=f,y=a;for(var z=0;z<r;z++){var J=R*I>>w;if(s[v+3]=J,0!==J){var Y=255/J;s[v]=(M*I>>w)*Y,s[v+1]=(L*I>>w)*Y,s[v+2]=(T*I>>w)*Y}else s[v]=s[v+1]=s[v+2]=0;M-=D,L-=F,T-=P,R-=U,D-=g.r,F-=g.g,P-=g.b,U-=g.a;var X=z+o+1;X=m+(X<u?X:u)<<2,M+=Q+=g.r=s[X],L+=k+=g.g=s[X+1],T+=_+=g.b=s[X+2],R+=N+=g.a=s[X+3],g=g.next;var W=y,Z=W.r,$=W.g,ee=W.b,te=W.a;D+=Z,F+=$,P+=ee,U+=te,Q-=Z,k-=$,_-=ee,N-=te,y=y.next,v+=4}m+=r}for(var ne=0;ne<r;ne++){var re=s[v=ne<<2],ie=s[v+1],oe=s[v+2],ae=s[v+3],se=c*re,le=c*ie,ue=c*oe,Ae=c*ae,ce=h*re,he=h*ie,fe=h*oe,de=h*ae;d=f;for(var pe=0;pe<c;pe++)d.r=re,d.g=ie,d.b=oe,d.a=ae,d=d.next;for(var ge=r,ye=0,me=0,ve=0,Ie=0,we=1;we<=o;we++){v=ge+ne<<2;var be=c-we;ce+=(d.r=re=s[v])*be,he+=(d.g=ie=s[v+1])*be,fe+=(d.b=oe=s[v+2])*be,de+=(d.a=ae=s[v+3])*be,Ie+=re,ye+=ie,me+=oe,ve+=ae,d=d.next,we<A&&(ge+=r)}v=ne,g=f,y=a;for(var Be=0;Be<i;Be++){var Ee=v<<2;s[Ee+3]=ae=de*I>>w,ae>0?(ae=255/ae,s[Ee]=(ce*I>>w)*ae,s[Ee+1]=(he*I>>w)*ae,s[Ee+2]=(fe*I>>w)*ae):s[Ee]=s[Ee+1]=s[Ee+2]=0,ce-=se,he-=le,fe-=ue,de-=Ae,se-=g.r,le-=g.g,ue-=g.b,Ae-=g.a,Ee=ne+((Ee=Be+c)<A?Ee:A)*r<<2,ce+=Ie+=g.r=s[Ee],he+=ye+=g.g=s[Ee+1],fe+=me+=g.b=s[Ee+2],de+=ve+=g.a=s[Ee+3],g=g.next,se+=re=y.r,le+=ie=y.g,ue+=oe=y.b,Ae+=ae=y.a,Ie-=re,ye-=ie,me-=oe,ve-=ae,y=y.next,v+=r}}return e}(a,0,0,r,i,o),e.getContext("2d").putImageData(a,t,n)}}var wQe=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};var bQe=Object.freeze({__proto__:null,offscreen:function(){var{DOMParser:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,createCanvas:(e,t)=>new OffscreenCanvas(e,t),createImage:e=>Qwe((function*(){var t=yield fetch(e),n=yield t.blob();return yield createImageBitmap(n)}))()};return"undefined"==typeof DOMParser&&void 0!==e||Reflect.deleteProperty(t,"DOMParser"),t},node:function(e){var{DOMParser:t,canvas:n,fetch:r}=e;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:t,fetch:r,createCanvas:n.createCanvas,createImage:n.loadImage}}});function BQe(e){return e.replace(/(?!\u3000)\s+/gm," ")}function EQe(e){return e.replace(/^[\n \t]+/,"")}function CQe(e){return e.replace(/[\n \t]+$/,"")}function SQe(e){return((e||"").match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm)||[]).map(parseFloat)}var xQe=/^[A-Z-]+$/;function QQe(e){return xQe.test(e)?e.toLowerCase():e}function kQe(e){var t=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(e)||[];return t[2]||t[3]||t[4]}function _Qe(e){if(!e.startsWith("rgb"))return e;var t=3;return e.replace(/\d+(\.\d+)?/g,((e,n)=>t--&&n?String(Math.round(parseFloat(e))):e))}var NQe=/(\[[^\]]+\])/g,DQe=/(#[^\s+>~.[:]+)/g,FQe=/(\.[^\s+>~.[:]+)/g,PQe=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,UQe=/(:[\w-]+\([^)]*\))/gi,MQe=/(:[^\s+>~.[:]+)/g,LQe=/([^\s+>~.[:]+)/g;function TQe(e,t){var n=t.exec(e);return n?[e.replace(t," "),n.length]:[e,0]}function RQe(e){var t=[0,0,0],n=e.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),r=0;return[n,r]=TQe(n,NQe),t[1]+=r,[n,r]=TQe(n,DQe),t[0]+=r,[n,r]=TQe(n,FQe),t[1]+=r,[n,r]=TQe(n,PQe),t[2]+=r,[n,r]=TQe(n,UQe),t[1]+=r,[n,r]=TQe(n,MQe),t[1]+=r,n=n.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[n,r]=TQe(n,LQe),t[2]+=r,t.join("")}var OQe=1e-8;function HQe(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2))}function KQe(e,t){return(e[0]*t[0]+e[1]*t[1])/(HQe(e)*HQe(t))}function jQe(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(KQe(e,t))}function GQe(e){return e*e*e}function qQe(e){return 3*e*e*(1-e)}function VQe(e){return 3*e*(1-e)*(1-e)}function zQe(e){return(1-e)*(1-e)*(1-e)}function JQe(e){return e*e}function YQe(e){return 2*e*(1-e)}function XQe(e){return(1-e)*(1-e)}class WQe{constructor(e,t,n){this.document=e,this.name=t,this.value=n,this.isNormalizedColor=!1}static empty(e){return new WQe(e,"EMPTY","")}split(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:" ",{document:t,name:n}=this;return BQe(this.getString()).trim().split(e).map((e=>new WQe(t,n,e)))}hasValue(e){var{value:t}=this;return null!==t&&""!==t&&(e||0!==t)&&void 0!==t}isString(e){var{value:t}=this,n="string"==typeof t;return n&&e?e.test(t):n}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;var e=this.getString();switch(!0){case e.endsWith("px"):case/^[0-9]+$/.test(e):return!0;default:return!1}}setValue(e){return this.value=e,this}getValue(e){return void 0===e||this.hasValue()?this.value:e}getNumber(e){if(!this.hasValue())return void 0===e?0:parseFloat(e);var{value:t}=this,n=parseFloat(t);return this.isString(/%$/)&&(n/=100),n}getString(e){return void 0===e||this.hasValue()?void 0===this.value?"":String(this.value):String(e)}getColor(e){var t=this.getString(e);return this.isNormalizedColor||(this.isNormalizedColor=!0,t=_Qe(t),this.value=t),t}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;var[n,r]="boolean"==typeof e?[void 0,e]:[e],{viewPort:i}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(i.computeSize("x"),i.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(i.computeSize("x"),i.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*i.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*i.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return 15*this.getNumber();case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case this.isString(/%$/)&&r:return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*i.computeSize(n);default:var o=this.getNumber();return t&&o<1?o*i.computeSize(n):o}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():1e3*this.getNumber():0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){var e=this.getString(),t=/#([^)'"]+)/.exec(e);return t&&(t=t[1]),t||(t=e),this.document.definitions[t]}getFillStyleDefinition(e,t){var n=this.getDefinition();if(!n)return null;if("function"==typeof n.createGradient)return n.createGradient(this.document.ctx,e,t);if("function"==typeof n.createPattern){if(n.getHrefAttribute().hasValue()){var r=n.getAttribute("patternTransform");n=n.getHrefAttribute().getDefinition(),r.hasValue()&&n.getAttribute("patternTransform",!0).setValue(r.value)}return n.createPattern(this.document.ctx,e,t)}return null}getTextBaseline(){return this.hasValue()?WQe.textBaselineMapping[this.getString()]:null}addOpacity(e){for(var t=this.getColor(),n=t.length,r=0,i=0;i<n&&(","===t[i]&&r++,3!==r);i++);if(e.hasValue()&&this.isString()&&3!==r){var o=new mxe(t);o.ok&&(o.alpha=e.getNumber(),t=o.toRGBA())}return new WQe(this.document,this.name,t)}}WQe.textBaselineMapping={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};class ZQe{constructor(){this.viewPorts=[]}clear(){this.viewPorts=[]}setCurrent(e,t){this.viewPorts.push({width:e,height:t})}removeCurrent(){this.viewPorts.pop()}getCurrent(){var{viewPorts:e}=this;return e[e.length-1]}get width(){return this.getCurrent().width}get height(){return this.getCurrent().height}computeSize(e){return"number"==typeof e?e:"x"===e?this.width:"y"===e?this.height:Math.sqrt(Math.pow(this.width,2)+Math.pow(this.height,2))/Math.sqrt(2)}}class $Qe{constructor(e,t){this.x=e,this.y=t}static parse(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,[n=t,r=t]=SQe(e);return new $Qe(n,r)}static parseScale(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,[n=t,r=n]=SQe(e);return new $Qe(n,r)}static parsePath(e){for(var t=SQe(e),n=t.length,r=[],i=0;i<n;i+=2)r.push(new $Qe(t[i],t[i+1]));return r}angleTo(e){return Math.atan2(e.y-this.y,e.x-this.x)}applyTransform(e){var{x:t,y:n}=this,r=t*e[0]+n*e[2]+e[4],i=t*e[1]+n*e[3]+e[5];this.x=r,this.y=i}}class eke{constructor(e){this.screen=e,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}isWorking(){return this.working}start(){if(!this.working){var{screen:e,onClick:t,onMouseMove:n}=this,r=e.ctx.canvas;r.onclick=t,r.onmousemove=n,this.working=!0}}stop(){if(this.working){var e=this.screen.ctx.canvas;this.working=!1,e.onclick=null,e.onmousemove=null}}hasEvents(){return this.working&&this.events.length>0}runEvents(){if(this.working){var{screen:e,events:t,eventElements:n}=this,{style:r}=e.ctx.canvas;r&&(r.cursor=""),t.forEach(((e,t)=>{for(var{run:r}=e,i=n[t];i;)r(i),i=i.parent})),this.events=[],this.eventElements=[]}}checkPath(e,t){if(this.working&&t){var{events:n,eventElements:r}=this;n.forEach(((n,i)=>{var{x:o,y:a}=n;!r[i]&&t.isPointInPath&&t.isPointInPath(o,a)&&(r[i]=e)}))}}checkBoundingBox(e,t){if(this.working&&t){var{events:n,eventElements:r}=this;n.forEach(((n,i)=>{var{x:o,y:a}=n;!r[i]&&t.isPointInBox(o,a)&&(r[i]=e)}))}}mapXY(e,t){for(var{window:n,ctx:r}=this.screen,i=new $Qe(e,t),o=r.canvas;o;)i.x-=o.offsetLeft,i.y-=o.offsetTop,o=o.offsetParent;return n.scrollX&&(i.x+=n.scrollX),n.scrollY&&(i.y+=n.scrollY),i}onClick(e){var{x:t,y:n}=this.mapXY(e.clientX,e.clientY);this.events.push({type:"onclick",x:t,y:n,run(e){e.onClick&&e.onClick()}})}onMouseMove(e){var{x:t,y:n}=this.mapXY(e.clientX,e.clientY);this.events.push({type:"onmousemove",x:t,y:n,run(e){e.onMouseMove&&e.onMouseMove()}})}}var tke="undefined"!=typeof window?window:null,nke="undefined"!=typeof fetch?fetch.bind(void 0):null;class rke{constructor(e){var{fetch:t=nke,window:n=tke}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.ctx=e,this.FRAMERATE=30,this.MAX_VIRTUAL_PIXELS=3e4,this.CLIENT_WIDTH=800,this.CLIENT_HEIGHT=600,this.viewPort=new ZQe,this.mouse=new eke(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=n,this.fetch=t}wait(e){this.waits.push(e)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;var e=this.waits.every((e=>e()));return e&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=e,e}setDefaults(e){e.strokeStyle="rgba(0,0,0,0)",e.lineCap="butt",e.lineJoin="miter",e.miterLimit=4}setViewBox(e){var{document:t,ctx:n,aspectRatio:r,width:i,desiredWidth:o,height:a,desiredHeight:s,minX:l=0,minY:u=0,refX:A,refY:c,clip:h=!1,clipX:f=0,clipY:d=0}=e,p=BQe(r).replace(/^defer\s/,""),[g,y]=p.split(" "),m=g||"xMidYMid",v=y||"meet",I=i/o,w=a/s,b=Math.min(I,w),B=Math.max(I,w),E=o,C=s;"meet"===v&&(E*=b,C*=b),"slice"===v&&(E*=B,C*=B);var S=new WQe(t,"refX",A),x=new WQe(t,"refY",c),Q=S.hasValue()&&x.hasValue();if(Q&&n.translate(-b*S.getPixels("x"),-b*x.getPixels("y")),h){var k=b*f,_=b*d;n.beginPath(),n.moveTo(k,_),n.lineTo(i,_),n.lineTo(i,a),n.lineTo(k,a),n.closePath(),n.clip()}if(!Q){var N="meet"===v&&b===w,D="slice"===v&&B===w,F="meet"===v&&b===I,P="slice"===v&&B===I;m.startsWith("xMid")&&(N||D)&&n.translate(i/2-E/2,0),m.endsWith("YMid")&&(F||P)&&n.translate(0,a/2-C/2),m.startsWith("xMax")&&(N||D)&&n.translate(i-E,0),m.endsWith("YMax")&&(F||P)&&n.translate(0,a-C)}switch(!0){case"none"===m:n.scale(I,w);break;case"meet"===v:n.scale(b,b);break;case"slice"===v:n.scale(B,B)}n.translate(-l,-u)}start(e){var{enableRedraw:t=!1,ignoreMouse:n=!1,ignoreAnimation:r=!1,ignoreDimensions:i=!1,ignoreClear:o=!1,forceRedraw:a,scaleWidth:s,scaleHeight:l,offsetX:u,offsetY:A}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{FRAMERATE:c,mouse:h}=this,f=1e3/c;if(this.frameDuration=f,this.readyPromise=new Promise((e=>{this.resolveReady=e})),this.isReady()&&this.render(e,i,o,s,l,u,A),t){var d=Date.now(),p=d,g=0,y=()=>{d=Date.now(),(g=d-p)>=f&&(p=d-g%f,this.shouldUpdate(r,a)&&(this.render(e,i,o,s,l,u,A),h.runEvents())),this.intervalId=zSe.exports(y)};n||h.start(),this.intervalId=zSe.exports(y)}}stop(){this.intervalId&&(zSe.exports.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(e,t){if(!e){var{frameDuration:n}=this;if(this.animations.reduce(((e,t)=>t.update(n)||e),!1))return!0}return!("function"!=typeof t||!t())||(!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents())}render(e,t,n,r,i,o,a){var{CLIENT_WIDTH:s,CLIENT_HEIGHT:l,viewPort:u,ctx:A,isFirstRender:c}=this,h=A.canvas;u.clear(),h.width&&h.height?u.setCurrent(h.width,h.height):u.setCurrent(s,l);var f=e.getStyle("width"),d=e.getStyle("height");!t&&(c||"number"!=typeof r&&"number"!=typeof i)&&(f.hasValue()&&(h.width=f.getPixels("x"),h.style&&(h.style.width="".concat(h.width,"px"))),d.hasValue()&&(h.height=d.getPixels("y"),h.style&&(h.style.height="".concat(h.height,"px"))));var p=h.clientWidth||h.width,g=h.clientHeight||h.height;if(t&&f.hasValue()&&d.hasValue()&&(p=f.getPixels("x"),g=d.getPixels("y")),u.setCurrent(p,g),"number"==typeof o&&e.getAttribute("x",!0).setValue(o),"number"==typeof a&&e.getAttribute("y",!0).setValue(a),"number"==typeof r||"number"==typeof i){var y=SQe(e.getAttribute("viewBox").getString()),m=0,v=0;if("number"==typeof r){var I=e.getStyle("width");I.hasValue()?m=I.getPixels("x")/r:isNaN(y[2])||(m=y[2]/r)}if("number"==typeof i){var w=e.getStyle("height");w.hasValue()?v=w.getPixels("y")/i:isNaN(y[3])||(v=y[3]/i)}m||(m=v),v||(v=m),e.getAttribute("width",!0).setValue(r),e.getAttribute("height",!0).setValue(i);var b=e.getStyle("transform",!0,!0);b.setValue("".concat(b.getString()," scale(").concat(1/m,", ").concat(1/v,")"))}n||A.clearRect(0,0,p,g),e.render(A),c&&(this.isFirstRender=!1)}}rke.defaultWindow=tke,rke.defaultFetch=nke;var{defaultFetch:ike}=rke,oke="undefined"!=typeof DOMParser?DOMParser:null;class ake{constructor(){var{fetch:e=ike,DOMParser:t=oke}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fetch=e,this.DOMParser=t}parse(e){var t=this;return Qwe((function*(){return e.startsWith("<")?t.parseFromString(e):t.load(e)}))()}parseFromString(e){var t=new this.DOMParser;try{return this.checkDocument(t.parseFromString(e,"image/svg+xml"))}catch(n){return this.checkDocument(t.parseFromString(e,"text/xml"))}}checkDocument(e){var t=e.getElementsByTagName("parsererror")[0];if(t)throw new Error(t.textContent);return e}load(e){var t=this;return Qwe((function*(){var n=yield t.fetch(e),r=yield n.text();return t.parseFromString(r)}))()}}class ske{constructor(e,t){this.type="translate",this.point=null,this.point=$Qe.parse(t)}apply(e){var{x:t,y:n}=this.point;e.translate(t||0,n||0)}unapply(e){var{x:t,y:n}=this.point;e.translate(-1*t||0,-1*n||0)}applyToPoint(e){var{x:t,y:n}=this.point;e.applyTransform([1,0,0,1,t||0,n||0])}}class lke{constructor(e,t,n){this.type="rotate",this.angle=null,this.originX=null,this.originY=null,this.cx=0,this.cy=0;var r=SQe(t);this.angle=new WQe(e,"angle",r[0]),this.originX=n[0],this.originY=n[1],this.cx=r[1]||0,this.cy=r[2]||0}apply(e){var{cx:t,cy:n,originX:r,originY:i,angle:o}=this,a=t+r.getPixels("x"),s=n+i.getPixels("y");e.translate(a,s),e.rotate(o.getRadians()),e.translate(-a,-s)}unapply(e){var{cx:t,cy:n,originX:r,originY:i,angle:o}=this,a=t+r.getPixels("x"),s=n+i.getPixels("y");e.translate(a,s),e.rotate(-1*o.getRadians()),e.translate(-a,-s)}applyToPoint(e){var{cx:t,cy:n,angle:r}=this,i=r.getRadians();e.applyTransform([1,0,0,1,t||0,n||0]),e.applyTransform([Math.cos(i),Math.sin(i),-Math.sin(i),Math.cos(i),0,0]),e.applyTransform([1,0,0,1,-t||0,-n||0])}}class uke{constructor(e,t,n){this.type="scale",this.scale=null,this.originX=null,this.originY=null;var r=$Qe.parseScale(t);0!==r.x&&0!==r.y||(r.x=OQe,r.y=OQe),this.scale=r,this.originX=n[0],this.originY=n[1]}apply(e){var{scale:{x:t,y:n},originX:r,originY:i}=this,o=r.getPixels("x"),a=i.getPixels("y");e.translate(o,a),e.scale(t,n||t),e.translate(-o,-a)}unapply(e){var{scale:{x:t,y:n},originX:r,originY:i}=this,o=r.getPixels("x"),a=i.getPixels("y");e.translate(o,a),e.scale(1/t,1/n||t),e.translate(-o,-a)}applyToPoint(e){var{x:t,y:n}=this.scale;e.applyTransform([t||0,0,0,n||0,0,0])}}class Ake{constructor(e,t,n){this.type="matrix",this.matrix=[],this.originX=null,this.originY=null,this.matrix=SQe(t),this.originX=n[0],this.originY=n[1]}apply(e){var{originX:t,originY:n,matrix:r}=this,i=t.getPixels("x"),o=n.getPixels("y");e.translate(i,o),e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),e.translate(-i,-o)}unapply(e){var{originX:t,originY:n,matrix:r}=this,i=r[0],o=r[2],a=r[4],s=r[1],l=r[3],u=r[5],A=1/(i*(1*l-0*u)-o*(1*s-0*u)+a*(0*s-0*l)),c=t.getPixels("x"),h=n.getPixels("y");e.translate(c,h),e.transform(A*(1*l-0*u),A*(0*u-1*s),A*(0*a-1*o),A*(1*i-0*a),A*(o*u-a*l),A*(a*s-i*u)),e.translate(-c,-h)}applyToPoint(e){e.applyTransform(this.matrix)}}class cke extends Ake{constructor(e,t,n){super(e,t,n),this.type="skew",this.angle=null,this.angle=new WQe(e,"angle",t)}}class hke extends cke{constructor(e,t,n){super(e,t,n),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class fke extends cke{constructor(e,t,n){super(e,t,n),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}class dke{constructor(e,t,n){this.document=e,this.transforms=[];var r=function(e){return BQe(e).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}(t);r.forEach((e=>{if("none"!==e){var[t,r]=function(e){var[t,n]=e.split("(");return[t.trim(),n.trim().replace(")","")]}(e),i=dke.transformTypes[t];void 0!==i&&this.transforms.push(new i(this.document,r,n))}}))}static fromElement(e,t){var n=t.getStyle("transform",!1,!0),[r,i=r]=t.getStyle("transform-origin",!1,!0).split(),o=[r,i];return n.hasValue()?new dke(e,n.getString(),o):null}apply(e){for(var{transforms:t}=this,n=t.length,r=0;r<n;r++)t[r].apply(e)}unapply(e){for(var{transforms:t}=this,n=t.length-1;n>=0;n--)t[n].unapply(e)}applyToPoint(e){for(var{transforms:t}=this,n=t.length,r=0;r<n;r++)t[r].applyToPoint(e)}}dke.transformTypes={translate:ske,rotate:lke,scale:uke,matrix:Ake,skewX:hke,skewY:fke};class pke{constructor(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.document=e,this.node=t,this.captureTextNodes=n,this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],t&&1===t.nodeType){if(Array.from(t.attributes).forEach((t=>{var n=QQe(t.nodeName);this.attributes[n]=new WQe(e,n,t.value)})),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()){var r=this.getAttribute("style").getString().split(";").map((e=>e.trim()));r.forEach((t=>{if(t){var[n,r]=t.split(":").map((e=>e.trim()));this.styles[n]=new WQe(e,n,r)}}))}var{definitions:i}=e,o=this.getAttribute("id");o.hasValue()&&(i[o.getString()]||(i[o.getString()]=this)),Array.from(t.childNodes).forEach((t=>{if(1===t.nodeType)this.addChild(t);else if(n&&(3===t.nodeType||4===t.nodeType)){var r=e.createTextNode(t);r.getText().length>0&&this.addChild(r)}}))}}getAttribute(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.attributes[e];if(!n&&t){var r=new WQe(this.document,e,"");return this.attributes[e]=r,r}return n||WQe.empty(this.document)}getHrefAttribute(){for(var e in this.attributes)if("href"===e||e.endsWith(":href"))return this.attributes[e];return WQe.empty(this.document)}getStyle(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.styles[e];if(r)return r;var i=this.getAttribute(e);if(null!=i&&i.hasValue())return this.styles[e]=i,i;if(!n){var{parent:o}=this;if(o){var a=o.getStyle(e);if(null!=a&&a.hasValue())return a}}if(t){var s=new WQe(this.document,e,"");return this.styles[e]=s,s}return r||WQe.empty(this.document)}render(e){if("none"!==this.getStyle("display").getString()&&"hidden"!==this.getStyle("visibility").getString()){if(e.save(),this.getStyle("mask").hasValue()){var t=this.getStyle("mask").getDefinition();t&&(this.applyEffects(e),t.apply(e,this))}else if("none"!==this.getStyle("filter").getValue("none")){var n=this.getStyle("filter").getDefinition();n&&(this.applyEffects(e),n.apply(e,this))}else this.setContext(e),this.renderChildren(e),this.clearContext(e);e.restore()}}setContext(e){}applyEffects(e){var t=dke.fromElement(this.document,this);t&&t.apply(e);var n=this.getStyle("clip-path",!1,!0);if(n.hasValue()){var r=n.getDefinition();r&&r.apply(e)}}clearContext(e){}renderChildren(e){this.children.forEach((t=>{t.render(e)}))}addChild(e){var t=e instanceof pke?e:this.document.createElement(e);t.parent=this,pke.ignoreChildTypes.includes(t.type)||this.children.push(t)}matchesSelector(e){var t,{node:n}=this;if("function"==typeof n.matches)return n.matches(e);var r=null===(t=n.getAttribute)||void 0===t?void 0:t.call(n,"class");return!(!r||""===r)&&r.split(" ").some((t=>".".concat(t)===e))}addStylesFromStyleDefinition(){var{styles:e,stylesSpecificity:t}=this.document;for(var n in e)if(!n.startsWith("@")&&this.matchesSelector(n)){var r=e[n],i=t[n];if(r)for(var o in r){var a=this.stylesSpecificity[o];void 0===a&&(a="000"),i>=a&&(this.styles[o]=r[o],this.stylesSpecificity[o]=i)}}}removeStyles(e,t){return t.reduce(((t,n)=>{var r=e.getStyle(n);if(!r.hasValue())return t;var i=r.getString();return r.setValue(""),[...t,[n,i]]}),[])}restoreStyles(e,t){t.forEach((t=>{var[n,r]=t;e.getStyle(n,!0).setValue(r)}))}isFirstChild(){var e;return 0===(null===(e=this.parent)||void 0===e?void 0:e.children.indexOf(this))}}pke.ignoreChildTypes=["title"];class gke extends pke{constructor(e,t,n){super(e,t,n)}}function yke(e){var t=e.trim();return/^('|")/.test(t)?t:'"'.concat(t,'"')}function mke(e){if(!e)return"";var t=e.trim().toLowerCase();switch(t){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return t;default:return/^oblique\s+(-|)\d+deg$/.test(t)?t:""}}function vke(e){if(!e)return"";var t=e.trim().toLowerCase();switch(t){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return t;default:return/^[\d.]+$/.test(t)?t:""}}class Ike{constructor(e,t,n,r,i,o){var a=o?"string"==typeof o?Ike.parse(o):o:{};this.fontFamily=i||a.fontFamily,this.fontSize=r||a.fontSize,this.fontStyle=e||a.fontStyle,this.fontWeight=n||a.fontWeight,this.fontVariant=t||a.fontVariant}static parse(){var e=arguments.length>1?arguments[1]:void 0,t="",n="",r="",i="",o="",a=BQe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").trim().split(" "),s={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return a.forEach((e=>{switch(!0){case!s.fontStyle&&Ike.styles.includes(e):"inherit"!==e&&(t=e),s.fontStyle=!0;break;case!s.fontVariant&&Ike.variants.includes(e):"inherit"!==e&&(n=e),s.fontStyle=!0,s.fontVariant=!0;break;case!s.fontWeight&&Ike.weights.includes(e):"inherit"!==e&&(r=e),s.fontStyle=!0,s.fontVariant=!0,s.fontWeight=!0;break;case!s.fontSize:"inherit"!==e&&([i]=e.split("/")),s.fontStyle=!0,s.fontVariant=!0,s.fontWeight=!0,s.fontSize=!0;break;default:"inherit"!==e&&(o+=e)}})),new Ike(t,n,r,i,o,e)}toString(){return[mke(this.fontStyle),this.fontVariant,vke(this.fontWeight),this.fontSize,(e=this.fontFamily,"undefined"==typeof process?e:e.trim().split(",").map(yke).join(","))].join(" ").trim();var e}}Ike.styles="normal|italic|oblique|inherit",Ike.variants="normal|small-caps|inherit",Ike.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class wke{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.NaN,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.NaN,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.NaN,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.NaN;this.x1=e,this.y1=t,this.x2=n,this.y2=r,this.addPoint(e,t),this.addPoint(n,r)}get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(e,t){void 0!==e&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),void 0!==t&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))}addX(e){this.addPoint(e,null)}addY(e){this.addPoint(null,e)}addBoundingBox(e){if(e){var{x1:t,y1:n,x2:r,y2:i}=e;this.addPoint(t,n),this.addPoint(r,i)}}sumCubic(e,t,n,r,i){return Math.pow(1-e,3)*t+3*Math.pow(1-e,2)*e*n+3*(1-e)*Math.pow(e,2)*r+Math.pow(e,3)*i}bezierCurveAdd(e,t,n,r,i){var o=6*t-12*n+6*r,a=-3*t+9*n-9*r+3*i,s=3*n-3*t;if(0!==a){var l=Math.pow(o,2)-4*s*a;if(!(l<0)){var u=(-o+Math.sqrt(l))/(2*a);0<u&&u<1&&(e?this.addX(this.sumCubic(u,t,n,r,i)):this.addY(this.sumCubic(u,t,n,r,i)));var A=(-o-Math.sqrt(l))/(2*a);0<A&&A<1&&(e?this.addX(this.sumCubic(A,t,n,r,i)):this.addY(this.sumCubic(A,t,n,r,i)))}}else{if(0===o)return;var c=-s/o;0<c&&c<1&&(e?this.addX(this.sumCubic(c,t,n,r,i)):this.addY(this.sumCubic(c,t,n,r,i)))}}addBezierCurve(e,t,n,r,i,o,a,s){this.addPoint(e,t),this.addPoint(a,s),this.bezierCurveAdd(!0,e,n,i,a),this.bezierCurveAdd(!1,t,r,o,s)}addQuadraticCurve(e,t,n,r,i,o){var a=e+2/3*(n-e),s=t+2/3*(r-t),l=a+1/3*(i-e),u=s+1/3*(o-t);this.addBezierCurve(e,t,a,l,s,u,i,o)}isPointInBox(e,t){var{x1:n,y1:r,x2:i,y2:o}=this;return n<=e&&e<=i&&r<=t&&t<=o}}class bke extends eQe{constructor(e){super(e.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,"")),this.control=null,this.start=null,this.current=null,this.command=null,this.commands=this.commands,this.i=-1,this.previousCommand=null,this.points=[],this.angles=[]}reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new $Qe(0,0),this.control=new $Qe(0,0),this.current=new $Qe(0,0),this.points=[],this.angles=[]}isEnd(){var{i:e,commands:t}=this;return e>=t.length-1}next(){var e=this.commands[++this.i];return this.previousCommand=this.command,this.command=e,e}getPoint(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"x",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y",n=new $Qe(this.command[e],this.command[t]);return this.makeAbsolute(n)}getAsControlPoint(e,t){var n=this.getPoint(e,t);return this.control=n,n}getAsCurrentPoint(e,t){var n=this.getPoint(e,t);return this.current=n,n}getReflectedControlPoint(){var e=this.previousCommand.type;if(e!==eQe.CURVE_TO&&e!==eQe.SMOOTH_CURVE_TO&&e!==eQe.QUAD_TO&&e!==eQe.SMOOTH_QUAD_TO)return this.current;var{current:{x:t,y:n},control:{x:r,y:i}}=this;return new $Qe(2*t-r,2*n-i)}makeAbsolute(e){if(this.command.relative){var{x:t,y:n}=this.current;e.x+=t,e.y+=n}return e}addMarker(e,t,n){var{points:r,angles:i}=this;n&&i.length>0&&!i[i.length-1]&&(i[i.length-1]=r[r.length-1].angleTo(n)),this.addMarkerAngle(e,t?t.angleTo(e):null)}addMarkerAngle(e,t){this.points.push(e),this.angles.push(t)}getMarkerPoints(){return this.points}getMarkerAngles(){for(var{angles:e}=this,t=e.length,n=0;n<t;n++)if(!e[n])for(var r=n+1;r<t;r++)if(e[r]){e[n]=e[r];break}return e}}class Bke extends pke{constructor(){super(...arguments),this.modifiedEmSizeStack=!1}calculateOpacity(){for(var e=1,t=this;t;){var n=t.getStyle("opacity",!1,!0);n.hasValue(!0)&&(e*=n.getNumber()),t=t.parent}return e}setContext(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t){var n=this.getStyle("fill"),r=this.getStyle("fill-opacity"),i=this.getStyle("stroke"),o=this.getStyle("stroke-opacity");if(n.isUrlDefinition()){var a=n.getFillStyleDefinition(this,r);a&&(e.fillStyle=a)}else if(n.hasValue()){"currentColor"===n.getString()&&n.setValue(this.getStyle("color").getColor());var s=n.getColor();"inherit"!==s&&(e.fillStyle="none"===s?"rgba(0,0,0,0)":s)}if(r.hasValue()){var l=new WQe(this.document,"fill",e.fillStyle).addOpacity(r).getColor();e.fillStyle=l}if(i.isUrlDefinition()){var u=i.getFillStyleDefinition(this,o);u&&(e.strokeStyle=u)}else if(i.hasValue()){"currentColor"===i.getString()&&i.setValue(this.getStyle("color").getColor());var A=i.getString();"inherit"!==A&&(e.strokeStyle="none"===A?"rgba(0,0,0,0)":A)}if(o.hasValue()){var c=new WQe(this.document,"stroke",e.strokeStyle).addOpacity(o).getString();e.strokeStyle=c}var h=this.getStyle("stroke-width");if(h.hasValue()){var f=h.getPixels();e.lineWidth=f||OQe}var d=this.getStyle("stroke-linecap"),p=this.getStyle("stroke-linejoin"),g=this.getStyle("stroke-miterlimit"),y=this.getStyle("stroke-dasharray"),m=this.getStyle("stroke-dashoffset");if(d.hasValue()&&(e.lineCap=d.getString()),p.hasValue()&&(e.lineJoin=p.getString()),g.hasValue()&&(e.miterLimit=g.getNumber()),y.hasValue()&&"none"!==y.getString()){var v=SQe(y.getString());void 0!==e.setLineDash?e.setLineDash(v):void 0!==e.webkitLineDash?e.webkitLineDash=v:void 0===e.mozDash||1===v.length&&0===v[0]||(e.mozDash=v);var I=m.getPixels();void 0!==e.lineDashOffset?e.lineDashOffset=I:void 0!==e.webkitLineDashOffset?e.webkitLineDashOffset=I:void 0!==e.mozDashOffset&&(e.mozDashOffset=I)}}if(this.modifiedEmSizeStack=!1,void 0!==e.font){var w=this.getStyle("font"),b=this.getStyle("font-style"),B=this.getStyle("font-variant"),E=this.getStyle("font-weight"),C=this.getStyle("font-size"),S=this.getStyle("font-family"),x=new Ike(b.getString(),B.getString(),E.getString(),C.hasValue()?"".concat(C.getPixels(!0),"px"):"",S.getString(),Ike.parse(w.getString(),e.font));b.setValue(x.fontStyle),B.setValue(x.fontVariant),E.setValue(x.fontWeight),C.setValue(x.fontSize),S.setValue(x.fontFamily),e.font=x.toString(),C.isPixels()&&(this.document.emSize=C.getPixels(),this.modifiedEmSizeStack=!0)}t||(this.applyEffects(e),e.globalAlpha=this.calculateOpacity())}clearContext(e){super.clearContext(e),this.modifiedEmSizeStack&&this.document.popEmSize()}}class Eke extends Bke{constructor(e,t,n){super(e,t,n),this.type="path",this.pathParser=null,this.pathParser=new bke(this.getAttribute("d").getString())}path(e){var{pathParser:t}=this,n=new wke;for(t.reset(),e&&e.beginPath();!t.isEnd();)switch(t.next().type){case bke.MOVE_TO:this.pathM(e,n);break;case bke.LINE_TO:this.pathL(e,n);break;case bke.HORIZ_LINE_TO:this.pathH(e,n);break;case bke.VERT_LINE_TO:this.pathV(e,n);break;case bke.CURVE_TO:this.pathC(e,n);break;case bke.SMOOTH_CURVE_TO:this.pathS(e,n);break;case bke.QUAD_TO:this.pathQ(e,n);break;case bke.SMOOTH_QUAD_TO:this.pathT(e,n);break;case bke.ARC:this.pathA(e,n);break;case bke.CLOSE_PATH:this.pathZ(e,n)}return n}getBoundingBox(e){return this.path()}getMarkers(){var{pathParser:e}=this,t=e.getMarkerPoints(),n=e.getMarkerAngles(),r=t.map(((e,t)=>[e,n[t]]));return r}renderChildren(e){this.path(e),this.document.screen.mouse.checkPath(this,e);var t=this.getStyle("fill-rule");""!==e.fillStyle&&("inherit"!==t.getString("inherit")?e.fill(t.getString()):e.fill()),""!==e.strokeStyle&&("non-scaling-stroke"===this.getAttribute("vector-effect").getString()?(e.save(),e.setTransform(1,0,0,1,0,0),e.stroke(),e.restore()):e.stroke());var n=this.getMarkers();if(n){var r=n.length-1,i=this.getStyle("marker-start"),o=this.getStyle("marker-mid"),a=this.getStyle("marker-end");if(i.isUrlDefinition()){var s=i.getDefinition(),[l,u]=n[0];s.render(e,l,u)}if(o.isUrlDefinition())for(var A=o.getDefinition(),c=1;c<r;c++){var[h,f]=n[c];A.render(e,h,f)}if(a.isUrlDefinition()){var d=a.getDefinition(),[p,g]=n[r];d.render(e,p,g)}}}static pathM(e){var t=e.getAsCurrentPoint();return e.start=e.current,{point:t}}pathM(e,t){var{pathParser:n}=this,{point:r}=Eke.pathM(n),{x:i,y:o}=r;n.addMarker(r),t.addPoint(i,o),e&&e.moveTo(i,o)}static pathL(e){var{current:t}=e;return{current:t,point:e.getAsCurrentPoint()}}pathL(e,t){var{pathParser:n}=this,{current:r,point:i}=Eke.pathL(n),{x:o,y:a}=i;n.addMarker(i,r),t.addPoint(o,a),e&&e.lineTo(o,a)}static pathH(e){var{current:t,command:n}=e,r=new $Qe((n.relative?t.x:0)+n.x,t.y);return e.current=r,{current:t,point:r}}pathH(e,t){var{pathParser:n}=this,{current:r,point:i}=Eke.pathH(n),{x:o,y:a}=i;n.addMarker(i,r),t.addPoint(o,a),e&&e.lineTo(o,a)}static pathV(e){var{current:t,command:n}=e,r=new $Qe(t.x,(n.relative?t.y:0)+n.y);return e.current=r,{current:t,point:r}}pathV(e,t){var{pathParser:n}=this,{current:r,point:i}=Eke.pathV(n),{x:o,y:a}=i;n.addMarker(i,r),t.addPoint(o,a),e&&e.lineTo(o,a)}static pathC(e){var{current:t}=e;return{current:t,point:e.getPoint("x1","y1"),controlPoint:e.getAsControlPoint("x2","y2"),currentPoint:e.getAsCurrentPoint()}}pathC(e,t){var{pathParser:n}=this,{current:r,point:i,controlPoint:o,currentPoint:a}=Eke.pathC(n);n.addMarker(a,o,i),t.addBezierCurve(r.x,r.y,i.x,i.y,o.x,o.y,a.x,a.y),e&&e.bezierCurveTo(i.x,i.y,o.x,o.y,a.x,a.y)}static pathS(e){var{current:t}=e;return{current:t,point:e.getReflectedControlPoint(),controlPoint:e.getAsControlPoint("x2","y2"),currentPoint:e.getAsCurrentPoint()}}pathS(e,t){var{pathParser:n}=this,{current:r,point:i,controlPoint:o,currentPoint:a}=Eke.pathS(n);n.addMarker(a,o,i),t.addBezierCurve(r.x,r.y,i.x,i.y,o.x,o.y,a.x,a.y),e&&e.bezierCurveTo(i.x,i.y,o.x,o.y,a.x,a.y)}static pathQ(e){var{current:t}=e;return{current:t,controlPoint:e.getAsControlPoint("x1","y1"),currentPoint:e.getAsCurrentPoint()}}pathQ(e,t){var{pathParser:n}=this,{current:r,controlPoint:i,currentPoint:o}=Eke.pathQ(n);n.addMarker(o,i,i),t.addQuadraticCurve(r.x,r.y,i.x,i.y,o.x,o.y),e&&e.quadraticCurveTo(i.x,i.y,o.x,o.y)}static pathT(e){var{current:t}=e,n=e.getReflectedControlPoint();return e.control=n,{current:t,controlPoint:n,currentPoint:e.getAsCurrentPoint()}}pathT(e,t){var{pathParser:n}=this,{current:r,controlPoint:i,currentPoint:o}=Eke.pathT(n);n.addMarker(o,i,i),t.addQuadraticCurve(r.x,r.y,i.x,i.y,o.x,o.y),e&&e.quadraticCurveTo(i.x,i.y,o.x,o.y)}static pathA(e){var{current:t,command:n}=e,{rX:r,rY:i,xRot:o,lArcFlag:a,sweepFlag:s}=n,l=o*(Math.PI/180),u=e.getAsCurrentPoint(),A=new $Qe(Math.cos(l)*(t.x-u.x)/2+Math.sin(l)*(t.y-u.y)/2,-Math.sin(l)*(t.x-u.x)/2+Math.cos(l)*(t.y-u.y)/2),c=Math.pow(A.x,2)/Math.pow(r,2)+Math.pow(A.y,2)/Math.pow(i,2);c>1&&(r*=Math.sqrt(c),i*=Math.sqrt(c));var h=(a===s?-1:1)*Math.sqrt((Math.pow(r,2)*Math.pow(i,2)-Math.pow(r,2)*Math.pow(A.y,2)-Math.pow(i,2)*Math.pow(A.x,2))/(Math.pow(r,2)*Math.pow(A.y,2)+Math.pow(i,2)*Math.pow(A.x,2)));isNaN(h)&&(h=0);var f=new $Qe(h*r*A.y/i,h*-i*A.x/r),d=new $Qe((t.x+u.x)/2+Math.cos(l)*f.x-Math.sin(l)*f.y,(t.y+u.y)/2+Math.sin(l)*f.x+Math.cos(l)*f.y),p=jQe([1,0],[(A.x-f.x)/r,(A.y-f.y)/i]),g=[(A.x-f.x)/r,(A.y-f.y)/i],y=[(-A.x-f.x)/r,(-A.y-f.y)/i],m=jQe(g,y);return KQe(g,y)<=-1&&(m=Math.PI),KQe(g,y)>=1&&(m=0),{currentPoint:u,rX:r,rY:i,sweepFlag:s,xAxisRotation:l,centp:d,a1:p,ad:m}}pathA(e,t){var{pathParser:n}=this,{currentPoint:r,rX:i,rY:o,sweepFlag:a,xAxisRotation:s,centp:l,a1:u,ad:A}=Eke.pathA(n),c=1-a?1:-1,h=u+c*(A/2),f=new $Qe(l.x+i*Math.cos(h),l.y+o*Math.sin(h));if(n.addMarkerAngle(f,h-c*Math.PI/2),n.addMarkerAngle(r,h-c*Math.PI),t.addPoint(r.x,r.y),e&&!isNaN(u)&&!isNaN(A)){var d=i>o?i:o,p=i>o?1:i/o,g=i>o?o/i:1;e.translate(l.x,l.y),e.rotate(s),e.scale(p,g),e.arc(0,0,d,u,u+A,Boolean(1-a)),e.scale(1/p,1/g),e.rotate(-s),e.translate(-l.x,-l.y)}}static pathZ(e){e.current=e.start}pathZ(e,t){Eke.pathZ(this.pathParser),e&&t.x1!==t.x2&&t.y1!==t.y2&&e.closePath()}}class Cke extends Eke{constructor(e,t,n){super(e,t,n),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class Ske extends Bke{constructor(e,t,n){super(e,t,new.target===Ske||n),this.type="text",this.x=0,this.y=0,this.measureCache=-1}setContext(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.setContext(e,t);var n=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();n&&(e.textBaseline=n)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(e){if("text"!==this.type)return this.getTElementBoundingBox(e);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(e);var t=null;return this.children.forEach(((n,r)=>{var i=this.getChildBoundingBox(e,this,this,r);t?t.addBoundingBox(i):t=i})),t}getFontSize(){var{document:e,parent:t}=this,n=Ike.parse(e.ctx.font).fontSize;return t.getStyle("font-size").getNumber(n)}getTElementBoundingBox(e){var t=this.getFontSize();return new wke(this.x,this.y-t,this.x+this.measureText(e),this.y)}getGlyph(e,t,n){var r=t[n],i=null;if(e.isArabic){var o=t.length,a=t[n-1],s=t[n+1],l="isolated";if((0===n||" "===a)&&n<o-1&&" "!==s&&(l="terminal"),n>0&&" "!==a&&n<o-1&&" "!==s&&(l="medial"),n>0&&" "!==a&&(n===o-1||" "===s)&&(l="initial"),void 0!==e.glyphs[r]){var u=e.glyphs[r];i=u instanceof Cke?u:u[l]}}else i=e.glyphs[r];return i||(i=e.missingGlyph),i}getText(){return""}getTextFromNode(e){var t=e||this.node,n=Array.from(t.parentNode.childNodes),r=n.indexOf(t),i=n.length-1,o=BQe(t.textContent||"");return 0===r&&(o=EQe(o)),r===i&&(o=CQe(o)),o}renderChildren(e){if("text"===this.type){this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(e),this.children.forEach(((t,n)=>{this.renderChild(e,this,this,n)}));var{mouse:t}=this.document.screen;t.isWorking()&&t.checkBoundingBox(this,this.getBoundingBox(e))}else this.renderTElementChildren(e)}renderTElementChildren(e){var{document:t,parent:n}=this,r=this.getText(),i=n.getStyle("font-family").getDefinition();if(i)for(var{unitsPerEm:o}=i.fontFace,a=Ike.parse(t.ctx.font),s=n.getStyle("font-size").getNumber(a.fontSize),l=n.getStyle("font-style").getString(a.fontStyle),u=s/o,A=i.isRTL?r.split("").reverse().join(""):r,c=SQe(n.getAttribute("dx").getString()),h=A.length,f=0;f<h;f++){var d=this.getGlyph(i,A,f);e.translate(this.x,this.y),e.scale(u,-u);var p=e.lineWidth;e.lineWidth=e.lineWidth*o/s,"italic"===l&&e.transform(1,0,.4,1,0,0),d.render(e),"italic"===l&&e.transform(1,0,-.4,1,0,0),e.lineWidth=p,e.scale(1/u,-1/u),e.translate(-this.x,-this.y),this.x+=s*(d.horizAdvX||i.horizAdvX)/o,void 0===c[f]||isNaN(c[f])||(this.x+=c[f])}else{var{x:g,y:y}=this;e.fillStyle&&e.fillText(r,g,y),e.strokeStyle&&e.strokeText(r,g,y)}}applyAnchoring(){if(!(this.textChunkStart>=this.leafTexts.length)){var e=this.leafTexts[this.textChunkStart],t=e.getStyle("text-anchor").getString("start"),n=0;n="start"===t?e.x-this.minX:"end"===t?e.x-this.maxX:e.x-(this.minX+this.maxX)/2;for(var r=this.textChunkStart;r<this.leafTexts.length;r++)this.leafTexts[r].x+=n;this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.textChunkStart=this.leafTexts.length}}adjustChildCoordinatesRecursive(e){this.children.forEach(((t,n)=>{this.adjustChildCoordinatesRecursiveCore(e,this,this,n)})),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(e,t,n,r){var i=n.children[r];i.children.length>0?i.children.forEach(((n,r)=>{t.adjustChildCoordinatesRecursiveCore(e,t,i,r)})):this.adjustChildCoordinates(e,t,n,r)}adjustChildCoordinates(e,t,n,r){var i=n.children[r];if("function"!=typeof i.measureText)return i;e.save(),i.setContext(e,!0);var o=i.getAttribute("x"),a=i.getAttribute("y"),s=i.getAttribute("dx"),l=i.getAttribute("dy"),u=i.getStyle("font-family").getDefinition(),A=Boolean(u)&&u.isRTL;0===r&&(o.hasValue()||o.setValue(i.getInheritedAttribute("x")),a.hasValue()||a.setValue(i.getInheritedAttribute("y")),s.hasValue()||s.setValue(i.getInheritedAttribute("dx")),l.hasValue()||l.setValue(i.getInheritedAttribute("dy")));var c=i.measureText(e);return A&&(t.x-=c),o.hasValue()?(t.applyAnchoring(),i.x=o.getPixels("x"),s.hasValue()&&(i.x+=s.getPixels("x"))):(s.hasValue()&&(t.x+=s.getPixels("x")),i.x=t.x),t.x=i.x,A||(t.x+=c),a.hasValue()?(i.y=a.getPixels("y"),l.hasValue()&&(i.y+=l.getPixels("y"))):(l.hasValue()&&(t.y+=l.getPixels("y")),i.y=t.y),t.y=i.y,t.leafTexts.push(i),t.minX=Math.min(t.minX,i.x,i.x+c),t.maxX=Math.max(t.maxX,i.x,i.x+c),i.clearContext(e),e.restore(),i}getChildBoundingBox(e,t,n,r){var i=n.children[r];if("function"!=typeof i.getBoundingBox)return null;var o=i.getBoundingBox(e);return o?(i.children.forEach(((n,r)=>{var a=t.getChildBoundingBox(e,t,i,r);o.addBoundingBox(a)})),o):null}renderChild(e,t,n,r){var i=n.children[r];i.render(e),i.children.forEach(((n,r)=>{t.renderChild(e,t,i,r)}))}measureText(e){var{measureCache:t}=this;if(~t)return t;var n=this.getText(),r=this.measureTargetText(e,n);return this.measureCache=r,r}measureTargetText(e,t){if(!t.length)return 0;var{parent:n}=this,r=n.getStyle("font-family").getDefinition();if(r){for(var i=this.getFontSize(),o=r.isRTL?t.split("").reverse().join(""):t,a=SQe(n.getAttribute("dx").getString()),s=o.length,l=0,u=0;u<s;u++){l+=(this.getGlyph(r,o,u).horizAdvX||r.horizAdvX)*i/r.fontFace.unitsPerEm,void 0===a[u]||isNaN(a[u])||(l+=a[u])}return l}if(!e.measureText)return 10*t.length;e.save(),this.setContext(e,!0);var{width:A}=e.measureText(t);return this.clearContext(e),e.restore(),A}getInheritedAttribute(e){for(var t=this;t instanceof Ske&&t.isFirstChild();){var n=t.parent.getAttribute(e);if(n.hasValue(!0))return n.getValue("0");t=t.parent}return null}}class xke extends Ske{constructor(e,t,n){super(e,t,new.target===xke||n),this.type="tspan",this.text=this.children.length>0?"":this.getTextFromNode()}getText(){return this.text}}class Qke extends xke{constructor(){super(...arguments),this.type="textNode"}}class kke extends Bke{constructor(){super(...arguments),this.type="svg",this.root=!1}setContext(e){var t,{document:n}=this,{screen:r,window:i}=n,o=e.canvas;if(r.setDefaults(e),o.style&&void 0!==e.font&&i&&void 0!==i.getComputedStyle){e.font=i.getComputedStyle(o).getPropertyValue("font");var a=new WQe(n,"fontSize",Ike.parse(e.font).fontSize);a.hasValue()&&(n.rootEmSize=a.getPixels("y"),n.emSize=n.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);var{width:s,height:l}=r.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");var u=this.getAttribute("refX"),A=this.getAttribute("refY"),c=this.getAttribute("viewBox"),h=c.hasValue()?SQe(c.getString()):null,f=!this.root&&"visible"!==this.getStyle("overflow").getValue("hidden"),d=0,p=0,g=0,y=0;h&&(d=h[0],p=h[1]),this.root||(s=this.getStyle("width").getPixels("x"),l=this.getStyle("height").getPixels("y"),"marker"===this.type&&(g=d,y=p,d=0,p=0)),r.viewPort.setCurrent(s,l),!this.node||this.parent&&"foreignObject"!==(null===(t=this.node.parentNode)||void 0===t?void 0:t.nodeName)||!this.getStyle("transform",!1,!0).hasValue()||this.getStyle("transform-origin",!1,!0).hasValue()||this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(e),e.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),h&&(s=h[2],l=h[3]),n.setViewBox({ctx:e,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:r.viewPort.width,desiredWidth:s,height:r.viewPort.height,desiredHeight:l,minX:d,minY:p,refX:u.getValue(),refY:A.getValue(),clip:f,clipX:g,clipY:y}),h&&(r.viewPort.removeCurrent(),r.viewPort.setCurrent(s,l))}clearContext(e){super.clearContext(e),this.document.screen.viewPort.removeCurrent()}resize(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.getAttribute("width",!0),i=this.getAttribute("height",!0),o=this.getAttribute("viewBox"),a=this.getAttribute("style"),s=r.getNumber(0),l=i.getNumber(0);if(n)if("string"==typeof n)this.getAttribute("preserveAspectRatio",!0).setValue(n);else{var u=this.getAttribute("preserveAspectRatio");u.hasValue()&&u.setValue(u.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(r.setValue(e),i.setValue(t),o.hasValue()||o.setValue("0 0 ".concat(s||e," ").concat(l||t)),a.hasValue()){var A=this.getStyle("width"),c=this.getStyle("height");A.hasValue()&&A.setValue("".concat(e,"px")),c.hasValue()&&c.setValue("".concat(t,"px"))}}}class _ke extends Eke{constructor(){super(...arguments),this.type="rect"}path(e){var t=this.getAttribute("x").getPixels("x"),n=this.getAttribute("y").getPixels("y"),r=this.getStyle("width",!1,!0).getPixels("x"),i=this.getStyle("height",!1,!0).getPixels("y"),o=this.getAttribute("rx"),a=this.getAttribute("ry"),s=o.getPixels("x"),l=a.getPixels("y");if(o.hasValue()&&!a.hasValue()&&(l=s),a.hasValue()&&!o.hasValue()&&(s=l),s=Math.min(s,r/2),l=Math.min(l,i/2),e){var u=(Math.sqrt(2)-1)/3*4;e.beginPath(),i>0&&r>0&&(e.moveTo(t+s,n),e.lineTo(t+r-s,n),e.bezierCurveTo(t+r-s+u*s,n,t+r,n+l-u*l,t+r,n+l),e.lineTo(t+r,n+i-l),e.bezierCurveTo(t+r,n+i-l+u*l,t+r-s+u*s,n+i,t+r-s,n+i),e.lineTo(t+s,n+i),e.bezierCurveTo(t+s-u*s,n+i,t,n+i-l+u*l,t,n+i-l),e.lineTo(t,n+l),e.bezierCurveTo(t,n+l-u*l,t+s-u*s,n,t+s,n),e.closePath())}return new wke(t,n,t+r,n+i)}getMarkers(){return null}}class Nke extends Eke{constructor(){super(...arguments),this.type="circle"}path(e){var t=this.getAttribute("cx").getPixels("x"),n=this.getAttribute("cy").getPixels("y"),r=this.getAttribute("r").getPixels();return e&&r>0&&(e.beginPath(),e.arc(t,n,r,0,2*Math.PI,!1),e.closePath()),new wke(t-r,n-r,t+r,n+r)}getMarkers(){return null}}class Dke extends Eke{constructor(){super(...arguments),this.type="ellipse"}path(e){var t=(Math.sqrt(2)-1)/3*4,n=this.getAttribute("rx").getPixels("x"),r=this.getAttribute("ry").getPixels("y"),i=this.getAttribute("cx").getPixels("x"),o=this.getAttribute("cy").getPixels("y");return e&&n>0&&r>0&&(e.beginPath(),e.moveTo(i+n,o),e.bezierCurveTo(i+n,o+t*r,i+t*n,o+r,i,o+r),e.bezierCurveTo(i-t*n,o+r,i-n,o+t*r,i-n,o),e.bezierCurveTo(i-n,o-t*r,i-t*n,o-r,i,o-r),e.bezierCurveTo(i+t*n,o-r,i+n,o-t*r,i+n,o),e.closePath()),new wke(i-n,o-r,i+n,o+r)}getMarkers(){return null}}class Fke extends Eke{constructor(){super(...arguments),this.type="line"}getPoints(){return[new $Qe(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new $Qe(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(e){var[{x:t,y:n},{x:r,y:i}]=this.getPoints();return e&&(e.beginPath(),e.moveTo(t,n),e.lineTo(r,i)),new wke(t,n,r,i)}getMarkers(){var[e,t]=this.getPoints(),n=e.angleTo(t);return[[e,n],[t,n]]}}class Pke extends Eke{constructor(e,t,n){super(e,t,n),this.type="polyline",this.points=[],this.points=$Qe.parsePath(this.getAttribute("points").getString())}path(e){var{points:t}=this,[{x:n,y:r}]=t,i=new wke(n,r);return e&&(e.beginPath(),e.moveTo(n,r)),t.forEach((t=>{var{x:n,y:r}=t;i.addPoint(n,r),e&&e.lineTo(n,r)})),i}getMarkers(){var{points:e}=this,t=e.length-1,n=[];return e.forEach(((r,i)=>{i!==t&&n.push([r,r.angleTo(e[i+1])])})),n.length>0&&n.push([e[e.length-1],n[n.length-1][1]]),n}}class Uke extends Pke{constructor(){super(...arguments),this.type="polygon"}path(e){var t=super.path(e),[{x:n,y:r}]=this.points;return e&&(e.lineTo(n,r),e.closePath()),t}}class Mke extends pke{constructor(){super(...arguments),this.type="pattern"}createPattern(e,t,n){var r=this.getStyle("width").getPixels("x",!0),i=this.getStyle("height").getPixels("y",!0),o=new kke(this.document,null);o.attributes.viewBox=new WQe(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.width=new WQe(this.document,"width","".concat(r,"px")),o.attributes.height=new WQe(this.document,"height","".concat(i,"px")),o.attributes.transform=new WQe(this.document,"transform",this.getAttribute("patternTransform").getValue()),o.children=this.children;var a=this.document.createCanvas(r,i),s=a.getContext("2d"),l=this.getAttribute("x"),u=this.getAttribute("y");l.hasValue()&&u.hasValue()&&s.translate(l.getPixels("x",!0),u.getPixels("y",!0)),n.hasValue()?this.styles["fill-opacity"]=n:Reflect.deleteProperty(this.styles,"fill-opacity");for(var A=-1;A<=1;A++)for(var c=-1;c<=1;c++)s.save(),o.attributes.x=new WQe(this.document,"x",A*a.width),o.attributes.y=new WQe(this.document,"y",c*a.height),o.render(s),s.restore();return e.createPattern(a,"repeat")}}class Lke extends pke{constructor(){super(...arguments),this.type="marker"}render(e,t,n){if(t){var{x:r,y:i}=t,o=this.getAttribute("orient").getString("auto"),a=this.getAttribute("markerUnits").getString("strokeWidth");e.translate(r,i),"auto"===o&&e.rotate(n),"strokeWidth"===a&&e.scale(e.lineWidth,e.lineWidth),e.save();var s=new kke(this.document,null);s.type=this.type,s.attributes.viewBox=new WQe(this.document,"viewBox",this.getAttribute("viewBox").getValue()),s.attributes.refX=new WQe(this.document,"refX",this.getAttribute("refX").getValue()),s.attributes.refY=new WQe(this.document,"refY",this.getAttribute("refY").getValue()),s.attributes.width=new WQe(this.document,"width",this.getAttribute("markerWidth").getValue()),s.attributes.height=new WQe(this.document,"height",this.getAttribute("markerHeight").getValue()),s.attributes.overflow=new WQe(this.document,"overflow",this.getAttribute("overflow").getValue()),s.attributes.fill=new WQe(this.document,"fill",this.getAttribute("fill").getColor("black")),s.attributes.stroke=new WQe(this.document,"stroke",this.getAttribute("stroke").getValue("none")),s.children=this.children,s.render(e),e.restore(),"strokeWidth"===a&&e.scale(1/e.lineWidth,1/e.lineWidth),"auto"===o&&e.rotate(-n),e.translate(-r,-i)}}}class Tke extends pke{constructor(){super(...arguments),this.type="defs"}render(){}}class Rke extends Bke{constructor(){super(...arguments),this.type="g"}getBoundingBox(e){var t=new wke;return this.children.forEach((n=>{t.addBoundingBox(n.getBoundingBox(e))})),t}}class Oke extends pke{constructor(e,t,n){super(e,t,n),this.attributesToInherit=["gradientUnits"],this.stops=[];var{stops:r,children:i}=this;i.forEach((e=>{"stop"===e.type&&r.push(e)}))}getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(e,t,n){var r=this;this.getHrefAttribute().hasValue()&&(r=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(r));var{stops:i}=r,o=this.getGradient(e,t);if(!o)return this.addParentOpacity(n,i[i.length-1].color);if(i.forEach((e=>{o.addColorStop(e.offset,this.addParentOpacity(n,e.color))})),this.getAttribute("gradientTransform").hasValue()){var{document:a}=this,{MAX_VIRTUAL_PIXELS:s,viewPort:l}=a.screen,[u]=l.viewPorts,A=new _ke(a,null);A.attributes.x=new WQe(a,"x",-s/3),A.attributes.y=new WQe(a,"y",-s/3),A.attributes.width=new WQe(a,"width",s),A.attributes.height=new WQe(a,"height",s);var c=new Rke(a,null);c.attributes.transform=new WQe(a,"transform",this.getAttribute("gradientTransform").getValue()),c.children=[A];var h=new kke(a,null);h.attributes.x=new WQe(a,"x",0),h.attributes.y=new WQe(a,"y",0),h.attributes.width=new WQe(a,"width",u.width),h.attributes.height=new WQe(a,"height",u.height),h.children=[c];var f=a.createCanvas(u.width,u.height),d=f.getContext("2d");return d.fillStyle=o,h.render(d),d.createPattern(f,"no-repeat")}return o}inheritStopContainer(e){this.attributesToInherit.forEach((t=>{!this.getAttribute(t).hasValue()&&e.getAttribute(t).hasValue()&&this.getAttribute(t,!0).setValue(e.getAttribute(t).getValue())}))}addParentOpacity(e,t){return e.hasValue()?new WQe(this.document,"color",t).addOpacity(e).getColor():t}}class Hke extends Oke{constructor(e,t,n){super(e,t,n),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}getGradient(e,t){var n="objectBoundingBox"===this.getGradientUnits(),r=n?t.getBoundingBox(e):null;if(n&&!r)return null;this.getAttribute("x1").hasValue()||this.getAttribute("y1").hasValue()||this.getAttribute("x2").hasValue()||this.getAttribute("y2").hasValue()||(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));var i=n?r.x+r.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),o=n?r.y+r.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),a=n?r.x+r.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),s=n?r.y+r.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return i===a&&o===s?null:e.createLinearGradient(i,o,a,s)}}class Kke extends Oke{constructor(e,t,n){super(e,t,n),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}getGradient(e,t){var n="objectBoundingBox"===this.getGradientUnits(),r=t.getBoundingBox(e);if(n&&!r)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");var i=n?r.x+r.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),o=n?r.y+r.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y"),a=i,s=o;this.getAttribute("fx").hasValue()&&(a=n?r.x+r.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(s=n?r.y+r.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));var l=n?(r.width+r.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),u=this.getAttribute("fr").getPixels();return e.createRadialGradient(a,s,u,i,o,l)}}class jke extends pke{constructor(e,t,n){super(e,t,n),this.type="stop";var r=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),i=this.getStyle("stop-opacity"),o=this.getStyle("stop-color",!0);""===o.getString()&&o.setValue("#000"),i.hasValue()&&(o=o.addOpacity(i)),this.offset=r,this.color=o.getColor()}}class Gke extends pke{constructor(e,t,n){super(e,t,n),this.type="animate",this.duration=0,this.initialValue=null,this.initialUnits="",this.removed=!1,this.frozen=!1,e.screen.animations.push(this),this.begin=this.getAttribute("begin").getMilliseconds(),this.maxDuration=this.begin+this.getAttribute("dur").getMilliseconds(),this.from=this.getAttribute("from"),this.to=this.getAttribute("to"),this.values=new WQe(e,"values",null);var r=this.getAttribute("values");r.hasValue()&&this.values.setValue(r.getString().split(";"))}getProperty(){var e=this.getAttribute("attributeType").getString(),t=this.getAttribute("attributeName").getString();return"CSS"===e?this.parent.getStyle(t,!0):this.parent.getAttribute(t,!0)}calcValue(){var{initialUnits:e}=this,{progress:t,from:n,to:r}=this.getProgress(),i=n.getNumber()+(r.getNumber()-n.getNumber())*t;return"%"===e&&(i*=100),"".concat(i).concat(e)}update(e){var{parent:t}=this,n=this.getProperty();if(this.initialValue||(this.initialValue=n.getString(),this.initialUnits=n.getUnits()),this.duration>this.maxDuration){var r=this.getAttribute("fill").getString("remove");if("indefinite"===this.getAttribute("repeatCount").getString()||"indefinite"===this.getAttribute("repeatDur").getString())this.duration=0;else if("freeze"!==r||this.frozen){if("remove"===r&&!this.removed)return this.removed=!0,n.setValue(t.animationFrozen?t.animationFrozenValue:this.initialValue),!0}else this.frozen=!0,t.animationFrozen=!0,t.animationFrozenValue=n.getString();return!1}this.duration+=e;var i=!1;if(this.begin<this.duration){var o=this.calcValue(),a=this.getAttribute("type");if(a.hasValue()){var s=a.getString();o="".concat(s,"(").concat(o,")")}n.setValue(o),i=!0}return i}getProgress(){var{document:e,values:t}=this,n={progress:(this.duration-this.begin)/(this.maxDuration-this.begin)};if(t.hasValue()){var r=n.progress*(t.getValue().length-1),i=Math.floor(r),o=Math.ceil(r);n.from=new WQe(e,"from",parseFloat(t.getValue()[i])),n.to=new WQe(e,"to",parseFloat(t.getValue()[o])),n.progress=(r-i)/(o-i)}else n.from=this.from,n.to=this.to;return n}}class qke extends Gke{constructor(){super(...arguments),this.type="animateColor"}calcValue(){var{progress:e,from:t,to:n}=this.getProgress(),r=new mxe(t.getColor()),i=new mxe(n.getColor());if(r.ok&&i.ok){var o=r.r+(i.r-r.r)*e,a=r.g+(i.g-r.g)*e,s=r.b+(i.b-r.b)*e;return"rgb(".concat(Math.floor(o),", ").concat(Math.floor(a),", ").concat(Math.floor(s),")")}return this.getAttribute("from").getColor()}}class Vke extends Gke{constructor(){super(...arguments),this.type="animateTransform"}calcValue(){var{progress:e,from:t,to:n}=this.getProgress(),r=SQe(t.getString()),i=SQe(n.getString()),o=r.map(((t,n)=>t+(i[n]-t)*e)).join(" ");return o}}class zke extends pke{constructor(e,t,n){super(e,t,n),this.type="font",this.glyphs={},this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();var{definitions:r}=e,{children:i}=this;for(var o of i)switch(o.type){case"font-face":this.fontFace=o;var a=o.getStyle("font-family");a.hasValue()&&(r[a.getString()]=this);break;case"missing-glyph":this.missingGlyph=o;break;case"glyph":var s=o;s.arabicForm?(this.isRTL=!0,this.isArabic=!0,void 0===this.glyphs[s.unicode]&&(this.glyphs[s.unicode]={}),this.glyphs[s.unicode][s.arabicForm]=s):this.glyphs[s.unicode]=s}}render(){}}class Jke extends pke{constructor(e,t,n){super(e,t,n),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class Yke extends Eke{constructor(){super(...arguments),this.type="missing-glyph",this.horizAdvX=0}}class Xke extends Ske{constructor(){super(...arguments),this.type="tref"}getText(){var e=this.getHrefAttribute().getDefinition();if(e){var t=e.children[0];if(t)return t.getText()}return""}}class Wke extends Ske{constructor(e,t,n){super(e,t,n),this.type="a";var{childNodes:r}=t,i=r[0],o=r.length>0&&Array.from(r).every((e=>3===e.nodeType));this.hasText=o,this.text=o?this.getTextFromNode(i):""}getText(){return this.text}renderChildren(e){if(this.hasText){super.renderChildren(e);var{document:t,x:n,y:r}=this,{mouse:i}=t.screen,o=new WQe(t,"fontSize",Ike.parse(t.ctx.font).fontSize);i.isWorking()&&i.checkBoundingBox(this,new wke(n,r-o.getPixels("y"),n+this.measureText(e),r))}else if(this.children.length>0){var a=new Rke(this.document,null);a.children=this.children,a.parent=this,a.render(e)}}onClick(){var{window:e}=this.document;e&&e.open(this.getHrefAttribute().getString())}onMouseMove(){this.document.ctx.canvas.style.cursor="pointer"}}function Zke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $ke(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zke(Object(n),!0).forEach((function(t){jCe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zke(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}class e_e extends Ske{constructor(e,t,n){super(e,t,n),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);var r=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(r)}getText(){return this.text}path(e){var{dataArray:t}=this;e&&e.beginPath(),t.forEach((t=>{var{type:n,points:r}=t;switch(n){case bke.LINE_TO:e&&e.lineTo(r[0],r[1]);break;case bke.MOVE_TO:e&&e.moveTo(r[0],r[1]);break;case bke.CURVE_TO:e&&e.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case bke.QUAD_TO:e&&e.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case bke.ARC:var[i,o,a,s,l,u,A,c]=r,h=a>s?a:s,f=a>s?1:a/s,d=a>s?s/a:1;e&&(e.translate(i,o),e.rotate(A),e.scale(f,d),e.arc(0,0,h,l,l+u,Boolean(1-c)),e.scale(1/f,1/d),e.rotate(-A),e.translate(-i,-o));break;case bke.CLOSE_PATH:e&&e.closePath()}}))}renderChildren(e){this.setTextData(e),e.save();var t=this.parent.getStyle("text-decoration").getString(),n=this.getFontSize(),{glyphInfo:r}=this,i=e.fillStyle;"underline"===t&&e.beginPath(),r.forEach(((r,i)=>{var{p0:o,p1:a,rotation:s,text:l}=r;e.save(),e.translate(o.x,o.y),e.rotate(s),e.fillStyle&&e.fillText(l,0,0),e.strokeStyle&&e.strokeText(l,0,0),e.restore(),"underline"===t&&(0===i&&e.moveTo(o.x,o.y+n/8),e.lineTo(a.x,a.y+n/5))})),"underline"===t&&(e.lineWidth=n/20,e.strokeStyle=i,e.stroke(),e.closePath()),e.restore()}getLetterSpacingAt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.letterSpacingCache[e]||0}findSegmentToFitChar(e,t,n,r,i,o,a,s,l){var u=o,A=this.measureText(e,s);" "===s&&"justify"===t&&n<r&&(A+=(r-n)/i),l>-1&&(u+=this.getLetterSpacingAt(l));var c=this.textHeight/20,h=this.getEquidistantPointOnPath(u,c,0),f=this.getEquidistantPointOnPath(u+A,c,0),d={p0:h,p1:f},p=h&&f?Math.atan2(f.y-h.y,f.x-h.x):0;if(a){var g=Math.cos(Math.PI/2+p)*a,y=Math.cos(-p)*a;d.p0=$ke($ke({},h),{},{x:h.x+g,y:h.y+y}),d.p1=$ke($ke({},f),{},{x:f.x+g,y:f.y+y})}return{offset:u+=A,segment:d,rotation:p}}measureText(e,t){var{measuresCache:n}=this,r=t||this.getText();if(n.has(r))return n.get(r);var i=this.measureTargetText(e,r);return n.set(r,i),i}setTextData(e){if(!this.glyphInfo){var t=this.getText(),n=t.split(""),r=t.split(" ").length-1,i=this.parent.getAttribute("dx").split().map((e=>e.getPixels("x"))),o=this.parent.getAttribute("dy").getPixels("y"),a=this.parent.getStyle("text-anchor").getString("start"),s=this.getStyle("letter-spacing"),l=this.parent.getStyle("letter-spacing"),u=0;s.hasValue()&&"inherit"!==s.getValue()?s.hasValue()&&"initial"!==s.getValue()&&"unset"!==s.getValue()&&(u=s.getPixels()):u=l.getPixels();var A=[],c=t.length;this.letterSpacingCache=A;for(var h=0;h<c;h++)A.push(void 0!==i[h]?i[h]:u);var f=A.reduce(((e,t,n)=>0===n?0:e+t||0),0),d=this.measureText(e),p=Math.max(d+f,0);this.textWidth=d,this.textHeight=this.getFontSize(),this.glyphInfo=[];var g=this.getPathLength(),y=this.getStyle("startOffset").getNumber(0)*g,m=0;"middle"!==a&&"center"!==a||(m=-p/2),"end"!==a&&"right"!==a||(m=-p),m+=y,n.forEach(((t,i)=>{var{offset:s,segment:l,rotation:u}=this.findSegmentToFitChar(e,a,p,g,r,m,o,t,i);m=s,l.p0&&l.p1&&this.glyphInfo.push({text:n[i],p0:l.p0,p1:l.p1,rotation:u})}))}}parsePathData(e){if(this.pathLength=-1,!e)return[];var t=[],{pathParser:n}=e;for(n.reset();!n.isEnd();){var{current:r}=n,i=r?r.x:0,o=r?r.y:0,a=n.next(),s=a.type,l=[];switch(a.type){case bke.MOVE_TO:this.pathM(n,l);break;case bke.LINE_TO:s=this.pathL(n,l);break;case bke.HORIZ_LINE_TO:s=this.pathH(n,l);break;case bke.VERT_LINE_TO:s=this.pathV(n,l);break;case bke.CURVE_TO:this.pathC(n,l);break;case bke.SMOOTH_CURVE_TO:s=this.pathS(n,l);break;case bke.QUAD_TO:this.pathQ(n,l);break;case bke.SMOOTH_QUAD_TO:s=this.pathT(n,l);break;case bke.ARC:l=this.pathA(n);break;case bke.CLOSE_PATH:Eke.pathZ(n)}a.type!==bke.CLOSE_PATH?t.push({type:s,points:l,start:{x:i,y:o},pathLength:this.calcLength(i,o,s,l)}):t.push({type:bke.CLOSE_PATH,points:[],pathLength:0})}return t}pathM(e,t){var{x:n,y:r}=Eke.pathM(e).point;t.push(n,r)}pathL(e,t){var{x:n,y:r}=Eke.pathL(e).point;return t.push(n,r),bke.LINE_TO}pathH(e,t){var{x:n,y:r}=Eke.pathH(e).point;return t.push(n,r),bke.LINE_TO}pathV(e,t){var{x:n,y:r}=Eke.pathV(e).point;return t.push(n,r),bke.LINE_TO}pathC(e,t){var{point:n,controlPoint:r,currentPoint:i}=Eke.pathC(e);t.push(n.x,n.y,r.x,r.y,i.x,i.y)}pathS(e,t){var{point:n,controlPoint:r,currentPoint:i}=Eke.pathS(e);return t.push(n.x,n.y,r.x,r.y,i.x,i.y),bke.CURVE_TO}pathQ(e,t){var{controlPoint:n,currentPoint:r}=Eke.pathQ(e);t.push(n.x,n.y,r.x,r.y)}pathT(e,t){var{controlPoint:n,currentPoint:r}=Eke.pathT(e);return t.push(n.x,n.y,r.x,r.y),bke.QUAD_TO}pathA(e){var{rX:t,rY:n,sweepFlag:r,xAxisRotation:i,centp:o,a1:a,ad:s}=Eke.pathA(e);return 0===r&&s>0&&(s-=2*Math.PI),1===r&&s<0&&(s+=2*Math.PI),[o.x,o.y,t,n,a,s,i,r]}calcLength(e,t,n,r){var i=0,o=null,a=null,s=0;switch(n){case bke.LINE_TO:return this.getLineLength(e,t,r[0],r[1]);case bke.CURVE_TO:for(i=0,o=this.getPointOnCubicBezier(0,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),s=.01;s<=1;s+=.01)a=this.getPointOnCubicBezier(s,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),i+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;return i;case bke.QUAD_TO:for(i=0,o=this.getPointOnQuadraticBezier(0,e,t,r[0],r[1],r[2],r[3]),s=.01;s<=1;s+=.01)a=this.getPointOnQuadraticBezier(s,e,t,r[0],r[1],r[2],r[3]),i+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;return i;case bke.ARC:i=0;var l=r[4],u=r[5],A=r[4]+u,c=Math.PI/180;if(Math.abs(l-A)<c&&(c=Math.abs(l-A)),o=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),u<0)for(s=l-c;s>A;s-=c)a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],s,0),i+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;else for(s=l+c;s<A;s+=c)a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],s,0),i+=this.getLineLength(o.x,o.y,a.x,a.y),o=a;return a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],A,0),i+=this.getLineLength(o.x,o.y,a.x,a.y)}return 0}getPointOnLine(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:t,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:n,s=(i-n)/(r-t+OQe),l=Math.sqrt(e*e/(1+s*s));r<t&&(l*=-1);var u=s*l,A=null;if(r===t)A={x:o,y:a+u};else if((a-n)/(o-t+OQe)===s)A={x:o+l,y:a+u};else{var c,h,f=this.getLineLength(t,n,r,i);if(f<OQe)return null;var d=(o-t)*(r-t)+(a-n)*(i-n);c=t+(d/=f*f)*(r-t),h=n+d*(i-n);var p=this.getLineLength(o,a,c,h),g=Math.sqrt(e*e-p*p);l=Math.sqrt(g*g/(1+s*s)),r<t&&(l*=-1),A={x:c+l,y:h+(u=s*l)}}return A}getPointOnPath(e){var t=this.getPathLength(),n=0,r=null;if(e<-5e-5||e-5e-5>t)return null;var{dataArray:i}=this;for(var o of i){if(!o||!(o.pathLength<5e-5||n+o.pathLength+5e-5<e)){var a=e-n,s=0;switch(o.type){case bke.LINE_TO:r=this.getPointOnLine(a,o.start.x,o.start.y,o.points[0],o.points[1],o.start.x,o.start.y);break;case bke.ARC:var l=o.points[4],u=o.points[5],A=o.points[4]+u;if(s=l+a/o.pathLength*u,u<0&&s<A||u>=0&&s>A)break;r=this.getPointOnEllipticalArc(o.points[0],o.points[1],o.points[2],o.points[3],s,o.points[6]);break;case bke.CURVE_TO:(s=a/o.pathLength)>1&&(s=1),r=this.getPointOnCubicBezier(s,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3],o.points[4],o.points[5]);break;case bke.QUAD_TO:(s=a/o.pathLength)>1&&(s=1),r=this.getPointOnQuadraticBezier(s,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3])}if(r)return r;break}n+=o.pathLength}return null}getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}getPathLength(){return-1===this.pathLength&&(this.pathLength=this.dataArray.reduce(((e,t)=>t.pathLength>0?e+t.pathLength:e),0)),this.pathLength}getPointOnCubicBezier(e,t,n,r,i,o,a,s,l){return{x:s*GQe(e)+o*qQe(e)+r*VQe(e)+t*zQe(e),y:l*GQe(e)+a*qQe(e)+i*VQe(e)+n*zQe(e)}}getPointOnQuadraticBezier(e,t,n,r,i,o,a){return{x:o*JQe(e)+r*YQe(e)+t*XQe(e),y:a*JQe(e)+i*YQe(e)+n*XQe(e)}}getPointOnEllipticalArc(e,t,n,r,i,o){var a=Math.cos(o),s=Math.sin(o),l=n*Math.cos(i),u=r*Math.sin(i);return{x:e+(l*a-u*s),y:t+(l*s+u*a)}}buildEquidistantCache(e,t){var n=this.getPathLength(),r=t||.25,i=e||n/100;if(!this.equidistantCache||this.equidistantCache.step!==i||this.equidistantCache.precision!==r){this.equidistantCache={step:i,precision:r,points:[]};for(var o=0,a=0;a<=n;a+=r){var s=this.getPointOnPath(a),l=this.getPointOnPath(a+r);s&&l&&((o+=this.getLineLength(s.x,s.y,l.x,l.y))>=i&&(this.equidistantCache.points.push({x:s.x,y:s.y,distance:a}),o-=i))}}}getEquidistantPointOnPath(e,t,n){if(this.buildEquidistantCache(t,n),e<0||e-this.getPathLength()>5e-5)return null;var r=Math.round(e/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[r]||null}}var t_e=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class n_e extends Bke{constructor(e,t,n){super(e,t,n),this.type="image",this.loaded=!1;var r=this.getHrefAttribute().getString();if(r){var i=r.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(r);e.images.push(this),i?this.loadSvg(r):this.loadImage(r),this.isSvg=i}}loadImage(e){var t=this;return Qwe((function*(){try{var n=yield t.document.createImage(e);t.image=n}catch(t){console.error('Error while loading image "'.concat(e,'":'),t)}t.loaded=!0}))()}loadSvg(e){var t=this;return Qwe((function*(){var n=t_e.exec(e);if(n){var r=n[5];"base64"===n[4]?t.image=atob(r):t.image=decodeURIComponent(r)}else try{var i=yield t.document.fetch(e),o=yield i.text();t.image=o}catch(t){console.error('Error while loading image "'.concat(e,'":'),t)}t.loaded=!0}))()}renderChildren(e){var{document:t,image:n,loaded:r}=this,i=this.getAttribute("x").getPixels("x"),o=this.getAttribute("y").getPixels("y"),a=this.getStyle("width").getPixels("x"),s=this.getStyle("height").getPixels("y");if(r&&n&&a&&s){if(e.save(),e.translate(i,o),this.isSvg){var l=t.canvg.forkString(e,this.image,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:a,scaleHeight:s});l.document.documentElement.parent=this,l.render()}else{var u=this.image;t.setViewBox({ctx:e,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:a,desiredWidth:u.width,height:s,desiredHeight:u.height}),this.loaded&&(void 0===u.complete||u.complete)&&e.drawImage(u,0,0)}e.restore()}}getBoundingBox(){var e=this.getAttribute("x").getPixels("x"),t=this.getAttribute("y").getPixels("y"),n=this.getStyle("width").getPixels("x"),r=this.getStyle("height").getPixels("y");return new wke(e,t,e+n,t+r)}}class r_e extends Bke{constructor(){super(...arguments),this.type="symbol"}render(e){}}class i_e{constructor(e){this.document=e,this.loaded=!1,e.fonts.push(this)}load(e,t){var n=this;return Qwe((function*(){try{var{document:r}=n,i=(yield r.canvg.parser.load(t)).getElementsByTagName("font");Array.from(i).forEach((t=>{var n=r.createElement(t);r.definitions[e]=n}))}catch(e){console.error('Error while loading font "'.concat(t,'":'),e)}n.loaded=!0}))()}}class o_e extends pke{constructor(e,t,n){super(e,t,n),this.type="style";var r=BQe(Array.from(t.childNodes).map((e=>e.textContent)).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,""));r.split("}").forEach((t=>{var n=t.trim();if(n){var r=n.split("{"),i=r[0].split(","),o=r[1].split(";");i.forEach((t=>{var n=t.trim();if(n){var r=e.styles[n]||{};if(o.forEach((t=>{var n=t.indexOf(":"),i=t.substr(0,n).trim(),o=t.substr(n+1,t.length-n).trim();i&&o&&(r[i]=new WQe(e,i,o))})),e.styles[n]=r,e.stylesSpecificity[n]=RQe(n),"@font-face"===n){var i=r["font-family"].getString().replace(/"|'/g,"");r.src.getString().split(",").forEach((t=>{if(t.indexOf('format("svg")')>0){var n=kQe(t);n&&new i_e(e).load(i,n)}}))}}}))}}))}}o_e.parseExternalUrl=kQe;class a_e extends Bke{constructor(){super(...arguments),this.type="use"}setContext(e){super.setContext(e);var t=this.getAttribute("x"),n=this.getAttribute("y");t.hasValue()&&e.translate(t.getPixels("x"),0),n.hasValue()&&e.translate(0,n.getPixels("y"))}path(e){var{element:t}=this;t&&t.path(e)}renderChildren(e){var{document:t,element:n}=this;if(n){var r=n;if("symbol"===n.type&&((r=new kke(t,null)).attributes.viewBox=new WQe(t,"viewBox",n.getAttribute("viewBox").getString()),r.attributes.preserveAspectRatio=new WQe(t,"preserveAspectRatio",n.getAttribute("preserveAspectRatio").getString()),r.attributes.overflow=new WQe(t,"overflow",n.getAttribute("overflow").getString()),r.children=n.children,n.styles.opacity=new WQe(t,"opacity",this.calculateOpacity())),"svg"===r.type){var i=this.getStyle("width",!1,!0),o=this.getStyle("height",!1,!0);i.hasValue()&&(r.attributes.width=new WQe(t,"width",i.getString())),o.hasValue()&&(r.attributes.height=new WQe(t,"height",o.getString()))}var a=r.parent;r.parent=this,r.render(e),r.parent=a}}getBoundingBox(e){var{element:t}=this;return t?t.getBoundingBox(e):null}elementTransform(){var{document:e,element:t}=this;return dke.fromElement(e,t)}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}}function s_e(e,t,n,r,i,o){return e[n*r*4+4*t+o]}function l_e(e,t,n,r,i,o,a){e[n*r*4+4*t+o]=a}function u_e(e,t,n){return e[t]*n}function A_e(e,t,n,r){return t+Math.cos(e)*n+Math.sin(e)*r}class c_e extends pke{constructor(e,t,n){super(e,t,n),this.type="feColorMatrix";var r=SQe(this.getAttribute("values").getString());switch(this.getAttribute("type").getString("matrix")){case"saturate":var i=r[0];r=[.213+.787*i,.715-.715*i,.072-.072*i,0,0,.213-.213*i,.715+.285*i,.072-.072*i,0,0,.213-.213*i,.715-.715*i,.072+.928*i,0,0,0,0,0,1,0,0,0,0,0,1];break;case"hueRotate":var o=r[0]*Math.PI/180;r=[A_e(o,.213,.787,-.213),A_e(o,.715,-.715,-.715),A_e(o,.072,-.072,.928),0,0,A_e(o,.213,-.213,.143),A_e(o,.715,.285,.14),A_e(o,.072,-.072,-.283),0,0,A_e(o,.213,-.213,-.787),A_e(o,.715,-.715,.715),A_e(o,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}this.matrix=r,this.includeOpacity=this.getAttribute("includeOpacity").hasValue()}apply(e,t,n,r,i){for(var{includeOpacity:o,matrix:a}=this,s=e.getImageData(0,0,r,i),l=0;l<i;l++)for(var u=0;u<r;u++){var A=s_e(s.data,u,l,r,0,0),c=s_e(s.data,u,l,r,0,1),h=s_e(s.data,u,l,r,0,2),f=s_e(s.data,u,l,r,0,3),d=u_e(a,0,A)+u_e(a,1,c)+u_e(a,2,h)+u_e(a,3,f)+u_e(a,4,1),p=u_e(a,5,A)+u_e(a,6,c)+u_e(a,7,h)+u_e(a,8,f)+u_e(a,9,1),g=u_e(a,10,A)+u_e(a,11,c)+u_e(a,12,h)+u_e(a,13,f)+u_e(a,14,1),y=u_e(a,15,A)+u_e(a,16,c)+u_e(a,17,h)+u_e(a,18,f)+u_e(a,19,1);o&&(d=0,p=0,g=0,y*=f/255),l_e(s.data,u,l,r,0,0,d),l_e(s.data,u,l,r,0,1,p),l_e(s.data,u,l,r,0,2,g),l_e(s.data,u,l,r,0,3,y)}e.clearRect(0,0,r,i),e.putImageData(s,0,0)}}class h_e extends pke{constructor(){super(...arguments),this.type="mask"}apply(e,t){var{document:n}=this,r=this.getAttribute("x").getPixels("x"),i=this.getAttribute("y").getPixels("y"),o=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y");if(!o&&!a){var s=new wke;this.children.forEach((t=>{s.addBoundingBox(t.getBoundingBox(e))})),r=Math.floor(s.x1),i=Math.floor(s.y1),o=Math.floor(s.width),a=Math.floor(s.height)}var l=this.removeStyles(t,h_e.ignoreStyles),u=n.createCanvas(r+o,i+a),A=u.getContext("2d");n.screen.setDefaults(A),this.renderChildren(A),new c_e(n,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(A,0,0,r+o,i+a);var c=n.createCanvas(r+o,i+a),h=c.getContext("2d");n.screen.setDefaults(h),t.render(h),h.globalCompositeOperation="destination-in",h.fillStyle=A.createPattern(u,"no-repeat"),h.fillRect(0,0,r+o,i+a),e.fillStyle=h.createPattern(c,"no-repeat"),e.fillRect(0,0,r+o,i+a),this.restoreStyles(t,l)}render(e){}}h_e.ignoreStyles=["mask","transform","clip-path"];var f_e=()=>{};class d_e extends pke{constructor(){super(...arguments),this.type="clipPath"}apply(e){var{document:t}=this,n=Reflect.getPrototypeOf(e),{beginPath:r,closePath:i}=e;n&&(n.beginPath=f_e,n.closePath=f_e),Reflect.apply(r,e,[]),this.children.forEach((r=>{if(void 0!==r.path){var o=void 0!==r.elementTransform?r.elementTransform():null;o||(o=dke.fromElement(t,r)),o&&o.apply(e),r.path(e),n&&(n.closePath=i),o&&o.unapply(e)}})),Reflect.apply(i,e,[]),e.clip(),n&&(n.beginPath=r,n.closePath=i)}render(e){}}class p_e extends pke{constructor(){super(...arguments),this.type="filter"}apply(e,t){var{document:n,children:r}=this,i=t.getBoundingBox(e);if(i){var o=0,a=0;r.forEach((e=>{var t=e.extraFilterDistance||0;o=Math.max(o,t),a=Math.max(a,t)}));var s=Math.floor(i.width),l=Math.floor(i.height),u=s+2*o,A=l+2*a;if(!(u<1||A<1)){var c=Math.floor(i.x),h=Math.floor(i.y),f=this.removeStyles(t,p_e.ignoreStyles),d=n.createCanvas(u,A),p=d.getContext("2d");n.screen.setDefaults(p),p.translate(-c+o,-h+a),t.render(p),r.forEach((e=>{"function"==typeof e.apply&&e.apply(p,0,0,u,A)})),e.drawImage(d,0,0,u,A,c-o,h-a,u,A),this.restoreStyles(t,f)}}}render(e){}}p_e.ignoreStyles=["filter","transform","clip-path"];class g_e extends pke{constructor(e,t,n){super(e,t,n),this.type="feDropShadow",this.addStylesFromStyleDefinition()}apply(e,t,n,r,i){}}class y_e extends pke{constructor(){super(...arguments),this.type="feMorphology"}apply(e,t,n,r,i){}}class m_e extends pke{constructor(){super(...arguments),this.type="feComposite"}apply(e,t,n,r,i){}}class v_e extends pke{constructor(e,t,n){super(e,t,n),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}apply(e,t,n,r,i){var{document:o,blurRadius:a}=this,s=o.window?o.window.document.body:null,l=e.canvas;l.id=o.getUniqueId(),s&&(l.style.display="none",s.appendChild(l)),IQe(l,t,n,r,i,a),s&&s.removeChild(l)}}class I_e extends pke{constructor(){super(...arguments),this.type="title"}}class w_e extends pke{constructor(){super(...arguments),this.type="desc"}}var b_e={svg:kke,rect:_ke,circle:Nke,ellipse:Dke,line:Fke,polyline:Pke,polygon:Uke,path:Eke,pattern:Mke,marker:Lke,defs:Tke,linearGradient:Hke,radialGradient:Kke,stop:jke,animate:Gke,animateColor:qke,animateTransform:Vke,font:zke,"font-face":Jke,"missing-glyph":Yke,glyph:Cke,text:Ske,tspan:xke,tref:Xke,a:Wke,textPath:e_e,image:n_e,g:Rke,symbol:r_e,style:o_e,use:a_e,mask:h_e,clipPath:d_e,filter:p_e,feDropShadow:g_e,feMorphology:y_e,feComposite:m_e,feColorMatrix:c_e,feGaussianBlur:v_e,title:I_e,desc:w_e};function B_e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function E_e(){return E_e=Qwe((function*(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=document.createElement("img");return t&&(n.crossOrigin="Anonymous"),new Promise(((t,r)=>{n.onload=()=>{t(n)},n.onerror=(e,t,n,i,o)=>{r(o)},n.src=e}))})),E_e.apply(this,arguments)}class C_e{constructor(e){var{rootEmSize:t=12,emSize:n=12,createCanvas:r=C_e.createCanvas,createImage:i=C_e.createImage,anonymousCrossOrigin:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.canvg=e,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=e.screen,this.rootEmSize=t,this.emSize=n,this.createCanvas=r,this.createImage=this.bindCreateImage(i,o),this.screen.wait(this.isImagesLoaded.bind(this)),this.screen.wait(this.isFontsLoaded.bind(this))}bindCreateImage(e,t){return"boolean"==typeof t?(n,r)=>e(n,"boolean"==typeof r?r:t):e}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){var{emSizeStack:e}=this;return e[e.length-1]}set emSize(e){var{emSizeStack:t}=this;t.push(e)}popEmSize(){var{emSizeStack:e}=this;e.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every((e=>e.loaded))}isFontsLoaded(){return this.fonts.every((e=>e.loaded))}createDocumentElement(e){var t=this.createElement(e.documentElement);return t.root=!0,t.addStylesFromStyleDefinition(),this.documentElement=t,t}createElement(e){var t=e.nodeName.replace(/^[^:]+:/,""),n=C_e.elementTypes[t];return void 0!==n?new n(this,e):new gke(this,e)}createTextNode(e){return new Qke(this,e)}setViewBox(e){this.screen.setViewBox(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B_e(Object(n),!0).forEach((function(t){jCe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({document:this},e))}}function S_e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function x_e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S_e(Object(n),!0).forEach((function(t){jCe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}C_e.createCanvas=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,n},C_e.createImage=function(e){return E_e.apply(this,arguments)},C_e.elementTypes=b_e;class Q_e{constructor(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.parser=new ake(n),this.screen=new rke(e,n),this.options=n;var r=new C_e(this,n),i=r.createDocumentElement(t);this.document=r,this.documentElement=i}static from(e,t){var n=arguments;return Qwe((function*(){var r=n.length>2&&void 0!==n[2]?n[2]:{},i=new ake(r),o=yield i.parse(t);return new Q_e(e,o,r)}))()}static fromString(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new ake(n).parseFromString(t);return new Q_e(e,r,n)}fork(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Q_e.from(e,t,x_e(x_e({},this.options),n))}forkString(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Q_e.fromString(e,t,x_e(x_e({},this.options),n))}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}render(){var e=arguments,t=this;return Qwe((function*(){var n=e.length>0&&void 0!==e[0]?e[0]:{};t.start(x_e({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0},n)),yield t.ready(),t.stop()}))()}start(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{documentElement:t,screen:n,options:r}=this;n.start(t,x_e(x_e({enableRedraw:!0},r),e))}stop(){this.screen.stop()}resize(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.documentElement.resize(e,t,n)}}var k_e=Object.freeze({__proto__:null,AElement:Wke,AnimateColorElement:qke,AnimateElement:Gke,AnimateTransformElement:Vke,BoundingBox:wke,CB1:GQe,CB2:qQe,CB3:VQe,CB4:zQe,Canvg:Q_e,CircleElement:Nke,ClipPathElement:d_e,DefsElement:Tke,DescElement:w_e,Document:C_e,Element:pke,EllipseElement:Dke,FeColorMatrixElement:c_e,FeCompositeElement:m_e,FeDropShadowElement:g_e,FeGaussianBlurElement:v_e,FeMorphologyElement:y_e,FilterElement:p_e,Font:Ike,FontElement:zke,FontFaceElement:Jke,GElement:Rke,GlyphElement:Cke,GradientElement:Oke,ImageElement:n_e,LineElement:Fke,LinearGradientElement:Hke,MarkerElement:Lke,MaskElement:h_e,Matrix:Ake,MissingGlyphElement:Yke,Mouse:eke,PSEUDO_ZERO:OQe,Parser:ake,PathElement:Eke,PathParser:bke,PatternElement:Mke,Point:$Qe,PolygonElement:Uke,PolylineElement:Pke,Property:WQe,QB1:JQe,QB2:YQe,QB3:XQe,RadialGradientElement:Kke,RectElement:_ke,RenderedElement:Bke,Rotate:lke,SVGElement:kke,SVGFontLoader:i_e,Scale:uke,Screen:rke,Skew:cke,SkewX:hke,SkewY:fke,StopElement:jke,StyleElement:o_e,SymbolElement:r_e,TRefElement:Xke,TSpanElement:xke,TextElement:Ske,TextPathElement:e_e,TitleElement:I_e,Transform:dke,Translate:ske,UnknownElement:gke,UseElement:a_e,ViewPort:ZQe,compressSpaces:BQe,default:Q_e,getSelectorSpecificity:RQe,normalizeAttributeName:QQe,normalizeColor:_Qe,parseExternalUrl:kQe,presets:bQe,toNumbers:SQe,trimLeft:EQe,trimRight:CQe,vectorMagnitude:HQe,vectorsAngle:jQe,vectorsRatio:KQe})}();
|