@ledgerhq/connect-kit 1.1.8 → 1.1.10

Sign up to get free protection for your applications and to get access to all the features.
package/dist/umd/index.js CHANGED
@@ -169,7 +169,7 @@ t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?i-1:0,h=
169
169
  `,pt=et.a`
170
170
  color: #BBB0FF;
171
171
  cursor: pointer;
172
- `;var gt=function(e,t){return gt=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])},gt(e,t)};function yt(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}gt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var vt=function(){return vt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},vt.apply(this,arguments)};function mt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function _t(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function bt(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function wt(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Et=function(e,t){return Et=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])},Et(e,t)};function St(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}Et(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ot=function(){return Ot=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ot.apply(this,arguments)};function It(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function xt(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function Rt(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function kt(e,t,n){t.split&&(t=t.split("."));for(var r,i,o=0,s=t.length,a=e;o<s&&"__proto__"!==(i=t[o++])&&"constructor"!==i&&"prototype"!==i;)a=a[i]=o===s?n:typeof(r=a[i])==typeof t?r:0*t[o]!=0||~(""+t[o]).indexOf(".")?{}:[]}"function"==typeof SuppressedError&&SuppressedError;var Ct=function(e){function t(t,n){var r=e.call(this,"".concat(t," ").concat(n))||this;return r.field=t,r}return St(t,e),t}(Error);function Pt(e){return"string"==typeof e}function At(e){return"number"==typeof e}function Nt(e){return"function"==typeof e}function Tt(e){return null!=e}function Mt(e){return"object"===Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var Lt="is not a string",jt="is not an object",Ut="is nil";function Dt(e,t){return new Promise((function(n,r){var i=setTimeout((function(){r(Error("Promise timed out"))}),t);e.then((function(e){return clearTimeout(i),n(e)})).catch(r)}))}function zt(e,t,n){var r;return(r=n,new Promise((function(e){return setTimeout(e,r)}))).then((function(){return Dt(function(){try{return Promise.resolve(t(e))}catch(e){return Promise.reject(e)}}(),1e3)})).catch((function(t){null==e||e.log("warn","Callback Error",{error:t}),null==e||e.stats.increment("callback_error")})).then((function(){return e}))}var Ft=function(){function e(e){var t;this.callbacks={},this.warned=!1,this.maxListeners=null!==(t=null==e?void 0:e.maxListeners)&&void 0!==t?t:10}return e.prototype.warnIfPossibleMemoryLeak=function(e){this.warned||this.maxListeners&&this.callbacks[e].length>this.maxListeners&&(console.warn("Event Emitter: Possible memory leak detected; ".concat(String(e)," has exceeded ").concat(this.maxListeners," listeners.")),this.warned=!0)},e.prototype.on=function(e,t){return this.callbacks[e]?(this.callbacks[e].push(t),this.warnIfPossibleMemoryLeak(e)):this.callbacks[e]=[t],this},e.prototype.once=function(e,t){var n=this,r=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];n.off(e,r),t.apply(n,i)};return this.on(e,r),this},e.prototype.off=function(e,t){var n,r=(null!==(n=this.callbacks[e])&&void 0!==n?n:[]).filter((function(e){return e!==t}));return this.callbacks[e]=r,this},e.prototype.emit=function(e){for(var t,n=this,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return(null!==(t=this.callbacks[e])&&void 0!==t?t:[]).forEach((function(e){e.apply(n,r)})),this},e}();for(var Bt,Ht="onRemoveFromFuture",qt=function(e){function t(t,n,r){var i=e.call(this)||this;return i.future=[],i.maxAttempts=t,i.queue=n,i.seen=null!=r?r:{},i}return St(t,e),t.prototype.push=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map((function(t){return!(e.updateAttempts(t)>e.maxAttempts||e.includes(t))&&(e.queue.push(t),!0)}));return this.queue=this.queue.sort((function(t,n){return e.getAttempts(t)-e.getAttempts(n)})),r},t.prototype.pushWithBackoff=function(e){var t=this;if(0===this.getAttempts(e))return this.push(e)[0];var n=this.updateAttempts(e);if(n>this.maxAttempts||this.includes(e))return!1;var r=function(e){var t=Math.random()+1,n=e.minTimeout,r=void 0===n?500:n,i=e.factor,o=void 0===i?2:i,s=e.attempt,a=e.maxTimeout,u=void 0===a?1/0:a;return Math.min(t*r*Math.pow(o,s),u)}({attempt:n-1});return setTimeout((function(){t.queue.push(e),t.future=t.future.filter((function(t){return t.id!==e.id})),t.emit(Ht)}),r),this.future.push(e),!0},t.prototype.getAttempts=function(e){var t;return null!==(t=this.seen[e.id])&&void 0!==t?t:0},t.prototype.updateAttempts=function(e){return this.seen[e.id]=this.getAttempts(e)+1,this.getAttempts(e)},t.prototype.includes=function(e){return this.queue.includes(e)||this.future.includes(e)||Boolean(this.queue.find((function(t){return t.id===e.id})))||Boolean(this.future.find((function(t){return t.id===e.id})))},t.prototype.pop=function(){return this.queue.shift()},Object.defineProperty(t.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"todo",{get:function(){return this.queue.length+this.future.length},enumerable:!1,configurable:!0}),t}(Ft),$t=256,Vt=[];$t--;)Vt[$t]=($t+256).toString(16).substring(1);function Wt(){var e,t=0,n="";if(!Bt||$t+16>256){for(Bt=Array(t=256);t--;)Bt[t]=256*Math.random()|0;t=$t=0}for(;t<16;t++)e=Bt[$t+t],n+=6==t?Vt[15&e|64]:8==t?Vt[63&e|128]:Vt[e],1&t&&t>1&&t<11&&(n+="-");return $t++,n}var Kt=function(){function e(){this._logs=[]}return e.prototype.log=function(e,t,n){var r=new Date;this._logs.push({level:e,message:t,time:r,extras:n})},Object.defineProperty(e.prototype,"logs",{get:function(){return this._logs},enumerable:!1,configurable:!0}),e.prototype.flush=function(){if(this.logs.length>1){var e=this._logs.reduce((function(e,t){var n,r,i,o=Ot(Ot({},t),{json:JSON.stringify(t.extras,null," "),extras:t.extras});delete o.time;var s=null!==(i=null===(r=t.time)||void 0===r?void 0:r.toISOString())&&void 0!==i?i:"";return e[s]&&(s="".concat(s,"-").concat(Math.random())),Ot(Ot({},e),((n={})[s]=o,n))}),{});console.table?console.table(e):console.log(e)}else this.logs.forEach((function(e){var t=e.level,n=e.message,r=e.extras;"info"===t||"debug"===t?console.log(n,null!=r?r:""):console[t](n,null!=r?r:"")}));this._logs=[]},e}(),Gt=function(){function e(){this.metrics=[]}return e.prototype.increment=function(e,t,n){void 0===t&&(t=1),this.metrics.push({metric:e,value:t,tags:null!=n?n:[],type:"counter",timestamp:Date.now()})},e.prototype.gauge=function(e,t,n){this.metrics.push({metric:e,value:t,tags:null!=n?n:[],type:"gauge",timestamp:Date.now()})},e.prototype.flush=function(){var e=this.metrics.map((function(e){return Ot(Ot({},e),{tags:e.tags.join(",")})}));console.table?console.table(e):console.log(e),this.metrics=[]},e.prototype.serialize=function(){return this.metrics.map((function(e){return{m:e.metric,v:e.value,t:e.tags,k:(t=e.type,{gauge:"g",counter:"c"}[t]),e:e.timestamp};var t}))},e}(),Yt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return St(t,e),t.prototype.gauge=function(){},t.prototype.increment=function(){},t.prototype.flush=function(){},t.prototype.serialize=function(){return[]},t}(Gt),Qt=function(e){var t,n,r;this.retry=null===(t=e.retry)||void 0===t||t,this.type=null!==(n=e.type)&&void 0!==n?n:"plugin Error",this.reason=null!==(r=e.reason)&&void 0!==r?r:""},Jt=function(){function e(e,t,n,r){void 0===t&&(t=Wt()),void 0===n&&(n=new Yt),void 0===r&&(r=new Kt),this.attempts=0,this.event=e,this._id=t,this.logger=r,this.stats=n}return e.system=function(){},e.prototype.isSame=function(e){return e.id===this.id},e.prototype.cancel=function(e){if(e)throw e;throw new Qt({reason:"Context Cancel"})},e.prototype.log=function(e,t,n){this.logger.log(e,t,n)},Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),e.prototype.updateEvent=function(e,t){var n;if("integrations"===e.split(".")[0]){var r=e.split(".")[1];if(!1===(null===(n=this.event.integrations)||void 0===n?void 0:n[r]))return this.event}return kt(this.event,e,t),this.event},e.prototype.failedDelivery=function(){return this._failedDelivery},e.prototype.setFailedDelivery=function(e){this._failedDelivery=e},e.prototype.logs=function(){return this.logger.logs},e.prototype.flush=function(){this.logger.flush(),this.stats.flush()},e.prototype.toJSON=function(){return{id:this._id,event:this.event,logs:this.logger.logs,metrics:this.stats.metrics}},e}();function Xt(e,t){e.log("debug","plugin",{plugin:t.name});var n=(new Date).getTime(),r=t[e.event.type];if(void 0===r)return Promise.resolve(e);var i=function(e){return It(this,void 0,void 0,(function(){var t;return xt(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:return[2,n.sent()];case 2:return t=n.sent(),[2,Promise.reject(t)];case 3:return[2]}}))}))}((function(){return r.apply(t,[e])})).then((function(e){var r=(new Date).getTime()-n;return e.stats.gauge("plugin_time",r,["plugin:".concat(t.name)]),e})).catch((function(n){if(n instanceof Qt&&"middleware_cancellation"===n.type)throw n;return n instanceof Qt?(e.log("warn",n.type,{plugin:t.name,error:n}),n):(e.log("error","plugin Error",{plugin:t.name,error:n}),e.stats.increment("plugin_error",1,["plugin:".concat(t.name)]),n)}));return i}function Zt(e,t){return Xt(e,t).then((function(t){if(t instanceof Jt)return t;e.log("debug","Context canceled"),e.stats.increment("context_canceled"),e.cancel(t)}))}var en=function(e){function t(t){var n,r,i,o=e.call(this)||this;return o.criticalTasks=(i=0,{done:function(){return n},run:function(e){var t,o=e();return"object"==typeof(t=o)&&null!==t&&"then"in t&&"function"==typeof t.then&&(1==++i&&(n=new Promise((function(e){return r=e}))),o.finally((function(){return 0==--i&&r()}))),o}}),o.plugins=[],o.failedInitializations=[],o.flushing=!1,o.queue=t,o.queue.on(Ht,(function(){o.scheduleFlush(0)})),o}return St(t,e),t.prototype.register=function(e,t,n){return It(this,void 0,void 0,(function(){var r=this;return xt(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve(t.load(e,n)).then((function(){r.plugins.push(t)})).catch((function(n){if("destination"===t.type)return r.failedInitializations.push(t.name),console.warn(t.name,n),void e.log("warn","Failed to load destination",{plugin:t.name,error:n});throw n}))];case 1:return i.sent(),[2]}}))}))},t.prototype.deregister=function(e,t,n){return It(this,void 0,void 0,(function(){var r;return xt(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),t.unload?[4,Promise.resolve(t.unload(e,n))]:[3,2];case 1:i.sent(),i.label=2;case 2:return this.plugins=this.plugins.filter((function(e){return e.name!==t.name})),[3,4];case 3:return r=i.sent(),e.log("warn","Failed to unload destination",{plugin:t.name,error:r}),[3,4];case 4:return[2]}}))}))},t.prototype.dispatch=function(e){return It(this,void 0,void 0,(function(){var t;return xt(this,(function(n){return e.log("debug","Dispatching"),e.stats.increment("message_dispatched"),this.queue.push(e),t=this.subscribeToDelivery(e),this.scheduleFlush(0),[2,t]}))}))},t.prototype.subscribeToDelivery=function(e){return It(this,void 0,void 0,(function(){var t=this;return xt(this,(function(n){return[2,new Promise((function(n){var r=function(i,o){i.isSame(e)&&(t.off("flush",r),n(i))};t.on("flush",r)}))]}))}))},t.prototype.dispatchSingle=function(e){return It(this,void 0,void 0,(function(){var t=this;return xt(this,(function(n){return e.log("debug","Dispatching"),e.stats.increment("message_dispatched"),this.queue.updateAttempts(e),e.attempts=1,[2,this.deliver(e).catch((function(n){return t.enqueuRetry(n,e)?t.subscribeToDelivery(e):(e.setFailedDelivery({reason:n}),e)}))]}))}))},t.prototype.isEmpty=function(){return 0===this.queue.length},t.prototype.scheduleFlush=function(e){var t=this;void 0===e&&(e=500),this.flushing||(this.flushing=!0,setTimeout((function(){t.flush().then((function(){setTimeout((function(){t.flushing=!1,t.queue.length&&t.scheduleFlush(0)}),0)}))}),e))},t.prototype.deliver=function(e){return It(this,void 0,void 0,(function(){var t,n,r,i;return xt(this,(function(o){switch(o.label){case 0:return[4,this.criticalTasks.done()];case 1:o.sent(),t=Date.now(),o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.flushOne(e)];case 3:return e=o.sent(),n=Date.now()-t,this.emit("delivery_success",e),e.stats.gauge("delivered",n),e.log("debug","Delivered",e.event),[2,e];case 4:throw r=o.sent(),i=r,e.log("error","Failed to deliver",i),this.emit("delivery_failure",e,i),e.stats.increment("delivery_failed"),r;case 5:return[2]}}))}))},t.prototype.enqueuRetry=function(e,t){return!(e instanceof Qt&&!e.retry)&&this.queue.pushWithBackoff(t)},t.prototype.flush=function(){return It(this,void 0,void 0,(function(){var e,t;return xt(this,(function(n){switch(n.label){case 0:if(0===this.queue.length)return[2,[]];if(!(e=this.queue.pop()))return[2,[]];e.attempts=this.queue.getAttempts(e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.deliver(e)];case 2:return e=n.sent(),this.emit("flush",e,!0),[3,4];case 3:return t=n.sent(),this.enqueuRetry(t,e)||(e.setFailedDelivery({reason:t}),this.emit("flush",e,!1)),[2,[]];case 4:return[2,[e]]}}))}))},t.prototype.isReady=function(){return!0},t.prototype.availableExtensions=function(e){var t,n,r=this.plugins.filter((function(t){var n,r,i;if("destination"!==t.type&&"Segment.io"!==t.name)return!0;var o=void 0;return null===(n=t.alternativeNames)||void 0===n||n.forEach((function(t){void 0!==e[t]&&(o=e[t])})),null!==(i=null!==(r=e[t.name])&&void 0!==r?r:o)&&void 0!==i?i:!1!==("Segment.io"===t.name||e.All)})),i=(t="type",n={},r.forEach((function(e){var r,i=void 0;if("string"==typeof t){var o=e[t];i="string"!=typeof o?JSON.stringify(o):o}else t instanceof Function&&(i=t(e));void 0!==i&&(n[i]=Rt(Rt([],null!==(r=n[i])&&void 0!==r?r:[],!0),[e],!1))})),n),o=i.before,s=void 0===o?[]:o,a=i.enrichment,u=void 0===a?[]:a,c=i.destination,l=void 0===c?[]:c,f=i.after;return{before:s,enrichment:u,destinations:l,after:void 0===f?[]:f}},t.prototype.flushOne=function(e){var t,n;return It(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f,h,d,p,g,y;return xt(this,(function(v){switch(v.label){case 0:if(!this.isReady())throw new Error("Not ready");e.attempts>1&&this.emit("delivery_retry",e),r=this.availableExtensions(null!==(t=e.event.integrations)&&void 0!==t?t:{}),i=r.before,o=r.enrichment,s=0,a=i,v.label=1;case 1:return s<a.length?(u=a[s],[4,Zt(e,u)]):[3,4];case 2:(h=v.sent())instanceof Jt&&(e=h),this.emit("message_enriched",e,u),v.label=3;case 3:return s++,[3,1];case 4:c=0,l=o,v.label=5;case 5:return c<l.length?(f=l[c],[4,Xt(e,f)]):[3,8];case 6:(h=v.sent())instanceof Jt&&(e=h),this.emit("message_enriched",e,f),v.label=7;case 7:return c++,[3,5];case 8:return d=this.availableExtensions(null!==(n=e.event.integrations)&&void 0!==n?n:{}),p=d.destinations,g=d.after,[4,new Promise((function(t,n){setTimeout((function(){var r=p.map((function(t){return Xt(e,t)}));Promise.all(r).then(t).catch(n)}),0)}))];case 9:return v.sent(),e.stats.increment("message_delivered"),this.emit("message_delivered",e),y=g.map((function(t){return Xt(e,t)})),[4,Promise.all(y)];case 10:return v.sent(),[2,e]}}))}))},t}(Ft);function tn(e,t,n,r){return It(this,void 0,void 0,(function(){var i,o;return xt(this,(function(s){switch(s.label){case 0:return n.emit("dispatch_start",e),i=Date.now(),t.isEmpty()?[4,t.dispatchSingle(e)]:[3,2];case 1:return o=s.sent(),[3,4];case 2:return[4,t.dispatch(e)];case 3:o=s.sent(),s.label=4;case 4:return(null==r?void 0:r.callback)?[4,zt(o,r.callback,(a=i,u=r.timeout,c=Date.now()-a,Math.max((null!=u?u:300)-c,0)))]:[3,6];case 5:o=s.sent(),s.label=6;case 6:return(null==r?void 0:r.debug)&&o.flush(),[2,o]}var a,u,c}))}))}function nn(e,t,n,r){var i,o=[e,t,n,r],s=Mt(e)?e.event:e;if(!s||!Pt(s))throw new Error("Event missing");var a=Mt(e)?null!==(i=e.properties)&&void 0!==i?i:{}:Mt(t)?t:{},u={};return Nt(n)||(u=null!=n?n:{}),Mt(e)&&!Nt(t)&&(u=null!=t?t:{}),[s,a,u,o.find(Nt)]}function rn(e,t,n,r,i){var o,s,a=null,u=null,c=[e,t,n,r,i],l=c.filter(Pt);void 0!==l[0]&&void 0!==l[1]&&(a=l[0],u=l[1]),1===l.length&&(a=null,u=l[0]);var f=c.find(Nt),h=c.filter((function(e){return null===u?Mt(e):Mt(e)||null===e})),d=null!==(o=h[0])&&void 0!==o?o:{},p=null!==(s=h[1])&&void 0!==s?s:{};return[a,u,d,p,f]}var on=function(e){return function(){for(var t,n,r,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];for(var s={},a=["callback","options","traits","id"],u=0,c=i;u<c.length;u++){var l=c[u],f=a.pop();if("id"===f){if(Pt(l)||At(l)){s.id=l.toString();continue}if(null==l)continue;f=a.pop()}if("traits"!==f&&"options"!==f||null!=l&&!Mt(l)||(s[f]=l),Nt(l)){s.callback=l;break}}return[null!==(t=s.id)&&void 0!==t?t:e.id(),null!==(n=s.traits)&&void 0!==n?n:{},null!==(r=s.options)&&void 0!==r?r:{},s.callback]}};function sn(e,t,n,r){At(e)&&(e=e.toString()),At(t)&&(t=t.toString());var i=[e,t,n,r],o=i.filter(Pt),s=o[0],a=void 0===s?e:s,u=o[1],c=void 0===u?null:u,l=i.filter(Mt)[0];return[a,c,void 0===l?{}:l,i.find(Nt)]}function an(){return"undefined"!=typeof window}function un(){return!an()}function cn(){return!an()||window.navigator.onLine}function ln(){return!cn()}function fn(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}var hn=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:null},dn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=hn();return(n&&n.fetch||fn).apply(void 0,e)},pn="1.62.0";var gn="api.segment.io/v1";function yn(e){console.error("Error sending segment performance metrics",e)}var vn,mn=function(){function e(e){var t,n,r,i,o=this;if(this.host=null!==(t=null==e?void 0:e.host)&&void 0!==t?t:gn,this.sampleRate=null!==(n=null==e?void 0:e.sampleRate)&&void 0!==n?n:1,this.flushTimer=null!==(r=null==e?void 0:e.flushTimer)&&void 0!==r?r:3e4,this.maxQueueSize=null!==(i=null==e?void 0:e.maxQueueSize)&&void 0!==i?i:20,this.queue=[],this.sampleRate>0){var s=!1,a=function(){s||(s=!0,o.flush().catch(yn),s=!1,setTimeout(a,o.flushTimer))};a()}}return e.prototype.increment=function(e,t){if(e.includes("analytics_js.")&&0!==t.length&&!(Math.random()>this.sampleRate||this.queue.length>=this.maxQueueSize)){var n=function(e,t,n){var r=t.reduce((function(e,t){var n=t.split(":"),r=n[0],i=n[1];return e[r]=i,e}),{});return{type:"Counter",metric:e,value:1,tags:vt(vt({},r),{library:"analytics.js",library_version:"web"===n?"next-".concat(pn):"npm:next-".concat(pn)})}}(e,t,"npm");this.queue.push(n),e.includes("error")&&this.flush().catch(yn)}},e.prototype.flush=function(){return _t(this,void 0,void 0,(function(){var e=this;return bt(this,(function(t){switch(t.label){case 0:return this.queue.length<=0?[2]:[4,this.send().catch((function(t){yn(t),e.sampleRate=0}))];case 1:return t.sent(),[2]}}))}))},e.prototype.send=function(){return _t(this,void 0,void 0,(function(){var e,t,n;return bt(this,(function(r){return e={series:this.queue},this.queue=[],t={"Content-Type":"text/plain"},n="https://".concat(this.host,"/m"),[2,dn(n,{headers:t,body:JSON.stringify(e),method:"POST"})]}))}))},e}(),_n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return yt(t,e),t.initRemoteMetrics=function(e){vn=new mn(e)},t.prototype.increment=function(t,n,r){e.prototype.increment.call(this,t,n,r),null==vn||vn.increment(t,null!=r?r:[])},t}(Gt),bn=function(e){function t(t,n){return e.call(this,t,n,new _n)||this}return yt(t,e),t.system=function(){return new this({type:"track",event:"system"})},t}(Jt),wn={exports:{}};!function(e,t){e.exports=function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],i=e[2],o=e[3];r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&i)+t[1]-389564586|0)<<12|o>>>20)+n|0)&n|~o&r)+t[2]+606105819|0)<<17|i>>>15)+o|0)&o|~i&n)+t[3]-1044525330|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&i)+t[5]+1200080426|0)<<12|o>>>20)+n|0)&n|~o&r)+t[6]-1473231341|0)<<17|i>>>15)+o|0)&o|~i&n)+t[7]-45705983|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&i)+t[9]-1958414417|0)<<12|o>>>20)+n|0)&n|~o&r)+t[10]-42063|0)<<17|i>>>15)+o|0)&o|~i&n)+t[11]-1990404162|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&i)+t[13]-40341101|0)<<12|o>>>20)+n|0)&n|~o&r)+t[14]-1502002290|0)<<17|i>>>15)+o|0)&o|~i&n)+t[15]+1236535329|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[1]-165796510|0)<<5|n>>>27)+r|0)&i|r&~i)+t[6]-1069501632|0)<<9|o>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|i>>>18)+o|0)&n|o&~n)+t[0]-373897302|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[5]-701558691|0)<<5|n>>>27)+r|0)&i|r&~i)+t[10]+38016083|0)<<9|o>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|i>>>18)+o|0)&n|o&~n)+t[4]-405537848|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[9]+568446438|0)<<5|n>>>27)+r|0)&i|r&~i)+t[14]-1019803690|0)<<9|o>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|i>>>18)+o|0)&n|o&~n)+t[8]+1163531501|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&i|r&~i)+t[2]-51403784|0)<<9|o>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|i>>>18)+o|0)&n|o&~n)+t[12]-1926607734|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^i)+t[8]-2022574463|0)<<11|o>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|i>>>16)+o|0)^o^n)+t[14]-35309556|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^i)+t[4]+1272893353|0)<<11|o>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|i>>>16)+o|0)^o^n)+t[10]-1094730640|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^i)+t[0]-358537222|0)<<11|o>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|i>>>16)+o|0)^o^n)+t[6]+76029189|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^i)+t[12]-421815835|0)<<11|o>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|i>>>16)+o|0)^o^n)+t[2]-995338651|0)<<23|r>>>9)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~i))+t[7]+1126891415|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[14]-1416354905|0)<<15|i>>>17)+o|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~i))+t[3]-1894986606|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[10]-1051523|0)<<15|i>>>17)+o|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~i))+t[15]-30611744|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[6]-1560198380|0)<<15|i>>>17)+o|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~i))+t[11]-1120210379|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[2]+718787259|0)<<15|i>>>17)+o|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+i|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=i+e[2]|0,e[3]=o+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function i(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function o(e){var t,i,o,s,a,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(l,r(e.substring(t-64,t)));for(i=(e=e.substring(t-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<i;t+=1)o[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(l,o),t=0;t<16;t+=1)o[t]=0;return s=(s=8*c).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(s[2],16),u=parseInt(s[1],16)||0,o[14]=a,o[15]=u,n(l,o),l}function s(e){var t,r,o,s,a,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(l,i(e.subarray(t-64,t)));for(r=(e=t-64<c?e.subarray(t-64):new Uint8Array(0)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)o[t>>2]|=e[t]<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(l,o),t=0;t<16;t+=1)o[t]=0;return s=(s=8*c).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(s[2],16),u=parseInt(s[1],16)||0,o[14]=a,o[15]=u,n(l,o),l}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function u(e){var t;for(t=0;t<e.length;t+=1)e[t]=a(e[t]);return e.join("")}function c(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function l(e,t){var n,r=e.length,i=new ArrayBuffer(r),o=new Uint8Array(i);for(n=0;n<r;n+=1)o[n]=e.charCodeAt(n);return t?o:i}function f(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function h(e,t,n){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e)),r.set(new Uint8Array(t),e.byteLength),n?r:r.buffer}function d(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function p(){this.reset()}return u(o("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,s,a,u=this.byteLength,c=t(n,u),l=u;return r!==e&&(l=t(r,u)),c>l?new ArrayBuffer(0):(i=l-c,o=new ArrayBuffer(i),s=new Uint8Array(o),a=new Uint8Array(this,c,i),s.set(a),o)}}(),p.prototype.append=function(e){return this.appendBinary(c(e)),this},p.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,i=this._buff.length;for(t=64;t<=i;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},p.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)o[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=u(this._hash),e&&(n=d(n)),this.reset(),n},p.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},p.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},p.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},p.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},p.prototype._finish=function(e,t){var r,i,o,s=t;if(e[s>>2]|=128<<(s%4<<3),s>55)for(n(this._hash,e),s=0;s<16;s+=1)e[s]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(r[2],16),o=parseInt(r[1],16)||0,e[14]=i,e[15]=o,n(this._hash,e)},p.hash=function(e,t){return p.hashBinary(c(e),t)},p.hashBinary=function(e,t){var n=u(o(e));return t?d(n):n},p.ArrayBuffer=function(){this.reset()},p.ArrayBuffer.prototype.append=function(e){var t,r=h(this._buff.buffer,e,!0),o=r.length;for(this._length+=e.byteLength,t=64;t<=o;t+=64)n(this._hash,i(r.subarray(t-64,t)));return this._buff=t-64<o?new Uint8Array(r.buffer.slice(t-64)):new Uint8Array(0),this},p.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)o[t>>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=u(this._hash),e&&(n=d(n)),this.reset(),n},p.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},p.ArrayBuffer.prototype.getState=function(){var e=p.prototype.getState.call(this);return e.buff=f(e.buff),e},p.ArrayBuffer.prototype.setState=function(e){return e.buff=l(e.buff,!0),p.prototype.setState.call(this,e)},p.ArrayBuffer.prototype.destroy=p.prototype.destroy,p.ArrayBuffer.prototype._finish=p.prototype._finish,p.ArrayBuffer.hash=function(e,t){var n=u(s(new Uint8Array(e)));return t?d(n):n},p}()}(wn);var En=wn.exports,Sn=function(e,t,n,r,i,o){return{__t:"bpc",c:t,p:r,u:e,s:n,t:i,r:o}},On=Object.keys(Sn("","","","","",""));var In=function(e){var t,n,r=e.c,i=e.p,o=e.s,s=e.u,a=e.r,u=e.t,c=r?function(e){try{return new URL(e).pathname}catch(t){return"/"===e[0]?e:"/"+e}}(r):i,l=r?function(e,t){return e.indexOf("?")>-1?e:e+t}(r,o):-1===(n=(t=s).indexOf("#"))?t:t.slice(0,n);return{path:c,referrer:a,search:o,title:u,url:l}},xn=function(){var e=document.querySelector("link[rel='canonical']");return Sn(location.href,e&&e.getAttribute("href")||void 0,location.search,location.pathname,document.title,document.referrer)};var Rn=function(e,t){void 0===t&&(t=In(xn()));var n,r,i,o=e.context;"page"===e.type&&(n=e.properties&&(r=e.properties,i=Object.keys(t),Object.assign.apply(Object,wt([{}],i.map((function(e){var t;if(r&&Object.prototype.hasOwnProperty.call(r,e))return(t={})[e]=r[e],t})),!1))),e.properties=vt(vt(vt({},t),e.properties),e.name?{name:e.name}:{})),o.page=vt(vt(vt({},t),n),o.page)},kn=function(){function e(e){this.user=e}return e.prototype.track=function(e,t,n,r,i){return this.normalize(vt(vt({},this.baseEvent()),{event:e,type:"track",properties:t,options:vt({},n),integrations:vt({},r)}),i)},e.prototype.page=function(e,t,n,r,i,o){var s,a={type:"page",properties:vt({},n),options:vt({},r),integrations:vt({},i)};return null!==e&&(a.category=e,a.properties=null!==(s=a.properties)&&void 0!==s?s:{},a.properties.category=e),null!==t&&(a.name=t),this.normalize(vt(vt({},this.baseEvent()),a),o)},e.prototype.screen=function(e,t,n,r,i,o){var s={type:"screen",properties:vt({},n),options:vt({},r),integrations:vt({},i)};return null!==e&&(s.category=e),null!==t&&(s.name=t),this.normalize(vt(vt({},this.baseEvent()),s),o)},e.prototype.identify=function(e,t,n,r,i){return this.normalize(vt(vt({},this.baseEvent()),{type:"identify",userId:e,traits:t,options:vt({},n),integrations:vt({},r)}),i)},e.prototype.group=function(e,t,n,r,i){return this.normalize(vt(vt({},this.baseEvent()),{type:"group",traits:t,options:vt({},n),integrations:vt({},r),groupId:e}),i)},e.prototype.alias=function(e,t,n,r,i){var o={userId:e,type:"alias",options:vt({},n),integrations:vt({},r)};return null!==t&&(o.previousId=t),void 0===e?this.normalize(vt(vt({},o),this.baseEvent())):this.normalize(vt(vt({},this.baseEvent()),o),i)},e.prototype.baseEvent=function(){var e={integrations:{},options:{}},t=this.user;return t.id()&&(e.userId=t.id()),t.anonymousId()&&(e.anonymousId=t.anonymousId()),e},e.prototype.context=function(e){var t,n,r,i=["integrations","anonymousId","timestamp","userId"],o=null!==(t=e.options)&&void 0!==t?t:{};delete o.integrations;var s=Object.keys(o),a=null!==(r=null===(n=e.options)||void 0===n?void 0:n.context)&&void 0!==r?r:{},u={};return s.forEach((function(e){"context"!==e&&(i.includes(e)?kt(u,e,o[e]):kt(a,e,o[e]))})),[a,u]},e.prototype.normalize=function(e,t){var n,r,i;(null===(n=e.options)||void 0===n?void 0:n.anonymousId)&&this.user.anonymousId(e.options.anonymousId);var o=Object.keys(null!==(r=e.integrations)&&void 0!==r?r:{}).reduce((function(t,n){var r,i;return vt(vt({},t),((r={})[n]=Boolean(null===(i=e.integrations)||void 0===i?void 0:i[n]),r))}),{}),s=vt(vt({},o),null===(i=e.options)||void 0===i?void 0:i.integrations),a=this.context(e),u=a[0],c=a[1];e.options;var l=mt(e,["options"]),f=vt(vt(vt(vt({timestamp:new Date},l),{context:u,integrations:s}),c),{messageId:"ajs-next-"+En.hash(JSON.stringify(e)+Wt())});return Rn(f,t),f},e}(),Cn={getItem:function(){},setItem:function(){},removeItem:function(){}};try{Cn=an()&&window.localStorage?window.localStorage:Cn}catch(e){console.warn("Unable to access localStorage",e)}function Pn(e){var t=Cn.getItem(e);return(t?JSON.parse(t):[]).map((function(e){return new bn(e.event,e.id)}))}function An(e){var t=Cn.getItem(e);return t?JSON.parse(t):{}}function Nn(e){Cn.removeItem(e)}function Tn(e,t,n){void 0===n&&(n=0);var r="persisted-queue:v1:".concat(e,":lock"),i=Cn.getItem(r),o=i?JSON.parse(i):null,s=null===o||function(e){return(new Date).getTime()>e}(o);if(s)return Cn.setItem(r,JSON.stringify((new Date).getTime()+50)),t(),void Cn.removeItem(r);!s&&n<3?setTimeout((function(){Tn(e,t,n+1)}),50):console.error("Unable to retrieve lock")}var Mn=function(e){function t(t,n){var r=e.call(this,t,[])||this,i="persisted-queue:v1:".concat(n,":items"),o="persisted-queue:v1:".concat(n,":seen"),s=[],a={};return Tn(n,(function(){try{s=Pn(i),a=An(o),Nn(i),Nn(o),r.queue=wt(wt([],s,!0),r.queue,!0),r.seen=vt(vt({},a),r.seen)}catch(e){console.error(e)}})),window.addEventListener("pagehide",(function(){if(r.todo>0){var e=wt(wt([],r.queue,!0),r.future,!0);try{Tn(n,(function(){!function(e,t){var n=Pn(e),r=wt(wt([],t,!0),n,!0).reduce((function(e,t){var n;return vt(vt({},e),((n={})[t.id]=t,n))}),{});Cn.setItem(e,JSON.stringify(Object.values(r)))}(i,e),function(e,t){var n=An(e);Cn.setItem(e,JSON.stringify(vt(vt({},n),t)))}(o,r.seen)}))}catch(e){console.error(e)}}})),r}return yt(t,e),t}(qt),Ln=function(e){function t(t){return e.call(this,"string"==typeof t?new Mn(4,t):t)||this}return yt(t,e),t.prototype.flush=function(){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){return ln()?[2,[]]:[2,e.prototype.flush.call(this)]}))}))},t}(en);function jn(e){for(var t=e.constructor.prototype,n=0,r=Object.getOwnPropertyNames(t);n<r.length;n++){var i=r[n];if("constructor"!==i){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,i);o&&"function"==typeof o.value&&(e[i]=e[i].bind(e))}}return e}/*! js-cookie v3.0.1 | MIT */function Un(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var Dn=function e(t,n){function r(e,r,i){if("undefined"!=typeof document){"number"==typeof(i=Un({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var s in i)i[s]&&(o+="; "+s,!0!==i[s]&&(o+="="+i[s].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+o}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},i=0;i<n.length;i++){var o=n[i].split("="),s=o.slice(1).join("=");try{var a=decodeURIComponent(o[0]);if(r[a]=t.read(s,a),e===a)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",Un({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,Un({},this.attributes,t))},withConverter:function(t){return e(Un({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});function zn(e){var t=function(e){try{return new URL(e)}catch(e){return}}(e);if(t)for(var n=function(e){var t=e.hostname.split("."),n=t[t.length-1],r=[];if(4===t.length&&parseInt(n,10)>0)return r;if(t.length<=1)return r;for(var i=t.length-2;i>=0;--i)r.push(t.slice(i).join("."));return r}(t),r=0;r<n.length;++r){var i="__tld__",o=n[r],s={domain:"."+o};try{if(Dn.set(i,"1",s),Dn.get(i))return Dn.remove(i,s),o}catch(e){return}}}var Fn=function(){function e(t){void 0===t&&(t=e.defaults),this.options=vt(vt({},e.defaults),t)}return Object.defineProperty(e,"defaults",{get:function(){return{maxage:365,domain:zn(window.location.href),path:"/",sameSite:"Lax"}},enumerable:!1,configurable:!0}),e.prototype.opts=function(){return{sameSite:this.options.sameSite,expires:this.options.maxage,domain:this.options.domain,path:this.options.path,secure:this.options.secure}},e.prototype.get=function(e){var t;try{var n=Dn.get(e);if(null==n)return null;try{return null!==(t=JSON.parse(n))&&void 0!==t?t:null}catch(e){return null!=n?n:null}}catch(e){return null}},e.prototype.set=function(e,t){"string"==typeof t?Dn.set(e,t,this.opts()):null===t?Dn.remove(e,this.opts()):Dn.set(e,JSON.stringify(t),this.opts())},e.prototype.remove=function(e){return Dn.remove(e,this.opts())},e}(),Bn=function(){function e(){}return e.prototype.localStorageWarning=function(e,t){console.warn("Unable to access ".concat(e,", localStorage may be ").concat(t))},e.prototype.get=function(e){var t;try{var n=localStorage.getItem(e);if(null===n)return null;try{return null!==(t=JSON.parse(n))&&void 0!==t?t:null}catch(e){return null!=n?n:null}}catch(t){return this.localStorageWarning(e,"unavailable"),null}},e.prototype.set=function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(t){this.localStorageWarning(e,"full")}},e.prototype.remove=function(e){try{return localStorage.removeItem(e)}catch(t){this.localStorageWarning(e,"unavailable")}},e}(),Hn=function(){function e(){this.cache={}}return e.prototype.get=function(e){var t;return null!==(t=this.cache[e])&&void 0!==t?t:null},e.prototype.set=function(e,t){this.cache[e]=t},e.prototype.remove=function(e){delete this.cache[e]},e}(),qn={Cookie:"cookie",LocalStorage:"localStorage",Memory:"memory"};function $n(e){return e&&e.stores&&Array.isArray(e.stores)&&e.stores.every((function(e){return Object.values(qn).includes(e)}))}var Vn=function(e,t,n,r){console.warn("".concat(e.constructor.name,": Can't ").concat(t,' key "').concat(n,'" | Err: ').concat(r))},Wn=function(){function e(e){this.stores=e}return e.prototype.get=function(e){for(var t=null,n=0,r=this.stores;n<r.length;n++){var i=r[n];try{if(null!=(t=i.get(e)))return t}catch(t){Vn(i,"get",e,t)}}return null},e.prototype.set=function(e,t){this.stores.forEach((function(n){try{n.set(e,t)}catch(t){Vn(n,"set",e,t)}}))},e.prototype.clear=function(e){this.stores.forEach((function(t){try{t.remove(e)}catch(n){Vn(t,"remove",e,n)}}))},e.prototype.getAndSync=function(e){var t=this.get(e),n="number"==typeof t?t.toString():t;return this.set(e,n),n},e}();function Kn(e){return e.map((function(e){var t,n;switch(!function(e){return"object"==typeof e&&void 0!==e.name}(e)?t=e:(t=e.name,n=e.settings),t){case qn.Cookie:return new Fn(n);case qn.LocalStorage:return new Bn;case qn.Memory:return new Hn;default:throw new Error("Unknown Store Type: ".concat(e))}}))}function Gn(e,t){return e.map((function(e){return t&&e===qn.Cookie?{name:e,settings:t}:e}))}var Yn={persist:!0,cookie:{key:"ajs_user_id",oldKey:"ajs_user"},localStorage:{key:"ajs_user_traits"}},Qn=function(){function e(e,t){void 0===e&&(e=Yn);var n,r,i,o,s=this;this.options={},this.id=function(e){if(s.options.disable)return null;var t=s.identityStore.getAndSync(s.idKey);void 0!==e&&(s.identityStore.set(s.idKey,e),e!==t&&null!==t&&null!==e&&s.anonymousId(null));var n=s.identityStore.getAndSync(s.idKey);if(n)return n;var r=s.legacyUserStore.get(Yn.cookie.oldKey);return r?"object"==typeof r?r.id:r:null},this.anonymousId=function(e){var t,n;if(s.options.disable)return null;if(void 0===e){var r=null!==(t=s.identityStore.getAndSync(s.anonKey))&&void 0!==t?t:null===(n=s.legacySIO())||void 0===n?void 0:n[0];if(r)return r}return null===e?(s.identityStore.set(s.anonKey,null),s.identityStore.getAndSync(s.anonKey)):(s.identityStore.set(s.anonKey,null!=e?e:Wt()),s.identityStore.getAndSync(s.anonKey))},this.traits=function(e){var t;if(!s.options.disable)return null===e&&(e={}),e&&s.traitsStore.set(s.traitsKey,null!=e?e:{}),null!==(t=s.traitsStore.get(s.traitsKey))&&void 0!==t?t:{}},this.options=vt(vt({},Yn),e),this.cookieOptions=t,this.idKey=null!==(r=null===(n=e.cookie)||void 0===n?void 0:n.key)&&void 0!==r?r:Yn.cookie.key,this.traitsKey=null!==(o=null===(i=e.localStorage)||void 0===i?void 0:i.key)&&void 0!==o?o:Yn.localStorage.key,this.anonKey="ajs_anonymous_id",this.identityStore=this.createStorage(this.options,t),this.legacyUserStore=this.createStorage(this.options,t,(function(e){return e===qn.Cookie})),this.traitsStore=this.createStorage(this.options,t,(function(e){return e!==qn.Cookie}));var a=this.legacyUserStore.get(Yn.cookie.oldKey);a&&"object"==typeof a&&(a.id&&this.id(a.id),a.traits&&this.traits(a.traits)),jn(this)}return e.prototype.legacySIO=function(){var e=this.legacyUserStore.get("_sio");if(!e)return null;var t=e.split("----");return[t[0],t[1]]},e.prototype.identify=function(e,t){if(!this.options.disable){t=null!=t?t:{};var n=this.id();null!==n&&n!==e||(t=vt(vt({},this.traits()),t)),e&&this.id(e),this.traits(t)}},e.prototype.logout=function(){this.anonymousId(null),this.id(null),this.traits({})},e.prototype.reset=function(){this.logout(),this.identityStore.clear(this.idKey),this.identityStore.clear(this.anonKey),this.traitsStore.clear(this.traitsKey)},e.prototype.load=function(){return new e(this.options,this.cookieOptions)},e.prototype.save=function(){return!0},e.prototype.createStorage=function(e,t,n){var r=[qn.LocalStorage,qn.Cookie,qn.Memory];return e.disable?new Wn([]):e.persist?(void 0!==e.storage&&null!==e.storage&&$n(e.storage)&&(r=e.storage.stores),e.localStorageFallbackDisabled&&(r=r.filter((function(e){return e!==qn.LocalStorage}))),n&&(r=r.filter(n)),new Wn(Kn(Gn(r,t)))):new Wn([new Hn])},e.defaults=Yn,e}(),Jn={persist:!0,cookie:{key:"ajs_group_id"},localStorage:{key:"ajs_group_properties"}},Xn=function(e){function t(t,n){void 0===t&&(t=Jn);var r=e.call(this,vt(vt({},Jn),t),n)||this;return r.anonymousId=function(e){},jn(r),r}return yt(t,e),t}(Qn),Zn="analytics";function er(){return window[Zn]}var tr=function(e,t,n){n.getCalls(e).forEach((function(e){lr(t,e).catch(console.error)}))},nr=function(e,t){return _t(void 0,void 0,void 0,(function(){var n,r,i;return bt(this,(function(o){switch(o.label){case 0:n=0,r=t.getCalls("addSourceMiddleware"),o.label=1;case 1:return n<r.length?(i=r[n],[4,lr(e,i).catch(console.error)]):[3,4];case 2:o.sent(),o.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},rr=tr.bind(void 0,"on"),ir=tr.bind(void 0,"setAnonymousId"),or=function(e,t){t.toArray().forEach((function(t){setTimeout((function(){lr(e,t).catch(console.error)}),0)}))},sr=function(e){if(ar(e)){var t=e.pop();return In(t)}},ar=function(e){return function(e){if(!Mt(e))return!1;if("bpc"!==e.__t)return!1;for(var t in e)if(!On.includes(t))return!1;return!0}(e[e.length-1])},ur=function(e,t,n,r){void 0===n&&(n=function(){}),void 0===r&&(r=console.error),this.method=e,this.resolve=n,this.reject=r,this.called=!1,this.args=t},cr=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._callMap={},this.push.apply(this,e)}return Object.defineProperty(e.prototype,"calls",{get:function(){return this._pushSnippetWindowBuffer(),this._callMap},set:function(e){this._callMap=e},enumerable:!1,configurable:!0}),e.prototype.getCalls=function(e){var t;return null!==(t=this.calls[e])&&void 0!==t?t:[]},e.prototype.push=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.forEach((function(t){["track","screen","alias","group","page","identify"].includes(t.method)&&!ar(t.args)&&(t.args=wt(wt([],t.args,!0),[xn()],!1)),e.calls[t.method]?e.calls[t.method].push(t):e.calls[t.method]=[t]}))},e.prototype.clear=function(){this._pushSnippetWindowBuffer(),this.calls={}},e.prototype.toArray=function(){var e;return(e=[]).concat.apply(e,Object.values(this.calls))},e.prototype._pushSnippetWindowBuffer=function(){var e=er();if(Array.isArray(e)){var t=e.splice(0,e.length).map((function(e){var t=e[0],n=e.slice(1);return new ur(t,n)}));this.push.apply(this,t)}},e}();function lr(e,t){return _t(this,void 0,void 0,(function(){var n,r;return bt(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),t.called?[2,void 0]:(t.called=!0,n=e[t.method].apply(e,t.args),"object"==typeof(o=n)&&null!==o&&"then"in o&&"function"==typeof o.then?[4,n]:[3,2]);case 1:i.sent(),i.label=2;case 2:return t.resolve(n),[3,4];case 3:return r=i.sent(),t.reject(r),[3,4];case 4:return[2]}var o}))}))}var fr=function(){function e(e){var t=this;this.trackSubmit=this._createMethod("trackSubmit"),this.trackClick=this._createMethod("trackClick"),this.trackLink=this._createMethod("trackLink"),this.pageView=this._createMethod("pageview"),this.identify=this._createMethod("identify"),this.reset=this._createMethod("reset"),this.group=this._createMethod("group"),this.track=this._createMethod("track"),this.ready=this._createMethod("ready"),this.alias=this._createMethod("alias"),this.debug=this._createChainableMethod("debug"),this.page=this._createMethod("page"),this.once=this._createChainableMethod("once"),this.off=this._createChainableMethod("off"),this.on=this._createChainableMethod("on"),this.addSourceMiddleware=this._createMethod("addSourceMiddleware"),this.setAnonymousId=this._createMethod("setAnonymousId"),this.addDestinationMiddleware=this._createMethod("addDestinationMiddleware"),this.screen=this._createMethod("screen"),this.register=this._createMethod("register"),this.deregister=this._createMethod("deregister"),this.user=this._createMethod("user"),this.VERSION=pn,this._preInitBuffer=new cr,this._promise=e(this._preInitBuffer),this._promise.then((function(e){var n=e[0],r=e[1];t.instance=n,t.ctx=r})).catch((function(){}))}return e.prototype.then=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).then.apply(e,t)},e.prototype.catch=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).catch.apply(e,t)},e.prototype.finally=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).finally.apply(e,t)},e.prototype._createMethod=function(e){var t=this;return function(){for(var n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];if(t.instance){var o=(n=t.instance)[e].apply(n,r);return Promise.resolve(o)}return new Promise((function(n,i){t._preInitBuffer.push(new ur(e,r,n,i))}))}},e.prototype._createChainableMethod=function(e){var t=this;return function(){for(var n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return t.instance?((n=t.instance)[e].apply(n,r),t):(t._preInitBuffer.push(new ur(e,r)),t)}},e}(),hr="This is being deprecated and will be not be available in future releases of Analytics JS",dr=hn(),pr=null==dr?void 0:dr.analytics;function gr(){console.warn(hr)}var yr=function(e){function t(t,n,r,i,o){var s,a,u,c=this;(c=e.call(this)||this)._debug=!1,c.initialized=!1,c.user=function(){return c._user},c.init=c.initialize.bind(c),c.log=gr,c.addIntegrationMiddleware=gr,c.listeners=gr,c.addEventListener=gr,c.removeAllListeners=gr,c.removeListener=gr,c.removeEventListener=gr,c.hasListeners=gr,c.add=gr,c.addIntegration=gr;var l=null==n?void 0:n.cookie,f=null!==(s=null==n?void 0:n.disableClientPersistence)&&void 0!==s&&s;c.settings=t,c.settings.timeout=null!==(a=c.settings.timeout)&&void 0!==a?a:300,c.queue=null!=r?r:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var r=t?10:1,i=n?new qt(r,[]):new Mn(r,e);return new Ln(i)}("".concat(t.writeKey,":event-queue"),null==n?void 0:n.retryQueue,f);var h=null==n?void 0:n.storage;return c._universalStorage=c.createStore(f,h,l),c._user=null!=i?i:new Qn(vt({persist:!f,storage:null==n?void 0:n.storage},null==n?void 0:n.user),l).load(),c._group=null!=o?o:new Xn(vt({persist:!f,storage:null==n?void 0:n.storage},null==n?void 0:n.group),l).load(),c.eventFactory=new kn(c._user),c.integrations=null!==(u=null==n?void 0:n.integrations)&&void 0!==u?u:{},c.options=null!=n?n:{},jn(c),c}return yt(t,e),t.prototype.createStore=function(e,t,n){return e?new Wn([new Hn]):t&&$n(t)?new Wn(Kn(Gn(t.stores,n))):new Wn(Kn([qn.LocalStorage,{name:qn.Cookie,settings:n},qn.Memory]))},Object.defineProperty(t.prototype,"storage",{get:function(){return this._universalStorage},enumerable:!1,configurable:!0}),t.prototype.track=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u=this;return bt(this,(function(c){return t=sr(e),n=nn.apply(void 0,e),r=n[0],i=n[1],o=n[2],s=n[3],a=this.eventFactory.track(r,i,o,this.integrations,t),[2,this._dispatch(a,s).then((function(e){return u.emit("track",r,e.event.properties,e.event.options),e}))]}))}))},t.prototype.page=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c=this;return bt(this,(function(l){return t=sr(e),n=rn.apply(void 0,e),r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],u=this.eventFactory.page(r,i,o,s,this.integrations,t),[2,this._dispatch(u,a).then((function(e){return c.emit("page",r,i,e.event.properties,e.event.options),e}))]}))}))},t.prototype.identify=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u=this;return bt(this,(function(c){return t=sr(e),n=on(this._user).apply(void 0,e),r=n[0],i=n[1],o=n[2],s=n[3],this._user.identify(r,i),a=this.eventFactory.identify(this._user.id(),this._user.traits(),o,this.integrations,t),[2,this._dispatch(a,s).then((function(e){return u.emit("identify",e.event.userId,e.event.traits,e.event.options),e}))]}))}))},t.prototype.group=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=sr(t);if(0===t.length)return this._group;var i=on(this._group).apply(void 0,t),o=i[0],s=i[1],a=i[2],u=i[3];this._group.identify(o,s);var c=this._group.id(),l=this._group.traits(),f=this.eventFactory.group(c,l,a,this.integrations,r);return this._dispatch(f,u).then((function(t){return e.emit("group",t.event.groupId,t.event.traits,t.event.options),t}))},t.prototype.alias=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u=this;return bt(this,(function(c){return t=sr(e),n=sn.apply(void 0,e),r=n[0],i=n[1],o=n[2],s=n[3],a=this.eventFactory.alias(r,i,o,this.integrations,t),[2,this._dispatch(a,s).then((function(e){return u.emit("alias",r,i,e.event.options),e}))]}))}))},t.prototype.screen=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c=this;return bt(this,(function(l){return t=sr(e),n=rn.apply(void 0,e),r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],u=this.eventFactory.screen(r,i,o,s,this.integrations,t),[2,this._dispatch(u,a).then((function(e){return c.emit("screen",r,i,e.event.properties,e.event.options),e}))]}))}))},t.prototype.trackClick=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n;return bt(this,(function(r){switch(r.label){case 0:return[4,Promise.resolve().then((function(){return pl}))];case 1:return t=r.sent(),[2,(n=t.link).call.apply(n,wt([this],e,!1))]}}))}))},t.prototype.trackLink=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n;return bt(this,(function(r){switch(r.label){case 0:return[4,Promise.resolve().then((function(){return pl}))];case 1:return t=r.sent(),[2,(n=t.link).call.apply(n,wt([this],e,!1))]}}))}))},t.prototype.trackSubmit=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n;return bt(this,(function(r){switch(r.label){case 0:return[4,Promise.resolve().then((function(){return pl}))];case 1:return t=r.sent(),[2,(n=t.form).call.apply(n,wt([this],e,!1))]}}))}))},t.prototype.trackForm=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n;return bt(this,(function(r){switch(r.label){case 0:return[4,Promise.resolve().then((function(){return pl}))];case 1:return t=r.sent(),[2,(n=t.form).call.apply(n,wt([this],e,!1))]}}))}))},t.prototype.register=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r=this;return bt(this,(function(i){switch(i.label){case 0:return t=bn.system(),n=e.map((function(e){return r.queue.register(t,e,r)})),[4,Promise.all(n)];case 1:return i.sent(),[2,t]}}))}))},t.prototype.deregister=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r=this;return bt(this,(function(i){switch(i.label){case 0:return t=bn.system(),n=e.map((function(e){var n=r.queue.plugins.find((function(t){return t.name===e}));if(n)return r.queue.deregister(t,n,r);t.log("warn","plugin ".concat(e," not found"))})),[4,Promise.all(n)];case 1:return i.sent(),[2,t]}}))}))},t.prototype.debug=function(e){return!1===e&&localStorage.getItem("debug")&&localStorage.removeItem("debug"),this._debug=e,this},t.prototype.reset=function(){this._user.reset(),this._group.reset(),this.emit("reset")},t.prototype.timeout=function(e){this.settings.timeout=e},t.prototype._dispatch=function(e,t){return _t(this,void 0,void 0,(function(){var n;return bt(this,(function(r){return n=new bn(e),ln()&&!this.options.retryQueue?[2,n]:[2,tn(n,this.queue,this,{callback:t,debug:this._debug,timeout:this.settings.timeout})]}))}))},t.prototype.addSourceMiddleware=function(e){return _t(this,void 0,void 0,(function(){var t=this;return bt(this,(function(n){switch(n.label){case 0:return[4,this.queue.criticalTasks.run((function(){return _t(t,void 0,void 0,(function(){var t,n,r;return bt(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve().then((function(){return yo}))];case 1:return t=i.sent().sourceMiddlewarePlugin,n={},this.queue.plugins.forEach((function(e){if("destination"===e.type)return n[e.name]=!0})),r=t(e,n),[4,this.register(r)];case 2:return i.sent(),[2]}}))}))}))];case 1:return n.sent(),[2,this]}}))}))},t.prototype.addDestinationMiddleware=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return this.queue.plugins.filter((function(t){return t.name.toLowerCase()===e.toLowerCase()})).forEach((function(e){e.addMiddleware.apply(e,t)})),Promise.resolve(this)},t.prototype.setAnonymousId=function(e){return this._user.anonymousId(e)},t.prototype.queryString=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){switch(t.label){case 0:return!1===this.options.useQueryString?[2,[]]:[4,Promise.resolve().then((function(){return yl}))];case 1:return[2,(0,t.sent().queryString)(this,e)]}}))}))},t.prototype.use=function(e){return e(this),this},t.prototype.ready=function(e){return void 0===e&&(e=function(e){return e}),_t(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,Promise.all(this.queue.plugins.map((function(e){return e.ready?e.ready():Promise.resolve()}))).then((function(t){return e(t),t}))]}))}))},t.prototype.noConflict=function(){var e;return console.warn(hr),e=null!=pr?pr:this,window[Zn]=e,this},t.prototype.normalize=function(e){return console.warn(hr),this.eventFactory.normalize(e)},Object.defineProperty(t.prototype,"failedInitializations",{get:function(){return console.warn(hr),this.queue.failedInitializations},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"VERSION",{get:function(){return pn},enumerable:!1,configurable:!0}),t.prototype.initialize=function(e,t){return _t(this,void 0,void 0,(function(){return bt(this,(function(e){return console.warn(hr),[2,Promise.resolve(this)]}))}))},t.prototype.pageview=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){switch(t.label){case 0:return console.warn(hr),[4,this.page({path:e})];case 1:return t.sent(),[2,this]}}))}))},Object.defineProperty(t.prototype,"plugins",{get:function(){var e;return console.warn(hr),null!==(e=this._plugins)&&void 0!==e?e:{}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Integrations",{get:function(){console.warn(hr);var e=this.queue.plugins.filter((function(e){return"destination"===e.type})).reduce((function(e,t){var n="".concat(t.name.toLowerCase().replace(".","").split(" ").join("-"),"Integration"),r=window[n];if(!r)return e;var i=r.Integration;return i?(e[t.name]=i,e):(e[t.name]=r,e)}),{});return e},enumerable:!1,configurable:!0}),t.prototype.push=function(e){var t=e.shift();t&&!this[t]||this[t].apply(this,e)},t}(Ft),vr=function(e){function t(){var t=e.call(this,{writeKey:""},{disableClientPersistence:!0})||this;return t.initialized=!0,t}return yt(t,e),t}(yr);function mr(){return"undefined"!=typeof process&&process.env?process.env:{}}try{window.analyticsWriteKey="__WRITE_KEY__"}catch(J){}var _r,br,wr=/(https:\/\/.*)\/analytics\.js\/v1\/(?:.*?)\/(?:platform|analytics.*)?/,Er=function(){var e=function(){var e;return null!=_r?_r:null===(e=er())||void 0===e?void 0:e._cdn}();if(e)return e;var t,n=(Array.prototype.slice.call(document.querySelectorAll("script")).forEach((function(e){var n,r=null!==(n=e.getAttribute("src"))&&void 0!==n?n:"",i=wr.exec(r);i&&i[1]&&(t=i[1])})),t);return n||"https://cdn.segment.com"},Sr=function(){var e=Er();return"".concat(e,"/next-integrations")};function Or(e,t){var n,r=Object.entries(null!==(n=t.integrations)&&void 0!==n?n:{}).reduce((function(e,t){var n,r,i=t[0],o=t[1];return vt(vt({},e),"object"==typeof o?((n={})[i]=o,n):((r={})[i]={},r))}),{});return Object.entries(e.integrations).reduce((function(e,t){var n,i=t[0],o=t[1];return vt(vt({},e),((n={})[i]=vt(vt({},o),r[i]),n))}),{})}function Ir(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}}function xr(e){return _t(this,void 0,void 0,(function(){var t;return bt(this,(function(n){return(t=navigator.userAgentData)?e?[2,t.getHighEntropyValues(e).catch((function(){return t.toJSON()}))]:[2,t.toJSON()]:[2,void 0]}))}))}function Rr(){if(br)return br;var e=zn(window.location.href);return br={expires:31536e6,secure:!1,path:"/"},e&&(br.domain=e),br}var kr=function(){var e=this;this.name="Page Enrichment",this.type="before",this.version="0.1.0",this.isLoaded=function(){return!0},this.load=function(t,n){return _t(e,void 0,void 0,(function(){var e;return bt(this,(function(t){switch(t.label){case 0:this.instance=n,t.label=1;case 1:return t.trys.push([1,3,,4]),e=this,[4,xr(this.instance.options.highEntropyValuesClientHints)];case 2:return e.userAgentData=t.sent(),[3,4];case 3:return t.sent(),[3,4];case 4:return[2,Promise.resolve()]}}))}))},this.enrich=function(t){var n,r,i=t.event.context,o=i.page.search||"",s="object"==typeof o?function(e){try{var t=new URLSearchParams;return Object.entries(e).forEach((function(e){var n=e[0],r=e[1];Array.isArray(r)?r.forEach((function(e){return t.append(n,e)})):t.append(n,r)})),t.toString()}catch(e){return""}}(o):o;i.userAgent=navigator.userAgent,i.userAgentData=e.userAgentData;var a=navigator.userLanguage||navigator.language;void 0===i.locale&&void 0!==a&&(i.locale=a),null!==(n=i.library)&&void 0!==n||(i.library={name:"analytics.js",version:"".concat("npm:next","-").concat(pn)}),s&&!i.campaign&&(i.campaign=function(e){return e.startsWith("?")&&(e=e.substring(1)),(e=e.replace(/\?/g,"&")).split("&").reduce((function(e,t){var n=t.split("="),r=n[0],i=n[1],o=void 0===i?"":i;if(r.includes("utm_")&&r.length>4){var s=r.slice(4);"campaign"===s&&(s="name"),e[s]=Ir(o)}return e}),{})}(s));var u=function(){var e=Dn.get("_ga");if(e&&e.startsWith("amp"))return e}();u&&(i.amp={id:u}),function(e,t,n){var r,i=new Wn(n?[]:[new Fn(Rr())]),o=i.get("s:context.referrer"),s=null!==(r=function(e){var t={btid:"dataxu",urid:"millennial-media"};e.startsWith("?")&&(e=e.substring(1));for(var n=0,r=(e=e.replace(/\?/g,"&")).split("&");n<r.length;n++){var i=r[n].split("="),o=i[0],s=i[1];if(t[o])return{id:s,type:t[o]}}}(e))&&void 0!==r?r:o;s&&(t&&(t.referrer=vt(vt({},t.referrer),s)),i.set("s:context.referrer",s))}(s,i,null!==(r=e.instance.options.disableClientPersistence)&&void 0!==r&&r);try{i.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){}return t},this.track=this.enrich,this.identify=this.enrich,this.page=this.enrich,this.group=this.enrich,this.alias=this.enrich,this.screen=this.enrich},Cr=new kr;function Pr(e){return Array.prototype.slice.call(window.document.querySelectorAll("script")).find((function(t){return t.src===e}))}function Ar(e,t){var n=Pr(e);if(void 0!==n){var r=null==n?void 0:n.getAttribute("status");if("loaded"===r)return Promise.resolve(n);if("loading"===r)return new Promise((function(e,t){n.addEventListener("load",(function(){return e(n)})),n.addEventListener("error",(function(e){return t(e)}))}))}return new Promise((function(n,r){var i,o=window.document.createElement("script");o.type="text/javascript",o.src=e,o.async=!0,o.setAttribute("status","loading");for(var s=0,a=Object.entries(null!=t?t:{});s<a.length;s++){var u=a[s],c=u[0],l=u[1];o.setAttribute(c,l)}o.onload=function(){o.onerror=o.onload=null,o.setAttribute("status","loaded"),n(o)},o.onerror=function(){o.onerror=o.onload=null,o.setAttribute("status","error"),r(new Error("Failed to load ".concat(e)))};var f=window.document.getElementsByTagName("script")[0];null===(i=f.parentElement)||void 0===i||i.insertBefore(o,f)}))}function Nr(e){var t=Pr(e);return void 0!==t&&t.remove(),Promise.resolve()}var Tr={},Mr={},Lr={},jr={exports:{}};!function(e){function t(e){return function(t,n,r,o){var s,a=o&&function(e){return"function"==typeof e}(o.normalizer)?o.normalizer:i;n=a(n);for(var u=!1;!u;)c();function c(){for(s in t){var e=a(s);if(0===n.indexOf(e)){var r=n.substr(e.length);if("."===r.charAt(0)||0===r.length){n=r.substr(1);var i=t[s];return null==i?void(u=!0):n.length?void(t=i):void(u=!0)}}}s=void 0,u=!0}if(s)return null==t?t:e(t,s,r)}}function n(e,t){return e.hasOwnProperty(t)&&delete e[t],e}function r(e,t,n){return e.hasOwnProperty(t)&&(e[t]=n),e}function i(e){return e.replace(/[^a-zA-Z0-9\.]+/g,"").toLowerCase()}e.exports=t((function(e,t){if(e.hasOwnProperty(t))return e[t]})),e.exports.find=e.exports,e.exports.replace=function(e,n,i,o){return t(r).call(this,e,n,i,o),e},e.exports.del=function(e,r,i){return t(n).call(this,e,r,null,i),e}}(jr);var Ur=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Lr,"__esModule",{value:!0});var Dr=Ur(jr.exports);function zr(e,t){return function(){var n=this.traits(),r=this.properties?this.properties():{};return Dr.default(n,"address."+e)||Dr.default(n,e)||(t?Dr.default(n,"address."+t):null)||(t?Dr.default(n,t):null)||Dr.default(r,"address."+e)||Dr.default(r,e)||(t?Dr.default(r,"address."+t):null)||(t?Dr.default(r,t):null)}}Lr.default=function(e){e.zip=zr("postalCode","zip"),e.country=zr("country"),e.street=zr("street"),e.state=zr("state"),e.city=zr("city"),e.region=zr("region")};var Fr={};Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.clone=void 0,Fr.clone=function e(t){if("object"!=typeof t)return t;if("[object Object]"===Object.prototype.toString.call(t)){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e(t[r]));return n}return Array.isArray(t)?t.map(e):t};var Br={};Object.defineProperty(Br,"__esModule",{value:!0});var Hr={Salesforce:!0};Br.default=function(e){return!Hr[e]};var qr={},$r=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;qr.parse=function(e){var t=[1,5,6,7,11,12],n=$r.exec(e),r=0;if(!n)return new Date(e);for(var i,o=0;i=t[o];o++)n[i]=parseInt(n[i],10)||0;n[2]=parseInt(n[2],10)||1,n[3]=parseInt(n[3],10)||1,n[2]--,n[8]=n[8]?(n[8]+"00").substring(0,3):0," "===n[4]?r=(new Date).getTimezoneOffset():"Z"!==n[9]&&n[10]&&(r=60*n[11]+n[12],"+"===n[10]&&(r=0-r));var s=Date.UTC(n[1],n[2],n[3],n[5],n[6]+r,n[7],n[8]);return new Date(s)},qr.is=function(e,t){return"string"==typeof e&&((!t||!1!==/^\d{4}-\d{2}-\d{2}/.test(e))&&$r.test(e))};var Vr={},Wr=/\d{13}/;Vr.is=function(e){return Wr.test(e)},Vr.parse=function(e){return e=parseInt(e,10),new Date(e)};var Kr={},Gr=/\d{10}/;Kr.is=function(e){return Gr.test(e)},Kr.parse=function(e){var t=1e3*parseInt(e,10);return new Date(t)};var Yr=qr,Qr=Vr,Jr=Kr,Xr=Object.prototype.toString;var Zr=function(e){return t=e,"[object Date]"===Xr.call(t)?e:function(e){return"[object Number]"===Xr.call(e)}(e)?new Date((n=e)<315576e5?1e3*n:n):Yr.is(e)?Yr.parse(e):Qr.is(e)?Qr.parse(e):Jr.is(e)?Jr.parse(e):new Date(e);var t,n};var ei=qr,ti=ni;function ni(e,t){return void 0===t&&(t=!0),e&&"object"==typeof e?function(e,t){return Object.keys(e).forEach((function(n){e[n]=ni(e[n],t)})),e}(e,t):Array.isArray(e)?function(e,t){return e.forEach((function(n,r){e[r]=ni(n,t)})),e}(e,t):ei.is(e,t)?ei.parse(e):e}var ri=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.Facade=void 0;var ii=ri(Lr),oi=Fr,si=ri(Br),ai=ri(Zr),ui=ri(jr.exports),ci=ri(ti);function li(e,t){t=t||{},this.raw=oi.clone(e),"clone"in t||(t.clone=!0),t.clone&&(e=oi.clone(e)),"traverse"in t||(t.traverse=!0),e.timestamp="timestamp"in e?ai.default(e.timestamp):new Date,t.traverse&&ci.default(e),this.opts=t,this.obj=e}Mr.Facade=li;var fi=li.prototype;function hi(e){return oi.clone(e)}fi.proxy=function(e){var t=e.split("."),n=this[e=t.shift()]||this.obj[e];return n?("function"==typeof n&&(n=n.call(this)||{}),0===t.length||(n=ui.default(n,t.join("."))),this.opts.clone?hi(n):n):n},fi.field=function(e){var t=this.obj[e];return this.opts.clone?hi(t):t},li.proxy=function(e){return function(){return this.proxy(e)}},li.field=function(e){return function(){return this.field(e)}},li.multi=function(e){return function(){var t=this.proxy(e+"s");if(Array.isArray(t))return t;var n=this.proxy(e);return n&&(n=[this.opts.clone?oi.clone(n):n]),n||[]}},li.one=function(e){return function(){var t=this.proxy(e);if(t)return t;var n=this.proxy(e+"s");return Array.isArray(n)?n[0]:void 0}},fi.json=function(){var e=this.opts.clone?oi.clone(this.obj):this.obj;return this.type&&(e.type=this.type()),e},fi.rawEvent=function(){return this.raw},fi.options=function(e){var t=this.obj.options||this.obj.context||{},n=this.opts.clone?oi.clone(t):t;if(!e)return n;if(this.enabled(e)){var r=this.integrations(),i=r[e]||ui.default(r,e);return"object"!=typeof i&&(i=ui.default(this.options(),e)),"object"==typeof i?i:{}}},fi.context=fi.options,fi.enabled=function(e){var t=this.proxy("options.providers.all");"boolean"!=typeof t&&(t=this.proxy("options.all")),"boolean"!=typeof t&&(t=this.proxy("integrations.all")),"boolean"!=typeof t&&(t=!0);var n=t&&si.default(e),r=this.integrations();if(r.providers&&r.providers.hasOwnProperty(e)&&(n=r.providers[e]),r.hasOwnProperty(e)){var i=r[e];n="boolean"!=typeof i||i}return!!n},fi.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()},fi.active=function(){var e=this.proxy("options.active");return null==e&&(e=!0),e},fi.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")},fi.sessionId=fi.anonymousId,fi.groupId=li.proxy("options.groupId"),fi.traits=function(e){var t=this.proxy("options.traits")||{},n=this.userId();for(var r in e=e||{},n&&(t.id=n),e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=null==this[r]?this.proxy("options.traits."+r):this[r]();if(null==i)continue;t[e[r]]=i,delete t[r]}return t},fi.library=function(){var e=this.proxy("options.library");return e?"string"==typeof e?{name:e,version:null}:e:{name:"unknown",version:null}},fi.device=function(){var e=this.proxy("context.device");"object"==typeof e&&null!==e||(e={});var t=this.library().name;return e.type||(t.indexOf("ios")>-1&&(e.type="ios"),t.indexOf("android")>-1&&(e.type="android")),e},fi.userAgent=li.proxy("context.userAgent"),fi.timezone=li.proxy("context.timezone"),fi.timestamp=li.field("timestamp"),fi.channel=li.field("channel"),fi.ip=li.proxy("context.ip"),fi.userId=li.field("userId"),ii.default(fi);var di={},pi={exports:{}};"function"==typeof Object.create?pi.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:pi.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}};var gi=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(di,"__esModule",{value:!0}),di.Alias=void 0;var yi=gi(pi.exports),vi=Mr;function mi(e,t){vi.Facade.call(this,e,t)}di.Alias=mi,yi.default(mi,vi.Facade),mi.prototype.action=function(){return"alias"},mi.prototype.type=mi.prototype.action,mi.prototype.previousId=function(){return this.field("previousId")||this.field("from")},mi.prototype.from=mi.prototype.previousId,mi.prototype.userId=function(){return this.field("userId")||this.field("to")},mi.prototype.to=mi.prototype.userId;var _i={},bi={};Object.defineProperty(bi,"__esModule",{value:!0});var wi=/.+\@.+\..+/;bi.default=function(e){return wi.test(e)};var Ei=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_i,"__esModule",{value:!0}),_i.Group=void 0;var Si=Ei(pi.exports),Oi=Ei(bi),Ii=Ei(Zr),xi=Mr;function Ri(e,t){xi.Facade.call(this,e,t)}_i.Group=Ri,Si.default(Ri,xi.Facade);var ki=Ri.prototype;ki.action=function(){return"group"},ki.type=ki.action,ki.groupId=xi.Facade.field("groupId"),ki.created=function(){var e=this.proxy("traits.createdAt")||this.proxy("traits.created")||this.proxy("properties.createdAt")||this.proxy("properties.created");if(e)return Ii.default(e)},ki.email=function(){var e=this.proxy("traits.email");if(e)return e;var t=this.groupId();return Oi.default(t)?t:void 0},ki.traits=function(e){var t=this.properties(),n=this.groupId();for(var r in e=e||{},n&&(t.id=n),e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=null==this[r]?this.proxy("traits."+r):this[r]();if(null==i)continue;t[e[r]]=i,delete t[r]}return t},ki.name=xi.Facade.proxy("traits.name"),ki.industry=xi.Facade.proxy("traits.industry"),ki.employees=xi.Facade.proxy("traits.employees"),ki.properties=function(){return this.field("traits")||this.field("properties")||{}};var Ci={},Pi=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.Identify=void 0;var Ai=Mr,Ni=Pi(jr.exports),Ti=Pi(pi.exports),Mi=Pi(bi),Li=Pi(Zr),ji=function(e){return e.trim()};function Ui(e,t){Ai.Facade.call(this,e,t)}Ci.Identify=Ui,Ti.default(Ui,Ai.Facade);var Di=Ui.prototype;Di.action=function(){return"identify"},Di.type=Di.action,Di.traits=function(e){var t=this.field("traits")||{},n=this.userId();for(var r in e=e||{},n&&(t.id=n),e){var i=null==this[r]?this.proxy("traits."+r):this[r]();null!=i&&(t[e[r]]=i,r!==e[r]&&delete t[r])}return t},Di.email=function(){var e=this.proxy("traits.email");if(e)return e;var t=this.userId();return Mi.default(t)?t:void 0},Di.created=function(){var e=this.proxy("traits.created")||this.proxy("traits.createdAt");if(e)return Li.default(e)},Di.companyCreated=function(){var e=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(e)return Li.default(e)},Di.companyName=function(){return this.proxy("traits.company.name")},Di.name=function(){var e=this.proxy("traits.name");if("string"==typeof e)return ji(e);var t=this.firstName(),n=this.lastName();return t&&n?ji(t+" "+n):void 0},Di.firstName=function(){var e=this.proxy("traits.firstName");if("string"==typeof e)return ji(e);var t=this.proxy("traits.name");return"string"==typeof t?ji(t).split(" ")[0]:void 0},Di.lastName=function(){var e=this.proxy("traits.lastName");if("string"==typeof e)return ji(e);var t=this.proxy("traits.name");if("string"==typeof t){var n=ji(t).indexOf(" ");if(-1!==n)return ji(t.substr(n+1))}},Di.uid=function(){return this.userId()||this.username()||this.email()},Di.description=function(){return this.proxy("traits.description")||this.proxy("traits.background")},Di.age=function(){var e=this.birthday(),t=Ni.default(this.traits(),"age");return null!=t?t:e instanceof Date?(new Date).getFullYear()-e.getFullYear():void 0},Di.avatar=function(){var e=this.traits();return Ni.default(e,"avatar")||Ni.default(e,"photoUrl")||Ni.default(e,"avatarUrl")},Di.position=function(){var e=this.traits();return Ni.default(e,"position")||Ni.default(e,"jobTitle")},Di.username=Ai.Facade.proxy("traits.username"),Di.website=Ai.Facade.one("traits.website"),Di.websites=Ai.Facade.multi("traits.website"),Di.phone=Ai.Facade.one("traits.phone"),Di.phones=Ai.Facade.multi("traits.phone"),Di.address=Ai.Facade.proxy("traits.address"),Di.gender=Ai.Facade.proxy("traits.gender"),Di.birthday=Ai.Facade.proxy("traits.birthday");var zi={},Fi=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zi,"__esModule",{value:!0}),zi.Track=void 0;var Bi=Fi(pi.exports),Hi=Mr,qi=Ci,$i=Fi(bi),Vi=Fi(jr.exports);function Wi(e,t){Hi.Facade.call(this,e,t)}zi.Track=Wi,Bi.default(Wi,Hi.Facade);var Ki=Wi.prototype;Ki.action=function(){return"track"},Ki.type=Ki.action,Ki.event=Hi.Facade.field("event"),Ki.value=Hi.Facade.proxy("properties.value"),Ki.category=Hi.Facade.proxy("properties.category"),Ki.id=Hi.Facade.proxy("properties.id"),Ki.productId=function(){return this.proxy("properties.product_id")||this.proxy("properties.productId")},Ki.promotionId=function(){return this.proxy("properties.promotion_id")||this.proxy("properties.promotionId")},Ki.cartId=function(){return this.proxy("properties.cart_id")||this.proxy("properties.cartId")},Ki.checkoutId=function(){return this.proxy("properties.checkout_id")||this.proxy("properties.checkoutId")},Ki.paymentId=function(){return this.proxy("properties.payment_id")||this.proxy("properties.paymentId")},Ki.couponId=function(){return this.proxy("properties.coupon_id")||this.proxy("properties.couponId")},Ki.wishlistId=function(){return this.proxy("properties.wishlist_id")||this.proxy("properties.wishlistId")},Ki.reviewId=function(){return this.proxy("properties.review_id")||this.proxy("properties.reviewId")},Ki.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.order_id")||this.proxy("properties.orderId")},Ki.sku=Hi.Facade.proxy("properties.sku"),Ki.tax=Hi.Facade.proxy("properties.tax"),Ki.name=Hi.Facade.proxy("properties.name"),Ki.price=Hi.Facade.proxy("properties.price"),Ki.total=Hi.Facade.proxy("properties.total"),Ki.repeat=Hi.Facade.proxy("properties.repeat"),Ki.coupon=Hi.Facade.proxy("properties.coupon"),Ki.shipping=Hi.Facade.proxy("properties.shipping"),Ki.discount=Hi.Facade.proxy("properties.discount"),Ki.shippingMethod=function(){return this.proxy("properties.shipping_method")||this.proxy("properties.shippingMethod")},Ki.paymentMethod=function(){return this.proxy("properties.payment_method")||this.proxy("properties.paymentMethod")},Ki.description=Hi.Facade.proxy("properties.description"),Ki.plan=Hi.Facade.proxy("properties.plan"),Ki.subtotal=function(){var e=Vi.default(this.properties(),"subtotal"),t=this.total()||this.revenue();if(e)return e;if(!t)return 0;if(this.total()){var n=this.tax();n&&(t-=n),(n=this.shipping())&&(t-=n),(n=this.discount())&&(t+=n)}return t},Ki.products=function(){var e=this.properties(),t=Vi.default(e,"products");return Array.isArray(t)?t.filter((function(e){return null!==e})):[]},Ki.quantity=function(){return(this.obj.properties||{}).quantity||1},Ki.currency=function(){return(this.obj.properties||{}).currency||"USD"},Ki.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},Ki.query=Hi.Facade.proxy("options.query"),Ki.properties=function(e){var t=this.field("properties")||{};for(var n in e=e||{})if(Object.prototype.hasOwnProperty.call(e,n)){var r=null==this[n]?this.proxy("properties."+n):this[n]();if(null==r)continue;t[e[n]]=r,delete t[n]}return t},Ki.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()},Ki.email=function(){var e=this.proxy("traits.email")||this.proxy("properties.email")||this.proxy("options.traits.email");if(e)return e;var t=this.userId();return $i.default(t)?t:void 0},Ki.revenue=function(){var e=this.proxy("properties.revenue"),t=this.event();return!e&&t&&t.match(/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i)&&(e=this.proxy("properties.total")),function(e){if(!e)return;if("number"==typeof e)return e;if("string"!=typeof e)return;if(e=e.replace(/\$/g,""),e=parseFloat(e),!isNaN(e))return e}(e)},Ki.cents=function(){var e=this.revenue();return"number"!=typeof e?this.value()||0:100*e},Ki.identify=function(){var e=this.json();return e.traits=this.traits(),new qi.Identify(e,this.opts)};var Gi={},Yi=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.Page=void 0;var Qi=Yi(pi.exports),Ji=Mr,Xi=zi,Zi=Yi(bi);function eo(e,t){Ji.Facade.call(this,e,t)}Gi.Page=eo,Qi.default(eo,Ji.Facade);var to=eo.prototype;to.action=function(){return"page"},to.type=to.action,to.category=Ji.Facade.field("category"),to.name=Ji.Facade.field("name"),to.title=Ji.Facade.proxy("properties.title"),to.path=Ji.Facade.proxy("properties.path"),to.url=Ji.Facade.proxy("properties.url"),to.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},to.properties=function(e){var t=this.field("properties")||{},n=this.category(),r=this.name();for(var i in e=e||{},n&&(t.category=n),r&&(t.name=r),e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=null==this[i]?this.proxy("properties."+i):this[i]();if(null==o)continue;t[e[i]]=o,i!==e[i]&&delete t[i]}return t},to.email=function(){var e=this.proxy("context.traits.email")||this.proxy("properties.email");if(e)return e;var t=this.userId();return Zi.default(t)?t:void 0},to.fullName=function(){var e=this.category(),t=this.name();return t&&e?e+" "+t:t},to.event=function(e){return e?"Viewed "+e+" Page":"Loaded a Page"},to.track=function(e){var t=this.json();return t.event=this.event(e),t.timestamp=this.timestamp(),t.properties=this.properties(),new Xi.Track(t,this.opts)};var no={},ro=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(no,"__esModule",{value:!0}),no.Screen=void 0;var io=ro(pi.exports),oo=Gi,so=zi;function ao(e,t){oo.Page.call(this,e,t)}no.Screen=ao,io.default(ao,oo.Page),ao.prototype.action=function(){return"screen"},ao.prototype.type=ao.prototype.action,ao.prototype.event=function(e){return e?"Viewed "+e+" Screen":"Loaded a Screen"},ao.prototype.track=function(e){var t=this.json();return t.event=this.event(e),t.timestamp=this.timestamp(),t.properties=this.properties(),new so.Track(t,this.opts)};var uo={},co=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(uo,"__esModule",{value:!0}),uo.Delete=void 0;var lo=co(pi.exports),fo=Mr;function ho(e,t){fo.Facade.call(this,e,t)}function po(e,t){var n=new Tr.Facade(e,t);return"track"===e.type&&(n=new Tr.Track(e,t)),"identify"===e.type&&(n=new Tr.Identify(e,t)),"page"===e.type&&(n=new Tr.Page(e,t)),"alias"===e.type&&(n=new Tr.Alias(e,t)),"group"===e.type&&(n=new Tr.Group(e,t)),"screen"===e.type&&(n=new Tr.Screen(e,t)),Object.defineProperty(n,"obj",{value:e,writable:!0}),n}function go(e,t,n){return _t(this,void 0,void 0,(function(){function r(t,n){return _t(this,void 0,void 0,(function(){var r,i,o;return bt(this,(function(s){switch(s.label){case 0:return r=!1,i=null,[4,n({payload:po(t,{clone:!0,traverse:!1}),integration:e,next:function(e){r=!0,null===e&&(i=null),e&&(i=e.obj)}})];case 1:return s.sent(),r||null===i||(i.integrations=vt(vt({},t.integrations),((o={})[e]=!1,o))),[2,i]}}))}))}var i,o,s,a,u;return bt(this,(function(e){switch(e.label){case 0:i=po(t,{clone:!0,traverse:!1}).rawEvent(),o=0,s=n,e.label=1;case 1:return o<s.length?(a=s[o],[4,r(i,a)]):[3,4];case 2:if(null===(u=e.sent()))return[2,null];i=u,e.label=3;case 3:return o++,[3,1];case 4:return[2,i]}}))}))}uo.Delete=ho,lo.default(ho,fo.Facade),ho.prototype.type=function(){return"delete"},function(e){var t=l&&l.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.Delete=e.Screen=e.Page=e.Track=e.Identify=e.Group=e.Alias=e.Facade=void 0;var n=Mr;Object.defineProperty(e,"Facade",{enumerable:!0,get:function(){return n.Facade}});var r=di;Object.defineProperty(e,"Alias",{enumerable:!0,get:function(){return r.Alias}});var i=_i;Object.defineProperty(e,"Group",{enumerable:!0,get:function(){return i.Group}});var o=Ci;Object.defineProperty(e,"Identify",{enumerable:!0,get:function(){return o.Identify}});var s=zi;Object.defineProperty(e,"Track",{enumerable:!0,get:function(){return s.Track}});var a=Gi;Object.defineProperty(e,"Page",{enumerable:!0,get:function(){return a.Page}});var u=no;Object.defineProperty(e,"Screen",{enumerable:!0,get:function(){return u.Screen}});var c=uo;Object.defineProperty(e,"Delete",{enumerable:!0,get:function(){return c.Delete}}),e.default=t(t({},n.Facade),{Alias:r.Alias,Group:i.Group,Identify:o.Identify,Track:s.Track,Page:a.Page,Screen:u.Screen,Delete:c.Delete})}(Tr);var yo=Object.freeze({__proto__:null,applyDestinationMiddleware:go,sourceMiddlewarePlugin:function(e,t){function n(n){return _t(this,void 0,void 0,(function(){var r;return bt(this,(function(i){switch(i.label){case 0:return r=!1,[4,e({payload:po(n.event,{clone:!0,traverse:!1}),integrations:null!=t?t:{},next:function(e){r=!0,e&&(n.event=e.obj)}})];case 1:if(i.sent(),!r)throw new Qt({retry:!1,type:"middleware_cancellation",reason:"Middleware `next` function skipped"});return[2,n]}}))}))}return{name:"Source Middleware ".concat(e.name),type:"before",version:"0.1.0",isLoaded:function(){return!0},load:function(e){return Promise.resolve(e)},track:n,page:n,identify:n,alias:n,group:n}}});function vo(e,t){var n=t.methodName,r=t.integrationName,i=t.type,o=t.didError,s=void 0!==o&&o;e.stats.increment("analytics_js.integration.invoke".concat(s?".error":""),1,["method:".concat(n),"integration_name:".concat(r),"type:".concat(i)])}var mo=function(){function e(e,t){this.version="1.0.0",this.alternativeNames=[],this.middleware=[],this.alias=this._createMethod("alias"),this.group=this._createMethod("group"),this.identify=this._createMethod("identify"),this.page=this._createMethod("page"),this.screen=this._createMethod("screen"),this.track=this._createMethod("track"),this.action=t,this.name=e,this.type=t.type,this.alternativeNames.push(t.name)}return e.prototype.addMiddleware=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];"destination"===this.type&&(e=this.middleware).push.apply(e,t)},e.prototype.transform=function(e){return _t(this,void 0,void 0,(function(){var t;return bt(this,(function(n){switch(n.label){case 0:return[4,go(this.name,e.event,this.middleware)];case 1:return null===(t=n.sent())&&e.cancel(new Qt({retry:!1,reason:"dropped by destination middleware"})),[2,new bn(t)]}}))}))},e.prototype._createMethod=function(e){var t=this;return function(n){return _t(t,void 0,void 0,(function(){var t,r;return bt(this,(function(i){switch(i.label){case 0:return this.action[e]?(t=n,"destination"!==this.type?[3,2]:[4,this.transform(n)]):[2,n];case 1:t=i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),vo(n,{integrationName:this.action.name,methodName:e,type:"action"}),[4,this.action[e](t)];case 3:return i.sent(),[3,5];case 4:throw r=i.sent(),vo(n,{integrationName:this.action.name,methodName:e,type:"action",didError:!0}),r;case 5:return[2,n]}}))}))}},e.prototype.isLoaded=function(){return this.action.isLoaded()},e.prototype.ready=function(){return this.action.ready?this.action.ready():Promise.resolve()},e.prototype.load=function(e,t){return _t(this,void 0,void 0,(function(){var n;return bt(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),vo(e,{integrationName:this.action.name,methodName:"load",type:"action"}),[4,this.action.load(e,t)];case 1:return[2,r.sent()];case 2:throw n=r.sent(),vo(e,{integrationName:this.action.name,methodName:"load",type:"action",didError:!0}),n;case 3:return[2]}}))}))},e.prototype.unload=function(e,t){var n,r;return null===(r=(n=this.action).unload)||void 0===r?void 0:r.call(n,e,t)},e}();function _o(e,t){return _t(this,void 0,void 0,(function(){var n,r,i,o,s;return bt(this,(function(a){switch(a.label){case 0:if(n=new RegExp("https://cdn.segment.(com|build)"),r=Er(),!t)return[3,6];i=e.url.split("/"),o=i[i.length-2],s=e.url.replace(o,btoa(o).replace(/=/g,"")),a.label=1;case 1:return a.trys.push([1,3,,5]),[4,Ar(s.replace(n,r))];case 2:return a.sent(),[3,5];case 3:return a.sent(),[4,Ar(e.url.replace(n,r))];case 4:return a.sent(),[3,5];case 5:return[3,8];case 6:return[4,Ar(e.url.replace(n,r))];case 7:a.sent(),a.label=8;case 8:return"function"==typeof window[e.libraryName]?[2,window[e.libraryName]]:[2]}}))}))}function bo(e,t,n,r,i,o){var s,a,u;return _t(this,void 0,void 0,(function(){var c,l,f,h=this;return bt(this,(function(d){switch(d.label){case 0:return c=[],l=null!==(a=null===(s=e.middlewareSettings)||void 0===s?void 0:s.routingRules)&&void 0!==a?a:[],f=(null!==(u=e.remotePlugins)&&void 0!==u?u:[]).map((function(e){return _t(h,void 0,void 0,(function(){var s,a,u,f,h,d;return bt(this,(function(p){switch(p.label){case 0:if(function(e,t){var n=e[t.creationName],r=e[t.name];return!1===e.All&&!n&&!r||!1===n||!1===r}(t,e))return[2];p.label=1;case 1:return p.trys.push([1,6,,7]),(a=null==o?void 0:o.find((function(t){return t.pluginName===e.name})))?[3,3]:[4,_o(e,r)];case 2:a=p.sent(),p.label=3;case 3:return(s=a)?[4,s(vt(vt({},e.settings),n[e.name]))]:[3,5];case 4:u=p.sent(),function(e){if(!Array.isArray(e))throw new Error("Not a valid list of plugins");var t=["load","isLoaded","name","version","type"];e.forEach((function(e){t.forEach((function(t){var n;if(void 0===e[t])throw new Error("Plugin: ".concat(null!==(n=e.name)&&void 0!==n?n:"unknown"," missing required function ").concat(t))}))}))}(f=Array.isArray(u)?u:[u]),h=l.filter((function(t){return t.destinationName===e.creationName})),f.forEach((function(t){var n=new mo(e.creationName,t);h.length&&i&&"destination"===t.type&&n.addMiddleware(i),c.push(n)})),p.label=5;case 5:return[3,7];case 6:return d=p.sent(),console.warn("Failed to load Remote Plugin",d),[3,7];case 7:return[2]}}))}))})),[4,Promise.all(f)];case 1:return d.sent(),[2,c.filter(Boolean)]}}))}))}var wo=function(e){var t=!1;window.addEventListener("pagehide",(function(){t||e(t=!0)})),document.addEventListener("visibilitychange",(function(){if("hidden"==document.visibilityState){if(t)return;t=!0}else t=!1;e(t)}))},Eo=500;function So(e){return(encodeURI(JSON.stringify(e)).split(/%..|./).length-1)/1024}function Oo(e,t){var n,r,i,o=[],s=!1,a=null!==(n=null==t?void 0:t.size)&&void 0!==n?n:10,u=null!==(r=null==t?void 0:t.timeout)&&void 0!==r?r:5e3;function c(t){var n;if(0!==t.length){var r=null===(n=t[0])||void 0===n?void 0:n.writeKey,i=t.map((function(e){var t=e;return t.sentAt,mt(t,["sentAt"])}));return dn("https://".concat(e,"/b"),{keepalive:s,headers:{"Content-Type":"text/plain"},method:"post",body:JSON.stringify({writeKey:r,batch:i,sentAt:(new Date).toISOString()})})}}function l(){return _t(this,void 0,void 0,(function(){var e;return bt(this,(function(t){return o.length?(e=o,o=[],[2,c(e)]):[2]}))}))}return wo((function(e){if((s=e)&&o.length){var t=function(e){var t=[],n=0;return e.forEach((function(e){So(t[n])>=64&&n++,t[n]?t[n].push(e):t[n]=[e]})),t}(o).map(c);Promise.all(t).catch(console.error)}})),{dispatch:function(e,t){return _t(this,void 0,void 0,(function(){var e;return bt(this,(function(n){return o.push(t),e=o.length>=a||function(e){return So(e)>=Eo-50}(o),[2,e||s?l():void(i||(i=setTimeout((function(){i=void 0,l().catch(console.error)}),u)))]}))}))}}}function Io(e,t,n,r){var i,o=e.user();delete t.options,t.writeKey=null==n?void 0:n.apiKey,t.userId=t.userId||o.id(),t.anonymousId=t.anonymousId||o.anonymousId(),t.sentAt=new Date;var s=e.queue.failedInitializations||[];s.length>0&&(t._metadata={failedInitializations:s});var a=[],u=[];for(var c in r){var l=r[c];"Segment.io"===c&&a.push(c),"bundled"===l.bundlingStatus&&a.push(c),"unbundled"===l.bundlingStatus&&u.push(c)}for(var f=0,h=(null==n?void 0:n.unbundledIntegrations)||[];f<h.length;f++){var d=h[f];u.includes(d)||u.push(d)}var p=null!==(i=null==n?void 0:n.maybeBundledConfigIds)&&void 0!==i?i:{},g=[];return a.sort().forEach((function(e){var t;(null!==(t=p[e])&&void 0!==t?t:[]).forEach((function(e){g.push(e)}))})),!1!==(null==n?void 0:n.addBundledMetadata)&&(t._metadata=vt(vt({},t._metadata),{bundled:a.sort(),unbundled:u.sort(),bundledIds:g})),t}var xo=function(e,t){return _t(void 0,void 0,void 0,(function(){var n;return bt(this,(function(r){return n=function(r){return _t(void 0,void 0,void 0,(function(){var i;return bt(this,(function(o){switch(o.label){case 0:return e(r)?(i=n,[4,t()]):[3,2];case 1:return[2,i.apply(void 0,[o.sent()])];case 2:return[2]}}))}))},[2,n(void 0)]}))}))};function Ro(e,t){return _t(this,void 0,void 0,(function(){var n,r=this;return bt(this,(function(i){switch(i.label){case 0:return n=[],ln()?[2,t]:[4,xo((function(){return t.length>0&&!ln()}),(function(){return _t(r,void 0,void 0,(function(){var r,i;return bt(this,(function(o){switch(o.label){case 0:return(r=t.pop())?[4,Xt(r,e)]:[2];case 1:return i=o.sent(),i instanceof bn||n.push(r),[2]}}))}))}))];case 1:return i.sent(),n.map((function(e){return t.pushWithBackoff(e)})),[2,t]}}))}))}function ko(e,t,n,r){var i=this;e||setTimeout((function(){return _t(i,void 0,void 0,(function(){var e,i;return bt(this,(function(o){switch(o.label){case 0:return e=!0,[4,Ro(n,t)];case 1:return i=o.sent(),e=!1,t.todo>0&&r(e,i,n,r),[2]}}))}))}),5e3*Math.random())}function Co(e,t,n){var r,i,o;window.addEventListener("pagehide",(function(){u.push.apply(u,Array.from(c)),c.clear()}));var s,a=null!==(r=null==t?void 0:t.apiKey)&&void 0!==r?r:"",u=e.options.disableClientPersistence?new qt(e.queue.queue.maxAttempts,[]):new Mn(e.queue.queue.maxAttempts,"".concat(a,":dest-Segment.io")),c=new Set,l=!1,f=null!==(i=null==t?void 0:t.apiHost)&&void 0!==i?i:gn,h=null!==(o=null==t?void 0:t.protocol)&&void 0!==o?o:"https",d="".concat(h,"://").concat(f),p=null==t?void 0:t.deliveryStrategy,g="batching"===(null==p?void 0:p.strategy)?Oo(f,p.config):(s=null==p?void 0:p.config,{dispatch:function(e,t){return dn(e,{keepalive:null==s?void 0:s.keepalive,headers:{"Content-Type":"text/plain"},method:"post",body:JSON.stringify(t)})}});function y(r){return _t(this,void 0,void 0,(function(){var i,o;return bt(this,(function(s){return ln()?(u.push(r),ko(l,u,v,ko),[2,r]):(c.add(r),i=r.event.type.charAt(0),o=po(r.event).json(),"track"===r.event.type&&delete o.traits,"alias"===r.event.type&&(o=function(e,t){var n,r,i,o,s=e.user();return t.previousId=null!==(i=null!==(r=null!==(n=t.previousId)&&void 0!==n?n:t.from)&&void 0!==r?r:s.id())&&void 0!==i?i:s.anonymousId(),t.userId=null!==(o=t.userId)&&void 0!==o?o:t.to,delete t.from,delete t.to,t}(e,o)),[2,g.dispatch("".concat(d,"/").concat(i),Io(e,o,t,n)).then((function(){return r})).catch((function(){return u.pushWithBackoff(r),ko(l,u,v,ko),r})).finally((function(){c.delete(r)}))])}))}))}var v={name:"Segment.io",type:"after",version:"0.1.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:y,identify:y,page:y,alias:y,group:y,screen:y};return u.todo&&ko(l,u,v,ko),v}function Po(e){var t,n=e.event;!function(e){if(!Tt(e))throw new Ct("Event",Ut);if("object"!=typeof e)throw new Ct("Event",jt)}(n),function(e){if(!Pt(e.type))throw new Ct(".type",Lt)}(n),"track"===n.type&&function(e){if(!Pt(e.event))throw new Ct(".event",Lt)}(n);var r=null!==(t=n.properties)&&void 0!==t?t:n.traits;if("alias"!==n.type&&!Mt(r))throw new Ct(".properties","is not an object");return function(e){var t=".userId/anonymousId/previousId/groupId",n=function(e){var t,n,r;return null!==(r=null!==(n=null!==(t=e.userId)&&void 0!==t?t:e.anonymousId)&&void 0!==n?n:e.groupId)&&void 0!==r?r:e.previousId}(e);if(!Tt(n))throw new Ct(t,Ut);if(!Pt(n))throw new Ct(t,Lt)}(n),e}var Ao,No,To={name:"Event Validation",type:"before",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:Po,identify:Po,page:Po,alias:Po,group:Po,screen:Po},Mo=null!==(Ao=(No=hn()).__SEGMENT_INSPECTOR__)&&void 0!==Ao?Ao:No.__SEGMENT_INSPECTOR__={};function Lo(e,t){return _t(this,void 0,void 0,(function(){return bt(this,(function(n){switch(n.label){case 0:return[4,nr(e,t)];case 1:return n.sent(),or(e,t),t.clear(),[2]}}))}))}function jo(e,t,n,r,i,o,s){var a,u,c;return void 0===o&&(o=[]),_t(this,void 0,void 0,(function(){var l,f,h,d,p,g,y,v,m,_,b,w,E,S,O=this;return bt(this,(function(I){switch(I.label){case 0:return l=null==o?void 0:o.filter((function(e){return"object"==typeof e})),f=null==o?void 0:o.filter((function(e){return"function"==typeof e&&"string"==typeof e.pluginName})),function(e){var t,n,r;return"test"!==mr().NODE_ENV&&(null!==(r=null===(n=null===(t=e.middlewareSettings)||void 0===t?void 0:t.routingRules)||void 0===n?void 0:n.length)&&void 0!==r?r:0)>0}(t)?[4,Promise.resolve().then((function(){return Ed})).then((function(e){return e.tsubMiddleware(t.middlewareSettings.routingRules)}))]:[3,2];case 1:return d=I.sent(),[3,3];case 2:d=void 0,I.label=3;case 3:return h=d,x=t,"test"!==mr().NODE_ENV&&Object.keys(x.integrations).length>1||s.length>0?[4,Promise.resolve().then((function(){return Cd})).then((function(i){return i.ajsDestinations(e,t,n.integrations,r,h,s)}))]:[3,5];case 4:return g=I.sent(),[3,6];case 5:g=[],I.label=6;case 6:return p=g,t.legacyVideoPluginsEnabled?[4,Promise.resolve().then((function(){return Pd})).then((function(e){return e.loadLegacyVideoPlugins(n)}))]:[3,8];case 7:I.sent(),I.label=8;case 8:return(null===(a=r.plan)||void 0===a?void 0:a.track)?[4,Promise.resolve().then((function(){return Ad})).then((function(e){var n;return e.schemaFilter(null===(n=r.plan)||void 0===n?void 0:n.track,t)}))]:[3,10];case 9:return v=I.sent(),[3,11];case 10:v=void 0,I.label=11;case 11:return y=v,m=Or(t,i),[4,bo(t,n.integrations,m,i.obfuscate,h,f).catch((function(){return[]}))];case 12:return _=I.sent(),b=wt(wt(wt([To,Cr],l,!0),p,!0),_,!0),y&&b.push(y),!1===(null===(u=r.integrations)||void 0===u?void 0:u.All)&&!r.integrations["Segment.io"]||r.integrations&&!1===r.integrations["Segment.io"]?[3,14]:(E=(w=b).push,[4,Co(n,m["Segment.io"],t.integrations)]);case 13:E.apply(w,[I.sent()]),I.label=14;case 14:return[4,n.register.apply(n,b)];case 15:return S=I.sent(),Object.entries(null!==(c=t.enabledMiddleware)&&void 0!==c?c:{}).some((function(e){return e[1]}))?[4,Promise.resolve().then((function(){return Nd})).then((function(e){var r=e.remoteMiddlewares;return _t(O,void 0,void 0,(function(){var e,o;return bt(this,(function(s){switch(s.label){case 0:return[4,r(S,t,i.obfuscate)];case 1:return e=s.sent(),o=e.map((function(e){return n.addSourceMiddleware(e)})),[2,Promise.all(o)]}}))}))}))]:[3,17];case 16:I.sent(),I.label=17;case 17:return[2,S]}var x}))}))}function Uo(e,t,n){var r,i,o,s,a,u,c;return void 0===t&&(t={}),_t(this,void 0,void 0,(function(){var l,f,h,d,p,g,y,v,m,_,b;return bt(this,(function(w){switch(w.label){case 0:return!0===t.disable?[2,[new vr,bn.system()]]:(t.globalAnalyticsKey&&(R=t.globalAnalyticsKey,Zn=R),e.cdnURL&&(I=e.cdnURL,(x=er())&&(x._cdn=I),_r=I),null===(r=e.cdnSettings)||void 0===r?[3,1]:(f=r,[3,3]));case 1:return[4,(E=e.writeKey,S=e.cdnURL,O=null!=S?S:Er(),dn("".concat(O,"/v1/projects/").concat(E,"/settings")).then((function(e){return e.ok?e.json():e.text().then((function(e){throw new Error(e)}))})).catch((function(e){throw console.error(e.message),e})))];case 2:f=w.sent(),w.label=3;case 3:return l=f,t.updateCDNSettings&&(l=t.updateCDNSettings(l)),"function"!=typeof t.disable?[3,5]:[4,t.disable(l)];case 4:if(w.sent())return[2,[new vr,bn.system()]];w.label=5;case 5:return h=null===(o=null===(i=l.integrations["Segment.io"])||void 0===i?void 0:i.retryQueue)||void 0===o||o,d=vt({retryQueue:h},t),function(e){var t;null===(t=Mo.attach)||void 0===t||t.call(Mo,e)}(p=new yr(e,d)),g=null!==(s=e.plugins)&&void 0!==s?s:[],y=null!==(a=e.classicIntegrations)&&void 0!==a?a:[],_n.initRemoteMetrics(l.metrics),function(e,t){ir(e,t),rr(e,t)}(p,n),[4,jo(e.writeKey,l,p,d,t,g,y)];case 6:return v=w.sent(),m=null!==(u=window.location.search)&&void 0!==u?u:"",_=null!==(c=window.location.hash)&&void 0!==c?c:"",(b=m.length?m:_.replace(/(?=#).*(?=\?)/,"")).includes("ajs_")?[4,p.queryString(b).catch(console.error)]:[3,8];case 7:w.sent(),w.label=8;case 8:return p.initialized=!0,p.emit("initialize",e,t),t.initialPageview&&p.page().catch(console.error),[4,Lo(p,n)];case 9:return w.sent(),[2,[p,v]]}var E,S,O,I,x,R}))}))}var Do=function(e){function t(){var t,n,r,i=this,o=(r=new Promise((function(e,r){t=e,n=r})),{resolve:t,reject:n,promise:r}),s=o.promise,a=o.resolve;return i=e.call(this,(function(e){return s.then((function(t){return Uo(t[0],t[1],e)}))}))||this,i._resolveLoadStart=function(e,t){return a([e,t])},i}return yt(t,e),t.prototype.load=function(e,t){return void 0===t&&(t={}),this._resolveLoadStart(e,t),this},t.load=function(e,n){return void 0===n&&(n={}),(new t).load(e,n)},t.standalone=function(e,n){return t.load({writeKey:e},n).then((function(e){return e[0]}))},t}(fr);let zo;const Fo=new Uint8Array(16);function Bo(){if(!zo&&(zo="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!zo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return zo(Fo)}var Ho=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const qo=[];for(let e=0;e<256;++e)qo.push((e+256).toString(16).slice(1));function $o(e,t=0){return qo[e[t+0]]+qo[e[t+1]]+qo[e[t+2]]+qo[e[t+3]]+"-"+qo[e[t+4]]+qo[e[t+5]]+"-"+qo[e[t+6]]+qo[e[t+7]]+"-"+qo[e[t+8]]+qo[e[t+9]]+"-"+qo[e[t+10]]+qo[e[t+11]]+qo[e[t+12]]+qo[e[t+13]]+qo[e[t+14]]+qo[e[t+15]]}function Vo(e){if(!function(e){return"string"==typeof e&&Ho.test(e)}(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n}function Wo(e,t,n){function r(e,r,i,o){var s;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof r&&(r=Vo(r)),16!==(null===(s=r)||void 0===s?void 0:s.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let a=new Uint8Array(16+e.length);if(a.set(r),a.set(e,r.length),a=n(a),a[6]=15&a[6]|t,a[8]=63&a[8]|128,i){o=o||0;for(let e=0;e<16;++e)i[o+e]=a[e];return i}return $o(a)}try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function Ko(e){return 14+(e+64>>>9<<4)+1}function Go(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function Yo(e,t,n,r,i,o){return Go((s=Go(Go(t,e),Go(r,o)))<<(a=i)|s>>>32-a,n);var s,a}function Qo(e,t,n,r,i,o,s){return Yo(t&n|~t&r,e,t,i,o,s)}function Jo(e,t,n,r,i,o,s){return Yo(t&r|n&~r,e,t,i,o,s)}function Xo(e,t,n,r,i,o,s){return Yo(t^n^r,e,t,i,o,s)}function Zo(e,t,n,r,i,o,s){return Yo(n^(t|~r),e,t,i,o,s)}Wo("v3",48,(function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length,r="0123456789abcdef";for(let i=0;i<n;i+=8){const n=e[i>>5]>>>i%32&255,o=parseInt(r.charAt(n>>>4&15)+r.charAt(15&n),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[Ko(t)-1]=t;let n=1732584193,r=-271733879,i=-1732584194,o=271733878;for(let t=0;t<e.length;t+=16){const s=n,a=r,u=i,c=o;n=Qo(n,r,i,o,e[t],7,-680876936),o=Qo(o,n,r,i,e[t+1],12,-389564586),i=Qo(i,o,n,r,e[t+2],17,606105819),r=Qo(r,i,o,n,e[t+3],22,-1044525330),n=Qo(n,r,i,o,e[t+4],7,-176418897),o=Qo(o,n,r,i,e[t+5],12,1200080426),i=Qo(i,o,n,r,e[t+6],17,-1473231341),r=Qo(r,i,o,n,e[t+7],22,-45705983),n=Qo(n,r,i,o,e[t+8],7,1770035416),o=Qo(o,n,r,i,e[t+9],12,-1958414417),i=Qo(i,o,n,r,e[t+10],17,-42063),r=Qo(r,i,o,n,e[t+11],22,-1990404162),n=Qo(n,r,i,o,e[t+12],7,1804603682),o=Qo(o,n,r,i,e[t+13],12,-40341101),i=Qo(i,o,n,r,e[t+14],17,-1502002290),r=Qo(r,i,o,n,e[t+15],22,1236535329),n=Jo(n,r,i,o,e[t+1],5,-165796510),o=Jo(o,n,r,i,e[t+6],9,-1069501632),i=Jo(i,o,n,r,e[t+11],14,643717713),r=Jo(r,i,o,n,e[t],20,-373897302),n=Jo(n,r,i,o,e[t+5],5,-701558691),o=Jo(o,n,r,i,e[t+10],9,38016083),i=Jo(i,o,n,r,e[t+15],14,-660478335),r=Jo(r,i,o,n,e[t+4],20,-405537848),n=Jo(n,r,i,o,e[t+9],5,568446438),o=Jo(o,n,r,i,e[t+14],9,-1019803690),i=Jo(i,o,n,r,e[t+3],14,-187363961),r=Jo(r,i,o,n,e[t+8],20,1163531501),n=Jo(n,r,i,o,e[t+13],5,-1444681467),o=Jo(o,n,r,i,e[t+2],9,-51403784),i=Jo(i,o,n,r,e[t+7],14,1735328473),r=Jo(r,i,o,n,e[t+12],20,-1926607734),n=Xo(n,r,i,o,e[t+5],4,-378558),o=Xo(o,n,r,i,e[t+8],11,-2022574463),i=Xo(i,o,n,r,e[t+11],16,1839030562),r=Xo(r,i,o,n,e[t+14],23,-35309556),n=Xo(n,r,i,o,e[t+1],4,-1530992060),o=Xo(o,n,r,i,e[t+4],11,1272893353),i=Xo(i,o,n,r,e[t+7],16,-155497632),r=Xo(r,i,o,n,e[t+10],23,-1094730640),n=Xo(n,r,i,o,e[t+13],4,681279174),o=Xo(o,n,r,i,e[t],11,-358537222),i=Xo(i,o,n,r,e[t+3],16,-722521979),r=Xo(r,i,o,n,e[t+6],23,76029189),n=Xo(n,r,i,o,e[t+9],4,-640364487),o=Xo(o,n,r,i,e[t+12],11,-421815835),i=Xo(i,o,n,r,e[t+15],16,530742520),r=Xo(r,i,o,n,e[t+2],23,-995338651),n=Zo(n,r,i,o,e[t],6,-198630844),o=Zo(o,n,r,i,e[t+7],10,1126891415),i=Zo(i,o,n,r,e[t+14],15,-1416354905),r=Zo(r,i,o,n,e[t+5],21,-57434055),n=Zo(n,r,i,o,e[t+12],6,1700485571),o=Zo(o,n,r,i,e[t+3],10,-1894986606),i=Zo(i,o,n,r,e[t+10],15,-1051523),r=Zo(r,i,o,n,e[t+1],21,-2054922799),n=Zo(n,r,i,o,e[t+8],6,1873313359),o=Zo(o,n,r,i,e[t+15],10,-30611744),i=Zo(i,o,n,r,e[t+6],15,-1560198380),r=Zo(r,i,o,n,e[t+13],21,1309151649),n=Zo(n,r,i,o,e[t+4],6,-145523070),o=Zo(o,n,r,i,e[t+11],10,-1120210379),i=Zo(i,o,n,r,e[t+2],15,718787259),r=Zo(r,i,o,n,e[t+9],21,-343485551),n=Go(n,s),r=Go(r,a),i=Go(i,u),o=Go(o,c)}return[n,r,i,o]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(Ko(t));for(let r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))}));var es={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ts(e,t,n){if(es.randomUUID&&!t&&!e)return es.randomUUID();const r=(e=e||{}).random||(e.rng||Bo)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return $o(r)}function ns(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function rs(e,t){return e<<t|e>>>32-t}Wo("v5",80,(function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const r=e.length/4+2,i=Math.ceil(r/16),o=new Array(i);for(let t=0;t<i;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];o[t]=n}o[i-1][14]=8*(e.length-1)/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<i;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=o[e][t];for(let e=16;e<80;++e)r[e]=rs(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],s=n[1],a=n[2],u=n[3],c=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),o=rs(i,5)+ns(n,s,a,u)+c+t[n]+r[e]>>>0;c=u,u=a,a=rs(s,30)>>>0,s=i,i=o}n[0]=n[0]+i>>>0,n[1]=n[1]+s>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+u>>>0,n[4]=n[4]+c>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));let is=null;const os={};function ss(){const e=m.exports.useCallback(((e={},t={})=>c(this,void 0,void 0,(function*(){if(is)return;{const n=Do.load({writeKey:"q3dbZMDYOGQbk5GPl7eY7zWaAmNS5wk9",cdnURL:"https://proxyseg.api.live.ledger.com/"});yield n.identify(ts()),is={analytics:n,globalOptions:t,globalProperties:e}}}))),[]),t=m.exports.useCallback((e=>c(this,void 0,void 0,(function*(){is&&(os[Object.keys(os).length]=e)}))),[]),n=m.exports.useCallback((()=>c(this,void 0,void 0,(function*(){0!=Object.keys(os).length&&is&&(yield is.analytics.track("userFlow",os))}))),[]);return{init:e,track:m.exports.useCallback(((e,t={})=>c(this,void 0,void 0,(function*(){if(!is)return;const n=Object.assign(Object.assign({},is.globalProperties),t);yield is.analytics.track(e,n,is.globalOptions)}))),[]),page:m.exports.useCallback(((e,t={})=>c(this,void 0,void 0,(function*(){if(!is)return;const n=Object.assign(Object.assign({},is.globalProperties),t);yield is.analytics.page(e,n,is.globalOptions)}))),[]),addStepToFlow:t,sendUserFlow:n}}let as=e=>{};const us=({onClose:e,children:t})=>{const{sendUserFlow:n,addStepToFlow:r}=ss(),[i,o]=m.exports.useState(!0);as=o;const s=()=>{as(!1),r("Close"),n(),e&&e()},a=e=>{var t;"ModalWrapper"===(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.id)&&s()};return i?y.exports.jsxs(y.exports.Fragment,{children:[y.exports.jsx(tt,{}),y.exports.jsx(ot,Object.assign({id:"ModalWrapper",onClick:a},{children:y.exports.jsxs(st,{children:[y.exports.jsxs(ct,{children:[y.exports.jsx("img",{src:"data:image/svg+xml,%3csvg width='72' height='24' viewBox='0 0 72 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M61.3616 22.4887V23.9996H71.7318V17.1853H70.2208V22.4887H61.3616ZM61.3616 0V1.51096H70.2208V6.81473H71.7318V0H61.3616ZM56.0137 11.689V8.17796H58.3842C59.5398 8.17796 59.9546 8.56305 59.9546 9.61506V10.2372C59.9546 11.3186 59.5545 11.689 58.3842 11.689H56.0137ZM59.7764 12.311C60.8578 12.0296 61.6133 11.022 61.6133 9.82231C61.6133 9.06683 61.3172 8.38521 60.7542 7.83698C60.0432 7.15536 59.0948 6.81473 57.8653 6.81473H54.5322V17.1849H56.0137V13.0518H58.2361C59.3767 13.0518 59.836 13.5258 59.836 14.7112V17.1853H61.3469V14.9482C61.3469 13.3186 60.9618 12.6965 59.7764 12.5187V12.311ZM47.303 12.6517H51.866V11.2888H47.303V8.17761H52.3102V6.81473H45.7916V17.1849H52.5325V15.822H47.303V12.6517ZM42.3398 13.1999V13.9109C42.3398 15.4072 41.7916 15.8963 40.414 15.8963H40.0881C38.7102 15.8963 38.0436 15.4516 38.0436 13.3925V10.6072C38.0436 8.53329 38.7399 8.10338 40.1175 8.10338H40.4137C41.7618 8.10338 42.1914 8.60716 42.2061 9.99979H43.8357C43.6876 7.9553 42.3248 6.66665 40.2803 6.66665C39.2878 6.66665 38.4581 6.97787 37.836 7.57021C36.9027 8.44437 36.3842 9.92593 36.3842 11.9998C36.3842 13.9999 36.8288 15.4814 37.7471 16.3997C38.3692 17.0071 39.2286 17.333 40.073 17.333C40.9619 17.333 41.7769 16.9773 42.1914 16.2071H42.3986V17.1849H43.7615V11.837H39.7467V13.1999H42.3398ZM29.2737 8.17761H30.8886C32.4146 8.17761 33.2443 8.5627 33.2443 10.6369V13.3627C33.2443 15.4366 32.4146 15.822 30.8886 15.822H29.2737V8.17761ZM31.0216 17.1853C33.8513 17.1853 34.903 15.0372 34.903 12.0002C34.903 8.91874 33.7771 6.81509 30.9919 6.81509H27.7917V17.1853H31.0216ZM20.6367 12.6517H25.1997V11.2888H20.6367V8.17761H25.644V6.81473H19.1254V17.1849H25.8663V15.822H20.6367V12.6517ZM11.8962 6.81473H10.3852V17.1849H17.2V15.822H11.8962V6.81473ZM0 17.1853V24H10.3702V22.4887H1.51096V17.1853H0ZM0 0V6.81473H1.51096V1.51096H10.3702V0H0Z' fill='white'/%3e%3c/svg%3e"}),y.exports.jsx(at,Object.assign({onClick:s},{children:y.exports.jsx("img",{src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M22 2L2 22' stroke='white' stroke-width='3'/%3e%3cpath d='M2 2L22 22' stroke='white' stroke-width='3'/%3e%3c/svg%3e"})}))]}),y.exports.jsx(y.exports.Fragment,{children:t})]})}))]}):null};var cs,ls,fs,hs,ds={exports:{}},ps={},gs={exports:{}},ys={};function vs(){return ls||(ls=1,function(e){e.exports=(cs||(cs=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,s=o>>>1;r<s;){var a=2*(r+1)-1,u=e[a],c=a+1,l=e[c];if(0>i(u,n))c<o&&0>i(l,u)?(e[r]=l,e[c]=n,r=c):(e[r]=u,e[a]=n,r=a);else{if(!(c<o&&0>i(l,n)))break e;e[r]=l,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var u=[],c=[],l=1,f=null,h=3,d=!1,p=!1,g=!1,y="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,m="undefined"!=typeof setImmediate?setImmediate:null;function _(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(u,i)}i=n(c)}}function b(e){if(g=!1,_(e),!p)if(null!==n(u))p=!0,N(w);else{var t=n(c);null!==t&&T(b,t.startTime-e)}}function w(t,i){p=!1,g&&(g=!1,v(I),I=-1),d=!0;var o=h;try{for(_(i),f=n(u);null!==f&&(!(f.expirationTime>i)||t&&!k());){var s=f.callback;if("function"==typeof s){f.callback=null,h=f.priorityLevel;var a=s(f.expirationTime<=i);i=e.unstable_now(),"function"==typeof a?f.callback=a:f===n(u)&&r(u),_(i)}else r(u);f=n(u)}if(null!==f)var l=!0;else{var y=n(c);null!==y&&T(b,y.startTime-i),l=!1}return l}finally{f=null,h=o,d=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var E,S=!1,O=null,I=-1,x=5,R=-1;function k(){return!(e.unstable_now()-R<x)}function C(){if(null!==O){var t=e.unstable_now();R=t;var n=!0;try{n=O(!0,t)}finally{n?E():(S=!1,O=null)}}else S=!1}if("function"==typeof m)E=function(){m(C)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,A=P.port2;P.port1.onmessage=C,E=function(){A.postMessage(null)}}else E=function(){y(C,0)};function N(e){O=e,S||(S=!0,E())}function T(t,n){I=y((function(){t(e.unstable_now())}),n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){p||d||(p=!0,N(w))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):x=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(e){switch(h){case 1:case 2:case 3:var t=3;break;default:t=h}var n=h;h=t;try{return e()}finally{h=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=h;h=e;try{return t()}finally{h=n}},e.unstable_scheduleCallback=function(r,i,o){var s=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?s+o:s,r){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return r={id:l++,callback:i,priorityLevel:r,startTime:o,expirationTime:a=o+a,sortIndex:-1},o>s?(r.sortIndex=o,t(c,r),null===n(u)&&r===n(c)&&(g?(v(I),I=-1):g=!0,T(b,o-s))):(r.sortIndex=a,t(u,r),p||d||(p=!0,N(w))),r},e.unstable_shouldYield=k,e.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}}(ys)),ys)}(gs)),gs.exports}
172
+ `;var gt=function(e,t){return gt=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])},gt(e,t)};function yt(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}gt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var vt=function(){return vt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},vt.apply(this,arguments)};function mt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function _t(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function bt(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function wt(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Et=function(e,t){return Et=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])},Et(e,t)};function St(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}Et(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ot=function(){return Ot=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ot.apply(this,arguments)};function It(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function xt(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function Rt(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function kt(e,t,n){t.split&&(t=t.split("."));for(var r,i,o=0,s=t.length,a=e;o<s&&"__proto__"!==(i=t[o++])&&"constructor"!==i&&"prototype"!==i;)a=a[i]=o===s?n:typeof(r=a[i])==typeof t?r:0*t[o]!=0||~(""+t[o]).indexOf(".")?{}:[]}"function"==typeof SuppressedError&&SuppressedError;var Ct=function(e){function t(t,n){var r=e.call(this,"".concat(t," ").concat(n))||this;return r.field=t,r}return St(t,e),t}(Error);function Pt(e){return"string"==typeof e}function At(e){return"number"==typeof e}function Nt(e){return"function"==typeof e}function Tt(e){return null!=e}function Mt(e){return"object"===Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var Lt="is not a string",jt="is not an object",Ut="is nil";function Dt(e,t){return new Promise((function(n,r){var i=setTimeout((function(){r(Error("Promise timed out"))}),t);e.then((function(e){return clearTimeout(i),n(e)})).catch(r)}))}function zt(e,t,n){var r;return(r=n,new Promise((function(e){return setTimeout(e,r)}))).then((function(){return Dt(function(){try{return Promise.resolve(t(e))}catch(e){return Promise.reject(e)}}(),1e3)})).catch((function(t){null==e||e.log("warn","Callback Error",{error:t}),null==e||e.stats.increment("callback_error")})).then((function(){return e}))}var Ft=function(){function e(e){var t;this.callbacks={},this.warned=!1,this.maxListeners=null!==(t=null==e?void 0:e.maxListeners)&&void 0!==t?t:10}return e.prototype.warnIfPossibleMemoryLeak=function(e){this.warned||this.maxListeners&&this.callbacks[e].length>this.maxListeners&&(console.warn("Event Emitter: Possible memory leak detected; ".concat(String(e)," has exceeded ").concat(this.maxListeners," listeners.")),this.warned=!0)},e.prototype.on=function(e,t){return this.callbacks[e]?(this.callbacks[e].push(t),this.warnIfPossibleMemoryLeak(e)):this.callbacks[e]=[t],this},e.prototype.once=function(e,t){var n=this,r=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];n.off(e,r),t.apply(n,i)};return this.on(e,r),this},e.prototype.off=function(e,t){var n,r=(null!==(n=this.callbacks[e])&&void 0!==n?n:[]).filter((function(e){return e!==t}));return this.callbacks[e]=r,this},e.prototype.emit=function(e){for(var t,n=this,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return(null!==(t=this.callbacks[e])&&void 0!==t?t:[]).forEach((function(e){e.apply(n,r)})),this},e}();for(var Bt,Ht="onRemoveFromFuture",qt=function(e){function t(t,n,r){var i=e.call(this)||this;return i.future=[],i.maxAttempts=t,i.queue=n,i.seen=null!=r?r:{},i}return St(t,e),t.prototype.push=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map((function(t){return!(e.updateAttempts(t)>e.maxAttempts||e.includes(t))&&(e.queue.push(t),!0)}));return this.queue=this.queue.sort((function(t,n){return e.getAttempts(t)-e.getAttempts(n)})),r},t.prototype.pushWithBackoff=function(e){var t=this;if(0===this.getAttempts(e))return this.push(e)[0];var n=this.updateAttempts(e);if(n>this.maxAttempts||this.includes(e))return!1;var r=function(e){var t=Math.random()+1,n=e.minTimeout,r=void 0===n?500:n,i=e.factor,o=void 0===i?2:i,s=e.attempt,a=e.maxTimeout,u=void 0===a?1/0:a;return Math.min(t*r*Math.pow(o,s),u)}({attempt:n-1});return setTimeout((function(){t.queue.push(e),t.future=t.future.filter((function(t){return t.id!==e.id})),t.emit(Ht)}),r),this.future.push(e),!0},t.prototype.getAttempts=function(e){var t;return null!==(t=this.seen[e.id])&&void 0!==t?t:0},t.prototype.updateAttempts=function(e){return this.seen[e.id]=this.getAttempts(e)+1,this.getAttempts(e)},t.prototype.includes=function(e){return this.queue.includes(e)||this.future.includes(e)||Boolean(this.queue.find((function(t){return t.id===e.id})))||Boolean(this.future.find((function(t){return t.id===e.id})))},t.prototype.pop=function(){return this.queue.shift()},Object.defineProperty(t.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"todo",{get:function(){return this.queue.length+this.future.length},enumerable:!1,configurable:!0}),t}(Ft),$t=256,Vt=[];$t--;)Vt[$t]=($t+256).toString(16).substring(1);function Wt(){var e,t=0,n="";if(!Bt||$t+16>256){for(Bt=Array(t=256);t--;)Bt[t]=256*Math.random()|0;t=$t=0}for(;t<16;t++)e=Bt[$t+t],n+=6==t?Vt[15&e|64]:8==t?Vt[63&e|128]:Vt[e],1&t&&t>1&&t<11&&(n+="-");return $t++,n}var Kt=function(){function e(){this._logs=[]}return e.prototype.log=function(e,t,n){var r=new Date;this._logs.push({level:e,message:t,time:r,extras:n})},Object.defineProperty(e.prototype,"logs",{get:function(){return this._logs},enumerable:!1,configurable:!0}),e.prototype.flush=function(){if(this.logs.length>1){var e=this._logs.reduce((function(e,t){var n,r,i,o=Ot(Ot({},t),{json:JSON.stringify(t.extras,null," "),extras:t.extras});delete o.time;var s=null!==(i=null===(r=t.time)||void 0===r?void 0:r.toISOString())&&void 0!==i?i:"";return e[s]&&(s="".concat(s,"-").concat(Math.random())),Ot(Ot({},e),((n={})[s]=o,n))}),{});console.table?console.table(e):console.log(e)}else this.logs.forEach((function(e){var t=e.level,n=e.message,r=e.extras;"info"===t||"debug"===t?console.log(n,null!=r?r:""):console[t](n,null!=r?r:"")}));this._logs=[]},e}(),Gt=function(){function e(){this.metrics=[]}return e.prototype.increment=function(e,t,n){void 0===t&&(t=1),this.metrics.push({metric:e,value:t,tags:null!=n?n:[],type:"counter",timestamp:Date.now()})},e.prototype.gauge=function(e,t,n){this.metrics.push({metric:e,value:t,tags:null!=n?n:[],type:"gauge",timestamp:Date.now()})},e.prototype.flush=function(){var e=this.metrics.map((function(e){return Ot(Ot({},e),{tags:e.tags.join(",")})}));console.table?console.table(e):console.log(e),this.metrics=[]},e.prototype.serialize=function(){return this.metrics.map((function(e){return{m:e.metric,v:e.value,t:e.tags,k:(t=e.type,{gauge:"g",counter:"c"}[t]),e:e.timestamp};var t}))},e}(),Yt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return St(t,e),t.prototype.gauge=function(){},t.prototype.increment=function(){},t.prototype.flush=function(){},t.prototype.serialize=function(){return[]},t}(Gt),Qt=function(e){var t,n,r;this.retry=null===(t=e.retry)||void 0===t||t,this.type=null!==(n=e.type)&&void 0!==n?n:"plugin Error",this.reason=null!==(r=e.reason)&&void 0!==r?r:""},Jt=function(){function e(e,t,n,r){void 0===t&&(t=Wt()),void 0===n&&(n=new Yt),void 0===r&&(r=new Kt),this.attempts=0,this.event=e,this._id=t,this.logger=r,this.stats=n}return e.system=function(){},e.prototype.isSame=function(e){return e.id===this.id},e.prototype.cancel=function(e){if(e)throw e;throw new Qt({reason:"Context Cancel"})},e.prototype.log=function(e,t,n){this.logger.log(e,t,n)},Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),e.prototype.updateEvent=function(e,t){var n;if("integrations"===e.split(".")[0]){var r=e.split(".")[1];if(!1===(null===(n=this.event.integrations)||void 0===n?void 0:n[r]))return this.event}return kt(this.event,e,t),this.event},e.prototype.failedDelivery=function(){return this._failedDelivery},e.prototype.setFailedDelivery=function(e){this._failedDelivery=e},e.prototype.logs=function(){return this.logger.logs},e.prototype.flush=function(){this.logger.flush(),this.stats.flush()},e.prototype.toJSON=function(){return{id:this._id,event:this.event,logs:this.logger.logs,metrics:this.stats.metrics}},e}();function Xt(e,t){e.log("debug","plugin",{plugin:t.name});var n=(new Date).getTime(),r=t[e.event.type];if(void 0===r)return Promise.resolve(e);var i=function(e){return It(this,void 0,void 0,(function(){var t;return xt(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:return[2,n.sent()];case 2:return t=n.sent(),[2,Promise.reject(t)];case 3:return[2]}}))}))}((function(){return r.apply(t,[e])})).then((function(e){var r=(new Date).getTime()-n;return e.stats.gauge("plugin_time",r,["plugin:".concat(t.name)]),e})).catch((function(n){if(n instanceof Qt&&"middleware_cancellation"===n.type)throw n;return n instanceof Qt?(e.log("warn",n.type,{plugin:t.name,error:n}),n):(e.log("error","plugin Error",{plugin:t.name,error:n}),e.stats.increment("plugin_error",1,["plugin:".concat(t.name)]),n)}));return i}function Zt(e,t){return Xt(e,t).then((function(t){if(t instanceof Jt)return t;e.log("debug","Context canceled"),e.stats.increment("context_canceled"),e.cancel(t)}))}var en=function(e){function t(t){var n,r,i,o=e.call(this)||this;return o.criticalTasks=(i=0,{done:function(){return n},run:function(e){var t,o=e();return"object"==typeof(t=o)&&null!==t&&"then"in t&&"function"==typeof t.then&&(1==++i&&(n=new Promise((function(e){return r=e}))),o.finally((function(){return 0==--i&&r()}))),o}}),o.plugins=[],o.failedInitializations=[],o.flushing=!1,o.queue=t,o.queue.on(Ht,(function(){o.scheduleFlush(0)})),o}return St(t,e),t.prototype.register=function(e,t,n){return It(this,void 0,void 0,(function(){var r=this;return xt(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve(t.load(e,n)).then((function(){r.plugins.push(t)})).catch((function(n){if("destination"===t.type)return r.failedInitializations.push(t.name),console.warn(t.name,n),void e.log("warn","Failed to load destination",{plugin:t.name,error:n});throw n}))];case 1:return i.sent(),[2]}}))}))},t.prototype.deregister=function(e,t,n){return It(this,void 0,void 0,(function(){var r;return xt(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),t.unload?[4,Promise.resolve(t.unload(e,n))]:[3,2];case 1:i.sent(),i.label=2;case 2:return this.plugins=this.plugins.filter((function(e){return e.name!==t.name})),[3,4];case 3:return r=i.sent(),e.log("warn","Failed to unload destination",{plugin:t.name,error:r}),[3,4];case 4:return[2]}}))}))},t.prototype.dispatch=function(e){return It(this,void 0,void 0,(function(){var t;return xt(this,(function(n){return e.log("debug","Dispatching"),e.stats.increment("message_dispatched"),this.queue.push(e),t=this.subscribeToDelivery(e),this.scheduleFlush(0),[2,t]}))}))},t.prototype.subscribeToDelivery=function(e){return It(this,void 0,void 0,(function(){var t=this;return xt(this,(function(n){return[2,new Promise((function(n){var r=function(i,o){i.isSame(e)&&(t.off("flush",r),n(i))};t.on("flush",r)}))]}))}))},t.prototype.dispatchSingle=function(e){return It(this,void 0,void 0,(function(){var t=this;return xt(this,(function(n){return e.log("debug","Dispatching"),e.stats.increment("message_dispatched"),this.queue.updateAttempts(e),e.attempts=1,[2,this.deliver(e).catch((function(n){return t.enqueuRetry(n,e)?t.subscribeToDelivery(e):(e.setFailedDelivery({reason:n}),e)}))]}))}))},t.prototype.isEmpty=function(){return 0===this.queue.length},t.prototype.scheduleFlush=function(e){var t=this;void 0===e&&(e=500),this.flushing||(this.flushing=!0,setTimeout((function(){t.flush().then((function(){setTimeout((function(){t.flushing=!1,t.queue.length&&t.scheduleFlush(0)}),0)}))}),e))},t.prototype.deliver=function(e){return It(this,void 0,void 0,(function(){var t,n,r,i;return xt(this,(function(o){switch(o.label){case 0:return[4,this.criticalTasks.done()];case 1:o.sent(),t=Date.now(),o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.flushOne(e)];case 3:return e=o.sent(),n=Date.now()-t,this.emit("delivery_success",e),e.stats.gauge("delivered",n),e.log("debug","Delivered",e.event),[2,e];case 4:throw r=o.sent(),i=r,e.log("error","Failed to deliver",i),this.emit("delivery_failure",e,i),e.stats.increment("delivery_failed"),r;case 5:return[2]}}))}))},t.prototype.enqueuRetry=function(e,t){return!(e instanceof Qt&&!e.retry)&&this.queue.pushWithBackoff(t)},t.prototype.flush=function(){return It(this,void 0,void 0,(function(){var e,t;return xt(this,(function(n){switch(n.label){case 0:if(0===this.queue.length)return[2,[]];if(!(e=this.queue.pop()))return[2,[]];e.attempts=this.queue.getAttempts(e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.deliver(e)];case 2:return e=n.sent(),this.emit("flush",e,!0),[3,4];case 3:return t=n.sent(),this.enqueuRetry(t,e)||(e.setFailedDelivery({reason:t}),this.emit("flush",e,!1)),[2,[]];case 4:return[2,[e]]}}))}))},t.prototype.isReady=function(){return!0},t.prototype.availableExtensions=function(e){var t,n,r=this.plugins.filter((function(t){var n,r,i;if("destination"!==t.type&&"Segment.io"!==t.name)return!0;var o=void 0;return null===(n=t.alternativeNames)||void 0===n||n.forEach((function(t){void 0!==e[t]&&(o=e[t])})),null!==(i=null!==(r=e[t.name])&&void 0!==r?r:o)&&void 0!==i?i:!1!==("Segment.io"===t.name||e.All)})),i=(t="type",n={},r.forEach((function(e){var r,i=void 0;if("string"==typeof t){var o=e[t];i="string"!=typeof o?JSON.stringify(o):o}else t instanceof Function&&(i=t(e));void 0!==i&&(n[i]=Rt(Rt([],null!==(r=n[i])&&void 0!==r?r:[],!0),[e],!1))})),n),o=i.before,s=void 0===o?[]:o,a=i.enrichment,u=void 0===a?[]:a,c=i.destination,l=void 0===c?[]:c,f=i.after;return{before:s,enrichment:u,destinations:l,after:void 0===f?[]:f}},t.prototype.flushOne=function(e){var t,n;return It(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f,h,d,p,g,y;return xt(this,(function(v){switch(v.label){case 0:if(!this.isReady())throw new Error("Not ready");e.attempts>1&&this.emit("delivery_retry",e),r=this.availableExtensions(null!==(t=e.event.integrations)&&void 0!==t?t:{}),i=r.before,o=r.enrichment,s=0,a=i,v.label=1;case 1:return s<a.length?(u=a[s],[4,Zt(e,u)]):[3,4];case 2:(h=v.sent())instanceof Jt&&(e=h),this.emit("message_enriched",e,u),v.label=3;case 3:return s++,[3,1];case 4:c=0,l=o,v.label=5;case 5:return c<l.length?(f=l[c],[4,Xt(e,f)]):[3,8];case 6:(h=v.sent())instanceof Jt&&(e=h),this.emit("message_enriched",e,f),v.label=7;case 7:return c++,[3,5];case 8:return d=this.availableExtensions(null!==(n=e.event.integrations)&&void 0!==n?n:{}),p=d.destinations,g=d.after,[4,new Promise((function(t,n){setTimeout((function(){var r=p.map((function(t){return Xt(e,t)}));Promise.all(r).then(t).catch(n)}),0)}))];case 9:return v.sent(),e.stats.increment("message_delivered"),this.emit("message_delivered",e),y=g.map((function(t){return Xt(e,t)})),[4,Promise.all(y)];case 10:return v.sent(),[2,e]}}))}))},t}(Ft);function tn(e,t,n,r){return It(this,void 0,void 0,(function(){var i,o;return xt(this,(function(s){switch(s.label){case 0:return n.emit("dispatch_start",e),i=Date.now(),t.isEmpty()?[4,t.dispatchSingle(e)]:[3,2];case 1:return o=s.sent(),[3,4];case 2:return[4,t.dispatch(e)];case 3:o=s.sent(),s.label=4;case 4:return(null==r?void 0:r.callback)?[4,zt(o,r.callback,(a=i,u=r.timeout,c=Date.now()-a,Math.max((null!=u?u:300)-c,0)))]:[3,6];case 5:o=s.sent(),s.label=6;case 6:return(null==r?void 0:r.debug)&&o.flush(),[2,o]}var a,u,c}))}))}function nn(e,t,n,r){var i,o=[e,t,n,r],s=Mt(e)?e.event:e;if(!s||!Pt(s))throw new Error("Event missing");var a=Mt(e)?null!==(i=e.properties)&&void 0!==i?i:{}:Mt(t)?t:{},u={};return Nt(n)||(u=null!=n?n:{}),Mt(e)&&!Nt(t)&&(u=null!=t?t:{}),[s,a,u,o.find(Nt)]}function rn(e,t,n,r,i){var o,s,a=null,u=null,c=[e,t,n,r,i],l=c.filter(Pt);void 0!==l[0]&&void 0!==l[1]&&(a=l[0],u=l[1]),1===l.length&&(a=null,u=l[0]);var f=c.find(Nt),h=c.filter((function(e){return null===u?Mt(e):Mt(e)||null===e})),d=null!==(o=h[0])&&void 0!==o?o:{},p=null!==(s=h[1])&&void 0!==s?s:{};return[a,u,d,p,f]}var on=function(e){return function(){for(var t,n,r,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];for(var s={},a=["callback","options","traits","id"],u=0,c=i;u<c.length;u++){var l=c[u],f=a.pop();if("id"===f){if(Pt(l)||At(l)){s.id=l.toString();continue}if(null==l)continue;f=a.pop()}if("traits"!==f&&"options"!==f||null!=l&&!Mt(l)||(s[f]=l),Nt(l)){s.callback=l;break}}return[null!==(t=s.id)&&void 0!==t?t:e.id(),null!==(n=s.traits)&&void 0!==n?n:{},null!==(r=s.options)&&void 0!==r?r:{},s.callback]}};function sn(e,t,n,r){At(e)&&(e=e.toString()),At(t)&&(t=t.toString());var i=[e,t,n,r],o=i.filter(Pt),s=o[0],a=void 0===s?e:s,u=o[1],c=void 0===u?null:u,l=i.filter(Mt)[0];return[a,c,void 0===l?{}:l,i.find(Nt)]}function an(){return"undefined"!=typeof window}function un(){return!an()}function cn(){return!an()||window.navigator.onLine}function ln(){return!cn()}function fn(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}var hn=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:null},dn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=hn();return(n&&n.fetch||fn).apply(void 0,e)},pn="1.63.0";var gn="api.segment.io/v1";function yn(e){console.error("Error sending segment performance metrics",e)}var vn,mn=function(){function e(e){var t,n,r,i,o=this;if(this.host=null!==(t=null==e?void 0:e.host)&&void 0!==t?t:gn,this.sampleRate=null!==(n=null==e?void 0:e.sampleRate)&&void 0!==n?n:1,this.flushTimer=null!==(r=null==e?void 0:e.flushTimer)&&void 0!==r?r:3e4,this.maxQueueSize=null!==(i=null==e?void 0:e.maxQueueSize)&&void 0!==i?i:20,this.queue=[],this.sampleRate>0){var s=!1,a=function(){s||(s=!0,o.flush().catch(yn),s=!1,setTimeout(a,o.flushTimer))};a()}}return e.prototype.increment=function(e,t){if(e.includes("analytics_js.")&&0!==t.length&&!(Math.random()>this.sampleRate||this.queue.length>=this.maxQueueSize)){var n=function(e,t,n){var r=t.reduce((function(e,t){var n=t.split(":"),r=n[0],i=n[1];return e[r]=i,e}),{});return{type:"Counter",metric:e,value:1,tags:vt(vt({},r),{library:"analytics.js",library_version:"web"===n?"next-".concat(pn):"npm:next-".concat(pn)})}}(e,t,"npm");this.queue.push(n),e.includes("error")&&this.flush().catch(yn)}},e.prototype.flush=function(){return _t(this,void 0,void 0,(function(){var e=this;return bt(this,(function(t){switch(t.label){case 0:return this.queue.length<=0?[2]:[4,this.send().catch((function(t){yn(t),e.sampleRate=0}))];case 1:return t.sent(),[2]}}))}))},e.prototype.send=function(){return _t(this,void 0,void 0,(function(){var e,t,n;return bt(this,(function(r){return e={series:this.queue},this.queue=[],t={"Content-Type":"text/plain"},n="https://".concat(this.host,"/m"),[2,dn(n,{headers:t,body:JSON.stringify(e),method:"POST"})]}))}))},e}(),_n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return yt(t,e),t.initRemoteMetrics=function(e){vn=new mn(e)},t.prototype.increment=function(t,n,r){e.prototype.increment.call(this,t,n,r),null==vn||vn.increment(t,null!=r?r:[])},t}(Gt),bn=function(e){function t(t,n){return e.call(this,t,n,new _n)||this}return yt(t,e),t.system=function(){return new this({type:"track",event:"system"})},t}(Jt),wn={exports:{}};!function(e,t){e.exports=function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],i=e[2],o=e[3];r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&i)+t[1]-389564586|0)<<12|o>>>20)+n|0)&n|~o&r)+t[2]+606105819|0)<<17|i>>>15)+o|0)&o|~i&n)+t[3]-1044525330|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&i)+t[5]+1200080426|0)<<12|o>>>20)+n|0)&n|~o&r)+t[6]-1473231341|0)<<17|i>>>15)+o|0)&o|~i&n)+t[7]-45705983|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&i)+t[9]-1958414417|0)<<12|o>>>20)+n|0)&n|~o&r)+t[10]-42063|0)<<17|i>>>15)+o|0)&o|~i&n)+t[11]-1990404162|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&i)+t[13]-40341101|0)<<12|o>>>20)+n|0)&n|~o&r)+t[14]-1502002290|0)<<17|i>>>15)+o|0)&o|~i&n)+t[15]+1236535329|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[1]-165796510|0)<<5|n>>>27)+r|0)&i|r&~i)+t[6]-1069501632|0)<<9|o>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|i>>>18)+o|0)&n|o&~n)+t[0]-373897302|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[5]-701558691|0)<<5|n>>>27)+r|0)&i|r&~i)+t[10]+38016083|0)<<9|o>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|i>>>18)+o|0)&n|o&~n)+t[4]-405537848|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[9]+568446438|0)<<5|n>>>27)+r|0)&i|r&~i)+t[14]-1019803690|0)<<9|o>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|i>>>18)+o|0)&n|o&~n)+t[8]+1163531501|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&i|r&~i)+t[2]-51403784|0)<<9|o>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|i>>>18)+o|0)&n|o&~n)+t[12]-1926607734|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^i)+t[8]-2022574463|0)<<11|o>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|i>>>16)+o|0)^o^n)+t[14]-35309556|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^i)+t[4]+1272893353|0)<<11|o>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|i>>>16)+o|0)^o^n)+t[10]-1094730640|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^i)+t[0]-358537222|0)<<11|o>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|i>>>16)+o|0)^o^n)+t[6]+76029189|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^i)+t[12]-421815835|0)<<11|o>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|i>>>16)+o|0)^o^n)+t[2]-995338651|0)<<23|r>>>9)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~i))+t[7]+1126891415|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[14]-1416354905|0)<<15|i>>>17)+o|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~i))+t[3]-1894986606|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[10]-1051523|0)<<15|i>>>17)+o|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~i))+t[15]-30611744|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[6]-1560198380|0)<<15|i>>>17)+o|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~i))+t[11]-1120210379|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[2]+718787259|0)<<15|i>>>17)+o|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+i|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=i+e[2]|0,e[3]=o+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function i(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function o(e){var t,i,o,s,a,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(l,r(e.substring(t-64,t)));for(i=(e=e.substring(t-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<i;t+=1)o[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(l,o),t=0;t<16;t+=1)o[t]=0;return s=(s=8*c).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(s[2],16),u=parseInt(s[1],16)||0,o[14]=a,o[15]=u,n(l,o),l}function s(e){var t,r,o,s,a,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(l,i(e.subarray(t-64,t)));for(r=(e=t-64<c?e.subarray(t-64):new Uint8Array(0)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)o[t>>2]|=e[t]<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(l,o),t=0;t<16;t+=1)o[t]=0;return s=(s=8*c).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(s[2],16),u=parseInt(s[1],16)||0,o[14]=a,o[15]=u,n(l,o),l}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function u(e){var t;for(t=0;t<e.length;t+=1)e[t]=a(e[t]);return e.join("")}function c(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function l(e,t){var n,r=e.length,i=new ArrayBuffer(r),o=new Uint8Array(i);for(n=0;n<r;n+=1)o[n]=e.charCodeAt(n);return t?o:i}function f(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function h(e,t,n){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e)),r.set(new Uint8Array(t),e.byteLength),n?r:r.buffer}function d(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function p(){this.reset()}return u(o("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,s,a,u=this.byteLength,c=t(n,u),l=u;return r!==e&&(l=t(r,u)),c>l?new ArrayBuffer(0):(i=l-c,o=new ArrayBuffer(i),s=new Uint8Array(o),a=new Uint8Array(this,c,i),s.set(a),o)}}(),p.prototype.append=function(e){return this.appendBinary(c(e)),this},p.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,i=this._buff.length;for(t=64;t<=i;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},p.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)o[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=u(this._hash),e&&(n=d(n)),this.reset(),n},p.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},p.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},p.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},p.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},p.prototype._finish=function(e,t){var r,i,o,s=t;if(e[s>>2]|=128<<(s%4<<3),s>55)for(n(this._hash,e),s=0;s<16;s+=1)e[s]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(r[2],16),o=parseInt(r[1],16)||0,e[14]=i,e[15]=o,n(this._hash,e)},p.hash=function(e,t){return p.hashBinary(c(e),t)},p.hashBinary=function(e,t){var n=u(o(e));return t?d(n):n},p.ArrayBuffer=function(){this.reset()},p.ArrayBuffer.prototype.append=function(e){var t,r=h(this._buff.buffer,e,!0),o=r.length;for(this._length+=e.byteLength,t=64;t<=o;t+=64)n(this._hash,i(r.subarray(t-64,t)));return this._buff=t-64<o?new Uint8Array(r.buffer.slice(t-64)):new Uint8Array(0),this},p.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)o[t>>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=u(this._hash),e&&(n=d(n)),this.reset(),n},p.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},p.ArrayBuffer.prototype.getState=function(){var e=p.prototype.getState.call(this);return e.buff=f(e.buff),e},p.ArrayBuffer.prototype.setState=function(e){return e.buff=l(e.buff,!0),p.prototype.setState.call(this,e)},p.ArrayBuffer.prototype.destroy=p.prototype.destroy,p.ArrayBuffer.prototype._finish=p.prototype._finish,p.ArrayBuffer.hash=function(e,t){var n=u(s(new Uint8Array(e)));return t?d(n):n},p}()}(wn);var En=wn.exports,Sn=function(e,t,n,r,i,o){return{__t:"bpc",c:t,p:r,u:e,s:n,t:i,r:o}},On=Object.keys(Sn("","","","","",""));var In=function(e){var t,n,r=e.c,i=e.p,o=e.s,s=e.u,a=e.r,u=e.t,c=r?function(e){try{return new URL(e).pathname}catch(t){return"/"===e[0]?e:"/"+e}}(r):i,l=r?function(e,t){return e.indexOf("?")>-1?e:e+t}(r,o):-1===(n=(t=s).indexOf("#"))?t:t.slice(0,n);return{path:c,referrer:a,search:o,title:u,url:l}},xn=function(){var e=document.querySelector("link[rel='canonical']");return Sn(location.href,e&&e.getAttribute("href")||void 0,location.search,location.pathname,document.title,document.referrer)};var Rn=function(e,t){void 0===t&&(t=In(xn()));var n,r,i,o=e.context;"page"===e.type&&(n=e.properties&&(r=e.properties,i=Object.keys(t),Object.assign.apply(Object,wt([{}],i.map((function(e){var t;if(r&&Object.prototype.hasOwnProperty.call(r,e))return(t={})[e]=r[e],t})),!1))),e.properties=vt(vt(vt({},t),e.properties),e.name?{name:e.name}:{})),o.page=vt(vt(vt({},t),n),o.page)},kn=function(){function e(e){this.user=e}return e.prototype.track=function(e,t,n,r,i){return this.normalize(vt(vt({},this.baseEvent()),{event:e,type:"track",properties:t,options:vt({},n),integrations:vt({},r)}),i)},e.prototype.page=function(e,t,n,r,i,o){var s,a={type:"page",properties:vt({},n),options:vt({},r),integrations:vt({},i)};return null!==e&&(a.category=e,a.properties=null!==(s=a.properties)&&void 0!==s?s:{},a.properties.category=e),null!==t&&(a.name=t),this.normalize(vt(vt({},this.baseEvent()),a),o)},e.prototype.screen=function(e,t,n,r,i,o){var s={type:"screen",properties:vt({},n),options:vt({},r),integrations:vt({},i)};return null!==e&&(s.category=e),null!==t&&(s.name=t),this.normalize(vt(vt({},this.baseEvent()),s),o)},e.prototype.identify=function(e,t,n,r,i){return this.normalize(vt(vt({},this.baseEvent()),{type:"identify",userId:e,traits:t,options:vt({},n),integrations:vt({},r)}),i)},e.prototype.group=function(e,t,n,r,i){return this.normalize(vt(vt({},this.baseEvent()),{type:"group",traits:t,options:vt({},n),integrations:vt({},r),groupId:e}),i)},e.prototype.alias=function(e,t,n,r,i){var o={userId:e,type:"alias",options:vt({},n),integrations:vt({},r)};return null!==t&&(o.previousId=t),void 0===e?this.normalize(vt(vt({},o),this.baseEvent())):this.normalize(vt(vt({},this.baseEvent()),o),i)},e.prototype.baseEvent=function(){var e={integrations:{},options:{}},t=this.user;return t.id()&&(e.userId=t.id()),t.anonymousId()&&(e.anonymousId=t.anonymousId()),e},e.prototype.context=function(e){var t,n,r,i=["integrations","anonymousId","timestamp","userId"],o=null!==(t=e.options)&&void 0!==t?t:{};delete o.integrations;var s=Object.keys(o),a=null!==(r=null===(n=e.options)||void 0===n?void 0:n.context)&&void 0!==r?r:{},u={};return s.forEach((function(e){"context"!==e&&(i.includes(e)?kt(u,e,o[e]):kt(a,e,o[e]))})),[a,u]},e.prototype.normalize=function(e,t){var n,r,i;(null===(n=e.options)||void 0===n?void 0:n.anonymousId)&&this.user.anonymousId(e.options.anonymousId);var o=Object.keys(null!==(r=e.integrations)&&void 0!==r?r:{}).reduce((function(t,n){var r,i;return vt(vt({},t),((r={})[n]=Boolean(null===(i=e.integrations)||void 0===i?void 0:i[n]),r))}),{}),s=vt(vt({},o),null===(i=e.options)||void 0===i?void 0:i.integrations),a=this.context(e),u=a[0],c=a[1];e.options;var l=mt(e,["options"]),f=vt(vt(vt(vt({timestamp:new Date},l),{context:u,integrations:s}),c),{messageId:"ajs-next-"+En.hash(JSON.stringify(e)+Wt())});return Rn(f,t),f},e}(),Cn={getItem:function(){},setItem:function(){},removeItem:function(){}};try{Cn=an()&&window.localStorage?window.localStorage:Cn}catch(e){console.warn("Unable to access localStorage",e)}function Pn(e){var t=Cn.getItem(e);return(t?JSON.parse(t):[]).map((function(e){return new bn(e.event,e.id)}))}function An(e){var t=Cn.getItem(e);return t?JSON.parse(t):{}}function Nn(e){Cn.removeItem(e)}function Tn(e,t,n){void 0===n&&(n=0);var r="persisted-queue:v1:".concat(e,":lock"),i=Cn.getItem(r),o=i?JSON.parse(i):null,s=null===o||function(e){return(new Date).getTime()>e}(o);if(s)return Cn.setItem(r,JSON.stringify((new Date).getTime()+50)),t(),void Cn.removeItem(r);!s&&n<3?setTimeout((function(){Tn(e,t,n+1)}),50):console.error("Unable to retrieve lock")}var Mn=function(e){function t(t,n){var r=e.call(this,t,[])||this,i="persisted-queue:v1:".concat(n,":items"),o="persisted-queue:v1:".concat(n,":seen"),s=[],a={};return Tn(n,(function(){try{s=Pn(i),a=An(o),Nn(i),Nn(o),r.queue=wt(wt([],s,!0),r.queue,!0),r.seen=vt(vt({},a),r.seen)}catch(e){console.error(e)}})),window.addEventListener("pagehide",(function(){if(r.todo>0){var e=wt(wt([],r.queue,!0),r.future,!0);try{Tn(n,(function(){!function(e,t){var n=Pn(e),r=wt(wt([],t,!0),n,!0).reduce((function(e,t){var n;return vt(vt({},e),((n={})[t.id]=t,n))}),{});Cn.setItem(e,JSON.stringify(Object.values(r)))}(i,e),function(e,t){var n=An(e);Cn.setItem(e,JSON.stringify(vt(vt({},n),t)))}(o,r.seen)}))}catch(e){console.error(e)}}})),r}return yt(t,e),t}(qt),Ln=function(e){function t(t){return e.call(this,"string"==typeof t?new Mn(4,t):t)||this}return yt(t,e),t.prototype.flush=function(){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){return ln()?[2,[]]:[2,e.prototype.flush.call(this)]}))}))},t}(en);function jn(e){for(var t=e.constructor.prototype,n=0,r=Object.getOwnPropertyNames(t);n<r.length;n++){var i=r[n];if("constructor"!==i){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,i);o&&"function"==typeof o.value&&(e[i]=e[i].bind(e))}}return e}/*! js-cookie v3.0.1 | MIT */function Un(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var Dn=function e(t,n){function r(e,r,i){if("undefined"!=typeof document){"number"==typeof(i=Un({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var s in i)i[s]&&(o+="; "+s,!0!==i[s]&&(o+="="+i[s].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+o}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},i=0;i<n.length;i++){var o=n[i].split("="),s=o.slice(1).join("=");try{var a=decodeURIComponent(o[0]);if(r[a]=t.read(s,a),e===a)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",Un({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,Un({},this.attributes,t))},withConverter:function(t){return e(Un({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});function zn(e){var t=function(e){try{return new URL(e)}catch(e){return}}(e);if(t)for(var n=function(e){var t=e.hostname.split("."),n=t[t.length-1],r=[];if(4===t.length&&parseInt(n,10)>0)return r;if(t.length<=1)return r;for(var i=t.length-2;i>=0;--i)r.push(t.slice(i).join("."));return r}(t),r=0;r<n.length;++r){var i="__tld__",o=n[r],s={domain:"."+o};try{if(Dn.set(i,"1",s),Dn.get(i))return Dn.remove(i,s),o}catch(e){return}}}var Fn=function(){function e(t){void 0===t&&(t=e.defaults),this.options=vt(vt({},e.defaults),t)}return Object.defineProperty(e,"defaults",{get:function(){return{maxage:365,domain:zn(window.location.href),path:"/",sameSite:"Lax"}},enumerable:!1,configurable:!0}),e.prototype.opts=function(){return{sameSite:this.options.sameSite,expires:this.options.maxage,domain:this.options.domain,path:this.options.path,secure:this.options.secure}},e.prototype.get=function(e){var t;try{var n=Dn.get(e);if(null==n)return null;try{return null!==(t=JSON.parse(n))&&void 0!==t?t:null}catch(e){return null!=n?n:null}}catch(e){return null}},e.prototype.set=function(e,t){"string"==typeof t?Dn.set(e,t,this.opts()):null===t?Dn.remove(e,this.opts()):Dn.set(e,JSON.stringify(t),this.opts())},e.prototype.remove=function(e){return Dn.remove(e,this.opts())},e}(),Bn=function(){function e(){}return e.prototype.localStorageWarning=function(e,t){console.warn("Unable to access ".concat(e,", localStorage may be ").concat(t))},e.prototype.get=function(e){var t;try{var n=localStorage.getItem(e);if(null===n)return null;try{return null!==(t=JSON.parse(n))&&void 0!==t?t:null}catch(e){return null!=n?n:null}}catch(t){return this.localStorageWarning(e,"unavailable"),null}},e.prototype.set=function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(t){this.localStorageWarning(e,"full")}},e.prototype.remove=function(e){try{return localStorage.removeItem(e)}catch(t){this.localStorageWarning(e,"unavailable")}},e}(),Hn=function(){function e(){this.cache={}}return e.prototype.get=function(e){var t;return null!==(t=this.cache[e])&&void 0!==t?t:null},e.prototype.set=function(e,t){this.cache[e]=t},e.prototype.remove=function(e){delete this.cache[e]},e}(),qn={Cookie:"cookie",LocalStorage:"localStorage",Memory:"memory"};function $n(e){return e&&e.stores&&Array.isArray(e.stores)&&e.stores.every((function(e){return Object.values(qn).includes(e)}))}var Vn=function(e,t,n,r){console.warn("".concat(e.constructor.name,": Can't ").concat(t,' key "').concat(n,'" | Err: ').concat(r))},Wn=function(){function e(e){this.stores=e}return e.prototype.get=function(e){for(var t=null,n=0,r=this.stores;n<r.length;n++){var i=r[n];try{if(null!=(t=i.get(e)))return t}catch(t){Vn(i,"get",e,t)}}return null},e.prototype.set=function(e,t){this.stores.forEach((function(n){try{n.set(e,t)}catch(t){Vn(n,"set",e,t)}}))},e.prototype.clear=function(e){this.stores.forEach((function(t){try{t.remove(e)}catch(n){Vn(t,"remove",e,n)}}))},e.prototype.getAndSync=function(e){var t=this.get(e),n="number"==typeof t?t.toString():t;return this.set(e,n),n},e}();function Kn(e){return e.map((function(e){var t,n;switch(!function(e){return"object"==typeof e&&void 0!==e.name}(e)?t=e:(t=e.name,n=e.settings),t){case qn.Cookie:return new Fn(n);case qn.LocalStorage:return new Bn;case qn.Memory:return new Hn;default:throw new Error("Unknown Store Type: ".concat(e))}}))}function Gn(e,t){return e.map((function(e){return t&&e===qn.Cookie?{name:e,settings:t}:e}))}var Yn={persist:!0,cookie:{key:"ajs_user_id",oldKey:"ajs_user"},localStorage:{key:"ajs_user_traits"}},Qn=function(){function e(e,t){void 0===e&&(e=Yn);var n,r,i,o,s=this;this.options={},this.id=function(e){if(s.options.disable)return null;var t=s.identityStore.getAndSync(s.idKey);void 0!==e&&(s.identityStore.set(s.idKey,e),e!==t&&null!==t&&null!==e&&s.anonymousId(null));var n=s.identityStore.getAndSync(s.idKey);if(n)return n;var r=s.legacyUserStore.get(Yn.cookie.oldKey);return r?"object"==typeof r?r.id:r:null},this.anonymousId=function(e){var t,n;if(s.options.disable)return null;if(void 0===e){var r=null!==(t=s.identityStore.getAndSync(s.anonKey))&&void 0!==t?t:null===(n=s.legacySIO())||void 0===n?void 0:n[0];if(r)return r}return null===e?(s.identityStore.set(s.anonKey,null),s.identityStore.getAndSync(s.anonKey)):(s.identityStore.set(s.anonKey,null!=e?e:Wt()),s.identityStore.getAndSync(s.anonKey))},this.traits=function(e){var t;if(!s.options.disable)return null===e&&(e={}),e&&s.traitsStore.set(s.traitsKey,null!=e?e:{}),null!==(t=s.traitsStore.get(s.traitsKey))&&void 0!==t?t:{}},this.options=vt(vt({},Yn),e),this.cookieOptions=t,this.idKey=null!==(r=null===(n=e.cookie)||void 0===n?void 0:n.key)&&void 0!==r?r:Yn.cookie.key,this.traitsKey=null!==(o=null===(i=e.localStorage)||void 0===i?void 0:i.key)&&void 0!==o?o:Yn.localStorage.key,this.anonKey="ajs_anonymous_id",this.identityStore=this.createStorage(this.options,t),this.legacyUserStore=this.createStorage(this.options,t,(function(e){return e===qn.Cookie})),this.traitsStore=this.createStorage(this.options,t,(function(e){return e!==qn.Cookie}));var a=this.legacyUserStore.get(Yn.cookie.oldKey);a&&"object"==typeof a&&(a.id&&this.id(a.id),a.traits&&this.traits(a.traits)),jn(this)}return e.prototype.legacySIO=function(){var e=this.legacyUserStore.get("_sio");if(!e)return null;var t=e.split("----");return[t[0],t[1]]},e.prototype.identify=function(e,t){if(!this.options.disable){t=null!=t?t:{};var n=this.id();null!==n&&n!==e||(t=vt(vt({},this.traits()),t)),e&&this.id(e),this.traits(t)}},e.prototype.logout=function(){this.anonymousId(null),this.id(null),this.traits({})},e.prototype.reset=function(){this.logout(),this.identityStore.clear(this.idKey),this.identityStore.clear(this.anonKey),this.traitsStore.clear(this.traitsKey)},e.prototype.load=function(){return new e(this.options,this.cookieOptions)},e.prototype.save=function(){return!0},e.prototype.createStorage=function(e,t,n){var r=[qn.LocalStorage,qn.Cookie,qn.Memory];return e.disable?new Wn([]):e.persist?(void 0!==e.storage&&null!==e.storage&&$n(e.storage)&&(r=e.storage.stores),e.localStorageFallbackDisabled&&(r=r.filter((function(e){return e!==qn.LocalStorage}))),n&&(r=r.filter(n)),new Wn(Kn(Gn(r,t)))):new Wn([new Hn])},e.defaults=Yn,e}(),Jn={persist:!0,cookie:{key:"ajs_group_id"},localStorage:{key:"ajs_group_properties"}},Xn=function(e){function t(t,n){void 0===t&&(t=Jn);var r=e.call(this,vt(vt({},Jn),t),n)||this;return r.anonymousId=function(e){},jn(r),r}return yt(t,e),t}(Qn),Zn="analytics";function er(){return window[Zn]}var tr=function(e,t,n){n.getCalls(e).forEach((function(e){lr(t,e).catch(console.error)}))},nr=function(e,t){return _t(void 0,void 0,void 0,(function(){var n,r,i;return bt(this,(function(o){switch(o.label){case 0:n=0,r=t.getCalls("addSourceMiddleware"),o.label=1;case 1:return n<r.length?(i=r[n],[4,lr(e,i).catch(console.error)]):[3,4];case 2:o.sent(),o.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},rr=tr.bind(void 0,"on"),ir=tr.bind(void 0,"setAnonymousId"),or=function(e,t){t.toArray().forEach((function(t){setTimeout((function(){lr(e,t).catch(console.error)}),0)}))},sr=function(e){if(ar(e)){var t=e.pop();return In(t)}},ar=function(e){return function(e){if(!Mt(e))return!1;if("bpc"!==e.__t)return!1;for(var t in e)if(!On.includes(t))return!1;return!0}(e[e.length-1])},ur=function(e,t,n,r){void 0===n&&(n=function(){}),void 0===r&&(r=console.error),this.method=e,this.resolve=n,this.reject=r,this.called=!1,this.args=t},cr=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._callMap={},this.push.apply(this,e)}return Object.defineProperty(e.prototype,"calls",{get:function(){return this._pushSnippetWindowBuffer(),this._callMap},set:function(e){this._callMap=e},enumerable:!1,configurable:!0}),e.prototype.getCalls=function(e){var t;return null!==(t=this.calls[e])&&void 0!==t?t:[]},e.prototype.push=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.forEach((function(t){["track","screen","alias","group","page","identify"].includes(t.method)&&!ar(t.args)&&(t.args=wt(wt([],t.args,!0),[xn()],!1)),e.calls[t.method]?e.calls[t.method].push(t):e.calls[t.method]=[t]}))},e.prototype.clear=function(){this._pushSnippetWindowBuffer(),this.calls={}},e.prototype.toArray=function(){var e;return(e=[]).concat.apply(e,Object.values(this.calls))},e.prototype._pushSnippetWindowBuffer=function(){var e=er();if(Array.isArray(e)){var t=e.splice(0,e.length).map((function(e){var t=e[0],n=e.slice(1);return new ur(t,n)}));this.push.apply(this,t)}},e}();function lr(e,t){return _t(this,void 0,void 0,(function(){var n,r;return bt(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),t.called?[2,void 0]:(t.called=!0,n=e[t.method].apply(e,t.args),"object"==typeof(o=n)&&null!==o&&"then"in o&&"function"==typeof o.then?[4,n]:[3,2]);case 1:i.sent(),i.label=2;case 2:return t.resolve(n),[3,4];case 3:return r=i.sent(),t.reject(r),[3,4];case 4:return[2]}var o}))}))}var fr=function(){function e(e){var t=this;this.trackSubmit=this._createMethod("trackSubmit"),this.trackClick=this._createMethod("trackClick"),this.trackLink=this._createMethod("trackLink"),this.pageView=this._createMethod("pageview"),this.identify=this._createMethod("identify"),this.reset=this._createMethod("reset"),this.group=this._createMethod("group"),this.track=this._createMethod("track"),this.ready=this._createMethod("ready"),this.alias=this._createMethod("alias"),this.debug=this._createChainableMethod("debug"),this.page=this._createMethod("page"),this.once=this._createChainableMethod("once"),this.off=this._createChainableMethod("off"),this.on=this._createChainableMethod("on"),this.addSourceMiddleware=this._createMethod("addSourceMiddleware"),this.setAnonymousId=this._createMethod("setAnonymousId"),this.addDestinationMiddleware=this._createMethod("addDestinationMiddleware"),this.screen=this._createMethod("screen"),this.register=this._createMethod("register"),this.deregister=this._createMethod("deregister"),this.user=this._createMethod("user"),this.VERSION=pn,this._preInitBuffer=new cr,this._promise=e(this._preInitBuffer),this._promise.then((function(e){var n=e[0],r=e[1];t.instance=n,t.ctx=r})).catch((function(){}))}return e.prototype.then=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).then.apply(e,t)},e.prototype.catch=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).catch.apply(e,t)},e.prototype.finally=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).finally.apply(e,t)},e.prototype._createMethod=function(e){var t=this;return function(){for(var n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];if(t.instance){var o=(n=t.instance)[e].apply(n,r);return Promise.resolve(o)}return new Promise((function(n,i){t._preInitBuffer.push(new ur(e,r,n,i))}))}},e.prototype._createChainableMethod=function(e){var t=this;return function(){for(var n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return t.instance?((n=t.instance)[e].apply(n,r),t):(t._preInitBuffer.push(new ur(e,r)),t)}},e}(),hr="This is being deprecated and will be not be available in future releases of Analytics JS",dr=hn(),pr=null==dr?void 0:dr.analytics;function gr(){console.warn(hr)}var yr=function(e){function t(t,n,r,i,o){var s,a,u,c=this;(c=e.call(this)||this)._debug=!1,c.initialized=!1,c.user=function(){return c._user},c.init=c.initialize.bind(c),c.log=gr,c.addIntegrationMiddleware=gr,c.listeners=gr,c.addEventListener=gr,c.removeAllListeners=gr,c.removeListener=gr,c.removeEventListener=gr,c.hasListeners=gr,c.add=gr,c.addIntegration=gr;var l=null==n?void 0:n.cookie,f=null!==(s=null==n?void 0:n.disableClientPersistence)&&void 0!==s&&s;c.settings=t,c.settings.timeout=null!==(a=c.settings.timeout)&&void 0!==a?a:300,c.queue=null!=r?r:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var r=t?10:1,i=n?new qt(r,[]):new Mn(r,e);return new Ln(i)}("".concat(t.writeKey,":event-queue"),null==n?void 0:n.retryQueue,f);var h=null==n?void 0:n.storage;return c._universalStorage=c.createStore(f,h,l),c._user=null!=i?i:new Qn(vt({persist:!f,storage:null==n?void 0:n.storage},null==n?void 0:n.user),l).load(),c._group=null!=o?o:new Xn(vt({persist:!f,storage:null==n?void 0:n.storage},null==n?void 0:n.group),l).load(),c.eventFactory=new kn(c._user),c.integrations=null!==(u=null==n?void 0:n.integrations)&&void 0!==u?u:{},c.options=null!=n?n:{},jn(c),c}return yt(t,e),t.prototype.createStore=function(e,t,n){return e?new Wn([new Hn]):t&&$n(t)?new Wn(Kn(Gn(t.stores,n))):new Wn(Kn([qn.LocalStorage,{name:qn.Cookie,settings:n},qn.Memory]))},Object.defineProperty(t.prototype,"storage",{get:function(){return this._universalStorage},enumerable:!1,configurable:!0}),t.prototype.track=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u=this;return bt(this,(function(c){return t=sr(e),n=nn.apply(void 0,e),r=n[0],i=n[1],o=n[2],s=n[3],a=this.eventFactory.track(r,i,o,this.integrations,t),[2,this._dispatch(a,s).then((function(e){return u.emit("track",r,e.event.properties,e.event.options),e}))]}))}))},t.prototype.page=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c=this;return bt(this,(function(l){return t=sr(e),n=rn.apply(void 0,e),r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],u=this.eventFactory.page(r,i,o,s,this.integrations,t),[2,this._dispatch(u,a).then((function(e){return c.emit("page",r,i,e.event.properties,e.event.options),e}))]}))}))},t.prototype.identify=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u=this;return bt(this,(function(c){return t=sr(e),n=on(this._user).apply(void 0,e),r=n[0],i=n[1],o=n[2],s=n[3],this._user.identify(r,i),a=this.eventFactory.identify(this._user.id(),this._user.traits(),o,this.integrations,t),[2,this._dispatch(a,s).then((function(e){return u.emit("identify",e.event.userId,e.event.traits,e.event.options),e}))]}))}))},t.prototype.group=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=sr(t);if(0===t.length)return this._group;var i=on(this._group).apply(void 0,t),o=i[0],s=i[1],a=i[2],u=i[3];this._group.identify(o,s);var c=this._group.id(),l=this._group.traits(),f=this.eventFactory.group(c,l,a,this.integrations,r);return this._dispatch(f,u).then((function(t){return e.emit("group",t.event.groupId,t.event.traits,t.event.options),t}))},t.prototype.alias=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u=this;return bt(this,(function(c){return t=sr(e),n=sn.apply(void 0,e),r=n[0],i=n[1],o=n[2],s=n[3],a=this.eventFactory.alias(r,i,o,this.integrations,t),[2,this._dispatch(a,s).then((function(e){return u.emit("alias",r,i,e.event.options),e}))]}))}))},t.prototype.screen=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c=this;return bt(this,(function(l){return t=sr(e),n=rn.apply(void 0,e),r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],u=this.eventFactory.screen(r,i,o,s,this.integrations,t),[2,this._dispatch(u,a).then((function(e){return c.emit("screen",r,i,e.event.properties,e.event.options),e}))]}))}))},t.prototype.trackClick=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n;return bt(this,(function(r){switch(r.label){case 0:return[4,Promise.resolve().then((function(){return dl}))];case 1:return t=r.sent(),[2,(n=t.link).call.apply(n,wt([this],e,!1))]}}))}))},t.prototype.trackLink=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n;return bt(this,(function(r){switch(r.label){case 0:return[4,Promise.resolve().then((function(){return dl}))];case 1:return t=r.sent(),[2,(n=t.link).call.apply(n,wt([this],e,!1))]}}))}))},t.prototype.trackSubmit=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n;return bt(this,(function(r){switch(r.label){case 0:return[4,Promise.resolve().then((function(){return dl}))];case 1:return t=r.sent(),[2,(n=t.form).call.apply(n,wt([this],e,!1))]}}))}))},t.prototype.trackForm=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n;return bt(this,(function(r){switch(r.label){case 0:return[4,Promise.resolve().then((function(){return dl}))];case 1:return t=r.sent(),[2,(n=t.form).call.apply(n,wt([this],e,!1))]}}))}))},t.prototype.register=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r=this;return bt(this,(function(i){switch(i.label){case 0:return t=bn.system(),n=e.map((function(e){return r.queue.register(t,e,r)})),[4,Promise.all(n)];case 1:return i.sent(),[2,t]}}))}))},t.prototype.deregister=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _t(this,void 0,void 0,(function(){var t,n,r=this;return bt(this,(function(i){switch(i.label){case 0:return t=bn.system(),n=e.map((function(e){var n=r.queue.plugins.find((function(t){return t.name===e}));if(n)return r.queue.deregister(t,n,r);t.log("warn","plugin ".concat(e," not found"))})),[4,Promise.all(n)];case 1:return i.sent(),[2,t]}}))}))},t.prototype.debug=function(e){return!1===e&&localStorage.getItem("debug")&&localStorage.removeItem("debug"),this._debug=e,this},t.prototype.reset=function(){this._user.reset(),this._group.reset(),this.emit("reset")},t.prototype.timeout=function(e){this.settings.timeout=e},t.prototype._dispatch=function(e,t){return _t(this,void 0,void 0,(function(){var n;return bt(this,(function(r){return n=new bn(e),ln()&&!this.options.retryQueue?[2,n]:[2,tn(n,this.queue,this,{callback:t,debug:this._debug,timeout:this.settings.timeout})]}))}))},t.prototype.addSourceMiddleware=function(e){return _t(this,void 0,void 0,(function(){var t=this;return bt(this,(function(n){switch(n.label){case 0:return[4,this.queue.criticalTasks.run((function(){return _t(t,void 0,void 0,(function(){var t,n,r;return bt(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve().then((function(){return yo}))];case 1:return t=i.sent().sourceMiddlewarePlugin,n={},this.queue.plugins.forEach((function(e){if("destination"===e.type)return n[e.name]=!0})),r=t(e,n),[4,this.register(r)];case 2:return i.sent(),[2]}}))}))}))];case 1:return n.sent(),[2,this]}}))}))},t.prototype.addDestinationMiddleware=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return this.queue.plugins.filter((function(t){return t.name.toLowerCase()===e.toLowerCase()})).forEach((function(e){e.addMiddleware.apply(e,t)})),Promise.resolve(this)},t.prototype.setAnonymousId=function(e){return this._user.anonymousId(e)},t.prototype.queryString=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){switch(t.label){case 0:return!1===this.options.useQueryString?[2,[]]:[4,Promise.resolve().then((function(){return gl}))];case 1:return[2,(0,t.sent().queryString)(this,e)]}}))}))},t.prototype.use=function(e){return e(this),this},t.prototype.ready=function(e){return void 0===e&&(e=function(e){return e}),_t(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,Promise.all(this.queue.plugins.map((function(e){return e.ready?e.ready():Promise.resolve()}))).then((function(t){return e(t),t}))]}))}))},t.prototype.noConflict=function(){var e;return console.warn(hr),e=null!=pr?pr:this,window[Zn]=e,this},t.prototype.normalize=function(e){return console.warn(hr),this.eventFactory.normalize(e)},Object.defineProperty(t.prototype,"failedInitializations",{get:function(){return console.warn(hr),this.queue.failedInitializations},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"VERSION",{get:function(){return pn},enumerable:!1,configurable:!0}),t.prototype.initialize=function(e,t){return _t(this,void 0,void 0,(function(){return bt(this,(function(e){return console.warn(hr),[2,Promise.resolve(this)]}))}))},t.prototype.pageview=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){switch(t.label){case 0:return console.warn(hr),[4,this.page({path:e})];case 1:return t.sent(),[2,this]}}))}))},Object.defineProperty(t.prototype,"plugins",{get:function(){var e;return console.warn(hr),null!==(e=this._plugins)&&void 0!==e?e:{}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Integrations",{get:function(){console.warn(hr);var e=this.queue.plugins.filter((function(e){return"destination"===e.type})).reduce((function(e,t){var n="".concat(t.name.toLowerCase().replace(".","").split(" ").join("-"),"Integration"),r=window[n];if(!r)return e;var i=r.Integration;return i?(e[t.name]=i,e):(e[t.name]=r,e)}),{});return e},enumerable:!1,configurable:!0}),t.prototype.push=function(e){var t=e.shift();t&&!this[t]||this[t].apply(this,e)},t}(Ft),vr=function(e){function t(){var t=e.call(this,{writeKey:""},{disableClientPersistence:!0})||this;return t.initialized=!0,t}return yt(t,e),t}(yr);function mr(){return"undefined"!=typeof process&&process.env?process.env:{}}try{window.analyticsWriteKey="__WRITE_KEY__"}catch(J){}var _r,br,wr=/(https:\/\/.*)\/analytics\.js\/v1\/(?:.*?)\/(?:platform|analytics.*)?/,Er=function(){var e=function(){var e;return null!=_r?_r:null===(e=er())||void 0===e?void 0:e._cdn}();if(e)return e;var t,n=(Array.prototype.slice.call(document.querySelectorAll("script")).forEach((function(e){var n,r=null!==(n=e.getAttribute("src"))&&void 0!==n?n:"",i=wr.exec(r);i&&i[1]&&(t=i[1])})),t);return n||"https://cdn.segment.com"},Sr=function(){var e=Er();return"".concat(e,"/next-integrations")};function Or(e,t){var n,r=Object.entries(null!==(n=t.integrations)&&void 0!==n?n:{}).reduce((function(e,t){var n,r,i=t[0],o=t[1];return vt(vt({},e),"object"==typeof o?((n={})[i]=o,n):((r={})[i]={},r))}),{});return Object.entries(e.integrations).reduce((function(e,t){var n,i=t[0],o=t[1];return vt(vt({},e),((n={})[i]=vt(vt({},o),r[i]),n))}),{})}function Ir(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}}function xr(e){return _t(this,void 0,void 0,(function(){var t;return bt(this,(function(n){return(t=navigator.userAgentData)?e?[2,t.getHighEntropyValues(e).catch((function(){return t.toJSON()}))]:[2,t.toJSON()]:[2,void 0]}))}))}function Rr(){if(br)return br;var e=zn(window.location.href);return br={expires:31536e6,secure:!1,path:"/"},e&&(br.domain=e),br}var kr=function(){var e=this;this.name="Page Enrichment",this.type="before",this.version="0.1.0",this.isLoaded=function(){return!0},this.load=function(t,n){return _t(e,void 0,void 0,(function(){var e;return bt(this,(function(t){switch(t.label){case 0:this.instance=n,t.label=1;case 1:return t.trys.push([1,3,,4]),e=this,[4,xr(this.instance.options.highEntropyValuesClientHints)];case 2:return e.userAgentData=t.sent(),[3,4];case 3:return t.sent(),[3,4];case 4:return[2,Promise.resolve()]}}))}))},this.enrich=function(t){var n,r,i=t.event.context,o=i.page.search||"",s="object"==typeof o?function(e){try{var t=new URLSearchParams;return Object.entries(e).forEach((function(e){var n=e[0],r=e[1];Array.isArray(r)?r.forEach((function(e){return t.append(n,e)})):t.append(n,r)})),t.toString()}catch(e){return""}}(o):o;i.userAgent=navigator.userAgent,i.userAgentData=e.userAgentData;var a=navigator.userLanguage||navigator.language;void 0===i.locale&&void 0!==a&&(i.locale=a),null!==(n=i.library)&&void 0!==n||(i.library={name:"analytics.js",version:"".concat("npm:next","-").concat(pn)}),s&&!i.campaign&&(i.campaign=function(e){return e.startsWith("?")&&(e=e.substring(1)),(e=e.replace(/\?/g,"&")).split("&").reduce((function(e,t){var n=t.split("="),r=n[0],i=n[1],o=void 0===i?"":i;if(r.includes("utm_")&&r.length>4){var s=r.slice(4);"campaign"===s&&(s="name"),e[s]=Ir(o)}return e}),{})}(s));var u=function(){var e=Dn.get("_ga");if(e&&e.startsWith("amp"))return e}();u&&(i.amp={id:u}),function(e,t,n){var r,i=new Wn(n?[]:[new Fn(Rr())]),o=i.get("s:context.referrer"),s=null!==(r=function(e){var t={btid:"dataxu",urid:"millennial-media"};e.startsWith("?")&&(e=e.substring(1));for(var n=0,r=(e=e.replace(/\?/g,"&")).split("&");n<r.length;n++){var i=r[n].split("="),o=i[0],s=i[1];if(t[o])return{id:s,type:t[o]}}}(e))&&void 0!==r?r:o;s&&(t&&(t.referrer=vt(vt({},t.referrer),s)),i.set("s:context.referrer",s))}(s,i,null!==(r=e.instance.options.disableClientPersistence)&&void 0!==r&&r);try{i.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){}return t},this.track=this.enrich,this.identify=this.enrich,this.page=this.enrich,this.group=this.enrich,this.alias=this.enrich,this.screen=this.enrich},Cr=new kr;function Pr(e){return Array.prototype.slice.call(window.document.querySelectorAll("script")).find((function(t){return t.src===e}))}function Ar(e,t){var n=Pr(e);if(void 0!==n){var r=null==n?void 0:n.getAttribute("status");if("loaded"===r)return Promise.resolve(n);if("loading"===r)return new Promise((function(e,t){n.addEventListener("load",(function(){return e(n)})),n.addEventListener("error",(function(e){return t(e)}))}))}return new Promise((function(n,r){var i,o=window.document.createElement("script");o.type="text/javascript",o.src=e,o.async=!0,o.setAttribute("status","loading");for(var s=0,a=Object.entries(null!=t?t:{});s<a.length;s++){var u=a[s],c=u[0],l=u[1];o.setAttribute(c,l)}o.onload=function(){o.onerror=o.onload=null,o.setAttribute("status","loaded"),n(o)},o.onerror=function(){o.onerror=o.onload=null,o.setAttribute("status","error"),r(new Error("Failed to load ".concat(e)))};var f=window.document.getElementsByTagName("script")[0];null===(i=f.parentElement)||void 0===i||i.insertBefore(o,f)}))}function Nr(e){var t=Pr(e);return void 0!==t&&t.remove(),Promise.resolve()}var Tr={},Mr={},Lr={},jr={exports:{}};!function(e){function t(e){return function(t,n,r,o){var s,a=o&&function(e){return"function"==typeof e}(o.normalizer)?o.normalizer:i;n=a(n);for(var u=!1;!u;)c();function c(){for(s in t){var e=a(s);if(0===n.indexOf(e)){var r=n.substr(e.length);if("."===r.charAt(0)||0===r.length){n=r.substr(1);var i=t[s];return null==i?void(u=!0):n.length?void(t=i):void(u=!0)}}}s=void 0,u=!0}if(s)return null==t?t:e(t,s,r)}}function n(e,t){return e.hasOwnProperty(t)&&delete e[t],e}function r(e,t,n){return e.hasOwnProperty(t)&&(e[t]=n),e}function i(e){return e.replace(/[^a-zA-Z0-9\.]+/g,"").toLowerCase()}e.exports=t((function(e,t){if(e.hasOwnProperty(t))return e[t]})),e.exports.find=e.exports,e.exports.replace=function(e,n,i,o){return t(r).call(this,e,n,i,o),e},e.exports.del=function(e,r,i){return t(n).call(this,e,r,null,i),e}}(jr);var Ur=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Lr,"__esModule",{value:!0});var Dr=Ur(jr.exports);function zr(e,t){return function(){var n=this.traits(),r=this.properties?this.properties():{};return Dr.default(n,"address."+e)||Dr.default(n,e)||(t?Dr.default(n,"address."+t):null)||(t?Dr.default(n,t):null)||Dr.default(r,"address."+e)||Dr.default(r,e)||(t?Dr.default(r,"address."+t):null)||(t?Dr.default(r,t):null)}}Lr.default=function(e){e.zip=zr("postalCode","zip"),e.country=zr("country"),e.street=zr("street"),e.state=zr("state"),e.city=zr("city"),e.region=zr("region")};var Fr={};Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.clone=void 0,Fr.clone=function e(t){if("object"!=typeof t)return t;if("[object Object]"===Object.prototype.toString.call(t)){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e(t[r]));return n}return Array.isArray(t)?t.map(e):t};var Br={};Object.defineProperty(Br,"__esModule",{value:!0});var Hr={Salesforce:!0};Br.default=function(e){return!Hr[e]};var qr={},$r=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;qr.parse=function(e){var t=[1,5,6,7,11,12],n=$r.exec(e),r=0;if(!n)return new Date(e);for(var i,o=0;i=t[o];o++)n[i]=parseInt(n[i],10)||0;n[2]=parseInt(n[2],10)||1,n[3]=parseInt(n[3],10)||1,n[2]--,n[8]=n[8]?(n[8]+"00").substring(0,3):0," "===n[4]?r=(new Date).getTimezoneOffset():"Z"!==n[9]&&n[10]&&(r=60*n[11]+n[12],"+"===n[10]&&(r=0-r));var s=Date.UTC(n[1],n[2],n[3],n[5],n[6]+r,n[7],n[8]);return new Date(s)},qr.is=function(e,t){return"string"==typeof e&&((!t||!1!==/^\d{4}-\d{2}-\d{2}/.test(e))&&$r.test(e))};var Vr={},Wr=/\d{13}/;Vr.is=function(e){return Wr.test(e)},Vr.parse=function(e){return e=parseInt(e,10),new Date(e)};var Kr={},Gr=/\d{10}/;Kr.is=function(e){return Gr.test(e)},Kr.parse=function(e){var t=1e3*parseInt(e,10);return new Date(t)};var Yr=qr,Qr=Vr,Jr=Kr,Xr=Object.prototype.toString;var Zr=function(e){return t=e,"[object Date]"===Xr.call(t)?e:function(e){return"[object Number]"===Xr.call(e)}(e)?new Date((n=e)<315576e5?1e3*n:n):Yr.is(e)?Yr.parse(e):Qr.is(e)?Qr.parse(e):Jr.is(e)?Jr.parse(e):new Date(e);var t,n};var ei=qr,ti=ni;function ni(e,t){return void 0===t&&(t=!0),e&&"object"==typeof e?function(e,t){return Object.keys(e).forEach((function(n){e[n]=ni(e[n],t)})),e}(e,t):Array.isArray(e)?function(e,t){return e.forEach((function(n,r){e[r]=ni(n,t)})),e}(e,t):ei.is(e,t)?ei.parse(e):e}var ri=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.Facade=void 0;var ii=ri(Lr),oi=Fr,si=ri(Br),ai=ri(Zr),ui=ri(jr.exports),ci=ri(ti);function li(e,t){t=t||{},this.raw=oi.clone(e),"clone"in t||(t.clone=!0),t.clone&&(e=oi.clone(e)),"traverse"in t||(t.traverse=!0),e.timestamp="timestamp"in e?ai.default(e.timestamp):new Date,t.traverse&&ci.default(e),this.opts=t,this.obj=e}Mr.Facade=li;var fi=li.prototype;function hi(e){return oi.clone(e)}fi.proxy=function(e){var t=e.split("."),n=this[e=t.shift()]||this.obj[e];return n?("function"==typeof n&&(n=n.call(this)||{}),0===t.length||(n=ui.default(n,t.join("."))),this.opts.clone?hi(n):n):n},fi.field=function(e){var t=this.obj[e];return this.opts.clone?hi(t):t},li.proxy=function(e){return function(){return this.proxy(e)}},li.field=function(e){return function(){return this.field(e)}},li.multi=function(e){return function(){var t=this.proxy(e+"s");if(Array.isArray(t))return t;var n=this.proxy(e);return n&&(n=[this.opts.clone?oi.clone(n):n]),n||[]}},li.one=function(e){return function(){var t=this.proxy(e);if(t)return t;var n=this.proxy(e+"s");return Array.isArray(n)?n[0]:void 0}},fi.json=function(){var e=this.opts.clone?oi.clone(this.obj):this.obj;return this.type&&(e.type=this.type()),e},fi.rawEvent=function(){return this.raw},fi.options=function(e){var t=this.obj.options||this.obj.context||{},n=this.opts.clone?oi.clone(t):t;if(!e)return n;if(this.enabled(e)){var r=this.integrations(),i=r[e]||ui.default(r,e);return"object"!=typeof i&&(i=ui.default(this.options(),e)),"object"==typeof i?i:{}}},fi.context=fi.options,fi.enabled=function(e){var t=this.proxy("options.providers.all");"boolean"!=typeof t&&(t=this.proxy("options.all")),"boolean"!=typeof t&&(t=this.proxy("integrations.all")),"boolean"!=typeof t&&(t=!0);var n=t&&si.default(e),r=this.integrations();if(r.providers&&r.providers.hasOwnProperty(e)&&(n=r.providers[e]),r.hasOwnProperty(e)){var i=r[e];n="boolean"!=typeof i||i}return!!n},fi.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()},fi.active=function(){var e=this.proxy("options.active");return null==e&&(e=!0),e},fi.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")},fi.sessionId=fi.anonymousId,fi.groupId=li.proxy("options.groupId"),fi.traits=function(e){var t=this.proxy("options.traits")||{},n=this.userId();for(var r in e=e||{},n&&(t.id=n),e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=null==this[r]?this.proxy("options.traits."+r):this[r]();if(null==i)continue;t[e[r]]=i,delete t[r]}return t},fi.library=function(){var e=this.proxy("options.library");return e?"string"==typeof e?{name:e,version:null}:e:{name:"unknown",version:null}},fi.device=function(){var e=this.proxy("context.device");"object"==typeof e&&null!==e||(e={});var t=this.library().name;return e.type||(t.indexOf("ios")>-1&&(e.type="ios"),t.indexOf("android")>-1&&(e.type="android")),e},fi.userAgent=li.proxy("context.userAgent"),fi.timezone=li.proxy("context.timezone"),fi.timestamp=li.field("timestamp"),fi.channel=li.field("channel"),fi.ip=li.proxy("context.ip"),fi.userId=li.field("userId"),ii.default(fi);var di={},pi={exports:{}};"function"==typeof Object.create?pi.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:pi.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}};var gi=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(di,"__esModule",{value:!0}),di.Alias=void 0;var yi=gi(pi.exports),vi=Mr;function mi(e,t){vi.Facade.call(this,e,t)}di.Alias=mi,yi.default(mi,vi.Facade),mi.prototype.action=function(){return"alias"},mi.prototype.type=mi.prototype.action,mi.prototype.previousId=function(){return this.field("previousId")||this.field("from")},mi.prototype.from=mi.prototype.previousId,mi.prototype.userId=function(){return this.field("userId")||this.field("to")},mi.prototype.to=mi.prototype.userId;var _i={},bi={};Object.defineProperty(bi,"__esModule",{value:!0});var wi=/.+\@.+\..+/;bi.default=function(e){return wi.test(e)};var Ei=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_i,"__esModule",{value:!0}),_i.Group=void 0;var Si=Ei(pi.exports),Oi=Ei(bi),Ii=Ei(Zr),xi=Mr;function Ri(e,t){xi.Facade.call(this,e,t)}_i.Group=Ri,Si.default(Ri,xi.Facade);var ki=Ri.prototype;ki.action=function(){return"group"},ki.type=ki.action,ki.groupId=xi.Facade.field("groupId"),ki.created=function(){var e=this.proxy("traits.createdAt")||this.proxy("traits.created")||this.proxy("properties.createdAt")||this.proxy("properties.created");if(e)return Ii.default(e)},ki.email=function(){var e=this.proxy("traits.email");if(e)return e;var t=this.groupId();return Oi.default(t)?t:void 0},ki.traits=function(e){var t=this.properties(),n=this.groupId();for(var r in e=e||{},n&&(t.id=n),e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=null==this[r]?this.proxy("traits."+r):this[r]();if(null==i)continue;t[e[r]]=i,delete t[r]}return t},ki.name=xi.Facade.proxy("traits.name"),ki.industry=xi.Facade.proxy("traits.industry"),ki.employees=xi.Facade.proxy("traits.employees"),ki.properties=function(){return this.field("traits")||this.field("properties")||{}};var Ci={},Pi=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.Identify=void 0;var Ai=Mr,Ni=Pi(jr.exports),Ti=Pi(pi.exports),Mi=Pi(bi),Li=Pi(Zr),ji=function(e){return e.trim()};function Ui(e,t){Ai.Facade.call(this,e,t)}Ci.Identify=Ui,Ti.default(Ui,Ai.Facade);var Di=Ui.prototype;Di.action=function(){return"identify"},Di.type=Di.action,Di.traits=function(e){var t=this.field("traits")||{},n=this.userId();for(var r in e=e||{},n&&(t.id=n),e){var i=null==this[r]?this.proxy("traits."+r):this[r]();null!=i&&(t[e[r]]=i,r!==e[r]&&delete t[r])}return t},Di.email=function(){var e=this.proxy("traits.email");if(e)return e;var t=this.userId();return Mi.default(t)?t:void 0},Di.created=function(){var e=this.proxy("traits.created")||this.proxy("traits.createdAt");if(e)return Li.default(e)},Di.companyCreated=function(){var e=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(e)return Li.default(e)},Di.companyName=function(){return this.proxy("traits.company.name")},Di.name=function(){var e=this.proxy("traits.name");if("string"==typeof e)return ji(e);var t=this.firstName(),n=this.lastName();return t&&n?ji(t+" "+n):void 0},Di.firstName=function(){var e=this.proxy("traits.firstName");if("string"==typeof e)return ji(e);var t=this.proxy("traits.name");return"string"==typeof t?ji(t).split(" ")[0]:void 0},Di.lastName=function(){var e=this.proxy("traits.lastName");if("string"==typeof e)return ji(e);var t=this.proxy("traits.name");if("string"==typeof t){var n=ji(t).indexOf(" ");if(-1!==n)return ji(t.substr(n+1))}},Di.uid=function(){return this.userId()||this.username()||this.email()},Di.description=function(){return this.proxy("traits.description")||this.proxy("traits.background")},Di.age=function(){var e=this.birthday(),t=Ni.default(this.traits(),"age");return null!=t?t:e instanceof Date?(new Date).getFullYear()-e.getFullYear():void 0},Di.avatar=function(){var e=this.traits();return Ni.default(e,"avatar")||Ni.default(e,"photoUrl")||Ni.default(e,"avatarUrl")},Di.position=function(){var e=this.traits();return Ni.default(e,"position")||Ni.default(e,"jobTitle")},Di.username=Ai.Facade.proxy("traits.username"),Di.website=Ai.Facade.one("traits.website"),Di.websites=Ai.Facade.multi("traits.website"),Di.phone=Ai.Facade.one("traits.phone"),Di.phones=Ai.Facade.multi("traits.phone"),Di.address=Ai.Facade.proxy("traits.address"),Di.gender=Ai.Facade.proxy("traits.gender"),Di.birthday=Ai.Facade.proxy("traits.birthday");var zi={},Fi=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zi,"__esModule",{value:!0}),zi.Track=void 0;var Bi=Fi(pi.exports),Hi=Mr,qi=Ci,$i=Fi(bi),Vi=Fi(jr.exports);function Wi(e,t){Hi.Facade.call(this,e,t)}zi.Track=Wi,Bi.default(Wi,Hi.Facade);var Ki=Wi.prototype;Ki.action=function(){return"track"},Ki.type=Ki.action,Ki.event=Hi.Facade.field("event"),Ki.value=Hi.Facade.proxy("properties.value"),Ki.category=Hi.Facade.proxy("properties.category"),Ki.id=Hi.Facade.proxy("properties.id"),Ki.productId=function(){return this.proxy("properties.product_id")||this.proxy("properties.productId")},Ki.promotionId=function(){return this.proxy("properties.promotion_id")||this.proxy("properties.promotionId")},Ki.cartId=function(){return this.proxy("properties.cart_id")||this.proxy("properties.cartId")},Ki.checkoutId=function(){return this.proxy("properties.checkout_id")||this.proxy("properties.checkoutId")},Ki.paymentId=function(){return this.proxy("properties.payment_id")||this.proxy("properties.paymentId")},Ki.couponId=function(){return this.proxy("properties.coupon_id")||this.proxy("properties.couponId")},Ki.wishlistId=function(){return this.proxy("properties.wishlist_id")||this.proxy("properties.wishlistId")},Ki.reviewId=function(){return this.proxy("properties.review_id")||this.proxy("properties.reviewId")},Ki.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.order_id")||this.proxy("properties.orderId")},Ki.sku=Hi.Facade.proxy("properties.sku"),Ki.tax=Hi.Facade.proxy("properties.tax"),Ki.name=Hi.Facade.proxy("properties.name"),Ki.price=Hi.Facade.proxy("properties.price"),Ki.total=Hi.Facade.proxy("properties.total"),Ki.repeat=Hi.Facade.proxy("properties.repeat"),Ki.coupon=Hi.Facade.proxy("properties.coupon"),Ki.shipping=Hi.Facade.proxy("properties.shipping"),Ki.discount=Hi.Facade.proxy("properties.discount"),Ki.shippingMethod=function(){return this.proxy("properties.shipping_method")||this.proxy("properties.shippingMethod")},Ki.paymentMethod=function(){return this.proxy("properties.payment_method")||this.proxy("properties.paymentMethod")},Ki.description=Hi.Facade.proxy("properties.description"),Ki.plan=Hi.Facade.proxy("properties.plan"),Ki.subtotal=function(){var e=Vi.default(this.properties(),"subtotal"),t=this.total()||this.revenue();if(e)return e;if(!t)return 0;if(this.total()){var n=this.tax();n&&(t-=n),(n=this.shipping())&&(t-=n),(n=this.discount())&&(t+=n)}return t},Ki.products=function(){var e=this.properties(),t=Vi.default(e,"products");return Array.isArray(t)?t.filter((function(e){return null!==e})):[]},Ki.quantity=function(){return(this.obj.properties||{}).quantity||1},Ki.currency=function(){return(this.obj.properties||{}).currency||"USD"},Ki.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},Ki.query=Hi.Facade.proxy("options.query"),Ki.properties=function(e){var t=this.field("properties")||{};for(var n in e=e||{})if(Object.prototype.hasOwnProperty.call(e,n)){var r=null==this[n]?this.proxy("properties."+n):this[n]();if(null==r)continue;t[e[n]]=r,delete t[n]}return t},Ki.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()},Ki.email=function(){var e=this.proxy("traits.email")||this.proxy("properties.email")||this.proxy("options.traits.email");if(e)return e;var t=this.userId();return $i.default(t)?t:void 0},Ki.revenue=function(){var e=this.proxy("properties.revenue"),t=this.event();return!e&&t&&t.match(/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i)&&(e=this.proxy("properties.total")),function(e){if(!e)return;if("number"==typeof e)return e;if("string"!=typeof e)return;if(e=e.replace(/\$/g,""),e=parseFloat(e),!isNaN(e))return e}(e)},Ki.cents=function(){var e=this.revenue();return"number"!=typeof e?this.value()||0:100*e},Ki.identify=function(){var e=this.json();return e.traits=this.traits(),new qi.Identify(e,this.opts)};var Gi={},Yi=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.Page=void 0;var Qi=Yi(pi.exports),Ji=Mr,Xi=zi,Zi=Yi(bi);function eo(e,t){Ji.Facade.call(this,e,t)}Gi.Page=eo,Qi.default(eo,Ji.Facade);var to=eo.prototype;to.action=function(){return"page"},to.type=to.action,to.category=Ji.Facade.field("category"),to.name=Ji.Facade.field("name"),to.title=Ji.Facade.proxy("properties.title"),to.path=Ji.Facade.proxy("properties.path"),to.url=Ji.Facade.proxy("properties.url"),to.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},to.properties=function(e){var t=this.field("properties")||{},n=this.category(),r=this.name();for(var i in e=e||{},n&&(t.category=n),r&&(t.name=r),e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=null==this[i]?this.proxy("properties."+i):this[i]();if(null==o)continue;t[e[i]]=o,i!==e[i]&&delete t[i]}return t},to.email=function(){var e=this.proxy("context.traits.email")||this.proxy("properties.email");if(e)return e;var t=this.userId();return Zi.default(t)?t:void 0},to.fullName=function(){var e=this.category(),t=this.name();return t&&e?e+" "+t:t},to.event=function(e){return e?"Viewed "+e+" Page":"Loaded a Page"},to.track=function(e){var t=this.json();return t.event=this.event(e),t.timestamp=this.timestamp(),t.properties=this.properties(),new Xi.Track(t,this.opts)};var no={},ro=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(no,"__esModule",{value:!0}),no.Screen=void 0;var io=ro(pi.exports),oo=Gi,so=zi;function ao(e,t){oo.Page.call(this,e,t)}no.Screen=ao,io.default(ao,oo.Page),ao.prototype.action=function(){return"screen"},ao.prototype.type=ao.prototype.action,ao.prototype.event=function(e){return e?"Viewed "+e+" Screen":"Loaded a Screen"},ao.prototype.track=function(e){var t=this.json();return t.event=this.event(e),t.timestamp=this.timestamp(),t.properties=this.properties(),new so.Track(t,this.opts)};var uo={},co=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(uo,"__esModule",{value:!0}),uo.Delete=void 0;var lo=co(pi.exports),fo=Mr;function ho(e,t){fo.Facade.call(this,e,t)}function po(e,t){var n=new Tr.Facade(e,t);return"track"===e.type&&(n=new Tr.Track(e,t)),"identify"===e.type&&(n=new Tr.Identify(e,t)),"page"===e.type&&(n=new Tr.Page(e,t)),"alias"===e.type&&(n=new Tr.Alias(e,t)),"group"===e.type&&(n=new Tr.Group(e,t)),"screen"===e.type&&(n=new Tr.Screen(e,t)),Object.defineProperty(n,"obj",{value:e,writable:!0}),n}function go(e,t,n){return _t(this,void 0,void 0,(function(){function r(t,n){return _t(this,void 0,void 0,(function(){var r,i,o;return bt(this,(function(s){switch(s.label){case 0:return r=!1,i=null,[4,n({payload:po(t,{clone:!0,traverse:!1}),integration:e,next:function(e){r=!0,null===e&&(i=null),e&&(i=e.obj)}})];case 1:return s.sent(),r||null===i||(i.integrations=vt(vt({},t.integrations),((o={})[e]=!1,o))),[2,i]}}))}))}var i,o,s,a,u;return bt(this,(function(e){switch(e.label){case 0:i=po(t,{clone:!0,traverse:!1}).rawEvent(),o=0,s=n,e.label=1;case 1:return o<s.length?(a=s[o],[4,r(i,a)]):[3,4];case 2:if(null===(u=e.sent()))return[2,null];i=u,e.label=3;case 3:return o++,[3,1];case 4:return[2,i]}}))}))}uo.Delete=ho,lo.default(ho,fo.Facade),ho.prototype.type=function(){return"delete"},function(e){var t=l&&l.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.Delete=e.Screen=e.Page=e.Track=e.Identify=e.Group=e.Alias=e.Facade=void 0;var n=Mr;Object.defineProperty(e,"Facade",{enumerable:!0,get:function(){return n.Facade}});var r=di;Object.defineProperty(e,"Alias",{enumerable:!0,get:function(){return r.Alias}});var i=_i;Object.defineProperty(e,"Group",{enumerable:!0,get:function(){return i.Group}});var o=Ci;Object.defineProperty(e,"Identify",{enumerable:!0,get:function(){return o.Identify}});var s=zi;Object.defineProperty(e,"Track",{enumerable:!0,get:function(){return s.Track}});var a=Gi;Object.defineProperty(e,"Page",{enumerable:!0,get:function(){return a.Page}});var u=no;Object.defineProperty(e,"Screen",{enumerable:!0,get:function(){return u.Screen}});var c=uo;Object.defineProperty(e,"Delete",{enumerable:!0,get:function(){return c.Delete}}),e.default=t(t({},n.Facade),{Alias:r.Alias,Group:i.Group,Identify:o.Identify,Track:s.Track,Page:a.Page,Screen:u.Screen,Delete:c.Delete})}(Tr);var yo=Object.freeze({__proto__:null,applyDestinationMiddleware:go,sourceMiddlewarePlugin:function(e,t){function n(n){return _t(this,void 0,void 0,(function(){var r;return bt(this,(function(i){switch(i.label){case 0:return r=!1,[4,e({payload:po(n.event,{clone:!0,traverse:!1}),integrations:null!=t?t:{},next:function(e){r=!0,e&&(n.event=e.obj)}})];case 1:if(i.sent(),!r)throw new Qt({retry:!1,type:"middleware_cancellation",reason:"Middleware `next` function skipped"});return[2,n]}}))}))}return{name:"Source Middleware ".concat(e.name),type:"before",version:"0.1.0",isLoaded:function(){return!0},load:function(e){return Promise.resolve(e)},track:n,page:n,identify:n,alias:n,group:n}}});function vo(e,t){var n=t.methodName,r=t.integrationName,i=t.type,o=t.didError,s=void 0!==o&&o;e.stats.increment("analytics_js.integration.invoke".concat(s?".error":""),1,["method:".concat(n),"integration_name:".concat(r),"type:".concat(i)])}var mo=function(){function e(e,t){this.version="1.0.0",this.alternativeNames=[],this.middleware=[],this.alias=this._createMethod("alias"),this.group=this._createMethod("group"),this.identify=this._createMethod("identify"),this.page=this._createMethod("page"),this.screen=this._createMethod("screen"),this.track=this._createMethod("track"),this.action=t,this.name=e,this.type=t.type,this.alternativeNames.push(t.name)}return e.prototype.addMiddleware=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];"destination"===this.type&&(e=this.middleware).push.apply(e,t)},e.prototype.transform=function(e){return _t(this,void 0,void 0,(function(){var t;return bt(this,(function(n){switch(n.label){case 0:return[4,go(this.name,e.event,this.middleware)];case 1:return null===(t=n.sent())&&e.cancel(new Qt({retry:!1,reason:"dropped by destination middleware"})),[2,new bn(t)]}}))}))},e.prototype._createMethod=function(e){var t=this;return function(n){return _t(t,void 0,void 0,(function(){var t,r;return bt(this,(function(i){switch(i.label){case 0:return this.action[e]?(t=n,"destination"!==this.type?[3,2]:[4,this.transform(n)]):[2,n];case 1:t=i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),vo(n,{integrationName:this.action.name,methodName:e,type:"action"}),[4,this.action[e](t)];case 3:return i.sent(),[3,5];case 4:throw r=i.sent(),vo(n,{integrationName:this.action.name,methodName:e,type:"action",didError:!0}),r;case 5:return[2,n]}}))}))}},e.prototype.isLoaded=function(){return this.action.isLoaded()},e.prototype.ready=function(){return this.action.ready?this.action.ready():Promise.resolve()},e.prototype.load=function(e,t){return _t(this,void 0,void 0,(function(){var n;return bt(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),vo(e,{integrationName:this.action.name,methodName:"load",type:"action"}),[4,this.action.load(e,t)];case 1:return[2,r.sent()];case 2:throw n=r.sent(),vo(e,{integrationName:this.action.name,methodName:"load",type:"action",didError:!0}),n;case 3:return[2]}}))}))},e.prototype.unload=function(e,t){var n,r;return null===(r=(n=this.action).unload)||void 0===r?void 0:r.call(n,e,t)},e}();function _o(e,t){return _t(this,void 0,void 0,(function(){var n,r,i,o,s;return bt(this,(function(a){switch(a.label){case 0:if(n=new RegExp("https://cdn.segment.(com|build)"),r=Er(),!t)return[3,6];i=e.url.split("/"),o=i[i.length-2],s=e.url.replace(o,btoa(o).replace(/=/g,"")),a.label=1;case 1:return a.trys.push([1,3,,5]),[4,Ar(s.replace(n,r))];case 2:return a.sent(),[3,5];case 3:return a.sent(),[4,Ar(e.url.replace(n,r))];case 4:return a.sent(),[3,5];case 5:return[3,8];case 6:return[4,Ar(e.url.replace(n,r))];case 7:a.sent(),a.label=8;case 8:return"function"==typeof window[e.libraryName]?[2,window[e.libraryName]]:[2]}}))}))}function bo(e,t,n,r,i,o){var s,a,u;return _t(this,void 0,void 0,(function(){var c,l,f,h=this;return bt(this,(function(d){switch(d.label){case 0:return c=[],l=null!==(a=null===(s=e.middlewareSettings)||void 0===s?void 0:s.routingRules)&&void 0!==a?a:[],f=(null!==(u=e.remotePlugins)&&void 0!==u?u:[]).map((function(e){return _t(h,void 0,void 0,(function(){var s,a,u,f,h,d;return bt(this,(function(p){switch(p.label){case 0:if(function(e,t){var n=e[t.creationName],r=e[t.name];return!1===e.All&&!n&&!r||!1===n||!1===r}(t,e))return[2];p.label=1;case 1:return p.trys.push([1,6,,7]),(a=null==o?void 0:o.find((function(t){return t.pluginName===e.name})))?[3,3]:[4,_o(e,r)];case 2:a=p.sent(),p.label=3;case 3:return(s=a)?[4,s(vt(vt({},e.settings),n[e.name]))]:[3,5];case 4:u=p.sent(),function(e){if(!Array.isArray(e))throw new Error("Not a valid list of plugins");var t=["load","isLoaded","name","version","type"];e.forEach((function(e){t.forEach((function(t){var n;if(void 0===e[t])throw new Error("Plugin: ".concat(null!==(n=e.name)&&void 0!==n?n:"unknown"," missing required function ").concat(t))}))}))}(f=Array.isArray(u)?u:[u]),h=l.filter((function(t){return t.destinationName===e.creationName})),f.forEach((function(t){var n=new mo(e.creationName,t);h.length&&i&&"destination"===t.type&&n.addMiddleware(i),c.push(n)})),p.label=5;case 5:return[3,7];case 6:return d=p.sent(),console.warn("Failed to load Remote Plugin",d),[3,7];case 7:return[2]}}))}))})),[4,Promise.all(f)];case 1:return d.sent(),[2,c.filter(Boolean)]}}))}))}var wo=function(e){var t=!1;window.addEventListener("pagehide",(function(){t||e(t=!0)})),document.addEventListener("visibilitychange",(function(){if("hidden"==document.visibilityState){if(t)return;t=!0}else t=!1;e(t)}))},Eo=500;function So(e){return(encodeURI(JSON.stringify(e)).split(/%..|./).length-1)/1024}function Oo(e,t){var n,r,i,o=[],s=!1,a=null!==(n=null==t?void 0:t.size)&&void 0!==n?n:10,u=null!==(r=null==t?void 0:t.timeout)&&void 0!==r?r:5e3;function c(t){var n;if(0!==t.length){var r=null===(n=t[0])||void 0===n?void 0:n.writeKey,i=t.map((function(e){var t=e;return t.sentAt,mt(t,["sentAt"])}));return dn("https://".concat(e,"/b"),{keepalive:s,headers:{"Content-Type":"text/plain"},method:"post",body:JSON.stringify({writeKey:r,batch:i,sentAt:(new Date).toISOString()})})}}function l(){return _t(this,void 0,void 0,(function(){var e;return bt(this,(function(t){return o.length?(e=o,o=[],[2,c(e)]):[2]}))}))}return wo((function(e){if((s=e)&&o.length){var t=function(e){var t=[],n=0;return e.forEach((function(e){So(t[n])>=64&&n++,t[n]?t[n].push(e):t[n]=[e]})),t}(o).map(c);Promise.all(t).catch(console.error)}})),{dispatch:function(e,t){return _t(this,void 0,void 0,(function(){var e;return bt(this,(function(n){return o.push(t),e=o.length>=a||function(e){return So(e)>=Eo-50}(o),[2,e||s?l():void(i||(i=setTimeout((function(){i=void 0,l().catch(console.error)}),u)))]}))}))}}}function Io(e,t,n,r){var i,o=e.user();delete t.options,t.writeKey=null==n?void 0:n.apiKey,t.userId=t.userId||o.id(),t.anonymousId=t.anonymousId||o.anonymousId(),t.sentAt=new Date;var s=e.queue.failedInitializations||[];s.length>0&&(t._metadata={failedInitializations:s});var a=[],u=[];for(var c in r){var l=r[c];"Segment.io"===c&&a.push(c),"bundled"===l.bundlingStatus&&a.push(c),"unbundled"===l.bundlingStatus&&u.push(c)}for(var f=0,h=(null==n?void 0:n.unbundledIntegrations)||[];f<h.length;f++){var d=h[f];u.includes(d)||u.push(d)}var p=null!==(i=null==n?void 0:n.maybeBundledConfigIds)&&void 0!==i?i:{},g=[];return a.sort().forEach((function(e){var t;(null!==(t=p[e])&&void 0!==t?t:[]).forEach((function(e){g.push(e)}))})),!1!==(null==n?void 0:n.addBundledMetadata)&&(t._metadata=vt(vt({},t._metadata),{bundled:a.sort(),unbundled:u.sort(),bundledIds:g})),t}var xo=function(e,t){return _t(void 0,void 0,void 0,(function(){var n;return bt(this,(function(r){return n=function(r){return _t(void 0,void 0,void 0,(function(){var i;return bt(this,(function(o){switch(o.label){case 0:return e(r)?(i=n,[4,t()]):[3,2];case 1:return[2,i.apply(void 0,[o.sent()])];case 2:return[2]}}))}))},[2,n(void 0)]}))}))};function Ro(e,t){return _t(this,void 0,void 0,(function(){var n,r=this;return bt(this,(function(i){switch(i.label){case 0:return n=[],ln()?[2,t]:[4,xo((function(){return t.length>0&&!ln()}),(function(){return _t(r,void 0,void 0,(function(){var r,i;return bt(this,(function(o){switch(o.label){case 0:return(r=t.pop())?[4,Xt(r,e)]:[2];case 1:return i=o.sent(),i instanceof bn||n.push(r),[2]}}))}))}))];case 1:return i.sent(),n.map((function(e){return t.pushWithBackoff(e)})),[2,t]}}))}))}function ko(e,t,n,r){var i=this;e||setTimeout((function(){return _t(i,void 0,void 0,(function(){var e,i;return bt(this,(function(o){switch(o.label){case 0:return e=!0,[4,Ro(n,t)];case 1:return i=o.sent(),e=!1,t.todo>0&&r(e,i,n,r),[2]}}))}))}),5e3*Math.random())}function Co(e,t,n){var r,i,o;window.addEventListener("pagehide",(function(){u.push.apply(u,Array.from(c)),c.clear()}));var s,a=null!==(r=null==t?void 0:t.apiKey)&&void 0!==r?r:"",u=e.options.disableClientPersistence?new qt(e.queue.queue.maxAttempts,[]):new Mn(e.queue.queue.maxAttempts,"".concat(a,":dest-Segment.io")),c=new Set,l=!1,f=null!==(i=null==t?void 0:t.apiHost)&&void 0!==i?i:gn,h=null!==(o=null==t?void 0:t.protocol)&&void 0!==o?o:"https",d="".concat(h,"://").concat(f),p=null==t?void 0:t.deliveryStrategy,g="batching"===(null==p?void 0:p.strategy)?Oo(f,p.config):(s=null==p?void 0:p.config,{dispatch:function(e,t){return dn(e,{keepalive:null==s?void 0:s.keepalive,headers:{"Content-Type":"text/plain"},method:"post",body:JSON.stringify(t)})}});function y(r){return _t(this,void 0,void 0,(function(){var i,o;return bt(this,(function(s){return ln()?(u.push(r),ko(l,u,v,ko),[2,r]):(c.add(r),i=r.event.type.charAt(0),o=po(r.event).json(),"track"===r.event.type&&delete o.traits,"alias"===r.event.type&&(o=function(e,t){var n,r,i,o,s=e.user();return t.previousId=null!==(i=null!==(r=null!==(n=t.previousId)&&void 0!==n?n:t.from)&&void 0!==r?r:s.id())&&void 0!==i?i:s.anonymousId(),t.userId=null!==(o=t.userId)&&void 0!==o?o:t.to,delete t.from,delete t.to,t}(e,o)),[2,g.dispatch("".concat(d,"/").concat(i),Io(e,o,t,n)).then((function(){return r})).catch((function(){return u.pushWithBackoff(r),ko(l,u,v,ko),r})).finally((function(){c.delete(r)}))])}))}))}var v={name:"Segment.io",type:"destination",version:"0.1.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:y,identify:y,page:y,alias:y,group:y,screen:y};return u.todo&&ko(l,u,v,ko),v}function Po(e){var t,n=e.event;!function(e){if(!Tt(e))throw new Ct("Event",Ut);if("object"!=typeof e)throw new Ct("Event",jt)}(n),function(e){if(!Pt(e.type))throw new Ct(".type",Lt)}(n),"track"===n.type&&function(e){if(!Pt(e.event))throw new Ct(".event",Lt)}(n);var r=null!==(t=n.properties)&&void 0!==t?t:n.traits;if("alias"!==n.type&&!Mt(r))throw new Ct(".properties","is not an object");return function(e){var t=".userId/anonymousId/previousId/groupId",n=function(e){var t,n,r;return null!==(r=null!==(n=null!==(t=e.userId)&&void 0!==t?t:e.anonymousId)&&void 0!==n?n:e.groupId)&&void 0!==r?r:e.previousId}(e);if(!Tt(n))throw new Ct(t,Ut);if(!Pt(n))throw new Ct(t,Lt)}(n),e}var Ao,No,To={name:"Event Validation",type:"before",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:Po,identify:Po,page:Po,alias:Po,group:Po,screen:Po},Mo=null!==(Ao=(No=hn()).__SEGMENT_INSPECTOR__)&&void 0!==Ao?Ao:No.__SEGMENT_INSPECTOR__={};function Lo(e,t){return _t(this,void 0,void 0,(function(){return bt(this,(function(n){switch(n.label){case 0:return[4,nr(e,t)];case 1:return n.sent(),or(e,t),t.clear(),[2]}}))}))}function jo(e,t,n,r,i,o,s){var a,u,c;return void 0===o&&(o=[]),_t(this,void 0,void 0,(function(){var l,f,h,d,p,g,y,v,m,_,b,w,E,S,O=this;return bt(this,(function(I){switch(I.label){case 0:return l=null==o?void 0:o.filter((function(e){return"object"==typeof e})),f=null==o?void 0:o.filter((function(e){return"function"==typeof e&&"string"==typeof e.pluginName})),function(e){var t,n,r;return"test"!==mr().NODE_ENV&&(null!==(r=null===(n=null===(t=e.middlewareSettings)||void 0===t?void 0:t.routingRules)||void 0===n?void 0:n.length)&&void 0!==r?r:0)>0}(t)?[4,Promise.resolve().then((function(){return wd})).then((function(e){return e.tsubMiddleware(t.middlewareSettings.routingRules)}))]:[3,2];case 1:return d=I.sent(),[3,3];case 2:d=void 0,I.label=3;case 3:return h=d,x=t,"test"!==mr().NODE_ENV&&Object.keys(x.integrations).length>1||s.length>0?[4,Promise.resolve().then((function(){return kd})).then((function(i){return i.ajsDestinations(e,t,n.integrations,r,h,s)}))]:[3,5];case 4:return g=I.sent(),[3,6];case 5:g=[],I.label=6;case 6:return p=g,t.legacyVideoPluginsEnabled?[4,Promise.resolve().then((function(){return Cd})).then((function(e){return e.loadLegacyVideoPlugins(n)}))]:[3,8];case 7:I.sent(),I.label=8;case 8:return(null===(a=r.plan)||void 0===a?void 0:a.track)?[4,Promise.resolve().then((function(){return Pd})).then((function(e){var n;return e.schemaFilter(null===(n=r.plan)||void 0===n?void 0:n.track,t)}))]:[3,10];case 9:return v=I.sent(),[3,11];case 10:v=void 0,I.label=11;case 11:return y=v,m=Or(t,i),[4,bo(t,n.integrations,m,i.obfuscate,h,f).catch((function(){return[]}))];case 12:return _=I.sent(),b=wt(wt(wt([To,Cr],l,!0),p,!0),_,!0),y&&b.push(y),!1===(null===(u=r.integrations)||void 0===u?void 0:u.All)&&!r.integrations["Segment.io"]||r.integrations&&!1===r.integrations["Segment.io"]?[3,14]:(E=(w=b).push,[4,Co(n,m["Segment.io"],t.integrations)]);case 13:E.apply(w,[I.sent()]),I.label=14;case 14:return[4,n.register.apply(n,b)];case 15:return S=I.sent(),Object.entries(null!==(c=t.enabledMiddleware)&&void 0!==c?c:{}).some((function(e){return e[1]}))?[4,Promise.resolve().then((function(){return Ad})).then((function(e){var r=e.remoteMiddlewares;return _t(O,void 0,void 0,(function(){var e,o;return bt(this,(function(s){switch(s.label){case 0:return[4,r(S,t,i.obfuscate)];case 1:return e=s.sent(),o=e.map((function(e){return n.addSourceMiddleware(e)})),[2,Promise.all(o)]}}))}))}))]:[3,17];case 16:I.sent(),I.label=17;case 17:return[2,S]}var x}))}))}function Uo(e,t,n){var r,i,o,s,a,u,c;return void 0===t&&(t={}),_t(this,void 0,void 0,(function(){var l,f,h,d,p,g,y,v,m,_,b;return bt(this,(function(w){switch(w.label){case 0:return!0===t.disable?[2,[new vr,bn.system()]]:(t.globalAnalyticsKey&&(R=t.globalAnalyticsKey,Zn=R),e.cdnURL&&(I=e.cdnURL,(x=er())&&(x._cdn=I),_r=I),t.initialPageview&&n.push(new ur("page",[])),null===(r=e.cdnSettings)||void 0===r?[3,1]:(f=r,[3,3]));case 1:return[4,(E=e.writeKey,S=e.cdnURL,O=null!=S?S:Er(),dn("".concat(O,"/v1/projects/").concat(E,"/settings")).then((function(e){return e.ok?e.json():e.text().then((function(e){throw new Error(e)}))})).catch((function(e){throw console.error(e.message),e})))];case 2:f=w.sent(),w.label=3;case 3:return l=f,t.updateCDNSettings&&(l=t.updateCDNSettings(l)),"function"!=typeof t.disable?[3,5]:[4,t.disable(l)];case 4:if(w.sent())return[2,[new vr,bn.system()]];w.label=5;case 5:return h=null===(o=null===(i=l.integrations["Segment.io"])||void 0===i?void 0:i.retryQueue)||void 0===o||o,d=vt({retryQueue:h},t),function(e){var t;null===(t=Mo.attach)||void 0===t||t.call(Mo,e)}(p=new yr(e,d)),g=null!==(s=e.plugins)&&void 0!==s?s:[],y=null!==(a=e.classicIntegrations)&&void 0!==a?a:[],_n.initRemoteMetrics(l.metrics),function(e,t){ir(e,t),rr(e,t)}(p,n),[4,jo(e.writeKey,l,p,d,t,g,y)];case 6:return v=w.sent(),m=null!==(u=window.location.search)&&void 0!==u?u:"",_=null!==(c=window.location.hash)&&void 0!==c?c:"",(b=m.length?m:_.replace(/(?=#).*(?=\?)/,"")).includes("ajs_")?[4,p.queryString(b).catch(console.error)]:[3,8];case 7:w.sent(),w.label=8;case 8:return p.initialized=!0,p.emit("initialize",e,t),[4,Lo(p,n)];case 9:return w.sent(),[2,[p,v]]}var E,S,O,I,x,R}))}))}var Do=function(e){function t(){var t,n,r,i=this,o=(r=new Promise((function(e,r){t=e,n=r})),{resolve:t,reject:n,promise:r}),s=o.promise,a=o.resolve;return i=e.call(this,(function(e){return s.then((function(t){return Uo(t[0],t[1],e)}))}))||this,i._resolveLoadStart=function(e,t){return a([e,t])},i}return yt(t,e),t.prototype.load=function(e,t){return void 0===t&&(t={}),this._resolveLoadStart(e,t),this},t.load=function(e,n){return void 0===n&&(n={}),(new t).load(e,n)},t.standalone=function(e,n){return t.load({writeKey:e},n).then((function(e){return e[0]}))},t}(fr);let zo;const Fo=new Uint8Array(16);function Bo(){if(!zo&&(zo="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!zo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return zo(Fo)}var Ho=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const qo=[];for(let e=0;e<256;++e)qo.push((e+256).toString(16).slice(1));function $o(e,t=0){return qo[e[t+0]]+qo[e[t+1]]+qo[e[t+2]]+qo[e[t+3]]+"-"+qo[e[t+4]]+qo[e[t+5]]+"-"+qo[e[t+6]]+qo[e[t+7]]+"-"+qo[e[t+8]]+qo[e[t+9]]+"-"+qo[e[t+10]]+qo[e[t+11]]+qo[e[t+12]]+qo[e[t+13]]+qo[e[t+14]]+qo[e[t+15]]}function Vo(e){if(!function(e){return"string"==typeof e&&Ho.test(e)}(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n}function Wo(e,t,n){function r(e,r,i,o){var s;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof r&&(r=Vo(r)),16!==(null===(s=r)||void 0===s?void 0:s.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let a=new Uint8Array(16+e.length);if(a.set(r),a.set(e,r.length),a=n(a),a[6]=15&a[6]|t,a[8]=63&a[8]|128,i){o=o||0;for(let e=0;e<16;++e)i[o+e]=a[e];return i}return $o(a)}try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function Ko(e){return 14+(e+64>>>9<<4)+1}function Go(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function Yo(e,t,n,r,i,o){return Go((s=Go(Go(t,e),Go(r,o)))<<(a=i)|s>>>32-a,n);var s,a}function Qo(e,t,n,r,i,o,s){return Yo(t&n|~t&r,e,t,i,o,s)}function Jo(e,t,n,r,i,o,s){return Yo(t&r|n&~r,e,t,i,o,s)}function Xo(e,t,n,r,i,o,s){return Yo(t^n^r,e,t,i,o,s)}function Zo(e,t,n,r,i,o,s){return Yo(n^(t|~r),e,t,i,o,s)}Wo("v3",48,(function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length,r="0123456789abcdef";for(let i=0;i<n;i+=8){const n=e[i>>5]>>>i%32&255,o=parseInt(r.charAt(n>>>4&15)+r.charAt(15&n),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[Ko(t)-1]=t;let n=1732584193,r=-271733879,i=-1732584194,o=271733878;for(let t=0;t<e.length;t+=16){const s=n,a=r,u=i,c=o;n=Qo(n,r,i,o,e[t],7,-680876936),o=Qo(o,n,r,i,e[t+1],12,-389564586),i=Qo(i,o,n,r,e[t+2],17,606105819),r=Qo(r,i,o,n,e[t+3],22,-1044525330),n=Qo(n,r,i,o,e[t+4],7,-176418897),o=Qo(o,n,r,i,e[t+5],12,1200080426),i=Qo(i,o,n,r,e[t+6],17,-1473231341),r=Qo(r,i,o,n,e[t+7],22,-45705983),n=Qo(n,r,i,o,e[t+8],7,1770035416),o=Qo(o,n,r,i,e[t+9],12,-1958414417),i=Qo(i,o,n,r,e[t+10],17,-42063),r=Qo(r,i,o,n,e[t+11],22,-1990404162),n=Qo(n,r,i,o,e[t+12],7,1804603682),o=Qo(o,n,r,i,e[t+13],12,-40341101),i=Qo(i,o,n,r,e[t+14],17,-1502002290),r=Qo(r,i,o,n,e[t+15],22,1236535329),n=Jo(n,r,i,o,e[t+1],5,-165796510),o=Jo(o,n,r,i,e[t+6],9,-1069501632),i=Jo(i,o,n,r,e[t+11],14,643717713),r=Jo(r,i,o,n,e[t],20,-373897302),n=Jo(n,r,i,o,e[t+5],5,-701558691),o=Jo(o,n,r,i,e[t+10],9,38016083),i=Jo(i,o,n,r,e[t+15],14,-660478335),r=Jo(r,i,o,n,e[t+4],20,-405537848),n=Jo(n,r,i,o,e[t+9],5,568446438),o=Jo(o,n,r,i,e[t+14],9,-1019803690),i=Jo(i,o,n,r,e[t+3],14,-187363961),r=Jo(r,i,o,n,e[t+8],20,1163531501),n=Jo(n,r,i,o,e[t+13],5,-1444681467),o=Jo(o,n,r,i,e[t+2],9,-51403784),i=Jo(i,o,n,r,e[t+7],14,1735328473),r=Jo(r,i,o,n,e[t+12],20,-1926607734),n=Xo(n,r,i,o,e[t+5],4,-378558),o=Xo(o,n,r,i,e[t+8],11,-2022574463),i=Xo(i,o,n,r,e[t+11],16,1839030562),r=Xo(r,i,o,n,e[t+14],23,-35309556),n=Xo(n,r,i,o,e[t+1],4,-1530992060),o=Xo(o,n,r,i,e[t+4],11,1272893353),i=Xo(i,o,n,r,e[t+7],16,-155497632),r=Xo(r,i,o,n,e[t+10],23,-1094730640),n=Xo(n,r,i,o,e[t+13],4,681279174),o=Xo(o,n,r,i,e[t],11,-358537222),i=Xo(i,o,n,r,e[t+3],16,-722521979),r=Xo(r,i,o,n,e[t+6],23,76029189),n=Xo(n,r,i,o,e[t+9],4,-640364487),o=Xo(o,n,r,i,e[t+12],11,-421815835),i=Xo(i,o,n,r,e[t+15],16,530742520),r=Xo(r,i,o,n,e[t+2],23,-995338651),n=Zo(n,r,i,o,e[t],6,-198630844),o=Zo(o,n,r,i,e[t+7],10,1126891415),i=Zo(i,o,n,r,e[t+14],15,-1416354905),r=Zo(r,i,o,n,e[t+5],21,-57434055),n=Zo(n,r,i,o,e[t+12],6,1700485571),o=Zo(o,n,r,i,e[t+3],10,-1894986606),i=Zo(i,o,n,r,e[t+10],15,-1051523),r=Zo(r,i,o,n,e[t+1],21,-2054922799),n=Zo(n,r,i,o,e[t+8],6,1873313359),o=Zo(o,n,r,i,e[t+15],10,-30611744),i=Zo(i,o,n,r,e[t+6],15,-1560198380),r=Zo(r,i,o,n,e[t+13],21,1309151649),n=Zo(n,r,i,o,e[t+4],6,-145523070),o=Zo(o,n,r,i,e[t+11],10,-1120210379),i=Zo(i,o,n,r,e[t+2],15,718787259),r=Zo(r,i,o,n,e[t+9],21,-343485551),n=Go(n,s),r=Go(r,a),i=Go(i,u),o=Go(o,c)}return[n,r,i,o]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(Ko(t));for(let r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))}));var es={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ts(e,t,n){if(es.randomUUID&&!t&&!e)return es.randomUUID();const r=(e=e||{}).random||(e.rng||Bo)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return $o(r)}function ns(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function rs(e,t){return e<<t|e>>>32-t}Wo("v5",80,(function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const r=e.length/4+2,i=Math.ceil(r/16),o=new Array(i);for(let t=0;t<i;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];o[t]=n}o[i-1][14]=8*(e.length-1)/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<i;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=o[e][t];for(let e=16;e<80;++e)r[e]=rs(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],s=n[1],a=n[2],u=n[3],c=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),o=rs(i,5)+ns(n,s,a,u)+c+t[n]+r[e]>>>0;c=u,u=a,a=rs(s,30)>>>0,s=i,i=o}n[0]=n[0]+i>>>0,n[1]=n[1]+s>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+u>>>0,n[4]=n[4]+c>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));let is=null;const os={};function ss(){const e=m.exports.useCallback(((e={},t={})=>c(this,void 0,void 0,(function*(){if(is)return;{const n=Do.load({writeKey:"q3dbZMDYOGQbk5GPl7eY7zWaAmNS5wk9",cdnURL:"https://proxyseg.api.live.ledger.com/"});yield n.identify(ts()),is={analytics:n,globalOptions:t,globalProperties:e}}}))),[]),t=m.exports.useCallback((e=>c(this,void 0,void 0,(function*(){is&&(os[Object.keys(os).length]=e)}))),[]),n=m.exports.useCallback((()=>c(this,void 0,void 0,(function*(){0!=Object.keys(os).length&&is&&(yield is.analytics.track("userFlow",os))}))),[]);return{init:e,track:m.exports.useCallback(((e,t={})=>c(this,void 0,void 0,(function*(){if(!is)return;const n=Object.assign(Object.assign({},is.globalProperties),t);yield is.analytics.track(e,n,is.globalOptions)}))),[]),page:m.exports.useCallback(((e,t={})=>c(this,void 0,void 0,(function*(){if(!is)return;const n=Object.assign(Object.assign({},is.globalProperties),t);yield is.analytics.page(e,n,is.globalOptions)}))),[]),addStepToFlow:t,sendUserFlow:n}}let as=e=>{};const us=({onClose:e,children:t})=>{const{sendUserFlow:n,addStepToFlow:r}=ss(),[i,o]=m.exports.useState(!0);as=o;const s=()=>{as(!1),r("Close"),n(),e&&e()},a=e=>{var t;"ModalWrapper"===(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.id)&&s()};return i?y.exports.jsxs(y.exports.Fragment,{children:[y.exports.jsx(tt,{}),y.exports.jsx(ot,Object.assign({id:"ModalWrapper",onClick:a},{children:y.exports.jsxs(st,{children:[y.exports.jsxs(ct,{children:[y.exports.jsx("img",{src:"data:image/svg+xml,%3csvg width='72' height='24' viewBox='0 0 72 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M61.3616 22.4887V23.9996H71.7318V17.1853H70.2208V22.4887H61.3616ZM61.3616 0V1.51096H70.2208V6.81473H71.7318V0H61.3616ZM56.0137 11.689V8.17796H58.3842C59.5398 8.17796 59.9546 8.56305 59.9546 9.61506V10.2372C59.9546 11.3186 59.5545 11.689 58.3842 11.689H56.0137ZM59.7764 12.311C60.8578 12.0296 61.6133 11.022 61.6133 9.82231C61.6133 9.06683 61.3172 8.38521 60.7542 7.83698C60.0432 7.15536 59.0948 6.81473 57.8653 6.81473H54.5322V17.1849H56.0137V13.0518H58.2361C59.3767 13.0518 59.836 13.5258 59.836 14.7112V17.1853H61.3469V14.9482C61.3469 13.3186 60.9618 12.6965 59.7764 12.5187V12.311ZM47.303 12.6517H51.866V11.2888H47.303V8.17761H52.3102V6.81473H45.7916V17.1849H52.5325V15.822H47.303V12.6517ZM42.3398 13.1999V13.9109C42.3398 15.4072 41.7916 15.8963 40.414 15.8963H40.0881C38.7102 15.8963 38.0436 15.4516 38.0436 13.3925V10.6072C38.0436 8.53329 38.7399 8.10338 40.1175 8.10338H40.4137C41.7618 8.10338 42.1914 8.60716 42.2061 9.99979H43.8357C43.6876 7.9553 42.3248 6.66665 40.2803 6.66665C39.2878 6.66665 38.4581 6.97787 37.836 7.57021C36.9027 8.44437 36.3842 9.92593 36.3842 11.9998C36.3842 13.9999 36.8288 15.4814 37.7471 16.3997C38.3692 17.0071 39.2286 17.333 40.073 17.333C40.9619 17.333 41.7769 16.9773 42.1914 16.2071H42.3986V17.1849H43.7615V11.837H39.7467V13.1999H42.3398ZM29.2737 8.17761H30.8886C32.4146 8.17761 33.2443 8.5627 33.2443 10.6369V13.3627C33.2443 15.4366 32.4146 15.822 30.8886 15.822H29.2737V8.17761ZM31.0216 17.1853C33.8513 17.1853 34.903 15.0372 34.903 12.0002C34.903 8.91874 33.7771 6.81509 30.9919 6.81509H27.7917V17.1853H31.0216ZM20.6367 12.6517H25.1997V11.2888H20.6367V8.17761H25.644V6.81473H19.1254V17.1849H25.8663V15.822H20.6367V12.6517ZM11.8962 6.81473H10.3852V17.1849H17.2V15.822H11.8962V6.81473ZM0 17.1853V24H10.3702V22.4887H1.51096V17.1853H0ZM0 0V6.81473H1.51096V1.51096H10.3702V0H0Z' fill='white'/%3e%3c/svg%3e"}),y.exports.jsx(at,Object.assign({onClick:s},{children:y.exports.jsx("img",{src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M22 2L2 22' stroke='white' stroke-width='3'/%3e%3cpath d='M2 2L22 22' stroke='white' stroke-width='3'/%3e%3c/svg%3e"})}))]}),y.exports.jsx(y.exports.Fragment,{children:t})]})}))]}):null};var cs,ls,fs,hs,ds={exports:{}},ps={},gs={exports:{}},ys={};function vs(){return ls||(ls=1,function(e){e.exports=(cs||(cs=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,s=o>>>1;r<s;){var a=2*(r+1)-1,u=e[a],c=a+1,l=e[c];if(0>i(u,n))c<o&&0>i(l,u)?(e[r]=l,e[c]=n,r=c):(e[r]=u,e[a]=n,r=a);else{if(!(c<o&&0>i(l,n)))break e;e[r]=l,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var u=[],c=[],l=1,f=null,h=3,d=!1,p=!1,g=!1,y="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,m="undefined"!=typeof setImmediate?setImmediate:null;function _(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(u,i)}i=n(c)}}function b(e){if(g=!1,_(e),!p)if(null!==n(u))p=!0,N(w);else{var t=n(c);null!==t&&T(b,t.startTime-e)}}function w(t,i){p=!1,g&&(g=!1,v(I),I=-1),d=!0;var o=h;try{for(_(i),f=n(u);null!==f&&(!(f.expirationTime>i)||t&&!k());){var s=f.callback;if("function"==typeof s){f.callback=null,h=f.priorityLevel;var a=s(f.expirationTime<=i);i=e.unstable_now(),"function"==typeof a?f.callback=a:f===n(u)&&r(u),_(i)}else r(u);f=n(u)}if(null!==f)var l=!0;else{var y=n(c);null!==y&&T(b,y.startTime-i),l=!1}return l}finally{f=null,h=o,d=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var E,S=!1,O=null,I=-1,x=5,R=-1;function k(){return!(e.unstable_now()-R<x)}function C(){if(null!==O){var t=e.unstable_now();R=t;var n=!0;try{n=O(!0,t)}finally{n?E():(S=!1,O=null)}}else S=!1}if("function"==typeof m)E=function(){m(C)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,A=P.port2;P.port1.onmessage=C,E=function(){A.postMessage(null)}}else E=function(){y(C,0)};function N(e){O=e,S||(S=!0,E())}function T(t,n){I=y((function(){t(e.unstable_now())}),n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){p||d||(p=!0,N(w))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):x=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(e){switch(h){case 1:case 2:case 3:var t=3;break;default:t=h}var n=h;h=t;try{return e()}finally{h=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=h;h=e;try{return t()}finally{h=n}},e.unstable_scheduleCallback=function(r,i,o){var s=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?s+o:s,r){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return r={id:l++,callback:i,priorityLevel:r,startTime:o,expirationTime:a=o+a,sortIndex:-1},o>s?(r.sortIndex=o,t(c,r),null===n(u)&&r===n(c)&&(g?(v(I),I=-1):g=!0,T(b,o-s))):(r.sortIndex=a,t(u,r),p||d||(p=!0,N(w))),r},e.unstable_shouldYield=k,e.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}}(ys)),ys)}(gs)),gs.exports}
173
173
  /**
174
174
  * @license React
175
175
  * react-dom.production.min.js
@@ -233,7 +233,7 @@ t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?i-1:0,h=
233
233
  height: 24px;
234
234
  margin-right: 8px;
235
235
  }
236
- `;const Ks=r("PlatformNotSupportedModal"),Gs=()=>(Ks("initializing"),y.exports.jsx(us,{children:y.exports.jsx(y.exports.Fragment,{children:y.exports.jsxs(lt,{children:[y.exports.jsx(ft,{children:"Sorry, we don't support this platform just yet."}),y.exports.jsxs(ht,{children:["We're working hard to expand our coverage.",y.exports.jsx("br",{}),"Until we get there, you can try Ledger Connect on:"]}),y.exports.jsx(Vs,{children:y.exports.jsxs(Ws,{children:[y.exports.jsx("img",{src:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='250.076' height='248.707' viewBox='0 0 66.166 65.804'%3e%3cdefs%3e%3clinearGradient id='b'%3e%3cstop style='stop-color:%2306c2e7%3bstop-opacity:1' offset='0'/%3e%3cstop offset='.25' style='stop-color:%230db8ec%3bstop-opacity:1'/%3e%3cstop offset='.5' style='stop-color:%2312aef1%3bstop-opacity:1'/%3e%3cstop style='stop-color:%231f86f9%3bstop-opacity:1' offset='.75'/%3e%3cstop style='stop-color:%23107ddd%3bstop-opacity:1' offset='1'/%3e%3c/linearGradient%3e%3clinearGradient id='a'%3e%3cstop style='stop-color:%23bdbdbd%3bstop-opacity:1' offset='0'/%3e%3cstop style='stop-color:white%3bstop-opacity:1' offset='1'/%3e%3c/linearGradient%3e%3clinearGradient xlink:href='%23a' id='d' x1='412.975' y1='237.608' x2='412.975' y2='59.392' gradientUnits='userSpaceOnUse' gradientTransform='matrix(.35154 0 0 .35154 206.79 159.773)'/%3e%3cfilter style='color-interpolation-filters:sRGB' id='f' x='-.021' width='1.042' y='-.022' height='1.045'%3e%3cfeGaussianBlur stdDeviation='.958'/%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' id='c' x='-.048' width='1.096' y='-.048' height='1.096'%3e%3cfeGaussianBlur stdDeviation='3.564'/%3e%3c/filter%3e%3cradialGradient xlink:href='%23b' id='e' cx='413.061' cy='136.818' fx='413.061' fy='136.818' r='82.125' gradientUnits='userSpaceOnUse' gradientTransform='matrix(.38143 0 0 .38143 194.545 155.58)'/%3e%3c/defs%3e%3cpath transform='matrix(.33865 0 0 .3261 -106.77 -14.478)' style='opacity:.52999998%3bfill:black%3bfill-opacity:1%3bstroke:none%3bstroke-width:2.93077397%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill%3bfilter:url(%23c)' d='M502.083 148.5a89.108 89.108 0 0 1-89.108 89.108 89.108 89.108 0 0 1-89.108-89.108 89.108 89.108 0 0 1 89.108-89.108 89.108 89.108 0 0 1 89.108 89.108Z'/%3e%3cpath d='M383.294 211.977a31.325 31.325 0 0 1-31.325 31.325 31.325 31.325 0 0 1-31.326-31.325 31.325 31.325 0 0 1 31.326-31.325 31.325 31.325 0 0 1 31.325 31.325z' style='opacity:1%3bfill:url(%23d)%3bfill-opacity:1%3bstroke:%23cdcdcd%3bstroke-width:.09301235%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill' transform='translate(-318.886 -180.595)'/%3e%3cpath d='M380.84 211.977a28.87 28.87 0 0 1-28.871 28.87 28.87 28.87 0 0 1-28.871-28.87 28.87 28.87 0 0 1 28.87-28.87 28.87 28.87 0 0 1 28.871 28.87z' style='opacity:1%3bfill:url(%23e)%3bfill-opacity:1%3bstroke:none%3bstroke-width:.94955933%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill' transform='translate(-318.886 -180.595)'/%3e%3cpath d='M351.969 184.612a.42.42 0 0 0-.421.42v4.856a.42.42 0 1 0 .841 0v-4.855a.42.42 0 0 0-.42-.421zm-2.754.174a.42.42 0 0 0-.46.463l.212 2.03a.42.42 0 1 0 .837-.087l-.212-2.03a.42.42 0 0 0-.377-.376zm5.526.002a.42.42 0 0 0-.377.375l-.213 2.03a.42.42 0 1 0 .837.089l.214-2.031a.42.42 0 0 0-.46-.463zm-8.355.408a.42.42 0 0 0-.41.508l1.006 4.75a.42.42 0 1 0 .824-.174l-1.006-4.75a.42.42 0 0 0-.414-.334zm11.184.004a.42.42 0 0 0-.414.333l-1.01 4.75a.42.42 0 1 0 .824.175l1.01-4.75a.42.42 0 0 0-.41-.508zm-13.883.757a.42.42 0 0 0-.437.55l.631 1.942a.42.42 0 1 0 .8-.26l-.63-1.942a.42.42 0 0 0-.364-.29zm16.567.001a.42.42 0 0 0-.364.29l-.631 1.942a.42.42 0 1 0 .8.26l.632-1.942a.42.42 0 0 0-.437-.55zm-19.237.976a.42.42 0 0 0-.377.592l1.972 4.437a.42.42 0 1 0 .77-.342l-1.973-4.437a.42.42 0 0 0-.392-.25zm21.937.015a.42.42 0 0 0-.393.25l-1.978 4.434a.42.42 0 1 0 .77.343l1.977-4.434a.42.42 0 0 0-.376-.593zm-24.415 1.296a.42.42 0 0 0-.394.63l1.021 1.77a.42.42 0 1 0 .73-.421l-1.022-1.769a.42.42 0 0 0-.335-.21zm26.859 0a.419.419 0 0 0-.335.21l-1.021 1.769a.42.42 0 1 0 .729.42l1.021-1.768a.42.42 0 0 0-.394-.63zm-29.265 1.5a.422.422 0 0 0-.326.669l2.85 3.93a.42.42 0 1 0 .682-.494l-2.851-3.93a.42.42 0 0 0-.355-.174zm31.701.022a.42.42 0 0 0-.355.174l-2.856 3.926a.42.42 0 1 0 .68.495l2.857-3.926a.42.42 0 0 0-.326-.669zm-33.852 1.783a.42.42 0 0 0-.335.702l1.367 1.518a.42.42 0 1 0 .626-.563l-1.367-1.518a.42.42 0 0 0-.29-.14zm35.976.003a.421.421 0 0 0-.291.139l-1.366 1.517a.42.42 0 1 0 .625.564l1.367-1.518a.42.42 0 0 0-.335-.702zm-38.037 1.977a.42.42 0 0 0-.26.733l3.609 3.249a.42.42 0 1 0 .563-.626l-3.608-3.248a.42.42 0 0 0-.304-.108zm40.108.014a.419.419 0 0 0-.304.108l-3.61 3.245a.42.42 0 1 0 .563.626l3.61-3.245a.42.42 0 0 0-.259-.734zm-41.822 2.19a.42.42 0 0 0-.262.762l1.652 1.2a.42.42 0 1 0 .495-.681l-1.652-1.2a.42.42 0 0 0-.233-.081zm43.535.015a.421.421 0 0 0-.233.08l-1.653 1.2a.42.42 0 1 0 .494.681l1.653-1.2a.42.42 0 0 0-.261-.76zm-45.137 2.336a.42.42 0 0 0-.18.785l4.204 2.427a.42.42 0 1 0 .42-.729l-4.204-2.427a.42.42 0 0 0-.24-.056zm46.727 0a.417.417 0 0 0-.24.056l-4.204 2.427a.42.42 0 1 0 .42.73l4.205-2.428a.42.42 0 0 0-.18-.785zm-47.938 2.506a.42.42 0 0 0-.18.805l1.865.833a.42.42 0 1 0 .343-.77l-1.865-.831a.42.42 0 0 0-.163-.037zm49.158.017a.42.42 0 0 0-.164.037l-1.866.83a.42.42 0 1 0 .343.77l1.866-.831a.42.42 0 0 0-.18-.806zm-50.238 2.602a.42.42 0 0 0-.094.82l4.616 1.504a.42.42 0 1 0 .26-.8l-4.615-1.504a.421.421 0 0 0-.167-.02zm51.315.018a.408.408 0 0 0-.166.02l-4.618 1.5a.42.42 0 1 0 .26.801l4.618-1.5a.42.42 0 0 0-.094-.82zm-51.987 2.732a.42.42 0 0 0-.09.833l1.997.424a.42.42 0 1 0 .175-.823l-1.997-.425a.413.413 0 0 0-.085-.009zm52.654.004a.518.518 0 0 0-.084.009l-1.998.424a.42.42 0 1 0 .175.823l1.997-.424a.42.42 0 0 0-.09-.833zm-53.163 2.761a.42.42 0 0 0-.003.838l4.828.51a.42.42 0 1 0 .088-.837l-4.828-.51a.432.432 0 0 0-.085 0zm53.676.037a.386.386 0 0 0-.086 0l-4.828.504a.42.42 0 1 0 .087.837l4.829-.504a.42.42 0 0 0-.002-.837zm-53.758 2.794a.42.42 0 1 0 0 .842h2.042a.42.42 0 1 0 0-.842zm51.793 0a.42.42 0 1 0 0 .842h2.042a.42.42 0 1 0 0-.842zm-46.803 2.295a.384.384 0 0 0-.086 0l-4.829.504a.42.42 0 1 0 .088.838l4.829-.504a.42.42 0 0 0-.002-.838zm43.853.03a.42.42 0 0 0-.003.838l4.828.51a.42.42 0 1 0 .089-.837l-4.829-.51a.434.434 0 0 0-.085-.001zm-46.26 2.844a.43.43 0 0 0-.085.009l-1.998.424a.42.42 0 1 0 .175.823l1.998-.424a.42.42 0 0 0-.09-.833zm48.669.004a.42.42 0 0 0-.09.833l1.998.424a.42.42 0 1 0 .175-.824l-1.998-.424a.413.413 0 0 0-.085-.01zm-45.305 1.657a.408.408 0 0 0-.167.02l-4.617 1.5a.42.42 0 1 0 .26.801l4.618-1.5a.42.42 0 0 0-.094-.82zm41.937.015a.42.42 0 0 0-.094.82l4.616 1.504a.42.42 0 1 0 .26-.8l-4.616-1.504a.421.421 0 0 0-.166-.02zm-43.7 3.273a.42.42 0 0 0-.163.036l-1.865.831a.42.42 0 1 0 .342.769l1.866-.83a.42.42 0 0 0-.18-.806zm45.46.016a.42.42 0 0 0-.18.805l1.865.832a.42.42 0 1 0 .343-.768l-1.865-.833a.42.42 0 0 0-.163-.036zm-41.827.912a.417.417 0 0 0-.24.056l-4.204 2.427a.42.42 0 1 0 .42.73l4.205-2.428a.42.42 0 0 0-.18-.785zm38.2 0a.42.42 0 0 0-.181.785l4.205 2.427a.42.42 0 1 0 .421-.729l-4.204-2.427a.42.42 0 0 0-.24-.056zm-39.248 3.562a.421.421 0 0 0-.233.08l-1.653 1.2a.42.42 0 1 0 .494.682l1.653-1.2a.42.42 0 0 0-.261-.762zm40.287.015a.42.42 0 0 0-.262.762l1.653 1.2a.42.42 0 1 0 .495-.681l-1.653-1.2a.42.42 0 0 0-.233-.081zm-36.544.145a.418.418 0 0 0-.303.108l-3.611 3.245a.42.42 0 1 0 .563.626l3.61-3.245a.42.42 0 0 0-.259-.734zm32.8.011a.421.421 0 0 0-.259.734l3.608 3.248a.42.42 0 1 0 .564-.625l-3.609-3.249a.42.42 0 0 0-.303-.107zm-29.374 3.084a.42.42 0 0 0-.355.173l-2.857 3.927a.42.42 0 1 0 .681.495l2.856-3.926a.42.42 0 0 0-.325-.669zm25.936.018a.421.421 0 0 0-.327.668l2.851 3.93a.42.42 0 1 0 .682-.494l-2.851-3.93a.42.42 0 0 0-.355-.174zm-29.623.606a.421.421 0 0 0-.291.14l-1.366 1.517a.42.42 0 1 0 .625.563l1.367-1.517a.42.42 0 0 0-.335-.703zm33.33.002a.42.42 0 0 0-.335.702l1.367 1.518a.42.42 0 1 0 .626-.563l-1.367-1.518a.42.42 0 0 0-.29-.139zm-25.655 1.684a.419.419 0 0 0-.392.25l-1.978 4.433a.42.42 0 1 0 .769.343l1.978-4.434a.42.42 0 0 0-.377-.592zm17.956.012a.42.42 0 0 0-.377.592l1.972 4.437a.42.42 0 1 0 .77-.342l-1.973-4.437a.42.42 0 0 0-.392-.25zm-21.432 1.359a.419.419 0 0 0-.335.21l-1.02 1.768a.42.42 0 1 0 .728.421l1.021-1.769a.42.42 0 0 0-.394-.63zm24.935 0a.42.42 0 0 0-.394.63l1.02 1.77a.42.42 0 1 0 .73-.422l-1.021-1.769a.42.42 0 0 0-.335-.21zm-17.055.063a.42.42 0 0 0-.414.334l-1.009 4.749a.42.42 0 1 0 .823.175l1.01-4.75a.42.42 0 0 0-.41-.508zm9.16.003a.42.42 0 0 0-.41.508l1.006 4.75a.42.42 0 1 0 .824-.175l-1.006-4.75a.42.42 0 0 0-.414-.333zm-4.572.48a.42.42 0 0 0-.421.42v4.855a.42.42 0 1 0 .841 0v-4.855a.42.42 0 0 0-.42-.42zm-7.727 1.568a.42.42 0 0 0-.364.29l-.632 1.942a.42.42 0 1 0 .801.26l.631-1.942a.42.42 0 0 0-.436-.55zm15.45 0a.42.42 0 0 0-.437.55l.631 1.943a.42.42 0 1 0 .801-.26l-.631-1.942a.42.42 0 0 0-.364-.29zm-10.366 1.083a.42.42 0 0 0-.377.375l-.213 2.03a.42.42 0 1 0 .837.088l.213-2.03a.42.42 0 0 0-.46-.463zm5.268.002a.42.42 0 0 0-.46.463l.211 2.03a.42.42 0 1 0 .837-.088l-.211-2.03a.42.42 0 0 0-.377-.375z' style='opacity:1%3bfill:%23f4f2f3%3bfill-opacity:1%3bstroke:none%3bstroke-width:.38088897%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill' transform='translate(-318.886 -180.595)'/%3e%3cpath transform='matrix(.35154 0 0 .35154 -112.095 -20.822)' d='m469.096 100.607-65.51 38.061-41.42 65.207 60.595-44.882z' style='opacity:.40900005%3bfill:black%3bfill-opacity:1%3bstroke:none%3bstroke-width:1.5614785%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill%3bfilter:url(%23f)'/%3e%3cpath style='opacity:1%3bfill:%23ff5150%3bfill-opacity:1%3bstroke:none%3bstroke-width:1.01970422%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill' d='m129.839 160.803-23.014-23.015 31.437-8.423z' transform='matrix(.64804 -.3317 -.36122 .63206 10.328 -23.732)'/%3e%3cpath transform='matrix(-.36122 .63206 .64804 -.3317 -20.923 6.11)' d='m129.839 160.803-23.014-23.015 31.437-8.423z' style='opacity:1%3bfill:%23f1f1f1%3bfill-opacity:1%3bstroke:none%3bstroke-width:1.01970422%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill'/%3e%3cpath style='opacity:.243%3bfill:black%3bstroke:none%3bstroke-width:.09301235px%3bstroke-linecap:butt%3bstroke-linejoin:miter%3bstroke-opacity:1' d='m331.853 231.185 23.416-15.752 16.815-22.665z' transform='translate(-318.886 -180.595)'/%3e%3c/svg%3e"}),"Safari on iOS"]})})]})})}));var Ys={exports:{}};!function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,u=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===a)return 0;s-=1}else if(u[0][s]<u[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(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)}}var a=function(){function e(){}var t,n,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(n=null)&&s(t.prototype,n),r&&s(t,r),e}();t.default=a,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=u(n(92)),i=u(n(93)),o=u(n(94)),s=u(n(95)),a=u(n(17));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)})),r>0){var s=Object.keys(n),u=a.default.find(s,(function(e){return t.isOS(e)}));if(u){var c=this.satisfies(n[u]);if(void 0!==c)return c}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var f=this.satisfies(n[l]);if(void 0!==f)return f}}if(o>0){var h=Object.keys(i),d=a.default.find(h,(function(e){return t.isBrowser(e,!0)}));if(void 0!==d)return this.compareVersion(i[d])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=c,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})}(Ys);var Qs=f(Ys.exports);function Js(){const e=Qs.getParser(window.navigator.userAgent),t=e.getOS(),n=e.getBrowser(),{type:r}=e.getPlatform();return function(){var e,t;return"isBrave"===(null===(t=null===(e=window.navigator.brave)||void 0===e?void 0:e.isBrave)||void 0===t?void 0:t.name)}()&&(n.name="Brave"),{type:r,os:t,browser:n}}let Xs=null;function Zs(e,t){if(!Xs){const e=document.body,t=document.createElement("div");t.className="ledger-ck-modal",e.appendChild(t),Xs=hs(t)}if(Xs&&e){let n;switch(e){case"UseLedgerLiveModal":n=y.exports.jsx($s,Object.assign({},t));break;case"PlatformNotSupportedModal":n=y.exports.jsx(Gs,{});break;case"ExtensionInstallModal":n=y.exports.jsx(Es,Object.assign({},t))}Xs.render(n)}as(!0)}function ea(e){const t=Js(),n=(hl("getSupportResult"),dl);rl(),!(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV2"))&&!(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV1"))&&n.isLedgerConnectSupported&&n.isChainIdSupported?Zs("ExtensionInstallModal",{onClose:e.onClose}):Zs("UseLedgerLiveModal",{isDesktop:"desktop"===t.type,uri:e.uri,onClose:e.onClose})}const ta=r("WalletConnectLegacy"),na=i("WalletConnectLegacy");function ra(){return c(this,void 0,void 0,(function*(){ta("getWalletConnectLegacyProvider");try{const e=yield function(){return c(this,void 0,void 0,(function*(){ta("initWalletConnectLegacyProvider");const e=rl();return ta("walletConnectProviderOptions is",e),ta("created a new legacy provider instance"),new g({chainId:e.chainId,bridge:e.bridge,infuraId:e.infuraId,rpc:e.rpc,qrcode:!1})}))}();return function(e){function t(e){ta("connectHandler",e),as(!1)}function n(t,r){ta("disconnectHandler",t,r),"undefined"!=typeof localStorage&&localStorage.removeItem("walletconnect"),e.removeListener("disconnect",n)}ta("assignWalletConnectLegacyProviderEvents"),e.on("connect",t),e.on("disconnect",n)}(e),e.request=function(e){ta("patchWalletConnectLegacyProviderRequest");const t=e.request.bind(e),n=rl();return function({method:r,params:i}){return c(this,void 0,void 0,(function*(){return"eth_requestAccounts"===r?(ta("calling patched",r,i),new Promise(((o,s)=>c(this,void 0,void 0,(function*(){try{if(!e.connected)return yield e.connector.createSession({chainId:n.chainId}),ta("created a new session"),ea({uri:e.connector.uri,onClose:()=>{na("user rejected"),s(new a)}}),o(yield t({method:r,params:i}));ta("reusing existing session"),o(yield t({method:r,params:i}))}catch(e){return na("error",e),s(e)}}))))):(ta("calling provider",r,i),yield t({method:r,params:i}))}))}}(e),e}catch(e){const t=e instanceof Error?e:new Error(String(e));throw na("error",t),t}}))}var ia,oa={exports:{}},sa="object"==typeof Reflect?Reflect:null,aa=sa&&"function"==typeof sa.apply?sa.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};ia=sa&&"function"==typeof sa.ownKeys?sa.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var ua=Number.isNaN||function(e){return e!=e};function ca(){ca.init.call(this)}oa.exports=ca,oa.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}_a(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&_a(e,"error",t,n)}(e,i,{once:!0})}))},ca.EventEmitter=ca,ca.prototype._events=void 0,ca.prototype._eventsCount=0,ca.prototype._maxListeners=void 0;var la=10;function fa(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function ha(e){return void 0===e._maxListeners?ca.defaultMaxListeners:e._maxListeners}function da(e,t,n,r){var i,o,s,a;if(fa(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=ha(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return e}function pa(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ga(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=pa.bind(r);return i.listener=n,r.wrapFn=i,i}function ya(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):ma(i,i.length)}function va(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function ma(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _a(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(ca,"defaultMaxListeners",{enumerable:!0,get:function(){return la},set:function(e){if("number"!=typeof e||e<0||ua(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");la=e}}),ca.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ca.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||ua(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},ca.prototype.getMaxListeners=function(){return ha(this)},ca.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)aa(a,this,t);else{var u=a.length,c=ma(a,u);for(n=0;n<u;++n)aa(c[n],this,t)}return!0},ca.prototype.addListener=function(e,t){return da(this,e,t,!1)},ca.prototype.on=ca.prototype.addListener,ca.prototype.prependListener=function(e,t){return da(this,e,t,!0)},ca.prototype.once=function(e,t){return fa(t),this.on(e,ga(this,e,t)),this},ca.prototype.prependOnceListener=function(e,t){return fa(t),this.prependListener(e,ga(this,e,t)),this},ca.prototype.removeListener=function(e,t){var n,r,i,o,s;if(fa(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},ca.prototype.off=ca.prototype.removeListener,ca.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},ca.prototype.listeners=function(e){return ya(this,e,!0)},ca.prototype.rawListeners=function(e){return ya(this,e,!1)},ca.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):va.call(e,t)},ca.prototype.listenerCount=va,ca.prototype.eventNames=function(){return this._eventsCount>0?ia(this._events):[]};var ba={},wa={},Ea={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(e,t){var n=65535&e,r=65535&t;return n*r+((e>>>16&65535)*r+n*(t>>>16&65535)<<16>>>0)|0},e.add=function(e,t){return e+t|0},e.sub=function(e,t){return e-t|0},e.rotl=function(e,t){return e<<t|e>>>32-t},e.rotr=function(e,t){return e<<32-t|e>>>t},e.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}}(Ea),Object.defineProperty(wa,"__esModule",{value:!0});var Sa=Ea;function Oa(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>8,t[n+1]=e>>>0,t}function Ia(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t}function xa(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Ra(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function ka(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function Ca(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function Pa(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>24,t[n+1]=e>>>16,t[n+2]=e>>>8,t[n+3]=e>>>0,t}function Aa(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24,t}function Na(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),Pa(e/4294967296>>>0,t,n),Pa(e>>>0,t,n+4),t}function Ta(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),Aa(e>>>0,t,n),Aa(e/4294967296>>>0,t,n+4),t}wa.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},wa.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},wa.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},wa.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},wa.writeUint16BE=Oa,wa.writeInt16BE=Oa,wa.writeUint16LE=Ia,wa.writeInt16LE=Ia,wa.readInt32BE=xa,wa.readUint32BE=Ra,wa.readInt32LE=ka,wa.readUint32LE=Ca,wa.writeUint32BE=Pa,wa.writeInt32BE=Pa,wa.writeUint32LE=Aa,wa.writeInt32LE=Aa,wa.readInt64BE=function(e,t){void 0===t&&(t=0);var n=xa(e,t),r=xa(e,t+4);return 4294967296*n+r-4294967296*(r>>31)},wa.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*Ra(e,t)+Ra(e,t+4)},wa.readInt64LE=function(e,t){void 0===t&&(t=0);var n=ka(e,t);return 4294967296*ka(e,t+4)+n-4294967296*(n>>31)},wa.readUint64LE=function(e,t){void 0===t&&(t=0);var n=Ca(e,t);return 4294967296*Ca(e,t+4)+n},wa.writeUint64BE=Na,wa.writeInt64BE=Na,wa.writeUint64LE=Ta,wa.writeInt64LE=Ta,wa.readUintBE=function(e,t,n){if(void 0===n&&(n=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var r=0,i=1,o=e/8+n-1;o>=n;o--)r+=t[o]*i,i*=256;return r},wa.readUintLE=function(e,t,n){if(void 0===n&&(n=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var r=0,i=1,o=n;o<n+e/8;o++)r+=t[o]*i,i*=256;return r},wa.writeUintBE=function(e,t,n,r){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===r&&(r=0),e%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Sa.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var i=1,o=e/8+r-1;o>=r;o--)n[o]=t/i&255,i*=256;return n},wa.writeUintLE=function(e,t,n,r){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===r&&(r=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Sa.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var i=1,o=r;o<r+e/8;o++)n[o]=t/i&255,i*=256;return n},wa.readFloat32BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)},wa.readFloat32LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)},wa.readFloat64BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)},wa.readFloat64LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)},wa.writeFloat32BE=function(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(n,e),t},wa.writeFloat32LE=function(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(n,e,!0),t},wa.writeFloat64BE=function(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(n,e),t},wa.writeFloat64LE=function(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(n,e,!0),t};var Ma={};Object.defineProperty(Ma,"__esModule",{value:!0}),Ma.wipe=function(e){for(var t=0;t<e.length;t++)e[t]=0;return e},Object.defineProperty(ba,"__esModule",{value:!0});var La=wa,ja=Ma,Ua=20;function Da(e,t,n){for(var r=1634760805,i=857760878,o=2036477234,s=1797285236,a=n[3]<<24|n[2]<<16|n[1]<<8|n[0],u=n[7]<<24|n[6]<<16|n[5]<<8|n[4],c=n[11]<<24|n[10]<<16|n[9]<<8|n[8],l=n[15]<<24|n[14]<<16|n[13]<<8|n[12],f=n[19]<<24|n[18]<<16|n[17]<<8|n[16],h=n[23]<<24|n[22]<<16|n[21]<<8|n[20],d=n[27]<<24|n[26]<<16|n[25]<<8|n[24],p=n[31]<<24|n[30]<<16|n[29]<<8|n[28],g=t[3]<<24|t[2]<<16|t[1]<<8|t[0],y=t[7]<<24|t[6]<<16|t[5]<<8|t[4],v=t[11]<<24|t[10]<<16|t[9]<<8|t[8],m=t[15]<<24|t[14]<<16|t[13]<<8|t[12],_=r,b=i,w=o,E=s,S=a,O=u,I=c,x=l,R=f,k=h,C=d,P=p,A=g,N=y,T=v,M=m,L=0;L<Ua;L+=2)S=(S^=R=R+(A=(A^=_=_+S|0)>>>16|A<<16)|0)>>>20|S<<12,O=(O^=k=k+(N=(N^=b=b+O|0)>>>16|N<<16)|0)>>>20|O<<12,I=(I^=C=C+(T=(T^=w=w+I|0)>>>16|T<<16)|0)>>>20|I<<12,x=(x^=P=P+(M=(M^=E=E+x|0)>>>16|M<<16)|0)>>>20|x<<12,I=(I^=C=C+(T=(T^=w=w+I|0)>>>24|T<<8)|0)>>>25|I<<7,x=(x^=P=P+(M=(M^=E=E+x|0)>>>24|M<<8)|0)>>>25|x<<7,O=(O^=k=k+(N=(N^=b=b+O|0)>>>24|N<<8)|0)>>>25|O<<7,S=(S^=R=R+(A=(A^=_=_+S|0)>>>24|A<<8)|0)>>>25|S<<7,O=(O^=C=C+(M=(M^=_=_+O|0)>>>16|M<<16)|0)>>>20|O<<12,I=(I^=P=P+(A=(A^=b=b+I|0)>>>16|A<<16)|0)>>>20|I<<12,x=(x^=R=R+(N=(N^=w=w+x|0)>>>16|N<<16)|0)>>>20|x<<12,S=(S^=k=k+(T=(T^=E=E+S|0)>>>16|T<<16)|0)>>>20|S<<12,x=(x^=R=R+(N=(N^=w=w+x|0)>>>24|N<<8)|0)>>>25|x<<7,S=(S^=k=k+(T=(T^=E=E+S|0)>>>24|T<<8)|0)>>>25|S<<7,I=(I^=P=P+(A=(A^=b=b+I|0)>>>24|A<<8)|0)>>>25|I<<7,O=(O^=C=C+(M=(M^=_=_+O|0)>>>24|M<<8)|0)>>>25|O<<7;La.writeUint32LE(_+r|0,e,0),La.writeUint32LE(b+i|0,e,4),La.writeUint32LE(w+o|0,e,8),La.writeUint32LE(E+s|0,e,12),La.writeUint32LE(S+a|0,e,16),La.writeUint32LE(O+u|0,e,20),La.writeUint32LE(I+c|0,e,24),La.writeUint32LE(x+l|0,e,28),La.writeUint32LE(R+f|0,e,32),La.writeUint32LE(k+h|0,e,36),La.writeUint32LE(C+d|0,e,40),La.writeUint32LE(P+p|0,e,44),La.writeUint32LE(A+g|0,e,48),La.writeUint32LE(N+y|0,e,52),La.writeUint32LE(T+v|0,e,56),La.writeUint32LE(M+m|0,e,60)}function za(e,t,n,r,i){if(void 0===i&&(i=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(r.length<n.length)throw new Error("ChaCha: destination is shorter than source");var o,s;if(0===i){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=(o=new Uint8Array(16)).length-t.length,o.set(t,s)}else{if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");o=t,s=i}for(var a=new Uint8Array(64),u=0;u<n.length;u+=64){Da(a,o,e);for(var c=u;c<u+64&&c<n.length;c++)r[c]=n[c]^a[c-u];Fa(o,0,s)}return ja.wipe(a),0===i&&ja.wipe(o),r}function Fa(e,t,n){for(var r=1;n--;)r=r+(255&e[t])|0,e[t]=255&r,r>>>=8,t++;if(r>0)throw new Error("ChaCha: counter overflow")}ba.streamXOR=za,ba.stream=function(e,t,n,r){return void 0===r&&(r=0),ja.wipe(n),za(e,t,n,n,r)};var Ba={},Ha={};function qa(e,t){if(e.length!==t.length)return 0;for(var n=0,r=0;r<e.length;r++)n|=e[r]^t[r];return 1&n-1>>>8}Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.select=function(e,t,n){return~(e-1)&t|e-1&n},Ha.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},Ha.compare=qa,Ha.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==qa(e,t)},function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Ha,n=Ma;e.DIGEST_LENGTH=16;var r=function(){function t(t){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var n=t[0]|t[1]<<8;this._r[0]=8191&n;var r=t[2]|t[3]<<8;this._r[1]=8191&(n>>>13|r<<3);var i=t[4]|t[5]<<8;this._r[2]=7939&(r>>>10|i<<6);var o=t[6]|t[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=t[8]|t[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=t[10]|t[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var u=t[12]|t[13]<<8;this._r[7]=8065&(a>>>11|u<<5);var c=t[14]|t[15]<<8;this._r[8]=8191&(u>>>8|c<<8),this._r[9]=c>>>5&127,this._pad[0]=t[16]|t[17]<<8,this._pad[1]=t[18]|t[19]<<8,this._pad[2]=t[20]|t[21]<<8,this._pad[3]=t[22]|t[23]<<8,this._pad[4]=t[24]|t[25]<<8,this._pad[5]=t[26]|t[27]<<8,this._pad[6]=t[28]|t[29]<<8,this._pad[7]=t[30]|t[31]<<8}return t.prototype._blocks=function(e,t,n){for(var r=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],u=this._h[4],c=this._h[5],l=this._h[6],f=this._h[7],h=this._h[8],d=this._h[9],p=this._r[0],g=this._r[1],y=this._r[2],v=this._r[3],m=this._r[4],_=this._r[5],b=this._r[6],w=this._r[7],E=this._r[8],S=this._r[9];n>=16;){var O=e[t+0]|e[t+1]<<8;i+=8191&O;var I=e[t+2]|e[t+3]<<8;o+=8191&(O>>>13|I<<3);var x=e[t+4]|e[t+5]<<8;s+=8191&(I>>>10|x<<6);var R=e[t+6]|e[t+7]<<8;a+=8191&(x>>>7|R<<9);var k=e[t+8]|e[t+9]<<8;u+=8191&(R>>>4|k<<12),c+=k>>>1&8191;var C=e[t+10]|e[t+11]<<8;l+=8191&(k>>>14|C<<2);var P=e[t+12]|e[t+13]<<8;f+=8191&(C>>>11|P<<5);var A=e[t+14]|e[t+15]<<8,N=0,T=N;T+=i*p,T+=o*(5*S),T+=s*(5*E),T+=a*(5*w),N=(T+=u*(5*b))>>>13,T&=8191,T+=c*(5*_),T+=l*(5*m),T+=f*(5*v),T+=(h+=8191&(P>>>8|A<<8))*(5*y);var M=N+=(T+=(d+=A>>>5|r)*(5*g))>>>13;M+=i*g,M+=o*p,M+=s*(5*S),M+=a*(5*E),N=(M+=u*(5*w))>>>13,M&=8191,M+=c*(5*b),M+=l*(5*_),M+=f*(5*m),M+=h*(5*v),N+=(M+=d*(5*y))>>>13,M&=8191;var L=N;L+=i*y,L+=o*g,L+=s*p,L+=a*(5*S),N=(L+=u*(5*E))>>>13,L&=8191,L+=c*(5*w),L+=l*(5*b),L+=f*(5*_),L+=h*(5*m);var j=N+=(L+=d*(5*v))>>>13;j+=i*v,j+=o*y,j+=s*g,j+=a*p,N=(j+=u*(5*S))>>>13,j&=8191,j+=c*(5*E),j+=l*(5*w),j+=f*(5*b),j+=h*(5*_);var U=N+=(j+=d*(5*m))>>>13;U+=i*m,U+=o*v,U+=s*y,U+=a*g,N=(U+=u*p)>>>13,U&=8191,U+=c*(5*S),U+=l*(5*E),U+=f*(5*w),U+=h*(5*b);var D=N+=(U+=d*(5*_))>>>13;D+=i*_,D+=o*m,D+=s*v,D+=a*y,N=(D+=u*g)>>>13,D&=8191,D+=c*p,D+=l*(5*S),D+=f*(5*E),D+=h*(5*w);var z=N+=(D+=d*(5*b))>>>13;z+=i*b,z+=o*_,z+=s*m,z+=a*v,N=(z+=u*y)>>>13,z&=8191,z+=c*g,z+=l*p,z+=f*(5*S),z+=h*(5*E);var F=N+=(z+=d*(5*w))>>>13;F+=i*w,F+=o*b,F+=s*_,F+=a*m,N=(F+=u*v)>>>13,F&=8191,F+=c*y,F+=l*g,F+=f*p,F+=h*(5*S);var B=N+=(F+=d*(5*E))>>>13;B+=i*E,B+=o*w,B+=s*b,B+=a*_,N=(B+=u*m)>>>13,B&=8191,B+=c*v,B+=l*y,B+=f*g,B+=h*p;var H=N+=(B+=d*(5*S))>>>13;H+=i*S,H+=o*E,H+=s*w,H+=a*b,N=(H+=u*_)>>>13,H&=8191,H+=c*m,H+=l*v,H+=f*y,H+=h*g,i=T=8191&(N=(N=((N+=(H+=d*p)>>>13)<<2)+N|0)+(T&=8191)|0),o=M+=N>>>=13,s=L&=8191,a=j&=8191,u=U&=8191,c=D&=8191,l=z&=8191,f=F&=8191,h=B&=8191,d=H&=8191,t+=16,n-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=u,this._h[5]=c,this._h[6]=l,this._h[7]=f,this._h[8]=h,this._h[9]=d},t.prototype.finish=function(e,t){void 0===t&&(t=0);var n,r,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(n=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=n,n=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*n,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,s[0]=this._h[0]+5,n=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+n,n=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,r=(1^n)-1,o=0;o<10;o++)s[o]&=r;for(r=~r,o=0;o<10;o++)this._h[o]=this._h[o]&r|s[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var t,n=0,r=e.length;if(this._leftover){(t=16-this._leftover)>r&&(t=r);for(var i=0;i<t;i++)this._buffer[this._leftover+i]=e[n+i];if(r-=t,n+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(r>=16&&(t=r-r%16,this._blocks(e,n,t),n+=t,r-=t),r){for(i=0;i<r;i++)this._buffer[this._leftover+i]=e[n+i];this._leftover+=r}return this},t.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},t.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},t}();e.Poly1305=r,e.oneTimeAuth=function(e,t){var n=new r(e);n.update(t);var i=n.digest();return n.clean(),i},e.equal=function(n,r){return n.length===e.DIGEST_LENGTH&&r.length===e.DIGEST_LENGTH&&t.equal(n,r)}}(Ba),function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=ba,n=Ba,r=Ma,i=wa,o=Ha;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var s=new Uint8Array(16),a=function(){function a(t){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,t.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(t)}return a.prototype.seal=function(e,n,i,o){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);t.stream(this._key,s,a,4);var u,c=n.length+this.tagLength;if(o){if(o.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");u=o}else u=new Uint8Array(c);return t.streamXOR(this._key,s,n,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),a,u.subarray(0,u.length-this.tagLength),i),r.wipe(s),u},a.prototype.open=function(e,n,i,s){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(n.length<this.tagLength)return null;var a=new Uint8Array(16);a.set(e,a.length-e.length);var u=new Uint8Array(32);t.stream(this._key,a,u,4);var c=new Uint8Array(this.tagLength);if(this._authenticate(c,u,n.subarray(0,n.length-this.tagLength),i),!o.equal(c,n.subarray(n.length-this.tagLength,n.length)))return null;var l,f=n.length-this.tagLength;if(s){if(s.length!==f)throw new Error("ChaCha20Poly1305: incorrect destination length");l=s}else l=new Uint8Array(f);return t.streamXOR(this._key,a,n.subarray(0,n.length-this.tagLength),l,4),r.wipe(a),l},a.prototype.clean=function(){return r.wipe(this._key),this},a.prototype._authenticate=function(e,t,o,a){var u=new n.Poly1305(t);a&&(u.update(a),a.length%16>0&&u.update(s.subarray(a.length%16))),u.update(o),o.length%16>0&&u.update(s.subarray(o.length%16));var c=new Uint8Array(8);a&&i.writeUint64LE(a.length,c),u.update(c),i.writeUint64LE(o.length,c),u.update(c);for(var l=u.digest(),f=0;f<l.length;f++)e[f]=l[f];u.clean(),r.wipe(l),r.wipe(c)},a}();e.ChaCha20Poly1305=a}({});var $a={},Va={},Wa={};Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.isSerializableHash=function(e){return void 0!==e.saveState&&void 0!==e.restoreState&&void 0!==e.cleanSavedState},Object.defineProperty(Va,"__esModule",{value:!0});var Ka=Wa,Ga=Ha,Ya=Ma,Qa=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var r=0;r<n.length;r++)n[r]^=54;this._inner.update(n);for(r=0;r<n.length;r++)n[r]^=106;this._outer.update(n),Ka.isSerializableHash(this._inner)&&Ka.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Ya.wipe(n)}return e.prototype.reset=function(){if(!Ka.isSerializableHash(this._inner)||!Ka.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){Ka.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Ka.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(e){return this._inner.update(e),this},e.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!Ka.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!Ka.isSerializableHash(this._inner)||!Ka.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(e){if(!Ka.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},e}();Va.HMAC=Qa,Va.hmac=function(e,t,n){var r=new Qa(e,t);r.update(n);var i=r.digest();return r.clean(),i},Va.equal=Ga.equal,Object.defineProperty($a,"__esModule",{value:!0});var Ja=Va,Xa=Ma,Za=function(){function e(e,t,n,r){void 0===n&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=r;var i=Ja.hmac(this._hash,n,t);this._hmac=new Ja.HMAC(e,i),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;n<t.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[n]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),Xa.wipe(this._buffer),Xa.wipe(this._counter),this._bufpos=0},e}();$a.HKDF=Za;var eu={},tu={},nu={};Object.defineProperty(nu,"__esModule",{value:!0}),nu.BrowserRandomSource=void 0;function ru(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}nu.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let e=0;e<t.length;e+=65536)this._crypto.getRandomValues(t.subarray(e,e+Math.min(t.length-e,65536)));return t}};var iu={},ou=h(Object.freeze({__proto__:null,default:{}}));Object.defineProperty(iu,"__esModule",{value:!0}),iu.NodeRandomSource=void 0;const su=Ma;iu.NodeRandomSource=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,void 0!==ru){const e=ou;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let e=0;e<n.length;e++)n[e]=t[e];return(0,su.wipe)(t),n}},Object.defineProperty(tu,"__esModule",{value:!0}),tu.SystemRandomSource=void 0;const au=nu,uu=iu;tu.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new au.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new uu.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const t=tu,n=wa,r=Ma;function i(t,n=e.defaultRandomSource){return n.randomBytes(t)}e.defaultRandomSource=new t.SystemRandomSource,e.randomBytes=i,e.randomUint32=function(t=e.defaultRandomSource){const o=i(4,t),s=(0,n.readUint32LE)(o);return(0,r.wipe)(o),s};const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function s(t,n=o,s=e.defaultRandomSource){if(n.length<2)throw new Error("randomString charset is too short");if(n.length>256)throw new Error("randomString charset is too long");let a="";const u=n.length,c=256-256%u;for(;t>0;){const e=i(Math.ceil(256*t/c),s);for(let r=0;r<e.length&&t>0;r++){const i=e[r];i<c&&(a+=n.charAt(i%u),t--)}(0,r.wipe)(e)}return a}e.randomString=s,e.randomStringForEntropy=function(t,n=o,r=e.defaultRandomSource){return s(Math.ceil(t/(Math.log(n.length)/Math.LN2)),n,r)}}(eu);!function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=wa,n=Ma;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var r=function(){function r(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return r.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=o(this._temp,this._state,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var n=this._bytesHashed,r=this._bufferLength,i=n/536870912|0,s=n<<3,a=n%64<56?64:128;this._buffer[r]=128;for(var u=r+1;u<a-8;u++)this._buffer[u]=0;t.writeUint32BE(i,this._buffer,a-8),t.writeUint32BE(s,this._buffer,a-4),o(this._temp,this._state,this._buffer,0,a),this._finished=!0}for(u=0;u<this.digestLength/4;u++)t.writeUint32BE(this._state[u],e,4*u);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){n.wipe(e.state),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();e.SHA256=r;var i=new Int32Array([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]);function o(e,n,r,o,s){for(;s>=64;){for(var a=n[0],u=n[1],c=n[2],l=n[3],f=n[4],h=n[5],d=n[6],p=n[7],g=0;g<16;g++){var y=o+4*g;e[g]=t.readUint32BE(r,y)}for(g=16;g<64;g++){var v=e[g-2],m=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10,_=((v=e[g-15])>>>7|v<<25)^(v>>>18|v<<14)^v>>>3;e[g]=(m+e[g-7]|0)+(_+e[g-16]|0)}for(g=0;g<64;g++){m=(((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&h^~f&d)|0)+(p+(i[g]+e[g]|0)|0)|0,_=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&u^a&c^u&c)|0;p=d,d=h,h=f,f=l+m|0,l=c,c=u,u=a,a=m+_|0}n[0]+=a,n[1]+=u,n[2]+=c,n[3]+=l,n[4]+=f,n[5]+=h,n[6]+=d,n[7]+=p,o+=64,s-=64}return o}e.hash=function(e){var t=new r;t.update(e);var n=t.digest();return t.clean(),n}}({});!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const t=eu,n=Ma;function r(e){const t=new Float64Array(16);if(e)for(let n=0;n<e.length;n++)t[n]=e[n];return t}e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;const i=new Uint8Array(32);i[0]=9;const o=r([56129,1]);function s(e){let t=1;for(let n=0;n<16;n++){let r=e[n]+t+65535;t=Math.floor(r/65536),e[n]=r-65536*t}e[0]+=t-1+37*(t-1)}function a(e,t,n){const r=~(n-1);for(let n=0;n<16;n++){const i=r&(e[n]^t[n]);e[n]^=i,t[n]^=i}}function u(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]+n[r]}function c(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]-n[r]}function l(e,t,n){let r,i,o=0,s=0,a=0,u=0,c=0,l=0,f=0,h=0,d=0,p=0,g=0,y=0,v=0,m=0,_=0,b=0,w=0,E=0,S=0,O=0,I=0,x=0,R=0,k=0,C=0,P=0,A=0,N=0,T=0,M=0,L=0,j=n[0],U=n[1],D=n[2],z=n[3],F=n[4],B=n[5],H=n[6],q=n[7],$=n[8],V=n[9],W=n[10],K=n[11],G=n[12],Y=n[13],Q=n[14],J=n[15];r=t[0],o+=r*j,s+=r*U,a+=r*D,u+=r*z,c+=r*F,l+=r*B,f+=r*H,h+=r*q,d+=r*$,p+=r*V,g+=r*W,y+=r*K,v+=r*G,m+=r*Y,_+=r*Q,b+=r*J,r=t[1],s+=r*j,a+=r*U,u+=r*D,c+=r*z,l+=r*F,f+=r*B,h+=r*H,d+=r*q,p+=r*$,g+=r*V,y+=r*W,v+=r*K,m+=r*G,_+=r*Y,b+=r*Q,w+=r*J,r=t[2],a+=r*j,u+=r*U,c+=r*D,l+=r*z,f+=r*F,h+=r*B,d+=r*H,p+=r*q,g+=r*$,y+=r*V,v+=r*W,m+=r*K,_+=r*G,b+=r*Y,w+=r*Q,E+=r*J,r=t[3],u+=r*j,c+=r*U,l+=r*D,f+=r*z,h+=r*F,d+=r*B,p+=r*H,g+=r*q,y+=r*$,v+=r*V,m+=r*W,_+=r*K,b+=r*G,w+=r*Y,E+=r*Q,S+=r*J,r=t[4],c+=r*j,l+=r*U,f+=r*D,h+=r*z,d+=r*F,p+=r*B,g+=r*H,y+=r*q,v+=r*$,m+=r*V,_+=r*W,b+=r*K,w+=r*G,E+=r*Y,S+=r*Q,O+=r*J,r=t[5],l+=r*j,f+=r*U,h+=r*D,d+=r*z,p+=r*F,g+=r*B,y+=r*H,v+=r*q,m+=r*$,_+=r*V,b+=r*W,w+=r*K,E+=r*G,S+=r*Y,O+=r*Q,I+=r*J,r=t[6],f+=r*j,h+=r*U,d+=r*D,p+=r*z,g+=r*F,y+=r*B,v+=r*H,m+=r*q,_+=r*$,b+=r*V,w+=r*W,E+=r*K,S+=r*G,O+=r*Y,I+=r*Q,x+=r*J,r=t[7],h+=r*j,d+=r*U,p+=r*D,g+=r*z,y+=r*F,v+=r*B,m+=r*H,_+=r*q,b+=r*$,w+=r*V,E+=r*W,S+=r*K,O+=r*G,I+=r*Y,x+=r*Q,R+=r*J,r=t[8],d+=r*j,p+=r*U,g+=r*D,y+=r*z,v+=r*F,m+=r*B,_+=r*H,b+=r*q,w+=r*$,E+=r*V,S+=r*W,O+=r*K,I+=r*G,x+=r*Y,R+=r*Q,k+=r*J,r=t[9],p+=r*j,g+=r*U,y+=r*D,v+=r*z,m+=r*F,_+=r*B,b+=r*H,w+=r*q,E+=r*$,S+=r*V,O+=r*W,I+=r*K,x+=r*G,R+=r*Y,k+=r*Q,C+=r*J,r=t[10],g+=r*j,y+=r*U,v+=r*D,m+=r*z,_+=r*F,b+=r*B,w+=r*H,E+=r*q,S+=r*$,O+=r*V,I+=r*W,x+=r*K,R+=r*G,k+=r*Y,C+=r*Q,P+=r*J,r=t[11],y+=r*j,v+=r*U,m+=r*D,_+=r*z,b+=r*F,w+=r*B,E+=r*H,S+=r*q,O+=r*$,I+=r*V,x+=r*W,R+=r*K,k+=r*G,C+=r*Y,P+=r*Q,A+=r*J,r=t[12],v+=r*j,m+=r*U,_+=r*D,b+=r*z,w+=r*F,E+=r*B,S+=r*H,O+=r*q,I+=r*$,x+=r*V,R+=r*W,k+=r*K,C+=r*G,P+=r*Y,A+=r*Q,N+=r*J,r=t[13],m+=r*j,_+=r*U,b+=r*D,w+=r*z,E+=r*F,S+=r*B,O+=r*H,I+=r*q,x+=r*$,R+=r*V,k+=r*W,C+=r*K,P+=r*G,A+=r*Y,N+=r*Q,T+=r*J,r=t[14],_+=r*j,b+=r*U,w+=r*D,E+=r*z,S+=r*F,O+=r*B,I+=r*H,x+=r*q,R+=r*$,k+=r*V,C+=r*W,P+=r*K,A+=r*G,N+=r*Y,T+=r*Q,M+=r*J,r=t[15],b+=r*j,w+=r*U,E+=r*D,S+=r*z,O+=r*F,I+=r*B,x+=r*H,R+=r*q,k+=r*$,C+=r*V,P+=r*W,A+=r*K,N+=r*G,T+=r*Y,M+=r*Q,L+=r*J,o+=38*w,s+=38*E,a+=38*S,u+=38*O,c+=38*I,l+=38*x,f+=38*R,h+=38*k,d+=38*C,p+=38*P,g+=38*A,y+=38*N,v+=38*T,m+=38*M,_+=38*L,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=h,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=v,e[13]=m,e[14]=_,e[15]=b}function f(e,t){l(e,t,t)}function h(e,t){const n=new Uint8Array(32),i=new Float64Array(80),h=r(),d=r(),p=r(),g=r(),y=r(),v=r();for(let t=0;t<31;t++)n[t]=e[t];n[31]=127&e[31]|64,n[0]&=248,function(e,t){for(let n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}(i,t);for(let e=0;e<16;e++)d[e]=i[e];h[0]=g[0]=1;for(let e=254;e>=0;--e){const t=n[e>>>3]>>>(7&e)&1;a(h,d,t),a(p,g,t),u(y,h,p),c(h,h,p),u(p,d,g),c(d,d,g),f(g,y),f(v,h),l(h,p,h),l(p,d,y),u(y,h,p),c(h,h,p),f(d,h),c(p,g,v),l(h,p,o),u(h,h,g),l(p,p,h),l(h,g,v),l(g,d,i),f(d,y),a(h,d,t),a(p,g,t)}for(let e=0;e<16;e++)i[e+16]=h[e],i[e+32]=p[e],i[e+48]=d[e],i[e+64]=g[e];const m=i.subarray(32),_=i.subarray(16);!function(e,t){const n=r();for(let e=0;e<16;e++)n[e]=t[e];for(let e=253;e>=0;e--)f(n,n),2!==e&&4!==e&&l(n,n,t);for(let t=0;t<16;t++)e[t]=n[t]}(m,m),l(_,_,m);const b=new Uint8Array(32);return function(e,t){const n=r(),i=r();for(let e=0;e<16;e++)i[e]=t[e];s(i),s(i),s(i);for(let e=0;e<2;e++){n[0]=i[0]-65517;for(let e=1;e<15;e++)n[e]=i[e]-65535-(n[e-1]>>16&1),n[e-1]&=65535;n[15]=i[15]-32767-(n[14]>>16&1);const e=n[15]>>16&1;n[14]&=65535,a(i,n,1-e)}for(let t=0;t<16;t++)e[2*t]=255&i[t],e[2*t+1]=i[t]>>8}(b,_),b}function d(e){return h(e,i)}function p(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const n=new Uint8Array(t);return{publicKey:d(n),secretKey:n}}e.scalarMult=h,e.scalarMultBase=d,e.generateKeyPairFromSeed=p,e.generateKeyPair=function(e){const r=(0,t.randomBytes)(32,e),i=p(r);return(0,n.wipe)(r),i},e.sharedKey=function(t,n,r=!1){if(t.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(n.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const i=h(t,n);if(r){let e=0;for(let t=0;t<i.length;t++)e|=i[t];if(0===e)throw new Error("X25519: invalid shared key")}return i}}({});var cu=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var r=0,i=0;e[t]===u;)r++,t++;for(var o=(e.length-t)*c+1>>>0,s=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var f=0,h=o-1;(0!==l||f<i)&&-1!==h;h--,f++)l+=a*s[h]>>>0,s[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=o-i;d!==o&&0===s[d];)d++;for(var p=new Uint8Array(r+(o-d)),g=r;d!==o;)p[g++]=s[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*l+1>>>0,c=new Uint8Array(s);i!==o;){for(var f=t[i],h=0,d=s-1;(0!==f||h<r)&&-1!==d;d--,h++)f+=256*c[d]>>>0,c[d]=f%a>>>0,f=f/a>>>0;if(0!==f)throw new Error("Non-zero carry");r=h,i++}for(var p=s-r;p!==s&&0===c[p];)p++;for(var g=u.repeat(n);p<s;++p)g+=e.charAt(c[p]);return g},decodeUnsafe:f,decode:function(e){var n=f(e);if(n)return n;throw new Error(`Non-${t} character`)}}},lu=cu;const fu=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};class hu{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class du{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return gu(this,e)}}class pu{constructor(e){this.decoders=e}or(e){return gu(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const gu=(e,t)=>new pu({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class yu{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new hu(e,t,n),this.decoder=new du(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const vu=({name:e,prefix:t,encode:n,decode:r})=>new yu(e,t,n,r),mu=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=lu(n,t);return vu({prefix:e,name:t,encode:r,decode:e=>fu(i(e))})},_u=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>vu({prefix:t,name:e,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let r=0;r<e.length;++r)for(a=a<<8|e[r],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o})(e,r,n),decode:t=>((e,t,n,r)=>{const i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*n/8|0);let a=0,u=0,c=0;for(let t=0;t<o;++t){const o=i[e[t]];if(void 0===o)throw new SyntaxError(`Non-${r} character`);u=u<<n|o,a+=n,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=n||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s})(t,r,n,e)});vu({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)});_u({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});_u({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});mu({prefix:"9",name:"base10",alphabet:"0123456789"});_u({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_u({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});_u({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),_u({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),_u({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),_u({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),_u({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_u({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),_u({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_u({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_u({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});mu({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),mu({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});mu({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mu({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});_u({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_u({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_u({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_u({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});const bu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),wu=bu.reduce(((e,t,n)=>(e[n]=t,e)),[]),Eu=bu.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);vu({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=wu[t]),"")},decode:function(e){const t=[];for(const n of e){const e=Eu[n.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}});var Su=function e(t,n,r){n=n||[];var i=r=r||0;for(;t>=xu;)n[r++]=255&t|Ou,t/=128;for(;t&Iu;)n[r++]=255&t|Ou,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Ou=128,Iu=-128,xu=Math.pow(2,31);var Ru=function e(t,n){var r,i=0,o=0,s=n=n||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(r&Cu)<<o:(r&Cu)*Math.pow(2,o),o+=7}while(r>=ku);return e.bytes=s-n,i},ku=128,Cu=127;var Pu=Math.pow(2,7),Au=Math.pow(2,14),Nu=Math.pow(2,21),Tu=Math.pow(2,28),Mu=Math.pow(2,35),Lu=Math.pow(2,42),ju=Math.pow(2,49),Uu=Math.pow(2,56),Du=Math.pow(2,63),zu={encode:Su,decode:Ru,encodingLength:function(e){return e<Pu?1:e<Au?2:e<Nu?3:e<Tu?4:e<Mu?5:e<Lu?6:e<ju?7:e<Uu?8:e<Du?9:10}};const Fu=(e,t,n=0)=>(zu.encode(e,t,n),t),Bu=e=>zu.encodingLength(e),Hu=(e,t)=>{const n=t.byteLength,r=Bu(e),i=r+Bu(n),o=new Uint8Array(i+n);return Fu(e,o,0),Fu(n,o,r),o.set(t,i),new qu(e,n,t,o)};class qu{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const $u=({name:e,code:t,encode:n})=>new Vu(e,t,n);class Vu{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Hu(this.code,t):t.then((e=>Hu(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Wu=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));$u({name:"sha2-256",code:18,encode:Wu("SHA-256")}),$u({name:"sha2-512",code:19,encode:Wu("SHA-512")});new TextEncoder,new TextDecoder;var Ku=function(e,t){return Ku=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},Ku(e,t)};
236
+ `;const Ks=r("PlatformNotSupportedModal"),Gs=()=>(Ks("initializing"),y.exports.jsx(us,{children:y.exports.jsx(y.exports.Fragment,{children:y.exports.jsxs(lt,{children:[y.exports.jsx(ft,{children:"Sorry, we don't support this platform just yet."}),y.exports.jsxs(ht,{children:["We're working hard to expand our coverage.",y.exports.jsx("br",{}),"Until we get there, you can try Ledger Connect on:"]}),y.exports.jsx(Vs,{children:y.exports.jsxs(Ws,{children:[y.exports.jsx("img",{src:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='250.076' height='248.707' viewBox='0 0 66.166 65.804'%3e%3cdefs%3e%3clinearGradient id='b'%3e%3cstop style='stop-color:%2306c2e7%3bstop-opacity:1' offset='0'/%3e%3cstop offset='.25' style='stop-color:%230db8ec%3bstop-opacity:1'/%3e%3cstop offset='.5' style='stop-color:%2312aef1%3bstop-opacity:1'/%3e%3cstop style='stop-color:%231f86f9%3bstop-opacity:1' offset='.75'/%3e%3cstop style='stop-color:%23107ddd%3bstop-opacity:1' offset='1'/%3e%3c/linearGradient%3e%3clinearGradient id='a'%3e%3cstop style='stop-color:%23bdbdbd%3bstop-opacity:1' offset='0'/%3e%3cstop style='stop-color:white%3bstop-opacity:1' offset='1'/%3e%3c/linearGradient%3e%3clinearGradient xlink:href='%23a' id='d' x1='412.975' y1='237.608' x2='412.975' y2='59.392' gradientUnits='userSpaceOnUse' gradientTransform='matrix(.35154 0 0 .35154 206.79 159.773)'/%3e%3cfilter style='color-interpolation-filters:sRGB' id='f' x='-.021' width='1.042' y='-.022' height='1.045'%3e%3cfeGaussianBlur stdDeviation='.958'/%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' id='c' x='-.048' width='1.096' y='-.048' height='1.096'%3e%3cfeGaussianBlur stdDeviation='3.564'/%3e%3c/filter%3e%3cradialGradient xlink:href='%23b' id='e' cx='413.061' cy='136.818' fx='413.061' fy='136.818' r='82.125' gradientUnits='userSpaceOnUse' gradientTransform='matrix(.38143 0 0 .38143 194.545 155.58)'/%3e%3c/defs%3e%3cpath transform='matrix(.33865 0 0 .3261 -106.77 -14.478)' style='opacity:.52999998%3bfill:black%3bfill-opacity:1%3bstroke:none%3bstroke-width:2.93077397%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill%3bfilter:url(%23c)' d='M502.083 148.5a89.108 89.108 0 0 1-89.108 89.108 89.108 89.108 0 0 1-89.108-89.108 89.108 89.108 0 0 1 89.108-89.108 89.108 89.108 0 0 1 89.108 89.108Z'/%3e%3cpath d='M383.294 211.977a31.325 31.325 0 0 1-31.325 31.325 31.325 31.325 0 0 1-31.326-31.325 31.325 31.325 0 0 1 31.326-31.325 31.325 31.325 0 0 1 31.325 31.325z' style='opacity:1%3bfill:url(%23d)%3bfill-opacity:1%3bstroke:%23cdcdcd%3bstroke-width:.09301235%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill' transform='translate(-318.886 -180.595)'/%3e%3cpath d='M380.84 211.977a28.87 28.87 0 0 1-28.871 28.87 28.87 28.87 0 0 1-28.871-28.87 28.87 28.87 0 0 1 28.87-28.87 28.87 28.87 0 0 1 28.871 28.87z' style='opacity:1%3bfill:url(%23e)%3bfill-opacity:1%3bstroke:none%3bstroke-width:.94955933%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill' transform='translate(-318.886 -180.595)'/%3e%3cpath d='M351.969 184.612a.42.42 0 0 0-.421.42v4.856a.42.42 0 1 0 .841 0v-4.855a.42.42 0 0 0-.42-.421zm-2.754.174a.42.42 0 0 0-.46.463l.212 2.03a.42.42 0 1 0 .837-.087l-.212-2.03a.42.42 0 0 0-.377-.376zm5.526.002a.42.42 0 0 0-.377.375l-.213 2.03a.42.42 0 1 0 .837.089l.214-2.031a.42.42 0 0 0-.46-.463zm-8.355.408a.42.42 0 0 0-.41.508l1.006 4.75a.42.42 0 1 0 .824-.174l-1.006-4.75a.42.42 0 0 0-.414-.334zm11.184.004a.42.42 0 0 0-.414.333l-1.01 4.75a.42.42 0 1 0 .824.175l1.01-4.75a.42.42 0 0 0-.41-.508zm-13.883.757a.42.42 0 0 0-.437.55l.631 1.942a.42.42 0 1 0 .8-.26l-.63-1.942a.42.42 0 0 0-.364-.29zm16.567.001a.42.42 0 0 0-.364.29l-.631 1.942a.42.42 0 1 0 .8.26l.632-1.942a.42.42 0 0 0-.437-.55zm-19.237.976a.42.42 0 0 0-.377.592l1.972 4.437a.42.42 0 1 0 .77-.342l-1.973-4.437a.42.42 0 0 0-.392-.25zm21.937.015a.42.42 0 0 0-.393.25l-1.978 4.434a.42.42 0 1 0 .77.343l1.977-4.434a.42.42 0 0 0-.376-.593zm-24.415 1.296a.42.42 0 0 0-.394.63l1.021 1.77a.42.42 0 1 0 .73-.421l-1.022-1.769a.42.42 0 0 0-.335-.21zm26.859 0a.419.419 0 0 0-.335.21l-1.021 1.769a.42.42 0 1 0 .729.42l1.021-1.768a.42.42 0 0 0-.394-.63zm-29.265 1.5a.422.422 0 0 0-.326.669l2.85 3.93a.42.42 0 1 0 .682-.494l-2.851-3.93a.42.42 0 0 0-.355-.174zm31.701.022a.42.42 0 0 0-.355.174l-2.856 3.926a.42.42 0 1 0 .68.495l2.857-3.926a.42.42 0 0 0-.326-.669zm-33.852 1.783a.42.42 0 0 0-.335.702l1.367 1.518a.42.42 0 1 0 .626-.563l-1.367-1.518a.42.42 0 0 0-.29-.14zm35.976.003a.421.421 0 0 0-.291.139l-1.366 1.517a.42.42 0 1 0 .625.564l1.367-1.518a.42.42 0 0 0-.335-.702zm-38.037 1.977a.42.42 0 0 0-.26.733l3.609 3.249a.42.42 0 1 0 .563-.626l-3.608-3.248a.42.42 0 0 0-.304-.108zm40.108.014a.419.419 0 0 0-.304.108l-3.61 3.245a.42.42 0 1 0 .563.626l3.61-3.245a.42.42 0 0 0-.259-.734zm-41.822 2.19a.42.42 0 0 0-.262.762l1.652 1.2a.42.42 0 1 0 .495-.681l-1.652-1.2a.42.42 0 0 0-.233-.081zm43.535.015a.421.421 0 0 0-.233.08l-1.653 1.2a.42.42 0 1 0 .494.681l1.653-1.2a.42.42 0 0 0-.261-.76zm-45.137 2.336a.42.42 0 0 0-.18.785l4.204 2.427a.42.42 0 1 0 .42-.729l-4.204-2.427a.42.42 0 0 0-.24-.056zm46.727 0a.417.417 0 0 0-.24.056l-4.204 2.427a.42.42 0 1 0 .42.73l4.205-2.428a.42.42 0 0 0-.18-.785zm-47.938 2.506a.42.42 0 0 0-.18.805l1.865.833a.42.42 0 1 0 .343-.77l-1.865-.831a.42.42 0 0 0-.163-.037zm49.158.017a.42.42 0 0 0-.164.037l-1.866.83a.42.42 0 1 0 .343.77l1.866-.831a.42.42 0 0 0-.18-.806zm-50.238 2.602a.42.42 0 0 0-.094.82l4.616 1.504a.42.42 0 1 0 .26-.8l-4.615-1.504a.421.421 0 0 0-.167-.02zm51.315.018a.408.408 0 0 0-.166.02l-4.618 1.5a.42.42 0 1 0 .26.801l4.618-1.5a.42.42 0 0 0-.094-.82zm-51.987 2.732a.42.42 0 0 0-.09.833l1.997.424a.42.42 0 1 0 .175-.823l-1.997-.425a.413.413 0 0 0-.085-.009zm52.654.004a.518.518 0 0 0-.084.009l-1.998.424a.42.42 0 1 0 .175.823l1.997-.424a.42.42 0 0 0-.09-.833zm-53.163 2.761a.42.42 0 0 0-.003.838l4.828.51a.42.42 0 1 0 .088-.837l-4.828-.51a.432.432 0 0 0-.085 0zm53.676.037a.386.386 0 0 0-.086 0l-4.828.504a.42.42 0 1 0 .087.837l4.829-.504a.42.42 0 0 0-.002-.837zm-53.758 2.794a.42.42 0 1 0 0 .842h2.042a.42.42 0 1 0 0-.842zm51.793 0a.42.42 0 1 0 0 .842h2.042a.42.42 0 1 0 0-.842zm-46.803 2.295a.384.384 0 0 0-.086 0l-4.829.504a.42.42 0 1 0 .088.838l4.829-.504a.42.42 0 0 0-.002-.838zm43.853.03a.42.42 0 0 0-.003.838l4.828.51a.42.42 0 1 0 .089-.837l-4.829-.51a.434.434 0 0 0-.085-.001zm-46.26 2.844a.43.43 0 0 0-.085.009l-1.998.424a.42.42 0 1 0 .175.823l1.998-.424a.42.42 0 0 0-.09-.833zm48.669.004a.42.42 0 0 0-.09.833l1.998.424a.42.42 0 1 0 .175-.824l-1.998-.424a.413.413 0 0 0-.085-.01zm-45.305 1.657a.408.408 0 0 0-.167.02l-4.617 1.5a.42.42 0 1 0 .26.801l4.618-1.5a.42.42 0 0 0-.094-.82zm41.937.015a.42.42 0 0 0-.094.82l4.616 1.504a.42.42 0 1 0 .26-.8l-4.616-1.504a.421.421 0 0 0-.166-.02zm-43.7 3.273a.42.42 0 0 0-.163.036l-1.865.831a.42.42 0 1 0 .342.769l1.866-.83a.42.42 0 0 0-.18-.806zm45.46.016a.42.42 0 0 0-.18.805l1.865.832a.42.42 0 1 0 .343-.768l-1.865-.833a.42.42 0 0 0-.163-.036zm-41.827.912a.417.417 0 0 0-.24.056l-4.204 2.427a.42.42 0 1 0 .42.73l4.205-2.428a.42.42 0 0 0-.18-.785zm38.2 0a.42.42 0 0 0-.181.785l4.205 2.427a.42.42 0 1 0 .421-.729l-4.204-2.427a.42.42 0 0 0-.24-.056zm-39.248 3.562a.421.421 0 0 0-.233.08l-1.653 1.2a.42.42 0 1 0 .494.682l1.653-1.2a.42.42 0 0 0-.261-.762zm40.287.015a.42.42 0 0 0-.262.762l1.653 1.2a.42.42 0 1 0 .495-.681l-1.653-1.2a.42.42 0 0 0-.233-.081zm-36.544.145a.418.418 0 0 0-.303.108l-3.611 3.245a.42.42 0 1 0 .563.626l3.61-3.245a.42.42 0 0 0-.259-.734zm32.8.011a.421.421 0 0 0-.259.734l3.608 3.248a.42.42 0 1 0 .564-.625l-3.609-3.249a.42.42 0 0 0-.303-.107zm-29.374 3.084a.42.42 0 0 0-.355.173l-2.857 3.927a.42.42 0 1 0 .681.495l2.856-3.926a.42.42 0 0 0-.325-.669zm25.936.018a.421.421 0 0 0-.327.668l2.851 3.93a.42.42 0 1 0 .682-.494l-2.851-3.93a.42.42 0 0 0-.355-.174zm-29.623.606a.421.421 0 0 0-.291.14l-1.366 1.517a.42.42 0 1 0 .625.563l1.367-1.517a.42.42 0 0 0-.335-.703zm33.33.002a.42.42 0 0 0-.335.702l1.367 1.518a.42.42 0 1 0 .626-.563l-1.367-1.518a.42.42 0 0 0-.29-.139zm-25.655 1.684a.419.419 0 0 0-.392.25l-1.978 4.433a.42.42 0 1 0 .769.343l1.978-4.434a.42.42 0 0 0-.377-.592zm17.956.012a.42.42 0 0 0-.377.592l1.972 4.437a.42.42 0 1 0 .77-.342l-1.973-4.437a.42.42 0 0 0-.392-.25zm-21.432 1.359a.419.419 0 0 0-.335.21l-1.02 1.768a.42.42 0 1 0 .728.421l1.021-1.769a.42.42 0 0 0-.394-.63zm24.935 0a.42.42 0 0 0-.394.63l1.02 1.77a.42.42 0 1 0 .73-.422l-1.021-1.769a.42.42 0 0 0-.335-.21zm-17.055.063a.42.42 0 0 0-.414.334l-1.009 4.749a.42.42 0 1 0 .823.175l1.01-4.75a.42.42 0 0 0-.41-.508zm9.16.003a.42.42 0 0 0-.41.508l1.006 4.75a.42.42 0 1 0 .824-.175l-1.006-4.75a.42.42 0 0 0-.414-.333zm-4.572.48a.42.42 0 0 0-.421.42v4.855a.42.42 0 1 0 .841 0v-4.855a.42.42 0 0 0-.42-.42zm-7.727 1.568a.42.42 0 0 0-.364.29l-.632 1.942a.42.42 0 1 0 .801.26l.631-1.942a.42.42 0 0 0-.436-.55zm15.45 0a.42.42 0 0 0-.437.55l.631 1.943a.42.42 0 1 0 .801-.26l-.631-1.942a.42.42 0 0 0-.364-.29zm-10.366 1.083a.42.42 0 0 0-.377.375l-.213 2.03a.42.42 0 1 0 .837.088l.213-2.03a.42.42 0 0 0-.46-.463zm5.268.002a.42.42 0 0 0-.46.463l.211 2.03a.42.42 0 1 0 .837-.088l-.211-2.03a.42.42 0 0 0-.377-.375z' style='opacity:1%3bfill:%23f4f2f3%3bfill-opacity:1%3bstroke:none%3bstroke-width:.38088897%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill' transform='translate(-318.886 -180.595)'/%3e%3cpath transform='matrix(.35154 0 0 .35154 -112.095 -20.822)' d='m469.096 100.607-65.51 38.061-41.42 65.207 60.595-44.882z' style='opacity:.40900005%3bfill:black%3bfill-opacity:1%3bstroke:none%3bstroke-width:1.5614785%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill%3bfilter:url(%23f)'/%3e%3cpath style='opacity:1%3bfill:%23ff5150%3bfill-opacity:1%3bstroke:none%3bstroke-width:1.01970422%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill' d='m129.839 160.803-23.014-23.015 31.437-8.423z' transform='matrix(.64804 -.3317 -.36122 .63206 10.328 -23.732)'/%3e%3cpath transform='matrix(-.36122 .63206 .64804 -.3317 -20.923 6.11)' d='m129.839 160.803-23.014-23.015 31.437-8.423z' style='opacity:1%3bfill:%23f1f1f1%3bfill-opacity:1%3bstroke:none%3bstroke-width:1.01970422%3bstroke-linecap:round%3bstroke-linejoin:round%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-dashoffset:0%3bstroke-opacity:1%3bpaint-order:markers stroke fill'/%3e%3cpath style='opacity:.243%3bfill:black%3bstroke:none%3bstroke-width:.09301235px%3bstroke-linecap:butt%3bstroke-linejoin:miter%3bstroke-opacity:1' d='m331.853 231.185 23.416-15.752 16.815-22.665z' transform='translate(-318.886 -180.595)'/%3e%3c/svg%3e"}),"Safari on iOS"]})})]})})}));var Ys={exports:{}};!function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,u=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===a)return 0;s-=1}else if(u[0][s]<u[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(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)}}var a=function(){function e(){}var t,n,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(n=null)&&s(t.prototype,n),r&&s(t,r),e}();t.default=a,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=u(n(92)),i=u(n(93)),o=u(n(94)),s=u(n(95)),a=u(n(17));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)})),r>0){var s=Object.keys(n),u=a.default.find(s,(function(e){return t.isOS(e)}));if(u){var c=this.satisfies(n[u]);if(void 0!==c)return c}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var f=this.satisfies(n[l]);if(void 0!==f)return f}}if(o>0){var h=Object.keys(i),d=a.default.find(h,(function(e){return t.isBrowser(e,!0)}));if(void 0!==d)return this.compareVersion(i[d])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=c,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})}(Ys);var Qs=f(Ys.exports);function Js(){const e=Qs.getParser(window.navigator.userAgent),t=e.getOS(),n=e.getBrowser(),{type:r}=e.getPlatform();return function(){var e,t;return"isBrave"===(null===(t=null===(e=window.navigator.brave)||void 0===e?void 0:e.isBrave)||void 0===t?void 0:t.name)}()&&(n.name="Brave"),{type:r,os:t,browser:n}}let Xs=null;function Zs(e,t){if(!Xs){const e=document.body,t=document.createElement("div");t.className="ledger-ck-modal",e.appendChild(t),Xs=hs(t)}if(Xs&&e){let n;switch(e){case"UseLedgerLiveModal":n=y.exports.jsx($s,Object.assign({},t));break;case"PlatformNotSupportedModal":n=y.exports.jsx(Gs,{});break;case"ExtensionInstallModal":n=y.exports.jsx(Es,Object.assign({},t))}Xs.render(n)}as(!0)}function ea(e){const t=Js(),n=(fl("getSupportResult"),hl);nl(),!(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV2"))&&!(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV1"))&&n.isLedgerConnectSupported&&n.isChainIdSupported?Zs("ExtensionInstallModal",{onClose:e.onClose}):Zs("UseLedgerLiveModal",{isDesktop:"desktop"===t.type,uri:e.uri,onClose:e.onClose})}const ta=r("WalletConnectLegacy"),na=i("WalletConnectLegacy");function ra(){return c(this,void 0,void 0,(function*(){ta("getWalletConnectLegacyProvider");try{const e=yield function(){return c(this,void 0,void 0,(function*(){ta("initWalletConnectLegacyProvider");const e=nl();return ta("walletConnectProviderOptions is",e),ta("created a new legacy provider instance"),new g({chainId:e.chainId,bridge:e.bridge,infuraId:e.infuraId,rpc:e.rpc,qrcode:!1})}))}();return function(e){function t(e){ta("connectHandler",e),as(!1)}function n(t,r){ta("disconnectHandler",t,r),"undefined"!=typeof localStorage&&localStorage.removeItem("walletconnect"),e.removeListener("disconnect",n)}ta("assignWalletConnectLegacyProviderEvents"),e.on("connect",t),e.on("disconnect",n)}(e),e.request=function(e){ta("patchWalletConnectLegacyProviderRequest");const t=e.request.bind(e),n=nl();return function({method:r,params:i}){return c(this,void 0,void 0,(function*(){return"eth_requestAccounts"===r?(ta("calling patched",r,i),new Promise(((o,s)=>c(this,void 0,void 0,(function*(){try{if(!e.connected)return yield e.connector.createSession({chainId:n.chainId}),ta("created a new session"),ea({uri:e.connector.uri,onClose:()=>{na("user rejected"),s(new a)}}),o(yield t({method:r,params:i}));ta("reusing existing session"),o(yield t({method:r,params:i}))}catch(e){return na("error",e),s(e)}}))))):(ta("calling provider",r,i),yield t({method:r,params:i}))}))}}(e),e}catch(e){const t=e instanceof Error?e:new Error(String(e));throw na("error",t),t}}))}var ia,oa={exports:{}},sa="object"==typeof Reflect?Reflect:null,aa=sa&&"function"==typeof sa.apply?sa.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};ia=sa&&"function"==typeof sa.ownKeys?sa.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var ua=Number.isNaN||function(e){return e!=e};function ca(){ca.init.call(this)}oa.exports=ca,oa.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}_a(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&_a(e,"error",t,n)}(e,i,{once:!0})}))},ca.EventEmitter=ca,ca.prototype._events=void 0,ca.prototype._eventsCount=0,ca.prototype._maxListeners=void 0;var la=10;function fa(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function ha(e){return void 0===e._maxListeners?ca.defaultMaxListeners:e._maxListeners}function da(e,t,n,r){var i,o,s,a;if(fa(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=ha(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return e}function pa(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ga(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=pa.bind(r);return i.listener=n,r.wrapFn=i,i}function ya(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):ma(i,i.length)}function va(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function ma(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _a(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(ca,"defaultMaxListeners",{enumerable:!0,get:function(){return la},set:function(e){if("number"!=typeof e||e<0||ua(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");la=e}}),ca.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ca.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||ua(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},ca.prototype.getMaxListeners=function(){return ha(this)},ca.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)aa(a,this,t);else{var u=a.length,c=ma(a,u);for(n=0;n<u;++n)aa(c[n],this,t)}return!0},ca.prototype.addListener=function(e,t){return da(this,e,t,!1)},ca.prototype.on=ca.prototype.addListener,ca.prototype.prependListener=function(e,t){return da(this,e,t,!0)},ca.prototype.once=function(e,t){return fa(t),this.on(e,ga(this,e,t)),this},ca.prototype.prependOnceListener=function(e,t){return fa(t),this.prependListener(e,ga(this,e,t)),this},ca.prototype.removeListener=function(e,t){var n,r,i,o,s;if(fa(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},ca.prototype.off=ca.prototype.removeListener,ca.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},ca.prototype.listeners=function(e){return ya(this,e,!0)},ca.prototype.rawListeners=function(e){return ya(this,e,!1)},ca.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):va.call(e,t)},ca.prototype.listenerCount=va,ca.prototype.eventNames=function(){return this._eventsCount>0?ia(this._events):[]};var ba={},wa={},Ea={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(e,t){var n=65535&e,r=65535&t;return n*r+((e>>>16&65535)*r+n*(t>>>16&65535)<<16>>>0)|0},e.add=function(e,t){return e+t|0},e.sub=function(e,t){return e-t|0},e.rotl=function(e,t){return e<<t|e>>>32-t},e.rotr=function(e,t){return e<<32-t|e>>>t},e.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}}(Ea),Object.defineProperty(wa,"__esModule",{value:!0});var Sa=Ea;function Oa(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>8,t[n+1]=e>>>0,t}function Ia(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t}function xa(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Ra(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function ka(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function Ca(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function Pa(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>24,t[n+1]=e>>>16,t[n+2]=e>>>8,t[n+3]=e>>>0,t}function Aa(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24,t}function Na(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),Pa(e/4294967296>>>0,t,n),Pa(e>>>0,t,n+4),t}function Ta(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),Aa(e>>>0,t,n),Aa(e/4294967296>>>0,t,n+4),t}wa.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},wa.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},wa.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},wa.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},wa.writeUint16BE=Oa,wa.writeInt16BE=Oa,wa.writeUint16LE=Ia,wa.writeInt16LE=Ia,wa.readInt32BE=xa,wa.readUint32BE=Ra,wa.readInt32LE=ka,wa.readUint32LE=Ca,wa.writeUint32BE=Pa,wa.writeInt32BE=Pa,wa.writeUint32LE=Aa,wa.writeInt32LE=Aa,wa.readInt64BE=function(e,t){void 0===t&&(t=0);var n=xa(e,t),r=xa(e,t+4);return 4294967296*n+r-4294967296*(r>>31)},wa.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*Ra(e,t)+Ra(e,t+4)},wa.readInt64LE=function(e,t){void 0===t&&(t=0);var n=ka(e,t);return 4294967296*ka(e,t+4)+n-4294967296*(n>>31)},wa.readUint64LE=function(e,t){void 0===t&&(t=0);var n=Ca(e,t);return 4294967296*Ca(e,t+4)+n},wa.writeUint64BE=Na,wa.writeInt64BE=Na,wa.writeUint64LE=Ta,wa.writeInt64LE=Ta,wa.readUintBE=function(e,t,n){if(void 0===n&&(n=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var r=0,i=1,o=e/8+n-1;o>=n;o--)r+=t[o]*i,i*=256;return r},wa.readUintLE=function(e,t,n){if(void 0===n&&(n=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var r=0,i=1,o=n;o<n+e/8;o++)r+=t[o]*i,i*=256;return r},wa.writeUintBE=function(e,t,n,r){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===r&&(r=0),e%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Sa.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var i=1,o=e/8+r-1;o>=r;o--)n[o]=t/i&255,i*=256;return n},wa.writeUintLE=function(e,t,n,r){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===r&&(r=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Sa.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var i=1,o=r;o<r+e/8;o++)n[o]=t/i&255,i*=256;return n},wa.readFloat32BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)},wa.readFloat32LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)},wa.readFloat64BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)},wa.readFloat64LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)},wa.writeFloat32BE=function(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(n,e),t},wa.writeFloat32LE=function(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(n,e,!0),t},wa.writeFloat64BE=function(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(n,e),t},wa.writeFloat64LE=function(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(n,e,!0),t};var Ma={};Object.defineProperty(Ma,"__esModule",{value:!0}),Ma.wipe=function(e){for(var t=0;t<e.length;t++)e[t]=0;return e},Object.defineProperty(ba,"__esModule",{value:!0});var La=wa,ja=Ma,Ua=20;function Da(e,t,n){for(var r=1634760805,i=857760878,o=2036477234,s=1797285236,a=n[3]<<24|n[2]<<16|n[1]<<8|n[0],u=n[7]<<24|n[6]<<16|n[5]<<8|n[4],c=n[11]<<24|n[10]<<16|n[9]<<8|n[8],l=n[15]<<24|n[14]<<16|n[13]<<8|n[12],f=n[19]<<24|n[18]<<16|n[17]<<8|n[16],h=n[23]<<24|n[22]<<16|n[21]<<8|n[20],d=n[27]<<24|n[26]<<16|n[25]<<8|n[24],p=n[31]<<24|n[30]<<16|n[29]<<8|n[28],g=t[3]<<24|t[2]<<16|t[1]<<8|t[0],y=t[7]<<24|t[6]<<16|t[5]<<8|t[4],v=t[11]<<24|t[10]<<16|t[9]<<8|t[8],m=t[15]<<24|t[14]<<16|t[13]<<8|t[12],_=r,b=i,w=o,E=s,S=a,O=u,I=c,x=l,R=f,k=h,C=d,P=p,A=g,N=y,T=v,M=m,L=0;L<Ua;L+=2)S=(S^=R=R+(A=(A^=_=_+S|0)>>>16|A<<16)|0)>>>20|S<<12,O=(O^=k=k+(N=(N^=b=b+O|0)>>>16|N<<16)|0)>>>20|O<<12,I=(I^=C=C+(T=(T^=w=w+I|0)>>>16|T<<16)|0)>>>20|I<<12,x=(x^=P=P+(M=(M^=E=E+x|0)>>>16|M<<16)|0)>>>20|x<<12,I=(I^=C=C+(T=(T^=w=w+I|0)>>>24|T<<8)|0)>>>25|I<<7,x=(x^=P=P+(M=(M^=E=E+x|0)>>>24|M<<8)|0)>>>25|x<<7,O=(O^=k=k+(N=(N^=b=b+O|0)>>>24|N<<8)|0)>>>25|O<<7,S=(S^=R=R+(A=(A^=_=_+S|0)>>>24|A<<8)|0)>>>25|S<<7,O=(O^=C=C+(M=(M^=_=_+O|0)>>>16|M<<16)|0)>>>20|O<<12,I=(I^=P=P+(A=(A^=b=b+I|0)>>>16|A<<16)|0)>>>20|I<<12,x=(x^=R=R+(N=(N^=w=w+x|0)>>>16|N<<16)|0)>>>20|x<<12,S=(S^=k=k+(T=(T^=E=E+S|0)>>>16|T<<16)|0)>>>20|S<<12,x=(x^=R=R+(N=(N^=w=w+x|0)>>>24|N<<8)|0)>>>25|x<<7,S=(S^=k=k+(T=(T^=E=E+S|0)>>>24|T<<8)|0)>>>25|S<<7,I=(I^=P=P+(A=(A^=b=b+I|0)>>>24|A<<8)|0)>>>25|I<<7,O=(O^=C=C+(M=(M^=_=_+O|0)>>>24|M<<8)|0)>>>25|O<<7;La.writeUint32LE(_+r|0,e,0),La.writeUint32LE(b+i|0,e,4),La.writeUint32LE(w+o|0,e,8),La.writeUint32LE(E+s|0,e,12),La.writeUint32LE(S+a|0,e,16),La.writeUint32LE(O+u|0,e,20),La.writeUint32LE(I+c|0,e,24),La.writeUint32LE(x+l|0,e,28),La.writeUint32LE(R+f|0,e,32),La.writeUint32LE(k+h|0,e,36),La.writeUint32LE(C+d|0,e,40),La.writeUint32LE(P+p|0,e,44),La.writeUint32LE(A+g|0,e,48),La.writeUint32LE(N+y|0,e,52),La.writeUint32LE(T+v|0,e,56),La.writeUint32LE(M+m|0,e,60)}function za(e,t,n,r,i){if(void 0===i&&(i=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(r.length<n.length)throw new Error("ChaCha: destination is shorter than source");var o,s;if(0===i){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=(o=new Uint8Array(16)).length-t.length,o.set(t,s)}else{if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");o=t,s=i}for(var a=new Uint8Array(64),u=0;u<n.length;u+=64){Da(a,o,e);for(var c=u;c<u+64&&c<n.length;c++)r[c]=n[c]^a[c-u];Fa(o,0,s)}return ja.wipe(a),0===i&&ja.wipe(o),r}function Fa(e,t,n){for(var r=1;n--;)r=r+(255&e[t])|0,e[t]=255&r,r>>>=8,t++;if(r>0)throw new Error("ChaCha: counter overflow")}ba.streamXOR=za,ba.stream=function(e,t,n,r){return void 0===r&&(r=0),ja.wipe(n),za(e,t,n,n,r)};var Ba={},Ha={};function qa(e,t){if(e.length!==t.length)return 0;for(var n=0,r=0;r<e.length;r++)n|=e[r]^t[r];return 1&n-1>>>8}Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.select=function(e,t,n){return~(e-1)&t|e-1&n},Ha.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},Ha.compare=qa,Ha.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==qa(e,t)},function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Ha,n=Ma;e.DIGEST_LENGTH=16;var r=function(){function t(t){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var n=t[0]|t[1]<<8;this._r[0]=8191&n;var r=t[2]|t[3]<<8;this._r[1]=8191&(n>>>13|r<<3);var i=t[4]|t[5]<<8;this._r[2]=7939&(r>>>10|i<<6);var o=t[6]|t[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=t[8]|t[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=t[10]|t[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var u=t[12]|t[13]<<8;this._r[7]=8065&(a>>>11|u<<5);var c=t[14]|t[15]<<8;this._r[8]=8191&(u>>>8|c<<8),this._r[9]=c>>>5&127,this._pad[0]=t[16]|t[17]<<8,this._pad[1]=t[18]|t[19]<<8,this._pad[2]=t[20]|t[21]<<8,this._pad[3]=t[22]|t[23]<<8,this._pad[4]=t[24]|t[25]<<8,this._pad[5]=t[26]|t[27]<<8,this._pad[6]=t[28]|t[29]<<8,this._pad[7]=t[30]|t[31]<<8}return t.prototype._blocks=function(e,t,n){for(var r=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],u=this._h[4],c=this._h[5],l=this._h[6],f=this._h[7],h=this._h[8],d=this._h[9],p=this._r[0],g=this._r[1],y=this._r[2],v=this._r[3],m=this._r[4],_=this._r[5],b=this._r[6],w=this._r[7],E=this._r[8],S=this._r[9];n>=16;){var O=e[t+0]|e[t+1]<<8;i+=8191&O;var I=e[t+2]|e[t+3]<<8;o+=8191&(O>>>13|I<<3);var x=e[t+4]|e[t+5]<<8;s+=8191&(I>>>10|x<<6);var R=e[t+6]|e[t+7]<<8;a+=8191&(x>>>7|R<<9);var k=e[t+8]|e[t+9]<<8;u+=8191&(R>>>4|k<<12),c+=k>>>1&8191;var C=e[t+10]|e[t+11]<<8;l+=8191&(k>>>14|C<<2);var P=e[t+12]|e[t+13]<<8;f+=8191&(C>>>11|P<<5);var A=e[t+14]|e[t+15]<<8,N=0,T=N;T+=i*p,T+=o*(5*S),T+=s*(5*E),T+=a*(5*w),N=(T+=u*(5*b))>>>13,T&=8191,T+=c*(5*_),T+=l*(5*m),T+=f*(5*v),T+=(h+=8191&(P>>>8|A<<8))*(5*y);var M=N+=(T+=(d+=A>>>5|r)*(5*g))>>>13;M+=i*g,M+=o*p,M+=s*(5*S),M+=a*(5*E),N=(M+=u*(5*w))>>>13,M&=8191,M+=c*(5*b),M+=l*(5*_),M+=f*(5*m),M+=h*(5*v),N+=(M+=d*(5*y))>>>13,M&=8191;var L=N;L+=i*y,L+=o*g,L+=s*p,L+=a*(5*S),N=(L+=u*(5*E))>>>13,L&=8191,L+=c*(5*w),L+=l*(5*b),L+=f*(5*_),L+=h*(5*m);var j=N+=(L+=d*(5*v))>>>13;j+=i*v,j+=o*y,j+=s*g,j+=a*p,N=(j+=u*(5*S))>>>13,j&=8191,j+=c*(5*E),j+=l*(5*w),j+=f*(5*b),j+=h*(5*_);var U=N+=(j+=d*(5*m))>>>13;U+=i*m,U+=o*v,U+=s*y,U+=a*g,N=(U+=u*p)>>>13,U&=8191,U+=c*(5*S),U+=l*(5*E),U+=f*(5*w),U+=h*(5*b);var D=N+=(U+=d*(5*_))>>>13;D+=i*_,D+=o*m,D+=s*v,D+=a*y,N=(D+=u*g)>>>13,D&=8191,D+=c*p,D+=l*(5*S),D+=f*(5*E),D+=h*(5*w);var z=N+=(D+=d*(5*b))>>>13;z+=i*b,z+=o*_,z+=s*m,z+=a*v,N=(z+=u*y)>>>13,z&=8191,z+=c*g,z+=l*p,z+=f*(5*S),z+=h*(5*E);var F=N+=(z+=d*(5*w))>>>13;F+=i*w,F+=o*b,F+=s*_,F+=a*m,N=(F+=u*v)>>>13,F&=8191,F+=c*y,F+=l*g,F+=f*p,F+=h*(5*S);var B=N+=(F+=d*(5*E))>>>13;B+=i*E,B+=o*w,B+=s*b,B+=a*_,N=(B+=u*m)>>>13,B&=8191,B+=c*v,B+=l*y,B+=f*g,B+=h*p;var H=N+=(B+=d*(5*S))>>>13;H+=i*S,H+=o*E,H+=s*w,H+=a*b,N=(H+=u*_)>>>13,H&=8191,H+=c*m,H+=l*v,H+=f*y,H+=h*g,i=T=8191&(N=(N=((N+=(H+=d*p)>>>13)<<2)+N|0)+(T&=8191)|0),o=M+=N>>>=13,s=L&=8191,a=j&=8191,u=U&=8191,c=D&=8191,l=z&=8191,f=F&=8191,h=B&=8191,d=H&=8191,t+=16,n-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=u,this._h[5]=c,this._h[6]=l,this._h[7]=f,this._h[8]=h,this._h[9]=d},t.prototype.finish=function(e,t){void 0===t&&(t=0);var n,r,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(n=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=n,n=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*n,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,s[0]=this._h[0]+5,n=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+n,n=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,r=(1^n)-1,o=0;o<10;o++)s[o]&=r;for(r=~r,o=0;o<10;o++)this._h[o]=this._h[o]&r|s[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var t,n=0,r=e.length;if(this._leftover){(t=16-this._leftover)>r&&(t=r);for(var i=0;i<t;i++)this._buffer[this._leftover+i]=e[n+i];if(r-=t,n+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(r>=16&&(t=r-r%16,this._blocks(e,n,t),n+=t,r-=t),r){for(i=0;i<r;i++)this._buffer[this._leftover+i]=e[n+i];this._leftover+=r}return this},t.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},t.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},t}();e.Poly1305=r,e.oneTimeAuth=function(e,t){var n=new r(e);n.update(t);var i=n.digest();return n.clean(),i},e.equal=function(n,r){return n.length===e.DIGEST_LENGTH&&r.length===e.DIGEST_LENGTH&&t.equal(n,r)}}(Ba),function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=ba,n=Ba,r=Ma,i=wa,o=Ha;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var s=new Uint8Array(16),a=function(){function a(t){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,t.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(t)}return a.prototype.seal=function(e,n,i,o){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);t.stream(this._key,s,a,4);var u,c=n.length+this.tagLength;if(o){if(o.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");u=o}else u=new Uint8Array(c);return t.streamXOR(this._key,s,n,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),a,u.subarray(0,u.length-this.tagLength),i),r.wipe(s),u},a.prototype.open=function(e,n,i,s){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(n.length<this.tagLength)return null;var a=new Uint8Array(16);a.set(e,a.length-e.length);var u=new Uint8Array(32);t.stream(this._key,a,u,4);var c=new Uint8Array(this.tagLength);if(this._authenticate(c,u,n.subarray(0,n.length-this.tagLength),i),!o.equal(c,n.subarray(n.length-this.tagLength,n.length)))return null;var l,f=n.length-this.tagLength;if(s){if(s.length!==f)throw new Error("ChaCha20Poly1305: incorrect destination length");l=s}else l=new Uint8Array(f);return t.streamXOR(this._key,a,n.subarray(0,n.length-this.tagLength),l,4),r.wipe(a),l},a.prototype.clean=function(){return r.wipe(this._key),this},a.prototype._authenticate=function(e,t,o,a){var u=new n.Poly1305(t);a&&(u.update(a),a.length%16>0&&u.update(s.subarray(a.length%16))),u.update(o),o.length%16>0&&u.update(s.subarray(o.length%16));var c=new Uint8Array(8);a&&i.writeUint64LE(a.length,c),u.update(c),i.writeUint64LE(o.length,c),u.update(c);for(var l=u.digest(),f=0;f<l.length;f++)e[f]=l[f];u.clean(),r.wipe(l),r.wipe(c)},a}();e.ChaCha20Poly1305=a}({});var $a={},Va={},Wa={};Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.isSerializableHash=function(e){return void 0!==e.saveState&&void 0!==e.restoreState&&void 0!==e.cleanSavedState},Object.defineProperty(Va,"__esModule",{value:!0});var Ka=Wa,Ga=Ha,Ya=Ma,Qa=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var r=0;r<n.length;r++)n[r]^=54;this._inner.update(n);for(r=0;r<n.length;r++)n[r]^=106;this._outer.update(n),Ka.isSerializableHash(this._inner)&&Ka.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Ya.wipe(n)}return e.prototype.reset=function(){if(!Ka.isSerializableHash(this._inner)||!Ka.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){Ka.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Ka.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(e){return this._inner.update(e),this},e.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!Ka.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!Ka.isSerializableHash(this._inner)||!Ka.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(e){if(!Ka.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},e}();Va.HMAC=Qa,Va.hmac=function(e,t,n){var r=new Qa(e,t);r.update(n);var i=r.digest();return r.clean(),i},Va.equal=Ga.equal,Object.defineProperty($a,"__esModule",{value:!0});var Ja=Va,Xa=Ma,Za=function(){function e(e,t,n,r){void 0===n&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=r;var i=Ja.hmac(this._hash,n,t);this._hmac=new Ja.HMAC(e,i),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;n<t.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[n]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),Xa.wipe(this._buffer),Xa.wipe(this._counter),this._bufpos=0},e}();$a.HKDF=Za;var eu={},tu={},nu={};Object.defineProperty(nu,"__esModule",{value:!0}),nu.BrowserRandomSource=void 0;function ru(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}nu.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let e=0;e<t.length;e+=65536)this._crypto.getRandomValues(t.subarray(e,e+Math.min(t.length-e,65536)));return t}};var iu={},ou=h(Object.freeze({__proto__:null,default:{}}));Object.defineProperty(iu,"__esModule",{value:!0}),iu.NodeRandomSource=void 0;const su=Ma;iu.NodeRandomSource=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,void 0!==ru){const e=ou;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let e=0;e<n.length;e++)n[e]=t[e];return(0,su.wipe)(t),n}},Object.defineProperty(tu,"__esModule",{value:!0}),tu.SystemRandomSource=void 0;const au=nu,uu=iu;tu.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new au.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new uu.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const t=tu,n=wa,r=Ma;function i(t,n=e.defaultRandomSource){return n.randomBytes(t)}e.defaultRandomSource=new t.SystemRandomSource,e.randomBytes=i,e.randomUint32=function(t=e.defaultRandomSource){const o=i(4,t),s=(0,n.readUint32LE)(o);return(0,r.wipe)(o),s};const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function s(t,n=o,s=e.defaultRandomSource){if(n.length<2)throw new Error("randomString charset is too short");if(n.length>256)throw new Error("randomString charset is too long");let a="";const u=n.length,c=256-256%u;for(;t>0;){const e=i(Math.ceil(256*t/c),s);for(let r=0;r<e.length&&t>0;r++){const i=e[r];i<c&&(a+=n.charAt(i%u),t--)}(0,r.wipe)(e)}return a}e.randomString=s,e.randomStringForEntropy=function(t,n=o,r=e.defaultRandomSource){return s(Math.ceil(t/(Math.log(n.length)/Math.LN2)),n,r)}}(eu);!function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=wa,n=Ma;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var r=function(){function r(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return r.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=o(this._temp,this._state,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var n=this._bytesHashed,r=this._bufferLength,i=n/536870912|0,s=n<<3,a=n%64<56?64:128;this._buffer[r]=128;for(var u=r+1;u<a-8;u++)this._buffer[u]=0;t.writeUint32BE(i,this._buffer,a-8),t.writeUint32BE(s,this._buffer,a-4),o(this._temp,this._state,this._buffer,0,a),this._finished=!0}for(u=0;u<this.digestLength/4;u++)t.writeUint32BE(this._state[u],e,4*u);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){n.wipe(e.state),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();e.SHA256=r;var i=new Int32Array([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]);function o(e,n,r,o,s){for(;s>=64;){for(var a=n[0],u=n[1],c=n[2],l=n[3],f=n[4],h=n[5],d=n[6],p=n[7],g=0;g<16;g++){var y=o+4*g;e[g]=t.readUint32BE(r,y)}for(g=16;g<64;g++){var v=e[g-2],m=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10,_=((v=e[g-15])>>>7|v<<25)^(v>>>18|v<<14)^v>>>3;e[g]=(m+e[g-7]|0)+(_+e[g-16]|0)}for(g=0;g<64;g++){m=(((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&h^~f&d)|0)+(p+(i[g]+e[g]|0)|0)|0,_=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&u^a&c^u&c)|0;p=d,d=h,h=f,f=l+m|0,l=c,c=u,u=a,a=m+_|0}n[0]+=a,n[1]+=u,n[2]+=c,n[3]+=l,n[4]+=f,n[5]+=h,n[6]+=d,n[7]+=p,o+=64,s-=64}return o}e.hash=function(e){var t=new r;t.update(e);var n=t.digest();return t.clean(),n}}({});!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const t=eu,n=Ma;function r(e){const t=new Float64Array(16);if(e)for(let n=0;n<e.length;n++)t[n]=e[n];return t}e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;const i=new Uint8Array(32);i[0]=9;const o=r([56129,1]);function s(e){let t=1;for(let n=0;n<16;n++){let r=e[n]+t+65535;t=Math.floor(r/65536),e[n]=r-65536*t}e[0]+=t-1+37*(t-1)}function a(e,t,n){const r=~(n-1);for(let n=0;n<16;n++){const i=r&(e[n]^t[n]);e[n]^=i,t[n]^=i}}function u(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]+n[r]}function c(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]-n[r]}function l(e,t,n){let r,i,o=0,s=0,a=0,u=0,c=0,l=0,f=0,h=0,d=0,p=0,g=0,y=0,v=0,m=0,_=0,b=0,w=0,E=0,S=0,O=0,I=0,x=0,R=0,k=0,C=0,P=0,A=0,N=0,T=0,M=0,L=0,j=n[0],U=n[1],D=n[2],z=n[3],F=n[4],B=n[5],H=n[6],q=n[7],$=n[8],V=n[9],W=n[10],K=n[11],G=n[12],Y=n[13],Q=n[14],J=n[15];r=t[0],o+=r*j,s+=r*U,a+=r*D,u+=r*z,c+=r*F,l+=r*B,f+=r*H,h+=r*q,d+=r*$,p+=r*V,g+=r*W,y+=r*K,v+=r*G,m+=r*Y,_+=r*Q,b+=r*J,r=t[1],s+=r*j,a+=r*U,u+=r*D,c+=r*z,l+=r*F,f+=r*B,h+=r*H,d+=r*q,p+=r*$,g+=r*V,y+=r*W,v+=r*K,m+=r*G,_+=r*Y,b+=r*Q,w+=r*J,r=t[2],a+=r*j,u+=r*U,c+=r*D,l+=r*z,f+=r*F,h+=r*B,d+=r*H,p+=r*q,g+=r*$,y+=r*V,v+=r*W,m+=r*K,_+=r*G,b+=r*Y,w+=r*Q,E+=r*J,r=t[3],u+=r*j,c+=r*U,l+=r*D,f+=r*z,h+=r*F,d+=r*B,p+=r*H,g+=r*q,y+=r*$,v+=r*V,m+=r*W,_+=r*K,b+=r*G,w+=r*Y,E+=r*Q,S+=r*J,r=t[4],c+=r*j,l+=r*U,f+=r*D,h+=r*z,d+=r*F,p+=r*B,g+=r*H,y+=r*q,v+=r*$,m+=r*V,_+=r*W,b+=r*K,w+=r*G,E+=r*Y,S+=r*Q,O+=r*J,r=t[5],l+=r*j,f+=r*U,h+=r*D,d+=r*z,p+=r*F,g+=r*B,y+=r*H,v+=r*q,m+=r*$,_+=r*V,b+=r*W,w+=r*K,E+=r*G,S+=r*Y,O+=r*Q,I+=r*J,r=t[6],f+=r*j,h+=r*U,d+=r*D,p+=r*z,g+=r*F,y+=r*B,v+=r*H,m+=r*q,_+=r*$,b+=r*V,w+=r*W,E+=r*K,S+=r*G,O+=r*Y,I+=r*Q,x+=r*J,r=t[7],h+=r*j,d+=r*U,p+=r*D,g+=r*z,y+=r*F,v+=r*B,m+=r*H,_+=r*q,b+=r*$,w+=r*V,E+=r*W,S+=r*K,O+=r*G,I+=r*Y,x+=r*Q,R+=r*J,r=t[8],d+=r*j,p+=r*U,g+=r*D,y+=r*z,v+=r*F,m+=r*B,_+=r*H,b+=r*q,w+=r*$,E+=r*V,S+=r*W,O+=r*K,I+=r*G,x+=r*Y,R+=r*Q,k+=r*J,r=t[9],p+=r*j,g+=r*U,y+=r*D,v+=r*z,m+=r*F,_+=r*B,b+=r*H,w+=r*q,E+=r*$,S+=r*V,O+=r*W,I+=r*K,x+=r*G,R+=r*Y,k+=r*Q,C+=r*J,r=t[10],g+=r*j,y+=r*U,v+=r*D,m+=r*z,_+=r*F,b+=r*B,w+=r*H,E+=r*q,S+=r*$,O+=r*V,I+=r*W,x+=r*K,R+=r*G,k+=r*Y,C+=r*Q,P+=r*J,r=t[11],y+=r*j,v+=r*U,m+=r*D,_+=r*z,b+=r*F,w+=r*B,E+=r*H,S+=r*q,O+=r*$,I+=r*V,x+=r*W,R+=r*K,k+=r*G,C+=r*Y,P+=r*Q,A+=r*J,r=t[12],v+=r*j,m+=r*U,_+=r*D,b+=r*z,w+=r*F,E+=r*B,S+=r*H,O+=r*q,I+=r*$,x+=r*V,R+=r*W,k+=r*K,C+=r*G,P+=r*Y,A+=r*Q,N+=r*J,r=t[13],m+=r*j,_+=r*U,b+=r*D,w+=r*z,E+=r*F,S+=r*B,O+=r*H,I+=r*q,x+=r*$,R+=r*V,k+=r*W,C+=r*K,P+=r*G,A+=r*Y,N+=r*Q,T+=r*J,r=t[14],_+=r*j,b+=r*U,w+=r*D,E+=r*z,S+=r*F,O+=r*B,I+=r*H,x+=r*q,R+=r*$,k+=r*V,C+=r*W,P+=r*K,A+=r*G,N+=r*Y,T+=r*Q,M+=r*J,r=t[15],b+=r*j,w+=r*U,E+=r*D,S+=r*z,O+=r*F,I+=r*B,x+=r*H,R+=r*q,k+=r*$,C+=r*V,P+=r*W,A+=r*K,N+=r*G,T+=r*Y,M+=r*Q,L+=r*J,o+=38*w,s+=38*E,a+=38*S,u+=38*O,c+=38*I,l+=38*x,f+=38*R,h+=38*k,d+=38*C,p+=38*P,g+=38*A,y+=38*N,v+=38*T,m+=38*M,_+=38*L,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=h,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=v,e[13]=m,e[14]=_,e[15]=b}function f(e,t){l(e,t,t)}function h(e,t){const n=new Uint8Array(32),i=new Float64Array(80),h=r(),d=r(),p=r(),g=r(),y=r(),v=r();for(let t=0;t<31;t++)n[t]=e[t];n[31]=127&e[31]|64,n[0]&=248,function(e,t){for(let n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}(i,t);for(let e=0;e<16;e++)d[e]=i[e];h[0]=g[0]=1;for(let e=254;e>=0;--e){const t=n[e>>>3]>>>(7&e)&1;a(h,d,t),a(p,g,t),u(y,h,p),c(h,h,p),u(p,d,g),c(d,d,g),f(g,y),f(v,h),l(h,p,h),l(p,d,y),u(y,h,p),c(h,h,p),f(d,h),c(p,g,v),l(h,p,o),u(h,h,g),l(p,p,h),l(h,g,v),l(g,d,i),f(d,y),a(h,d,t),a(p,g,t)}for(let e=0;e<16;e++)i[e+16]=h[e],i[e+32]=p[e],i[e+48]=d[e],i[e+64]=g[e];const m=i.subarray(32),_=i.subarray(16);!function(e,t){const n=r();for(let e=0;e<16;e++)n[e]=t[e];for(let e=253;e>=0;e--)f(n,n),2!==e&&4!==e&&l(n,n,t);for(let t=0;t<16;t++)e[t]=n[t]}(m,m),l(_,_,m);const b=new Uint8Array(32);return function(e,t){const n=r(),i=r();for(let e=0;e<16;e++)i[e]=t[e];s(i),s(i),s(i);for(let e=0;e<2;e++){n[0]=i[0]-65517;for(let e=1;e<15;e++)n[e]=i[e]-65535-(n[e-1]>>16&1),n[e-1]&=65535;n[15]=i[15]-32767-(n[14]>>16&1);const e=n[15]>>16&1;n[14]&=65535,a(i,n,1-e)}for(let t=0;t<16;t++)e[2*t]=255&i[t],e[2*t+1]=i[t]>>8}(b,_),b}function d(e){return h(e,i)}function p(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const n=new Uint8Array(t);return{publicKey:d(n),secretKey:n}}e.scalarMult=h,e.scalarMultBase=d,e.generateKeyPairFromSeed=p,e.generateKeyPair=function(e){const r=(0,t.randomBytes)(32,e),i=p(r);return(0,n.wipe)(r),i},e.sharedKey=function(t,n,r=!1){if(t.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(n.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const i=h(t,n);if(r){let e=0;for(let t=0;t<i.length;t++)e|=i[t];if(0===e)throw new Error("X25519: invalid shared key")}return i}}({});var cu=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var r=0,i=0;e[t]===u;)r++,t++;for(var o=(e.length-t)*c+1>>>0,s=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var f=0,h=o-1;(0!==l||f<i)&&-1!==h;h--,f++)l+=a*s[h]>>>0,s[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=o-i;d!==o&&0===s[d];)d++;for(var p=new Uint8Array(r+(o-d)),g=r;d!==o;)p[g++]=s[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*l+1>>>0,c=new Uint8Array(s);i!==o;){for(var f=t[i],h=0,d=s-1;(0!==f||h<r)&&-1!==d;d--,h++)f+=256*c[d]>>>0,c[d]=f%a>>>0,f=f/a>>>0;if(0!==f)throw new Error("Non-zero carry");r=h,i++}for(var p=s-r;p!==s&&0===c[p];)p++;for(var g=u.repeat(n);p<s;++p)g+=e.charAt(c[p]);return g},decodeUnsafe:f,decode:function(e){var n=f(e);if(n)return n;throw new Error(`Non-${t} character`)}}},lu=cu;const fu=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};class hu{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class du{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return gu(this,e)}}class pu{constructor(e){this.decoders=e}or(e){return gu(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const gu=(e,t)=>new pu({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class yu{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new hu(e,t,n),this.decoder=new du(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const vu=({name:e,prefix:t,encode:n,decode:r})=>new yu(e,t,n,r),mu=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=lu(n,t);return vu({prefix:e,name:t,encode:r,decode:e=>fu(i(e))})},_u=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>vu({prefix:t,name:e,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let r=0;r<e.length;++r)for(a=a<<8|e[r],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o})(e,r,n),decode:t=>((e,t,n,r)=>{const i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*n/8|0);let a=0,u=0,c=0;for(let t=0;t<o;++t){const o=i[e[t]];if(void 0===o)throw new SyntaxError(`Non-${r} character`);u=u<<n|o,a+=n,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=n||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s})(t,r,n,e)});vu({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)});_u({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});_u({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});mu({prefix:"9",name:"base10",alphabet:"0123456789"});_u({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_u({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});_u({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),_u({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),_u({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),_u({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),_u({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_u({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),_u({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_u({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_u({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});mu({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),mu({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});mu({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mu({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});_u({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_u({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_u({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_u({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});const bu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),wu=bu.reduce(((e,t,n)=>(e[n]=t,e)),[]),Eu=bu.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);vu({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=wu[t]),"")},decode:function(e){const t=[];for(const n of e){const e=Eu[n.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}});var Su=function e(t,n,r){n=n||[];var i=r=r||0;for(;t>=xu;)n[r++]=255&t|Ou,t/=128;for(;t&Iu;)n[r++]=255&t|Ou,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Ou=128,Iu=-128,xu=Math.pow(2,31);var Ru=function e(t,n){var r,i=0,o=0,s=n=n||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(r&Cu)<<o:(r&Cu)*Math.pow(2,o),o+=7}while(r>=ku);return e.bytes=s-n,i},ku=128,Cu=127;var Pu=Math.pow(2,7),Au=Math.pow(2,14),Nu=Math.pow(2,21),Tu=Math.pow(2,28),Mu=Math.pow(2,35),Lu=Math.pow(2,42),ju=Math.pow(2,49),Uu=Math.pow(2,56),Du=Math.pow(2,63),zu={encode:Su,decode:Ru,encodingLength:function(e){return e<Pu?1:e<Au?2:e<Nu?3:e<Tu?4:e<Mu?5:e<Lu?6:e<ju?7:e<Uu?8:e<Du?9:10}};const Fu=(e,t,n=0)=>(zu.encode(e,t,n),t),Bu=e=>zu.encodingLength(e),Hu=(e,t)=>{const n=t.byteLength,r=Bu(e),i=r+Bu(n),o=new Uint8Array(i+n);return Fu(e,o,0),Fu(n,o,r),o.set(t,i),new qu(e,n,t,o)};class qu{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const $u=({name:e,code:t,encode:n})=>new Vu(e,t,n);class Vu{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Hu(this.code,t):t.then((e=>Hu(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Wu=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));$u({name:"sha2-256",code:18,encode:Wu("SHA-256")}),$u({name:"sha2-512",code:19,encode:Wu("SHA-512")});new TextEncoder,new TextDecoder;var Ku=function(e,t){return Ku=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},Ku(e,t)};
237
237
  /*! *****************************************************************************
238
238
  Copyright (c) Microsoft Corporation.
239
239
 
@@ -275,7 +275,7 @@ PERFORMANCE OF THIS SOFTWARE.
275
275
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
276
276
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
277
277
  PERFORMANCE OF THIS SOFTWARE.
278
- ***************************************************************************** */function Xe(e,t){function n(){this.constructor=e}Je(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ze=function(){return Ze=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ze.apply(this,arguments)};function et(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function tt(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function nt(e,t){return function(n,r){t(n,r,e)}}function rt(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function it(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function ot(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return u([e,t])}}function u(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function st(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function at(e,t){for(var n in e)"default"!==n&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function ut(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ct(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function lt(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ct(arguments[t]));return e}function ft(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function ht(e){return this instanceof ht?(this.v=e,this):new ht(e)}function dt(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{u(i[e](t))}catch(e){f(o[0][3],e)}}function u(e){e.value instanceof ht?Promise.resolve(e.value.v).then(c,l):f(o[0][2],e)}function c(e){a("next",e)}function l(e){a("throw",e)}function f(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function pt(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:ht(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function gt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof ut?ut(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){i(r,o,(t=e[n](t)).done,t.value)}))}}function i(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}}function yt(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function vt(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function mt(e){return e&&e.__esModule?e:{default:e}}function _t(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function bt(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}var wt,Et=r(Object.freeze({__proto__:null,__extends:Xe,get __assign(){return Ze},__rest:et,__decorate:tt,__param:nt,__metadata:rt,__awaiter:it,__generator:ot,__createBinding:st,__exportStar:at,__values:ut,__read:ct,__spread:lt,__spreadArrays:ft,__await:ht,__asyncGenerator:dt,__asyncDelegator:pt,__asyncValues:gt,__makeTemplateObject:yt,__importStar:vt,__importDefault:mt,__classPrivateFieldGet:_t,__classPrivateFieldSet:bt})),St={},Ot={};function It(){if(wt)return Ot;function e(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}return wt=1,Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.delay=void 0,Ot.delay=e,Ot}var xt,Rt={},kt={},Ct={};function Pt(){return xt||(xt=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.ONE_THOUSAND=Ct.ONE_HUNDRED=void 0,Ct.ONE_HUNDRED=100,Ct.ONE_THOUSAND=1e3),Ct}var At,Nt,Tt,Mt,Lt={};function jt(){return At||(At=1,e=Lt,Object.defineProperty(e,"__esModule",{value:!0}),e.ONE_YEAR=e.FOUR_WEEKS=e.THREE_WEEKS=e.TWO_WEEKS=e.ONE_WEEK=e.THIRTY_DAYS=e.SEVEN_DAYS=e.FIVE_DAYS=e.THREE_DAYS=e.ONE_DAY=e.TWENTY_FOUR_HOURS=e.TWELVE_HOURS=e.SIX_HOURS=e.THREE_HOURS=e.ONE_HOUR=e.SIXTY_MINUTES=e.THIRTY_MINUTES=e.TEN_MINUTES=e.FIVE_MINUTES=e.ONE_MINUTE=e.SIXTY_SECONDS=e.THIRTY_SECONDS=e.TEN_SECONDS=e.FIVE_SECONDS=e.ONE_SECOND=void 0,e.ONE_SECOND=1,e.FIVE_SECONDS=5,e.TEN_SECONDS=10,e.THIRTY_SECONDS=30,e.SIXTY_SECONDS=60,e.ONE_MINUTE=e.SIXTY_SECONDS,e.FIVE_MINUTES=5*e.ONE_MINUTE,e.TEN_MINUTES=10*e.ONE_MINUTE,e.THIRTY_MINUTES=30*e.ONE_MINUTE,e.SIXTY_MINUTES=60*e.ONE_MINUTE,e.ONE_HOUR=e.SIXTY_MINUTES,e.THREE_HOURS=3*e.ONE_HOUR,e.SIX_HOURS=6*e.ONE_HOUR,e.TWELVE_HOURS=12*e.ONE_HOUR,e.TWENTY_FOUR_HOURS=24*e.ONE_HOUR,e.ONE_DAY=e.TWENTY_FOUR_HOURS,e.THREE_DAYS=3*e.ONE_DAY,e.FIVE_DAYS=5*e.ONE_DAY,e.SEVEN_DAYS=7*e.ONE_DAY,e.THIRTY_DAYS=30*e.ONE_DAY,e.ONE_WEEK=e.SEVEN_DAYS,e.TWO_WEEKS=2*e.ONE_WEEK,e.THREE_WEEKS=3*e.ONE_WEEK,e.FOUR_WEEKS=4*e.ONE_WEEK,e.ONE_YEAR=365*e.ONE_DAY),Lt;var e}function Ut(){return Nt||(Nt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Et;t.__exportStar(Pt(),e),t.__exportStar(jt(),e)}(kt)),kt}function Dt(){if(Tt)return Rt;Tt=1,Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.fromMiliseconds=Rt.toMiliseconds=void 0;const e=Ut();function t(t){return t*e.ONE_THOUSAND}function n(t){return Math.floor(t/e.ONE_THOUSAND)}return Rt.toMiliseconds=t,Rt.fromMiliseconds=n,Rt}function zt(){return Mt||(Mt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Et;t.__exportStar(It(),e),t.__exportStar(Dt(),e)}(St)),St}var Ft,Bt={};function Ht(){if(Ft)return Bt;Ft=1,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.Watch=void 0;class e{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const t=this.get(e);if(typeof t.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);const n=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:n})}get(e){const t=this.timestamps.get(e);if(typeof t>"u")throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}return Bt.Watch=e,Bt.default=e,Bt}var qt,$t,Vt={},Wt={};function Kt(){if(qt)return Wt;qt=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.IWatch=void 0;class e{}return Wt.IWatch=e,Wt}function Gt(){return $t||($t=1,e=Vt,Object.defineProperty(e,"__esModule",{value:!0}),Et.__exportStar(Kt(),e)),Vt;var e}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Et;t.__exportStar(zt(),e),t.__exportStar(Ht(),e),t.__exportStar(Gt(),e),t.__exportStar(Ut(),e)}(Qe);var Yt={},Qt={};class Jt{}var Xt,Zt,en=r(Object.freeze({__proto__:null,IEvents:Jt}));function tn(){if(Xt)return Qt;Xt=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.IHeartBeat=void 0;const e=en;class t extends e.IEvents{constructor(e){super()}}return Qt.IHeartBeat=t,Qt}function nn(){return Zt||(Zt=1,e=Yt,Object.defineProperty(e,"__esModule",{value:!0}),Ge.__exportStar(tn(),e)),Yt;var e}var rn,on,sn,an={},un={};function cn(){if(rn)return un;rn=1,Object.defineProperty(un,"__esModule",{value:!0}),un.HEARTBEAT_EVENTS=un.HEARTBEAT_INTERVAL=void 0;const e=Qe;return un.HEARTBEAT_INTERVAL=e.FIVE_SECONDS,un.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},un}function ln(){return on||(on=1,e=an,Object.defineProperty(e,"__esModule",{value:!0}),Ge.__exportStar(cn(),e)),an;var e}function fn(){if(sn)return Ye;sn=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.HeartBeat=void 0;const e=Ge,t=o.exports,n=Qe,r=nn(),i=ln();class s extends r.IHeartBeat{constructor(e){super(e),this.events=new t.EventEmitter,this.interval=i.HEARTBEAT_INTERVAL,this.interval=e?.interval||i.HEARTBEAT_INTERVAL}static init(t){return e.__awaiter(this,void 0,void 0,(function*(){const e=new s(t);return yield e.init(),e}))}init(){return e.__awaiter(this,void 0,void 0,(function*(){yield this.initialize()}))}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}initialize(){return e.__awaiter(this,void 0,void 0,(function*(){this.intervalRef=setInterval((()=>this.pulse()),n.toMiliseconds(this.interval))}))}pulse(){this.events.emit(i.HEARTBEAT_EVENTS.pulse)}}return Ye.HeartBeat=s,Ye}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Ge;t.__exportStar(fn(),e),t.__exportStar(nn(),e),t.__exportStar(ln(),e)}(Se);var hn={},dn=function(e,t){return dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},dn(e,t)};
278
+ ***************************************************************************** */function Xe(e,t){function n(){this.constructor=e}Je(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ze=function(){return Ze=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ze.apply(this,arguments)};function et(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function tt(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function nt(e,t){return function(n,r){t(n,r,e)}}function rt(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function it(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function ot(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return u([e,t])}}function u(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function st(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function at(e,t){for(var n in e)"default"!==n&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function ut(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ct(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function lt(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ct(arguments[t]));return e}function ft(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function ht(e){return this instanceof ht?(this.v=e,this):new ht(e)}function dt(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{u(i[e](t))}catch(e){f(o[0][3],e)}}function u(e){e.value instanceof ht?Promise.resolve(e.value.v).then(c,l):f(o[0][2],e)}function c(e){a("next",e)}function l(e){a("throw",e)}function f(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function pt(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:ht(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function gt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof ut?ut(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){i(r,o,(t=e[n](t)).done,t.value)}))}}function i(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}}function yt(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function vt(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function mt(e){return e&&e.__esModule?e:{default:e}}function _t(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function bt(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}var wt,Et=r(Object.freeze({__proto__:null,__extends:Xe,get __assign(){return Ze},__rest:et,__decorate:tt,__param:nt,__metadata:rt,__awaiter:it,__generator:ot,__createBinding:st,__exportStar:at,__values:ut,__read:ct,__spread:lt,__spreadArrays:ft,__await:ht,__asyncGenerator:dt,__asyncDelegator:pt,__asyncValues:gt,__makeTemplateObject:yt,__importStar:vt,__importDefault:mt,__classPrivateFieldGet:_t,__classPrivateFieldSet:bt})),St={},Ot={};function It(){if(wt)return Ot;function e(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}return wt=1,Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.delay=void 0,Ot.delay=e,Ot}var xt,Rt={},kt={},Ct={};function Pt(){return xt||(xt=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.ONE_THOUSAND=Ct.ONE_HUNDRED=void 0,Ct.ONE_HUNDRED=100,Ct.ONE_THOUSAND=1e3),Ct}var At,Nt,Tt,Mt,Lt={};function jt(){return At||(At=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ONE_YEAR=e.FOUR_WEEKS=e.THREE_WEEKS=e.TWO_WEEKS=e.ONE_WEEK=e.THIRTY_DAYS=e.SEVEN_DAYS=e.FIVE_DAYS=e.THREE_DAYS=e.ONE_DAY=e.TWENTY_FOUR_HOURS=e.TWELVE_HOURS=e.SIX_HOURS=e.THREE_HOURS=e.ONE_HOUR=e.SIXTY_MINUTES=e.THIRTY_MINUTES=e.TEN_MINUTES=e.FIVE_MINUTES=e.ONE_MINUTE=e.SIXTY_SECONDS=e.THIRTY_SECONDS=e.TEN_SECONDS=e.FIVE_SECONDS=e.ONE_SECOND=void 0,e.ONE_SECOND=1,e.FIVE_SECONDS=5,e.TEN_SECONDS=10,e.THIRTY_SECONDS=30,e.SIXTY_SECONDS=60,e.ONE_MINUTE=e.SIXTY_SECONDS,e.FIVE_MINUTES=5*e.ONE_MINUTE,e.TEN_MINUTES=10*e.ONE_MINUTE,e.THIRTY_MINUTES=30*e.ONE_MINUTE,e.SIXTY_MINUTES=60*e.ONE_MINUTE,e.ONE_HOUR=e.SIXTY_MINUTES,e.THREE_HOURS=3*e.ONE_HOUR,e.SIX_HOURS=6*e.ONE_HOUR,e.TWELVE_HOURS=12*e.ONE_HOUR,e.TWENTY_FOUR_HOURS=24*e.ONE_HOUR,e.ONE_DAY=e.TWENTY_FOUR_HOURS,e.THREE_DAYS=3*e.ONE_DAY,e.FIVE_DAYS=5*e.ONE_DAY,e.SEVEN_DAYS=7*e.ONE_DAY,e.THIRTY_DAYS=30*e.ONE_DAY,e.ONE_WEEK=e.SEVEN_DAYS,e.TWO_WEEKS=2*e.ONE_WEEK,e.THREE_WEEKS=3*e.ONE_WEEK,e.FOUR_WEEKS=4*e.ONE_WEEK,e.ONE_YEAR=365*e.ONE_DAY}(Lt)),Lt}function Ut(){return Nt||(Nt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Et;t.__exportStar(Pt(),e),t.__exportStar(jt(),e)}(kt)),kt}function Dt(){if(Tt)return Rt;Tt=1,Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.fromMiliseconds=Rt.toMiliseconds=void 0;const e=Ut();function t(t){return t*e.ONE_THOUSAND}function n(t){return Math.floor(t/e.ONE_THOUSAND)}return Rt.toMiliseconds=t,Rt.fromMiliseconds=n,Rt}function zt(){return Mt||(Mt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Et;t.__exportStar(It(),e),t.__exportStar(Dt(),e)}(St)),St}var Ft,Bt={};function Ht(){if(Ft)return Bt;Ft=1,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.Watch=void 0;class e{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const t=this.get(e);if(typeof t.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);const n=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:n})}get(e){const t=this.timestamps.get(e);if(typeof t>"u")throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}return Bt.Watch=e,Bt.default=e,Bt}var qt,$t,Vt={},Wt={};function Kt(){if(qt)return Wt;qt=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.IWatch=void 0;class e{}return Wt.IWatch=e,Wt}function Gt(){return $t||($t=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Et.__exportStar(Kt(),e)}(Vt)),Vt}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Et;t.__exportStar(zt(),e),t.__exportStar(Ht(),e),t.__exportStar(Gt(),e),t.__exportStar(Ut(),e)}(Qe);var Yt={},Qt={};class Jt{}var Xt,Zt,en=r(Object.freeze({__proto__:null,IEvents:Jt}));function tn(){if(Xt)return Qt;Xt=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.IHeartBeat=void 0;const e=en;class t extends e.IEvents{constructor(e){super()}}return Qt.IHeartBeat=t,Qt}function nn(){return Zt||(Zt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Ge.__exportStar(tn(),e)}(Yt)),Yt}var rn,on,sn,an={},un={};function cn(){if(rn)return un;rn=1,Object.defineProperty(un,"__esModule",{value:!0}),un.HEARTBEAT_EVENTS=un.HEARTBEAT_INTERVAL=void 0;const e=Qe;return un.HEARTBEAT_INTERVAL=e.FIVE_SECONDS,un.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},un}function ln(){return on||(on=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Ge.__exportStar(cn(),e)}(an)),an}function fn(){if(sn)return Ye;sn=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.HeartBeat=void 0;const e=Ge,t=o.exports,n=Qe,r=nn(),i=ln();class s extends r.IHeartBeat{constructor(e){super(e),this.events=new t.EventEmitter,this.interval=i.HEARTBEAT_INTERVAL,this.interval=e?.interval||i.HEARTBEAT_INTERVAL}static init(t){return e.__awaiter(this,void 0,void 0,(function*(){const e=new s(t);return yield e.init(),e}))}init(){return e.__awaiter(this,void 0,void 0,(function*(){yield this.initialize()}))}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}initialize(){return e.__awaiter(this,void 0,void 0,(function*(){this.intervalRef=setInterval((()=>this.pulse()),n.toMiliseconds(this.interval))}))}pulse(){this.events.emit(i.HEARTBEAT_EVENTS.pulse)}}return Ye.HeartBeat=s,Ye}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Ge;t.__exportStar(fn(),e),t.__exportStar(nn(),e),t.__exportStar(ln(),e)}(Se);var hn={},dn=function(e,t){return dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},dn(e,t)};
279
279
  /*! *****************************************************************************
280
280
  Copyright (c) Microsoft Corporation.
281
281
 
@@ -289,7 +289,7 @@ PERFORMANCE OF THIS SOFTWARE.
289
289
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
290
290
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
291
291
  PERFORMANCE OF THIS SOFTWARE.
292
- ***************************************************************************** */function pn(e,t){function n(){this.constructor=e}dn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var gn=function(){return gn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},gn.apply(this,arguments)};function yn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function vn(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function mn(e,t){return function(n,r){t(n,r,e)}}function _n(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function bn(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function wn(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return u([e,t])}}function u(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function En(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function Sn(e,t){for(var n in e)"default"!==n&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function On(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function In(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function xn(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(In(arguments[t]));return e}function Rn(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function kn(e){return this instanceof kn?(this.v=e,this):new kn(e)}function Cn(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{u(i[e](t))}catch(e){f(o[0][3],e)}}function u(e){e.value instanceof kn?Promise.resolve(e.value.v).then(c,l):f(o[0][2],e)}function c(e){a("next",e)}function l(e){a("throw",e)}function f(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Pn(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:kn(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function An(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof On?On(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){i(r,o,(t=e[n](t)).done,t.value)}))}}function i(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}}function Nn(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Tn(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Mn(e){return e&&e.__esModule?e:{default:e}}function Ln(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function jn(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}var Un,Dn,zn,Fn,Bn=r(Object.freeze({__proto__:null,__extends:pn,get __assign(){return gn},__rest:yn,__decorate:vn,__param:mn,__metadata:_n,__awaiter:bn,__generator:wn,__createBinding:En,__exportStar:Sn,__values:On,__read:In,__spread:xn,__spreadArrays:Rn,__await:kn,__asyncGenerator:Cn,__asyncDelegator:Pn,__asyncValues:An,__makeTemplateObject:Nn,__importStar:Tn,__importDefault:Mn,__classPrivateFieldGet:Ln,__classPrivateFieldSet:jn}));function Hn(){if(Dn)return Un;function e(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}function t(t,n,r){var i=r&&r.stringify||e,o=1;if("object"==typeof t&&null!==t){var s=n.length+o;if(1===s)return t;var a=new Array(s);a[0]=i(t);for(var u=1;u<s;u++)a[u]=i(n[u]);return a.join(" ")}if("string"!=typeof t)return t;var c=n.length;if(0===c)return t;for(var l="",f=1-o,h=-1,d=t&&t.length||0,p=0;p<d;){if(37===t.charCodeAt(p)&&p+1<d){switch(h=h>-1?h:0,t.charCodeAt(p+1)){case 100:case 102:if(f>=c||null==n[f])break;h<p&&(l+=t.slice(h,p)),l+=Number(n[f]),h=p+2,p++;break;case 105:if(f>=c||null==n[f])break;h<p&&(l+=t.slice(h,p)),l+=Math.floor(Number(n[f])),h=p+2,p++;break;case 79:case 111:case 106:if(f>=c||void 0===n[f])break;h<p&&(l+=t.slice(h,p));var g=typeof n[f];if("string"===g){l+="'"+n[f]+"'",h=p+2,p++;break}if("function"===g){l+=n[f].name||"<anonymous>",h=p+2,p++;break}l+=i(n[f]),h=p+2,p++;break;case 115:if(f>=c)break;h<p&&(l+=t.slice(h,p)),l+=String(n[f]),h=p+2,p++;break;case 37:h<p&&(l+=t.slice(h,p)),l+="%",h=p+2,p++,f--}++f}++p}return-1===h?t:(h<d&&(l+=t.slice(h)),l)}return Dn=1,Un=t}function qn(){if(Fn)return zn;Fn=1;const e=Hn();zn=i;const t=w().console||{},n={mapHttpRequest:p,mapHttpResponse:p,wrapRequestSerializer:g,wrapResponseSerializer:g,wrapErrorSerializer:g,req:p,res:p,err:h};function r(e,t){return Array.isArray(e)?e.filter((function(e){return"!stdSerializers.err"!==e})):!0===e&&Object.keys(t)}function i(e){(e=e||{}).browser=e.browser||{};const n=e.browser.transmit;if(n&&"function"!=typeof n.send)throw Error("pino: transmit option must have a send function");const s=e.browser.write||t;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},l=r(e.browser.serialize,a);let h=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(h=!1);const p=["error","fatal","warn","info","debug","trace"];"function"==typeof s&&(s.error=s.fatal=s.warn=s.info=s.debug=s.trace=s),!1===e.enabled&&(e.level="silent");const g=e.level||"info",v=Object.create(s);v.log||(v.log=y),Object.defineProperty(v,"levelVal",{get:_}),Object.defineProperty(v,"level",{get:b,set:w});const m={transmit:n,serialize:l,asObject:e.browser.asObject,levels:p,timestamp:d(e)};function _(){return"silent"===this.level?1/0:this.levels.values[this.level]}function b(){return this._level}function w(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,o(m,v,"error","log"),o(m,v,"fatal","error"),o(m,v,"warn","error"),o(m,v,"info","log"),o(m,v,"debug","log"),o(m,v,"trace","log")}function E(t,r){if(!t)throw new Error("missing bindings for child Pino");r=r||{},l&&t.serializers&&(r.serializers=t.serializers);const i=r.serializers;if(l&&i){var o=Object.assign({},a,i),s=!0===e.browser.serialize?Object.keys(o):l;delete t.serializers,u([t],s,o,this._stdErrSerialize)}function h(e){this._childLevel=1+(0|e._childLevel),this.error=c(e,t,"error"),this.fatal=c(e,t,"fatal"),this.warn=c(e,t,"warn"),this.info=c(e,t,"info"),this.debug=c(e,t,"debug"),this.trace=c(e,t,"trace"),o&&(this.serializers=o,this._serialize=s),n&&(this._logEvent=f([].concat(e._logEvent.bindings,t)))}return h.prototype=this,new h(this)}return v.levels=i.levels,v.level=g,v.setMaxListeners=v.getMaxListeners=v.emit=v.addListener=v.on=v.prependListener=v.once=v.prependOnceListener=v.removeListener=v.removeAllListeners=v.listeners=v.listenerCount=v.eventNames=v.write=v.flush=y,v.serializers=a,v._serialize=l,v._stdErrSerialize=h,v.child=E,n&&(v._logEvent=f()),v}function o(e,n,r,i){const o=Object.getPrototypeOf(n);n[r]=n.levelVal>n.levels.values[r]?y:o[r]?o[r]:t[r]||t[i]||y,s(e,n,r)}function s(e,n,r){!e.transmit&&n[r]===y||(n[r]=function(o){return function(){const s=e.timestamp(),c=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var h=0;h<c.length;h++)c[h]=arguments[h];if(e.serialize&&!e.asObject&&u(c,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?o.call(f,a(this,r,c,s)):o.apply(f,c),e.transmit){const t=e.transmit.level||n.level,o=i.levels.values[t],a=i.levels.values[r];if(a<o)return;l(this,{ts:s,methodLevel:r,methodValue:a,transmitLevel:t,transmitValue:i.levels.values[e.transmit.level||n.level],send:e.transmit.send,val:n.levelVal},c)}}}(n[r]))}function a(t,n,r,o){t._serialize&&u(r,t._serialize,t.serializers,t._stdErrSerialize);const s=r.slice();let a=s[0];const c={};o&&(c.time=o),c.level=i.levels.values[n];let l=1+(0|t._childLevel);if(l<1&&(l=1),null!==a&&"object"==typeof a){for(;l--&&"object"==typeof s[0];)Object.assign(c,s.shift());a=s.length?e(s.shift(),s):void 0}else"string"==typeof a&&(a=e(s.shift(),s));return void 0!==a&&(c.msg=a),c}function u(e,t,n,r){for(const o in e)if(r&&e[o]instanceof Error)e[o]=i.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o]))for(const r in e[o])t&&t.indexOf(r)>-1&&r in n&&(e[o][r]=n[r](e[o][r]))}function c(e,t,n){return function(){const r=new Array(1+arguments.length);r[0]=t;for(var i=1;i<r.length;i++)r[i]=arguments[i-1];return e[n].apply(this,r)}}function l(e,t,n){const r=t.send,i=t.ts,o=t.methodLevel,s=t.methodValue,a=t.val,c=e._logEvent.bindings;u(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=o,e._logEvent.level.value=s,r(o,e._logEvent,a),e._logEvent=f(c)}function f(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function h(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function d(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?v:m}function p(){return{}}function g(e){return e}function y(){}function v(){return!1}function m(){return Date.now()}function _(){return Math.round(Date.now()/1e3)}function b(){return new Date(Date.now()).toISOString()}function w(){function e(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}return i.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},i.stdSerializers=n,i.stdTimeFunctions=Object.assign({},{nullTime:v,epochTime:m,unixTime:_,isoTime:b}),zn}var $n,Vn={};function Wn(){return $n||($n=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.PINO_CUSTOM_CONTEXT_KEY=Vn.PINO_LOGGER_DEFAULTS=void 0,Vn.PINO_LOGGER_DEFAULTS={level:"info"},Vn.PINO_CUSTOM_CONTEXT_KEY="custom_context"),Vn}var Kn,Gn={};function Yn(){if(Kn)return Gn;Kn=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.generateChildLogger=Gn.formatChildLoggerContext=Gn.getLoggerContext=Gn.setBrowserLoggerContext=Gn.getBrowserLoggerContext=Gn.getDefaultLoggerOptions=void 0;const e=Wn();function t(t){return Object.assign(Object.assign({},t),{level:t?.level||e.PINO_LOGGER_DEFAULTS.level})}function n(t,n=e.PINO_CUSTOM_CONTEXT_KEY){return t[n]||""}function r(t,n,r=e.PINO_CUSTOM_CONTEXT_KEY){return t[r]=n,t}function i(t,r=e.PINO_CUSTOM_CONTEXT_KEY){let i="";return i=typeof t.bindings>"u"?n(t,r):t.bindings().context||"",i}function o(t,n,r=e.PINO_CUSTOM_CONTEXT_KEY){const o=i(t,r);return o.trim()?`${o}/${n}`:n}function s(t,n,i=e.PINO_CUSTOM_CONTEXT_KEY){const s=o(t,n,i);return r(t.child({context:s}),s,i)}return Gn.getDefaultLoggerOptions=t,Gn.getBrowserLoggerContext=n,Gn.setBrowserLoggerContext=r,Gn.getLoggerContext=i,Gn.formatChildLoggerContext=o,Gn.generateChildLogger=s,Gn}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pino=void 0;const t=Bn,n=t.__importDefault(qn());Object.defineProperty(e,"pino",{enumerable:!0,get:function(){return n.default}}),t.__exportStar(Wn(),e),t.__exportStar(Yn(),e)}(hn);class Qn extends Jt{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Jn extends Jt{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class Xn{constructor(e,t){this.logger=e,this.core=t}}class Zn extends Jt{constructor(e,t){super(),this.relayer=e,this.logger=t}}class er extends Jt{constructor(e){super()}}class tr{constructor(e,t,n,r){this.core=e,this.logger=t,this.name=n}}class nr extends Jt{constructor(e,t){super(),this.relayer=e,this.logger=t}}class rr extends Jt{constructor(e,t){super(),this.core=e,this.logger=t}}class ir{constructor(e,t){this.projectId=e,this.logger=t}}class or{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class sr{constructor(e){this.client=e}}var ar={},ur={},cr={},lr={};Object.defineProperty(lr,"__esModule",{value:!0}),lr.BrowserRandomSource=void 0;const fr=65536;class hr{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let e=0;e<t.length;e+=fr)this._crypto.getRandomValues(t.subarray(e,e+Math.min(t.length-e,fr)));return t}}function dr(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}lr.BrowserRandomSource=hr;var pr={},gr={};function yr(e){for(var t=0;t<e.length;t++)e[t]=0;return e}Object.defineProperty(gr,"__esModule",{value:!0}),gr.wipe=yr;var vr={},mr=r(Object.freeze({__proto__:null,default:vr}));Object.defineProperty(pr,"__esModule",{value:!0}),pr.NodeRandomSource=void 0;const _r=gr;class br{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof dr<"u"){const e=mr;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let e=0;e<n.length;e++)n[e]=t[e];return(0,_r.wipe)(t),n}}pr.NodeRandomSource=br,Object.defineProperty(cr,"__esModule",{value:!0}),cr.SystemRandomSource=void 0;const wr=lr,Er=pr;class Sr{constructor(){return this.isAvailable=!1,this.name="",this._source=new wr.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new Er.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}cr.SystemRandomSource=Sr;var Or={},Ir={};(function(e){function t(e,t){var n=65535&e,r=65535&t;return n*r+((e>>>16&65535)*r+n*(t>>>16&65535)<<16>>>0)|0}function n(e,t){return e+t|0}function r(e,t){return e-t|0}function i(e,t){return e<<t|e>>>32-t}function o(e,t){return e<<32-t|e>>>t}function s(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||t,e.add=n,e.sub=r,e.rotl=i,e.rotr=o,e.isInteger=Number.isInteger||s,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}})(Ir),Object.defineProperty(Or,"__esModule",{value:!0});var xr=Ir;function Rr(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16}function kr(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0}function Cr(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16}function Pr(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0}function Ar(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>8,t[n+1]=e>>>0,t}function Nr(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t}function Tr(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Mr(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function Lr(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function jr(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function Ur(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>24,t[n+1]=e>>>16,t[n+2]=e>>>8,t[n+3]=e>>>0,t}function Dr(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24,t}function zr(e,t){void 0===t&&(t=0);var n=Tr(e,t),r=Tr(e,t+4);return 4294967296*n+r-4294967296*(r>>31)}function Fr(e,t){return void 0===t&&(t=0),4294967296*Mr(e,t)+Mr(e,t+4)}function Br(e,t){void 0===t&&(t=0);var n=Lr(e,t);return 4294967296*Lr(e,t+4)+n-4294967296*(n>>31)}function Hr(e,t){void 0===t&&(t=0);var n=jr(e,t);return 4294967296*jr(e,t+4)+n}function qr(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),Ur(e/4294967296>>>0,t,n),Ur(e>>>0,t,n+4),t}function $r(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),Dr(e>>>0,t,n),Dr(e/4294967296>>>0,t,n+4),t}function Vr(e,t,n){if(void 0===n&&(n=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var r=0,i=1,o=e/8+n-1;o>=n;o--)r+=t[o]*i,i*=256;return r}function Wr(e,t,n){if(void 0===n&&(n=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var r=0,i=1,o=n;o<n+e/8;o++)r+=t[o]*i,i*=256;return r}function Kr(e,t,n,r){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===r&&(r=0),e%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!xr.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var i=1,o=e/8+r-1;o>=r;o--)n[o]=t/i&255,i*=256;return n}function Gr(e,t,n,r){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===r&&(r=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!xr.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var i=1,o=r;o<r+e/8;o++)n[o]=t/i&255,i*=256;return n}function Yr(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)}function Qr(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)}function Jr(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)}function Xr(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)}function Zr(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(n,e),t}function ei(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(n,e,!0),t}function ti(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(n,e),t}function ni(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(n,e,!0),t}Or.readInt16BE=Rr,Or.readUint16BE=kr,Or.readInt16LE=Cr,Or.readUint16LE=Pr,Or.writeUint16BE=Ar,Or.writeInt16BE=Ar,Or.writeUint16LE=Nr,Or.writeInt16LE=Nr,Or.readInt32BE=Tr,Or.readUint32BE=Mr,Or.readInt32LE=Lr,Or.readUint32LE=jr,Or.writeUint32BE=Ur,Or.writeInt32BE=Ur,Or.writeUint32LE=Dr,Or.writeInt32LE=Dr,Or.readInt64BE=zr,Or.readUint64BE=Fr,Or.readInt64LE=Br,Or.readUint64LE=Hr,Or.writeUint64BE=qr,Or.writeInt64BE=qr,Or.writeUint64LE=$r,Or.writeInt64LE=$r,Or.readUintBE=Vr,Or.readUintLE=Wr,Or.writeUintBE=Kr,Or.writeUintLE=Gr,Or.readFloat32BE=Yr,Or.readFloat32LE=Qr,Or.readFloat64BE=Jr,Or.readFloat64LE=Xr,Or.writeFloat32BE=Zr,Or.writeFloat32LE=ei,Or.writeFloat64BE=ti,Or.writeFloat64LE=ni,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const t=cr,n=Or,r=gr;function i(t,n=e.defaultRandomSource){return n.randomBytes(t)}function o(t=e.defaultRandomSource){const o=i(4,t),s=(0,n.readUint32LE)(o);return(0,r.wipe)(o),s}e.defaultRandomSource=new t.SystemRandomSource,e.randomBytes=i,e.randomUint32=o;const s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(t,n=s,o=e.defaultRandomSource){if(n.length<2)throw new Error("randomString charset is too short");if(n.length>256)throw new Error("randomString charset is too long");let a="";const u=n.length,c=256-256%u;for(;t>0;){const e=i(Math.ceil(256*t/c),o);for(let r=0;r<e.length&&t>0;r++){const i=e[r];i<c&&(a+=n.charAt(i%u),t--)}(0,r.wipe)(e)}return a}function u(t,n=s,r=e.defaultRandomSource){return a(Math.ceil(t/(Math.log(n.length)/Math.LN2)),n,r)}e.randomString=a,e.randomStringForEntropy=u}(ur);var ri={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Or,n=gr;e.DIGEST_LENGTH=64,e.BLOCK_SIZE=128;var r=function(){function r(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return r.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},r.prototype.update=function(t,n){if(void 0===n&&(n=t.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var r=0;if(this._bytesHashed+=n,this._bufferLength>0){for(;this._bufferLength<e.BLOCK_SIZE&&n>0;)this._buffer[this._bufferLength++]=t[r++],n--;this._bufferLength===this.blockSize&&(o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(n>=this.blockSize&&(r=o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,t,r,n),n%=this.blockSize);n>0;)this._buffer[this._bufferLength++]=t[r++],n--;return this},r.prototype.finish=function(e){if(!this._finished){var n=this._bytesHashed,r=this._bufferLength,i=n/536870912|0,s=n<<3,a=n%128<112?128:256;this._buffer[r]=128;for(var u=r+1;u<a-8;u++)this._buffer[u]=0;t.writeUint32BE(i,this._buffer,a-8),t.writeUint32BE(s,this._buffer,a-4),o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,a),this._finished=!0}for(u=0;u<this.digestLength/8;u++)t.writeUint32BE(this._stateHi[u],e,8*u),t.writeUint32BE(this._stateLo[u],e,8*u+4);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){n.wipe(e.stateHi),n.wipe(e.stateLo),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();e.SHA512=r;var i=new Int32Array([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]);function o(e,n,r,o,s,a,u){for(var c,l,f,h,d,p,g,y,v=r[0],m=r[1],_=r[2],b=r[3],w=r[4],E=r[5],S=r[6],O=r[7],I=o[0],x=o[1],R=o[2],k=o[3],C=o[4],P=o[5],A=o[6],N=o[7];u>=128;){for(var T=0;T<16;T++){var M=8*T+a;e[T]=t.readUint32BE(s,M),n[T]=t.readUint32BE(s,M+4)}for(T=0;T<80;T++){var L=v,j=m,U=_,D=b,z=w,F=E,B=S,H=O,q=I,$=x,V=R,W=k,K=C,G=P,Y=A,Q=N;if(d=65535&(l=N),p=l>>>16,g=65535&(c=O),y=c>>>16,d+=65535&(l=(C>>>14|w<<18)^(C>>>18|w<<14)^(w>>>9|C<<23)),p+=l>>>16,g+=65535&(c=(w>>>14|C<<18)^(w>>>18|C<<14)^(C>>>9|w<<23)),y+=c>>>16,d+=65535&(l=C&P^~C&A),p+=l>>>16,g+=65535&(c=w&E^~w&S),y+=c>>>16,c=i[2*T],d+=65535&(l=i[2*T+1]),p+=l>>>16,g+=65535&c,y+=c>>>16,c=e[T%16],p+=(l=n[T%16])>>>16,g+=65535&c,y+=c>>>16,g+=(p+=(d+=65535&l)>>>16)>>>16,d=65535&(l=h=65535&d|p<<16),p=l>>>16,g=65535&(c=f=65535&g|(y+=g>>>16)<<16),y=c>>>16,d+=65535&(l=(I>>>28|v<<4)^(v>>>2|I<<30)^(v>>>7|I<<25)),p+=l>>>16,g+=65535&(c=(v>>>28|I<<4)^(I>>>2|v<<30)^(I>>>7|v<<25)),y+=c>>>16,p+=(l=I&x^I&R^x&R)>>>16,g+=65535&(c=v&m^v&_^m&_),y+=c>>>16,H=65535&(g+=(p+=(d+=65535&l)>>>16)>>>16)|(y+=g>>>16)<<16,Q=65535&d|p<<16,d=65535&(l=W),p=l>>>16,g=65535&(c=D),y=c>>>16,p+=(l=h)>>>16,g+=65535&(c=f),y+=c>>>16,m=L,_=j,b=U,w=D=65535&(g+=(p+=(d+=65535&l)>>>16)>>>16)|(y+=g>>>16)<<16,E=z,S=F,O=B,v=H,x=q,R=$,k=V,C=W=65535&d|p<<16,P=K,A=G,N=Y,I=Q,T%16==15)for(M=0;M<16;M++)c=e[M],d=65535&(l=n[M]),p=l>>>16,g=65535&c,y=c>>>16,c=e[(M+9)%16],d+=65535&(l=n[(M+9)%16]),p+=l>>>16,g+=65535&c,y+=c>>>16,f=e[(M+1)%16],d+=65535&(l=((h=n[(M+1)%16])>>>1|f<<31)^(h>>>8|f<<24)^(h>>>7|f<<25)),p+=l>>>16,g+=65535&(c=(f>>>1|h<<31)^(f>>>8|h<<24)^f>>>7),y+=c>>>16,f=e[(M+14)%16],p+=(l=((h=n[(M+14)%16])>>>19|f<<13)^(f>>>29|h<<3)^(h>>>6|f<<26))>>>16,g+=65535&(c=(f>>>19|h<<13)^(h>>>29|f<<3)^f>>>6),y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,e[M]=65535&g|y<<16,n[M]=65535&d|p<<16}d=65535&(l=I),p=l>>>16,g=65535&(c=v),y=c>>>16,c=r[0],p+=(l=o[0])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[0]=v=65535&g|y<<16,o[0]=I=65535&d|p<<16,d=65535&(l=x),p=l>>>16,g=65535&(c=m),y=c>>>16,c=r[1],p+=(l=o[1])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[1]=m=65535&g|y<<16,o[1]=x=65535&d|p<<16,d=65535&(l=R),p=l>>>16,g=65535&(c=_),y=c>>>16,c=r[2],p+=(l=o[2])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[2]=_=65535&g|y<<16,o[2]=R=65535&d|p<<16,d=65535&(l=k),p=l>>>16,g=65535&(c=b),y=c>>>16,c=r[3],p+=(l=o[3])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[3]=b=65535&g|y<<16,o[3]=k=65535&d|p<<16,d=65535&(l=C),p=l>>>16,g=65535&(c=w),y=c>>>16,c=r[4],p+=(l=o[4])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[4]=w=65535&g|y<<16,o[4]=C=65535&d|p<<16,d=65535&(l=P),p=l>>>16,g=65535&(c=E),y=c>>>16,c=r[5],p+=(l=o[5])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[5]=E=65535&g|y<<16,o[5]=P=65535&d|p<<16,d=65535&(l=A),p=l>>>16,g=65535&(c=S),y=c>>>16,c=r[6],p+=(l=o[6])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[6]=S=65535&g|y<<16,o[6]=A=65535&d|p<<16,d=65535&(l=N),p=l>>>16,g=65535&(c=O),y=c>>>16,c=r[7],p+=(l=o[7])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[7]=O=65535&g|y<<16,o[7]=N=65535&d|p<<16,a+=128,u-=128}return a}function s(e){var t=new r;t.update(e);var n=t.digest();return t.clean(),n}e.hash=s})(ri),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.convertSecretKeyToX25519=e.convertPublicKeyToX25519=e.verify=e.sign=e.extractPublicKeyFromSecretKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.SEED_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=e.SIGNATURE_LENGTH=void 0;const t=ur,n=ri,r=gr;function i(e){const t=new Float64Array(16);if(e)for(let n=0;n<e.length;n++)t[n]=e[n];return t}e.SIGNATURE_LENGTH=64,e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=64,e.SEED_LENGTH=32,new Uint8Array(32)[0]=9;const o=i(),s=i([1]),a=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),c=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),l=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h(e,t){for(let n=0;n<16;n++)e[n]=0|t[n]}function d(e){let t=1;for(let n=0;n<16;n++){let r=e[n]+t+65535;t=Math.floor(r/65536),e[n]=r-65536*t}e[0]+=t-1+37*(t-1)}function p(e,t,n){const r=~(n-1);for(let n=0;n<16;n++){const i=r&(e[n]^t[n]);e[n]^=i,t[n]^=i}}function g(e,t){const n=i(),r=i();for(let e=0;e<16;e++)r[e]=t[e];d(r),d(r),d(r);for(let e=0;e<2;e++){n[0]=r[0]-65517;for(let e=1;e<15;e++)n[e]=r[e]-65535-(n[e-1]>>16&1),n[e-1]&=65535;n[15]=r[15]-32767-(n[14]>>16&1);const e=n[15]>>16&1;n[14]&=65535,p(r,n,1-e)}for(let t=0;t<16;t++)e[2*t]=255&r[t],e[2*t+1]=r[t]>>8}function y(e,t){let n=0;for(let r=0;r<32;r++)n|=e[r]^t[r];return(1&n-1>>>8)-1}function v(e,t){const n=new Uint8Array(32),r=new Uint8Array(32);return g(n,e),g(r,t),y(n,r)}function m(e){const t=new Uint8Array(32);return g(t,e),1&t[0]}function _(e,t){for(let n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function b(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]+n[r]}function w(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]-n[r]}function E(e,t,n){let r,i,o=0,s=0,a=0,u=0,c=0,l=0,f=0,h=0,d=0,p=0,g=0,y=0,v=0,m=0,_=0,b=0,w=0,E=0,S=0,O=0,I=0,x=0,R=0,k=0,C=0,P=0,A=0,N=0,T=0,M=0,L=0,j=n[0],U=n[1],D=n[2],z=n[3],F=n[4],B=n[5],H=n[6],q=n[7],$=n[8],V=n[9],W=n[10],K=n[11],G=n[12],Y=n[13],Q=n[14],J=n[15];r=t[0],o+=r*j,s+=r*U,a+=r*D,u+=r*z,c+=r*F,l+=r*B,f+=r*H,h+=r*q,d+=r*$,p+=r*V,g+=r*W,y+=r*K,v+=r*G,m+=r*Y,_+=r*Q,b+=r*J,r=t[1],s+=r*j,a+=r*U,u+=r*D,c+=r*z,l+=r*F,f+=r*B,h+=r*H,d+=r*q,p+=r*$,g+=r*V,y+=r*W,v+=r*K,m+=r*G,_+=r*Y,b+=r*Q,w+=r*J,r=t[2],a+=r*j,u+=r*U,c+=r*D,l+=r*z,f+=r*F,h+=r*B,d+=r*H,p+=r*q,g+=r*$,y+=r*V,v+=r*W,m+=r*K,_+=r*G,b+=r*Y,w+=r*Q,E+=r*J,r=t[3],u+=r*j,c+=r*U,l+=r*D,f+=r*z,h+=r*F,d+=r*B,p+=r*H,g+=r*q,y+=r*$,v+=r*V,m+=r*W,_+=r*K,b+=r*G,w+=r*Y,E+=r*Q,S+=r*J,r=t[4],c+=r*j,l+=r*U,f+=r*D,h+=r*z,d+=r*F,p+=r*B,g+=r*H,y+=r*q,v+=r*$,m+=r*V,_+=r*W,b+=r*K,w+=r*G,E+=r*Y,S+=r*Q,O+=r*J,r=t[5],l+=r*j,f+=r*U,h+=r*D,d+=r*z,p+=r*F,g+=r*B,y+=r*H,v+=r*q,m+=r*$,_+=r*V,b+=r*W,w+=r*K,E+=r*G,S+=r*Y,O+=r*Q,I+=r*J,r=t[6],f+=r*j,h+=r*U,d+=r*D,p+=r*z,g+=r*F,y+=r*B,v+=r*H,m+=r*q,_+=r*$,b+=r*V,w+=r*W,E+=r*K,S+=r*G,O+=r*Y,I+=r*Q,x+=r*J,r=t[7],h+=r*j,d+=r*U,p+=r*D,g+=r*z,y+=r*F,v+=r*B,m+=r*H,_+=r*q,b+=r*$,w+=r*V,E+=r*W,S+=r*K,O+=r*G,I+=r*Y,x+=r*Q,R+=r*J,r=t[8],d+=r*j,p+=r*U,g+=r*D,y+=r*z,v+=r*F,m+=r*B,_+=r*H,b+=r*q,w+=r*$,E+=r*V,S+=r*W,O+=r*K,I+=r*G,x+=r*Y,R+=r*Q,k+=r*J,r=t[9],p+=r*j,g+=r*U,y+=r*D,v+=r*z,m+=r*F,_+=r*B,b+=r*H,w+=r*q,E+=r*$,S+=r*V,O+=r*W,I+=r*K,x+=r*G,R+=r*Y,k+=r*Q,C+=r*J,r=t[10],g+=r*j,y+=r*U,v+=r*D,m+=r*z,_+=r*F,b+=r*B,w+=r*H,E+=r*q,S+=r*$,O+=r*V,I+=r*W,x+=r*K,R+=r*G,k+=r*Y,C+=r*Q,P+=r*J,r=t[11],y+=r*j,v+=r*U,m+=r*D,_+=r*z,b+=r*F,w+=r*B,E+=r*H,S+=r*q,O+=r*$,I+=r*V,x+=r*W,R+=r*K,k+=r*G,C+=r*Y,P+=r*Q,A+=r*J,r=t[12],v+=r*j,m+=r*U,_+=r*D,b+=r*z,w+=r*F,E+=r*B,S+=r*H,O+=r*q,I+=r*$,x+=r*V,R+=r*W,k+=r*K,C+=r*G,P+=r*Y,A+=r*Q,N+=r*J,r=t[13],m+=r*j,_+=r*U,b+=r*D,w+=r*z,E+=r*F,S+=r*B,O+=r*H,I+=r*q,x+=r*$,R+=r*V,k+=r*W,C+=r*K,P+=r*G,A+=r*Y,N+=r*Q,T+=r*J,r=t[14],_+=r*j,b+=r*U,w+=r*D,E+=r*z,S+=r*F,O+=r*B,I+=r*H,x+=r*q,R+=r*$,k+=r*V,C+=r*W,P+=r*K,A+=r*G,N+=r*Y,T+=r*Q,M+=r*J,r=t[15],b+=r*j,w+=r*U,E+=r*D,S+=r*z,O+=r*F,I+=r*B,x+=r*H,R+=r*q,k+=r*$,C+=r*V,P+=r*W,A+=r*K,N+=r*G,T+=r*Y,M+=r*Q,L+=r*J,o+=38*w,s+=38*E,a+=38*S,u+=38*O,c+=38*I,l+=38*x,f+=38*R,h+=38*k,d+=38*C,p+=38*P,g+=38*A,y+=38*N,v+=38*T,m+=38*M,_+=38*L,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=h,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=v,e[13]=m,e[14]=_,e[15]=b}function S(e,t){E(e,t,t)}function O(e,t){const n=i();let r;for(r=0;r<16;r++)n[r]=t[r];for(r=253;r>=0;r--)S(n,n),2!==r&&4!==r&&E(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}function I(e,t){const n=i();let r;for(r=0;r<16;r++)n[r]=t[r];for(r=250;r>=0;r--)S(n,n),1!==r&&E(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}function x(e,t){const n=i(),r=i(),o=i(),s=i(),a=i(),c=i(),l=i(),f=i(),h=i();w(n,e[1],e[0]),w(h,t[1],t[0]),E(n,n,h),b(r,e[0],e[1]),b(h,t[0],t[1]),E(r,r,h),E(o,e[3],t[3]),E(o,o,u),E(s,e[2],t[2]),b(s,s,s),w(a,r,n),w(c,s,o),b(l,s,o),b(f,r,n),E(e[0],a,c),E(e[1],f,l),E(e[2],l,c),E(e[3],a,f)}function R(e,t,n){for(let r=0;r<4;r++)p(e[r],t[r],n)}function k(e,t){const n=i(),r=i(),o=i();O(o,t[2]),E(n,t[0],o),E(r,t[1],o),g(e,r),e[31]^=m(n)<<7}function C(e,t,n){h(e[0],o),h(e[1],s),h(e[2],s),h(e[3],o);for(let r=255;r>=0;--r){const i=n[r/8|0]>>(7&r)&1;R(e,t,i),x(t,e),x(e,e),R(e,t,i)}}function P(e,t){const n=[i(),i(),i(),i()];h(n[0],c),h(n[1],l),h(n[2],s),E(n[3],c,l),C(e,n,t)}function A(t){if(t.length!==e.SEED_LENGTH)throw new Error(`ed25519: seed must be ${e.SEED_LENGTH} bytes`);const r=(0,n.hash)(t);r[0]&=248,r[31]&=127,r[31]|=64;const o=new Uint8Array(32),s=[i(),i(),i(),i()];P(s,r),k(o,s);const a=new Uint8Array(64);return a.set(t),a.set(o,32),{publicKey:o,secretKey:a}}function N(e){const n=(0,t.randomBytes)(32,e),i=A(n);return(0,r.wipe)(n),i}function T(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${e.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}e.generateKeyPairFromSeed=A,e.generateKeyPair=N,e.extractPublicKeyFromSecretKey=T;const M=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function L(e,t){let n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i<o;++i)t[i]+=n-16*t[r]*M[i-(r-32)],n=Math.floor((t[i]+128)/256),t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*M[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*M[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function j(e){const t=new Float64Array(64);for(let n=0;n<64;n++)t[n]=e[n];for(let t=0;t<64;t++)e[t]=0;L(e,t)}function U(e,t){const r=new Float64Array(64),o=[i(),i(),i(),i()],s=(0,n.hash)(e.subarray(0,32));s[0]&=248,s[31]&=127,s[31]|=64;const a=new Uint8Array(64);a.set(s.subarray(32),32);const u=new n.SHA512;u.update(a.subarray(32)),u.update(t);const c=u.digest();u.clean(),j(c),P(o,c),k(a,o),u.reset(),u.update(a.subarray(0,32)),u.update(e.subarray(32)),u.update(t);const l=u.digest();j(l);for(let e=0;e<32;e++)r[e]=c[e];for(let e=0;e<32;e++)for(let t=0;t<32;t++)r[e+t]+=l[e]*s[t];return L(a.subarray(32),r),a}function D(e,t){const n=i(),r=i(),u=i(),c=i(),l=i(),d=i(),p=i();return h(e[2],s),_(e[1],t),S(u,e[1]),E(c,u,a),w(u,u,e[2]),b(c,e[2],c),S(l,c),S(d,l),E(p,d,l),E(n,p,u),E(n,n,c),I(n,n),E(n,n,u),E(n,n,c),E(n,n,c),E(e[0],n,c),S(r,e[0]),E(r,r,c),v(r,u)&&E(e[0],e[0],f),S(r,e[0]),E(r,r,c),v(r,u)?-1:(m(e[0])===t[31]>>7&&w(e[0],o,e[0]),E(e[3],e[0],e[1]),0)}function z(t,r,o){const s=new Uint8Array(32),a=[i(),i(),i(),i()],u=[i(),i(),i(),i()];if(o.length!==e.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${e.SIGNATURE_LENGTH} bytes`);if(D(u,t))return!1;const c=new n.SHA512;c.update(o.subarray(0,32)),c.update(t),c.update(r);const l=c.digest();return j(l),C(a,u,l),P(u,o.subarray(32)),x(a,u),k(s,a),!y(o,s)}function F(e){let t=[i(),i(),i(),i()];if(D(t,e))throw new Error("Ed25519: invalid public key");let n=i(),r=i(),o=t[1];b(n,s,o),w(r,s,o),O(r,r),E(n,n,r);let a=new Uint8Array(32);return g(a,n),a}function B(e){const t=(0,n.hash)(e.subarray(0,32));t[0]&=248,t[31]&=127,t[31]|=64;const i=new Uint8Array(t.subarray(0,32));return(0,r.wipe)(t),i}e.sign=U,e.verify=z,e.convertPublicKeyToX25519=F,e.convertSecretKeyToX25519=B}(ar);const ii="EdDSA",oi="JWT",si=".",ai="base64url",ui="utf8",ci="utf8",li=":",fi="did",hi="key",di="base58btc",pi="z",gi="K36",yi=32;function vi(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function mi(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?vi(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function _i(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const n=mi(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return vi(n)}function bi(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function f(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*l+1>>>0,c=new Uint8Array(s);i!==o;){for(var f=t[i],h=0,d=s-1;(0!==f||h<r)&&-1!==d;d--,h++)f+=256*c[d]>>>0,c[d]=f%a>>>0,f=f/a>>>0;if(0!==f)throw new Error("Non-zero carry");r=h,i++}for(var p=s-r;p!==s&&0===c[p];)p++;for(var g=u.repeat(n);p<s;++p)g+=e.charAt(c[p]);return g}function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var r=0,i=0;e[t]===u;)r++,t++;for(var o=(e.length-t)*c+1>>>0,s=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var f=0,h=o-1;(0!==l||f<i)&&-1!==h;h--,f++)l+=a*s[h]>>>0,s[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=o-i;d!==o&&0===s[d];)d++;for(var p=new Uint8Array(r+(o-d)),g=r;d!==o;)p[g++]=s[d++];return p}}}function d(e){var n=h(e);if(n)return n;throw new Error(`Non-${t} character`)}return{encode:f,decodeUnsafe:h,decode:d}}var wi=bi;const Ei=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Si=e=>(new TextEncoder).encode(e),Oi=e=>(new TextDecoder).decode(e);class Ii{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class xi{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return ki(this,e)}}class Ri{constructor(e){this.decoders=e}or(e){return ki(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const ki=(e,t)=>new Ri({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class Ci{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new Ii(e,t,n),this.decoder=new xi(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Pi=({name:e,prefix:t,encode:n,decode:r})=>new Ci(e,t,n,r),Ai=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=wi(n,t);return Pi({prefix:e,name:t,encode:r,decode:e=>Ei(i(e))})},Ni=(e,t,n,r)=>{const i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*n/8|0);let a=0,u=0,c=0;for(let t=0;t<o;++t){const o=i[e[t]];if(void 0===o)throw new SyntaxError(`Non-${r} character`);u=u<<n|o,a+=n,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=n||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s},Ti=(e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let r=0;r<e.length;++r)for(a=a<<8|e[r],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o},Mi=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>Pi({prefix:t,name:e,encode:e=>Ti(e,r,n),decode:t=>Ni(t,r,n,e)}),Li=Pi({prefix:"\0",name:"identity",encode:e=>Oi(e),decode:e=>Si(e)});var ji=Object.freeze({__proto__:null,identity:Li});const Ui=Mi({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Di=Object.freeze({__proto__:null,base2:Ui});const zi=Mi({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Fi=Object.freeze({__proto__:null,base8:zi});const Bi=Ai({prefix:"9",name:"base10",alphabet:"0123456789"});var Hi=Object.freeze({__proto__:null,base10:Bi});const qi=Mi({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$i=Mi({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Vi=Object.freeze({__proto__:null,base16:qi,base16upper:$i});const Wi=Mi({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ki=Mi({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Gi=Mi({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Yi=Mi({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Qi=Mi({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ji=Mi({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Xi=Mi({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Zi=Mi({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),eo=Mi({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var to=Object.freeze({__proto__:null,base32:Wi,base32upper:Ki,base32pad:Gi,base32padupper:Yi,base32hex:Qi,base32hexupper:Ji,base32hexpad:Xi,base32hexpadupper:Zi,base32z:eo});const no=Ai({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ro=Ai({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var io=Object.freeze({__proto__:null,base36:no,base36upper:ro});const oo=Ai({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),so=Ai({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ao=Object.freeze({__proto__:null,base58btc:oo,base58flickr:so});const uo=Mi({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),co=Mi({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),lo=Mi({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),fo=Mi({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ho=Object.freeze({__proto__:null,base64:uo,base64pad:co,base64url:lo,base64urlpad:fo});const po=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),go=po.reduce(((e,t,n)=>(e[n]=t,e)),[]),yo=po.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);function vo(e){return e.reduce(((e,t)=>e+=go[t]),"")}function mo(e){const t=[];for(const n of e){const e=yo[n.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}const _o=Pi({prefix:"🚀",name:"base256emoji",encode:vo,decode:mo});var bo=Object.freeze({__proto__:null,base256emoji:_o}),wo=Io,Eo=128,So=-128,Oo=Math.pow(2,31);function Io(e,t,n){t=t||[];for(var r=n=n||0;e>=Oo;)t[n++]=255&e|Eo,e/=128;for(;e&So;)t[n++]=255&e|Eo,e>>>=7;return t[n]=0|e,Io.bytes=n-r+1,t}var xo=Co,Ro=128,ko=127;function Co(e,t){var n,r=0,i=0,o=t=t||0,s=e.length;do{if(o>=s)throw Co.bytes=0,new RangeError("Could not decode varint");n=e[o++],r+=i<28?(n&ko)<<i:(n&ko)*Math.pow(2,i),i+=7}while(n>=Ro);return Co.bytes=o-t,r}var Po=Math.pow(2,7),Ao=Math.pow(2,14),No=Math.pow(2,21),To=Math.pow(2,28),Mo=Math.pow(2,35),Lo=Math.pow(2,42),jo=Math.pow(2,49),Uo=Math.pow(2,56),Do=Math.pow(2,63),zo={encode:wo,decode:xo,encodingLength:function(e){return e<Po?1:e<Ao?2:e<No?3:e<To?4:e<Mo?5:e<Lo?6:e<jo?7:e<Uo?8:e<Do?9:10}};const Fo=(e,t,n=0)=>(zo.encode(e,t,n),t),Bo=e=>zo.encodingLength(e),Ho=(e,t)=>{const n=t.byteLength,r=Bo(e),i=r+Bo(n),o=new Uint8Array(i+n);return Fo(e,o,0),Fo(n,o,r),o.set(t,i),new qo(e,n,t,o)};class qo{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const $o=({name:e,code:t,encode:n})=>new Vo(e,t,n);class Vo{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Ho(this.code,t):t.then((e=>Ho(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Wo=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Ko=$o({name:"sha2-256",code:18,encode:Wo("SHA-256")}),Go=$o({name:"sha2-512",code:19,encode:Wo("SHA-512")});Object.freeze({__proto__:null,sha256:Ko,sha512:Go});const Yo=0,Qo="identity",Jo=Ei;Object.freeze({__proto__:null,identity:{code:Yo,name:Qo,encode:Jo,digest:e=>Ho(Yo,Jo(e))}}),new TextEncoder,new TextDecoder;const Xo={...ji,...Di,...Fi,...Hi,...Vi,...to,...io,...ao,...ho,...bo};function Zo(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const es=Zo("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),ts=Zo("ascii","a",(e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}),(e=>{const t=mi((e=e.substring(1)).length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t})),ns={utf8:es,"utf-8":es,hex:Xo.base16,latin1:ts,ascii:ts,binary:ts,...Xo};function rs(e,t="utf8"){const n=ns[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}function is(e,t="utf8"){const n=ns[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode(`${n.prefix}${e}`):vi(globalThis.Buffer.from(e,"utf-8"))}function os(e){return rs(is(ue(e),ui),ai)}function ss(e){const t=is(gi,di),n=pi+rs(_i([t,e]),di);return[fi,hi,n].join(li)}function as(e){return rs(e,ai)}function us(e){return is([os(e.header),os(e.payload)].join(si),ci)}function cs(e){return[os(e.header),os(e.payload),as(e.signature)].join(si)}function ls(e=ur.randomBytes(yi)){return ar.generateKeyPairFromSeed(e)}async function fs(e,t,n,r,i=Qe.fromMiliseconds(Date.now())){const o={alg:ii,typ:oi},s={iss:ss(r.publicKey),sub:e,aud:t,iat:i,exp:i+n},a=us({header:o,payload:s});return cs({header:o,payload:s,signature:ar.sign(r.secretKey,a)})}var hs={},ds={};Object.defineProperty(ds,"__esModule",{value:!0});var ps=Or,gs=gr,ys=20;function vs(e,t,n){for(var r=1634760805,i=857760878,o=2036477234,s=1797285236,a=n[3]<<24|n[2]<<16|n[1]<<8|n[0],u=n[7]<<24|n[6]<<16|n[5]<<8|n[4],c=n[11]<<24|n[10]<<16|n[9]<<8|n[8],l=n[15]<<24|n[14]<<16|n[13]<<8|n[12],f=n[19]<<24|n[18]<<16|n[17]<<8|n[16],h=n[23]<<24|n[22]<<16|n[21]<<8|n[20],d=n[27]<<24|n[26]<<16|n[25]<<8|n[24],p=n[31]<<24|n[30]<<16|n[29]<<8|n[28],g=t[3]<<24|t[2]<<16|t[1]<<8|t[0],y=t[7]<<24|t[6]<<16|t[5]<<8|t[4],v=t[11]<<24|t[10]<<16|t[9]<<8|t[8],m=t[15]<<24|t[14]<<16|t[13]<<8|t[12],_=r,b=i,w=o,E=s,S=a,O=u,I=c,x=l,R=f,k=h,C=d,P=p,A=g,N=y,T=v,M=m,L=0;L<ys;L+=2)S=(S^=R=R+(A=(A^=_=_+S|0)>>>16|A<<16)|0)>>>20|S<<12,O=(O^=k=k+(N=(N^=b=b+O|0)>>>16|N<<16)|0)>>>20|O<<12,I=(I^=C=C+(T=(T^=w=w+I|0)>>>16|T<<16)|0)>>>20|I<<12,x=(x^=P=P+(M=(M^=E=E+x|0)>>>16|M<<16)|0)>>>20|x<<12,I=(I^=C=C+(T=(T^=w=w+I|0)>>>24|T<<8)|0)>>>25|I<<7,x=(x^=P=P+(M=(M^=E=E+x|0)>>>24|M<<8)|0)>>>25|x<<7,O=(O^=k=k+(N=(N^=b=b+O|0)>>>24|N<<8)|0)>>>25|O<<7,S=(S^=R=R+(A=(A^=_=_+S|0)>>>24|A<<8)|0)>>>25|S<<7,O=(O^=C=C+(M=(M^=_=_+O|0)>>>16|M<<16)|0)>>>20|O<<12,I=(I^=P=P+(A=(A^=b=b+I|0)>>>16|A<<16)|0)>>>20|I<<12,x=(x^=R=R+(N=(N^=w=w+x|0)>>>16|N<<16)|0)>>>20|x<<12,S=(S^=k=k+(T=(T^=E=E+S|0)>>>16|T<<16)|0)>>>20|S<<12,x=(x^=R=R+(N=(N^=w=w+x|0)>>>24|N<<8)|0)>>>25|x<<7,S=(S^=k=k+(T=(T^=E=E+S|0)>>>24|T<<8)|0)>>>25|S<<7,I=(I^=P=P+(A=(A^=b=b+I|0)>>>24|A<<8)|0)>>>25|I<<7,O=(O^=C=C+(M=(M^=_=_+O|0)>>>24|M<<8)|0)>>>25|O<<7;ps.writeUint32LE(_+r|0,e,0),ps.writeUint32LE(b+i|0,e,4),ps.writeUint32LE(w+o|0,e,8),ps.writeUint32LE(E+s|0,e,12),ps.writeUint32LE(S+a|0,e,16),ps.writeUint32LE(O+u|0,e,20),ps.writeUint32LE(I+c|0,e,24),ps.writeUint32LE(x+l|0,e,28),ps.writeUint32LE(R+f|0,e,32),ps.writeUint32LE(k+h|0,e,36),ps.writeUint32LE(C+d|0,e,40),ps.writeUint32LE(P+p|0,e,44),ps.writeUint32LE(A+g|0,e,48),ps.writeUint32LE(N+y|0,e,52),ps.writeUint32LE(T+v|0,e,56),ps.writeUint32LE(M+m|0,e,60)}function ms(e,t,n,r,i){if(void 0===i&&(i=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(r.length<n.length)throw new Error("ChaCha: destination is shorter than source");var o,s;if(0===i){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=(o=new Uint8Array(16)).length-t.length,o.set(t,s)}else{if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");o=t,s=i}for(var a=new Uint8Array(64),u=0;u<n.length;u+=64){vs(a,o,e);for(var c=u;c<u+64&&c<n.length;c++)r[c]=n[c]^a[c-u];bs(o,0,s)}return gs.wipe(a),0===i&&gs.wipe(o),r}function _s(e,t,n,r){return void 0===r&&(r=0),gs.wipe(n),ms(e,t,n,n,r)}function bs(e,t,n){for(var r=1;n--;)r=r+(255&e[t])|0,e[t]=255&r,r>>>=8,t++;if(r>0)throw new Error("ChaCha: counter overflow")}ds.streamXOR=ms,ds.stream=_s;var ws={},Es={};function Ss(e,t,n){return~(e-1)&t|e-1&n}function Os(e,t){return(0|e)-(0|t)-1>>>31&1}function Is(e,t){if(e.length!==t.length)return 0;for(var n=0,r=0;r<e.length;r++)n|=e[r]^t[r];return 1&n-1>>>8}function xs(e,t){return 0!==e.length&&0!==t.length&&0!==Is(e,t)}Object.defineProperty(Es,"__esModule",{value:!0}),Es.select=Ss,Es.lessOrEqual=Os,Es.compare=Is,Es.equal=xs,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Es,n=gr;e.DIGEST_LENGTH=16;var r=function(){function t(t){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var n=t[0]|t[1]<<8;this._r[0]=8191&n;var r=t[2]|t[3]<<8;this._r[1]=8191&(n>>>13|r<<3);var i=t[4]|t[5]<<8;this._r[2]=7939&(r>>>10|i<<6);var o=t[6]|t[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=t[8]|t[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=t[10]|t[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var u=t[12]|t[13]<<8;this._r[7]=8065&(a>>>11|u<<5);var c=t[14]|t[15]<<8;this._r[8]=8191&(u>>>8|c<<8),this._r[9]=c>>>5&127,this._pad[0]=t[16]|t[17]<<8,this._pad[1]=t[18]|t[19]<<8,this._pad[2]=t[20]|t[21]<<8,this._pad[3]=t[22]|t[23]<<8,this._pad[4]=t[24]|t[25]<<8,this._pad[5]=t[26]|t[27]<<8,this._pad[6]=t[28]|t[29]<<8,this._pad[7]=t[30]|t[31]<<8}return t.prototype._blocks=function(e,t,n){for(var r=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],u=this._h[4],c=this._h[5],l=this._h[6],f=this._h[7],h=this._h[8],d=this._h[9],p=this._r[0],g=this._r[1],y=this._r[2],v=this._r[3],m=this._r[4],_=this._r[5],b=this._r[6],w=this._r[7],E=this._r[8],S=this._r[9];n>=16;){var O=e[t+0]|e[t+1]<<8;i+=8191&O;var I=e[t+2]|e[t+3]<<8;o+=8191&(O>>>13|I<<3);var x=e[t+4]|e[t+5]<<8;s+=8191&(I>>>10|x<<6);var R=e[t+6]|e[t+7]<<8;a+=8191&(x>>>7|R<<9);var k=e[t+8]|e[t+9]<<8;u+=8191&(R>>>4|k<<12),c+=k>>>1&8191;var C=e[t+10]|e[t+11]<<8;l+=8191&(k>>>14|C<<2);var P=e[t+12]|e[t+13]<<8;f+=8191&(C>>>11|P<<5);var A=e[t+14]|e[t+15]<<8,N=0,T=N;T+=i*p,T+=o*(5*S),T+=s*(5*E),T+=a*(5*w),N=(T+=u*(5*b))>>>13,T&=8191,T+=c*(5*_),T+=l*(5*m),T+=f*(5*v),T+=(h+=8191&(P>>>8|A<<8))*(5*y);var M=N+=(T+=(d+=A>>>5|r)*(5*g))>>>13;M+=i*g,M+=o*p,M+=s*(5*S),M+=a*(5*E),N=(M+=u*(5*w))>>>13,M&=8191,M+=c*(5*b),M+=l*(5*_),M+=f*(5*m),M+=h*(5*v),N+=(M+=d*(5*y))>>>13,M&=8191;var L=N;L+=i*y,L+=o*g,L+=s*p,L+=a*(5*S),N=(L+=u*(5*E))>>>13,L&=8191,L+=c*(5*w),L+=l*(5*b),L+=f*(5*_),L+=h*(5*m);var j=N+=(L+=d*(5*v))>>>13;j+=i*v,j+=o*y,j+=s*g,j+=a*p,N=(j+=u*(5*S))>>>13,j&=8191,j+=c*(5*E),j+=l*(5*w),j+=f*(5*b),j+=h*(5*_);var U=N+=(j+=d*(5*m))>>>13;U+=i*m,U+=o*v,U+=s*y,U+=a*g,N=(U+=u*p)>>>13,U&=8191,U+=c*(5*S),U+=l*(5*E),U+=f*(5*w),U+=h*(5*b);var D=N+=(U+=d*(5*_))>>>13;D+=i*_,D+=o*m,D+=s*v,D+=a*y,N=(D+=u*g)>>>13,D&=8191,D+=c*p,D+=l*(5*S),D+=f*(5*E),D+=h*(5*w);var z=N+=(D+=d*(5*b))>>>13;z+=i*b,z+=o*_,z+=s*m,z+=a*v,N=(z+=u*y)>>>13,z&=8191,z+=c*g,z+=l*p,z+=f*(5*S),z+=h*(5*E);var F=N+=(z+=d*(5*w))>>>13;F+=i*w,F+=o*b,F+=s*_,F+=a*m,N=(F+=u*v)>>>13,F&=8191,F+=c*y,F+=l*g,F+=f*p,F+=h*(5*S);var B=N+=(F+=d*(5*E))>>>13;B+=i*E,B+=o*w,B+=s*b,B+=a*_,N=(B+=u*m)>>>13,B&=8191,B+=c*v,B+=l*y,B+=f*g,B+=h*p;var H=N+=(B+=d*(5*S))>>>13;H+=i*S,H+=o*E,H+=s*w,H+=a*b,N=(H+=u*_)>>>13,H&=8191,H+=c*m,H+=l*v,H+=f*y,H+=h*g,i=T=8191&(N=(N=((N+=(H+=d*p)>>>13)<<2)+N|0)+(T&=8191)|0),o=M+=N>>>=13,s=L&=8191,a=j&=8191,u=U&=8191,c=D&=8191,l=z&=8191,f=F&=8191,h=B&=8191,d=H&=8191,t+=16,n-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=u,this._h[5]=c,this._h[6]=l,this._h[7]=f,this._h[8]=h,this._h[9]=d},t.prototype.finish=function(e,t){void 0===t&&(t=0);var n,r,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(n=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=n,n=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*n,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,s[0]=this._h[0]+5,n=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+n,n=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,r=(1^n)-1,o=0;o<10;o++)s[o]&=r;for(r=~r,o=0;o<10;o++)this._h[o]=this._h[o]&r|s[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var t,n=0,r=e.length;if(this._leftover){(t=16-this._leftover)>r&&(t=r);for(var i=0;i<t;i++)this._buffer[this._leftover+i]=e[n+i];if(r-=t,n+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(r>=16&&(t=r-r%16,this._blocks(e,n,t),n+=t,r-=t),r){for(i=0;i<r;i++)this._buffer[this._leftover+i]=e[n+i];this._leftover+=r}return this},t.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},t.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},t}();function i(e,t){var n=new r(e);n.update(t);var i=n.digest();return n.clean(),i}function o(n,r){return n.length===e.DIGEST_LENGTH&&r.length===e.DIGEST_LENGTH&&t.equal(n,r)}e.Poly1305=r,e.oneTimeAuth=i,e.equal=o}(ws),function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=ds,n=ws,r=gr,i=Or,o=Es;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var s=new Uint8Array(16),a=function(){function a(t){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,t.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(t)}return a.prototype.seal=function(e,n,i,o){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);t.stream(this._key,s,a,4);var u,c=n.length+this.tagLength;if(o){if(o.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");u=o}else u=new Uint8Array(c);return t.streamXOR(this._key,s,n,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),a,u.subarray(0,u.length-this.tagLength),i),r.wipe(s),u},a.prototype.open=function(e,n,i,s){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(n.length<this.tagLength)return null;var a=new Uint8Array(16);a.set(e,a.length-e.length);var u=new Uint8Array(32);t.stream(this._key,a,u,4);var c=new Uint8Array(this.tagLength);if(this._authenticate(c,u,n.subarray(0,n.length-this.tagLength),i),!o.equal(c,n.subarray(n.length-this.tagLength,n.length)))return null;var l,f=n.length-this.tagLength;if(s){if(s.length!==f)throw new Error("ChaCha20Poly1305: incorrect destination length");l=s}else l=new Uint8Array(f);return t.streamXOR(this._key,a,n.subarray(0,n.length-this.tagLength),l,4),r.wipe(a),l},a.prototype.clean=function(){return r.wipe(this._key),this},a.prototype._authenticate=function(e,t,o,a){var u=new n.Poly1305(t);a&&(u.update(a),a.length%16>0&&u.update(s.subarray(a.length%16))),u.update(o),o.length%16>0&&u.update(s.subarray(o.length%16));var c=new Uint8Array(8);a&&i.writeUint64LE(a.length,c),u.update(c),i.writeUint64LE(o.length,c),u.update(c);for(var l=u.digest(),f=0;f<l.length;f++)e[f]=l[f];u.clean(),r.wipe(l),r.wipe(c)},a}();e.ChaCha20Poly1305=a}(hs);var Rs={},ks={},Cs={};function Ps(e){return typeof e.saveState<"u"&&typeof e.restoreState<"u"&&typeof e.cleanSavedState<"u"}Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.isSerializableHash=Ps,Object.defineProperty(ks,"__esModule",{value:!0});var As=Cs,Ns=Es,Ts=gr,Ms=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var r=0;r<n.length;r++)n[r]^=54;for(this._inner.update(n),r=0;r<n.length;r++)n[r]^=106;this._outer.update(n),As.isSerializableHash(this._inner)&&As.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Ts.wipe(n)}return e.prototype.reset=function(){if(!As.isSerializableHash(this._inner)||!As.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){As.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),As.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(e){return this._inner.update(e),this},e.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!As.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!As.isSerializableHash(this._inner)||!As.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(e){if(!As.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},e}();function Ls(e,t,n){var r=new Ms(e,t);r.update(n);var i=r.digest();return r.clean(),i}ks.HMAC=Ms,ks.hmac=Ls,ks.equal=Ns.equal,Object.defineProperty(Rs,"__esModule",{value:!0});var js=ks,Us=gr,Ds=function(){function e(e,t,n,r){void 0===n&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=r;var i=js.hmac(this._hash,n,t);this._hmac=new js.HMAC(e,i),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;n<t.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[n]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),Us.wipe(this._buffer),Us.wipe(this._counter),this._bufpos=0},e}(),zs=Rs.HKDF=Ds,Fs={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Or,n=gr;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var r=function(){function r(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return r.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=o(this._temp,this._state,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var n=this._bytesHashed,r=this._bufferLength,i=n/536870912|0,s=n<<3,a=n%64<56?64:128;this._buffer[r]=128;for(var u=r+1;u<a-8;u++)this._buffer[u]=0;t.writeUint32BE(i,this._buffer,a-8),t.writeUint32BE(s,this._buffer,a-4),o(this._temp,this._state,this._buffer,0,a),this._finished=!0}for(u=0;u<this.digestLength/4;u++)t.writeUint32BE(this._state[u],e,4*u);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){n.wipe(e.state),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();e.SHA256=r;var i=new Int32Array([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]);function o(e,n,r,o,s){for(;s>=64;){for(var a=n[0],u=n[1],c=n[2],l=n[3],f=n[4],h=n[5],d=n[6],p=n[7],g=0;g<16;g++){var y=o+4*g;e[g]=t.readUint32BE(r,y)}for(g=16;g<64;g++){var v=e[g-2],m=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10,_=((v=e[g-15])>>>7|v<<25)^(v>>>18|v<<14)^v>>>3;e[g]=(m+e[g-7]|0)+(_+e[g-16]|0)}for(g=0;g<64;g++)m=(((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&h^~f&d)|0)+(p+(i[g]+e[g]|0)|0)|0,_=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&u^a&c^u&c)|0,p=d,d=h,h=f,f=l+m|0,l=c,c=u,u=a,a=m+_|0;n[0]+=a,n[1]+=u,n[2]+=c,n[3]+=l,n[4]+=f,n[5]+=h,n[6]+=d,n[7]+=p,o+=64,s-=64}return o}function s(e){var t=new r;t.update(e);var n=t.digest();return t.clean(),n}e.hash=s}(Fs);var Bs={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const t=ur,n=gr;function r(e){const t=new Float64Array(16);if(e)for(let n=0;n<e.length;n++)t[n]=e[n];return t}e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;const i=new Uint8Array(32);i[0]=9;const o=r([56129,1]);function s(e){let t=1;for(let n=0;n<16;n++){let r=e[n]+t+65535;t=Math.floor(r/65536),e[n]=r-65536*t}e[0]+=t-1+37*(t-1)}function a(e,t,n){const r=~(n-1);for(let n=0;n<16;n++){const i=r&(e[n]^t[n]);e[n]^=i,t[n]^=i}}function u(e,t){const n=r(),i=r();for(let e=0;e<16;e++)i[e]=t[e];s(i),s(i),s(i);for(let e=0;e<2;e++){n[0]=i[0]-65517;for(let e=1;e<15;e++)n[e]=i[e]-65535-(n[e-1]>>16&1),n[e-1]&=65535;n[15]=i[15]-32767-(n[14]>>16&1);const e=n[15]>>16&1;n[14]&=65535,a(i,n,1-e)}for(let t=0;t<16;t++)e[2*t]=255&i[t],e[2*t+1]=i[t]>>8}function c(e,t){for(let n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function l(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]+n[r]}function f(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]-n[r]}function h(e,t,n){let r,i,o=0,s=0,a=0,u=0,c=0,l=0,f=0,h=0,d=0,p=0,g=0,y=0,v=0,m=0,_=0,b=0,w=0,E=0,S=0,O=0,I=0,x=0,R=0,k=0,C=0,P=0,A=0,N=0,T=0,M=0,L=0,j=n[0],U=n[1],D=n[2],z=n[3],F=n[4],B=n[5],H=n[6],q=n[7],$=n[8],V=n[9],W=n[10],K=n[11],G=n[12],Y=n[13],Q=n[14],J=n[15];r=t[0],o+=r*j,s+=r*U,a+=r*D,u+=r*z,c+=r*F,l+=r*B,f+=r*H,h+=r*q,d+=r*$,p+=r*V,g+=r*W,y+=r*K,v+=r*G,m+=r*Y,_+=r*Q,b+=r*J,r=t[1],s+=r*j,a+=r*U,u+=r*D,c+=r*z,l+=r*F,f+=r*B,h+=r*H,d+=r*q,p+=r*$,g+=r*V,y+=r*W,v+=r*K,m+=r*G,_+=r*Y,b+=r*Q,w+=r*J,r=t[2],a+=r*j,u+=r*U,c+=r*D,l+=r*z,f+=r*F,h+=r*B,d+=r*H,p+=r*q,g+=r*$,y+=r*V,v+=r*W,m+=r*K,_+=r*G,b+=r*Y,w+=r*Q,E+=r*J,r=t[3],u+=r*j,c+=r*U,l+=r*D,f+=r*z,h+=r*F,d+=r*B,p+=r*H,g+=r*q,y+=r*$,v+=r*V,m+=r*W,_+=r*K,b+=r*G,w+=r*Y,E+=r*Q,S+=r*J,r=t[4],c+=r*j,l+=r*U,f+=r*D,h+=r*z,d+=r*F,p+=r*B,g+=r*H,y+=r*q,v+=r*$,m+=r*V,_+=r*W,b+=r*K,w+=r*G,E+=r*Y,S+=r*Q,O+=r*J,r=t[5],l+=r*j,f+=r*U,h+=r*D,d+=r*z,p+=r*F,g+=r*B,y+=r*H,v+=r*q,m+=r*$,_+=r*V,b+=r*W,w+=r*K,E+=r*G,S+=r*Y,O+=r*Q,I+=r*J,r=t[6],f+=r*j,h+=r*U,d+=r*D,p+=r*z,g+=r*F,y+=r*B,v+=r*H,m+=r*q,_+=r*$,b+=r*V,w+=r*W,E+=r*K,S+=r*G,O+=r*Y,I+=r*Q,x+=r*J,r=t[7],h+=r*j,d+=r*U,p+=r*D,g+=r*z,y+=r*F,v+=r*B,m+=r*H,_+=r*q,b+=r*$,w+=r*V,E+=r*W,S+=r*K,O+=r*G,I+=r*Y,x+=r*Q,R+=r*J,r=t[8],d+=r*j,p+=r*U,g+=r*D,y+=r*z,v+=r*F,m+=r*B,_+=r*H,b+=r*q,w+=r*$,E+=r*V,S+=r*W,O+=r*K,I+=r*G,x+=r*Y,R+=r*Q,k+=r*J,r=t[9],p+=r*j,g+=r*U,y+=r*D,v+=r*z,m+=r*F,_+=r*B,b+=r*H,w+=r*q,E+=r*$,S+=r*V,O+=r*W,I+=r*K,x+=r*G,R+=r*Y,k+=r*Q,C+=r*J,r=t[10],g+=r*j,y+=r*U,v+=r*D,m+=r*z,_+=r*F,b+=r*B,w+=r*H,E+=r*q,S+=r*$,O+=r*V,I+=r*W,x+=r*K,R+=r*G,k+=r*Y,C+=r*Q,P+=r*J,r=t[11],y+=r*j,v+=r*U,m+=r*D,_+=r*z,b+=r*F,w+=r*B,E+=r*H,S+=r*q,O+=r*$,I+=r*V,x+=r*W,R+=r*K,k+=r*G,C+=r*Y,P+=r*Q,A+=r*J,r=t[12],v+=r*j,m+=r*U,_+=r*D,b+=r*z,w+=r*F,E+=r*B,S+=r*H,O+=r*q,I+=r*$,x+=r*V,R+=r*W,k+=r*K,C+=r*G,P+=r*Y,A+=r*Q,N+=r*J,r=t[13],m+=r*j,_+=r*U,b+=r*D,w+=r*z,E+=r*F,S+=r*B,O+=r*H,I+=r*q,x+=r*$,R+=r*V,k+=r*W,C+=r*K,P+=r*G,A+=r*Y,N+=r*Q,T+=r*J,r=t[14],_+=r*j,b+=r*U,w+=r*D,E+=r*z,S+=r*F,O+=r*B,I+=r*H,x+=r*q,R+=r*$,k+=r*V,C+=r*W,P+=r*K,A+=r*G,N+=r*Y,T+=r*Q,M+=r*J,r=t[15],b+=r*j,w+=r*U,E+=r*D,S+=r*z,O+=r*F,I+=r*B,x+=r*H,R+=r*q,k+=r*$,C+=r*V,P+=r*W,A+=r*K,N+=r*G,T+=r*Y,M+=r*Q,L+=r*J,o+=38*w,s+=38*E,a+=38*S,u+=38*O,c+=38*I,l+=38*x,f+=38*R,h+=38*k,d+=38*C,p+=38*P,g+=38*A,y+=38*N,v+=38*T,m+=38*M,_+=38*L,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=h,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=v,e[13]=m,e[14]=_,e[15]=b}function d(e,t){h(e,t,t)}function p(e,t){const n=r();for(let e=0;e<16;e++)n[e]=t[e];for(let e=253;e>=0;e--)d(n,n),2!==e&&4!==e&&h(n,n,t);for(let t=0;t<16;t++)e[t]=n[t]}function g(e,t){const n=new Uint8Array(32),i=new Float64Array(80),s=r(),g=r(),y=r(),v=r(),m=r(),_=r();for(let t=0;t<31;t++)n[t]=e[t];n[31]=127&e[31]|64,n[0]&=248,c(i,t);for(let e=0;e<16;e++)g[e]=i[e];s[0]=v[0]=1;for(let e=254;e>=0;--e){const t=n[e>>>3]>>>(7&e)&1;a(s,g,t),a(y,v,t),l(m,s,y),f(s,s,y),l(y,g,v),f(g,g,v),d(v,m),d(_,s),h(s,y,s),h(y,g,m),l(m,s,y),f(s,s,y),d(g,s),f(y,v,_),h(s,y,o),l(s,s,v),h(y,y,s),h(s,v,_),h(v,g,i),d(g,m),a(s,g,t),a(y,v,t)}for(let e=0;e<16;e++)i[e+16]=s[e],i[e+32]=y[e],i[e+48]=g[e],i[e+64]=v[e];const b=i.subarray(32),w=i.subarray(16);p(b,b),h(w,w,b);const E=new Uint8Array(32);return u(E,w),E}function y(e){return g(e,i)}function v(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const n=new Uint8Array(t);return{publicKey:y(n),secretKey:n}}function m(e){const r=(0,t.randomBytes)(32,e),i=v(r);return(0,n.wipe)(r),i}function _(t,n,r=!1){if(t.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(n.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const i=g(t,n);if(r){let e=0;for(let t=0;t<i.length;t++)e|=i[t];if(0===e)throw new Error("X25519: invalid shared key")}return i}e.scalarMult=g,e.scalarMultBase=y,e.generateKeyPairFromSeed=v,e.generateKeyPair=m,e.sharedKey=_}(Bs);var Hs=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)(r||!(i in t))&&(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},qs=function(){function e(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return e}(),$s=function(){function e(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return e}(),Vs=function(){function e(e,t,n,r){this.name=e,this.version=t,this.os=n,this.bot=r,this.type="bot-device"}return e}(),Ws=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),Ks=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),Gs=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Ys=3,Qs=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],Js=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Xs(e){return e?ea(e):typeof document>"u"&&typeof navigator<"u"&&"ReactNative"===navigator.product?new Ks:typeof navigator<"u"?ea(navigator.userAgent):na()}function Zs(e){return""!==e&&Qs.reduce((function(t,n){var r=n[0],i=n[1];if(t)return t;var o=i.exec(e);return!!o&&[r,o]}),!1)}function ea(e){var t=Zs(e);if(!t)return null;var n=t[0],r=t[1];if("searchbot"===n)return new Ws;var i=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);i?i.length<Ys&&(i=Hs(Hs([],i,!0),ra(Ys-i.length),!0)):i=[];var o=i.join("."),s=ta(e),a=Gs.exec(e);return a&&a[1]?new Vs(n,o,s,a[1]):new qs(n,o,s)}function ta(e){for(var t=0,n=Js.length;t<n;t++){var r=Js[t],i=r[0];if(r[1].exec(e))return i}return null}function na(){return typeof process<"u"&&process.version?new $s(process.version.slice(1)):null}function ra(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}var ia={};function oa(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}function sa(e){const t=oa(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}function aa(){return sa("document")}function ua(){return oa("document")}Object.defineProperty(ia,"__esModule",{value:!0}),ia.getLocalStorage=ia.getLocalStorageOrThrow=ia.getCrypto=ia.getCryptoOrThrow=ga=ia.getLocation=ia.getLocationOrThrow=ha=ia.getNavigator=ia.getNavigatorOrThrow=ca=ia.getDocument=ia.getDocumentOrThrow=ia.getFromWindowOrThrow=ia.getFromWindow=void 0,ia.getFromWindow=oa,ia.getFromWindowOrThrow=sa,ia.getDocumentOrThrow=aa;var ca=ia.getDocument=ua;function la(){return sa("navigator")}function fa(){return oa("navigator")}ia.getNavigatorOrThrow=la;var ha=ia.getNavigator=fa;function da(){return sa("location")}function pa(){return oa("location")}ia.getLocationOrThrow=da;var ga=ia.getLocation=pa;function ya(){return sa("crypto")}function va(){return oa("crypto")}function ma(){return sa("localStorage")}function _a(){return oa("localStorage")}ia.getCryptoOrThrow=ya,ia.getCrypto=va,ia.getLocalStorageOrThrow=ma,ia.getLocalStorage=_a;var ba={};Object.defineProperty(ba,"__esModule",{value:!0});var wa=ba.getWindowMetadata=void 0;const Ea=ia;function Sa(){let e,t;try{e=Ea.getDocumentOrThrow(),t=Ea.getLocationOrThrow()}catch{return null}function n(){const n=e.getElementsByTagName("link"),r=[];for(let e=0;e<n.length;e++){const i=n[e],o=i.getAttribute("rel");if(o&&o.toLowerCase().indexOf("icon")>-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let n=t.protocol+"//"+t.host;if(0===e.indexOf("/"))n+=e;else{const r=t.pathname.split("/");r.pop(),n+=r.join("/")+"/"+e}r.push(n)}else if(0===e.indexOf("//")){const n=t.protocol+e;r.push(n)}else r.push(e)}}return r}function r(...t){const n=e.getElementsByTagName("meta");for(let e=0;e<n.length;e++){const r=n[e],i=["itemprop","property","name"].map((e=>r.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(i.length&&i){const e=r.getAttribute("content");if(e)return e}}return""}function i(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}function o(){return r("description","og:description","twitter:description","keywords")}const s=i();return{description:o(),url:t.origin,icons:n(),name:s}}wa=ba.getWindowMetadata=Sa;var Oa={},Ia=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),xa="%[a-f0-9]{2}",Ra=new RegExp("("+xa+")|([^%]+?)","gi"),ka=new RegExp("("+xa+")+","gi");function Ca(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],Ca(n),Ca(r))}function Pa(e){try{return decodeURIComponent(e)}catch{for(var t=e.match(Ra)||[],n=1;n<t.length;n++)t=(e=Ca(t,n).join("")).match(Ra)||[];return e}}function Aa(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=ka.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch{var r=Pa(n[0]);r!==n[0]&&(t[n[0]]=r)}n=ka.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),o=0;o<i.length;o++){var s=i[o];e=e.replace(new RegExp(s,"g"),t[s])}return e}var Na=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch{return Aa(e)}},Ta=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]},Ma=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),o=0;o<r.length;o++){var s=r[o],a=e[s];(i?-1!==t.indexOf(s):t(s,a,e))&&(n[s]=a)}return n};!function(e){const t=Ia,n=Na,r=Ta,i=Ma,o=e=>null==e,s=Symbol("encodeFragmentIdentifier");function a(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[l(t,e),"[",i,"]"].join("")]:[...n,[l(t,e),"[",l(i,e),"]=",l(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[l(t,e),"[]"].join("")]:[...n,[l(t,e),"[]=",l(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[l(t,e),":list="].join("")]:[...n,[l(t,e),":list=",l(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[l(n,e),t,l(i,e)].join("")]:[[r,l(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,l(t,e)]:[...n,[l(t,e),"=",l(r,e)].join("")]}}function u(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"colon-list-separator":return(e,n,r)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"==typeof n&&n.includes(e.arrayFormatSeparator),o="string"==typeof n&&!i&&f(n,e).includes(e.arrayFormatSeparator);n=o?f(n,e):n;const s=i||o?n.split(e.arrayFormatSeparator).map((t=>f(t,e))):null===n?n:f(n,e);r[t]=s};case"bracket-separator":return(t,n,r)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(r[t]=n&&f(n,e));const o=null===n?[]:n.split(e.arrayFormatSeparator).map((t=>f(t,e)));void 0!==r[t]?r[t]=[].concat(r[t],o):r[t]=o};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}function c(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function l(e,n){return n.encode?n.strict?t(e):encodeURIComponent(e):e}function f(e,t){return t.decode?n(e):e}function h(e){return Array.isArray(e)?e.sort():"object"==typeof e?h(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function d(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function p(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}function g(e){const t=(e=d(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function y(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):t.parseBooleans&&null!==e&&("true"===e.toLowerCase()||"false"===e.toLowerCase())&&(e="true"===e.toLowerCase()),e}function v(e,t){c((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=u(t),i=Object.create(null);if("string"!=typeof e||!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const o of e.split("&")){if(""===o)continue;let[e,s]=r(t.decode?o.replace(/\+/g," "):o,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:f(s,t),n(f(e,t),s,i)}for(const e of Object.keys(i)){const n=i[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=y(n[e],t);else i[e]=y(n,t)}return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce(((e,t)=>{const n=i[t];return n&&"object"==typeof n&&!Array.isArray(n)?e[t]=h(n):e[t]=n,e}),Object.create(null))}e.extract=g,e.parse=v,e.stringify=(e,t)=>{if(!e)return"";c((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&o(e[n])||t.skipEmptyString&&""===e[n],r=a(t),i={};for(const t of Object.keys(e))n(t)||(i[t]=e[t]);const s=Object.keys(i);return!1!==t.sort&&s.sort(t.sort),s.map((n=>{const i=e[n];return void 0===i?"":null===i?l(n,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?l(n,t)+"[]":i.reduce(r(n),[]).join("&"):l(n,t)+"="+l(i,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,i]=r(e,"#");return Object.assign({url:n.split("?")[0]||"",query:v(g(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:f(i,t)}:{})},e.stringifyUrl=(t,n)=>{n=Object.assign({encode:!0,strict:!0,[s]:!0},n);const r=d(t.url).split("?")[0]||"",i=e.extract(t.url),o=e.parse(i,{sort:!1}),a=Object.assign(o,t.query);let u=e.stringify(a,n);u&&(u=`?${u}`);let c=p(t.url);return t.fragmentIdentifier&&(c=`#${n[s]?l(t.fragmentIdentifier,n):t.fragmentIdentifier}`),`${r}${u}${c}`},e.pick=(t,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[s]:!1},r);const{url:o,query:a,fragmentIdentifier:u}=e.parseUrl(t,r);return e.stringifyUrl({url:o,query:i(a,n),fragmentIdentifier:u},r)},e.exclude=(t,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return e.pick(t,i,r)}}(Oa);const La={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}},ja=":";function Ua(e){const[t,n]=e.split(ja);return{namespace:t,reference:n}}function Da(e,t){return e.includes(":")?[e]:t.chains||[]}const za="base10",Fa="base16",Ba="base64pad",Ha="utf8",qa=0,$a=1,Va=0,Wa=1,Ka=12,Ga=32;function Ya(){const e=Bs.generateKeyPair();return{privateKey:rs(e.secretKey,Fa),publicKey:rs(e.publicKey,Fa)}}function Qa(){return rs(ur.randomBytes(Ga),Fa)}function Ja(e,t){const n=Bs.sharedKey(is(e,Fa),is(t,Fa),!0);return rs(new zs(Fs.SHA256,n).expand(Ga),Fa)}function Xa(e){return rs(Fs.hash(is(e,Fa)),Fa)}function Za(e){return rs(Fs.hash(is(e,Ha)),Fa)}function eu(e){return is(`${e}`,za)}function tu(e){return Number(rs(e,za))}function nu(e){const t=eu(typeof e.type<"u"?e.type:qa);if(tu(t)===$a&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?is(e.senderPublicKey,Fa):void 0,r=typeof e.iv<"u"?is(e.iv,Fa):ur.randomBytes(Ka);return iu({type:t,sealed:new hs.ChaCha20Poly1305(is(e.symKey,Fa)).seal(r,is(e.message,Ha)),iv:r,senderPublicKey:n})}function ru(e){const t=new hs.ChaCha20Poly1305(is(e.symKey,Fa)),{sealed:n,iv:r}=ou(e.encoded),i=t.open(r,n);if(null===i)throw new Error("Failed to decrypt");return rs(i,Ha)}function iu(e){if(tu(e.type)===$a){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return rs(_i([e.type,e.senderPublicKey,e.iv,e.sealed]),Ba)}return rs(_i([e.type,e.iv,e.sealed]),Ba)}function ou(e){const t=is(e,Ba),n=t.slice(Va,Wa),r=Wa;if(tu(n)===$a){const e=r+Ga,i=e+Ka,o=t.slice(r,e),s=t.slice(e,i);return{type:n,sealed:t.slice(i),iv:s,senderPublicKey:o}}const i=r+Ka,o=t.slice(r,i);return{type:n,sealed:t.slice(i),iv:o}}function su(e,t){const n=ou(e);return au({type:tu(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?rs(n.senderPublicKey,Fa):void 0,receiverPublicKey:t?.receiverPublicKey})}function au(e){const t=e?.type||qa;if(t===$a){if(typeof e?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function uu(e){return e.type===$a&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}var cu=Object.defineProperty,lu=Object.getOwnPropertySymbols,fu=Object.prototype.hasOwnProperty,hu=Object.prototype.propertyIsEnumerable,du=(e,t,n)=>t in e?cu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pu=(e,t)=>{for(var n in t||(t={}))fu.call(t,n)&&du(e,n,t[n]);if(lu)for(var n of lu(t))hu.call(t,n)&&du(e,n,t[n]);return e};const gu="ReactNative",yu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},vu="js";function mu(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function _u(){return!ca()&&!!ha()&&navigator.product===gu}function bu(){return!mu()&&!!ha()}function wu(){return _u()?yu.reactNative:mu()?yu.node:bu()?yu.browser:yu.unknown}function Eu(){var e;try{return _u()&&typeof l<"u"&&typeof(null==l?void 0:l.Application)<"u"?null==(e=l.Application)?void 0:e.applicationId:void 0}catch{return}}function Su(e,t){let n=Oa.parse(e);return n=pu(pu({},n),t),e=Oa.stringify(n)}function Ou(){return wa()||{name:"",description:"",url:"",icons:[""]}}function Iu(){if(wu()===yu.reactNative&&typeof l<"u"&&typeof(null==l?void 0:l.Platform)<"u"){const{OS:e,Version:t}=l.Platform;return[e,t].join("-")}const e=Xs();if(null===e)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function xu(){var e;const t=wu();return t===yu.browser?[t,(null==(e=ga())?void 0:e.host)||"unknown"].join(":"):t}function Ru(e,t,n){const r=Iu(),i=xu();return[[e,t].join("-"),[vu,n].join("-"),r,i].join("/")}function ku({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:i,projectId:o,useOnCloseEvent:s,bundleId:a}){const u=n.split("?"),c={auth:i,ua:Ru(e,t,r),projectId:o,useOnCloseEvent:s||void 0,origin:a||void 0},l=Su(u[1]||"",c);return u[0]+"?"+l}function Cu(e,t){return e.filter((e=>t.includes(e))).length===e.length}function Pu(e){return Object.fromEntries(e.entries())}function Au(e){return new Map(Object.entries(e))}function Nu(e=Qe.FIVE_MINUTES,t){const n=Qe.toMiliseconds(e||Qe.FIVE_MINUTES);let r,i,o;return{resolve:e=>{o&&r&&(clearTimeout(o),r(e))},reject:e=>{o&&i&&(clearTimeout(o),i(e))},done:()=>new Promise(((e,s)=>{o=setTimeout((()=>{s(new Error(t))}),n),r=e,i=s}))}}function Tu(e,t,n){return new Promise((async(r,i)=>{const o=setTimeout((()=>i(new Error(n))),t);try{r(await e)}catch(e){i(e)}clearTimeout(o)}))}function Mu(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Lu(e){return Mu("topic",e)}function ju(e){return Mu("id",e)}function Uu(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof n)r.topic=n;else{if("id"!==t||!Number.isInteger(Number(n)))throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);r.id=Number(n)}return r}function Du(e,t){return Qe.fromMiliseconds((t||Date.now())+Qe.toMiliseconds(e))}function zu(e){return Date.now()>=Qe.toMiliseconds(e)}function Fu(e,t){return`${e}${t?`:${t}`:""}`}function Bu(e=[],t=[]){return[...new Set([...e,...t])]}async function Hu({id:e,topic:t,wcDeepLink:n}){try{if(!n)return;const r="string"==typeof n?JSON.parse(n):n;let i=r?.href;if("string"!=typeof i)return;i.endsWith("/")&&(i=i.slice(0,-1));const o=`${i}/wc?requestId=${e}&sessionTopic=${t}`,s=wu();s===yu.browser?o.startsWith("https://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,"_self","noreferrer noopener"):s===yu.reactNative&&typeof(null==l?void 0:l.Linking)<"u"&&await l.Linking.openURL(o)}catch(e){console.error(e)}}async function qu(e,t){try{return await e.getItem(t)||(bu()?localStorage.getItem(t):void 0)}catch(e){console.error(e)}}const $u="irn";function Vu(e){return e?.relay||{protocol:$u}}function Wu(e){const t=La[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var Ku=Object.defineProperty,Gu=Object.getOwnPropertySymbols,Yu=Object.prototype.hasOwnProperty,Qu=Object.prototype.propertyIsEnumerable,Ju=(e,t,n)=>t in e?Ku(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xu=(e,t)=>{for(var n in t||(t={}))Yu.call(t,n)&&Ju(e,n,t[n]);if(Gu)for(var n of Gu(t))Qu.call(t,n)&&Ju(e,n,t[n]);return e};function Zu(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach((t=>{if(t.startsWith(r)){const i=t.replace(r,""),o=e[t];n[i]=o}})),n}function ec(e){const t=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=e.substring(t+1,n).split("@"),o=typeof n<"u"?e.substring(n):"",s=Oa.parse(o);return{protocol:r,topic:tc(i[0]),version:parseInt(i[1],10),symKey:s.symKey,relay:Zu(s)}}function tc(e){return e.startsWith("//")?e.substring(2):e}function nc(e,t="-"){const n="relay",r={};return Object.keys(e).forEach((i=>{const o=n+t+i;e[i]&&(r[o]=e[i])})),r}function rc(e){return`${e.protocol}:${e.topic}@${e.version}?`+Oa.stringify(Xu({symKey:e.symKey},nc(e.relay)))}function ic(e){const t=[];return e.forEach((e=>{const[n,r]=e.split(":");t.push(`${n}:${r}`)})),t}function oc(e){const t=[];return Object.values(e).forEach((e=>{t.push(...ic(e.accounts))})),t}function sc(e,t){const n=[];return Object.values(e).forEach((e=>{ic(e.accounts).includes(t)&&n.push(...e.methods)})),n}function ac(e,t){const n=[];return Object.values(e).forEach((e=>{ic(e.accounts).includes(t)&&n.push(...e.events)})),n}function uc(e,t){const n=Lc(e,t);if(n)throw new Error(n.message);const r={};for(const[t,n]of Object.entries(e))r[t]={methods:n.methods,events:n.events,chains:n.accounts.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))};return r}function cc(e){return e.includes(":")}function lc(e){return cc(e)?e.split(":")[0]:e}const fc={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},hc={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function dc(e,t){const{message:n,code:r}=hc[e];return{message:t?`${n} ${t}`:n,code:r}}function pc(e,t){const{message:n,code:r}=fc[e];return{message:t?`${n} ${t}`:n,code:r}}function gc(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function yc(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function vc(e){return typeof e>"u"}function mc(e,t){return!(!t||!vc(e))||"string"==typeof e&&!!e.trim().length}function _c(e,t){return!(!t||!vc(e))||"number"==typeof e&&!isNaN(e)}function bc(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),i=Object.keys(n);let o=!0;return!!Cu(i,r)&&(r.forEach((t=>{const{accounts:r,methods:i,events:s}=e.namespaces[t],a=ic(r),u=n[t];Cu(Da(t,u),a)&&Cu(u.methods,i)&&Cu(u.events,s)||(o=!1)})),o)}function wc(e){return!(!mc(e,!1)||!e.includes(":"))&&2===e.split(":").length}function Ec(e){if(mc(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&wc(e)}}return!1}function Sc(e){if(mc(e,!1))try{return typeof new URL(e)<"u"}catch{return!1}return!1}function Oc(e){var t;return null==(t=e?.proposer)?void 0:t.publicKey}function Ic(e){return e?.topic}function xc(e,t){let n=null;return mc(e?.publicKey,!1)||(n=dc("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}function Rc(e){let t=!0;return gc(e)?e.length&&(t=e.every((e=>mc(e,!1)))):t=!1,t}function kc(e,t,n){let r=null;return gc(t)&&t.length?t.forEach((e=>{r||wc(e)||(r=pc("UNSUPPORTED_CHAINS",`${n}, chain ${e} should be a string and conform to "namespace:chainId" format`))})):wc(e)||(r=pc("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function Cc(e,t,n){let r=null;return Object.entries(e).forEach((([e,i])=>{if(r)return;const o=kc(e,Da(e,i),`${t} ${n}`);o&&(r=o)})),r}function Pc(e,t){let n=null;return gc(e)?e.forEach((e=>{n||Ec(e)||(n=pc("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))})):n=pc("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function Ac(e,t){let n=null;return Object.values(e).forEach((e=>{if(n)return;const r=Pc(e?.accounts,`${t} namespace`);r&&(n=r)})),n}function Nc(e,t){let n=null;return Rc(e?.methods)?Rc(e?.events)||(n=pc("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=pc("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}function Tc(e,t){let n=null;return Object.values(e).forEach((e=>{if(n)return;const r=Nc(e,`${t}, namespace`);r&&(n=r)})),n}function Mc(e,t,n){let r=null;if(e&&yc(e)){const i=Tc(e,t);i&&(r=i);const o=Cc(e,t,n);o&&(r=o)}else r=dc("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}function Lc(e,t){let n=null;if(e&&yc(e)){const r=Tc(e,t);r&&(n=r);const i=Ac(e,t);i&&(n=i)}else n=dc("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function jc(e){return mc(e.protocol,!0)}function zc(e,t){let n=!1;return t&&!e?n=!0:e&&gc(e)&&e.length&&e.forEach((e=>{n=jc(e)})),n}function Fc(e){return"number"==typeof e}function Bc(e){return typeof e<"u"&&null!==typeof e}function Hc(e){return!!(e&&"object"==typeof e&&e.code&&_c(e.code,!1)&&e.message&&mc(e.message,!1))}function qc(e){return!(vc(e)||!mc(e.method,!1))}function $c(e){return!(vc(e)||vc(e.result)&&vc(e.error)||!_c(e.id,!1)||!mc(e.jsonrpc,!1))}function Vc(e){return!(vc(e)||!mc(e.name,!1))}function Wc(e,t){return!(!wc(t)||!oc(e).includes(t))}function Kc(e,t,n){return!!mc(n,!1)&&sc(e,t).includes(n)}function Gc(e,t,n){return!!mc(n,!1)&&ac(e,t).includes(n)}function Yc(e,t,n){let r=null;const i=Qc(e),o=Xc(t),s=Object.keys(i),a=Object.keys(o),u=Jc(Object.keys(e)),c=Jc(Object.keys(t)),l=u.filter((e=>!c.includes(e)));return l.length&&(r=dc("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces.\n Required: ${l.toString()}\n Received: ${Object.keys(t).toString()}`)),Cu(s,a)||(r=dc("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces.\n Required: ${s.toString()}\n Approved: ${a.toString()}`)),Object.keys(t).forEach((e=>{if(!e.includes(":")||r)return;const i=ic(t[e].accounts);i.includes(e)||(r=dc("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${e}\n Required: ${e}\n Approved: ${i.toString()}`))})),s.forEach((e=>{r||(Cu(i[e].methods,o[e].methods)?Cu(i[e].events,o[e].events)||(r=dc("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${e}`)):r=dc("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${e}`))})),r}function Qc(e){const t={};return Object.keys(e).forEach((n=>{var r;n.includes(":")?t[n]=e[n]:null==(r=e[n].chains)||r.forEach((r=>{t[r]={methods:e[n].methods,events:e[n].events}}))})),t}function Jc(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}function Xc(e){const t={};return Object.keys(e).forEach((n=>{if(n.includes(":"))t[n]=e[n];else{const r=ic(e[n].accounts);r?.forEach((r=>{t[r]={accounts:e[n].accounts.filter((e=>e.includes(`${r}:`))),methods:e[n].methods,events:e[n].events}}))}})),t}function Zc(e,t){return _c(e,!1)&&e<=t.max&&e>=t.min}function el(){const e=wu();return new Promise((t=>{switch(e){case yu.browser:t(tl());break;case yu.reactNative:t(nl());break;case yu.node:t(rl());break;default:t(!0)}}))}function tl(){return bu()&&navigator?.onLine}async function nl(){if(_u()&&typeof l<"u"&&null!=l&&l.NetInfo){const e=await(null==l?void 0:l.NetInfo.fetch());return e?.isConnected}return!0}function rl(){return!0}function il(e){switch(wu()){case yu.browser:ol(e);break;case yu.reactNative:sl(e)}}function ol(e){!_u()&&bu()&&(window.addEventListener("online",(()=>e(!0))),window.addEventListener("offline",(()=>e(!1))))}function sl(e){_u()&&typeof l<"u"&&null!=l&&l.NetInfo&&l?.NetInfo.addEventListener((t=>e(t?.isConnected)))}const al={};class ul{static get(e){return al[e]}static set(e,t){al[e]=t}static delete(e){delete al[e]}}const cl="INTERNAL_ERROR",ll="SERVER_ERROR",fl=[-32700,-32600,-32601,-32602,-32603],hl={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[cl]:{code:-32603,message:"Internal error"},[ll]:{code:-32e3,message:"Server error"}},dl=ll;function pl(e){return fl.includes(e)}function gl(e){return Object.keys(hl).includes(e)?hl[e]:hl[dl]}function yl(e){const t=Object.values(hl).find((t=>t.code===e));return t||hl[dl]}function vl(e,t,n){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${t}`):e}var ml={},_l=function(e,t){return _l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},_l(e,t)};
292
+ ***************************************************************************** */function pn(e,t){function n(){this.constructor=e}dn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var gn=function(){return gn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},gn.apply(this,arguments)};function yn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function vn(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function mn(e,t){return function(n,r){t(n,r,e)}}function _n(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function bn(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function wn(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return u([e,t])}}function u(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function En(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function Sn(e,t){for(var n in e)"default"!==n&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function On(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function In(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function xn(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(In(arguments[t]));return e}function Rn(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function kn(e){return this instanceof kn?(this.v=e,this):new kn(e)}function Cn(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{u(i[e](t))}catch(e){f(o[0][3],e)}}function u(e){e.value instanceof kn?Promise.resolve(e.value.v).then(c,l):f(o[0][2],e)}function c(e){a("next",e)}function l(e){a("throw",e)}function f(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Pn(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:kn(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function An(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof On?On(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){i(r,o,(t=e[n](t)).done,t.value)}))}}function i(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}}function Nn(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Tn(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Mn(e){return e&&e.__esModule?e:{default:e}}function Ln(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function jn(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}var Un,Dn,zn,Fn,Bn=r(Object.freeze({__proto__:null,__extends:pn,get __assign(){return gn},__rest:yn,__decorate:vn,__param:mn,__metadata:_n,__awaiter:bn,__generator:wn,__createBinding:En,__exportStar:Sn,__values:On,__read:In,__spread:xn,__spreadArrays:Rn,__await:kn,__asyncGenerator:Cn,__asyncDelegator:Pn,__asyncValues:An,__makeTemplateObject:Nn,__importStar:Tn,__importDefault:Mn,__classPrivateFieldGet:Ln,__classPrivateFieldSet:jn}));function Hn(){if(Dn)return Un;function e(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}function t(t,n,r){var i=r&&r.stringify||e,o=1;if("object"==typeof t&&null!==t){var s=n.length+o;if(1===s)return t;var a=new Array(s);a[0]=i(t);for(var u=1;u<s;u++)a[u]=i(n[u]);return a.join(" ")}if("string"!=typeof t)return t;var c=n.length;if(0===c)return t;for(var l="",f=1-o,h=-1,d=t&&t.length||0,p=0;p<d;){if(37===t.charCodeAt(p)&&p+1<d){switch(h=h>-1?h:0,t.charCodeAt(p+1)){case 100:case 102:if(f>=c||null==n[f])break;h<p&&(l+=t.slice(h,p)),l+=Number(n[f]),h=p+2,p++;break;case 105:if(f>=c||null==n[f])break;h<p&&(l+=t.slice(h,p)),l+=Math.floor(Number(n[f])),h=p+2,p++;break;case 79:case 111:case 106:if(f>=c||void 0===n[f])break;h<p&&(l+=t.slice(h,p));var g=typeof n[f];if("string"===g){l+="'"+n[f]+"'",h=p+2,p++;break}if("function"===g){l+=n[f].name||"<anonymous>",h=p+2,p++;break}l+=i(n[f]),h=p+2,p++;break;case 115:if(f>=c)break;h<p&&(l+=t.slice(h,p)),l+=String(n[f]),h=p+2,p++;break;case 37:h<p&&(l+=t.slice(h,p)),l+="%",h=p+2,p++,f--}++f}++p}return-1===h?t:(h<d&&(l+=t.slice(h)),l)}return Dn=1,Un=t}function qn(){if(Fn)return zn;Fn=1;const e=Hn();zn=i;const t=w().console||{},n={mapHttpRequest:p,mapHttpResponse:p,wrapRequestSerializer:g,wrapResponseSerializer:g,wrapErrorSerializer:g,req:p,res:p,err:h};function r(e,t){return Array.isArray(e)?e.filter((function(e){return"!stdSerializers.err"!==e})):!0===e&&Object.keys(t)}function i(e){(e=e||{}).browser=e.browser||{};const n=e.browser.transmit;if(n&&"function"!=typeof n.send)throw Error("pino: transmit option must have a send function");const s=e.browser.write||t;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},l=r(e.browser.serialize,a);let h=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(h=!1);const p=["error","fatal","warn","info","debug","trace"];"function"==typeof s&&(s.error=s.fatal=s.warn=s.info=s.debug=s.trace=s),!1===e.enabled&&(e.level="silent");const g=e.level||"info",v=Object.create(s);v.log||(v.log=y),Object.defineProperty(v,"levelVal",{get:_}),Object.defineProperty(v,"level",{get:b,set:w});const m={transmit:n,serialize:l,asObject:e.browser.asObject,levels:p,timestamp:d(e)};function _(){return"silent"===this.level?1/0:this.levels.values[this.level]}function b(){return this._level}function w(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,o(m,v,"error","log"),o(m,v,"fatal","error"),o(m,v,"warn","error"),o(m,v,"info","log"),o(m,v,"debug","log"),o(m,v,"trace","log")}function E(t,r){if(!t)throw new Error("missing bindings for child Pino");r=r||{},l&&t.serializers&&(r.serializers=t.serializers);const i=r.serializers;if(l&&i){var o=Object.assign({},a,i),s=!0===e.browser.serialize?Object.keys(o):l;delete t.serializers,u([t],s,o,this._stdErrSerialize)}function h(e){this._childLevel=1+(0|e._childLevel),this.error=c(e,t,"error"),this.fatal=c(e,t,"fatal"),this.warn=c(e,t,"warn"),this.info=c(e,t,"info"),this.debug=c(e,t,"debug"),this.trace=c(e,t,"trace"),o&&(this.serializers=o,this._serialize=s),n&&(this._logEvent=f([].concat(e._logEvent.bindings,t)))}return h.prototype=this,new h(this)}return v.levels=i.levels,v.level=g,v.setMaxListeners=v.getMaxListeners=v.emit=v.addListener=v.on=v.prependListener=v.once=v.prependOnceListener=v.removeListener=v.removeAllListeners=v.listeners=v.listenerCount=v.eventNames=v.write=v.flush=y,v.serializers=a,v._serialize=l,v._stdErrSerialize=h,v.child=E,n&&(v._logEvent=f()),v}function o(e,n,r,i){const o=Object.getPrototypeOf(n);n[r]=n.levelVal>n.levels.values[r]?y:o[r]?o[r]:t[r]||t[i]||y,s(e,n,r)}function s(e,n,r){!e.transmit&&n[r]===y||(n[r]=function(o){return function(){const s=e.timestamp(),c=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var h=0;h<c.length;h++)c[h]=arguments[h];if(e.serialize&&!e.asObject&&u(c,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?o.call(f,a(this,r,c,s)):o.apply(f,c),e.transmit){const t=e.transmit.level||n.level,o=i.levels.values[t],a=i.levels.values[r];if(a<o)return;l(this,{ts:s,methodLevel:r,methodValue:a,transmitLevel:t,transmitValue:i.levels.values[e.transmit.level||n.level],send:e.transmit.send,val:n.levelVal},c)}}}(n[r]))}function a(t,n,r,o){t._serialize&&u(r,t._serialize,t.serializers,t._stdErrSerialize);const s=r.slice();let a=s[0];const c={};o&&(c.time=o),c.level=i.levels.values[n];let l=1+(0|t._childLevel);if(l<1&&(l=1),null!==a&&"object"==typeof a){for(;l--&&"object"==typeof s[0];)Object.assign(c,s.shift());a=s.length?e(s.shift(),s):void 0}else"string"==typeof a&&(a=e(s.shift(),s));return void 0!==a&&(c.msg=a),c}function u(e,t,n,r){for(const o in e)if(r&&e[o]instanceof Error)e[o]=i.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o]))for(const r in e[o])t&&t.indexOf(r)>-1&&r in n&&(e[o][r]=n[r](e[o][r]))}function c(e,t,n){return function(){const r=new Array(1+arguments.length);r[0]=t;for(var i=1;i<r.length;i++)r[i]=arguments[i-1];return e[n].apply(this,r)}}function l(e,t,n){const r=t.send,i=t.ts,o=t.methodLevel,s=t.methodValue,a=t.val,c=e._logEvent.bindings;u(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=o,e._logEvent.level.value=s,r(o,e._logEvent,a),e._logEvent=f(c)}function f(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function h(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function d(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?v:m}function p(){return{}}function g(e){return e}function y(){}function v(){return!1}function m(){return Date.now()}function _(){return Math.round(Date.now()/1e3)}function b(){return new Date(Date.now()).toISOString()}function w(){function e(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}return i.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},i.stdSerializers=n,i.stdTimeFunctions=Object.assign({},{nullTime:v,epochTime:m,unixTime:_,isoTime:b}),zn}var $n,Vn={};function Wn(){return $n||($n=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.PINO_CUSTOM_CONTEXT_KEY=Vn.PINO_LOGGER_DEFAULTS=void 0,Vn.PINO_LOGGER_DEFAULTS={level:"info"},Vn.PINO_CUSTOM_CONTEXT_KEY="custom_context"),Vn}var Kn,Gn={};function Yn(){if(Kn)return Gn;Kn=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.generateChildLogger=Gn.formatChildLoggerContext=Gn.getLoggerContext=Gn.setBrowserLoggerContext=Gn.getBrowserLoggerContext=Gn.getDefaultLoggerOptions=void 0;const e=Wn();function t(t){return Object.assign(Object.assign({},t),{level:t?.level||e.PINO_LOGGER_DEFAULTS.level})}function n(t,n=e.PINO_CUSTOM_CONTEXT_KEY){return t[n]||""}function r(t,n,r=e.PINO_CUSTOM_CONTEXT_KEY){return t[r]=n,t}function i(t,r=e.PINO_CUSTOM_CONTEXT_KEY){let i="";return i=typeof t.bindings>"u"?n(t,r):t.bindings().context||"",i}function o(t,n,r=e.PINO_CUSTOM_CONTEXT_KEY){const o=i(t,r);return o.trim()?`${o}/${n}`:n}function s(t,n,i=e.PINO_CUSTOM_CONTEXT_KEY){const s=o(t,n,i);return r(t.child({context:s}),s,i)}return Gn.getDefaultLoggerOptions=t,Gn.getBrowserLoggerContext=n,Gn.setBrowserLoggerContext=r,Gn.getLoggerContext=i,Gn.formatChildLoggerContext=o,Gn.generateChildLogger=s,Gn}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pino=void 0;const t=Bn,n=t.__importDefault(qn());Object.defineProperty(e,"pino",{enumerable:!0,get:function(){return n.default}}),t.__exportStar(Wn(),e),t.__exportStar(Yn(),e)}(hn);class Qn extends Jt{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Jn extends Jt{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class Xn{constructor(e,t){this.logger=e,this.core=t}}class Zn extends Jt{constructor(e,t){super(),this.relayer=e,this.logger=t}}class er extends Jt{constructor(e){super()}}class tr{constructor(e,t,n,r){this.core=e,this.logger=t,this.name=n}}class nr extends Jt{constructor(e,t){super(),this.relayer=e,this.logger=t}}class rr extends Jt{constructor(e,t){super(),this.core=e,this.logger=t}}class ir{constructor(e,t){this.projectId=e,this.logger=t}}class or{constructor(e,t){this.projectId=e,this.logger=t}}class sr{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class ar{constructor(e){this.client=e}}var ur={},cr={},lr={},fr={};Object.defineProperty(fr,"__esModule",{value:!0}),fr.BrowserRandomSource=void 0;const hr=65536;class dr{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let e=0;e<t.length;e+=hr)this._crypto.getRandomValues(t.subarray(e,e+Math.min(t.length-e,hr)));return t}}function pr(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}fr.BrowserRandomSource=dr;var gr={},yr={};function vr(e){for(var t=0;t<e.length;t++)e[t]=0;return e}Object.defineProperty(yr,"__esModule",{value:!0}),yr.wipe=vr;var mr={},_r=r(Object.freeze({__proto__:null,default:mr}));Object.defineProperty(gr,"__esModule",{value:!0}),gr.NodeRandomSource=void 0;const br=yr;class wr{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof pr<"u"){const e=_r;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let e=0;e<n.length;e++)n[e]=t[e];return(0,br.wipe)(t),n}}gr.NodeRandomSource=wr,Object.defineProperty(lr,"__esModule",{value:!0}),lr.SystemRandomSource=void 0;const Er=fr,Sr=gr;class Or{constructor(){return this.isAvailable=!1,this.name="",this._source=new Er.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new Sr.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}lr.SystemRandomSource=Or;var Ir={},xr={};(function(e){function t(e,t){var n=65535&e,r=65535&t;return n*r+((e>>>16&65535)*r+n*(t>>>16&65535)<<16>>>0)|0}function n(e,t){return e+t|0}function r(e,t){return e-t|0}function i(e,t){return e<<t|e>>>32-t}function o(e,t){return e<<32-t|e>>>t}function s(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||t,e.add=n,e.sub=r,e.rotl=i,e.rotr=o,e.isInteger=Number.isInteger||s,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}})(xr),Object.defineProperty(Ir,"__esModule",{value:!0});var Rr=xr;function kr(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16}function Cr(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0}function Pr(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16}function Ar(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0}function Nr(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>8,t[n+1]=e>>>0,t}function Tr(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t}function Mr(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Lr(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function jr(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function Ur(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function Dr(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>24,t[n+1]=e>>>16,t[n+2]=e>>>8,t[n+3]=e>>>0,t}function zr(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24,t}function Fr(e,t){void 0===t&&(t=0);var n=Mr(e,t),r=Mr(e,t+4);return 4294967296*n+r-4294967296*(r>>31)}function Br(e,t){return void 0===t&&(t=0),4294967296*Lr(e,t)+Lr(e,t+4)}function Hr(e,t){void 0===t&&(t=0);var n=jr(e,t);return 4294967296*jr(e,t+4)+n-4294967296*(n>>31)}function qr(e,t){void 0===t&&(t=0);var n=Ur(e,t);return 4294967296*Ur(e,t+4)+n}function $r(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),Dr(e/4294967296>>>0,t,n),Dr(e>>>0,t,n+4),t}function Vr(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),zr(e>>>0,t,n),zr(e/4294967296>>>0,t,n+4),t}function Wr(e,t,n){if(void 0===n&&(n=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var r=0,i=1,o=e/8+n-1;o>=n;o--)r+=t[o]*i,i*=256;return r}function Kr(e,t,n){if(void 0===n&&(n=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var r=0,i=1,o=n;o<n+e/8;o++)r+=t[o]*i,i*=256;return r}function Gr(e,t,n,r){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===r&&(r=0),e%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Rr.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var i=1,o=e/8+r-1;o>=r;o--)n[o]=t/i&255,i*=256;return n}function Yr(e,t,n,r){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===r&&(r=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Rr.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var i=1,o=r;o<r+e/8;o++)n[o]=t/i&255,i*=256;return n}function Qr(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)}function Jr(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)}function Xr(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)}function Zr(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)}function ei(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(n,e),t}function ti(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(n,e,!0),t}function ni(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(n,e),t}function ri(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(n,e,!0),t}Ir.readInt16BE=kr,Ir.readUint16BE=Cr,Ir.readInt16LE=Pr,Ir.readUint16LE=Ar,Ir.writeUint16BE=Nr,Ir.writeInt16BE=Nr,Ir.writeUint16LE=Tr,Ir.writeInt16LE=Tr,Ir.readInt32BE=Mr,Ir.readUint32BE=Lr,Ir.readInt32LE=jr,Ir.readUint32LE=Ur,Ir.writeUint32BE=Dr,Ir.writeInt32BE=Dr,Ir.writeUint32LE=zr,Ir.writeInt32LE=zr,Ir.readInt64BE=Fr,Ir.readUint64BE=Br,Ir.readInt64LE=Hr,Ir.readUint64LE=qr,Ir.writeUint64BE=$r,Ir.writeInt64BE=$r,Ir.writeUint64LE=Vr,Ir.writeInt64LE=Vr,Ir.readUintBE=Wr,Ir.readUintLE=Kr,Ir.writeUintBE=Gr,Ir.writeUintLE=Yr,Ir.readFloat32BE=Qr,Ir.readFloat32LE=Jr,Ir.readFloat64BE=Xr,Ir.readFloat64LE=Zr,Ir.writeFloat32BE=ei,Ir.writeFloat32LE=ti,Ir.writeFloat64BE=ni,Ir.writeFloat64LE=ri,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const t=lr,n=Ir,r=yr;function i(t,n=e.defaultRandomSource){return n.randomBytes(t)}function o(t=e.defaultRandomSource){const o=i(4,t),s=(0,n.readUint32LE)(o);return(0,r.wipe)(o),s}e.defaultRandomSource=new t.SystemRandomSource,e.randomBytes=i,e.randomUint32=o;const s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(t,n=s,o=e.defaultRandomSource){if(n.length<2)throw new Error("randomString charset is too short");if(n.length>256)throw new Error("randomString charset is too long");let a="";const u=n.length,c=256-256%u;for(;t>0;){const e=i(Math.ceil(256*t/c),o);for(let r=0;r<e.length&&t>0;r++){const i=e[r];i<c&&(a+=n.charAt(i%u),t--)}(0,r.wipe)(e)}return a}function u(t,n=s,r=e.defaultRandomSource){return a(Math.ceil(t/(Math.log(n.length)/Math.LN2)),n,r)}e.randomString=a,e.randomStringForEntropy=u}(cr);var ii={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Ir,n=yr;e.DIGEST_LENGTH=64,e.BLOCK_SIZE=128;var r=function(){function r(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return r.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},r.prototype.update=function(t,n){if(void 0===n&&(n=t.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var r=0;if(this._bytesHashed+=n,this._bufferLength>0){for(;this._bufferLength<e.BLOCK_SIZE&&n>0;)this._buffer[this._bufferLength++]=t[r++],n--;this._bufferLength===this.blockSize&&(o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(n>=this.blockSize&&(r=o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,t,r,n),n%=this.blockSize);n>0;)this._buffer[this._bufferLength++]=t[r++],n--;return this},r.prototype.finish=function(e){if(!this._finished){var n=this._bytesHashed,r=this._bufferLength,i=n/536870912|0,s=n<<3,a=n%128<112?128:256;this._buffer[r]=128;for(var u=r+1;u<a-8;u++)this._buffer[u]=0;t.writeUint32BE(i,this._buffer,a-8),t.writeUint32BE(s,this._buffer,a-4),o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,a),this._finished=!0}for(u=0;u<this.digestLength/8;u++)t.writeUint32BE(this._stateHi[u],e,8*u),t.writeUint32BE(this._stateLo[u],e,8*u+4);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){n.wipe(e.stateHi),n.wipe(e.stateLo),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();e.SHA512=r;var i=new Int32Array([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]);function o(e,n,r,o,s,a,u){for(var c,l,f,h,d,p,g,y,v=r[0],m=r[1],_=r[2],b=r[3],w=r[4],E=r[5],S=r[6],O=r[7],I=o[0],x=o[1],R=o[2],k=o[3],C=o[4],P=o[5],A=o[6],N=o[7];u>=128;){for(var T=0;T<16;T++){var M=8*T+a;e[T]=t.readUint32BE(s,M),n[T]=t.readUint32BE(s,M+4)}for(T=0;T<80;T++){var L=v,j=m,U=_,D=b,z=w,F=E,B=S,H=O,q=I,$=x,V=R,W=k,K=C,G=P,Y=A,Q=N;if(d=65535&(l=N),p=l>>>16,g=65535&(c=O),y=c>>>16,d+=65535&(l=(C>>>14|w<<18)^(C>>>18|w<<14)^(w>>>9|C<<23)),p+=l>>>16,g+=65535&(c=(w>>>14|C<<18)^(w>>>18|C<<14)^(C>>>9|w<<23)),y+=c>>>16,d+=65535&(l=C&P^~C&A),p+=l>>>16,g+=65535&(c=w&E^~w&S),y+=c>>>16,c=i[2*T],d+=65535&(l=i[2*T+1]),p+=l>>>16,g+=65535&c,y+=c>>>16,c=e[T%16],p+=(l=n[T%16])>>>16,g+=65535&c,y+=c>>>16,g+=(p+=(d+=65535&l)>>>16)>>>16,d=65535&(l=h=65535&d|p<<16),p=l>>>16,g=65535&(c=f=65535&g|(y+=g>>>16)<<16),y=c>>>16,d+=65535&(l=(I>>>28|v<<4)^(v>>>2|I<<30)^(v>>>7|I<<25)),p+=l>>>16,g+=65535&(c=(v>>>28|I<<4)^(I>>>2|v<<30)^(I>>>7|v<<25)),y+=c>>>16,p+=(l=I&x^I&R^x&R)>>>16,g+=65535&(c=v&m^v&_^m&_),y+=c>>>16,H=65535&(g+=(p+=(d+=65535&l)>>>16)>>>16)|(y+=g>>>16)<<16,Q=65535&d|p<<16,d=65535&(l=W),p=l>>>16,g=65535&(c=D),y=c>>>16,p+=(l=h)>>>16,g+=65535&(c=f),y+=c>>>16,m=L,_=j,b=U,w=D=65535&(g+=(p+=(d+=65535&l)>>>16)>>>16)|(y+=g>>>16)<<16,E=z,S=F,O=B,v=H,x=q,R=$,k=V,C=W=65535&d|p<<16,P=K,A=G,N=Y,I=Q,T%16==15)for(M=0;M<16;M++)c=e[M],d=65535&(l=n[M]),p=l>>>16,g=65535&c,y=c>>>16,c=e[(M+9)%16],d+=65535&(l=n[(M+9)%16]),p+=l>>>16,g+=65535&c,y+=c>>>16,f=e[(M+1)%16],d+=65535&(l=((h=n[(M+1)%16])>>>1|f<<31)^(h>>>8|f<<24)^(h>>>7|f<<25)),p+=l>>>16,g+=65535&(c=(f>>>1|h<<31)^(f>>>8|h<<24)^f>>>7),y+=c>>>16,f=e[(M+14)%16],p+=(l=((h=n[(M+14)%16])>>>19|f<<13)^(f>>>29|h<<3)^(h>>>6|f<<26))>>>16,g+=65535&(c=(f>>>19|h<<13)^(h>>>29|f<<3)^f>>>6),y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,e[M]=65535&g|y<<16,n[M]=65535&d|p<<16}d=65535&(l=I),p=l>>>16,g=65535&(c=v),y=c>>>16,c=r[0],p+=(l=o[0])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[0]=v=65535&g|y<<16,o[0]=I=65535&d|p<<16,d=65535&(l=x),p=l>>>16,g=65535&(c=m),y=c>>>16,c=r[1],p+=(l=o[1])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[1]=m=65535&g|y<<16,o[1]=x=65535&d|p<<16,d=65535&(l=R),p=l>>>16,g=65535&(c=_),y=c>>>16,c=r[2],p+=(l=o[2])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[2]=_=65535&g|y<<16,o[2]=R=65535&d|p<<16,d=65535&(l=k),p=l>>>16,g=65535&(c=b),y=c>>>16,c=r[3],p+=(l=o[3])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[3]=b=65535&g|y<<16,o[3]=k=65535&d|p<<16,d=65535&(l=C),p=l>>>16,g=65535&(c=w),y=c>>>16,c=r[4],p+=(l=o[4])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[4]=w=65535&g|y<<16,o[4]=C=65535&d|p<<16,d=65535&(l=P),p=l>>>16,g=65535&(c=E),y=c>>>16,c=r[5],p+=(l=o[5])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[5]=E=65535&g|y<<16,o[5]=P=65535&d|p<<16,d=65535&(l=A),p=l>>>16,g=65535&(c=S),y=c>>>16,c=r[6],p+=(l=o[6])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[6]=S=65535&g|y<<16,o[6]=A=65535&d|p<<16,d=65535&(l=N),p=l>>>16,g=65535&(c=O),y=c>>>16,c=r[7],p+=(l=o[7])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,r[7]=O=65535&g|y<<16,o[7]=N=65535&d|p<<16,a+=128,u-=128}return a}function s(e){var t=new r;t.update(e);var n=t.digest();return t.clean(),n}e.hash=s})(ii),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.convertSecretKeyToX25519=e.convertPublicKeyToX25519=e.verify=e.sign=e.extractPublicKeyFromSecretKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.SEED_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=e.SIGNATURE_LENGTH=void 0;const t=cr,n=ii,r=yr;function i(e){const t=new Float64Array(16);if(e)for(let n=0;n<e.length;n++)t[n]=e[n];return t}e.SIGNATURE_LENGTH=64,e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=64,e.SEED_LENGTH=32,new Uint8Array(32)[0]=9;const o=i(),s=i([1]),a=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),c=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),l=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h(e,t){for(let n=0;n<16;n++)e[n]=0|t[n]}function d(e){let t=1;for(let n=0;n<16;n++){let r=e[n]+t+65535;t=Math.floor(r/65536),e[n]=r-65536*t}e[0]+=t-1+37*(t-1)}function p(e,t,n){const r=~(n-1);for(let n=0;n<16;n++){const i=r&(e[n]^t[n]);e[n]^=i,t[n]^=i}}function g(e,t){const n=i(),r=i();for(let e=0;e<16;e++)r[e]=t[e];d(r),d(r),d(r);for(let e=0;e<2;e++){n[0]=r[0]-65517;for(let e=1;e<15;e++)n[e]=r[e]-65535-(n[e-1]>>16&1),n[e-1]&=65535;n[15]=r[15]-32767-(n[14]>>16&1);const e=n[15]>>16&1;n[14]&=65535,p(r,n,1-e)}for(let t=0;t<16;t++)e[2*t]=255&r[t],e[2*t+1]=r[t]>>8}function y(e,t){let n=0;for(let r=0;r<32;r++)n|=e[r]^t[r];return(1&n-1>>>8)-1}function v(e,t){const n=new Uint8Array(32),r=new Uint8Array(32);return g(n,e),g(r,t),y(n,r)}function m(e){const t=new Uint8Array(32);return g(t,e),1&t[0]}function _(e,t){for(let n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function b(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]+n[r]}function w(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]-n[r]}function E(e,t,n){let r,i,o=0,s=0,a=0,u=0,c=0,l=0,f=0,h=0,d=0,p=0,g=0,y=0,v=0,m=0,_=0,b=0,w=0,E=0,S=0,O=0,I=0,x=0,R=0,k=0,C=0,P=0,A=0,N=0,T=0,M=0,L=0,j=n[0],U=n[1],D=n[2],z=n[3],F=n[4],B=n[5],H=n[6],q=n[7],$=n[8],V=n[9],W=n[10],K=n[11],G=n[12],Y=n[13],Q=n[14],J=n[15];r=t[0],o+=r*j,s+=r*U,a+=r*D,u+=r*z,c+=r*F,l+=r*B,f+=r*H,h+=r*q,d+=r*$,p+=r*V,g+=r*W,y+=r*K,v+=r*G,m+=r*Y,_+=r*Q,b+=r*J,r=t[1],s+=r*j,a+=r*U,u+=r*D,c+=r*z,l+=r*F,f+=r*B,h+=r*H,d+=r*q,p+=r*$,g+=r*V,y+=r*W,v+=r*K,m+=r*G,_+=r*Y,b+=r*Q,w+=r*J,r=t[2],a+=r*j,u+=r*U,c+=r*D,l+=r*z,f+=r*F,h+=r*B,d+=r*H,p+=r*q,g+=r*$,y+=r*V,v+=r*W,m+=r*K,_+=r*G,b+=r*Y,w+=r*Q,E+=r*J,r=t[3],u+=r*j,c+=r*U,l+=r*D,f+=r*z,h+=r*F,d+=r*B,p+=r*H,g+=r*q,y+=r*$,v+=r*V,m+=r*W,_+=r*K,b+=r*G,w+=r*Y,E+=r*Q,S+=r*J,r=t[4],c+=r*j,l+=r*U,f+=r*D,h+=r*z,d+=r*F,p+=r*B,g+=r*H,y+=r*q,v+=r*$,m+=r*V,_+=r*W,b+=r*K,w+=r*G,E+=r*Y,S+=r*Q,O+=r*J,r=t[5],l+=r*j,f+=r*U,h+=r*D,d+=r*z,p+=r*F,g+=r*B,y+=r*H,v+=r*q,m+=r*$,_+=r*V,b+=r*W,w+=r*K,E+=r*G,S+=r*Y,O+=r*Q,I+=r*J,r=t[6],f+=r*j,h+=r*U,d+=r*D,p+=r*z,g+=r*F,y+=r*B,v+=r*H,m+=r*q,_+=r*$,b+=r*V,w+=r*W,E+=r*K,S+=r*G,O+=r*Y,I+=r*Q,x+=r*J,r=t[7],h+=r*j,d+=r*U,p+=r*D,g+=r*z,y+=r*F,v+=r*B,m+=r*H,_+=r*q,b+=r*$,w+=r*V,E+=r*W,S+=r*K,O+=r*G,I+=r*Y,x+=r*Q,R+=r*J,r=t[8],d+=r*j,p+=r*U,g+=r*D,y+=r*z,v+=r*F,m+=r*B,_+=r*H,b+=r*q,w+=r*$,E+=r*V,S+=r*W,O+=r*K,I+=r*G,x+=r*Y,R+=r*Q,k+=r*J,r=t[9],p+=r*j,g+=r*U,y+=r*D,v+=r*z,m+=r*F,_+=r*B,b+=r*H,w+=r*q,E+=r*$,S+=r*V,O+=r*W,I+=r*K,x+=r*G,R+=r*Y,k+=r*Q,C+=r*J,r=t[10],g+=r*j,y+=r*U,v+=r*D,m+=r*z,_+=r*F,b+=r*B,w+=r*H,E+=r*q,S+=r*$,O+=r*V,I+=r*W,x+=r*K,R+=r*G,k+=r*Y,C+=r*Q,P+=r*J,r=t[11],y+=r*j,v+=r*U,m+=r*D,_+=r*z,b+=r*F,w+=r*B,E+=r*H,S+=r*q,O+=r*$,I+=r*V,x+=r*W,R+=r*K,k+=r*G,C+=r*Y,P+=r*Q,A+=r*J,r=t[12],v+=r*j,m+=r*U,_+=r*D,b+=r*z,w+=r*F,E+=r*B,S+=r*H,O+=r*q,I+=r*$,x+=r*V,R+=r*W,k+=r*K,C+=r*G,P+=r*Y,A+=r*Q,N+=r*J,r=t[13],m+=r*j,_+=r*U,b+=r*D,w+=r*z,E+=r*F,S+=r*B,O+=r*H,I+=r*q,x+=r*$,R+=r*V,k+=r*W,C+=r*K,P+=r*G,A+=r*Y,N+=r*Q,T+=r*J,r=t[14],_+=r*j,b+=r*U,w+=r*D,E+=r*z,S+=r*F,O+=r*B,I+=r*H,x+=r*q,R+=r*$,k+=r*V,C+=r*W,P+=r*K,A+=r*G,N+=r*Y,T+=r*Q,M+=r*J,r=t[15],b+=r*j,w+=r*U,E+=r*D,S+=r*z,O+=r*F,I+=r*B,x+=r*H,R+=r*q,k+=r*$,C+=r*V,P+=r*W,A+=r*K,N+=r*G,T+=r*Y,M+=r*Q,L+=r*J,o+=38*w,s+=38*E,a+=38*S,u+=38*O,c+=38*I,l+=38*x,f+=38*R,h+=38*k,d+=38*C,p+=38*P,g+=38*A,y+=38*N,v+=38*T,m+=38*M,_+=38*L,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=h,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=v,e[13]=m,e[14]=_,e[15]=b}function S(e,t){E(e,t,t)}function O(e,t){const n=i();let r;for(r=0;r<16;r++)n[r]=t[r];for(r=253;r>=0;r--)S(n,n),2!==r&&4!==r&&E(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}function I(e,t){const n=i();let r;for(r=0;r<16;r++)n[r]=t[r];for(r=250;r>=0;r--)S(n,n),1!==r&&E(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}function x(e,t){const n=i(),r=i(),o=i(),s=i(),a=i(),c=i(),l=i(),f=i(),h=i();w(n,e[1],e[0]),w(h,t[1],t[0]),E(n,n,h),b(r,e[0],e[1]),b(h,t[0],t[1]),E(r,r,h),E(o,e[3],t[3]),E(o,o,u),E(s,e[2],t[2]),b(s,s,s),w(a,r,n),w(c,s,o),b(l,s,o),b(f,r,n),E(e[0],a,c),E(e[1],f,l),E(e[2],l,c),E(e[3],a,f)}function R(e,t,n){for(let r=0;r<4;r++)p(e[r],t[r],n)}function k(e,t){const n=i(),r=i(),o=i();O(o,t[2]),E(n,t[0],o),E(r,t[1],o),g(e,r),e[31]^=m(n)<<7}function C(e,t,n){h(e[0],o),h(e[1],s),h(e[2],s),h(e[3],o);for(let r=255;r>=0;--r){const i=n[r/8|0]>>(7&r)&1;R(e,t,i),x(t,e),x(e,e),R(e,t,i)}}function P(e,t){const n=[i(),i(),i(),i()];h(n[0],c),h(n[1],l),h(n[2],s),E(n[3],c,l),C(e,n,t)}function A(t){if(t.length!==e.SEED_LENGTH)throw new Error(`ed25519: seed must be ${e.SEED_LENGTH} bytes`);const r=(0,n.hash)(t);r[0]&=248,r[31]&=127,r[31]|=64;const o=new Uint8Array(32),s=[i(),i(),i(),i()];P(s,r),k(o,s);const a=new Uint8Array(64);return a.set(t),a.set(o,32),{publicKey:o,secretKey:a}}function N(e){const n=(0,t.randomBytes)(32,e),i=A(n);return(0,r.wipe)(n),i}function T(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${e.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}e.generateKeyPairFromSeed=A,e.generateKeyPair=N,e.extractPublicKeyFromSecretKey=T;const M=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function L(e,t){let n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i<o;++i)t[i]+=n-16*t[r]*M[i-(r-32)],n=Math.floor((t[i]+128)/256),t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*M[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*M[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function j(e){const t=new Float64Array(64);for(let n=0;n<64;n++)t[n]=e[n];for(let t=0;t<64;t++)e[t]=0;L(e,t)}function U(e,t){const r=new Float64Array(64),o=[i(),i(),i(),i()],s=(0,n.hash)(e.subarray(0,32));s[0]&=248,s[31]&=127,s[31]|=64;const a=new Uint8Array(64);a.set(s.subarray(32),32);const u=new n.SHA512;u.update(a.subarray(32)),u.update(t);const c=u.digest();u.clean(),j(c),P(o,c),k(a,o),u.reset(),u.update(a.subarray(0,32)),u.update(e.subarray(32)),u.update(t);const l=u.digest();j(l);for(let e=0;e<32;e++)r[e]=c[e];for(let e=0;e<32;e++)for(let t=0;t<32;t++)r[e+t]+=l[e]*s[t];return L(a.subarray(32),r),a}function D(e,t){const n=i(),r=i(),u=i(),c=i(),l=i(),d=i(),p=i();return h(e[2],s),_(e[1],t),S(u,e[1]),E(c,u,a),w(u,u,e[2]),b(c,e[2],c),S(l,c),S(d,l),E(p,d,l),E(n,p,u),E(n,n,c),I(n,n),E(n,n,u),E(n,n,c),E(n,n,c),E(e[0],n,c),S(r,e[0]),E(r,r,c),v(r,u)&&E(e[0],e[0],f),S(r,e[0]),E(r,r,c),v(r,u)?-1:(m(e[0])===t[31]>>7&&w(e[0],o,e[0]),E(e[3],e[0],e[1]),0)}function z(t,r,o){const s=new Uint8Array(32),a=[i(),i(),i(),i()],u=[i(),i(),i(),i()];if(o.length!==e.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${e.SIGNATURE_LENGTH} bytes`);if(D(u,t))return!1;const c=new n.SHA512;c.update(o.subarray(0,32)),c.update(t),c.update(r);const l=c.digest();return j(l),C(a,u,l),P(u,o.subarray(32)),x(a,u),k(s,a),!y(o,s)}function F(e){let t=[i(),i(),i(),i()];if(D(t,e))throw new Error("Ed25519: invalid public key");let n=i(),r=i(),o=t[1];b(n,s,o),w(r,s,o),O(r,r),E(n,n,r);let a=new Uint8Array(32);return g(a,n),a}function B(e){const t=(0,n.hash)(e.subarray(0,32));t[0]&=248,t[31]&=127,t[31]|=64;const i=new Uint8Array(t.subarray(0,32));return(0,r.wipe)(t),i}e.sign=U,e.verify=z,e.convertPublicKeyToX25519=F,e.convertSecretKeyToX25519=B}(ur);const oi="EdDSA",si="JWT",ai=".",ui="base64url",ci="utf8",li="utf8",fi=":",hi="did",di="key",pi="base58btc",gi="z",yi="K36",vi=32;function mi(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function _i(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?mi(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function bi(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const n=_i(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return mi(n)}function wi(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function f(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*l+1>>>0,c=new Uint8Array(s);i!==o;){for(var f=t[i],h=0,d=s-1;(0!==f||h<r)&&-1!==d;d--,h++)f+=256*c[d]>>>0,c[d]=f%a>>>0,f=f/a>>>0;if(0!==f)throw new Error("Non-zero carry");r=h,i++}for(var p=s-r;p!==s&&0===c[p];)p++;for(var g=u.repeat(n);p<s;++p)g+=e.charAt(c[p]);return g}function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var r=0,i=0;e[t]===u;)r++,t++;for(var o=(e.length-t)*c+1>>>0,s=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var f=0,h=o-1;(0!==l||f<i)&&-1!==h;h--,f++)l+=a*s[h]>>>0,s[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=o-i;d!==o&&0===s[d];)d++;for(var p=new Uint8Array(r+(o-d)),g=r;d!==o;)p[g++]=s[d++];return p}}}function d(e){var n=h(e);if(n)return n;throw new Error(`Non-${t} character`)}return{encode:f,decodeUnsafe:h,decode:d}}var Ei=wi;const Si=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Oi=e=>(new TextEncoder).encode(e),Ii=e=>(new TextDecoder).decode(e);class xi{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Ri{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Ci(this,e)}}class ki{constructor(e){this.decoders=e}or(e){return Ci(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Ci=(e,t)=>new ki({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class Pi{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new xi(e,t,n),this.decoder=new Ri(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Ai=({name:e,prefix:t,encode:n,decode:r})=>new Pi(e,t,n,r),Ni=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=Ei(n,t);return Ai({prefix:e,name:t,encode:r,decode:e=>Si(i(e))})},Ti=(e,t,n,r)=>{const i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*n/8|0);let a=0,u=0,c=0;for(let t=0;t<o;++t){const o=i[e[t]];if(void 0===o)throw new SyntaxError(`Non-${r} character`);u=u<<n|o,a+=n,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=n||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s},Mi=(e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let r=0;r<e.length;++r)for(a=a<<8|e[r],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o},Li=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>Ai({prefix:t,name:e,encode:e=>Mi(e,r,n),decode:t=>Ti(t,r,n,e)}),ji=Ai({prefix:"\0",name:"identity",encode:e=>Ii(e),decode:e=>Oi(e)});var Ui=Object.freeze({__proto__:null,identity:ji});const Di=Li({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var zi=Object.freeze({__proto__:null,base2:Di});const Fi=Li({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Bi=Object.freeze({__proto__:null,base8:Fi});const Hi=Ni({prefix:"9",name:"base10",alphabet:"0123456789"});var qi=Object.freeze({__proto__:null,base10:Hi});const $i=Li({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Vi=Li({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Wi=Object.freeze({__proto__:null,base16:$i,base16upper:Vi});const Ki=Li({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Gi=Li({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Yi=Li({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Qi=Li({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ji=Li({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Xi=Li({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zi=Li({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),eo=Li({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),to=Li({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var no=Object.freeze({__proto__:null,base32:Ki,base32upper:Gi,base32pad:Yi,base32padupper:Qi,base32hex:Ji,base32hexupper:Xi,base32hexpad:Zi,base32hexpadupper:eo,base32z:to});const ro=Ni({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),io=Ni({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var oo=Object.freeze({__proto__:null,base36:ro,base36upper:io});const so=Ni({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ao=Ni({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var uo=Object.freeze({__proto__:null,base58btc:so,base58flickr:ao});const co=Li({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),lo=Li({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),fo=Li({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ho=Li({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var po=Object.freeze({__proto__:null,base64:co,base64pad:lo,base64url:fo,base64urlpad:ho});const go=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),yo=go.reduce(((e,t,n)=>(e[n]=t,e)),[]),vo=go.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);function mo(e){return e.reduce(((e,t)=>e+=yo[t]),"")}function _o(e){const t=[];for(const n of e){const e=vo[n.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}const bo=Ai({prefix:"🚀",name:"base256emoji",encode:mo,decode:_o});var wo=Object.freeze({__proto__:null,base256emoji:bo}),Eo=xo,So=128,Oo=-128,Io=Math.pow(2,31);function xo(e,t,n){t=t||[];for(var r=n=n||0;e>=Io;)t[n++]=255&e|So,e/=128;for(;e&Oo;)t[n++]=255&e|So,e>>>=7;return t[n]=0|e,xo.bytes=n-r+1,t}var Ro=Po,ko=128,Co=127;function Po(e,t){var n,r=0,i=0,o=t=t||0,s=e.length;do{if(o>=s)throw Po.bytes=0,new RangeError("Could not decode varint");n=e[o++],r+=i<28?(n&Co)<<i:(n&Co)*Math.pow(2,i),i+=7}while(n>=ko);return Po.bytes=o-t,r}var Ao=Math.pow(2,7),No=Math.pow(2,14),To=Math.pow(2,21),Mo=Math.pow(2,28),Lo=Math.pow(2,35),jo=Math.pow(2,42),Uo=Math.pow(2,49),Do=Math.pow(2,56),zo=Math.pow(2,63),Fo=function(e){return e<Ao?1:e<No?2:e<To?3:e<Mo?4:e<Lo?5:e<jo?6:e<Uo?7:e<Do?8:e<zo?9:10},Bo={encode:Eo,decode:Ro,encodingLength:Fo};const Ho=(e,t,n=0)=>(Bo.encode(e,t,n),t),qo=e=>Bo.encodingLength(e),$o=(e,t)=>{const n=t.byteLength,r=qo(e),i=r+qo(n),o=new Uint8Array(i+n);return Ho(e,o,0),Ho(n,o,r),o.set(t,i),new Vo(e,n,t,o)};class Vo{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const Wo=({name:e,code:t,encode:n})=>new Ko(e,t,n);class Ko{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?$o(this.code,t):t.then((e=>$o(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Go=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Yo=Wo({name:"sha2-256",code:18,encode:Go("SHA-256")}),Qo=Wo({name:"sha2-512",code:19,encode:Go("SHA-512")});Object.freeze({__proto__:null,sha256:Yo,sha512:Qo});const Jo=0,Xo="identity",Zo=Si;Object.freeze({__proto__:null,identity:{code:Jo,name:Xo,encode:Zo,digest:e=>$o(Jo,Zo(e))}}),new TextEncoder,new TextDecoder;const es={...Ui,...zi,...Bi,...qi,...Wi,...no,...oo,...uo,...po,...wo};function ts(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const ns=ts("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),rs=ts("ascii","a",(e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}),(e=>{const t=_i((e=e.substring(1)).length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t})),is={utf8:ns,"utf-8":ns,hex:es.base16,latin1:rs,ascii:rs,binary:rs,...es};function os(e,t="utf8"){const n=is[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}function ss(e,t="utf8"){const n=is[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode(`${n.prefix}${e}`):mi(globalThis.Buffer.from(e,"utf-8"))}function as(e){return os(ss(ue(e),ci),ui)}function us(e){const t=ss(yi,pi),n=gi+os(bi([t,e]),pi);return[hi,di,n].join(fi)}function cs(e){return os(e,ui)}function ls(e){return ss([as(e.header),as(e.payload)].join(ai),li)}function fs(e){return[as(e.header),as(e.payload),cs(e.signature)].join(ai)}function hs(e=cr.randomBytes(vi)){return ur.generateKeyPairFromSeed(e)}async function ds(e,t,n,r,i=Qe.fromMiliseconds(Date.now())){const o={alg:oi,typ:si},s={iss:us(r.publicKey),sub:e,aud:t,iat:i,exp:i+n},a=ls({header:o,payload:s});return fs({header:o,payload:s,signature:ur.sign(r.secretKey,a)})}var ps={},gs={};Object.defineProperty(gs,"__esModule",{value:!0});var ys=Ir,vs=yr,ms=20;function _s(e,t,n){for(var r=1634760805,i=857760878,o=2036477234,s=1797285236,a=n[3]<<24|n[2]<<16|n[1]<<8|n[0],u=n[7]<<24|n[6]<<16|n[5]<<8|n[4],c=n[11]<<24|n[10]<<16|n[9]<<8|n[8],l=n[15]<<24|n[14]<<16|n[13]<<8|n[12],f=n[19]<<24|n[18]<<16|n[17]<<8|n[16],h=n[23]<<24|n[22]<<16|n[21]<<8|n[20],d=n[27]<<24|n[26]<<16|n[25]<<8|n[24],p=n[31]<<24|n[30]<<16|n[29]<<8|n[28],g=t[3]<<24|t[2]<<16|t[1]<<8|t[0],y=t[7]<<24|t[6]<<16|t[5]<<8|t[4],v=t[11]<<24|t[10]<<16|t[9]<<8|t[8],m=t[15]<<24|t[14]<<16|t[13]<<8|t[12],_=r,b=i,w=o,E=s,S=a,O=u,I=c,x=l,R=f,k=h,C=d,P=p,A=g,N=y,T=v,M=m,L=0;L<ms;L+=2)S=(S^=R=R+(A=(A^=_=_+S|0)>>>16|A<<16)|0)>>>20|S<<12,O=(O^=k=k+(N=(N^=b=b+O|0)>>>16|N<<16)|0)>>>20|O<<12,I=(I^=C=C+(T=(T^=w=w+I|0)>>>16|T<<16)|0)>>>20|I<<12,x=(x^=P=P+(M=(M^=E=E+x|0)>>>16|M<<16)|0)>>>20|x<<12,I=(I^=C=C+(T=(T^=w=w+I|0)>>>24|T<<8)|0)>>>25|I<<7,x=(x^=P=P+(M=(M^=E=E+x|0)>>>24|M<<8)|0)>>>25|x<<7,O=(O^=k=k+(N=(N^=b=b+O|0)>>>24|N<<8)|0)>>>25|O<<7,S=(S^=R=R+(A=(A^=_=_+S|0)>>>24|A<<8)|0)>>>25|S<<7,O=(O^=C=C+(M=(M^=_=_+O|0)>>>16|M<<16)|0)>>>20|O<<12,I=(I^=P=P+(A=(A^=b=b+I|0)>>>16|A<<16)|0)>>>20|I<<12,x=(x^=R=R+(N=(N^=w=w+x|0)>>>16|N<<16)|0)>>>20|x<<12,S=(S^=k=k+(T=(T^=E=E+S|0)>>>16|T<<16)|0)>>>20|S<<12,x=(x^=R=R+(N=(N^=w=w+x|0)>>>24|N<<8)|0)>>>25|x<<7,S=(S^=k=k+(T=(T^=E=E+S|0)>>>24|T<<8)|0)>>>25|S<<7,I=(I^=P=P+(A=(A^=b=b+I|0)>>>24|A<<8)|0)>>>25|I<<7,O=(O^=C=C+(M=(M^=_=_+O|0)>>>24|M<<8)|0)>>>25|O<<7;ys.writeUint32LE(_+r|0,e,0),ys.writeUint32LE(b+i|0,e,4),ys.writeUint32LE(w+o|0,e,8),ys.writeUint32LE(E+s|0,e,12),ys.writeUint32LE(S+a|0,e,16),ys.writeUint32LE(O+u|0,e,20),ys.writeUint32LE(I+c|0,e,24),ys.writeUint32LE(x+l|0,e,28),ys.writeUint32LE(R+f|0,e,32),ys.writeUint32LE(k+h|0,e,36),ys.writeUint32LE(C+d|0,e,40),ys.writeUint32LE(P+p|0,e,44),ys.writeUint32LE(A+g|0,e,48),ys.writeUint32LE(N+y|0,e,52),ys.writeUint32LE(T+v|0,e,56),ys.writeUint32LE(M+m|0,e,60)}function bs(e,t,n,r,i){if(void 0===i&&(i=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(r.length<n.length)throw new Error("ChaCha: destination is shorter than source");var o,s;if(0===i){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=(o=new Uint8Array(16)).length-t.length,o.set(t,s)}else{if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");o=t,s=i}for(var a=new Uint8Array(64),u=0;u<n.length;u+=64){_s(a,o,e);for(var c=u;c<u+64&&c<n.length;c++)r[c]=n[c]^a[c-u];Es(o,0,s)}return vs.wipe(a),0===i&&vs.wipe(o),r}function ws(e,t,n,r){return void 0===r&&(r=0),vs.wipe(n),bs(e,t,n,n,r)}function Es(e,t,n){for(var r=1;n--;)r=r+(255&e[t])|0,e[t]=255&r,r>>>=8,t++;if(r>0)throw new Error("ChaCha: counter overflow")}gs.streamXOR=bs,gs.stream=ws;var Ss={},Os={};function Is(e,t,n){return~(e-1)&t|e-1&n}function xs(e,t){return(0|e)-(0|t)-1>>>31&1}function Rs(e,t){if(e.length!==t.length)return 0;for(var n=0,r=0;r<e.length;r++)n|=e[r]^t[r];return 1&n-1>>>8}function ks(e,t){return 0!==e.length&&0!==t.length&&0!==Rs(e,t)}Object.defineProperty(Os,"__esModule",{value:!0}),Os.select=Is,Os.lessOrEqual=xs,Os.compare=Rs,Os.equal=ks,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Os,n=yr;e.DIGEST_LENGTH=16;var r=function(){function t(t){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var n=t[0]|t[1]<<8;this._r[0]=8191&n;var r=t[2]|t[3]<<8;this._r[1]=8191&(n>>>13|r<<3);var i=t[4]|t[5]<<8;this._r[2]=7939&(r>>>10|i<<6);var o=t[6]|t[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=t[8]|t[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=t[10]|t[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var u=t[12]|t[13]<<8;this._r[7]=8065&(a>>>11|u<<5);var c=t[14]|t[15]<<8;this._r[8]=8191&(u>>>8|c<<8),this._r[9]=c>>>5&127,this._pad[0]=t[16]|t[17]<<8,this._pad[1]=t[18]|t[19]<<8,this._pad[2]=t[20]|t[21]<<8,this._pad[3]=t[22]|t[23]<<8,this._pad[4]=t[24]|t[25]<<8,this._pad[5]=t[26]|t[27]<<8,this._pad[6]=t[28]|t[29]<<8,this._pad[7]=t[30]|t[31]<<8}return t.prototype._blocks=function(e,t,n){for(var r=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],u=this._h[4],c=this._h[5],l=this._h[6],f=this._h[7],h=this._h[8],d=this._h[9],p=this._r[0],g=this._r[1],y=this._r[2],v=this._r[3],m=this._r[4],_=this._r[5],b=this._r[6],w=this._r[7],E=this._r[8],S=this._r[9];n>=16;){var O=e[t+0]|e[t+1]<<8;i+=8191&O;var I=e[t+2]|e[t+3]<<8;o+=8191&(O>>>13|I<<3);var x=e[t+4]|e[t+5]<<8;s+=8191&(I>>>10|x<<6);var R=e[t+6]|e[t+7]<<8;a+=8191&(x>>>7|R<<9);var k=e[t+8]|e[t+9]<<8;u+=8191&(R>>>4|k<<12),c+=k>>>1&8191;var C=e[t+10]|e[t+11]<<8;l+=8191&(k>>>14|C<<2);var P=e[t+12]|e[t+13]<<8;f+=8191&(C>>>11|P<<5);var A=e[t+14]|e[t+15]<<8,N=0,T=N;T+=i*p,T+=o*(5*S),T+=s*(5*E),T+=a*(5*w),N=(T+=u*(5*b))>>>13,T&=8191,T+=c*(5*_),T+=l*(5*m),T+=f*(5*v),T+=(h+=8191&(P>>>8|A<<8))*(5*y);var M=N+=(T+=(d+=A>>>5|r)*(5*g))>>>13;M+=i*g,M+=o*p,M+=s*(5*S),M+=a*(5*E),N=(M+=u*(5*w))>>>13,M&=8191,M+=c*(5*b),M+=l*(5*_),M+=f*(5*m),M+=h*(5*v),N+=(M+=d*(5*y))>>>13,M&=8191;var L=N;L+=i*y,L+=o*g,L+=s*p,L+=a*(5*S),N=(L+=u*(5*E))>>>13,L&=8191,L+=c*(5*w),L+=l*(5*b),L+=f*(5*_),L+=h*(5*m);var j=N+=(L+=d*(5*v))>>>13;j+=i*v,j+=o*y,j+=s*g,j+=a*p,N=(j+=u*(5*S))>>>13,j&=8191,j+=c*(5*E),j+=l*(5*w),j+=f*(5*b),j+=h*(5*_);var U=N+=(j+=d*(5*m))>>>13;U+=i*m,U+=o*v,U+=s*y,U+=a*g,N=(U+=u*p)>>>13,U&=8191,U+=c*(5*S),U+=l*(5*E),U+=f*(5*w),U+=h*(5*b);var D=N+=(U+=d*(5*_))>>>13;D+=i*_,D+=o*m,D+=s*v,D+=a*y,N=(D+=u*g)>>>13,D&=8191,D+=c*p,D+=l*(5*S),D+=f*(5*E),D+=h*(5*w);var z=N+=(D+=d*(5*b))>>>13;z+=i*b,z+=o*_,z+=s*m,z+=a*v,N=(z+=u*y)>>>13,z&=8191,z+=c*g,z+=l*p,z+=f*(5*S),z+=h*(5*E);var F=N+=(z+=d*(5*w))>>>13;F+=i*w,F+=o*b,F+=s*_,F+=a*m,N=(F+=u*v)>>>13,F&=8191,F+=c*y,F+=l*g,F+=f*p,F+=h*(5*S);var B=N+=(F+=d*(5*E))>>>13;B+=i*E,B+=o*w,B+=s*b,B+=a*_,N=(B+=u*m)>>>13,B&=8191,B+=c*v,B+=l*y,B+=f*g,B+=h*p;var H=N+=(B+=d*(5*S))>>>13;H+=i*S,H+=o*E,H+=s*w,H+=a*b,N=(H+=u*_)>>>13,H&=8191,H+=c*m,H+=l*v,H+=f*y,H+=h*g,i=T=8191&(N=(N=((N+=(H+=d*p)>>>13)<<2)+N|0)+(T&=8191)|0),o=M+=N>>>=13,s=L&=8191,a=j&=8191,u=U&=8191,c=D&=8191,l=z&=8191,f=F&=8191,h=B&=8191,d=H&=8191,t+=16,n-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=u,this._h[5]=c,this._h[6]=l,this._h[7]=f,this._h[8]=h,this._h[9]=d},t.prototype.finish=function(e,t){void 0===t&&(t=0);var n,r,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(n=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=n,n=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*n,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,s[0]=this._h[0]+5,n=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+n,n=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,r=(1^n)-1,o=0;o<10;o++)s[o]&=r;for(r=~r,o=0;o<10;o++)this._h[o]=this._h[o]&r|s[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var t,n=0,r=e.length;if(this._leftover){(t=16-this._leftover)>r&&(t=r);for(var i=0;i<t;i++)this._buffer[this._leftover+i]=e[n+i];if(r-=t,n+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(r>=16&&(t=r-r%16,this._blocks(e,n,t),n+=t,r-=t),r){for(i=0;i<r;i++)this._buffer[this._leftover+i]=e[n+i];this._leftover+=r}return this},t.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},t.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},t}();function i(e,t){var n=new r(e);n.update(t);var i=n.digest();return n.clean(),i}function o(n,r){return n.length===e.DIGEST_LENGTH&&r.length===e.DIGEST_LENGTH&&t.equal(n,r)}e.Poly1305=r,e.oneTimeAuth=i,e.equal=o}(Ss),function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=gs,n=Ss,r=yr,i=Ir,o=Os;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var s=new Uint8Array(16),a=function(){function a(t){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,t.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(t)}return a.prototype.seal=function(e,n,i,o){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);t.stream(this._key,s,a,4);var u,c=n.length+this.tagLength;if(o){if(o.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");u=o}else u=new Uint8Array(c);return t.streamXOR(this._key,s,n,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),a,u.subarray(0,u.length-this.tagLength),i),r.wipe(s),u},a.prototype.open=function(e,n,i,s){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(n.length<this.tagLength)return null;var a=new Uint8Array(16);a.set(e,a.length-e.length);var u=new Uint8Array(32);t.stream(this._key,a,u,4);var c=new Uint8Array(this.tagLength);if(this._authenticate(c,u,n.subarray(0,n.length-this.tagLength),i),!o.equal(c,n.subarray(n.length-this.tagLength,n.length)))return null;var l,f=n.length-this.tagLength;if(s){if(s.length!==f)throw new Error("ChaCha20Poly1305: incorrect destination length");l=s}else l=new Uint8Array(f);return t.streamXOR(this._key,a,n.subarray(0,n.length-this.tagLength),l,4),r.wipe(a),l},a.prototype.clean=function(){return r.wipe(this._key),this},a.prototype._authenticate=function(e,t,o,a){var u=new n.Poly1305(t);a&&(u.update(a),a.length%16>0&&u.update(s.subarray(a.length%16))),u.update(o),o.length%16>0&&u.update(s.subarray(o.length%16));var c=new Uint8Array(8);a&&i.writeUint64LE(a.length,c),u.update(c),i.writeUint64LE(o.length,c),u.update(c);for(var l=u.digest(),f=0;f<l.length;f++)e[f]=l[f];u.clean(),r.wipe(l),r.wipe(c)},a}();e.ChaCha20Poly1305=a}(ps);var Cs={},Ps={},As={};function Ns(e){return typeof e.saveState<"u"&&typeof e.restoreState<"u"&&typeof e.cleanSavedState<"u"}Object.defineProperty(As,"__esModule",{value:!0}),As.isSerializableHash=Ns,Object.defineProperty(Ps,"__esModule",{value:!0});var Ts=As,Ms=Os,Ls=yr,js=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var r=0;r<n.length;r++)n[r]^=54;for(this._inner.update(n),r=0;r<n.length;r++)n[r]^=106;this._outer.update(n),Ts.isSerializableHash(this._inner)&&Ts.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Ls.wipe(n)}return e.prototype.reset=function(){if(!Ts.isSerializableHash(this._inner)||!Ts.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){Ts.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Ts.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(e){return this._inner.update(e),this},e.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!Ts.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!Ts.isSerializableHash(this._inner)||!Ts.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(e){if(!Ts.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},e}();function Us(e,t,n){var r=new js(e,t);r.update(n);var i=r.digest();return r.clean(),i}Ps.HMAC=js,Ps.hmac=Us,Ps.equal=Ms.equal,Object.defineProperty(Cs,"__esModule",{value:!0});var Ds=Ps,zs=yr,Fs=function(){function e(e,t,n,r){void 0===n&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=r;var i=Ds.hmac(this._hash,n,t);this._hmac=new Ds.HMAC(e,i),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;n<t.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[n]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),zs.wipe(this._buffer),zs.wipe(this._counter),this._bufpos=0},e}(),Bs=Cs.HKDF=Fs,Hs={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Ir,n=yr;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var r=function(){function r(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return r.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=o(this._temp,this._state,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var n=this._bytesHashed,r=this._bufferLength,i=n/536870912|0,s=n<<3,a=n%64<56?64:128;this._buffer[r]=128;for(var u=r+1;u<a-8;u++)this._buffer[u]=0;t.writeUint32BE(i,this._buffer,a-8),t.writeUint32BE(s,this._buffer,a-4),o(this._temp,this._state,this._buffer,0,a),this._finished=!0}for(u=0;u<this.digestLength/4;u++)t.writeUint32BE(this._state[u],e,4*u);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){n.wipe(e.state),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();e.SHA256=r;var i=new Int32Array([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]);function o(e,n,r,o,s){for(;s>=64;){for(var a=n[0],u=n[1],c=n[2],l=n[3],f=n[4],h=n[5],d=n[6],p=n[7],g=0;g<16;g++){var y=o+4*g;e[g]=t.readUint32BE(r,y)}for(g=16;g<64;g++){var v=e[g-2],m=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10,_=((v=e[g-15])>>>7|v<<25)^(v>>>18|v<<14)^v>>>3;e[g]=(m+e[g-7]|0)+(_+e[g-16]|0)}for(g=0;g<64;g++)m=(((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&h^~f&d)|0)+(p+(i[g]+e[g]|0)|0)|0,_=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&u^a&c^u&c)|0,p=d,d=h,h=f,f=l+m|0,l=c,c=u,u=a,a=m+_|0;n[0]+=a,n[1]+=u,n[2]+=c,n[3]+=l,n[4]+=f,n[5]+=h,n[6]+=d,n[7]+=p,o+=64,s-=64}return o}function s(e){var t=new r;t.update(e);var n=t.digest();return t.clean(),n}e.hash=s}(Hs);var qs={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const t=cr,n=yr;function r(e){const t=new Float64Array(16);if(e)for(let n=0;n<e.length;n++)t[n]=e[n];return t}e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;const i=new Uint8Array(32);i[0]=9;const o=r([56129,1]);function s(e){let t=1;for(let n=0;n<16;n++){let r=e[n]+t+65535;t=Math.floor(r/65536),e[n]=r-65536*t}e[0]+=t-1+37*(t-1)}function a(e,t,n){const r=~(n-1);for(let n=0;n<16;n++){const i=r&(e[n]^t[n]);e[n]^=i,t[n]^=i}}function u(e,t){const n=r(),i=r();for(let e=0;e<16;e++)i[e]=t[e];s(i),s(i),s(i);for(let e=0;e<2;e++){n[0]=i[0]-65517;for(let e=1;e<15;e++)n[e]=i[e]-65535-(n[e-1]>>16&1),n[e-1]&=65535;n[15]=i[15]-32767-(n[14]>>16&1);const e=n[15]>>16&1;n[14]&=65535,a(i,n,1-e)}for(let t=0;t<16;t++)e[2*t]=255&i[t],e[2*t+1]=i[t]>>8}function c(e,t){for(let n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function l(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]+n[r]}function f(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]-n[r]}function h(e,t,n){let r,i,o=0,s=0,a=0,u=0,c=0,l=0,f=0,h=0,d=0,p=0,g=0,y=0,v=0,m=0,_=0,b=0,w=0,E=0,S=0,O=0,I=0,x=0,R=0,k=0,C=0,P=0,A=0,N=0,T=0,M=0,L=0,j=n[0],U=n[1],D=n[2],z=n[3],F=n[4],B=n[5],H=n[6],q=n[7],$=n[8],V=n[9],W=n[10],K=n[11],G=n[12],Y=n[13],Q=n[14],J=n[15];r=t[0],o+=r*j,s+=r*U,a+=r*D,u+=r*z,c+=r*F,l+=r*B,f+=r*H,h+=r*q,d+=r*$,p+=r*V,g+=r*W,y+=r*K,v+=r*G,m+=r*Y,_+=r*Q,b+=r*J,r=t[1],s+=r*j,a+=r*U,u+=r*D,c+=r*z,l+=r*F,f+=r*B,h+=r*H,d+=r*q,p+=r*$,g+=r*V,y+=r*W,v+=r*K,m+=r*G,_+=r*Y,b+=r*Q,w+=r*J,r=t[2],a+=r*j,u+=r*U,c+=r*D,l+=r*z,f+=r*F,h+=r*B,d+=r*H,p+=r*q,g+=r*$,y+=r*V,v+=r*W,m+=r*K,_+=r*G,b+=r*Y,w+=r*Q,E+=r*J,r=t[3],u+=r*j,c+=r*U,l+=r*D,f+=r*z,h+=r*F,d+=r*B,p+=r*H,g+=r*q,y+=r*$,v+=r*V,m+=r*W,_+=r*K,b+=r*G,w+=r*Y,E+=r*Q,S+=r*J,r=t[4],c+=r*j,l+=r*U,f+=r*D,h+=r*z,d+=r*F,p+=r*B,g+=r*H,y+=r*q,v+=r*$,m+=r*V,_+=r*W,b+=r*K,w+=r*G,E+=r*Y,S+=r*Q,O+=r*J,r=t[5],l+=r*j,f+=r*U,h+=r*D,d+=r*z,p+=r*F,g+=r*B,y+=r*H,v+=r*q,m+=r*$,_+=r*V,b+=r*W,w+=r*K,E+=r*G,S+=r*Y,O+=r*Q,I+=r*J,r=t[6],f+=r*j,h+=r*U,d+=r*D,p+=r*z,g+=r*F,y+=r*B,v+=r*H,m+=r*q,_+=r*$,b+=r*V,w+=r*W,E+=r*K,S+=r*G,O+=r*Y,I+=r*Q,x+=r*J,r=t[7],h+=r*j,d+=r*U,p+=r*D,g+=r*z,y+=r*F,v+=r*B,m+=r*H,_+=r*q,b+=r*$,w+=r*V,E+=r*W,S+=r*K,O+=r*G,I+=r*Y,x+=r*Q,R+=r*J,r=t[8],d+=r*j,p+=r*U,g+=r*D,y+=r*z,v+=r*F,m+=r*B,_+=r*H,b+=r*q,w+=r*$,E+=r*V,S+=r*W,O+=r*K,I+=r*G,x+=r*Y,R+=r*Q,k+=r*J,r=t[9],p+=r*j,g+=r*U,y+=r*D,v+=r*z,m+=r*F,_+=r*B,b+=r*H,w+=r*q,E+=r*$,S+=r*V,O+=r*W,I+=r*K,x+=r*G,R+=r*Y,k+=r*Q,C+=r*J,r=t[10],g+=r*j,y+=r*U,v+=r*D,m+=r*z,_+=r*F,b+=r*B,w+=r*H,E+=r*q,S+=r*$,O+=r*V,I+=r*W,x+=r*K,R+=r*G,k+=r*Y,C+=r*Q,P+=r*J,r=t[11],y+=r*j,v+=r*U,m+=r*D,_+=r*z,b+=r*F,w+=r*B,E+=r*H,S+=r*q,O+=r*$,I+=r*V,x+=r*W,R+=r*K,k+=r*G,C+=r*Y,P+=r*Q,A+=r*J,r=t[12],v+=r*j,m+=r*U,_+=r*D,b+=r*z,w+=r*F,E+=r*B,S+=r*H,O+=r*q,I+=r*$,x+=r*V,R+=r*W,k+=r*K,C+=r*G,P+=r*Y,A+=r*Q,N+=r*J,r=t[13],m+=r*j,_+=r*U,b+=r*D,w+=r*z,E+=r*F,S+=r*B,O+=r*H,I+=r*q,x+=r*$,R+=r*V,k+=r*W,C+=r*K,P+=r*G,A+=r*Y,N+=r*Q,T+=r*J,r=t[14],_+=r*j,b+=r*U,w+=r*D,E+=r*z,S+=r*F,O+=r*B,I+=r*H,x+=r*q,R+=r*$,k+=r*V,C+=r*W,P+=r*K,A+=r*G,N+=r*Y,T+=r*Q,M+=r*J,r=t[15],b+=r*j,w+=r*U,E+=r*D,S+=r*z,O+=r*F,I+=r*B,x+=r*H,R+=r*q,k+=r*$,C+=r*V,P+=r*W,A+=r*K,N+=r*G,T+=r*Y,M+=r*Q,L+=r*J,o+=38*w,s+=38*E,a+=38*S,u+=38*O,c+=38*I,l+=38*x,f+=38*R,h+=38*k,d+=38*C,p+=38*P,g+=38*A,y+=38*N,v+=38*T,m+=38*M,_+=38*L,i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),i=1,r=o+i+65535,i=Math.floor(r/65536),o=r-65536*i,r=s+i+65535,i=Math.floor(r/65536),s=r-65536*i,r=a+i+65535,i=Math.floor(r/65536),a=r-65536*i,r=u+i+65535,i=Math.floor(r/65536),u=r-65536*i,r=c+i+65535,i=Math.floor(r/65536),c=r-65536*i,r=l+i+65535,i=Math.floor(r/65536),l=r-65536*i,r=f+i+65535,i=Math.floor(r/65536),f=r-65536*i,r=h+i+65535,i=Math.floor(r/65536),h=r-65536*i,r=d+i+65535,i=Math.floor(r/65536),d=r-65536*i,r=p+i+65535,i=Math.floor(r/65536),p=r-65536*i,r=g+i+65535,i=Math.floor(r/65536),g=r-65536*i,r=y+i+65535,i=Math.floor(r/65536),y=r-65536*i,r=v+i+65535,i=Math.floor(r/65536),v=r-65536*i,r=m+i+65535,i=Math.floor(r/65536),m=r-65536*i,r=_+i+65535,i=Math.floor(r/65536),_=r-65536*i,r=b+i+65535,i=Math.floor(r/65536),b=r-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=h,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=v,e[13]=m,e[14]=_,e[15]=b}function d(e,t){h(e,t,t)}function p(e,t){const n=r();for(let e=0;e<16;e++)n[e]=t[e];for(let e=253;e>=0;e--)d(n,n),2!==e&&4!==e&&h(n,n,t);for(let t=0;t<16;t++)e[t]=n[t]}function g(e,t){const n=new Uint8Array(32),i=new Float64Array(80),s=r(),g=r(),y=r(),v=r(),m=r(),_=r();for(let t=0;t<31;t++)n[t]=e[t];n[31]=127&e[31]|64,n[0]&=248,c(i,t);for(let e=0;e<16;e++)g[e]=i[e];s[0]=v[0]=1;for(let e=254;e>=0;--e){const t=n[e>>>3]>>>(7&e)&1;a(s,g,t),a(y,v,t),l(m,s,y),f(s,s,y),l(y,g,v),f(g,g,v),d(v,m),d(_,s),h(s,y,s),h(y,g,m),l(m,s,y),f(s,s,y),d(g,s),f(y,v,_),h(s,y,o),l(s,s,v),h(y,y,s),h(s,v,_),h(v,g,i),d(g,m),a(s,g,t),a(y,v,t)}for(let e=0;e<16;e++)i[e+16]=s[e],i[e+32]=y[e],i[e+48]=g[e],i[e+64]=v[e];const b=i.subarray(32),w=i.subarray(16);p(b,b),h(w,w,b);const E=new Uint8Array(32);return u(E,w),E}function y(e){return g(e,i)}function v(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const n=new Uint8Array(t);return{publicKey:y(n),secretKey:n}}function m(e){const r=(0,t.randomBytes)(32,e),i=v(r);return(0,n.wipe)(r),i}function _(t,n,r=!1){if(t.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(n.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const i=g(t,n);if(r){let e=0;for(let t=0;t<i.length;t++)e|=i[t];if(0===e)throw new Error("X25519: invalid shared key")}return i}e.scalarMult=g,e.scalarMultBase=y,e.generateKeyPairFromSeed=v,e.generateKeyPair=m,e.sharedKey=_}(qs);var $s=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)(r||!(i in t))&&(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},Vs=function(){function e(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return e}(),Ws=function(){function e(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return e}(),Ks=function(){function e(e,t,n,r){this.name=e,this.version=t,this.os=n,this.bot=r,this.type="bot-device"}return e}(),Gs=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),Ys=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),Qs=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Js=3,Xs=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],Zs=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function ea(e){return e?na(e):typeof document>"u"&&typeof navigator<"u"&&"ReactNative"===navigator.product?new Ys:typeof navigator<"u"?na(navigator.userAgent):ia()}function ta(e){return""!==e&&Xs.reduce((function(t,n){var r=n[0],i=n[1];if(t)return t;var o=i.exec(e);return!!o&&[r,o]}),!1)}function na(e){var t=ta(e);if(!t)return null;var n=t[0],r=t[1];if("searchbot"===n)return new Gs;var i=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);i?i.length<Js&&(i=$s($s([],i,!0),oa(Js-i.length),!0)):i=[];var o=i.join("."),s=ra(e),a=Qs.exec(e);return a&&a[1]?new Ks(n,o,s,a[1]):new Vs(n,o,s)}function ra(e){for(var t=0,n=Zs.length;t<n;t++){var r=Zs[t],i=r[0];if(r[1].exec(e))return i}return null}function ia(){return typeof process<"u"&&process.version?new Ws(process.version.slice(1)):null}function oa(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}var sa={};function aa(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}function ua(e){const t=aa(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}function ca(){return ua("document")}function la(){return aa("document")}Object.defineProperty(sa,"__esModule",{value:!0}),sa.getLocalStorage=sa.getLocalStorageOrThrow=sa.getCrypto=sa.getCryptoOrThrow=va=sa.getLocation=sa.getLocationOrThrow=pa=sa.getNavigator=sa.getNavigatorOrThrow=fa=sa.getDocument=sa.getDocumentOrThrow=sa.getFromWindowOrThrow=sa.getFromWindow=void 0,sa.getFromWindow=aa,sa.getFromWindowOrThrow=ua,sa.getDocumentOrThrow=ca;var fa=sa.getDocument=la;function ha(){return ua("navigator")}function da(){return aa("navigator")}sa.getNavigatorOrThrow=ha;var pa=sa.getNavigator=da;function ga(){return ua("location")}function ya(){return aa("location")}sa.getLocationOrThrow=ga;var va=sa.getLocation=ya;function ma(){return ua("crypto")}function _a(){return aa("crypto")}function ba(){return ua("localStorage")}function wa(){return aa("localStorage")}sa.getCryptoOrThrow=ma,sa.getCrypto=_a,sa.getLocalStorageOrThrow=ba,sa.getLocalStorage=wa;var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});var Sa=Ea.getWindowMetadata=void 0;const Oa=sa;function Ia(){let e,t;try{e=Oa.getDocumentOrThrow(),t=Oa.getLocationOrThrow()}catch{return null}function n(){const n=e.getElementsByTagName("link"),r=[];for(let e=0;e<n.length;e++){const i=n[e],o=i.getAttribute("rel");if(o&&o.toLowerCase().indexOf("icon")>-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let n=t.protocol+"//"+t.host;if(0===e.indexOf("/"))n+=e;else{const r=t.pathname.split("/");r.pop(),n+=r.join("/")+"/"+e}r.push(n)}else if(0===e.indexOf("//")){const n=t.protocol+e;r.push(n)}else r.push(e)}}return r}function r(...t){const n=e.getElementsByTagName("meta");for(let e=0;e<n.length;e++){const r=n[e],i=["itemprop","property","name"].map((e=>r.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(i.length&&i){const e=r.getAttribute("content");if(e)return e}}return""}function i(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}function o(){return r("description","og:description","twitter:description","keywords")}const s=i();return{description:o(),url:t.origin,icons:n(),name:s}}Sa=Ea.getWindowMetadata=Ia;var xa={},Ra=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),ka="%[a-f0-9]{2}",Ca=new RegExp("("+ka+")|([^%]+?)","gi"),Pa=new RegExp("("+ka+")+","gi");function Aa(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],Aa(n),Aa(r))}function Na(e){try{return decodeURIComponent(e)}catch{for(var t=e.match(Ca)||[],n=1;n<t.length;n++)t=(e=Aa(t,n).join("")).match(Ca)||[];return e}}function Ta(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=Pa.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch{var r=Na(n[0]);r!==n[0]&&(t[n[0]]=r)}n=Pa.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),o=0;o<i.length;o++){var s=i[o];e=e.replace(new RegExp(s,"g"),t[s])}return e}var Ma=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch{return Ta(e)}},La=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]},ja=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),o=0;o<r.length;o++){var s=r[o],a=e[s];(i?-1!==t.indexOf(s):t(s,a,e))&&(n[s]=a)}return n};!function(e){const t=Ra,n=Ma,r=La,i=ja,o=e=>null==e,s=Symbol("encodeFragmentIdentifier");function a(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[l(t,e),"[",i,"]"].join("")]:[...n,[l(t,e),"[",l(i,e),"]=",l(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[l(t,e),"[]"].join("")]:[...n,[l(t,e),"[]=",l(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[l(t,e),":list="].join("")]:[...n,[l(t,e),":list=",l(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[l(n,e),t,l(i,e)].join("")]:[[r,l(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,l(t,e)]:[...n,[l(t,e),"=",l(r,e)].join("")]}}function u(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"colon-list-separator":return(e,n,r)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"==typeof n&&n.includes(e.arrayFormatSeparator),o="string"==typeof n&&!i&&f(n,e).includes(e.arrayFormatSeparator);n=o?f(n,e):n;const s=i||o?n.split(e.arrayFormatSeparator).map((t=>f(t,e))):null===n?n:f(n,e);r[t]=s};case"bracket-separator":return(t,n,r)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(r[t]=n&&f(n,e));const o=null===n?[]:n.split(e.arrayFormatSeparator).map((t=>f(t,e)));void 0!==r[t]?r[t]=[].concat(r[t],o):r[t]=o};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}function c(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function l(e,n){return n.encode?n.strict?t(e):encodeURIComponent(e):e}function f(e,t){return t.decode?n(e):e}function h(e){return Array.isArray(e)?e.sort():"object"==typeof e?h(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function d(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function p(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}function g(e){const t=(e=d(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function y(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):t.parseBooleans&&null!==e&&("true"===e.toLowerCase()||"false"===e.toLowerCase())&&(e="true"===e.toLowerCase()),e}function v(e,t){c((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=u(t),i=Object.create(null);if("string"!=typeof e||!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const o of e.split("&")){if(""===o)continue;let[e,s]=r(t.decode?o.replace(/\+/g," "):o,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:f(s,t),n(f(e,t),s,i)}for(const e of Object.keys(i)){const n=i[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=y(n[e],t);else i[e]=y(n,t)}return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce(((e,t)=>{const n=i[t];return n&&"object"==typeof n&&!Array.isArray(n)?e[t]=h(n):e[t]=n,e}),Object.create(null))}e.extract=g,e.parse=v,e.stringify=(e,t)=>{if(!e)return"";c((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&o(e[n])||t.skipEmptyString&&""===e[n],r=a(t),i={};for(const t of Object.keys(e))n(t)||(i[t]=e[t]);const s=Object.keys(i);return!1!==t.sort&&s.sort(t.sort),s.map((n=>{const i=e[n];return void 0===i?"":null===i?l(n,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?l(n,t)+"[]":i.reduce(r(n),[]).join("&"):l(n,t)+"="+l(i,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,i]=r(e,"#");return Object.assign({url:n.split("?")[0]||"",query:v(g(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:f(i,t)}:{})},e.stringifyUrl=(t,n)=>{n=Object.assign({encode:!0,strict:!0,[s]:!0},n);const r=d(t.url).split("?")[0]||"",i=e.extract(t.url),o=e.parse(i,{sort:!1}),a=Object.assign(o,t.query);let u=e.stringify(a,n);u&&(u=`?${u}`);let c=p(t.url);return t.fragmentIdentifier&&(c=`#${n[s]?l(t.fragmentIdentifier,n):t.fragmentIdentifier}`),`${r}${u}${c}`},e.pick=(t,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[s]:!1},r);const{url:o,query:a,fragmentIdentifier:u}=e.parseUrl(t,r);return e.stringifyUrl({url:o,query:i(a,n),fragmentIdentifier:u},r)},e.exclude=(t,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return e.pick(t,i,r)}}(xa);const Ua={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}},Da=":";function za(e){const[t,n]=e.split(Da);return{namespace:t,reference:n}}function Fa(e,t){return e.includes(":")?[e]:t.chains||[]}const Ba="base10",Ha="base16",qa="base64pad",$a="utf8",Va=0,Wa=1,Ka=0,Ga=1,Ya=12,Qa=32;function Ja(){const e=qs.generateKeyPair();return{privateKey:os(e.secretKey,Ha),publicKey:os(e.publicKey,Ha)}}function Xa(){return os(cr.randomBytes(Qa),Ha)}function Za(e,t){const n=qs.sharedKey(ss(e,Ha),ss(t,Ha),!0);return os(new Bs(Hs.SHA256,n).expand(Qa),Ha)}function eu(e){return os(Hs.hash(ss(e,Ha)),Ha)}function tu(e){return os(Hs.hash(ss(e,$a)),Ha)}function nu(e){return ss(`${e}`,Ba)}function ru(e){return Number(os(e,Ba))}function iu(e){const t=nu(typeof e.type<"u"?e.type:Va);if(ru(t)===Wa&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?ss(e.senderPublicKey,Ha):void 0,r=typeof e.iv<"u"?ss(e.iv,Ha):cr.randomBytes(Ya);return su({type:t,sealed:new ps.ChaCha20Poly1305(ss(e.symKey,Ha)).seal(r,ss(e.message,$a)),iv:r,senderPublicKey:n})}function ou(e){const t=new ps.ChaCha20Poly1305(ss(e.symKey,Ha)),{sealed:n,iv:r}=au(e.encoded),i=t.open(r,n);if(null===i)throw new Error("Failed to decrypt");return os(i,$a)}function su(e){if(ru(e.type)===Wa){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return os(bi([e.type,e.senderPublicKey,e.iv,e.sealed]),qa)}return os(bi([e.type,e.iv,e.sealed]),qa)}function au(e){const t=ss(e,qa),n=t.slice(Ka,Ga),r=Ga;if(ru(n)===Wa){const e=r+Qa,i=e+Ya,o=t.slice(r,e),s=t.slice(e,i);return{type:n,sealed:t.slice(i),iv:s,senderPublicKey:o}}const i=r+Ya,o=t.slice(r,i);return{type:n,sealed:t.slice(i),iv:o}}function uu(e,t){const n=au(e);return cu({type:ru(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?os(n.senderPublicKey,Ha):void 0,receiverPublicKey:t?.receiverPublicKey})}function cu(e){const t=e?.type||Va;if(t===Wa){if(typeof e?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function lu(e){return e.type===Wa&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}var fu=Object.defineProperty,hu=Object.getOwnPropertySymbols,du=Object.prototype.hasOwnProperty,pu=Object.prototype.propertyIsEnumerable,gu=(e,t,n)=>t in e?fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yu=(e,t)=>{for(var n in t||(t={}))du.call(t,n)&&gu(e,n,t[n]);if(hu)for(var n of hu(t))pu.call(t,n)&&gu(e,n,t[n]);return e};const vu="ReactNative",mu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},_u="js";function bu(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function wu(){return!fa()&&!!pa()&&navigator.product===vu}function Eu(){return!bu()&&!!pa()&&!!fa()}function Su(){return wu()?mu.reactNative:bu()?mu.node:Eu()?mu.browser:mu.unknown}function Ou(){var e;try{return wu()&&typeof l<"u"&&typeof(null==l?void 0:l.Application)<"u"?null==(e=l.Application)?void 0:e.applicationId:void 0}catch{return}}function Iu(e,t){let n=xa.parse(e);return n=yu(yu({},n),t),e=xa.stringify(n)}function xu(){return Sa()||{name:"",description:"",url:"",icons:[""]}}function Ru(){if(Su()===mu.reactNative&&typeof l<"u"&&typeof(null==l?void 0:l.Platform)<"u"){const{OS:e,Version:t}=l.Platform;return[e,t].join("-")}const e=ea();if(null===e)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function ku(){var e;const t=Su();return t===mu.browser?[t,(null==(e=va())?void 0:e.host)||"unknown"].join(":"):t}function Cu(e,t,n){const r=Ru(),i=ku();return[[e,t].join("-"),[_u,n].join("-"),r,i].join("/")}function Pu({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:i,projectId:o,useOnCloseEvent:s,bundleId:a}){const u=n.split("?"),c={auth:i,ua:Cu(e,t,r),projectId:o,useOnCloseEvent:s||void 0,origin:a||void 0},l=Iu(u[1]||"",c);return u[0]+"?"+l}function Au(e,t){return e.filter((e=>t.includes(e))).length===e.length}function Nu(e){return Object.fromEntries(e.entries())}function Tu(e){return new Map(Object.entries(e))}function Mu(e=Qe.FIVE_MINUTES,t){const n=Qe.toMiliseconds(e||Qe.FIVE_MINUTES);let r,i,o;return{resolve:e=>{o&&r&&(clearTimeout(o),r(e))},reject:e=>{o&&i&&(clearTimeout(o),i(e))},done:()=>new Promise(((e,s)=>{o=setTimeout((()=>{s(new Error(t))}),n),r=e,i=s}))}}function Lu(e,t,n){return new Promise((async(r,i)=>{const o=setTimeout((()=>i(new Error(n))),t);try{r(await e)}catch(e){i(e)}clearTimeout(o)}))}function ju(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Uu(e){return ju("topic",e)}function Du(e){return ju("id",e)}function zu(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof n)r.topic=n;else{if("id"!==t||!Number.isInteger(Number(n)))throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);r.id=Number(n)}return r}function Fu(e,t){return Qe.fromMiliseconds((t||Date.now())+Qe.toMiliseconds(e))}function Bu(e){return Date.now()>=Qe.toMiliseconds(e)}function Hu(e,t){return`${e}${t?`:${t}`:""}`}function qu(e=[],t=[]){return[...new Set([...e,...t])]}async function $u({id:e,topic:t,wcDeepLink:n}){try{if(!n)return;const r="string"==typeof n?JSON.parse(n):n;let i=r?.href;if("string"!=typeof i)return;i.endsWith("/")&&(i=i.slice(0,-1));const o=`${i}/wc?requestId=${e}&sessionTopic=${t}`,s=Su();s===mu.browser?o.startsWith("https://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,"_self","noreferrer noopener"):s===mu.reactNative&&typeof(null==l?void 0:l.Linking)<"u"&&await l.Linking.openURL(o)}catch(e){console.error(e)}}async function Vu(e,t){try{return await e.getItem(t)||(Eu()?localStorage.getItem(t):void 0)}catch(e){console.error(e)}}const Wu="irn";function Ku(e){return e?.relay||{protocol:Wu}}function Gu(e){const t=Ua[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var Yu=Object.defineProperty,Qu=Object.getOwnPropertySymbols,Ju=Object.prototype.hasOwnProperty,Xu=Object.prototype.propertyIsEnumerable,Zu=(e,t,n)=>t in e?Yu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ec=(e,t)=>{for(var n in t||(t={}))Ju.call(t,n)&&Zu(e,n,t[n]);if(Qu)for(var n of Qu(t))Xu.call(t,n)&&Zu(e,n,t[n]);return e};function tc(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach((t=>{if(t.startsWith(r)){const i=t.replace(r,""),o=e[t];n[i]=o}})),n}function nc(e){const t=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=e.substring(t+1,n).split("@"),o=typeof n<"u"?e.substring(n):"",s=xa.parse(o);return{protocol:r,topic:rc(i[0]),version:parseInt(i[1],10),symKey:s.symKey,relay:tc(s)}}function rc(e){return e.startsWith("//")?e.substring(2):e}function ic(e,t="-"){const n="relay",r={};return Object.keys(e).forEach((i=>{const o=n+t+i;e[i]&&(r[o]=e[i])})),r}function oc(e){return`${e.protocol}:${e.topic}@${e.version}?`+xa.stringify(ec({symKey:e.symKey},ic(e.relay)))}function sc(e){const t=[];return e.forEach((e=>{const[n,r]=e.split(":");t.push(`${n}:${r}`)})),t}function ac(e){const t=[];return Object.values(e).forEach((e=>{t.push(...sc(e.accounts))})),t}function uc(e,t){const n=[];return Object.values(e).forEach((e=>{sc(e.accounts).includes(t)&&n.push(...e.methods)})),n}function cc(e,t){const n=[];return Object.values(e).forEach((e=>{sc(e.accounts).includes(t)&&n.push(...e.events)})),n}function lc(e,t){const n=zc(e,t);if(n)throw new Error(n.message);const r={};for(const[t,n]of Object.entries(e))r[t]={methods:n.methods,events:n.events,chains:n.accounts.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))};return r}function fc(e){return e.includes(":")}function hc(e){return fc(e)?e.split(":")[0]:e}const dc={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},pc={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function gc(e,t){const{message:n,code:r}=pc[e];return{message:t?`${n} ${t}`:n,code:r}}function yc(e,t){const{message:n,code:r}=dc[e];return{message:t?`${n} ${t}`:n,code:r}}function vc(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function mc(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function _c(e){return typeof e>"u"}function bc(e,t){return!(!t||!_c(e))||"string"==typeof e&&!!e.trim().length}function wc(e,t){return!(!t||!_c(e))||"number"==typeof e&&!isNaN(e)}function Ec(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),i=Object.keys(n);let o=!0;return!!Au(i,r)&&(r.forEach((t=>{const{accounts:r,methods:i,events:s}=e.namespaces[t],a=sc(r),u=n[t];Au(Fa(t,u),a)&&Au(u.methods,i)&&Au(u.events,s)||(o=!1)})),o)}function Sc(e){return!(!bc(e,!1)||!e.includes(":"))&&2===e.split(":").length}function Oc(e){if(bc(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&Sc(e)}}return!1}function Ic(e){if(bc(e,!1))try{return typeof new URL(e)<"u"}catch{return!1}return!1}function xc(e){var t;return null==(t=e?.proposer)?void 0:t.publicKey}function Rc(e){return e?.topic}function kc(e,t){let n=null;return bc(e?.publicKey,!1)||(n=gc("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}function Cc(e){let t=!0;return vc(e)?e.length&&(t=e.every((e=>bc(e,!1)))):t=!1,t}function Pc(e,t,n){let r=null;return vc(t)&&t.length?t.forEach((e=>{r||Sc(e)||(r=yc("UNSUPPORTED_CHAINS",`${n}, chain ${e} should be a string and conform to "namespace:chainId" format`))})):Sc(e)||(r=yc("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function Ac(e,t,n){let r=null;return Object.entries(e).forEach((([e,i])=>{if(r)return;const o=Pc(e,Fa(e,i),`${t} ${n}`);o&&(r=o)})),r}function Nc(e,t){let n=null;return vc(e)?e.forEach((e=>{n||Oc(e)||(n=yc("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))})):n=yc("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function Tc(e,t){let n=null;return Object.values(e).forEach((e=>{if(n)return;const r=Nc(e?.accounts,`${t} namespace`);r&&(n=r)})),n}function Mc(e,t){let n=null;return Cc(e?.methods)?Cc(e?.events)||(n=yc("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=yc("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}function Lc(e,t){let n=null;return Object.values(e).forEach((e=>{if(n)return;const r=Mc(e,`${t}, namespace`);r&&(n=r)})),n}function jc(e,t,n){let r=null;if(e&&mc(e)){const i=Lc(e,t);i&&(r=i);const o=Ac(e,t,n);o&&(r=o)}else r=gc("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}function zc(e,t){let n=null;if(e&&mc(e)){const r=Lc(e,t);r&&(n=r);const i=Tc(e,t);i&&(n=i)}else n=gc("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function Fc(e){return bc(e.protocol,!0)}function Bc(e,t){let n=!1;return t&&!e?n=!0:e&&vc(e)&&e.length&&e.forEach((e=>{n=Fc(e)})),n}function Hc(e){return"number"==typeof e}function qc(e){return typeof e<"u"&&null!==typeof e}function $c(e){return!!(e&&"object"==typeof e&&e.code&&wc(e.code,!1)&&e.message&&bc(e.message,!1))}function Vc(e){return!(_c(e)||!bc(e.method,!1))}function Wc(e){return!(_c(e)||_c(e.result)&&_c(e.error)||!wc(e.id,!1)||!bc(e.jsonrpc,!1))}function Kc(e){return!(_c(e)||!bc(e.name,!1))}function Gc(e,t){return!(!Sc(t)||!ac(e).includes(t))}function Yc(e,t,n){return!!bc(n,!1)&&uc(e,t).includes(n)}function Qc(e,t,n){return!!bc(n,!1)&&cc(e,t).includes(n)}function Jc(e,t,n){let r=null;const i=Xc(e),o=el(t),s=Object.keys(i),a=Object.keys(o),u=Zc(Object.keys(e)),c=Zc(Object.keys(t)),l=u.filter((e=>!c.includes(e)));return l.length&&(r=gc("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces.\n Required: ${l.toString()}\n Received: ${Object.keys(t).toString()}`)),Au(s,a)||(r=gc("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces.\n Required: ${s.toString()}\n Approved: ${a.toString()}`)),Object.keys(t).forEach((e=>{if(!e.includes(":")||r)return;const i=sc(t[e].accounts);i.includes(e)||(r=gc("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${e}\n Required: ${e}\n Approved: ${i.toString()}`))})),s.forEach((e=>{r||(Au(i[e].methods,o[e].methods)?Au(i[e].events,o[e].events)||(r=gc("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${e}`)):r=gc("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${e}`))})),r}function Xc(e){const t={};return Object.keys(e).forEach((n=>{var r;n.includes(":")?t[n]=e[n]:null==(r=e[n].chains)||r.forEach((r=>{t[r]={methods:e[n].methods,events:e[n].events}}))})),t}function Zc(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}function el(e){const t={};return Object.keys(e).forEach((n=>{if(n.includes(":"))t[n]=e[n];else{const r=sc(e[n].accounts);r?.forEach((r=>{t[r]={accounts:e[n].accounts.filter((e=>e.includes(`${r}:`))),methods:e[n].methods,events:e[n].events}}))}})),t}function tl(e,t){return wc(e,!1)&&e<=t.max&&e>=t.min}function nl(){const e=Su();return new Promise((t=>{switch(e){case mu.browser:t(rl());break;case mu.reactNative:t(il());break;case mu.node:t(ol());break;default:t(!0)}}))}function rl(){return Eu()&&navigator?.onLine}async function il(){if(wu()&&typeof l<"u"&&null!=l&&l.NetInfo){const e=await(null==l?void 0:l.NetInfo.fetch());return e?.isConnected}return!0}function ol(){return!0}function sl(e){switch(Su()){case mu.browser:al(e);break;case mu.reactNative:ul(e)}}function al(e){!wu()&&Eu()&&(window.addEventListener("online",(()=>e(!0))),window.addEventListener("offline",(()=>e(!1))))}function ul(e){wu()&&typeof l<"u"&&null!=l&&l.NetInfo&&l?.NetInfo.addEventListener((t=>e(t?.isConnected)))}const cl={};class ll{static get(e){return cl[e]}static set(e,t){cl[e]=t}static delete(e){delete cl[e]}}const fl="INTERNAL_ERROR",hl="SERVER_ERROR",dl=[-32700,-32600,-32601,-32602,-32603],pl={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[fl]:{code:-32603,message:"Internal error"},[hl]:{code:-32e3,message:"Server error"}},gl=hl;function yl(e){return dl.includes(e)}function vl(e){return Object.keys(pl).includes(e)?pl[e]:pl[gl]}function ml(e){const t=Object.values(pl).find((t=>t.code===e));return t||pl[gl]}function _l(e,t,n){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${t}`):e}var bl={},wl=function(e,t){return wl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},wl(e,t)};
293
293
  /*! *****************************************************************************
294
294
  Copyright (c) Microsoft Corporation.
295
295
 
@@ -303,7 +303,7 @@ PERFORMANCE OF THIS SOFTWARE.
303
303
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
304
304
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
305
305
  PERFORMANCE OF THIS SOFTWARE.
306
- ***************************************************************************** */function bl(e,t){function n(){this.constructor=e}_l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var wl=function(){return wl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},wl.apply(this,arguments)};function El(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function Sl(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function Ol(e,t){return function(n,r){t(n,r,e)}}function Il(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function xl(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Rl(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return u([e,t])}}function u(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function kl(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function Cl(e,t){for(var n in e)"default"!==n&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function Pl(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Al(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function Nl(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Al(arguments[t]));return e}function Tl(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function Ml(e){return this instanceof Ml?(this.v=e,this):new Ml(e)}function Ll(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{u(i[e](t))}catch(e){f(o[0][3],e)}}function u(e){e.value instanceof Ml?Promise.resolve(e.value.v).then(c,l):f(o[0][2],e)}function c(e){a("next",e)}function l(e){a("throw",e)}function f(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function jl(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:Ml(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function Ul(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof Pl?Pl(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){i(r,o,(t=e[n](t)).done,t.value)}))}}function i(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}}function Dl(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function zl(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Fl(e){return e&&e.__esModule?e:{default:e}}function Bl(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function Hl(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}var ql,$l=r(Object.freeze({__proto__:null,__extends:bl,get __assign(){return wl},__rest:El,__decorate:Sl,__param:Ol,__metadata:Il,__awaiter:xl,__generator:Rl,__createBinding:kl,__exportStar:Cl,__values:Pl,__read:Al,__spread:Nl,__spreadArrays:Tl,__await:Ml,__asyncGenerator:Ll,__asyncDelegator:jl,__asyncValues:Ul,__makeTemplateObject:Dl,__importStar:zl,__importDefault:Fl,__classPrivateFieldGet:Bl,__classPrivateFieldSet:Hl})),Vl={};function Wl(){if(ql)return Vl;function e(){return t?.crypto||t?.msCrypto||{}}function n(){const t=e();return t.subtle||t.webkitSubtle}function r(){return!!e()&&!!n()}return ql=1,Object.defineProperty(Vl,"__esModule",{value:!0}),Vl.isBrowserCryptoAvailable=Vl.getSubtleCrypto=Vl.getBrowerCrypto=void 0,Vl.getBrowerCrypto=e,Vl.getSubtleCrypto=n,Vl.isBrowserCryptoAvailable=r,Vl}var Kl,Gl={};function Yl(){if(Kl)return Gl;function e(){return typeof document>"u"&&typeof navigator<"u"&&"ReactNative"===navigator.product}function t(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function n(){return!e()&&!t()}return Kl=1,Object.defineProperty(Gl,"__esModule",{value:!0}),Gl.isBrowser=Gl.isNode=Gl.isReactNative=void 0,Gl.isReactNative=e,Gl.isNode=t,Gl.isBrowser=n,Gl}function Ql(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function Jl(e=6){return BigInt(Ql(e))}function Xl(e,t,n){return{id:n||Ql(),jsonrpc:"2.0",method:e,params:t}}function Zl(e,t){return{id:e,jsonrpc:"2.0",result:t}}function ef(e,t,n){return{id:e,jsonrpc:"2.0",error:tf(t,n)}}function tf(e,t){return typeof e>"u"?gl(cl):("string"==typeof e&&(e=Object.assign(Object.assign({},gl(ll)),{message:e})),typeof t<"u"&&(e.data=t),pl(e.code)&&(e=yl(e.code)),e)}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=$l;t.__exportStar(Wl(),e),t.__exportStar(Yl(),e)}(ml);class nf{}class rf extends nf{constructor(){super()}}class of extends rf{constructor(e){super()}}const sf="^https?:",af="^wss?:";function uf(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}function cf(e,t){const n=uf(e);return!(typeof n>"u")&&new RegExp(t).test(n)}function lf(e){return cf(e,sf)}function ff(e){return cf(e,af)}function hf(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}function df(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function pf(e){return df(e)&&"method"in e}function gf(e){return df(e)&&(yf(e)||vf(e))}function yf(e){return"result"in e}function vf(e){return"error"in e}class mf extends of{constructor(e){super(e),this.events=new o.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Xl(e.method,e.params||[],e.id||Jl().toString()),t)}async requestStrict(e,t){return new Promise((async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(e){r(e)}this.events.on(`${e.id}`,(e=>{vf(e)?r(e.error):n(e.result)}));try{await this.connection.send(e,t)}catch(e){r(e)}}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),gf(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",(e=>this.onPayload(e))),this.connection.on("close",(e=>this.onClose(e))),this.connection.on("error",(e=>this.events.emit("error",e))),this.connection.on("register_error",(e=>this.onClose())),this.hasRegisteredEventListeners=!0)}}const _f=()=>typeof WebSocket<"u"||typeof l<"u"&&typeof l.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",bf=e=>e.split("?")[0],wf=10,Ef=typeof WebSocket<"u"?WebSocket:typeof l<"u"&&typeof l.WebSocket<"u"?l.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:Dc?Uc:(Dc=1,Uc=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")});class Sf{constructor(e){if(this.url=e,this.events=new o.exports.EventEmitter,this.registering=!1,!ff(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise(((e,t)=>{typeof this.socket>"u"?t(new Error("Connection already closed")):(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close())}))}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(ue(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!ff(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(new Error("WebSocket connection is missing or invalid"));e(this.socket)}))}))}return this.url=e,this.registering=!0,new Promise(((t,n)=>{const r=new URLSearchParams(e).get("origin"),i=ml.isReactNative()?{headers:{origin:r}}:{rejectUnauthorized:!hf(e)},o=new Ef(e,[],i);_f()?o.onerror=e=>{const t=e;n(this.emitError(t.error))}:o.on("error",(e=>{n(this.emitError(e))})),o.onopen=()=>{this.onOpen(o),t(o)}}))}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?ae(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=ef(e,n.message||n.toString());this.events.emit("payload",r)}parseError(e,t=this.url){return vl(e,bf(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>wf&&this.events.setMaxListeners(wf)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${bf(this.url)}`));return this.events.emit("register_error",t),t}}var Of={exports:{}};!function(e,n){var r=200,i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,u="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",f="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",g="[object GeneratorFunction]",y="[object Map]",v="[object Number]",m="[object Null]",_="[object Object]",b="[object Promise]",w="[object Proxy]",E="[object RegExp]",S="[object Set]",O="[object String]",I="[object Symbol]",x="[object Undefined]",R="[object WeakMap]",k="[object ArrayBuffer]",C="[object DataView]",P="[object Float64Array]",A="[object Int8Array]",N="[object Int16Array]",T="[object Int32Array]",M="[object Uint8Array]",L="[object Uint8ClampedArray]",j="[object Uint16Array]",U="[object Uint32Array]",D=/[\\^$.*+?()[\]{}|]/g,z=/^\[object .+?Constructor\]$/,F=/^(?:0|[1-9]\d*)$/,B={};B["[object Float32Array]"]=B[P]=B[A]=B[N]=B[T]=B[M]=B[L]=B[j]=B[U]=!0,B[u]=B[c]=B[k]=B[f]=B[C]=B[h]=B[d]=B[p]=B[y]=B[v]=B[_]=B[E]=B[S]=B[O]=B[R]=!1;var H="object"==typeof t&&t&&t.Object===Object&&t,q="object"==typeof self&&self&&self.Object===Object&&self,$=H||q||Function("return this")(),V=n&&!n.nodeType&&n,W=V&&e&&!e.nodeType&&e,K=W&&W.exports===V,G=K&&H.process,Y=function(){try{return G&&G.binding&&G.binding("util")}catch{}}(),Q=Y&&Y.isTypedArray;function J(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function X(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Z(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function ee(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function te(e){return function(t){return e(t)}}function ne(e,t){return e.has(t)}function re(e,t){return e?.[t]}function ie(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function oe(e,t){return function(n){return e(t(n))}}function se(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var ae=Array.prototype,ue=Function.prototype,ce=Object.prototype,le=$["__core-js_shared__"],fe=ue.toString,he=ce.hasOwnProperty,de=function(){var e=/[^.]+$/.exec(le&&le.keys&&le.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),pe=ce.toString,ge=RegExp("^"+fe.call(he).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ye=K?$.Buffer:void 0,ve=$.Symbol,me=$.Uint8Array,_e=ce.propertyIsEnumerable,be=ae.splice,we=ve?ve.toStringTag:void 0,Ee=Object.getOwnPropertySymbols,Se=ye?ye.isBuffer:void 0,Oe=oe(Object.keys,Object),Ie=xt($,"DataView"),xe=xt($,"Map"),Re=xt($,"Promise"),ke=xt($,"Set"),Ce=xt($,"WeakMap"),Pe=xt(Object,"create"),Ae=Lt(Ie),Ne=Lt(xe),Te=Lt(Re),Me=Lt(ke),Le=Lt(Ce),je=ve?ve.prototype:void 0,Ue=je?je.valueOf:void 0;function De(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ze(){this.__data__=Pe?Pe(null):{},this.size=0}function Fe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Be(e){var t=this.__data__;if(Pe){var n=t[e];return n===i?void 0:n}return he.call(t,e)?t[e]:void 0}function He(e){var t=this.__data__;return Pe?void 0!==t[e]:he.call(t,e)}function qe(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Pe&&void 0===t?i:t,this}function $e(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ve(){this.__data__=[],this.size=0}function We(e){var t=this.__data__,n=ht(t,e);return!(n<0||(n==t.length-1?t.pop():be.call(t,n,1),--this.size,0))}function Ke(e){var t=this.__data__,n=ht(t,e);return n<0?void 0:t[n][1]}function Ge(e){return ht(this.__data__,e)>-1}function Ye(e,t){var n=this.__data__,r=ht(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Qe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Je(){this.size=0,this.__data__={hash:new De,map:new(xe||$e),string:new De}}function Xe(e){var t=It(this,e).delete(e);return this.size-=t?1:0,t}function Ze(e){return It(this,e).get(e)}function et(e){return It(this,e).has(e)}function tt(e,t){var n=It(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function nt(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Qe;++t<n;)this.add(e[t])}function rt(e){return this.__data__.set(e,i),this}function it(e){return this.__data__.has(e)}function ot(e){var t=this.__data__=new $e(e);this.size=t.size}function st(){this.__data__=new $e,this.size=0}function at(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ut(e){return this.__data__.get(e)}function ct(e){return this.__data__.has(e)}function lt(e,t){var n=this.__data__;if(n instanceof $e){var i=n.__data__;if(!xe||i.length<r-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Qe(i)}return n.set(e,t),this.size=n.size,this}function ft(e,t){var n=Dt(e),r=!n&&Ut(e),i=!n&&!r&&Ft(e),o=!n&&!r&&!i&&Wt(e),s=n||r||i||o,a=s?ee(e.length,String):[],u=a.length;for(var c in e)(t||he.call(e,c))&&(!s||!("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Pt(c,u)))&&a.push(c);return a}function ht(e,t){for(var n=e.length;n--;)if(jt(e[n][0],t))return n;return-1}function dt(e,t,n){var r=t(e);return Dt(e)?r:X(r,n(e))}function pt(e){return null==e?void 0===e?x:m:we&&we in Object(e)?Rt(e):Mt(e)}function gt(e){return Vt(e)&&pt(e)==u}function yt(e,t,n,r,i){return e===t||(null==e||null==t||!Vt(e)&&!Vt(t)?e!=e&&t!=t:vt(e,t,n,r,yt,i))}function vt(e,t,n,r,i,s){var a=Dt(e),l=Dt(t),f=a?c:Ct(e),h=l?c:Ct(t),d=(f=f==u?_:f)==_,p=(h=h==u?_:h)==_,g=f==h;if(g&&Ft(e)){if(!Ft(t))return!1;a=!0,d=!1}if(g&&!d)return s||(s=new ot),a||Wt(e)?wt(e,t,n,r,i,s):Et(e,t,f,n,r,i,s);if(!(n&o)){var y=d&&he.call(e,"__wrapped__"),v=p&&he.call(t,"__wrapped__");if(y||v){var m=y?e.value():e,b=v?t.value():t;return s||(s=new ot),i(m,b,n,r,s)}}return!!g&&(s||(s=new ot),St(e,t,n,r,i,s))}function mt(e){return!(!$t(e)||Nt(e))&&(Ht(e)?ge:z).test(Lt(e))}function _t(e){return Vt(e)&&qt(e.length)&&!!B[pt(e)]}function bt(e){if(!Tt(e))return Oe(e);var t=[];for(var n in Object(e))he.call(e,n)&&"constructor"!=n&&t.push(n);return t}function wt(e,t,n,r,i,a){var u=n&o,c=e.length,l=t.length;if(c!=l&&!(u&&l>c))return!1;var f=a.get(e);if(f&&a.get(t))return f==t;var h=-1,d=!0,p=n&s?new nt:void 0;for(a.set(e,t),a.set(t,e);++h<c;){var g=e[h],y=t[h];if(r)var v=u?r(y,g,h,t,e,a):r(g,y,h,e,t,a);if(void 0!==v){if(v)continue;d=!1;break}if(p){if(!Z(t,(function(e,t){if(!ne(p,t)&&(g===e||i(g,e,n,r,a)))return p.push(t)}))){d=!1;break}}else if(g!==y&&!i(g,y,n,r,a)){d=!1;break}}return a.delete(e),a.delete(t),d}function Et(e,t,n,r,i,a,u){switch(n){case C:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case k:return!(e.byteLength!=t.byteLength||!a(new me(e),new me(t)));case f:case h:case v:return jt(+e,+t);case d:return e.name==t.name&&e.message==t.message;case E:case O:return e==t+"";case y:var c=ie;case S:var l=r&o;if(c||(c=se),e.size!=t.size&&!l)return!1;var p=u.get(e);if(p)return p==t;r|=s,u.set(e,t);var g=wt(c(e),c(t),r,i,a,u);return u.delete(e),g;case I:if(Ue)return Ue.call(e)==Ue.call(t)}return!1}function St(e,t,n,r,i,s){var a=n&o,u=Ot(e),c=u.length;if(c!=Ot(t).length&&!a)return!1;for(var l=c;l--;){var f=u[l];if(!(a?f in t:he.call(t,f)))return!1}var h=s.get(e);if(h&&s.get(t))return h==t;var d=!0;s.set(e,t),s.set(t,e);for(var p=a;++l<c;){var g=e[f=u[l]],y=t[f];if(r)var v=a?r(y,g,f,t,e,s):r(g,y,f,e,t,s);if(!(void 0===v?g===y||i(g,y,n,r,s):v)){d=!1;break}p||(p="constructor"==f)}if(d&&!p){var m=e.constructor,_=t.constructor;m!=_&&"constructor"in e&&"constructor"in t&&!("function"==typeof m&&m instanceof m&&"function"==typeof _&&_ instanceof _)&&(d=!1)}return s.delete(e),s.delete(t),d}function Ot(e){return dt(e,Kt,kt)}function It(e,t){var n=e.__data__;return At(t)?n["string"==typeof t?"string":"hash"]:n.map}function xt(e,t){var n=re(e,t);return mt(n)?n:void 0}function Rt(e){var t=he.call(e,we),n=e[we];try{e[we]=void 0;var r=!0}catch{}var i=pe.call(e);return r&&(t?e[we]=n:delete e[we]),i}De.prototype.clear=ze,De.prototype.delete=Fe,De.prototype.get=Be,De.prototype.has=He,De.prototype.set=qe,$e.prototype.clear=Ve,$e.prototype.delete=We,$e.prototype.get=Ke,$e.prototype.has=Ge,$e.prototype.set=Ye,Qe.prototype.clear=Je,Qe.prototype.delete=Xe,Qe.prototype.get=Ze,Qe.prototype.has=et,Qe.prototype.set=tt,nt.prototype.add=nt.prototype.push=rt,nt.prototype.has=it,ot.prototype.clear=st,ot.prototype.delete=at,ot.prototype.get=ut,ot.prototype.has=ct,ot.prototype.set=lt;var kt=Ee?function(e){return null==e?[]:(e=Object(e),J(Ee(e),(function(t){return _e.call(e,t)})))}:Gt,Ct=pt;function Pt(e,t){return!!(t=t??a)&&("number"==typeof e||F.test(e))&&e>-1&&e%1==0&&e<t}function At(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function Nt(e){return!!de&&de in e}function Tt(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ce)}function Mt(e){return pe.call(e)}function Lt(e){if(null!=e){try{return fe.call(e)}catch{}try{return e+""}catch{}}return""}function jt(e,t){return e===t||e!=e&&t!=t}(Ie&&Ct(new Ie(new ArrayBuffer(1)))!=C||xe&&Ct(new xe)!=y||Re&&Ct(Re.resolve())!=b||ke&&Ct(new ke)!=S||Ce&&Ct(new Ce)!=R)&&(Ct=function(e){var t=pt(e),n=t==_?e.constructor:void 0,r=n?Lt(n):"";if(r)switch(r){case Ae:return C;case Ne:return y;case Te:return b;case Me:return S;case Le:return R}return t});var Ut=gt(function(){return arguments}())?gt:function(e){return Vt(e)&&he.call(e,"callee")&&!_e.call(e,"callee")},Dt=Array.isArray;function zt(e){return null!=e&&qt(e.length)&&!Ht(e)}var Ft=Se||Yt;function Bt(e,t){return yt(e,t)}function Ht(e){if(!$t(e))return!1;var t=pt(e);return t==p||t==g||t==l||t==w}function qt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function $t(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Vt(e){return null!=e&&"object"==typeof e}var Wt=Q?te(Q):_t;function Kt(e){return zt(e)?ft(e):bt(e)}function Gt(){return[]}function Yt(){return!1}e.exports=Bt}(Of,Of.exports);var If=Of.exports,xf=Object.defineProperty,Rf=Object.getOwnPropertySymbols,kf=Object.prototype.hasOwnProperty,Cf=Object.prototype.propertyIsEnumerable,Pf=(e,t,n)=>t in e?xf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Af=(e,t)=>{for(var n in t||(t={}))kf.call(t,n)&&Pf(e,n,t[n]);if(Rf)for(var n of Rf(t))Cf.call(t,n)&&Pf(e,n,t[n]);return e};function Nf(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function f(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*l+1>>>0,c=new Uint8Array(s);i!==o;){for(var f=t[i],h=0,d=s-1;(0!==f||h<r)&&-1!==d;d--,h++)f+=256*c[d]>>>0,c[d]=f%a>>>0,f=f/a>>>0;if(0!==f)throw new Error("Non-zero carry");r=h,i++}for(var p=s-r;p!==s&&0===c[p];)p++;for(var g=u.repeat(n);p<s;++p)g+=e.charAt(c[p]);return g}function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var r=0,i=0;e[t]===u;)r++,t++;for(var o=(e.length-t)*c+1>>>0,s=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var f=0,h=o-1;(0!==l||f<i)&&-1!==h;h--,f++)l+=a*s[h]>>>0,s[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=o-i;d!==o&&0===s[d];)d++;for(var p=new Uint8Array(r+(o-d)),g=r;d!==o;)p[g++]=s[d++];return p}}}function d(e){var n=h(e);if(n)return n;throw new Error(`Non-${t} character`)}return{encode:f,decodeUnsafe:h,decode:d}}var Tf=Nf;const Mf=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Lf=e=>(new TextEncoder).encode(e),jf=e=>(new TextDecoder).decode(e);class Uf{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Df{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Ff(this,e)}}class zf{constructor(e){this.decoders=e}or(e){return Ff(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Ff=(e,t)=>new zf(Af(Af({},e.decoders||{[e.prefix]:e}),t.decoders||{[t.prefix]:t}));class Bf{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new Uf(e,t,n),this.decoder=new Df(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Hf=({name:e,prefix:t,encode:n,decode:r})=>new Bf(e,t,n,r),qf=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=Tf(n,t);return Hf({prefix:e,name:t,encode:r,decode:e=>Mf(i(e))})},$f=(e,t,n,r)=>{const i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*n/8|0);let a=0,u=0,c=0;for(let t=0;t<o;++t){const o=i[e[t]];if(void 0===o)throw new SyntaxError(`Non-${r} character`);u=u<<n|o,a+=n,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=n||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s},Vf=(e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let r=0;r<e.length;++r)for(a=a<<8|e[r],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o},Wf=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>Hf({prefix:t,name:e,encode:e=>Vf(e,r,n),decode:t=>$f(t,r,n,e)}),Kf=Hf({prefix:"\0",name:"identity",encode:e=>jf(e),decode:e=>Lf(e)});var Gf=Object.freeze({__proto__:null,identity:Kf});const Yf=Wf({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Qf=Object.freeze({__proto__:null,base2:Yf});const Jf=Wf({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Xf=Object.freeze({__proto__:null,base8:Jf});const Zf=qf({prefix:"9",name:"base10",alphabet:"0123456789"});var eh=Object.freeze({__proto__:null,base10:Zf});const th=Wf({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),nh=Wf({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rh=Object.freeze({__proto__:null,base16:th,base16upper:nh});const ih=Wf({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),oh=Wf({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sh=Wf({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ah=Wf({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),uh=Wf({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ch=Wf({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),lh=Wf({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fh=Wf({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hh=Wf({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var dh=Object.freeze({__proto__:null,base32:ih,base32upper:oh,base32pad:sh,base32padupper:ah,base32hex:uh,base32hexupper:ch,base32hexpad:lh,base32hexpadupper:fh,base32z:hh});const ph=qf({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gh=qf({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var yh=Object.freeze({__proto__:null,base36:ph,base36upper:gh});const vh=qf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mh=qf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var _h=Object.freeze({__proto__:null,base58btc:vh,base58flickr:mh});const bh=Wf({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wh=Wf({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Eh=Wf({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Sh=Wf({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Oh=Object.freeze({__proto__:null,base64:bh,base64pad:wh,base64url:Eh,base64urlpad:Sh});const Ih=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),xh=Ih.reduce(((e,t,n)=>(e[n]=t,e)),[]),Rh=Ih.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);function kh(e){return e.reduce(((e,t)=>e+=xh[t]),"")}function Ch(e){const t=[];for(const n of e){const e=Rh[n.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}const Ph=Hf({prefix:"🚀",name:"base256emoji",encode:kh,decode:Ch});var Ah=Object.freeze({__proto__:null,base256emoji:Ph}),Nh=jh,Th=128,Mh=-128,Lh=Math.pow(2,31);function jh(e,t,n){t=t||[];for(var r=n=n||0;e>=Lh;)t[n++]=255&e|Th,e/=128;for(;e&Mh;)t[n++]=255&e|Th,e>>>=7;return t[n]=0|e,jh.bytes=n-r+1,t}var Uh=Fh,Dh=128,zh=127;function Fh(e,t){var n,r=0,i=0,o=t=t||0,s=e.length;do{if(o>=s)throw Fh.bytes=0,new RangeError("Could not decode varint");n=e[o++],r+=i<28?(n&zh)<<i:(n&zh)*Math.pow(2,i),i+=7}while(n>=Dh);return Fh.bytes=o-t,r}var Bh=Math.pow(2,7),Hh=Math.pow(2,14),qh=Math.pow(2,21),$h=Math.pow(2,28),Vh=Math.pow(2,35),Wh=Math.pow(2,42),Kh=Math.pow(2,49),Gh=Math.pow(2,56),Yh=Math.pow(2,63),Qh={encode:Nh,decode:Uh,encodingLength:function(e){return e<Bh?1:e<Hh?2:e<qh?3:e<$h?4:e<Vh?5:e<Wh?6:e<Kh?7:e<Gh?8:e<Yh?9:10}};const Jh=(e,t,n=0)=>(Qh.encode(e,t,n),t),Xh=e=>Qh.encodingLength(e),Zh=(e,t)=>{const n=t.byteLength,r=Xh(e),i=r+Xh(n),o=new Uint8Array(i+n);return Jh(e,o,0),Jh(n,o,r),o.set(t,i),new ed(e,n,t,o)};class ed{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const td=({name:e,code:t,encode:n})=>new nd(e,t,n);class nd{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Zh(this.code,t):t.then((e=>Zh(this.code,e)))}throw Error("Unknown type, must be binary type")}}const rd=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),id=td({name:"sha2-256",code:18,encode:rd("SHA-256")}),od=td({name:"sha2-512",code:19,encode:rd("SHA-512")});var sd=Object.freeze({__proto__:null,sha256:id,sha512:od});const ad=0,ud="identity",cd=Mf;var ld=Object.freeze({__proto__:null,identity:{code:ad,name:ud,encode:cd,digest:e=>Zh(ad,cd(e))}});new TextEncoder,new TextDecoder;const fd=Af(Af(Af(Af(Af(Af(Af(Af(Af(Af({},Gf),Qf),Xf),eh),rh),dh),yh),_h),Oh),Ah);function hd(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function dd(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?hd(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function pd(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}Af(Af({},sd),ld);const gd=pd("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),yd=pd("ascii","a",(e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}),(e=>{const t=dd((e=e.substring(1)).length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t})),vd=Af({utf8:gd,"utf-8":gd,hex:fd.base16,latin1:yd,ascii:yd,binary:yd},fd);function md(e,t="utf8"){const n=vd[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode(`${n.prefix}${e}`):hd(globalThis.Buffer.from(e,"utf-8"))}const _d="wc",bd=2,wd="core",Ed=`${_d}@2:${wd}:`,Sd={name:wd,logger:"error"},Od={database:":memory:"},Id="crypto",xd="client_ed25519_seed",Rd=Qe.ONE_DAY,kd="keychain",Cd="0.3",Pd="messages",Ad="0.3",Nd=Qe.SIX_HOURS,Td="publisher",Md="irn",Ld="error",jd="wss://relay.walletconnect.com",Ud="wss://relay.walletconnect.org",Dd="relayer",zd={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Fd="_subscription",Bd={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Hd=Qe.ONE_SECOND,qd="2.10.6",$d=1e4,Vd="0.3",Wd="WALLETCONNECT_CLIENT_ID",Kd={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},Gd="subscription",Yd="0.3",Qd=1e3*Qe.FIVE_SECONDS,Jd="pairing",Xd="0.3",Zd={wc_pairingDelete:{req:{ttl:Qe.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Qe.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Qe.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Qe.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Qe.ONE_DAY,prompt:!1,tag:0},res:{ttl:Qe.ONE_DAY,prompt:!1,tag:0}}},ep={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},tp={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},np="history",rp="0.3",ip="expirer",op={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},sp="0.3",ap="verify-api",up="https://verify.walletconnect.com",cp="https://verify.walletconnect.org",lp=[up,cp];class fp{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=kd,this.version=Cd,this.initialized=!1,this.storagePrefix=Ed,this.init=async()=>{if(!this.initialized){const e=await this.getKeyChain();typeof e<"u"&&(this.keychain=e),this.initialized=!0}},this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()},this.get=e=>{this.isInitialized();const t=this.keychain.get(e);if(typeof t>"u"){const{message:t}=dc("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t},this.del=async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()},this.core=e,this.logger=hn.generateChildLogger(t,this.name)}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Pu(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Au(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=dc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class hp{constructor(e,t,n){this.core=e,this.logger=t,this.name=Id,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=async()=>(this.isInitialized(),ss(ls(await this.getClientSeed()).publicKey)),this.generateKeyPair=()=>{this.isInitialized();const e=Ya();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();const t=ls(await this.getClientSeed()),n=Qa();return await fs(n,e,Rd,t)},this.generateSharedKey=(e,t,n)=>{this.isInitialized();const r=Ja(this.getPrivateKey(e),t);return this.setSymKey(r,n)},this.setSymKey=async(e,t)=>{this.isInitialized();const n=t||Xa(e);return await this.keychain.set(n,e),n},this.deleteKeyPair=async e=>{this.isInitialized(),await this.keychain.del(e)},this.deleteSymKey=async e=>{this.isInitialized(),await this.keychain.del(e)},this.encode=async(e,t,n)=>{this.isInitialized();const r=au(n),i=ue(t);if(uu(r)){const t=r.senderPublicKey,n=r.receiverPublicKey;e=await this.generateSharedKey(t,n)}const o=this.getSymKey(e),{type:s,senderPublicKey:a}=r;return nu({type:s,symKey:o,message:i,senderPublicKey:a})},this.decode=async(e,t,n)=>{this.isInitialized();const r=su(t,n);if(uu(r)){const t=r.receiverPublicKey,n=r.senderPublicKey;e=await this.generateSharedKey(t,n)}try{const n=this.getSymKey(e);return ae(ru({symKey:n,encoded:t}))}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}},this.getPayloadType=e=>tu(ou(e).type),this.getPayloadSenderPublicKey=e=>{const t=ou(e);return t.senderPublicKey?rs(t.senderPublicKey,Fa):void 0},this.core=e,this.logger=hn.generateChildLogger(t,this.name),this.keychain=n||new fp(this.core,this.logger)}get context(){return hn.getLoggerContext(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(xd)}catch{e=Qa(),await this.keychain.set(xd,e)}return md(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=dc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class dp extends Xn{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=Pd,this.version=Ad,this.initialized=!1,this.storagePrefix=Ed,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const e=await this.getRelayerMessages();typeof e<"u"&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}},this.set=async(e,t)=>{this.isInitialized();const n=Za(t);let r=this.messages.get(e);return typeof r>"u"&&(r={}),typeof r[n]<"u"||(r[n]=t,this.messages.set(e,r),await this.persist()),n},this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>(this.isInitialized(),typeof this.get(e)[Za(t)]<"u"),this.del=async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()},this.logger=hn.generateChildLogger(e,this.name),this.core=t}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Pu(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Au(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=dc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class pp extends Zn{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new o.exports.EventEmitter,this.name=Td,this.queue=new Map,this.publishTimeout=Qe.toMiliseconds(Qe.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(e,t,n)=>{var r;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:n}});try{const i=n?.ttl||Nd,o=Vu(n),s=n?.prompt||!1,a=n?.tag||0,u=n?.id||Jl().toString(),c={topic:e,message:t,opts:{ttl:i,relay:o,prompt:s,tag:a,id:u}},l=setTimeout((()=>this.queue.set(u,c)),this.publishTimeout);try{await await Tu(this.rpcPublish(e,t,i,o,s,a,u),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(u),this.relayer.events.emit(zd.publish,c)}catch(e){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,null!=(r=n?.internal)&&r.throwOnFailedPublish)throw this.removeRequestFromQueue(u),e;return}finally{clearTimeout(l)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:n}})}catch(e){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(e),e}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.relayer=e,this.logger=hn.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return hn.getLoggerContext(this.logger)}rpcPublish(e,t,n,r,i,o,s){var a,u,c,l;const f={method:Wu(r.protocol).publish,params:{topic:e,message:t,ttl:n,prompt:i,tag:o},id:s};return vc(null==(a=f.params)?void 0:a.prompt)&&(null==(u=f.params)||delete u.prompt),vc(null==(c=f.params)?void 0:c.tag)&&(null==(l=f.params)||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f}),this.relayer.request(f)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach((async e=>{const{topic:t,message:n,opts:r}=e;await this.publish(t,n,r)}))}registerEventListeners(){this.relayer.core.heartbeat.on(Se.HEARTBEAT_EVENTS.pulse,(()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit(zd.connection_stalled);this.checkQueue()})),this.relayer.on(zd.message_ack,(e=>{this.removeRequestFromQueue(e.id.toString())}))}}class gp{constructor(){this.map=new Map,this.set=(e,t)=>{const n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,t))return;const r=n.filter((e=>e!==t));r.length?this.map.set(e,r):this.map.delete(e)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var yp=Object.defineProperty,vp=Object.defineProperties,mp=Object.getOwnPropertyDescriptors,_p=Object.getOwnPropertySymbols,bp=Object.prototype.hasOwnProperty,wp=Object.prototype.propertyIsEnumerable,Ep=(e,t,n)=>t in e?yp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sp=(e,t)=>{for(var n in t||(t={}))bp.call(t,n)&&Ep(e,n,t[n]);if(_p)for(var n of _p(t))wp.call(t,n)&&Ep(e,n,t[n]);return e},Op=(e,t)=>vp(e,mp(t));class Ip extends nr{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new gp,this.events=new o.exports.EventEmitter,this.name=Gd,this.version=Yd,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Ed,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{const n=Vu(t),r={topic:e,relay:n};this.pending.set(e,r);const i=await this.rpcSubscribe(e,n);return this.onSubscribe(i,r),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}}),i}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}},this.unsubscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),typeof t?.id<"u"?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)},this.isSubscribed=async e=>!!this.topics.includes(e)||await new Promise(((t,n)=>{const r=new Qe.Watch;r.start(this.pendingSubscriptionWatchLabel);const i=setInterval((()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(i),r.stop(this.pendingSubscriptionWatchLabel),t(!0)),r.elapsed(this.pendingSubscriptionWatchLabel)>=Qd&&(clearInterval(i),r.stop(this.pendingSubscriptionWatchLabel),n(new Error("Subscription resolution timeout")))}),this.pollingInterval)})).catch((()=>!1)),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=hn.generateChildLogger(t,this.name),this.clientId=""}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const n=this.topicMap.get(e);await Promise.all(n.map((async n=>await this.unsubscribeById(e,n,t))))}async unsubscribeById(e,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}});try{const r=Vu(n);await this.rpcUnsubscribe(e,t,r);const i=pc("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}})}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}async rpcSubscribe(e,t){const n={method:Wu(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await Tu(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(zd.connection_stalled)}return Za(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;const t={method:Wu(e[0].relay.protocol).batchSubscribe,params:{topics:e.map((e=>e.topic))}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{return await await Tu(this.relayer.request(t),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(zd.connection_stalled)}}rpcUnsubscribe(e,t,n){const r={method:Wu(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}onSubscribe(e,t){this.setSubscription(e,Op(Sp({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach((e=>{this.setSubscription(e.id,Sp({},e)),this.pending.delete(e.topic)}))}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,Sp({},t)),this.topicMap.set(t.topic,e),this.events.emit(Kd.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:t}=dc("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Kd.deleted,Op(Sp({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Kd.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const e=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(e)}}this.events.emit(Kd.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:e}=dc("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);gc(t)&&this.onBatchSubscribe(t.map(((t,n)=>Op(Sp({},e[n]),{id:t}))))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const e=[];this.pending.forEach((t=>{e.push(t)})),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Se.HEARTBEAT_EVENTS.pulse,(async()=>{await this.checkPending()})),this.relayer.on(zd.connect,(async()=>{await this.onConnect()})),this.relayer.on(zd.disconnect,(()=>{this.onDisconnect()})),this.events.on(Kd.created,(async e=>{const t=Kd.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})),this.events.on(Kd.deleted,(async e=>{const t=Kd.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=dc("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.restartInProgress||(clearInterval(t),e())}),this.pollingInterval)}))}}var xp=Object.defineProperty,Rp=Object.getOwnPropertySymbols,kp=Object.prototype.hasOwnProperty,Cp=Object.prototype.propertyIsEnumerable,Pp=(e,t,n)=>t in e?xp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ap=(e,t)=>{for(var n in t||(t={}))kp.call(t,n)&&Pp(e,n,t[n]);if(Rp)for(var n of Rp(t))Cp.call(t,n)&&Pp(e,n,t[n]);return e};class Np extends er{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new o.exports.EventEmitter,this.name=Dd,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async e=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(e)}catch(e){throw this.logger.debug("Failed to Publish Request"),this.logger.error(e),e}},this.onPayloadHandler=e=>{this.onProviderPayload(e)},this.onConnectHandler=()=>{this.events.emit(zd.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit(zd.error,e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Bd.payload,this.onPayloadHandler),this.provider.on(Bd.connect,this.onConnectHandler),this.provider.on(Bd.disconnect,this.onDisconnectHandler),this.provider.on(Bd.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&"string"!=typeof e.logger?hn.generateChildLogger(e.logger,this.name):hn.pino(hn.getDefaultLoggerOptions({level:e.logger||Ld})),this.messages=new dp(this.logger,e.core),this.subscriber=new Ip(this,this.logger),this.publisher=new pp(this,this.logger),this.relayUrl=e?.relayUrl||jd,this.projectId=e.projectId,this.bundleId=Eu(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Ud}...`),await this.restartTransport(Ud)}this.initialized=!0,setTimeout((async()=>{0===this.subscriber.topics.length&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)}),$d)}get context(){return hn.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var n;this.isInitialized();let r,i=(null==(n=this.subscriber.topicMap.get(e))?void 0:n[0])||"";if(i)return i;const o=t=>{t.topic===e&&(this.subscriber.off(Kd.created,o),r())};return await Promise.all([new Promise((e=>{r=e,this.subscriber.on(Kd.created,o)})),new Promise((async n=>{i=await this.subscriber.subscribe(e,t),n()}))]),i}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await Tu(this.provider.disconnect(),1e3,"provider.disconnect()").catch((()=>this.onProviderDisconnect())):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise((e=>{if(!this.initialized)return e();this.subscriber.once(Kd.resubscribed,(()=>{e()}))})),new Promise((async(e,t)=>{try{await Tu(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(e){return void t(e)}e()}))])}catch(e){this.logger.error(e);const t=e;if(!this.isConnectionStalled(t.message))throw e;this.provider.events.emit(Bd.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await el())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some((t=>e.includes(t)))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new mf(new Sf(ku({sdkVersion:qd,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:n}=e;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(e){const{topic:t,message:n}=e;if(!n||0===n.length)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const r=this.messages.has(t,n);return r&&this.logger.debug(`Ignoring duplicate message: ${n}`),r}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),pf(e)){if(!e.method.endsWith(Fd))return;const t=e.params,{topic:n,message:r,publishedAt:i}=t.data,o={topic:n,message:r,publishedAt:i};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ap({type:"event",event:t.id},o)),this.events.emit(t.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else gf(e)&&this.events.emit(zd.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(zd.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=Zl(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(Bd.payload,this.onPayloadHandler),this.provider.off(Bd.connect,this.onConnectHandler),this.provider.off(Bd.disconnect,this.onDisconnectHandler),this.provider.off(Bd.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(zd.connection_stalled,(()=>{this.restartTransport().catch((e=>this.logger.error(e)))}));let e=await el();il((async t=>{this.initialized&&e!==t&&(e=t,t?await this.restartTransport().catch((e=>this.logger.error(e))):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch((e=>this.logger.error(e)))))}))}onProviderDisconnect(){this.events.emit(zd.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout((async()=>{await this.restartTransport().catch((e=>this.logger.error(e)))}),Qe.toMiliseconds(Hd)))}isInitialized(){if(!this.initialized){const{message:e}=dc("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise((e=>{const t=setInterval((()=>{this.connected&&(clearInterval(t),e())}),this.connectionStatusPollingInterval)}));await this.restartTransport()}}}var Tp=Object.defineProperty,Mp=Object.getOwnPropertySymbols,Lp=Object.prototype.hasOwnProperty,jp=Object.prototype.propertyIsEnumerable,Up=(e,t,n)=>t in e?Tp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dp=(e,t)=>{for(var n in t||(t={}))Lp.call(t,n)&&Up(e,n,t[n]);if(Mp)for(var n of Mp(t))jp.call(t,n)&&Up(e,n,t[n]);return e};class zp extends tr{constructor(e,t,n,r=Ed,i=void 0){super(e,t,n,r),this.core=e,this.logger=t,this.name=n,this.map=new Map,this.version=Vd,this.cached=[],this.initialized=!1,this.storagePrefix=Ed,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>{this.getKey&&null!==e&&!vc(e)?this.map.set(this.getKey(e),e):Oc(e)?this.map.set(e.id,e):Ic(e)&&this.map.set(e.topic,e)})),this.cached=[],this.initialized=!0)},this.set=async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())},this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter((t=>Object.keys(e).every((n=>If(t[n],e[n]))))):this.values),this.update=async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});const n=Dp(Dp({},this.getData(e)),t);this.map.set(e,n),await this.persist()},this.delete=async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),await this.persist())},this.logger=hn.generateChildLogger(t,this.name),this.storagePrefix=r,this.getKey=i}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){const{message:t}=dc("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:e}=dc("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=dc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Fp{constructor(e,t){this.core=e,this.logger=t,this.name=Jd,this.version=Xd,this.events=new o.exports,this.initialized=!1,this.storagePrefix=Ed,this.ignoredPayloadTypes=[$a],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]},this.create=async()=>{this.isInitialized();const e=Qa(),t=await this.core.crypto.setSymKey(e),n=Du(Qe.FIVE_MINUTES),r={protocol:Md},i={topic:t,expiry:n,relay:r,active:!1},o=rc({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:e,relay:r});return await this.pairings.set(t,i),await this.core.relayer.subscribe(t),this.core.expirer.set(t,n),{topic:t,uri:o}},this.pair=async e=>{this.isInitialized(),this.isValidPair(e);const{topic:t,symKey:n,relay:r}=ec(e.uri);let i;if(this.pairings.keys.includes(t)&&(i=this.pairings.get(t),i.active))throw new Error(`Pairing already exists: ${t}. Please try again with a new connection URI.`);const o=Du(Qe.FIVE_MINUTES),s={topic:t,relay:r,expiry:o,active:!1};return await this.pairings.set(t,s),this.core.expirer.set(t,o),e.activatePairing&&await this.activate({topic:t}),this.events.emit(ep.create,s),this.core.crypto.keychain.has(t)||(await this.core.crypto.setSymKey(n,t),await this.core.relayer.subscribe(t,{relay:r})),s},this.activate=async({topic:e})=>{this.isInitialized();const t=Du(Qe.THIRTY_DAYS);await this.pairings.update(e,{active:!0,expiry:t}),this.core.expirer.set(e,t)},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.pairings.keys.includes(t)){const e=await this.sendRequest(t,"wc_pairingPing",{}),{done:n,resolve:r,reject:i}=Nu();this.events.once(Fu("pairing_ping",e),(({error:e})=>{e?i(e):r()})),await n()}},this.updateExpiry=async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})},this.updateMetadata=async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",pc("USER_DISCONNECTED")),await this.deletePairing(t))},this.sendRequest=async(e,t,n)=>{const r=Xl(t,n),i=await this.core.crypto.encode(e,r),o=Zd[t].req;return this.core.history.set(e,r),this.core.relayer.publish(e,i,o),r.id},this.sendResult=async(e,t,n)=>{const r=Zl(e,n),i=await this.core.crypto.encode(t,r),o=await this.core.history.get(t,e),s=Zd[o.request.method].res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(r)},this.sendError=async(e,t,n)=>{const r=ef(e,n),i=await this.core.crypto.encode(t,r),o=await this.core.history.get(t,e),s=Zd[o.request.method]?Zd[o.request.method].res:Zd.unregistered_method.res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(r)},this.deletePairing=async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,pc("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])},this.cleanup=async()=>{const e=this.pairings.getAll().filter((e=>zu(e.expiry)));await Promise.all(e.map((e=>this.deletePairing(e.topic))))},this.onRelayEventRequest=e=>{const{topic:t,payload:n}=e;switch(n.method){case"wc_pairingPing":return this.onPairingPingRequest(t,n);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,n);default:return this.onUnknownRpcMethodRequest(t,n)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:n}=e,r=(await this.core.history.get(t,n.id)).request.method;return"wc_pairingPing"===r?this.onPairingPingResponse(t,n):this.onUnknownRpcMethodResponse(r)},this.onPairingPingRequest=async(e,t)=>{const{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult(n,e,!0),this.events.emit(ep.ping,{id:n,topic:e})}catch(t){await this.sendError(n,e,t),this.logger.error(t)}},this.onPairingPingResponse=(e,t)=>{const{id:n}=t;setTimeout((()=>{yf(t)?this.events.emit(Fu("pairing_ping",n),{}):vf(t)&&this.events.emit(Fu("pairing_ping",n),{error:t.error})}),500)},this.onPairingDeleteRequest=async(e,t)=>{const{id:n}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(ep.delete,{id:n,topic:e})}catch(t){await this.sendError(n,e,t),this.logger.error(t)}},this.onUnknownRpcMethodRequest=async(e,t)=>{const{id:n,method:r}=t;try{if(this.registeredMethods.includes(r))return;const t=pc("WC_METHOD_UNSUPPORTED",r);await this.sendError(n,e,t),this.logger.error(t)}catch(t){await this.sendError(n,e,t),this.logger.error(t)}},this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error(pc("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=e=>{var t;if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`pair() params: ${e}`);throw new Error(t)}if(!Sc(e.uri)){const{message:t}=dc("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw new Error(t)}const n=ec(e.uri);if(null==(t=n?.relay)||!t.protocol){const{message:e}=dc("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(e)}if(null==n||!n.symKey){const{message:e}=dc("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(e)}},this.isValidPing=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!mc(e,!1)){const{message:t}=dc("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.pairings.keys.includes(e)){const{message:t}=dc("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(zu(this.pairings.get(e).expiry)){await this.deletePairing(e);const{message:t}=dc("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}},this.core=e,this.logger=hn.generateChildLogger(t,this.name),this.pairings=new zp(this.core,this.logger,this.name,this.storagePrefix)}get context(){return hn.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=dc("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(zd.message,(async e=>{const{topic:t,message:n}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const r=await this.core.crypto.decode(t,n);try{pf(r)?(this.core.history.set(t,r),this.onRelayEventRequest({topic:t,payload:r})):gf(r)&&(await this.core.history.resolve(r),await this.onRelayEventResponse({topic:t,payload:r}),this.core.history.delete(t,r.id))}catch(e){this.logger.error(e)}}))}registerExpirerEvents(){this.core.expirer.on(op.expired,(async e=>{const{topic:t}=Uu(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(ep.expire,{topic:t}))}))}}class Bp extends Jn{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new o.exports.EventEmitter,this.name=np,this.version=rp,this.cached=[],this.initialized=!1,this.storagePrefix=Ed,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.records.set(e.id,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(e,t,n)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:n}),this.records.has(t.id))return;const r={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:n,expiry:Du(Qe.THIRTY_DAYS)};this.records.set(r.id,r),this.events.emit(tp.created,r)},this.resolve=async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;const t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=vf(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.events.emit(tp.updated,t))},this.get=async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)),this.delete=(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach((n=>{if(n.topic===e){if(typeof t<"u"&&n.id!==t)return;this.records.delete(n.id),this.events.emit(tp.deleted,n)}}))},this.exists=async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=hn.generateChildLogger(t,this.name)}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach((t=>{if(typeof t.response<"u")return;const n={topic:t.topic,request:Xl(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)})),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:t}=dc("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(tp.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:e}=dc("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(tp.created,(e=>{const t=tp.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.events.on(tp.updated,(e=>{const t=tp.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.events.on(tp.deleted,(e=>{const t=tp.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.core.heartbeat.on(Se.HEARTBEAT_EVENTS.pulse,(()=>{this.cleanup()}))}cleanup(){try{this.records.forEach((e=>{Qe.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))}))}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=dc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Hp extends rr{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new o.exports.EventEmitter,this.name=ip,this.version=sp,this.cached=[],this.initialized=!1,this.storagePrefix=Ed,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.expirations.set(e.target,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=e=>{try{const t=this.formatTarget(e);return typeof this.getExpiration(t)<"u"}catch{return!1}},this.set=(e,t)=>{this.isInitialized();const n=this.formatTarget(e),r={target:n,expiry:t};this.expirations.set(n,r),this.checkExpiry(n,r),this.events.emit(op.created,{target:n,expiration:r})},this.get=e=>{this.isInitialized();const t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){const t=this.formatTarget(e),n=this.getExpiration(t);this.expirations.delete(t),this.events.emit(op.deleted,{target:t,expiration:n})}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=hn.generateChildLogger(t,this.name)}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return Lu(e);if("number"==typeof e)return ju(e);const{message:t}=dc("UNKNOWN_TYPE","Target type: "+typeof e);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(op.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:e}=dc("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:t}=dc("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}checkExpiry(e,t){const{expiry:n}=t;Qe.toMiliseconds(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(op.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach(((e,t)=>this.checkExpiry(t,e)))}registerEventListeners(){this.core.heartbeat.on(Se.HEARTBEAT_EVENTS.pulse,(()=>this.checkExpirations())),this.events.on(op.created,(e=>{const t=op.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(op.expired,(e=>{const t=op.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(op.deleted,(e=>{const t=op.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=dc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class qp extends ir{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=ap,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async e=>{if(this.verifyDisabled||_u()||!bu())return;const t=this.getVerifyUrl(e?.verifyUrl);this.verifyUrl!==t&&this.removeIframe(),this.verifyUrl=t;try{await this.createIframe()}catch(e){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(e)}if(!this.initialized){this.removeIframe(),this.verifyUrl=cp;try{await this.createIframe()}catch(e){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(e),this.verifyDisabled=!0}}},this.register=async e=>{this.initialized?this.sendPost(e.attestationId):(this.addToQueue(e.attestationId),await this.init())},this.resolve=async e=>{if(this.isDevEnv)return"";const t=this.getVerifyUrl(e?.verifyUrl);let n;try{n=await this.fetchAttestation(e.attestationId,t)}catch(r){this.logger.info(`failed to resolve attestation: ${e.attestationId} from url: ${t}`),this.logger.info(r),n=await this.fetchAttestation(e.attestationId,cp)}return n},this.fetchAttestation=async(e,t)=>{this.logger.info(`resolving attestation: ${e} from url: ${t}`);const n=this.startAbortTimer(2*Qe.ONE_SECOND),r=await fetch(`${t}/attestation/${e}`,{signal:this.abortController.signal});return clearTimeout(n),200===r.status?await r.json():void 0},this.addToQueue=e=>{this.queue.push(e)},this.processQueue=()=>{0!==this.queue.length&&(this.queue.forEach((e=>this.sendPost(e))),this.queue=[])},this.sendPost=e=>{var t;try{if(!this.iframe)return;null==(t=this.iframe.contentWindow)||t.postMessage(e,"*"),this.logger.info(`postMessage sent: ${e} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let e;const t=n=>{"verify_ready"===n.data&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",t),e())};await Promise.race([new Promise((n=>{if(document.getElementById(ap))return n();window.addEventListener("message",t);const r=document.createElement("iframe");r.id=ap,r.src=`${this.verifyUrl}/${this.projectId}`,r.style.display="none",document.body.append(r),this.iframe=r,e=n})),new Promise(((e,n)=>setTimeout((()=>{window.removeEventListener("message",t),n("verify iframe load timeout")}),Qe.toMiliseconds(Qe.FIVE_SECONDS))))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=e=>{let t=e||up;return lp.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${up}`),t=up),t},this.logger=hn.generateChildLogger(t,this.name),this.verifyUrl=up,this.abortController=new AbortController,this.isDevEnv=mu()&&process.env.IS_VITEST}get context(){return hn.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout((()=>this.abortController.abort()),Qe.toMiliseconds(e))}}var $p=Object.defineProperty,Vp=Object.getOwnPropertySymbols,Wp=Object.prototype.hasOwnProperty,Kp=Object.prototype.propertyIsEnumerable,Gp=(e,t,n)=>t in e?$p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yp=(e,t)=>{for(var n in t||(t={}))Wp.call(t,n)&&Gp(e,n,t[n]);if(Vp)for(var n of Vp(t))Kp.call(t,n)&&Gp(e,n,t[n]);return e};class Qp extends Qn{constructor(e){super(e),this.protocol=_d,this.version=bd,this.name=wd,this.events=new o.exports.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||jd,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const t=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:hn.pino(hn.getDefaultLoggerOptions({level:e?.logger||Sd.logger}));this.logger=hn.generateChildLogger(t,this.name),this.heartbeat=new Se.HeartBeat,this.crypto=new hp(this,this.logger,e?.keychain),this.history=new Bp(this,this.logger),this.expirer=new Hp(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new Ee(Yp(Yp({},Od),e?.storageOptions)),this.relayer=new Np({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Fp(this,this.logger),this.verify=new qp(this.projectId||"",this.logger)}static async init(e){const t=new Qp(e);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem(Wd,n),t}get context(){return hn.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const Jp=Qp,Xp="wc",Zp=2,eg="client",tg=`${Xp}@${Zp}:${eg}:`,ng={name:eg,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},rg="WALLETCONNECT_DEEPLINK_CHOICE",ig="proposal",og="Proposal expired",sg="session",ag=Qe.SEVEN_DAYS,ug="engine",cg={wc_sessionPropose:{req:{ttl:Qe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Qe.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Qe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Qe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Qe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Qe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Qe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Qe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Qe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Qe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Qe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Qe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Qe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Qe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Qe.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Qe.THIRTY_SECONDS,prompt:!1,tag:1115}}},lg={min:Qe.FIVE_MINUTES,max:Qe.SEVEN_DAYS},fg={idle:"IDLE",active:"ACTIVE"},hg="request",dg=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var pg=Object.defineProperty,gg=Object.defineProperties,yg=Object.getOwnPropertyDescriptors,vg=Object.getOwnPropertySymbols,mg=Object.prototype.hasOwnProperty,_g=Object.prototype.propertyIsEnumerable,bg=(e,t,n)=>t in e?pg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wg=(e,t)=>{for(var n in t||(t={}))mg.call(t,n)&&bg(e,n,t[n]);if(vg)for(var n of vg(t))_g.call(t,n)&&bg(e,n,t[n]);return e},Eg=(e,t)=>gg(e,yg(t));class Sg extends sr{constructor(e){super(e),this.name=ug,this.events=new o.exports,this.initialized=!1,this.ignoredPayloadTypes=[$a],this.requestQueue={state:fg.idle,queue:[]},this.sessionRequestQueue={state:fg.idle,queue:[]},this.requestQueueDelay=Qe.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(cg)}),this.initialized=!0,setTimeout((()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),Qe.toMiliseconds(this.requestQueueDelay)))},this.connect=async e=>{await this.isInitialized();const t=Eg(wg({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);const{pairingTopic:n,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:o,relays:s}=t;let a,u=n,c=!1;if(u&&(c=this.client.core.pairing.pairings.get(u).active),!u||!c){const{topic:e,uri:t}=await this.client.core.pairing.create();u=e,a=t}const l=await this.client.core.crypto.generateKeyPair(),f=wg({requiredNamespaces:r,optionalNamespaces:i,relays:s??[{protocol:Md}],proposer:{publicKey:l,metadata:this.client.metadata}},o&&{sessionProperties:o}),{reject:h,resolve:d,done:p}=Nu(Qe.FIVE_MINUTES,og);if(this.events.once(Fu("session_connect"),(async({error:e,session:t})=>{if(e)h(e);else if(t){t.self.publicKey=l;const e=Eg(wg({},t),{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),u&&await this.client.core.pairing.updateMetadata({topic:u,metadata:t.peer.metadata}),d(e)}})),!u){const{message:e}=dc("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(e)}const g=await this.sendRequest({topic:u,method:"wc_sessionPropose",params:f}),y=Du(Qe.FIVE_MINUTES);return await this.setProposal(g,wg({id:g,expiry:y},f)),{uri:a,approval:p}},this.pair=async e=>(await this.isInitialized(),await this.client.core.pairing.pair(e)),this.approve=async e=>{await this.isInitialized(),await this.isValidApprove(e);const{id:t,relayProtocol:n,namespaces:r,sessionProperties:i}=e,o=this.client.proposal.get(t);let{pairingTopic:s,proposer:a,requiredNamespaces:u,optionalNamespaces:c}=o;s=s||"",yc(u)||(u=uc(r,"approve()"));const l=await this.client.core.crypto.generateKeyPair(),f=a.publicKey,h=await this.client.core.crypto.generateSharedKey(l,f);s&&t&&(await this.client.core.pairing.updateMetadata({topic:s,metadata:a.metadata}),await this.sendResult({id:t,topic:s,result:{relay:{protocol:n??"irn"},responderPublicKey:l}}),await this.client.proposal.delete(t,pc("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:s}));const d=wg({relay:{protocol:n??"irn"},namespaces:r,requiredNamespaces:u,optionalNamespaces:c,pairingTopic:s,controller:{publicKey:l,metadata:this.client.metadata},expiry:Du(ag)},i&&{sessionProperties:i});await this.client.core.relayer.subscribe(h),await this.sendRequest({topic:h,method:"wc_sessionSettle",params:d,throwOnFailedPublish:!0});const p=Eg(wg({},d),{topic:h,pairingTopic:s,acknowledged:!1,self:d.controller,peer:{publicKey:a.publicKey,metadata:a.metadata},controller:l});return await this.client.session.set(h,p),await this.setExpiry(h,Du(ag)),{topic:h,acknowledged:()=>new Promise((e=>setTimeout((()=>e(this.client.session.get(h))),500)))}},this.reject=async e=>{await this.isInitialized(),await this.isValidReject(e);const{id:t,reason:n}=e,{pairingTopic:r}=this.client.proposal.get(t);r&&(await this.sendError(t,r,n),await this.client.proposal.delete(t,pc("USER_DISCONNECTED")))},this.update=async e=>{await this.isInitialized(),await this.isValidUpdate(e);const{topic:t,namespaces:n}=e,r=await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:n}}),{done:i,resolve:o,reject:s}=Nu();return this.events.once(Fu("session_update",r),(({error:e})=>{e?s(e):o()})),await this.client.session.update(t,{namespaces:n}),{acknowledged:i}},this.extend=async e=>{await this.isInitialized(),await this.isValidExtend(e);const{topic:t}=e,n=await this.sendRequest({topic:t,method:"wc_sessionExtend",params:{}}),{done:r,resolve:i,reject:o}=Nu();return this.events.once(Fu("session_extend",n),(({error:e})=>{e?o(e):i()})),await this.setExpiry(t,Du(ag)),{acknowledged:r}},this.request=async e=>{await this.isInitialized(),await this.isValidRequest(e);const{chainId:t,request:n,topic:r,expiry:i}=e,o=Ql(),{done:s,resolve:a,reject:u}=Nu(i,"Request expired. Please try again.");return this.events.once(Fu("session_request",o),(({error:e,result:t})=>{e?u(e):a(t)})),await Promise.all([new Promise((async e=>{await this.sendRequest({clientRpcId:o,topic:r,method:"wc_sessionRequest",params:{request:n,chainId:t},expiry:i,throwOnFailedPublish:!0}).catch((e=>u(e))),this.client.events.emit("session_request_sent",{topic:r,request:n,chainId:t,id:o}),e()})),new Promise((async e=>{const t=await qu(this.client.core.storage,rg);Hu({id:o,topic:r,wcDeepLink:t}),e()})),s()]).then((e=>e[2]))},this.respond=async e=>{await this.isInitialized(),await this.isValidRespond(e);const{topic:t,response:n}=e,{id:r}=n;yf(n)?await this.sendResult({id:r,topic:t,result:n.result,throwOnFailedPublish:!0}):vf(n)&&await this.sendError(r,t,n.error),this.cleanupAfterResponse(e)},this.ping=async e=>{await this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=await this.sendRequest({topic:t,method:"wc_sessionPing",params:{}}),{done:n,resolve:r,reject:i}=Nu();this.events.once(Fu("session_ping",e),(({error:e})=>{e?i(e):r()})),await n()}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{await this.isInitialized(),await this.isValidEmit(e);const{topic:t,event:n,chainId:r}=e;await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:n,chainId:r}})},this.disconnect=async e=>{await this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.client.session.keys.includes(t)?(await this.sendRequest({topic:t,method:"wc_sessionDelete",params:pc("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(t)):await this.client.core.pairing.disconnect({topic:t})},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter((t=>bc(t,e)))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter((n=>{var r,i;return(null==(r=n.peerMetadata)?void 0:r.url)&&(null==(i=n.peerMetadata)?void 0:i.url)===e.peer.metadata.url&&n.topic&&n.topic!==t.topic}));if(0===n.length)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e){this.client.logger.error(e)}},this.deleteSession=async(e,t)=>{const{self:n}=this.client.session.get(e);await this.client.core.relayer.unsubscribe(e),this.client.session.delete(e,pc("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(n.publicKey)&&await this.client.core.crypto.deleteKeyPair(n.publicKey),this.client.core.crypto.keychain.has(e)&&await this.client.core.crypto.deleteSymKey(e),t||this.client.core.expirer.del(e),this.client.core.storage.removeItem(rg).catch((e=>this.client.logger.warn(e)))},this.deleteProposal=async(e,t)=>{await Promise.all([this.client.proposal.delete(e,pc("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)])},this.deletePendingSessionRequest=async(e,t,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),n?Promise.resolve():this.client.core.expirer.del(e)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter((t=>t.id!==e)),n&&(this.sessionRequestQueue.state=fg.idle)},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&await this.client.session.update(e,{expiry:t}),this.client.core.expirer.set(e,t)},this.setProposal=async(e,t)=>{await this.client.proposal.set(e,t),this.client.core.expirer.set(e,t.expiry)},this.setPendingSessionRequest=async e=>{const t=cg.wc_sessionRequest.req.ttl,{id:n,topic:r,params:i,verifyContext:o}=e;await this.client.pendingRequest.set(n,{id:n,topic:r,params:i,verifyContext:o}),t&&this.client.core.expirer.set(n,Du(t))},this.sendRequest=async e=>{const{topic:t,method:n,params:r,expiry:i,relayRpcId:o,clientRpcId:s,throwOnFailedPublish:a}=e,u=Xl(n,r,s);if(bu()&&dg.includes(n)){const e=Za(JSON.stringify(u));this.client.core.verify.register({attestationId:e})}const c=await this.client.core.crypto.encode(t,u),l=cg[n].req;return i&&(l.ttl=i),o&&(l.id=o),this.client.core.history.set(t,u),a?(l.internal=Eg(wg({},l.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,c,l)):this.client.core.relayer.publish(t,c,l).catch((e=>this.client.logger.error(e))),u.id},this.sendResult=async e=>{const{id:t,topic:n,result:r,throwOnFailedPublish:i}=e,o=Zl(t,r),s=await this.client.core.crypto.encode(n,o),a=await this.client.core.history.get(n,t),u=cg[a.request.method].res;i?(u.internal=Eg(wg({},u.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,s,u)):this.client.core.relayer.publish(n,s,u).catch((e=>this.client.logger.error(e))),await this.client.core.history.resolve(o)},this.sendError=async(e,t,n)=>{const r=ef(e,n),i=await this.client.core.crypto.encode(t,r),o=await this.client.core.history.get(t,e),s=cg[o.request.method].res;this.client.core.relayer.publish(t,i,s),await this.client.core.history.resolve(r)},this.cleanup=async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{zu(t.expiry)&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{zu(e.expiry)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession(e))),...t.map((e=>this.deleteProposal(e)))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state!==fg.active){for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=fg.active;const e=this.requestQueue.queue.shift();if(e)try{this.processRequest(e),await new Promise((e=>setTimeout(e,300)))}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=fg.idle}else this.client.logger.info("Request queue already active, skipping...")},this.processRequest=e=>{const{topic:t,payload:n}=e,r=n.method;switch(r){case"wc_sessionPropose":return this.onSessionProposeRequest(t,n);case"wc_sessionSettle":return this.onSessionSettleRequest(t,n);case"wc_sessionUpdate":return this.onSessionUpdateRequest(t,n);case"wc_sessionExtend":return this.onSessionExtendRequest(t,n);case"wc_sessionPing":return this.onSessionPingRequest(t,n);case"wc_sessionDelete":return this.onSessionDeleteRequest(t,n);case"wc_sessionRequest":return this.onSessionRequest(t,n);case"wc_sessionEvent":return this.onSessionEventRequest(t,n);default:return this.client.logger.info(`Unsupported request method ${r}`)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:n}=e,r=(await this.client.core.history.get(t,n.id)).request.method;switch(r){case"wc_sessionPropose":return this.onSessionProposeResponse(t,n);case"wc_sessionSettle":return this.onSessionSettleResponse(t,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,n);case"wc_sessionExtend":return this.onSessionExtendResponse(t,n);case"wc_sessionPing":return this.onSessionPingResponse(t,n);case"wc_sessionRequest":return this.onSessionRequestResponse(t,n);default:return this.client.logger.info(`Unsupported response method ${r}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:t}=e,{message:n}=dc("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.onSessionProposeRequest=async(e,t)=>{const{params:n,id:r}=t;try{this.isValidConnect(wg({},t.params));const i=Du(Qe.FIVE_MINUTES),o=wg({id:r,pairingTopic:e,expiry:i},n);await this.setProposal(r,o);const s=Za(JSON.stringify(t)),a=await this.getVerifyContext(s,o.proposer.metadata);this.client.events.emit("session_proposal",{id:r,params:o,verifyContext:a})}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionProposeResponse=async(e,t)=>{const{id:n}=t;if(yf(t)){const{result:r}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:r});const i=this.client.proposal.get(n);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:i});const o=i.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:o});const s=r.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:s});const a=await this.client.core.crypto.generateSharedKey(o,s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:a});const u=await this.client.core.relayer.subscribe(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:e})}else vf(t)&&(await this.client.proposal.delete(n,pc("USER_DISCONNECTED")),this.events.emit(Fu("session_connect"),{error:t.error}))},this.onSessionSettleRequest=async(e,t)=>{const{id:n,params:r}=t;try{this.isValidSessionSettleRequest(r);const{relay:n,controller:i,expiry:o,namespaces:s,requiredNamespaces:a,optionalNamespaces:u,sessionProperties:c,pairingTopic:l}=t.params,f=wg({topic:e,relay:n,expiry:o,namespaces:s,acknowledged:!0,pairingTopic:l,requiredNamespaces:a,optionalNamespaces:u,controller:i.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:i.publicKey,metadata:i.metadata}},c&&{sessionProperties:c});await this.sendResult({id:t.id,topic:e,result:!0}),this.events.emit(Fu("session_connect"),{session:f}),this.cleanupDuplicatePairings(f)}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.onSessionSettleResponse=async(e,t)=>{const{id:n}=t;yf(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(Fu("session_approve",n),{})):vf(t)&&(await this.client.session.delete(e,pc("USER_DISCONNECTED")),this.events.emit(Fu("session_approve",n),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{const{params:n,id:r}=t;try{const t=`${e}_session_update`,i=ul.get(t);if(i&&this.isRequestOutOfSync(i,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidUpdate(wg({topic:e},n)),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:r,topic:e,result:!0}),this.client.events.emit("session_update",{id:r,topic:e,params:n}),ul.set(t,r)}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{const{id:n}=t;yf(t)?this.events.emit(Fu("session_update",n),{}):vf(t)&&this.events.emit(Fu("session_update",n),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{const{id:n}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,Du(ag)),await this.sendResult({id:n,topic:e,result:!0}),this.client.events.emit("session_extend",{id:n,topic:e})}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.onSessionExtendResponse=(e,t)=>{const{id:n}=t;yf(t)?this.events.emit(Fu("session_extend",n),{}):vf(t)&&this.events.emit(Fu("session_extend",n),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{const{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0}),this.client.events.emit("session_ping",{id:n,topic:e})}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.onSessionPingResponse=(e,t)=>{const{id:n}=t;setTimeout((()=>{yf(t)?this.events.emit(Fu("session_ping",n),{}):vf(t)&&this.events.emit(Fu("session_ping",n),{error:t.error})}),500)},this.onSessionDeleteRequest=async(e,t)=>{const{id:n}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),await Promise.all([new Promise((t=>{this.client.core.relayer.once(zd.publish,(async()=>{t(await this.deleteSession(e))}))})),this.sendResult({id:n,topic:e,result:!0})]),this.client.events.emit("session_delete",{id:n,topic:e})}catch(e){this.client.logger.error(e)}},this.onSessionRequest=async(e,t)=>{const{id:n,params:r}=t;try{this.isValidRequest(wg({topic:e},r));const t=Za(JSON.stringify(Xl("wc_sessionRequest",r,n))),i=this.client.session.get(e),o={id:n,topic:e,params:r,verifyContext:await this.getVerifyContext(t,i.peer.metadata)};await this.setPendingSessionRequest(o),this.addSessionRequestToSessionRequestQueue(o),this.processSessionRequestQueue()}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.onSessionRequestResponse=(e,t)=>{const{id:n}=t;yf(t)?this.events.emit(Fu("session_request",n),{result:t.result}):vf(t)&&this.events.emit(Fu("session_request",n),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{const{id:n,params:r}=t;try{const t=`${e}_session_event_${r.event.name}`,i=ul.get(t);if(i&&this.isRequestOutOfSync(i,n))return void this.client.logger.info(`Discarding out of sync request - ${n}`);this.isValidEmit(wg({topic:e},r)),this.client.events.emit("session_event",{id:n,topic:e,params:r}),ul.set(t,n)}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=fg.idle,this.processSessionRequestQueue()}),Qe.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===fg.active)return void this.client.logger.info("session request queue is already active.");const e=this.sessionRequestQueue.queue[0];if(e)try{this.sessionRequestQueue.state=fg.active,this.client.events.emit("session_request",e)}catch(e){this.client.logger.error(e)}else this.client.logger.info("session request queue is empty.")},this.onPairingCreated=e=>{if(e.active)return;const t=this.client.proposal.getAll().find((t=>t.pairingTopic===e.topic));t&&this.onSessionProposeRequest(e.topic,Xl("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id))},this.isValidConnect=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(t)}const{pairingTopic:t,requiredNamespaces:n,optionalNamespaces:r,sessionProperties:i,relays:o}=e;if(vc(t)||await this.isValidPairingTopic(t),!zc(o,!0)){const{message:e}=dc("MISSING_OR_INVALID",`connect() relays: ${o}`);throw new Error(e)}!vc(n)&&0!==yc(n)&&this.validateNamespaces(n,"requiredNamespaces"),!vc(r)&&0!==yc(r)&&this.validateNamespaces(r,"optionalNamespaces"),vc(i)||this.validateSessionProps(i,"sessionProperties")},this.validateNamespaces=(e,t)=>{const n=Mc(e,"connect()",t);if(n)throw new Error(n.message)},this.isValidApprove=async e=>{if(!Bc(e))throw new Error(dc("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:t,namespaces:n,relayProtocol:r,sessionProperties:i}=e;await this.isValidProposalId(t);const o=this.client.proposal.get(t),s=Lc(n,"approve()");if(s)throw new Error(s.message);const a=Yc(o.requiredNamespaces,n,"approve()");if(a)throw new Error(a.message);if(!mc(r,!0)){const{message:e}=dc("MISSING_OR_INVALID",`approve() relayProtocol: ${r}`);throw new Error(e)}vc(i)||this.validateSessionProps(i,"sessionProperties")},this.isValidReject=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(t)}const{id:t,reason:n}=e;if(await this.isValidProposalId(t),!Hc(n)){const{message:e}=dc("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidSessionSettleRequest=e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(t)}const{relay:t,controller:n,namespaces:r,expiry:i}=e;if(!jc(t)){const{message:e}=dc("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const o=xc(n,"onSessionSettleRequest()");if(o)throw new Error(o.message);const s=Lc(r,"onSessionSettleRequest()");if(s)throw new Error(s.message);if(zu(i)){const{message:e}=dc("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(t)}const{topic:t,namespaces:n}=e;await this.isValidSessionTopic(t);const r=this.client.session.get(t),i=Lc(n,"update()");if(i)throw new Error(i.message);const o=Yc(r.requiredNamespaces,n,"update()");if(o)throw new Error(o.message)},this.isValidExtend=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(t)}const{topic:t,request:n,chainId:r,expiry:i}=e;await this.isValidSessionTopic(t);const{namespaces:o}=this.client.session.get(t);if(!Wc(o,r)){const{message:e}=dc("MISSING_OR_INVALID",`request() chainId: ${r}`);throw new Error(e)}if(!qc(n)){const{message:e}=dc("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(e)}if(!Kc(o,r,n.method)){const{message:e}=dc("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(e)}if(i&&!Zc(i,lg)){const{message:e}=dc("MISSING_OR_INVALID",`request() expiry: ${i}. Expiry must be a number (in seconds) between ${lg.min} and ${lg.max}`);throw new Error(e)}},this.isValidRespond=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(t)}const{topic:t,response:n}=e;if(await this.isValidSessionTopic(t),!$c(n)){const{message:e}=dc("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidPing=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(t)}const{topic:t,event:n,chainId:r}=e;await this.isValidSessionTopic(t);const{namespaces:i}=this.client.session.get(t);if(!Wc(i,r)){const{message:e}=dc("MISSING_OR_INVALID",`emit() chainId: ${r}`);throw new Error(e)}if(!Vc(n)){const{message:e}=dc("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(e)}if(!Gc(i,r,n.name)){const{message:e}=dc("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidDisconnect=async e=>{if(!Bc(e)){const{message:t}=dc("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.getVerifyContext=async(e,t)=>{const n={verified:{verifyUrl:t.verifyUrl||up,validation:"UNKNOWN",origin:t.url||""}};try{const r=await this.client.core.verify.resolve({attestationId:e,verifyUrl:t.verifyUrl});r&&(n.verified.origin=r.origin,n.verified.isScam=r.isScam,n.verified.validation=r.origin===new URL(t.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.info(e)}return this.client.logger.info(`Verify context: ${JSON.stringify(n)}`),n},this.validateSessionProps=(e,t)=>{Object.values(e).forEach((e=>{if(!mc(e,!1)){const{message:n}=dc("MISSING_OR_INVALID",`${t} must be in Record<string, string> format. Received: ${JSON.stringify(e)}`);throw new Error(n)}}))}}async isInitialized(){if(!this.initialized){const{message:e}=dc("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(zd.message,(async e=>{const{topic:t,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const r=await this.client.core.crypto.decode(t,n);try{pf(r)?(this.client.core.history.set(t,r),this.onRelayEventRequest({topic:t,payload:r})):gf(r)?(await this.client.core.history.resolve(r),await this.onRelayEventResponse({topic:t,payload:r}),this.client.core.history.delete(t,r.id)):this.onRelayEventUnknownPayload({topic:t,payload:r})}catch(e){this.client.logger.error(e)}}))}registerExpirerEvents(){this.client.core.expirer.on(op.expired,(async e=>{const{topic:t,id:n}=Uu(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,dc("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))}))}registerPairingEvents(){this.client.core.pairing.events.on(ep.create,(e=>this.onPairingCreated(e)))}isValidPairingTopic(e){if(!mc(e,!1)){const{message:t}=dc("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=dc("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(zu(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=dc("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!mc(e,!1)){const{message:t}=dc("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){const{message:t}=dc("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(zu(this.client.session.get(e).expiry)){await this.deleteSession(e);const{message:t}=dc("EXPIRED",`session topic: ${e}`);throw new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else{if(!this.client.core.pairing.pairings.keys.includes(e)){if(mc(e,!1)){const{message:t}=dc("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}{const{message:t}=dc("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if(!Fc(e)){const{message:t}=dc("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=dc("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(zu(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:t}=dc("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class Og extends zp{constructor(e,t){super(e,t,ig,tg),this.core=e,this.logger=t}}class Ig extends zp{constructor(e,t){super(e,t,sg,tg),this.core=e,this.logger=t}}class xg extends zp{constructor(e,t){super(e,t,hg,tg,(e=>e.id)),this.core=e,this.logger=t}}class Rg extends or{constructor(e){super(e),this.protocol=Xp,this.version=Zp,this.name=ng.name,this.events=new o.exports.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}},this.update=async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}},this.request=async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}},this.find=e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.name=e?.name||ng.name,this.metadata=e?.metadata||Ou();const t=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:hn.pino(hn.getDefaultLoggerOptions({level:e?.logger||ng.logger}));this.core=e?.core||new Jp(e),this.logger=hn.generateChildLogger(t,this.name),this.session=new Ig(this.core,this.logger),this.proposal=new Og(this.core,this.logger),this.pendingRequest=new xg(this.core,this.logger),this.engine=new Sg(this)}static async init(e){const t=new Rg(e);return await t.initialize(),t}get context(){return hn.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}const kg="error",Cg="wss://relay.walletconnect.com",Pg="wc@2:universal_provider:",Ag="https://rpc.walletconnect.com/v1/",Ng={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Tg,Mg,Lg={exports:{}};
306
+ ***************************************************************************** */function El(e,t){function n(){this.constructor=e}wl(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Sl=function(){return Sl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Sl.apply(this,arguments)};function Ol(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function Il(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function xl(e,t){return function(n,r){t(n,r,e)}}function Rl(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function kl(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Cl(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return u([e,t])}}function u(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function Pl(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function Al(e,t){for(var n in e)"default"!==n&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function Nl(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tl(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function Ml(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Tl(arguments[t]));return e}function Ll(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function jl(e){return this instanceof jl?(this.v=e,this):new jl(e)}function Ul(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{u(i[e](t))}catch(e){f(o[0][3],e)}}function u(e){e.value instanceof jl?Promise.resolve(e.value.v).then(c,l):f(o[0][2],e)}function c(e){a("next",e)}function l(e){a("throw",e)}function f(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Dl(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:jl(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function zl(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof Nl?Nl(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){i(r,o,(t=e[n](t)).done,t.value)}))}}function i(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}}function Fl(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Bl(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Hl(e){return e&&e.__esModule?e:{default:e}}function ql(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function $l(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}var Vl,Wl=r(Object.freeze({__proto__:null,__extends:El,get __assign(){return Sl},__rest:Ol,__decorate:Il,__param:xl,__metadata:Rl,__awaiter:kl,__generator:Cl,__createBinding:Pl,__exportStar:Al,__values:Nl,__read:Tl,__spread:Ml,__spreadArrays:Ll,__await:jl,__asyncGenerator:Ul,__asyncDelegator:Dl,__asyncValues:zl,__makeTemplateObject:Fl,__importStar:Bl,__importDefault:Hl,__classPrivateFieldGet:ql,__classPrivateFieldSet:$l})),Kl={};function Gl(){if(Vl)return Kl;function e(){return t?.crypto||t?.msCrypto||{}}function n(){const t=e();return t.subtle||t.webkitSubtle}function r(){return!!e()&&!!n()}return Vl=1,Object.defineProperty(Kl,"__esModule",{value:!0}),Kl.isBrowserCryptoAvailable=Kl.getSubtleCrypto=Kl.getBrowerCrypto=void 0,Kl.getBrowerCrypto=e,Kl.getSubtleCrypto=n,Kl.isBrowserCryptoAvailable=r,Kl}var Yl,Ql={};function Jl(){if(Yl)return Ql;function e(){return typeof document>"u"&&typeof navigator<"u"&&"ReactNative"===navigator.product}function t(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function n(){return!e()&&!t()}return Yl=1,Object.defineProperty(Ql,"__esModule",{value:!0}),Ql.isBrowser=Ql.isNode=Ql.isReactNative=void 0,Ql.isReactNative=e,Ql.isNode=t,Ql.isBrowser=n,Ql}function Xl(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function Zl(e=6){return BigInt(Xl(e))}function ef(e,t,n){return{id:n||Xl(),jsonrpc:"2.0",method:e,params:t}}function tf(e,t){return{id:e,jsonrpc:"2.0",result:t}}function nf(e,t,n){return{id:e,jsonrpc:"2.0",error:rf(t,n)}}function rf(e,t){return typeof e>"u"?vl(fl):("string"==typeof e&&(e=Object.assign(Object.assign({},vl(hl)),{message:e})),typeof t<"u"&&(e.data=t),yl(e.code)&&(e=ml(e.code)),e)}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Wl;t.__exportStar(Gl(),e),t.__exportStar(Jl(),e)}(bl);class of{}class sf extends of{constructor(){super()}}class af extends sf{constructor(e){super()}}const uf="^https?:",cf="^wss?:";function lf(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}function ff(e,t){const n=lf(e);return!(typeof n>"u")&&new RegExp(t).test(n)}function hf(e){return ff(e,uf)}function df(e){return ff(e,cf)}function pf(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}function gf(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function yf(e){return gf(e)&&"method"in e}function vf(e){return gf(e)&&(mf(e)||_f(e))}function mf(e){return"result"in e}function _f(e){return"error"in e}class bf extends af{constructor(e){super(e),this.events=new o.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(ef(e.method,e.params||[],e.id||Zl().toString()),t)}async requestStrict(e,t){return new Promise((async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(e){r(e)}this.events.on(`${e.id}`,(e=>{_f(e)?r(e.error):n(e.result)}));try{await this.connection.send(e,t)}catch(e){r(e)}}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),vf(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",(e=>this.onPayload(e))),this.connection.on("close",(e=>this.onClose(e))),this.connection.on("error",(e=>this.events.emit("error",e))),this.connection.on("register_error",(e=>this.onClose())),this.hasRegisteredEventListeners=!0)}}const wf=()=>typeof WebSocket<"u"||typeof l<"u"&&typeof l.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Ef=e=>e.split("?")[0],Sf=10,Of=typeof WebSocket<"u"?WebSocket:typeof l<"u"&&typeof l.WebSocket<"u"?l.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:Dc?Uc:(Dc=1,Uc=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")});class If{constructor(e){if(this.url=e,this.events=new o.exports.EventEmitter,this.registering=!1,!df(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise(((e,t)=>{typeof this.socket>"u"?t(new Error("Connection already closed")):(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close())}))}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(ue(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!df(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(new Error("WebSocket connection is missing or invalid"));e(this.socket)}))}))}return this.url=e,this.registering=!0,new Promise(((t,n)=>{const r=new URLSearchParams(e).get("origin"),i=bl.isReactNative()?{headers:{origin:r}}:{rejectUnauthorized:!pf(e)},o=new Of(e,[],i);wf()?o.onerror=e=>{const t=e;n(this.emitError(t.error))}:o.on("error",(e=>{n(this.emitError(e))})),o.onopen=()=>{this.onOpen(o),t(o)}}))}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?ae(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=nf(e,n.message||n.toString());this.events.emit("payload",r)}parseError(e,t=this.url){return _l(e,Ef(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Sf&&this.events.setMaxListeners(Sf)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${Ef(this.url)}`));return this.events.emit("register_error",t),t}}var xf={exports:{}};!function(e,n){var r=200,i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,u="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",f="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",g="[object GeneratorFunction]",y="[object Map]",v="[object Number]",m="[object Null]",_="[object Object]",b="[object Promise]",w="[object Proxy]",E="[object RegExp]",S="[object Set]",O="[object String]",I="[object Symbol]",x="[object Undefined]",R="[object WeakMap]",k="[object ArrayBuffer]",C="[object DataView]",P="[object Float64Array]",A="[object Int8Array]",N="[object Int16Array]",T="[object Int32Array]",M="[object Uint8Array]",L="[object Uint8ClampedArray]",j="[object Uint16Array]",U="[object Uint32Array]",D=/[\\^$.*+?()[\]{}|]/g,z=/^\[object .+?Constructor\]$/,F=/^(?:0|[1-9]\d*)$/,B={};B["[object Float32Array]"]=B[P]=B[A]=B[N]=B[T]=B[M]=B[L]=B[j]=B[U]=!0,B[u]=B[c]=B[k]=B[f]=B[C]=B[h]=B[d]=B[p]=B[y]=B[v]=B[_]=B[E]=B[S]=B[O]=B[R]=!1;var H="object"==typeof t&&t&&t.Object===Object&&t,q="object"==typeof self&&self&&self.Object===Object&&self,$=H||q||Function("return this")(),V=n&&!n.nodeType&&n,W=V&&e&&!e.nodeType&&e,K=W&&W.exports===V,G=K&&H.process,Y=function(){try{return G&&G.binding&&G.binding("util")}catch{}}(),Q=Y&&Y.isTypedArray;function J(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function X(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Z(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function ee(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function te(e){return function(t){return e(t)}}function ne(e,t){return e.has(t)}function re(e,t){return e?.[t]}function ie(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function oe(e,t){return function(n){return e(t(n))}}function se(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var ae=Array.prototype,ue=Function.prototype,ce=Object.prototype,le=$["__core-js_shared__"],fe=ue.toString,he=ce.hasOwnProperty,de=function(){var e=/[^.]+$/.exec(le&&le.keys&&le.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),pe=ce.toString,ge=RegExp("^"+fe.call(he).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ye=K?$.Buffer:void 0,ve=$.Symbol,me=$.Uint8Array,_e=ce.propertyIsEnumerable,be=ae.splice,we=ve?ve.toStringTag:void 0,Ee=Object.getOwnPropertySymbols,Se=ye?ye.isBuffer:void 0,Oe=oe(Object.keys,Object),Ie=xt($,"DataView"),xe=xt($,"Map"),Re=xt($,"Promise"),ke=xt($,"Set"),Ce=xt($,"WeakMap"),Pe=xt(Object,"create"),Ae=Lt(Ie),Ne=Lt(xe),Te=Lt(Re),Me=Lt(ke),Le=Lt(Ce),je=ve?ve.prototype:void 0,Ue=je?je.valueOf:void 0;function De(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ze(){this.__data__=Pe?Pe(null):{},this.size=0}function Fe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Be(e){var t=this.__data__;if(Pe){var n=t[e];return n===i?void 0:n}return he.call(t,e)?t[e]:void 0}function He(e){var t=this.__data__;return Pe?void 0!==t[e]:he.call(t,e)}function qe(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Pe&&void 0===t?i:t,this}function $e(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ve(){this.__data__=[],this.size=0}function We(e){var t=this.__data__,n=ht(t,e);return!(n<0||(n==t.length-1?t.pop():be.call(t,n,1),--this.size,0))}function Ke(e){var t=this.__data__,n=ht(t,e);return n<0?void 0:t[n][1]}function Ge(e){return ht(this.__data__,e)>-1}function Ye(e,t){var n=this.__data__,r=ht(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Qe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Je(){this.size=0,this.__data__={hash:new De,map:new(xe||$e),string:new De}}function Xe(e){var t=It(this,e).delete(e);return this.size-=t?1:0,t}function Ze(e){return It(this,e).get(e)}function et(e){return It(this,e).has(e)}function tt(e,t){var n=It(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function nt(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Qe;++t<n;)this.add(e[t])}function rt(e){return this.__data__.set(e,i),this}function it(e){return this.__data__.has(e)}function ot(e){var t=this.__data__=new $e(e);this.size=t.size}function st(){this.__data__=new $e,this.size=0}function at(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ut(e){return this.__data__.get(e)}function ct(e){return this.__data__.has(e)}function lt(e,t){var n=this.__data__;if(n instanceof $e){var i=n.__data__;if(!xe||i.length<r-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Qe(i)}return n.set(e,t),this.size=n.size,this}function ft(e,t){var n=Dt(e),r=!n&&Ut(e),i=!n&&!r&&Ft(e),o=!n&&!r&&!i&&Wt(e),s=n||r||i||o,a=s?ee(e.length,String):[],u=a.length;for(var c in e)(t||he.call(e,c))&&(!s||!("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Pt(c,u)))&&a.push(c);return a}function ht(e,t){for(var n=e.length;n--;)if(jt(e[n][0],t))return n;return-1}function dt(e,t,n){var r=t(e);return Dt(e)?r:X(r,n(e))}function pt(e){return null==e?void 0===e?x:m:we&&we in Object(e)?Rt(e):Mt(e)}function gt(e){return Vt(e)&&pt(e)==u}function yt(e,t,n,r,i){return e===t||(null==e||null==t||!Vt(e)&&!Vt(t)?e!=e&&t!=t:vt(e,t,n,r,yt,i))}function vt(e,t,n,r,i,s){var a=Dt(e),l=Dt(t),f=a?c:Ct(e),h=l?c:Ct(t),d=(f=f==u?_:f)==_,p=(h=h==u?_:h)==_,g=f==h;if(g&&Ft(e)){if(!Ft(t))return!1;a=!0,d=!1}if(g&&!d)return s||(s=new ot),a||Wt(e)?wt(e,t,n,r,i,s):Et(e,t,f,n,r,i,s);if(!(n&o)){var y=d&&he.call(e,"__wrapped__"),v=p&&he.call(t,"__wrapped__");if(y||v){var m=y?e.value():e,b=v?t.value():t;return s||(s=new ot),i(m,b,n,r,s)}}return!!g&&(s||(s=new ot),St(e,t,n,r,i,s))}function mt(e){return!(!$t(e)||Nt(e))&&(Ht(e)?ge:z).test(Lt(e))}function _t(e){return Vt(e)&&qt(e.length)&&!!B[pt(e)]}function bt(e){if(!Tt(e))return Oe(e);var t=[];for(var n in Object(e))he.call(e,n)&&"constructor"!=n&&t.push(n);return t}function wt(e,t,n,r,i,a){var u=n&o,c=e.length,l=t.length;if(c!=l&&!(u&&l>c))return!1;var f=a.get(e);if(f&&a.get(t))return f==t;var h=-1,d=!0,p=n&s?new nt:void 0;for(a.set(e,t),a.set(t,e);++h<c;){var g=e[h],y=t[h];if(r)var v=u?r(y,g,h,t,e,a):r(g,y,h,e,t,a);if(void 0!==v){if(v)continue;d=!1;break}if(p){if(!Z(t,(function(e,t){if(!ne(p,t)&&(g===e||i(g,e,n,r,a)))return p.push(t)}))){d=!1;break}}else if(g!==y&&!i(g,y,n,r,a)){d=!1;break}}return a.delete(e),a.delete(t),d}function Et(e,t,n,r,i,a,u){switch(n){case C:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case k:return!(e.byteLength!=t.byteLength||!a(new me(e),new me(t)));case f:case h:case v:return jt(+e,+t);case d:return e.name==t.name&&e.message==t.message;case E:case O:return e==t+"";case y:var c=ie;case S:var l=r&o;if(c||(c=se),e.size!=t.size&&!l)return!1;var p=u.get(e);if(p)return p==t;r|=s,u.set(e,t);var g=wt(c(e),c(t),r,i,a,u);return u.delete(e),g;case I:if(Ue)return Ue.call(e)==Ue.call(t)}return!1}function St(e,t,n,r,i,s){var a=n&o,u=Ot(e),c=u.length;if(c!=Ot(t).length&&!a)return!1;for(var l=c;l--;){var f=u[l];if(!(a?f in t:he.call(t,f)))return!1}var h=s.get(e);if(h&&s.get(t))return h==t;var d=!0;s.set(e,t),s.set(t,e);for(var p=a;++l<c;){var g=e[f=u[l]],y=t[f];if(r)var v=a?r(y,g,f,t,e,s):r(g,y,f,e,t,s);if(!(void 0===v?g===y||i(g,y,n,r,s):v)){d=!1;break}p||(p="constructor"==f)}if(d&&!p){var m=e.constructor,_=t.constructor;m!=_&&"constructor"in e&&"constructor"in t&&!("function"==typeof m&&m instanceof m&&"function"==typeof _&&_ instanceof _)&&(d=!1)}return s.delete(e),s.delete(t),d}function Ot(e){return dt(e,Kt,kt)}function It(e,t){var n=e.__data__;return At(t)?n["string"==typeof t?"string":"hash"]:n.map}function xt(e,t){var n=re(e,t);return mt(n)?n:void 0}function Rt(e){var t=he.call(e,we),n=e[we];try{e[we]=void 0;var r=!0}catch{}var i=pe.call(e);return r&&(t?e[we]=n:delete e[we]),i}De.prototype.clear=ze,De.prototype.delete=Fe,De.prototype.get=Be,De.prototype.has=He,De.prototype.set=qe,$e.prototype.clear=Ve,$e.prototype.delete=We,$e.prototype.get=Ke,$e.prototype.has=Ge,$e.prototype.set=Ye,Qe.prototype.clear=Je,Qe.prototype.delete=Xe,Qe.prototype.get=Ze,Qe.prototype.has=et,Qe.prototype.set=tt,nt.prototype.add=nt.prototype.push=rt,nt.prototype.has=it,ot.prototype.clear=st,ot.prototype.delete=at,ot.prototype.get=ut,ot.prototype.has=ct,ot.prototype.set=lt;var kt=Ee?function(e){return null==e?[]:(e=Object(e),J(Ee(e),(function(t){return _e.call(e,t)})))}:Gt,Ct=pt;function Pt(e,t){return!!(t=t??a)&&("number"==typeof e||F.test(e))&&e>-1&&e%1==0&&e<t}function At(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function Nt(e){return!!de&&de in e}function Tt(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ce)}function Mt(e){return pe.call(e)}function Lt(e){if(null!=e){try{return fe.call(e)}catch{}try{return e+""}catch{}}return""}function jt(e,t){return e===t||e!=e&&t!=t}(Ie&&Ct(new Ie(new ArrayBuffer(1)))!=C||xe&&Ct(new xe)!=y||Re&&Ct(Re.resolve())!=b||ke&&Ct(new ke)!=S||Ce&&Ct(new Ce)!=R)&&(Ct=function(e){var t=pt(e),n=t==_?e.constructor:void 0,r=n?Lt(n):"";if(r)switch(r){case Ae:return C;case Ne:return y;case Te:return b;case Me:return S;case Le:return R}return t});var Ut=gt(function(){return arguments}())?gt:function(e){return Vt(e)&&he.call(e,"callee")&&!_e.call(e,"callee")},Dt=Array.isArray;function zt(e){return null!=e&&qt(e.length)&&!Ht(e)}var Ft=Se||Yt;function Bt(e,t){return yt(e,t)}function Ht(e){if(!$t(e))return!1;var t=pt(e);return t==p||t==g||t==l||t==w}function qt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function $t(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Vt(e){return null!=e&&"object"==typeof e}var Wt=Q?te(Q):_t;function Kt(e){return zt(e)?ft(e):bt(e)}function Gt(){return[]}function Yt(){return!1}e.exports=Bt}(xf,xf.exports);var Rf=xf.exports;function kf(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}var Cf=r(Object.freeze({__proto__:null,default:kf})),Pf=self.fetch||(self.fetch=Cf.default||Cf),Af=Object.defineProperty,Nf=Object.getOwnPropertySymbols,Tf=Object.prototype.hasOwnProperty,Mf=Object.prototype.propertyIsEnumerable,Lf=(e,t,n)=>t in e?Af(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jf=(e,t)=>{for(var n in t||(t={}))Tf.call(t,n)&&Lf(e,n,t[n]);if(Nf)for(var n of Nf(t))Mf.call(t,n)&&Lf(e,n,t[n]);return e};function Uf(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function f(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*l+1>>>0,c=new Uint8Array(s);i!==o;){for(var f=t[i],h=0,d=s-1;(0!==f||h<r)&&-1!==d;d--,h++)f+=256*c[d]>>>0,c[d]=f%a>>>0,f=f/a>>>0;if(0!==f)throw new Error("Non-zero carry");r=h,i++}for(var p=s-r;p!==s&&0===c[p];)p++;for(var g=u.repeat(n);p<s;++p)g+=e.charAt(c[p]);return g}function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var r=0,i=0;e[t]===u;)r++,t++;for(var o=(e.length-t)*c+1>>>0,s=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var f=0,h=o-1;(0!==l||f<i)&&-1!==h;h--,f++)l+=a*s[h]>>>0,s[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=o-i;d!==o&&0===s[d];)d++;for(var p=new Uint8Array(r+(o-d)),g=r;d!==o;)p[g++]=s[d++];return p}}}function d(e){var n=h(e);if(n)return n;throw new Error(`Non-${t} character`)}return{encode:f,decodeUnsafe:h,decode:d}}var Df=Uf;const zf=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Ff=e=>(new TextEncoder).encode(e),Bf=e=>(new TextDecoder).decode(e);class Hf{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class qf{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Vf(this,e)}}class $f{constructor(e){this.decoders=e}or(e){return Vf(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Vf=(e,t)=>new $f(jf(jf({},e.decoders||{[e.prefix]:e}),t.decoders||{[t.prefix]:t}));class Wf{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new Hf(e,t,n),this.decoder=new qf(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Kf=({name:e,prefix:t,encode:n,decode:r})=>new Wf(e,t,n,r),Gf=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=Df(n,t);return Kf({prefix:e,name:t,encode:r,decode:e=>zf(i(e))})},Yf=(e,t,n,r)=>{const i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*n/8|0);let a=0,u=0,c=0;for(let t=0;t<o;++t){const o=i[e[t]];if(void 0===o)throw new SyntaxError(`Non-${r} character`);u=u<<n|o,a+=n,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=n||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s},Qf=(e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let r=0;r<e.length;++r)for(a=a<<8|e[r],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o},Jf=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>Kf({prefix:t,name:e,encode:e=>Qf(e,r,n),decode:t=>Yf(t,r,n,e)}),Xf=Kf({prefix:"\0",name:"identity",encode:e=>Bf(e),decode:e=>Ff(e)});var Zf=Object.freeze({__proto__:null,identity:Xf});const eh=Jf({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var th=Object.freeze({__proto__:null,base2:eh});const nh=Jf({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var rh=Object.freeze({__proto__:null,base8:nh});const ih=Gf({prefix:"9",name:"base10",alphabet:"0123456789"});var oh=Object.freeze({__proto__:null,base10:ih});const sh=Jf({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ah=Jf({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var uh=Object.freeze({__proto__:null,base16:sh,base16upper:ah});const ch=Jf({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),lh=Jf({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),fh=Jf({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),hh=Jf({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),dh=Jf({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ph=Jf({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),gh=Jf({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),yh=Jf({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),vh=Jf({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var mh=Object.freeze({__proto__:null,base32:ch,base32upper:lh,base32pad:fh,base32padupper:hh,base32hex:dh,base32hexupper:ph,base32hexpad:gh,base32hexpadupper:yh,base32z:vh});const _h=Gf({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bh=Gf({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var wh=Object.freeze({__proto__:null,base36:_h,base36upper:bh});const Eh=Gf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Sh=Gf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Oh=Object.freeze({__proto__:null,base58btc:Eh,base58flickr:Sh});const Ih=Jf({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xh=Jf({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Rh=Jf({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),kh=Jf({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ch=Object.freeze({__proto__:null,base64:Ih,base64pad:xh,base64url:Rh,base64urlpad:kh});const Ph=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Ah=Ph.reduce(((e,t,n)=>(e[n]=t,e)),[]),Nh=Ph.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);function Th(e){return e.reduce(((e,t)=>e+=Ah[t]),"")}function Mh(e){const t=[];for(const n of e){const e=Nh[n.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}const Lh=Kf({prefix:"🚀",name:"base256emoji",encode:Th,decode:Mh});var jh=Object.freeze({__proto__:null,base256emoji:Lh}),Uh=Bh,Dh=128,zh=-128,Fh=Math.pow(2,31);function Bh(e,t,n){t=t||[];for(var r=n=n||0;e>=Fh;)t[n++]=255&e|Dh,e/=128;for(;e&zh;)t[n++]=255&e|Dh,e>>>=7;return t[n]=0|e,Bh.bytes=n-r+1,t}var Hh=Vh,qh=128,$h=127;function Vh(e,t){var n,r=0,i=0,o=t=t||0,s=e.length;do{if(o>=s)throw Vh.bytes=0,new RangeError("Could not decode varint");n=e[o++],r+=i<28?(n&$h)<<i:(n&$h)*Math.pow(2,i),i+=7}while(n>=qh);return Vh.bytes=o-t,r}var Wh=Math.pow(2,7),Kh=Math.pow(2,14),Gh=Math.pow(2,21),Yh=Math.pow(2,28),Qh=Math.pow(2,35),Jh=Math.pow(2,42),Xh=Math.pow(2,49),Zh=Math.pow(2,56),ed=Math.pow(2,63),td=function(e){return e<Wh?1:e<Kh?2:e<Gh?3:e<Yh?4:e<Qh?5:e<Jh?6:e<Xh?7:e<Zh?8:e<ed?9:10},nd={encode:Uh,decode:Hh,encodingLength:td};const rd=(e,t,n=0)=>(nd.encode(e,t,n),t),id=e=>nd.encodingLength(e),od=(e,t)=>{const n=t.byteLength,r=id(e),i=r+id(n),o=new Uint8Array(i+n);return rd(e,o,0),rd(n,o,r),o.set(t,i),new sd(e,n,t,o)};class sd{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const ad=({name:e,code:t,encode:n})=>new ud(e,t,n);class ud{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?od(this.code,t):t.then((e=>od(this.code,e)))}throw Error("Unknown type, must be binary type")}}const cd=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),ld=ad({name:"sha2-256",code:18,encode:cd("SHA-256")}),fd=ad({name:"sha2-512",code:19,encode:cd("SHA-512")});var hd=Object.freeze({__proto__:null,sha256:ld,sha512:fd});const dd=0,pd="identity",gd=zf;var yd=Object.freeze({__proto__:null,identity:{code:dd,name:pd,encode:gd,digest:e=>od(dd,gd(e))}});new TextEncoder,new TextDecoder;const vd=jf(jf(jf(jf(jf(jf(jf(jf(jf(jf({},Zf),th),rh),oh),uh),mh),wh),Oh),Ch),jh);function md(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function _d(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?md(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function bd(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}jf(jf({},hd),yd);const wd=bd("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Ed=bd("ascii","a",(e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}),(e=>{const t=_d((e=e.substring(1)).length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t})),Sd=jf({utf8:wd,"utf-8":wd,hex:vd.base16,latin1:Ed,ascii:Ed,binary:Ed},vd);function Od(e,t="utf8"){const n=Sd[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode(`${n.prefix}${e}`):md(globalThis.Buffer.from(e,"utf-8"))}const Id="wc",xd=2,Rd="core",kd=`${Id}@2:${Rd}:`,Cd={name:Rd,logger:"error"},Pd={database:":memory:"},Ad="crypto",Nd="client_ed25519_seed",Td=Qe.ONE_DAY,Md="keychain",Ld="0.3",jd="messages",Ud="0.3",Dd=Qe.SIX_HOURS,zd="publisher",Fd="irn",Bd="error",Hd="wss://relay.walletconnect.com",qd="wss://relay.walletconnect.org",$d="relayer",Vd={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Wd="_subscription",Kd={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Gd=Qe.ONE_SECOND,Yd="2.11.0",Qd=1e4,Jd="0.3",Xd="WALLETCONNECT_CLIENT_ID",Zd={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},ep="subscription",tp="0.3",np=1e3*Qe.FIVE_SECONDS,rp="pairing",ip="0.3",op={wc_pairingDelete:{req:{ttl:Qe.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Qe.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Qe.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Qe.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Qe.ONE_DAY,prompt:!1,tag:0},res:{ttl:Qe.ONE_DAY,prompt:!1,tag:0}}},sp={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},ap={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},up="history",cp="0.3",lp="expirer",fp={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},hp="0.3",dp="verify-api",pp="https://verify.walletconnect.com",gp="https://verify.walletconnect.org",yp=[pp,gp],vp="echo",mp="https://echo.walletconnect.com";class _p{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=Md,this.version=Ld,this.initialized=!1,this.storagePrefix=kd,this.init=async()=>{if(!this.initialized){const e=await this.getKeyChain();typeof e<"u"&&(this.keychain=e),this.initialized=!0}},this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()},this.get=e=>{this.isInitialized();const t=this.keychain.get(e);if(typeof t>"u"){const{message:t}=gc("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t},this.del=async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()},this.core=e,this.logger=hn.generateChildLogger(t,this.name)}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Nu(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Tu(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=gc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class bp{constructor(e,t,n){this.core=e,this.logger=t,this.name=Ad,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=async()=>(this.isInitialized(),us(hs(await this.getClientSeed()).publicKey)),this.generateKeyPair=()=>{this.isInitialized();const e=Ja();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();const t=hs(await this.getClientSeed()),n=Xa();return await ds(n,e,Td,t)},this.generateSharedKey=(e,t,n)=>{this.isInitialized();const r=Za(this.getPrivateKey(e),t);return this.setSymKey(r,n)},this.setSymKey=async(e,t)=>{this.isInitialized();const n=t||eu(e);return await this.keychain.set(n,e),n},this.deleteKeyPair=async e=>{this.isInitialized(),await this.keychain.del(e)},this.deleteSymKey=async e=>{this.isInitialized(),await this.keychain.del(e)},this.encode=async(e,t,n)=>{this.isInitialized();const r=cu(n),i=ue(t);if(lu(r)){const t=r.senderPublicKey,n=r.receiverPublicKey;e=await this.generateSharedKey(t,n)}const o=this.getSymKey(e),{type:s,senderPublicKey:a}=r;return iu({type:s,symKey:o,message:i,senderPublicKey:a})},this.decode=async(e,t,n)=>{this.isInitialized();const r=uu(t,n);if(lu(r)){const t=r.receiverPublicKey,n=r.senderPublicKey;e=await this.generateSharedKey(t,n)}try{const n=this.getSymKey(e);return ae(ou({symKey:n,encoded:t}))}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}},this.getPayloadType=e=>ru(au(e).type),this.getPayloadSenderPublicKey=e=>{const t=au(e);return t.senderPublicKey?os(t.senderPublicKey,Ha):void 0},this.core=e,this.logger=hn.generateChildLogger(t,this.name),this.keychain=n||new _p(this.core,this.logger)}get context(){return hn.getLoggerContext(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Nd)}catch{e=Xa(),await this.keychain.set(Nd,e)}return Od(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=gc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class wp extends Xn{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=jd,this.version=Ud,this.initialized=!1,this.storagePrefix=kd,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const e=await this.getRelayerMessages();typeof e<"u"&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}},this.set=async(e,t)=>{this.isInitialized();const n=tu(t);let r=this.messages.get(e);return typeof r>"u"&&(r={}),typeof r[n]<"u"||(r[n]=t,this.messages.set(e,r),await this.persist()),n},this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>(this.isInitialized(),typeof this.get(e)[tu(t)]<"u"),this.del=async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()},this.logger=hn.generateChildLogger(e,this.name),this.core=t}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Nu(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Tu(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=gc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Ep extends Zn{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new o.exports.EventEmitter,this.name=zd,this.queue=new Map,this.publishTimeout=Qe.toMiliseconds(Qe.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(e,t,n)=>{var r;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:n}});try{const i=n?.ttl||Dd,o=Ku(n),s=n?.prompt||!1,a=n?.tag||0,u=n?.id||Zl().toString(),c={topic:e,message:t,opts:{ttl:i,relay:o,prompt:s,tag:a,id:u}},l=setTimeout((()=>this.queue.set(u,c)),this.publishTimeout);try{await await Lu(this.rpcPublish(e,t,i,o,s,a,u),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(u),this.relayer.events.emit(Vd.publish,c)}catch(e){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,null!=(r=n?.internal)&&r.throwOnFailedPublish)throw this.removeRequestFromQueue(u),e;return}finally{clearTimeout(l)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:n}})}catch(e){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(e),e}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.relayer=e,this.logger=hn.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return hn.getLoggerContext(this.logger)}rpcPublish(e,t,n,r,i,o,s){var a,u,c,l;const f={method:Gu(r.protocol).publish,params:{topic:e,message:t,ttl:n,prompt:i,tag:o},id:s};return _c(null==(a=f.params)?void 0:a.prompt)&&(null==(u=f.params)||delete u.prompt),_c(null==(c=f.params)?void 0:c.tag)&&(null==(l=f.params)||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f}),this.relayer.request(f)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach((async e=>{const{topic:t,message:n,opts:r}=e;await this.publish(t,n,r)}))}registerEventListeners(){this.relayer.core.heartbeat.on(Se.HEARTBEAT_EVENTS.pulse,(()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit(Vd.connection_stalled);this.checkQueue()})),this.relayer.on(Vd.message_ack,(e=>{this.removeRequestFromQueue(e.id.toString())}))}}class Sp{constructor(){this.map=new Map,this.set=(e,t)=>{const n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,t))return;const r=n.filter((e=>e!==t));r.length?this.map.set(e,r):this.map.delete(e)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var Op=Object.defineProperty,Ip=Object.defineProperties,xp=Object.getOwnPropertyDescriptors,Rp=Object.getOwnPropertySymbols,kp=Object.prototype.hasOwnProperty,Cp=Object.prototype.propertyIsEnumerable,Pp=(e,t,n)=>t in e?Op(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ap=(e,t)=>{for(var n in t||(t={}))kp.call(t,n)&&Pp(e,n,t[n]);if(Rp)for(var n of Rp(t))Cp.call(t,n)&&Pp(e,n,t[n]);return e},Np=(e,t)=>Ip(e,xp(t));class Tp extends nr{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new Sp,this.events=new o.exports.EventEmitter,this.name=ep,this.version=tp,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=kd,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{const n=Ku(t),r={topic:e,relay:n};this.pending.set(e,r);const i=await this.rpcSubscribe(e,n);return this.onSubscribe(i,r),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}}),i}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}},this.unsubscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),typeof t?.id<"u"?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)},this.isSubscribed=async e=>!!this.topics.includes(e)||await new Promise(((t,n)=>{const r=new Qe.Watch;r.start(this.pendingSubscriptionWatchLabel);const i=setInterval((()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(i),r.stop(this.pendingSubscriptionWatchLabel),t(!0)),r.elapsed(this.pendingSubscriptionWatchLabel)>=np&&(clearInterval(i),r.stop(this.pendingSubscriptionWatchLabel),n(new Error("Subscription resolution timeout")))}),this.pollingInterval)})).catch((()=>!1)),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=hn.generateChildLogger(t,this.name),this.clientId=""}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const n=this.topicMap.get(e);await Promise.all(n.map((async n=>await this.unsubscribeById(e,n,t))))}async unsubscribeById(e,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}});try{const r=Ku(n);await this.rpcUnsubscribe(e,t,r);const i=yc("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}})}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}async rpcSubscribe(e,t){const n={method:Gu(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await Lu(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Vd.connection_stalled)}return tu(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;const t={method:Gu(e[0].relay.protocol).batchSubscribe,params:{topics:e.map((e=>e.topic))}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{return await await Lu(this.relayer.request(t),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Vd.connection_stalled)}}rpcUnsubscribe(e,t,n){const r={method:Gu(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}onSubscribe(e,t){this.setSubscription(e,Np(Ap({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach((e=>{this.setSubscription(e.id,Ap({},e)),this.pending.delete(e.topic)}))}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,Ap({},t)),this.topicMap.set(t.topic,e),this.events.emit(Zd.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:t}=gc("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Zd.deleted,Np(Ap({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Zd.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const e=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(e)}}this.events.emit(Zd.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:e}=gc("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);vc(t)&&this.onBatchSubscribe(t.map(((t,n)=>Np(Ap({},e[n]),{id:t}))))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const e=[];this.pending.forEach((t=>{e.push(t)})),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Se.HEARTBEAT_EVENTS.pulse,(async()=>{await this.checkPending()})),this.relayer.on(Vd.connect,(async()=>{await this.onConnect()})),this.relayer.on(Vd.disconnect,(()=>{this.onDisconnect()})),this.events.on(Zd.created,(async e=>{const t=Zd.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})),this.events.on(Zd.deleted,(async e=>{const t=Zd.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=gc("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.restartInProgress||(clearInterval(t),e())}),this.pollingInterval)}))}}var Mp=Object.defineProperty,Lp=Object.getOwnPropertySymbols,jp=Object.prototype.hasOwnProperty,Up=Object.prototype.propertyIsEnumerable,Dp=(e,t,n)=>t in e?Mp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zp=(e,t)=>{for(var n in t||(t={}))jp.call(t,n)&&Dp(e,n,t[n]);if(Lp)for(var n of Lp(t))Up.call(t,n)&&Dp(e,n,t[n]);return e};class Fp extends er{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new o.exports.EventEmitter,this.name=$d,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async e=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(e)}catch(e){throw this.logger.debug("Failed to Publish Request"),this.logger.error(e),e}},this.onPayloadHandler=e=>{this.onProviderPayload(e)},this.onConnectHandler=()=>{this.events.emit(Vd.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit(Vd.error,e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Kd.payload,this.onPayloadHandler),this.provider.on(Kd.connect,this.onConnectHandler),this.provider.on(Kd.disconnect,this.onDisconnectHandler),this.provider.on(Kd.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&"string"!=typeof e.logger?hn.generateChildLogger(e.logger,this.name):hn.pino(hn.getDefaultLoggerOptions({level:e.logger||Bd})),this.messages=new wp(this.logger,e.core),this.subscriber=new Tp(this,this.logger),this.publisher=new Ep(this,this.logger),this.relayUrl=e?.relayUrl||Hd,this.projectId=e.projectId,this.bundleId=Ou(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${qd}...`),await this.restartTransport(qd)}this.initialized=!0,setTimeout((async()=>{0===this.subscriber.topics.length&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)}),Qd)}get context(){return hn.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var n;this.isInitialized();let r,i=(null==(n=this.subscriber.topicMap.get(e))?void 0:n[0])||"";if(i)return i;const o=t=>{t.topic===e&&(this.subscriber.off(Zd.created,o),r())};return await Promise.all([new Promise((e=>{r=e,this.subscriber.on(Zd.created,o)})),new Promise((async n=>{i=await this.subscriber.subscribe(e,t),n()}))]),i}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await Lu(this.provider.disconnect(),1e3,"provider.disconnect()").catch((()=>this.onProviderDisconnect())):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise((e=>{if(!this.initialized)return e();this.subscriber.once(Zd.resubscribed,(()=>{e()}))})),new Promise((async(e,t)=>{try{await Lu(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(e){return void t(e)}e()}))])}catch(e){this.logger.error(e);const t=e;if(!this.isConnectionStalled(t.message))throw e;this.provider.events.emit(Kd.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await nl())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some((t=>e.includes(t)))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new bf(new If(Pu({sdkVersion:Yd,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:n}=e;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(e){const{topic:t,message:n}=e;if(!n||0===n.length)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const r=this.messages.has(t,n);return r&&this.logger.debug(`Ignoring duplicate message: ${n}`),r}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),yf(e)){if(!e.method.endsWith(Wd))return;const t=e.params,{topic:n,message:r,publishedAt:i}=t.data,o={topic:n,message:r,publishedAt:i};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(zp({type:"event",event:t.id},o)),this.events.emit(t.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else vf(e)&&this.events.emit(Vd.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Vd.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=tf(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(Kd.payload,this.onPayloadHandler),this.provider.off(Kd.connect,this.onConnectHandler),this.provider.off(Kd.disconnect,this.onDisconnectHandler),this.provider.off(Kd.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(Vd.connection_stalled,(()=>{this.restartTransport().catch((e=>this.logger.error(e)))}));let e=await nl();sl((async t=>{this.initialized&&e!==t&&(e=t,t?await this.restartTransport().catch((e=>this.logger.error(e))):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch((e=>this.logger.error(e)))))}))}onProviderDisconnect(){this.events.emit(Vd.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout((async()=>{await this.restartTransport().catch((e=>this.logger.error(e)))}),Qe.toMiliseconds(Gd)))}isInitialized(){if(!this.initialized){const{message:e}=gc("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise((e=>{const t=setInterval((()=>{this.connected&&(clearInterval(t),e())}),this.connectionStatusPollingInterval)}));await this.restartTransport()}}}var Bp=Object.defineProperty,Hp=Object.getOwnPropertySymbols,qp=Object.prototype.hasOwnProperty,$p=Object.prototype.propertyIsEnumerable,Vp=(e,t,n)=>t in e?Bp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wp=(e,t)=>{for(var n in t||(t={}))qp.call(t,n)&&Vp(e,n,t[n]);if(Hp)for(var n of Hp(t))$p.call(t,n)&&Vp(e,n,t[n]);return e};class Kp extends tr{constructor(e,t,n,r=kd,i=void 0){super(e,t,n,r),this.core=e,this.logger=t,this.name=n,this.map=new Map,this.version=Jd,this.cached=[],this.initialized=!1,this.storagePrefix=kd,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>{this.getKey&&null!==e&&!_c(e)?this.map.set(this.getKey(e),e):xc(e)?this.map.set(e.id,e):Rc(e)&&this.map.set(e.topic,e)})),this.cached=[],this.initialized=!0)},this.set=async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())},this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter((t=>Object.keys(e).every((n=>Rf(t[n],e[n]))))):this.values),this.update=async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});const n=Wp(Wp({},this.getData(e)),t);this.map.set(e,n),await this.persist()},this.delete=async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),await this.persist())},this.logger=hn.generateChildLogger(t,this.name),this.storagePrefix=r,this.getKey=i}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){const{message:t}=gc("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:e}=gc("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=gc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Gp{constructor(e,t){this.core=e,this.logger=t,this.name=rp,this.version=ip,this.events=new o.exports,this.initialized=!1,this.storagePrefix=kd,this.ignoredPayloadTypes=[Wa],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]},this.create=async()=>{this.isInitialized();const e=Xa(),t=await this.core.crypto.setSymKey(e),n=Fu(Qe.FIVE_MINUTES),r={protocol:Fd},i={topic:t,expiry:n,relay:r,active:!1},o=oc({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:e,relay:r});return await this.pairings.set(t,i),await this.core.relayer.subscribe(t),this.core.expirer.set(t,n),{topic:t,uri:o}},this.pair=async e=>{this.isInitialized(),this.isValidPair(e);const{topic:t,symKey:n,relay:r}=nc(e.uri);let i;if(this.pairings.keys.includes(t)&&(i=this.pairings.get(t),i.active))throw new Error(`Pairing already exists: ${t}. Please try again with a new connection URI.`);const o=Fu(Qe.FIVE_MINUTES),s={topic:t,relay:r,expiry:o,active:!1};return await this.pairings.set(t,s),this.core.expirer.set(t,o),e.activatePairing&&await this.activate({topic:t}),this.events.emit(sp.create,s),this.core.crypto.keychain.has(t)||(await this.core.crypto.setSymKey(n,t),await this.core.relayer.subscribe(t,{relay:r})),s},this.activate=async({topic:e})=>{this.isInitialized();const t=Fu(Qe.THIRTY_DAYS);await this.pairings.update(e,{active:!0,expiry:t}),this.core.expirer.set(e,t)},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.pairings.keys.includes(t)){const e=await this.sendRequest(t,"wc_pairingPing",{}),{done:n,resolve:r,reject:i}=Mu();this.events.once(Hu("pairing_ping",e),(({error:e})=>{e?i(e):r()})),await n()}},this.updateExpiry=async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})},this.updateMetadata=async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",yc("USER_DISCONNECTED")),await this.deletePairing(t))},this.sendRequest=async(e,t,n)=>{const r=ef(t,n),i=await this.core.crypto.encode(e,r),o=op[t].req;return this.core.history.set(e,r),this.core.relayer.publish(e,i,o),r.id},this.sendResult=async(e,t,n)=>{const r=tf(e,n),i=await this.core.crypto.encode(t,r),o=await this.core.history.get(t,e),s=op[o.request.method].res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(r)},this.sendError=async(e,t,n)=>{const r=nf(e,n),i=await this.core.crypto.encode(t,r),o=await this.core.history.get(t,e),s=op[o.request.method]?op[o.request.method].res:op.unregistered_method.res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(r)},this.deletePairing=async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,yc("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])},this.cleanup=async()=>{const e=this.pairings.getAll().filter((e=>Bu(e.expiry)));await Promise.all(e.map((e=>this.deletePairing(e.topic))))},this.onRelayEventRequest=e=>{const{topic:t,payload:n}=e;switch(n.method){case"wc_pairingPing":return this.onPairingPingRequest(t,n);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,n);default:return this.onUnknownRpcMethodRequest(t,n)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:n}=e,r=(await this.core.history.get(t,n.id)).request.method;return"wc_pairingPing"===r?this.onPairingPingResponse(t,n):this.onUnknownRpcMethodResponse(r)},this.onPairingPingRequest=async(e,t)=>{const{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult(n,e,!0),this.events.emit(sp.ping,{id:n,topic:e})}catch(t){await this.sendError(n,e,t),this.logger.error(t)}},this.onPairingPingResponse=(e,t)=>{const{id:n}=t;setTimeout((()=>{mf(t)?this.events.emit(Hu("pairing_ping",n),{}):_f(t)&&this.events.emit(Hu("pairing_ping",n),{error:t.error})}),500)},this.onPairingDeleteRequest=async(e,t)=>{const{id:n}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(sp.delete,{id:n,topic:e})}catch(t){await this.sendError(n,e,t),this.logger.error(t)}},this.onUnknownRpcMethodRequest=async(e,t)=>{const{id:n,method:r}=t;try{if(this.registeredMethods.includes(r))return;const t=yc("WC_METHOD_UNSUPPORTED",r);await this.sendError(n,e,t),this.logger.error(t)}catch(t){await this.sendError(n,e,t),this.logger.error(t)}},this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error(yc("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=e=>{var t;if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`pair() params: ${e}`);throw new Error(t)}if(!Ic(e.uri)){const{message:t}=gc("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw new Error(t)}const n=nc(e.uri);if(null==(t=n?.relay)||!t.protocol){const{message:e}=gc("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(e)}if(null==n||!n.symKey){const{message:e}=gc("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(e)}},this.isValidPing=async e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!bc(e,!1)){const{message:t}=gc("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.pairings.keys.includes(e)){const{message:t}=gc("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Bu(this.pairings.get(e).expiry)){await this.deletePairing(e);const{message:t}=gc("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}},this.core=e,this.logger=hn.generateChildLogger(t,this.name),this.pairings=new Kp(this.core,this.logger,this.name,this.storagePrefix)}get context(){return hn.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=gc("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Vd.message,(async e=>{const{topic:t,message:n}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const r=await this.core.crypto.decode(t,n);try{yf(r)?(this.core.history.set(t,r),this.onRelayEventRequest({topic:t,payload:r})):vf(r)&&(await this.core.history.resolve(r),await this.onRelayEventResponse({topic:t,payload:r}),this.core.history.delete(t,r.id))}catch(e){this.logger.error(e)}}))}registerExpirerEvents(){this.core.expirer.on(fp.expired,(async e=>{const{topic:t}=zu(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(sp.expire,{topic:t}))}))}}class Yp extends Jn{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new o.exports.EventEmitter,this.name=up,this.version=cp,this.cached=[],this.initialized=!1,this.storagePrefix=kd,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.records.set(e.id,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(e,t,n)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:n}),this.records.has(t.id))return;const r={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:n,expiry:Fu(Qe.THIRTY_DAYS)};this.records.set(r.id,r),this.events.emit(ap.created,r)},this.resolve=async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;const t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=_f(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.events.emit(ap.updated,t))},this.get=async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)),this.delete=(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach((n=>{if(n.topic===e){if(typeof t<"u"&&n.id!==t)return;this.records.delete(n.id),this.events.emit(ap.deleted,n)}}))},this.exists=async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=hn.generateChildLogger(t,this.name)}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach((t=>{if(typeof t.response<"u")return;const n={topic:t.topic,request:ef(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)})),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:t}=gc("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(ap.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:e}=gc("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(ap.created,(e=>{const t=ap.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.events.on(ap.updated,(e=>{const t=ap.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.events.on(ap.deleted,(e=>{const t=ap.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.core.heartbeat.on(Se.HEARTBEAT_EVENTS.pulse,(()=>{this.cleanup()}))}cleanup(){try{this.records.forEach((e=>{Qe.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))}))}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=gc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Qp extends rr{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new o.exports.EventEmitter,this.name=lp,this.version=hp,this.cached=[],this.initialized=!1,this.storagePrefix=kd,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.expirations.set(e.target,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=e=>{try{const t=this.formatTarget(e);return typeof this.getExpiration(t)<"u"}catch{return!1}},this.set=(e,t)=>{this.isInitialized();const n=this.formatTarget(e),r={target:n,expiry:t};this.expirations.set(n,r),this.checkExpiry(n,r),this.events.emit(fp.created,{target:n,expiration:r})},this.get=e=>{this.isInitialized();const t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){const t=this.formatTarget(e),n=this.getExpiration(t);this.expirations.delete(t),this.events.emit(fp.deleted,{target:t,expiration:n})}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=hn.generateChildLogger(t,this.name)}get context(){return hn.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return Uu(e);if("number"==typeof e)return Du(e);const{message:t}=gc("UNKNOWN_TYPE","Target type: "+typeof e);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(fp.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:e}=gc("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:t}=gc("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}checkExpiry(e,t){const{expiry:n}=t;Qe.toMiliseconds(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(fp.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach(((e,t)=>this.checkExpiry(t,e)))}registerEventListeners(){this.core.heartbeat.on(Se.HEARTBEAT_EVENTS.pulse,(()=>this.checkExpirations())),this.events.on(fp.created,(e=>{const t=fp.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(fp.expired,(e=>{const t=fp.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(fp.deleted,(e=>{const t=fp.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=gc("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Jp extends ir{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=dp,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async e=>{if(this.verifyDisabled||wu()||!Eu())return;const t=this.getVerifyUrl(e?.verifyUrl);this.verifyUrl!==t&&this.removeIframe(),this.verifyUrl=t;try{await this.createIframe()}catch(e){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(e)}if(!this.initialized){this.removeIframe(),this.verifyUrl=gp;try{await this.createIframe()}catch(e){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(e),this.verifyDisabled=!0}}},this.register=async e=>{this.initialized?this.sendPost(e.attestationId):(this.addToQueue(e.attestationId),await this.init())},this.resolve=async e=>{if(this.isDevEnv)return"";const t=this.getVerifyUrl(e?.verifyUrl);let n;try{n=await this.fetchAttestation(e.attestationId,t)}catch(r){this.logger.info(`failed to resolve attestation: ${e.attestationId} from url: ${t}`),this.logger.info(r),n=await this.fetchAttestation(e.attestationId,gp)}return n},this.fetchAttestation=async(e,t)=>{this.logger.info(`resolving attestation: ${e} from url: ${t}`);const n=this.startAbortTimer(2*Qe.ONE_SECOND),r=await fetch(`${t}/attestation/${e}`,{signal:this.abortController.signal});return clearTimeout(n),200===r.status?await r.json():void 0},this.addToQueue=e=>{this.queue.push(e)},this.processQueue=()=>{0!==this.queue.length&&(this.queue.forEach((e=>this.sendPost(e))),this.queue=[])},this.sendPost=e=>{var t;try{if(!this.iframe)return;null==(t=this.iframe.contentWindow)||t.postMessage(e,"*"),this.logger.info(`postMessage sent: ${e} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let e;const t=n=>{"verify_ready"===n.data&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",t),e())};await Promise.race([new Promise((n=>{if(document.getElementById(dp))return n();window.addEventListener("message",t);const r=document.createElement("iframe");r.id=dp,r.src=`${this.verifyUrl}/${this.projectId}`,r.style.display="none",document.body.append(r),this.iframe=r,e=n})),new Promise(((e,n)=>setTimeout((()=>{window.removeEventListener("message",t),n("verify iframe load timeout")}),Qe.toMiliseconds(Qe.FIVE_SECONDS))))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=e=>{let t=e||pp;return yp.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${pp}`),t=pp),t},this.logger=hn.generateChildLogger(t,this.name),this.verifyUrl=pp,this.abortController=new AbortController,this.isDevEnv=bu()&&process.env.IS_VITEST}get context(){return hn.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout((()=>this.abortController.abort()),Qe.toMiliseconds(e))}}class Xp extends or{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=vp,this.registerDeviceToken=async e=>{const{clientId:t,token:n,notificationType:r,enableEncrypted:i=!1}=e,o=`${mp}/${this.projectId}/clients`;await Pf(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:r,token:n,always_raw:i})})},this.logger=hn.generateChildLogger(t,this.context)}}var Zp=Object.defineProperty,eg=Object.getOwnPropertySymbols,tg=Object.prototype.hasOwnProperty,ng=Object.prototype.propertyIsEnumerable,rg=(e,t,n)=>t in e?Zp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ig=(e,t)=>{for(var n in t||(t={}))tg.call(t,n)&&rg(e,n,t[n]);if(eg)for(var n of eg(t))ng.call(t,n)&&rg(e,n,t[n]);return e};class og extends Qn{constructor(e){super(e),this.protocol=Id,this.version=xd,this.name=Rd,this.events=new o.exports.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Hd,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const t=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:hn.pino(hn.getDefaultLoggerOptions({level:e?.logger||Cd.logger}));this.logger=hn.generateChildLogger(t,this.name),this.heartbeat=new Se.HeartBeat,this.crypto=new bp(this,this.logger,e?.keychain),this.history=new Yp(this,this.logger),this.expirer=new Qp(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new Ee(ig(ig({},Pd),e?.storageOptions)),this.relayer=new Fp({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Gp(this,this.logger),this.verify=new Jp(this.projectId||"",this.logger),this.echoClient=new Xp(this.projectId||"",this.logger)}static async init(e){const t=new og(e);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem(Xd,n),t}get context(){return hn.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const sg=og,ag="wc",ug=2,cg="client",lg=`${ag}@${ug}:${cg}:`,fg={name:cg,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},hg="WALLETCONNECT_DEEPLINK_CHOICE",dg="proposal",pg="Proposal expired",gg="session",yg=Qe.SEVEN_DAYS,vg="engine",mg={wc_sessionPropose:{req:{ttl:Qe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Qe.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Qe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Qe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Qe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Qe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Qe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Qe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Qe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Qe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Qe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Qe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Qe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Qe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Qe.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Qe.THIRTY_SECONDS,prompt:!1,tag:1115}}},_g={min:Qe.FIVE_MINUTES,max:Qe.SEVEN_DAYS},bg={idle:"IDLE",active:"ACTIVE"},wg="request",Eg=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var Sg=Object.defineProperty,Og=Object.defineProperties,Ig=Object.getOwnPropertyDescriptors,xg=Object.getOwnPropertySymbols,Rg=Object.prototype.hasOwnProperty,kg=Object.prototype.propertyIsEnumerable,Cg=(e,t,n)=>t in e?Sg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pg=(e,t)=>{for(var n in t||(t={}))Rg.call(t,n)&&Cg(e,n,t[n]);if(xg)for(var n of xg(t))kg.call(t,n)&&Cg(e,n,t[n]);return e},Ag=(e,t)=>Og(e,Ig(t));class Ng extends ar{constructor(e){super(e),this.name=vg,this.events=new o.exports,this.initialized=!1,this.ignoredPayloadTypes=[Wa],this.requestQueue={state:bg.idle,queue:[]},this.sessionRequestQueue={state:bg.idle,queue:[]},this.requestQueueDelay=Qe.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(mg)}),this.initialized=!0,setTimeout((()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),Qe.toMiliseconds(this.requestQueueDelay)))},this.connect=async e=>{await this.isInitialized();const t=Ag(Pg({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);const{pairingTopic:n,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:o,relays:s}=t;let a,u=n,c=!1;if(u&&(c=this.client.core.pairing.pairings.get(u).active),!u||!c){const{topic:e,uri:t}=await this.client.core.pairing.create();u=e,a=t}const l=await this.client.core.crypto.generateKeyPair(),f=Pg({requiredNamespaces:r,optionalNamespaces:i,relays:s??[{protocol:Fd}],proposer:{publicKey:l,metadata:this.client.metadata}},o&&{sessionProperties:o}),{reject:h,resolve:d,done:p}=Mu(Qe.FIVE_MINUTES,pg);if(this.events.once(Hu("session_connect"),(async({error:e,session:t})=>{if(e)h(e);else if(t){t.self.publicKey=l;const e=Ag(Pg({},t),{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),u&&await this.client.core.pairing.updateMetadata({topic:u,metadata:t.peer.metadata}),d(e)}})),!u){const{message:e}=gc("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(e)}const g=await this.sendRequest({topic:u,method:"wc_sessionPropose",params:f}),y=Fu(Qe.FIVE_MINUTES);return await this.setProposal(g,Pg({id:g,expiry:y},f)),{uri:a,approval:p}},this.pair=async e=>(await this.isInitialized(),await this.client.core.pairing.pair(e)),this.approve=async e=>{await this.isInitialized(),await this.isValidApprove(e);const{id:t,relayProtocol:n,namespaces:r,sessionProperties:i}=e,o=this.client.proposal.get(t);let{pairingTopic:s,proposer:a,requiredNamespaces:u,optionalNamespaces:c}=o;s=s||"",mc(u)||(u=lc(r,"approve()"));const l=await this.client.core.crypto.generateKeyPair(),f=a.publicKey,h=await this.client.core.crypto.generateSharedKey(l,f);s&&t&&(await this.client.core.pairing.updateMetadata({topic:s,metadata:a.metadata}),await this.sendResult({id:t,topic:s,result:{relay:{protocol:n??"irn"},responderPublicKey:l}}),await this.client.proposal.delete(t,yc("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:s}));const d=Pg({relay:{protocol:n??"irn"},namespaces:r,requiredNamespaces:u,optionalNamespaces:c,pairingTopic:s,controller:{publicKey:l,metadata:this.client.metadata},expiry:Fu(yg)},i&&{sessionProperties:i});await this.client.core.relayer.subscribe(h),await this.sendRequest({topic:h,method:"wc_sessionSettle",params:d,throwOnFailedPublish:!0});const p=Ag(Pg({},d),{topic:h,pairingTopic:s,acknowledged:!1,self:d.controller,peer:{publicKey:a.publicKey,metadata:a.metadata},controller:l});return await this.client.session.set(h,p),await this.setExpiry(h,Fu(yg)),{topic:h,acknowledged:()=>new Promise((e=>setTimeout((()=>e(this.client.session.get(h))),500)))}},this.reject=async e=>{await this.isInitialized(),await this.isValidReject(e);const{id:t,reason:n}=e,{pairingTopic:r}=this.client.proposal.get(t);r&&(await this.sendError(t,r,n),await this.client.proposal.delete(t,yc("USER_DISCONNECTED")))},this.update=async e=>{await this.isInitialized(),await this.isValidUpdate(e);const{topic:t,namespaces:n}=e,r=await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:n}}),{done:i,resolve:o,reject:s}=Mu();return this.events.once(Hu("session_update",r),(({error:e})=>{e?s(e):o()})),await this.client.session.update(t,{namespaces:n}),{acknowledged:i}},this.extend=async e=>{await this.isInitialized(),await this.isValidExtend(e);const{topic:t}=e,n=await this.sendRequest({topic:t,method:"wc_sessionExtend",params:{}}),{done:r,resolve:i,reject:o}=Mu();return this.events.once(Hu("session_extend",n),(({error:e})=>{e?o(e):i()})),await this.setExpiry(t,Fu(yg)),{acknowledged:r}},this.request=async e=>{await this.isInitialized(),await this.isValidRequest(e);const{chainId:t,request:n,topic:r,expiry:i}=e,o=Xl(),{done:s,resolve:a,reject:u}=Mu(i,"Request expired. Please try again.");return this.events.once(Hu("session_request",o),(({error:e,result:t})=>{e?u(e):a(t)})),await Promise.all([new Promise((async e=>{await this.sendRequest({clientRpcId:o,topic:r,method:"wc_sessionRequest",params:{request:n,chainId:t},expiry:i,throwOnFailedPublish:!0}).catch((e=>u(e))),this.client.events.emit("session_request_sent",{topic:r,request:n,chainId:t,id:o}),e()})),new Promise((async e=>{const t=await Vu(this.client.core.storage,hg);$u({id:o,topic:r,wcDeepLink:t}),e()})),s()]).then((e=>e[2]))},this.respond=async e=>{await this.isInitialized(),await this.isValidRespond(e);const{topic:t,response:n}=e,{id:r}=n;mf(n)?await this.sendResult({id:r,topic:t,result:n.result,throwOnFailedPublish:!0}):_f(n)&&await this.sendError(r,t,n.error),this.cleanupAfterResponse(e)},this.ping=async e=>{await this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=await this.sendRequest({topic:t,method:"wc_sessionPing",params:{}}),{done:n,resolve:r,reject:i}=Mu();this.events.once(Hu("session_ping",e),(({error:e})=>{e?i(e):r()})),await n()}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{await this.isInitialized(),await this.isValidEmit(e);const{topic:t,event:n,chainId:r}=e;await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:n,chainId:r}})},this.disconnect=async e=>{await this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.client.session.keys.includes(t)?(await this.sendRequest({topic:t,method:"wc_sessionDelete",params:yc("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(t)):await this.client.core.pairing.disconnect({topic:t})},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter((t=>Ec(t,e)))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter((n=>{var r,i;return(null==(r=n.peerMetadata)?void 0:r.url)&&(null==(i=n.peerMetadata)?void 0:i.url)===e.peer.metadata.url&&n.topic&&n.topic!==t.topic}));if(0===n.length)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e){this.client.logger.error(e)}},this.deleteSession=async(e,t)=>{const{self:n}=this.client.session.get(e);await this.client.core.relayer.unsubscribe(e),this.client.session.delete(e,yc("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(n.publicKey)&&await this.client.core.crypto.deleteKeyPair(n.publicKey),this.client.core.crypto.keychain.has(e)&&await this.client.core.crypto.deleteSymKey(e),t||this.client.core.expirer.del(e),this.client.core.storage.removeItem(hg).catch((e=>this.client.logger.warn(e))),this.getPendingSessionRequests().forEach((t=>{t.topic===e&&this.deletePendingSessionRequest(t.id,yc("USER_DISCONNECTED"))}))},this.deleteProposal=async(e,t)=>{await Promise.all([this.client.proposal.delete(e,yc("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)])},this.deletePendingSessionRequest=async(e,t,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),n?Promise.resolve():this.client.core.expirer.del(e)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter((t=>t.id!==e)),n&&(this.sessionRequestQueue.state=bg.idle)},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&await this.client.session.update(e,{expiry:t}),this.client.core.expirer.set(e,t)},this.setProposal=async(e,t)=>{await this.client.proposal.set(e,t),this.client.core.expirer.set(e,t.expiry)},this.setPendingSessionRequest=async e=>{const t=mg.wc_sessionRequest.req.ttl,{id:n,topic:r,params:i,verifyContext:o}=e;await this.client.pendingRequest.set(n,{id:n,topic:r,params:i,verifyContext:o}),t&&this.client.core.expirer.set(n,Fu(t))},this.sendRequest=async e=>{const{topic:t,method:n,params:r,expiry:i,relayRpcId:o,clientRpcId:s,throwOnFailedPublish:a}=e,u=ef(n,r,s);if(Eu()&&Eg.includes(n)){const e=tu(JSON.stringify(u));this.client.core.verify.register({attestationId:e})}const c=await this.client.core.crypto.encode(t,u),l=mg[n].req;return i&&(l.ttl=i),o&&(l.id=o),this.client.core.history.set(t,u),a?(l.internal=Ag(Pg({},l.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,c,l)):this.client.core.relayer.publish(t,c,l).catch((e=>this.client.logger.error(e))),u.id},this.sendResult=async e=>{const{id:t,topic:n,result:r,throwOnFailedPublish:i}=e,o=tf(t,r),s=await this.client.core.crypto.encode(n,o),a=await this.client.core.history.get(n,t),u=mg[a.request.method].res;i?(u.internal=Ag(Pg({},u.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,s,u)):this.client.core.relayer.publish(n,s,u).catch((e=>this.client.logger.error(e))),await this.client.core.history.resolve(o)},this.sendError=async(e,t,n)=>{const r=nf(e,n),i=await this.client.core.crypto.encode(t,r),o=await this.client.core.history.get(t,e),s=mg[o.request.method].res;this.client.core.relayer.publish(t,i,s),await this.client.core.history.resolve(r)},this.cleanup=async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{Bu(t.expiry)&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{Bu(e.expiry)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession(e))),...t.map((e=>this.deleteProposal(e)))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state!==bg.active){for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=bg.active;const e=this.requestQueue.queue.shift();if(e)try{this.processRequest(e),await new Promise((e=>setTimeout(e,300)))}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=bg.idle}else this.client.logger.info("Request queue already active, skipping...")},this.processRequest=e=>{const{topic:t,payload:n}=e,r=n.method;switch(r){case"wc_sessionPropose":return this.onSessionProposeRequest(t,n);case"wc_sessionSettle":return this.onSessionSettleRequest(t,n);case"wc_sessionUpdate":return this.onSessionUpdateRequest(t,n);case"wc_sessionExtend":return this.onSessionExtendRequest(t,n);case"wc_sessionPing":return this.onSessionPingRequest(t,n);case"wc_sessionDelete":return this.onSessionDeleteRequest(t,n);case"wc_sessionRequest":return this.onSessionRequest(t,n);case"wc_sessionEvent":return this.onSessionEventRequest(t,n);default:return this.client.logger.info(`Unsupported request method ${r}`)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:n}=e,r=(await this.client.core.history.get(t,n.id)).request.method;switch(r){case"wc_sessionPropose":return this.onSessionProposeResponse(t,n);case"wc_sessionSettle":return this.onSessionSettleResponse(t,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,n);case"wc_sessionExtend":return this.onSessionExtendResponse(t,n);case"wc_sessionPing":return this.onSessionPingResponse(t,n);case"wc_sessionRequest":return this.onSessionRequestResponse(t,n);default:return this.client.logger.info(`Unsupported response method ${r}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:t}=e,{message:n}=gc("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.onSessionProposeRequest=async(e,t)=>{const{params:n,id:r}=t;try{this.isValidConnect(Pg({},t.params));const i=Fu(Qe.FIVE_MINUTES),o=Pg({id:r,pairingTopic:e,expiry:i},n);await this.setProposal(r,o);const s=tu(JSON.stringify(t)),a=await this.getVerifyContext(s,o.proposer.metadata);this.client.events.emit("session_proposal",{id:r,params:o,verifyContext:a})}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionProposeResponse=async(e,t)=>{const{id:n}=t;if(mf(t)){const{result:r}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:r});const i=this.client.proposal.get(n);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:i});const o=i.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:o});const s=r.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:s});const a=await this.client.core.crypto.generateSharedKey(o,s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:a});const u=await this.client.core.relayer.subscribe(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:e})}else _f(t)&&(await this.client.proposal.delete(n,yc("USER_DISCONNECTED")),this.events.emit(Hu("session_connect"),{error:t.error}))},this.onSessionSettleRequest=async(e,t)=>{const{id:n,params:r}=t;try{this.isValidSessionSettleRequest(r);const{relay:n,controller:i,expiry:o,namespaces:s,requiredNamespaces:a,optionalNamespaces:u,sessionProperties:c,pairingTopic:l}=t.params,f=Pg({topic:e,relay:n,expiry:o,namespaces:s,acknowledged:!0,pairingTopic:l,requiredNamespaces:a,optionalNamespaces:u,controller:i.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:i.publicKey,metadata:i.metadata}},c&&{sessionProperties:c});await this.sendResult({id:t.id,topic:e,result:!0}),this.events.emit(Hu("session_connect"),{session:f}),this.cleanupDuplicatePairings(f)}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.onSessionSettleResponse=async(e,t)=>{const{id:n}=t;mf(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(Hu("session_approve",n),{})):_f(t)&&(await this.client.session.delete(e,yc("USER_DISCONNECTED")),this.events.emit(Hu("session_approve",n),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{const{params:n,id:r}=t;try{const t=`${e}_session_update`,i=ll.get(t);if(i&&this.isRequestOutOfSync(i,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidUpdate(Pg({topic:e},n)),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:r,topic:e,result:!0}),this.client.events.emit("session_update",{id:r,topic:e,params:n}),ll.set(t,r)}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{const{id:n}=t;mf(t)?this.events.emit(Hu("session_update",n),{}):_f(t)&&this.events.emit(Hu("session_update",n),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{const{id:n}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,Fu(yg)),await this.sendResult({id:n,topic:e,result:!0}),this.client.events.emit("session_extend",{id:n,topic:e})}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.onSessionExtendResponse=(e,t)=>{const{id:n}=t;mf(t)?this.events.emit(Hu("session_extend",n),{}):_f(t)&&this.events.emit(Hu("session_extend",n),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{const{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0}),this.client.events.emit("session_ping",{id:n,topic:e})}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.onSessionPingResponse=(e,t)=>{const{id:n}=t;setTimeout((()=>{mf(t)?this.events.emit(Hu("session_ping",n),{}):_f(t)&&this.events.emit(Hu("session_ping",n),{error:t.error})}),500)},this.onSessionDeleteRequest=async(e,t)=>{const{id:n}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),await Promise.all([new Promise((t=>{this.client.core.relayer.once(Vd.publish,(async()=>{t(await this.deleteSession(e))}))})),this.sendResult({id:n,topic:e,result:!0})]),this.client.events.emit("session_delete",{id:n,topic:e})}catch(e){this.client.logger.error(e)}},this.onSessionRequest=async(e,t)=>{const{id:n,params:r}=t;try{this.isValidRequest(Pg({topic:e},r));const t=tu(JSON.stringify(ef("wc_sessionRequest",r,n))),i=this.client.session.get(e),o={id:n,topic:e,params:r,verifyContext:await this.getVerifyContext(t,i.peer.metadata)};await this.setPendingSessionRequest(o),this.addSessionRequestToSessionRequestQueue(o),this.processSessionRequestQueue()}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.onSessionRequestResponse=(e,t)=>{const{id:n}=t;mf(t)?this.events.emit(Hu("session_request",n),{result:t.result}):_f(t)&&this.events.emit(Hu("session_request",n),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{const{id:n,params:r}=t;try{const t=`${e}_session_event_${r.event.name}`,i=ll.get(t);if(i&&this.isRequestOutOfSync(i,n))return void this.client.logger.info(`Discarding out of sync request - ${n}`);this.isValidEmit(Pg({topic:e},r)),this.client.events.emit("session_event",{id:n,topic:e,params:r}),ll.set(t,n)}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=bg.idle,this.processSessionRequestQueue()}),Qe.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===bg.active)return void this.client.logger.info("session request queue is already active.");const e=this.sessionRequestQueue.queue[0];if(e)try{this.sessionRequestQueue.state=bg.active,this.client.events.emit("session_request",e)}catch(e){this.client.logger.error(e)}else this.client.logger.info("session request queue is empty.")},this.onPairingCreated=e=>{if(e.active)return;const t=this.client.proposal.getAll().find((t=>t.pairingTopic===e.topic));t&&this.onSessionProposeRequest(e.topic,ef("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id))},this.isValidConnect=async e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(t)}const{pairingTopic:t,requiredNamespaces:n,optionalNamespaces:r,sessionProperties:i,relays:o}=e;if(_c(t)||await this.isValidPairingTopic(t),!Bc(o,!0)){const{message:e}=gc("MISSING_OR_INVALID",`connect() relays: ${o}`);throw new Error(e)}!_c(n)&&0!==mc(n)&&this.validateNamespaces(n,"requiredNamespaces"),!_c(r)&&0!==mc(r)&&this.validateNamespaces(r,"optionalNamespaces"),_c(i)||this.validateSessionProps(i,"sessionProperties")},this.validateNamespaces=(e,t)=>{const n=jc(e,"connect()",t);if(n)throw new Error(n.message)},this.isValidApprove=async e=>{if(!qc(e))throw new Error(gc("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:t,namespaces:n,relayProtocol:r,sessionProperties:i}=e;await this.isValidProposalId(t);const o=this.client.proposal.get(t),s=zc(n,"approve()");if(s)throw new Error(s.message);const a=Jc(o.requiredNamespaces,n,"approve()");if(a)throw new Error(a.message);if(!bc(r,!0)){const{message:e}=gc("MISSING_OR_INVALID",`approve() relayProtocol: ${r}`);throw new Error(e)}_c(i)||this.validateSessionProps(i,"sessionProperties")},this.isValidReject=async e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(t)}const{id:t,reason:n}=e;if(await this.isValidProposalId(t),!$c(n)){const{message:e}=gc("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidSessionSettleRequest=e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(t)}const{relay:t,controller:n,namespaces:r,expiry:i}=e;if(!Fc(t)){const{message:e}=gc("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const o=kc(n,"onSessionSettleRequest()");if(o)throw new Error(o.message);const s=zc(r,"onSessionSettleRequest()");if(s)throw new Error(s.message);if(Bu(i)){const{message:e}=gc("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=async e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(t)}const{topic:t,namespaces:n}=e;await this.isValidSessionTopic(t);const r=this.client.session.get(t),i=zc(n,"update()");if(i)throw new Error(i.message);const o=Jc(r.requiredNamespaces,n,"update()");if(o)throw new Error(o.message)},this.isValidExtend=async e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(t)}const{topic:t,request:n,chainId:r,expiry:i}=e;await this.isValidSessionTopic(t);const{namespaces:o}=this.client.session.get(t);if(!Gc(o,r)){const{message:e}=gc("MISSING_OR_INVALID",`request() chainId: ${r}`);throw new Error(e)}if(!Vc(n)){const{message:e}=gc("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(e)}if(!Yc(o,r,n.method)){const{message:e}=gc("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(e)}if(i&&!tl(i,_g)){const{message:e}=gc("MISSING_OR_INVALID",`request() expiry: ${i}. Expiry must be a number (in seconds) between ${_g.min} and ${_g.max}`);throw new Error(e)}},this.isValidRespond=async e=>{var t;if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(t)}const{topic:n,response:r}=e;try{await this.isValidSessionTopic(n)}catch(n){throw null!=(t=e?.response)&&t.id&&this.cleanupAfterResponse(e),n}if(!Wc(r)){const{message:e}=gc("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidPing=async e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(t)}const{topic:t,event:n,chainId:r}=e;await this.isValidSessionTopic(t);const{namespaces:i}=this.client.session.get(t);if(!Gc(i,r)){const{message:e}=gc("MISSING_OR_INVALID",`emit() chainId: ${r}`);throw new Error(e)}if(!Kc(n)){const{message:e}=gc("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(e)}if(!Qc(i,r,n.name)){const{message:e}=gc("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidDisconnect=async e=>{if(!qc(e)){const{message:t}=gc("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.getVerifyContext=async(e,t)=>{const n={verified:{verifyUrl:t.verifyUrl||pp,validation:"UNKNOWN",origin:t.url||""}};try{const r=await this.client.core.verify.resolve({attestationId:e,verifyUrl:t.verifyUrl});r&&(n.verified.origin=r.origin,n.verified.isScam=r.isScam,n.verified.validation=r.origin===new URL(t.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.info(e)}return this.client.logger.info(`Verify context: ${JSON.stringify(n)}`),n},this.validateSessionProps=(e,t)=>{Object.values(e).forEach((e=>{if(!bc(e,!1)){const{message:n}=gc("MISSING_OR_INVALID",`${t} must be in Record<string, string> format. Received: ${JSON.stringify(e)}`);throw new Error(n)}}))}}async isInitialized(){if(!this.initialized){const{message:e}=gc("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Vd.message,(async e=>{const{topic:t,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const r=await this.client.core.crypto.decode(t,n);try{yf(r)?(this.client.core.history.set(t,r),this.onRelayEventRequest({topic:t,payload:r})):vf(r)?(await this.client.core.history.resolve(r),await this.onRelayEventResponse({topic:t,payload:r}),this.client.core.history.delete(t,r.id)):this.onRelayEventUnknownPayload({topic:t,payload:r})}catch(e){this.client.logger.error(e)}}))}registerExpirerEvents(){this.client.core.expirer.on(fp.expired,(async e=>{const{topic:t,id:n}=zu(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,gc("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))}))}registerPairingEvents(){this.client.core.pairing.events.on(sp.create,(e=>this.onPairingCreated(e)))}isValidPairingTopic(e){if(!bc(e,!1)){const{message:t}=gc("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=gc("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Bu(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=gc("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!bc(e,!1)){const{message:t}=gc("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){const{message:t}=gc("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Bu(this.client.session.get(e).expiry)){await this.deleteSession(e);const{message:t}=gc("EXPIRED",`session topic: ${e}`);throw new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else{if(!this.client.core.pairing.pairings.keys.includes(e)){if(bc(e,!1)){const{message:t}=gc("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}{const{message:t}=gc("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if(!Hc(e)){const{message:t}=gc("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=gc("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Bu(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:t}=gc("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class Tg extends Kp{constructor(e,t){super(e,t,dg,lg),this.core=e,this.logger=t}}class Mg extends Kp{constructor(e,t){super(e,t,gg,lg),this.core=e,this.logger=t}}class Lg extends Kp{constructor(e,t){super(e,t,wg,lg,(e=>e.id)),this.core=e,this.logger=t}}class jg extends sr{constructor(e){super(e),this.protocol=ag,this.version=ug,this.name=fg.name,this.events=new o.exports.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}},this.update=async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}},this.request=async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}},this.find=e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.name=e?.name||fg.name,this.metadata=e?.metadata||xu();const t=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:hn.pino(hn.getDefaultLoggerOptions({level:e?.logger||fg.logger}));this.core=e?.core||new sg(e),this.logger=hn.generateChildLogger(t,this.name),this.session=new Mg(this.core,this.logger),this.proposal=new Tg(this.core,this.logger),this.pendingRequest=new Lg(this.core,this.logger),this.engine=new Ng(this)}static async init(e){const t=new jg(e);return await t.initialize(),t}get context(){return hn.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}const Ug="error",Dg="wss://relay.walletconnect.com",zg="wc@2:universal_provider:",Fg="https://rpc.walletconnect.com/v1/",Bg={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Hg={exports:{}};
307
307
  /**
308
308
  * @license
309
309
  * Lodash <https://lodash.com/>
@@ -311,7 +311,7 @@ PERFORMANCE OF THIS SOFTWARE.
311
311
  * Released under MIT license <https://lodash.com/license>
312
312
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
313
313
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
314
- */Tg=Lg,Mg=Lg.exports,function(){var e,n="4.17.21",r=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",s="Invalid `variable` option passed into `_.template`",a="__lodash_hash_undefined__",u=500,c="__lodash_placeholder__",l=1,f=2,h=4,d=1,p=2,g=1,y=2,v=4,m=8,_=16,b=32,w=64,E=128,S=256,O=512,I=30,x="...",R=800,k=16,C=1,P=2,A=3,N=1/0,T=9007199254740991,M=17976931348623157e292,L=NaN,j=4294967295,U=j-1,D=j>>>1,z=[["ary",E],["bind",g],["bindKey",y],["curry",m],["curryRight",_],["flip",O],["partial",b],["partialRight",w],["rearg",S]],F="[object Arguments]",B="[object Array]",H="[object AsyncFunction]",q="[object Boolean]",$="[object Date]",V="[object DOMException]",W="[object Error]",K="[object Function]",G="[object GeneratorFunction]",Y="[object Map]",Q="[object Number]",J="[object Null]",X="[object Object]",Z="[object Promise]",ee="[object Proxy]",te="[object RegExp]",ne="[object Set]",re="[object String]",ie="[object Symbol]",oe="[object Undefined]",se="[object WeakMap]",ae="[object WeakSet]",ue="[object ArrayBuffer]",ce="[object DataView]",le="[object Float32Array]",fe="[object Float64Array]",he="[object Int8Array]",de="[object Int16Array]",pe="[object Int32Array]",ge="[object Uint8Array]",ye="[object Uint8ClampedArray]",ve="[object Uint16Array]",me="[object Uint32Array]",_e=/\b__p \+= '';/g,be=/\b(__p \+=) '' \+/g,we=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ee=/&(?:amp|lt|gt|quot|#39);/g,Se=/[&<>"']/g,Oe=RegExp(Ee.source),Ie=RegExp(Se.source),xe=/<%-([\s\S]+?)%>/g,Re=/<%([\s\S]+?)%>/g,ke=/<%=([\s\S]+?)%>/g,Ce=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pe=/^\w*$/,Ae=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ne=/[\\^$.*+?()[\]{}|]/g,Te=RegExp(Ne.source),Me=/^\s+/,Le=/\s/,je=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ue=/\{\n\/\* \[wrapped with (.+)\] \*/,De=/,? & /,ze=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Fe=/[()=,{}\[\]\/\s]/,Be=/\\(\\)?/g,He=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,qe=/\w*$/,$e=/^[-+]0x[0-9a-f]+$/i,Ve=/^0b[01]+$/i,We=/^\[object .+?Constructor\]$/,Ke=/^0o[0-7]+$/i,Ge=/^(?:0|[1-9]\d*)$/,Ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qe=/($^)/,Je=/['\n\r\u2028\u2029\\]/g,Xe="\\ud800-\\udfff",Ze="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",et="\\u2700-\\u27bf",tt="a-z\\xdf-\\xf6\\xf8-\\xff",nt="A-Z\\xc0-\\xd6\\xd8-\\xde",rt="\\ufe0e\\ufe0f",it="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ot="['’]",st="["+Xe+"]",at="["+it+"]",ut="["+Ze+"]",ct="\\d+",lt="["+et+"]",ft="["+tt+"]",ht="[^"+Xe+it+ct+et+tt+nt+"]",dt="\\ud83c[\\udffb-\\udfff]",pt="[^"+Xe+"]",gt="(?:\\ud83c[\\udde6-\\uddff]){2}",yt="[\\ud800-\\udbff][\\udc00-\\udfff]",vt="["+nt+"]",mt="\\u200d",_t="(?:"+ft+"|"+ht+")",bt="(?:"+vt+"|"+ht+")",wt="(?:"+ot+"(?:d|ll|m|re|s|t|ve))?",Et="(?:"+ot+"(?:D|LL|M|RE|S|T|VE))?",St="(?:"+ut+"|"+dt+")?",Ot="["+rt+"]?",It="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Rt=Ot+St+"(?:"+mt+"(?:"+[pt,gt,yt].join("|")+")"+Ot+St+")*",kt="(?:"+[lt,gt,yt].join("|")+")"+Rt,Ct="(?:"+[pt+ut+"?",ut,gt,yt,st].join("|")+")",Pt=RegExp(ot,"g"),At=RegExp(ut,"g"),Nt=RegExp(dt+"(?="+dt+")|"+Ct+Rt,"g"),Tt=RegExp([vt+"?"+ft+"+"+wt+"(?="+[at,vt,"$"].join("|")+")",bt+"+"+Et+"(?="+[at,vt+_t,"$"].join("|")+")",vt+"?"+_t+"+"+wt,vt+"+"+Et,xt,It,ct,kt].join("|"),"g"),Mt=RegExp("["+mt+Xe+Ze+rt+"]"),Lt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,jt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ut=-1,Dt={};Dt[le]=Dt[fe]=Dt[he]=Dt[de]=Dt[pe]=Dt[ge]=Dt[ye]=Dt[ve]=Dt[me]=!0,Dt[F]=Dt[B]=Dt[ue]=Dt[q]=Dt[ce]=Dt[$]=Dt[W]=Dt[K]=Dt[Y]=Dt[Q]=Dt[X]=Dt[te]=Dt[ne]=Dt[re]=Dt[se]=!1;var zt={};zt[F]=zt[B]=zt[ue]=zt[ce]=zt[q]=zt[$]=zt[le]=zt[fe]=zt[he]=zt[de]=zt[pe]=zt[Y]=zt[Q]=zt[X]=zt[te]=zt[ne]=zt[re]=zt[ie]=zt[ge]=zt[ye]=zt[ve]=zt[me]=!0,zt[W]=zt[K]=zt[se]=!1;var Ft={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},Bt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ht={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},qt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$t=parseFloat,Vt=parseInt,Wt="object"==typeof t&&t&&t.Object===Object&&t,Kt="object"==typeof self&&self&&self.Object===Object&&self,Gt=Wt||Kt||Function("return this")(),Yt=Mg&&!Mg.nodeType&&Mg,Qt=Yt&&Tg&&!Tg.nodeType&&Tg,Jt=Qt&&Qt.exports===Yt,Xt=Jt&&Wt.process,Zt=function(){try{return Qt&&Qt.require&&Qt.require("util").types||Xt&&Xt.binding&&Xt.binding("util")}catch{}}(),en=Zt&&Zt.isArrayBuffer,tn=Zt&&Zt.isDate,nn=Zt&&Zt.isMap,rn=Zt&&Zt.isRegExp,on=Zt&&Zt.isSet,sn=Zt&&Zt.isTypedArray;function an(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function un(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(r,s,n(s),e)}return r}function cn(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function ln(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function fn(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function hn(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function dn(e,t){return!(null==e||!e.length)&&In(e,t,0)>-1}function pn(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function gn(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function yn(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function vn(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function mn(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function _n(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var bn=Cn("length");function wn(e){return e.split("")}function En(e){return e.match(ze)||[]}function Sn(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function On(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function In(e,t,n){return t==t?tr(e,t,n):On(e,Rn,n)}function xn(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Rn(e){return e!=e}function kn(e,t){var n=null==e?0:e.length;return n?Tn(e,t)/n:L}function Cn(t){return function(n){return null==n?e:n[t]}}function Pn(t){return function(n){return null==t?e:t[n]}}function An(e,t,n,r,i){return i(e,(function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)})),n}function Nn(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Tn(t,n){for(var r,i=-1,o=t.length;++i<o;){var s=n(t[i]);s!==e&&(r=r===e?s:r+s)}return r}function Mn(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Ln(e,t){return gn(t,(function(t){return[t,e[t]]}))}function jn(e){return e&&e.slice(0,or(e)+1).replace(Me,"")}function Un(e){return function(t){return e(t)}}function Dn(e,t){return gn(t,(function(t){return e[t]}))}function zn(e,t){return e.has(t)}function Fn(e,t){for(var n=-1,r=e.length;++n<r&&In(t,e[n],0)>-1;);return n}function Bn(e,t){for(var n=e.length;n--&&In(t,e[n],0)>-1;);return n}function Hn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var qn=Pn(Ft),$n=Pn(Bt);function Vn(e){return"\\"+qt[e]}function Wn(t,n){return null==t?e:t[n]}function Kn(e){return Mt.test(e)}function Gn(e){return Lt.test(e)}function Yn(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function Qn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Jn(e,t){return function(n){return e(t(n))}}function Xn(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];(s===t||s===c)&&(e[n]=c,o[i++]=n)}return o}function Zn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function er(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function tr(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function nr(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}function rr(e){return Kn(e)?ar(e):bn(e)}function ir(e){return Kn(e)?ur(e):wn(e)}function or(e){for(var t=e.length;t--&&Le.test(e.charAt(t)););return t}var sr=Pn(Ht);function ar(e){for(var t=Nt.lastIndex=0;Nt.test(e);)++t;return t}function ur(e){return e.match(Nt)||[]}function cr(e){return e.match(Tt)||[]}var lr=function t(Le){var ze=(Le=null==Le?Gt:fr.defaults(Gt.Object(),Le,fr.pick(Gt,jt))).Array,Xe=Le.Date,Ze=Le.Error,et=Le.Function,tt=Le.Math,nt=Le.Object,rt=Le.RegExp,it=Le.String,ot=Le.TypeError,st=ze.prototype,at=et.prototype,ut=nt.prototype,ct=Le["__core-js_shared__"],lt=at.toString,ft=ut.hasOwnProperty,ht=0,dt=function(){var e=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),pt=ut.toString,gt=lt.call(nt),yt=Gt._,vt=rt("^"+lt.call(ft).replace(Ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),mt=Jt?Le.Buffer:e,_t=Le.Symbol,bt=Le.Uint8Array,wt=mt?mt.allocUnsafe:e,Et=Jn(nt.getPrototypeOf,nt),St=nt.create,Ot=ut.propertyIsEnumerable,It=st.splice,xt=_t?_t.isConcatSpreadable:e,Rt=_t?_t.iterator:e,kt=_t?_t.toStringTag:e,Ct=function(){try{var e=Ks(nt,"defineProperty");return e({},"",{}),e}catch{}}(),Nt=Le.clearTimeout!==Gt.clearTimeout&&Le.clearTimeout,Tt=Xe&&Xe.now!==Gt.Date.now&&Xe.now,Mt=Le.setTimeout!==Gt.setTimeout&&Le.setTimeout,Lt=tt.ceil,Ft=tt.floor,Bt=nt.getOwnPropertySymbols,Ht=mt?mt.isBuffer:e,qt=Le.isFinite,Wt=st.join,Kt=Jn(nt.keys,nt),Yt=tt.max,Qt=tt.min,Xt=Xe.now,Zt=Le.parseInt,bn=tt.random,wn=st.reverse,Pn=Ks(Le,"DataView"),tr=Ks(Le,"Map"),ar=Ks(Le,"Promise"),ur=Ks(Le,"Set"),lr=Ks(Le,"WeakMap"),hr=Ks(nt,"create"),dr=lr&&new lr,pr={},gr=Na(Pn),yr=Na(tr),vr=Na(ar),mr=Na(ur),_r=Na(lr),br=_t?_t.prototype:e,wr=br?br.valueOf:e,Er=br?br.toString:e;function Sr(e){if(Il(e)&&!ul(e)&&!(e instanceof Rr)){if(e instanceof xr)return e;if(ft.call(e,"__wrapped__"))return Ma(e)}return new xr(e)}var Or=function(){function t(){}return function(n){if(!Ol(n))return{};if(St)return St(n);t.prototype=n;var r=new t;return t.prototype=e,r}}();function Ir(){}function xr(t,n){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=e}function Rr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=j,this.__views__=[]}function kr(){var e=new Rr(this.__wrapped__);return e.__actions__=is(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=is(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=is(this.__views__),e}function Cr(){if(this.__filtered__){var e=new Rr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e}function Pr(){var e=this.__wrapped__.value(),t=this.__dir__,n=ul(e),r=t<0,i=n?e.length:0,o=Xs(0,i,this.__views__),s=o.start,a=o.end,u=a-s,c=r?a:s-1,l=this.__iteratees__,f=l.length,h=0,d=Qt(u,this.__takeCount__);if(!n||!r&&i==u&&d==u)return zo(e,this.__actions__);var p=[];e:for(;u--&&h<d;){for(var g=-1,y=e[c+=t];++g<f;){var v=l[g],m=v.iteratee,_=v.type,b=m(y);if(_==P)y=b;else if(!b){if(_==C)continue e;break e}}p[h++]=y}return p}function Ar(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Nr(){this.__data__=hr?hr(null):{},this.size=0}function Tr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Mr(t){var n=this.__data__;if(hr){var r=n[t];return r===a?e:r}return ft.call(n,t)?n[t]:e}function Lr(t){var n=this.__data__;return hr?n[t]!==e:ft.call(n,t)}function jr(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=hr&&n===e?a:n,this}function Ur(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Dr(){this.__data__=[],this.size=0}function zr(e){var t=this.__data__,n=li(t,e);return!(n<0||(n==t.length-1?t.pop():It.call(t,n,1),--this.size,0))}function Fr(t){var n=this.__data__,r=li(n,t);return r<0?e:n[r][1]}function Br(e){return li(this.__data__,e)>-1}function Hr(e,t){var n=this.__data__,r=li(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function qr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function $r(){this.size=0,this.__data__={hash:new Ar,map:new(tr||Ur),string:new Ar}}function Vr(e){var t=Vs(this,e).delete(e);return this.size-=t?1:0,t}function Wr(e){return Vs(this,e).get(e)}function Kr(e){return Vs(this,e).has(e)}function Gr(e,t){var n=Vs(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Yr(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new qr;++t<n;)this.add(e[t])}function Qr(e){return this.__data__.set(e,a),this}function Jr(e){return this.__data__.has(e)}function Xr(e){var t=this.__data__=new Ur(e);this.size=t.size}function Zr(){this.__data__=new Ur,this.size=0}function ei(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ti(e){return this.__data__.get(e)}function ni(e){return this.__data__.has(e)}function ri(e,t){var n=this.__data__;if(n instanceof Ur){var i=n.__data__;if(!tr||i.length<r-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new qr(i)}return n.set(e,t),this.size=n.size,this}function ii(e,t){var n=ul(e),r=!n&&al(e),i=!n&&!r&&dl(e),o=!n&&!r&&!i&&Fl(e),s=n||r||i||o,a=s?Mn(e.length,it):[],u=a.length;for(var c in e)(t||ft.call(e,c))&&(!s||!("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||sa(c,u)))&&a.push(c);return a}function oi(t){var n=t.length;return n?t[mo(0,n-1)]:e}function si(e,t){return Ca(is(e),yi(t,0,e.length))}function ai(e){return Ca(is(e))}function ui(t,n,r){(r!==e&&!il(t[n],r)||r===e&&!(n in t))&&pi(t,n,r)}function ci(t,n,r){var i=t[n];(!ft.call(t,n)||!il(i,r)||r===e&&!(n in t))&&pi(t,n,r)}function li(e,t){for(var n=e.length;n--;)if(il(e[n][0],t))return n;return-1}function fi(e,t,n,r){return Ei(e,(function(e,i,o){t(r,e,n(e),o)})),r}function hi(e,t){return e&&os(t,Sf(t),e)}function di(e,t){return e&&os(t,Of(t),e)}function pi(e,t,n){"__proto__"==t&&Ct?Ct(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function gi(t,n){for(var r=-1,i=n.length,o=ze(i),s=null==t;++r<i;)o[r]=s?e:vf(t,n[r]);return o}function yi(t,n,r){return t==t&&(r!==e&&(t=t<=r?t:r),n!==e&&(t=t>=n?t:n)),t}function vi(t,n,r,i,o,s){var a,u=n&l,c=n&f,d=n&h;if(r&&(a=o?r(t,i,o,s):r(t)),a!==e)return a;if(!Ol(t))return t;var p=ul(t);if(p){if(a=ta(t),!u)return is(t,a)}else{var g=Js(t),y=g==K||g==G;if(dl(t))return Go(t,u);if(g==X||g==F||y&&!o){if(a=c||y?{}:na(t),!u)return c?as(t,di(a,t)):ss(t,hi(a,t))}else{if(!zt[g])return o?t:{};a=ra(t,g,u)}}s||(s=new Xr);var v=s.get(t);if(v)return v;s.set(t,a),Ul(t)?t.forEach((function(e){a.add(vi(e,n,r,e,t,s))})):xl(t)&&t.forEach((function(e,i){a.set(i,vi(e,n,r,i,t,s))}));var m=p?e:(d?c?Fs:zs:c?Of:Sf)(t);return cn(m||t,(function(e,i){m&&(e=t[i=e]),ci(a,i,vi(e,n,r,i,t,s))})),a}function mi(e){var t=Sf(e);return function(n){return _i(n,e,t)}}function _i(t,n,r){var i=r.length;if(null==t)return!i;for(t=nt(t);i--;){var o=r[i],s=n[o],a=t[o];if(a===e&&!(o in t)||!s(a))return!1}return!0}function bi(t,n,r){if("function"!=typeof t)throw new ot(o);return Ia((function(){t.apply(e,r)}),n)}function wi(e,t,n,i){var o=-1,s=dn,a=!0,u=e.length,c=[],l=t.length;if(!u)return c;n&&(t=gn(t,Un(n))),i?(s=pn,a=!1):t.length>=r&&(s=zn,a=!1,t=new Yr(t));e:for(;++o<u;){var f=e[o],h=null==n?f:n(f);if(f=i||0!==f?f:0,a&&h==h){for(var d=l;d--;)if(t[d]===h)continue e;c.push(f)}else s(t,h,i)||c.push(f)}return c}Sr.templateSettings={escape:xe,evaluate:Re,interpolate:ke,variable:"",imports:{_:Sr}},Sr.prototype=Ir.prototype,Sr.prototype.constructor=Sr,xr.prototype=Or(Ir.prototype),xr.prototype.constructor=xr,Rr.prototype=Or(Ir.prototype),Rr.prototype.constructor=Rr,Ar.prototype.clear=Nr,Ar.prototype.delete=Tr,Ar.prototype.get=Mr,Ar.prototype.has=Lr,Ar.prototype.set=jr,Ur.prototype.clear=Dr,Ur.prototype.delete=zr,Ur.prototype.get=Fr,Ur.prototype.has=Br,Ur.prototype.set=Hr,qr.prototype.clear=$r,qr.prototype.delete=Vr,qr.prototype.get=Wr,qr.prototype.has=Kr,qr.prototype.set=Gr,Yr.prototype.add=Yr.prototype.push=Qr,Yr.prototype.has=Jr,Xr.prototype.clear=Zr,Xr.prototype.delete=ei,Xr.prototype.get=ti,Xr.prototype.has=ni,Xr.prototype.set=ri;var Ei=ls(Ai),Si=ls(Ni,!0);function Oi(e,t){var n=!0;return Ei(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function Ii(t,n,r){for(var i=-1,o=t.length;++i<o;){var s=t[i],a=n(s);if(null!=a&&(u===e?a==a&&!zl(a):r(a,u)))var u=a,c=s}return c}function xi(t,n,r,i){var o=t.length;for((r=Gl(r))<0&&(r=-r>o?0:o+r),(i=i===e||i>o?o:Gl(i))<0&&(i+=o),i=r>i?0:Yl(i);r<i;)t[r++]=n;return t}function Ri(e,t){var n=[];return Ei(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function ki(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=oa),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?ki(a,t-1,n,r,i):yn(i,a):r||(i[i.length]=a)}return i}var Ci=fs(),Pi=fs(!0);function Ai(e,t){return e&&Ci(e,t,Sf)}function Ni(e,t){return e&&Pi(e,t,Sf)}function Ti(e,t){return hn(t,(function(t){return wl(e[t])}))}function Mi(t,n){for(var r=0,i=(n=$o(n,t)).length;null!=t&&r<i;)t=t[Aa(n[r++])];return r&&r==i?t:e}function Li(e,t,n){var r=t(e);return ul(e)?r:yn(r,n(e))}function ji(t){return null==t?t===e?oe:J:kt&&kt in nt(t)?Gs(t):_a(t)}function Ui(e,t){return e>t}function Di(e,t){return null!=e&&ft.call(e,t)}function zi(e,t){return null!=e&&t in nt(e)}function Fi(e,t,n){return e>=Qt(t,n)&&e<Yt(t,n)}function Bi(t,n,r){for(var i=r?pn:dn,o=t[0].length,s=t.length,a=s,u=ze(s),c=1/0,l=[];a--;){var f=t[a];a&&n&&(f=gn(f,Un(n))),c=Qt(f.length,c),u[a]=!r&&(n||o>=120&&f.length>=120)?new Yr(a&&f):e}f=t[0];var h=-1,d=u[0];e:for(;++h<o&&l.length<c;){var p=f[h],g=n?n(p):p;if(p=r||0!==p?p:0,!(d?zn(d,g):i(l,g,r))){for(a=s;--a;){var y=u[a];if(!(y?zn(y,g):i(t[a],g,r)))continue e}d&&d.push(g),l.push(p)}}return l}function Hi(e,t,n,r){return Ai(e,(function(e,i,o){t(r,n(e),i,o)})),r}function qi(t,n,r){var i=null==(t=wa(t,n=$o(n,t)))?t:t[Aa(ou(n))];return null==i?e:an(i,t,r)}function $i(e){return Il(e)&&ji(e)==F}function Vi(e){return Il(e)&&ji(e)==ue}function Wi(e){return Il(e)&&ji(e)==$}function Ki(e,t,n,r,i){return e===t||(null==e||null==t||!Il(e)&&!Il(t)?e!=e&&t!=t:Gi(e,t,n,r,Ki,i))}function Gi(e,t,n,r,i,o){var s=ul(e),a=ul(t),u=s?B:Js(e),c=a?B:Js(t),l=(u=u==F?X:u)==X,f=(c=c==F?X:c)==X,h=u==c;if(h&&dl(e)){if(!dl(t))return!1;s=!0,l=!1}if(h&&!l)return o||(o=new Xr),s||Fl(e)?Ls(e,t,n,r,i,o):js(e,t,u,n,r,i,o);if(!(n&d)){var p=l&&ft.call(e,"__wrapped__"),g=f&&ft.call(t,"__wrapped__");if(p||g){var y=p?e.value():e,v=g?t.value():t;return o||(o=new Xr),i(y,v,n,r,o)}}return!!h&&(o||(o=new Xr),Us(e,t,n,r,i,o))}function Yi(e){return Il(e)&&Js(e)==Y}function Qi(t,n,r,i){var o=r.length,s=o,a=!i;if(null==t)return!s;for(t=nt(t);o--;){var u=r[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<s;){var c=(u=r[o])[0],l=t[c],f=u[1];if(a&&u[2]){if(l===e&&!(c in t))return!1}else{var h=new Xr;if(i)var g=i(l,f,c,t,n,h);if(!(g===e?Ki(f,l,d|p,i,h):g))return!1}}return!0}function Ji(e){return!(!Ol(e)||fa(e))&&(wl(e)?vt:We).test(Na(e))}function Xi(e){return Il(e)&&ji(e)==te}function Zi(e){return Il(e)&&Js(e)==ne}function eo(e){return Il(e)&&Sl(e.length)&&!!Dt[ji(e)]}function to(e){return"function"==typeof e?e:null==e?Ah:"object"==typeof e?ul(e)?ao(e[0],e[1]):so(e):$h(e)}function no(e){if(!da(e))return Kt(e);var t=[];for(var n in nt(e))ft.call(e,n)&&"constructor"!=n&&t.push(n);return t}function ro(e){if(!Ol(e))return ma(e);var t=da(e),n=[];for(var r in e)"constructor"==r&&(t||!ft.call(e,r))||n.push(r);return n}function io(e,t){return e<t}function oo(e,t){var n=-1,r=ll(e)?ze(e.length):[];return Ei(e,(function(e,i,o){r[++n]=t(e,i,o)})),r}function so(e){var t=Ws(e);return 1==t.length&&t[0][2]?ga(t[0][0],t[0][1]):function(n){return n===e||Qi(n,e,t)}}function ao(t,n){return ua(t)&&pa(n)?ga(Aa(t),n):function(r){var i=vf(r,t);return i===e&&i===n?_f(r,t):Ki(n,i,d|p)}}function uo(t,n,r,i,o){t!==n&&Ci(n,(function(s,a){if(o||(o=new Xr),Ol(s))co(t,n,a,r,uo,i,o);else{var u=i?i(Sa(t,a),s,a+"",t,n,o):e;u===e&&(u=s),ui(t,a,u)}}),Of)}function co(t,n,r,i,o,s,a){var u=Sa(t,r),c=Sa(n,r),l=a.get(c);if(l)ui(t,r,l);else{var f=s?s(u,c,r+"",t,n,a):e,h=f===e;if(h){var d=ul(c),p=!d&&dl(c),g=!d&&!p&&Fl(c);f=c,d||p||g?ul(u)?f=u:fl(u)?f=is(u):p?(h=!1,f=Go(c,!0)):g?(h=!1,f=Zo(c,!0)):f=[]:Ml(c)||al(c)?(f=u,al(u)?f=Jl(u):(!Ol(u)||wl(u))&&(f=na(c))):h=!1}h&&(a.set(c,f),o(f,c,i,s,a),a.delete(c)),ui(t,r,f)}}function lo(t,n){var r=t.length;if(r)return sa(n+=n<0?r:0,r)?t[n]:e}function fo(e,t,n){t=t.length?gn(t,(function(e){return ul(e)?function(t){return Mi(t,1===e.length?e[0]:e)}:e})):[Ah];var r=-1;t=gn(t,Un($s()));var i=oo(e,(function(e,n,i){var o=gn(t,(function(t){return t(e)}));return{criteria:o,index:++r,value:e}}));return Nn(i,(function(e,t){return ts(e,t,n)}))}function ho(e,t){return po(e,t,(function(t,n){return _f(e,n)}))}function po(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=Mi(e,s);n(a,s)&&Oo(o,$o(s,e),a)}return o}function go(e){return function(t){return Mi(t,e)}}function yo(e,t,n,r){var i=r?xn:In,o=-1,s=t.length,a=e;for(e===t&&(t=is(t)),n&&(a=gn(e,Un(n)));++o<s;)for(var u=0,c=t[o],l=n?n(c):c;(u=i(a,l,u,r))>-1;)a!==e&&It.call(a,u,1),It.call(e,u,1);return e}function vo(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;sa(i)?It.call(e,i,1):jo(e,i)}}return e}function mo(e,t){return e+Ft(bn()*(t-e+1))}function _o(e,t,n,r){for(var i=-1,o=Yt(Lt((t-e)/(n||1)),0),s=ze(o);o--;)s[r?o:++i]=e,e+=n;return s}function bo(e,t){var n="";if(!e||t<1||t>T)return n;do{t%2&&(n+=e),(t=Ft(t/2))&&(e+=e)}while(t);return n}function wo(e,t){return xa(ba(e,t,Ah),e+"")}function Eo(e){return oi(Hf(e))}function So(e,t){var n=Hf(e);return Ca(n,yi(t,0,n.length))}function Oo(t,n,r,i){if(!Ol(t))return t;for(var o=-1,s=(n=$o(n,t)).length,a=s-1,u=t;null!=u&&++o<s;){var c=Aa(n[o]),l=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=a){var f=u[c];(l=i?i(f,c,u):e)===e&&(l=Ol(f)?f:sa(n[o+1])?[]:{})}ci(u,c,l),u=u[c]}return t}var Io=dr?function(e,t){return dr.set(e,t),e}:Ah,xo=Ct?function(e,t){return Ct(e,"toString",{configurable:!0,enumerable:!1,value:Rh(t),writable:!0})}:Ah;function Ro(e){return Ca(Hf(e))}function ko(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=ze(i);++r<i;)o[r]=e[r+t];return o}function Co(e,t){var n;return Ei(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function Po(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=D){for(;r<i;){var o=r+i>>>1,s=e[o];null!==s&&!zl(s)&&(n?s<=t:s<t)?r=o+1:i=o}return i}return Ao(e,t,Ah,n)}function Ao(t,n,r,i){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(n=r(n))!=n,u=null===n,c=zl(n),l=n===e;o<s;){var f=Ft((o+s)/2),h=r(t[f]),d=h!==e,p=null===h,g=h==h,y=zl(h);if(a)var v=i||g;else v=l?g&&(i||d):u?g&&d&&(i||!p):c?g&&d&&!p&&(i||!y):!p&&!y&&(i?h<=n:h<n);v?o=f+1:s=f}return Qt(s,U)}function No(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n],a=t?t(s):s;if(!n||!il(a,u)){var u=a;o[i++]=0===s?0:s}}return o}function To(e){return"number"==typeof e?e:zl(e)?L:+e}function Mo(e){if("string"==typeof e)return e;if(ul(e))return gn(e,Mo)+"";if(zl(e))return Er?Er.call(e):"";var t=e+"";return"0"==t&&1/e==-N?"-0":t}function Lo(e,t,n){var i=-1,o=dn,s=e.length,a=!0,u=[],c=u;if(n)a=!1,o=pn;else if(s>=r){var l=t?null:Cs(e);if(l)return Zn(l);a=!1,o=zn,c=new Yr}else c=t?[]:u;e:for(;++i<s;){var f=e[i],h=t?t(f):f;if(f=n||0!==f?f:0,a&&h==h){for(var d=c.length;d--;)if(c[d]===h)continue e;t&&c.push(h),u.push(f)}else o(c,h,n)||(c!==u&&c.push(h),u.push(f))}return u}function jo(e,t){return null==(e=wa(e,t=$o(t,e)))||delete e[Aa(ou(t))]}function Uo(e,t,n,r){return Oo(e,t,n(Mi(e,t)),r)}function Do(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?ko(e,r?0:o,r?o+1:i):ko(e,r?o+1:0,r?i:o)}function zo(e,t){var n=e;return n instanceof Rr&&(n=n.value()),vn(t,(function(e,t){return t.func.apply(t.thisArg,yn([e],t.args))}),n)}function Fo(e,t,n){var r=e.length;if(r<2)return r?Lo(e[0]):[];for(var i=-1,o=ze(r);++i<r;)for(var s=e[i],a=-1;++a<r;)a!=i&&(o[i]=wi(o[i]||s,e[a],t,n));return Lo(ki(o,1),t,n)}function Bo(t,n,r){for(var i=-1,o=t.length,s=n.length,a={};++i<o;){var u=i<s?n[i]:e;r(a,t[i],u)}return a}function Ho(e){return fl(e)?e:[]}function qo(e){return"function"==typeof e?e:Ah}function $o(e,t){return ul(e)?e:ua(e,t)?[e]:Pa(Zl(e))}var Vo=wo;function Wo(t,n,r){var i=t.length;return r=r===e?i:r,!n&&r>=i?t:ko(t,n,r)}var Ko=Nt||function(e){return Gt.clearTimeout(e)};function Go(e,t){if(t)return e.slice();var n=e.length,r=wt?wt(n):new e.constructor(n);return e.copy(r),r}function Yo(e){var t=new e.constructor(e.byteLength);return new bt(t).set(new bt(e)),t}function Qo(e,t){var n=t?Yo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Jo(e){var t=new e.constructor(e.source,qe.exec(e));return t.lastIndex=e.lastIndex,t}function Xo(e){return wr?nt(wr.call(e)):{}}function Zo(e,t){var n=t?Yo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function es(t,n){if(t!==n){var r=t!==e,i=null===t,o=t==t,s=zl(t),a=n!==e,u=null===n,c=n==n,l=zl(n);if(!u&&!l&&!s&&t>n||s&&a&&c&&!u&&!l||i&&a&&c||!r&&c||!o)return 1;if(!i&&!s&&!l&&t<n||l&&r&&o&&!i&&!s||u&&r&&o||!a&&o||!c)return-1}return 0}function ts(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,s=i.length,a=n.length;++r<s;){var u=es(i[r],o[r]);if(u)return r>=a?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}function ns(e,t,n,r){for(var i=-1,o=e.length,s=n.length,a=-1,u=t.length,c=Yt(o-s,0),l=ze(u+c),f=!r;++a<u;)l[a]=t[a];for(;++i<s;)(f||i<o)&&(l[n[i]]=e[i]);for(;c--;)l[a++]=e[i++];return l}function rs(e,t,n,r){for(var i=-1,o=e.length,s=-1,a=n.length,u=-1,c=t.length,l=Yt(o-a,0),f=ze(l+c),h=!r;++i<l;)f[i]=e[i];for(var d=i;++u<c;)f[d+u]=t[u];for(;++s<a;)(h||i<o)&&(f[d+n[s]]=e[i++]);return f}function is(e,t){var n=-1,r=e.length;for(t||(t=ze(r));++n<r;)t[n]=e[n];return t}function os(t,n,r,i){var o=!r;r||(r={});for(var s=-1,a=n.length;++s<a;){var u=n[s],c=i?i(r[u],t[u],u,r,t):e;c===e&&(c=t[u]),o?pi(r,u,c):ci(r,u,c)}return r}function ss(e,t){return os(e,Ys(e),t)}function as(e,t){return os(e,Qs(e),t)}function us(e,t){return function(n,r){var i=ul(n)?un:fi,o=t?t():{};return i(n,e,$s(r,2),o)}}function cs(t){return wo((function(n,r){var i=-1,o=r.length,s=o>1?r[o-1]:e,a=o>2?r[2]:e;for(s=t.length>3&&"function"==typeof s?(o--,s):e,a&&aa(r[0],r[1],a)&&(s=o<3?e:s,o=1),n=nt(n);++i<o;){var u=r[i];u&&t(n,u,i,s)}return n}))}function ls(e,t){return function(n,r){if(null==n)return n;if(!ll(n))return e(n,r);for(var i=n.length,o=t?i:-1,s=nt(n);(t?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function fs(e){return function(t,n,r){for(var i=-1,o=nt(t),s=r(t),a=s.length;a--;){var u=s[e?a:++i];if(!1===n(o[u],u,o))break}return t}}function hs(e,t,n){var r=t&g,i=gs(e);function o(){return(this&&this!==Gt&&this instanceof o?i:e).apply(r?n:this,arguments)}return o}function ds(t){return function(n){var r=Kn(n=Zl(n))?ir(n):e,i=r?r[0]:n.charAt(0),o=r?Wo(r,1).join(""):n.slice(1);return i[t]()+o}}function ps(e){return function(t){return vn(Eh(Yf(t).replace(Pt,"")),e,"")}}function gs(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Or(e.prototype),r=e.apply(n,t);return Ol(r)?r:n}}function ys(t,n,r){var i=gs(t);function o(){for(var s=arguments.length,a=ze(s),u=s,c=qs(o);u--;)a[u]=arguments[u];var l=s<3&&a[0]!==c&&a[s-1]!==c?[]:Xn(a,c);return(s-=l.length)<r?Rs(t,n,_s,o.placeholder,e,a,l,e,e,r-s):an(this&&this!==Gt&&this instanceof o?i:t,this,a)}return o}function vs(t){return function(n,r,i){var o=nt(n);if(!ll(n)){var s=$s(r,3);n=Sf(n),r=function(e){return s(o[e],e,o)}}var a=t(n,r,i);return a>-1?o[s?n[a]:a]:e}}function ms(t){return Ds((function(n){var r=n.length,i=r,s=xr.prototype.thru;for(t&&n.reverse();i--;){var a=n[i];if("function"!=typeof a)throw new ot(o);if(s&&!u&&"wrapper"==Hs(a))var u=new xr([],!0)}for(i=u?i:r;++i<r;){var c=Hs(a=n[i]),l="wrapper"==c?Bs(a):e;u=l&&la(l[0])&&l[1]==(E|m|b|S)&&!l[4].length&&1==l[9]?u[Hs(l[0])].apply(u,l[3]):1==a.length&&la(a)?u[c]():u.thru(a)}return function(){var e=arguments,t=e[0];if(u&&1==e.length&&ul(t))return u.plant(t).value();for(var i=0,o=r?n[i].apply(this,e):t;++i<r;)o=n[i].call(this,o);return o}}))}function _s(t,n,r,i,o,s,a,u,c,l){var f=n&E,h=n&g,d=n&y,p=n&(m|_),v=n&O,b=d?e:gs(t);function w(){for(var e=arguments.length,g=ze(e),y=e;y--;)g[y]=arguments[y];if(p)var m=qs(w),_=Hn(g,m);if(i&&(g=ns(g,i,o,p)),s&&(g=rs(g,s,a,p)),e-=_,p&&e<l){var E=Xn(g,m);return Rs(t,n,_s,w.placeholder,r,g,E,u,c,l-e)}var S=h?r:this,O=d?S[t]:t;return e=g.length,u?g=Ea(g,u):v&&e>1&&g.reverse(),f&&c<e&&(g.length=c),this&&this!==Gt&&this instanceof w&&(O=b||gs(O)),O.apply(S,g)}return w}function bs(e,t){return function(n,r){return Hi(n,e,t(r),{})}}function ws(t,n){return function(r,i){var o;if(r===e&&i===e)return n;if(r!==e&&(o=r),i!==e){if(o===e)return i;"string"==typeof r||"string"==typeof i?(r=Mo(r),i=Mo(i)):(r=To(r),i=To(i)),o=t(r,i)}return o}}function Es(e){return Ds((function(t){return t=gn(t,Un($s())),wo((function(n){var r=this;return e(t,(function(e){return an(e,r,n)}))}))}))}function Ss(t,n){var r=(n=n===e?" ":Mo(n)).length;if(r<2)return r?bo(n,t):n;var i=bo(n,Lt(t/rr(n)));return Kn(n)?Wo(ir(i),0,t).join(""):i.slice(0,t)}function Os(e,t,n,r){var i=t&g,o=gs(e);function s(){for(var t=-1,a=arguments.length,u=-1,c=r.length,l=ze(c+a),f=this&&this!==Gt&&this instanceof s?o:e;++u<c;)l[u]=r[u];for(;a--;)l[u++]=arguments[++t];return an(f,i?n:this,l)}return s}function Is(t){return function(n,r,i){return i&&"number"!=typeof i&&aa(n,r,i)&&(r=i=e),n=Kl(n),r===e?(r=n,n=0):r=Kl(r),_o(n,r,i=i===e?n<r?1:-1:Kl(i),t)}}function xs(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=Ql(t),n=Ql(n)),e(t,n)}}function Rs(t,n,r,i,o,s,a,u,c,l){var f=n&m;n|=f?b:w,(n&=~(f?w:b))&v||(n&=~(g|y));var h=[t,n,o,f?s:e,f?a:e,f?e:s,f?e:a,u,c,l],d=r.apply(e,h);return la(t)&&Oa(d,h),d.placeholder=i,Ra(d,t,n)}function ks(e){var t=tt[e];return function(e,n){if(e=Ql(e),(n=null==n?0:Qt(Gl(n),292))&&qt(e)){var r=(Zl(e)+"e").split("e");return+((r=(Zl(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Cs=ur&&1/Zn(new ur([,-0]))[1]==N?function(e){return new ur(e)}:zh;function Ps(e){return function(t){var n=Js(t);return n==Y?Qn(t):n==ne?er(t):Ln(t,e(t))}}function As(t,n,r,i,s,a,u,c){var l=n&y;if(!l&&"function"!=typeof t)throw new ot(o);var f=i?i.length:0;if(f||(n&=~(b|w),i=s=e),u=u===e?u:Yt(Gl(u),0),c=c===e?c:Gl(c),f-=s?s.length:0,n&w){var h=i,d=s;i=s=e}var p=l?e:Bs(t),v=[t,n,r,i,s,h,d,a,u,c];if(p&&va(v,p),t=v[0],n=v[1],r=v[2],i=v[3],s=v[4],!(c=v[9]=v[9]===e?l?0:t.length:Yt(v[9]-f,0))&&n&(m|_)&&(n&=~(m|_)),n&&n!=g)E=n==m||n==_?ys(t,n,c):n!=b&&n!=(g|b)||s.length?_s.apply(e,v):Os(t,n,r,i);else var E=hs(t,n,r);return Ra((p?Io:Oa)(E,v),t,n)}function Ns(t,n,r,i){return t===e||il(t,ut[r])&&!ft.call(i,r)?n:t}function Ts(t,n,r,i,o,s){return Ol(t)&&Ol(n)&&(s.set(n,t),uo(t,n,e,Ts,s),s.delete(n)),t}function Ms(t){return Ml(t)?e:t}function Ls(t,n,r,i,o,s){var a=r&d,u=t.length,c=n.length;if(u!=c&&!(a&&c>u))return!1;var l=s.get(t),f=s.get(n);if(l&&f)return l==n&&f==t;var h=-1,g=!0,y=r&p?new Yr:e;for(s.set(t,n),s.set(n,t);++h<u;){var v=t[h],m=n[h];if(i)var _=a?i(m,v,h,n,t,s):i(v,m,h,t,n,s);if(_!==e){if(_)continue;g=!1;break}if(y){if(!_n(n,(function(e,t){if(!zn(y,t)&&(v===e||o(v,e,r,i,s)))return y.push(t)}))){g=!1;break}}else if(v!==m&&!o(v,m,r,i,s)){g=!1;break}}return s.delete(t),s.delete(n),g}function js(e,t,n,r,i,o,s){switch(n){case ce:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ue:return!(e.byteLength!=t.byteLength||!o(new bt(e),new bt(t)));case q:case $:case Q:return il(+e,+t);case W:return e.name==t.name&&e.message==t.message;case te:case re:return e==t+"";case Y:var a=Qn;case ne:var u=r&d;if(a||(a=Zn),e.size!=t.size&&!u)return!1;var c=s.get(e);if(c)return c==t;r|=p,s.set(e,t);var l=Ls(a(e),a(t),r,i,o,s);return s.delete(e),l;case ie:if(wr)return wr.call(e)==wr.call(t)}return!1}function Us(t,n,r,i,o,s){var a=r&d,u=zs(t),c=u.length;if(c!=zs(n).length&&!a)return!1;for(var l=c;l--;){var f=u[l];if(!(a?f in n:ft.call(n,f)))return!1}var h=s.get(t),p=s.get(n);if(h&&p)return h==n&&p==t;var g=!0;s.set(t,n),s.set(n,t);for(var y=a;++l<c;){var v=t[f=u[l]],m=n[f];if(i)var _=a?i(m,v,f,n,t,s):i(v,m,f,t,n,s);if(!(_===e?v===m||o(v,m,r,i,s):_)){g=!1;break}y||(y="constructor"==f)}if(g&&!y){var b=t.constructor,w=n.constructor;b!=w&&"constructor"in t&&"constructor"in n&&!("function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w)&&(g=!1)}return s.delete(t),s.delete(n),g}function Ds(t){return xa(ba(t,e,Ga),t+"")}function zs(e){return Li(e,Sf,Ys)}function Fs(e){return Li(e,Of,Qs)}var Bs=dr?function(e){return dr.get(e)}:zh;function Hs(e){for(var t=e.name+"",n=pr[t],r=ft.call(pr,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function qs(e){return(ft.call(Sr,"placeholder")?Sr:e).placeholder}function $s(){var e=Sr.iteratee||Nh;return e=e===Nh?to:e,arguments.length?e(arguments[0],arguments[1]):e}function Vs(e,t){var n=e.__data__;return ca(t)?n["string"==typeof t?"string":"hash"]:n.map}function Ws(e){for(var t=Sf(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,pa(i)]}return t}function Ks(t,n){var r=Wn(t,n);return Ji(r)?r:e}function Gs(t){var n=ft.call(t,kt),r=t[kt];try{t[kt]=e;var i=!0}catch{}var o=pt.call(t);return i&&(n?t[kt]=r:delete t[kt]),o}var Ys=Bt?function(e){return null==e?[]:(e=nt(e),hn(Bt(e),(function(t){return Ot.call(e,t)})))}:Gh,Qs=Bt?function(e){for(var t=[];e;)yn(t,Ys(e)),e=Et(e);return t}:Gh,Js=ji;function Xs(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=Qt(t,e+s);break;case"takeRight":e=Yt(e,t-s)}}return{start:e,end:t}}function Zs(e){var t=e.match(Ue);return t?t[1].split(De):[]}function ea(e,t,n){for(var r=-1,i=(t=$o(t,e)).length,o=!1;++r<i;){var s=Aa(t[r]);if(!(o=null!=e&&n(e,s)))break;e=e[s]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Sl(i)&&sa(s,i)&&(ul(e)||al(e))}function ta(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ft.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function na(e){return"function"!=typeof e.constructor||da(e)?{}:Or(Et(e))}function ra(e,t,n){var r=e.constructor;switch(t){case ue:return Yo(e);case q:case $:return new r(+e);case ce:return Qo(e,n);case le:case fe:case he:case de:case pe:case ge:case ye:case ve:case me:return Zo(e,n);case Y:return new r;case Q:case re:return new r(e);case te:return Jo(e);case ne:return new r;case ie:return Xo(e)}}function ia(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(je,"{\n/* [wrapped with "+t+"] */\n")}function oa(e){return ul(e)||al(e)||!!(xt&&e&&e[xt])}function sa(e,t){var n=typeof e;return!!(t=t??T)&&("number"==n||"symbol"!=n&&Ge.test(e))&&e>-1&&e%1==0&&e<t}function aa(e,t,n){if(!Ol(n))return!1;var r=typeof t;return!!("number"==r?ll(n)&&sa(t,n.length):"string"==r&&t in n)&&il(n[t],e)}function ua(e,t){if(ul(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!zl(e))||Pe.test(e)||!Ce.test(e)||null!=t&&e in nt(t)}function ca(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function la(e){var t=Hs(e),n=Sr[t];if("function"!=typeof n||!(t in Rr.prototype))return!1;if(e===n)return!0;var r=Bs(n);return!!r&&e===r[0]}function fa(e){return!!dt&&dt in e}(Pn&&Js(new Pn(new ArrayBuffer(1)))!=ce||tr&&Js(new tr)!=Y||ar&&Js(ar.resolve())!=Z||ur&&Js(new ur)!=ne||lr&&Js(new lr)!=se)&&(Js=function(t){var n=ji(t),r=n==X?t.constructor:e,i=r?Na(r):"";if(i)switch(i){case gr:return ce;case yr:return Y;case vr:return Z;case mr:return ne;case _r:return se}return n});var ha=ct?wl:Yh;function da(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ut)}function pa(e){return e==e&&!Ol(e)}function ga(t,n){return function(r){return null!=r&&r[t]===n&&(n!==e||t in nt(r))}}function ya(e){var t=Fc(e,(function(e){return n.size===u&&n.clear(),e})),n=t.cache;return t}function va(e,t){var n=e[1],r=t[1],i=n|r,o=i<(g|y|E),s=r==E&&n==m||r==E&&n==S&&e[7].length<=t[8]||r==(E|S)&&t[7].length<=t[8]&&n==m;if(!o&&!s)return e;r&g&&(e[2]=t[2],i|=n&g?0:v);var a=t[3];if(a){var u=e[3];e[3]=u?ns(u,a,t[4]):a,e[4]=u?Xn(e[3],c):t[4]}return(a=t[5])&&(u=e[5],e[5]=u?rs(u,a,t[6]):a,e[6]=u?Xn(e[5],c):t[6]),(a=t[7])&&(e[7]=a),r&E&&(e[8]=null==e[8]?t[8]:Qt(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}function ma(e){var t=[];if(null!=e)for(var n in nt(e))t.push(n);return t}function _a(e){return pt.call(e)}function ba(t,n,r){return n=Yt(n===e?t.length-1:n,0),function(){for(var e=arguments,i=-1,o=Yt(e.length-n,0),s=ze(o);++i<o;)s[i]=e[n+i];i=-1;for(var a=ze(n+1);++i<n;)a[i]=e[i];return a[n]=r(s),an(t,this,a)}}function wa(e,t){return t.length<2?e:Mi(e,ko(t,0,-1))}function Ea(t,n){for(var r=t.length,i=Qt(n.length,r),o=is(t);i--;){var s=n[i];t[i]=sa(s,r)?o[s]:e}return t}function Sa(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Oa=ka(Io),Ia=Mt||function(e,t){return Gt.setTimeout(e,t)},xa=ka(xo);function Ra(e,t,n){var r=t+"";return xa(e,ia(r,Ta(Zs(r),n)))}function ka(t){var n=0,r=0;return function(){var i=Xt(),o=k-(i-r);if(r=i,o>0){if(++n>=R)return arguments[0]}else n=0;return t.apply(e,arguments)}}function Ca(t,n){var r=-1,i=t.length,o=i-1;for(n=n===e?i:n;++r<n;){var s=mo(r,o),a=t[s];t[s]=t[r],t[r]=a}return t.length=n,t}var Pa=ya((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ae,(function(e,n,r,i){t.push(r?i.replace(Be,"$1"):n||e)})),t}));function Aa(e){if("string"==typeof e||zl(e))return e;var t=e+"";return"0"==t&&1/e==-N?"-0":t}function Na(e){if(null!=e){try{return lt.call(e)}catch{}try{return e+""}catch{}}return""}function Ta(e,t){return cn(z,(function(n){var r="_."+n[0];t&n[1]&&!dn(e,r)&&e.push(r)})),e.sort()}function Ma(e){if(e instanceof Rr)return e.clone();var t=new xr(e.__wrapped__,e.__chain__);return t.__actions__=is(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function La(t,n,r){n=(r?aa(t,n,r):n===e)?1:Yt(Gl(n),0);var i=null==t?0:t.length;if(!i||n<1)return[];for(var o=0,s=0,a=ze(Lt(i/n));o<i;)a[s++]=ko(t,o,o+=n);return a}function ja(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i}function Ua(){var e=arguments.length;if(!e)return[];for(var t=ze(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return yn(ul(n)?is(n):[n],ki(t,1))}var Da=wo((function(e,t){return fl(e)?wi(e,ki(t,1,fl,!0)):[]})),za=wo((function(t,n){var r=ou(n);return fl(r)&&(r=e),fl(t)?wi(t,ki(n,1,fl,!0),$s(r,2)):[]})),Fa=wo((function(t,n){var r=ou(n);return fl(r)&&(r=e),fl(t)?wi(t,ki(n,1,fl,!0),e,r):[]}));function Ba(t,n,r){var i=null==t?0:t.length;return i?ko(t,(n=r||n===e?1:Gl(n))<0?0:n,i):[]}function Ha(t,n,r){var i=null==t?0:t.length;return i?ko(t,0,(n=i-(n=r||n===e?1:Gl(n)))<0?0:n):[]}function qa(e,t){return e&&e.length?Do(e,$s(t,3),!0,!0):[]}function $a(e,t){return e&&e.length?Do(e,$s(t,3),!0):[]}function Va(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&aa(e,t,n)&&(n=0,r=i),xi(e,t,n,r)):[]}function Wa(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:Gl(n);return i<0&&(i=Yt(r+i,0)),On(e,$s(t,3),i)}function Ka(t,n,r){var i=null==t?0:t.length;if(!i)return-1;var o=i-1;return r!==e&&(o=Gl(r),o=r<0?Yt(i+o,0):Qt(o,i-1)),On(t,$s(n,3),o,!0)}function Ga(e){return null!=e&&e.length?ki(e,1):[]}function Ya(e){return null!=e&&e.length?ki(e,N):[]}function Qa(t,n){return null!=t&&t.length?ki(t,n=n===e?1:Gl(n)):[]}function Ja(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r}function Xa(t){return t&&t.length?t[0]:e}function Za(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:Gl(n);return i<0&&(i=Yt(r+i,0)),In(e,t,i)}function eu(e){return null!=e&&e.length?ko(e,0,-1):[]}var tu=wo((function(e){var t=gn(e,Ho);return t.length&&t[0]===e[0]?Bi(t):[]})),nu=wo((function(t){var n=ou(t),r=gn(t,Ho);return n===ou(r)?n=e:r.pop(),r.length&&r[0]===t[0]?Bi(r,$s(n,2)):[]})),ru=wo((function(t){var n=ou(t),r=gn(t,Ho);return(n="function"==typeof n?n:e)&&r.pop(),r.length&&r[0]===t[0]?Bi(r,e,n):[]}));function iu(e,t){return null==e?"":Wt.call(e,t)}function ou(t){var n=null==t?0:t.length;return n?t[n-1]:e}function su(t,n,r){var i=null==t?0:t.length;if(!i)return-1;var o=i;return r!==e&&(o=(o=Gl(r))<0?Yt(i+o,0):Qt(o,i-1)),n==n?nr(t,n,o):On(t,Rn,o,!0)}function au(t,n){return t&&t.length?lo(t,Gl(n)):e}var uu=wo(cu);function cu(e,t){return e&&e.length&&t&&t.length?yo(e,t):e}function lu(e,t,n){return e&&e.length&&t&&t.length?yo(e,t,$s(n,2)):e}function fu(t,n,r){return t&&t.length&&n&&n.length?yo(t,n,e,r):t}var hu=Ds((function(e,t){var n=null==e?0:e.length,r=gi(e,t);return vo(e,gn(t,(function(e){return sa(e,n)?+e:e})).sort(es)),r}));function du(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=$s(t,3);++r<o;){var s=e[r];t(s,r,e)&&(n.push(s),i.push(r))}return vo(e,i),n}function pu(e){return null==e?e:wn.call(e)}function gu(t,n,r){var i=null==t?0:t.length;return i?(r&&"number"!=typeof r&&aa(t,n,r)?(n=0,r=i):(n=null==n?0:Gl(n),r=r===e?i:Gl(r)),ko(t,n,r)):[]}function yu(e,t){return Po(e,t)}function vu(e,t,n){return Ao(e,t,$s(n,2))}function mu(e,t){var n=null==e?0:e.length;if(n){var r=Po(e,t);if(r<n&&il(e[r],t))return r}return-1}function _u(e,t){return Po(e,t,!0)}function bu(e,t,n){return Ao(e,t,$s(n,2),!0)}function wu(e,t){if(null!=e&&e.length){var n=Po(e,t,!0)-1;if(il(e[n],t))return n}return-1}function Eu(e){return e&&e.length?No(e):[]}function Su(e,t){return e&&e.length?No(e,$s(t,2)):[]}function Ou(e){var t=null==e?0:e.length;return t?ko(e,1,t):[]}function Iu(t,n,r){return t&&t.length?ko(t,0,(n=r||n===e?1:Gl(n))<0?0:n):[]}function xu(t,n,r){var i=null==t?0:t.length;return i?ko(t,(n=i-(n=r||n===e?1:Gl(n)))<0?0:n,i):[]}function Ru(e,t){return e&&e.length?Do(e,$s(t,3),!1,!0):[]}function ku(e,t){return e&&e.length?Do(e,$s(t,3)):[]}var Cu=wo((function(e){return Lo(ki(e,1,fl,!0))})),Pu=wo((function(t){var n=ou(t);return fl(n)&&(n=e),Lo(ki(t,1,fl,!0),$s(n,2))})),Au=wo((function(t){var n=ou(t);return n="function"==typeof n?n:e,Lo(ki(t,1,fl,!0),e,n)}));function Nu(e){return e&&e.length?Lo(e):[]}function Tu(e,t){return e&&e.length?Lo(e,$s(t,2)):[]}function Mu(t,n){return n="function"==typeof n?n:e,t&&t.length?Lo(t,e,n):[]}function Lu(e){if(!e||!e.length)return[];var t=0;return e=hn(e,(function(e){if(fl(e))return t=Yt(e.length,t),!0})),Mn(t,(function(t){return gn(e,Cn(t))}))}function ju(t,n){if(!t||!t.length)return[];var r=Lu(t);return null==n?r:gn(r,(function(t){return an(n,e,t)}))}var Uu=wo((function(e,t){return fl(e)?wi(e,t):[]})),Du=wo((function(e){return Fo(hn(e,fl))})),zu=wo((function(t){var n=ou(t);return fl(n)&&(n=e),Fo(hn(t,fl),$s(n,2))})),Fu=wo((function(t){var n=ou(t);return n="function"==typeof n?n:e,Fo(hn(t,fl),e,n)})),Bu=wo(Lu);function Hu(e,t){return Bo(e||[],t||[],ci)}function qu(e,t){return Bo(e||[],t||[],Oo)}var $u=wo((function(t){var n=t.length,r=n>1?t[n-1]:e;return r="function"==typeof r?(t.pop(),r):e,ju(t,r)}));function Vu(e){var t=Sr(e);return t.__chain__=!0,t}function Wu(e,t){return t(e),e}function Ku(e,t){return t(e)}var Gu=Ds((function(t){var n=t.length,r=n?t[0]:0,i=this.__wrapped__,o=function(e){return gi(e,t)};return!(n>1||this.__actions__.length)&&i instanceof Rr&&sa(r)?((i=i.slice(r,+r+(n?1:0))).__actions__.push({func:Ku,args:[o],thisArg:e}),new xr(i,this.__chain__).thru((function(t){return n&&!t.length&&t.push(e),t}))):this.thru(o)}));function Yu(){return Vu(this)}function Qu(){return new xr(this.value(),this.__chain__)}function Ju(){this.__values__===e&&(this.__values__=Wl(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}}function Xu(){return this}function Zu(t){for(var n,r=this;r instanceof Ir;){var i=Ma(r);i.__index__=0,i.__values__=e,n?o.__wrapped__=i:n=i;var o=i;r=r.__wrapped__}return o.__wrapped__=t,n}function ec(){var t=this.__wrapped__;if(t instanceof Rr){var n=t;return this.__actions__.length&&(n=new Rr(this)),(n=n.reverse()).__actions__.push({func:Ku,args:[pu],thisArg:e}),new xr(n,this.__chain__)}return this.thru(pu)}function tc(){return zo(this.__wrapped__,this.__actions__)}var nc=us((function(e,t,n){ft.call(e,n)?++e[n]:pi(e,n,1)}));function rc(t,n,r){var i=ul(t)?fn:Oi;return r&&aa(t,n,r)&&(n=e),i(t,$s(n,3))}function ic(e,t){return(ul(e)?hn:Ri)(e,$s(t,3))}var oc=vs(Wa),sc=vs(Ka);function ac(e,t){return ki(yc(e,t),1)}function uc(e,t){return ki(yc(e,t),N)}function cc(t,n,r){return r=r===e?1:Gl(r),ki(yc(t,n),r)}function lc(e,t){return(ul(e)?cn:Ei)(e,$s(t,3))}function fc(e,t){return(ul(e)?ln:Si)(e,$s(t,3))}var hc=us((function(e,t,n){ft.call(e,n)?e[n].push(t):pi(e,n,[t])}));function dc(e,t,n,r){e=ll(e)?e:Hf(e),n=n&&!r?Gl(n):0;var i=e.length;return n<0&&(n=Yt(i+n,0)),Dl(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&In(e,t,n)>-1}var pc=wo((function(e,t,n){var r=-1,i="function"==typeof t,o=ll(e)?ze(e.length):[];return Ei(e,(function(e){o[++r]=i?an(t,e,n):qi(e,t,n)})),o})),gc=us((function(e,t,n){pi(e,n,t)}));function yc(e,t){return(ul(e)?gn:oo)(e,$s(t,3))}function vc(t,n,r,i){return null==t?[]:(ul(n)||(n=null==n?[]:[n]),ul(r=i?e:r)||(r=null==r?[]:[r]),fo(t,n,r))}var mc=us((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));function _c(e,t,n){var r=ul(e)?vn:An,i=arguments.length<3;return r(e,$s(t,4),n,i,Ei)}function bc(e,t,n){var r=ul(e)?mn:An,i=arguments.length<3;return r(e,$s(t,4),n,i,Si)}function wc(e,t){return(ul(e)?hn:Ri)(e,Bc($s(t,3)))}function Ec(e){return(ul(e)?oi:Eo)(e)}function Sc(t,n,r){return n=(r?aa(t,n,r):n===e)?1:Gl(n),(ul(t)?si:So)(t,n)}function Oc(e){return(ul(e)?ai:Ro)(e)}function Ic(e){if(null==e)return 0;if(ll(e))return Dl(e)?rr(e):e.length;var t=Js(e);return t==Y||t==ne?e.size:no(e).length}function xc(t,n,r){var i=ul(t)?_n:Co;return r&&aa(t,n,r)&&(n=e),i(t,$s(n,3))}var Rc=wo((function(e,t){if(null==e)return[];var n=t.length;return n>1&&aa(e,t[0],t[1])?t=[]:n>2&&aa(t[0],t[1],t[2])&&(t=[t[0]]),fo(e,ki(t,1),[])})),kc=Tt||function(){return Gt.Date.now()};function Cc(e,t){if("function"!=typeof t)throw new ot(o);return e=Gl(e),function(){if(--e<1)return t.apply(this,arguments)}}function Pc(t,n,r){return n=r?e:n,n=t&&null==n?t.length:n,As(t,E,e,e,e,e,n)}function Ac(t,n){var r;if("function"!=typeof n)throw new ot(o);return t=Gl(t),function(){return--t>0&&(r=n.apply(this,arguments)),t<=1&&(n=e),r}}var Nc=wo((function(e,t,n){var r=g;if(n.length){var i=Xn(n,qs(Nc));r|=b}return As(e,r,t,n,i)})),Tc=wo((function(e,t,n){var r=g|y;if(n.length){var i=Xn(n,qs(Tc));r|=b}return As(t,r,e,n,i)}));function Mc(t,n,r){var i=As(t,m,e,e,e,e,e,n=r?e:n);return i.placeholder=Mc.placeholder,i}function Lc(t,n,r){var i=As(t,_,e,e,e,e,e,n=r?e:n);return i.placeholder=Lc.placeholder,i}function jc(t,n,r){var i,s,a,u,c,l,f=0,h=!1,d=!1,p=!0;if("function"!=typeof t)throw new ot(o);function g(n){var r=i,o=s;return i=s=e,f=n,u=t.apply(o,r)}function y(e){return f=e,c=Ia(_,n),h?g(e):u}function v(e){var t=n-(e-l);return d?Qt(t,a-(e-f)):t}function m(t){var r=t-l;return l===e||r>=n||r<0||d&&t-f>=a}function _(){var e=kc();if(m(e))return b(e);c=Ia(_,v(e))}function b(t){return c=e,p&&i?g(t):(i=s=e,u)}function w(){c!==e&&Ko(c),f=0,i=l=s=c=e}function E(){return c===e?u:b(kc())}function S(){var t=kc(),r=m(t);if(i=arguments,s=this,l=t,r){if(c===e)return y(l);if(d)return Ko(c),c=Ia(_,n),g(l)}return c===e&&(c=Ia(_,n)),u}return n=Ql(n)||0,Ol(r)&&(h=!!r.leading,a=(d="maxWait"in r)?Yt(Ql(r.maxWait)||0,n):a,p="trailing"in r?!!r.trailing:p),S.cancel=w,S.flush=E,S}var Uc=wo((function(e,t){return bi(e,1,t)})),Dc=wo((function(e,t,n){return bi(e,Ql(t)||0,n)}));function zc(e){return As(e,O)}function Fc(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ot(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Fc.Cache||qr),n}function Bc(e){if("function"!=typeof e)throw new ot(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Hc(e){return Ac(2,e)}Fc.Cache=qr;var qc=Vo((function(e,t){var n=(t=1==t.length&&ul(t[0])?gn(t[0],Un($s())):gn(ki(t,1),Un($s()))).length;return wo((function(r){for(var i=-1,o=Qt(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return an(e,this,r)}))})),$c=wo((function(t,n){var r=Xn(n,qs($c));return As(t,b,e,n,r)})),Vc=wo((function(t,n){var r=Xn(n,qs(Vc));return As(t,w,e,n,r)})),Wc=Ds((function(t,n){return As(t,S,e,e,e,n)}));function Kc(t,n){if("function"!=typeof t)throw new ot(o);return wo(t,n=n===e?n:Gl(n))}function Gc(e,t){if("function"!=typeof e)throw new ot(o);return t=null==t?0:Yt(Gl(t),0),wo((function(n){var r=n[t],i=Wo(n,0,t);return r&&yn(i,r),an(e,this,i)}))}function Yc(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new ot(o);return Ol(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),jc(e,t,{leading:r,maxWait:t,trailing:i})}function Qc(e){return Pc(e,1)}function Jc(e,t){return $c(qo(t),e)}function Xc(){if(!arguments.length)return[];var e=arguments[0];return ul(e)?e:[e]}function Zc(e){return vi(e,h)}function el(t,n){return vi(t,h,n="function"==typeof n?n:e)}function tl(e){return vi(e,l|h)}function nl(t,n){return vi(t,l|h,n="function"==typeof n?n:e)}function rl(e,t){return null==t||_i(e,t,Sf(t))}function il(e,t){return e===t||e!=e&&t!=t}var ol=xs(Ui),sl=xs((function(e,t){return e>=t})),al=$i(function(){return arguments}())?$i:function(e){return Il(e)&&ft.call(e,"callee")&&!Ot.call(e,"callee")},ul=ze.isArray,cl=en?Un(en):Vi;function ll(e){return null!=e&&Sl(e.length)&&!wl(e)}function fl(e){return Il(e)&&ll(e)}function hl(e){return!0===e||!1===e||Il(e)&&ji(e)==q}var dl=Ht||Yh,pl=tn?Un(tn):Wi;function gl(e){return Il(e)&&1===e.nodeType&&!Ml(e)}function yl(e){if(null==e)return!0;if(ll(e)&&(ul(e)||"string"==typeof e||"function"==typeof e.splice||dl(e)||Fl(e)||al(e)))return!e.length;var t=Js(e);if(t==Y||t==ne)return!e.size;if(da(e))return!no(e).length;for(var n in e)if(ft.call(e,n))return!1;return!0}function vl(e,t){return Ki(e,t)}function ml(t,n,r){var i=(r="function"==typeof r?r:e)?r(t,n):e;return i===e?Ki(t,n,e,r):!!i}function _l(e){if(!Il(e))return!1;var t=ji(e);return t==W||t==V||"string"==typeof e.message&&"string"==typeof e.name&&!Ml(e)}function bl(e){return"number"==typeof e&&qt(e)}function wl(e){if(!Ol(e))return!1;var t=ji(e);return t==K||t==G||t==H||t==ee}function El(e){return"number"==typeof e&&e==Gl(e)}function Sl(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=T}function Ol(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Il(e){return null!=e&&"object"==typeof e}var xl=nn?Un(nn):Yi;function Rl(e,t){return e===t||Qi(e,t,Ws(t))}function kl(t,n,r){return r="function"==typeof r?r:e,Qi(t,n,Ws(n),r)}function Cl(e){return Tl(e)&&e!=+e}function Pl(e){if(ha(e))throw new Ze(i);return Ji(e)}function Al(e){return null===e}function Nl(e){return null==e}function Tl(e){return"number"==typeof e||Il(e)&&ji(e)==Q}function Ml(e){if(!Il(e)||ji(e)!=X)return!1;var t=Et(e);if(null===t)return!0;var n=ft.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&lt.call(n)==gt}var Ll=rn?Un(rn):Xi;function jl(e){return El(e)&&e>=-T&&e<=T}var Ul=on?Un(on):Zi;function Dl(e){return"string"==typeof e||!ul(e)&&Il(e)&&ji(e)==re}function zl(e){return"symbol"==typeof e||Il(e)&&ji(e)==ie}var Fl=sn?Un(sn):eo;function Bl(t){return t===e}function Hl(e){return Il(e)&&Js(e)==se}function ql(e){return Il(e)&&ji(e)==ae}var $l=xs(io),Vl=xs((function(e,t){return e<=t}));function Wl(e){if(!e)return[];if(ll(e))return Dl(e)?ir(e):is(e);if(Rt&&e[Rt])return Yn(e[Rt]());var t=Js(e);return(t==Y?Qn:t==ne?Zn:Hf)(e)}function Kl(e){return e?(e=Ql(e))===N||e===-N?(e<0?-1:1)*M:e==e?e:0:0===e?e:0}function Gl(e){var t=Kl(e),n=t%1;return t==t?n?t-n:t:0}function Yl(e){return e?yi(Gl(e),0,j):0}function Ql(e){if("number"==typeof e)return e;if(zl(e))return L;if(Ol(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ol(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=jn(e);var n=Ve.test(e);return n||Ke.test(e)?Vt(e.slice(2),n?2:8):$e.test(e)?L:+e}function Jl(e){return os(e,Of(e))}function Xl(e){return e?yi(Gl(e),-T,T):0===e?e:0}function Zl(e){return null==e?"":Mo(e)}var ef=cs((function(e,t){if(da(t)||ll(t))os(t,Sf(t),e);else for(var n in t)ft.call(t,n)&&ci(e,n,t[n])})),tf=cs((function(e,t){os(t,Of(t),e)})),nf=cs((function(e,t,n,r){os(t,Of(t),e,r)})),rf=cs((function(e,t,n,r){os(t,Sf(t),e,r)})),of=Ds(gi);function sf(e,t){var n=Or(e);return null==t?n:hi(n,t)}var af=wo((function(t,n){t=nt(t);var r=-1,i=n.length,o=i>2?n[2]:e;for(o&&aa(n[0],n[1],o)&&(i=1);++r<i;)for(var s=n[r],a=Of(s),u=-1,c=a.length;++u<c;){var l=a[u],f=t[l];(f===e||il(f,ut[l])&&!ft.call(t,l))&&(t[l]=s[l])}return t})),uf=wo((function(t){return t.push(e,Ts),an(kf,e,t)}));function cf(e,t){return Sn(e,$s(t,3),Ai)}function lf(e,t){return Sn(e,$s(t,3),Ni)}function ff(e,t){return null==e?e:Ci(e,$s(t,3),Of)}function hf(e,t){return null==e?e:Pi(e,$s(t,3),Of)}function df(e,t){return e&&Ai(e,$s(t,3))}function pf(e,t){return e&&Ni(e,$s(t,3))}function gf(e){return null==e?[]:Ti(e,Sf(e))}function yf(e){return null==e?[]:Ti(e,Of(e))}function vf(t,n,r){var i=null==t?e:Mi(t,n);return i===e?r:i}function mf(e,t){return null!=e&&ea(e,t,Di)}function _f(e,t){return null!=e&&ea(e,t,zi)}var bf=bs((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=pt.call(t)),e[t]=n}),Rh(Ah)),wf=bs((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=pt.call(t)),ft.call(e,t)?e[t].push(n):e[t]=[n]}),$s),Ef=wo(qi);function Sf(e){return ll(e)?ii(e):no(e)}function Of(e){return ll(e)?ii(e,!0):ro(e)}function If(e,t){var n={};return t=$s(t,3),Ai(e,(function(e,r,i){pi(n,t(e,r,i),e)})),n}function xf(e,t){var n={};return t=$s(t,3),Ai(e,(function(e,r,i){pi(n,r,t(e,r,i))})),n}var Rf=cs((function(e,t,n){uo(e,t,n)})),kf=cs((function(e,t,n,r){uo(e,t,n,r)})),Cf=Ds((function(e,t){var n={};if(null==e)return n;var r=!1;t=gn(t,(function(t){return t=$o(t,e),r||(r=t.length>1),t})),os(e,Fs(e),n),r&&(n=vi(n,l|f|h,Ms));for(var i=t.length;i--;)jo(n,t[i]);return n}));function Pf(e,t){return Nf(e,Bc($s(t)))}var Af=Ds((function(e,t){return null==e?{}:ho(e,t)}));function Nf(e,t){if(null==e)return{};var n=gn(Fs(e),(function(e){return[e]}));return t=$s(t),po(e,n,(function(e,n){return t(e,n[0])}))}function Tf(t,n,r){var i=-1,o=(n=$o(n,t)).length;for(o||(o=1,t=e);++i<o;){var s=null==t?e:t[Aa(n[i])];s===e&&(i=o,s=r),t=wl(s)?s.call(t):s}return t}function Mf(e,t,n){return null==e?e:Oo(e,t,n)}function Lf(t,n,r,i){return i="function"==typeof i?i:e,null==t?t:Oo(t,n,r,i)}var jf=Ps(Sf),Uf=Ps(Of);function Df(e,t,n){var r=ul(e),i=r||dl(e)||Fl(e);if(t=$s(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Ol(e)&&wl(o)?Or(Et(e)):{}}return(i?cn:Ai)(e,(function(e,r,i){return t(n,e,r,i)})),n}function zf(e,t){return null==e||jo(e,t)}function Ff(e,t,n){return null==e?e:Uo(e,t,qo(n))}function Bf(t,n,r,i){return i="function"==typeof i?i:e,null==t?t:Uo(t,n,qo(r),i)}function Hf(e){return null==e?[]:Dn(e,Sf(e))}function qf(e){return null==e?[]:Dn(e,Of(e))}function $f(t,n,r){return r===e&&(r=n,n=e),r!==e&&(r=(r=Ql(r))==r?r:0),n!==e&&(n=(n=Ql(n))==n?n:0),yi(Ql(t),n,r)}function Vf(t,n,r){return n=Kl(n),r===e?(r=n,n=0):r=Kl(r),Fi(t=Ql(t),n,r)}function Wf(t,n,r){if(r&&"boolean"!=typeof r&&aa(t,n,r)&&(n=r=e),r===e&&("boolean"==typeof n?(r=n,n=e):"boolean"==typeof t&&(r=t,t=e)),t===e&&n===e?(t=0,n=1):(t=Kl(t),n===e?(n=t,t=0):n=Kl(n)),t>n){var i=t;t=n,n=i}if(r||t%1||n%1){var o=bn();return Qt(t+o*(n-t+$t("1e-"+((o+"").length-1))),n)}return mo(t,n)}var Kf=ps((function(e,t,n){return t=t.toLowerCase(),e+(n?Gf(t):t)}));function Gf(e){return wh(Zl(e).toLowerCase())}function Yf(e){return(e=Zl(e))&&e.replace(Ye,qn).replace(At,"")}function Qf(t,n,r){t=Zl(t),n=Mo(n);var i=t.length,o=r=r===e?i:yi(Gl(r),0,i);return(r-=n.length)>=0&&t.slice(r,o)==n}function Jf(e){return(e=Zl(e))&&Ie.test(e)?e.replace(Se,$n):e}function Xf(e){return(e=Zl(e))&&Te.test(e)?e.replace(Ne,"\\$&"):e}var Zf=ps((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),eh=ps((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),th=ds("toLowerCase");function nh(e,t,n){e=Zl(e);var r=(t=Gl(t))?rr(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Ss(Ft(i),n)+e+Ss(Lt(i),n)}function rh(e,t,n){e=Zl(e);var r=(t=Gl(t))?rr(e):0;return t&&r<t?e+Ss(t-r,n):e}function ih(e,t,n){e=Zl(e);var r=(t=Gl(t))?rr(e):0;return t&&r<t?Ss(t-r,n)+e:e}function oh(e,t,n){return n||null==t?t=0:t&&(t=+t),Zt(Zl(e).replace(Me,""),t||0)}function sh(t,n,r){return n=(r?aa(t,n,r):n===e)?1:Gl(n),bo(Zl(t),n)}function ah(){var e=arguments,t=Zl(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var uh=ps((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));function ch(t,n,r){return r&&"number"!=typeof r&&aa(t,n,r)&&(n=r=e),(r=r===e?j:r>>>0)?(t=Zl(t))&&("string"==typeof n||null!=n&&!Ll(n))&&!(n=Mo(n))&&Kn(t)?Wo(ir(t),0,r):t.split(n,r):[]}var lh=ps((function(e,t,n){return e+(n?" ":"")+wh(t)}));function fh(e,t,n){return e=Zl(e),n=null==n?0:yi(Gl(n),0,e.length),t=Mo(t),e.slice(n,n+t.length)==t}function hh(t,n,r){var i=Sr.templateSettings;r&&aa(t,n,r)&&(n=e),t=Zl(t),n=nf({},n,i,Ns);var o,a,u=nf({},n.imports,i.imports,Ns),c=Sf(u),l=Dn(u,c),f=0,h=n.interpolate||Qe,d="__p += '",p=rt((n.escape||Qe).source+"|"+h.source+"|"+(h===ke?He:Qe).source+"|"+(n.evaluate||Qe).source+"|$","g"),g="//# sourceURL="+(ft.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ut+"]")+"\n";t.replace(p,(function(e,n,r,i,s,u){return r||(r=i),d+=t.slice(f,u).replace(Je,Vn),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),s&&(a=!0,d+="';\n"+s+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),f=u+e.length,e})),d+="';\n";var y=ft.call(n,"variable")&&n.variable;if(y){if(Fe.test(y))throw new Ze(s)}else d="with (obj) {\n"+d+"\n}\n";d=(a?d.replace(_e,""):d).replace(be,"$1").replace(we,"$1;"),d="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var v=Sh((function(){return et(c,g+"return "+d).apply(e,l)}));if(v.source=d,_l(v))throw v;return v}function dh(e){return Zl(e).toLowerCase()}function ph(e){return Zl(e).toUpperCase()}function gh(t,n,r){if((t=Zl(t))&&(r||n===e))return jn(t);if(!t||!(n=Mo(n)))return t;var i=ir(t),o=ir(n);return Wo(i,Fn(i,o),Bn(i,o)+1).join("")}function yh(t,n,r){if((t=Zl(t))&&(r||n===e))return t.slice(0,or(t)+1);if(!t||!(n=Mo(n)))return t;var i=ir(t);return Wo(i,0,Bn(i,ir(n))+1).join("")}function vh(t,n,r){if((t=Zl(t))&&(r||n===e))return t.replace(Me,"");if(!t||!(n=Mo(n)))return t;var i=ir(t);return Wo(i,Fn(i,ir(n))).join("")}function mh(t,n){var r=I,i=x;if(Ol(n)){var o="separator"in n?n.separator:o;r="length"in n?Gl(n.length):r,i="omission"in n?Mo(n.omission):i}var s=(t=Zl(t)).length;if(Kn(t)){var a=ir(t);s=a.length}if(r>=s)return t;var u=r-rr(i);if(u<1)return i;var c=a?Wo(a,0,u).join(""):t.slice(0,u);if(o===e)return c+i;if(a&&(u+=c.length-u),Ll(o)){if(t.slice(u).search(o)){var l,f=c;for(o.global||(o=rt(o.source,Zl(qe.exec(o))+"g")),o.lastIndex=0;l=o.exec(f);)var h=l.index;c=c.slice(0,h===e?u:h)}}else if(t.indexOf(Mo(o),u)!=u){var d=c.lastIndexOf(o);d>-1&&(c=c.slice(0,d))}return c+i}function _h(e){return(e=Zl(e))&&Oe.test(e)?e.replace(Ee,sr):e}var bh=ps((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),wh=ds("toUpperCase");function Eh(t,n,r){return t=Zl(t),(n=r?e:n)===e?Gn(t)?cr(t):En(t):t.match(n)||[]}var Sh=wo((function(t,n){try{return an(t,e,n)}catch(e){return _l(e)?e:new Ze(e)}})),Oh=Ds((function(e,t){return cn(t,(function(t){t=Aa(t),pi(e,t,Nc(e[t],e))})),e}));function Ih(e){var t=null==e?0:e.length,n=$s();return e=t?gn(e,(function(e){if("function"!=typeof e[1])throw new ot(o);return[n(e[0]),e[1]]})):[],wo((function(n){for(var r=-1;++r<t;){var i=e[r];if(an(i[0],this,n))return an(i[1],this,n)}}))}function xh(e){return mi(vi(e,l))}function Rh(e){return function(){return e}}function kh(e,t){return null==e||e!=e?t:e}var Ch=ms(),Ph=ms(!0);function Ah(e){return e}function Nh(e){return to("function"==typeof e?e:vi(e,l))}function Th(e){return so(vi(e,l))}function Mh(e,t){return ao(e,vi(t,l))}var Lh=wo((function(e,t){return function(n){return qi(n,e,t)}})),jh=wo((function(e,t){return function(n){return qi(e,n,t)}}));function Uh(e,t,n){var r=Sf(t),i=Ti(t,r);null==n&&(!Ol(t)||!i.length&&r.length)&&(n=t,t=e,e=this,i=Ti(t,Sf(t)));var o=!(Ol(n)&&"chain"in n&&!n.chain),s=wl(e);return cn(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=is(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,yn([this.value()],arguments))})})),e}function Dh(){return Gt._===this&&(Gt._=yt),this}function zh(){}function Fh(e){return e=Gl(e),wo((function(t){return lo(t,e)}))}var Bh=Es(gn),Hh=Es(fn),qh=Es(_n);function $h(e){return ua(e)?Cn(Aa(e)):go(e)}function Vh(t){return function(n){return null==t?e:Mi(t,n)}}var Wh=Is(),Kh=Is(!0);function Gh(){return[]}function Yh(){return!1}function Qh(){return{}}function Jh(){return""}function Xh(){return!0}function Zh(e,t){if((e=Gl(e))<1||e>T)return[];var n=j,r=Qt(e,j);t=$s(t),e-=j;for(var i=Mn(r,t);++n<e;)t(n);return i}function ed(e){return ul(e)?gn(e,Aa):zl(e)?[e]:is(Pa(Zl(e)))}function td(e){var t=++ht;return Zl(e)+t}var nd=ws((function(e,t){return e+t}),0),rd=ks("ceil"),id=ws((function(e,t){return e/t}),1),od=ks("floor");function sd(t){return t&&t.length?Ii(t,Ah,Ui):e}function ad(t,n){return t&&t.length?Ii(t,$s(n,2),Ui):e}function ud(e){return kn(e,Ah)}function cd(e,t){return kn(e,$s(t,2))}function ld(t){return t&&t.length?Ii(t,Ah,io):e}function fd(t,n){return t&&t.length?Ii(t,$s(n,2),io):e}var hd=ws((function(e,t){return e*t}),1),dd=ks("round"),pd=ws((function(e,t){return e-t}),0);function gd(e){return e&&e.length?Tn(e,Ah):0}function yd(e,t){return e&&e.length?Tn(e,$s(t,2)):0}return Sr.after=Cc,Sr.ary=Pc,Sr.assign=ef,Sr.assignIn=tf,Sr.assignInWith=nf,Sr.assignWith=rf,Sr.at=of,Sr.before=Ac,Sr.bind=Nc,Sr.bindAll=Oh,Sr.bindKey=Tc,Sr.castArray=Xc,Sr.chain=Vu,Sr.chunk=La,Sr.compact=ja,Sr.concat=Ua,Sr.cond=Ih,Sr.conforms=xh,Sr.constant=Rh,Sr.countBy=nc,Sr.create=sf,Sr.curry=Mc,Sr.curryRight=Lc,Sr.debounce=jc,Sr.defaults=af,Sr.defaultsDeep=uf,Sr.defer=Uc,Sr.delay=Dc,Sr.difference=Da,Sr.differenceBy=za,Sr.differenceWith=Fa,Sr.drop=Ba,Sr.dropRight=Ha,Sr.dropRightWhile=qa,Sr.dropWhile=$a,Sr.fill=Va,Sr.filter=ic,Sr.flatMap=ac,Sr.flatMapDeep=uc,Sr.flatMapDepth=cc,Sr.flatten=Ga,Sr.flattenDeep=Ya,Sr.flattenDepth=Qa,Sr.flip=zc,Sr.flow=Ch,Sr.flowRight=Ph,Sr.fromPairs=Ja,Sr.functions=gf,Sr.functionsIn=yf,Sr.groupBy=hc,Sr.initial=eu,Sr.intersection=tu,Sr.intersectionBy=nu,Sr.intersectionWith=ru,Sr.invert=bf,Sr.invertBy=wf,Sr.invokeMap=pc,Sr.iteratee=Nh,Sr.keyBy=gc,Sr.keys=Sf,Sr.keysIn=Of,Sr.map=yc,Sr.mapKeys=If,Sr.mapValues=xf,Sr.matches=Th,Sr.matchesProperty=Mh,Sr.memoize=Fc,Sr.merge=Rf,Sr.mergeWith=kf,Sr.method=Lh,Sr.methodOf=jh,Sr.mixin=Uh,Sr.negate=Bc,Sr.nthArg=Fh,Sr.omit=Cf,Sr.omitBy=Pf,Sr.once=Hc,Sr.orderBy=vc,Sr.over=Bh,Sr.overArgs=qc,Sr.overEvery=Hh,Sr.overSome=qh,Sr.partial=$c,Sr.partialRight=Vc,Sr.partition=mc,Sr.pick=Af,Sr.pickBy=Nf,Sr.property=$h,Sr.propertyOf=Vh,Sr.pull=uu,Sr.pullAll=cu,Sr.pullAllBy=lu,Sr.pullAllWith=fu,Sr.pullAt=hu,Sr.range=Wh,Sr.rangeRight=Kh,Sr.rearg=Wc,Sr.reject=wc,Sr.remove=du,Sr.rest=Kc,Sr.reverse=pu,Sr.sampleSize=Sc,Sr.set=Mf,Sr.setWith=Lf,Sr.shuffle=Oc,Sr.slice=gu,Sr.sortBy=Rc,Sr.sortedUniq=Eu,Sr.sortedUniqBy=Su,Sr.split=ch,Sr.spread=Gc,Sr.tail=Ou,Sr.take=Iu,Sr.takeRight=xu,Sr.takeRightWhile=Ru,Sr.takeWhile=ku,Sr.tap=Wu,Sr.throttle=Yc,Sr.thru=Ku,Sr.toArray=Wl,Sr.toPairs=jf,Sr.toPairsIn=Uf,Sr.toPath=ed,Sr.toPlainObject=Jl,Sr.transform=Df,Sr.unary=Qc,Sr.union=Cu,Sr.unionBy=Pu,Sr.unionWith=Au,Sr.uniq=Nu,Sr.uniqBy=Tu,Sr.uniqWith=Mu,Sr.unset=zf,Sr.unzip=Lu,Sr.unzipWith=ju,Sr.update=Ff,Sr.updateWith=Bf,Sr.values=Hf,Sr.valuesIn=qf,Sr.without=Uu,Sr.words=Eh,Sr.wrap=Jc,Sr.xor=Du,Sr.xorBy=zu,Sr.xorWith=Fu,Sr.zip=Bu,Sr.zipObject=Hu,Sr.zipObjectDeep=qu,Sr.zipWith=$u,Sr.entries=jf,Sr.entriesIn=Uf,Sr.extend=tf,Sr.extendWith=nf,Uh(Sr,Sr),Sr.add=nd,Sr.attempt=Sh,Sr.camelCase=Kf,Sr.capitalize=Gf,Sr.ceil=rd,Sr.clamp=$f,Sr.clone=Zc,Sr.cloneDeep=tl,Sr.cloneDeepWith=nl,Sr.cloneWith=el,Sr.conformsTo=rl,Sr.deburr=Yf,Sr.defaultTo=kh,Sr.divide=id,Sr.endsWith=Qf,Sr.eq=il,Sr.escape=Jf,Sr.escapeRegExp=Xf,Sr.every=rc,Sr.find=oc,Sr.findIndex=Wa,Sr.findKey=cf,Sr.findLast=sc,Sr.findLastIndex=Ka,Sr.findLastKey=lf,Sr.floor=od,Sr.forEach=lc,Sr.forEachRight=fc,Sr.forIn=ff,Sr.forInRight=hf,Sr.forOwn=df,Sr.forOwnRight=pf,Sr.get=vf,Sr.gt=ol,Sr.gte=sl,Sr.has=mf,Sr.hasIn=_f,Sr.head=Xa,Sr.identity=Ah,Sr.includes=dc,Sr.indexOf=Za,Sr.inRange=Vf,Sr.invoke=Ef,Sr.isArguments=al,Sr.isArray=ul,Sr.isArrayBuffer=cl,Sr.isArrayLike=ll,Sr.isArrayLikeObject=fl,Sr.isBoolean=hl,Sr.isBuffer=dl,Sr.isDate=pl,Sr.isElement=gl,Sr.isEmpty=yl,Sr.isEqual=vl,Sr.isEqualWith=ml,Sr.isError=_l,Sr.isFinite=bl,Sr.isFunction=wl,Sr.isInteger=El,Sr.isLength=Sl,Sr.isMap=xl,Sr.isMatch=Rl,Sr.isMatchWith=kl,Sr.isNaN=Cl,Sr.isNative=Pl,Sr.isNil=Nl,Sr.isNull=Al,Sr.isNumber=Tl,Sr.isObject=Ol,Sr.isObjectLike=Il,Sr.isPlainObject=Ml,Sr.isRegExp=Ll,Sr.isSafeInteger=jl,Sr.isSet=Ul,Sr.isString=Dl,Sr.isSymbol=zl,Sr.isTypedArray=Fl,Sr.isUndefined=Bl,Sr.isWeakMap=Hl,Sr.isWeakSet=ql,Sr.join=iu,Sr.kebabCase=Zf,Sr.last=ou,Sr.lastIndexOf=su,Sr.lowerCase=eh,Sr.lowerFirst=th,Sr.lt=$l,Sr.lte=Vl,Sr.max=sd,Sr.maxBy=ad,Sr.mean=ud,Sr.meanBy=cd,Sr.min=ld,Sr.minBy=fd,Sr.stubArray=Gh,Sr.stubFalse=Yh,Sr.stubObject=Qh,Sr.stubString=Jh,Sr.stubTrue=Xh,Sr.multiply=hd,Sr.nth=au,Sr.noConflict=Dh,Sr.noop=zh,Sr.now=kc,Sr.pad=nh,Sr.padEnd=rh,Sr.padStart=ih,Sr.parseInt=oh,Sr.random=Wf,Sr.reduce=_c,Sr.reduceRight=bc,Sr.repeat=sh,Sr.replace=ah,Sr.result=Tf,Sr.round=dd,Sr.runInContext=t,Sr.sample=Ec,Sr.size=Ic,Sr.snakeCase=uh,Sr.some=xc,Sr.sortedIndex=yu,Sr.sortedIndexBy=vu,Sr.sortedIndexOf=mu,Sr.sortedLastIndex=_u,Sr.sortedLastIndexBy=bu,Sr.sortedLastIndexOf=wu,Sr.startCase=lh,Sr.startsWith=fh,Sr.subtract=pd,Sr.sum=gd,Sr.sumBy=yd,Sr.template=hh,Sr.times=Zh,Sr.toFinite=Kl,Sr.toInteger=Gl,Sr.toLength=Yl,Sr.toLower=dh,Sr.toNumber=Ql,Sr.toSafeInteger=Xl,Sr.toString=Zl,Sr.toUpper=ph,Sr.trim=gh,Sr.trimEnd=yh,Sr.trimStart=vh,Sr.truncate=mh,Sr.unescape=_h,Sr.uniqueId=td,Sr.upperCase=bh,Sr.upperFirst=wh,Sr.each=lc,Sr.eachRight=fc,Sr.first=Xa,Uh(Sr,function(){var e={};return Ai(Sr,(function(t,n){ft.call(Sr.prototype,n)||(e[n]=t)})),e}(),{chain:!1}),Sr.VERSION=n,cn(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Sr[e].placeholder=Sr})),cn(["drop","take"],(function(t,n){Rr.prototype[t]=function(r){r=r===e?1:Yt(Gl(r),0);var i=this.__filtered__&&!n?new Rr(this):this.clone();return i.__filtered__?i.__takeCount__=Qt(r,i.__takeCount__):i.__views__.push({size:Qt(r,j),type:t+(i.__dir__<0?"Right":"")}),i},Rr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),cn(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=n==C||n==A;Rr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$s(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),cn(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Rr.prototype[e]=function(){return this[n](1).value()[0]}})),cn(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Rr.prototype[e]=function(){return this.__filtered__?new Rr(this):this[n](1)}})),Rr.prototype.compact=function(){return this.filter(Ah)},Rr.prototype.find=function(e){return this.filter(e).head()},Rr.prototype.findLast=function(e){return this.reverse().find(e)},Rr.prototype.invokeMap=wo((function(e,t){return"function"==typeof e?new Rr(this):this.map((function(n){return qi(n,e,t)}))})),Rr.prototype.reject=function(e){return this.filter(Bc($s(e)))},Rr.prototype.slice=function(t,n){t=Gl(t);var r=this;return r.__filtered__&&(t>0||n<0)?new Rr(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==e&&(r=(n=Gl(n))<0?r.dropRight(-n):r.take(n-t)),r)},Rr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Rr.prototype.toArray=function(){return this.take(j)},Ai(Rr.prototype,(function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),i=/^(?:head|last)$/.test(n),o=Sr[i?"take"+("last"==n?"Right":""):n],s=i||/^find/.test(n);o&&(Sr.prototype[n]=function(){var n=this.__wrapped__,a=i?[1]:arguments,u=n instanceof Rr,c=a[0],l=u||ul(n),f=function(e){var t=o.apply(Sr,yn([e],a));return i&&h?t[0]:t};l&&r&&"function"==typeof c&&1!=c.length&&(u=l=!1);var h=this.__chain__,d=!!this.__actions__.length,p=s&&!h,g=u&&!d;if(!s&&l){n=g?n:new Rr(this);var y=t.apply(n,a);return y.__actions__.push({func:Ku,args:[f],thisArg:e}),new xr(y,h)}return p&&g?t.apply(this,a):(y=this.thru(f),p?i?y.value()[0]:y.value():y)})})),cn(["pop","push","shift","sort","splice","unshift"],(function(e){var t=st[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Sr.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(ul(i)?i:[],e)}return this[n]((function(n){return t.apply(ul(n)?n:[],e)}))}})),Ai(Rr.prototype,(function(e,t){var n=Sr[t];if(n){var r=n.name+"";ft.call(pr,r)||(pr[r]=[]),pr[r].push({name:t,func:n})}})),pr[_s(e,y).name]=[{name:"wrapper",func:e}],Rr.prototype.clone=kr,Rr.prototype.reverse=Cr,Rr.prototype.value=Pr,Sr.prototype.at=Gu,Sr.prototype.chain=Yu,Sr.prototype.commit=Qu,Sr.prototype.next=Ju,Sr.prototype.plant=Zu,Sr.prototype.reverse=ec,Sr.prototype.toJSON=Sr.prototype.valueOf=Sr.prototype.value=tc,Sr.prototype.first=Sr.prototype.head,Rt&&(Sr.prototype[Rt]=Xu),Sr},fr=lr();Qt?((Qt.exports=fr)._=fr,Yt._=fr):Gt._=fr}.call(t);var jg=Object.defineProperty,Ug=Object.defineProperties,Dg=Object.getOwnPropertyDescriptors,zg=Object.getOwnPropertySymbols,Fg=Object.prototype.hasOwnProperty,Bg=Object.prototype.propertyIsEnumerable,Hg=(e,t,n)=>t in e?jg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qg=(e,t)=>{for(var n in t||(t={}))Fg.call(t,n)&&Hg(e,n,t[n]);if(zg)for(var n of zg(t))Bg.call(t,n)&&Hg(e,n,t[n]);return e},$g=(e,t)=>Ug(e,Dg(t));function Vg(e,t,n){var r;const i=Ua(e);return(null==(r=t.rpcMap)?void 0:r[i.reference])||`${Ag}?chainId=${i.namespace}:${i.reference}&projectId=${n}`}function Wg(e){return e.includes(":")?e.split(":")[1]:e}function Kg(e){return e.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))}function Gg(e,t){const n=Object.keys(t.namespaces).filter((t=>t.includes(e)));if(!n.length)return[];const r=[];return n.forEach((e=>{const n=t.namespaces[e].accounts;r.push(...n)})),r}function Yg(e={},t={}){const n=Qg(e),r=Qg(t);return Lg.exports.merge(n,r)}function Qg(e){var t,n,r,i;const o={};if(!yc(e))return o;for(const[s,a]of Object.entries(e)){const e=cc(s)?[s]:a.chains,u=a.methods||[],c=a.events||[],l=a.rpcMap||{},f=lc(s);o[f]=$g(qg(qg({},o[f]),a),{chains:Bu(e,null==(t=o[f])?void 0:t.chains),methods:Bu(u,null==(n=o[f])?void 0:n.methods),events:Bu(c,null==(r=o[f])?void 0:r.events),rpcMap:qg(qg({},l),null==(i=o[f])?void 0:i.rpcMap)})}return o}function Jg(e){return e.includes(":")?e.split(":")[2]:e}function Xg(e){const t={};for(const[n,r]of Object.entries(e)){const e=r.methods||[],i=r.events||[],o=r.accounts||[],s=cc(n)?[n]:r.chains?r.chains:Kg(r.accounts);t[n]={chains:s,methods:e,events:i,accounts:o}}return t}function Zg(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):e.includes(":")?Number(e.split(":")[1]):Number(e)}const ey={},ty=e=>ey[e],ny=(e,t)=>{ey[e]=t};var ry={exports:{}};!function(e,n){var r,i=typeof self<"u"?self:t,o=function(){function e(){this.fetch=!1,this.DOMException=i.DOMException}return e.prototype=i,new e}();r=o,function(e){var t={searchParams:"URLSearchParams"in r,iterable:"Symbol"in r&&"iterator"in Symbol,blob:"FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in r,arrayBuffer:"ArrayBuffer"in r};function n(e){return e&&DataView.prototype.isPrototypeOf(e)}if(t.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function u(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(n[Symbol.iterator]=function(){return n}),n}function c(e){this.map={},e instanceof c?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function l(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function h(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function d(e){var t=new FileReader,n=f(t);return t.readAsText(e),n}function p(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(e){this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:t.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:t.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():t.arrayBuffer&&t.blob&&n(e)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):t.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||o(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=l(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var e=l(this);if(e)return e;if(this._bodyBlob)return d(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(p(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},t.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(e,t){e=s(e),t=a(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},c.prototype.delete=function(e){delete this.map[s(e)]},c.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},c.prototype.set=function(e,t){this.map[s(e)]=a(t)},c.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},c.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),u(e)},c.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),u(e)},c.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),u(e)},t.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(e){var t=e.toUpperCase();return v.indexOf(t)>-1?t:e}function _(e,t){var n=(t=t||{}).body;if(e instanceof _){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!n&&null!=e._bodyInit&&(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new c(t.headers)),this.method=m(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function w(e){var t=new c;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function E(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},y.call(_.prototype),y.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},E.error=function(){var e=new E(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];E.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new E(null,{status:t,headers:{location:e}})},e.DOMException=r.DOMException;try{new e.DOMException}catch{e.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function O(n,r){return new Promise((function(i,o){var s=new _(n,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:w(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;i(new E(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&t.blob&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(typeof s._bodyInit>"u"?null:s._bodyInit)}))}O.polyfill=!0,r.fetch||(r.fetch=O,r.Headers=c,r.Request=_,r.Response=E),e.Headers=c,e.Request=_,e.Response=E,e.fetch=O,Object.defineProperty(e,"__esModule",{value:!0})}({}),o.fetch.ponyfill=!0,delete o.fetch.polyfill;var s=o;(n=s.fetch).default=s.fetch,n.fetch=s.fetch,n.Headers=s.Headers,n.Request=s.Request,n.Response=s.Response,e.exports=n}(ry,ry.exports);var iy=n(ry.exports);const oy={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},sy=10;class ay{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new o.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!lf(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e,t){this.isAvailable||await this.register();try{const t=ue(e),n=await(await iy(this.url,Object.assign(Object.assign({},oy),{body:t}))).json();this.onPayload({data:n})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!lf(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return t(new Error("HTTP connection is missing or invalid"));e()}))}))}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=ue({id:1,jsonrpc:"2.0",method:"test",params:[]});await iy(e,Object.assign(Object.assign({},oy),{body:t}))}this.onOpen()}catch(e){const t=this.parseError(e);throw this.events.emit("register_error",t),this.onClose(),t}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?ae(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=ef(e,n.message||n.toString());this.events.emit("payload",r)}parseError(e,t=this.url){return vl(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>sy&&this.events.setMaxListeners(sy)}}class uy{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=ty("events"),this.client=ty("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ng.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=Wg(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Vg(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new mf(new ay(n,ty("disableProviderPing")))}}class cy{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=ty("events"),this.client=ty("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(Ng.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const n=t||Vg(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new mf(new ay(n,ty("disableProviderPing")))}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=parseInt(Wg(t));e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,n;let r=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0";r=r.startsWith("0x")?r:`0x${r}`;const i=parseInt(r,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else{if(!this.namespace.methods.includes("wallet_switchEthereumChain"))throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:r}]},chainId:null==(n=this.namespace.chains)?void 0:n[0]}),this.setDefaultChain(`${i}`)}return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}}class ly{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=ty("events"),this.client=ty("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ng.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=Wg(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Vg(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new mf(new ay(n,ty("disableProviderPing")))}}class fy{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=ty("events"),this.client=ty("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ng.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=Wg(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Vg(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new mf(new ay(n,ty("disableProviderPing")))}}class hy{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=ty("events"),this.client=ty("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ng.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{const n=this.getCardanoRPCUrl(t),r=Wg(t);e[r]=this.createHttpProvider(r,n)})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new mf(new ay(n,ty("disableProviderPing")))}}class dy{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=ty("events"),this.client=ty("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ng.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=Wg(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Vg(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new mf(new ay(n,ty("disableProviderPing")))}}class py{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=ty("events"),this.client=ty("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ng.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=Wg(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Vg(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new mf(new ay(n,ty("disableProviderPing")))}}class gy{constructor(e){this.name="near",this.namespace=e.namespace,this.events=ty("events"),this.client=ty("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const n=t||Vg(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Ng.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;e[t]=this.createHttpProvider(t,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Vg(e,this.namespace);return typeof n>"u"?void 0:new mf(new ay(n,ty("disableProviderPing")))}}var yy=Object.defineProperty,vy=Object.defineProperties,my=Object.getOwnPropertyDescriptors,_y=Object.getOwnPropertySymbols,by=Object.prototype.hasOwnProperty,wy=Object.prototype.propertyIsEnumerable,Ey=(e,t,n)=>t in e?yy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sy=(e,t)=>{for(var n in t||(t={}))by.call(t,n)&&Ey(e,n,t[n]);if(_y)for(var n of _y(t))wy.call(t,n)&&Ey(e,n,t[n]);return e},Oy=(e,t)=>vy(e,my(t));class Iy{constructor(e){this.events=new o.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:hn.pino(hn.getDefaultLoggerOptions({level:e?.logger||kg})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new Iy(e);return await t.initialize(),t}async request(e,t){const[n,r]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:Sy({},e),chainId:`${n}:${r}`,topic:this.session.topic})}sendAsync(e,t,n){this.request(e,n).then((e=>t(null,e))).catch((e=>t(e,void 0)))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:pc("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:r}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await r().then((e=>{this.session=e,this.namespaces||(this.namespaces=Xg(e.namespaces),this.persist("namespaces",this.namespaces))})).catch((e=>{if(e.message!==og)throw e;t++}))}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[n,r]=this.validateChain(e);this.getProvider(n).setDefaultChain(r,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(gc(t)){for(const n of t)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Rg.init({logger:this.providerOpts.logger||kg,relayUrl:this.providerOpts.relayUrl||Cg,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map((e=>lc(e))))];ny("client",this.client),ny("events",this.events),ny("disableProviderPing",this.disableProviderPing),e.forEach((e=>{if(!this.session)return;const t=Gg(e,this.session),n=Kg(t),r=Yg(this.namespaces,this.optionalNamespaces),i=Oy(Sy({},r[e]),{accounts:t,chains:n});switch(e){case"eip155":this.rpcProviders[e]=new cy({namespace:i});break;case"solana":this.rpcProviders[e]=new ly({namespace:i});break;case"cosmos":this.rpcProviders[e]=new fy({namespace:i});break;case"polkadot":this.rpcProviders[e]=new uy({namespace:i});break;case"cip34":this.rpcProviders[e]=new hy({namespace:i});break;case"elrond":this.rpcProviders[e]=new dy({namespace:i});break;case"multiversx":this.rpcProviders[e]=new py({namespace:i});break;case"near":this.rpcProviders[e]=new gy({namespace:i})}}))}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",(e=>{this.events.emit("session_ping",e)})),this.client.on("session_event",(e=>{const{params:t}=e,{event:n}=t;if("accountsChanged"===n.name){const e=n.data;e&&gc(e)&&this.events.emit("accountsChanged",e.map(Jg))}else if("chainChanged"===n.name){const e=t.chainId,n=t.event.data,r=lc(e),i=Zg(e)!==Zg(n)?`${r}:${Zg(n)}`:e;this.onChainChanged(i)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)})),this.client.on("session_update",(({topic:e,params:t})=>{var n;const{namespaces:r}=t,i=null==(n=this.client)?void 0:n.session.get(e);this.session=Oy(Sy({},i),{namespaces:r}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})})),this.client.on("session_delete",(async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Oy(Sy({},pc("USER_DISCONNECTED")),{data:e.topic}))})),this.on(Ng.DEFAULT_CHAIN_CHANGED,(e=>{this.onChainChanged(e,!0)}))}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach((e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])}))}setNamespaces(e){const{namespaces:t,optionalNamespaces:n,sessionProperties:r}=e;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=r,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(e){const[t,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map((e=>lc(e))).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const r=lc(Object.keys(this.namespaces)[0]);return[r,this.rpcProviders[r].getDefaultChain()]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){var n;if(!this.namespaces)return;const[r,i]=this.validateChain(e);t||this.getProvider(r).setDefaultChain(i),(null!=(n=this.namespaces[r])?n:this.namespaces[`${r}:${i}`]).defaultChain=i,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${Pg}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${Pg}/${e}`)}}const xy=Iy;e.UniversalProvider=xy,e.default=Iy,Object.defineProperty(e,"__esModule",{value:!0})}(t)}(0,zc.exports);const Fc=["eth_sendTransaction","personal_sign"],Bc=["chainChanged","accountsChanged"];function Hc(e){return Number(e[0].split(":")[1])}function qc(e){return`0x${e.toString(16)}`}class $c{constructor(){this.events=new oa.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY="wc@2:ethereum_provider:",this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static init(e){return c(this,void 0,void 0,(function*(){const t=new $c;return yield t.initialize(e),t}))}request(e){return c(this,void 0,void 0,(function*(){return yield this.signer.request(e,this.formatChainId(this.chainId))}))}sendAsync(e,t){this.signer.sendAsync(e,t,this.formatChainId(this.chainId))}get connected(){return!!this.signer.client&&this.signer.client.core.relayer.connected}get connecting(){return!!this.signer.client&&this.signer.client.core.relayer.connecting}enable(){return c(this,void 0,void 0,(function*(){this.session||(yield this.connect());return yield this.request({method:"eth_requestAccounts"})}))}connect(e){return c(this,void 0,void 0,(function*(){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:n}=function(e){const{chains:t,optionalChains:n,methods:r,optionalMethods:i,events:o,optionalEvents:s,rpcMap:a}=e;if(!jc(t))throw new Error("Invalid chains");const u=t,c=r||Fc,l=o||Bc,f={chains:u,methods:c,events:l,rpcMap:{[Hc(u)]:a[Hc(u)]}},h=null==o?void 0:o.filter((e=>!Bc.includes(e))),d=null==r?void 0:r.filter((e=>!Fc.includes(e)));if(!(n||s||i||(null==h?void 0:h.length)||(null==d?void 0:d.length)))return{required:f};const p=(null==h?void 0:h.length)&&(null==d?void 0:d.length)||!n;return{required:f,optional:{chains:[...new Set(p?u.concat(n||[]):n)],methods:[...new Set(c.concat(i||[]))],events:[...new Set(l.concat(s||[]))],rpcMap:a}}}(this.rpc);try{const r=yield new Promise(((r,i)=>c(this,void 0,void 0,(function*(){yield this.signer.connect(Object.assign(Object.assign({namespaces:{[this.namespace]:t}},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:null==e?void 0:e.pairingTopic,skipPairing:!1})).then((e=>{r(e)})).catch((e=>{i(new Error(e.message))}))}))));if(!r)return;this.setChainIds(this.rpc.chains);const i=function(e,t=[]){const n=[];return Object.keys(e).forEach((r=>{if(t.length&&!t.includes(r))return;const i=e[r];n.push(...i.accounts)})),n}(r.namespaces,[this.namespace]);this.setAccounts(i),this.events.emit("connect",{chainId:qc(this.chainId)})}catch(e){throw this.signer.logger.error(e),e}}))}disconnect(){return c(this,void 0,void 0,(function*(){this.session&&(yield this.signer.disconnect()),this.reset()}))}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",(e=>{const{params:t}=e,{event:n}=t;"accountsChanged"===n.name?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):"chainChanged"===n.name?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)})),this.signer.on("chainChanged",(e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",qc(this.chainId)),this.persist()})),this.signer.on("session_update",(e=>{this.events.emit("session_update",e)})),this.signer.on("session_delete",(e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",Object.assign(Object.assign({},function(e,t){const{message:n,code:r}=Lc[e];return{message:t?`${n} ${t}`:n,code:r}}("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))})),this.signer.on("display_uri",(e=>{this.events.emit("display_uri",e)}))}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return"string"==typeof e&&e.startsWith(`${this.namespace}:`)}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter((e=>this.isCompatibleChainId(e))),n=t.map((e=>this.parseChainId(e)));n.length&&(this.chainId=n[0],this.events.emit("chainChanged",qc(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,n,r]=e.split(":");return{chainId:`${t}:${n}`,address:r}}setAccounts(e){this.accounts=e.filter((e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId)).map((e=>this.parseAccountId(e).address)),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t;return{chains:(null===(t=e.chains)||void 0===t?void 0:t.map((e=>this.formatChainId(e))))||[`${this.namespace}:1`],optionalChains:e.optionalChains?e.optionalChains.map((e=>this.formatChainId(e))):void 0,methods:(null==e?void 0:e.methods)||Fc,events:(null==e?void 0:e.events)||Bc,optionalMethods:(null==e?void 0:e.optionalMethods)||[],optionalEvents:(null==e?void 0:e.optionalEvents)||[],rpcMap:(null==e?void 0:e.rpcMap)||this.buildRpcMap(e.chains.concat(e.optionalChains||[]),e.projectId),projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const n={};return e.forEach((e=>{n[e]=this.getRpcUrl(e,t)})),n}initialize(e){return c(this,void 0,void 0,(function*(){this.rpc=this.getRpcConfig(e),this.chainId=Hc(this.rpc.chains),this.signer=yield zc.exports.UniversalProvider.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),yield this.loadPersistedSession()}))}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:n,rpcMap:r}=e;t&&jc(t)&&(this.rpc.chains=t.map((e=>this.formatChainId(e))),t.forEach((e=>{this.rpc.rpcMap[e]=(null==r?void 0:r[e])||this.getRpcUrl(e)}))),n&&jc(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=null==n?void 0:n.map((e=>this.formatChainId(e))),n.forEach((e=>{this.rpc.rpcMap[e]=(null==r?void 0:r[e])||this.getRpcUrl(e)})))}getRpcUrl(e,t){var n;return(null===(n=this.rpc.rpcMap)||void 0===n?void 0:n[e])||`https://rpc.walletconnect.com/v1/?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}loadPersistedSession(){return c(this,void 0,void 0,(function*(){if(!this.session)return;const e=yield this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:null==t?void 0:t.accounts),this.setAccounts(null==t?void 0:t.accounts)}))}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return"string"==typeof e||e instanceof String?[this.parseAccount(e)]:e.map((e=>this.parseAccount(e)))}}const Vc=r("WalletConnectEvm"),Wc=i("WalletConnectEvm");function Kc(){return c(this,void 0,void 0,(function*(){Vc("getWalletConnectProvider");try{const e=yield function(){return c(this,void 0,void 0,(function*(){Vc("initWalletConnectProvider");const e=rl();Vc("walletConnectProviderOptions is",e);const t={projectId:e.projectId,chains:e.chains,optionalChains:e.optionalChains,methods:e.methods,optionalMethods:e.optionalMethods||[],events:e.events,optionalEvents:e.optionalEvents||[],rpcMap:e.rpcMap,relayUrl:e.relayUrl,showQrModal:!1};Vc("ethereum init options are",t),Vc("creating a new provider instance");try{return $c.init(t)}catch(e){throw Wc("Error while initializing ethereum provider"),e}}))}();return function(e){if(Vc("assignWalletConnectProviderEvents"),!e)return;function t(e){e&&(e.removeListener("connect",n),e.removeListener("session_delete",r))}function n(e){Vc("connectHandler",e),as(!1)}function r(n){Vc("disconnectHandler",n),e.disconnect(),t(e)}t(e),e.on("connect",n),e.on("session_delete",r),Vc("provider is",e)}(e),e.request=function(e){Vc("patchWalletConnectProviderRequest");const t=e.request.bind(e),n=rl();return Vc("walletConnectProviderOptions is",n),function({method:r,params:i}){return c(this,void 0,void 0,(function*(){return"eth_requestAccounts"===r?(Vc("calling patched",r,i),Vc("handling display_uri once"),e.once("display_uri",Gc),new Promise(((o,s)=>c(this,void 0,void 0,(function*(){var u,c;try{(null===(u=null==e?void 0:e.session)||void 0===u?void 0:u.connected)?(Vc("reusing existing session"),o(yield t({method:r,params:i}))):(c={uri:"",onClose:()=>{Wc("user rejected"),s(new a)}},Zs("UseLedgerLiveModal",{isDesktop:"desktop"===Js().type,uri:c.uri,onClose:c.onClose}),Vc("creating a new session"),yield e.connect({chains:n.chains,optionalChains:n.optionalChains}),o(yield t({method:r,params:i})))}catch(e){return Wc("error",e),s(e)}}))))):(Vc("calling provider",r,i),yield t({method:r,params:i}))}))}}(e),e}catch(e){const t=e instanceof Error?e:new Error(String(e));throw Wc("error",t),t}}))}function Gc(e){Vc("displayUriHandler",e),qs(e)}const Yc=r("getProvider"),Qc=[1];var Jc,Xc;let Zc;!function(e){e.Ethereum="Ethereum",e.Solana="Solana"}(Jc||(Jc={})),function(e){e.LedgerConnect="LedgerConnect",e.WalletConnect="WalletConnect"}(Xc||(Xc={}));const el=e=>(Yc("getHexChainId",e),"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]*$/)?e:`0x${e.toString(16)}`),tl=r("supportOptions");let nl;const rl=()=>(tl("getSupportOptions"),nl),il=r("ExtensionEvm"),ol="ethereum",sl="isLedgerConnect";var al;function ul(e){return("iOS"===e.os.name||"macOS"===e.os.name)&&"Safari"===e.browser.name}function cl(e){return!!al[e]}function ll(e){return e.every(cl)}function fl(){if(il("getEthereumProvider"),"undefined"==typeof window)throw new u;let e=window[ol];if(il("provider is",e),void 0===e||void 0===e[sl])throw new o;const t=rl(),n=el(t.chainId||0);return el(e.chainId)!=n&&(il("chainIds are different, changing to",n),e.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})),e}!function(e){e[e.EthereumMainnet=1]="EthereumMainnet",e[e.Polygon=137]="Polygon"}(al||(al={}));const hl=r("support");let dl;var pl=Object.freeze({__proto__:null,link:function(e,t,n,r){var i=this;return e?((e instanceof Element?[e]:"toArray"in e?e.toArray():e).forEach((function(e){e.addEventListener("click",(function(o){var s,a,u=t instanceof Function?t(e):t,c=n instanceof Function?n(e):n,l=e.getAttribute("href")||e.getAttributeNS("http://www.w3.org/1999/xlink","href")||e.getAttribute("xlink:href")||(null===(s=e.getElementsByTagName("a")[0])||void 0===s?void 0:s.getAttribute("href")),f=Dt(i.track(u,c,null!=r?r:{}),null!==(a=i.settings.timeout)&&void 0!==a?a:500);(function(e,t){return!("_blank"!==e.target||!t)})(e,l)||function(e){var t=e;return!!(t.ctrlKey||t.shiftKey||t.metaKey||t.button&&1==t.button)}(o)||l&&(o.preventDefault?o.preventDefault():o.returnValue=!1,f.catch(console.error).then((function(){window.location.href=l})).catch(console.error))}),!1)})),this):this},form:function(e,t,n,r){var i=this;return e?(e instanceof HTMLFormElement&&(e=[e]),e.forEach((function(e){if(!(e instanceof Element))throw new TypeError("Must pass HTMLElement to trackForm/trackSubmit.");var o=function(o){var s;o.preventDefault?o.preventDefault():o.returnValue=!1;var a=t instanceof Function?t(e):t,u=n instanceof Function?n(e):n;Dt(i.track(a,u,null!=r?r:{}),null!==(s=i.settings.timeout)&&void 0!==s?s:500).catch(console.error).then((function(){e.submit()})).catch(console.error)},s=window.jQuery||window.Zepto;s?s(e).submit(o):e.addEventListener("submit",o,!1)})),this):this}});function gl(e,t){return Object.keys(t).reduce((function(n,r){r.startsWith(e)&&(n[r.substr(e.length)]=t[r]);return n}),{})}for(var yl=Object.freeze({__proto__:null,queryString:function(e,t){var n=document.createElement("a");n.href=t;var r=n.search.slice(1).split("&").reduce((function(e,t){var n=t.split("="),r=n[0],i=n[1];return e[r]=Ir(i),e}),{}),i=[],o=r.ajs_uid,s=r.ajs_event,a=r.ajs_aid,u=Mt(e.options.useQueryString)?e.options.useQueryString:{},c=u.aid,l=void 0===c?/.+/:c,f=u.uid,h=void 0===f?/.+/:f;if(a){var d=Array.isArray(r.ajs_aid)?r.ajs_aid[0]:r.ajs_aid;l.test(d)&&e.setAnonymousId(d)}if(o){var p=Array.isArray(r.ajs_uid)?r.ajs_uid[0]:r.ajs_uid;if(h.test(p)){var g=gl("ajs_trait_",r);i.push(e.identify(p,g))}}if(s){var y=Array.isArray(r.ajs_event)?r.ajs_event[0]:r.ajs_event,v=gl("ajs_prop_",r);i.push(e.track(y,v))}return Promise.all(i)}}),vl={},ml={},_l=[],bl=0;bl<64;)_l[bl]=0|4294967296*Math.sin(++bl%Math.PI);var wl=Object.freeze({__proto__:null,default:function(e){var t,n,r,i=[t=1732584193,n=4023233417,~t,~n],o=[],s=unescape(encodeURI(e))+"€",a=s.length;for(e=--a/4+2|15,o[--e]=8*a;~a;)o[a>>2]|=s.charCodeAt(a)<<8*a--;for(bl=s=0;bl<e;bl+=16){for(a=i;s<64;a=[r=a[3],t+((r=a[0]+[t&n|~t&r,r&t|~r&n,t^n^r,n^(t|~r)][a=s>>4]+_l[s]+~~o[bl|15&[s,5*s+1,3*s+5,7*s][a]])<<(a=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*a+s++%4])|r>>>-a),t,n])t=0|a[1],n=a[2];for(s=4;s;)i[--s]+=a[s]}for(e="";s<32;)e+=(i[s>>3]>>4*(1^s++)&15).toString(16);return e}}),El=h(wl),Sl={exports:{}};!function(e,t){e.exports=function(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:i;return e===i?n:e}}(Sl);
314
+ */!function(e,n){(function(){var r,i="4.17.21",o=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",l=500,f="__lodash_placeholder__",h=1,d=2,p=4,g=1,y=2,v=1,m=2,_=4,b=8,w=16,E=32,S=64,O=128,I=256,x=512,R=30,k="...",C=800,P=16,A=1,N=2,T=3,M=1/0,L=9007199254740991,j=17976931348623157e292,U=NaN,D=4294967295,z=D-1,F=D>>>1,B=[["ary",O],["bind",v],["bindKey",m],["curry",b],["curryRight",w],["flip",x],["partial",E],["partialRight",S],["rearg",I]],H="[object Arguments]",q="[object Array]",$="[object AsyncFunction]",V="[object Boolean]",W="[object Date]",K="[object DOMException]",G="[object Error]",Y="[object Function]",Q="[object GeneratorFunction]",J="[object Map]",X="[object Number]",Z="[object Null]",ee="[object Object]",te="[object Promise]",ne="[object Proxy]",re="[object RegExp]",ie="[object Set]",oe="[object String]",se="[object Symbol]",ae="[object Undefined]",ue="[object WeakMap]",ce="[object WeakSet]",le="[object ArrayBuffer]",fe="[object DataView]",he="[object Float32Array]",de="[object Float64Array]",pe="[object Int8Array]",ge="[object Int16Array]",ye="[object Int32Array]",ve="[object Uint8Array]",me="[object Uint8ClampedArray]",_e="[object Uint16Array]",be="[object Uint32Array]",we=/\b__p \+= '';/g,Ee=/\b(__p \+=) '' \+/g,Se=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Oe=/&(?:amp|lt|gt|quot|#39);/g,Ie=/[&<>"']/g,xe=RegExp(Oe.source),Re=RegExp(Ie.source),ke=/<%-([\s\S]+?)%>/g,Ce=/<%([\s\S]+?)%>/g,Pe=/<%=([\s\S]+?)%>/g,Ae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ne=/^\w*$/,Te=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Me=/[\\^$.*+?()[\]{}|]/g,Le=RegExp(Me.source),je=/^\s+/,Ue=/\s/,De=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ze=/\{\n\/\* \[wrapped with (.+)\] \*/,Fe=/,? & /,Be=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,He=/[()=,{}\[\]\/\s]/,qe=/\\(\\)?/g,$e=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ve=/\w*$/,We=/^[-+]0x[0-9a-f]+$/i,Ke=/^0b[01]+$/i,Ge=/^\[object .+?Constructor\]$/,Ye=/^0o[0-7]+$/i,Qe=/^(?:0|[1-9]\d*)$/,Je=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xe=/($^)/,Ze=/['\n\r\u2028\u2029\\]/g,et="\\ud800-\\udfff",tt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",nt="\\u2700-\\u27bf",rt="a-z\\xdf-\\xf6\\xf8-\\xff",it="A-Z\\xc0-\\xd6\\xd8-\\xde",ot="\\ufe0e\\ufe0f",st="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",at="['’]",ut="["+et+"]",ct="["+st+"]",lt="["+tt+"]",ft="\\d+",ht="["+nt+"]",dt="["+rt+"]",pt="[^"+et+st+ft+nt+rt+it+"]",gt="\\ud83c[\\udffb-\\udfff]",yt="[^"+et+"]",vt="(?:\\ud83c[\\udde6-\\uddff]){2}",mt="[\\ud800-\\udbff][\\udc00-\\udfff]",_t="["+it+"]",bt="\\u200d",wt="(?:"+dt+"|"+pt+")",Et="(?:"+_t+"|"+pt+")",St="(?:"+at+"(?:d|ll|m|re|s|t|ve))?",Ot="(?:"+at+"(?:D|LL|M|RE|S|T|VE))?",It="(?:"+lt+"|"+gt+")?",xt="["+ot+"]?",Rt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",kt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ct=xt+It+"(?:"+bt+"(?:"+[yt,vt,mt].join("|")+")"+xt+It+")*",Pt="(?:"+[ht,vt,mt].join("|")+")"+Ct,At="(?:"+[yt+lt+"?",lt,vt,mt,ut].join("|")+")",Nt=RegExp(at,"g"),Tt=RegExp(lt,"g"),Mt=RegExp(gt+"(?="+gt+")|"+At+Ct,"g"),Lt=RegExp([_t+"?"+dt+"+"+St+"(?="+[ct,_t,"$"].join("|")+")",Et+"+"+Ot+"(?="+[ct,_t+wt,"$"].join("|")+")",_t+"?"+wt+"+"+St,_t+"+"+Ot,kt,Rt,ft,Pt].join("|"),"g"),jt=RegExp("["+bt+et+tt+ot+"]"),Ut=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Dt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zt=-1,Ft={};Ft[he]=Ft[de]=Ft[pe]=Ft[ge]=Ft[ye]=Ft[ve]=Ft[me]=Ft[_e]=Ft[be]=!0,Ft[H]=Ft[q]=Ft[le]=Ft[V]=Ft[fe]=Ft[W]=Ft[G]=Ft[Y]=Ft[J]=Ft[X]=Ft[ee]=Ft[re]=Ft[ie]=Ft[oe]=Ft[ue]=!1;var Bt={};Bt[H]=Bt[q]=Bt[le]=Bt[fe]=Bt[V]=Bt[W]=Bt[he]=Bt[de]=Bt[pe]=Bt[ge]=Bt[ye]=Bt[J]=Bt[X]=Bt[ee]=Bt[re]=Bt[ie]=Bt[oe]=Bt[se]=Bt[ve]=Bt[me]=Bt[_e]=Bt[be]=!0,Bt[G]=Bt[Y]=Bt[ue]=!1;var Ht={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},qt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},$t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Vt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Wt=parseFloat,Kt=parseInt,Gt="object"==typeof t&&t&&t.Object===Object&&t,Yt="object"==typeof self&&self&&self.Object===Object&&self,Qt=Gt||Yt||Function("return this")(),Jt=n&&!n.nodeType&&n,Xt=Jt&&e&&!e.nodeType&&e,Zt=Xt&&Xt.exports===Jt,en=Zt&&Gt.process,tn=function(){try{return Xt&&Xt.require&&Xt.require("util").types||en&&en.binding&&en.binding("util")}catch{}}(),nn=tn&&tn.isArrayBuffer,rn=tn&&tn.isDate,on=tn&&tn.isMap,sn=tn&&tn.isRegExp,an=tn&&tn.isSet,un=tn&&tn.isTypedArray;function cn(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function ln(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(r,s,n(s),e)}return r}function fn(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function hn(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function dn(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function pn(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function gn(e,t){return!(null==e||!e.length)&&Rn(e,t,0)>-1}function yn(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function vn(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function mn(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function _n(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function bn(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function wn(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var En=An("length");function Sn(e){return e.split("")}function On(e){return e.match(Be)||[]}function In(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function xn(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function Rn(e,t,n){return t==t?rr(e,t,n):xn(e,Cn,n)}function kn(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Cn(e){return e!=e}function Pn(e,t){var n=null==e?0:e.length;return n?Ln(e,t)/n:U}function An(e){return function(t){return null==t?r:t[e]}}function Nn(e){return function(t){return null==e?r:e[t]}}function Tn(e,t,n,r,i){return i(e,(function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)})),n}function Mn(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Ln(e,t){for(var n,i=-1,o=e.length;++i<o;){var s=t(e[i]);s!==r&&(n=n===r?s:n+s)}return n}function jn(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Un(e,t){return vn(t,(function(t){return[t,e[t]]}))}function Dn(e){return e&&e.slice(0,ar(e)+1).replace(je,"")}function zn(e){return function(t){return e(t)}}function Fn(e,t){return vn(t,(function(t){return e[t]}))}function Bn(e,t){return e.has(t)}function Hn(e,t){for(var n=-1,r=e.length;++n<r&&Rn(t,e[n],0)>-1;);return n}function qn(e,t){for(var n=e.length;n--&&Rn(t,e[n],0)>-1;);return n}function $n(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Vn=Nn(Ht),Wn=Nn(qt);function Kn(e){return"\\"+Vt[e]}function Gn(e,t){return null==e?r:e[t]}function Yn(e){return jt.test(e)}function Qn(e){return Ut.test(e)}function Jn(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function Xn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Zn(e,t){return function(n){return e(t(n))}}function er(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];(s===t||s===f)&&(e[n]=f,o[i++]=n)}return o}function tr(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function nr(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function rr(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function ir(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}function or(e){return Yn(e)?cr(e):En(e)}function sr(e){return Yn(e)?lr(e):Sn(e)}function ar(e){for(var t=e.length;t--&&Ue.test(e.charAt(t)););return t}var ur=Nn($t);function cr(e){for(var t=Mt.lastIndex=0;Mt.test(e);)++t;return t}function lr(e){return e.match(Mt)||[]}function fr(e){return e.match(Lt)||[]}var hr=function e(t){var n,Ue=(t=null==t?Qt:dr.defaults(Qt.Object(),t,dr.pick(Qt,Dt))).Array,Be=t.Date,et=t.Error,tt=t.Function,nt=t.Math,rt=t.Object,it=t.RegExp,ot=t.String,st=t.TypeError,at=Ue.prototype,ut=tt.prototype,ct=rt.prototype,lt=t["__core-js_shared__"],ft=ut.toString,ht=ct.hasOwnProperty,dt=0,pt=(n=/[^.]+$/.exec(lt&&lt.keys&&lt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",gt=ct.toString,yt=ft.call(rt),vt=Qt._,mt=it("^"+ft.call(ht).replace(Me,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_t=Zt?t.Buffer:r,bt=t.Symbol,wt=t.Uint8Array,Et=_t?_t.allocUnsafe:r,St=Zn(rt.getPrototypeOf,rt),Ot=rt.create,It=ct.propertyIsEnumerable,xt=at.splice,Rt=bt?bt.isConcatSpreadable:r,kt=bt?bt.iterator:r,Ct=bt?bt.toStringTag:r,Pt=function(){try{var e=Gs(rt,"defineProperty");return e({},"",{}),e}catch{}}(),At=t.clearTimeout!==Qt.clearTimeout&&t.clearTimeout,Mt=Be&&Be.now!==Qt.Date.now&&Be.now,Lt=t.setTimeout!==Qt.setTimeout&&t.setTimeout,jt=nt.ceil,Ut=nt.floor,Ht=rt.getOwnPropertySymbols,qt=_t?_t.isBuffer:r,$t=t.isFinite,Vt=at.join,Gt=Zn(rt.keys,rt),Yt=nt.max,Jt=nt.min,Xt=Be.now,en=t.parseInt,tn=nt.random,En=at.reverse,Sn=Gs(t,"DataView"),Nn=Gs(t,"Map"),rr=Gs(t,"Promise"),cr=Gs(t,"Set"),lr=Gs(t,"WeakMap"),hr=Gs(rt,"create"),pr=lr&&new lr,gr={},yr=Ta(Sn),vr=Ta(Nn),mr=Ta(rr),_r=Ta(cr),br=Ta(lr),wr=bt?bt.prototype:r,Er=wr?wr.valueOf:r,Sr=wr?wr.toString:r;function Or(e){if(xl(e)&&!cl(e)&&!(e instanceof kr)){if(e instanceof Rr)return e;if(ht.call(e,"__wrapped__"))return La(e)}return new Rr(e)}var Ir=function(){function e(){}return function(t){if(!Il(t))return{};if(Ot)return Ot(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function xr(){}function Rr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function kr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=D,this.__views__=[]}function Cr(){var e=new kr(this.__wrapped__);return e.__actions__=os(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=os(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=os(this.__views__),e}function Pr(){if(this.__filtered__){var e=new kr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e}function Ar(){var e=this.__wrapped__.value(),t=this.__dir__,n=cl(e),r=t<0,i=n?e.length:0,o=Zs(0,i,this.__views__),s=o.start,a=o.end,u=a-s,c=r?a:s-1,l=this.__iteratees__,f=l.length,h=0,d=Jt(u,this.__takeCount__);if(!n||!r&&i==u&&d==u)return Fo(e,this.__actions__);var p=[];e:for(;u--&&h<d;){for(var g=-1,y=e[c+=t];++g<f;){var v=l[g],m=v.iteratee,_=v.type,b=m(y);if(_==N)y=b;else if(!b){if(_==A)continue e;break e}}p[h++]=y}return p}function Nr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Tr(){this.__data__=hr?hr(null):{},this.size=0}function Mr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Lr(e){var t=this.__data__;if(hr){var n=t[e];return n===c?r:n}return ht.call(t,e)?t[e]:r}function jr(e){var t=this.__data__;return hr?t[e]!==r:ht.call(t,e)}function Ur(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=hr&&t===r?c:t,this}function Dr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function zr(){this.__data__=[],this.size=0}function Fr(e){var t=this.__data__,n=fi(t,e);return!(n<0||(n==t.length-1?t.pop():xt.call(t,n,1),--this.size,0))}function Br(e){var t=this.__data__,n=fi(t,e);return n<0?r:t[n][1]}function Hr(e){return fi(this.__data__,e)>-1}function qr(e,t){var n=this.__data__,r=fi(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function $r(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vr(){this.size=0,this.__data__={hash:new Nr,map:new(Nn||Dr),string:new Nr}}function Wr(e){var t=Ws(this,e).delete(e);return this.size-=t?1:0,t}function Kr(e){return Ws(this,e).get(e)}function Gr(e){return Ws(this,e).has(e)}function Yr(e,t){var n=Ws(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Qr(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new $r;++t<n;)this.add(e[t])}function Jr(e){return this.__data__.set(e,c),this}function Xr(e){return this.__data__.has(e)}function Zr(e){var t=this.__data__=new Dr(e);this.size=t.size}function ei(){this.__data__=new Dr,this.size=0}function ti(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ni(e){return this.__data__.get(e)}function ri(e){return this.__data__.has(e)}function ii(e,t){var n=this.__data__;if(n instanceof Dr){var r=n.__data__;if(!Nn||r.length<o-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new $r(r)}return n.set(e,t),this.size=n.size,this}function oi(e,t){var n=cl(e),r=!n&&ul(e),i=!n&&!r&&pl(e),o=!n&&!r&&!i&&Bl(e),s=n||r||i||o,a=s?jn(e.length,ot):[],u=a.length;for(var c in e)(t||ht.call(e,c))&&(!s||!("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||aa(c,u)))&&a.push(c);return a}function si(e){var t=e.length;return t?e[_o(0,t-1)]:r}function ai(e,t){return Pa(os(e),vi(t,0,e.length))}function ui(e){return Pa(os(e))}function ci(e,t,n){(n!==r&&!ol(e[t],n)||n===r&&!(t in e))&&gi(e,t,n)}function li(e,t,n){var i=e[t];(!ht.call(e,t)||!ol(i,n)||n===r&&!(t in e))&&gi(e,t,n)}function fi(e,t){for(var n=e.length;n--;)if(ol(e[n][0],t))return n;return-1}function hi(e,t,n,r){return Si(e,(function(e,i,o){t(r,e,n(e),o)})),r}function di(e,t){return e&&ss(t,Of(t),e)}function pi(e,t){return e&&ss(t,If(t),e)}function gi(e,t,n){"__proto__"==t&&Pt?Pt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function yi(e,t){for(var n=-1,i=t.length,o=Ue(i),s=null==e;++n<i;)o[n]=s?r:mf(e,t[n]);return o}function vi(e,t,n){return e==e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function mi(e,t,n,i,o,s){var a,u=t&h,c=t&d,l=t&p;if(n&&(a=o?n(e,i,o,s):n(e)),a!==r)return a;if(!Il(e))return e;var f=cl(e);if(f){if(a=na(e),!u)return os(e,a)}else{var g=Xs(e),y=g==Y||g==Q;if(pl(e))return Yo(e,u);if(g==ee||g==H||y&&!o){if(a=c||y?{}:ra(e),!u)return c?us(e,pi(a,e)):as(e,di(a,e))}else{if(!Bt[g])return o?e:{};a=ia(e,g,u)}}s||(s=new Zr);var v=s.get(e);if(v)return v;s.set(e,a),Dl(e)?e.forEach((function(r){a.add(mi(r,t,n,r,e,s))})):Rl(e)&&e.forEach((function(r,i){a.set(i,mi(r,t,n,i,e,s))}));var m=f?r:(l?c?Bs:Fs:c?If:Of)(e);return fn(m||e,(function(r,i){m&&(r=e[i=r]),li(a,i,mi(r,t,n,i,e,s))})),a}function _i(e){var t=Of(e);return function(n){return bi(n,e,t)}}function bi(e,t,n){var i=n.length;if(null==e)return!i;for(e=rt(e);i--;){var o=n[i],s=t[o],a=e[o];if(a===r&&!(o in e)||!s(a))return!1}return!0}function wi(e,t,n){if("function"!=typeof e)throw new st(a);return xa((function(){e.apply(r,n)}),t)}function Ei(e,t,n,r){var i=-1,s=gn,a=!0,u=e.length,c=[],l=t.length;if(!u)return c;n&&(t=vn(t,zn(n))),r?(s=yn,a=!1):t.length>=o&&(s=Bn,a=!1,t=new Qr(t));e:for(;++i<u;){var f=e[i],h=null==n?f:n(f);if(f=r||0!==f?f:0,a&&h==h){for(var d=l;d--;)if(t[d]===h)continue e;c.push(f)}else s(t,h,r)||c.push(f)}return c}Or.templateSettings={escape:ke,evaluate:Ce,interpolate:Pe,variable:"",imports:{_:Or}},Or.prototype=xr.prototype,Or.prototype.constructor=Or,Rr.prototype=Ir(xr.prototype),Rr.prototype.constructor=Rr,kr.prototype=Ir(xr.prototype),kr.prototype.constructor=kr,Nr.prototype.clear=Tr,Nr.prototype.delete=Mr,Nr.prototype.get=Lr,Nr.prototype.has=jr,Nr.prototype.set=Ur,Dr.prototype.clear=zr,Dr.prototype.delete=Fr,Dr.prototype.get=Br,Dr.prototype.has=Hr,Dr.prototype.set=qr,$r.prototype.clear=Vr,$r.prototype.delete=Wr,$r.prototype.get=Kr,$r.prototype.has=Gr,$r.prototype.set=Yr,Qr.prototype.add=Qr.prototype.push=Jr,Qr.prototype.has=Xr,Zr.prototype.clear=ei,Zr.prototype.delete=ti,Zr.prototype.get=ni,Zr.prototype.has=ri,Zr.prototype.set=ii;var Si=fs(Ni),Oi=fs(Ti,!0);function Ii(e,t){var n=!0;return Si(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function xi(e,t,n){for(var i=-1,o=e.length;++i<o;){var s=e[i],a=t(s);if(null!=a&&(u===r?a==a&&!Fl(a):n(a,u)))var u=a,c=s}return c}function Ri(e,t,n,i){var o=e.length;for((n=Yl(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:Yl(i))<0&&(i+=o),i=n>i?0:Ql(i);n<i;)e[n++]=t;return e}function ki(e,t){var n=[];return Si(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function Ci(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=sa),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?Ci(a,t-1,n,r,i):mn(i,a):r||(i[i.length]=a)}return i}var Pi=hs(),Ai=hs(!0);function Ni(e,t){return e&&Pi(e,t,Of)}function Ti(e,t){return e&&Ai(e,t,Of)}function Mi(e,t){return pn(t,(function(t){return El(e[t])}))}function Li(e,t){for(var n=0,i=(t=Vo(t,e)).length;null!=e&&n<i;)e=e[Na(t[n++])];return n&&n==i?e:r}function ji(e,t,n){var r=t(e);return cl(e)?r:mn(r,n(e))}function Ui(e){return null==e?e===r?ae:Z:Ct&&Ct in rt(e)?Ys(e):ba(e)}function Di(e,t){return e>t}function zi(e,t){return null!=e&&ht.call(e,t)}function Fi(e,t){return null!=e&&t in rt(e)}function Bi(e,t,n){return e>=Jt(t,n)&&e<Yt(t,n)}function Hi(e,t,n){for(var i=n?yn:gn,o=e[0].length,s=e.length,a=s,u=Ue(s),c=1/0,l=[];a--;){var f=e[a];a&&t&&(f=vn(f,zn(t))),c=Jt(f.length,c),u[a]=!n&&(t||o>=120&&f.length>=120)?new Qr(a&&f):r}f=e[0];var h=-1,d=u[0];e:for(;++h<o&&l.length<c;){var p=f[h],g=t?t(p):p;if(p=n||0!==p?p:0,!(d?Bn(d,g):i(l,g,n))){for(a=s;--a;){var y=u[a];if(!(y?Bn(y,g):i(e[a],g,n)))continue e}d&&d.push(g),l.push(p)}}return l}function qi(e,t,n,r){return Ni(e,(function(e,i,o){t(r,n(e),i,o)})),r}function $i(e,t,n){var i=null==(e=Ea(e,t=Vo(t,e)))?e:e[Na(su(t))];return null==i?r:cn(i,e,n)}function Vi(e){return xl(e)&&Ui(e)==H}function Wi(e){return xl(e)&&Ui(e)==le}function Ki(e){return xl(e)&&Ui(e)==W}function Gi(e,t,n,r,i){return e===t||(null==e||null==t||!xl(e)&&!xl(t)?e!=e&&t!=t:Yi(e,t,n,r,Gi,i))}function Yi(e,t,n,r,i,o){var s=cl(e),a=cl(t),u=s?q:Xs(e),c=a?q:Xs(t),l=(u=u==H?ee:u)==ee,f=(c=c==H?ee:c)==ee,h=u==c;if(h&&pl(e)){if(!pl(t))return!1;s=!0,l=!1}if(h&&!l)return o||(o=new Zr),s||Bl(e)?js(e,t,n,r,i,o):Us(e,t,u,n,r,i,o);if(!(n&g)){var d=l&&ht.call(e,"__wrapped__"),p=f&&ht.call(t,"__wrapped__");if(d||p){var y=d?e.value():e,v=p?t.value():t;return o||(o=new Zr),i(y,v,n,r,o)}}return!!h&&(o||(o=new Zr),Ds(e,t,n,r,i,o))}function Qi(e){return xl(e)&&Xs(e)==J}function Ji(e,t,n,i){var o=n.length,s=o,a=!i;if(null==e)return!s;for(e=rt(e);o--;){var u=n[o];if(a&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<s;){var c=(u=n[o])[0],l=e[c],f=u[1];if(a&&u[2]){if(l===r&&!(c in e))return!1}else{var h=new Zr;if(i)var d=i(l,f,c,e,t,h);if(!(d===r?Gi(f,l,g|y,i,h):d))return!1}}return!0}function Xi(e){return!(!Il(e)||ha(e))&&(El(e)?mt:Ge).test(Ta(e))}function Zi(e){return xl(e)&&Ui(e)==re}function eo(e){return xl(e)&&Xs(e)==ie}function to(e){return xl(e)&&Ol(e.length)&&!!Ft[Ui(e)]}function no(e){return"function"==typeof e?e:null==e?Nh:"object"==typeof e?cl(e)?uo(e[0],e[1]):ao(e):Vh(e)}function ro(e){if(!pa(e))return Gt(e);var t=[];for(var n in rt(e))ht.call(e,n)&&"constructor"!=n&&t.push(n);return t}function io(e){if(!Il(e))return _a(e);var t=pa(e),n=[];for(var r in e)"constructor"==r&&(t||!ht.call(e,r))||n.push(r);return n}function oo(e,t){return e<t}function so(e,t){var n=-1,r=fl(e)?Ue(e.length):[];return Si(e,(function(e,i,o){r[++n]=t(e,i,o)})),r}function ao(e){var t=Ks(e);return 1==t.length&&t[0][2]?ya(t[0][0],t[0][1]):function(n){return n===e||Ji(n,e,t)}}function uo(e,t){return ca(e)&&ga(t)?ya(Na(e),t):function(n){var i=mf(n,e);return i===r&&i===t?bf(n,e):Gi(t,i,g|y)}}function co(e,t,n,i,o){e!==t&&Pi(t,(function(s,a){if(o||(o=new Zr),Il(s))lo(e,t,a,n,co,i,o);else{var u=i?i(Oa(e,a),s,a+"",e,t,o):r;u===r&&(u=s),ci(e,a,u)}}),If)}function lo(e,t,n,i,o,s,a){var u=Oa(e,n),c=Oa(t,n),l=a.get(c);if(l)ci(e,n,l);else{var f=s?s(u,c,n+"",e,t,a):r,h=f===r;if(h){var d=cl(c),p=!d&&pl(c),g=!d&&!p&&Bl(c);f=c,d||p||g?cl(u)?f=u:hl(u)?f=os(u):p?(h=!1,f=Yo(c,!0)):g?(h=!1,f=es(c,!0)):f=[]:Ll(c)||ul(c)?(f=u,ul(u)?f=Xl(u):(!Il(u)||El(u))&&(f=ra(c))):h=!1}h&&(a.set(c,f),o(f,c,i,s,a),a.delete(c)),ci(e,n,f)}}function fo(e,t){var n=e.length;if(n)return aa(t+=t<0?n:0,n)?e[t]:r}function ho(e,t,n){t=t.length?vn(t,(function(e){return cl(e)?function(t){return Li(t,1===e.length?e[0]:e)}:e})):[Nh];var r=-1;t=vn(t,zn(Vs()));var i=so(e,(function(e,n,i){var o=vn(t,(function(t){return t(e)}));return{criteria:o,index:++r,value:e}}));return Mn(i,(function(e,t){return ns(e,t,n)}))}function po(e,t){return go(e,t,(function(t,n){return bf(e,n)}))}function go(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=Li(e,s);n(a,s)&&Io(o,Vo(s,e),a)}return o}function yo(e){return function(t){return Li(t,e)}}function vo(e,t,n,r){var i=r?kn:Rn,o=-1,s=t.length,a=e;for(e===t&&(t=os(t)),n&&(a=vn(e,zn(n)));++o<s;)for(var u=0,c=t[o],l=n?n(c):c;(u=i(a,l,u,r))>-1;)a!==e&&xt.call(a,u,1),xt.call(e,u,1);return e}function mo(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;aa(i)?xt.call(e,i,1):Uo(e,i)}}return e}function _o(e,t){return e+Ut(tn()*(t-e+1))}function bo(e,t,n,r){for(var i=-1,o=Yt(jt((t-e)/(n||1)),0),s=Ue(o);o--;)s[r?o:++i]=e,e+=n;return s}function wo(e,t){var n="";if(!e||t<1||t>L)return n;do{t%2&&(n+=e),(t=Ut(t/2))&&(e+=e)}while(t);return n}function Eo(e,t){return Ra(wa(e,t,Nh),e+"")}function So(e){return si(qf(e))}function Oo(e,t){var n=qf(e);return Pa(n,vi(t,0,n.length))}function Io(e,t,n,i){if(!Il(e))return e;for(var o=-1,s=(t=Vo(t,e)).length,a=s-1,u=e;null!=u&&++o<s;){var c=Na(t[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var f=u[c];(l=i?i(f,c,u):r)===r&&(l=Il(f)?f:aa(t[o+1])?[]:{})}li(u,c,l),u=u[c]}return e}var xo=pr?function(e,t){return pr.set(e,t),e}:Nh,Ro=Pt?function(e,t){return Pt(e,"toString",{configurable:!0,enumerable:!1,value:kh(t),writable:!0})}:Nh;function ko(e){return Pa(qf(e))}function Co(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Ue(i);++r<i;)o[r]=e[r+t];return o}function Po(e,t){var n;return Si(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function Ao(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=F){for(;r<i;){var o=r+i>>>1,s=e[o];null!==s&&!Fl(s)&&(n?s<=t:s<t)?r=o+1:i=o}return i}return No(e,t,Nh,n)}function No(e,t,n,i){var o=0,s=null==e?0:e.length;if(0===s)return 0;for(var a=(t=n(t))!=t,u=null===t,c=Fl(t),l=t===r;o<s;){var f=Ut((o+s)/2),h=n(e[f]),d=h!==r,p=null===h,g=h==h,y=Fl(h);if(a)var v=i||g;else v=l?g&&(i||d):u?g&&d&&(i||!p):c?g&&d&&!p&&(i||!y):!p&&!y&&(i?h<=t:h<t);v?o=f+1:s=f}return Jt(s,z)}function To(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n],a=t?t(s):s;if(!n||!ol(a,u)){var u=a;o[i++]=0===s?0:s}}return o}function Mo(e){return"number"==typeof e?e:Fl(e)?U:+e}function Lo(e){if("string"==typeof e)return e;if(cl(e))return vn(e,Lo)+"";if(Fl(e))return Sr?Sr.call(e):"";var t=e+"";return"0"==t&&1/e==-M?"-0":t}function jo(e,t,n){var r=-1,i=gn,s=e.length,a=!0,u=[],c=u;if(n)a=!1,i=yn;else if(s>=o){var l=t?null:Ps(e);if(l)return tr(l);a=!1,i=Bn,c=new Qr}else c=t?[]:u;e:for(;++r<s;){var f=e[r],h=t?t(f):f;if(f=n||0!==f?f:0,a&&h==h){for(var d=c.length;d--;)if(c[d]===h)continue e;t&&c.push(h),u.push(f)}else i(c,h,n)||(c!==u&&c.push(h),u.push(f))}return u}function Uo(e,t){return null==(e=Ea(e,t=Vo(t,e)))||delete e[Na(su(t))]}function Do(e,t,n,r){return Io(e,t,n(Li(e,t)),r)}function zo(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?Co(e,r?0:o,r?o+1:i):Co(e,r?o+1:0,r?i:o)}function Fo(e,t){var n=e;return n instanceof kr&&(n=n.value()),_n(t,(function(e,t){return t.func.apply(t.thisArg,mn([e],t.args))}),n)}function Bo(e,t,n){var r=e.length;if(r<2)return r?jo(e[0]):[];for(var i=-1,o=Ue(r);++i<r;)for(var s=e[i],a=-1;++a<r;)a!=i&&(o[i]=Ei(o[i]||s,e[a],t,n));return jo(Ci(o,1),t,n)}function Ho(e,t,n){for(var i=-1,o=e.length,s=t.length,a={};++i<o;){var u=i<s?t[i]:r;n(a,e[i],u)}return a}function qo(e){return hl(e)?e:[]}function $o(e){return"function"==typeof e?e:Nh}function Vo(e,t){return cl(e)?e:ca(e,t)?[e]:Aa(ef(e))}var Wo=Eo;function Ko(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:Co(e,t,n)}var Go=At||function(e){return Qt.clearTimeout(e)};function Yo(e,t){if(t)return e.slice();var n=e.length,r=Et?Et(n):new e.constructor(n);return e.copy(r),r}function Qo(e){var t=new e.constructor(e.byteLength);return new wt(t).set(new wt(e)),t}function Jo(e,t){var n=t?Qo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Xo(e){var t=new e.constructor(e.source,Ve.exec(e));return t.lastIndex=e.lastIndex,t}function Zo(e){return Er?rt(Er.call(e)):{}}function es(e,t){var n=t?Qo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ts(e,t){if(e!==t){var n=e!==r,i=null===e,o=e==e,s=Fl(e),a=t!==r,u=null===t,c=t==t,l=Fl(t);if(!u&&!l&&!s&&e>t||s&&a&&c&&!u&&!l||i&&a&&c||!n&&c||!o)return 1;if(!i&&!s&&!l&&e<t||l&&n&&o&&!i&&!s||u&&n&&o||!a&&o||!c)return-1}return 0}function ns(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,s=i.length,a=n.length;++r<s;){var u=ts(i[r],o[r]);if(u)return r>=a?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}function rs(e,t,n,r){for(var i=-1,o=e.length,s=n.length,a=-1,u=t.length,c=Yt(o-s,0),l=Ue(u+c),f=!r;++a<u;)l[a]=t[a];for(;++i<s;)(f||i<o)&&(l[n[i]]=e[i]);for(;c--;)l[a++]=e[i++];return l}function is(e,t,n,r){for(var i=-1,o=e.length,s=-1,a=n.length,u=-1,c=t.length,l=Yt(o-a,0),f=Ue(l+c),h=!r;++i<l;)f[i]=e[i];for(var d=i;++u<c;)f[d+u]=t[u];for(;++s<a;)(h||i<o)&&(f[d+n[s]]=e[i++]);return f}function os(e,t){var n=-1,r=e.length;for(t||(t=Ue(r));++n<r;)t[n]=e[n];return t}function ss(e,t,n,i){var o=!n;n||(n={});for(var s=-1,a=t.length;++s<a;){var u=t[s],c=i?i(n[u],e[u],u,n,e):r;c===r&&(c=e[u]),o?gi(n,u,c):li(n,u,c)}return n}function as(e,t){return ss(e,Qs(e),t)}function us(e,t){return ss(e,Js(e),t)}function cs(e,t){return function(n,r){var i=cl(n)?ln:hi,o=t?t():{};return i(n,e,Vs(r,2),o)}}function ls(e){return Eo((function(t,n){var i=-1,o=n.length,s=o>1?n[o-1]:r,a=o>2?n[2]:r;for(s=e.length>3&&"function"==typeof s?(o--,s):r,a&&ua(n[0],n[1],a)&&(s=o<3?r:s,o=1),t=rt(t);++i<o;){var u=n[i];u&&e(t,u,i,s)}return t}))}function fs(e,t){return function(n,r){if(null==n)return n;if(!fl(n))return e(n,r);for(var i=n.length,o=t?i:-1,s=rt(n);(t?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function hs(e){return function(t,n,r){for(var i=-1,o=rt(t),s=r(t),a=s.length;a--;){var u=s[e?a:++i];if(!1===n(o[u],u,o))break}return t}}function ds(e,t,n){var r=t&v,i=ys(e);function o(){return(this&&this!==Qt&&this instanceof o?i:e).apply(r?n:this,arguments)}return o}function ps(e){return function(t){var n=Yn(t=ef(t))?sr(t):r,i=n?n[0]:t.charAt(0),o=n?Ko(n,1).join(""):t.slice(1);return i[e]()+o}}function gs(e){return function(t){return _n(Sh(Qf(t).replace(Nt,"")),e,"")}}function ys(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Ir(e.prototype),r=e.apply(n,t);return Il(r)?r:n}}function vs(e,t,n){var i=ys(e);function o(){for(var s=arguments.length,a=Ue(s),u=s,c=$s(o);u--;)a[u]=arguments[u];var l=s<3&&a[0]!==c&&a[s-1]!==c?[]:er(a,c);return(s-=l.length)<n?ks(e,t,bs,o.placeholder,r,a,l,r,r,n-s):cn(this&&this!==Qt&&this instanceof o?i:e,this,a)}return o}function ms(e){return function(t,n,i){var o=rt(t);if(!fl(t)){var s=Vs(n,3);t=Of(t),n=function(e){return s(o[e],e,o)}}var a=e(t,n,i);return a>-1?o[s?t[a]:a]:r}}function _s(e){return zs((function(t){var n=t.length,i=n,o=Rr.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if("function"!=typeof s)throw new st(a);if(o&&!u&&"wrapper"==qs(s))var u=new Rr([],!0)}for(i=u?i:n;++i<n;){var c=qs(s=t[i]),l="wrapper"==c?Hs(s):r;u=l&&fa(l[0])&&l[1]==(O|b|E|I)&&!l[4].length&&1==l[9]?u[qs(l[0])].apply(u,l[3]):1==s.length&&fa(s)?u[c]():u.thru(s)}return function(){var e=arguments,r=e[0];if(u&&1==e.length&&cl(r))return u.plant(r).value();for(var i=0,o=n?t[i].apply(this,e):r;++i<n;)o=t[i].call(this,o);return o}}))}function bs(e,t,n,i,o,s,a,u,c,l){var f=t&O,h=t&v,d=t&m,p=t&(b|w),g=t&x,y=d?r:ys(e);function _(){for(var r=arguments.length,v=Ue(r),m=r;m--;)v[m]=arguments[m];if(p)var b=$s(_),w=$n(v,b);if(i&&(v=rs(v,i,o,p)),s&&(v=is(v,s,a,p)),r-=w,p&&r<l){var E=er(v,b);return ks(e,t,bs,_.placeholder,n,v,E,u,c,l-r)}var S=h?n:this,O=d?S[e]:e;return r=v.length,u?v=Sa(v,u):g&&r>1&&v.reverse(),f&&c<r&&(v.length=c),this&&this!==Qt&&this instanceof _&&(O=y||ys(O)),O.apply(S,v)}return _}function ws(e,t){return function(n,r){return qi(n,e,t(r),{})}}function Es(e,t){return function(n,i){var o;if(n===r&&i===r)return t;if(n!==r&&(o=n),i!==r){if(o===r)return i;"string"==typeof n||"string"==typeof i?(n=Lo(n),i=Lo(i)):(n=Mo(n),i=Mo(i)),o=e(n,i)}return o}}function Ss(e){return zs((function(t){return t=vn(t,zn(Vs())),Eo((function(n){var r=this;return e(t,(function(e){return cn(e,r,n)}))}))}))}function Os(e,t){var n=(t=t===r?" ":Lo(t)).length;if(n<2)return n?wo(t,e):t;var i=wo(t,jt(e/or(t)));return Yn(t)?Ko(sr(i),0,e).join(""):i.slice(0,e)}function Is(e,t,n,r){var i=t&v,o=ys(e);function s(){for(var t=-1,a=arguments.length,u=-1,c=r.length,l=Ue(c+a),f=this&&this!==Qt&&this instanceof s?o:e;++u<c;)l[u]=r[u];for(;a--;)l[u++]=arguments[++t];return cn(f,i?n:this,l)}return s}function xs(e){return function(t,n,i){return i&&"number"!=typeof i&&ua(t,n,i)&&(n=i=r),t=Gl(t),n===r?(n=t,t=0):n=Gl(n),bo(t,n,i=i===r?t<n?1:-1:Gl(i),e)}}function Rs(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=Jl(t),n=Jl(n)),e(t,n)}}function ks(e,t,n,i,o,s,a,u,c,l){var f=t&b;t|=f?E:S,(t&=~(f?S:E))&_||(t&=~(v|m));var h=[e,t,o,f?s:r,f?a:r,f?r:s,f?r:a,u,c,l],d=n.apply(r,h);return fa(e)&&Ia(d,h),d.placeholder=i,ka(d,e,t)}function Cs(e){var t=nt[e];return function(e,n){if(e=Jl(e),(n=null==n?0:Jt(Yl(n),292))&&$t(e)){var r=(ef(e)+"e").split("e");return+((r=(ef(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Ps=cr&&1/tr(new cr([,-0]))[1]==M?function(e){return new cr(e)}:Fh;function As(e){return function(t){var n=Xs(t);return n==J?Xn(t):n==ie?nr(t):Un(t,e(t))}}function Ns(e,t,n,i,o,s,u,c){var l=t&m;if(!l&&"function"!=typeof e)throw new st(a);var f=i?i.length:0;if(f||(t&=~(E|S),i=o=r),u=u===r?u:Yt(Yl(u),0),c=c===r?c:Yl(c),f-=o?o.length:0,t&S){var h=i,d=o;i=o=r}var p=l?r:Hs(e),g=[e,t,n,i,o,h,d,s,u,c];if(p&&ma(g,p),e=g[0],t=g[1],n=g[2],i=g[3],o=g[4],!(c=g[9]=g[9]===r?l?0:e.length:Yt(g[9]-f,0))&&t&(b|w)&&(t&=~(b|w)),t&&t!=v)y=t==b||t==w?vs(e,t,c):t!=E&&t!=(v|E)||o.length?bs.apply(r,g):Is(e,t,n,i);else var y=ds(e,t,n);return ka((p?xo:Ia)(y,g),e,t)}function Ts(e,t,n,i){return e===r||ol(e,ct[n])&&!ht.call(i,n)?t:e}function Ms(e,t,n,i,o,s){return Il(e)&&Il(t)&&(s.set(t,e),co(e,t,r,Ms,s),s.delete(t)),e}function Ls(e){return Ll(e)?r:e}function js(e,t,n,i,o,s){var a=n&g,u=e.length,c=t.length;if(u!=c&&!(a&&c>u))return!1;var l=s.get(e),f=s.get(t);if(l&&f)return l==t&&f==e;var h=-1,d=!0,p=n&y?new Qr:r;for(s.set(e,t),s.set(t,e);++h<u;){var v=e[h],m=t[h];if(i)var _=a?i(m,v,h,t,e,s):i(v,m,h,e,t,s);if(_!==r){if(_)continue;d=!1;break}if(p){if(!wn(t,(function(e,t){if(!Bn(p,t)&&(v===e||o(v,e,n,i,s)))return p.push(t)}))){d=!1;break}}else if(v!==m&&!o(v,m,n,i,s)){d=!1;break}}return s.delete(e),s.delete(t),d}function Us(e,t,n,r,i,o,s){switch(n){case fe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case le:return!(e.byteLength!=t.byteLength||!o(new wt(e),new wt(t)));case V:case W:case X:return ol(+e,+t);case G:return e.name==t.name&&e.message==t.message;case re:case oe:return e==t+"";case J:var a=Xn;case ie:var u=r&g;if(a||(a=tr),e.size!=t.size&&!u)return!1;var c=s.get(e);if(c)return c==t;r|=y,s.set(e,t);var l=js(a(e),a(t),r,i,o,s);return s.delete(e),l;case se:if(Er)return Er.call(e)==Er.call(t)}return!1}function Ds(e,t,n,i,o,s){var a=n&g,u=Fs(e),c=u.length;if(c!=Fs(t).length&&!a)return!1;for(var l=c;l--;){var f=u[l];if(!(a?f in t:ht.call(t,f)))return!1}var h=s.get(e),d=s.get(t);if(h&&d)return h==t&&d==e;var p=!0;s.set(e,t),s.set(t,e);for(var y=a;++l<c;){var v=e[f=u[l]],m=t[f];if(i)var _=a?i(m,v,f,t,e,s):i(v,m,f,e,t,s);if(!(_===r?v===m||o(v,m,n,i,s):_)){p=!1;break}y||(y="constructor"==f)}if(p&&!y){var b=e.constructor,w=t.constructor;b!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w)&&(p=!1)}return s.delete(e),s.delete(t),p}function zs(e){return Ra(wa(e,r,Ya),e+"")}function Fs(e){return ji(e,Of,Qs)}function Bs(e){return ji(e,If,Js)}var Hs=pr?function(e){return pr.get(e)}:Fh;function qs(e){for(var t=e.name+"",n=gr[t],r=ht.call(gr,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function $s(e){return(ht.call(Or,"placeholder")?Or:e).placeholder}function Vs(){var e=Or.iteratee||Th;return e=e===Th?no:e,arguments.length?e(arguments[0],arguments[1]):e}function Ws(e,t){var n=e.__data__;return la(t)?n["string"==typeof t?"string":"hash"]:n.map}function Ks(e){for(var t=Of(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,ga(i)]}return t}function Gs(e,t){var n=Gn(e,t);return Xi(n)?n:r}function Ys(e){var t=ht.call(e,Ct),n=e[Ct];try{e[Ct]=r;var i=!0}catch{}var o=gt.call(e);return i&&(t?e[Ct]=n:delete e[Ct]),o}var Qs=Ht?function(e){return null==e?[]:(e=rt(e),pn(Ht(e),(function(t){return It.call(e,t)})))}:Yh,Js=Ht?function(e){for(var t=[];e;)mn(t,Qs(e)),e=St(e);return t}:Yh,Xs=Ui;function Zs(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=Jt(t,e+s);break;case"takeRight":e=Yt(e,t-s)}}return{start:e,end:t}}function ea(e){var t=e.match(ze);return t?t[1].split(Fe):[]}function ta(e,t,n){for(var r=-1,i=(t=Vo(t,e)).length,o=!1;++r<i;){var s=Na(t[r]);if(!(o=null!=e&&n(e,s)))break;e=e[s]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Ol(i)&&aa(s,i)&&(cl(e)||ul(e))}function na(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ht.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function ra(e){return"function"!=typeof e.constructor||pa(e)?{}:Ir(St(e))}function ia(e,t,n){var r=e.constructor;switch(t){case le:return Qo(e);case V:case W:return new r(+e);case fe:return Jo(e,n);case he:case de:case pe:case ge:case ye:case ve:case me:case _e:case be:return es(e,n);case J:return new r;case X:case oe:return new r(e);case re:return Xo(e);case ie:return new r;case se:return Zo(e)}}function oa(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(De,"{\n/* [wrapped with "+t+"] */\n")}function sa(e){return cl(e)||ul(e)||!!(Rt&&e&&e[Rt])}function aa(e,t){var n=typeof e;return!!(t=t??L)&&("number"==n||"symbol"!=n&&Qe.test(e))&&e>-1&&e%1==0&&e<t}function ua(e,t,n){if(!Il(n))return!1;var r=typeof t;return!!("number"==r?fl(n)&&aa(t,n.length):"string"==r&&t in n)&&ol(n[t],e)}function ca(e,t){if(cl(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Fl(e))||Ne.test(e)||!Ae.test(e)||null!=t&&e in rt(t)}function la(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function fa(e){var t=qs(e),n=Or[t];if("function"!=typeof n||!(t in kr.prototype))return!1;if(e===n)return!0;var r=Hs(n);return!!r&&e===r[0]}function ha(e){return!!pt&&pt in e}(Sn&&Xs(new Sn(new ArrayBuffer(1)))!=fe||Nn&&Xs(new Nn)!=J||rr&&Xs(rr.resolve())!=te||cr&&Xs(new cr)!=ie||lr&&Xs(new lr)!=ue)&&(Xs=function(e){var t=Ui(e),n=t==ee?e.constructor:r,i=n?Ta(n):"";if(i)switch(i){case yr:return fe;case vr:return J;case mr:return te;case _r:return ie;case br:return ue}return t});var da=lt?El:Qh;function pa(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ct)}function ga(e){return e==e&&!Il(e)}function ya(e,t){return function(n){return null!=n&&n[e]===t&&(t!==r||e in rt(n))}}function va(e){var t=Bc(e,(function(e){return n.size===l&&n.clear(),e})),n=t.cache;return t}function ma(e,t){var n=e[1],r=t[1],i=n|r,o=i<(v|m|O),s=r==O&&n==b||r==O&&n==I&&e[7].length<=t[8]||r==(O|I)&&t[7].length<=t[8]&&n==b;if(!o&&!s)return e;r&v&&(e[2]=t[2],i|=n&v?0:_);var a=t[3];if(a){var u=e[3];e[3]=u?rs(u,a,t[4]):a,e[4]=u?er(e[3],f):t[4]}return(a=t[5])&&(u=e[5],e[5]=u?is(u,a,t[6]):a,e[6]=u?er(e[5],f):t[6]),(a=t[7])&&(e[7]=a),r&O&&(e[8]=null==e[8]?t[8]:Jt(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}function _a(e){var t=[];if(null!=e)for(var n in rt(e))t.push(n);return t}function ba(e){return gt.call(e)}function wa(e,t,n){return t=Yt(t===r?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=Yt(r.length-t,0),s=Ue(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Ue(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),cn(e,this,a)}}function Ea(e,t){return t.length<2?e:Li(e,Co(t,0,-1))}function Sa(e,t){for(var n=e.length,i=Jt(t.length,n),o=os(e);i--;){var s=t[i];e[i]=aa(s,n)?o[s]:r}return e}function Oa(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ia=Ca(xo),xa=Lt||function(e,t){return Qt.setTimeout(e,t)},Ra=Ca(Ro);function ka(e,t,n){var r=t+"";return Ra(e,oa(r,Ma(ea(r),n)))}function Ca(e){var t=0,n=0;return function(){var i=Xt(),o=P-(i-n);if(n=i,o>0){if(++t>=C)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Pa(e,t){var n=-1,i=e.length,o=i-1;for(t=t===r?i:t;++n<t;){var s=_o(n,o),a=e[s];e[s]=e[n],e[n]=a}return e.length=t,e}var Aa=va((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Te,(function(e,n,r,i){t.push(r?i.replace(qe,"$1"):n||e)})),t}));function Na(e){if("string"==typeof e||Fl(e))return e;var t=e+"";return"0"==t&&1/e==-M?"-0":t}function Ta(e){if(null!=e){try{return ft.call(e)}catch{}try{return e+""}catch{}}return""}function Ma(e,t){return fn(B,(function(n){var r="_."+n[0];t&n[1]&&!gn(e,r)&&e.push(r)})),e.sort()}function La(e){if(e instanceof kr)return e.clone();var t=new Rr(e.__wrapped__,e.__chain__);return t.__actions__=os(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function ja(e,t,n){t=(n?ua(e,t,n):t===r)?1:Yt(Yl(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,s=0,a=Ue(jt(i/t));o<i;)a[s++]=Co(e,o,o+=t);return a}function Ua(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i}function Da(){var e=arguments.length;if(!e)return[];for(var t=Ue(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return mn(cl(n)?os(n):[n],Ci(t,1))}var za=Eo((function(e,t){return hl(e)?Ei(e,Ci(t,1,hl,!0)):[]})),Fa=Eo((function(e,t){var n=su(t);return hl(n)&&(n=r),hl(e)?Ei(e,Ci(t,1,hl,!0),Vs(n,2)):[]})),Ba=Eo((function(e,t){var n=su(t);return hl(n)&&(n=r),hl(e)?Ei(e,Ci(t,1,hl,!0),r,n):[]}));function Ha(e,t,n){var i=null==e?0:e.length;return i?Co(e,(t=n||t===r?1:Yl(t))<0?0:t,i):[]}function qa(e,t,n){var i=null==e?0:e.length;return i?Co(e,0,(t=i-(t=n||t===r?1:Yl(t)))<0?0:t):[]}function $a(e,t){return e&&e.length?zo(e,Vs(t,3),!0,!0):[]}function Va(e,t){return e&&e.length?zo(e,Vs(t,3),!0):[]}function Wa(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&ua(e,t,n)&&(n=0,r=i),Ri(e,t,n,r)):[]}function Ka(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:Yl(n);return i<0&&(i=Yt(r+i,0)),xn(e,Vs(t,3),i)}function Ga(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return n!==r&&(o=Yl(n),o=n<0?Yt(i+o,0):Jt(o,i-1)),xn(e,Vs(t,3),o,!0)}function Ya(e){return null!=e&&e.length?Ci(e,1):[]}function Qa(e){return null!=e&&e.length?Ci(e,M):[]}function Ja(e,t){return null!=e&&e.length?Ci(e,t=t===r?1:Yl(t)):[]}function Xa(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r}function Za(e){return e&&e.length?e[0]:r}function eu(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:Yl(n);return i<0&&(i=Yt(r+i,0)),Rn(e,t,i)}function tu(e){return null!=e&&e.length?Co(e,0,-1):[]}var nu=Eo((function(e){var t=vn(e,qo);return t.length&&t[0]===e[0]?Hi(t):[]})),ru=Eo((function(e){var t=su(e),n=vn(e,qo);return t===su(n)?t=r:n.pop(),n.length&&n[0]===e[0]?Hi(n,Vs(t,2)):[]})),iu=Eo((function(e){var t=su(e),n=vn(e,qo);return(t="function"==typeof t?t:r)&&n.pop(),n.length&&n[0]===e[0]?Hi(n,r,t):[]}));function ou(e,t){return null==e?"":Vt.call(e,t)}function su(e){var t=null==e?0:e.length;return t?e[t-1]:r}function au(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=Yl(n))<0?Yt(i+o,0):Jt(o,i-1)),t==t?ir(e,t,o):xn(e,Cn,o,!0)}function uu(e,t){return e&&e.length?fo(e,Yl(t)):r}var cu=Eo(lu);function lu(e,t){return e&&e.length&&t&&t.length?vo(e,t):e}function fu(e,t,n){return e&&e.length&&t&&t.length?vo(e,t,Vs(n,2)):e}function hu(e,t,n){return e&&e.length&&t&&t.length?vo(e,t,r,n):e}var du=zs((function(e,t){var n=null==e?0:e.length,r=yi(e,t);return mo(e,vn(t,(function(e){return aa(e,n)?+e:e})).sort(ts)),r}));function pu(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=Vs(t,3);++r<o;){var s=e[r];t(s,r,e)&&(n.push(s),i.push(r))}return mo(e,i),n}function gu(e){return null==e?e:En.call(e)}function yu(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&ua(e,t,n)?(t=0,n=i):(t=null==t?0:Yl(t),n=n===r?i:Yl(n)),Co(e,t,n)):[]}function vu(e,t){return Ao(e,t)}function mu(e,t,n){return No(e,t,Vs(n,2))}function _u(e,t){var n=null==e?0:e.length;if(n){var r=Ao(e,t);if(r<n&&ol(e[r],t))return r}return-1}function bu(e,t){return Ao(e,t,!0)}function wu(e,t,n){return No(e,t,Vs(n,2),!0)}function Eu(e,t){if(null!=e&&e.length){var n=Ao(e,t,!0)-1;if(ol(e[n],t))return n}return-1}function Su(e){return e&&e.length?To(e):[]}function Ou(e,t){return e&&e.length?To(e,Vs(t,2)):[]}function Iu(e){var t=null==e?0:e.length;return t?Co(e,1,t):[]}function xu(e,t,n){return e&&e.length?Co(e,0,(t=n||t===r?1:Yl(t))<0?0:t):[]}function Ru(e,t,n){var i=null==e?0:e.length;return i?Co(e,(t=i-(t=n||t===r?1:Yl(t)))<0?0:t,i):[]}function ku(e,t){return e&&e.length?zo(e,Vs(t,3),!1,!0):[]}function Cu(e,t){return e&&e.length?zo(e,Vs(t,3)):[]}var Pu=Eo((function(e){return jo(Ci(e,1,hl,!0))})),Au=Eo((function(e){var t=su(e);return hl(t)&&(t=r),jo(Ci(e,1,hl,!0),Vs(t,2))})),Nu=Eo((function(e){var t=su(e);return t="function"==typeof t?t:r,jo(Ci(e,1,hl,!0),r,t)}));function Tu(e){return e&&e.length?jo(e):[]}function Mu(e,t){return e&&e.length?jo(e,Vs(t,2)):[]}function Lu(e,t){return t="function"==typeof t?t:r,e&&e.length?jo(e,r,t):[]}function ju(e){if(!e||!e.length)return[];var t=0;return e=pn(e,(function(e){if(hl(e))return t=Yt(e.length,t),!0})),jn(t,(function(t){return vn(e,An(t))}))}function Uu(e,t){if(!e||!e.length)return[];var n=ju(e);return null==t?n:vn(n,(function(e){return cn(t,r,e)}))}var Du=Eo((function(e,t){return hl(e)?Ei(e,t):[]})),zu=Eo((function(e){return Bo(pn(e,hl))})),Fu=Eo((function(e){var t=su(e);return hl(t)&&(t=r),Bo(pn(e,hl),Vs(t,2))})),Bu=Eo((function(e){var t=su(e);return t="function"==typeof t?t:r,Bo(pn(e,hl),r,t)})),Hu=Eo(ju);function qu(e,t){return Ho(e||[],t||[],li)}function $u(e,t){return Ho(e||[],t||[],Io)}var Vu=Eo((function(e){var t=e.length,n=t>1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,Uu(e,n)}));function Wu(e){var t=Or(e);return t.__chain__=!0,t}function Ku(e,t){return t(e),e}function Gu(e,t){return t(e)}var Yu=zs((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return yi(t,e)};return!(t>1||this.__actions__.length)&&i instanceof kr&&aa(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Gu,args:[o],thisArg:r}),new Rr(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(r),e}))):this.thru(o)}));function Qu(){return Wu(this)}function Ju(){return new Rr(this.value(),this.__chain__)}function Xu(){this.__values__===r&&(this.__values__=Kl(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}}function Zu(){return this}function ec(e){for(var t,n=this;n instanceof xr;){var i=La(n);i.__index__=0,i.__values__=r,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t}function tc(){var e=this.__wrapped__;if(e instanceof kr){var t=e;return this.__actions__.length&&(t=new kr(this)),(t=t.reverse()).__actions__.push({func:Gu,args:[gu],thisArg:r}),new Rr(t,this.__chain__)}return this.thru(gu)}function nc(){return Fo(this.__wrapped__,this.__actions__)}var rc=cs((function(e,t,n){ht.call(e,n)?++e[n]:gi(e,n,1)}));function ic(e,t,n){var i=cl(e)?dn:Ii;return n&&ua(e,t,n)&&(t=r),i(e,Vs(t,3))}function oc(e,t){return(cl(e)?pn:ki)(e,Vs(t,3))}var sc=ms(Ka),ac=ms(Ga);function uc(e,t){return Ci(vc(e,t),1)}function cc(e,t){return Ci(vc(e,t),M)}function lc(e,t,n){return n=n===r?1:Yl(n),Ci(vc(e,t),n)}function fc(e,t){return(cl(e)?fn:Si)(e,Vs(t,3))}function hc(e,t){return(cl(e)?hn:Oi)(e,Vs(t,3))}var dc=cs((function(e,t,n){ht.call(e,n)?e[n].push(t):gi(e,n,[t])}));function pc(e,t,n,r){e=fl(e)?e:qf(e),n=n&&!r?Yl(n):0;var i=e.length;return n<0&&(n=Yt(i+n,0)),zl(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Rn(e,t,n)>-1}var gc=Eo((function(e,t,n){var r=-1,i="function"==typeof t,o=fl(e)?Ue(e.length):[];return Si(e,(function(e){o[++r]=i?cn(t,e,n):$i(e,t,n)})),o})),yc=cs((function(e,t,n){gi(e,n,t)}));function vc(e,t){return(cl(e)?vn:so)(e,Vs(t,3))}function mc(e,t,n,i){return null==e?[]:(cl(t)||(t=null==t?[]:[t]),cl(n=i?r:n)||(n=null==n?[]:[n]),ho(e,t,n))}var _c=cs((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));function bc(e,t,n){var r=cl(e)?_n:Tn,i=arguments.length<3;return r(e,Vs(t,4),n,i,Si)}function wc(e,t,n){var r=cl(e)?bn:Tn,i=arguments.length<3;return r(e,Vs(t,4),n,i,Oi)}function Ec(e,t){return(cl(e)?pn:ki)(e,Hc(Vs(t,3)))}function Sc(e){return(cl(e)?si:So)(e)}function Oc(e,t,n){return t=(n?ua(e,t,n):t===r)?1:Yl(t),(cl(e)?ai:Oo)(e,t)}function Ic(e){return(cl(e)?ui:ko)(e)}function xc(e){if(null==e)return 0;if(fl(e))return zl(e)?or(e):e.length;var t=Xs(e);return t==J||t==ie?e.size:ro(e).length}function Rc(e,t,n){var i=cl(e)?wn:Po;return n&&ua(e,t,n)&&(t=r),i(e,Vs(t,3))}var kc=Eo((function(e,t){if(null==e)return[];var n=t.length;return n>1&&ua(e,t[0],t[1])?t=[]:n>2&&ua(t[0],t[1],t[2])&&(t=[t[0]]),ho(e,Ci(t,1),[])})),Cc=Mt||function(){return Qt.Date.now()};function Pc(e,t){if("function"!=typeof t)throw new st(a);return e=Yl(e),function(){if(--e<1)return t.apply(this,arguments)}}function Ac(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Ns(e,O,r,r,r,r,t)}function Nc(e,t){var n;if("function"!=typeof t)throw new st(a);return e=Yl(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var Tc=Eo((function(e,t,n){var r=v;if(n.length){var i=er(n,$s(Tc));r|=E}return Ns(e,r,t,n,i)})),Mc=Eo((function(e,t,n){var r=v|m;if(n.length){var i=er(n,$s(Mc));r|=E}return Ns(t,r,e,n,i)}));function Lc(e,t,n){var i=Ns(e,b,r,r,r,r,r,t=n?r:t);return i.placeholder=Lc.placeholder,i}function jc(e,t,n){var i=Ns(e,w,r,r,r,r,r,t=n?r:t);return i.placeholder=jc.placeholder,i}function Uc(e,t,n){var i,o,s,u,c,l,f=0,h=!1,d=!1,p=!0;if("function"!=typeof e)throw new st(a);function g(t){var n=i,s=o;return i=o=r,f=t,u=e.apply(s,n)}function y(e){return f=e,c=xa(_,t),h?g(e):u}function v(e){var n=t-(e-l);return d?Jt(n,s-(e-f)):n}function m(e){var n=e-l;return l===r||n>=t||n<0||d&&e-f>=s}function _(){var e=Cc();if(m(e))return b(e);c=xa(_,v(e))}function b(e){return c=r,p&&i?g(e):(i=o=r,u)}function w(){c!==r&&Go(c),f=0,i=l=o=c=r}function E(){return c===r?u:b(Cc())}function S(){var e=Cc(),n=m(e);if(i=arguments,o=this,l=e,n){if(c===r)return y(l);if(d)return Go(c),c=xa(_,t),g(l)}return c===r&&(c=xa(_,t)),u}return t=Jl(t)||0,Il(n)&&(h=!!n.leading,s=(d="maxWait"in n)?Yt(Jl(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),S.cancel=w,S.flush=E,S}var Dc=Eo((function(e,t){return wi(e,1,t)})),zc=Eo((function(e,t,n){return wi(e,Jl(t)||0,n)}));function Fc(e){return Ns(e,x)}function Bc(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new st(a);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Bc.Cache||$r),n}function Hc(e){if("function"!=typeof e)throw new st(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function qc(e){return Nc(2,e)}Bc.Cache=$r;var $c=Wo((function(e,t){var n=(t=1==t.length&&cl(t[0])?vn(t[0],zn(Vs())):vn(Ci(t,1),zn(Vs()))).length;return Eo((function(r){for(var i=-1,o=Jt(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return cn(e,this,r)}))})),Vc=Eo((function(e,t){var n=er(t,$s(Vc));return Ns(e,E,r,t,n)})),Wc=Eo((function(e,t){var n=er(t,$s(Wc));return Ns(e,S,r,t,n)})),Kc=zs((function(e,t){return Ns(e,I,r,r,r,t)}));function Gc(e,t){if("function"!=typeof e)throw new st(a);return Eo(e,t=t===r?t:Yl(t))}function Yc(e,t){if("function"!=typeof e)throw new st(a);return t=null==t?0:Yt(Yl(t),0),Eo((function(n){var r=n[t],i=Ko(n,0,t);return r&&mn(i,r),cn(e,this,i)}))}function Qc(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new st(a);return Il(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Uc(e,t,{leading:r,maxWait:t,trailing:i})}function Jc(e){return Ac(e,1)}function Xc(e,t){return Vc($o(t),e)}function Zc(){if(!arguments.length)return[];var e=arguments[0];return cl(e)?e:[e]}function el(e){return mi(e,p)}function tl(e,t){return mi(e,p,t="function"==typeof t?t:r)}function nl(e){return mi(e,h|p)}function rl(e,t){return mi(e,h|p,t="function"==typeof t?t:r)}function il(e,t){return null==t||bi(e,t,Of(t))}function ol(e,t){return e===t||e!=e&&t!=t}var sl=Rs(Di),al=Rs((function(e,t){return e>=t})),ul=Vi(function(){return arguments}())?Vi:function(e){return xl(e)&&ht.call(e,"callee")&&!It.call(e,"callee")},cl=Ue.isArray,ll=nn?zn(nn):Wi;function fl(e){return null!=e&&Ol(e.length)&&!El(e)}function hl(e){return xl(e)&&fl(e)}function dl(e){return!0===e||!1===e||xl(e)&&Ui(e)==V}var pl=qt||Qh,gl=rn?zn(rn):Ki;function yl(e){return xl(e)&&1===e.nodeType&&!Ll(e)}function vl(e){if(null==e)return!0;if(fl(e)&&(cl(e)||"string"==typeof e||"function"==typeof e.splice||pl(e)||Bl(e)||ul(e)))return!e.length;var t=Xs(e);if(t==J||t==ie)return!e.size;if(pa(e))return!ro(e).length;for(var n in e)if(ht.call(e,n))return!1;return!0}function ml(e,t){return Gi(e,t)}function _l(e,t,n){var i=(n="function"==typeof n?n:r)?n(e,t):r;return i===r?Gi(e,t,r,n):!!i}function bl(e){if(!xl(e))return!1;var t=Ui(e);return t==G||t==K||"string"==typeof e.message&&"string"==typeof e.name&&!Ll(e)}function wl(e){return"number"==typeof e&&$t(e)}function El(e){if(!Il(e))return!1;var t=Ui(e);return t==Y||t==Q||t==$||t==ne}function Sl(e){return"number"==typeof e&&e==Yl(e)}function Ol(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=L}function Il(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function xl(e){return null!=e&&"object"==typeof e}var Rl=on?zn(on):Qi;function kl(e,t){return e===t||Ji(e,t,Ks(t))}function Cl(e,t,n){return n="function"==typeof n?n:r,Ji(e,t,Ks(t),n)}function Pl(e){return Ml(e)&&e!=+e}function Al(e){if(da(e))throw new et(s);return Xi(e)}function Nl(e){return null===e}function Tl(e){return null==e}function Ml(e){return"number"==typeof e||xl(e)&&Ui(e)==X}function Ll(e){if(!xl(e)||Ui(e)!=ee)return!1;var t=St(e);if(null===t)return!0;var n=ht.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ft.call(n)==yt}var jl=sn?zn(sn):Zi;function Ul(e){return Sl(e)&&e>=-L&&e<=L}var Dl=an?zn(an):eo;function zl(e){return"string"==typeof e||!cl(e)&&xl(e)&&Ui(e)==oe}function Fl(e){return"symbol"==typeof e||xl(e)&&Ui(e)==se}var Bl=un?zn(un):to;function Hl(e){return e===r}function ql(e){return xl(e)&&Xs(e)==ue}function $l(e){return xl(e)&&Ui(e)==ce}var Vl=Rs(oo),Wl=Rs((function(e,t){return e<=t}));function Kl(e){if(!e)return[];if(fl(e))return zl(e)?sr(e):os(e);if(kt&&e[kt])return Jn(e[kt]());var t=Xs(e);return(t==J?Xn:t==ie?tr:qf)(e)}function Gl(e){return e?(e=Jl(e))===M||e===-M?(e<0?-1:1)*j:e==e?e:0:0===e?e:0}function Yl(e){var t=Gl(e),n=t%1;return t==t?n?t-n:t:0}function Ql(e){return e?vi(Yl(e),0,D):0}function Jl(e){if("number"==typeof e)return e;if(Fl(e))return U;if(Il(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Il(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Dn(e);var n=Ke.test(e);return n||Ye.test(e)?Kt(e.slice(2),n?2:8):We.test(e)?U:+e}function Xl(e){return ss(e,If(e))}function Zl(e){return e?vi(Yl(e),-L,L):0===e?e:0}function ef(e){return null==e?"":Lo(e)}var tf=ls((function(e,t){if(pa(t)||fl(t))ss(t,Of(t),e);else for(var n in t)ht.call(t,n)&&li(e,n,t[n])})),nf=ls((function(e,t){ss(t,If(t),e)})),rf=ls((function(e,t,n,r){ss(t,If(t),e,r)})),of=ls((function(e,t,n,r){ss(t,Of(t),e,r)})),sf=zs(yi);function af(e,t){var n=Ir(e);return null==t?n:di(n,t)}var uf=Eo((function(e,t){e=rt(e);var n=-1,i=t.length,o=i>2?t[2]:r;for(o&&ua(t[0],t[1],o)&&(i=1);++n<i;)for(var s=t[n],a=If(s),u=-1,c=a.length;++u<c;){var l=a[u],f=e[l];(f===r||ol(f,ct[l])&&!ht.call(e,l))&&(e[l]=s[l])}return e})),cf=Eo((function(e){return e.push(r,Ms),cn(Cf,r,e)}));function lf(e,t){return In(e,Vs(t,3),Ni)}function ff(e,t){return In(e,Vs(t,3),Ti)}function hf(e,t){return null==e?e:Pi(e,Vs(t,3),If)}function df(e,t){return null==e?e:Ai(e,Vs(t,3),If)}function pf(e,t){return e&&Ni(e,Vs(t,3))}function gf(e,t){return e&&Ti(e,Vs(t,3))}function yf(e){return null==e?[]:Mi(e,Of(e))}function vf(e){return null==e?[]:Mi(e,If(e))}function mf(e,t,n){var i=null==e?r:Li(e,t);return i===r?n:i}function _f(e,t){return null!=e&&ta(e,t,zi)}function bf(e,t){return null!=e&&ta(e,t,Fi)}var wf=ws((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=gt.call(t)),e[t]=n}),kh(Nh)),Ef=ws((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=gt.call(t)),ht.call(e,t)?e[t].push(n):e[t]=[n]}),Vs),Sf=Eo($i);function Of(e){return fl(e)?oi(e):ro(e)}function If(e){return fl(e)?oi(e,!0):io(e)}function xf(e,t){var n={};return t=Vs(t,3),Ni(e,(function(e,r,i){gi(n,t(e,r,i),e)})),n}function Rf(e,t){var n={};return t=Vs(t,3),Ni(e,(function(e,r,i){gi(n,r,t(e,r,i))})),n}var kf=ls((function(e,t,n){co(e,t,n)})),Cf=ls((function(e,t,n,r){co(e,t,n,r)})),Pf=zs((function(e,t){var n={};if(null==e)return n;var r=!1;t=vn(t,(function(t){return t=Vo(t,e),r||(r=t.length>1),t})),ss(e,Bs(e),n),r&&(n=mi(n,h|d|p,Ls));for(var i=t.length;i--;)Uo(n,t[i]);return n}));function Af(e,t){return Tf(e,Hc(Vs(t)))}var Nf=zs((function(e,t){return null==e?{}:po(e,t)}));function Tf(e,t){if(null==e)return{};var n=vn(Bs(e),(function(e){return[e]}));return t=Vs(t),go(e,n,(function(e,n){return t(e,n[0])}))}function Mf(e,t,n){var i=-1,o=(t=Vo(t,e)).length;for(o||(o=1,e=r);++i<o;){var s=null==e?r:e[Na(t[i])];s===r&&(i=o,s=n),e=El(s)?s.call(e):s}return e}function Lf(e,t,n){return null==e?e:Io(e,t,n)}function jf(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Io(e,t,n,i)}var Uf=As(Of),Df=As(If);function zf(e,t,n){var r=cl(e),i=r||pl(e)||Bl(e);if(t=Vs(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Il(e)&&El(o)?Ir(St(e)):{}}return(i?fn:Ni)(e,(function(e,r,i){return t(n,e,r,i)})),n}function Ff(e,t){return null==e||Uo(e,t)}function Bf(e,t,n){return null==e?e:Do(e,t,$o(n))}function Hf(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Do(e,t,$o(n),i)}function qf(e){return null==e?[]:Fn(e,Of(e))}function $f(e){return null==e?[]:Fn(e,If(e))}function Vf(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=Jl(n))==n?n:0),t!==r&&(t=(t=Jl(t))==t?t:0),vi(Jl(e),t,n)}function Wf(e,t,n){return t=Gl(t),n===r?(n=t,t=0):n=Gl(n),Bi(e=Jl(e),t,n)}function Kf(e,t,n){if(n&&"boolean"!=typeof n&&ua(e,t,n)&&(t=n=r),n===r&&("boolean"==typeof t?(n=t,t=r):"boolean"==typeof e&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=Gl(e),t===r?(t=e,e=0):t=Gl(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var o=tn();return Jt(e+o*(t-e+Wt("1e-"+((o+"").length-1))),t)}return _o(e,t)}var Gf=gs((function(e,t,n){return t=t.toLowerCase(),e+(n?Yf(t):t)}));function Yf(e){return Eh(ef(e).toLowerCase())}function Qf(e){return(e=ef(e))&&e.replace(Je,Vn).replace(Tt,"")}function Jf(e,t,n){e=ef(e),t=Lo(t);var i=e.length,o=n=n===r?i:vi(Yl(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t}function Xf(e){return(e=ef(e))&&Re.test(e)?e.replace(Ie,Wn):e}function Zf(e){return(e=ef(e))&&Le.test(e)?e.replace(Me,"\\$&"):e}var eh=gs((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),th=gs((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),nh=ps("toLowerCase");function rh(e,t,n){e=ef(e);var r=(t=Yl(t))?or(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Os(Ut(i),n)+e+Os(jt(i),n)}function ih(e,t,n){e=ef(e);var r=(t=Yl(t))?or(e):0;return t&&r<t?e+Os(t-r,n):e}function oh(e,t,n){e=ef(e);var r=(t=Yl(t))?or(e):0;return t&&r<t?Os(t-r,n)+e:e}function sh(e,t,n){return n||null==t?t=0:t&&(t=+t),en(ef(e).replace(je,""),t||0)}function ah(e,t,n){return t=(n?ua(e,t,n):t===r)?1:Yl(t),wo(ef(e),t)}function uh(){var e=arguments,t=ef(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var ch=gs((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));function lh(e,t,n){return n&&"number"!=typeof n&&ua(e,t,n)&&(t=n=r),(n=n===r?D:n>>>0)?(e=ef(e))&&("string"==typeof t||null!=t&&!jl(t))&&!(t=Lo(t))&&Yn(e)?Ko(sr(e),0,n):e.split(t,n):[]}var fh=gs((function(e,t,n){return e+(n?" ":"")+Eh(t)}));function hh(e,t,n){return e=ef(e),n=null==n?0:vi(Yl(n),0,e.length),t=Lo(t),e.slice(n,n+t.length)==t}function dh(e,t,n){var i=Or.templateSettings;n&&ua(e,t,n)&&(t=r),e=ef(e),t=rf({},t,i,Ts);var o,s,a=rf({},t.imports,i.imports,Ts),c=Of(a),l=Fn(a,c),f=0,h=t.interpolate||Xe,d="__p += '",p=it((t.escape||Xe).source+"|"+h.source+"|"+(h===Pe?$e:Xe).source+"|"+(t.evaluate||Xe).source+"|$","g"),g="//# sourceURL="+(ht.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++zt+"]")+"\n";e.replace(p,(function(t,n,r,i,a,u){return r||(r=i),d+=e.slice(f,u).replace(Ze,Kn),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),a&&(s=!0,d+="';\n"+a+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),f=u+t.length,t})),d+="';\n";var y=ht.call(t,"variable")&&t.variable;if(y){if(He.test(y))throw new et(u)}else d="with (obj) {\n"+d+"\n}\n";d=(s?d.replace(we,""):d).replace(Ee,"$1").replace(Se,"$1;"),d="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var v=Oh((function(){return tt(c,g+"return "+d).apply(r,l)}));if(v.source=d,bl(v))throw v;return v}function ph(e){return ef(e).toLowerCase()}function gh(e){return ef(e).toUpperCase()}function yh(e,t,n){if((e=ef(e))&&(n||t===r))return Dn(e);if(!e||!(t=Lo(t)))return e;var i=sr(e),o=sr(t);return Ko(i,Hn(i,o),qn(i,o)+1).join("")}function vh(e,t,n){if((e=ef(e))&&(n||t===r))return e.slice(0,ar(e)+1);if(!e||!(t=Lo(t)))return e;var i=sr(e);return Ko(i,0,qn(i,sr(t))+1).join("")}function mh(e,t,n){if((e=ef(e))&&(n||t===r))return e.replace(je,"");if(!e||!(t=Lo(t)))return e;var i=sr(e);return Ko(i,Hn(i,sr(t))).join("")}function _h(e,t){var n=R,i=k;if(Il(t)){var o="separator"in t?t.separator:o;n="length"in t?Yl(t.length):n,i="omission"in t?Lo(t.omission):i}var s=(e=ef(e)).length;if(Yn(e)){var a=sr(e);s=a.length}if(n>=s)return e;var u=n-or(i);if(u<1)return i;var c=a?Ko(a,0,u).join(""):e.slice(0,u);if(o===r)return c+i;if(a&&(u+=c.length-u),jl(o)){if(e.slice(u).search(o)){var l,f=c;for(o.global||(o=it(o.source,ef(Ve.exec(o))+"g")),o.lastIndex=0;l=o.exec(f);)var h=l.index;c=c.slice(0,h===r?u:h)}}else if(e.indexOf(Lo(o),u)!=u){var d=c.lastIndexOf(o);d>-1&&(c=c.slice(0,d))}return c+i}function bh(e){return(e=ef(e))&&xe.test(e)?e.replace(Oe,ur):e}var wh=gs((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Eh=ps("toUpperCase");function Sh(e,t,n){return e=ef(e),(t=n?r:t)===r?Qn(e)?fr(e):On(e):e.match(t)||[]}var Oh=Eo((function(e,t){try{return cn(e,r,t)}catch(e){return bl(e)?e:new et(e)}})),Ih=zs((function(e,t){return fn(t,(function(t){t=Na(t),gi(e,t,Tc(e[t],e))})),e}));function xh(e){var t=null==e?0:e.length,n=Vs();return e=t?vn(e,(function(e){if("function"!=typeof e[1])throw new st(a);return[n(e[0]),e[1]]})):[],Eo((function(n){for(var r=-1;++r<t;){var i=e[r];if(cn(i[0],this,n))return cn(i[1],this,n)}}))}function Rh(e){return _i(mi(e,h))}function kh(e){return function(){return e}}function Ch(e,t){return null==e||e!=e?t:e}var Ph=_s(),Ah=_s(!0);function Nh(e){return e}function Th(e){return no("function"==typeof e?e:mi(e,h))}function Mh(e){return ao(mi(e,h))}function Lh(e,t){return uo(e,mi(t,h))}var jh=Eo((function(e,t){return function(n){return $i(n,e,t)}})),Uh=Eo((function(e,t){return function(n){return $i(e,n,t)}}));function Dh(e,t,n){var r=Of(t),i=Mi(t,r);null==n&&(!Il(t)||!i.length&&r.length)&&(n=t,t=e,e=this,i=Mi(t,Of(t)));var o=!(Il(n)&&"chain"in n&&!n.chain),s=El(e);return fn(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=os(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,mn([this.value()],arguments))})})),e}function zh(){return Qt._===this&&(Qt._=vt),this}function Fh(){}function Bh(e){return e=Yl(e),Eo((function(t){return fo(t,e)}))}var Hh=Ss(vn),qh=Ss(dn),$h=Ss(wn);function Vh(e){return ca(e)?An(Na(e)):yo(e)}function Wh(e){return function(t){return null==e?r:Li(e,t)}}var Kh=xs(),Gh=xs(!0);function Yh(){return[]}function Qh(){return!1}function Jh(){return{}}function Xh(){return""}function Zh(){return!0}function ed(e,t){if((e=Yl(e))<1||e>L)return[];var n=D,r=Jt(e,D);t=Vs(t),e-=D;for(var i=jn(r,t);++n<e;)t(n);return i}function td(e){return cl(e)?vn(e,Na):Fl(e)?[e]:os(Aa(ef(e)))}function nd(e){var t=++dt;return ef(e)+t}var rd=Es((function(e,t){return e+t}),0),id=Cs("ceil"),od=Es((function(e,t){return e/t}),1),sd=Cs("floor");function ad(e){return e&&e.length?xi(e,Nh,Di):r}function ud(e,t){return e&&e.length?xi(e,Vs(t,2),Di):r}function cd(e){return Pn(e,Nh)}function ld(e,t){return Pn(e,Vs(t,2))}function fd(e){return e&&e.length?xi(e,Nh,oo):r}function hd(e,t){return e&&e.length?xi(e,Vs(t,2),oo):r}var dd=Es((function(e,t){return e*t}),1),pd=Cs("round"),gd=Es((function(e,t){return e-t}),0);function yd(e){return e&&e.length?Ln(e,Nh):0}function vd(e,t){return e&&e.length?Ln(e,Vs(t,2)):0}return Or.after=Pc,Or.ary=Ac,Or.assign=tf,Or.assignIn=nf,Or.assignInWith=rf,Or.assignWith=of,Or.at=sf,Or.before=Nc,Or.bind=Tc,Or.bindAll=Ih,Or.bindKey=Mc,Or.castArray=Zc,Or.chain=Wu,Or.chunk=ja,Or.compact=Ua,Or.concat=Da,Or.cond=xh,Or.conforms=Rh,Or.constant=kh,Or.countBy=rc,Or.create=af,Or.curry=Lc,Or.curryRight=jc,Or.debounce=Uc,Or.defaults=uf,Or.defaultsDeep=cf,Or.defer=Dc,Or.delay=zc,Or.difference=za,Or.differenceBy=Fa,Or.differenceWith=Ba,Or.drop=Ha,Or.dropRight=qa,Or.dropRightWhile=$a,Or.dropWhile=Va,Or.fill=Wa,Or.filter=oc,Or.flatMap=uc,Or.flatMapDeep=cc,Or.flatMapDepth=lc,Or.flatten=Ya,Or.flattenDeep=Qa,Or.flattenDepth=Ja,Or.flip=Fc,Or.flow=Ph,Or.flowRight=Ah,Or.fromPairs=Xa,Or.functions=yf,Or.functionsIn=vf,Or.groupBy=dc,Or.initial=tu,Or.intersection=nu,Or.intersectionBy=ru,Or.intersectionWith=iu,Or.invert=wf,Or.invertBy=Ef,Or.invokeMap=gc,Or.iteratee=Th,Or.keyBy=yc,Or.keys=Of,Or.keysIn=If,Or.map=vc,Or.mapKeys=xf,Or.mapValues=Rf,Or.matches=Mh,Or.matchesProperty=Lh,Or.memoize=Bc,Or.merge=kf,Or.mergeWith=Cf,Or.method=jh,Or.methodOf=Uh,Or.mixin=Dh,Or.negate=Hc,Or.nthArg=Bh,Or.omit=Pf,Or.omitBy=Af,Or.once=qc,Or.orderBy=mc,Or.over=Hh,Or.overArgs=$c,Or.overEvery=qh,Or.overSome=$h,Or.partial=Vc,Or.partialRight=Wc,Or.partition=_c,Or.pick=Nf,Or.pickBy=Tf,Or.property=Vh,Or.propertyOf=Wh,Or.pull=cu,Or.pullAll=lu,Or.pullAllBy=fu,Or.pullAllWith=hu,Or.pullAt=du,Or.range=Kh,Or.rangeRight=Gh,Or.rearg=Kc,Or.reject=Ec,Or.remove=pu,Or.rest=Gc,Or.reverse=gu,Or.sampleSize=Oc,Or.set=Lf,Or.setWith=jf,Or.shuffle=Ic,Or.slice=yu,Or.sortBy=kc,Or.sortedUniq=Su,Or.sortedUniqBy=Ou,Or.split=lh,Or.spread=Yc,Or.tail=Iu,Or.take=xu,Or.takeRight=Ru,Or.takeRightWhile=ku,Or.takeWhile=Cu,Or.tap=Ku,Or.throttle=Qc,Or.thru=Gu,Or.toArray=Kl,Or.toPairs=Uf,Or.toPairsIn=Df,Or.toPath=td,Or.toPlainObject=Xl,Or.transform=zf,Or.unary=Jc,Or.union=Pu,Or.unionBy=Au,Or.unionWith=Nu,Or.uniq=Tu,Or.uniqBy=Mu,Or.uniqWith=Lu,Or.unset=Ff,Or.unzip=ju,Or.unzipWith=Uu,Or.update=Bf,Or.updateWith=Hf,Or.values=qf,Or.valuesIn=$f,Or.without=Du,Or.words=Sh,Or.wrap=Xc,Or.xor=zu,Or.xorBy=Fu,Or.xorWith=Bu,Or.zip=Hu,Or.zipObject=qu,Or.zipObjectDeep=$u,Or.zipWith=Vu,Or.entries=Uf,Or.entriesIn=Df,Or.extend=nf,Or.extendWith=rf,Dh(Or,Or),Or.add=rd,Or.attempt=Oh,Or.camelCase=Gf,Or.capitalize=Yf,Or.ceil=id,Or.clamp=Vf,Or.clone=el,Or.cloneDeep=nl,Or.cloneDeepWith=rl,Or.cloneWith=tl,Or.conformsTo=il,Or.deburr=Qf,Or.defaultTo=Ch,Or.divide=od,Or.endsWith=Jf,Or.eq=ol,Or.escape=Xf,Or.escapeRegExp=Zf,Or.every=ic,Or.find=sc,Or.findIndex=Ka,Or.findKey=lf,Or.findLast=ac,Or.findLastIndex=Ga,Or.findLastKey=ff,Or.floor=sd,Or.forEach=fc,Or.forEachRight=hc,Or.forIn=hf,Or.forInRight=df,Or.forOwn=pf,Or.forOwnRight=gf,Or.get=mf,Or.gt=sl,Or.gte=al,Or.has=_f,Or.hasIn=bf,Or.head=Za,Or.identity=Nh,Or.includes=pc,Or.indexOf=eu,Or.inRange=Wf,Or.invoke=Sf,Or.isArguments=ul,Or.isArray=cl,Or.isArrayBuffer=ll,Or.isArrayLike=fl,Or.isArrayLikeObject=hl,Or.isBoolean=dl,Or.isBuffer=pl,Or.isDate=gl,Or.isElement=yl,Or.isEmpty=vl,Or.isEqual=ml,Or.isEqualWith=_l,Or.isError=bl,Or.isFinite=wl,Or.isFunction=El,Or.isInteger=Sl,Or.isLength=Ol,Or.isMap=Rl,Or.isMatch=kl,Or.isMatchWith=Cl,Or.isNaN=Pl,Or.isNative=Al,Or.isNil=Tl,Or.isNull=Nl,Or.isNumber=Ml,Or.isObject=Il,Or.isObjectLike=xl,Or.isPlainObject=Ll,Or.isRegExp=jl,Or.isSafeInteger=Ul,Or.isSet=Dl,Or.isString=zl,Or.isSymbol=Fl,Or.isTypedArray=Bl,Or.isUndefined=Hl,Or.isWeakMap=ql,Or.isWeakSet=$l,Or.join=ou,Or.kebabCase=eh,Or.last=su,Or.lastIndexOf=au,Or.lowerCase=th,Or.lowerFirst=nh,Or.lt=Vl,Or.lte=Wl,Or.max=ad,Or.maxBy=ud,Or.mean=cd,Or.meanBy=ld,Or.min=fd,Or.minBy=hd,Or.stubArray=Yh,Or.stubFalse=Qh,Or.stubObject=Jh,Or.stubString=Xh,Or.stubTrue=Zh,Or.multiply=dd,Or.nth=uu,Or.noConflict=zh,Or.noop=Fh,Or.now=Cc,Or.pad=rh,Or.padEnd=ih,Or.padStart=oh,Or.parseInt=sh,Or.random=Kf,Or.reduce=bc,Or.reduceRight=wc,Or.repeat=ah,Or.replace=uh,Or.result=Mf,Or.round=pd,Or.runInContext=e,Or.sample=Sc,Or.size=xc,Or.snakeCase=ch,Or.some=Rc,Or.sortedIndex=vu,Or.sortedIndexBy=mu,Or.sortedIndexOf=_u,Or.sortedLastIndex=bu,Or.sortedLastIndexBy=wu,Or.sortedLastIndexOf=Eu,Or.startCase=fh,Or.startsWith=hh,Or.subtract=gd,Or.sum=yd,Or.sumBy=vd,Or.template=dh,Or.times=ed,Or.toFinite=Gl,Or.toInteger=Yl,Or.toLength=Ql,Or.toLower=ph,Or.toNumber=Jl,Or.toSafeInteger=Zl,Or.toString=ef,Or.toUpper=gh,Or.trim=yh,Or.trimEnd=vh,Or.trimStart=mh,Or.truncate=_h,Or.unescape=bh,Or.uniqueId=nd,Or.upperCase=wh,Or.upperFirst=Eh,Or.each=fc,Or.eachRight=hc,Or.first=Za,Dh(Or,function(){var e={};return Ni(Or,(function(t,n){ht.call(Or.prototype,n)||(e[n]=t)})),e}(),{chain:!1}),Or.VERSION=i,fn(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Or[e].placeholder=Or})),fn(["drop","take"],(function(e,t){kr.prototype[e]=function(n){n=n===r?1:Yt(Yl(n),0);var i=this.__filtered__&&!t?new kr(this):this.clone();return i.__filtered__?i.__takeCount__=Jt(n,i.__takeCount__):i.__views__.push({size:Jt(n,D),type:e+(i.__dir__<0?"Right":"")}),i},kr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),fn(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=n==A||n==T;kr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Vs(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),fn(["head","last"],(function(e,t){var n="take"+(t?"Right":"");kr.prototype[e]=function(){return this[n](1).value()[0]}})),fn(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");kr.prototype[e]=function(){return this.__filtered__?new kr(this):this[n](1)}})),kr.prototype.compact=function(){return this.filter(Nh)},kr.prototype.find=function(e){return this.filter(e).head()},kr.prototype.findLast=function(e){return this.reverse().find(e)},kr.prototype.invokeMap=Eo((function(e,t){return"function"==typeof e?new kr(this):this.map((function(n){return $i(n,e,t)}))})),kr.prototype.reject=function(e){return this.filter(Hc(Vs(e)))},kr.prototype.slice=function(e,t){e=Yl(e);var n=this;return n.__filtered__&&(e>0||t<0)?new kr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=Yl(t))<0?n.dropRight(-t):n.take(t-e)),n)},kr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},kr.prototype.toArray=function(){return this.take(D)},Ni(kr.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Or[i?"take"+("last"==t?"Right":""):t],s=i||/^find/.test(t);o&&(Or.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,u=t instanceof kr,c=a[0],l=u||cl(t),f=function(e){var t=o.apply(Or,mn([e],a));return i&&h?t[0]:t};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var h=this.__chain__,d=!!this.__actions__.length,p=s&&!h,g=u&&!d;if(!s&&l){t=g?t:new kr(this);var y=e.apply(t,a);return y.__actions__.push({func:Gu,args:[f],thisArg:r}),new Rr(y,h)}return p&&g?e.apply(this,a):(y=this.thru(f),p?i?y.value()[0]:y.value():y)})})),fn(["pop","push","shift","sort","splice","unshift"],(function(e){var t=at[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Or.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(cl(i)?i:[],e)}return this[n]((function(n){return t.apply(cl(n)?n:[],e)}))}})),Ni(kr.prototype,(function(e,t){var n=Or[t];if(n){var r=n.name+"";ht.call(gr,r)||(gr[r]=[]),gr[r].push({name:t,func:n})}})),gr[bs(r,m).name]=[{name:"wrapper",func:r}],kr.prototype.clone=Cr,kr.prototype.reverse=Pr,kr.prototype.value=Ar,Or.prototype.at=Yu,Or.prototype.chain=Qu,Or.prototype.commit=Ju,Or.prototype.next=Xu,Or.prototype.plant=ec,Or.prototype.reverse=tc,Or.prototype.toJSON=Or.prototype.valueOf=Or.prototype.value=nc,Or.prototype.first=Or.prototype.head,kt&&(Or.prototype[kt]=Zu),Or},dr=hr();Xt?((Xt.exports=dr)._=dr,Jt._=dr):Qt._=dr}).call(t)}(Hg,Hg.exports);var qg=Object.defineProperty,$g=Object.defineProperties,Vg=Object.getOwnPropertyDescriptors,Wg=Object.getOwnPropertySymbols,Kg=Object.prototype.hasOwnProperty,Gg=Object.prototype.propertyIsEnumerable,Yg=(e,t,n)=>t in e?qg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qg=(e,t)=>{for(var n in t||(t={}))Kg.call(t,n)&&Yg(e,n,t[n]);if(Wg)for(var n of Wg(t))Gg.call(t,n)&&Yg(e,n,t[n]);return e},Jg=(e,t)=>$g(e,Vg(t));function Xg(e,t,n){var r;const i=za(e);return(null==(r=t.rpcMap)?void 0:r[i.reference])||`${Fg}?chainId=${i.namespace}:${i.reference}&projectId=${n}`}function Zg(e){return e.includes(":")?e.split(":")[1]:e}function ey(e){return e.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))}function ty(e,t){const n=Object.keys(t.namespaces).filter((t=>t.includes(e)));if(!n.length)return[];const r=[];return n.forEach((e=>{const n=t.namespaces[e].accounts;r.push(...n)})),r}function ny(e={},t={}){const n=ry(e),r=ry(t);return Hg.exports.merge(n,r)}function ry(e){var t,n,r,i;const o={};if(!mc(e))return o;for(const[s,a]of Object.entries(e)){const e=fc(s)?[s]:a.chains,u=a.methods||[],c=a.events||[],l=a.rpcMap||{},f=hc(s);o[f]=Jg(Qg(Qg({},o[f]),a),{chains:qu(e,null==(t=o[f])?void 0:t.chains),methods:qu(u,null==(n=o[f])?void 0:n.methods),events:qu(c,null==(r=o[f])?void 0:r.events),rpcMap:Qg(Qg({},l),null==(i=o[f])?void 0:i.rpcMap)})}return o}function iy(e){return e.includes(":")?e.split(":")[2]:e}function oy(e){const t={};for(const[n,r]of Object.entries(e)){const e=r.methods||[],i=r.events||[],o=r.accounts||[],s=fc(n)?[n]:r.chains?r.chains:ey(r.accounts);t[n]={chains:s,methods:e,events:i,accounts:o}}return t}function sy(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):e.includes(":")?Number(e.split(":")[1]):Number(e)}const ay={},uy=e=>ay[e],cy=(e,t)=>{ay[e]=t};var ly={exports:{}};!function(e,n){var r,i=typeof self<"u"?self:t,o=function(){function e(){this.fetch=!1,this.DOMException=i.DOMException}return e.prototype=i,new e}();r=o,function(e){var t={searchParams:"URLSearchParams"in r,iterable:"Symbol"in r&&"iterator"in Symbol,blob:"FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in r,arrayBuffer:"ArrayBuffer"in r};function n(e){return e&&DataView.prototype.isPrototypeOf(e)}if(t.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function u(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(n[Symbol.iterator]=function(){return n}),n}function c(e){this.map={},e instanceof c?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function l(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function h(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function d(e){var t=new FileReader,n=f(t);return t.readAsText(e),n}function p(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(e){this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:t.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:t.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():t.arrayBuffer&&t.blob&&n(e)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):t.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||o(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=l(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var e=l(this);if(e)return e;if(this._bodyBlob)return d(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(p(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},t.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(e,t){e=s(e),t=a(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},c.prototype.delete=function(e){delete this.map[s(e)]},c.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},c.prototype.set=function(e,t){this.map[s(e)]=a(t)},c.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},c.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),u(e)},c.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),u(e)},c.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),u(e)},t.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(e){var t=e.toUpperCase();return v.indexOf(t)>-1?t:e}function _(e,t){var n=(t=t||{}).body;if(e instanceof _){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!n&&null!=e._bodyInit&&(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new c(t.headers)),this.method=m(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function w(e){var t=new c;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function E(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},y.call(_.prototype),y.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},E.error=function(){var e=new E(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];E.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new E(null,{status:t,headers:{location:e}})},e.DOMException=r.DOMException;try{new e.DOMException}catch{e.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function O(n,r){return new Promise((function(i,o){var s=new _(n,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:w(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;i(new E(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&t.blob&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(typeof s._bodyInit>"u"?null:s._bodyInit)}))}O.polyfill=!0,r.fetch||(r.fetch=O,r.Headers=c,r.Request=_,r.Response=E),e.Headers=c,e.Request=_,e.Response=E,e.fetch=O,Object.defineProperty(e,"__esModule",{value:!0})}({}),o.fetch.ponyfill=!0,delete o.fetch.polyfill;var s=o;(n=s.fetch).default=s.fetch,n.fetch=s.fetch,n.Headers=s.Headers,n.Request=s.Request,n.Response=s.Response,e.exports=n}(ly,ly.exports);var fy=n(ly.exports);const hy={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},dy=10;class py{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new o.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!hf(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e,t){this.isAvailable||await this.register();try{const t=ue(e),n=await(await fy(this.url,Object.assign(Object.assign({},hy),{body:t}))).json();this.onPayload({data:n})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!hf(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return t(new Error("HTTP connection is missing or invalid"));e()}))}))}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=ue({id:1,jsonrpc:"2.0",method:"test",params:[]});await fy(e,Object.assign(Object.assign({},hy),{body:t}))}this.onOpen()}catch(e){const t=this.parseError(e);throw this.events.emit("register_error",t),this.onClose(),t}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?ae(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=nf(e,n.message||n.toString());this.events.emit("payload",r)}parseError(e,t=this.url){return _l(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>dy&&this.events.setMaxListeners(dy)}}class gy{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=uy("events"),this.client=uy("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Bg.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=Zg(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Xg(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new bf(new py(n,uy("disableProviderPing")))}}class yy{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=uy("events"),this.client=uy("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(Bg.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const n=t||Xg(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new bf(new py(n,uy("disableProviderPing")))}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=parseInt(Zg(t));e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,n;let r=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0";r=r.startsWith("0x")?r:`0x${r}`;const i=parseInt(r,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else{if(!this.namespace.methods.includes("wallet_switchEthereumChain"))throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:r}]},chainId:null==(n=this.namespace.chains)?void 0:n[0]}),this.setDefaultChain(`${i}`)}return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}}class vy{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=uy("events"),this.client=uy("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Bg.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=Zg(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Xg(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new bf(new py(n,uy("disableProviderPing")))}}class my{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=uy("events"),this.client=uy("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Bg.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=Zg(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Xg(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new bf(new py(n,uy("disableProviderPing")))}}class _y{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=uy("events"),this.client=uy("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Bg.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{const n=this.getCardanoRPCUrl(t),r=Zg(t);e[r]=this.createHttpProvider(r,n)})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new bf(new py(n,uy("disableProviderPing")))}}class by{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=uy("events"),this.client=uy("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Bg.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=Zg(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Xg(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new bf(new py(n,uy("disableProviderPing")))}}class wy{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=uy("events"),this.client=uy("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Bg.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=Zg(t);e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Xg(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new bf(new py(n,uy("disableProviderPing")))}}class Ey{constructor(e){this.name="near",this.namespace=e.namespace,this.events=uy("events"),this.client=uy("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const n=t||Xg(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Bg.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;e[t]=this.createHttpProvider(t,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Xg(e,this.namespace);return typeof n>"u"?void 0:new bf(new py(n,uy("disableProviderPing")))}}var Sy=Object.defineProperty,Oy=Object.defineProperties,Iy=Object.getOwnPropertyDescriptors,xy=Object.getOwnPropertySymbols,Ry=Object.prototype.hasOwnProperty,ky=Object.prototype.propertyIsEnumerable,Cy=(e,t,n)=>t in e?Sy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Py=(e,t)=>{for(var n in t||(t={}))Ry.call(t,n)&&Cy(e,n,t[n]);if(xy)for(var n of xy(t))ky.call(t,n)&&Cy(e,n,t[n]);return e},Ay=(e,t)=>Oy(e,Iy(t));class Ny{constructor(e){this.events=new o.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:hn.pino(hn.getDefaultLoggerOptions({level:e?.logger||Ug})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new Ny(e);return await t.initialize(),t}async request(e,t){const[n,r]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:Py({},e),chainId:`${n}:${r}`,topic:this.session.topic})}sendAsync(e,t,n){const r=(new Date).getTime();this.request(e,n).then((e=>t(null,tf(r,e)))).catch((e=>t(e,void 0)))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:yc("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:r}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await r().then((e=>{this.session=e,this.namespaces||(this.namespaces=oy(e.namespaces),this.persist("namespaces",this.namespaces))})).catch((e=>{if(e.message!==pg)throw e;t++}))}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[n,r]=this.validateChain(e);this.getProvider(n).setDefaultChain(r,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(vc(t)){for(const n of t)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await jg.init({logger:this.providerOpts.logger||Ug,relayUrl:this.providerOpts.relayUrl||Dg,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map((e=>hc(e))))];cy("client",this.client),cy("events",this.events),cy("disableProviderPing",this.disableProviderPing),e.forEach((e=>{if(!this.session)return;const t=ty(e,this.session),n=ey(t),r=ny(this.namespaces,this.optionalNamespaces),i=Ay(Py({},r[e]),{accounts:t,chains:n});switch(e){case"eip155":this.rpcProviders[e]=new yy({namespace:i});break;case"solana":this.rpcProviders[e]=new vy({namespace:i});break;case"cosmos":this.rpcProviders[e]=new my({namespace:i});break;case"polkadot":this.rpcProviders[e]=new gy({namespace:i});break;case"cip34":this.rpcProviders[e]=new _y({namespace:i});break;case"elrond":this.rpcProviders[e]=new by({namespace:i});break;case"multiversx":this.rpcProviders[e]=new wy({namespace:i});break;case"near":this.rpcProviders[e]=new Ey({namespace:i})}}))}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",(e=>{this.events.emit("session_ping",e)})),this.client.on("session_event",(e=>{const{params:t}=e,{event:n}=t;if("accountsChanged"===n.name){const e=n.data;e&&vc(e)&&this.events.emit("accountsChanged",e.map(iy))}else if("chainChanged"===n.name){const e=t.chainId,n=t.event.data,r=hc(e),i=sy(e)!==sy(n)?`${r}:${sy(n)}`:e;this.onChainChanged(i)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)})),this.client.on("session_update",(({topic:e,params:t})=>{var n;const{namespaces:r}=t,i=null==(n=this.client)?void 0:n.session.get(e);this.session=Ay(Py({},i),{namespaces:r}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})})),this.client.on("session_delete",(async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Ay(Py({},yc("USER_DISCONNECTED")),{data:e.topic}))})),this.on(Bg.DEFAULT_CHAIN_CHANGED,(e=>{this.onChainChanged(e,!0)}))}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach((e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])}))}setNamespaces(e){const{namespaces:t,optionalNamespaces:n,sessionProperties:r}=e;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=r,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(e){const[t,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map((e=>hc(e))).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const r=hc(Object.keys(this.namespaces)[0]);return[r,this.rpcProviders[r].getDefaultChain()]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){var n;if(!this.namespaces)return;const[r,i]=this.validateChain(e);t||this.getProvider(r).setDefaultChain(i),(null!=(n=this.namespaces[r])?n:this.namespaces[`${r}:${i}`]).defaultChain=i,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${zg}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${zg}/${e}`)}}const Ty=Ny;e.UniversalProvider=Ty,e.default=Ny,Object.defineProperty(e,"__esModule",{value:!0})}(t)}(0,zc.exports);const Fc=["eth_sendTransaction","personal_sign"],Bc=["chainChanged","accountsChanged"];function Hc(e){return Number(e[0].split(":")[1])}function qc(e){return`0x${e.toString(16)}`}class $c{constructor(){this.events=new oa.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY="wc@2:ethereum_provider:",this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static init(e){return c(this,void 0,void 0,(function*(){const t=new $c;return yield t.initialize(e),t}))}request(e){return c(this,void 0,void 0,(function*(){return yield this.signer.request(e,this.formatChainId(this.chainId))}))}sendAsync(e,t){this.signer.sendAsync(e,t,this.formatChainId(this.chainId))}get connected(){return!!this.signer.client&&this.signer.client.core.relayer.connected}get connecting(){return!!this.signer.client&&this.signer.client.core.relayer.connecting}enable(){return c(this,void 0,void 0,(function*(){this.session||(yield this.connect());return yield this.request({method:"eth_requestAccounts"})}))}connect(e){return c(this,void 0,void 0,(function*(){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:n}=function(e){const{chains:t,optionalChains:n,methods:r,optionalMethods:i,events:o,optionalEvents:s,rpcMap:a}=e;if(!jc(t))throw new Error("Invalid chains");const u=t,c=r||Fc,l=o||Bc,f={chains:u,methods:c,events:l,rpcMap:{[Hc(u)]:a[Hc(u)]}},h=null==o?void 0:o.filter((e=>!Bc.includes(e))),d=null==r?void 0:r.filter((e=>!Fc.includes(e)));if(!(n||s||i||(null==h?void 0:h.length)||(null==d?void 0:d.length)))return{required:f};const p=(null==h?void 0:h.length)&&(null==d?void 0:d.length)||!n;return{required:f,optional:{chains:[...new Set(p?u.concat(n||[]):n)],methods:[...new Set(c.concat(i||[]))],events:[...new Set(l.concat(s||[]))],rpcMap:a}}}(this.rpc);try{const r=yield new Promise(((r,i)=>c(this,void 0,void 0,(function*(){yield this.signer.connect(Object.assign(Object.assign({namespaces:{[this.namespace]:t}},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:null==e?void 0:e.pairingTopic,skipPairing:!1})).then((e=>{r(e)})).catch((e=>{i(new Error(e.message))}))}))));if(!r)return;this.setChainIds(this.rpc.chains);const i=function(e,t=[]){const n=[];return Object.keys(e).forEach((r=>{if(t.length&&!t.includes(r))return;const i=e[r];n.push(...i.accounts)})),n}(r.namespaces,[this.namespace]);this.setAccounts(i),this.events.emit("connect",{chainId:qc(this.chainId)})}catch(e){throw this.signer.logger.error(e),e}}))}disconnect(){return c(this,void 0,void 0,(function*(){this.session&&(yield this.signer.disconnect()),this.reset()}))}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",(e=>{const{params:t}=e,{event:n}=t;"accountsChanged"===n.name?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):"chainChanged"===n.name?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)})),this.signer.on("chainChanged",(e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",qc(this.chainId)),this.persist()})),this.signer.on("session_update",(e=>{this.events.emit("session_update",e)})),this.signer.on("session_delete",(e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",Object.assign(Object.assign({},function(e,t){const{message:n,code:r}=Lc[e];return{message:t?`${n} ${t}`:n,code:r}}("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))})),this.signer.on("display_uri",(e=>{this.events.emit("display_uri",e)}))}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return"string"==typeof e&&e.startsWith(`${this.namespace}:`)}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter((e=>this.isCompatibleChainId(e))),n=t.map((e=>this.parseChainId(e)));n.length&&(this.chainId=n[0],this.events.emit("chainChanged",qc(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,n,r]=e.split(":");return{chainId:`${t}:${n}`,address:r}}setAccounts(e){this.accounts=e.filter((e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId)).map((e=>this.parseAccountId(e).address)),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t;return{chains:(null===(t=e.chains)||void 0===t?void 0:t.map((e=>this.formatChainId(e))))||[`${this.namespace}:1`],optionalChains:e.optionalChains?e.optionalChains.map((e=>this.formatChainId(e))):void 0,methods:(null==e?void 0:e.methods)||Fc,events:(null==e?void 0:e.events)||Bc,optionalMethods:(null==e?void 0:e.optionalMethods)||[],optionalEvents:(null==e?void 0:e.optionalEvents)||[],rpcMap:(null==e?void 0:e.rpcMap)||this.buildRpcMap(e.chains.concat(e.optionalChains||[]),e.projectId),projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const n={};return e.forEach((e=>{n[e]=this.getRpcUrl(e,t)})),n}initialize(e){return c(this,void 0,void 0,(function*(){this.rpc=this.getRpcConfig(e),this.chainId=Hc(this.rpc.chains),this.signer=yield zc.exports.UniversalProvider.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),yield this.loadPersistedSession()}))}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:n,rpcMap:r}=e;t&&jc(t)&&(this.rpc.chains=t.map((e=>this.formatChainId(e))),t.forEach((e=>{this.rpc.rpcMap[e]=(null==r?void 0:r[e])||this.getRpcUrl(e)}))),n&&jc(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=null==n?void 0:n.map((e=>this.formatChainId(e))),n.forEach((e=>{this.rpc.rpcMap[e]=(null==r?void 0:r[e])||this.getRpcUrl(e)})))}getRpcUrl(e,t){var n;return(null===(n=this.rpc.rpcMap)||void 0===n?void 0:n[e])||`https://rpc.walletconnect.com/v1/?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}loadPersistedSession(){return c(this,void 0,void 0,(function*(){if(!this.session)return;const e=yield this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:null==t?void 0:t.accounts),this.setAccounts(null==t?void 0:t.accounts)}))}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return"string"==typeof e||e instanceof String?[this.parseAccount(e)]:e.map((e=>this.parseAccount(e)))}}const Vc=r("WalletConnectEvm"),Wc=i("WalletConnectEvm");function Kc(){return c(this,void 0,void 0,(function*(){Vc("getWalletConnectProvider");try{const e=yield function(){return c(this,void 0,void 0,(function*(){Vc("initWalletConnectProvider");const e=nl();Vc("walletConnectProviderOptions is",e);const t={projectId:e.projectId,chains:e.chains,optionalChains:e.optionalChains,methods:e.methods,optionalMethods:e.optionalMethods||[],events:e.events,optionalEvents:e.optionalEvents||[],rpcMap:e.rpcMap,relayUrl:e.relayUrl,showQrModal:!1};Vc("ethereum init options are",t),Vc("creating a new provider instance");try{return $c.init(t)}catch(e){throw Wc("Error while initializing ethereum provider"),e}}))}();return function(e){if(Vc("assignWalletConnectProviderEvents"),!e)return;function t(e){e&&(e.removeListener("connect",n),e.removeListener("session_delete",r))}function n(e){Vc("connectHandler",e),as(!1)}function r(n){Vc("disconnectHandler",n),e.disconnect(),t(e)}t(e),e.on("connect",n),e.on("session_delete",r),Vc("provider is",e)}(e),e.request=function(e){Vc("patchWalletConnectProviderRequest");const t=e.request.bind(e),n=nl();return Vc("walletConnectProviderOptions is",n),function({method:r,params:i}){return c(this,void 0,void 0,(function*(){return"eth_requestAccounts"===r?(Vc("calling patched",r,i),Vc("handling display_uri once"),e.once("display_uri",Gc),new Promise(((o,s)=>c(this,void 0,void 0,(function*(){var u,c;try{(null===(u=null==e?void 0:e.session)||void 0===u?void 0:u.connected)?(Vc("reusing existing session"),o(yield t({method:r,params:i}))):(c={uri:"",onClose:()=>{Wc("user rejected"),s(new a)}},Zs("UseLedgerLiveModal",{isDesktop:"desktop"===Js().type,uri:c.uri,onClose:c.onClose}),Vc("creating a new session"),yield e.connect({chains:n.chains,optionalChains:n.optionalChains}),o(yield t({method:r,params:i})))}catch(e){return Wc("error",e),s(e)}}))))):(Vc("calling provider",r,i),yield t({method:r,params:i}))}))}}(e),e}catch(e){const t=e instanceof Error?e:new Error(String(e));throw Wc("error",t),t}}))}function Gc(e){Vc("displayUriHandler",e),qs(e)}const Yc=r("getProvider"),Qc=[1];var Jc;let Xc;e.SupportedProviders=void 0,(e.SupportedProviders||(e.SupportedProviders={})).Ethereum="Ethereum",function(e){e.LedgerConnect="LedgerConnect",e.WalletConnect="WalletConnect"}(Jc||(Jc={}));const Zc=e=>(Yc("getHexChainId",e),"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]*$/)?e:`0x${e.toString(16)}`),el=r("supportOptions");let tl;const nl=()=>(el("getSupportOptions"),tl),rl=r("ExtensionEvm"),il="ethereum",ol="isLedgerConnect";var sl;function al(e){return("iOS"===e.os.name||"macOS"===e.os.name)&&"Safari"===e.browser.name}function ul(e){return!!sl[e]}function cl(e){return e.every(ul)}function ll(){if(rl("getEthereumProvider"),"undefined"==typeof window)throw new u;let e=window[il];if(rl("provider is",e),void 0===e||void 0===e[ol])throw new o;const t=nl(),n=Zc(t.chainId||0);return Zc(e.chainId)!=n&&(rl("chainIds are different, changing to",n),e.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})),e}!function(e){e[e.EthereumMainnet=1]="EthereumMainnet",e[e.Polygon=137]="Polygon"}(sl||(sl={}));const fl=r("support");let hl;var dl=Object.freeze({__proto__:null,link:function(e,t,n,r){var i=this;return e?((e instanceof Element?[e]:"toArray"in e?e.toArray():e).forEach((function(e){e.addEventListener("click",(function(o){var s,a,u=t instanceof Function?t(e):t,c=n instanceof Function?n(e):n,l=e.getAttribute("href")||e.getAttributeNS("http://www.w3.org/1999/xlink","href")||e.getAttribute("xlink:href")||(null===(s=e.getElementsByTagName("a")[0])||void 0===s?void 0:s.getAttribute("href")),f=Dt(i.track(u,c,null!=r?r:{}),null!==(a=i.settings.timeout)&&void 0!==a?a:500);(function(e,t){return!("_blank"!==e.target||!t)})(e,l)||function(e){var t=e;return!!(t.ctrlKey||t.shiftKey||t.metaKey||t.button&&1==t.button)}(o)||l&&(o.preventDefault?o.preventDefault():o.returnValue=!1,f.catch(console.error).then((function(){window.location.href=l})).catch(console.error))}),!1)})),this):this},form:function(e,t,n,r){var i=this;return e?(e instanceof HTMLFormElement&&(e=[e]),e.forEach((function(e){if(!(e instanceof Element))throw new TypeError("Must pass HTMLElement to trackForm/trackSubmit.");var o=function(o){var s;o.preventDefault?o.preventDefault():o.returnValue=!1;var a=t instanceof Function?t(e):t,u=n instanceof Function?n(e):n;Dt(i.track(a,u,null!=r?r:{}),null!==(s=i.settings.timeout)&&void 0!==s?s:500).catch(console.error).then((function(){e.submit()})).catch(console.error)},s=window.jQuery||window.Zepto;s?s(e).submit(o):e.addEventListener("submit",o,!1)})),this):this}});function pl(e,t){return Object.keys(t).reduce((function(n,r){r.startsWith(e)&&(n[r.substr(e.length)]=t[r]);return n}),{})}for(var gl=Object.freeze({__proto__:null,queryString:function(e,t){var n=document.createElement("a");n.href=t;var r=n.search.slice(1).split("&").reduce((function(e,t){var n=t.split("="),r=n[0],i=n[1];return e[r]=Ir(i),e}),{}),i=[],o=r.ajs_uid,s=r.ajs_event,a=r.ajs_aid,u=Mt(e.options.useQueryString)?e.options.useQueryString:{},c=u.aid,l=void 0===c?/.+/:c,f=u.uid,h=void 0===f?/.+/:f;if(a){var d=Array.isArray(r.ajs_aid)?r.ajs_aid[0]:r.ajs_aid;l.test(d)&&e.setAnonymousId(d)}if(o){var p=Array.isArray(r.ajs_uid)?r.ajs_uid[0]:r.ajs_uid;if(h.test(p)){var g=pl("ajs_trait_",r);i.push(e.identify(p,g))}}if(s){var y=Array.isArray(r.ajs_event)?r.ajs_event[0]:r.ajs_event,v=pl("ajs_prop_",r);i.push(e.track(y,v))}return Promise.all(i)}}),yl={},vl={},ml=[],_l=0;_l<64;)ml[_l]=0|4294967296*Math.sin(++_l%Math.PI);var bl=Object.freeze({__proto__:null,default:function(e){var t,n,r,i=[t=1732584193,n=4023233417,~t,~n],o=[],s=unescape(encodeURI(e))+"€",a=s.length;for(e=--a/4+2|15,o[--e]=8*a;~a;)o[a>>2]|=s.charCodeAt(a)<<8*a--;for(_l=s=0;_l<e;_l+=16){for(a=i;s<64;a=[r=a[3],t+((r=a[0]+[t&n|~t&r,r&t|~r&n,t^n^r,n^(t|~r)][a=s>>4]+ml[s]+~~o[_l|15&[s,5*s+1,3*s+5,7*s][a]])<<(a=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*a+s++%4])|r>>>-a),t,n])t=0|a[1],n=a[2];for(s=4;s;)i[--s]+=a[s]}for(e="";s<32;)e+=(i[s>>3]>>4*(1^s++)&15).toString(16);return e}}),wl=h(bl),El={exports:{}};!function(e,t){e.exports=function(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:i;return e===i?n:e}}(El);
315
315
  /**
316
316
  * @license Apache-2.0
317
317
  *
@@ -329,7 +329,7 @@ PERFORMANCE OF THIS SOFTWARE.
329
329
  * See the License for the specific language governing permissions and
330
330
  * limitations under the License.
331
331
  */
332
- var Ol=Number.POSITIVE_INFINITY,Il=Number.NEGATIVE_INFINITY;var xl=
332
+ var Sl=Number.POSITIVE_INFINITY,Ol=Number.NEGATIVE_INFINITY;var Il=
333
333
  /**
334
334
  * @license Apache-2.0
335
335
  *
@@ -347,7 +347,7 @@ var Ol=Number.POSITIVE_INFINITY,Il=Number.NEGATIVE_INFINITY;var xl=
347
347
  * See the License for the specific language governing permissions and
348
348
  * limitations under the License.
349
349
  */
350
- function(e){return e!=e},Rl=xl,kl=Ol,Cl=Il;
350
+ function(e){return e!=e},xl=Il,Rl=Sl,kl=Ol;
351
351
  /**
352
352
  * @license Apache-2.0
353
353
  *
@@ -364,7 +364,7 @@ function(e){return e!=e},Rl=xl,kl=Ol,Cl=Il;
364
364
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
365
365
  * See the License for the specific language governing permissions and
366
366
  * limitations under the License.
367
- */var Pl=function(e){return e===kl||e===Cl},Al=Pl,Nl="function"==typeof Object.defineProperty?Object.defineProperty:null;
367
+ */var Cl=function(e){return e===Rl||e===kl},Pl=Cl,Al="function"==typeof Object.defineProperty?Object.defineProperty:null;
368
368
  /**
369
369
  * @license Apache-2.0
370
370
  *
@@ -381,7 +381,7 @@ function(e){return e!=e},Rl=xl,kl=Ol,Cl=Il;
381
381
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
382
382
  * See the License for the specific language governing permissions and
383
383
  * limitations under the License.
384
- */var Tl=function(){try{return Nl({},"x",{}),!0}catch(e){return!1}},Ml=Object.defineProperty,Ll=Object.prototype,jl=Ll.toString,Ul=Ll.__defineGetter__,Dl=Ll.__defineSetter__,zl=Ll.__lookupGetter__,Fl=Ll.__lookupSetter__;
384
+ */var Nl=function(){try{return Al({},"x",{}),!0}catch(e){return!1}},Tl=Object.defineProperty,Ml=Object.prototype,Ll=Ml.toString,jl=Ml.__defineGetter__,Ul=Ml.__defineSetter__,Dl=Ml.__lookupGetter__,zl=Ml.__lookupSetter__;
385
385
  /**
386
386
  * @license Apache-2.0
387
387
  *
@@ -398,7 +398,7 @@ function(e){return e!=e},Rl=xl,kl=Ol,Cl=Il;
398
398
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
399
399
  * See the License for the specific language governing permissions and
400
400
  * limitations under the License.
401
- */var Bl=Ml,Hl=function(e,t,n){var r,i,o,s;if("object"!=typeof e||null===e||"[object Array]"===jl.call(e))throw new TypeError("invalid argument. First argument must be an object. Value: `"+e+"`.");if("object"!=typeof n||null===n||"[object Array]"===jl.call(n))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+n+"`.");if((i="value"in n)&&(zl.call(e,t)||Fl.call(e,t)?(r=e.__proto__,e.__proto__=Ll,delete e[t],e[t]=n.value,e.__proto__=r):e[t]=n.value),o="get"in n,s="set"in n,i&&(o||s))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return o&&Ul&&Ul.call(e,t,n.get),s&&Dl&&Dl.call(e,t,n.set),e},ql=Tl()?Bl:Hl;
401
+ */var Fl=Tl,Bl=function(e,t,n){var r,i,o,s;if("object"!=typeof e||null===e||"[object Array]"===Ll.call(e))throw new TypeError("invalid argument. First argument must be an object. Value: `"+e+"`.");if("object"!=typeof n||null===n||"[object Array]"===Ll.call(n))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+n+"`.");if((i="value"in n)&&(Dl.call(e,t)||zl.call(e,t)?(r=e.__proto__,e.__proto__=Ml,delete e[t],e[t]=n.value,e.__proto__=r):e[t]=n.value),o="get"in n,s="set"in n,i&&(o||s))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return o&&jl&&jl.call(e,t,n.get),s&&Ul&&Ul.call(e,t,n.set),e},Hl=Nl()?Fl:Bl;
402
402
  /**
403
403
  * @license Apache-2.0
404
404
  *
@@ -415,7 +415,7 @@ function(e){return e!=e},Rl=xl,kl=Ol,Cl=Il;
415
415
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
416
416
  * See the License for the specific language governing permissions and
417
417
  * limitations under the License.
418
- */var $l=function(e,t,n){ql(e,t,{configurable:!1,enumerable:!1,writable:!1,value:n})};
418
+ */var ql=function(e,t,n){Hl(e,t,{configurable:!1,enumerable:!1,writable:!1,value:n})};
419
419
  /**
420
420
  * @license Apache-2.0
421
421
  *
@@ -432,7 +432,7 @@ function(e){return e!=e},Rl=xl,kl=Ol,Cl=Il;
432
432
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
433
433
  * See the License for the specific language governing permissions and
434
434
  * limitations under the License.
435
- */var Vl=
435
+ */var $l=
436
436
  /**
437
437
  * @license Apache-2.0
438
438
  *
@@ -467,7 +467,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
467
467
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
468
468
  * See the License for the specific language governing permissions and
469
469
  * limitations under the License.
470
- */var Wl=function(){return Vl&&"symbol"==typeof Symbol.toStringTag},Kl=Object.prototype.toString,Gl=Kl;
470
+ */var Vl=function(){return $l&&"symbol"==typeof Symbol.toStringTag},Wl=Object.prototype.toString,Kl=Wl;
471
471
  /**
472
472
  * @license Apache-2.0
473
473
  *
@@ -484,7 +484,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
484
484
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
485
485
  * See the License for the specific language governing permissions and
486
486
  * limitations under the License.
487
- */var Yl=function(e){return Gl.call(e)},Ql=Object.prototype.hasOwnProperty;
487
+ */var Gl=function(e){return Kl.call(e)},Yl=Object.prototype.hasOwnProperty;
488
488
  /**
489
489
  * @license Apache-2.0
490
490
  *
@@ -501,7 +501,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
501
501
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
502
502
  * See the License for the specific language governing permissions and
503
503
  * limitations under the License.
504
- */var Jl=function(e,t){return null!=e&&Ql.call(e,t)},Xl="function"==typeof Symbol?Symbol.toStringTag:"",Zl=Jl,ef=Xl,tf=Kl;
504
+ */var Ql=function(e,t){return null!=e&&Yl.call(e,t)},Jl="function"==typeof Symbol?Symbol.toStringTag:"",Xl=Ql,Zl=Jl,ef=Wl;
505
505
  /**
506
506
  * @license Apache-2.0
507
507
  *
@@ -518,7 +518,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
518
518
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
519
519
  * See the License for the specific language governing permissions and
520
520
  * limitations under the License.
521
- */var nf=function(e){var t,n,r;if(null==e)return tf.call(e);n=e[ef],t=Zl(e,ef);try{e[ef]=void 0}catch(t){return tf.call(e)}return r=tf.call(e),t?e[ef]=n:delete e[ef],r},rf=Yl,of=nf,sf=Wl()?of:rf,af=sf,uf="function"==typeof Uint32Array;
521
+ */var tf=function(e){var t,n,r;if(null==e)return ef.call(e);n=e[Zl],t=Xl(e,Zl);try{e[Zl]=void 0}catch(t){return ef.call(e)}return r=ef.call(e),t?e[Zl]=n:delete e[Zl],r},nf=Gl,rf=tf,of=Vl()?rf:nf,sf=of,af="function"==typeof Uint32Array;
522
522
  /**
523
523
  * @license Apache-2.0
524
524
  *
@@ -535,7 +535,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
535
535
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
536
536
  * See the License for the specific language governing permissions and
537
537
  * limitations under the License.
538
- */var cf="function"==typeof Uint32Array?Uint32Array:null,lf=function(e){return uf&&e instanceof Uint32Array||"[object Uint32Array]"===af(e)},ff=cf;
538
+ */var uf="function"==typeof Uint32Array?Uint32Array:null,cf=function(e){return af&&e instanceof Uint32Array||"[object Uint32Array]"===sf(e)},lf=uf;
539
539
  /**
540
540
  * @license Apache-2.0
541
541
  *
@@ -552,7 +552,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
552
552
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
553
553
  * See the License for the specific language governing permissions and
554
554
  * limitations under the License.
555
- */var hf=function(){var e,t;if("function"!=typeof ff)return!1;try{t=new ff(t=[1,3.14,-3.14,4294967296,4294967297]),e=lf(t)&&1===t[0]&&3===t[1]&&4294967293===t[2]&&0===t[3]&&1===t[4]}catch(t){e=!1}return e};
555
+ */var ff=function(){var e,t;if("function"!=typeof lf)return!1;try{t=new lf(t=[1,3.14,-3.14,4294967296,4294967297]),e=cf(t)&&1===t[0]&&3===t[1]&&4294967293===t[2]&&0===t[3]&&1===t[4]}catch(t){e=!1}return e};
556
556
  /**
557
557
  * @license Apache-2.0
558
558
  *
@@ -569,7 +569,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
569
569
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
570
570
  * See the License for the specific language governing permissions and
571
571
  * limitations under the License.
572
- */var df="function"==typeof Uint32Array?Uint32Array:void 0,pf=
572
+ */var hf="function"==typeof Uint32Array?Uint32Array:void 0,df=
573
573
  /**
574
574
  * @license Apache-2.0
575
575
  *
@@ -587,7 +587,7 @@ function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();
587
587
  * See the License for the specific language governing permissions and
588
588
  * limitations under the License.
589
589
  */
590
- function(){throw new Error("not implemented")},gf=hf()?df:pf,yf=sf,vf="function"==typeof Float64Array;
590
+ function(){throw new Error("not implemented")},pf=ff()?hf:df,gf=of,yf="function"==typeof Float64Array;
591
591
  /**
592
592
  * @license Apache-2.0
593
593
  *
@@ -604,7 +604,7 @@ function(){throw new Error("not implemented")},gf=hf()?df:pf,yf=sf,vf="function"
604
604
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
605
605
  * See the License for the specific language governing permissions and
606
606
  * limitations under the License.
607
- */var mf="function"==typeof Float64Array?Float64Array:null,_f=function(e){return vf&&e instanceof Float64Array||"[object Float64Array]"===yf(e)},bf=mf;
607
+ */var vf="function"==typeof Float64Array?Float64Array:null,mf=function(e){return yf&&e instanceof Float64Array||"[object Float64Array]"===gf(e)},_f=vf;
608
608
  /**
609
609
  * @license Apache-2.0
610
610
  *
@@ -621,7 +621,7 @@ function(){throw new Error("not implemented")},gf=hf()?df:pf,yf=sf,vf="function"
621
621
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
622
622
  * See the License for the specific language governing permissions and
623
623
  * limitations under the License.
624
- */var wf=function(){var e,t;if("function"!=typeof bf)return!1;try{t=new bf([1,3.14,-3.14,NaN]),e=_f(t)&&1===t[0]&&3.14===t[1]&&-3.14===t[2]&&t[3]!=t[3]}catch(t){e=!1}return e};
624
+ */var bf=function(){var e,t;if("function"!=typeof _f)return!1;try{t=new _f([1,3.14,-3.14,NaN]),e=mf(t)&&1===t[0]&&3.14===t[1]&&-3.14===t[2]&&t[3]!=t[3]}catch(t){e=!1}return e};
625
625
  /**
626
626
  * @license Apache-2.0
627
627
  *
@@ -638,7 +638,7 @@ function(){throw new Error("not implemented")},gf=hf()?df:pf,yf=sf,vf="function"
638
638
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
639
639
  * See the License for the specific language governing permissions and
640
640
  * limitations under the License.
641
- */var Ef="function"==typeof Float64Array?Float64Array:void 0,Sf=
641
+ */var wf="function"==typeof Float64Array?Float64Array:void 0,Ef=
642
642
  /**
643
643
  * @license Apache-2.0
644
644
  *
@@ -656,7 +656,7 @@ function(){throw new Error("not implemented")},gf=hf()?df:pf,yf=sf,vf="function"
656
656
  * See the License for the specific language governing permissions and
657
657
  * limitations under the License.
658
658
  */
659
- function(){throw new Error("not implemented")},Of=wf()?Ef:Sf,If=sf,xf="function"==typeof Uint8Array;
659
+ function(){throw new Error("not implemented")},Sf=bf()?wf:Ef,Of=of,If="function"==typeof Uint8Array;
660
660
  /**
661
661
  * @license Apache-2.0
662
662
  *
@@ -673,7 +673,7 @@ function(){throw new Error("not implemented")},Of=wf()?Ef:Sf,If=sf,xf="function"
673
673
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
674
674
  * See the License for the specific language governing permissions and
675
675
  * limitations under the License.
676
- */var Rf="function"==typeof Uint8Array?Uint8Array:null,kf=function(e){return xf&&e instanceof Uint8Array||"[object Uint8Array]"===If(e)},Cf=Rf;
676
+ */var xf="function"==typeof Uint8Array?Uint8Array:null,Rf=function(e){return If&&e instanceof Uint8Array||"[object Uint8Array]"===Of(e)},kf=xf;
677
677
  /**
678
678
  * @license Apache-2.0
679
679
  *
@@ -690,7 +690,7 @@ function(){throw new Error("not implemented")},Of=wf()?Ef:Sf,If=sf,xf="function"
690
690
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
691
691
  * See the License for the specific language governing permissions and
692
692
  * limitations under the License.
693
- */var Pf=function(){var e,t;if("function"!=typeof Cf)return!1;try{t=new Cf(t=[1,3.14,-3.14,256,257]),e=kf(t)&&1===t[0]&&3===t[1]&&253===t[2]&&0===t[3]&&1===t[4]}catch(t){e=!1}return e};
693
+ */var Cf=function(){var e,t;if("function"!=typeof kf)return!1;try{t=new kf(t=[1,3.14,-3.14,256,257]),e=Rf(t)&&1===t[0]&&3===t[1]&&253===t[2]&&0===t[3]&&1===t[4]}catch(t){e=!1}return e};
694
694
  /**
695
695
  * @license Apache-2.0
696
696
  *
@@ -707,7 +707,7 @@ function(){throw new Error("not implemented")},Of=wf()?Ef:Sf,If=sf,xf="function"
707
707
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
708
708
  * See the License for the specific language governing permissions and
709
709
  * limitations under the License.
710
- */var Af="function"==typeof Uint8Array?Uint8Array:void 0,Nf=
710
+ */var Pf="function"==typeof Uint8Array?Uint8Array:void 0,Af=
711
711
  /**
712
712
  * @license Apache-2.0
713
713
  *
@@ -725,7 +725,7 @@ function(){throw new Error("not implemented")},Of=wf()?Ef:Sf,If=sf,xf="function"
725
725
  * See the License for the specific language governing permissions and
726
726
  * limitations under the License.
727
727
  */
728
- function(){throw new Error("not implemented")},Tf=Pf()?Af:Nf,Mf=sf,Lf="function"==typeof Uint16Array;
728
+ function(){throw new Error("not implemented")},Nf=Cf()?Pf:Af,Tf=of,Mf="function"==typeof Uint16Array;
729
729
  /**
730
730
  * @license Apache-2.0
731
731
  *
@@ -742,7 +742,7 @@ function(){throw new Error("not implemented")},Tf=Pf()?Af:Nf,Mf=sf,Lf="function"
742
742
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
743
743
  * See the License for the specific language governing permissions and
744
744
  * limitations under the License.
745
- */var jf="function"==typeof Uint16Array?Uint16Array:null,Uf=function(e){return Lf&&e instanceof Uint16Array||"[object Uint16Array]"===Mf(e)},Df=jf;
745
+ */var Lf="function"==typeof Uint16Array?Uint16Array:null,jf=function(e){return Mf&&e instanceof Uint16Array||"[object Uint16Array]"===Tf(e)},Uf=Lf;
746
746
  /**
747
747
  * @license Apache-2.0
748
748
  *
@@ -759,7 +759,7 @@ function(){throw new Error("not implemented")},Tf=Pf()?Af:Nf,Mf=sf,Lf="function"
759
759
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
760
760
  * See the License for the specific language governing permissions and
761
761
  * limitations under the License.
762
- */var zf=function(){var e,t;if("function"!=typeof Df)return!1;try{t=new Df(t=[1,3.14,-3.14,65536,65537]),e=Uf(t)&&1===t[0]&&3===t[1]&&65533===t[2]&&0===t[3]&&1===t[4]}catch(t){e=!1}return e};
762
+ */var Df=function(){var e,t;if("function"!=typeof Uf)return!1;try{t=new Uf(t=[1,3.14,-3.14,65536,65537]),e=jf(t)&&1===t[0]&&3===t[1]&&65533===t[2]&&0===t[3]&&1===t[4]}catch(t){e=!1}return e};
763
763
  /**
764
764
  * @license Apache-2.0
765
765
  *
@@ -776,7 +776,7 @@ function(){throw new Error("not implemented")},Tf=Pf()?Af:Nf,Mf=sf,Lf="function"
776
776
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
777
777
  * See the License for the specific language governing permissions and
778
778
  * limitations under the License.
779
- */var Ff,Bf="function"==typeof Uint16Array?Uint16Array:void 0,Hf=
779
+ */var zf,Ff="function"==typeof Uint16Array?Uint16Array:void 0,Bf=
780
780
  /**
781
781
  * @license Apache-2.0
782
782
  *
@@ -794,7 +794,7 @@ function(){throw new Error("not implemented")},Tf=Pf()?Af:Nf,Mf=sf,Lf="function"
794
794
  * See the License for the specific language governing permissions and
795
795
  * limitations under the License.
796
796
  */
797
- function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
797
+ function(){throw new Error("not implemented")},Hf={uint16:Df()?Ff:Bf,uint8:Nf};
798
798
  /**
799
799
  * @license Apache-2.0
800
800
  *
@@ -811,7 +811,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
811
811
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
812
812
  * See the License for the specific language governing permissions and
813
813
  * limitations under the License.
814
- */(Ff=new qf.uint16(1))[0]=4660;var $f,Vf,Wf=52===new qf.uint8(Ff.buffer)[0];
814
+ */(zf=new Hf.uint16(1))[0]=4660;var qf,$f,Vf=52===new Hf.uint8(zf.buffer)[0];
815
815
  /**
816
816
  * @license Apache-2.0
817
817
  *
@@ -828,7 +828,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
828
828
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
829
829
  * See the License for the specific language governing permissions and
830
830
  * limitations under the License.
831
- */!0===Wf?($f=1,Vf=0):($f=0,Vf=1);var Kf=gf,Gf={HIGH:$f,LOW:Vf},Yf=new Of(1),Qf=new Kf(Yf.buffer),Jf=Gf.HIGH,Xf=Gf.LOW;
831
+ */!0===Vf?(qf=1,$f=0):(qf=0,$f=1);var Wf=pf,Kf={HIGH:qf,LOW:$f},Gf=new Sf(1),Yf=new Wf(Gf.buffer),Qf=Kf.HIGH,Jf=Kf.LOW;
832
832
  /**
833
833
  * @license Apache-2.0
834
834
  *
@@ -845,7 +845,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
845
845
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
846
846
  * See the License for the specific language governing permissions and
847
847
  * limitations under the License.
848
- */var Zf=function(e,t,n,r){return Yf[0]=e,t[r]=Qf[Jf],t[r+n]=Qf[Xf],t},eh=Zf;
848
+ */var Xf=function(e,t,n,r){return Gf[0]=e,t[r]=Yf[Qf],t[r+n]=Yf[Jf],t},Zf=Xf;
849
849
  /**
850
850
  * @license Apache-2.0
851
851
  *
@@ -862,7 +862,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
862
862
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
863
863
  * See the License for the specific language governing permissions and
864
864
  * limitations under the License.
865
- */var th=function(e){return eh(e,[0,0],1,0)},nh=th;
865
+ */var eh=function(e){return Zf(e,[0,0],1,0)},th=eh;
866
866
  /**
867
867
  * @license Apache-2.0
868
868
  *
@@ -879,7 +879,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
879
879
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
880
880
  * See the License for the specific language governing permissions and
881
881
  * limitations under the License.
882
- */$l(nh,"assign",Zf);var rh=nh,ih=gf,oh=!0===Wf?1:0,sh=new Of(1),ah=new ih(sh.buffer);
882
+ */ql(th,"assign",Xf);var nh=th,rh=pf,ih=!0===Vf?1:0,oh=new Sf(1),sh=new rh(oh.buffer);
883
883
  /**
884
884
  * @license Apache-2.0
885
885
  *
@@ -896,7 +896,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
896
896
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
897
897
  * See the License for the specific language governing permissions and
898
898
  * limitations under the License.
899
- */var uh,ch,lh=function(e){return sh[0]=e,ah[oh]},fh=lh;
899
+ */var ah,uh,ch=function(e){return oh[0]=e,sh[ih]},lh=ch;
900
900
  /**
901
901
  * @license Apache-2.0
902
902
  *
@@ -913,7 +913,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
913
913
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
914
914
  * See the License for the specific language governing permissions and
915
915
  * limitations under the License.
916
- */!0===Wf?(uh=1,ch=0):(uh=0,ch=1);var hh=gf,dh={HIGH:uh,LOW:ch},ph=new Of(1),gh=new hh(ph.buffer),yh=dh.HIGH,vh=dh.LOW;
916
+ */!0===Vf?(ah=1,uh=0):(ah=0,uh=1);var fh=pf,hh={HIGH:ah,LOW:uh},dh=new Sf(1),ph=new fh(dh.buffer),gh=hh.HIGH,yh=hh.LOW;
917
917
  /**
918
918
  * @license Apache-2.0
919
919
  *
@@ -930,7 +930,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
930
930
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
931
931
  * See the License for the specific language governing permissions and
932
932
  * limitations under the License.
933
- */var mh=function(e,t){return gh[yh]=e,gh[vh]=t,ph[0]},_h=mh,bh=rh,wh=fh,Eh=_h,Sh=[0,0];
933
+ */var vh=function(e,t){return ph[gh]=e,ph[yh]=t,dh[0]},mh=vh,_h=nh,bh=lh,wh=mh,Eh=[0,0];
934
934
  /**
935
935
  * @license Apache-2.0
936
936
  *
@@ -947,7 +947,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
947
947
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
948
948
  * See the License for the specific language governing permissions and
949
949
  * limitations under the License.
950
- */var Oh=function(e,t){var n,r;return bh.assign(e,Sh,1,0),n=Sh[0],n&=2147483647,r=wh(t),Eh(n|=r&=2147483648,Sh[1])},Ih=Oh;
950
+ */var Sh=function(e,t){var n,r;return _h.assign(e,Eh,1,0),n=Eh[0],n&=2147483647,r=bh(t),wh(n|=r&=2147483648,Eh[1])},Oh=Sh;
951
951
  /**
952
952
  * @license Apache-2.0
953
953
  *
@@ -964,7 +964,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
964
964
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
965
965
  * See the License for the specific language governing permissions and
966
966
  * limitations under the License.
967
- */var xh=
967
+ */var Ih=
968
968
  /**
969
969
  * @license Apache-2.0
970
970
  *
@@ -982,7 +982,7 @@ function(){throw new Error("not implemented")},qf={uint16:zf()?Bf:Hf,uint8:Tf};
982
982
  * See the License for the specific language governing permissions and
983
983
  * limitations under the License.
984
984
  */
985
- function(e){return Math.abs(e)},Rh=Al,kh=Rl,Ch=xh;
985
+ function(e){return Math.abs(e)},xh=Pl,Rh=xl,kh=Ih;
986
986
  /**
987
987
  * @license Apache-2.0
988
988
  *
@@ -999,7 +999,7 @@ function(e){return Math.abs(e)},Rh=Al,kh=Rl,Ch=xh;
999
999
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1000
1000
  * See the License for the specific language governing permissions and
1001
1001
  * limitations under the License.
1002
- */var Ph=function(e,t,n,r){return kh(e)||Rh(e)?(t[r]=e,t[r+n]=0,t):0!==e&&Ch(e)<22250738585072014e-324?(t[r]=4503599627370496*e,t[r+n]=-52,t):(t[r]=e,t[r+n]=0,t)},Ah=Ph;
1002
+ */var Ch=function(e,t,n,r){return Rh(e)||xh(e)?(t[r]=e,t[r+n]=0,t):0!==e&&kh(e)<22250738585072014e-324?(t[r]=4503599627370496*e,t[r+n]=-52,t):(t[r]=e,t[r+n]=0,t)},Ph=Ch;
1003
1003
  /**
1004
1004
  * @license Apache-2.0
1005
1005
  *
@@ -1016,7 +1016,7 @@ function(e){return Math.abs(e)},Rh=Al,kh=Rl,Ch=xh;
1016
1016
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1017
1017
  * See the License for the specific language governing permissions and
1018
1018
  * limitations under the License.
1019
- */var Nh=function(e){return Ah(e,[0,0],1,0)},Th=Nh;
1019
+ */var Ah=function(e){return Ph(e,[0,0],1,0)},Nh=Ah;
1020
1020
  /**
1021
1021
  * @license Apache-2.0
1022
1022
  *
@@ -1033,7 +1033,7 @@ function(e){return Math.abs(e)},Rh=Al,kh=Rl,Ch=xh;
1033
1033
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1034
1034
  * See the License for the specific language governing permissions and
1035
1035
  * limitations under the License.
1036
- */$l(Th,"assign",Ph);var Mh=fh;
1036
+ */ql(Nh,"assign",Ch);var Th=lh;
1037
1037
  /**
1038
1038
  * @license Apache-2.0
1039
1039
  *
@@ -1050,7 +1050,7 @@ function(e){return Math.abs(e)},Rh=Al,kh=Rl,Ch=xh;
1050
1050
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1051
1051
  * See the License for the specific language governing permissions and
1052
1052
  * limitations under the License.
1053
- */var Lh=function(e){var t=Mh(e);return(t=(2146435072&t)>>>20)-1023|0},jh=Ol,Uh=Il,Dh=Rl,zh=Al,Fh=Ih,Bh=Th,Hh=Lh,qh=rh,$h=_h,Vh=[0,0],Wh=[0,0];
1053
+ */var Mh=function(e){var t=Th(e);return(t=(2146435072&t)>>>20)-1023|0},Lh=Sl,jh=Ol,Uh=xl,Dh=Pl,zh=Oh,Fh=Nh,Bh=Mh,Hh=nh,qh=mh,$h=[0,0],Vh=[0,0];
1054
1054
  /**
1055
1055
  * @license Apache-2.0
1056
1056
  *
@@ -1067,7 +1067,7 @@ function(e){return Math.abs(e)},Rh=Al,kh=Rl,Ch=xh;
1067
1067
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1068
1068
  * See the License for the specific language governing permissions and
1069
1069
  * limitations under the License.
1070
- */var Kh=function(e,t){var n,r;return 0===e||Dh(e)||zh(e)?e:(Bh(Vh),t+=Vh[1],(t+=Hh(e=Vh[0]))<-1074?Fh(0,e):t>1023?e<0?Uh:jh:(t<=-1023?(t+=52,r=2220446049250313e-31):r=1,qh(Wh),n=Wh[0],n&=2148532223,r*$h(n|=t+1023<<20,Wh[1])))},Gh=Kh,Yh={};
1070
+ */var Wh=function(e,t){var n,r;return 0===e||Uh(e)||Dh(e)?e:(Fh($h),t+=$h[1],(t+=Bh(e=$h[0]))<-1074?zh(0,e):t>1023?e<0?jh:Lh:(t<=-1023?(t+=52,r=2220446049250313e-31):r=1,Hh(Vh),n=Vh[0],n&=2148532223,r*qh(n|=t+1023<<20,Vh[1])))},Kh=Wh,Gh={};
1071
1071
  /**
1072
1072
  * @license Apache-2.0
1073
1073
  *
@@ -1084,4 +1084,4 @@ function(e){return Math.abs(e)},Rh=Al,kh=Rl,Ch=xh;
1084
1084
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1085
1085
  * See the License for the specific language governing permissions and
1086
1086
  * limitations under the License.
1087
- */Yh.dset=function(e,t,n){t.split&&(t=t.split("."));for(var r,i,o=0,s=t.length,a=e;o<s&&"__proto__"!==(i=t[o++])&&"constructor"!==i&&"prototype"!==i;)a=a[i]=o===s?n:typeof(r=a[i])==typeof t?r:0*t[o]!=0||~(""+t[o]).indexOf(".")?{}:[]};var Qh={},Jh=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qh,"__esModule",{value:!0}),Qh.unset=void 0;var Xh=Jh(Sl.exports);Qh.unset=function(e,t){if((0,Xh.default)(e,t)){for(var n=t.split("."),r=n.pop();n.length&&"\\"===n[n.length-1].slice(-1);)r=n.pop().slice(0,-1)+"."+r;for(;n.length;)e=e[t=n.shift()];return delete e[r]}return!0};var Zh=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ml,"__esModule",{value:!0});var ed=Zh(El),td=Zh(Sl.exports),nd=Zh(Gh),rd=Yh,id=Qh;function od(e,t){ad(e,t.drop,(function(e,t){t.forEach((function(t){return delete e[t]}))}))}function sd(e,t){ad(e,t.allow,(function(e,t){Object.keys(e).forEach((function(n){t.includes(n)||delete e[n]}))}))}function ad(e,t,n){Object.entries(t).forEach((function(t){var r=t[0],i=t[1],o=function(e){"object"==typeof e&&null!==e&&n(e,i)},s=""===r?e:(0,td.default)(e,r);Array.isArray(s)?s.forEach(o):o(s)}))}function ud(e,t){var n=JSON.parse(JSON.stringify(e));for(var r in t.map)if(t.map.hasOwnProperty(r)){var i=t.map[r],o=r.split("."),s=void 0;if(o.length>1?(o.pop(),s=(0,td.default)(n,o.join("."))):s=e,"object"==typeof s){if(i.copy){var a=(0,td.default)(n,i.copy);void 0!==a&&(0,rd.dset)(e,r,a)}else if(i.move){var u=(0,td.default)(n,i.move);void 0!==u&&(0,rd.dset)(e,r,u),(0,id.unset)(e,i.move)}else i.hasOwnProperty("set")&&(0,rd.dset)(e,r,i.set);if(i.to_string){var c=(0,td.default)(e,r);if("string"==typeof c||"object"==typeof c&&null!==c)continue;void 0!==c?(0,rd.dset)(e,r,JSON.stringify(c)):(0,rd.dset)(e,r,"undefined")}}}}function cd(e,t){return!(t.sample.percent<=0)&&(t.sample.percent>=1||(t.sample.path?function(e,t){var n=(0,td.default)(e,t.sample.path),r=(0,ed.default)(JSON.stringify(n)),i=-64,o=[];ld(r.slice(0,8),o);for(var s=0,a=0;a<64&&1!==o[a];a++)s++;if(0!==s){var u=[];ld(r.slice(9,16),u),i-=s,o.splice(0,s),u.splice(64-s),o=o.concat(u)}return o[63]=0===o[63]?1:0,(0,nd.default)(parseInt(o.join(""),2),i)<t.sample.percent}(e,t):(n=t.sample.percent,Math.random()<=n)));var n}function ld(e,t){for(var n=0;n<8;n++)for(var r=e[n],i=128;i>=1;i/=2)r-i>=0?(r-=i,t.push(1)):t.push(0)}ml.default=function(e,t){for(var n=e,r=0,i=t;r<i.length;r++){var o=i[r];switch(o.type){case"drop":return null;case"drop_properties":od(n,o.config);break;case"allow_properties":sd(n,o.config);break;case"sample_event":if(cd(n,o.config))break;return null;case"map_properties":ud(n,o.config);break;case"hash_properties":break;default:throw new Error('Transformer of type "'.concat(o.type,'" is unsupported.'))}}return n};var fd={},hd=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fd,"__esModule",{value:!0});var dd=hd(Sl.exports);function pd(e,t){if(!Array.isArray(e))return!0===gd(e,t);var n=e[0];switch(n){case"!":return!pd(e[1],t);case"or":for(var r=1;r<e.length;r++)if(pd(e[r],t))return!0;return!1;case"and":for(r=1;r<e.length;r++)if(!pd(e[r],t))return!1;return!0;case"=":case"!=":return function(e,t,n,r){yd(e)&&(e=pd(e,r));yd(t)&&(t=pd(t,r));"object"==typeof e&&"object"==typeof t&&(e=JSON.stringify(e),t=JSON.stringify(t));switch(n){case"=":return e===t;case"!=":return e!==t;default:throw new Error("Invalid operator in compareItems: ".concat(n))}}(gd(e[1],t),gd(e[2],t),n,t);case"<=":case"<":case">":case">=":return function(e,t,n,r){yd(e)&&(e=pd(e,r));yd(t)&&(t=pd(t,r));if("number"!=typeof e||"number"!=typeof t)return!1;switch(n){case"<=":return e<=t;case">=":return e>=t;case"<":return e<t;case">":return e>t;default:throw new Error("Invalid operator in compareNumbers: ".concat(n))}}(gd(e[1],t),gd(e[2],t),n,t);case"in":return function(e,t,n){return void 0!==t.find((function(t){return gd(t,n)===e}))}(gd(e[1],t),gd(e[2],t),t);case"contains":return function(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;return-1!==e.indexOf(t)}(gd(e[1],t),gd(e[2],t));case"match":return function(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;return function(e,t){var n,r;e:for(;e.length>0;){var i=void 0,o=void 0;if(i=(n=vd(e)).star,o=n.chunk,e=n.pattern,i&&""===o)return!0;var s=md(o,t),a=s.t,u=s.ok,c=s.err;if(c)return!1;if(!u||!(0===a.length||e.length>0)){if(i)for(var l=0;l<t.length;l++){if(a=(r=md(o,t.slice(l+1))).t,u=r.ok,c=r.err,u){if(0===e.length&&a.length>0)continue;t=a;continue e}if(c)return!1}return!1}t=a}return 0===t.length}(t,e)}(gd(e[1],t),gd(e[2],t));case"lowercase":var i=gd(e[1],t);return"string"!=typeof i?null:i.toLowerCase();case"typeof":return typeof gd(e[1],t);case"length":return function(e){if(null===e)return 0;if(!Array.isArray(e)&&"string"!=typeof e)return NaN;return e.length}(gd(e[1],t));default:throw new Error("FQL IR could not evaluate for token: ".concat(n))}}function gd(e,t){return Array.isArray(e)?e:"object"==typeof e?e.value:(0,dd.default)(t,e)}function yd(e){return!!Array.isArray(e)&&(("lowercase"===e[0]||"length"===e[0]||"typeof"===e[0])&&2===e.length||("contains"===e[0]||"match"===e[0])&&3===e.length)}function vd(e){for(var t={star:!1,chunk:"",pattern:""};e.length>0&&"*"===e[0];)e=e.slice(1),t.star=!0;var n,r=!1;e:for(n=0;n<e.length;n++)switch(e[n]){case"\\":n+1<e.length&&n++;break;case"[":r=!0;break;case"]":r=!1;break;case"*":if(!r)break e}return t.chunk=e.slice(0,n),t.pattern=e.slice(n),t}function md(e,t){for(var n,r,i={t:"",ok:!1,err:!1};e.length>0;){if(0===t.length)return i;switch(e[0]){case"[":var o=t[0];t=t.slice(1);var s=!0;(e=e.slice(1)).length>0&&"^"===e[0]&&(s=!1,e=e.slice(1));for(var a=!1,u=0;;){if(e.length>0&&"]"===e[0]&&u>0){e=e.slice(1);break}var c,l="";if(c=(n=_d(e)).char,e=n.newChunk,n.err)return i;if(l=c,"-"===e[0]&&(l=(r=_d(e.slice(1))).char,e=r.newChunk,r.err))return i;c<=o&&o<=l&&(a=!0),u++}if(a!==s)return i;break;case"?":t=t.slice(1),e=e.slice(1);break;case"\\":if(0===(e=e.slice(1)).length)return i.err=!0,i;default:if(e[0]!==t[0])return i;t=t.slice(1),e=e.slice(1)}}return i.t=t,i.ok=!0,i.err=!1,i}function _d(e){var t={char:"",newChunk:"",err:!1};return 0===e.length||"-"===e[0]||"]"===e[0]||"\\"===e[0]&&0===(e=e.slice(1)).length?(t.err=!0,t):(t.char=e[0],t.newChunk=e.slice(1),0===t.newChunk.length&&(t.err=!0),t)}fd.default=function(e,t){if(!t)throw new Error("No matcher supplied!");switch(t.type){case"all":return!0;case"fql":return function(e,t){if(!e)return!1;try{e=JSON.parse(e)}catch(t){throw new Error('Failed to JSON.parse FQL intermediate representation "'.concat(e,'": ').concat(t))}var n=pd(e,t);if("boolean"!=typeof n)return!1;return n}(t.ir,e);default:throw new Error("Matcher of type ".concat(t.type," unsupported."))}};var bd={};Object.defineProperty(bd,"__esModule",{value:!0});var wd=function(){function e(e){this.rules=[],this.rules=e||[]}return e.prototype.getRulesByDestinationName=function(e){for(var t=[],n=0,r=this.rules;n<r.length;n++){var i=r[n];i.destinationName!==e&&void 0!==i.destinationName||t.push(i)}return t},e}();bd.default=wd,function(e){var t=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.Store=e.matches=e.transform=void 0;var n=ml;Object.defineProperty(e,"transform",{enumerable:!0,get:function(){return t(n).default}});var r=fd;Object.defineProperty(e,"matches",{enumerable:!0,get:function(){return t(r).default}});var i=bd;Object.defineProperty(e,"Store",{enumerable:!0,get:function(){return t(i).default}})}(vl);var Ed=Object.freeze({__proto__:null,tsubMiddleware:function(e){return function(t){var n=t.payload,r=t.integration,i=t.next;new vl.Store(e).getRulesByDestinationName(r).forEach((function(e){for(var t=e.matchers,r=e.transformers,o=0;o<t.length;o++)if(vl.matches(n.obj,t[o])&&(n.obj=vl.transform(n.obj,r[o]),null===n.obj))return i(null)})),i(n)}}});function Sd(e,t){var n,r;return"boolean"==typeof(null==t?void 0:t.enabled)?t.enabled:null===(r=null===(n=null==e?void 0:e.__default)||void 0===n?void 0:n.enabled)||void 0===r||r}function Od(e){return e.toLowerCase().replace(".","").replace(/\s+/g,"-")}function Id(e,t){return void 0===t&&(t=!1),t?btoa(e).replace(/=/g,""):void 0}function xd(e,t,n,r){return _t(this,void 0,void 0,(function(){var i,o,s,a,u,c;return bt(this,(function(l){switch(l.label){case 0:i=Od(t),o=Id(i,r),s=Sr(),a="".concat(s,"/integrations/").concat(null!=o?o:i,"/").concat(n,"/").concat(null!=o?o:i,".dynamic.js.gz"),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,Ar(a)];case 2:return l.sent(),function(e,t,n){var r,i;try{var o=(null!==(i=null===(r=null===window||void 0===window?void 0:window.performance)||void 0===r?void 0:r.getEntriesByName(e,"resource"))&&void 0!==i?i:[])[0];o&&t.stats.gauge("legacy_destination_time",Math.round(o.duration),wt([n],o.duration<100?["cached"]:[],!0))}catch(e){}}(a,e,t),[3,4];case 3:throw u=l.sent(),e.stats.gauge("legacy_destination_time",-1,["plugin:".concat(t),"failed"]),u;case 4:return c=window["".concat(i,"Deps")],[4,Promise.all(c.map((function(e){return Ar(s+e+".gz")})))];case 5:return l.sent(),window["".concat(i,"Loader")](),[2,window["".concat(i,"Integration")]]}}))}))}function Rd(e,t){return _t(this,void 0,void 0,(function(){var n,r=this;return bt(this,(function(i){switch(i.label){case 0:return n=[],ln()?[2,t]:[4,xo((function(){return t.length>0&&cn()}),(function(){return _t(r,void 0,void 0,(function(){var r,i;return bt(this,(function(o){switch(o.label){case 0:return(r=t.pop())?[4,Xt(r,e)]:[2];case 1:return i=o.sent(),i instanceof bn||n.push(r),[2]}}))}))}))];case 1:return i.sent(),n.map((function(e){return t.pushWithBackoff(e)})),[2,t]}}))}))}var kd=function(){function e(e,t,n,r,i,o){void 0===r&&(r={}),this.options={},this.type="destination",this.middleware=[],this._ready=!1,this._initialized=!1,this.flushing=!1,this.name=e,this.version=t,this.settings=vt({},r),this.disableAutoISOConversion=i.disableAutoISOConversion||!1,this.integrationSource=o,this.settings.type&&"browser"===this.settings.type&&delete this.settings.type,this.options=i,this.buffer=i.disableClientPersistence?new qt(4,[]):new Mn(4,"".concat(n,":dest-").concat(e)),this.scheduleFlush()}return e.prototype.isLoaded=function(){return this._ready},e.prototype.ready=function(){var e;return null!==(e=this.onReady)&&void 0!==e?e:Promise.resolve()},e.prototype.load=function(e,t){var n;return _t(this,void 0,void 0,(function(){var r,i,o=this;return bt(this,(function(s){switch(s.label){case 0:return this._ready||void 0!==this.onReady?[2]:null===(n=this.integrationSource)||void 0===n?[3,1]:(i=n,[3,3]);case 1:return[4,xd(e,this.name,this.version,this.options.obfuscate)];case 2:i=s.sent(),s.label=3;case 3:r=i,this.integration=function(e,t,n){var r;"Integration"in e?(e({user:function(){return n.user()},addIntegration:function(){}}),r=e.Integration):r=e;var i=new r(t);return i.analytics=n,i}(r,this.settings,t),this.onReady=new Promise((function(e){o.integration.once("ready",(function(){o._ready=!0,e(!0)}))})),this.onInitialize=new Promise((function(e){o.integration.on("initialize",(function(){o._initialized=!0,e(!0)}))}));try{vo(e,{integrationName:this.name,methodName:"initialize",type:"classic"}),this.integration.initialize()}catch(t){throw vo(e,{integrationName:this.name,methodName:"initialize",type:"classic",didError:!0}),t}return[2]}}))}))},e.prototype.unload=function(e,t){return function(e,t,n){return _t(this,void 0,void 0,(function(){var r,i,o;return bt(this,(function(s){return r=Sr(),i=Od(e),o=Id(e,n),[2,Nr("".concat(r,"/integrations/").concat(null!=o?o:i,"/").concat(t,"/").concat(null!=o?o:i,".dynamic.js.gz"))]}))}))}(this.name,this.version,this.options.obfuscate)},e.prototype.addMiddleware=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.middleware=(e=this.middleware).concat.apply(e,t)},e.prototype.shouldBuffer=function(e){return"page"!==e.event.type&&(ln()||!1===this._ready||!1===this._initialized)},e.prototype.send=function(e,t,n){var r,i;return _t(this,void 0,void 0,(function(){var o,s,a,u,c,l;return bt(this,(function(f){switch(f.label){case 0:if(this.shouldBuffer(e))return this.buffer.push(e),this.scheduleFlush(),[2,e];if(o=null===(i=null===(r=this.options)||void 0===r?void 0:r.plan)||void 0===i?void 0:i.track,s=e.event.event,o&&s&&"Segment.io"!==this.name){if(a=o[s],!Sd(o,a))return e.updateEvent("integrations",vt(vt({},e.event.integrations),{All:!1,"Segment.io":!0})),e.cancel(new Qt({retry:!1,reason:"Event ".concat(s," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,e];if(e.updateEvent("integrations",vt(vt({},e.event.integrations),null==a?void 0:a.integrations)),(null==a?void 0:a.enabled)&&!1===(null==a?void 0:a.integrations[this.name]))return e.cancel(new Qt({retry:!1,reason:"Event ".concat(s," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,e]}return[4,go(this.name,e.event,this.middleware)];case 1:if(null===(u=f.sent()))return[2,e];c=new t(u,{traverse:!this.disableAutoISOConversion}),vo(e,{integrationName:this.name,methodName:n,type:"classic"}),f.label=2;case 2:return f.trys.push([2,5,,6]),this.integration?[4,this.integration.invoke.call(this.integration,n,c)]:[3,4];case 3:f.sent(),f.label=4;case 4:return[3,6];case 5:throw l=f.sent(),vo(e,{integrationName:this.name,methodName:n,type:"classic",didError:!0}),l;case 6:return[2,e]}}))}))},e.prototype.track=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,this.send(e,Tr.Track,"track")]}))}))},e.prototype.page=function(e){var t;return _t(this,void 0,void 0,(function(){var n=this;return bt(this,(function(r){return(null===(t=this.integration)||void 0===t?void 0:t._assumesPageview)&&!this._initialized&&this.integration.initialize(),[2,this.onInitialize.then((function(){return n.send(e,Tr.Page,"page")}))]}))}))},e.prototype.identify=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,this.send(e,Tr.Identify,"identify")]}))}))},e.prototype.alias=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,this.send(e,Tr.Alias,"alias")]}))}))},e.prototype.group=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,this.send(e,Tr.Group,"group")]}))}))},e.prototype.scheduleFlush=function(){var e=this;this.flushing||setTimeout((function(){return _t(e,void 0,void 0,(function(){var e;return bt(this,(function(t){switch(t.label){case 0:return this.flushing=!0,e=this,[4,Rd(this,this.buffer)];case 1:return e.buffer=t.sent(),this.flushing=!1,this.buffer.todo>0&&this.scheduleFlush(),[2]}}))}))}),5e3*Math.random())},e}();var Cd=Object.freeze({__proto__:null,LegacyDestination:kd,ajsDestinations:function(e,t,n,r,i,o){var s,a;if(void 0===n&&(n={}),void 0===r&&(r={}),un())return[];t.plan&&((r=null!=r?r:{}).plan=t.plan);var u=null!==(a=null===(s=t.middlewareSettings)||void 0===s?void 0:s.routingRules)&&void 0!==a?a:[],c=t.integrations,l=r.integrations,f=Or(t,null!=r?r:{}),h=null==o?void 0:o.reduce((function(e,t){var n;return vt(vt({},e),((n={})[function(e){return("Integration"in e?e.Integration:e).prototype.name}(t)]=t,n))}),{}),d=new Set(wt(wt([],Object.keys(c).filter((function(e){return function(e,t){var n,r=t.type,i=t.bundlingStatus,o=t.versionSettings,s="unbundled"!==i&&("browser"===r||(null===(n=null==o?void 0:o.componentTypes)||void 0===n?void 0:n.includes("browser")));return!e.startsWith("Segment")&&"Iterable"!==e&&s}(e,c[e])})),!0),Object.keys(h||{}).filter((function(e){return Mt(c[e])||Mt(null==l?void 0:l[e])})),!0));return Array.from(d).filter((function(e){return!function(e,t){var n=!1===t.All&&void 0===t[e];return!1===t[e]||n}(e,n)})).map((function(t){var n=function(e){var t,n,r,i;return null!==(i=null!==(n=null===(t=null==e?void 0:e.versionSettings)||void 0===t?void 0:t.override)&&void 0!==n?n:null===(r=null==e?void 0:e.versionSettings)||void 0===r?void 0:r.version)&&void 0!==i?i:"latest"}(c[t]),o=new kd(t,n,e,f[t],r,null==h?void 0:h[t]);return u.filter((function(e){return e.destinationName===t})).length>0&&i&&o.addMiddleware(i),o}))}});var Pd=Object.freeze({__proto__:null,loadLegacyVideoPlugins:function(e){return _t(this,void 0,void 0,(function(){var t;return bt(this,(function(n){switch(n.label){case 0:return[4,Promise.resolve().then((function(){return Md}))];case 1:return t=n.sent(),e._plugins=t,[2]}}))}))}});var Ad=Object.freeze({__proto__:null,schemaFilter:function(e,t){function n(n){var r=e,i=n.event.event;if(r&&i){var o=r[i];if(!Sd(r,o))return n.updateEvent("integrations",vt(vt({},n.event.integrations),{All:!1,"Segment.io":!0})),n;var s=function(e,t){var n,r;if(!e||!Object.keys(e))return{};var i=e.integrations?Object.keys(e.integrations).filter((function(t){return!1===e.integrations[t]})):[],o=[];return(null!==(n=t.remotePlugins)&&void 0!==n?n:[]).forEach((function(e){i.forEach((function(t){(e.name.includes(t)||t.includes(e.name))&&o.push(e.name)}))})),(null!==(r=t.remotePlugins)&&void 0!==r?r:[]).reduce((function(e,t){return t.settings.subscriptions&&o.includes(t.name)&&t.settings.subscriptions.forEach((function(n){return e["".concat(t.name," ").concat(n.partnerAction)]=!1})),e}),{})}(o,t);n.updateEvent("integrations",vt(vt(vt({},n.event.integrations),null==o?void 0:o.integrations),s))}return n}return{name:"Schema Filter",version:"0.1.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},type:"before",page:n,alias:n,track:n,identify:n,group:n}}});var Nd=Object.freeze({__proto__:null,remoteMiddlewares:function(e,t,n){var r;return _t(this,void 0,void 0,(function(){var i,o,s,a,u=this;return bt(this,(function(c){switch(c.label){case 0:return un()?[2,[]]:(i=Sr(),o=null!==(r=t.enabledMiddleware)&&void 0!==r?r:{},s=Object.entries(o).filter((function(e){return e[0],e[1]})).map((function(e){return e[0]})),a=s.map((function(t){return _t(u,void 0,void 0,(function(){var r,o,s,a;return bt(this,(function(u){switch(u.label){case 0:r=t.replace("@segment/",""),o=r,n&&(o=btoa(r).replace(/=/g,"")),s="".concat(i,"/middleware/").concat(o,"/latest/").concat(o,".js.gz"),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Ar(s)];case 2:return u.sent(),[2,window["".concat(r,"Middleware")]];case 3:return a=u.sent(),e.log("error",a),e.stats.increment("failed_remote_middleware"),[3,4];case 4:return[2]}}))}))})),[4,Promise.all(a)]);case 1:return[2,c.sent().filter(Boolean)]}}))}))}}),Td={exports:{}};!function(e,t){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){n.r(t);var r="function"==typeof fetch?fetch.bind():function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest;for(var o in i.open(t.method||"get",e,!0),t.headers)i.setRequestHeader(o,t.headers[o]);function s(){var e,t=[],n=[],r={};return i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(i,o,s){t.push(o=o.toLowerCase()),n.push([o,s]),e=r[o],r[o]=e?e+","+s:s})),{ok:2==(i.status/100|0),status:i.status,statusText:i.statusText,url:i.responseURL,clone:s,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},headers:{keys:function(){return t},entries:function(){return n},get:function(e){return r[e.toLowerCase()]},has:function(e){return e.toLowerCase()in r}}}}i.withCredentials="include"==t.credentials,i.onload=function(){n(s())},i.onerror=r,i.send(t.body)}))};t.default=r},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pluginName=t}return r(e,[{key:"track",value:function(e,t){window.analytics.track(e,t,{integration:{name:this.pluginName}})}}]),e}();t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeAnalytics=t.VimeoAnalytics=void 0;var r=o(n(3)),i=o(n(4));function o(e){return e&&e.__esModule?e:{default:e}}t.VimeoAnalytics=r.default,t.YouTubeAnalytics=i.default},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=o(n(0));function o(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"VimeoAnalytics"));return r.authToken=n,r.player=e,r.metadata={content:{},playback:{videoPlayer:"Vimeo"}},r.mostRecentHeartbeat=0,r.isPaused=!1,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"initialize",value:function(){var e=this,t={loaded:this.retrieveMetadata,play:this.trackPlay,pause:this.trackPause,ended:this.trackEnded,timeupdate:this.trackHeartbeat};for(var n in t)this.registerHandler(n,t[n]);this.player.getVideoId().then((function(t){e.retrieveMetadata({id:t})})).catch(console.error)}},{key:"registerHandler",value:function(e,t){var n=this;this.player.on(e,(function(e){n.updateMetadata(e),t.call(n,e)}))}},{key:"trackPlay",value:function(){this.isPaused?(this.track("Video Playback Resumed",this.metadata.playback),this.isPaused=!1):(this.track("Video Playback Started",this.metadata.playback),this.track("Video Content Started",this.metadata.content))}},{key:"trackEnded",value:function(){this.track("Video Playback Completed",this.metadata.playback),this.track("Video Content Completed",this.metadata.content)}},{key:"trackHeartbeat",value:function(){var e=this.mostRecentHeartbeat,t=this.metadata.playback.position;t!==e&&t-e>=10&&(this.track("Video Content Playing",this.metadata.content),this.mostRecentHeartbeat=Math.floor(t))}},{key:"trackPause",value:function(){this.isPaused=!0,this.track("Video Playback Paused",this.metadata.playback)}},{key:"retrieveMetadata",value:function(e){var t=this;return new Promise((function(n,r){var o=e.id;(0,i.default)("https://api.vimeo.com/videos/"+o,{headers:{Authorization:"Bearer "+t.authToken}}).then((function(e){return e.ok?e.json():r(e)})).then((function(e){t.metadata.content.title=e.name,t.metadata.content.description=e.description,t.metadata.content.publisher=e.user.name,t.metadata.playback.position=0,t.metadata.playback.totalLength=e.duration})).catch((function(e){return console.error("Request to Vimeo API Failed with: ",e),r(e)}))}))}},{key:"updateMetadata",value:function(e){var t=this;return new Promise((function(n,r){t.player.getVolume().then((function(r){r&&(t.metadata.playback.sound=100*r),t.metadata.playback.position=e.seconds,n()})).catch(r)}))}}]),t}(o(n(1)).default);t.default=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=o(n(0));function o(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"YoutubeAnalytics"));return r.player=e,r.apiKey=n,r.playerLoaded=!1,r.playbackStarted=!1,r.contentStarted=!1,r.isPaused=!1,r.isBuffering=!1,r.isSeeking=!1,r.lastRecordedTime={timeReported:Date.now(),timeElapsed:0},r.metadata=[{playback:{video_player:"youtube"},content:{}}],r.playlistIndex=0,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"initialize",value:function(){window.segmentYoutubeOnStateChange=this.onPlayerStateChange.bind(this),window.segmentYoutubeOnReady=this.onPlayerReady.bind(this),this.player.addEventListener("onReady","segmentYoutubeOnReady"),this.player.addEventListener("onStateChange","segmentYoutubeOnStateChange")}},{key:"onPlayerReady",value:function(e){this.retrieveMetadata()}},{key:"onPlayerStateChange",value:function(e){var t=this.player.getCurrentTime();switch(this.metadata[this.playlistIndex]&&(this.metadata[this.playlistIndex].playback.position=this.metadata[this.playlistIndex].content.position=t,this.metadata[this.playlistIndex].playback.quality=this.player.getPlaybackQuality(),this.metadata[this.playlistIndex].playback.sound=this.player.isMuted()?0:this.player.getVolume()),e.data){case-1:if(this.playerLoaded)break;this.retrieveMetadata(),this.playerLoaded=!0;break;case YT.PlayerState.BUFFERING:this.handleBuffer();break;case YT.PlayerState.PLAYING:this.handlePlay();break;case YT.PlayerState.PAUSED:this.handlePause();break;case YT.PlayerState.ENDED:this.handleEnd()}this.lastRecordedTime={timeReported:Date.now(),timeElapsed:1e3*this.player.getCurrentTime()}}},{key:"retrieveMetadata",value:function(){var e=this;return new Promise((function(t,n){var r=e.player.getVideoData(),o=e.player.getPlaylist()||[r.video_id],s=o.join();(0,i.default)("https://www.googleapis.com/youtube/v3/videos?id="+s+"&part=snippet,contentDetails&key="+e.apiKey).then((function(e){if(!e.ok){var t=new Error("Segment request to Youtube API failed (likely due to a bad API Key. Events will still be sent but will not contain video metadata)");throw t.response=e,t}return e.json()})).then((function(n){e.metadata=[];for(var r=0,i=0;i<o.length;i++){var s=n.items[i];e.metadata.push({content:{title:s.snippet.title,description:s.snippet.description,keywords:s.snippet.tags,channel:s.snippet.channelTitle,airdate:s.snippet.publishedAt}}),r+=a(s.contentDetails.duration)}for(i=0;i<o.length;i++)e.metadata[i].playback={total_length:r,video_player:"youtube"};t()})).catch((function(t){e.metadata=o.map((function(e){return{playback:{video_player:"youtube"},content:{}}})),n(t)}))}))}},{key:"handleBuffer",value:function(){var e=this.determineSeek();this.playbackStarted||(this.playbackStarted=!0,this.track("Video Playback Started",this.metadata[this.playlistIndex].playback)),e&&!this.isSeeking&&(this.isSeeking=!0,this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback)),this.isSeeking&&(this.track("Video Playback Seek Completed",this.metadata[this.playlistIndex].playback),this.isSeeking=!1);var t=this.player.getPlaylist();t&&0===this.player.getCurrentTime()&&this.player.getPlaylistIndex()!==this.playlistIndex&&(this.contentStarted=!1,this.playlistIndex===t.length-1&&0===this.player.getPlaylistIndex()&&(this.track("Video Playback Completed",this.metadata[this.player.getPlaylistIndex()].playback),this.track("Video Playback Started",this.metadata[this.player.getPlaylistIndex()].playback))),this.track("Video Playback Buffer Started",this.metadata[this.playlistIndex].playback),this.isBuffering=!0}},{key:"handlePlay",value:function(){this.contentStarted||(this.playlistIndex=this.player.getPlaylistIndex(),-1===this.playlistIndex&&(this.playlistIndex=0),this.track("Video Content Started",this.metadata[this.playlistIndex].content),this.contentStarted=!0),this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused&&(this.track("Video Playback Resumed",this.metadata[this.playlistIndex].playback),this.isPaused=!1)}},{key:"handlePause",value:function(){var e=this.determineSeek();this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused||(e?(this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback),this.isSeeking=!0):(this.track("Video Playback Paused",this.metadata[this.playlistIndex].playback),this.isPaused=!0))}},{key:"handleEnd",value:function(){this.track("Video Content Completed",this.metadata[this.playlistIndex].content),this.contentStarted=!1;var e=this.player.getPlaylistIndex(),t=this.player.getPlaylist();(t&&e===t.length-1||-1===e)&&(this.track("Video Playback Completed",this.metadata[this.playlistIndex].playback),this.playbackStarted=!1)}},{key:"determineSeek",value:function(){var e=this.isPaused||this.isBuffering?0:Date.now()-this.lastRecordedTime.timeReported,t=1e3*this.player.getCurrentTime()-this.lastRecordedTime.timeElapsed;return Math.abs(e-t)>2e3}}]),t}(o(n(1)).default);function a(e){var t=e.match(/PT(\d+H)?(\d+M)?(\d+S)?/);return t=t.slice(1).map((function(e){if(null!=e)return e.replace(/\D/,"")})),3600*(parseInt(t[0])||0)+60*(parseInt(t[1])||0)+(parseInt(t[2])||0)}t.default=s}])}(Td);var Md=t({__proto__:null,default:f(Td.exports)},[Td.exports]);e.checkSupport=function(e){hl("checkSupport",e),(e=>{var t;tl("setSupportOptions",e);const n=e.walletConnectVersion||1;let r,i,o=[];1===n?(i=e.chainId||1,r=[i]):(r=e.chains||Qc,i=r[0],o.push(...r),(null===(t=e.optionalChains)||void 0===t?void 0:t.length)&&o.push(...e.optionalChains.filter((e=>o.indexOf(e)<0))));const s=Object.assign(Object.assign({},e),{walletConnectVersion:n,chains:r,chainId:i,optionalChains:o,projectId:e.projectId||""});if(2===n&&(!e.projectId||""===e.projectId))throw new Error("WalletConnect requires a projectId. Please visit https://cloud.walletconnect.com to get one.");nl=s})(e);const t=rl();let n;return t.providerType,Jc.Ethereum,n=function(e){hl("checkEthereumSupport",e);const t=Js();let n=!1;try{n=!!fl()}catch(e){}const r={isLedgerConnectSupported:ul(t),isLedgerConnectEnabled:!!n,isChainIdSupported:ll(e.chains),providerImplementation:Xc.LedgerConnect};r.isLedgerConnectSupported&&r.isLedgerConnectEnabled&&r.isChainIdSupported||(r.providerImplementation=Xc.WalletConnect);return function(e){Yc("setProviderImplementation",e),Zc=e}(r.providerImplementation),r}(t),hl("checkSupportResult is",n),dl=n,n},e.enableDebugLogs=()=>{n=!0},e.getProvider=function(){return c(this,void 0,void 0,(function*(){Yc("getProvider",Zc);const e=rl();if(e.providerType===Jc.Ethereum)return(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV2"))||(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV1"))||Zc!==Xc.LedgerConnect?(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV2"))||1!==e.walletConnectVersion&&!(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV1"))?yield Kc():yield ra():fl();throw new s}))},Object.defineProperty(e,"__esModule",{value:!0})}));//# sourceMappingURL=index.js.map
1087
+ */Gh.dset=function(e,t,n){t.split&&(t=t.split("."));for(var r,i,o=0,s=t.length,a=e;o<s&&"__proto__"!==(i=t[o++])&&"constructor"!==i&&"prototype"!==i;)a=a[i]=o===s?n:typeof(r=a[i])==typeof t?r:0*t[o]!=0||~(""+t[o]).indexOf(".")?{}:[]};var Yh={},Qh=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Yh,"__esModule",{value:!0}),Yh.unset=void 0;var Jh=Qh(El.exports);Yh.unset=function(e,t){if((0,Jh.default)(e,t)){for(var n=t.split("."),r=n.pop();n.length&&"\\"===n[n.length-1].slice(-1);)r=n.pop().slice(0,-1)+"."+r;for(;n.length;)e=e[t=n.shift()];return delete e[r]}return!0};var Xh=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(vl,"__esModule",{value:!0});var Zh=Xh(wl),ed=Xh(El.exports),td=Xh(Kh),nd=Gh,rd=Yh;function id(e,t){sd(e,t.drop,(function(e,t){t.forEach((function(t){return delete e[t]}))}))}function od(e,t){sd(e,t.allow,(function(e,t){Object.keys(e).forEach((function(n){t.includes(n)||delete e[n]}))}))}function sd(e,t,n){Object.entries(t).forEach((function(t){var r=t[0],i=t[1],o=function(e){"object"==typeof e&&null!==e&&n(e,i)},s=""===r?e:(0,ed.default)(e,r);Array.isArray(s)?s.forEach(o):o(s)}))}function ad(e,t){var n=JSON.parse(JSON.stringify(e));for(var r in t.map)if(t.map.hasOwnProperty(r)){var i=t.map[r],o=r.split("."),s=void 0;if(o.length>1?(o.pop(),s=(0,ed.default)(n,o.join("."))):s=e,"object"==typeof s){if(i.copy){var a=(0,ed.default)(n,i.copy);void 0!==a&&(0,nd.dset)(e,r,a)}else if(i.move){var u=(0,ed.default)(n,i.move);void 0!==u&&(0,nd.dset)(e,r,u),(0,rd.unset)(e,i.move)}else i.hasOwnProperty("set")&&(0,nd.dset)(e,r,i.set);if(i.to_string){var c=(0,ed.default)(e,r);if("string"==typeof c||"object"==typeof c&&null!==c)continue;void 0!==c?(0,nd.dset)(e,r,JSON.stringify(c)):(0,nd.dset)(e,r,"undefined")}}}}function ud(e,t){return!(t.sample.percent<=0)&&(t.sample.percent>=1||(t.sample.path?function(e,t){var n=(0,ed.default)(e,t.sample.path),r=(0,Zh.default)(JSON.stringify(n)),i=-64,o=[];cd(r.slice(0,8),o);for(var s=0,a=0;a<64&&1!==o[a];a++)s++;if(0!==s){var u=[];cd(r.slice(9,16),u),i-=s,o.splice(0,s),u.splice(64-s),o=o.concat(u)}return o[63]=0===o[63]?1:0,(0,td.default)(parseInt(o.join(""),2),i)<t.sample.percent}(e,t):(n=t.sample.percent,Math.random()<=n)));var n}function cd(e,t){for(var n=0;n<8;n++)for(var r=e[n],i=128;i>=1;i/=2)r-i>=0?(r-=i,t.push(1)):t.push(0)}vl.default=function(e,t){for(var n=e,r=0,i=t;r<i.length;r++){var o=i[r];switch(o.type){case"drop":return null;case"drop_properties":id(n,o.config);break;case"allow_properties":od(n,o.config);break;case"sample_event":if(ud(n,o.config))break;return null;case"map_properties":ad(n,o.config);break;case"hash_properties":break;default:throw new Error('Transformer of type "'.concat(o.type,'" is unsupported.'))}}return n};var ld={},fd=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ld,"__esModule",{value:!0});var hd=fd(El.exports);function dd(e,t){if(!Array.isArray(e))return!0===pd(e,t);var n=e[0];switch(n){case"!":return!dd(e[1],t);case"or":for(var r=1;r<e.length;r++)if(dd(e[r],t))return!0;return!1;case"and":for(r=1;r<e.length;r++)if(!dd(e[r],t))return!1;return!0;case"=":case"!=":return function(e,t,n,r){gd(e)&&(e=dd(e,r));gd(t)&&(t=dd(t,r));"object"==typeof e&&"object"==typeof t&&(e=JSON.stringify(e),t=JSON.stringify(t));switch(n){case"=":return e===t;case"!=":return e!==t;default:throw new Error("Invalid operator in compareItems: ".concat(n))}}(pd(e[1],t),pd(e[2],t),n,t);case"<=":case"<":case">":case">=":return function(e,t,n,r){gd(e)&&(e=dd(e,r));gd(t)&&(t=dd(t,r));if("number"!=typeof e||"number"!=typeof t)return!1;switch(n){case"<=":return e<=t;case">=":return e>=t;case"<":return e<t;case">":return e>t;default:throw new Error("Invalid operator in compareNumbers: ".concat(n))}}(pd(e[1],t),pd(e[2],t),n,t);case"in":return function(e,t,n){return void 0!==t.find((function(t){return pd(t,n)===e}))}(pd(e[1],t),pd(e[2],t),t);case"contains":return function(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;return-1!==e.indexOf(t)}(pd(e[1],t),pd(e[2],t));case"match":return function(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;return function(e,t){var n,r;e:for(;e.length>0;){var i=void 0,o=void 0;if(i=(n=yd(e)).star,o=n.chunk,e=n.pattern,i&&""===o)return!0;var s=vd(o,t),a=s.t,u=s.ok,c=s.err;if(c)return!1;if(!u||!(0===a.length||e.length>0)){if(i)for(var l=0;l<t.length;l++){if(a=(r=vd(o,t.slice(l+1))).t,u=r.ok,c=r.err,u){if(0===e.length&&a.length>0)continue;t=a;continue e}if(c)return!1}return!1}t=a}return 0===t.length}(t,e)}(pd(e[1],t),pd(e[2],t));case"lowercase":var i=pd(e[1],t);return"string"!=typeof i?null:i.toLowerCase();case"typeof":return typeof pd(e[1],t);case"length":return function(e){if(null===e)return 0;if(!Array.isArray(e)&&"string"!=typeof e)return NaN;return e.length}(pd(e[1],t));default:throw new Error("FQL IR could not evaluate for token: ".concat(n))}}function pd(e,t){return Array.isArray(e)?e:"object"==typeof e?e.value:(0,hd.default)(t,e)}function gd(e){return!!Array.isArray(e)&&(("lowercase"===e[0]||"length"===e[0]||"typeof"===e[0])&&2===e.length||("contains"===e[0]||"match"===e[0])&&3===e.length)}function yd(e){for(var t={star:!1,chunk:"",pattern:""};e.length>0&&"*"===e[0];)e=e.slice(1),t.star=!0;var n,r=!1;e:for(n=0;n<e.length;n++)switch(e[n]){case"\\":n+1<e.length&&n++;break;case"[":r=!0;break;case"]":r=!1;break;case"*":if(!r)break e}return t.chunk=e.slice(0,n),t.pattern=e.slice(n),t}function vd(e,t){for(var n,r,i={t:"",ok:!1,err:!1};e.length>0;){if(0===t.length)return i;switch(e[0]){case"[":var o=t[0];t=t.slice(1);var s=!0;(e=e.slice(1)).length>0&&"^"===e[0]&&(s=!1,e=e.slice(1));for(var a=!1,u=0;;){if(e.length>0&&"]"===e[0]&&u>0){e=e.slice(1);break}var c,l="";if(c=(n=md(e)).char,e=n.newChunk,n.err)return i;if(l=c,"-"===e[0]&&(l=(r=md(e.slice(1))).char,e=r.newChunk,r.err))return i;c<=o&&o<=l&&(a=!0),u++}if(a!==s)return i;break;case"?":t=t.slice(1),e=e.slice(1);break;case"\\":if(0===(e=e.slice(1)).length)return i.err=!0,i;default:if(e[0]!==t[0])return i;t=t.slice(1),e=e.slice(1)}}return i.t=t,i.ok=!0,i.err=!1,i}function md(e){var t={char:"",newChunk:"",err:!1};return 0===e.length||"-"===e[0]||"]"===e[0]||"\\"===e[0]&&0===(e=e.slice(1)).length?(t.err=!0,t):(t.char=e[0],t.newChunk=e.slice(1),0===t.newChunk.length&&(t.err=!0),t)}ld.default=function(e,t){if(!t)throw new Error("No matcher supplied!");switch(t.type){case"all":return!0;case"fql":return function(e,t){if(!e)return!1;try{e=JSON.parse(e)}catch(t){throw new Error('Failed to JSON.parse FQL intermediate representation "'.concat(e,'": ').concat(t))}var n=dd(e,t);if("boolean"!=typeof n)return!1;return n}(t.ir,e);default:throw new Error("Matcher of type ".concat(t.type," unsupported."))}};var _d={};Object.defineProperty(_d,"__esModule",{value:!0});var bd=function(){function e(e){this.rules=[],this.rules=e||[]}return e.prototype.getRulesByDestinationName=function(e){for(var t=[],n=0,r=this.rules;n<r.length;n++){var i=r[n];i.destinationName!==e&&void 0!==i.destinationName||t.push(i)}return t},e}();_d.default=bd,function(e){var t=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.Store=e.matches=e.transform=void 0;var n=vl;Object.defineProperty(e,"transform",{enumerable:!0,get:function(){return t(n).default}});var r=ld;Object.defineProperty(e,"matches",{enumerable:!0,get:function(){return t(r).default}});var i=_d;Object.defineProperty(e,"Store",{enumerable:!0,get:function(){return t(i).default}})}(yl);var wd=Object.freeze({__proto__:null,tsubMiddleware:function(e){return function(t){var n=t.payload,r=t.integration,i=t.next;new yl.Store(e).getRulesByDestinationName(r).forEach((function(e){for(var t=e.matchers,r=e.transformers,o=0;o<t.length;o++)if(yl.matches(n.obj,t[o])&&(n.obj=yl.transform(n.obj,r[o]),null===n.obj))return i(null)})),i(n)}}});function Ed(e,t){var n,r;return"boolean"==typeof(null==t?void 0:t.enabled)?t.enabled:null===(r=null===(n=null==e?void 0:e.__default)||void 0===n?void 0:n.enabled)||void 0===r||r}function Sd(e){return e.toLowerCase().replace(".","").replace(/\s+/g,"-")}function Od(e,t){return void 0===t&&(t=!1),t?btoa(e).replace(/=/g,""):void 0}function Id(e,t,n,r){return _t(this,void 0,void 0,(function(){var i,o,s,a,u,c;return bt(this,(function(l){switch(l.label){case 0:i=Sd(t),o=Od(i,r),s=Sr(),a="".concat(s,"/integrations/").concat(null!=o?o:i,"/").concat(n,"/").concat(null!=o?o:i,".dynamic.js.gz"),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,Ar(a)];case 2:return l.sent(),function(e,t,n){var r,i;try{var o=(null!==(i=null===(r=null===window||void 0===window?void 0:window.performance)||void 0===r?void 0:r.getEntriesByName(e,"resource"))&&void 0!==i?i:[])[0];o&&t.stats.gauge("legacy_destination_time",Math.round(o.duration),wt([n],o.duration<100?["cached"]:[],!0))}catch(e){}}(a,e,t),[3,4];case 3:throw u=l.sent(),e.stats.gauge("legacy_destination_time",-1,["plugin:".concat(t),"failed"]),u;case 4:return c=window["".concat(i,"Deps")],[4,Promise.all(c.map((function(e){return Ar(s+e+".gz")})))];case 5:return l.sent(),window["".concat(i,"Loader")](),[2,window["".concat(i,"Integration")]]}}))}))}function xd(e,t){return _t(this,void 0,void 0,(function(){var n,r=this;return bt(this,(function(i){switch(i.label){case 0:return n=[],ln()?[2,t]:[4,xo((function(){return t.length>0&&cn()}),(function(){return _t(r,void 0,void 0,(function(){var r,i;return bt(this,(function(o){switch(o.label){case 0:return(r=t.pop())?[4,Xt(r,e)]:[2];case 1:return i=o.sent(),i instanceof bn||n.push(r),[2]}}))}))}))];case 1:return i.sent(),n.map((function(e){return t.pushWithBackoff(e)})),[2,t]}}))}))}var Rd=function(){function e(e,t,n,r,i,o){void 0===r&&(r={}),this.options={},this.type="destination",this.middleware=[],this._ready=!1,this._initialized=!1,this.flushing=!1,this.name=e,this.version=t,this.settings=vt({},r),this.disableAutoISOConversion=i.disableAutoISOConversion||!1,this.integrationSource=o,this.settings.type&&"browser"===this.settings.type&&delete this.settings.type,this.options=i,this.buffer=i.disableClientPersistence?new qt(4,[]):new Mn(4,"".concat(n,":dest-").concat(e)),this.scheduleFlush()}return e.prototype.isLoaded=function(){return this._ready},e.prototype.ready=function(){var e;return null!==(e=this.onReady)&&void 0!==e?e:Promise.resolve()},e.prototype.load=function(e,t){var n;return _t(this,void 0,void 0,(function(){var r,i,o=this;return bt(this,(function(s){switch(s.label){case 0:return this._ready||void 0!==this.onReady?[2]:null===(n=this.integrationSource)||void 0===n?[3,1]:(i=n,[3,3]);case 1:return[4,Id(e,this.name,this.version,this.options.obfuscate)];case 2:i=s.sent(),s.label=3;case 3:r=i,this.integration=function(e,t,n){var r;"Integration"in e?(e({user:function(){return n.user()},addIntegration:function(){}}),r=e.Integration):r=e;var i=new r(t);return i.analytics=n,i}(r,this.settings,t),this.onReady=new Promise((function(e){o.integration.once("ready",(function(){o._ready=!0,e(!0)}))})),this.onInitialize=new Promise((function(e){o.integration.on("initialize",(function(){o._initialized=!0,e(!0)}))}));try{vo(e,{integrationName:this.name,methodName:"initialize",type:"classic"}),this.integration.initialize()}catch(t){throw vo(e,{integrationName:this.name,methodName:"initialize",type:"classic",didError:!0}),t}return[2]}}))}))},e.prototype.unload=function(e,t){return function(e,t,n){return _t(this,void 0,void 0,(function(){var r,i,o;return bt(this,(function(s){return r=Sr(),i=Sd(e),o=Od(e,n),[2,Nr("".concat(r,"/integrations/").concat(null!=o?o:i,"/").concat(t,"/").concat(null!=o?o:i,".dynamic.js.gz"))]}))}))}(this.name,this.version,this.options.obfuscate)},e.prototype.addMiddleware=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.middleware=(e=this.middleware).concat.apply(e,t)},e.prototype.shouldBuffer=function(e){return"page"!==e.event.type&&(ln()||!1===this._ready||!1===this._initialized)},e.prototype.send=function(e,t,n){var r,i;return _t(this,void 0,void 0,(function(){var o,s,a,u,c,l;return bt(this,(function(f){switch(f.label){case 0:if(this.shouldBuffer(e))return this.buffer.push(e),this.scheduleFlush(),[2,e];if(o=null===(i=null===(r=this.options)||void 0===r?void 0:r.plan)||void 0===i?void 0:i.track,s=e.event.event,o&&s&&"Segment.io"!==this.name){if(a=o[s],!Ed(o,a))return e.updateEvent("integrations",vt(vt({},e.event.integrations),{All:!1,"Segment.io":!0})),e.cancel(new Qt({retry:!1,reason:"Event ".concat(s," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,e];if(e.updateEvent("integrations",vt(vt({},e.event.integrations),null==a?void 0:a.integrations)),(null==a?void 0:a.enabled)&&!1===(null==a?void 0:a.integrations[this.name]))return e.cancel(new Qt({retry:!1,reason:"Event ".concat(s," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,e]}return[4,go(this.name,e.event,this.middleware)];case 1:if(null===(u=f.sent()))return[2,e];c=new t(u,{traverse:!this.disableAutoISOConversion}),vo(e,{integrationName:this.name,methodName:n,type:"classic"}),f.label=2;case 2:return f.trys.push([2,5,,6]),this.integration?[4,this.integration.invoke.call(this.integration,n,c)]:[3,4];case 3:f.sent(),f.label=4;case 4:return[3,6];case 5:throw l=f.sent(),vo(e,{integrationName:this.name,methodName:n,type:"classic",didError:!0}),l;case 6:return[2,e]}}))}))},e.prototype.track=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,this.send(e,Tr.Track,"track")]}))}))},e.prototype.page=function(e){var t;return _t(this,void 0,void 0,(function(){var n=this;return bt(this,(function(r){return(null===(t=this.integration)||void 0===t?void 0:t._assumesPageview)&&!this._initialized&&this.integration.initialize(),[2,this.onInitialize.then((function(){return n.send(e,Tr.Page,"page")}))]}))}))},e.prototype.identify=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,this.send(e,Tr.Identify,"identify")]}))}))},e.prototype.alias=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,this.send(e,Tr.Alias,"alias")]}))}))},e.prototype.group=function(e){return _t(this,void 0,void 0,(function(){return bt(this,(function(t){return[2,this.send(e,Tr.Group,"group")]}))}))},e.prototype.scheduleFlush=function(){var e=this;this.flushing||setTimeout((function(){return _t(e,void 0,void 0,(function(){var e;return bt(this,(function(t){switch(t.label){case 0:return this.flushing=!0,e=this,[4,xd(this,this.buffer)];case 1:return e.buffer=t.sent(),this.flushing=!1,this.buffer.todo>0&&this.scheduleFlush(),[2]}}))}))}),5e3*Math.random())},e}();var kd=Object.freeze({__proto__:null,LegacyDestination:Rd,ajsDestinations:function(e,t,n,r,i,o){var s,a;if(void 0===n&&(n={}),void 0===r&&(r={}),un())return[];t.plan&&((r=null!=r?r:{}).plan=t.plan);var u=null!==(a=null===(s=t.middlewareSettings)||void 0===s?void 0:s.routingRules)&&void 0!==a?a:[],c=t.integrations,l=r.integrations,f=Or(t,null!=r?r:{}),h=null==o?void 0:o.reduce((function(e,t){var n;return vt(vt({},e),((n={})[function(e){return("Integration"in e?e.Integration:e).prototype.name}(t)]=t,n))}),{}),d=new Set(wt(wt([],Object.keys(c).filter((function(e){return function(e,t){var n,r=t.type,i=t.bundlingStatus,o=t.versionSettings,s="unbundled"!==i&&("browser"===r||(null===(n=null==o?void 0:o.componentTypes)||void 0===n?void 0:n.includes("browser")));return!e.startsWith("Segment")&&"Iterable"!==e&&s}(e,c[e])})),!0),Object.keys(h||{}).filter((function(e){return Mt(c[e])||Mt(null==l?void 0:l[e])})),!0));return Array.from(d).filter((function(e){return!function(e,t){var n=!1===t.All&&void 0===t[e];return!1===t[e]||n}(e,n)})).map((function(t){var n=function(e){var t,n,r,i;return null!==(i=null!==(n=null===(t=null==e?void 0:e.versionSettings)||void 0===t?void 0:t.override)&&void 0!==n?n:null===(r=null==e?void 0:e.versionSettings)||void 0===r?void 0:r.version)&&void 0!==i?i:"latest"}(c[t]),o=new Rd(t,n,e,f[t],r,null==h?void 0:h[t]);return u.filter((function(e){return e.destinationName===t})).length>0&&i&&o.addMiddleware(i),o}))}});var Cd=Object.freeze({__proto__:null,loadLegacyVideoPlugins:function(e){return _t(this,void 0,void 0,(function(){var t;return bt(this,(function(n){switch(n.label){case 0:return[4,Promise.resolve().then((function(){return Td}))];case 1:return t=n.sent(),e._plugins=t,[2]}}))}))}});var Pd=Object.freeze({__proto__:null,schemaFilter:function(e,t){function n(n){var r=e,i=n.event.event;if(r&&i){var o=r[i];if(!Ed(r,o))return n.updateEvent("integrations",vt(vt({},n.event.integrations),{All:!1,"Segment.io":!0})),n;var s=function(e,t){var n,r;if(!e||!Object.keys(e))return{};var i=e.integrations?Object.keys(e.integrations).filter((function(t){return!1===e.integrations[t]})):[],o=[];return(null!==(n=t.remotePlugins)&&void 0!==n?n:[]).forEach((function(e){i.forEach((function(t){(e.name.includes(t)||t.includes(e.name))&&o.push(e.name)}))})),(null!==(r=t.remotePlugins)&&void 0!==r?r:[]).reduce((function(e,t){return t.settings.subscriptions&&o.includes(t.name)&&t.settings.subscriptions.forEach((function(n){return e["".concat(t.name," ").concat(n.partnerAction)]=!1})),e}),{})}(o,t);n.updateEvent("integrations",vt(vt(vt({},n.event.integrations),null==o?void 0:o.integrations),s))}return n}return{name:"Schema Filter",version:"0.1.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},type:"before",page:n,alias:n,track:n,identify:n,group:n}}});var Ad=Object.freeze({__proto__:null,remoteMiddlewares:function(e,t,n){var r;return _t(this,void 0,void 0,(function(){var i,o,s,a,u=this;return bt(this,(function(c){switch(c.label){case 0:return un()?[2,[]]:(i=Sr(),o=null!==(r=t.enabledMiddleware)&&void 0!==r?r:{},s=Object.entries(o).filter((function(e){return e[0],e[1]})).map((function(e){return e[0]})),a=s.map((function(t){return _t(u,void 0,void 0,(function(){var r,o,s,a;return bt(this,(function(u){switch(u.label){case 0:r=t.replace("@segment/",""),o=r,n&&(o=btoa(r).replace(/=/g,"")),s="".concat(i,"/middleware/").concat(o,"/latest/").concat(o,".js.gz"),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Ar(s)];case 2:return u.sent(),[2,window["".concat(r,"Middleware")]];case 3:return a=u.sent(),e.log("error",a),e.stats.increment("failed_remote_middleware"),[3,4];case 4:return[2]}}))}))})),[4,Promise.all(a)]);case 1:return[2,c.sent().filter(Boolean)]}}))}))}}),Nd={exports:{}};!function(e,t){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){n.r(t);var r="function"==typeof fetch?fetch.bind():function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest;for(var o in i.open(t.method||"get",e,!0),t.headers)i.setRequestHeader(o,t.headers[o]);function s(){var e,t=[],n=[],r={};return i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(i,o,s){t.push(o=o.toLowerCase()),n.push([o,s]),e=r[o],r[o]=e?e+","+s:s})),{ok:2==(i.status/100|0),status:i.status,statusText:i.statusText,url:i.responseURL,clone:s,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},headers:{keys:function(){return t},entries:function(){return n},get:function(e){return r[e.toLowerCase()]},has:function(e){return e.toLowerCase()in r}}}}i.withCredentials="include"==t.credentials,i.onload=function(){n(s())},i.onerror=r,i.send(t.body)}))};t.default=r},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pluginName=t}return r(e,[{key:"track",value:function(e,t){window.analytics.track(e,t,{integration:{name:this.pluginName}})}}]),e}();t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeAnalytics=t.VimeoAnalytics=void 0;var r=o(n(3)),i=o(n(4));function o(e){return e&&e.__esModule?e:{default:e}}t.VimeoAnalytics=r.default,t.YouTubeAnalytics=i.default},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=o(n(0));function o(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"VimeoAnalytics"));return r.authToken=n,r.player=e,r.metadata={content:{},playback:{videoPlayer:"Vimeo"}},r.mostRecentHeartbeat=0,r.isPaused=!1,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"initialize",value:function(){var e=this,t={loaded:this.retrieveMetadata,play:this.trackPlay,pause:this.trackPause,ended:this.trackEnded,timeupdate:this.trackHeartbeat};for(var n in t)this.registerHandler(n,t[n]);this.player.getVideoId().then((function(t){e.retrieveMetadata({id:t})})).catch(console.error)}},{key:"registerHandler",value:function(e,t){var n=this;this.player.on(e,(function(e){n.updateMetadata(e),t.call(n,e)}))}},{key:"trackPlay",value:function(){this.isPaused?(this.track("Video Playback Resumed",this.metadata.playback),this.isPaused=!1):(this.track("Video Playback Started",this.metadata.playback),this.track("Video Content Started",this.metadata.content))}},{key:"trackEnded",value:function(){this.track("Video Playback Completed",this.metadata.playback),this.track("Video Content Completed",this.metadata.content)}},{key:"trackHeartbeat",value:function(){var e=this.mostRecentHeartbeat,t=this.metadata.playback.position;t!==e&&t-e>=10&&(this.track("Video Content Playing",this.metadata.content),this.mostRecentHeartbeat=Math.floor(t))}},{key:"trackPause",value:function(){this.isPaused=!0,this.track("Video Playback Paused",this.metadata.playback)}},{key:"retrieveMetadata",value:function(e){var t=this;return new Promise((function(n,r){var o=e.id;(0,i.default)("https://api.vimeo.com/videos/"+o,{headers:{Authorization:"Bearer "+t.authToken}}).then((function(e){return e.ok?e.json():r(e)})).then((function(e){t.metadata.content.title=e.name,t.metadata.content.description=e.description,t.metadata.content.publisher=e.user.name,t.metadata.playback.position=0,t.metadata.playback.totalLength=e.duration})).catch((function(e){return console.error("Request to Vimeo API Failed with: ",e),r(e)}))}))}},{key:"updateMetadata",value:function(e){var t=this;return new Promise((function(n,r){t.player.getVolume().then((function(r){r&&(t.metadata.playback.sound=100*r),t.metadata.playback.position=e.seconds,n()})).catch(r)}))}}]),t}(o(n(1)).default);t.default=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=o(n(0));function o(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"YoutubeAnalytics"));return r.player=e,r.apiKey=n,r.playerLoaded=!1,r.playbackStarted=!1,r.contentStarted=!1,r.isPaused=!1,r.isBuffering=!1,r.isSeeking=!1,r.lastRecordedTime={timeReported:Date.now(),timeElapsed:0},r.metadata=[{playback:{video_player:"youtube"},content:{}}],r.playlistIndex=0,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"initialize",value:function(){window.segmentYoutubeOnStateChange=this.onPlayerStateChange.bind(this),window.segmentYoutubeOnReady=this.onPlayerReady.bind(this),this.player.addEventListener("onReady","segmentYoutubeOnReady"),this.player.addEventListener("onStateChange","segmentYoutubeOnStateChange")}},{key:"onPlayerReady",value:function(e){this.retrieveMetadata()}},{key:"onPlayerStateChange",value:function(e){var t=this.player.getCurrentTime();switch(this.metadata[this.playlistIndex]&&(this.metadata[this.playlistIndex].playback.position=this.metadata[this.playlistIndex].content.position=t,this.metadata[this.playlistIndex].playback.quality=this.player.getPlaybackQuality(),this.metadata[this.playlistIndex].playback.sound=this.player.isMuted()?0:this.player.getVolume()),e.data){case-1:if(this.playerLoaded)break;this.retrieveMetadata(),this.playerLoaded=!0;break;case YT.PlayerState.BUFFERING:this.handleBuffer();break;case YT.PlayerState.PLAYING:this.handlePlay();break;case YT.PlayerState.PAUSED:this.handlePause();break;case YT.PlayerState.ENDED:this.handleEnd()}this.lastRecordedTime={timeReported:Date.now(),timeElapsed:1e3*this.player.getCurrentTime()}}},{key:"retrieveMetadata",value:function(){var e=this;return new Promise((function(t,n){var r=e.player.getVideoData(),o=e.player.getPlaylist()||[r.video_id],s=o.join();(0,i.default)("https://www.googleapis.com/youtube/v3/videos?id="+s+"&part=snippet,contentDetails&key="+e.apiKey).then((function(e){if(!e.ok){var t=new Error("Segment request to Youtube API failed (likely due to a bad API Key. Events will still be sent but will not contain video metadata)");throw t.response=e,t}return e.json()})).then((function(n){e.metadata=[];for(var r=0,i=0;i<o.length;i++){var s=n.items[i];e.metadata.push({content:{title:s.snippet.title,description:s.snippet.description,keywords:s.snippet.tags,channel:s.snippet.channelTitle,airdate:s.snippet.publishedAt}}),r+=a(s.contentDetails.duration)}for(i=0;i<o.length;i++)e.metadata[i].playback={total_length:r,video_player:"youtube"};t()})).catch((function(t){e.metadata=o.map((function(e){return{playback:{video_player:"youtube"},content:{}}})),n(t)}))}))}},{key:"handleBuffer",value:function(){var e=this.determineSeek();this.playbackStarted||(this.playbackStarted=!0,this.track("Video Playback Started",this.metadata[this.playlistIndex].playback)),e&&!this.isSeeking&&(this.isSeeking=!0,this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback)),this.isSeeking&&(this.track("Video Playback Seek Completed",this.metadata[this.playlistIndex].playback),this.isSeeking=!1);var t=this.player.getPlaylist();t&&0===this.player.getCurrentTime()&&this.player.getPlaylistIndex()!==this.playlistIndex&&(this.contentStarted=!1,this.playlistIndex===t.length-1&&0===this.player.getPlaylistIndex()&&(this.track("Video Playback Completed",this.metadata[this.player.getPlaylistIndex()].playback),this.track("Video Playback Started",this.metadata[this.player.getPlaylistIndex()].playback))),this.track("Video Playback Buffer Started",this.metadata[this.playlistIndex].playback),this.isBuffering=!0}},{key:"handlePlay",value:function(){this.contentStarted||(this.playlistIndex=this.player.getPlaylistIndex(),-1===this.playlistIndex&&(this.playlistIndex=0),this.track("Video Content Started",this.metadata[this.playlistIndex].content),this.contentStarted=!0),this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused&&(this.track("Video Playback Resumed",this.metadata[this.playlistIndex].playback),this.isPaused=!1)}},{key:"handlePause",value:function(){var e=this.determineSeek();this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused||(e?(this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback),this.isSeeking=!0):(this.track("Video Playback Paused",this.metadata[this.playlistIndex].playback),this.isPaused=!0))}},{key:"handleEnd",value:function(){this.track("Video Content Completed",this.metadata[this.playlistIndex].content),this.contentStarted=!1;var e=this.player.getPlaylistIndex(),t=this.player.getPlaylist();(t&&e===t.length-1||-1===e)&&(this.track("Video Playback Completed",this.metadata[this.playlistIndex].playback),this.playbackStarted=!1)}},{key:"determineSeek",value:function(){var e=this.isPaused||this.isBuffering?0:Date.now()-this.lastRecordedTime.timeReported,t=1e3*this.player.getCurrentTime()-this.lastRecordedTime.timeElapsed;return Math.abs(e-t)>2e3}}]),t}(o(n(1)).default);function a(e){var t=e.match(/PT(\d+H)?(\d+M)?(\d+S)?/);return t=t.slice(1).map((function(e){if(null!=e)return e.replace(/\D/,"")})),3600*(parseInt(t[0])||0)+60*(parseInt(t[1])||0)+(parseInt(t[2])||0)}t.default=s}])}(Nd);var Td=t({__proto__:null,default:f(Nd.exports)},[Nd.exports]);e.checkSupport=function(t){fl("checkSupport",t),(e=>{var t;el("setSupportOptions",e);const n=e.walletConnectVersion||1;let r,i,o=[];1===n?(i=e.chainId||1,r=[i]):(r=e.chains||Qc,i=r[0],o.push(...r),(null===(t=e.optionalChains)||void 0===t?void 0:t.length)&&o.push(...e.optionalChains.filter((e=>o.indexOf(e)<0))));const s=Object.assign(Object.assign({},e),{walletConnectVersion:n,chains:r,chainId:i,optionalChains:o,projectId:e.projectId||""});if(2===n&&(!e.projectId||""===e.projectId))throw new Error("WalletConnect requires a projectId. Please visit https://cloud.walletconnect.com to get one.");tl=s})(t);const n=nl();let r;return n.providerType,e.SupportedProviders.Ethereum,r=function(e){fl("checkEthereumSupport",e);const t=Js();let n=!1;try{n=!!ll()}catch(e){}const r={isLedgerConnectSupported:al(t),isLedgerConnectEnabled:!!n,isChainIdSupported:cl(e.chains),providerImplementation:Jc.LedgerConnect};r.isLedgerConnectSupported&&r.isLedgerConnectEnabled&&r.isChainIdSupported||(r.providerImplementation=Jc.WalletConnect);return function(e){Yc("setProviderImplementation",e),Xc=e}(r.providerImplementation),r}(n),fl("checkSupportResult is",r),hl=r,r},e.enableDebugLogs=()=>{n=!0},e.getProvider=function(){return c(this,void 0,void 0,(function*(){Yc("getProvider",Xc);const t=nl();if(t.providerType===e.SupportedProviders.Ethereum)return(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV2"))||(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV1"))||Xc!==Jc.LedgerConnect?(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV2"))||1!==t.walletConnectVersion&&!(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("connectKit_forceWcV1"))?yield Kc():yield ra():ll();throw new s}))},Object.defineProperty(e,"__esModule",{value:!0})}));//# sourceMappingURL=index.js.map