shopar-plugin
Version:
Plugin for the Web that seamlessly integrates into your webpage to create embedded virtual try-on and 3D preview capabilities.
2 lines • 964 kB
JavaScript
/*! For license information please see xzimg.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.__deeparDynamicJsModule_xzimg__=t():e.__deeparDynamicJsModule_xzimg__=t()}(self,(()=>(()=>{var e={683:()=>{},345:()=>{}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}n.r(r),n.d(r,{Foot:()=>jC,Geometry:()=>QC,Segmentation:()=>tT,VideoManager:()=>i});var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},t.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))((function(a,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function i(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,i)}u((r=r.apply(e,t||[])).next())}))}function s(e,t){var n,r,a,s,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function i(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,i[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function o(e,t,n){if(n||2===arguments.length)for(var r,a=0,s=t.length;a<s;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var i=function(){function e(e,t,n){this.NB_BUFFERS=5,this._videoFrames=[],this._nbFramesDelay=0,this._videoElement=e,null!==e&&(this._videoCanvas=document.createElement("canvas"),this._videoCanvas.style.display="none",this._videoCanvasContext=this._videoCanvas.getContext("2d",{willReadFrequently:!0})),null!=t&&(this._videoCanvas.width=t),null!=n&&(this._videoCanvas.height=n)}return e.prototype.getNbFramesDelay=function(){return this._nbFramesDelay},e.prototype.setNbFramesDelay=function(e){e>=0&&e<this.NB_BUFFERS?this._nbFramesDelay=e:console.error("Invalid frames delay, delay must be less than ",this.NB_BUFFERS)},e.prototype.getVideoCanvas=function(){return this._videoCanvas},e.prototype.preProcessWithBuffer=function(e){return this._videoFrames.length===this.NB_BUFFERS&&(this._videoFrames=this._videoFrames.slice(0,-1)),this._videoFrames=o([e],this._videoFrames,!0),!0},e.prototype.preProcess=function(){if(null==this._videoElement||0===this._videoElement.videoWidth||0===this._videoElement.videoHeight)return!1;this._videoCanvas.width===this._videoElement.videoWidth&&this._videoCanvas.height===this._videoElement.videoHeight||(this._videoFrames=[],this._videoCanvas.width=this._videoElement.videoWidth,this._videoCanvas.height=this._videoElement.videoHeight),this._videoCanvasContext.drawImage(this._videoElement,0,0,this._videoCanvas.width,this._videoCanvas.height);var e=this._videoCanvasContext.getImageData(0,0,this._videoCanvas.width,this._videoCanvas.height);return this._videoFrames.length===this.NB_BUFFERS&&(this._videoFrames=this._videoFrames.slice(0,-1)),this._videoFrames=o([e],this._videoFrames,!0),!0},e.prototype.postProcess=function(){if(this._nbFramesDelay>0&&this._videoFrames.length>0){var e=this._nbFramesDelay<this._videoFrames.length?this._videoFrames[this._nbFramesDelay]:this._videoFrames[this._videoFrames.length-1];this._videoCanvasContext.putImageData(e,0,0)}},e.prototype.getCameraFrame=function(){return this._nbFramesDelay>0&&this._videoFrames.length>0?this._nbFramesDelay<this._videoFrames.length?this._videoFrames[this._nbFramesDelay]:this._videoFrames[this._videoFrames.length-1]:this.getLastBuffer()},e.prototype.updateDelay=function(e){e>=0&&e<this.NB_BUFFERS?this._nbFramesDelay=e:console.error("Invalid frames delay, delay must be less than ",this.NB_BUFFERS)},e.prototype.getLastBuffer=function(){return this._videoFrames.length>0?this._videoFrames[0]:null},e.prototype.setOverlapingImage=function(e){this._videoCanvasContext.putImageData(e,10,10)},e}(),u=function(e,t){return u=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])},u(e,t)};function l(e,t){function n(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function c(e){return"function"==typeof e}var p=!1,h={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack,p=e},get useDeprecatedSynchronousErrorHandling(){return p}};function d(e){setTimeout((function(){throw e}),0)}var f={closed:!0,next:function(e){},error:function(e){if(h.useDeprecatedSynchronousErrorHandling)throw e;d(e)},complete:function(){}},m=Array.isArray||function(e){return e&&"number"==typeof e.length};function g(e){return null!==e&&"object"==typeof e}var y=function(){function e(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}return e.prototype=Object.create(Error.prototype),e}(),b=y,_=function(){function e(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}return e.prototype.unsubscribe=function(){var t;if(!this.closed){var n=this,r=n._parentOrParents,a=n._ctorUnsubscribe,s=n._unsubscribe,o=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,r instanceof e)r.remove(this);else if(null!==r)for(var i=0;i<r.length;++i)r[i].remove(this);if(c(s)){a&&(this._unsubscribe=void 0);try{s.call(this)}catch(e){t=e instanceof b?x(e.errors):[e]}}if(m(o)){i=-1;for(var u=o.length;++i<u;){var l=o[i];if(g(l))try{l.unsubscribe()}catch(e){t=t||[],e instanceof b?t=t.concat(x(e.errors)):t.push(e)}}}if(t)throw new b(t)}},e.prototype.add=function(t){var n=t;if(!t)return e.EMPTY;switch(typeof t){case"function":n=new e(t);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof e)){var r=n;(n=new e)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var a=n._parentOrParents;if(null===a)n._parentOrParents=this;else if(a instanceof e){if(a===this)return n;n._parentOrParents=[a,this]}else{if(-1!==a.indexOf(this))return n;a.push(this)}var s=this._subscriptions;return null===s?this._subscriptions=[n]:s.push(n),n},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}},e.EMPTY=function(e){return e.closed=!0,e}(new e),e}();function x(e){return e.reduce((function(e,t){return e.concat(t instanceof b?t.errors:t)}),[])}var w="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),v=function(e){function t(n,r,a){var s=e.call(this)||this;switch(s.syncErrorValue=null,s.syncErrorThrown=!1,s.syncErrorThrowable=!1,s.isStopped=!1,arguments.length){case 0:s.destination=f;break;case 1:if(!n){s.destination=f;break}if("object"==typeof n){n instanceof t?(s.syncErrorThrowable=n.syncErrorThrowable,s.destination=n,n.add(s)):(s.syncErrorThrowable=!0,s.destination=new k(s,n));break}default:s.syncErrorThrowable=!0,s.destination=new k(s,n,r,a)}return s}return l(t,e),t.prototype[w]=function(){return this},t.create=function(e,n,r){var a=new t(e,n,r);return a.syncErrorThrowable=!1,a},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this))},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var e=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this},t}(_),k=function(e){function t(t,n,r,a){var s,o=e.call(this)||this;o._parentSubscriber=t;var i=o;return c(n)?s=n:n&&(s=n.next,r=n.error,a=n.complete,n!==f&&(c((i=Object.create(n)).unsubscribe)&&o.add(i.unsubscribe.bind(i)),i.unsubscribe=o.unsubscribe.bind(o))),o._context=i,o._next=s,o._error=r,o._complete=a,o}return l(t,e),t.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;h.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},t.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,n=h.useDeprecatedSynchronousErrorHandling;if(this._error)n&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)n?(t.syncErrorValue=e,t.syncErrorThrown=!0):d(e),this.unsubscribe();else{if(this.unsubscribe(),n)throw e;d(e)}}},t.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var n=function(){return e._complete.call(e._context)};h.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),h.useDeprecatedSynchronousErrorHandling)throw e;d(e)}},t.prototype.__tryOrSetError=function(e,t,n){if(!h.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,n)}catch(t){return h.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(d(t),!0)}return!1},t.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},t}(v),I="function"==typeof Symbol&&Symbol.observable||"@@observable";function T(e){return e}var S=function(){function e(e){this._isScalar=!1,e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this.operator,a=function(e,t,n){if(e){if(e instanceof v)return e;if(e[w])return e[w]()}return e||t||n?new v(e,t,n):new v(f)}(e,t,n);if(r?a.add(r.call(a,this.source)):a.add(this.source||h.useDeprecatedSynchronousErrorHandling&&!a.syncErrorThrowable?this._subscribe(a):this._trySubscribe(a)),h.useDeprecatedSynchronousErrorHandling&&a.syncErrorThrowable&&(a.syncErrorThrowable=!1,a.syncErrorThrown))throw a.syncErrorValue;return a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){h.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),function(e){for(;e;){var t=e,n=t.closed,r=t.destination,a=t.isStopped;if(n||a)return!1;e=r&&r instanceof v?r:null}return!0}(e)?e.error(t):console.warn(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=E(t))((function(t,r){var a;a=n.subscribe((function(t){try{e(t)}catch(e){r(e),a&&a.unsubscribe()}}),r,t)}))},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[I]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 0===t.length?this:(0===(e=t).length?T:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=E(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function E(e){if(e||(e=h.Promise||Promise),!e)throw new Error("no Promise impl found");return e}var N=function(e){return function(t){for(var n=0,r=e.length;n<r&&!t.closed;n++)t.next(e[n]);t.complete()}},A="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator",C=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function R(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then}var M=function(e){if(e&&"function"==typeof e[I])return r=e,function(e){var t=r[I]();if("function"!=typeof t.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return t.subscribe(e)};if(C(e))return N(e);if(R(e))return n=e,function(e){return n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,d),e};if(e&&"function"==typeof e[A])return t=e,function(e){for(var n=t[A]();;){var r=void 0;try{r=n.next()}catch(t){return e.error(t),e}if(r.done){e.complete();break}if(e.next(r.value),e.closed)break}return"function"==typeof n.return&&e.add((function(){n.return&&n.return()})),e};var t,n,r,a=g(e)?"an invalid object":"'"+e+"'";throw new TypeError("You provided "+a+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")},F=function(e){function t(t){var n=e.call(this)||this;return n.parent=t,n}return l(t,e),t.prototype._next=function(e){this.parent.notifyNext(e)},t.prototype._error=function(e){this.parent.notifyError(e),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},t}(v),$=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t.prototype.notifyNext=function(e){this.destination.next(e)},t.prototype.notifyError=function(e){this.destination.error(e)},t.prototype.notifyComplete=function(){this.destination.complete()},t}(v);function O(e){return e&&"function"==typeof e.schedule}var D=function(e){function t(t,n,r){var a=e.call(this)||this;return a.parent=t,a.outerValue=n,a.outerIndex=r,a.index=0,a}return l(t,e),t.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},t.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},t}(v);function P(e,t,n,r,a){if(void 0===a&&(a=new D(e,n,r)),!a.closed)return t instanceof S?t.subscribe(a):M(t)(a)}var L=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t.prototype.notifyNext=function(e,t,n,r,a){this.destination.next(t)},t.prototype.notifyError=function(e,t){this.destination.error(e)},t.prototype.notifyComplete=function(e){this.destination.complete()},t}(v);function B(e,t){return new S((function(n){var r=new _,a=0;return r.add(t.schedule((function(){a!==e.length?(n.next(e[a++]),n.closed||r.add(this.schedule())):n.complete()}))),r}))}function U(e,t){return t?B(e,t):new S(N(e))}var W={};function z(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=void 0,r=void 0;return O(e[e.length-1])&&(r=e.pop()),"function"==typeof e[e.length-1]&&(n=e.pop()),1===e.length&&m(e[0])&&(e=e[0]),U(e,r).lift(new V(n))}var V=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new H(e,this.resultSelector))},e}(),H=function(e){function t(t,n){var r=e.call(this,t)||this;return r.resultSelector=n,r.active=0,r.values=[],r.observables=[],r}return l(t,e),t.prototype._next=function(e){this.values.push(W),this.observables.push(e)},t.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{this.active=t,this.toRespond=t;for(var n=0;n<t;n++){var r=e[n];this.add(P(this,r,void 0,n))}}},t.prototype.notifyComplete=function(e){0==(this.active-=1)&&this.destination.complete()},t.prototype.notifyNext=function(e,t,n){var r=this.values,a=r[n],s=this.toRespond?a===W?--this.toRespond:this.toRespond:0;r[n]=t,0===s&&(this.resultSelector?this._tryResultSelector(r):this.destination.next(r.slice()))},t.prototype._tryResultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(L);function G(e,t){return t?function(e,t){if(null!=e){if(function(e){return e&&"function"==typeof e[I]}(e))return function(e,t){return new S((function(n){var r=new _;return r.add(t.schedule((function(){var a=e[I]();r.add(a.subscribe({next:function(e){r.add(t.schedule((function(){return n.next(e)})))},error:function(e){r.add(t.schedule((function(){return n.error(e)})))},complete:function(){r.add(t.schedule((function(){return n.complete()})))}}))}))),r}))}(e,t);if(R(e))return function(e,t){return new S((function(n){var r=new _;return r.add(t.schedule((function(){return e.then((function(e){r.add(t.schedule((function(){n.next(e),r.add(t.schedule((function(){return n.complete()})))})))}),(function(e){r.add(t.schedule((function(){return n.error(e)})))}))}))),r}))}(e,t);if(C(e))return B(e,t);if(function(e){return e&&"function"==typeof e[A]}(e)||"string"==typeof e)return function(e,t){if(!e)throw new Error("Iterable cannot be null");return new S((function(n){var r,a=new _;return a.add((function(){r&&"function"==typeof r.return&&r.return()})),a.add(t.schedule((function(){r=e[A](),a.add(t.schedule((function(){if(!n.closed){var e,t;try{var a=r.next();e=a.value,t=a.done}catch(e){return void n.error(e)}t?n.complete():(n.next(e),this.schedule())}})))}))),a}))}(e,t)}throw new TypeError((null!==e&&typeof e||e)+" is not observable")}(e,t):e instanceof S?e:new S(M(e))}function j(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e[e.length-1];return O(n)?(e.pop(),B(e,n)):U(e)}function K(e,t){return function(n){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new q(e,t))}}var q=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new X(e,this.project,this.thisArg))},e}(),X=function(e){function t(t,n,r){var a=e.call(this,t)||this;return a.project=n,a.count=0,a.thisArg=r||a,a}return l(t,e),t.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(v),Y=new S((function(e){return e.complete()}));function Q(e,t){return new S(t?function(n){return t.schedule(J,0,{error:e,subscriber:n})}:function(t){return t.error(e)})}function J(e){var t=e.error;e.subscriber.error(t)}function Z(e){return function(t){return t.lift(new ee(e))}}var ee=function(){function e(e){this.callback=e}return e.prototype.call=function(e,t){return t.subscribe(new te(e,this.callback))},e}(),te=function(e){function t(t,n){var r=e.call(this,t)||this;return r.add(new _(n)),r}return l(t,e),t}(v),ne=function(){function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e}(),re=function(e){function t(t,n){var r=e.call(this)||this;return r.subject=t,r.subscriber=n,r.closed=!1,r}return l(t,e),t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var n=t.indexOf(this.subscriber);-1!==n&&t.splice(n,1)}}},t}(_),ae=function(e){function t(t){var n=e.call(this,t)||this;return n.destination=t,n}return l(t,e),t}(v),se=function(e){function t(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return l(t,e),t.prototype[w]=function(){return new ae(this)},t.prototype.lift=function(e){var t=new oe(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new ne;if(!this.isStopped)for(var t=this.observers,n=t.length,r=t.slice(),a=0;a<n;a++)r[a].next(e)},t.prototype.error=function(e){if(this.closed)throw new ne;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,n=t.length,r=t.slice(),a=0;a<n;a++)r[a].error(e);this.observers.length=0},t.prototype.complete=function(){if(this.closed)throw new ne;this.isStopped=!0;for(var e=this.observers,t=e.length,n=e.slice(),r=0;r<t;r++)n[r].complete();this.observers.length=0},t.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},t.prototype._trySubscribe=function(t){if(this.closed)throw new ne;return e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){if(this.closed)throw new ne;return this.hasError?(e.error(this.thrownError),_.EMPTY):this.isStopped?(e.complete(),_.EMPTY):(this.observers.push(e),new re(this,e))},t.prototype.asObservable=function(){var e=new S;return e.source=this,e},t.create=function(e,t){return new oe(e,t)},t}(S),oe=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return l(t,e),t.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},t.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},t.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},t.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):_.EMPTY},t}(se),ie=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return l(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return n&&!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new ne;return this._value},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(se);function ue(e){return void 0===e&&(e=-1),function(t){return t.lift(new le(e,t))}}var le=function(){function e(e,t){this.count=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new ce(e,this.count,this.source))},e}(),ce=function(e){function t(t,n,r){var a=e.call(this,t)||this;return a.count=n,a.source=r,a}return l(t,e),t.prototype.error=function(t){if(!this.isStopped){var n=this.source,r=this.count;if(0===r)return e.prototype.error.call(this,t);r>-1&&(this.count=r-1),n.subscribe(this._unsubscribeAndRecycle())}},t}(v);function pe(e,t){return"function"==typeof t?function(n){return n.pipe(pe((function(n,r){return G(e(n,r)).pipe(K((function(e,a){return t(n,e,r,a)})))})))}:function(t){return t.lift(new he(e))}}var he=function(){function e(e){this.project=e}return e.prototype.call=function(e,t){return t.subscribe(new de(e,this.project))},e}(),de=function(e){function t(t,n){var r=e.call(this,t)||this;return r.project=n,r.index=0,r}return l(t,e),t.prototype._next=function(e){var t,n=this.index++;try{t=this.project(e,n)}catch(e){return void this.destination.error(e)}this._innerSub(t)},t.prototype._innerSub=function(e){var t=this.innerSubscription;t&&t.unsubscribe();var n=new F(this),r=this.destination;r.add(n),this.innerSubscription=function(e,t){if(!t.closed){if(e instanceof S)return e.subscribe(t);var n;try{n=M(e)(t)}catch(e){t.error(e)}return n}}(e,n),this.innerSubscription!==n&&r.add(this.innerSubscription)},t.prototype._complete=function(){var t=this.innerSubscription;t&&!t.closed||e.prototype._complete.call(this),this.unsubscribe()},t.prototype._unsubscribe=function(){this.innerSubscription=void 0},t.prototype.notifyComplete=function(){this.innerSubscription=void 0,this.isStopped&&e.prototype._complete.call(this)},t.prototype.notifyNext=function(e){this.destination.next(e)},t}($);function fe(){}function me(e,t,n){return function(r){return r.lift(new ge(e,t,n))}}var ge=function(){function e(e,t,n){this.nextOrObserver=e,this.error=t,this.complete=n}return e.prototype.call=function(e,t){return t.subscribe(new ye(e,this.nextOrObserver,this.error,this.complete))},e}(),ye=function(e){function t(t,n,r,a){var s=e.call(this,t)||this;return s._tapNext=fe,s._tapError=fe,s._tapComplete=fe,s._tapError=r||fe,s._tapComplete=a||fe,c(n)?(s._context=s,s._tapNext=n):n&&(s._context=n,s._tapNext=n.next||fe,s._tapError=n.error||fe,s._tapComplete=n.complete||fe),s}return l(t,e),t.prototype._next=function(e){try{this._tapNext.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.next(e)},t.prototype._error=function(e){try{this._tapError.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.error(e)},t.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(e){return void this.destination.error(e)}return this.destination.complete()},t}(v);function be(e){return new S((function(t){var n;try{n=e()}catch(e){return void t.error(e)}return(n?G(n):Y).subscribe(t)}))}var _e=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function xe(){throw new Error("setTimeout has not been defined")}function we(){throw new Error("clearTimeout has not been defined")}var ve=xe,ke=we;function Ie(e){if(ve===setTimeout)return setTimeout(e,0);if((ve===xe||!ve)&&setTimeout)return ve=setTimeout,setTimeout(e,0);try{return ve(e,0)}catch(t){try{return ve.call(null,e,0)}catch(t){return ve.call(this,e,0)}}}"function"==typeof _e.setTimeout&&(ve=setTimeout),"function"==typeof _e.clearTimeout&&(ke=clearTimeout);var Te,Se=[],Ee=!1,Ne=-1;function Ae(){Ee&&Te&&(Ee=!1,Te.length?Se=Te.concat(Se):Ne=-1,Se.length&&Ce())}function Ce(){if(!Ee){var e=Ie(Ae);Ee=!0;for(var t=Se.length;t;){for(Te=Se,Se=[];++Ne<t;)Te&&Te[Ne].run();Ne=-1,t=Se.length}Te=null,Ee=!1,function(e){if(ke===clearTimeout)return clearTimeout(e);if((ke===we||!ke)&&clearTimeout)return ke=clearTimeout,clearTimeout(e);try{ke(e)}catch(t){try{return ke.call(null,e)}catch(t){return ke.call(this,e)}}}(e)}}function Re(e,t){this.fun=e,this.array=t}function Me(){}Re.prototype.run=function(){this.fun.apply(null,this.array)};var Fe=Me,$e=Me,Oe=Me,De=Me,Pe=Me,Le=Me,Be=Me,Ue=_e.performance||{},We=Ue.now||Ue.mozNow||Ue.msNow||Ue.oNow||Ue.webkitNow||function(){return(new Date).getTime()},ze=new Date,Ve={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Se.push(new Re(e,t)),1!==Se.length||Ee||Ie(Ce)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Fe,addListener:$e,once:Oe,off:De,removeListener:Pe,removeAllListeners:Le,emit:Be,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*We.call(Ue),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ze)/1e3}},He=Ve;class Ge{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class je{refCount(e){return Ke("refCount")}incRef(e){return Ke("incRef")}timerAvailable(){return!0}time(e){return Ke("time")}read(e){return Ke("read")}readSync(e){return Ke("readSync")}readToGPU(e,t){return Ke("readToGPU")}numDataIds(){return Ke("numDataIds")}disposeData(e,t){return Ke("disposeData")}write(e,t,n){return Ke("write")}move(e,t,n,r,a){return Ke("move")}createTensorFromGPUData(e,t,n){return Ke("createTensorFromGPUData")}memory(){return Ke("memory")}floatPrecision(){return Ke("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}dispose(){return Ke("dispose")}}function Ke(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function qe(e,t,n){return Math.max(e,Math.min(t,n))}function Xe(e){return e%2==0?e:e+1}function Ye(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Qe(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function Je(e,t,n=""){Qe(tt(e,t),(()=>n+` Shapes ${e} and ${t} must match`))}function Ze(e){Qe(null!=e,(()=>"The input to the tensor constructor must be a non-null value."))}function et(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function tt(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function nt(e){return e%1==0}function rt(e){const t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function at(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function st(e,t=(e=>0),n,r){return new Promise(((a,s)=>{let o=0;const i=()=>{if(e())return void a();o++;const u=t(o);null!=n&&o>=n?s():null!=r?r(i,u):setTimeout(i,u)};i()}))}function ot(e,t){let n=1,r=-1;for(let t=0;t<e.length;++t)if(e[t]>=0)n*=e[t];else if(-1===e[t]){if(-1!==r)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${r} and dim ${t}`);r=t}else if(e[t]<0)throw Error(`Shapes can not be < 0. Found ${e[t]} at dim ${t}`);if(-1===r){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(0===n)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!=0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);const a=e.slice();return a[r]=t/n,a}function it(e,t){const n=t.length;return Qe((e=null==e?t.map(((e,t)=>t)):[].concat(e)).every((e=>e>=-n&&e<n)),(()=>`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`)),Qe(e.every((e=>nt(e))),(()=>`All values in axis param must be integers but got axis ${e}`)),e.map((e=>e<0?n+e:e))}function ut(e,t){const n=[],r=[],a=null!=t&&Array.isArray(t)&&0===t.length,s=null==t||a?null:it(t,e).sort();let o=0;for(let t=0;t<e.length;++t){if(null!=s){if(s[o]===t&&1!==e[t])throw new Error(`Can't squeeze axis ${t} since its dim '${e[t]}' is not 1`);(null==s[o]||s[o]>t)&&1===e[t]&&(n.push(e[t]),r.push(t)),s[o]<=t&&o++}1!==e[t]&&(n.push(e[t]),r.push(t))}return{newShape:n,keptDims:r}}function lt(e,t){return ct(e,t)}function ct(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error(`Unknown data type ${e}`);n=new Array(t)}return n}function pt(e,t){return!("complex64"===t||"float32"===t&&"complex64"!==e||"int32"===t&&"float32"!==e&&"complex64"!==e||"bool"===t&&"bool"===e)}function ht(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error(`Unknown dtype ${e}`)}function dt(e){return"string"==typeof e||e instanceof String}function ft(e){return Array.isArray(e)?ft(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":"number"==typeof e?"float32":dt(e)?"string":function(e){return"boolean"==typeof e}(e)?"bool":"float32"}function mt(e){return!!(e&&e.constructor&&e.call&&e.apply)}function gt(e,t){for(let n=t;n<e;++n)if(e%n==0)return n;return e}function yt(e){const t=e.length;if(t<2)return[];const n=new Array(t-1);n[t-2]=e[t-1];for(let r=t-3;r>=0;--r)n[r]=n[r+1]*e[r+1];return n}function bt(e,t,n,r=!1){const a=new Array;if(1===t.length){const s=t[0]*(r?2:1);for(let t=0;t<s;t++)a[t]=n[e+t]}else{const s=t[0],o=t.slice(1),i=o.reduce(((e,t)=>e*t))*(r?2:1);for(let t=0;t<s;t++)a[t]=bt(e+t*i,o,n,r)}return a}function _t(e,t,n=!1){if(0===e.length)return t[0];const r=e.reduce(((e,t)=>e*t))*(n?2:1);if(0===r)return[];if(r!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return bt(0,e,t,n)}function xt(e,t){const n=wt(e,t);for(let e=0;e<n.length;e++)n[e]=1;return n}function wt(e,t){if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t)return new Uint8Array(e);throw new Error(`Unknown data type ${t}`)}function vt(e){e.forEach((t=>{Qe(Number.isInteger(t)&&t>=0,(()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`))}))}function kt(e,t,n){if(0===t)return 0;if(1===t)return e[0];let r=e[e.length-1];for(let t=0;t<e.length-1;++t)r+=n[t]*e[t];return r}function It(e,t,n){if(0===t)return[];if(1===t)return[e];const r=new Array(t);for(let t=0;t<r.length-1;++t)r[t]=Math.floor(e/n[t]),e-=r[t]*n[t];return r[r.length-1]=e,r}function Tt(e){return e&&e.then&&"function"==typeof e.then}const St="tfjsflags";class Et{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=Nt,this.populateURLFlags()}setPlatform(e,t){null!=this.platform&&(At().getBool("IS_TEST")||At().getBool("PROD")||console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${e}.`)),this.platformName=e,this.platform=t}registerFlag(e,t,n){if(this.flagRegistry[e]={evaluationFn:t,setHook:n},null!=this.urlFlags[e]){const t=this.urlFlags[e];At().getBool("IS_TEST")||At().getBool("PROD")||console.warn(`Setting feature override from URL ${e}: ${t}.`),this.set(e,t)}}async getAsync(e){return e in this.flags||(this.flags[e]=await this.evaluateFlag(e)),this.flags[e]}get(e){if(e in this.flags)return this.flags[e];const t=this.evaluateFlag(e);if(Tt(t))throw new Error(`Flag ${e} cannot be synchronously evaluated. Please use getAsync() instead.`);return this.flags[e]=t,this.flags[e]}getNumber(e){return this.get(e)}getBool(e){return this.get(e)}getString(e){return this.get(e)}getFlags(){return this.flags}get features(){return this.flags}set(e,t){if(null==this.flagRegistry[e])throw new Error(`Cannot set flag ${e} as it has not been registered.`);this.flags[e]=t,null!=this.flagRegistry[e].setHook&&this.flagRegistry[e].setHook(t)}evaluateFlag(e){if(null==this.flagRegistry[e])throw new Error(`Cannot evaluate flag '${e}': no evaluation function found.`);return this.flagRegistry[e].evaluationFn()}setFlags(e){this.flags=Object.assign({},e)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(void 0===this.global||void 0===this.global.location||void 0===this.global.location.search)return;const e=this.getQueryParams(this.global.location.search);St in e&&e[St].split(",").forEach((e=>{const[t,n]=e.split(":");this.urlFlags[t]=function(e,t){const n=t.toLowerCase();return"true"===n||"false"===n?"true"===n:""+ +n===n?+n:t}(0,n)}))}}function Nt(e){const t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,((e,...n)=>(function(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}(t,n[0],n[1]),n.join("=")))),t}function At(){return Rt}let Ct,Rt=null;function Mt(){if(null==Ct){let e;if("undefined"!=typeof window)e=window;else if(void 0!==_e)e=_e;else if(void 0!==He)e=He;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}Ct=e}return Ct}function Ft(e,t){const n=function(){const e=Mt();return null==e._tfGlobals&&(e._tfGlobals=new Map),e._tfGlobals}();if(n.has(e))return n.get(e);{const r=t();return n.set(e,r),n.get(e)}}const $t="Acos",Ot="Acosh",Dt="Add",Pt="AddN",Lt="All",Bt="Any",Ut="ArgMax",Wt="ArgMin",zt="Asin",Vt="Asinh",Ht="Atan",Gt="Atanh",jt="Atan2",Kt="AvgPool",qt="AvgPool3D",Xt="BatchMatMul",Yt="BatchToSpaceND",Qt="Bincount",Jt="BitwiseAnd",Zt="BroadcastArgs",en="Cast",tn="Ceil",nn="ClipByValue",rn="Concat",an="Conv2D",sn="Conv2DBackpropInput",on="Conv3D",un="Conv3DBackpropFilterV2",ln="Conv3DBackpropInputV2",cn="Cosh",pn="Cumprod",hn="Cumsum",dn="CropAndResize",fn="DenseBincount",mn="DepthToSpace",gn="DepthwiseConv2dNative",yn="Diag",bn="Dilation2D",_n="Dilation2DBackpropInput",xn="Dilation2DBackpropFilter",wn="RealDiv",vn="Elu",kn="EluGrad",In="Equal",Tn="Exp",Sn="ExpandDims",En="Expm1",Nn="Fill",An="FlipLeftRight",Cn="Floor",Rn="FloorDiv",Mn="FusedBatchNorm",Fn="GatherV2",$n="GatherNd",On="Greater",Dn="GreaterEqual",Pn="Identity",Ln="IsFinite",Bn="IsInf",Un="IsNan",Wn="LeakyRelu",zn="Less",Vn="LessEqual",Hn="LinSpace",Gn="Log1p",jn="LogicalAnd",Kn="LogicalNot",qn="LogicalOr",Xn="LRN",Yn="LRNGrad",Qn="Max",Jn="Maximum",Zn="MaxPool",er="MaxPool3D",tr="MaxPoolWithArgmax",nr="Mean",rr="Min",ar="Minimum",sr="MirrorPad",or="Multinomial",ir="Multiply",ur="NotEqual",lr="NonMaxSuppressionV3",cr="NonMaxSuppressionV4",pr="NonMaxSuppressionV5",hr="OnesLike",dr="OneHot",fr="Pack",mr="PadV2",gr="Prelu",yr="Prod",br="Range",_r="Reciprocal",xr="Relu",wr="Reshape",vr="ResizeNearestNeighbor",kr="ResizeNearestNeighborGrad",Ir="ResizeBilinear",Tr="ResizeBilinearGrad",Sr="Relu6",Er="Reverse",Nr="Round",Ar="Rsqrt",Cr="ScatterNd",Rr="TensorScatterUpdate",Mr="SearchSorted",Fr="Select",$r="Selu",Or="Slice",Dr="Sinh",Pr="Sign",Lr="Sigmoid",Br="Softplus",Ur="Sqrt",Wr="Sum",zr="SpaceToBatchND",Vr="SplitV",Hr="Softmax",Gr="SparseFillEmptyRows",jr="SparseReshape",Kr="SparseSegmentMean",qr="SparseSegmentSum",Xr="SparseToDense",Yr="SquaredDifference",Qr="StridedSlice",Jr="StringNGrams",Zr="StringSplit",ea="StringToHashBucketFast",ta="Sub",na="Tanh",ra="Tile",aa="TopK",sa="Transform",oa="Transpose",ia="Unique",ua="Unpack",la="ZerosLike",ca="Step",pa="FromPixels",ha="RotateWithOffset",da="_FusedMatMul",fa="FusedConv2D",ma="FusedDepthwiseConv2D";function ga(...e){At().getBool("IS_TEST")||At().getBool("PROD")||console.warn(...e)}const ya=Ft("kernelRegistry",(()=>new Map)),ba=Ft("gradRegistry",(()=>new Map));function _a(e,t){const n=ka(e,t);return ya.get(n)}function xa(e){return ba.get(e)}function wa(e){const t=ya.entries(),n=[];for(;;){const{done:r,value:a}=t.next();if(r)break;const[s,o]=a,[i]=s.split("_");i===e&&n.push(o)}return n}function va(e){const{kernelName:t,backendName:n}=e,r=ka(t,n);ya.has(r)&&ga(`The kernel '${t}' for backend '${n}' is already registered`),ya.set(r,e)}function ka(e,t){return`${t}_${e}`}function Ia(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}var Ta=Ea,Sa=null;try{Sa=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function Ea(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function Na(e){return!0===(e&&e.__isLong__)}Ea.prototype.__isLong__,Object.defineProperty(Ea.prototype,"__isLong__",{value:!0}),Ea.isLong=Na;var Aa={},Ca={};function Ra(e,t){var n,r,a;return t?(a=0<=(e>>>=0)&&e<256)&&(r=Ca[e])?r:(n=Fa(e,(0|e)<0?-1:0,!0),a&&(Ca[e]=n),n):(a=-128<=(e|=0)&&e<128)&&(r=Aa[e])?r:(n=Fa(e,e<0?-1:0,!1),a&&(Aa[e]=n),n)}function Ma(e,t){if(isNaN(e))return t?za:Wa;if(t){if(e<0)return za;if(e>=La)return Ka}else{if(e<=-Ba)return qa;if(e+1>=Ba)return ja}return e<0?Ma(-e,t).neg():Fa(e%Pa|0,e/Pa|0,t)}function Fa(e,t,n){return new Ea(e,t,n)}Ea.fromInt=Ra,Ea.fromNumber=Ma,Ea.fromBits=Fa;var $a=Math.pow;function Oa(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return Wa;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return Oa(e.substring(1),t,n).neg();for(var a=Ma($a(n,8)),s=Wa,o=0;o<e.length;o+=8){var i=Math.min(8,e.length-o),u=parseInt(e.substring(o,o+i),n);if(i<8){var l=Ma($a(n,i));s=s.mul(l).add(Ma(u))}else s=(s=s.mul(a)).add(Ma(u))}return s.unsigned=t,s}function Da(e,t){return"number"==typeof e?Ma(e,t):"string"==typeof e?Oa(e,t):Fa(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}Ea.fromString=Oa,Ea.fromValue=Da;var Pa=4294967296,La=Pa*Pa,Ba=La/2,Ua=Ra(1<<24),Wa=Ra(0);Ea.ZERO=Wa;var za=Ra(0,!0);Ea.UZERO=za;var Va=Ra(1);Ea.ONE=Va;var Ha=Ra(1,!0);Ea.UONE=Ha;var Ga=Ra(-1);Ea.NEG_ONE=Ga;var ja=Fa(-1,2147483647,!1);Ea.MAX_VALUE=ja;var Ka=Fa(-1,-1,!0);Ea.MAX_UNSIGNED_VALUE=Ka;var qa=Fa(0,-2147483648,!1);Ea.MIN_VALUE=qa;var Xa=Ea.prototype;Xa.toInt=function(){return this.unsigned?this.low>>>0:this.low},Xa.toNumber=function(){return this.unsigned?(this.high>>>0)*Pa+(this.low>>>0):this.high*Pa+(this.low>>>0)},Xa.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(qa)){var t=Ma(e),n=this.div(t),r=n.mul(t).sub(this);return n.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var a=Ma($a(e,6),this.unsigned),s=this,o="";;){var i=s.div(a),u=(s.sub(i.mul(a)).toInt()>>>0).toString(e);if((s=i).isZero())return u+o;for(;u.length<6;)u="0"+u;o=""+u+o}},Xa.getHighBits=function(){return this.high},Xa.getHighBitsUnsigned=function(){return this.high>>>0},Xa.getLowBits=function(){return this.low},Xa.getLowBitsUnsigned=function(){return this.low>>>0},Xa.getNumBitsAbs=function(){if(this.isNegative())return this.eq(qa)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},Xa.isZero=function(){return 0===this.high&&0===this.low},Xa.eqz=Xa.isZero,Xa.isNegative=function(){return!this.unsigned&&this.high<0},Xa.isPositive=function(){return this.unsigned||this.high>=0},Xa.isOdd=function(){return!(1&~this.low)},Xa.isEven=function(){return!(1&this.low)},Xa.equals=function(e){return Na(e)||(e=Da(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},Xa.eq=Xa.equals,Xa.notEquals=function(e){return!this.eq(e)},Xa.neq=Xa.notEquals,Xa.ne=Xa.notEquals,Xa.lessThan=function(e){return this.comp(e)<0},Xa.lt=Xa.lessThan,Xa.lessThanOrEqual=function(e){return this.comp(e)<=0},Xa.lte=Xa.lessThanOrEqual,Xa.le=Xa.lessThanOrEqual,Xa.greaterThan=function(e){return this.comp(e)>0},Xa.gt=Xa.greaterThan,Xa.greaterThanOrEqual=function(e){return this.comp(e)>=0},Xa.gte=Xa.greaterThanOrEqual,Xa.ge=Xa.greaterThanOrEqual,Xa.compare=function(e){if(Na(e)||(e=Da(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},Xa.comp=Xa.compare,Xa.negate=function(){return!this.unsigned&&this.eq(qa)?qa:this.not().add(Va)},Xa.neg=Xa.negate,Xa.add=function(e){Na(e)||(e=Da(e));var t=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,s=e.high>>>16,o=65535&e.high,i=e.low>>>16,u=0,l=0,c=0,p=0;return c+=(p+=a+(65535&e.low))>>>16,l+=(c+=r+i)>>>16,u+=(l+=n+o)>>>16,u+=t+s,Fa((c&=65535)<<16|(p&=65535),(u&=65535)<<16|(l&=65535),this.unsigned)},Xa.subtract=function(e){return Na(e)||(e=Da(e)),this.add(e.neg())},Xa.sub=Xa.subtract,Xa.multiply=function(e){if(this.isZero())return Wa;if(Na(e)||(e=Da(e)),Sa)return Fa(Sa.mul(this.low,this.high,e.low,e.high),Sa.get_high(),this.unsigned);if(e.isZero())return Wa;if(this.eq(qa))return e.isOdd()?qa:Wa;if(e.eq(qa))return this.isOdd()?qa:Wa;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Ua)&&e.lt(Ua))return Ma(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,s=e.high>>>16,o=65535&e.high,i=e.low>>>16,u=65535&e.low,l=0,c=0,p=0,h=0;return p+=(h+=a*u)>>>16,c+=(p+=r*u)>>>16,p&=65535,c+=(p+=a*i)>>>16,l+=(c+=n*u)>>>16,c&=65535,l+=(c+=r*i)>>>16,c&=65535,l+=(c+=a*o)>>>16,l+=t*u+n*i+r*o+a*s,Fa((p&=65535)<<16|(h&=65535),(l&=65535)<<16|(c&=65535),this.unsigned)},Xa.mul=Xa.multiply,Xa.divide=function(e){if(Na(e)||(e=Da(e)),e.isZero())throw Error("division by zero");var t,n,r;if(Sa)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?Fa((this.unsigned?Sa.div_u:Sa.div_s)(this.low,this.high,e.low,e.high),Sa.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?za:Wa;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return za;if(e.gt(this.shru(1)))return Ha;r=za}else{if(this.eq(qa))return e.eq(Va)||e.eq(Ga)?qa:e.eq(qa)?Va:(t=this.shr(1).div(e).shl(1)).eq(Wa)?e.isNegative()?Va:Ga:(n=this.sub(e.mul(t)),r=t.add(n.div(e)));if(e.eq(qa))return this.unsigned?za:Wa;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=Wa}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(t)/Math.LN2),s=a<=48?1:$a(2,a-48),o=Ma(t),i=o.mul(e);i.isNegative()||i.gt(n);)i=(o=Ma(t-=s,this.unsigned)).mul(e);o.isZero()&&(o=Va),r=r.add(o),n=n.sub(i)}return r},Xa.div=Xa.divide,Xa.modulo=function(e){return Na(e)||(e=Da(e)),Sa?Fa((this.unsigned?Sa.rem_u:Sa.rem_s)(this.low,this.high,e.low,e.high),Sa.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},Xa.mod=Xa.modulo,Xa.rem=Xa.modulo,Xa.not=function(){return Fa(~this.low,~this.high,this.unsigned)},Xa.and=function(e){return Na(e)||(e=Da(e)),Fa(this.low&e.low,this.high&e.high,this.unsigned)},Xa.or=function(e){return Na(e)||(e=Da(e)),Fa(this.low|e.low,this.high|e.high,this.unsigned)},Xa.xor=function(e){return Na(e)||(e=Da(e)),Fa(this.low^e.low,this.high^e.high,this.unsigned)},Xa.shiftLeft=function(e){return Na(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Fa(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):Fa(0,this.low<<e-32,this.unsigned)},Xa.shl=Xa.shiftLeft,Xa.shiftRight=function(e){return Na(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Fa(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):Fa(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},Xa.shr=Xa.shiftRight,Xa.shiftRightUnsigned=function(e){if(Na(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?Fa(this.low>>>e|t<<32-e,t>>>e,this.unsigned):Fa(32===e?t:t>>>e-32,0,this.unsigned)},Xa.shru=Xa.shiftRightUnsigned,Xa.shr_u=Xa.shiftRightUnsigned,Xa.toSigned=function(){return this.unsigned?Fa(this.low,this.high,!1):this},Xa.toUnsigned=function(){return this.unsigned?this:Fa(this.low,this.high,!0)},Xa.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},Xa.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},Xa.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},Ea.fromBytes=function(e,t,n){return n?Ea.fromBytesLE(e,t):Ea.fromBytesBE(e,t)},Ea.fromBytesLE=function(e,t){return new Ea(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},Ea.fromBytesBE=function(e,t){return new Ea(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};const Ya=Ta||e({__proto__:null,default:Ta},[Ta]);function Qa(e){return Ya.fromString(e,!0,16)}const Ja=Qa("c3a5c85c97cb3127"),Za=Qa("b492b66fbe98f273"),es=Qa("9ae16a3b2f90404f");function ts(e){return e.xor(e.shru(47))}function ns(e,t,n){const r=e.slice(t,t+n);return Ya.fromBytes(Array.from(r),!0,!0)}function rs(e,t){return ns(e,t,8)}function as(e,t){return ns(e,t,4)}function ss(e,t){return 0===t?e:e.shru(t).or(e.shl(64-t))}function os(e,t,n=Qa("9ddfea08eb382d69")){let r=e.xor(t).mul(n);r=r.xor(r.shru(47));let a=t.xor(r).mul(n);return a=a.xor(a.shru(47)),a=a.mul(n),a}function is(e,t,n,r){return function(e,t,n,r,a,s){a=a.add(e),s=ss(s.add(a).add(r),21);const o=a;return a=(a=a.add(t)).add(n),s=s.add(ss(a,44)),[a.add(r),s.add(o)]}(rs(e,t),rs(e,t+8),rs(e,t+16),rs(e,t+24),n,r)}function us(e,t=e.length){const n=Ya.fromNumber(81,!0);if(t<=32)return t<=16?function(e,t=e.length){if(t>=8){const n=es.add(2*t),r=rs(e,0).add(es),a=rs(e,t-8);return os(ss(a,37).mul(n).add(r),ss(r,25).add(a).mul(n),n)}if(t>=4){const n=es.add(2*t);return os(as(e,0).shl(3).add(t),as(e,t-4),n)}if(t>0){const n=e[0]+(e[t>>1]<<8),r=t+(e[t-1]<<2);return ts(es.mul(n).xor(Ja.mul(r))).mul(es)}return es}(e,t):function(e,t=e.length