From 5a9a9f6d57950bf1173a1c70581e53b74a966d5e Mon Sep 17 00:00:00 2001 From: fenglibin Date: Wed, 10 Jan 2024 17:33:34 +0800 Subject: [PATCH] update window-manager to 0.4.66 --- carrot.yml | 2 +- sdk/src/main/assets/whiteboard/{750b0e5 => 55b0a29} | 0 sdk/src/main/assets/whiteboard/index.html | 2 +- .../{netless.b3f4d38b.js => netless.1d95ce3a.js} | 8 ++++---- 4 files changed, 6 insertions(+), 6 deletions(-) rename sdk/src/main/assets/whiteboard/{750b0e5 => 55b0a29} (100%) rename sdk/src/main/assets/whiteboard/{netless.b3f4d38b.js => netless.1d95ce3a.js} (90%) diff --git a/carrot.yml b/carrot.yml index 0b695786..5174186c 100644 --- a/carrot.yml +++ b/carrot.yml @@ -1,4 +1,4 @@ - name: whiteboard-bridge repoPath: ../whiteboard-bridge repoURL: 'https://github.com/netless-io/whiteboard-bridge.git' - commit: 750b0e5 + commit: 55b0a29 diff --git a/sdk/src/main/assets/whiteboard/750b0e5 b/sdk/src/main/assets/whiteboard/55b0a29 similarity index 100% rename from sdk/src/main/assets/whiteboard/750b0e5 rename to sdk/src/main/assets/whiteboard/55b0a29 diff --git a/sdk/src/main/assets/whiteboard/index.html b/sdk/src/main/assets/whiteboard/index.html index abb24788..aa4bc89f 100644 --- a/sdk/src/main/assets/whiteboard/index.html +++ b/sdk/src/main/assets/whiteboard/index.html @@ -1 +1 @@ -white-sdk-bridge Application
\ No newline at end of file +white-sdk-bridge Application
\ No newline at end of file diff --git a/sdk/src/main/assets/whiteboard/netless.b3f4d38b.js b/sdk/src/main/assets/whiteboard/netless.1d95ce3a.js similarity index 90% rename from sdk/src/main/assets/whiteboard/netless.b3f4d38b.js rename to sdk/src/main/assets/whiteboard/netless.1d95ce3a.js index 5c8ebdc8..40eefe54 100644 --- a/sdk/src/main/assets/whiteboard/netless.b3f4d38b.js +++ b/sdk/src/main/assets/whiteboard/netless.1d95ce3a.js @@ -257,7 +257,7 @@ var Xp=new jl.j,Qp=function(){function e(e){this.renderer=e}return e.prototype.i */ t.videoJsPlugin=function(e){var t;return e&&(t=e,I=x(x({},A),t)),{kind:E,render:de,defaultAttributes:{src:"",poster:"",hostTime:0,currentTime:0,paused:!0,muted:!1,volume:1,close:!0}}}},14976:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||a(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]&&arguments[2];n?this.asyncMethods.set(e,t):this.methods.set(e,t)}},{key:"registerAsyn",value:function(e,t){this.asyncMethods.set(e,t)}},{key:"recv",value:function(e){if("string"==typeof e){var t=(0,o.parseBridgeMessage)(e),n=t.type,r=t.actionId,i=t.method,a=t.payload;switch(this.verbose&&console.log({type:n,actionId:r,method:i,payload:a}),n){case o.BridgeEventType.req:var s={data:void 0,actionId:r,complete:!0},u=function(e,t){try{s.data=e.apply(t,a);var n=(0,o.bridgeMessageTemplate)(o.BridgeEventType.ack,r,o.ackTypeSuccess,s);window.ReactNativeWebView.postMessage(n)}catch(e){var i=(0,o.bridgeMessageTemplate)(o.BridgeEventType.ack,r,o.ackTypeError,e);window.ReactNativeWebView.postMessage(i)}},l=function(e,t){a.push((function(e,t){s.data=e,s.complete=!1!==t;var n="",i=!1;if("string"==typeof e)try{var a=JSON.parse(e);i=!(!a.error&&!a.__error)}catch(e){}else i=!(!e||!e.error&&!e.__error);n=i?(0,o.bridgeMessageTemplate)(o.BridgeEventType.ack,r,o.ackTypeError,s.data):(0,o.bridgeMessageTemplate)(o.BridgeEventType.ack,r,o.ackTypeSuccess,s),window.ReactNativeWebView.postMessage(n)}));try{e.apply(t,a)}catch(e){var n=(0,o.bridgeMessageTemplate)(o.BridgeEventType.ack,r,o.ackTypeError,e);window.ReactNativeWebView.postMessage(n)}},c=this.methods.get(i),h=this.asyncMethods.get(i);if(c)u(c,this.methods);else if(h)l(h,this.asyncMethods);else{var d=i.split(".");if(d.length<2)return;var f=d.pop(),p=d.join("."),v=this.methods.get(p);if(v){var m=v[f];if(m&&"function"==typeof m)return void u(m,v)}var g=this.asyncMethods.get(p);if(g){var y=g[f];if(y&&"function"==typeof y)return void l(y,g)}console.log("method ".concat(i," not found"))}break;case o.BridgeEventType.ack:var b=a;if(this.queue.has(r)){var x=this.queue.get(r);x.ack=!0,i===o.ackTypeError?x.reject(a):(x.resolve(b.data),x.callback&&x.callback(b.data)),b.complete&&this.queue.delete(r)}}}}}],n&&r(t.prototype,n),a&&r(t,a),e}();t.Bridge=a},5419:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.parseBridgeMessage=t.bridgeMessageTemplate=t.ackTypeError=t.ackTypeSuccess=t.BridgeEventType=void 0,function(e){e.req="req",e.evt="evt",e.ack="ack"}(t.BridgeEventType||(t.BridgeEventType={})),t.ackTypeSuccess="success",t.ackTypeError="error",t.bridgeMessageTemplate=function(e,t,n,r){return JSON.stringify({type:e,actionId:t,method:n,payload:r})},t.parseBridgeMessage=function(e){try{var t=JSON.parse(e);return{type:t.type,actionId:t.actionId,method:t.method,payload:t.payload}}catch(t){return console.log("parse bridge message ".concat(e," failed: "),t),{type:"fail",actionId:"",method:"",payload:e}}}},13324:function(e,t,n){var r=Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]},i=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RNBridge=t.RNCommon=void 0,t.RNCommon=o(n(5419));var a=n(5397);Object.defineProperty(t,"RNBridge",{enumerable:!0,get:function(){return a.Bridge}})},79888:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},87980:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)} /*! For license information please see index.js.LICENSE.txt */var i;e=n.nmd(e),window,i=function(e,t){return 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"==r(e)&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},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=12)}([function(t,n){t.exports=e},function(e,t,n){(function(e,i){n.d(t,"a",(function(){return et}));var o=function(e,t){return(o=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])})(e,t)};function a(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=o.next()).done;)a.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 a}function l(){for(var e=[],t=0;t2&&ne("box");var n=Q(t);return new Se(e,Z(n),n.name,!0,n.equals)},shallowBox:function(e,t){return arguments.length>2&&ne("shallowBox"),te.box(e,{name:t,deep:!1})},array:function(e,t){arguments.length>2&&ne("array");var n=Q(t);return new Tt(e,Z(n),n.name)},shallowArray:function(e,t){return arguments.length>2&&ne("shallowArray"),te.array(e,{name:t,deep:!1})},map:function(e,t){arguments.length>2&&ne("map");var n=Q(t);return new kt(e,Z(n),n.name)},shallowMap:function(e,t){return arguments.length>2&&ne("shallowMap"),te.map(e,{name:t,deep:!1})},set:function(e,t){arguments.length>2&&ne("set");var n=Q(t);return new Rt(e,Z(n),n.name)},object:function(e,t,n){"string"==typeof arguments[1]&&ne("object");var r=Q(n);return rt({},e,t,r)},shallowObject:function(e,t){return"string"==typeof arguments[1]&&ne("shallowObject"),te.object(e,{},{name:t,deep:!1})},ref:K,shallow:J,deep:q,struct:$},te=function e(t,n,r){if("string"==typeof arguments[1])return q.apply(null,arguments);if(at(t))return t;var i=x(t)?e.object(t,n,r):Array.isArray(t)?e.array(t,n):M(t)?e.map(t,n):S(t)?e.set(t,n):t;if(i!==t)return i;v(!1)};function ne(e){v("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}Object.keys(ee).forEach((function(e){return te[e]=ee[e]}));var re,ie,oe=G(!1,(function(e,t,n,r,i){var o=n.get,a=n.set,u=i[0]||{};!function(e,t,n){var r=Bt(e);n.name=r.name+"."+t,n.context=e,r.values[t]=new Ee(n),Object.defineProperty(e,t,function(e){return Ft[e]||(Ft[e]={configurable:Ne.computedConfigurable,enumerable:!1,get:function(){return zt(this).read(this,e)},set:function(t){zt(this).write(this,e,t)}})}(t))}(e,t,s({get:o,set:a},u))}));oe({equals:j.structural}),function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(re||(re={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(ie||(ie={}));var ae=function(e){this.cause=e};function se(e){return e instanceof ae}function ue(e){switch(e.dependenciesState){case re.UP_TO_DATE:return!1;case re.NOT_TRACKING:case re.STALE:return!0;case re.POSSIBLY_STALE:for(var t=ve(!0),n=fe(),r=e.observing,i=r.length,o=0;o0;Ne.computationDepth>0&&t&&v(!1),Ne.allowStateChanges||!t&&"strict"!==Ne.enforceActions||v(!1)}function ce(e,t,n){var r=ve(!0);ge(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Ne.runId;var i,o=Ne.trackingDerivation;if(Ne.trackingDerivation=e,!0===Ne.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new ae(e)}return Ne.trackingDerivation=o,function(e){for(var t=e.observing,n=e.observing=e.newObserving,r=re.UP_TO_DATE,i=0,o=e.unboundDepsCount,a=0;ar&&(r=s.dependenciesState);for(n.length=i,e.newObserving=null,o=t.length;o--;)0===(s=t[o]).diffValue&&De(s,e),s.diffValue=0;for(;i--;){var s;1===(s=n[i]).diffValue&&(s.diffValue=0,ke(s,e))}r!==re.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}(e),e.observing.length,me(r),i}function he(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)De(t[n],e);e.dependenciesState=re.NOT_TRACKING}function de(e){var t=fe(),n=e();return pe(t),n}function fe(){var e=Ne.trackingDerivation;return Ne.trackingDerivation=null,e}function pe(e){Ne.trackingDerivation=e}function ve(e){var t=Ne.allowStateReads;return Ne.allowStateReads=e,t}function me(e){Ne.allowStateReads=e}function ge(e){if(e.dependenciesState!==re.UP_TO_DATE){e.dependenciesState=re.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=re.UP_TO_DATE}}var ye=0,be=1,xe=Object.getOwnPropertyDescriptor((function(){}),"name");function _e(e,t){var n=function(){return we(e,t,this,arguments)};return n.isMobxAction=!0,n}function we(e,t,n,r){var i=function(e,t,n){var r=Ge()&&!!e,i=0;if(r){i=Date.now();var o=n&&n.length||0,a=new Array(o);if(o>0)for(var s=0;s0&&!e.__mobxGlobals&&(Ce=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Ie).version&&(Ce=!1),Ce?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Ie):(setTimeout((function(){v("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Ie)}();function ke(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function De(e,t){if(1===e.observers.length)e.observers.length=0,Pe(e);else{var n=e.observers,r=e.observersIndexes,i=n.pop();if(i!==t){var o=r[t.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[t.__mapid]}}function Pe(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,Ne.pendingUnobservations.push(e))}function Oe(){Ne.inBatch++}function Re(){if(0==--Ne.inBatch){Ue();for(var e=Ne.pendingUnobservations,t=0;t0&&Pe(e),!1)}function je(e,t){if(console.log("[mobx.trace] '"+e.name+"' is invalidated due to a change in: '"+t.name+"'"),e.isTracing===ie.BREAK){var n=[];!function e(t,n,r){n.length>=1e3?n.push("(and many more)"):(n.push(""+new Array(r).join("\t")+t.name),t.dependencies&&t.dependencies.forEach((function(t){return e(t,n,r+1)})))}((r=e,it(Vt(r,void 0))),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof Ee?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}var r}var Be=function(){function e(e,t,n,r){void 0===e&&(e="Reaction@"+p()),void 0===r&&(r=!1),this.name=e,this.onInvalidate=t,this.errorHandler=n,this.requiresObservable=r,this.observing=[],this.newObserving=[],this.dependenciesState=re.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+p(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=ie.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Ne.pendingReactions.push(this),Ue())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(Oe(),this._isScheduled=!1,ue(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&Ge()&&He({name:this.name,type:"scheduled-reaction"})}catch(e){this.reportExceptionInDerivation(e)}}Re()}},e.prototype.track=function(e){Oe();var t,n=Ge();n&&(t=Date.now(),Ve({name:this.name,type:"reaction"})),this._isRunning=!0;var r=ce(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&he(this),se(r)&&this.reportExceptionInDerivation(r.cause),n&&Ye({time:Date.now()-t}),Re()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)this.errorHandler(e,this);else{if(Ne.disableErrorBoundaries)throw e;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";Ne.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)"):console.error(n,e),Ge()&&He({type:"error",name:this.name,message:n,error:""+e}),Ne.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Oe(),he(this),Re()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.trace=function(e){void 0===e&&(e=!1),function(){for(var e=[],t=0;t0||Ne.isRunningReactions||function(e){e()}(Fe)}function Fe(){Ne.isRunningReactions=!0;for(var e=Ne.pendingReactions,t=0;e.length>0;){100==++t&&(console.error("Reaction doesn't converge to a stable state after 100 iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",e):2===arguments.length&&"function"==typeof t?_e(e,t):1===arguments.length&&"string"==typeof e?Qe(e):!0!==r?Qe(t).apply(null,arguments):void(e[t]=_e(e.name||t,n.value))};function Je(e,t,n){_(e,t,_e(t,n.bind(e)))}qe.bound=function(e,t,n,r){return!0===r?(Je(e,t,n.value),null):n?{configurable:!0,enumerable:!1,get:function(){return Je(this,t,n.value||n.initializer.call(this)),this[t]},set:Xe}:{enumerable:!1,configurable:!0,set:function(e){Je(this,t,e)},get:function(){}}};var Ke=function(e){return e()};function $e(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Ke}function et(e,t,n){void 0===n&&(n=h),"boolean"==typeof n&&(n={fireImmediately:n});var r,i,o,a=n.name||"Reaction@"+p(),s=qe(a,n.onError?(r=n.onError,i=t,function(){try{return i.apply(this,arguments)}catch(e){r.call(this,e)}}):t),u=!n.scheduler&&!n.delay,l=$e(n),c=!0,d=!1,f=n.compareStructural?j.structural:n.equals||j.default,v=new Be(a,(function(){c||u?m():d||(d=!0,l(m))}),n.onError,n.requiresObservable);function m(){if(d=!1,!v.isDisposed){var t=!1;v.track((function(){var n=e(v);t=c||!f(o,n),o=n})),c&&n.fireImmediately&&s(o,v),c||!0!==t||s(o,v),c&&(c=!1)}}return v.schedule(),v.getDisposer()}function tt(e,t,n){return nt("onBecomeUnobserved",e,t,n)}function nt(e,t,n,r){var i="function"==typeof r?Vt(t,n):Vt(t),o="function"==typeof r?r:n,a=i[e];return"function"!=typeof a?v(!1):(i[e]=function(){a.call(this),o.call(this)},function(){i[e]=a})}function rt(e,t,n,r){var i=(r=Q(r)).defaultDecorator||(!1===r.deep?K:q);z(e),Bt(e,r.name,i.enhancer),Oe();try{for(var o in t){var a=Object.getOwnPropertyDescriptor(t,o),s=(n&&o in n?n[o]:a.get?oe:i)(e,o,a,!0);s&&Object.defineProperty(e,o,s)}}finally{Re()}return e}function it(e){var t,n,r={name:e.name};return e.observing&&e.observing.length>0&&(r.dependencies=(t=e.observing,n=[],t.forEach((function(e){-1===n.indexOf(e)&&n.push(e)})),n).map(it)),r}function ot(e,t){if(null==e)return!1;if(void 0!==t){if(Ht(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return Ht(e)||!!e.$mobx||R(e)||ze(e)||Ae(e)}function at(e){return 1!==arguments.length&&v(!1),ot(e)}function st(e){switch(e.length){case 0:return Ne.trackingDerivation;case 1:return Vt(e[0]);case 2:return Vt(e[0],e[1])}}function ut(e,t){void 0===t&&(t=void 0),Oe();try{return e.apply(t)}finally{Re()}}function lt(e){return void 0!==e.interceptors&&e.interceptors.length>0}function ct(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),g((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ht(e,t){var n=fe();try{var r=e.interceptors;if(r)for(var i=0,o=r.length;i0}function ft(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),g((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function pt(e,t){var n=fe(),r=e.changeListeners;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},e.prototype.intercept=function(e){return ct(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),ft(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r0&&e+t+1>xt&&At(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var r=this;le(this.atom);var i=this.values.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=c),lt(this)){var o=ht(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!o)return c;t=o.removedCount,n=o.added}var a=(n=0===n.length?n:n.map((function(e){return r.enhancer(e,void 0)}))).length-t;this.updateArrayLength(i,a);var s=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,s),this.dehanceValues(s)},e.prototype.spliceItemsIntoValues=function(e,t,n){var r;if(n.length<1e4)return(r=this.values).splice.apply(r,l([e,t],n));var i=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),i},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&Ge(),i=dt(this),o=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&Ve(s(s({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&pt(this,o),r&&Ye()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&Ge(),i=dt(this),o=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&Ve(s(s({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&pt(this,o),r&&Ye()},e}(),Tt=function(e){function t(t,n,r,i){void 0===r&&(r="ObservableArray@"+p()),void 0===i&&(i=!1);var o=e.call(this)||this,a=new wt(r,n,o,i);if(w(o,"$mobx",a),t&&t.length){var s=Te(!0);o.spliceWithArray(0,0,t),Me(s)}return bt&&Object.defineProperty(a.array,"0",Mt),o}return a(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,i=this.$mobx.values;r=e1)for(var n=1;n=2&&(this.player.currentTime=e)},e}(),d=(r=function(e,t){return(r=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])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(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(a,s)}u((r=r.apply(e,t||[])).next())}))},p=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1e3&&(n.lastSyncProgressTimestamp=r,n.selfUserInf&&n.selfUserInf.identity===i.host&&t.putAttributes({currentTime:e,play:n.playerState}))},n.handleSeekReaction=function(e,t){n.isHost()||n.player.current&&void 0!==t&&(n.player.current.currentTime=e+Date.now()/1e3-t)},n.handleRemove=function(){return f(n,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=this.props.plugin,this.handleRemotePlayState(!1),[4,v(300)];case 1:return t.sent(),e.remove(),[2]}}))}))},n.timeUpdate=function(){if(n.player.current){var e=n.player.current.currentTime;n.onTimeUpdate(e)}},n.detectAudioClickEnable=function(){var e=n.props.plugin;return e.context&&e.context.identity?e.context.identity!==i.host?"none":"auto":"none"},n.renderMuteBox=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity!==i.host&&n.state.selfMute?o.createElement("div",{className:"media-mute-box"},o.createElement("div",{onClick:function(){n.setState({selfMute:!1})},onTouchStart:function(){n.setState({selfMute:!1})},style:{pointerEvents:"auto"},className:"media-mute-box-inner"},o.createElement("img",{src:u,alt:"mute_icon"}),o.createElement("span",null,"unmute"))):null},n.renderDeleteBtn=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity===i.host?o.createElement("div",{style:{pointerEvents:"auto"},className:"plugin-audio-box-delete",onClick:n.handleRemove},o.createElement("img",{src:c,alt:"delete_icon"})):null},n.renderNavigation=function(){return!0===n.props.plugin.attributes.isNavigationDisable?null:o.createElement("div",{className:"plugin-audio-box-nav"},o.createElement("div",null,o.createElement("img",{style:{width:20,marginLeft:8},src:l,alt:"audio_plugin"}),o.createElement("span",null,"Audio Player")),n.renderDeleteBtn())},n.handleFirstSeek=function(e){if(!e){var t,r=n.props.plugin,i=Date.now()/1e3;t=r.attributes.seekTime?r.attributes.seek+i-r.attributes.seekTime:r.attributes.seek,n.syncNode.syncProgress(t)}},n.player=o.createRef(),n.reactionPlayDisposer=n.startPlayReaction(),n.reactionSeekDisposer=n.startSeekReaction(),n.reactionVolumeDisposer=n.startVolumeReaction(),n.reactionMuteDisposer=n.startMuteTimeReaction(),n.reactionSeekTimeDisposer=n.startSeekTimeReaction(),n.reactionSyncDisposer=n.startSyncReaction(),n.state={play:!1,seek:0,selfMute:!1,currentTime:0,mute:!1,volume:1,isEnd:!1},n}return d(t,e),t.prototype.componentDidMount=function(){return f(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.syncNode=new h(this.player.current),[4,this.handleStartCondition()];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.play}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.isHost()?[3,2]:[4,this.handleNativePlayerState(t)];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))}))},t.prototype.startSeekTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seekTime}),(function(n){e.handleSeekReaction(t.attributes.seek,n)}))},t.prototype.startSeekReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seek}),(function(n){e.handleSeekReaction(n,t.attributes.seekTime)}))},t.prototype.startSyncReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.currentTime}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){return this.isHost()||this.player.current&&Math.abs(t-this.player.current.currentTime)>2&&(this.player.current.currentTime=t),[2]}))}))}))},t.prototype.startVolumeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.volume}),(function(t){e.isHost()||e.player.current&&(e.player.current.volume=t)}))},t.prototype.startMuteTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.mute}),(function(t){e.isHost()||e.setState({mute:t})}))},t.prototype.componentWillUnmount=function(){this.reactionPlayDisposer(),this.reactionSeekDisposer(),this.reactionMuteDisposer(),this.reactionVolumeDisposer(),this.reactionSyncDisposer(),this.player.current&&this.player.current.pause()},t.prototype.render=function(){var e=this,t=this.props,n=t.size,r=t.plugin,a=t.scale,s=0===a?1:a,u=navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform);return o.createElement("div",{className:"plugin-audio-box",style:{width:n.width/s,height:n.height/s,transform:"scale("+s+")"}},this.renderNavigation(),o.createElement("div",{className:"plugin-audio-box-body"},this.renderMuteBox(),o.createElement("div",{className:"white-plugin-audio-box"},o.createElement("audio",{className:"white-plugin-audio",src:r.attributes.pluginAudioUrl,ref:this.player,muted:this.state.mute?this.state.mute:this.state.selfMute,style:{width:"100%",height:54,pointerEvents:this.detectAudioClickEnable(),outline:"none"},onLoadedMetadataCapture:function(){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return u?[4,v(300)]:[3,2];case 1:e.sent(),this.handleFirstSeek(this.state.isEnd),e.label=2;case 2:return[2]}}))}))},onEnded:function(){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.player.current?this.selfUserInf?this.selfUserInf.identity!==i.host?[3,2]:(r.putAttributes({seek:0,seekTime:void 0,currentTime:0}),[4,v(500)]):[3,5]:[3,7];case 1:return e.sent(),this.player.current.load(),[3,4];case 2:return[4,v(1e3)];case 3:e.sent(),this.player.current.load(),e.label=4;case 4:return[3,7];case 5:return[4,v(1e3)];case 6:e.sent(),this.player.current.load(),e.label=7;case 7:return this.setState({isEnd:!0}),[2]}}))}))},controls:!0,controlsList:"nodownload nofullscreen",onTimeUpdate:this.timeUpdate,preload:"auto"}))))},t}(o.Component),b=(g=function(e,t){return(g=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])})(e,t)},function(e,t){function n(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),x=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(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(a,s)}u((r=r.apply(e,t||[])).next())}))},_=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1] img {\n width: 20px;\n margin-left: 8px;\n}\n.white-audio-plugin-nav-title {\n margin-left: 6px;\n font-size: 12px;\n font-weight: bold;\n flex-grow: 1;\n}\n.white-audio-plugin-nav-delete {\n width: 22px;\n height: 22px;\n border: 0;\n background-color: #ff756e;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n margin-right: 8px;\n cursor: pointer;\n opacity: 0.6;\n transition: opacity 0.2s ease;\n}\n.white-audio-plugin-nav-delete > img {\n width: 14px;\n}\n.white-audio-plugin-nav-delete:hover {\n opacity: 1;\n}\n.white-audio-plugin-body {\n flex-grow: 1;\n background-color: #f2f4f5;\n display: flex;\n flex-flow: column nowrap;\n align-items: stretch;\n justify-content: center;\n}\n.white-audio-plugin-body > audio {\n flex-grow: 1;\n outline: none;\n}\n",""]),e.exports=t},function(e,t,n){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,r,i,o=e[1]||"",a=e[3];if(!a)return o;if(t&&"function"==typeof btoa){var s=(n=a,r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),"/*# ".concat(i," */")),u=a.sources.map((function(e){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(e," */")}));return[o].concat(u).concat([s]).join("\n")}return[o].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;o0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&(d=Date.now(),this.props.player&&(d=this.props.player.beginTimestamp+r),f=l+(d-c)/1e3,Math.abs(n.currentTime-f)>2&&(n.currentTime=f)),this.changedMap.changed("rate",i)&&(n.playbackRate=i),[2]}}))}))}));this.disposers.push(r),this.disposers.push((function(){return e.changedMap.clear()}))},t.prototype.componentWillUnmount=function(){var e;null===(e=this.player.current)||void 0===e||e.pause(),this.disposers.forEach((function(e){return e()}))},Object.defineProperty(t.prototype,"containerStyle",{get:function(){var e=this.props,t=e.size,n=e.scale||1;return{width:t.width/n,height:t.height/n,transform:"scale("+n+")"}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointerEventsStyle",{get:function(){return{pointerEvents:this.isHost()?"auto":"none"}},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.props,t=e.room,n=e.player,r=e.plugin;return t||n?i.a.createElement("div",{className:"white-audio-plugin-container",style:this.containerStyle},!r.attributes.isNavigationDisable&&i.a.createElement("div",{className:"white-audio-plugin-nav"},i.a.createElement("img",{src:s.a,alt:"audio_plugin"}),i.a.createElement("span",{className:"white-audio-plugin-nav-title"},"Audio Player"),i.a.createElement("span",{className:"white-audio-plugin-nav-delete",style:this.pointerEventsStyle,onClick:this.removeSelf},i.a.createElement("img",{src:l.a,alt:"delete_icon"}))),i.a.createElement("div",{className:"white-audio-plugin-body"},i.a.createElement("audio",{src:r.attributes.src,style:this.pointerEventsStyle,controls:!!t,controlsList:"nodownload nofullscreen",preload:"auto",ref:this.player}))):null},t}(r.Component);n.d(t,"audioPlugin2",(function(){return _}));var _=Object.freeze({kind:"audio2",render:b,defaultAttributes:{src:"",hostTime:0,currentTime:0,paused:!0,muted:!1,volume:1},hitTest:function(e){var t=e.component.context.getMemberState();return!("eraser"===(null==t?void 0:t.currentApplianceName))}})}])},"object"==r(t)&&"object"==r(e)?e.exports=i(n(17328),n(71895)):n.amdD([,],i)},44112:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)} -/*! For license information please see index.js.LICENSE.txt */var i;e=n.nmd(e),window,i=function(e,t){return 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"==r(e)&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},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=12)}([function(t,n){t.exports=e},function(e,t,n){(function(e,i){n.d(t,"a",(function(){return nt}));var o=[];Object.freeze(o);var a={};Object.freeze(a);var s={};function u(){return"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:s}function l(){return++De.mobxGuid}function c(e){throw h(!1,e),"X"}function h(e,t){if(!e)throw new Error("[mobx] "+(t||"An invariant failed, however the error is obfuscated because this is an production build."))}function d(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var f=function(){};function p(e){return null!==e&&"object"==r(e)}function v(e){if(null===e||"object"!=r(e))return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function m(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function g(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function y(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return p(e)&&!0===e[n]}}function b(e){return void 0!==u().Map&&e instanceof u().Map}function x(e){return e instanceof Set}function _(e){for(var t=[];;){var n=e.next();if(n.done)break;t.push(n.value)}return t}function w(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function T(e){return null===e?null:"object"==r(e)?""+e:e}function M(e,t){for(var n=e.next();!n.done;)t(n.value),n=e.next()}function S(){return"function"==typeof Symbol&&Symbol.iterator||"@@iterator"}function E(e,t){g(e,S(),t)}function A(e){return e[S()]=C,e}function I(){return"function"==typeof Symbol&&Symbol.toStringTag||"@@toStringTag"}function C(){return this}var N=function(){function e(e){void 0===e&&(e="Atom@"+l()),this.name=e,this.isPendingUnobservation=!1,this.isBeingObserved=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=oe.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.onBecomeObserved=function(){},e.prototype.reportObserved=function(){return Be(this)},e.prototype.reportChanged=function(){Le(),function(e){if(e.lowestObserverState!==oe.STALE){e.lowestObserverState=oe.STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===oe.UP_TO_DATE&&(r.isTracing!==ae.NONE&&Ue(r,e),r.onBecomeStale()),r.dependenciesState=oe.STALE}}}(this),je()},e.prototype.toString=function(){return this.name},e}(),k=y("Atom",N);function D(e,t,n){void 0===t&&(t=f),void 0===n&&(n=f);var r=new N(e);return it("onBecomeObserved",r,t,void 0),rt(r,n),r}function P(e,t){return e===t}var O={identity:P,structural:function(e,t){return Zt(e,t)},default:function(e,t){return function(e,t){return"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}(e,t)||P(e,t)},shallow:function(e,t){return Zt(e,t,1)}},R=function(e,t){return(R=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])})(e,t)};function L(e,t){function n(){this.constructor=e}R(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var j=function(){return(j=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=o.next()).done;)a.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 a}function U(){for(var e=[],t=0;t2&&ie("box");var n=q(t);return new Ae(e,J(n),n.name,!0,n.equals)},shallowBox:function(e,t){return arguments.length>2&&ie("shallowBox"),re.box(e,{name:t,deep:!1})},array:function(e,t){arguments.length>2&&ie("array");var n=q(t);return new St(e,J(n),n.name)},shallowArray:function(e,t){return arguments.length>2&&ie("shallowArray"),re.array(e,{name:t,deep:!1})},map:function(e,t){arguments.length>2&&ie("map");var n=q(t);return new Pt(e,J(n),n.name)},shallowMap:function(e,t){return arguments.length>2&&ie("shallowMap"),re.map(e,{name:t,deep:!1})},set:function(e,t){arguments.length>2&&ie("set");var n=q(t);return new jt(e,J(n),n.name)},object:function(e,t,n){"string"==typeof arguments[1]&&ie("object");var r=q(n);return ot({},e,t,r)},shallowObject:function(e,t){return"string"==typeof arguments[1]&&ie("shallowObject"),re.object(e,{},{name:t,deep:!1})},ref:ee,shallow:$,deep:K,struct:te},re=function e(t,n,r){if("string"==typeof arguments[1])return K.apply(null,arguments);if(ut(t))return t;var i=v(t)?e.object(t,n,r):Array.isArray(t)?e.array(t,n):b(t)?e.map(t,n):x(t)?e.set(t,n):t;if(i!==t)return i;c(!1)};function ie(e){c("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}Object.keys(ne).forEach((function(e){return re[e]=ne[e]}));var oe,ae,se=V(!1,(function(e,t,n,r,i){var o=n.get,a=n.set,s=i[0]||{};!function(e,t,n){var r=Ft(e);n.name=r.name+"."+t,n.context=e,r.values[t]=new Ie(n),Object.defineProperty(e,t,function(e){return Gt[e]||(Gt[e]={configurable:De.computedConfigurable,enumerable:!1,get:function(){return Ht(this).read(this,e)},set:function(t){Ht(this).write(this,e,t)}})}(t))}(e,t,j({get:o,set:a},s))}));se({equals:O.structural}),function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(oe||(oe={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(ae||(ae={}));var ue=function(e){this.cause=e};function le(e){return e instanceof ue}function ce(e){switch(e.dependenciesState){case oe.UP_TO_DATE:return!1;case oe.NOT_TRACKING:case oe.STALE:return!0;case oe.POSSIBLY_STALE:for(var t=ge(!0),n=ve(),r=e.observing,i=r.length,o=0;o0;De.computationDepth>0&&t&&c(!1),De.allowStateChanges||!t&&"strict"!==De.enforceActions||c(!1)}function de(e,t,n){var r=ge(!0);be(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++De.runId;var i,o=De.trackingDerivation;if(De.trackingDerivation=e,!0===De.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new ue(e)}return De.trackingDerivation=o,function(e){for(var t=e.observing,n=e.observing=e.newObserving,r=oe.UP_TO_DATE,i=0,o=e.unboundDepsCount,a=0;ar&&(r=s.dependenciesState);for(n.length=i,e.newObserving=null,o=t.length;o--;)0===(s=t[o]).diffValue&&Oe(s,e),s.diffValue=0;for(;i--;){var s;1===(s=n[i]).diffValue&&(s.diffValue=0,Pe(s,e))}r!==oe.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}(e),e.observing.length,ye(r),i}function fe(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Oe(t[n],e);e.dependenciesState=oe.NOT_TRACKING}function pe(e){var t=ve(),n=e();return me(t),n}function ve(){var e=De.trackingDerivation;return De.trackingDerivation=null,e}function me(e){De.trackingDerivation=e}function ge(e){var t=De.allowStateReads;return De.allowStateReads=e,t}function ye(e){De.allowStateReads=e}function be(e){if(e.dependenciesState!==oe.UP_TO_DATE){e.dependenciesState=oe.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=oe.UP_TO_DATE}}var xe=0,_e=1,we=Object.getOwnPropertyDescriptor((function(){}),"name");function Te(e,t){var n=function(){return Me(e,t,this,arguments)};return n.isMobxAction=!0,n}function Me(e,t,n,r){var i=function(e,t,n){var r=Ve()&&!!e,i=0;if(r){i=Date.now();var o=n&&n.length||0,a=new Array(o);if(o>0)for(var s=0;s0&&!e.__mobxGlobals&&(ke=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Ne).version&&(ke=!1),ke?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Ne):(setTimeout((function(){c("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Ne)}();function Pe(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Oe(e,t){if(1===e.observers.length)e.observers.length=0,Re(e);else{var n=e.observers,r=e.observersIndexes,i=n.pop();if(i!==t){var o=r[t.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[t.__mapid]}}function Re(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,De.pendingUnobservations.push(e))}function Le(){De.inBatch++}function je(){if(0==--De.inBatch){ze();for(var e=De.pendingUnobservations,t=0;t0&&Re(e),!1)}function Ue(e,t){if(console.log("[mobx.trace] '"+e.name+"' is invalidated due to a change in: '"+t.name+"'"),e.isTracing===ae.BREAK){var n=[];!function e(t,n,r){n.length>=1e3?n.push("(and many more)"):(n.push(""+new Array(r).join("\t")+t.name),t.dependencies&&t.dependencies.forEach((function(t){return e(t,n,r+1)})))}((r=e,at(Yt(r,void 0))),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof Ie?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}var r}var Fe=function(){function e(e,t,n,r){void 0===e&&(e="Reaction@"+l()),void 0===r&&(r=!1),this.name=e,this.onInvalidate=t,this.errorHandler=n,this.requiresObservable=r,this.observing=[],this.newObserving=[],this.dependenciesState=oe.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+l(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=ae.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,De.pendingReactions.push(this),ze())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(Le(),this._isScheduled=!1,ce(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&Ve()&&We({name:this.name,type:"scheduled-reaction"})}catch(e){this.reportExceptionInDerivation(e)}}je()}},e.prototype.track=function(e){Le();var t,n=Ve();n&&(t=Date.now(),Ye({name:this.name,type:"reaction"})),this._isRunning=!0;var r=de(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&fe(this),le(r)&&this.reportExceptionInDerivation(r.cause),n&&Qe({time:Date.now()-t}),je()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)this.errorHandler(e,this);else{if(De.disableErrorBoundaries)throw e;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";De.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)"):console.error(n,e),Ve()&&We({type:"error",name:this.name,message:n,error:""+e}),De.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Le(),fe(this),je()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.trace=function(e){void 0===e&&(e=!1),function(){for(var e=[],t=0;t0||De.isRunningReactions||function(e){e()}(Ge)}function Ge(){De.isRunningReactions=!0;for(var e=De.pendingReactions,t=0;e.length>0;){100==++t&&(console.error("Reaction doesn't converge to a stable state after 100 iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",e):2===arguments.length&&"function"==typeof t?Te(e,t):1===arguments.length&&"string"==typeof e?qe(e):!0!==r?qe(t).apply(null,arguments):void(e[t]=Te(e.name||t,n.value))};function $e(e,t,n){m(e,t,Te(t,n.bind(e)))}Ke.bound=function(e,t,n,r){return!0===r?($e(e,t,n.value),null):n?{configurable:!0,enumerable:!1,get:function(){return $e(this,t,n.value||n.initializer.call(this)),this[t]},set:Ze}:{enumerable:!1,configurable:!0,set:function(e){$e(this,t,e)},get:function(){}}};var et=function(e){return e()};function tt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:et}function nt(e,t,n){void 0===n&&(n=a),"boolean"==typeof n&&(n={fireImmediately:n});var r,i,o,s=n.name||"Reaction@"+l(),u=Ke(s,n.onError?(r=n.onError,i=t,function(){try{return i.apply(this,arguments)}catch(e){r.call(this,e)}}):t),c=!n.scheduler&&!n.delay,h=tt(n),d=!0,f=!1,p=n.compareStructural?O.structural:n.equals||O.default,v=new Fe(s,(function(){d||c?m():f||(f=!0,h(m))}),n.onError,n.requiresObservable);function m(){if(f=!1,!v.isDisposed){var t=!1;v.track((function(){var n=e(v);t=d||!p(o,n),o=n})),d&&n.fireImmediately&&u(o,v),d||!0!==t||u(o,v),d&&(d=!1)}}return v.schedule(),v.getDisposer()}function rt(e,t,n){return it("onBecomeUnobserved",e,t,n)}function it(e,t,n,r){var i="function"==typeof r?Yt(t,n):Yt(t),o="function"==typeof r?r:n,a=i[e];return"function"!=typeof a?c(!1):(i[e]=function(){a.call(this),o.call(this)},function(){i[e]=a})}function ot(e,t,n,r){var i=(r=q(r)).defaultDecorator||(!1===r.deep?ee:K);H(e),Ft(e,r.name,i.enhancer),Le();try{for(var o=Object.getOwnPropertyNames(t),a=0,s=o.length;a0&&(r.dependencies=(t=e.observing,n=[],t.forEach((function(e){-1===n.indexOf(e)&&n.push(e)})),n).map(at)),r}function st(e,t){if(null==e)return!1;if(void 0!==t){if(Wt(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return Wt(e)||!!e.$mobx||k(e)||He(e)||Ce(e)}function ut(e){return 1!==arguments.length&&c(!1),st(e)}function lt(e){switch(e.length){case 0:return De.trackingDerivation;case 1:return Yt(e[0]);case 2:return Yt(e[0],e[1])}}function ct(e,t){void 0===t&&(t=void 0),Le();try{return e.apply(t)}finally{je()}}function ht(e){return void 0!==e.interceptors&&e.interceptors.length>0}function dt(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),d((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ft(e,t){var n=ve();try{var r=e.interceptors;if(r)for(var i=0,o=r.length;i0}function vt(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),d((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function mt(e,t){var n=ve(),r=e.changeListeners;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},e.prototype.intercept=function(e){return dt(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),vt(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r0&&e+t+1>wt&&Ct(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var r=this;he(this.atom);var i=this.values.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=o),ht(this)){var a=ft(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!a)return o;t=a.removedCount,n=a.added}var s=(n=0===n.length?n:n.map((function(e){return r.enhancer(e,void 0)}))).length-t;this.updateArrayLength(i,s);var u=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,u),this.dehanceValues(u)},e.prototype.spliceItemsIntoValues=function(e,t,n){var r;if(n.length<1e4)return(r=this.values).splice.apply(r,U([e,t],n));var i=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),i},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&Ve(),i=pt(this),o=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&Ye(j(j({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&mt(this,o),r&&Qe()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&Ve(),i=pt(this),o=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&Ye(j(j({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&mt(this,o),r&&Qe()},e}(),St=function(e){function t(t,n,r,i){void 0===r&&(r="ObservableArray@"+l()),void 0===i&&(i=!1);var o=e.call(this)||this,a=new Mt(r,n,o,i);if(g(o,"$mobx",a),t&&t.length){var s=Se(!0);o.spliceWithArray(0,0,t),Ee(s)}return _t&&Object.defineProperty(a.array,"0",Et),o}return L(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,i=this.$mobx.values;r=e1)for(var n=1;n=2&&(this.player.currentTime=e)},e}(),d=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(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(a,s)}u((r=r.apply(e,t||[])).next())}))},p=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1e3&&(n.lastSyncProgressTimestamp=r,n.selfUserInf&&n.selfUserInf.identity===i.host&&t.putAttributes({currentTime:e,play:n.playerState}))},n.handleNativePlayerState=function(e){return f(n,void 0,void 0,(function(){var t;return p(this,(function(n){switch(n.label){case 0:if(!e)return[3,7];if(!this.player.current)return[3,6];n.label=1;case 1:return n.trys.push([1,3,,6]),[4,this.player.current.play()];case 2:return n.sent(),[3,6];case 3:return""+(t=n.sent()).name!="NotAllowedError"&&""+t.name!="AbortError"?[3,5]:(this.setState({selfMute:!0}),[4,this.player.current.play()]);case 4:n.sent(),n.label=5;case 5:return[3,6];case 6:return[3,8];case 7:this.player.current&&this.player.current.pause(),n.label=8;case 8:return[2]}}))}))},n.handleSeekReaction=function(e,t){return f(n,void 0,void 0,(function(){return p(this,(function(n){return this.isHost()||this.player.current&&void 0!==t&&(this.player.current.currentTime=e+Date.now()/1e3-t),[2]}))}))},n.timeUpdate=function(){if(n.player.current){var e=n.player.current.currentTime;n.onTimeUpdate(e)}},n.detectVideoClickEnable=function(){var e=n.props.plugin;return e.context&&e.context.identity?e.context.identity!==i.host?"none":"auto":"none"},n.renderMuteBox=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity!==i.host&&n.state.selfMute?o.createElement("div",{className:"media-mute-box"},o.createElement("div",{onClick:function(){n.setState({selfMute:!1})},onTouchStart:function(){n.setState({selfMute:!1})},style:{pointerEvents:"auto"},className:"media-mute-box-inner"},o.createElement("img",{src:u,alt:"mute_icon"}),o.createElement("span",null,"unmute"))):null},n.handleRemove=function(){return f(n,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=this.props.plugin,this.handleRemotePlayState(!1),[4,v(300)];case 1:return t.sent(),e.remove(),[2]}}))}))},n.renderDeleteBtn=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity===i.host?o.createElement("div",{style:{pointerEvents:"auto"},className:"plugin-audio-box-delete",onClick:n.handleRemove},o.createElement("img",{src:c,alt:"delete"})):null},n.renderNavigation=function(){return!0===n.props.plugin.attributes.isNavigationDisable?null:o.createElement("div",{className:"plugin-video-box-nav"},o.createElement("div",null,o.createElement("img",{style:{width:20,marginLeft:8},src:l,alt:"video_plugin"}),o.createElement("span",null,"Video Player")),n.renderDeleteBtn())},n.handleOnEnd=function(){return f(n,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=this.props.plugin,this.player.current?this.selfUserInf?this.selfUserInf.identity!==i.host?[3,2]:(e.putAttributes({seek:0,seekTime:void 0,currentTime:0}),[4,v(500)]):[3,5]:[3,7];case 1:return t.sent(),this.player.current.load(),[3,4];case 2:return[4,v(1e3)];case 3:t.sent(),this.player.current.load(),t.label=4;case 4:return[3,7];case 5:return[4,v(1e3)];case 6:t.sent(),this.player.current.load(),t.label=7;case 7:return this.setState({isEnd:!0}),[2]}}))}))},n.handleOnLoadedMetadataCapture=function(){return f(n,void 0,void 0,(function(){var e,t;return p(this,(function(n){switch(n.label){case 0:return e=navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform),t=this.state.isEnd,e?[4,v(300)]:[3,2];case 1:n.sent(),this.handleFirstSeek(t),n.label=2;case 2:return[2]}}))}))},n.player=o.createRef(),n.reactionSeekDisposer=n.startSeekReaction(),n.reactionSeekTimeDisposer=n.startSeekTimeReaction(),n.reactionPlayDisposer=n.startPlayReaction(),n.reactionVolumeDisposer=n.startVolumeReaction(),n.reactionMuteDisposer=n.startMuteTimeReaction(),n.reactionSyncDisposer=n.startSyncReaction(),n.state={play:!1,seek:0,selfMute:!1,currentTime:0,mute:!1,volume:1,isEnd:!1},n}return d(t,e),t.prototype.componentDidMount=function(){return f(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.syncNode=new h(this.player.current),[4,this.handleStartCondition()];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.play}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.isHost()?[3,2]:[4,this.handleNativePlayerState(t)];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))}))},t.prototype.startSeekReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seek}),(function(n){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.handleSeekReaction(n,t.attributes.seekTime)];case 1:return e.sent(),[2]}}))}))}))},t.prototype.startSyncReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.currentTime}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){return this.isHost()||this.player.current&&Math.abs(t-this.player.current.currentTime)>2&&(this.player.current.currentTime=t),[2]}))}))}))},t.prototype.startSeekTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seekTime}),(function(n){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.handleSeekReaction(t.attributes.seek,n)];case 1:return e.sent(),[2]}}))}))}))},t.prototype.startVolumeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.volume}),(function(t){e.isHost()||e.player.current&&(e.player.current.volume=t)}))},t.prototype.startMuteTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.mute}),(function(t){e.isHost()||e.setState({mute:t})}))},t.prototype.componentWillUnmount=function(){this.reactionPlayDisposer(),this.reactionSeekDisposer(),this.reactionMuteDisposer(),this.reactionVolumeDisposer(),this.reactionSeekTimeDisposer(),this.reactionSyncDisposer(),this.player.current&&this.player.current.pause()},t.prototype.render=function(){var e=this.props,t=e.size,n=e.plugin,r=e.scale,i=this.state,a=i.mute,s=i.selfMute,u=0===r?1:r;return o.createElement("div",{className:"plugin-video-box",style:{width:t.width/u,height:t.height/u,transform:"scale("+u+")"}},this.renderNavigation(),o.createElement("div",{className:"plugin-video-box-body"},this.renderMuteBox(),o.createElement("div",{className:"white-plugin-video-box"},o.createElement("video",{"webkit-playsinline":"true",playsInline:!0,poster:n.attributes.poster,className:"white-plugin-video",src:n.attributes.pluginVideoUrl,ref:this.player,muted:a||s,style:{width:"100%",height:"100%",pointerEvents:this.detectVideoClickEnable(),outline:"none"},disablePictureInPicture:!0,onLoadedMetadataCapture:this.handleOnLoadedMetadataCapture,onEnded:this.handleOnEnd,controls:!0,controlsList:"nodownload nofullscreen",onTimeUpdate:this.timeUpdate,preload:"metadata"}))))},t}(o.Component),y=(m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(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}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),b=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(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(a,s)}u((r=r.apply(e,t||[])).next())}))},x=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1] img {\n width: 20px;\n margin-left: 8px;\n}\n.white-video-plugin-nav-title {\n margin-left: 6px;\n font-size: 12px;\n font-weight: bold;\n flex-grow: 1;\n}\n.white-video-plugin-nav-delete {\n width: 22px;\n height: 22px;\n border: 0;\n background-color: #ff756e;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n margin-right: 8px;\n cursor: pointer;\n opacity: 0.6;\n transition: opacity 0.2s ease;\n}\n.white-video-plugin-nav-delete > img {\n width: 14px;\n}\n.white-video-plugin-nav-delete:hover {\n opacity: 1;\n}\n.white-video-plugin-body {\n flex-grow: 1;\n background-color: #f2f4f5;\n display: flex;\n flex-flow: column nowrap;\n align-items: stretch;\n justify-content: center;\n height: calc(100% - 32px);\n}\n.white-video-plugin-body > audio {\n flex-grow: 1;\n outline: none;\n}\n",""]),e.exports=t},function(e,t,n){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,r,i,o=e[1]||"",a=e[3];if(!a)return o;if(t&&"function"==typeof btoa){var s=(n=a,r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),"/*# ".concat(i," */")),u=a.sources.map((function(e){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(e," */")}));return[o].concat(u).concat([s]).join("\n")}return[o].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;o0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&(d=Date.now(),this.props.player&&(d=this.props.player.beginTimestamp+r),f=l+(d-c)/1e3,Math.abs(n.currentTime-f)>2&&(n.currentTime=f)),this.changedMap.changed("rate",i)&&(n.playbackRate=i),[2]}}))}))}));this.disposers.push(r),this.disposers.push((function(){return e.changedMap.clear()}))},t.prototype.componentWillUnmount=function(){var e;null===(e=this.player.current)||void 0===e||e.pause(),this.disposers.forEach((function(e){return e()}))},Object.defineProperty(t.prototype,"containerStyle",{get:function(){var e=this.props,t=e.size,n=e.scale||1;return{width:t.width/n,height:t.height/n,transform:"scale("+n+")"}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointerEventsStyle",{get:function(){return{pointerEvents:this.isHost()?"auto":"none"}},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.props,t=e.room,n=e.player,r=e.plugin;return t||n?i.a.createElement("div",{className:"white-video-plugin-container",style:this.containerStyle},!r.attributes.isNavigationDisable&&i.a.createElement("div",{className:"white-video-plugin-nav"},i.a.createElement("img",{src:s.a,alt:"video_plugin"}),i.a.createElement("span",{className:"white-video-plugin-nav-title"},"Video Player"),i.a.createElement("span",{className:"white-video-plugin-nav-delete",style:this.pointerEventsStyle,onClick:this.removeSelf},i.a.createElement("img",{src:l.a,alt:"delete_icon"}))),i.a.createElement("div",{className:"white-video-plugin-body"},i.a.createElement("video",{src:r.attributes.src,style:m({maxWidth:"100%",maxHeight:"100%"},this.pointerEventsStyle),controls:!!t,controlsList:"nodownload nofullscreen",preload:"metadata",ref:this.player,playsInline:!0,"webkit-playsinline":"true",poster:r.attributes.poster,disablePictureInPicture:!0}))):null},t}(r.Component);n.d(t,"videoPlugin2",(function(){return _}));var _=Object.freeze({kind:"video2",render:b,defaultAttributes:{src:"",hostTime:0,currentTime:0,paused:!0,muted:!1,volume:1},hitTest:function(e){var t=e.component.context.getMemberState();return!("eraser"===(null==t?void 0:t.currentApplianceName))}})}])},"object"==r(t)&&"object"==r(e)?e.exports=i(n(17328),n(71895)):n.amdD([,],i)},18371:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.playerStateNameSpace=t.playerNameSpace=t.sdkNameSpace=t.roomStateNamespace=t.roomNamespace=t.roomSyncNamespace=t.pptNamespace=t.ScaleMode=void 0,function(e){e[e.Scale=0]="Scale",e[e.AspectFit=1]="AspectFit",e[e.AspectFitScale=2]="AspectFitScale",e[e.AspectFitSpace=3]="AspectFitSpace",e[e.AspectFill=4]="AspectFill",e[e.AspectFillScale=5]="AspectFillScale"}(t.ScaleMode||(t.ScaleMode={})),t.pptNamespace="ppt",t.roomSyncNamespace="room.sync",t.roomNamespace="room",t.roomStateNamespace="room.state",t.sdkNameSpace="sdk",t.playerNameSpace="player",t.playerStateNameSpace="player.state"},46640:function(e,t,n){var r;function i(e,t,n){return i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}},i(e,t,n||e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||M(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||M(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function u(e){var t=f();return function(){var n,r=v(e);if(t){var i=v(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,t){return!t||"object"!==_(t)&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){var t="function"==typeof Map?new Map:void 0;return h=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,v(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,e)},h(e)}function d(e,t,n){return d=f()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&p(i,n.prototype),i},d.apply(null,arguments)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function m(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function g(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){m(o,r,i,a,s,"next",e)}function s(e){m(o,r,i,a,s,"throw",e)}a(void 0)}))}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function M(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this.timer=this.initInterval())}},{key:"invoke",value:function(){var e=this;if(0!==this.list.length&&void 0===this.currentInvoker){var t=this.list.shift();t&&(this.currentInvoker=t,t().then((function(){e.invoked()})).catch((function(t){console.error("[WindowManager]: create app error: ".concat(t.message)),e.invoked()})))}}},{key:"emitReady",value:function(){this.isEmit||setTimeout((function(){ae.emit("ready")}),50),this.isEmit=!0}},{key:"empty",value:function(){this.list=[],this.clear()}},{key:"destroy",value:function(){this.timer&&this.clear()}}]),e}(),ue=new Q.default,le=function(){var e=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,t){var n=indexedDB.open("__WindowManagerAppCache",2);n.onerror=function(e){t(e)},n.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains("apps")||t.createObjectStore("apps",{keyPath:"kind"}).createIndex("kind","kind",{unique:!0})},n.onsuccess=function(){var t=n.result;e(t)}}));case 2:Y=e.sent;case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ce=function(e,t){if(Y)return function(e,t){return new Promise((function(n,r){var i=e.transaction(["apps"],"readwrite").objectStore("apps").add(t);i.onsuccess=function(){return n()},i.onerror=function(){return r()}}))}(Y,{kind:e,sourceCode:t})},he=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Y){e.next=6;break}return e.next=3,de(Y,t);case 3:e.t0=e.sent,e.next=7;break;case 6:e.t0=null;case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function de(e,t){return new Promise((function(n,r){var i=e.transaction(["apps"]).objectStore("apps").index("kind").get(t);i.onerror=function(e){return r(e)},i.onsuccess=function(){i.result?n(i.result):n(null)}}))}var fe=function(){var e=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,he(t);case 2:if(!(n=e.sent)){e.next=5;break}return e.abrupt("return",n.sourceCode);case 5:return e.next=7,ge(t,{timeout:1e4});case 7:return e.next=9,e.sent.text();case 9:return r=e.sent,e.next=12,ce(t,r);case 12:return e.abrupt("return",r);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),pe=function(e,t){var n=Function(e+"\n;return ".concat(t))();return void 0===n&&(n=window[t]),n},ve=function(){var e=g(regeneratorRuntime.mark((function e(t,n,r){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r||"NetlessApp"+n,ae.emit("loadApp",{kind:n,status:"start"}),e.prev=2,e.next=5,fe(t);case 5:if((o=e.sent)&&0!==o.length){e.next=8;break}throw ae.emit("loadApp",{kind:n,status:"failed",reason:"script is empty."}),new Error("[WindowManager]: script is empty.");case 8:e.next=13;break;case 10:throw e.prev=10,e.t0=e.catch(2),ae.emit("loadApp",{kind:n,status:"failed",reason:e.t0.message}),e.t0;case 13:return e.abrupt("return",me(o,i,n));case 14:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t,n,r){return e.apply(this,arguments)}}(),me=function(e,t,n){try{var r=pe(e,t);return ae.emit("loadApp",{kind:n,status:"success"}),r}catch(r){if(r.message.includes("Can only have one anonymous define call per script file")){var i=window.define;"function"==typeof i&&i.amd&&delete i.amd;var o=pe(e,t);return ae.emit("loadApp",{kind:n,status:"success"}),o}throw ae.emit("loadApp",{kind:n,status:"failed",reason:r.message}),r}};function ge(e,t){return ye.apply(this,arguments)}function ye(){return ye=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.timeout,i=void 0===r?1e4:r,o=new AbortController,a=setTimeout((function(){return o.abort()}),i),e.next=6,fetch(t,O(P({},n),{signal:o.signal,headers:{"content-type":"text/plain"}}));case 6:return s=e.sent,e.abrupt("return",(clearTimeout(a),s));case 8:case"end":return e.stop()}}),e)}))),ye.apply(this,arguments)}var be=function(){function e(){var t=this;y(this,e),this.kindEmitters=new Map,this.registered=new Map,this.appClassesCache=new Map,this.appClasses=new Map,this.syncRegisterApp=null,this.onSyncRegisterAppChange=function(e){t.register({kind:e.kind,src:e.src})}}var t,n;return x(e,[{key:"setSyncRegisterApp",value:function(e){this.syncRegisterApp=e}},{key:"register",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appClassesCache.delete(t.kind),this.registered.set(t.kind,t),"string"==typeof(n=t.src)&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ve(n,t.kind,t.name);case 2:return r=e.sent,e.abrupt("return",r.__esModule?r.default:r);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this.syncRegisterApp&&this.syncRegisterApp({kind:t.kind,src:n,name:t.name})),"function"==typeof n&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n();case 2:if(!(t=e.sent)){e.next=5;break}return e.abrupt("return",((t.__esModule||t.default)&&(t=t.default),t));case 5:throw new Error("[WindowManager]: load remote script failed, ".concat(n));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()),"object"==_(n)&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()),this.appClasses.set(t.kind,g(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.appClassesCache.get(t.kind),e.abrupt("return",(n||(n=r(),o.appClassesCache.set(t.kind,n)),n));case 2:case"end":return e.stop()}}),e)})))),t.addHooks&&(i=this.createKindEmitter(t.kind))&&t.addHooks(i);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unregister",value:function(e){this.appClasses.delete(e),this.appClassesCache.delete(e),this.registered.delete(e);var t=this.kindEmitters.get(e);t&&(t.clearListeners(),this.kindEmitters.delete(e))}},{key:"notifyApp",value:(t=g(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this.kindEmitters.get(t),e.next=3,null==i?void 0:i.emit(n,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"createKindEmitter",value:function(e){if(!this.kindEmitters.has(e)){var t=new Q.default;this.kindEmitters.set(e,t)}return this.kindEmitters.get(e)}}]),e}(),xe=new be,_e=function(){var e=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null==(n=xe.appClasses.get(t))?void 0:n();case 2:return i=e.sent,e.abrupt("return",i&&(null==(r=i.config)?void 0:r.singleton)?t:"".concat(t,"-").concat(U.v4().replace("-","").slice(0,8)));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),we=function(e,t){if(e.focusScenePath!==t)return e.focusScenePath=t,e},Te=function(e,t){if(e&&e.isWritable&&e.state.sceneState.scenePath!==t){var n="/"===t?"":t;e.setScenePath(n)}},Me=function(e,t,n){e&&e.scenePathType(t)!==B.ScenePathType.None&&e.removeScenes(t,n)};j.debounce((function(e,t){e.emit("mainViewModeChange",t)}),200);var Se=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Ee(e)[t];if(r){var i=r[n];if(i){var o=i.name;return t===ie?"/".concat(o):"".concat(t,"/").concat(o)}}},Ee=function(e){return e.entireScenes()},Ae=function(e,t,n,r){for(var i,o=0;o0&&n.forEach((function(n){var r=e[n];if(r!==t._state[n])if(void 0===r)t._lastValue.set(n,t._state[n]),delete t._state[n],t._setRawState(n,r);else{t._lastValue.set(n,t._state[n]),t._state[n]=r;var i=r;if(j.isObject(r)){var o=t._refMap.get(r);o||(o=function(e){return{k:F.genUID(),v:e,__isRef:!0}}(r),t._refMap.set(r,o)),i=o}t._setRawState(n,i)}}))}else console.error(new Error('Cannot setState on Storage "'.concat(this.id,'" without writable access')),e)}},{key:"emptyStorage",value:function(){if(!(j.size(this._state)<=0)){if(this._destroyed)return void console.error(new Error('Cannot empty destroyed Storage "'.concat(this.id,'".')));if(!this._context.getIsWritable())return void console.error(new Error('Cannot empty Storage "'.concat(this.id,'" without writable access.')));this.setState(j.mapValues(this._state,j.noop))}}},{key:"deleteStorage",value:function(){if(null===this.id)throw new Error("Cannot delete main Storage");this._context.getIsWritable()?(this.destroy(),this._context.updateAttributes([Ze,this.id],void 0)):console.error(new Error('Cannot delete Storage "'.concat(this.id,'" without writable access.')))}},{key:"destroy",value:function(){this._destroyed=!0,this._sideEffect.flushAll()}},{key:"_getRawState",value:function(e){var t;return null===this.id?null!=(t=this._context.getAttributes())?t:e:j.get(this._context.getAttributes(),[Ze,this.id],e)}},{key:"_setRawState",value:function(e,t){if(null===this.id){if(e===Ze)throw new Error('Cannot set attribute internal filed "'.concat(Ze,'"'));return this._context.updateAttributes([e],t)}return this._context.updateAttributes([Ze,this.id,e],t)}},{key:"_updateProperties",value:function(e){var t;if(this._destroyed)console.error(new Error('Cannot call _updateProperties on destroyed Storage "'.concat(this.id,'".')));else if(e.length>0){for(var n={},r=0;rs.pageState.length-1?(console.warn("[WindowManager] nextPage: index out of range"),!1):(s.appProxy.setSceneIndex(t),!0));case 2:case"end":return e.stop()}}),e)}))),this.jumpPage=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",0<=t&&t=s.pageState.length?(console.warn("[WindowManager]: page index ".concat(t," out of range")),!1):s.appProxy.removeSceneByIndex(n));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.emitter=i.appEmitter,this.isAddApp=i.isAddApp}return x(e,[{key:"storage",get:function(){return this._storage||(this._storage=new qe(this)),this._storage}},{key:"pageState",get:function(){return this.appProxy.pageState}}]),e}(),Ke=function(){function e(t){var n=this;y(this,e),this.params=t,this.sceneNode=null,this.onSceneChange=function(e){n.sceneNode=e,n.params.notifyPageStateChange()};var r=this.params,i=r.displayer,o=r.scenePath;o&&(this.sceneNode=i.createScenesCallback(o,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}return x(e,[{key:"getFullPath",value:function(e){var t,n=null==(t=this.sceneNode)?void 0:t.scenes;if(this.params.scenePath&&n){var r=n[e];if(r)return"".concat(this.params.scenePath,"/").concat(r)}}},{key:"toObject",value:function(){var e,t;return{index:(null==(e=this.params.view)?void 0:e.focusSceneIndex)||0,length:(null==(t=this.sceneNode)?void 0:t.scenes.length)||0}}},{key:"destroy",value:function(){var e;null==(e=this.sceneNode)||e.dispose()}}]),e}(),$e=function(e){return e.Apps="apps",e.Focus="focus",e.State="state",e.BoxState="boxState",e.MainViewCamera="mainViewCamera",e.MainViewSize="mainViewSize",e.Broadcaster="broadcaster",e.Cursors="cursors",e.Position="position",e.CursorState="cursorState",e.FullPath="fullPath",e.Registered="registered",e.IframeBridge="iframeBridge",e}($e||{}),et=new(function(){function e(t){var n=this;y(this,e),this.context=t,this.setAppFocus=function(e,t){t?n.context.safeSetAttributes({focus:e}):n.context.safeSetAttributes({focus:void 0})}}return x(e,[{key:"setContext",value:function(e){this.context=e}},{key:"apps",value:function(){return j.get(this.attributes,["apps"])}},{key:"getAppAttributes",value:function(e){return j.get(this.apps(),[e])}},{key:"getAppState",value:function(e){return j.get(this.apps(),[e,"state"])}},{key:"getMaximized",value:function(){return j.get(this.attributes,["maximized"])}},{key:"getMinimized",value:function(){return j.get(this.attributes,["minimized"])}},{key:"setupAppAttributes",value:function(e,t,n){var r;this.attributes.apps||this.context.safeSetAttributes({apps:{}});var i=["scenePath","title"];n||i.push("scenes");var o=j.pick(e.options,i),a={kind:e.kind,options:o,isDynamicPPT:n};"string"==typeof e.src&&(a.src=e.src),a.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",t],a),this.context.safeUpdateAttributes(["apps",t,"state"],(w(r={},$.Size,{}),w(r,$.Position,{}),w(r,$.SceneIndex,0),r))}},{key:"updateAppState",value:function(e,t,n){j.get(this.attributes,["apps",e,"state"])&&this.context.safeUpdateAttributes(["apps",e,"state",t],n)}},{key:"cleanAppAttributes",value:function(e){this.context.safeUpdateAttributes(["apps",e],void 0),this.context.safeSetAttributes(w({},e,void 0)),this.attributes.focus===e&&this.cleanFocus()}},{key:"cleanFocus",value:function(){this.context.safeSetAttributes({focus:void 0})}},{key:"getAppSceneIndex",value:function(e){var t;return null==(t=this.getAppState(e))?void 0:t[$.SceneIndex]}},{key:"getAppScenePath",value:function(e){var t,n;return null==(n=null==(t=this.getAppAttributes(e))?void 0:t.options)?void 0:n.scenePath}},{key:"getMainViewScenePath",value:function(){return this.attributes._mainScenePath}},{key:"getMainViewSceneIndex",value:function(){return this.attributes._mainSceneIndex}},{key:"getBoxState",value:function(){return this.attributes.boxState}},{key:"setMainViewScenePath",value:function(e){this.context.safeSetAttributes({_mainScenePath:e})}},{key:"setMainViewSceneIndex",value:function(e){this.context.safeSetAttributes({_mainSceneIndex:e})}},{key:"getMainViewCamera",value:function(){return j.get(this.attributes,["mainViewCamera"])}},{key:"getMainViewSize",value:function(){return j.get(this.attributes,["mainViewSize"])}},{key:"setMainViewCamera",value:function(e){this.context.safeSetAttributes({mainViewCamera:P({},e)})}},{key:"setMainViewSize",value:function(e){this.context.safeSetAttributes({mainViewSize:P({},e)})}},{key:"setMainViewCameraAndSize",value:function(e,t){this.context.safeSetAttributes({mainViewCamera:P({},e),mainViewSize:P({},t)})}},{key:"updateCursor",value:function(e,t){j.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),j.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],t)}},{key:"updateCursorState",value:function(e,t){j.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],t)}},{key:"getCursorState",value:function(e){return j.get(this.attributes,["cursors",e,"cursorState"])}},{key:"cleanCursor",value:function(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}},{key:"setMainViewFocusPath",value:function(e){var t=this.getMainViewScenePath();t&&we(e,t)}},{key:"getIframeBridge",value:function(){return j.get(this.attributes,["iframeBridge"])}},{key:"setIframeBridge",value:function(e){if(j.isObject(e)){var t=this.getIframeBridge();for(var n in e){var r=e[n];t[n]!==r&&this.context.safeUpdateAttributes(["iframeBridge",n],r)}}}},{key:"attributes",get:function(){return this.context.getAttributes()}},{key:"focus",get:function(){return j.get(this.attributes,["focus"])}}]),e}())({getAttributes:function(){throw new Error("getAttributes not implemented")},safeSetAttributes:function(){throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:function(){throw new Error("safeUpdateAttributes not implemented")}}),tt=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r0&&i.zIndex!==(null==(n=a.box)?void 0:n.zIndex)&&(null==(r=a.boxManager)||r.setZIndex(e,i.zIndex))}))})),null==(r=a.manager.refresher)||r.add("".concat(e,"-fullPath"),(function(){return B.autorun((function(){var e,t=null==(e=a.appAttributes)?void 0:e.fullPath;a.setFocusScenePathHandler(t),a._prevFullPath!==t&&(a.notifyPageStateChange(),a._prevFullPath=t)}))}))},this.setFocusScenePathHandler=j.debounce((function(e){var t;a.view&&e&&e!==(null==(t=a.view)?void 0:t.focusScenePath)&&we(a.view,e)}),50),this.notifyPageStateChange=j.debounce((function(){a.appEmitter.emit("pageStateChange",a.pageState)}),50),this.kind=t.kind,this.id=r,this.stateKey="".concat(this.id,"_state"),this.appProxies.set(this.id,this),this.appEmitter=new Q.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=i,this.initScenes(),null!=(o=this.params.options)&&o.scenePath&&this.createView(),this._pageState=new Ke({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}var t,n,r,i,o,a,s,u;return x(e,[{key:"initScenes",value:function(){var e,t=this.params.options;t&&(this.scenePath=t.scenePath,(null==(e=this.appAttributes)?void 0:e.isDynamicPPT)&&this.scenePath?this.scenes=Ee(this.manager.displayer)[this.scenePath]:this.scenes=t.scenes)}},{key:"getFullScenePath",value:function(){if(this.scenePath)return j.get(this.appAttributes,[$e.FullPath])||this.getFullScenePathFromScenes()}},{key:"getFullScenePathFromScenes",value:function(){var e=j.get(this.appAttributes,["state","SceneIndex"],0),t=function(e,t,n){var r;if(e&&t){var i=null==(r=Ee(e)[t])?void 0:r[n];if(i)return"".concat(t,"/").concat(i.name)}}(this.manager.room,this.scenePath,e);return t&&this.setFullPath(t),t}},{key:"setFullPath",value:function(e){this.manager.safeUpdateAttributes(["apps",this.id,$e.FullPath],e)}},{key:"baseInsertApp",value:(u=g(regeneratorRuntime.mark((function e(){var t,n,r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]&&a[0],(r=this.params).kind){e.next=4;break}throw new Error("[WindowManager]: kind require");case 4:return e.next=6,null==(n=xe.appClasses.get(r.kind))?void 0:n();case 6:if(i=e.sent,o=xe.registered.get(r.kind),!i){e.next=13;break}return e.next=11,this.setupApp(this.id,t,i,r.options,null==o?void 0:o.appOptions);case 11:e.next=14;break;case 13:throw new Error("[WindowManager]: app load failed ".concat(r.kind," ").concat(r.src));case 14:return e.abrupt("return",(ue.emit("updateManagerRect"),{appId:this.id,app:i}));case 15:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"setupApp",value:(s=g(regeneratorRuntime.mark((function e(t,n,r,i,o){var a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tt("setupApp",t,r,i),this.boxManager){e.next=2;break}throw new ze;case 2:s=new Je(this.manager,this.boxManager,t,this,o),this.appContext=s,e.prev=4,ue.once("".concat(t).concat(q.WindowCreated)).then(g(regeneratorRuntime.mark((function e(){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n||(o=u.getAppInitState(t),null==(i=u.boxManager)||i.updateBoxState(o)),u.appEmitter.onAny(u.appListener),u.appAttributesUpdateListener(t),u.setViewFocusScenePath(),setTimeout(g(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("setup app",r),e.next=3,r.setup(s);case 3:n=e.sent,u.appResult=n,xe.notifyApp(u.kind,"created",{appId:t,result:n}),u.afterSetupApp(o),u.fixMobileSize();case 5:case"end":return e.stop()}}),e)}))),50);case 1:case"end":return e.stop()}}),e)})))),null==(a=this.boxManager)||a.createBox({appId:t,app:r,options:i,canOperate:this.manager.canOperate,smartPosition:this.isAddApp}),this.isAddApp&&this.box&&(this.store.updateAppState(t,$.ZIndex,this.box.zIndex),this.store.updateAppState(t,$.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:t},!1)),e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(4),console.error(e.t0),new Error("[WindowManager]: app setup error: ".concat(e.t0.message));case 11:case"end":return e.stop()}}),e,this,[[4,8]])}))),function(e,t,n,r,i){return s.apply(this,arguments)})},{key:"fixMobileSize",value:function(){var e,t,n=null==(e=this.boxManager)?void 0:e.getBox(this.id);n&&(null==(t=this.boxManager)||t.resizeBox({appId:this.id,width:n.intrinsicWidth+.001,height:n.intrinsicHeight+.001,skipUpdate:!0}))}},{key:"afterSetupApp",value:function(e){var t;e&&(null==e||!e.x||!e.y)&&(null==(t=this.boxManager)||t.setBoxInitState(this.id))}},{key:"onSeek",value:(a=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appEmitter.emit("seek",t).catch((function(e){console.log("[WindowManager]: emit seek error: ".concat(e.message))})),r=this.getAppInitState(this.id),null==(n=this.boxManager)||n.updateBoxState(r);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"onReconnected",value:(o=g(regeneratorRuntime.mark((function t(){var n,r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Boolean(this.manager.attributes.apps[this.id])){t.next=4;break}return t.next=3,this.destroy(!0,!1,!0);case 3:return t.abrupt("return");case 4:return this.appEmitter.emit("reconnected",void 0),r=this.getAppInitState(this.id),t.next=8,this.destroy(!0,!1,!0);case 8:return i=this.params,t.next=11,new e(i,this.manager,this.id,this.isAddApp).baseInsertApp(!0);case 11:null==(n=this.boxManager)||n.updateBoxState(r);case 12:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"onRemoveScene",value:(i=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.scenePath&&t.startsWith(this.scenePath+"/")&&(n=this.pageState.index,(r=this._pageState.getFullPath(n))||(n=0,r=this._pageState.getFullPath(n)),r&&this.setFullPath(r),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=n));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"emitAppSceneStateChange",value:function(e){this.appEmitter.emit("sceneStateChange",e)}},{key:"emitAppIsWritableChange",value:function(){this.appEmitter.emit("writableChange",this.isWritable)}},{key:"makeAppEventListener",value:function(e){var t=this;return function(n,r){var i,o,a,s;if(t.manager.canOperate)switch(n){case"setBoxSize":null==(i=t.boxManager)||i.resizeBox({appId:e,width:r.width,height:r.height,skipUpdate:!1});break;case"setBoxMinSize":null==(o=t.boxManager)||o.setBoxMinSize({appId:e,minWidth:r.minwidth,minHeight:r.minheight});break;case"setBoxTitle":null==(a=t.boxManager)||a.setBoxTitle({appId:e,title:r.title});break;case ee.destroy:if("destroyed"===t.status)return;t.destroy(!0,!1,!0,null==r?void 0:r.error),null!=r&&r.error&&console.error(null==r?void 0:r.error);break;case"focus":null==(s=t.boxManager)||s.focusBox({appId:t.id}),rt.emit("focus",{appId:t.id})}}}},{key:"setScenePath",value:function(){if(this.manager.canOperate){var e=this.getFullScenePath();this.manager.room&&e&&this.view&&Te(this.manager.room,e)}}},{key:"setViewFocusScenePath",value:function(){var e=this.getFullScenePath();return e&&this.view&&we(this.view,e),e}},{key:"createView",value:(r=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.viewManager.createView(this.id);case 2:return t=e.sent,e.abrupt("return",(this.setViewFocusScenePath(),t));case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"removeSceneByIndex",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this._pageState.getFullPath(t))){e.next=6;break}return r=nt(t,this.pageState),e.abrupt("return",(this.setSceneIndexWithoutSync(r),this.manager.dispatchInternalEvent(q.SetAppFocusIndex,{type:"app",appID:this.id,index:r}),setTimeout((function(){Me(i.manager.room,n,t)}),100),!0));case 6:return e.abrupt("return",!1);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setSceneIndexWithoutSync",value:function(e){this.view&&(this.view.focusSceneIndex=e)}},{key:"setSceneIndex",value:function(e){if(this.view){this.view.focusSceneIndex=e;var t=this._pageState.getFullPath(e);t&&this.setFullPath(t)}}},{key:"destroy",value:(t=g(regeneratorRuntime.mark((function e(t,n,r,i){var o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("destroyed"===this.status){e.next=13;break}return this.status="destroyed",e.prev=2,e.next=5,xe.notifyApp(this.kind,"destroy",{appId:this.id});case 5:return e.next=7,this.appEmitter.emit("destroy",{error:i});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("[WindowManager]: notifyApp error",e.t0.message,e.t0.stack);case 12:this.appEmitter.clearListeners(),ue.emit("destroy-".concat(this.id),{error:i}),t&&(null==(o=this.boxManager)||o.closeBox(this.id,r)),n&&(this.store.cleanAppAttributes(this.id),this.scenePath&&Me(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this._pageState.destroy(),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),null==(a=this.manager.refresher)||a.remove(this.id),null==(s=this.manager.refresher)||s.remove(this.stateKey),null==(u=this.manager.refresher)||u.remove("".concat(this.id,"-fullPath")),this._prevFullPath=void 0;case 13:case"end":return e.stop()}}),e,this,[[2,9]])}))),function(e,n,r,i){return t.apply(this,arguments)})},{key:"close",value:function(){return this.destroy(!0,!0,!1)}},{key:"view",get:function(){return this.manager.viewManager.getView(this.id)}},{key:"viewIndex",get:function(){var e;return null==(e=this.view)?void 0:e.focusSceneIndex}},{key:"isWritable",get:function(){var e;return this.manager.canOperate&&!(null!=(e=this.box)&&e.readonly)}},{key:"attributes",get:function(){return this.manager.attributes[this.id]}},{key:"appAttributes",get:function(){return this.store.getAppAttributes(this.id)}},{key:"box",get:function(){var e;return null==(e=this.boxManager)?void 0:e.getBox(this.id)}},{key:"pageState",get:function(){return this._pageState.toObject()}}]),e}(),ot=function(){function e(t){y(this,e),this.displayer=t,this.views=new Map}return x(e,[{key:"createView",value:function(e){var t=at(this.displayer);return this.views.set(e,t),t}},{key:"getView",value:function(e){return this.views.get(e)}},{key:"destroyView",value:function(e){var t=this.views.get(e);if(t){try{t.release()}catch(e){}this.views.delete(e)}}},{key:"setViewScenePath",value:function(e,t){var n=this.views.get(e);n&&(n.focusScenePath=t)}},{key:"destroy",value:function(){this.views.forEach((function(e){try{e.release()}catch(e){}})),this.views.clear()}}]),e}(),at=function(e){var t=e.views.createView();return st(t),t},st=function(e){e.setCameraBound({maxContentMode:function(){return 10},minContentMode:function(){return.1}})},ut=function(){function e(t){var n=this;y(this,e),this.manager=t,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new F.SideEffectManager,this.startListenWritableChange=function(){n.sideEffectManager.add((function(){return ue.on("writableChange",(function(e){e&&n.ensureCameraAndSize(),n.manager.room&&n.syncMainView(n.manager.room)}))}))},this.addCameraReaction=function(){var e;null==(e=n.manager.refresher)||e.add($e.MainViewCamera,n.cameraReaction)},this.cameraReaction=function(){return B.reaction((function(){return n.mainViewCamera}),(function(e){e&&e.id!==n.manager.uid&&(n.moveCameraToContian(n.mainViewSize),n.moveCamera(e))}),{fireImmediately:!0})},this.sizeChangeHandler=j.debounce((function(e){e&&(n.moveCameraToContian(e),n.moveCamera(n.mainViewCamera))}),30),this.onUpdateContainerSizeRatio=function(){var e=n.store.getMainViewSize();n.sizeChangeHandler(e)},this.onCameraUpdatedByDevice=function(e){n.viewMode!==B.ViewMode.Follower&&(n.store.setMainViewCamera(O(P({},e),{id:n.manager.uid})),j.isEqual(n.mainViewSize,O(P({},n.mainView.size),{id:n.manager.uid}))||n.setMainViewSize(n.view.size))},this.mainViewClickListener=function(){n.mainViewClickHandler()},this.setMainViewSize=j.debounce((function(e){n.store.setMainViewSize(O(P({},e),{id:n.manager.uid}))}),50),this._syncMainViewTimer=0,this.onCameraOrSizeUpdated=function(){ae.emit("cameraStateChange",n.cameraState),n.manager.room&&n.manager.room.syncMainView&&(clearTimeout(n._syncMainViewTimer),n._syncMainViewTimer=setTimeout(n.syncMainView,100,n.manager.room))},this.syncMainView=function(e){e.isWritable&&e.syncMainView(n.mainView)},this.setViewMode=function(e){n.viewMode=e},this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),ue.once("mainViewMounted").then((function(){n.addMainViewListener(),n.start(),n.ensureCameraAndSize(),n.startListenWritableChange()}));var r=function(){n.sizeChangeHandler(n.mainViewSize)};this.sideEffectManager.add((function(){return ue.on("playgroundSizeChange",r)})),this.sideEffectManager.add((function(){return ue.on("containerSizeRatioUpdate",n.onUpdateContainerSizeRatio)})),this.sideEffectManager.add((function(){return ue.on("startReconnect",(function(){n.didRelease||n.mainView.release()}))}))}var t;return x(e,[{key:"ensureCameraAndSize",value:function(){this.viewMode===B.ViewMode.Broadcaster&&(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(q.InitMainViewCamera),this.setCameraAndSize())}},{key:"moveCameraSizeByAttributes",value:function(){this.moveCameraToContian(this.mainViewSize),this.moveCamera(this.mainViewCamera)}},{key:"start",value:function(){this.sizeChangeHandler(this.mainViewSize),!this.started&&(this.addCameraListener(),this.addCameraReaction(),this.manager.room&&this.syncMainView(this.manager.room),this.started=!0)}},{key:"setCameraAndSize",value:function(){var e=O(P({},this.mainView.camera),{id:this.manager.uid}),t=O(P({},this.mainView.size),{id:this.manager.uid});this.store.setMainViewCameraAndSize(e,t)}},{key:"createMainView",value:function(){var e=at(this.manager.displayer),t=this.store.getMainViewScenePath();return t&&we(e,t),e}},{key:"onReconnect",value:function(){if(this.didRelease)this.rebind();else{var e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}},{key:"setFocusScenePath",value:function(e){if(e)return we(this.view,e)}},{key:"rebind",value:function(){var e=this.mainView.divElement,t=this.mainView.disableCameraTransform;this.stop(),this.didRelease||this.mainView.release(),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=t,this.mainView.divElement=e,this.addMainViewListener(),this.start()}},{key:"addMainViewListener",value:function(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}},{key:"removeMainViewListener",value:function(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}},{key:"mainViewClickHandler",value:(t=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:!this.manager.canOperate||(this.store.cleanFocus(),null==(t=this.manager.boxManager)||t.blurAllBox());case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"addCameraListener",value:function(){this.view.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.on("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}},{key:"removeCameraListener",value:function(){this.view.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}},{key:"moveCameraToContian",value:function(e){j.isEmpty(e)||(this.view.moveCameraToContain({width:e.width,height:e.height,originX:-e.width/2,originY:-e.height/2,animationMode:B.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}},{key:"moveCamera",value:function(e){if(!j.isEmpty(e)){if(j.isEqual(e,this.view.camera))return;var t=e.centerX,n=e.centerY,r=e.scale*(this.scale||1);this.view.moveCamera({centerX:t,centerY:n,scale:r,animationMode:B.AnimationMode.Immediately})}}},{key:"stop",value:function(){var e,t;this.removeCameraListener(),null==(e=this.manager.refresher)||e.remove($e.MainViewCamera),null==(t=this.manager.refresher)||t.remove($e.MainViewSize),this.started=!1}},{key:"destroy",value:function(){this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}},{key:"mainViewCamera",get:function(){return this.store.getMainViewCamera()}},{key:"mainViewSize",get:function(){return this.store.getMainViewSize()}},{key:"didRelease",get:function(){return j.get(this.view,["didRelease"])}},{key:"view",get:function(){return this.mainView}},{key:"cameraState",get:function(){return P(P({},this.view.camera),this.view.size)}}]),e}(),lt=function(){function e(t){var n=this;y(this,e),this.context=t,this.addRedoUndoListeners=function(e){if(void 0===e)n.addViewCallbacks(n.context.mainView(),n.onCanRedoStepsUpdate,n.onCanUndoStepsUpdate);else{var t=n.context.getAppProxy(e);t&&t.view&&n.addViewCallbacks(t.view,n.onCanRedoStepsUpdate,n.onCanUndoStepsUpdate)}},this.addViewCallbacks=function(e,t,n){t(e.canRedoSteps),n(e.canUndoSteps),e.callbacks.on("onCanRedoStepsUpdate",t),e.callbacks.on("onCanUndoStepsUpdate",n)},this.disposeViewCallbacks=function(e){e.callbacks.off("onCanRedoStepsUpdate",n.onCanRedoStepsUpdate),e.callbacks.off("onCanUndoStepsUpdate",n.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=function(e){ae.emit("canRedoStepsChange",e)},this.onCanUndoStepsUpdate=function(e){ae.emit("canUndoStepsChange",e)},this.disposePrevFocusViewRedoUndoListeners=function(e){var t;if(void 0===e)t=n.context.mainView();else{var r=n.context.getAppProxy(e);r&&r.view&&(t=r.view)}t&&n.disposeViewCallbacks(t)},ue.on("focusedChange",(function(e){n.disposePrevFocusViewRedoUndoListeners(e.prev),setTimeout((function(){n.addRedoUndoListeners(e.focused)}),0)})),ue.on("rootDirRemoved",(function(){n.disposePrevFocusViewRedoUndoListeners(t.focus()),n.addRedoUndoListeners(t.focus())})),this.addRedoUndoListeners(t.focus())}return x(e,[{key:"destroy",value:function(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}]),e}(),ct=function(){function e(t){var n=this;y(this,e),this.windowManger=t,this.appProxies=new Map,this.appStatus=new Map,this.store=et,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new se,this.sideEffectManager=new F.SideEffectManager,this.sceneState=null,this.rootDirRemoving=!1,this.onRemoveScenes=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=t.scenePath)!==ie){e.next=6;break}return e.next=4,n.onRootDirRemoved();case 4:return n.dispatchInternalEvent(q.RootDirRemoved),e.abrupt("return");case 6:if(!De(o)){e.next=14;break}return a=n.mainView.focusSceneIndex||0,(s=null==(r=n.callbacksNode)?void 0:r.scenes[a])||(a=0,s=null==(i=n.callbacksNode)?void 0:i.scenes[a]),s&&n.setMainViewScenePath("".concat(ie).concat(s)),e.next=12,n.setMainViewSceneIndex(a);case 12:e.next=15;break;case 14:n.appProxies.forEach((function(e){e.onRemoveScene(o)}));case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.onReadonlyChanged=function(){n.appProxies.forEach((function(e){e.emitAppIsWritableChange()}))},this.onPlayerSeekStart=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.closeAll();case 2:case"end":return e.stop()}}),e)}))),this.onPlayerSeekDone=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.attributesUpdateCallback(n.attributes.apps);case 2:n.appProxies.forEach((function(e){e.onSeek(t)}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.createRootDirScenesCallback=function(){var e,t=!1;n.callbacksNode&&(n.callbacksNode.dispose(),t=!0),n.callbacksNode=n.displayer.createScenesCallback(ie,{onAddScene:n.onSceneChange,onRemoveScene:(e=g(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.onSceneChange(t);case 2:ue.emit("rootDirSceneRemoved",r);case 3:case"end":return e.stop()}}),e)}))),function(t,n){return e.apply(this,arguments)})}),n.callbacksNode&&(n.updateSceneState(n.callbacksNode),n.mainViewScenesLength=n.callbacksNode.scenes.length,t&&n.emitMainViewScenesChange(n.callbacksNode.scenes.length))},this.removeSceneByIndex=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=nt(t,n.windowManger.pageState),n.setSceneIndexWithoutSync(i),n.dispatchInternalEvent(q.SetAppFocusIndex,{type:"main",index:i}),o=null==(r=n.callbacksNode)?void 0:r.scenes[t],e.abrupt("return",(setTimeout((function(){o&&Me(n.room,"".concat(ie).concat(o),t)}),100),new Promise((function(e,t){ue.once("rootDirSceneRemoved").then((function(t){t===o&&e(!0)})).catch((function(e){console.log("[WindowManager]: removePage error: ".concat(e)),t(!1)}))}))));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.setSceneIndexWithoutSync=function(e){var t,r=null==(t=n.callbacksNode)?void 0:t.scenes[e];r&&n.mainViewProxy.setFocusScenePath("".concat(ie).concat(r))},this.onSceneChange=function(e){return n.mainViewScenesLength=e.scenes.length,n.updateSceneState(e),n.emitMainViewScenesChange(n.mainViewScenesLength)},this.emitMainViewScenesChange=function(e){return Promise.all([ae.emit("mainViewScenesLengthChange",e),ue.emit("changePageState")])},this.updateSceneState=function(e){var t=n.store.getMainViewSceneIndex()||0,r=e.scenes[t];r||(r=e.scenes[n.mainView.focusSceneIndex||0]),n.sceneState={scenePath:"".concat(ie).concat(r),contextPath:e.path,index:t,scenes:e.scenes.map((function(e){return{name:e}})),sceneName:r},ae.emit("sceneStateChange",n.sceneState)},this.onBoxMove=function(e){n.dispatchInternalEvent(q.AppMove,e),n.store.updateAppState(e.appId,$.Position,{x:e.x,y:e.y})},this.onBoxResize=function(e){e.width&&e.height&&(n.dispatchInternalEvent(q.AppResize,e),n.store.updateAppState(e.appId,$.Size,{width:e.width,height:e.height}))},this.onBoxFocus=function(e){n.windowManger.safeSetAttributes({focus:e.appId})},this.onBoxClose=function(e){var t=n.appProxies.get(e.appId);t&&t.destroy(!1,!0,!0,e.error)},this.onBoxStateChange=function(e){n.dispatchInternalEvent(q.AppBoxStateChange,e)},this.addAppsChangeListener=function(){var e;null==(e=n.refresher)||e.add("apps",(function(){return Ve((function(){return n.attributes.apps}),(function(){n.attributesUpdateCallback(n.attributes.apps)}))}))},this.addAppCloseListener=function(){var e;null==(e=n.refresher)||e.add("appsClose",(function(){return We(n.attributes.apps,(function(){n.onAppDelete(n.attributes.apps)}))}))},this.onMainViewIndexChange=function(e){void 0!==e&&n._prevSceneIndex!==e&&(ae.emit("mainViewSceneIndexChange",e),ue.emit("changePageState"),n.callbacksNode&&n.updateSceneState(n.callbacksNode),n._prevSceneIndex=e)},this.onFocusChange=function(e){var t;n._prevFocused!==e&&(ae.emit("focusedChange",e),ue.emit("focusedChange",{focused:e,prev:n._prevFocused}),n._prevFocused=e,void 0!==e&&(null==(t=n.boxManager)||t.focusBox({appId:e}),setTimeout((function(){var t=n.appProxies.get(e);t&&xe.notifyApp(t.kind,"focus",{appId:e})}),0)))},this.attributesUpdateCallback=j.debounce((function(e){return n._attributesUpdateCallback(e)}),100),this._appIds=[],this.onRegisteredChange=function(e){!e||Object.entries(e).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];xe.appClasses.has(n)||xe.register({kind:n,src:r.src,name:r.name})}))},this.onMinimized=function(e){var t,r;(null==(t=n.boxManager)?void 0:t.minimized)!==e&&(!0===e&&(null==(r=n.boxManager)||r.blurAllBox()),setTimeout((function(){var t;null==(t=n.boxManager)||t.setMinimized(Boolean(e))}),0))},this.onAppDelete=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,a,s,u,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Object.keys(t),i=T(n.appProxies.entries()),e.prev=2,i.s();case 4:if((a=i.n()).done){e.next=12;break}if(s=o(a.value,2),u=s[0],l=s[1],e.t0=r.includes(u),e.t0){e.next=10;break}return e.next=10,l.destroy(!0,!1,!0);case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t1=e.catch(2),i.e(e.t1);case 17:return e.prev=17,i.f(),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[2,14,17,20]])})));return function(t){return e.apply(this,arguments)}}(),this.closeAll=g(regeneratorRuntime.mark((function e(){var t,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=T(n.appProxies.entries()),e.prev=1,t.s();case 3:if((r=t.n()).done){e.next=9;break}return i=o(r.value,2),i[0],a=i[1],e.next=7,a.destroy(!0,!1,!0);case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),t.e(e.t0);case 14:return e.prev=14,t.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])}))),this.displayerStateListener=function(e){var t=e.sceneState;if(t){var r=t.scenePath;n.appProxies.forEach((function(e){e.scenePath&&r.startsWith(e.scenePath)&&(e.emitAppSceneStateChange(t),e.setFullPath(r))}))}n.appProxies.forEach((function(t){t.appEmitter.emit("roomStateChange",e)})),ue.emit("observerIdChange",n.displayer.observerId)},this.displayerWritableListener=function(e){var t,r,i=!e,o=void 0===n.windowManger.readonly||!1===n.windowManger.readonly;void 0===n.windowManger.readonly?null==(t=n.boxManager)||t.setReadonly(e):null==(r=n.boxManager)||r.setReadonly(!(i&&o)),n.appProxies.forEach((function(e){e.emitAppIsWritableChange()})),ue.emit("writableChange",i)},this.updateSceneIndex=function(){var e=n.store.getMainViewScenePath(),t=Ie(e),r=Ee(n.displayer)[t];if(r.length){var i=e.replace(t,"").replace("/",""),o=r.findIndex((function(e){return e.name===i}));j.isInteger(o)&&o>=0&&n.safeSetAttributes({_mainSceneIndex:o})}},this.updateRootDirRemoving=function(e){n.rootDirRemoving=e},this.displayer=t.displayer,this.store.setContext({getAttributes:function(){return n.attributes},safeSetAttributes:function(e){return n.safeSetAttributes(e)},safeUpdateAttributes:function(e,t){return n.safeUpdateAttributes(e,t)}}),this.mainViewProxy=new ut(this),this.viewManager=new ot(this.displayer),this.appListeners=new Pe(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=Ab,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:ue}),this.sideEffectManager.add((function(){return function(){var e,t,r;n.appCreateQueue.destroy(),n.mainViewProxy.destroy(),null==(e=n.refresher)||e.destroy(),n.viewManager.destroy(),null==(t=n.boxManager)||t.destroy(),null==(r=n.callbacksNode)||r.dispose()}})),ue.once("onCreated").then((function(){return n.onCreated()})),ue.on("onReconnected",(function(){return n.onReconnected()})),B.isPlayer(this.displayer)&&(ue.on("seekStart",this.onPlayerSeekStart),ue.on("seek",this.onPlayerSeekDone)),ue.on("removeScenes",this.onRemoveScenes),ue.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),xe.setSyncRegisterApp((function(e){n.safeUpdateAttributes([$e.Registered,e.kind],e)}))}var t,n,r,i,a,s,u,l,c,h,d;return x(e,[{key:"onRootDirRemoved",value:(d=g(regeneratorRuntime.mark((function e(){var t,n,r,i,a,s,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!(u.length>0&&void 0!==u[0])||u[0],this.setMainViewScenePath(oe),this.createRootDirScenesCallback(),n=T(this.appProxies.entries()),e.prev=3,n.s();case 5:if((r=n.n()).done){e.next=13;break}if(i=o(r.value,2),a=i[0],s=i[1],e.t0=s.view,!e.t0){e.next=11;break}return e.next=11,this.closeApp(a,t);case 11:e.next=5;break;case 13:e.next=18;break;case 15:e.prev=15,e.t1=e.catch(3),n.e(e.t1);case 18:return e.prev=18,n.f(),e.finish(18);case 21:this.mainViewProxy.rebind(),ue.emit("rootDirRemoved"),this.updateRootDirRemoving(!1);case 22:case"end":return e.stop()}}),e,this,[[3,15,18,21]])}))),function(){return d.apply(this,arguments)})},{key:"getMainViewSceneDir",value:function(){var e=this.store.getMainViewScenePath();if(e)return Ie(e);throw new Error("[WindowManager]: mainViewSceneDir not found")}},{key:"onCreated",value:(h=g(regeneratorRuntime.mark((function e(){var t,n,r,i,o,a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.attributesUpdateCallback(this.attributes.apps);case 2:if(ue.emit("updateManagerRect"),rt.on("move",this.onBoxMove),rt.on("resize",this.onBoxResize),rt.on("focus",this.onBoxFocus),rt.on("close",this.onBoxClose),rt.on("boxStateChange",this.onBoxStateChange),this.addAppsChangeListener(),this.addAppCloseListener(),null==(t=this.refresher)||t.add("maximized",(function(){return B.autorun((function(){var e,t=u.attributes.maximized;null==(e=u.boxManager)||e.setMaximized(Boolean(t))}))})),null==(n=this.refresher)||n.add("minimized",(function(){return B.autorun((function(){var e=u.attributes.minimized;u.onMinimized(e)}))})),null==(r=this.refresher)||r.add("mainViewIndex",(function(){return B.autorun((function(){var e=j.get(u.attributes,"_mainSceneIndex");u.onMainViewIndexChange(e)}))})),null==(i=this.refresher)||i.add("focusedChange",(function(){return B.autorun((function(){var e=j.get(u.attributes,"focus");u.onFocusChange(e)}))})),null==(o=this.refresher)||o.add("registeredChange",(function(){return B.autorun((function(){var e=j.get(u.attributes,$e.Registered);u.onRegisteredChange(e)}))})),this.attributes.apps&&0!==Object.keys(this.attributes.apps).length){e.next=20;break}if(s=this.store.getMainViewScenePath()){e.next=19;break}return e.abrupt("return");case 19:this.resetScenePath(s);case 20:this.displayerWritableListener(!(null!=(a=this.room)&&a.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this._prevFocused=this.attributes.focus,this.sideEffectManager.add((function(){var e=new lt({mainView:function(){return u.mainViewProxy.view},focus:function(){return u.attributes.focus},getAppProxy:function(e){return u.appProxies.get(e)}});return function(){return e.destroy()}}));case 21:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"notifyAppsChange",value:function(e){(this._appIds.length!==e.length||!this._appIds.every((function(t){return e.includes(t)})))&&(this._appIds=e,ae.emit("appsChange",e))}},{key:"_attributesUpdateCallback",value:(c=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&Cb.container){0===(n=Object.keys(t)).length&&this.appCreateQueue.emitReady(),r=j.orderBy(n.map((function(e){return{id:e,createdAt:t[e].createdAt}})),"createdAt","asc").map((function(e){return e.id})),this.notifyAppsChange(r),i=T(r);try{for(a=function(){var e=o.value;if(!s.appProxies.has(e)&&!s.appStatus.has(e)){var n=t[e];try{if(!s.attributes[e])throw new Error("appAttributes is undefined");s.appCreateQueue.push((function(){return s.appStatus.set(e,te.StartCreate),s.baseInsertApp({kind:n.kind,options:n.options,isDynamicPPT:n.isDynamicPPT},e,!1)})),s.focusByAttributes(t)}catch(e){console.warn("[WindowManager]: Insert App Error",e)}}},i.s();!(o=i.n()).done;)a()}catch(e){i.e(e)}finally{i.f()}}case 1:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"refresh",value:function(){this.attributesUpdateCallback(this.attributes.apps)}},{key:"setBoxManager",value:function(e){this.boxManager=e}},{key:"resetMaximized",value:function(){var e;null==(e=this.boxManager)||e.setMaximized(Boolean(this.store.getMaximized()))}},{key:"resetMinimized",value:function(){var e;null==(e=this.boxManager)||e.setMinimized(Boolean(this.store.getMinimized()))}},{key:"bindMainView",value:function(e,t){var n=this.mainViewProxy.view;n.disableCameraTransform=t,n.divElement=e,n.focusScenePath||this.setMainViewFocusPath(),ue.emit("mainViewMounted")}},{key:"setMainViewFocusPath",value:function(e){var t,n=e||this.store.getMainViewScenePath();if(n)return we(this.mainView,n),(null==(t=this.mainView)?void 0:t.focusScenePath)===n}},{key:"resetScenePath",value:function(e){this.displayer.state.sceneState.scenePath!==e&&Te(this.room,e)}},{key:"addApp",value:(l=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tt("addApp",t),e.next=3,this.beforeAddApp(t,n);case 3:return r=e.sent,i=r.appId,o=r.needFocus,e.next=8,this.baseInsertApp(t,i,!0,o);case 8:return a=e.sent,e.abrupt("return",(this.afterAddApp(a),null==a?void 0:a.id));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"beforeAddApp",value:(u=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_e(t.kind);case 2:return o=e.sent,this.appStatus.set(o,te.StartCreate),a=null!=(r=t.attributes)?r:{},this.safeUpdateAttributes([o],a),this.store.setupAppAttributes(t,o,n),s=!(null!=(i=this.boxManager)&&i.minimized),e.abrupt("return",(s&&this.store.setAppFocus(o,!0),{appId:o,needFocus:s}));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"afterAddApp",value:function(e){var t,n;if(e&&e.box){var r=e.box;rt.emit("move",{appId:e.id,x:null==r?void 0:r.intrinsicX,y:null==r?void 0:r.intrinsicY}),this.store.updateAppState(e.id,$.ZIndex,r.zIndex)}null!=(t=this.boxManager)&&t.minimized&&(null==(n=this.boxManager)||n.setMinimized(!1,!1))}},{key:"closeApp",value:(s=g(regeneratorRuntime.mark((function e(t){var n,r,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=!(i.length>1&&void 0!==i[1])||i[1],(r=this.appProxies.get(t))&&r.destroy(!0,n,!1);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"baseInsertApp",value:(a=g(regeneratorRuntime.mark((function e(t,n,r,i){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appProxies.has(n)){e.next=3;break}return console.warn("[WindowManager]: app duplicate exists and cannot be created again"),e.abrupt("return");case 3:if(!(o=new it(t,this,n,r))){e.next=9;break}return e.next=7,o.baseInsertApp(i);case 7:return this.appStatus.delete(n),e.abrupt("return",o);case 9:throw this.appStatus.delete(n),new Error("[WindowManger]: initialize AppProxy failed");case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return a.apply(this,arguments)})},{key:"safeSetAttributes",value:function(e){this.windowManger.safeSetAttributes(e)}},{key:"safeUpdateAttributes",value:function(e,t){this.windowManger.safeUpdateAttributes(e,t)}},{key:"setMainViewScenePath",value:(i=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.room){e.next=17;break}if(n=this.displayer.scenePathType(t),Ie(t)===ie){e.next=4;break}throw new Error('[WindowManager]: main view scenePath must in root dir "/"');case 4:if(n!==B.ScenePathType.None){e.next=6;break}throw new Error("[WindowManager]: ".concat(t," not valid scene"));case 6:if(n!==B.ScenePathType.Page){e.next=11;break}return e.next=9,this._setMainViewScenePath(t);case 9:e.next=17;break;case 11:if(n!==B.ScenePathType.Dir){e.next=17;break}if(r=Se(this.displayer,t),e.t0=r,!e.t0){e.next=17;break}return e.next=17,this._setMainViewScenePath(r);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_setMainViewScenePath",value:(r=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.setMainViewFocusPath(t)&&(this.safeSetAttributes({_mainScenePath:t}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setMainViewSceneIndex",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.room){e.next=9;break}if(this.store.getMainViewSceneIndex()!==t){e.next=3;break}return e.abrupt("return");case 3:if(r=null==(n=this.callbacksNode)?void 0:n.scenes[t],i="".concat(ie).concat(r),!r){e.next=8;break}this.setMainViewFocusPath(i)&&(this.store.setMainViewScenePath(i),this.store.setMainViewSceneIndex(t),this.dispatchSetMainViewScenePath(i)),e.next=9;break;case 8:throw new Error("[WindowManager]: ".concat(t," not valid index"));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"dispatchSetMainViewScenePath",value:function(e){this.dispatchInternalEvent(q.SetMainViewScenePath,{nextScenePath:e}),ae.emit("mainViewScenePathChange",e),Te(this.room,e)}},{key:"getAppInitPath",value:function(e){var t,n=this.store.getAppAttributes(e);if(n)return null==(t=null==n?void 0:n.options)?void 0:t.scenePath}},{key:"safeDispatchMagixEvent",value:function(e,t){this.canOperate&&this.displayer.dispatchMagixEvent(e,t)}},{key:"focusByAttributes",value:function(e){var t;if(e&&Object.keys(e).length===(null==(t=this.boxManager)?void 0:t.boxSize)){var n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}},{key:"onReconnected",value:(t=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.attributesUpdateCallback(this.attributes.apps),t=Array.from(this.appProxies.values()).map((function(e){return e.onReconnected()})),this.mainViewProxy.onReconnect(),e.next=5,Promise.all(t);case 5:this.callbacksNode&&this.onSceneChange(this.callbacksNode);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"notifyContainerRectUpdate",value:function(e){this.appProxies.forEach((function(t){t.appEmitter.emit("containerRectUpdate",e)}))}},{key:"dispatchInternalEvent",value:function(e,t){this.safeDispatchMagixEvent(J,{eventName:e,payload:t})}},{key:"destroy",value:function(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),rt.clearListeners(),ue.clearListeners(),this.appProxies.size&&this.appProxies.forEach((function(e){e.destroy(!0,!1,!0)})),ae.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0}},{key:"eventName",get:function(){return B.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}},{key:"attributes",get:function(){return this.windowManger.attributes}},{key:"canOperate",get:function(){return this.windowManger.canOperate}},{key:"room",get:function(){return B.isRoom(this.displayer)?this.displayer:void 0}},{key:"mainView",get:function(){return this.mainViewProxy.view}},{key:"focusApp",get:function(){if(this.store.focus)return this.appProxies.get(this.store.focus)}},{key:"uid",get:function(){var e;return(null==(e=this.room)?void 0:e.uid)||""}}]),e}(),ht=function(){if(Ne(B.WhiteVersion)Cb.containerSizeRatio?(i=r*Cb.containerSizeRatio,t.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(r=i/Cb.containerSizeRatio,t.classList.toggle("netless-window-manager-sizer-horizontal",!1)),n.style.width="".concat(r,"px"),n.style.height="".concat(i,"px"))}},{key:"disconnect",value:function(){var e;null==(e=this.containerResizeObserver)||e.disconnect(),j.isFunction(this.disposer)&&(this.disposer(),this.disposer=void 0)}}],[{key:"create",value:function(t,n,r,i){var o=new e(i);return o.observePlaygroundSize(t,n,r),o}}]),e}(),mt={exports:{}},gt={},yt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable;function _t(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var wt=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=_t(e),o=1;o0)&&!(r=o.next()).done;)a.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 a}function U(){for(var e=[],t=0;t2&&ie("box");var n=q(t);return new Ae(e,J(n),n.name,!0,n.equals)},shallowBox:function(e,t){return arguments.length>2&&ie("shallowBox"),re.box(e,{name:t,deep:!1})},array:function(e,t){arguments.length>2&&ie("array");var n=q(t);return new St(e,J(n),n.name)},shallowArray:function(e,t){return arguments.length>2&&ie("shallowArray"),re.array(e,{name:t,deep:!1})},map:function(e,t){arguments.length>2&&ie("map");var n=q(t);return new Pt(e,J(n),n.name)},shallowMap:function(e,t){return arguments.length>2&&ie("shallowMap"),re.map(e,{name:t,deep:!1})},set:function(e,t){arguments.length>2&&ie("set");var n=q(t);return new jt(e,J(n),n.name)},object:function(e,t,n){"string"==typeof arguments[1]&&ie("object");var r=q(n);return ot({},e,t,r)},shallowObject:function(e,t){return"string"==typeof arguments[1]&&ie("shallowObject"),re.object(e,{},{name:t,deep:!1})},ref:ee,shallow:$,deep:K,struct:te},re=function e(t,n,r){if("string"==typeof arguments[1])return K.apply(null,arguments);if(ut(t))return t;var i=v(t)?e.object(t,n,r):Array.isArray(t)?e.array(t,n):b(t)?e.map(t,n):x(t)?e.set(t,n):t;if(i!==t)return i;c(!1)};function ie(e){c("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}Object.keys(ne).forEach((function(e){return re[e]=ne[e]}));var oe,ae,se=V(!1,(function(e,t,n,r,i){var o=n.get,a=n.set,s=i[0]||{};!function(e,t,n){var r=Ft(e);n.name=r.name+"."+t,n.context=e,r.values[t]=new Ie(n),Object.defineProperty(e,t,function(e){return Gt[e]||(Gt[e]={configurable:De.computedConfigurable,enumerable:!1,get:function(){return Ht(this).read(this,e)},set:function(t){Ht(this).write(this,e,t)}})}(t))}(e,t,j({get:o,set:a},s))}));se({equals:O.structural}),function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(oe||(oe={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(ae||(ae={}));var ue=function(e){this.cause=e};function le(e){return e instanceof ue}function ce(e){switch(e.dependenciesState){case oe.UP_TO_DATE:return!1;case oe.NOT_TRACKING:case oe.STALE:return!0;case oe.POSSIBLY_STALE:for(var t=ge(!0),n=ve(),r=e.observing,i=r.length,o=0;o0;De.computationDepth>0&&t&&c(!1),De.allowStateChanges||!t&&"strict"!==De.enforceActions||c(!1)}function de(e,t,n){var r=ge(!0);be(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++De.runId;var i,o=De.trackingDerivation;if(De.trackingDerivation=e,!0===De.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new ue(e)}return De.trackingDerivation=o,function(e){for(var t=e.observing,n=e.observing=e.newObserving,r=oe.UP_TO_DATE,i=0,o=e.unboundDepsCount,a=0;ar&&(r=s.dependenciesState);for(n.length=i,e.newObserving=null,o=t.length;o--;)0===(s=t[o]).diffValue&&Oe(s,e),s.diffValue=0;for(;i--;){var s;1===(s=n[i]).diffValue&&(s.diffValue=0,Pe(s,e))}r!==oe.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}(e),e.observing.length,ye(r),i}function fe(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Oe(t[n],e);e.dependenciesState=oe.NOT_TRACKING}function pe(e){var t=ve(),n=e();return me(t),n}function ve(){var e=De.trackingDerivation;return De.trackingDerivation=null,e}function me(e){De.trackingDerivation=e}function ge(e){var t=De.allowStateReads;return De.allowStateReads=e,t}function ye(e){De.allowStateReads=e}function be(e){if(e.dependenciesState!==oe.UP_TO_DATE){e.dependenciesState=oe.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=oe.UP_TO_DATE}}var xe=0,_e=1,we=Object.getOwnPropertyDescriptor((function(){}),"name");function Te(e,t){var n=function(){return Me(e,t,this,arguments)};return n.isMobxAction=!0,n}function Me(e,t,n,r){var i=function(e,t,n){var r=Ve()&&!!e,i=0;if(r){i=Date.now();var o=n&&n.length||0,a=new Array(o);if(o>0)for(var s=0;s0&&!e.__mobxGlobals&&(ke=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Ne).version&&(ke=!1),ke?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Ne):(setTimeout((function(){c("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Ne)}();function Pe(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Oe(e,t){if(1===e.observers.length)e.observers.length=0,Re(e);else{var n=e.observers,r=e.observersIndexes,i=n.pop();if(i!==t){var o=r[t.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[t.__mapid]}}function Re(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,De.pendingUnobservations.push(e))}function Le(){De.inBatch++}function je(){if(0==--De.inBatch){ze();for(var e=De.pendingUnobservations,t=0;t0&&Re(e),!1)}function Ue(e,t){if(console.log("[mobx.trace] '"+e.name+"' is invalidated due to a change in: '"+t.name+"'"),e.isTracing===ae.BREAK){var n=[];!function e(t,n,r){n.length>=1e3?n.push("(and many more)"):(n.push(""+new Array(r).join("\t")+t.name),t.dependencies&&t.dependencies.forEach((function(t){return e(t,n,r+1)})))}((r=e,at(Yt(r,void 0))),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof Ie?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}var r}var Fe=function(){function e(e,t,n,r){void 0===e&&(e="Reaction@"+l()),void 0===r&&(r=!1),this.name=e,this.onInvalidate=t,this.errorHandler=n,this.requiresObservable=r,this.observing=[],this.newObserving=[],this.dependenciesState=oe.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+l(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=ae.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,De.pendingReactions.push(this),ze())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(Le(),this._isScheduled=!1,ce(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&Ve()&&We({name:this.name,type:"scheduled-reaction"})}catch(e){this.reportExceptionInDerivation(e)}}je()}},e.prototype.track=function(e){Le();var t,n=Ve();n&&(t=Date.now(),Ye({name:this.name,type:"reaction"})),this._isRunning=!0;var r=de(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&fe(this),le(r)&&this.reportExceptionInDerivation(r.cause),n&&Qe({time:Date.now()-t}),je()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)this.errorHandler(e,this);else{if(De.disableErrorBoundaries)throw e;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";De.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)"):console.error(n,e),Ve()&&We({type:"error",name:this.name,message:n,error:""+e}),De.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Le(),fe(this),je()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.trace=function(e){void 0===e&&(e=!1),function(){for(var e=[],t=0;t0||De.isRunningReactions||function(e){e()}(Ge)}function Ge(){De.isRunningReactions=!0;for(var e=De.pendingReactions,t=0;e.length>0;){100==++t&&(console.error("Reaction doesn't converge to a stable state after 100 iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",e):2===arguments.length&&"function"==typeof t?Te(e,t):1===arguments.length&&"string"==typeof e?qe(e):!0!==r?qe(t).apply(null,arguments):void(e[t]=Te(e.name||t,n.value))};function $e(e,t,n){m(e,t,Te(t,n.bind(e)))}Ke.bound=function(e,t,n,r){return!0===r?($e(e,t,n.value),null):n?{configurable:!0,enumerable:!1,get:function(){return $e(this,t,n.value||n.initializer.call(this)),this[t]},set:Ze}:{enumerable:!1,configurable:!0,set:function(e){$e(this,t,e)},get:function(){}}};var et=function(e){return e()};function tt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:et}function nt(e,t,n){void 0===n&&(n=a),"boolean"==typeof n&&(n={fireImmediately:n});var r,i,o,s=n.name||"Reaction@"+l(),u=Ke(s,n.onError?(r=n.onError,i=t,function(){try{return i.apply(this,arguments)}catch(e){r.call(this,e)}}):t),c=!n.scheduler&&!n.delay,h=tt(n),d=!0,f=!1,p=n.compareStructural?O.structural:n.equals||O.default,v=new Fe(s,(function(){d||c?m():f||(f=!0,h(m))}),n.onError,n.requiresObservable);function m(){if(f=!1,!v.isDisposed){var t=!1;v.track((function(){var n=e(v);t=d||!p(o,n),o=n})),d&&n.fireImmediately&&u(o,v),d||!0!==t||u(o,v),d&&(d=!1)}}return v.schedule(),v.getDisposer()}function rt(e,t,n){return it("onBecomeUnobserved",e,t,n)}function it(e,t,n,r){var i="function"==typeof r?Yt(t,n):Yt(t),o="function"==typeof r?r:n,a=i[e];return"function"!=typeof a?c(!1):(i[e]=function(){a.call(this),o.call(this)},function(){i[e]=a})}function ot(e,t,n,r){var i=(r=q(r)).defaultDecorator||(!1===r.deep?ee:K);H(e),Ft(e,r.name,i.enhancer),Le();try{for(var o=Object.getOwnPropertyNames(t),a=0,s=o.length;a0&&(r.dependencies=(t=e.observing,n=[],t.forEach((function(e){-1===n.indexOf(e)&&n.push(e)})),n).map(at)),r}function st(e,t){if(null==e)return!1;if(void 0!==t){if(Wt(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return Wt(e)||!!e.$mobx||k(e)||He(e)||Ce(e)}function ut(e){return 1!==arguments.length&&c(!1),st(e)}function lt(e){switch(e.length){case 0:return De.trackingDerivation;case 1:return Yt(e[0]);case 2:return Yt(e[0],e[1])}}function ct(e,t){void 0===t&&(t=void 0),Le();try{return e.apply(t)}finally{je()}}function ht(e){return void 0!==e.interceptors&&e.interceptors.length>0}function dt(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),d((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ft(e,t){var n=ve();try{var r=e.interceptors;if(r)for(var i=0,o=r.length;i0}function vt(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),d((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function mt(e,t){var n=ve(),r=e.changeListeners;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},e.prototype.intercept=function(e){return dt(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),vt(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r0&&e+t+1>wt&&Ct(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var r=this;he(this.atom);var i=this.values.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=o),ht(this)){var a=ft(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!a)return o;t=a.removedCount,n=a.added}var s=(n=0===n.length?n:n.map((function(e){return r.enhancer(e,void 0)}))).length-t;this.updateArrayLength(i,s);var u=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,u),this.dehanceValues(u)},e.prototype.spliceItemsIntoValues=function(e,t,n){var r;if(n.length<1e4)return(r=this.values).splice.apply(r,U([e,t],n));var i=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),i},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&Ve(),i=pt(this),o=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&Ye(j(j({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&mt(this,o),r&&Qe()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&Ve(),i=pt(this),o=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&Ye(j(j({},o),{name:this.atom.name})),this.atom.reportChanged(),i&&mt(this,o),r&&Qe()},e}(),St=function(e){function t(t,n,r,i){void 0===r&&(r="ObservableArray@"+l()),void 0===i&&(i=!1);var o=e.call(this)||this,a=new Mt(r,n,o,i);if(g(o,"$mobx",a),t&&t.length){var s=Se(!0);o.spliceWithArray(0,0,t),Ee(s)}return _t&&Object.defineProperty(a.array,"0",Et),o}return L(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,i=this.$mobx.values;r=e1)for(var n=1;n=2&&(this.player.currentTime=e)},e}(),d=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(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(a,s)}u((r=r.apply(e,t||[])).next())}))},p=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1e3&&(n.lastSyncProgressTimestamp=r,n.selfUserInf&&n.selfUserInf.identity===i.host&&t.putAttributes({currentTime:e,play:n.playerState}))},n.handleNativePlayerState=function(e){return f(n,void 0,void 0,(function(){var t;return p(this,(function(n){switch(n.label){case 0:if(!e)return[3,7];if(!this.player.current)return[3,6];n.label=1;case 1:return n.trys.push([1,3,,6]),[4,this.player.current.play()];case 2:return n.sent(),[3,6];case 3:return""+(t=n.sent()).name!="NotAllowedError"&&""+t.name!="AbortError"?[3,5]:(this.setState({selfMute:!0}),[4,this.player.current.play()]);case 4:n.sent(),n.label=5;case 5:return[3,6];case 6:return[3,8];case 7:this.player.current&&this.player.current.pause(),n.label=8;case 8:return[2]}}))}))},n.handleSeekReaction=function(e,t){return f(n,void 0,void 0,(function(){return p(this,(function(n){return this.isHost()||this.player.current&&void 0!==t&&(this.player.current.currentTime=e+Date.now()/1e3-t),[2]}))}))},n.timeUpdate=function(){if(n.player.current){var e=n.player.current.currentTime;n.onTimeUpdate(e)}},n.detectVideoClickEnable=function(){var e=n.props.plugin;return e.context&&e.context.identity?e.context.identity!==i.host?"none":"auto":"none"},n.renderMuteBox=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity!==i.host&&n.state.selfMute?o.createElement("div",{className:"media-mute-box"},o.createElement("div",{onClick:function(){n.setState({selfMute:!1})},onTouchStart:function(){n.setState({selfMute:!1})},style:{pointerEvents:"auto"},className:"media-mute-box-inner"},o.createElement("img",{src:u,alt:"mute_icon"}),o.createElement("span",null,"unmute"))):null},n.handleRemove=function(){return f(n,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=this.props.plugin,this.handleRemotePlayState(!1),[4,v(300)];case 1:return t.sent(),e.remove(),[2]}}))}))},n.renderDeleteBtn=function(){var e=n.props.plugin;return e.context&&e.context.identity&&e.context.identity===i.host?o.createElement("div",{style:{pointerEvents:"auto"},className:"plugin-audio-box-delete",onClick:n.handleRemove},o.createElement("img",{src:c,alt:"delete"})):null},n.renderNavigation=function(){return!0===n.props.plugin.attributes.isNavigationDisable?null:o.createElement("div",{className:"plugin-video-box-nav"},o.createElement("div",null,o.createElement("img",{style:{width:20,marginLeft:8},src:l,alt:"video_plugin"}),o.createElement("span",null,"Video Player")),n.renderDeleteBtn())},n.handleOnEnd=function(){return f(n,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=this.props.plugin,this.player.current?this.selfUserInf?this.selfUserInf.identity!==i.host?[3,2]:(e.putAttributes({seek:0,seekTime:void 0,currentTime:0}),[4,v(500)]):[3,5]:[3,7];case 1:return t.sent(),this.player.current.load(),[3,4];case 2:return[4,v(1e3)];case 3:t.sent(),this.player.current.load(),t.label=4;case 4:return[3,7];case 5:return[4,v(1e3)];case 6:t.sent(),this.player.current.load(),t.label=7;case 7:return this.setState({isEnd:!0}),[2]}}))}))},n.handleOnLoadedMetadataCapture=function(){return f(n,void 0,void 0,(function(){var e,t;return p(this,(function(n){switch(n.label){case 0:return e=navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform),t=this.state.isEnd,e?[4,v(300)]:[3,2];case 1:n.sent(),this.handleFirstSeek(t),n.label=2;case 2:return[2]}}))}))},n.player=o.createRef(),n.reactionSeekDisposer=n.startSeekReaction(),n.reactionSeekTimeDisposer=n.startSeekTimeReaction(),n.reactionPlayDisposer=n.startPlayReaction(),n.reactionVolumeDisposer=n.startVolumeReaction(),n.reactionMuteDisposer=n.startMuteTimeReaction(),n.reactionSyncDisposer=n.startSyncReaction(),n.state={play:!1,seek:0,selfMute:!1,currentTime:0,mute:!1,volume:1,isEnd:!1},n}return d(t,e),t.prototype.componentDidMount=function(){return f(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.syncNode=new h(this.player.current),[4,this.handleStartCondition()];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.play}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.isHost()?[3,2]:[4,this.handleNativePlayerState(t)];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))}))},t.prototype.startSeekReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seek}),(function(n){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.handleSeekReaction(n,t.attributes.seekTime)];case 1:return e.sent(),[2]}}))}))}))},t.prototype.startSyncReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.currentTime}),(function(t){return f(e,void 0,void 0,(function(){return p(this,(function(e){return this.isHost()||this.player.current&&Math.abs(t-this.player.current.currentTime)>2&&(this.player.current.currentTime=t),[2]}))}))}))},t.prototype.startSeekTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.seekTime}),(function(n){return f(e,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.handleSeekReaction(t.attributes.seek,n)];case 1:return e.sent(),[2]}}))}))}))},t.prototype.startVolumeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.volume}),(function(t){e.isHost()||e.player.current&&(e.player.current.volume=t)}))},t.prototype.startMuteTimeReaction=function(){var e=this,t=this.props.plugin;return Object(s.a)((function(){return t.attributes.mute}),(function(t){e.isHost()||e.setState({mute:t})}))},t.prototype.componentWillUnmount=function(){this.reactionPlayDisposer(),this.reactionSeekDisposer(),this.reactionMuteDisposer(),this.reactionVolumeDisposer(),this.reactionSeekTimeDisposer(),this.reactionSyncDisposer(),this.player.current&&this.player.current.pause()},t.prototype.render=function(){var e=this.props,t=e.size,n=e.plugin,r=e.scale,i=this.state,a=i.mute,s=i.selfMute,u=0===r?1:r;return o.createElement("div",{className:"plugin-video-box",style:{width:t.width/u,height:t.height/u,transform:"scale("+u+")"}},this.renderNavigation(),o.createElement("div",{className:"plugin-video-box-body"},this.renderMuteBox(),o.createElement("div",{className:"white-plugin-video-box"},o.createElement("video",{"webkit-playsinline":"true",playsInline:!0,poster:n.attributes.poster,className:"white-plugin-video",src:n.attributes.pluginVideoUrl,ref:this.player,muted:a||s,style:{width:"100%",height:"100%",pointerEvents:this.detectVideoClickEnable(),outline:"none"},disablePictureInPicture:!0,onLoadedMetadataCapture:this.handleOnLoadedMetadataCapture,onEnded:this.handleOnEnd,controls:!0,controlsList:"nodownload nofullscreen",onTimeUpdate:this.timeUpdate,preload:"metadata"}))))},t}(o.Component),y=(m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(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}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),b=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(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(a,s)}u((r=r.apply(e,t||[])).next())}))},x=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1] img {\n width: 20px;\n margin-left: 8px;\n}\n.white-video-plugin-nav-title {\n margin-left: 6px;\n font-size: 12px;\n font-weight: bold;\n flex-grow: 1;\n}\n.white-video-plugin-nav-delete {\n width: 22px;\n height: 22px;\n border: 0;\n background-color: #ff756e;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n margin-right: 8px;\n cursor: pointer;\n opacity: 0.6;\n transition: opacity 0.2s ease;\n}\n.white-video-plugin-nav-delete > img {\n width: 14px;\n}\n.white-video-plugin-nav-delete:hover {\n opacity: 1;\n}\n.white-video-plugin-body {\n flex-grow: 1;\n background-color: #f2f4f5;\n display: flex;\n flex-flow: column nowrap;\n align-items: stretch;\n justify-content: center;\n height: calc(100% - 32px);\n}\n.white-video-plugin-body > audio {\n flex-grow: 1;\n outline: none;\n}\n",""]),e.exports=t},function(e,t,n){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,r,i,o=e[1]||"",a=e[3];if(!a)return o;if(t&&"function"==typeof btoa){var s=(n=a,r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),"/*# ".concat(i," */")),u=a.sources.map((function(e){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(e," */")}));return[o].concat(u).concat([s]).join("\n")}return[o].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;o0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&(d=Date.now(),this.props.player&&(d=this.props.player.beginTimestamp+r),f=l+(d-c)/1e3,Math.abs(n.currentTime-f)>2&&(n.currentTime=f)),this.changedMap.changed("rate",i)&&(n.playbackRate=i),[2]}}))}))}));this.disposers.push(r),this.disposers.push((function(){return e.changedMap.clear()}))},t.prototype.componentWillUnmount=function(){var e;null===(e=this.player.current)||void 0===e||e.pause(),this.disposers.forEach((function(e){return e()}))},Object.defineProperty(t.prototype,"containerStyle",{get:function(){var e=this.props,t=e.size,n=e.scale||1;return{width:t.width/n,height:t.height/n,transform:"scale("+n+")"}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointerEventsStyle",{get:function(){return{pointerEvents:this.isHost()?"auto":"none"}},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.props,t=e.room,n=e.player,r=e.plugin;return t||n?i.a.createElement("div",{className:"white-video-plugin-container",style:this.containerStyle},!r.attributes.isNavigationDisable&&i.a.createElement("div",{className:"white-video-plugin-nav"},i.a.createElement("img",{src:s.a,alt:"video_plugin"}),i.a.createElement("span",{className:"white-video-plugin-nav-title"},"Video Player"),i.a.createElement("span",{className:"white-video-plugin-nav-delete",style:this.pointerEventsStyle,onClick:this.removeSelf},i.a.createElement("img",{src:l.a,alt:"delete_icon"}))),i.a.createElement("div",{className:"white-video-plugin-body"},i.a.createElement("video",{src:r.attributes.src,style:m({maxWidth:"100%",maxHeight:"100%"},this.pointerEventsStyle),controls:!!t,controlsList:"nodownload nofullscreen",preload:"metadata",ref:this.player,playsInline:!0,"webkit-playsinline":"true",poster:r.attributes.poster,disablePictureInPicture:!0}))):null},t}(r.Component);n.d(t,"videoPlugin2",(function(){return _}));var _=Object.freeze({kind:"video2",render:b,defaultAttributes:{src:"",hostTime:0,currentTime:0,paused:!0,muted:!1,volume:1},hitTest:function(e){var t=e.component.context.getMemberState();return!("eraser"===(null==t?void 0:t.currentApplianceName))}})}])},"object"==r(t)&&"object"==r(e)?e.exports=i(n(17328),n(71895)):n.amdD([,],i)},18371:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.playerStateNameSpace=t.playerNameSpace=t.sdkNameSpace=t.roomStateNamespace=t.roomNamespace=t.roomSyncNamespace=t.pptNamespace=t.ScaleMode=void 0,function(e){e[e.Scale=0]="Scale",e[e.AspectFit=1]="AspectFit",e[e.AspectFitScale=2]="AspectFitScale",e[e.AspectFitSpace=3]="AspectFitSpace",e[e.AspectFill=4]="AspectFill",e[e.AspectFillScale=5]="AspectFillScale"}(t.ScaleMode||(t.ScaleMode={})),t.pptNamespace="ppt",t.roomSyncNamespace="room.sync",t.roomNamespace="room",t.roomStateNamespace="room.state",t.sdkNameSpace="sdk",t.playerNameSpace="player",t.playerStateNameSpace="player.state"},46640:function(e,t,n){var r;function i(e,t,n){return i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}},i(e,t,n||e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||M(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||M(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function u(e){var t=f();return function(){var n,r=v(e);if(t){var i=v(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,t){return!t||"object"!==_(t)&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){var t="function"==typeof Map?new Map:void 0;return h=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,v(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,e)},h(e)}function d(e,t,n){return d=f()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&p(i,n.prototype),i},d.apply(null,arguments)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function m(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function g(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){m(o,r,i,a,s,"next",e)}function s(e){m(o,r,i,a,s,"throw",e)}a(void 0)}))}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function M(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this.timer=this.initInterval())}},{key:"invoke",value:function(){var e=this;if(0!==this.list.length&&void 0===this.currentInvoker){var t=this.list.shift();t&&(this.currentInvoker=t,t().then((function(){e.invoked()})).catch((function(t){console.error("[WindowManager]: create app error: ".concat(t.message)),e.invoked()})))}}},{key:"emitReady",value:function(){this.isEmit||setTimeout((function(){ae.emit("ready")}),50),this.isEmit=!0}},{key:"empty",value:function(){this.list=[],this.clear()}},{key:"destroy",value:function(){this.timer&&this.clear()}}]),e}(),ue=new Q.default,le=function(){var e=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,t){var n=indexedDB.open("__WindowManagerAppCache",2);n.onerror=function(e){t(e)},n.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains("apps")||t.createObjectStore("apps",{keyPath:"kind"}).createIndex("kind","kind",{unique:!0})},n.onsuccess=function(){var t=n.result;e(t)}}));case 2:Y=e.sent;case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ce=function(e,t){if(Y)return function(e,t){return new Promise((function(n,r){var i=e.transaction(["apps"],"readwrite").objectStore("apps").add(t);i.onsuccess=function(){return n()},i.onerror=function(){return r()}}))}(Y,{kind:e,sourceCode:t})},he=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Y){e.next=6;break}return e.next=3,de(Y,t);case 3:e.t0=e.sent,e.next=7;break;case 6:e.t0=null;case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function de(e,t){return new Promise((function(n,r){var i=e.transaction(["apps"]).objectStore("apps").index("kind").get(t);i.onerror=function(e){return r(e)},i.onsuccess=function(){i.result?n(i.result):n(null)}}))}var fe=function(){var e=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,he(t);case 2:if(!(n=e.sent)){e.next=5;break}return e.abrupt("return",n.sourceCode);case 5:return e.next=7,ge(t,{timeout:1e4});case 7:return e.next=9,e.sent.text();case 9:return r=e.sent,e.next=12,ce(t,r);case 12:return e.abrupt("return",r);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),pe=function(e,t){var n=Function(e+"\n;return ".concat(t))();return void 0===n&&(n=window[t]),n},ve=function(){var e=g(regeneratorRuntime.mark((function e(t,n,r){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r||"NetlessApp"+n,ae.emit("loadApp",{kind:n,status:"start"}),e.prev=2,e.next=5,fe(t);case 5:if((o=e.sent)&&0!==o.length){e.next=8;break}throw ae.emit("loadApp",{kind:n,status:"failed",reason:"script is empty."}),new Error("[WindowManager]: script is empty.");case 8:e.next=13;break;case 10:throw e.prev=10,e.t0=e.catch(2),ae.emit("loadApp",{kind:n,status:"failed",reason:e.t0.message}),e.t0;case 13:return e.abrupt("return",me(o,i,n));case 14:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t,n,r){return e.apply(this,arguments)}}(),me=function(e,t,n){try{var r=pe(e,t);return ae.emit("loadApp",{kind:n,status:"success"}),r}catch(r){if(r.message.includes("Can only have one anonymous define call per script file")){var i=window.define;"function"==typeof i&&i.amd&&delete i.amd;var o=pe(e,t);return ae.emit("loadApp",{kind:n,status:"success"}),o}throw ae.emit("loadApp",{kind:n,status:"failed",reason:r.message}),r}};function ge(e,t){return ye.apply(this,arguments)}function ye(){return ye=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.timeout,i=void 0===r?1e4:r,o=new AbortController,a=setTimeout((function(){return o.abort()}),i),e.next=6,fetch(t,O(P({},n),{signal:o.signal,headers:{"content-type":"text/plain"}}));case 6:return s=e.sent,e.abrupt("return",(clearTimeout(a),s));case 8:case"end":return e.stop()}}),e)}))),ye.apply(this,arguments)}var be=function(){function e(){var t=this;y(this,e),this.kindEmitters=new Map,this.registered=new Map,this.appClassesCache=new Map,this.appClasses=new Map,this.syncRegisterApp=null,this.onSyncRegisterAppChange=function(e){t.register({kind:e.kind,src:e.src})}}var t,n;return x(e,[{key:"setSyncRegisterApp",value:function(e){this.syncRegisterApp=e}},{key:"register",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appClassesCache.delete(t.kind),this.registered.set(t.kind,t),"string"==typeof(n=t.src)&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ve(n,t.kind,t.name);case 2:return r=e.sent,e.abrupt("return",r.__esModule?r.default:r);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this.syncRegisterApp&&this.syncRegisterApp({kind:t.kind,src:n,name:t.name})),"function"==typeof n&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n();case 2:if(!(t=e.sent)){e.next=5;break}return e.abrupt("return",((t.__esModule||t.default)&&(t=t.default),t));case 5:throw new Error("[WindowManager]: load remote script failed, ".concat(n));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()),"object"==_(n)&&(r=function(){var e=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()),this.appClasses.set(t.kind,g(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.appClassesCache.get(t.kind),e.abrupt("return",(n||(n=r(),o.appClassesCache.set(t.kind,n)),n));case 2:case"end":return e.stop()}}),e)})))),t.addHooks&&(i=this.createKindEmitter(t.kind))&&t.addHooks(i);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unregister",value:function(e){this.appClasses.delete(e),this.appClassesCache.delete(e),this.registered.delete(e);var t=this.kindEmitters.get(e);t&&(t.clearListeners(),this.kindEmitters.delete(e))}},{key:"notifyApp",value:(t=g(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this.kindEmitters.get(t),e.next=3,null==i?void 0:i.emit(n,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"createKindEmitter",value:function(e){if(!this.kindEmitters.has(e)){var t=new Q.default;this.kindEmitters.set(e,t)}return this.kindEmitters.get(e)}}]),e}(),xe=new be,_e=function(){var e=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null==(n=xe.appClasses.get(t))?void 0:n();case 2:return i=e.sent,e.abrupt("return",i&&(null==(r=i.config)?void 0:r.singleton)?t:"".concat(t,"-").concat(U.v4().replace("-","").slice(0,8)));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),we=function(e,t){if(e.focusScenePath!==t)return e.focusScenePath=t,e},Te=function(e,t){if(e&&e.isWritable&&e.state.sceneState.scenePath!==t){var n="/"===t?"":t;e.setScenePath(n)}},Me=function(e,t,n){e&&e.scenePathType(t)!==B.ScenePathType.None&&e.removeScenes(t,n)};j.debounce((function(e,t){e.emit("mainViewModeChange",t)}),200);var Se=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Ee(e)[t];if(r){var i=r[n];if(i){var o=i.name;return t===ie?"/".concat(o):"".concat(t,"/").concat(o)}}},Ee=function(e){return e.entireScenes()},Ae=function(e,t,n,r){for(var i,o=0;o0&&n.forEach((function(n){var r=e[n];if(r!==t._state[n])if(void 0===r)t._lastValue.set(n,t._state[n]),delete t._state[n],t._setRawState(n,r);else{t._lastValue.set(n,t._state[n]),t._state[n]=r;var i=r;if(j.isObject(r)){var o=t._refMap.get(r);o||(o=function(e){return{k:F.genUID(),v:e,__isRef:!0}}(r),t._refMap.set(r,o)),i=o}t._setRawState(n,i)}}))}else console.error(new Error('Cannot setState on Storage "'.concat(this.id,'" without writable access')),e)}},{key:"emptyStorage",value:function(){if(!(j.size(this._state)<=0)){if(this._destroyed)return void console.error(new Error('Cannot empty destroyed Storage "'.concat(this.id,'".')));if(!this._context.getIsWritable())return void console.error(new Error('Cannot empty Storage "'.concat(this.id,'" without writable access.')));this.setState(j.mapValues(this._state,j.noop))}}},{key:"deleteStorage",value:function(){if(null===this.id)throw new Error("Cannot delete main Storage");this._context.getIsWritable()?(this.destroy(),this._context.updateAttributes([Ze,this.id],void 0)):console.error(new Error('Cannot delete Storage "'.concat(this.id,'" without writable access.')))}},{key:"destroy",value:function(){this._destroyed=!0,this._sideEffect.flushAll()}},{key:"_getRawState",value:function(e){var t;return null===this.id?null!=(t=this._context.getAttributes())?t:e:j.get(this._context.getAttributes(),[Ze,this.id],e)}},{key:"_setRawState",value:function(e,t){if(null===this.id){if(e===Ze)throw new Error('Cannot set attribute internal filed "'.concat(Ze,'"'));return this._context.updateAttributes([e],t)}return this._context.updateAttributes([Ze,this.id,e],t)}},{key:"_updateProperties",value:function(e){var t;if(this._destroyed)console.error(new Error('Cannot call _updateProperties on destroyed Storage "'.concat(this.id,'".')));else if(e.length>0){for(var n={},r=0;rs.pageState.length-1?(console.warn("[WindowManager] nextPage: index out of range"),!1):(s.appProxy.setSceneIndex(t),!0));case 2:case"end":return e.stop()}}),e)}))),this.jumpPage=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",0<=t&&t=s.pageState.length?(console.warn("[WindowManager]: page index ".concat(t," out of range")),!1):s.appProxy.removeSceneByIndex(n));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.emitter=i.appEmitter,this.isAddApp=i.isAddApp}return x(e,[{key:"dispatchAppEvent",value:function(e,t){ue.emit("custom-".concat(this.kind),{kind:this.kind,appId:this.appId,type:e,value:t})}},{key:"storage",get:function(){return this._storage||(this._storage=new qe(this)),this._storage}},{key:"pageState",get:function(){return this.appProxy.pageState}},{key:"kind",get:function(){return this.appProxy.kind}}]),e}(),Ke=function(){function e(t){var n=this;y(this,e),this.params=t,this.sceneNode=null,this.onSceneChange=function(e){n.sceneNode=e,n.params.notifyPageStateChange()};var r=this.params,i=r.displayer,o=r.scenePath;o&&(this.sceneNode=i.createScenesCallback(o,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}return x(e,[{key:"getFullPath",value:function(e){var t,n=null==(t=this.sceneNode)?void 0:t.scenes;if(this.params.scenePath&&n){var r=n[e];if(r)return"".concat(this.params.scenePath,"/").concat(r)}}},{key:"toObject",value:function(){var e,t;return{index:(null==(e=this.params.view)?void 0:e.focusSceneIndex)||0,length:(null==(t=this.sceneNode)?void 0:t.scenes.length)||0}}},{key:"destroy",value:function(){var e;null==(e=this.sceneNode)||e.dispose()}}]),e}(),$e=function(e){return e.Apps="apps",e.Focus="focus",e.State="state",e.BoxState="boxState",e.MainViewCamera="mainViewCamera",e.MainViewSize="mainViewSize",e.Broadcaster="broadcaster",e.Cursors="cursors",e.Position="position",e.CursorState="cursorState",e.FullPath="fullPath",e.Registered="registered",e.IframeBridge="iframeBridge",e}($e||{}),et=new(function(){function e(t){var n=this;y(this,e),this.context=t,this.setAppFocus=function(e,t){t?n.context.safeSetAttributes({focus:e}):n.context.safeSetAttributes({focus:void 0})}}return x(e,[{key:"setContext",value:function(e){this.context=e}},{key:"apps",value:function(){return j.get(this.attributes,["apps"])}},{key:"getAppAttributes",value:function(e){return j.get(this.apps(),[e])}},{key:"getAppState",value:function(e){return j.get(this.apps(),[e,"state"])}},{key:"getMaximized",value:function(){return j.get(this.attributes,["maximized"])}},{key:"getMinimized",value:function(){return j.get(this.attributes,["minimized"])}},{key:"setupAppAttributes",value:function(e,t,n){var r;this.attributes.apps||this.context.safeSetAttributes({apps:{}});var i=["scenePath","title"];n||i.push("scenes");var o=j.pick(e.options,i),a={kind:e.kind,options:o,isDynamicPPT:n};"string"==typeof e.src&&(a.src=e.src),a.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",t],a),this.context.safeUpdateAttributes(["apps",t,"state"],(w(r={},$.Size,{}),w(r,$.Position,{}),w(r,$.SceneIndex,0),r))}},{key:"updateAppState",value:function(e,t,n){j.get(this.attributes,["apps",e,"state"])&&this.context.safeUpdateAttributes(["apps",e,"state",t],n)}},{key:"cleanAppAttributes",value:function(e){this.context.safeUpdateAttributes(["apps",e],void 0),this.context.safeSetAttributes(w({},e,void 0)),this.attributes.focus===e&&this.cleanFocus()}},{key:"cleanFocus",value:function(){this.context.safeSetAttributes({focus:void 0})}},{key:"getAppSceneIndex",value:function(e){var t;return null==(t=this.getAppState(e))?void 0:t[$.SceneIndex]}},{key:"getAppScenePath",value:function(e){var t,n;return null==(n=null==(t=this.getAppAttributes(e))?void 0:t.options)?void 0:n.scenePath}},{key:"getMainViewScenePath",value:function(){return this.attributes._mainScenePath}},{key:"getMainViewSceneIndex",value:function(){return this.attributes._mainSceneIndex}},{key:"getBoxState",value:function(){return this.attributes.boxState}},{key:"setMainViewScenePath",value:function(e){this.context.safeSetAttributes({_mainScenePath:e})}},{key:"setMainViewSceneIndex",value:function(e){this.context.safeSetAttributes({_mainSceneIndex:e})}},{key:"getMainViewCamera",value:function(){return j.get(this.attributes,["mainViewCamera"])}},{key:"getMainViewSize",value:function(){return j.get(this.attributes,["mainViewSize"])}},{key:"setMainViewCamera",value:function(e){this.context.safeSetAttributes({mainViewCamera:P({},e)})}},{key:"setMainViewSize",value:function(e){this.context.safeSetAttributes({mainViewSize:P({},e)})}},{key:"setMainViewCameraAndSize",value:function(e,t){this.context.safeSetAttributes({mainViewCamera:P({},e),mainViewSize:P({},t)})}},{key:"updateCursor",value:function(e,t){j.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),j.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],t)}},{key:"updateCursorState",value:function(e,t){j.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],t)}},{key:"getCursorState",value:function(e){return j.get(this.attributes,["cursors",e,"cursorState"])}},{key:"cleanCursor",value:function(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}},{key:"setMainViewFocusPath",value:function(e){var t=this.getMainViewScenePath();t&&we(e,t)}},{key:"getIframeBridge",value:function(){return j.get(this.attributes,["iframeBridge"])}},{key:"setIframeBridge",value:function(e){if(j.isObject(e)){var t=this.getIframeBridge();for(var n in e){var r=e[n];t[n]!==r&&this.context.safeUpdateAttributes(["iframeBridge",n],r)}}}},{key:"attributes",get:function(){return this.context.getAttributes()}},{key:"focus",get:function(){return j.get(this.attributes,["focus"])}}]),e}())({getAttributes:function(){throw new Error("getAttributes not implemented")},safeSetAttributes:function(){throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:function(){throw new Error("safeUpdateAttributes not implemented")}}),tt=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r0&&o.zIndex!==(null==(n=a.box)?void 0:n.zIndex)&&(null==(r=a.boxManager)||r.setZIndex(e,o.zIndex),null==(i=a.boxManager)||i.focusBox({appId:e}))}))})),null==(r=a.manager.refresher)||r.add("".concat(e,"-fullPath"),(function(){return B.autorun((function(){var e,t=null==(e=a.appAttributes)?void 0:e.fullPath;a.setFocusScenePathHandler(t),a._prevFullPath!==t&&(a.notifyPageStateChange(),a._prevFullPath=t)}))}))},this.setFocusScenePathHandler=j.debounce((function(e){var t;a.view&&e&&e!==(null==(t=a.view)?void 0:t.focusScenePath)&&we(a.view,e)}),50),this.notifyPageStateChange=j.debounce((function(){a.appEmitter.emit("pageStateChange",a.pageState)}),50),this.kind=t.kind,this.id=r,this.stateKey="".concat(this.id,"_state"),this.appProxies.set(this.id,this),this.appEmitter=new Q.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=i,this.initScenes(),null!=(o=this.params.options)&&o.scenePath&&this.createView(),this._pageState=new Ke({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}var t,n,r,i,o,a,s,u;return x(e,[{key:"initScenes",value:function(){var e,t=this.params.options;t&&(this.scenePath=t.scenePath,(null==(e=this.appAttributes)?void 0:e.isDynamicPPT)&&this.scenePath?this.scenes=Ee(this.manager.displayer)[this.scenePath]:this.scenes=t.scenes)}},{key:"getFullScenePath",value:function(){if(this.scenePath)return j.get(this.appAttributes,[$e.FullPath])||this.getFullScenePathFromScenes()}},{key:"getFullScenePathFromScenes",value:function(){var e=j.get(this.appAttributes,["state","SceneIndex"],0),t=function(e,t,n){var r;if(e&&t){var i=null==(r=Ee(e)[t])?void 0:r[n];if(i)return"".concat(t,"/").concat(i.name)}}(this.manager.room,this.scenePath,e);return t&&this.setFullPath(t),t}},{key:"setFullPath",value:function(e){this.manager.safeUpdateAttributes(["apps",this.id,$e.FullPath],e)}},{key:"baseInsertApp",value:(u=g(regeneratorRuntime.mark((function e(){var t,n,r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]&&a[0],(r=this.params).kind){e.next=4;break}throw new Error("[WindowManager]: kind require");case 4:return e.next=6,null==(n=xe.appClasses.get(r.kind))?void 0:n();case 6:if(i=e.sent,o=xe.registered.get(r.kind),!i){e.next=13;break}return e.next=11,this.setupApp(this.id,t,i,r.options,null==o?void 0:o.appOptions);case 11:e.next=14;break;case 13:throw new Error("[WindowManager]: app load failed ".concat(r.kind," ").concat(r.src));case 14:return e.abrupt("return",(ue.emit("updateManagerRect"),{appId:this.id,app:i}));case 15:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"setupApp",value:(s=g(regeneratorRuntime.mark((function e(t,n,r,i,o){var a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tt("setupApp",t,r,i),this.boxManager){e.next=2;break}throw new ze;case 2:s=new Je(this.manager,this.boxManager,t,this,o),this.appContext=s,e.prev=4,ue.once("".concat(t).concat(q.WindowCreated)).then(g(regeneratorRuntime.mark((function e(){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n||(o=u.getAppInitState(t),null==(i=u.boxManager)||i.updateBoxState(o)),u.appEmitter.onAny(u.appListener),u.appAttributesUpdateListener(t),u.setViewFocusScenePath(),setTimeout(g(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("setup app",r),e.next=3,r.setup(s);case 3:n=e.sent,u.appResult=n,xe.notifyApp(u.kind,"created",{appId:t,result:n}),u.afterSetupApp(o),u.fixMobileSize();case 5:case"end":return e.stop()}}),e)}))),50);case 1:case"end":return e.stop()}}),e)})))),null==(a=this.boxManager)||a.createBox({appId:t,app:r,options:i,canOperate:this.manager.canOperate,smartPosition:this.isAddApp}),this.isAddApp&&this.box&&(this.store.updateAppState(t,$.ZIndex,this.box.zIndex),this.store.updateAppState(t,$.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:t},!1)),e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(4),console.error(e.t0),new Error("[WindowManager]: app setup error: ".concat(e.t0.message));case 11:case"end":return e.stop()}}),e,this,[[4,8]])}))),function(e,t,n,r,i){return s.apply(this,arguments)})},{key:"fixMobileSize",value:function(){var e,t,n=null==(e=this.boxManager)?void 0:e.getBox(this.id);n&&(null==(t=this.boxManager)||t.resizeBox({appId:this.id,width:n.intrinsicWidth+.001,height:n.intrinsicHeight+.001,skipUpdate:!0}))}},{key:"afterSetupApp",value:function(e){var t;e&&(null==e||!e.x||!e.y)&&(null==(t=this.boxManager)||t.setBoxInitState(this.id))}},{key:"onSeek",value:(a=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appEmitter.emit("seek",t).catch((function(e){console.log("[WindowManager]: emit seek error: ".concat(e.message))})),r=this.getAppInitState(this.id),null==(n=this.boxManager)||n.updateBoxState(r);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"onReconnected",value:(o=g(regeneratorRuntime.mark((function t(){var n,r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Boolean(this.manager.attributes.apps[this.id])){t.next=4;break}return t.next=3,this.destroy(!0,!1,!0);case 3:return t.abrupt("return");case 4:return this.appEmitter.emit("reconnected",void 0),r=this.getAppInitState(this.id),t.next=8,this.destroy(!0,!1,!0);case 8:return i=this.params,t.next=11,new e(i,this.manager,this.id,this.isAddApp).baseInsertApp(!0);case 11:null==(n=this.boxManager)||n.updateBoxState(r);case 12:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"onRemoveScene",value:(i=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.scenePath&&t.startsWith(this.scenePath+"/")&&(n=this.pageState.index,(r=this._pageState.getFullPath(n))||(n=0,r=this._pageState.getFullPath(n)),r&&this.setFullPath(r),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=n));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"emitAppSceneStateChange",value:function(e){this.appEmitter.emit("sceneStateChange",e)}},{key:"emitAppIsWritableChange",value:function(){this.appEmitter.emit("writableChange",this.isWritable)}},{key:"makeAppEventListener",value:function(e){var t=this;return function(n,r){var i,o,a,s;if(t.manager.canOperate)switch(n){case"setBoxSize":null==(i=t.boxManager)||i.resizeBox({appId:e,width:r.width,height:r.height,skipUpdate:!1});break;case"setBoxMinSize":null==(o=t.boxManager)||o.setBoxMinSize({appId:e,minWidth:r.minwidth,minHeight:r.minheight});break;case"setBoxTitle":null==(a=t.boxManager)||a.setBoxTitle({appId:e,title:r.title});break;case ee.destroy:if("destroyed"===t.status)return;t.destroy(!0,!1,!0,null==r?void 0:r.error),null!=r&&r.error&&console.error(null==r?void 0:r.error);break;case"focus":null==(s=t.boxManager)||s.focusBox({appId:t.id}),rt.emit("focus",{appId:t.id})}}}},{key:"setScenePath",value:function(){if(this.manager.canOperate){var e=this.getFullScenePath();this.manager.room&&e&&this.view&&Te(this.manager.room,e)}}},{key:"setViewFocusScenePath",value:function(){var e=this.getFullScenePath();return e&&this.view&&we(this.view,e),e}},{key:"createView",value:(r=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.viewManager.createView(this.id);case 2:return t=e.sent,e.abrupt("return",(this.setViewFocusScenePath(),t));case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"removeSceneByIndex",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this._pageState.getFullPath(t))){e.next=6;break}return r=nt(t,this.pageState),e.abrupt("return",(this.setSceneIndexWithoutSync(r),this.manager.dispatchInternalEvent(q.SetAppFocusIndex,{type:"app",appID:this.id,index:r}),setTimeout((function(){Me(i.manager.room,n,t)}),100),!0));case 6:return e.abrupt("return",!1);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setSceneIndexWithoutSync",value:function(e){this.view&&(this.view.focusSceneIndex=e)}},{key:"setSceneIndex",value:function(e){if(this.view){this.view.focusSceneIndex=e;var t=this._pageState.getFullPath(e);t&&this.setFullPath(t)}}},{key:"destroy",value:(t=g(regeneratorRuntime.mark((function e(t,n,r,i){var o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("destroyed"===this.status){e.next=13;break}return this.status="destroyed",e.prev=2,e.next=5,xe.notifyApp(this.kind,"destroy",{appId:this.id});case 5:return e.next=7,this.appEmitter.emit("destroy",{error:i});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("[WindowManager]: notifyApp error",e.t0.message,e.t0.stack);case 12:this.appEmitter.clearListeners(),ue.emit("destroy-".concat(this.id),{error:i}),t&&(null==(o=this.boxManager)||o.closeBox(this.id,r)),n&&(this.store.cleanAppAttributes(this.id),this.scenePath&&Me(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this._pageState.destroy(),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),null==(a=this.manager.refresher)||a.remove(this.id),null==(s=this.manager.refresher)||s.remove(this.stateKey),null==(u=this.manager.refresher)||u.remove("".concat(this.id,"-fullPath")),this._prevFullPath=void 0;case 13:case"end":return e.stop()}}),e,this,[[2,9]])}))),function(e,n,r,i){return t.apply(this,arguments)})},{key:"close",value:function(){return this.destroy(!0,!0,!1)}},{key:"view",get:function(){return this.manager.viewManager.getView(this.id)}},{key:"viewIndex",get:function(){var e;return null==(e=this.view)?void 0:e.focusSceneIndex}},{key:"isWritable",get:function(){var e;return this.manager.canOperate&&!(null!=(e=this.box)&&e.readonly)}},{key:"attributes",get:function(){return this.manager.attributes[this.id]}},{key:"appAttributes",get:function(){return this.store.getAppAttributes(this.id)}},{key:"box",get:function(){var e;return null==(e=this.boxManager)?void 0:e.getBox(this.id)}},{key:"pageState",get:function(){return this._pageState.toObject()}}]),e}(),ot=function(){function e(t){y(this,e),this.displayer=t,this.views=new Map}return x(e,[{key:"createView",value:function(e){var t=at(this.displayer);return this.views.set(e,t),t}},{key:"getView",value:function(e){return this.views.get(e)}},{key:"destroyView",value:function(e){var t=this.views.get(e);if(t){try{t.release()}catch(e){}this.views.delete(e)}}},{key:"setViewScenePath",value:function(e,t){var n=this.views.get(e);n&&(n.focusScenePath=t)}},{key:"destroy",value:function(){this.views.forEach((function(e){try{e.release()}catch(e){}})),this.views.clear()}}]),e}(),at=function(e){var t=e.views.createView();return st(t),t},st=function(e){e.setCameraBound({maxContentMode:function(){return 10},minContentMode:function(){return.1}})},ut=function(){function e(t){var n=this;y(this,e),this.manager=t,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new F.SideEffectManager,this.startListenWritableChange=function(){n.sideEffectManager.add((function(){return ue.on("writableChange",(function(e){e&&n.ensureCameraAndSize(),n.manager.room&&n.syncMainView(n.manager.room)}))}))},this.addCameraReaction=function(){var e;null==(e=n.manager.refresher)||e.add($e.MainViewCamera,n.cameraReaction)},this.cameraReaction=function(){return B.reaction((function(){return n.mainViewCamera}),(function(e){e&&e.id!==n.manager.uid&&(n.moveCameraToContian(n.mainViewSize),n.moveCamera(e))}),{fireImmediately:!0})},this.sizeChangeHandler=j.debounce((function(e){e&&(n.moveCameraToContian(e),n.moveCamera(n.mainViewCamera))}),30),this.onUpdateContainerSizeRatio=function(){var e=n.store.getMainViewSize();n.sizeChangeHandler(e)},this.onCameraUpdatedByDevice=function(e){n.viewMode!==B.ViewMode.Follower&&(n.store.setMainViewCamera(O(P({},e),{id:n.manager.uid})),j.isEqual(n.mainViewSize,O(P({},n.mainView.size),{id:n.manager.uid}))||n.setMainViewSize(n.view.size))},this.mainViewClickListener=function(){n.mainViewClickHandler()},this.setMainViewSize=j.debounce((function(e){n.store.setMainViewSize(O(P({},e),{id:n.manager.uid}))}),50),this._syncMainViewTimer=0,this.onCameraOrSizeUpdated=function(){ae.emit("cameraStateChange",n.cameraState),n.manager.room&&n.manager.room.syncMainView&&(clearTimeout(n._syncMainViewTimer),n._syncMainViewTimer=setTimeout(n.syncMainView,100,n.manager.room))},this.syncMainView=function(e){e.isWritable&&e.syncMainView(n.mainView)},this.setViewMode=function(e){n.viewMode=e},this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),ue.once("mainViewMounted").then((function(){n.addMainViewListener(),n.start(),n.ensureCameraAndSize(),n.startListenWritableChange()}));var r=function(){n.sizeChangeHandler(n.mainViewSize)};this.sideEffectManager.add((function(){return ue.on("playgroundSizeChange",r)})),this.sideEffectManager.add((function(){return ue.on("containerSizeRatioUpdate",n.onUpdateContainerSizeRatio)})),this.sideEffectManager.add((function(){return ue.on("startReconnect",(function(){n.didRelease||n.mainView.release()}))}))}var t;return x(e,[{key:"ensureCameraAndSize",value:function(){this.viewMode===B.ViewMode.Broadcaster&&(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(q.InitMainViewCamera),this.setCameraAndSize())}},{key:"moveCameraSizeByAttributes",value:function(){this.moveCameraToContian(this.mainViewSize),this.moveCamera(this.mainViewCamera)}},{key:"start",value:function(){this.sizeChangeHandler(this.mainViewSize),!this.started&&(this.addCameraListener(),this.addCameraReaction(),this.manager.room&&this.syncMainView(this.manager.room),this.started=!0)}},{key:"setCameraAndSize",value:function(){var e=O(P({},this.mainView.camera),{id:this.manager.uid}),t=O(P({},this.mainView.size),{id:this.manager.uid});this.store.setMainViewCameraAndSize(e,t)}},{key:"createMainView",value:function(){var e=at(this.manager.displayer),t=this.store.getMainViewScenePath();return t&&we(e,t),e}},{key:"onReconnect",value:function(){if(this.didRelease)this.rebind();else{var e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}},{key:"setFocusScenePath",value:function(e){if(e)return we(this.view,e)}},{key:"rebind",value:function(){var e=this.mainView.divElement,t=this.mainView.disableCameraTransform;this.stop(),this.didRelease||this.mainView.release(),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=t,this.mainView.divElement=e,this.addMainViewListener(),this.start()}},{key:"addMainViewListener",value:function(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}},{key:"removeMainViewListener",value:function(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}},{key:"mainViewClickHandler",value:(t=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:!this.manager.canOperate||(this.store.cleanFocus(),null==(t=this.manager.boxManager)||t.blurAllBox());case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"addCameraListener",value:function(){this.view.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.on("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}},{key:"removeCameraListener",value:function(){this.view.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}},{key:"moveCameraToContian",value:function(e){j.isEmpty(e)||(this.view.moveCameraToContain({width:e.width,height:e.height,originX:-e.width/2,originY:-e.height/2,animationMode:B.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}},{key:"moveCamera",value:function(e){if(!j.isEmpty(e)){if(j.isEqual(e,this.view.camera))return;var t=e.centerX,n=e.centerY,r=e.scale*(this.scale||1);this.view.moveCamera({centerX:t,centerY:n,scale:r,animationMode:B.AnimationMode.Immediately})}}},{key:"stop",value:function(){var e,t;this.removeCameraListener(),null==(e=this.manager.refresher)||e.remove($e.MainViewCamera),null==(t=this.manager.refresher)||t.remove($e.MainViewSize),this.started=!1}},{key:"destroy",value:function(){this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}},{key:"mainViewCamera",get:function(){return this.store.getMainViewCamera()}},{key:"mainViewSize",get:function(){return this.store.getMainViewSize()}},{key:"didRelease",get:function(){return j.get(this.view,["didRelease"])}},{key:"view",get:function(){return this.mainView}},{key:"cameraState",get:function(){return P(P({},this.view.camera),this.view.size)}}]),e}(),lt=function(){function e(t){var n=this;y(this,e),this.context=t,this.addRedoUndoListeners=function(e){if(void 0===e)n.addViewCallbacks(n.context.mainView(),n.onCanRedoStepsUpdate,n.onCanUndoStepsUpdate);else{var t=n.context.getAppProxy(e);t&&t.view&&n.addViewCallbacks(t.view,n.onCanRedoStepsUpdate,n.onCanUndoStepsUpdate)}},this.addViewCallbacks=function(e,t,n){t(e.canRedoSteps),n(e.canUndoSteps),e.callbacks.on("onCanRedoStepsUpdate",t),e.callbacks.on("onCanUndoStepsUpdate",n)},this.disposeViewCallbacks=function(e){e.callbacks.off("onCanRedoStepsUpdate",n.onCanRedoStepsUpdate),e.callbacks.off("onCanUndoStepsUpdate",n.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=function(e){ae.emit("canRedoStepsChange",e)},this.onCanUndoStepsUpdate=function(e){ae.emit("canUndoStepsChange",e)},this.disposePrevFocusViewRedoUndoListeners=function(e){var t;if(void 0===e)t=n.context.mainView();else{var r=n.context.getAppProxy(e);r&&r.view&&(t=r.view)}t&&n.disposeViewCallbacks(t)},ue.on("focusedChange",(function(e){n.disposePrevFocusViewRedoUndoListeners(e.prev),setTimeout((function(){n.addRedoUndoListeners(e.focused)}),0)})),ue.on("rootDirRemoved",(function(){n.disposePrevFocusViewRedoUndoListeners(t.focus()),n.addRedoUndoListeners(t.focus())})),this.addRedoUndoListeners(t.focus())}return x(e,[{key:"destroy",value:function(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}]),e}(),ct=function(){function e(t){var n=this;y(this,e),this.windowManger=t,this.appProxies=new Map,this.appStatus=new Map,this.store=et,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new se,this.sideEffectManager=new F.SideEffectManager,this.sceneState=null,this.rootDirRemoving=!1,this.onRemoveScenes=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=t.scenePath)!==ie){e.next=6;break}return e.next=4,n.onRootDirRemoved();case 4:return n.dispatchInternalEvent(q.RootDirRemoved),e.abrupt("return");case 6:if(!De(o)){e.next=14;break}return a=n.mainView.focusSceneIndex||0,(s=null==(r=n.callbacksNode)?void 0:r.scenes[a])||(a=0,s=null==(i=n.callbacksNode)?void 0:i.scenes[a]),s&&n.setMainViewScenePath("".concat(ie).concat(s)),e.next=12,n.setMainViewSceneIndex(a);case 12:e.next=15;break;case 14:n.appProxies.forEach((function(e){e.onRemoveScene(o)}));case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.onReadonlyChanged=function(){n.appProxies.forEach((function(e){e.emitAppIsWritableChange()}))},this.onPlayerSeekStart=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.closeAll();case 2:case"end":return e.stop()}}),e)}))),this.onPlayerSeekDone=function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.attributesUpdateCallback(n.attributes.apps);case 2:n.appProxies.forEach((function(e){e.onSeek(t)}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.createRootDirScenesCallback=function(){var e,t=!1;n.callbacksNode&&(n.callbacksNode.dispose(),t=!0),n.callbacksNode=n.displayer.createScenesCallback(ie,{onAddScene:n.onSceneChange,onRemoveScene:(e=g(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.onSceneChange(t);case 2:ue.emit("rootDirSceneRemoved",r);case 3:case"end":return e.stop()}}),e)}))),function(t,n){return e.apply(this,arguments)})}),n.callbacksNode&&(n.updateSceneState(n.callbacksNode),n.mainViewScenesLength=n.callbacksNode.scenes.length,t&&n.emitMainViewScenesChange(n.callbacksNode.scenes.length))},this.removeSceneByIndex=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=nt(t,n.windowManger.pageState),n.setSceneIndexWithoutSync(i),n.dispatchInternalEvent(q.SetAppFocusIndex,{type:"main",index:i}),o=null==(r=n.callbacksNode)?void 0:r.scenes[t],e.abrupt("return",(setTimeout((function(){o&&Me(n.room,"".concat(ie).concat(o),t)}),100),new Promise((function(e,t){ue.once("rootDirSceneRemoved").then((function(t){t===o&&e(!0)})).catch((function(e){console.log("[WindowManager]: removePage error: ".concat(e)),t(!1)}))}))));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.setSceneIndexWithoutSync=function(e){var t,r=null==(t=n.callbacksNode)?void 0:t.scenes[e];r&&n.mainViewProxy.setFocusScenePath("".concat(ie).concat(r))},this.onSceneChange=function(e){return n.mainViewScenesLength=e.scenes.length,n.updateSceneState(e),n.emitMainViewScenesChange(n.mainViewScenesLength)},this.emitMainViewScenesChange=function(e){return Promise.all([ae.emit("mainViewScenesLengthChange",e),ue.emit("changePageState")])},this.updateSceneState=function(e){var t=n.store.getMainViewSceneIndex()||0,r=e.scenes[t];r||(r=e.scenes[n.mainView.focusSceneIndex||0]),n.sceneState={scenePath:"".concat(ie).concat(r),contextPath:e.path,index:t,scenes:e.scenes.map((function(e){return{name:e}})),sceneName:r},ae.emit("sceneStateChange",n.sceneState)},this.onBoxMove=function(e){n.dispatchInternalEvent(q.AppMove,e),n.store.updateAppState(e.appId,$.Position,{x:e.x,y:e.y})},this.onBoxResize=function(e){e.width&&e.height&&(n.dispatchInternalEvent(q.AppResize,e),n.store.updateAppState(e.appId,$.Size,{width:e.width,height:e.height}))},this.onBoxFocus=function(e){n.windowManger.safeSetAttributes({focus:e.appId})},this.onBoxClose=function(e){var t=n.appProxies.get(e.appId);t&&t.destroy(!1,!0,!0,e.error)},this.onBoxStateChange=function(e){n.dispatchInternalEvent(q.AppBoxStateChange,e)},this.addAppsChangeListener=function(){var e;null==(e=n.refresher)||e.add("apps",(function(){return Ve((function(){return n.attributes.apps}),(function(){n.attributesUpdateCallback(n.attributes.apps)}))}))},this.addAppCloseListener=function(){var e;null==(e=n.refresher)||e.add("appsClose",(function(){return We(n.attributes.apps,(function(){n.onAppDelete(n.attributes.apps)}))}))},this.onMainViewIndexChange=function(e){void 0!==e&&n._prevSceneIndex!==e&&(ae.emit("mainViewSceneIndexChange",e),ue.emit("changePageState"),n.callbacksNode&&n.updateSceneState(n.callbacksNode),n._prevSceneIndex=e)},this.onFocusChange=function(e){var t;n._prevFocused!==e&&(ae.emit("focusedChange",e),ue.emit("focusedChange",{focused:e,prev:n._prevFocused}),n._prevFocused=e,void 0!==e&&(null==(t=n.boxManager)||t.focusBox({appId:e}),setTimeout((function(){var t=n.appProxies.get(e);t&&xe.notifyApp(t.kind,"focus",{appId:e})}),0)))},this.attributesUpdateCallback=j.debounce((function(e){return n._attributesUpdateCallback(e)}),100),this._appIds=[],this.onRegisteredChange=function(e){!e||Object.entries(e).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];xe.appClasses.has(n)||xe.register({kind:n,src:r.src,name:r.name})}))},this.onMinimized=function(e){var t,r;(null==(t=n.boxManager)?void 0:t.minimized)!==e&&(!0===e&&(null==(r=n.boxManager)||r.blurAllBox()),setTimeout((function(){var t;null==(t=n.boxManager)||t.setMinimized(Boolean(e))}),0))},this.onAppDelete=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i,a,s,u,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Object.keys(t),i=T(n.appProxies.entries()),e.prev=2,i.s();case 4:if((a=i.n()).done){e.next=12;break}if(s=o(a.value,2),u=s[0],l=s[1],e.t0=r.includes(u),e.t0){e.next=10;break}return e.next=10,l.destroy(!0,!1,!0);case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t1=e.catch(2),i.e(e.t1);case 17:return e.prev=17,i.f(),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[2,14,17,20]])})));return function(t){return e.apply(this,arguments)}}(),this.closeAll=g(regeneratorRuntime.mark((function e(){var t,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=T(n.appProxies.entries()),e.prev=1,t.s();case 3:if((r=t.n()).done){e.next=9;break}return i=o(r.value,2),i[0],a=i[1],e.next=7,a.destroy(!0,!1,!0);case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),t.e(e.t0);case 14:return e.prev=14,t.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])}))),this.displayerStateListener=function(e){var t=e.sceneState;if(t){var r=t.scenePath;n.appProxies.forEach((function(e){e.scenePath&&r.startsWith(e.scenePath)&&(e.emitAppSceneStateChange(t),e.setFullPath(r))}))}n.appProxies.forEach((function(t){t.appEmitter.emit("roomStateChange",e)})),ue.emit("observerIdChange",n.displayer.observerId)},this.displayerWritableListener=function(e){var t,r,i=!e,o=void 0===n.windowManger.readonly||!1===n.windowManger.readonly;void 0===n.windowManger.readonly?null==(t=n.boxManager)||t.setReadonly(e):null==(r=n.boxManager)||r.setReadonly(!(i&&o)),n.appProxies.forEach((function(e){e.emitAppIsWritableChange()})),ue.emit("writableChange",i)},this.updateSceneIndex=function(){var e=n.store.getMainViewScenePath(),t=Ie(e),r=Ee(n.displayer)[t];if(r.length){var i=e.replace(t,"").replace("/",""),o=r.findIndex((function(e){return e.name===i}));j.isInteger(o)&&o>=0&&n.safeSetAttributes({_mainSceneIndex:o})}},this.updateRootDirRemoving=function(e){n.rootDirRemoving=e},this.displayer=t.displayer,this.store.setContext({getAttributes:function(){return n.attributes},safeSetAttributes:function(e){return n.safeSetAttributes(e)},safeUpdateAttributes:function(e,t){return n.safeUpdateAttributes(e,t)}}),this.mainViewProxy=new ut(this),this.viewManager=new ot(this.displayer),this.appListeners=new Pe(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=Eb,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:ue}),this.sideEffectManager.add((function(){return function(){var e,t,r;n.appCreateQueue.destroy(),n.mainViewProxy.destroy(),null==(e=n.refresher)||e.destroy(),n.viewManager.destroy(),null==(t=n.boxManager)||t.destroy(),null==(r=n.callbacksNode)||r.dispose()}})),ue.once("onCreated").then((function(){return n.onCreated()})),ue.on("onReconnected",(function(){return n.onReconnected()})),B.isPlayer(this.displayer)&&(ue.on("seekStart",this.onPlayerSeekStart),ue.on("seek",this.onPlayerSeekDone)),ue.on("removeScenes",this.onRemoveScenes),ue.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),xe.setSyncRegisterApp((function(e){n.safeUpdateAttributes([$e.Registered,e.kind],e)}))}var t,n,r,i,a,s,u,l,c,h,d;return x(e,[{key:"onRootDirRemoved",value:(d=g(regeneratorRuntime.mark((function e(){var t,n,r,i,a,s,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!(u.length>0&&void 0!==u[0])||u[0],this.setMainViewScenePath(oe),this.createRootDirScenesCallback(),n=T(this.appProxies.entries()),e.prev=3,n.s();case 5:if((r=n.n()).done){e.next=13;break}if(i=o(r.value,2),a=i[0],s=i[1],e.t0=s.view,!e.t0){e.next=11;break}return e.next=11,this.closeApp(a,t);case 11:e.next=5;break;case 13:e.next=18;break;case 15:e.prev=15,e.t1=e.catch(3),n.e(e.t1);case 18:return e.prev=18,n.f(),e.finish(18);case 21:this.mainViewProxy.rebind(),ue.emit("rootDirRemoved"),this.updateRootDirRemoving(!1);case 22:case"end":return e.stop()}}),e,this,[[3,15,18,21]])}))),function(){return d.apply(this,arguments)})},{key:"getMainViewSceneDir",value:function(){var e=this.store.getMainViewScenePath();if(e)return Ie(e);throw new Error("[WindowManager]: mainViewSceneDir not found")}},{key:"onCreated",value:(h=g(regeneratorRuntime.mark((function e(){var t,n,r,i,o,a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.attributesUpdateCallback(this.attributes.apps);case 2:if(ue.emit("updateManagerRect"),rt.on("move",this.onBoxMove),rt.on("resize",this.onBoxResize),rt.on("focus",this.onBoxFocus),rt.on("close",this.onBoxClose),rt.on("boxStateChange",this.onBoxStateChange),this.addAppsChangeListener(),this.addAppCloseListener(),null==(t=this.refresher)||t.add("maximized",(function(){return B.autorun((function(){var e,t=u.attributes.maximized;null==(e=u.boxManager)||e.setMaximized(Boolean(t))}))})),null==(n=this.refresher)||n.add("minimized",(function(){return B.autorun((function(){var e=u.attributes.minimized;u.onMinimized(e)}))})),null==(r=this.refresher)||r.add("mainViewIndex",(function(){return B.autorun((function(){var e=j.get(u.attributes,"_mainSceneIndex");u.onMainViewIndexChange(e)}))})),null==(i=this.refresher)||i.add("focusedChange",(function(){return B.autorun((function(){var e=j.get(u.attributes,"focus");u.onFocusChange(e)}))})),null==(o=this.refresher)||o.add("registeredChange",(function(){return B.autorun((function(){var e=j.get(u.attributes,$e.Registered);u.onRegisteredChange(e)}))})),this.attributes.apps&&0!==Object.keys(this.attributes.apps).length){e.next=20;break}if(s=this.store.getMainViewScenePath()){e.next=19;break}return e.abrupt("return");case 19:this.resetScenePath(s);case 20:this.displayerWritableListener(!(null!=(a=this.room)&&a.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this._prevFocused=this.attributes.focus,this.sideEffectManager.add((function(){var e=new lt({mainView:function(){return u.mainViewProxy.view},focus:function(){return u.attributes.focus},getAppProxy:function(e){return u.appProxies.get(e)}});return function(){return e.destroy()}}));case 21:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"notifyAppsChange",value:function(e){(this._appIds.length!==e.length||!this._appIds.every((function(t){return e.includes(t)})))&&(this._appIds=e,ae.emit("appsChange",e))}},{key:"_attributesUpdateCallback",value:(c=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&Ib.container){0===(n=Object.keys(t)).length&&this.appCreateQueue.emitReady(),r=j.orderBy(n.map((function(e){return{id:e,createdAt:t[e].createdAt}})),"createdAt","asc").map((function(e){return e.id})),this.notifyAppsChange(r),i=T(r);try{for(a=function(){var e=o.value;if(!s.appProxies.has(e)&&!s.appStatus.has(e)){var n=t[e];try{if(!s.attributes[e])throw new Error("appAttributes is undefined");s.appCreateQueue.push((function(){return s.appStatus.set(e,te.StartCreate),s.baseInsertApp({kind:n.kind,options:n.options,isDynamicPPT:n.isDynamicPPT},e,!1)})),s.focusByAttributes(t)}catch(e){console.warn("[WindowManager]: Insert App Error",e)}}},i.s();!(o=i.n()).done;)a()}catch(e){i.e(e)}finally{i.f()}}case 1:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"refresh",value:function(){this.attributesUpdateCallback(this.attributes.apps)}},{key:"setBoxManager",value:function(e){this.boxManager=e}},{key:"resetMaximized",value:function(){var e;null==(e=this.boxManager)||e.setMaximized(Boolean(this.store.getMaximized()))}},{key:"resetMinimized",value:function(){var e;null==(e=this.boxManager)||e.setMinimized(Boolean(this.store.getMinimized()))}},{key:"bindMainView",value:function(e,t){var n=this.mainViewProxy.view;n.disableCameraTransform=t,n.divElement=e,n.focusScenePath||this.setMainViewFocusPath(),ue.emit("mainViewMounted")}},{key:"setMainViewFocusPath",value:function(e){var t,n=e||this.store.getMainViewScenePath();if(n)return we(this.mainView,n),(null==(t=this.mainView)?void 0:t.focusScenePath)===n}},{key:"resetScenePath",value:function(e){this.displayer.state.sceneState.scenePath!==e&&Te(this.room,e)}},{key:"addApp",value:(l=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tt("addApp",t),e.next=3,this.beforeAddApp(t,n);case 3:return r=e.sent,i=r.appId,o=r.needFocus,e.next=8,this.baseInsertApp(t,i,!0,o);case 8:return a=e.sent,e.abrupt("return",(this.afterAddApp(a),null==a?void 0:a.id));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"beforeAddApp",value:(u=g(regeneratorRuntime.mark((function e(t,n){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_e(t.kind);case 2:return o=e.sent,this.appStatus.set(o,te.StartCreate),a=null!=(r=t.attributes)?r:{},this.safeUpdateAttributes([o],a),this.store.setupAppAttributes(t,o,n),s=!(null!=(i=this.boxManager)&&i.minimized),e.abrupt("return",(s&&this.store.setAppFocus(o,!0),{appId:o,needFocus:s}));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"afterAddApp",value:function(e){var t,n;if(e&&e.box){var r=e.box;rt.emit("move",{appId:e.id,x:null==r?void 0:r.intrinsicX,y:null==r?void 0:r.intrinsicY}),this.store.updateAppState(e.id,$.ZIndex,r.zIndex)}null!=(t=this.boxManager)&&t.minimized&&(null==(n=this.boxManager)||n.setMinimized(!1,!1))}},{key:"closeApp",value:(s=g(regeneratorRuntime.mark((function e(t){var n,r,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=!(i.length>1&&void 0!==i[1])||i[1],(r=this.appProxies.get(t))&&r.destroy(!0,n,!1);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"baseInsertApp",value:(a=g(regeneratorRuntime.mark((function e(t,n,r,i){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appProxies.has(n)){e.next=3;break}return console.warn("[WindowManager]: app duplicate exists and cannot be created again"),e.abrupt("return");case 3:if(!(o=new it(t,this,n,r))){e.next=9;break}return e.next=7,o.baseInsertApp(i);case 7:return this.appStatus.delete(n),e.abrupt("return",o);case 9:throw this.appStatus.delete(n),new Error("[WindowManger]: initialize AppProxy failed");case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return a.apply(this,arguments)})},{key:"safeSetAttributes",value:function(e){this.windowManger.safeSetAttributes(e)}},{key:"safeUpdateAttributes",value:function(e,t){this.windowManger.safeUpdateAttributes(e,t)}},{key:"setMainViewScenePath",value:(i=g(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.room){e.next=17;break}if(n=this.displayer.scenePathType(t),Ie(t)===ie){e.next=4;break}throw new Error('[WindowManager]: main view scenePath must in root dir "/"');case 4:if(n!==B.ScenePathType.None){e.next=6;break}throw new Error("[WindowManager]: ".concat(t," not valid scene"));case 6:if(n!==B.ScenePathType.Page){e.next=11;break}return e.next=9,this._setMainViewScenePath(t);case 9:e.next=17;break;case 11:if(n!==B.ScenePathType.Dir){e.next=17;break}if(r=Se(this.displayer,t),e.t0=r,!e.t0){e.next=17;break}return e.next=17,this._setMainViewScenePath(r);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_setMainViewScenePath",value:(r=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.setMainViewFocusPath(t)&&(this.safeSetAttributes({_mainScenePath:t}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setMainViewSceneIndex",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.room){e.next=9;break}if(this.store.getMainViewSceneIndex()!==t){e.next=3;break}return e.abrupt("return");case 3:if(r=null==(n=this.callbacksNode)?void 0:n.scenes[t],i="".concat(ie).concat(r),!r){e.next=8;break}this.setMainViewFocusPath(i)&&(this.store.setMainViewScenePath(i),this.store.setMainViewSceneIndex(t),this.dispatchSetMainViewScenePath(i)),e.next=9;break;case 8:throw new Error("[WindowManager]: ".concat(t," not valid index"));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"dispatchSetMainViewScenePath",value:function(e){this.dispatchInternalEvent(q.SetMainViewScenePath,{nextScenePath:e}),ae.emit("mainViewScenePathChange",e),Te(this.room,e)}},{key:"getAppInitPath",value:function(e){var t,n=this.store.getAppAttributes(e);if(n)return null==(t=null==n?void 0:n.options)?void 0:t.scenePath}},{key:"safeDispatchMagixEvent",value:function(e,t){this.canOperate&&this.displayer.dispatchMagixEvent(e,t)}},{key:"focusByAttributes",value:function(e){var t;if(e&&Object.keys(e).length===(null==(t=this.boxManager)?void 0:t.boxSize)){var n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}},{key:"onReconnected",value:(t=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.attributesUpdateCallback(this.attributes.apps),t=Array.from(this.appProxies.values()).map((function(e){return e.onReconnected()})),this.mainViewProxy.onReconnect(),e.next=5,Promise.all(t);case 5:this.callbacksNode&&this.onSceneChange(this.callbacksNode);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"notifyContainerRectUpdate",value:function(e){this.appProxies.forEach((function(t){t.appEmitter.emit("containerRectUpdate",e)}))}},{key:"dispatchInternalEvent",value:function(e,t){this.safeDispatchMagixEvent(J,{eventName:e,payload:t})}},{key:"destroy",value:function(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),rt.clearListeners(),ue.clearListeners(),this.appProxies.size&&this.appProxies.forEach((function(e){e.destroy(!0,!1,!0)})),ae.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0}},{key:"eventName",get:function(){return B.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}},{key:"attributes",get:function(){return this.windowManger.attributes}},{key:"canOperate",get:function(){return this.windowManger.canOperate}},{key:"room",get:function(){return B.isRoom(this.displayer)?this.displayer:void 0}},{key:"mainView",get:function(){return this.mainViewProxy.view}},{key:"focusApp",get:function(){if(this.store.focus)return this.appProxies.get(this.store.focus)}},{key:"uid",get:function(){var e;return(null==(e=this.room)?void 0:e.uid)||""}}]),e}(),ht=function(){if(Ne(B.WhiteVersion)Ib.containerSizeRatio?(i=r*Ib.containerSizeRatio,t.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(r=i/Ib.containerSizeRatio,t.classList.toggle("netless-window-manager-sizer-horizontal",!1)),n.style.width="".concat(r,"px"),n.style.height="".concat(i,"px"))}},{key:"disconnect",value:function(){var e;null==(e=this.containerResizeObserver)||e.disconnect(),j.isFunction(this.disposer)&&(this.disposer(),this.disposer=void 0)}}],[{key:"create",value:function(t,n,r,i){var o=new e(i);return o.observePlaygroundSize(t,n,r),o}}]),e}(),mt={exports:{}},gt={},yt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable;function _t(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var wt=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=_t(e),o=1;o4?(t=e.substr(1,2),n=e.substr(3,2),r=e.substr(5,2)):(t=e.substr(1,1),n=e.substr(2,1),r=e.substr(3,1),t+=t,n+=n,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:1}}}),or={test:function(e){return"string"==typeof e&&Fn.test(e)||qn(e)||Jn(e)},parse:function(e){return nr.test(e)?nr.parse(e):rr.test(e)?rr.parse(e):ir.test(e)?ir.parse(e):e},transform:function(e){return qn(e)?nr.transform(e):Jn(e)?rr.transform(e):e}},ar=function(e){var t=e.onRead,n=e.onRender,r=e.uncachedValues,i=void 0===r?new Set:r,o=e.useCache,a=void 0===o||o;return function(e){void 0===e&&(e={});var r=wn(e,[]),o={},s=[],u=!1;function l(e,t){e.startsWith("--")&&(r.hasCSSVariable=!0);var n=o[e];o[e]=t,o[e]!==n&&(-1===s.indexOf(e)&&s.push(e),u||(u=!0,Pn.render(c.render)))}var c={get:function(e,n){return void 0===n&&(n=!1),!n&&a&&!i.has(e)&&void 0!==o[e]?o[e]:t(e,r)},set:function(e,t){if("string"==typeof e)l(e,t);else for(var n in e)l(n,e[n]);return this},render:function(e){return void 0===e&&(e=!1),(u||!0===e)&&(n(o,r,s),u=!1,s.length=0),this}};return c}},sr=/([a-z])([A-Z])/g,ur=function(e){return e.replace(sr,"$1-$2").toLowerCase()},lr=new Map,cr=new Map,hr=["Webkit","Moz","O","ms",""],dr=hr.length,fr="undefined"!=typeof document,pr=function(e,t){return cr.set(e,ur(t))},vr=function(e,t){void 0===t&&(t=!1);var n=t?cr:lr;return n.has(e)||(fr?function(e){tr=tr||document.createElement("div");for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:ri();return this.flush(t),this.disposers.set(t,e()),t}},{key:"addDisposer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ri();return this.flush(t),this.disposers.set(t,e),t}},{key:"addEventListener",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:ri();return this.add((function(){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}),i),i}},{key:"setTimeout",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ri();return this.add((function(){var i=window.setTimeout((function(){n.remove(r),e()}),t);return function(){return window.clearTimeout(i)}}),r)}},{key:"setInterval",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ri();return this.add((function(){var n=window.setInterval(e,t);return function(){return window.clearInterval(n)}}),n)}},{key:"remove",value:function(e){var t=this.disposers.get(e);return this.disposers.delete(e),t}},{key:"flush",value:function(e){var t=this.remove(e);if(t)try{t()}catch(e){console.error(e)}}},{key:"flushAll",value:function(){this.disposers.forEach((function(e){try{e()}catch(e){console.error(e)}})),this.disposers.clear()}}]),e}(),oi=Object.defineProperty,ai=(n(80782),function(e,t,n){return r=e,i="symbol"!=_(t)?t+"":t,o=n,i in r?oi(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o,n;var r,i,o}),si=function(){function e(t,n){y(this,e),ai(this,"_value"),ai(this,"_beforeDestroys"),ai(this,"_subscribers"),this._value=t,n&&(this.compare=n)}return x(e,[{key:"setValue",value:function(e,t){if(!this.compare(e,this._value)){var n=this._value;this._value=e,this._subscribers&&this._subscribers.forEach((function(r){return r(e,n,t)}))}}},{key:"reaction",value:function(e){var t=this;return this._subscribers||(this._subscribers=new Set),this._subscribers.add(e),function(){t._subscribers&&t._subscribers.delete(e)}}},{key:"subscribe",value:function(e,t){var n=this.reaction(e);return e(this._value,void 0,t),n}},{key:"derive",value:function(t,n,r){var i=new e(t(this.value,void 0,r),n),o=this.reaction((function(e,n,r){i.setValue(t(e,n,r))}));return i.addBeforeDestroy(o),i}},{key:"destroy",value:function(){this._beforeDestroys&&(this._beforeDestroys.forEach((function(e){return e()})),this._beforeDestroys.clear()),this._subscribers&&this._subscribers.clear()}},{key:"addBeforeDestroy",value:function(e){var t=this;return this._beforeDestroys||(this._beforeDestroys=new Set),this._beforeDestroys.add(e),function(){t._beforeDestroys&&t._beforeDestroys.delete(e)}}},{key:"compare",value:function(e,t){return e===t}},{key:"value",get:function(){return this._value}}]),e}();function ui(e,t){Object.keys(t).forEach((function(n){!function(e,t,n){var r,i;Object.defineProperties(e,(w(r={},t,{get:function(){return n.value}}),w(r,"_".concat(t,"$"),{value:n}),w(r,"set".concat((i=t)[0].toUpperCase()+i.slice(1)),{value:function(e,t){return n.setValue(e,t)}}),r))}(e,n,t[n])}))}function li(e){var t=function(t){var n=e.addDisposer((function(){t.destroy()}));return t.addBeforeDestroy((function(){e.remove(n)})),t};return{bindSideEffect:t,combine:function(e,n,r,i){return t(function(e,t,n,r){var i=e.map((function(e){return e.value})),o=new si(t(i,void 0,r),n);return e.forEach((function(e,n){var r=e.reaction((function(e,r,a){var s=i.slice();s[n]=e;var u=i;i=s,o.setValue(t(s,u,a),a)}));o.addBeforeDestroy(r)})),o}(e,n,r,i))},createVal:function(e,n){return t(new si(e,n))}}}!function(e){e.Light="light",e.Dark="dark",e.Auto="auto"}(Qr||(Qr={})),function(e){e.Normal="normal",e.Minimized="minimized",e.Maximized="maximized"}(Zr||(Zr={})),function(e){e.DarkMode="dark_mode",e.PrefersColorScheme="prefers_color_scheme",e.Close="close",e.Focus="focus",e.Blur="blur",e.Move="move",e.Resize="resize",e.IntrinsicMove="intrinsic_move",e.IntrinsicResize="intrinsic_resize",e.VisualResize="visual_resize",e.ZIndex="z_index",e.State="state",e.Minimized="minimized",e.Maximized="maximized",e.Readonly="readonly",e.Destroyed="destroyed"}(qr||(qr={})),function(e){e.Close="close",e.Maximize="maximize",e.Minimize="minimize"}(Jr||(Jr={})),function(e){e.North="n",e.South="s",e.West="w",e.East="e",e.NorthWest="nw",e.NorthEast="ne",e.SouthEast="se",e.SouthWest="sw"}(Kr||(Kr={}));var ci="dh";function hi(e,t,n){return Math.min(Math.max(e,t),n)}function di(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function fi(e){return e.touches?e.touches[0]:e}function pi(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}var vi=1;function mi(){return"New Box ".concat(vi++)}function gi(e){return Boolean(e)}function yi(e){return!e}var bi=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.readonly,i=void 0!==r&&r,o=n.title,a=n.buttons,s=n.onEvent,u=n.onDragStart,l=n.namespace,c=void 0===l?"telebox":l,h=n.state,d=void 0===h?Zr.Normal:h;y(this,e),this.$btns=[],this.sideEffect=new ii,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=function(e){var n;if(!(t.readonly||0!==e.button||null!=(n=e.target.dataset)&&n.teleTitleBarNoDblClick)){di(e);var r=Date.now();r-t.lastTitleBarClick.timestamp<=500?Math.abs(e.clientX-t.lastTitleBarClick.clientX)<=5&&Math.abs(e.clientY-t.lastTitleBarClick.clientY)<=5&&t.onEvent&&t.onEvent({type:Jr.Maximize}):t.onDragStart&&t.onDragStart(e),t.lastTitleBarClick.timestamp=r,t.lastTitleBarClick.clientX=e.clientX,t.lastTitleBarClick.clientY=e.clientY}},this.lastTitleBarTouch={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarTouch=function(e){var n;if(!(t.readonly||null!=(n=e.target.dataset)&&n.teleTitleBarNoDblClick)){di(e);var r=Date.now(),i=e.touches[0]||{},o=i.clientX,a=void 0===o?t.lastTitleBarTouch.clientX+100:o,s=i.clientY,u=void 0===s?t.lastTitleBarTouch.clientY+100:s;r-t.lastTitleBarTouch.timestamp<=500?Math.abs(a-t.lastTitleBarTouch.clientX)<=10&&Math.abs(u-t.lastTitleBarTouch.clientY)<=10&&t.onEvent&&t.onEvent({type:Jr.Maximize}):t.onDragStart&&t.onDragStart(e),t.lastTitleBarTouch.timestamp=r,t.lastTitleBarTouch.clientX=a,t.lastTitleBarTouch.clientY=u}},this.readonly=i,this.onEvent=s,this.onDragStart=u,this.namespace=c,this.title=o,this.state=d,this.buttons=a||[{type:Jr.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:Jr.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:function(e){return e===Zr.Maximized}},{type:Jr.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}],this.$dragArea=this.renderDragArea()}return x(e,[{key:"setTitle",value:function(e){this.title=e,this.$title&&(this.$title.textContent=e,this.$title.title=e)}},{key:"setState",value:function(e){var t=this;this.state!==e&&(this.state=e,this.buttons.forEach((function(n,r){n.isActive&&t.$btns[r].classList.toggle("is-active",n.isActive(e))})))}},{key:"setReadonly",value:function(e){this.readonly!==e&&(this.readonly=e)}},{key:"render",value:function(){var e=this;if(!this.$titleBar){this.$titleBar=document.createElement("div"),this.$titleBar.className=this.wrapClassName("titlebar");var t=document.createElement("div");t.className=this.wrapClassName("title-area"),t.dataset.teleBoxHandle=ci,this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle=ci,this.title&&(this.$title.textContent=this.title,this.$title.title=this.title),t.appendChild(this.$title),t.appendChild(this.$dragArea);var n=document.createElement("div");n.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach((function(t,r){var i=t.iconClassName,o=t.isActive,a=String(r),s=document.createElement("button");s.className="".concat(e.wrapClassName("titlebar-btn")," ").concat(i),s.dataset.teleTitleBarBtnIndex=a,s.dataset.teleTitleBarNoDblClick="true",o&&s.classList.toggle("is-active",o(e.state)),e.$btns.push(s),n.appendChild(s)})),this.sideEffect.addEventListener(n,"click",(function(t){var n;if(!e.readonly){var r=t.target,i=Number(null==(n=r.dataset)?void 0:n.teleTitleBarBtnIndex);if(!Number.isNaN(i)&&i0&&void 0!==arguments[0]?arguments[0]:{},r=n.id,i=void 0===r?pi():r,a=n.title,s=void 0===a?mi():a,u=n.prefersColorScheme,l=void 0===u?Qr.Light:u,c=n.darkMode,h=n.visible,d=void 0===h||h,f=n.width,p=void 0===f?.5:f,v=n.height,m=void 0===v?.5:v,g=n.minWidth,b=void 0===g?0:g,x=n.minHeight,_=void 0===x?0:x,w=n.x,T=void 0===w?.1:w,M=n.y,S=void 0===M?.1:M,E=n.minimized,A=void 0!==E&&E,I=n.maximized,C=void 0!==I&&I,N=n.readonly,k=void 0!==N&&N,D=n.resizable,P=void 0===D||D,O=n.draggable,R=void 0===O||O,L=n.fence,j=void 0===L||L,B=n.fixRatio,U=void 0!==B&&B,F=n.focus,z=void 0!==F&&F,G=n.zIndex,H=void 0===G?100:G,V=n.namespace,W=void 0===V?"telebox":V,Y=n.titleBar,X=n.content,Q=n.footer,Z=n.styles,q=n.containerRect,J=void 0===q?{x:0,y:0,width:window.innerWidth,height:window.innerHeight}:q,K=n.collectorRect;y(this,e),this._renderSideEffect=new ii,this.handleTrackStart=function(e){var n;return null==(n=t._handleTrackStart)?void 0:n.call(t,e)},this._sideEffect=new ii,this._valSideEffectBinder=li(this._sideEffect);var $=this._valSideEffectBinder,ee=$.combine,te=$.createVal;this.id=i,this.namespace=W,this.events=new xn,this._delegateEvents=new xn;var ne=te(l);ne.reaction((function(e,n,r){r||t.events.emit(qr.PrefersColorScheme,e)}));var re=te(Boolean(c));null==c&&ne.subscribe((function(e,n,r){t._sideEffect.add((function(){if("auto"===e){var t=window.matchMedia("(prefers-color-scheme: dark)");if(t){re.setValue(t.matches,r);var n=function(e){re.setValue(e.matches,r)};return t.addListener(n),function(){return t.removeListener(n)}}return _i}return re.setValue("dark"===e,r),_i}),"prefers-color-scheme")})),re.reaction((function(e,n,r){r||t.events.emit(qr.DarkMode,e)}));var ie=te(J,$r),oe=te(K,$r),ae=te(s),se=te(d);se.reaction((function(e,n,r){!r&&!e&&t.events.emit(qr.Close)}));var ue=te(k);ue.reaction((function(e,n,r){r||t.events.emit(qr.Readonly,e)}));var le=te(P),ce=te(R),he=te(j),de=te(U),fe=te(H);fe.reaction((function(e,n,r){r||t.events.emit(qr.ZIndex,e)}));var pe=te(z);pe.reaction((function(e,n,r){r||t.events.emit(e?qr.Focus:qr.Blur)}));var ve=te(A);ve.reaction((function(e,n,r){r||t.events.emit(qr.Minimized,e)}));var me=te(C);me.reaction((function(e,n,r){r||t.events.emit(qr.Maximized,e)}));var ge=ee([ve,me],(function(e){var t=o(e,2),n=t[0],r=t[1];return n?Zr.Minimized:r?Zr.Maximized:Zr.Normal}));ge.reaction((function(e,n,r){r||t.events.emit(qr.State,e)}));var ye=te({width:hi(b,0,1),height:hi(_,0,1)},$r),be=te({width:hi(p,ye.value.width,1),height:hi(m,ye.value.height,1)},$r);ye.reaction((function(e,t,n){be.setValue({width:hi(p,e.width,1),height:hi(m,e.height,1)},n)})),be.reaction((function(e,n,r){r||t.events.emit(qr.IntrinsicResize,e)}));var xe=ee([be,me],(function(e){var t=o(e,2),n=t[0];return t[1]?{width:1,height:1}:n}),$r);xe.reaction((function(e,n,r){r||t.events.emit(qr.Resize,e)}));var _e=ee([xe,ve,ie,oe],(function(e){var t=o(e,4),n=t[0],r=t[1],i=t[2],a=t[3];return r&&a?{width:a.width/n.width/i.width,height:a.height/n.height/i.height}:n}),$r);_e.reaction((function(e,n,r){r||t.events.emit(qr.VisualResize,e)}));var we=te({x:hi(T,0,1),y:hi(S,0,1)},$r);we.reaction((function(e,n,r){r||t.events.emit(qr.IntrinsicMove,e)}));var Te=ee([we,be,ie,oe,ve,me],(function(e){var t=o(e,6),n=t[0],r=t[1],i=t[2],a=t[3],s=t[4],u=t[5];return s&&a?u?{x:(a.x+a.width/2)/i.width-.5,y:(a.y+a.height/2)/i.height-.5}:{x:(a.x+a.width/2)/i.width-r.width/2,y:(a.y+a.height/2)/i.height-r.height/2}:u?{x:0,y:0}:n}),$r);Te.reaction((function(e,n,r){r||t.events.emit(qr.Move,e)})),this.titleBar=Y||new bi({readonly:ue.value,title:ae.value,namespace:this.namespace,onDragStart:function(e){var n;return null==(n=t._handleTrackStart)?void 0:n.call(t,e)},onEvent:function(e){if(t._delegateEvents.listeners.length>0)t._delegateEvents.emit(e.type);else switch(e.type){case Jr.Maximize:me.setValue(!me.value);break;case Jr.Minimize:ve.setValue(!0);break;case Jr.Close:se.setValue(!1);break;default:console.error("Unsupported titleBar event:",e)}}}),ue.reaction((function(e){t.titleBar.setReadonly(e)}));var Me=te(X),Se=te(Q),Ee=te(Z);ui(this,{prefersColorScheme:ne,darkMode:re,containerRect:ie,collectorRect:oe,title:ae,visible:se,readonly:ue,resizable:le,draggable:ce,fence:he,fixRatio:de,focus:pe,zIndex:fe,minimized:ve,maximized:me,$userContent:Me,$userFooter:Se,$userStyles:Ee}),this._state$=ge,this._minSize$=ye,this._size$=xe,this._intrinsicSize$=be,this._visualSize$=_e,this._coord$=Te,this._intrinsicCoord$=we,this.fixRatio&&this.transform(Te.value.x,Te.value.y,xe.value.width,xe.value.height,!0),this.$box=this.render()}return x(e,[{key:"setState",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];switch(e){case Zr.Maximized:this.setMinimized(!1,t),this.setMaximized(!0,t);break;case Zr.Minimized:this.setMinimized(!0,t),this.setMaximized(!1,t);break;default:this.setMinimized(!1,t),this.setMaximized(!1,t)}return this}},{key:"setMinWidth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._minSize$.setValue({width:e,height:this.minHeight},t),this}},{key:"setMinHeight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._minSize$.setValue({width:this.minWidth,height:e},t),this}},{key:"resize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._intrinsicSize$.setValue({width:e,height:t},n),this}},{key:"move",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._intrinsicCoord$.setValue({x:e,y:t},n),this}},{key:"transform",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(this.fixRatio){var o=this.intrinsicHeight/this.intrinsicWidth*n;t!==this.intrinsicY&&(t-=o-r),r=o}return t<0&&(t=0,r>this.intrinsicHeight&&(r=this.intrinsicHeight)),this._intrinsicCoord$.setValue({x:n>=this.minWidth?e:this.intrinsicX,y:r>=this.minHeight?t:this.intrinsicY},i),this._intrinsicSize$.setValue({width:hi(n,this.minWidth,1),height:hi(r,this.minHeight,1)},i),this}},{key:"mount",value:function(e){return e.appendChild(this.render()),this}},{key:"unmount",value:function(){return this.$box&&this.$box.remove(),this}},{key:"mountContent",value:function(e){return this.set$userContent(e),this}},{key:"unmountContent",value:function(){return this.set$userContent(void 0),this}},{key:"mountFooter",value:function(e){return this.set$userFooter(e),this}},{key:"unmountFooter",value:function(){return this.set$userFooter(void 0),this}},{key:"getUserStyles",value:function(){return this.$userStyles}},{key:"mountStyles",value:function(e){var t;return"string"==typeof e?(t=document.createElement("style")).textContent=e:t=e,this.set$userStyles(t),this}},{key:"unmountStyles",value:function(){return this.set$userStyles(void 0),this}},{key:"render",value:function(e){var t=this;if(e){if(e===this.$box)return this.$box;this.$box=e}else{if(this.$box)return this.$box;this.$box=document.createElement("div")}this._renderSideEffect.flushAll(),this.$box.classList.add(this.wrapClassName("box"));var n=function(e,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:gi;return t._renderSideEffect.add((function(){var o=t.wrapClassName(r);return n.subscribe((function(t){e.classList.toggle(o,i(t))}))}))};n(this.$box,this._readonly$,"readonly"),n(this.$box,this._draggable$,"no-drag",yi),n(this.$box,this._resizable$,"no-resize",yi),n(this.$box,this._focus$,"blur",yi),n(this.$box,this._darkMode$,"color-scheme-dark"),n(this.$box,this._darkMode$,"color-scheme-light",yi),this._renderSideEffect.add((function(){var e=t.wrapClassName("minimized"),n=t.wrapClassName("maximized"),r="box-maximized-timer";return t._state$.subscribe((function(i){t.$box.classList.toggle(e,i===Zr.Minimized),i===Zr.Maximized?(t._renderSideEffect.flush(r),t.$box.classList.toggle(n,!0)):t._renderSideEffect.setTimeout((function(){t.$box.classList.toggle(n,!1)}),0,r)}))})),this._renderSideEffect.add((function(){return t._visible$.subscribe((function(e){t.$box.style.display=e?"block":"none"}))})),this._renderSideEffect.add((function(){return t._zIndex$.subscribe((function(e){t.$box.style.zIndex=String(e)}))}));var r=Xr(this.$box);this.$box.dataset.teleBoxID=this.id,this.$box.style.width=this.absoluteWidth+"px",this.$box.style.height=this.absoluteHeight+"px";var i=this.x*this.containerRect.width+this.containerRect.x,a=this.y*this.containerRect.height+this.containerRect.y;this.$box.style.transform="translate(".concat(i-10,"px,").concat(a-10,"px)"),this._valSideEffectBinder.combine([this._coord$,this._size$,this._minimized$,this._containerRect$,this._collectorRect$],(function(e){var t=o(e,5),n=t[0],r=t[1],i=t[2],a=t[3],s=t[4],u=r.width*a.width,l=r.height*a.height;return{width:u+(i&&s?1:0),height:l+(i&&s?1:0),x:n.x*a.width,y:n.y*a.height,scaleX:i&&s?s.width/u:1,scaleY:i&&s?s.height/l:1}}),$r).subscribe((function(e){r.set(e)})),r.set({x:i,y:a});var s=document.createElement("div");s.className=this.wrapClassName("box-main"),this.$box.appendChild(s);var u=document.createElement("div");u.className=this.wrapClassName("titlebar-wrap"),u.appendChild(this.titleBar.render()),this.$titleBar=u;var l=document.createElement("div");l.className=this.wrapClassName("content-wrap");var c=document.createElement("div");c.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=c,this._renderSideEffect.add((function(){var e;return t._$userStyles$.subscribe((function(t){e&&e.remove(),e=t,t&&l.appendChild(t)}))})),this._renderSideEffect.add((function(){var e;return t._$userContent$.subscribe((function(t){e&&e.remove(),e=t,t&&c.appendChild(t)}))})),l.appendChild(c);var h=document.createElement("div");return h.className=this.wrapClassName("footer-wrap"),this.$footer=h,this._renderSideEffect.add((function(){var e;return t._$userFooter$.subscribe((function(t){e&&e.remove(),e=t,t&&h.appendChild(t)}))})),s.appendChild(u),s.appendChild(l),s.appendChild(h),this._renderResizeHandlers(),this.$box}},{key:"_renderResizeHandlers",value:function(){var e=this,t=document.createElement("div");t.className=this.wrapClassName("resize-handles"),Object.values(Kr).forEach((function(n){var r=document.createElement("div");r.className=e.wrapClassName(n)+" "+e.wrapClassName("resize-handle"),r.dataset.teleBoxHandle=n,t.appendChild(r)})),this.$box.appendChild(t);var n,r,i="handle-tracking-listener",o=this.wrapClassName("transforming"),a=0,s=0,u=0,l=0,c=0,h=0,d=function(t){if(e.state===Zr.Normal){di(t);var n=fi(t),i=n.pageX,o=n.pageY;o<0&&(o=0);var d=(i-c)/e.containerRect.width,f=(o-h)/e.containerRect.height;switch(r){case Kr.North:e.transform(e.x,s+f,e.width,l-f);break;case Kr.South:e.transform(e.x,e.y,e.width,l+f);break;case Kr.West:e.transform(a+d,e.y,u-d,e.height);break;case Kr.East:e.transform(e.x,e.y,u+d,e.height);break;case Kr.NorthWest:e.transform(a+d,s+f,u-d,l-f);break;case Kr.NorthEast:e.transform(e.x,s+f,u+d,l-f);break;case Kr.SouthEast:e.transform(e.x,e.y,u+d,l+f);break;case Kr.SouthWest:e.transform(a+d,e.y,u-d,l+f);break;default:if(e.fence)e.move(hi(a+d,0,1-e.width),hi(s+f,0,1-e.height));else{var p=20/e.containerRect.width,v=20/e.containerRect.height;e.move(hi(a+d,p-e.width,1-p),hi(s+f,0,1-v))}}}},f=function(t){r=void 0,n&&(di(t),e.$box.classList.toggle(o,!1),e._sideEffect.flush(i),n.remove())},p=function(t){var p;if(!(e.readonly||null!=t.button&&0!==t.button||!e.draggable||r||e.state!==Zr.Normal)){var v=t.target;if(null!=(p=v.dataset)&&p.teleBoxHandle){var m;di(t),a=e.x,s=e.y,u=e.width,l=e.height,m=fi(t),c=m.pageX,h=m.pageY,r=v.dataset.teleBoxHandle,n||(n=document.createElement("div"));var g=r?e.wrapClassName("cursor-".concat(r)):"";n.className=e.wrapClassName("track-mask".concat(g?" ".concat(g):"")),e.$box.appendChild(n),e.$box.classList.add(o),e._sideEffect.add((function(){return window.addEventListener("mousemove",d),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("mouseup",f),window.addEventListener("touchend",f,{passive:!1}),window.addEventListener("touchcancel",f,{passive:!1}),function(){window.removeEventListener("mousemove",d),window.removeEventListener("touchmove",d),window.removeEventListener("mouseup",f),window.removeEventListener("touchend",f),window.removeEventListener("touchcancel",f)}}),i)}}};this._handleTrackStart=p,this._sideEffect.addEventListener(t,"mousedown",p,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(t,"touchstart",p,{passive:!1},"box-resizeHandles-touchstart")}},{key:"destroy",value:function(){this.$box.remove(),this.events.emit(qr.Destroyed),this._sideEffect.flushAll(),this._renderSideEffect.flushAll(),this.events.removeAllListeners(),this._delegateEvents.removeAllListeners()}},{key:"wrapClassName",value:function(e){return"".concat(this.namespace,"-").concat(e)}},{key:"darkMode",get:function(){return this._darkMode$.value}},{key:"state",get:function(){return this._state$.value}},{key:"minWidth",get:function(){return this._minSize$.value.width}},{key:"minHeight",get:function(){return this._minSize$.value.height}},{key:"intrinsicWidth",get:function(){return this._intrinsicSize$.value.width}},{key:"intrinsicHeight",get:function(){return this._intrinsicSize$.value.height}},{key:"width",get:function(){return this._size$.value.width}},{key:"height",get:function(){return this._size$.value.height}},{key:"absoluteWidth",get:function(){return this.width*this.containerRect.width}},{key:"absoluteHeight",get:function(){return this.height*this.containerRect.height}},{key:"visualWidth",get:function(){return this._visualSize$.value.width}},{key:"visualHeight",get:function(){return this._visualSize$.value.height}},{key:"intrinsicX",get:function(){return this._intrinsicCoord$.value.x}},{key:"intrinsicY",get:function(){return this._intrinsicCoord$.value.y}},{key:"x",get:function(){return this._coord$.value.x}},{key:"y",get:function(){return this._coord$.value.y}}]),e}();function _i(){}var wi,Ti=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.visible,i=void 0===r||r,o=n.readonly,a=void 0!==o&&o,s=n.darkMode,u=void 0!==s&&s,l=n.namespace,c=void 0===l?"telebox":l,h=n.styles,d=void 0===h?{}:h,f=n.onClick;y(this,e),this.handleCollectorClick=function(){!t._readonly&&t.onClick&&t.onClick()},this._visible=i,this._readonly=a,this._darkMode=u,this.namespace=c,this.styles=d,this.onClick=f}return x(e,[{key:"mount",value:function(e){return e.appendChild(this.render()),this}},{key:"unmount",value:function(){return this.$collector&&this.$collector.remove(),this}},{key:"setVisible",value:function(e){return this._visible!==e&&(this._visible=e,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-visible"),e)),this}},{key:"setReadonly",value:function(e){return this._readonly!==e&&(this._readonly=e,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-readonly"),e)),this}},{key:"setDarkMode",value:function(e){return this._darkMode!==e&&(this._darkMode=e,this.$collector&&(this.$collector.classList.toggle(this.wrapClassName("color-scheme-dark"),e),this.$collector.classList.toggle(this.wrapClassName("color-scheme-light"),!e))),this}},{key:"setStyles",value:function(e){if(Object.assign(this.styles,e),this.$collector){var t=this.$collector;Object.keys(e).forEach((function(n){var r=e[n];null!=r&&(t.style[n]=r)}))}return this}},{key:"render",value:function(){return this.$collector||(this.$collector=document.createElement("button"),this.$collector.className=this.wrapClassName("collector"),this.$collector.style.backgroundImage="url('".concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K","')"),this.$collector.addEventListener("click",this.handleCollectorClick),this._visible&&this.$collector.classList.add(this.wrapClassName("collector-visible")),this._readonly&&this.$collector.classList.add(this.wrapClassName("collector-readonly")),this.$collector.classList.add(this.wrapClassName(this._darkMode?"color-scheme-dark":"color-scheme-light")),this.setStyles(this.styles)),this.$collector}},{key:"destroy",value:function(){this.$collector&&(this.$collector.removeEventListener("click",this.handleCollectorClick),this.$collector.remove(),this.$collector=void 0),this.onClick=void 0}},{key:"wrapClassName",value:function(e){return"".concat(this.namespace,"-").concat(e)}},{key:"visible",get:function(){return this._visible}},{key:"readonly",get:function(){return this._readonly}},{key:"darkMode",get:function(){return this._darkMode}}]),e}();!function(e){e.Focused="focused",e.Blurred="blurred",e.Created="created",e.Removed="removed",e.State="state",e.Maximized="maximized",e.Minimized="minimized",e.Move="move",e.Resize="resize",e.IntrinsicMove="intrinsic_move",e.IntrinsicResize="intrinsic_resize",e.VisualResize="visual_resize",e.ZIndex="z_index",e.PrefersColorScheme="prefers_color_scheme",e.DarkMode="dark_mode"}(wi||(wi={}));var Mi,Si,Ei=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).boxes=e.boxes,r.focusedBox=e.focusedBox,r.containerRect=e.containerRect,r.darkMode=e.darkMode,r}return x(n,[{key:"focusBox",value:function(e){var t;if(!this.focusedBox||this.focusedBox!==e){if(this.$titles&&this.state===Zr.Maximized)for(var n=this.$titles.firstElementChild.children,r=n.length-1;r>=0;r-=1){var i=n[r],o=null==(t=i.dataset)?void 0:t.teleBoxID;o&&(e&&o===e.id?i.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&o===this.focusedBox.id&&i.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}this.focusedBox=e}}},{key:"setContainerRect",value:function(e){if(this.containerRect=e,this.$titleBar){var t=e.x,n=e.y,r=e.width;this.$titleBar.style.transform="translate(".concat(t,"px, ").concat(n,"px)"),this.$titleBar.style.width=r+"px"}}},{key:"setBoxes",value:function(e){this.boxes=e,this.updateTitles()}},{key:"setState",value:function(e){i(v(n.prototype),"setState",this).call(this,e),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),e===Zr.Maximized),this.updateTitles()}},{key:"setReadonly",value:function(e){i(v(n.prototype),"setReadonly",this).call(this,e),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("readonly"),this.readonly)}},{key:"setDarkMode",value:function(e){e!==this.darkMode&&(this.darkMode=e,this.$titleBar&&(this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-dark"),e),this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-light"),!e)))}},{key:"render",value:function(){var e=i(v(n.prototype),"render",this).call(this),t=this.containerRect,r=t.x,o=t.y,a=t.width;e.style.transform="translate(".concat(r,"px, ").concat(o,"px)"),e.style.width=a+"px",e.classList.add(this.wrapClassName("max-titlebar")),e.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===Zr.Maximized),e.classList.toggle(this.wrapClassName("readonly"),this.readonly),e.classList.add(this.wrapClassName(this.darkMode?"color-scheme-dark":"color-scheme-light"));var s=document.createElement("div");return s.classList.add(this.wrapClassName("titles-area")),e.insertBefore(s,e.firstElementChild),this.updateTitles(),e}},{key:"destroy",value:function(){i(v(n.prototype),"destroy",this).call(this),this.$titles=void 0,this.boxes.length=0,this.focusedBox=void 0}},{key:"updateTitles",value:function(){this.$titleBar&&this.state===Zr.Maximized&&(this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-single-title"),1===this.boxes.length),1===this.boxes.length?this.setTitle(this.boxes[0].title):this.$titleBar.replaceChild(this.renderTitles(),this.$titleBar.firstElementChild))}},{key:"renderTitles",value:function(){var e=this;this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.$titles.addEventListener("wheel",(function(e){e.currentTarget.scrollBy({left:e.deltaY>0?250:-250,behavior:"smooth"})}),{passive:!1});var t=document.createElement("div");return t.className=this.wrapClassName("titles-content"),this.$titles.appendChild(t),this.boxes.forEach((function(n){var r=document.createElement("button");r.className=e.wrapClassName("titles-tab"),r.textContent=n.title,r.dataset.teleBoxID=n.id,r.dataset.teleTitleBarNoDblClick="true",e.focusedBox&&n.id===e.focusedBox.id&&r.classList.add(e.wrapClassName("titles-tab-focus")),t.appendChild(r)})),this.$titles}}]),n}(bi),Ai=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.root,i=void 0===r?document.body:r,a=n.prefersColorScheme,s=void 0===a?Qr.Light:a,u=n.minimized,l=void 0!==u&&u,c=n.maximized,h=void 0!==c&&c,d=n.fence,f=void 0===d||d,p=n.containerRect,v=void 0===p?{x:0,y:0,width:window.innerWidth,height:window.innerHeight}:p,m=n.collector,g=n.namespace,b=void 0===g?"telebox":g,x=n.readonly,_=void 0!==x&&x;y(this,e),this.events=new xn,this._sideEffect=new ii;var w=li(this._sideEffect),T=w.combine,M=w.createVal;this.root=i,this.namespace=b,this.boxes$=M([]),this.topBox$=this.boxes$.derive((function(e){if(e.length>0)return e.reduce((function(e,t){return e.zIndex>t.zIndex?e:t}))}));var S=window.matchMedia("(prefers-color-scheme: dark)"),E=M(!1);S&&(E.setValue(S.matches),this._sideEffect.add((function(){var e=function(e){E.setValue(e.matches)};return S.addListener(e),function(){return S.removeListener(e)}})));var A=M(s);A.reaction((function(e,n,r){t.boxes.forEach((function(t){return t.setPrefersColorScheme(e,r)})),r||t.events.emit(wi.PrefersColorScheme,e)})),this._darkMode$=T([E,A],(function(e){var t=o(e,2),n=t[0],r=t[1];return"auto"===r?n:"dark"===r})),this._darkMode$.reaction((function(e,n,r){t.boxes.forEach((function(t){return t.setDarkMode(e,r)})),r||t.events.emit(wi.DarkMode,e)}));var I=M(_);I.reaction((function(e,n,r){t.boxes.forEach((function(t){return t.setReadonly(e,r)}))}));var C=M(l),N=M(h);N.reaction((function(e,n,r){t.boxes.forEach((function(t){return t.setMaximized(e,r)})),r||t.events.emit(wi.Maximized,e)}));var k=T([C,N],(function(e){var t=o(e,2),n=t[0],r=t[1];return n?Zr.Minimized:r?Zr.Maximized:Zr.Normal}));k.reaction((function(e,n,r){t.maxTitleBar.setState(e),r||t.events.emit(wi.State,e)}));var D=M(f);D.subscribe((function(e,n,r){t.boxes.forEach((function(t){return t.setFence(e,r)}))}));var P=M(v,$r);P.reaction((function(e,n,r){t.boxes.forEach((function(t){return t.setContainerRect(e,r)})),t.maxTitleBar.setContainerRect(e)}));var O=M(null===m?null:m||new Ti({visible:l,readonly:_,namespace:b}).mount(i));O.subscribe((function(e){e&&(e.setVisible(C.value),e.setReadonly(I.value),e.setDarkMode(t._darkMode$.value),t._sideEffect.add((function(){return e.onClick=function(){I.value||C.setValue(!1)},function(){return e.destroy()}}),"collect-onClick"))})),I.subscribe((function(e){var t;return null==(t=O.value)?void 0:t.setReadonly(e)})),this._darkMode$.subscribe((function(e){var t;null==(t=O.value)||t.setDarkMode(e)}));var R=function(){var e;if(null!=(e=O.value)&&e.$collector){var n=O.value.$collector.getBoundingClientRect(),r=n.x,i=n.y,o=n.width,a=n.height,s=t.root.getBoundingClientRect();return{x:r-s.x,y:i-s.y,width:o,height:a}}},L=M(C.value?R():void 0);L.subscribe((function(e,n,r){t.boxes.forEach((function(t){t.setCollectorRect(e,r)}))})),C.subscribe((function(e,n,r){var i,o;null==(i=O.value)||i.setVisible(e),e&&null!=(o=O.value)&&o.$collector&&L.setValue(R()),t.boxes.forEach((function(t){return t.setMinimized(e,r)})),r||t.events.emit(wi.Minimized,e)}));var j=this.wrapClassName("titlebar-icon-close"),B=function(e){var n;if(!I.value){var r=e.target;if(r.tagName)for(var i=r;i;i=i.parentElement){if(i.classList&&i.classList.contains(j))return;var o=null==(n=i.dataset)?void 0:n.teleBoxID;if(o){var a=t.getBox(o);if(a)return t.focusBox(a),void t.makeBoxTop(a)}}}};this._sideEffect.addEventListener(window,"mousedown",B,!0),this._sideEffect.addEventListener(window,"touchstart",B,!0),this.maxTitleBar=new Ei({darkMode:this.darkMode,readonly:I.value,namespace:this.namespace,state:k.value,boxes:this.boxes$.value,containerRect:P.value,onEvent:function(e){switch(e.type){case Jr.Maximize:N.setValue(!N.value);break;case Jr.Minimize:C.setValue(!0);break;case qr.Close:t.removeTopBox(),t.focusTopBox()}}}),I.subscribe((function(e){return t.maxTitleBar.setReadonly(e)})),this._darkMode$.subscribe((function(e){t.maxTitleBar.setDarkMode(e)})),this.boxes$.reaction((function(e){t.maxTitleBar.setBoxes(e)})),ui(this,{prefersColorScheme:A,containerRect:P,collector:O,collectorRect:L,readonly:I,fence:D,minimized:C,maximized:N}),this._state$=k,this.root.appendChild(this.maxTitleBar.render())}return x(e,[{key:"setState",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];switch(e){case Zr.Maximized:this.setMinimized(!1,t),this.setMaximized(!0,t);break;case Zr.Minimized:this.setMinimized(!0,t),this.setMaximized(!1,t);break;default:this.setMinimized(!1,t),this.setMaximized(!1,t)}return this}},{key:"create",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=new xi(yn(gn({zIndex:this.topBox?this.topBox.zIndex+1:100},n?this.smartPosition(t):t),{darkMode:this.darkMode,prefersColorScheme:this.prefersColorScheme,maximized:this.maximized,minimized:this.minimized,fence:this.fence,namespace:this.namespace,containerRect:this.containerRect,readonly:this.readonly,collectorRect:this.collectorRect}));return r.mount(this.root),r.focus&&(this.focusBox(r),n&&this.makeBoxTop(r)),this.boxes$.setValue([].concat(a(this.boxes),[r])),r._delegateEvents.on(Jr.Maximize,(function(){e.setMaximized(!e.maximized)})),r._delegateEvents.on(Jr.Minimize,(function(){e.setMinimized(!0)})),r._delegateEvents.on(Jr.Close,(function(){e.remove(r),e.focusTopBox()})),r._coord$.reaction((function(t,n,i){i||e.events.emit(wi.Move,r)})),r._size$.reaction((function(t,n,i){i||e.events.emit(wi.Resize,r)})),r._intrinsicCoord$.reaction((function(t,n,i){i||e.events.emit(wi.IntrinsicMove,r)})),r._intrinsicSize$.reaction((function(t,n,i){i||e.events.emit(wi.IntrinsicResize,r)})),r._visualSize$.reaction((function(t,n,i){i||e.events.emit(wi.VisualResize,r)})),r._zIndex$.reaction((function(t,n,i){if(e.boxes.length>0){var o=e.boxes.reduce((function(e,t){return e.zIndex>t.zIndex?e:t}));e.topBox$.setValue(o)}i||e.events.emit(wi.ZIndex,r)})),this.events.emit(wi.Created,r),r}},{key:"query",value:function(e){return e?this.boxes.filter(this.teleBoxMatcher(e)):a(this.boxes)}},{key:"queryOne",value:function(e){return e?this.boxes.find(this.teleBoxMatcher(e)):this.boxes[0]}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.boxes.find((function(t){return t.id===e}));if(r)return this.updateBox(r,t,n)}},{key:"updateAll",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.boxes.forEach((function(r){t.updateBox(r,e,n)}))}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getBoxIndex(e);if(n>=0){var r=this.boxes.slice(),i=r.splice(n,1);return this.boxes$.setValue(r),i.forEach((function(e){return e.destroy()})),t||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(wi.Removed,i)),i[0]}}},{key:"removeTopBox",value:function(){if(this.topBox)return this.remove(this.topBox)}},{key:"removeAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.boxes$.value;return this.boxes$.setValue([]),t.forEach((function(e){return e.destroy()})),e||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(wi.Removed,t)),t}},{key:"destroy",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.events.removeAllListeners(),this._sideEffect.flushAll(),this.removeAll(t),Object.keys(this).forEach((function(t){var n=e[t];n instanceof si&&n.destroy()}))}},{key:"wrapClassName",value:function(e){return"".concat(this.namespace,"-").concat(e)}},{key:"focusBox",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.getBox(e);r&&(this.boxes.forEach((function(e){if(r===e){var i=!1;r.focus||(i=!0,r.setFocus(!0,n)),i&&!n&&t.events.emit(wi.Focused,r)}else e.focus&&t.blurBox(e,n)})),this.maxTitleBar.focusBox(r))}},{key:"focusTopBox",value:function(){if(this.topBox&&!this.topBox.focus)return this.focusBox(this.topBox)}},{key:"blurBox",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getBox(e);n&&(n.focus&&(n.setFocus(!1,t),t||this.events.emit(wi.Blurred,n)),this.maxTitleBar.focusedBox===n&&this.maxTitleBar.focusBox())}},{key:"blurAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.boxes.forEach((function(n){n.focus&&(n.setFocus(!1,t),t||e.events.emit(wi.Blurred,n))})),this.maxTitleBar.focusedBox&&this.maxTitleBar.focusBox()}},{key:"teleBoxMatcher",value:function(e){var t=Object.keys(e);return function(n){return t.every((function(t){return e[t]===n[t]}))}}},{key:"updateBox",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(null!=t.x||null!=t.y)&&e.move(null==t.x?e.intrinsicX:t.x,null==t.y?e.intrinsicY:t.y,n),(null!=t.width||null!=t.height)&&e.resize(null==t.width?e.intrinsicWidth:t.width,null==t.height?e.intrinsicHeight:t.height,n),null!=t.title&&(e.setTitle(t.title),this.maxTitleBar.updateTitles()),null!=t.visible&&e.setVisible(t.visible,n),null!=t.minHeight&&e.setMinHeight(t.minHeight,n),null!=t.minWidth&&e.setMinWidth(t.minWidth,n),null!=t.resizable&&e.setResizable(t.resizable,n),null!=t.draggable&&e.setDraggable(t.draggable,n),null!=t.fixRatio&&e.setFixRatio(t.fixRatio,n),null!=t.zIndex&&e.setZIndex(t.zIndex,n),null!=t.content&&e.mountContent(t.content),null!=t.footer&&e.mountFooter(t.footer)}},{key:"smartPosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.x,n=e.y,r=e.width,i=void 0===r?.5:r,o=e.height,a=void 0===o?.5:o;if(null==t){var s=20;this.topBox&&((s=this.topBox.intrinsicX*this.containerRect.width+20)>this.containerRect.width-i*this.containerRect.width&&(s=20)),t=s/this.containerRect.width}if(null==n){var u=20;this.topBox&&((u=this.topBox.intrinsicY*this.containerRect.height+20)>this.containerRect.height-a*this.containerRect.height&&(u=20)),n=u/this.containerRect.height}return yn(gn({},e),{x:t,y:n,width:i,height:a})}},{key:"makeBoxTop",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.topBox&&e!==this.topBox&&e.setZIndex(this.topBox.zIndex+1,t)}},{key:"getBoxIndex",value:function(e){return"string"==typeof e?this.boxes.findIndex((function(t){return t.id===e})):this.boxes.findIndex((function(t){return t===e}))}},{key:"getBox",value:function(e){return"string"==typeof e?this.boxes.find((function(t){return t.id===e})):e}},{key:"boxes",get:function(){return this.boxes$.value}},{key:"topBox",get:function(){return this.topBox$.value}},{key:"darkMode",get:function(){return this._darkMode$.value}},{key:"state",get:function(){return this._state$.value}}]),e}(),Ii=function(){function e(t,n){var r=this;y(this,e),this.context=t,this.createTeleBoxManagerConfig=n;var i=t.emitter,o=t.callbacks,a=t.boxEmitter;this.teleBoxManager=this.setupBoxManager(n),this.teleBoxManager._state$.reaction((function(e){o.emit("boxStateChange",e),i.emit("boxStateChange",e)})),this.teleBoxManager._darkMode$.reaction((function(e){o.emit("darkModeChange",e)})),this.teleBoxManager._prefersColorScheme$.reaction((function(e){o.emit("prefersColorSchemeChange",e)})),this.teleBoxManager._minimized$.reaction((function(e){e||setTimeout((function(){var e=.001*(Math.random()>.5?1:-1);r.teleBoxManager.boxes.forEach((function(t){t.resize(t.intrinsicWidth+e,t.intrinsicHeight+e,!0)}))}),400)})),this.teleBoxManager.events.on("minimized",(function(e){if(r.context.safeSetAttributes({minimized:e}),e)r.context.cleanFocus(),r.blurAllBox();else{var t=r.getTopBox();t&&(r.context.setAppFocus(t.id),r.focusBox({appId:t.id},!1))}})),this.teleBoxManager.events.on("maximized",(function(e){r.context.safeSetAttributes({maximized:e})})),this.teleBoxManager.events.on("removed",(function(e){e.forEach((function(e){a.emit("close",{appId:e.id})}))})),this.teleBoxManager.events.on("intrinsic_move",j.debounce((function(e){a.emit("move",{appId:e.id,x:e.intrinsicX,y:e.intrinsicY})}),50)),this.teleBoxManager.events.on("intrinsic_resize",j.debounce((function(e){a.emit("resize",{appId:e.id,width:e.intrinsicWidth,height:e.intrinsicHeight})}),200)),this.teleBoxManager.events.on("focused",(function(e){e&&(r.canOperate?a.emit("focus",{appId:e.id}):r.teleBoxManager.blurBox(e.id))})),this.teleBoxManager.events.on("z_index",(function(e){r.context.updateAppState(e.id,$.ZIndex,e.zIndex)})),i.on("playgroundSizeChange",(function(){return r.updateManagerRect()})),i.on("updateManagerRect",(function(){return r.updateManagerRect()}))}return x(e,[{key:"createBox",value:function(e){var t,n,r;if(this.teleBoxManager){var i=null!=(t=e.app.config)?t:{},o=i.minwidth,a=void 0===o?.4722222222222222:o,s=i.minheight,u=void 0===s?.4722222222222222:s,l=null!=(n=e.app.config)?n:{},c=l.width,h=l.height,d=(null==(r=e.options)?void 0:r.title)||e.appId,f=this.teleBoxManager.containerRect;a>1&&(a/=f.width),u>1&&(u/=f.height);var p={title:d,minWidth:a,minHeight:u,width:c,height:h,id:e.appId};this.teleBoxManager.create(p,e.smartPosition),this.context.emitter.emit("".concat(e.appId).concat(q.WindowCreated))}}},{key:"setBoxInitState",value:function(e){var t=this.teleBoxManager.queryOne({id:e});t&&t.state===Zr.Maximized&&this.context.boxEmitter.emit("resize",{appId:e,x:t.x,y:t.y,width:t.intrinsicWidth,height:t.intrinsicHeight})}},{key:"setupBoxManager",value:function(e){var t=Cb.wrapper?Cb.wrapper:document.body,n=t.getBoundingClientRect(),r={root:t,containerRect:{x:0,y:0,width:n.width,height:n.height},fence:!1,prefersColorScheme:null==e?void 0:e.prefersColorScheme},i=new Ai(r);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=i;var o=(null==e?void 0:e.collectorContainer)||Cb.wrapper;return o&&this.setCollectorContainer(o),i}},{key:"setCollectorContainer",value:function(e){var t,n=new Ti({styles:null==(t=this.createTeleBoxManagerConfig)?void 0:t.collectorStyles}).mount(e);this.teleBoxManager.setCollector(n)}},{key:"getBox",value:function(e){return this.teleBoxManager.queryOne({id:e})}},{key:"closeBox",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.teleBoxManager.remove(e,t)}},{key:"boxIsFocus",value:function(e){var t=this.getBox(e);return null==t?void 0:t.focus}},{key:"getFocusBox",value:function(){return this.teleBoxManager.query({focus:!0})[0]}},{key:"getTopBox",value:function(){return this.teleBoxManager.topBox}},{key:"updateBoxState",value:function(e){var t=this;if(e){var n=this.getBox(e.id);n&&(this.teleBoxManager.update(n.id,{x:e.x,y:e.y,width:e.width||.5,height:e.height||.5,zIndex:e.zIndex},!0),setTimeout((function(){e.focus&&t.teleBoxManager.focusBox(n.id,!0),null!=e.maximized&&t.teleBoxManager.setMaximized(Boolean(e.maximized),!0),null!=e.minimized&&t.teleBoxManager.setMinimized(Boolean(e.minimized),!0)}),50),this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}}},{key:"updateManagerRect",value:function(){var e,t=null==(e=this.mainView.divElement)?void 0:e.getBoundingClientRect();if(t&&t.width>0&&t.height>0){var n={x:0,y:0,width:t.width,height:t.height};this.teleBoxManager.setContainerRect(n),this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect)}}},{key:"moveBox",value:function(e){var t=e.appId,n=e.x,r=e.y;this.teleBoxManager.update(t,{x:n,y:r},!0)}},{key:"focusBox",value:function(e){var t=e.appId,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.teleBoxManager.focusBox(t,n)}},{key:"resizeBox",value:function(e){var t=e.appId,n=e.width,r=e.height,i=e.skipUpdate;this.teleBoxManager.update(t,{width:n,height:r},i)}},{key:"setBoxMinSize",value:function(e){this.teleBoxManager.update(e.appId,{minWidth:e.minWidth,minHeight:e.minHeight},!0)}},{key:"setBoxTitle",value:function(e){this.teleBoxManager.update(e.appId,{title:e.title},!0)}},{key:"blurAllBox",value:function(){this.teleBoxManager.blurAll()}},{key:"updateAll",value:function(e){this.teleBoxManager.updateAll(e)}},{key:"setMaximized",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e!==this.maximized&&this.teleBoxManager.setMaximized(e,t)}},{key:"setMinimized",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.teleBoxManager.setMinimized(e,t)}},{key:"focusTopBox",value:function(){if(this.teleBoxManager.query().length>=1){var e=this.getTopBox();e&&this.focusBox({appId:e.id},!1)}}},{key:"updateBox",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.teleBoxManager.update(e,t,n)}},{key:"setReadonly",value:function(e){this.teleBoxManager.setReadonly(e)}},{key:"setPrefersColorScheme",value:function(e){this.teleBoxManager.setPrefersColorScheme(e)}},{key:"setZIndex",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.teleBoxManager.update(e,{zIndex:t},n)}},{key:"destroy",value:function(){this.teleBoxManager.destroy()}},{key:"mainView",get:function(){return this.context.getMainView()}},{key:"canOperate",get:function(){return this.context.canOperate()}},{key:"boxState",get:function(){return this.teleBoxManager.state}},{key:"maximized",get:function(){return this.teleBoxManager.maximized}},{key:"minimized",get:function(){return this.teleBoxManager.minimized}},{key:"darkMode",get:function(){return this.teleBoxManager.darkMode}},{key:"prefersColorScheme",get:function(){return this.teleBoxManager.prefersColorScheme}},{key:"boxSize",get:function(){return this.teleBoxManager.boxes.length}}]),e}();function Ci(){}function Ni(e){return e()}function ki(){return Object.create(null)}function Di(e){e.forEach(Ni)}function Pi(e){return"function"==typeof e}function Oi(e,t){return e!=e?t==t:e!==t||e&&"object"==_(e)||"function"==typeof e}function Ri(e,t){return Mi||(Mi=document.createElement("a")),Mi.href=t,e===Mi.href}function Li(e,t){e.appendChild(t)}function ji(e,t,n){e.insertBefore(t,n||null)}function Bi(e){e.parentNode.removeChild(e)}function Ui(e){return document.createElement(e)}function Fi(e){return document.createTextNode(e)}function zi(){return Fi(" ")}function Gi(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Hi(e){return Array.from(e.childNodes)}function Vi(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function Wi(e,t,n,r){null===n?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Yi(e){Si=e}var Xi=[],Qi=[],Zi=[],qi=[],Ji=Promise.resolve(),Ki=!1;function $i(e){Zi.push(e)}var eo=new Set,to=0;function no(){var e=Si;do{for(;to7&&void 0!==arguments[7]?arguments[7]:[-1],u=Si;Yi(e);var l=e.$$={fragment:null,ctx:null,props:o,update:Ci,not_equal:i,bound:ki(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:ki(),dirty:s,skip_bound:!1,root:t.target||u.$$.root};a&&a(l.root);var c=!1;if(l.ctx=n?n(e,t.props||{},(function(t,n){var r=!(arguments.length<=2)&&arguments.length-2?arguments.length<=2?void 0:arguments[2]:n;return l.ctx&&i(l.ctx[t],l.ctx[t]=r)&&(!l.skip_bound&&l.bound[t]&&l.bound[t](r),c&&so(e,t)),n})):[],l.update(),c=!0,Di(l.before_update),l.fragment=!!r&&r(l.ctx),t.target){if(t.hydrate){var h=Hi(t.target);l.fragment&&l.fragment.l(h),h.forEach(Bi)}else l.fragment&&l.fragment.c();t.intro&&oo(e.$$.fragment),ao(e,t.target,t.anchor,t.customElement),no()}Yi(u)}(c(r=t.call(this)),e,po,fo,Oi,{cursorName:0,tagName:1,backgroundColor:2,appliance:3,x:4,y:5,src:6,visible:19,avatar:7,theme:8,color:9,cursorTagBackgroundColor:10,opacity:11,pencilEraserSize:20}),r}return n}(uo),mo=function(){function e(t,n,r,i){var o=this;y(this,e),this.manager=t,this.memberId=n,this.cursorManager=r,this.wrapper=i,this.move=function(e){var t;if("main"===e.type){var n=o.cursorManager.wrapperRect;o.component&&n&&(o.autoHidden(),o.moveCursor(e,n,o.manager.mainView))}else{var r=o.cursorManager.focusView,i=null==(t=null==r?void 0:r.divElement)?void 0:t.getBoundingClientRect(),a=null==r?void 0:r.camera;r&&i&&a&&o.component&&(o.autoHidden(),o.moveCursor(e,i,r))}},this.leave=function(){o.hide()},this.updateMember(),this.createCursor(),this.autoHidden()}var t;return x(e,[{key:"moveCursor",value:function(e,t,n){var r,i,o=e.x,a=e.y,s=e.type,u=null==n?void 0:n.screen.convertPointToScreen(o,a);if(u){var l=u.x-2,c=u.y-18;if("app"===s){var h=this.cursorManager.wrapperRect;h&&(l=l+t.x-h.x,c=c+t.y-h.y)}u.x<0||u.x>t.width||u.y<0||u.y>t.height?null==(r=this.component)||r.$set({visible:!1,x:l,y:c}):null==(i=this.component)||i.$set({visible:!0,x:l,y:c})}}},{key:"autoHidden",value:function(){var e=this;this.timer&&clearTimeout(this.timer),this.timer=window.setTimeout((function(){e.hide()}),1e4)}},{key:"createCursor",value:(t=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.member&&this.wrapper&&(this.component=new vo({target:this.wrapper,props:this.initProps()}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"initProps",value:function(){var e;return{x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName,pencilEraserSize:null==(e=this.member)?void 0:e.memberState.pencilEraserSize}}},{key:"getIcon",value:function(){var e;if(this.member){var t=this.cursorManager.applianceIcons,n=t[B.ApplianceNames.shape];if(this.memberApplianceName===B.ApplianceNames.pencilEraser){var r=(null==(e=this.member)?void 0:e.memberState.pencilEraserSize)||1;n=t["".concat(this.memberApplianceName).concat(r)]}else n=t[this.memberApplianceName||B.ApplianceNames.shape];return n||t[B.ApplianceNames.shape]}}},{key:"updateMember",value:function(){return this.member=dt(this.manager.room,this.memberId),this.updateComponent(),this.member}},{key:"updateComponent",value:function(){var e;null==(e=this.component)||e.$set(j.omit(this.initProps(),["x","y"]))}},{key:"destroy",value:function(){this.component&&this.component.$destroy(),this.cursorManager.cursorInstances.delete(this.memberId),this.timer&&clearTimeout(this.timer)}},{key:"hide",value:function(){this.component&&(this.component.$set({visible:!1}),this.destroy())}},{key:"memberApplianceName",get:function(){var e,t;return null==(t=null==(e=this.member)?void 0:e.memberState)?void 0:t.currentApplianceName}},{key:"memberColor",get:function(){var e,t;return"rgb(".concat(null==(t=null==(e=this.member)?void 0:e.memberState)?void 0:t.strokeColor.join(","),")")}},{key:"payload",get:function(){var e;return null==(e=this.member)?void 0:e.payload}},{key:"memberCursorName",get:function(){var e,t;return(null==(e=this.payload)?void 0:e.nickName)||(null==(t=this.payload)?void 0:t.cursorName)||this.memberId}},{key:"memberTheme",get:function(){var e;return null!=(e=this.payload)&&e.theme?"netless-window-manager-cursor-inner-mellow":"netless-window-manager-cursor-inner"}},{key:"memberCursorTextColor",get:function(){var e;return(null==(e=this.payload)?void 0:e.cursorTextColor)||"#FFFFFF"}},{key:"memberCursorTagBackgroundColor",get:function(){var e;return(null==(e=this.payload)?void 0:e.cursorTagBackgroundColor)||this.memberColor}},{key:"memberAvatar",get:function(){var e;return null==(e=this.payload)?void 0:e.avatar}},{key:"memberOpacity",get:function(){return this.memberCursorName||this.memberAvatar?1:0}},{key:"memberTagName",get:function(){var e;return null==(e=this.payload)?void 0:e.cursorTagName}}]),e}(),go=(w(r={},B.ApplianceNames.pencil,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYISURBVHgB7ZpNSCtXFIBPEuvz+dMGpYUKD/sWFX+Qti6kK7Hqpm6e9q0rIoIUFUShPLV10VZx4+JZqa9v20LBhdq9fyBUCtKNPH8qYl2IOw3G38Rkek4y15y5uTOZJDOWggcOSSYzN/ebc+45554JwIM8iBCPyTEP+86T4vyMfsRN4b+nQTKIJp0vzuGvlpID7os8EQNEIBD4oKio6Bm9DwaDv/v9/n/076JgbtWUYPchwrW8qD7UnOvr6wFNkpubm+/wu7f0c7y6mrnlvQufxB0Iau7V1dX3BDA/P6/V1dVpzc3N2uLiIofK1c8VYHys/wRKBUN3/hGHqaysNOjc3FwMis6hc0FtLTHuvYLxCCZgci8uLn4wg5Gh6Fy8Jk+/NkcCAlAAuUkoW4g0B+d5tLS05O/r67O8eGxsDNra2uDy8nKsoKCAwCIQDxQa0yTxgrvCYXyTk5Ml+Orf2dlJeeHIyAigFSE/P38ELfUNqNdSkjgF5FF89jL1TU1NlQwODl5gZPujp6cHWltbUw7Koc7Pz8mkZpHPFeFrJuZeqLnoMoPoZqe0JjDP/IZgnyLUG/o8NDRkuo5Ua2pjY6MC4oFCFf1cA0oKzRSOp6enRfTaGh0d/QxBt+1CUVgnOTs7+xrHfQzGyOcKkK3QTJMnQffZ6e/v/xwttmsHqqmpKXbdycnJCxy7ABLh3FEgVZ6hZJhnFZoFFMF0d3c/w7v+dyookXBnZ2c/xvHfhriVcvXfdBRItsxjnOhYqjwjoAimq6vrCysoGofk+Ph4Esd/F/UdiFtJAGUd2DygTpp5dmBUUJ2dnc9VUALm8PDwJY7/BPU9VD8k3M4RC6kskxZMKigKIMLN9vf3p3H8DyWgfEhEOwOQD9IXOTz7EObbwsLC4YWFBRgeHrY9ECXYo6MjaGlpKWlsbPxkYGDgRW1tbSEWquVlZWXBzc3Nl1VVVa8hXiXc6ioqBqGaPDk7AACJTRZ3NS9lcUp86cJwoSQ7Pj4Op6enfxUXF3/V0NCQv7q6GsCvwrqGUG/01xAD4+VQTOxaSF43d5bBOisrGBJRCtXX17+/trb268rKSgASFgmz97KFkmo6OztWuVyPweiWGc4WRkhFRQVEIpHg8vJyQAIQVlLBROVxvBYQHsXnO8tk62ZcyN0wecLBwcEvYHSzEPscBqOLCRhLC4n9uqaA8UAWAcAKhtbQ3t7eTHl5+Y9gtAp3twhT056CDMQ7MRzIFTeTYKb1yYYVQFH9VdzsqNmYKpfTJBDX3Ixgdnd3XyHMT2AMALJlBBSPaMpNngrIsTyTCgaj288YDGakictrxizvKFNOjgSSBLS+vv6UYHDb7DgMVgsChjTEgCIKGG4ZU+EWkgNBzN1qamq+pAMTExPgFMzW1tZrhHkFyWE5KxgSszx0527RaDRmOSpRshEOU11dPQPG8CwHARHJlMnTSrwSRFIlfXt7m3V5ngJGuJtqzaQtZkFBVNJezN5ZAdmwjKo2k9tVtrcI3OXk4tPgcg7ChCDZ1URgMOu72Xa5VFHOkymQhWVU60YVmjN6wiC7k6p+S1syCACOwJBYFaexV+yhBekNPsMBO6KAEeE4BMaCU67RsoYhSbXgaT//ht709vZCaWmp6YkEbLFmVJWzas04+iBL7EKpm0J7duqu0B7+CTUpNJuyvb1NCfMj1CqI9wLKUOlOUMeG+gGFkHii4HizUF4z/KFUrPsJ8WbEIyx7nnZ0dDynME6BAuce09iFHo+GrnmGltltb2//E4wVAN82y7vOjKOZXSBhJdHNiT3TYWD8OY2PTUJkdd7MkJMnT5wZVQF2RFX6yBMUdzPMvvfqxz3sXHF+GNT9ANXit/10O1sgHkZvdQAOKvs9B5L7ARELGAAXLSTvM8QExTE+YbHe+HURhZp1aRyF4CJXClbbWwGketgkW9VsY+YaiBCVhfgE+XvxRwgZSM4jUVCDZFQ9pytmXR8hUTB2gnidx4XffVWydN0yQjwmx/jkAZJBrIBI5J7ZvQGZWUgVSuU/EqmOAzicKNMVu816DdRWUV1/7xAP8n+SfwF3Du3NF2sYhwAAAABJRU5ErkJggg=="),w(r,B.ApplianceNames.selector,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAxCAYAAABznEEcAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAZoSURBVHgB7VlLSCRXFL3ljNEhEXTGhMQJmOjCz8ZNVLKICz9xIYhCNi7UgINkGEk2En8hW5cBUQNxo05GAoKikuCAmvGzGMdPcCUGjDPxD/4Vv/3JvWW97luvq7ur+hMZ8MKlqrteNfe8e965970GuLVbC5kpJr53+hjHx9yY3TUxJgLMAQG4ITARfp5T4Mri4uL9q6urnxwOxz/oY5eXl1/Pzs7e195X2FX4jZsIhAK7gx5ps9m6nGj9/f3OtbU1pzAE0318fPwVjYHrrN7R3AjU/wpOBwA9Cmf/9ejoqDMtLU31iooKGdA+ATo4OMiXAEWAHhBAGEApXj4rPAik0vPt7e0vCgoKPH4gMzMTSktLIS8vD2JiYgABvcHMTZyennbHxsaOg3udOJmLzwqEYB0ZgRCZENm4u7e39yQuLq65srISZmZmvP5Ybm4u5OfnQ0lJyXWUCAgzNLS+vt6SnJz8WgvYwV5xSlcRgyVg3ha2Dkxzc3MvfZmVlQW+bGxsDBobGyE7O1u94uJPjIqKqklKSvrbbrfPnp+ff7e8vJwMnlSTKWfJjDKhywJo6wLp0YcZ+dyIUr7s4cOHLsrRlQwBTSBFuzc2NiZYhjjVAIyzZBqEwgCQv0OOM/gNzuiP/ijlDxBRjgClpqa6AF1cXDydmpoaLCws3JcAGYHyC4JMzoKaibKysvienp6FtrY2IA/WCFB5ebkqCHSvARo8Ozt7igIxwIJ2gJ+seFMnDoIyEUV+dHT0G3qWVUr5M043DdAB0m2IKZwAYpgZX+qkywR6NFbuR0iDxmAoZRUQKRxSLTMnJ8eIaqqSeVMnIYUOdu+sq6vrp4f+VCoYo8khZaNs01VRlERUu2/BrWAA7sl2Anink1Ao18JGjyY/PDx8hq1GZqgp5c2mp6chMjLy2b179x7hRzvoqeUUwXIzqq4O5nZsNUaEbIbLqPLTou/s7FTvT05OpsA9sXJG1AVsZDwjutqBIN6gUlWjxod8XRBNKXgsrqpqYZfwEqX9h8TExD7wbFm8LmzxHQ0QHSlXKZVSqFC/hkqlaKapTaGgCQTK7PHW1lb/wsLC86KiokkccoV+qV1tcE0pO7AWxmhTxBszDzqRr66ujqanp2cRpQLNBgUsCh8BwQ54bn5+/s+mpqa+4eHhfS1gb52vwuP0trPjhSZCBtLQ0NA3MDDQQIFYAUHBYhuvzjpVbJr1lZWVP3p7e19UVVXNgHumXYrI4uBx6Yqevz02b0FcRQ8CoBQF3dXVpQLZ3d39C7n+ora29vfJyclDYFnWgFyxK3cxhss/+KoT/N6DVkQpKypFGUCp3Ozo6HgSHx//GLW/BwHsg57zl5pzADajwLn52mPL1ZHPloMoRYPMFL6EhAR18e7s7MxVV1fPsAAp4Avteq7dC/c1+wKI4g+EfGzDM+EYHBw8RDrNiA2QL6upqVGvKJ2/gHu2L1nA5wwEB2YDfSYMO1x/px0cgEc2zBY+eo67u6H29vZ/wU2VC8l58JxKNjDOgojNEp08aFVfX++3l6JMEdDx8fEB0FNIBsDXBc8ArwuW1EkeI1RKdLWmCx+1DhkZGRvR0dFfSsHKxYtnW0iqvJAN9xNm6MR/QO5sfapUSkqKmqW5ubmfwVgyZdpw/vPZl2kUEAinBMSUStG+gwra0NDQSynQKyloIxnlewafjDFLJzLRBJqiFMnqyMgIbG5uDuD996Dnv8iAPOMAPmbcm5lVJwA/vZRMKZGZlpaWVtAvUL4GZMqE1fjRJrUd76LHoX+InlhcXPwZnWW2tra6jjrpiBM3UK/weQr6J+gfodMh9HtwncG7YLA3CMSsLmxx5WuDCt8B7vZeicInTjCWlpb6wc15mfey7oc9E8LElpVmMgb9AXoC+qcTExOPKRu4NlTHs6Q10GfhgfYOvRsJQZ76BWMKuDtaolQs+gfoH6Mn436gDg+e+5BKXUQx/C5Je/a+NpbeiQJPKgUdlNXx/BCBKxVdxW5Q0I3XBqFKRhU4KLtjYawi3csuTKdc4FnIXNvKUJkVEGRG20QZAAUpA5DbaYAQLmQzfzxyk/ffdnCD4NWVnGdE7kQBQvQHC5lVEDxgMaM29lkxGCNLKrDnIbFAMkFmBIaDkHstU41coGZ1TZD5UjReCGUAYbNgdNqoXZB/T67yYbFAMiGML3BhYeH8rb0t9h/zgcTBcTNGiQAAAABJRU5ErkJggg=="),w(r,B.ApplianceNames.eraser,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAgrSURBVHgB7ZprTBRXFIDP7gIt8lQppTwE5V0KaAn6o1pqNGkDDTEmTUhsgKRp+gNJw68CFkLbVC2QkDS+gD8KJdWmARvbFBNNWpuIRGPFWBXQRMPDqIki+KLATs+ZnTvcvXtnX8w2beJJToaduTP3fHPOPffcOwC8kP+2WCDwIvahGFxTuN8KmNSZmULPNjLeqF9F8rdPkIEGEn+r+vjx46LQ0NA8/Dsader58+e/h4WFDWntFO7ot6fMFAt3JLWi2lCDpqamCux2+2+KROj82NhYGrXT2lu5Z/DP/deFByElA4Pv3LlTiHY/nJ6eVnbv3q1s2bJFyc7OVrZu3arU1dUp4+PjxPUQoT+g9tp9PkMFgpo9kxljHRoaWp2Xl3duYmIiurKyEvDoclNCQgIcPnxYPc7MzHwcGRnZhaft4Ag7O9fUbRhaITCie4lgcnNzT7qDIaHz27dvh+vXr0NEREQneqoCHKFnAR+8ZCaQGGq2CxcurCGYycnJZHcwTNAzUFFRoUJFRUV1IFQ5OKBsXB9uxSwgl0TQ3d29Yt26dccwoyVXV1d7hGEiQmGi2AzOUHx/hob4K2yuYS9G987s7OwPISEh7xPM6dOnwVfBsIMjR45AZmbmo5s3b76Xnp7+J55egMVxBSAZT0v1ED+76yn66dOnLQSzd+9ev2BIyFP0MjBco1JTU/sxfFeDazp3cYgZHmKqdoaGNISHh9fv378fSJcqlPV6e3sBJ+I/goOD34VFL0k95Y+HxPHCYGxmw5DQ2NuzZw8EBQVtunXr1jvgwUP+hhz/QDXMMCNVE8zx48dNg2FCz6QQjI2N/RA8VBFmANnu3btXihnpG8pM9fX1EAi5du0aeWkVOAMBCF7yN+R0z4yOjq6NiYlpp9CgdBtIwXpPH6vgDKWLt0CygtM6MDCwBuUYZSKaOCksAiVY9wFOBePgDOOytPAGSKzNVCCC2bBhw69YdK7ypgpYimzbtk2dl7CM+hFcveOUHDylbTFO1YdhFbByx44dA1QFUP0VSJj4+Hjo6+sDq9U6iEmHKvFZTedQ50GYbN15SITVlwNlZWUnLRZL8s6dOwMOQ9UCTtKTra2ttdppt9V2kMF5cbmsjxuM43bMNrmUzc6fP6+GQiDGDoOJi4ubwb4qm5ubafyIE6nLxGqTPEsGo1cBOGNX0TyDYafC0CyOaxcVziyh53Z2dkJycvLMvn37PmpoaBgFR4jxYSbWdVIgI89Iq4CjR48CZjlYv369+tssqI6ODsjPz4f+/v668vLycxrEHHfkYdwC8SB6mGEV8Cl64cuuri5oa2tTG+EyGjZu3AiXLl1qefDgwV8lJSUFZkDV1tZCcXExXLx4sbWoqKgPFj0zx8GI9ZwO5W4M6ekZYeqpaqbqmaSqqkpNpcPDw4dwzfM9nrLduHEjEs+X0XV/Sx96LnqE1kLtBQUF3eDwCO8dGQyzV5rl+JyuegfXI29jRotiRlKnpFghHMzKyjqotVXS0tLacKPjF3bdHxjSq1evduAkepAD+ZsDYlC8V5w8ZBVg+PPq2MGMlkInqE4joTf45MmT4YyMjAPcA+ltLSQlJX2BafxnX6HI29QeK44TOTk57mCYZ0QoJ8OBM4yB6dkNkwGlSygsLFQvYtYB3BTMxFL+M+0eFgZqp4mJiU2+QKGX1fGIk/QIrn0aYXGsyDxjmAyMhO2jhaCGoUbX1NSkLSwsPMJqV8Fspu6lIZS6OYhjiOLwdU7fQM1HfRPD7wS1obZ0j0xpb4726Z49ezaJf2/S7s9ATUGNR41BjdJseRnke3WGwhrRTS9pD1mOGoeG15BxOOfoxuCkp0Ih6NeaEaSZGlieJyiCoc1FgsGldokGk8nBvAKOrWIGQ5uPsm0tt0BWDiicAaGuGhkZ+YqMw9StGzU4OKhCnT179hNsswY1FTXdE5QEJhc1S3tGogazXLOBwQSBl3tzIhQPtAL1VQJCTcNx8y1vHIUghSKFZE9PT7H2dlM1b+Wgrr1y5Uq77J75+fnplpaWMg2ch4nlYEI5z7hdensDpI4hrYNErcMMXJ32koG4ztf3pultz83NjWG99Ra2WQ0OL2VjZjwgeufUqVOqV8+cOdPIwdBLSNJeHg8TAh5WqJ6EfSmgt7IMNRJ1JThiOlnrOAMHshprmMKdoGSCpb9s3B3SYLIFGIqICJB7xisYi+RvfiypXw40DWGdlJaWRmMd141hk8V2OWm7ieYTXhBc3+BgaZyqAISjOYxSMVvXsBTNlzdiNQDgRao2AtK3pjggpmrqbGpqSsLPIN/dv38/gaBwUjTshMHcvn27JyUlpRmc5xpPMD599LIYnLNyUKKndKjGxsakXbt2deMCLIE8IVvs0YRM1fjdu3d/wrXN5+BcnzEgvor2uN3rjzAYMp5lPEoQlE5fA0fWo8GfhlCbKVFQ1pKNIfzcOHH58mWqaimVUwJI0+6n59D4pIlzmdZPMPiZzXjDjX47Le5g0Uu8x2zgPqWyKpjVe7x3+AUbq9NYjQbgp2dsBud5o8TP7d5kHAWcQchQfoEmLgn8HjOiBIF7o5hI1x6CEbLNP3bdqYAF44JzyWLzcN1i8DcT/o3awbm8Fz3DAy2A62INwPV/E3wWdx5inmBHuwChCBD6R2JwHge80TIQRQLjt7e8DTkGZgfX8cUMZTDAteFDkveaIlzjX9ySQs8X18r2t2VHUURPKoICmDR+eCO9aSdmOIub3/w9RgpgUpiJhvraXpa6jZKHGEqyusw0GLFzX+5RhN/8kYnMSNMMfyH/V/kHST6OYVElTPAAAAAASUVORK5CYII="),w(r,B.ApplianceNames.shape,"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"),w(r,B.ApplianceNames.text,"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="),w(r,B.ApplianceNames.laserPointer,"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"),w(r,"pencilEraser1","data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMjYiIHZpZXdCb3g9IjAgMCAxOCAyNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIxNyIgaGVpZ2h0PSIyNSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K"),w(r,"pencilEraser2","data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMzQiIHZpZXdCb3g9IjAgMCAyNiAzNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIyNSIgaGVpZ2h0PSIzMyIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K"),w(r,"pencilEraser3","data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iNTAiIHZpZXdCb3g9IjAgMCAzNCA1MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIzMyIgaGVpZ2h0PSI0OSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K"),r),yo=function(){function e(t,n,r){var i,o=this;y(this,e),this.manager=t,this.enableCursor=n,this.cursorInstances=new Map,this.sideEffectManager=new F.SideEffectManager,this.store=this.manager.store,this.applianceIcons=go,this.onCursorMove=function(e){var t=o.initCursorInstance(e.uid);if(e.state===ne.Leave)t.leave();else{var n=t.updateMember();o.canMoveCursor(n)&&t.move(e.position)}},this.initCursorInstance=function(e){var t=o.cursorInstances.get(e);return t||(t=new mo(o.manager,e,o,Cb.wrapper),o.cursorInstances.set(e,t)),t},this.mouseMoveListener_=function(e,t){var n=o.getType(e);o.updateCursor(n,e.clientX,e.clientY),t&&o.showPencilEraserIfNeeded(n,e.clientX,e.clientY)},this.mouseMoveTimer=0,this.mouseMoveListener=function(e){var t="touch"===e.pointerType;if(!t||e.isPrimary){var n=Date.now();n-o.mouseMoveTimer>48&&(o.mouseMoveTimer=n,o.mouseMoveListener_(e,t))}},this.mouseLeaveListener=function(){o.hideCursor(o.manager.uid)},this.getPoint=function(e,t,n){var r,i=null==(r=null==e?void 0:e.divElement)?void 0:r.getBoundingClientRect();if(i)return null==e?void 0:e.convertToPointInWorld({x:t-i.x,y:n-i.y})},this.getType=function(e){var t,n=e.target,r=o.manager.focusApp;switch(n.parentElement){case o.mainViewElement:return{type:"main"};case null==(t=null==r?void 0:r.view)?void 0:t.divElement:return{type:"app"};default:return{type:"main"}}},this.roomMembers=null==(i=this.manager.room)?void 0:i.state.roomMembers;var a=Cb.wrapper;a&&this.setupWrapper(a),this.sideEffectManager.add((function(){return ue.on("cursorMove",o.onCursorMove)})),this.sideEffectManager.add((function(){return ue.on("playgroundSizeChange",(function(){return o.updateContainerRect()}))})),r&&(this.applianceIcons=P(P({},go),r))}return x(e,[{key:"canMoveCursor",value:function(e){var t=(null==e?void 0:e.memberState.currentApplianceName)===B.ApplianceNames.laserPointer;return this.enableCursor||t}},{key:"setupWrapper",value:function(e){var t=this;this.sideEffectManager.add((function(){return e.addEventListener("pointerenter",t.mouseMoveListener),e.addEventListener("pointermove",t.mouseMoveListener),e.addEventListener("pointerleave",t.mouseLeaveListener),function(){e.removeEventListener("pointerenter",t.mouseMoveListener),e.removeEventListener("pointermove",t.mouseMoveListener),e.removeEventListener("pointerleave",t.mouseLeaveListener)}})),this.wrapperRect=e.getBoundingClientRect()}},{key:"setMainViewDivElement",value:function(e){this.mainViewElement=e}},{key:"showPencilEraserIfNeeded",value:function(e,t,n){var r=dt(this.manager.room,this.manager.uid),i=(null==r?void 0:r.memberState.currentApplianceName)===B.ApplianceNames.pencilEraser;if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)&&i){var o="main"===e.type?this.manager.mainView:this.focusView,a=this.getPoint(o,t,n);a&&this.onCursorMove({uid:this.manager.uid,position:{x:a.x,y:a.y,type:e.type}})}}},{key:"updateCursor",value:function(e,t,n){var r=dt(this.manager.room,this.manager.uid);if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)){var i="main"===e.type?this.manager.mainView:this.focusView,o=this.getPoint(i,t,n);o&&this.manager.dispatchInternalEvent(q.CursorMove,{uid:this.manager.uid,position:{x:o.x,y:o.y,type:e.type}})}}},{key:"updateContainerRect",value:function(){var e,t;this.containerRect=null==(e=Cb.container)?void 0:e.getBoundingClientRect(),this.wrapperRect=null==(t=Cb.wrapper)?void 0:t.getBoundingClientRect()}},{key:"deleteCursor",value:function(e){this.store.cleanCursor(e);var t=this.cursorInstances.get(e);t&&t.destroy()}},{key:"hideCursor",value:function(e){var t=this.cursorInstances.get(e);t&&t.hide()}},{key:"destroy",value:function(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach((function(e){e.destroy()})),this.cursorInstances.clear())}},{key:"boxState",get:function(){return this.store.getBoxState()}},{key:"focusView",get:function(){var e;return null==(e=this.manager.focusApp)?void 0:e.view}}]),e}(),bo=function(){function e(t){var n=this;y(this,e),this.manager=t,ue.on("changePageState",(function(){ae.emit("pageStateChange",n.toObject())}))}return x(e,[{key:"toObject",value:function(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}},{key:"index",get:function(){return this.manager.store.getMainViewSceneIndex()||0}},{key:"length",get:function(){return this.manager.mainViewScenesLength||0}}]),e}(),xo=function(){function e(t){var n=this;y(this,e),this.ctx=t,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t===B.RoomPhase.Reconnecting&&n.ctx.emitter.emit("startReconnect"),e.t0=t===B.RoomPhase.Connected&&n.phase===B.RoomPhase.Reconnecting,!e.t0){e.next=10;break}if(null==(r=n.room)||!r.isWritable){e.next=7;break}null==(i=n.room)||i.dispatchMagixEvent(K,{}),e.next=10;break;case 7:return e.next=9,ke(500);case 9:n.onReconnected();case 10:n.phase=t;case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.onReconnected=j.debounce((function(){n._onReconnected()}),1e3),this._onReconnected=function(){tt("onReconnected refresh reactors"),n.releaseDisposers(),n.reactors.forEach((function(e,t){j.isFunction(e)&&n.disposers.set(t,e())})),n.ctx.emitter.emit("onReconnected")}}return x(e,[{key:"setRoom",value:function(e){var t=this;this.room=e,this.phase=null==e?void 0:e.phase,e&&(e.callbacks.off("onPhaseChanged",this.onPhaseChanged),e.callbacks.on("onPhaseChanged",this.onPhaseChanged),e.addMagixEventListener(K,(function(n){n.authorId===e.observerId&&t.onReconnected()}),{fireSelfEventAfterCommit:!0}))}},{key:"setContext",value:function(e){this.ctx=e}},{key:"releaseDisposers",value:function(){this.disposers.forEach((function(e){j.isFunction(e)&&e()})),this.disposers.clear()}},{key:"refresh",value:function(){this._onReconnected()}},{key:"add",value:function(e,t){var n=this.disposers.get(e);n&&j.isFunction(n)&&n(),j.isFunction(t)&&(this.reactors.set(e,t),this.disposers.set(e,t()))}},{key:"remove",value:function(e){this.reactors.has(e)&&this.reactors.delete(e);var t=this.disposers.get(e);t&&(j.isFunction(t)&&t(),this.disposers.delete(e))}},{key:"hasReactor",value:function(e){return this.reactors.has(e)}},{key:"destroy",value:function(){var e,t;null==(e=this.room)||e.callbacks.off("onPhaseChanged",this.onPhaseChanged),null==(t=this.room)||t.removeMagixEventListener(K,this.onReconnected),this.releaseDisposers()}}]),e}(),_o=function(e,t){if(B.isPlayer(e))To(e);else{if(e=e,Object.getOwnPropertyDescriptor(e,"disableCameraTransform"))return;Object.defineProperty(e,"disableCameraTransform",{get:function(){return t.mainView.disableCameraTransform},set:function(e){t.mainView.disableCameraTransform=e}}),Object.defineProperty(e,"canUndoSteps",{get:function(){return t.canUndoSteps}}),Object.defineProperty(e,"canRedoSteps",{get:function(){return t.canRedoSteps}}),e.moveCamera=function(e){return t.moveCamera(e)},e.moveCameraToContain=function(){return t.moveCameraToContain.apply(t,arguments)},e.convertToPointInWorld=function(){var e;return(e=t.mainView).convertToPointInWorld.apply(e,arguments)},e.setCameraBound=function(){var e;return(e=t.mainView).setCameraBound.apply(e,arguments)},e.scenePreview=function(){var e;return(e=t.mainView).scenePreview.apply(e,arguments)},e.fillSceneSnapshot=function(){var e;return(e=t.mainView).fillSceneSnapshot.apply(e,arguments)},e.generateScreenshot=function(){var e;return(e=t.mainView).generateScreenshot.apply(e,arguments)},e.setMemberState=function(){var e;return(e=t.mainView).setMemberState.apply(e,arguments)},e.redo=function(){return t.redo()},e.undo=function(){return t.undo()},e.cleanCurrentScene=function(){return t.cleanCurrentScene()},e.delete=function(){return t.delete()},e.copy=function(){return t.copy()},e.paste=function(){return t.paste()},e.duplicate=function(){return t.duplicate()},e.insertImage=function(){return t.insertImage.apply(t,arguments)},e.completeImageUpload=function(){return t.completeImageUpload.apply(t,arguments)},e.insertText=function(){return t.insertText.apply(t,arguments)},e.lockImage=function(){return t.lockImage.apply(t,arguments)},e.lockImages=function(){return t.lockImages.apply(t,arguments)},wo(e,t)}},wo=function(e,t){var n=e.removeScenes;e.removeScenes=function(r,i){var o;r===ie&&(null==(o=t.appManager)||o.updateRootDirRemoving(!0));var a=n.call(e,r);return ue.emit("removeScenes",{scenePath:r,index:i}),a}},To=function(e){var t=e.seekToProgressTime;function n(){return(n=g(regeneratorRuntime.mark((function n(r){var i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,ue.emit("seekStart");case 2:return n.next=4,t.call(e,r);case 4:return i=n.sent,n.abrupt("return",(ue.emit("seek",r),i));case 6:case"end":return n.stop()}}),n)})))).apply(this,arguments)}e.seekToProgressTime=function(e){return n.apply(this,arguments)}},Mo=Object.defineProperty,So=Object.defineProperties,Eo=Object.getOwnPropertyDescriptors,Ao=Object.getOwnPropertySymbols,Io=Object.prototype.hasOwnProperty,Co=Object.prototype.propertyIsEnumerable,No=function(e,t,n){return t in e?Mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ko=function(e,t){for(var n in t||(t={}))Io.call(t,n)&&No(e,n,t[n]);if(Ao){var r,i=T(Ao(t));try{for(i.s();!(r=i.n()).done;){n=r.value;Co.call(t,n)&&No(e,n,t[n])}}catch(e){i.e(e)}finally{i.f()}}return e},Do=function(e,t){return So(e,Eo(t))},Po=function(e,t,n,r){if("length"!==n&&"prototype"!==n&&"arguments"!==n&&"caller"!==n){var i=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);!Oo(i,o)&&r||Object.defineProperty(e,n,o)}},Oo=function(e,t){return void 0===e||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Ro=function(e,t){var n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},Lo=function(e,t){return"/* Wrapped ".concat(e,"*/\n").concat(t)},jo=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Bo=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Uo=function(e,t,n){var r=""===n?"":"with ".concat(n.trim(),"() "),i=Lo.bind(null,r,t.toString());Object.defineProperty(i,"name",Bo),Object.defineProperty(e,"toString",Do(ko({},jo),{value:i}))};function Fo(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.ignoreNonConfigurable,o=void 0!==i&&i,a=e.name,s=T(Reflect.ownKeys(t));try{for(s.s();!(n=s.n()).done;){var u=n.value;Po(e,t,u,o)}}catch(e){s.e(e)}finally{s.f()}return Ro(e,t),Uo(e,t,a),e}var zo="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Go=zo.length,Ho=Array(20),Vo=function(){for(var e=0;e<20;e++)Ho[e]=zo.charAt(Math.random()*Go);return Ho.join("")};function Wo(e){try{return e()}catch(e){console.error(e)}}var Yo,Xo=function(){function e(){y(this,e),this.disposers=new Map}return x(e,[{key:"addDisposer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.genUID();return this.flush(t),this.disposers.set(t,Array.isArray(e)?function(){return e.forEach(Wo)}:e),t}},{key:"add",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.genUID();return this.addDisposer(e(),t)}},{key:"addEventListener",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.genUID();return e.addEventListener(t,n,r),this.addDisposer((function(){return e.removeEventListener(t,n,r)}),i),i}},{key:"setTimeout",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.genUID(),i=window.setTimeout((function(){n.remove(r),e()}),t);return this.addDisposer((function(){return window.clearTimeout(i)}),r)}},{key:"setInterval",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.genUID(),r=window.setInterval(e,t);return this.addDisposer((function(){return window.clearInterval(r)}),n)}},{key:"remove",value:function(e){var t=this.disposers.get(e);return this.disposers.delete(e),t}},{key:"flush",value:function(e){var t=this.remove(e);if(t)try{t()}catch(e){console.error(e)}}},{key:"flushAll",value:function(){this.disposers.forEach(Wo),this.disposers.clear()}},{key:"genUID",value:function(){var e;do{e=Vo()}while(this.disposers.has(e));return e}}]),e}(),Qo=[],Zo="ResizeObserver loop completed with undelivered notifications.";!function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(Yo||(Yo={}));var qo,Jo=function(e){return Object.freeze(e)},Ko=function(e,t){this.inlineSize=e,this.blockSize=t,Jo(this)},$o=function(){function e(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Jo(this)}return e.prototype.toJSON=function(){var e=this;return{x:e.x,y:e.y,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),ea=function(e){return e instanceof SVGElement&&"getBBox"in e},ta=function(e){if(ea(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var i=e,o=i.offsetWidth,a=i.offsetHeight;return!(o||a||e.getClientRects().length)},na=function(e){var t,n;if(e instanceof Element)return!0;var r=null===(n=null===(t=e)||void 0===t?void 0:t.ownerDocument)||void 0===n?void 0:n.defaultView;return!!(r&&e instanceof r.Element)},ra="undefined"!=typeof window?window:{},ia=new WeakMap,oa=/auto|scroll/,aa=/^tb|vertical/,sa=/msie|trident/i.test(ra.navigator&&ra.navigator.userAgent),ua=function(e){return parseFloat(e||"0")},la=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=!1),new Ko((n?t:e)||0,(n?e:t)||0)},ca=Jo({devicePixelContentBoxSize:la(),borderBoxSize:la(),contentBoxSize:la(),contentRect:new $o(0,0,0,0)}),ha=function(e,t){if(void 0===t&&(t=!1),ia.has(e)&&!t)return ia.get(e);if(ta(e))return ia.set(e,ca),ca;var n=getComputedStyle(e),r=ea(e)&&e.ownerSVGElement&&e.getBBox(),i=!sa&&"border-box"===n.boxSizing,o=aa.test(n.writingMode||""),a=!r&&oa.test(n.overflowY||""),s=!r&&oa.test(n.overflowX||""),u=r?0:ua(n.paddingTop),l=r?0:ua(n.paddingRight),c=r?0:ua(n.paddingBottom),h=r?0:ua(n.paddingLeft),d=r?0:ua(n.borderTopWidth),f=r?0:ua(n.borderRightWidth),p=r?0:ua(n.borderBottomWidth),v=h+l,m=u+c,g=(r?0:ua(n.borderLeftWidth))+f,y=d+p,b=s?e.offsetHeight-y-e.clientHeight:0,x=a?e.offsetWidth-g-e.clientWidth:0,_=i?v+g:0,w=i?m+y:0,T=r?r.width:ua(n.width)-_-x,M=r?r.height:ua(n.height)-w-b,S=T+v+x+g,E=M+m+b+y,A=Jo({devicePixelContentBoxSize:la(Math.round(T*devicePixelRatio),Math.round(M*devicePixelRatio),o),borderBoxSize:la(S,E,o),contentBoxSize:la(T,M,o),contentRect:new $o(h,u,T,M)});return ia.set(e,A),A},da=function(e,t,n){var r=ha(e,n),i=r.borderBoxSize,o=r.contentBoxSize,a=r.devicePixelContentBoxSize;switch(t){case Yo.DEVICE_PIXEL_CONTENT_BOX:return a;case Yo.BORDER_BOX:return i;default:return o}},fa=function(e){var t=ha(e);this.target=e,this.contentRect=t.contentRect,this.borderBoxSize=Jo([t.borderBoxSize]),this.contentBoxSize=Jo([t.contentBoxSize]),this.devicePixelContentBoxSize=Jo([t.devicePixelContentBoxSize])},pa=function(e){if(ta(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},va=function(){var e=1/0,t=[];Qo.forEach((function(n){if(0!==n.activeTargets.length){var r=[];n.activeTargets.forEach((function(t){var n=new fa(t.target),i=pa(t.target);r.push(n),t.lastReportedSize=da(t.target,t.observedBox),ie?t.activeTargets.push(n):t.skippedTargets.push(n))}))}))},ga=function(){var e=0;for(ma(e);Qo.some((function(e){return e.activeTargets.length>0}));)e=va(),ma(e);return Qo.some((function(e){return e.skippedTargets.length>0}))&&function(){var e;"function"==typeof ErrorEvent?e=new ErrorEvent("error",{message:Zo}):((e=document.createEvent("Event")).initEvent("error",!1,!1),e.message=Zo),window.dispatchEvent(e)}(),e>0},ya=[],ba=function(e){if(!qo){var t=0,n=document.createTextNode("");new MutationObserver((function(){return ya.splice(0).forEach((function(e){return e()}))})).observe(n,{characterData:!0}),qo=function(){n.textContent=""+(t?t--:t++)}}ya.push(e),qo()},xa=0,_a={attributes:!0,characterData:!0,childList:!0,subtree:!0},wa=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Ta=function(e){return void 0===e&&(e=0),Date.now()+e},Ma=!1,Sa=function(){function e(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return e.prototype.run=function(e){var t=this;if(void 0===e&&(e=250),!Ma){Ma=!0;var n=Ta(e);!function(e){ba((function(){requestAnimationFrame(e)}))}((function(){var r=!1;try{r=ga()}finally{if(Ma=!1,e=n-Ta(),!xa)return;r?t.run(1e3):e>0?t.run(e):t.start()}}))}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var e=this,t=function(){return e.observer&&e.observer.observe(document.body,_a)};document.body?t():ra.addEventListener("DOMContentLoaded",t)},e.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),wa.forEach((function(t){return ra.addEventListener(t,e.listener,!0)})))},e.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),wa.forEach((function(t){return ra.removeEventListener(t,e.listener,!0)})),this.stopped=!0)},e}(),Ea=new Sa,Aa=function(e){!xa&&e>0&&Ea.start(),!(xa+=e)&&Ea.stop()},Ia=function(){function e(e,t){this.target=e,this.observedBox=t||Yo.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var e=da(this.target,this.observedBox,!0);return function(e){return!ea(e)&&!function(e){switch(e.tagName){case"INPUT":if("image"!==e.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(e)&&"inline"===getComputedStyle(e).display}(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},e}(),Ca=function(e,t){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=t},Na=new WeakMap,ka=function(e,t){for(var n=0;n=0&&(i&&Qo.splice(Qo.indexOf(n),1),n.observationTargets.splice(r,1),Aa(-1))},e.disconnect=function(e){var t=this,n=Na.get(e);n.observationTargets.slice().forEach((function(n){return t.unobserve(e,n.target)})),n.activeTargets.splice(0,n.activeTargets.length)},e}(),Pa=function(){function e(e){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof e)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Da.connect(this,e)}return e.prototype.observe=function(e,t){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!na(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Da.observe(this,e,t)},e.prototype.unobserve=function(e){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!na(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Da.unobserve(this,e)},e.prototype.disconnect=function(){Da.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();var Oa="undefined"!=typeof window,Ra=Oa&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),La=Oa&&"IntersectionObserver"in window,ja=Oa&&"classList"in document.createElement("p"),Ba=Oa&&window.devicePixelRatio>1,Ua={elements_selector:".lazy",container:Ra||Oa?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},Fa=function(e){return Object.assign({},Ua,e)},za=function(e,t){var n,r="LazyLoad::Initialized",i=new e(t);try{n=new CustomEvent(r,{detail:{instance:i}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent(r,!1,!1,{instance:i})}window.dispatchEvent(n)},Ga="src",Ha="srcset",Va="sizes",Wa="poster",Ya="llOriginalAttrs",Xa="data",Qa="loading",Za="loaded",qa="applied",Ja="error",Ka="native",$a="data-",es="ll-status",ts=function(e,t){return e.getAttribute($a+t)},ns=function(e){return ts(e,es)},rs=function(e,t){return function(e,t,n){var r=$a+t;null!==n?e.setAttribute(r,n):e.removeAttribute(r)}(e,es,t)},is=function(e){return rs(e,null)},os=function(e){return null===ns(e)},as=function(e){return ns(e)===Ka},ss=[Qa,Za,qa,Ja],us=function(e,t,n,r){if(e){if(void 0!==r)return void e(t,n,r);if(void 0!==n)return void e(t,n);e(t)}},ls=function(e,t){ja?e.classList.add(t):e.className+=(e.className?" ":"")+t},cs=function(e,t){ja?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},hs=function(e){return e.llTempImage},ds=function(e,t){if(t){var n=t._observer;!n||n.unobserve(e)}},fs=function(e,t){!e||(e.loadingCount+=t)},ps=function(e,t){!e||(e.toLoadCount=t)},vs=function(e){for(var t,n=[],r=0;t=e.children[r];r+=1)"SOURCE"===t.tagName&&n.push(t);return n},ms=function(e,t){var n=e.parentNode;n&&"PICTURE"===n.tagName&&vs(n).forEach(t)},gs=function(e,t){vs(e).forEach(t)},ys=[Ga],bs=[Ga,Wa],xs=[Ga,Ha,Va],_s=[Xa],ws=function(e){return!!e[Ya]},Ts=function(e){return e[Ya]},Ms=function(e){return delete e[Ya]},Ss=function(e,t){if(!ws(e)){var n={};t.forEach((function(t){n[t]=e.getAttribute(t)})),e[Ya]=n}},Es=function(e,t){if(ws(e)){var n=Ts(e);t.forEach((function(t){!function(e,t,n){n?e.setAttribute(t,n):e.removeAttribute(t)}(e,t,n[t])}))}},As=function(e,t,n){ls(e,t.class_applied),rs(e,qa),n&&(t.unobserve_completed&&ds(e,t),us(t.callback_applied,e,n))},Is=function(e,t,n){ls(e,t.class_loading),rs(e,Qa),n&&(fs(n,1),us(t.callback_loading,e,n))},Cs=function(e,t,n){!n||e.setAttribute(t,n)},Ns=function(e,t){Cs(e,Va,ts(e,t.data_sizes)),Cs(e,Ha,ts(e,t.data_srcset)),Cs(e,Ga,ts(e,t.data_src))},ks={IMG:function(e,t){ms(e,(function(e){Ss(e,xs),Ns(e,t)})),Ss(e,xs),Ns(e,t)},IFRAME:function(e,t){Ss(e,ys),Cs(e,Ga,ts(e,t.data_src))},VIDEO:function(e,t){gs(e,(function(e){Ss(e,ys),Cs(e,Ga,ts(e,t.data_src))})),Ss(e,bs),Cs(e,Wa,ts(e,t.data_poster)),Cs(e,Ga,ts(e,t.data_src)),e.load()},OBJECT:function(e,t){Ss(e,_s),Cs(e,Xa,ts(e,t.data_src))}},Ds=["IMG","IFRAME","VIDEO","OBJECT"],Ps=function(e,t){t&&!function(e){return e.loadingCount>0}(t)&&!function(e){return e.toLoadCount>0}(t)&&us(e.callback_finish,t)},Os=function(e,t,n){e.addEventListener(t,n),e.llEvLisnrs[t]=n},Rs=function(e,t,n){e.removeEventListener(t,n)},Ls=function(e){return!!e.llEvLisnrs},js=function(e){if(Ls(e)){var t=e.llEvLisnrs;for(var n in t){var r=t[n];Rs(e,n,r)}delete e.llEvLisnrs}},Bs=function(e,t,n){(function(e){delete e.llTempImage})(e),fs(n,-1),function(e){!e||(e.toLoadCount-=1)}(n),cs(e,t.class_loading),t.unobserve_completed&&ds(e,n)},Us=function(e,t,n){var r=hs(e)||e;Ls(r)||function(e,t,n){Ls(e)||(e.llEvLisnrs={});var r="VIDEO"===e.tagName?"loadeddata":"load";Os(e,r,t),Os(e,"error",n)}(r,(function(i){(function(e,t,n,r){var i=as(t);Bs(t,n,r),ls(t,n.class_loaded),rs(t,Za),us(n.callback_loaded,t,r),i||Ps(n,r)})(0,e,t,n),js(r)}),(function(i){(function(e,t,n,r){var i=as(t);Bs(t,n,r),ls(t,n.class_error),rs(t,Ja),us(n.callback_error,t,r),n.restore_on_error&&Es(t,xs),i||Ps(n,r)})(0,e,t,n),js(r)}))},Fs=function(e,t,n){(function(e){e.llTempImage=document.createElement("IMG")})(e),Us(e,t,n),function(e){ws(e)||(e[Ya]={backgroundImage:e.style.backgroundImage})}(e),function(e,t,n){var r=ts(e,t.data_bg),i=ts(e,t.data_bg_hidpi),o=Ba&&i?i:r;!o||(e.style.backgroundImage='url("'.concat(o,'")'),hs(e).setAttribute(Ga,o),Is(e,t,n))}(e,t,n),function(e,t,n){var r=ts(e,t.data_bg_multi),i=ts(e,t.data_bg_multi_hidpi),o=Ba&&i?i:r;!o||(e.style.backgroundImage=o,As(e,t,n))}(e,t,n),function(e,t,n){var r=ts(e,t.data_bg_set);if(r){var i=r.split("|"),o=i.map((function(e){return"image-set(".concat(e,")")}));e.style.backgroundImage=o.join(),""===e.style.backgroundImage&&(o=i.map((function(e){return"-webkit-image-set(".concat(e,")")})),e.style.backgroundImage=o.join()),As(e,t,n)}}(e,t,n)},zs=function(e,t,n){Us(e,t,n),function(e,t,n){var r=ks[e.tagName];!r||(r(e,t),Is(e,t,n))}(e,t,n)},Gs=function(e,t,n){!function(e){return Ds.indexOf(e.tagName)>-1}(e)?Fs(e,t,n):zs(e,t,n)},Hs=function(e,t,n){e.setAttribute("loading","lazy"),Us(e,t,n),function(e,t){var n=ks[e.tagName];!n||n(e,t)}(e,t),rs(e,Ka)},Vs=function(e){e.removeAttribute(Ga),e.removeAttribute(Ha),e.removeAttribute(Va)},Ws=function(e){ms(e,(function(e){Es(e,xs)})),Es(e,xs)},Ys={IMG:Ws,IFRAME:function(e){Es(e,ys)},VIDEO:function(e){gs(e,(function(e){Es(e,ys)})),Es(e,bs),e.load()},OBJECT:function(e){Es(e,_s)}},Xs=function(e){var t=Ys[e.tagName];t?t(e):function(e){if(ws(e)){var t=Ts(e);e.style.backgroundImage=t.backgroundImage}}(e)},Qs=function(e,t){Xs(e),function(e,t){os(e)||as(e)||(cs(e,t.class_entered),cs(e,t.class_exited),cs(e,t.class_applied),cs(e,t.class_loading),cs(e,t.class_loaded),cs(e,t.class_error))}(e,t),is(e),Ms(e)},Zs=function(e,t,n,r){!n.cancel_on_exit||!function(e){return ns(e)===Qa}(e)||"IMG"===e.tagName&&(js(e),function(e){ms(e,(function(e){Vs(e)})),Vs(e)}(e),Ws(e),cs(e,n.class_loading),fs(r,-1),is(e),us(n.callback_cancel,e,t,r))},qs=function(e,t,n,r){var i=function(e){return ss.indexOf(ns(e))>=0}(e);rs(e,"entered"),ls(e,n.class_entered),cs(e,n.class_exited),function(e,t,n){t.unobserve_entered&&ds(e,n)}(e,n,r),us(n.callback_enter,e,t,r),!i&&Gs(e,n,r)},Js=["IMG","IFRAME","VIDEO"],Ks=function(e){return e.use_native&&"loading"in HTMLImageElement.prototype},$s=function(e,t,n){e.forEach((function(e){return function(e){return e.isIntersecting||e.intersectionRatio>0}(e)?qs(e.target,e,t,n):function(e,t,n,r){os(e)||(ls(e,n.class_exited),Zs(e,t,n,r),us(n.callback_exit,e,t,r))}(e.target,e,t,n)}))},eu=function(e,t){!La||Ks(e)||(t._observer=new IntersectionObserver((function(n){$s(n,e,t)}),function(e){return{root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}}(e)))},tu=function(e){return Array.prototype.slice.call(e)},nu=function(e){return e.container.querySelectorAll(e.elements_selector)},ru=function(e){return function(e){return ns(e)===Ja}(e)},iu=function(e,t){return function(e){return tu(e).filter(os)}(e||nu(t))},ou=function(e,t){(function(e){return tu(e).filter(ru)})(nu(e)).forEach((function(t){cs(t,e.class_error),is(t)})),t.update()},au=function(e,t){var n=Fa(e);this._settings=n,this.loadingCount=0,eu(n,this),function(e,t){!Oa||(t._onlineHandler=function(){ou(e,t)},window.addEventListener("online",t._onlineHandler))}(n,this),this.update(t)};au.prototype={update:function(e){var t=this._settings,n=iu(e,t);ps(this,n.length),!Ra&&La?Ks(t)?function(e,t,n){e.forEach((function(e){-1!==Js.indexOf(e.tagName)&&Hs(e,t,n)})),ps(n,0)}(n,t,this):function(e,t){(function(e){e.disconnect()})(e),function(e,t){t.forEach((function(t){e.observe(t)}))}(e,t)}(this._observer,n):this.loadAll(n)},destroy:function(){this._observer&&this._observer.disconnect(),function(e){!Oa||window.removeEventListener("online",e._onlineHandler)}(this),nu(this._settings).forEach((function(e){Ms(e)})),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){var t=this,n=this._settings;iu(e,n).forEach((function(e){ds(e,t),Gs(e,n,t)}))},restoreAll:function(){var e=this._settings;nu(e).forEach((function(t){Qs(t,e)}))}},au.load=function(e,t){var n=Fa(t);Gs(e,n)},au.resetStatus=function(e){is(e)},Oa&&function(e,t){if(t)if(t.length)for(var n,r=0;n=t[r];r+=1)za(e,n);else za(e,t)}(au,window.lazyLoadOptions);var su=function(){function e(t){var n=t.readonly,r=t.box,i=t.pages,o=t.onNewPageIndex,a=t.onPlay;if(y(this,e),this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new Xo,i.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=n,this.box=r,this.pages=i,this.onNewPageIndex=o,this.onPlay=a,this.render()}return x(e,[{key:"mount",value:function(){var e=this;this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add((function(){var t=new au({container:e.$preview,elements_selector:".".concat(e.wrapClassName("preview-page>img"))});return function(){return t.destroy()}}),"preview-lazyload")}},{key:"unmount",value:function(){this.$content.remove(),this.$footer.remove()}},{key:"setReadonly",value:function(e){this.readonly!==e&&(this.readonly=e,this.$content.classList.toggle(this.wrapClassName("readonly"),e),this.$footer.classList.toggle(this.wrapClassName("readonly"),e),this.$pageNumberInput.disabled=e)}},{key:"destroy",value:function(){this.sideEffect.flushAll(),this.unmount()}},{key:"setPageIndex",value:function(e){Number.isNaN(e)||(this.pageIndex=e,this.$pageNumberInput.value=String(e+1))}},{key:"setSmallBox",value:function(e){this.isSmallBox!==e&&(this.isSmallBox=e,this.$footer.classList.toggle(this.wrapClassName("float-footer"),e))}},{key:"render",value:function(){return this.renderContent(),this.renderFooter(),this.$content}},{key:"renderContent",value:function(){if(!this.$content){var e=document.createElement("div");e.className=this.wrapClassName("content"),this.$content=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),e.appendChild(this.renderPreviewMask()),e.appendChild(this.renderPreview())}return this.$content}},{key:"renderPreview",value:function(){var e=this;if(!this.$preview){var t=document.createElement("div");t.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=t;var n=this.wrapClassName("preview-page"),r=this.wrapClassName("preview-page-name");this.pages.forEach((function(i,o){var a,s=null!=(a=i.thumbnail)?a:i.src.startsWith("ppt")?void 0:i.src;if(s){var u=String(o),l=document.createElement("a");l.className=n+" "+e.wrapClassName("preview-page-".concat(o)),l.setAttribute("href","#"),l.dataset.pageIndex=u;var c=document.createElement("span");c.className=r,c.textContent=String(o+1),c.dataset.pageIndex=u;var h=document.createElement("img");h.width=i.width,h.height=i.height,h.dataset.src=s,h.dataset.pageIndex=u,l.appendChild(h),l.appendChild(c),t.appendChild(l)}})),this.sideEffect.addEventListener(t,"click",(function(t){var n;if(!e.readonly){var r=null==(n=t.target.dataset)?void 0:n.pageIndex;r&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),e.onNewPageIndex(Number(r)),e.togglePreview(!1))}}))}return this.$preview}},{key:"renderPreviewMask",value:function(){var e=this;return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",(function(t){e.readonly||t.target===e.$previewMask&&e.togglePreview(!1)}))),this.$previewMask}},{key:"renderFooter",value:function(){var e=this;if(!this.$footer){var t=document.createElement("div");if(t.className=this.wrapClassName("footer"),this.$footer=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&t.classList.add(this.wrapClassName("float-footer")),this.pages.some((function(e){return e.thumbnail||!e.src.startsWith("ppt")}))){var n=this.renderFooterBtn("btn-sidebar",function(e){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("class","".concat(e,"-footer-icon-sidebar")),n.setAttribute("viewBox","0 0 64 64");var r=document.createElementNS(t,"path");return r.setAttribute("fill","currentColor"),r.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),n.appendChild(r),n}(this.namespace));this.sideEffect.addEventListener(n,"click",(function(){e.readonly||e.togglePreview()})),this.$footer.appendChild(n)}var r=document.createElement("div");r.className=this.wrapClassName("page-jumps");var i=this.renderFooterBtn("btn-page-back",function(e){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("class","".concat(e,"-footer-icon-arrow-left")),n.setAttribute("viewBox","0 0 500 500");var r=document.createElementNS(t,"path");return r.setAttribute("fill","currentColor"),r.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),n.appendChild(r),n}(this.namespace));if(this.sideEffect.addEventListener(i,"click",(function(){e.readonly||e.onNewPageIndex(e.pageIndex-1)})),r.appendChild(i),this.onPlay){var o=this.renderFooterBtn("btn-page-play",function(e){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("class","".concat(e,"-footer-icon-play")),n.setAttribute("viewBox","0 0 500 500");var r=document.createElementNS(t,"path");return r.setAttribute("fill","currentColor"),r.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),n.appendChild(r),n}(this.namespace),function(e){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("class","".concat(e,"-footer-icon-pause")),n.setAttribute("viewBox","0 0 500 500");var r=document.createElementNS(t,"path");return r.setAttribute("fill","currentColor"),r.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),n.appendChild(r),n}(this.namespace));this.sideEffect.addEventListener(o,"click",(function(){e.readonly||(o.classList.toggle(e.wrapClassName("footer-btn-playing"),!0),e.onPlay&&e.onPlay(),e.sideEffect.setTimeout((function(){o.classList.toggle(e.wrapClassName("footer-btn-playing"),!1)}),500,"returnPlay"))})),r.appendChild(o)}var a=this.renderFooterBtn("btn-page-next",function(e){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("class","".concat(e,"-footer-icon-arrow-right")),n.setAttribute("viewBox","0 0 500 500");var r=document.createElementNS(t,"path");return r.setAttribute("fill","currentColor"),r.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),n.appendChild(r),n}(this.namespace));this.sideEffect.addEventListener(a,"click",(function(){e.readonly||e.onNewPageIndex(e.pageIndex+1)})),r.appendChild(a);var s=document.createElement("div");s.className=this.wrapClassName("page-number");var u=document.createElement("input");u.className=this.wrapClassName("page-number-input"),u.value=String(this.pageIndex+1),this.readonly&&(u.disabled=!0),this.$pageNumberInput=u,this.sideEffect.addEventListener(u,"focus",(function(){u.select()})),this.sideEffect.addEventListener(u,"change",(function(){e.readonly||u.value&&e.onNewPageIndex(Number(u.value)-1)}));var l=document.createElement("span");l.textContent=" / "+this.pages.length,s.appendChild(u),s.appendChild(l),this.$footer.appendChild(r),this.$footer.appendChild(s)}return this.$footer}},{key:"renderFooterBtn",value:function(e,t,n){var r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(t),n&&r.appendChild(n),r}},{key:"togglePreview",value:function(e){if(this.isShowPreview=null!=e?e:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){var t=this.$preview.querySelector("."+this.wrapClassName("preview-page-".concat(this.pageIndex)));t&&this.$preview.scrollTo({top:t.offsetTop-16})}}},{key:"wrapClassName",value:function(e){return"".concat(this.namespace,"-").concat(e)}}]),e}();function uu(e,t,n){return Math.min(Math.max(e,t),n)}function lu(e){return e.touches?e.touches[0]:e}function cu(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function hu(e){if(!e)return!1;var t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t}var du=function(){function e(t){var n,r,i,o=this;y(this,e),this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=function(e){if(!o.paused){var t=Math.floor((e-o._loopTimestamp)/1e3*60)+1;for(o._loopTimestamp=e;t-- >0;)o.stepper();o.onStep(o.current,o),!o.paused&&o.current!==o.target&&window.requestAnimationFrame(o.looper)}},this.current=null!=(n=t.start)?n:0,this.target=this.current,this.stiffness=null!=(r=t.stiffness)?r:170,this.damping=null!=(i=t.damping)?i:26,this.onStep=t.onStep}return x(e,[{key:"stepTo",value:function(e,t){this.paused&&null!=t&&(this.current=t),this.paused=!1,this.target=e,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}},{key:"pause",value:function(){this.paused=!0}},{key:"destroy",value:function(){this.pause()}},{key:"stepper",value:function(){var e=-this.stiffness*(this.current-this.target),t=-this.damping*this.velocity,n=this.velocity+(e+t)/60,r=this.current+n/60;Math.abs(n-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=r,this.velocity=n)}}]),e}(),fu=function(){function e(t,n,r,i){y(this,e),this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=t,this.page=n,this.scale=r,this.pageOffsetX=(i-n.width)/2;var o=document.createElement("div");o.className="page-renderer-page",o.dataset.index="".concat(t),o.style.width="".concat(n.width*r,"px"),o.style.height="".concat(n.height*r,"px"),n.thumbnail&&(o.style.backgroundImage='url("'.concat(n.thumbnail,'")'));var a=document.createElement("img");a.className="page-renderer-page-img",a.width=n.width,a.height=n.height,a.src=n.src,o.appendChild(a),this.$page=o}return x(e,[{key:"translateY",value:function(e){Math.abs(e-this.pageOffsetY)>=.001&&(this.pageOffsetY=e,this.$page.style.transform="translate(".concat(this.pageOffsetX*this.scale,"px, ").concat(this.pageOffsetY*this.scale,"px)"))}},{key:"setScale",value:function(e){Math.abs(e-this.scale)>=.001&&(this.scale=e,this.$page.style.width="".concat(this.page.width*this.scale,"px"),this.$page.style.height="".concat(this.page.height*this.scale,"px"),this.$page.style.transform="translate(".concat(this.pageOffsetX*this.scale,"px, ").concat(this.pageOffsetY*this.scale,"px)"))}},{key:"setVisible",value:function(e){e!==this.visible&&(this.visible=e,this.$page.style.opacity=e?"1":"0")}}]),e}(),pu=window.requestIdleCallback||function(e){return window.setTimeout(e,5e3)},vu=window.cancelIdleCallback||window.clearTimeout,mu=function(){function e(t,n,r){var i=this;y(this,e),this.pages=t,this.pagesIntrinsicWidth=n,this.scale=r,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=function(){if(i.gcTimer=null,i.els.size>i.maxElCount)for(var e=a(i.els.values()).sort((function(e,t){return t.lastVisit-e.lastVisit})),t=Math.floor(i.maxElCount/4);tthis.maxElCount&&null===this.gcTimer&&(this.gcTimer=pu(this.gc)),t}},{key:"setScale",value:function(e){e!==this.scale&&(this.scale=e,this.els.forEach((function(t){return t.setScale(e)})))}},{key:"destroy",value:function(){this.els.clear(),null!==this.gcTimer&&(vu(this.gcTimer),this.gcTimer=null)}}]),e}(),gu=function(){function e(t){var n=this;y(this,e),this._hwaTimeout=NaN,this._turnOffHWA=function(){window.clearTimeout(n._hwaTimeout),n._hwaTimeout=NaN,n.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=t.pagesScrollTop||0,this.containerWidth=t.containerWidth||1,this.containerHeight=t.containerHeight||1,this.pages=t.pages.map((function(e){if(e.thumbnail)return e;try{var t=new URL(e.src);return t.searchParams.set("x-oss-process","image/resize,l_50"),Do(ko({},e),{thumbnail:t.toString()})}catch(t){return console.error(t),e}}));var r=Array(this.pages.length),i=1/0,o=0;this.pagesIntrinsicHeight=this.pages.reduce((function(e,t,n){return r[n]=e,t.width>o&&(o=t.width),t.height<=i&&(i=t.height),e+t.height}),0),this.pagesIntrinsicWidth=o,this.pagesMinHeight=i,this.pagesIntrinsicYs=r,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=t.onPageIndexChanged,this.pageScrollIndex=0,0!==this.pagesScrollTop&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new mu(this.pages,o,this.scale),this.$pages=this.renderPages()}return x(e,[{key:"setContainerSize",value:function(e,t){e>0&&t>0&&(e!==this.containerWidth||t!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=t,this.$pages.style.width="".concat(this.containerWidth,"px"),this.$pages.style.height="".concat(this.containerHeight,"px"),this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.pageElManager.setScale(this.scale),this.$pages.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}},{key:"renderPages",value:function(){var e=document.createElement("div");return e.className="page-renderer-pages-container",e.style.width="".concat(this.containerWidth,"px"),e.style.height="".concat(this.containerHeight,"px"),e}},{key:"pagesScrollTo",value:function(e,t){if(e=uu(e,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),t||Math.abs(e-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=e;for(var n=this.findScrollPageIndex(),r=Math.max(n-this.threshold,0),i=Math.min(n+this.threshold,this.pages.length-1),o=0;o=r&&s<=i||(a.remove(),o--)}for(var u=r;u<=i;u++){var l=this.pageElManager.getEl(u);l.$page.parentElement!==this.$pages&&this.$pages.appendChild(l.$page),l.translateY(this.pagesIntrinsicYs[u]-this.pagesScrollTop)}n!==this.pageScrollIndex&&(this.pageScrollIndex=n,this.onPageIndexChanged&&this.onPageIndexChanged(n))}}},{key:"findScrollPageIndex",value:function(){for(var e=0;e=.001)return e;return this.pagesIntrinsicYs.length-1}},{key:"mount",value:function(e){e.appendChild(this.$pages),this.pagesScrollTo(this.pagesScrollTop,!0)}},{key:"unmount",value:function(){this.$pages.remove()}},{key:"destroy",value:function(){this.unmount(),this.onPageIndexChanged=void 0,this.pageElManager.destroy(),this._hwaTimeout&&(window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN)}},{key:"_calcScale",value:function(){return this.containerWidth/this.pagesIntrinsicWidth||1}},{key:"_calcThreshold",value:function(){return uu(Math.ceil(this.containerHeight/this.scale/this.pagesMinHeight/2),1,this.pages.length)}},{key:"_turnOnHWA",value:function(){this._hwaTimeout?window.clearTimeout(this._hwaTimeout):this.$pages.classList.toggle("is-hwa",!0),this._hwaTimeout=window.setTimeout(this._turnOffHWA,1e3)}}]),e}(),yu=function(){function e(t){y(this,e),this.sideEffect=new Xo,this.pagesScrollTop=t.pagesScrollTop||0,this.containerWidth=t.containerWidth||1,this.containerHeight=t.containerHeight||1,this.pagesWidth=t.pagesWidth||1,this.pagesHeight=t.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=t.scrollbarMinHeight||30,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=t.readonly,this.wrapClassName=t.wrapClassName,this.onDragScroll=t.onDragScroll,this.$scrollbar=this.renderScrollbar()}return x(e,[{key:"mount",value:function(e){e.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}},{key:"unmount",value:function(){this.$scrollbar.remove()}},{key:"setReadonly",value:function(e){this.readonly=e}},{key:"setContainerSize",value:function(e,t){e>0&&t>0&&(e!==this.containerWidth||t!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=t,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}},{key:"pagesScrollTo",value:function(e,t){var n=this;if(e=uu(e,0,this.pagesHeight-this.containerHeight/this.scale),t||Math.abs(e-this.pagesScrollTop)>=.001){this.pagesScrollTop=e;var r=this.pagesScrollTop*this.scale/(this.pagesHeight*this.scale-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame((function(){n.$scrollbar.style.transform="translateY(".concat(r,"px)")})):this.$scrollbar.style.transform="translateY(".concat(r,"px)")}}},{key:"destroy",value:function(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}},{key:"renderScrollbar",value:function(){var e=this,t=document.createElement("button");t.className=this.wrapClassName("scrollbar"),t.style.minHeight="".concat(this.scrollbarMinHeight,"px"),t.style.height="".concat(this.scrollbarHeight,"px");var n=function(n){if(!(e.readonly||null!=n.button&&0!==n.button)){cu(n);var r=e.wrapClassName("scrollbar-dragging");t.classList.toggle(r,!0);var i=e.pagesScrollTop,o=lu(n).clientY,a=function(t){if(!e.readonly){var n=(lu(t).clientY-o)/e.scale;Math.abs(n)>0&&e.onDragScroll&&e.onDragScroll(i+n*(e.pagesHeight*e.scale/e.containerHeight))}},s=function e(){t.classList.toggle(r,!1),window.removeEventListener("mousemove",a,!0),window.removeEventListener("touchmove",a,!0),window.removeEventListener("mouseup",e,!0),window.removeEventListener("touchend",e,!0),window.removeEventListener("touchcancel",e,!0)};window.addEventListener("mousemove",a,!0),window.addEventListener("touchmove",a,!0),window.addEventListener("mouseup",s,!0),window.addEventListener("touchend",s,!0),window.addEventListener("touchcancel",s,!0)}};return this.sideEffect.addEventListener(t,"mousedown",n),this.sideEffect.addEventListener(t,"touchstart",n),t}},{key:"_calcScale",value:function(){return this.containerWidth/this.pagesWidth||1}},{key:"_calcScrollbarHeight",value:function(){return uu(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}},{key:"_updateScrollbarHeight",value:function(){var e=this._calcScrollbarHeight();Math.abs(e-this.scrollbarHeight)>.001&&(this.scrollbarHeight=e,this.$scrollbar.style.height="".concat(e,"px"))}}]),e}(),bu=window.ResizeObserver||Pa,xu=640,_u=function(){function e(t){var r=this,i=t.whiteboardView,a=t.readonly,s=t.box,u=t.pages,l=t.pageScrollTop,c=void 0===l?0:l,h=t.mountWhiteboard,d=t.onUserScroll,f=t.baseScenePath,p=t.appId;y(this,e),this.sideEffect=new Xo,this.userScrolling=!1,this.onNewPageIndex=function(e){r.scrollToPage(e)},this.toPdf=g(regeneratorRuntime.mark((function e(){var t,i,a,s,u,l,c,h,d,f,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=document.createElement("canvas"),(i=t.getContext("2d"))&&r.baseScenePath){e.next=4;break}return r.reportProgress(100,null),e.abrupt("return");case 4:return a=r.whiteboardView.focusScenePath||"".concat(r.baseScenePath,"/1"),s=r.pages[0],e.next=8,Promise.resolve().then((function(){return V(n(88877))}));case 8:u=e.sent,l=u.jsPDF,c=new l({format:[s.width,s.height],orientation:s.width>s.height?"l":"p",compress:!0}),h=T(r.pages.entries()),e.prev=12,f=regeneratorRuntime.mark((function e(){var n,s,u,l,h,f,p,v,m,g,y;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o(d.value,2),s=n[0],u=n[1],l=u.width,h=u.height,f=u.src,t.width=l,t.height=h,p=l>h?"l":"p",s>0&&c.addPage([l,h],p),e.next=7,r.getBase64FromUrl(f);case 7:return v=e.sent,(m=document.createElement("img")).src=v,e.next=12,new Promise((function(e){return m.onload=e}));case 12:i.drawImage(m,0,0),g=t.toDataURL("image/jpeg",.6),i.clearRect(0,0,l,h),r.whiteboardView.screenshotToCanvas(i,a,l,h,{centerX:l/2,centerY:h/2+s*h,scale:1}),y=t.toDataURL("image/png"),c.addImage(g,"JPEG",0,0,l,h,"","FAST"),c.addImage(y,"PNG",0,0,l,h,"","FAST"),i.clearRect(0,0,l,h),Math.ceil((s+1)/r.pages.length*100)<100&&r.reportProgress(Math.ceil((s+1)/r.pages.length*100),null);case 17:case"end":return e.stop()}}),e)})),h.s();case 15:if((d=h.n()).done){e.next=19;break}return e.delegateYield(f(),"t0",17);case 17:e.next=15;break;case 19:e.next=24;break;case 21:e.prev=21,e.t1=e.catch(12),h.e(e.t1);case 24:return e.prev=24,h.f(),e.finish(24);case 27:p=c.output("arraybuffer"),r.reportProgress(100,{pdf:p,title:r.box.title});case 29:case"end":return e.stop()}}),e,null,[[12,21,24,27]])}))),this.whiteboardView=i,this.readonly=a,this.box=s,this.pages=u,this.baseScenePath=f,this.appId=p,this.mountWhiteboard=h,this._onUserScroll=d;var v=this.debounce((function(){r.userScrolling=!1,r._onUserScroll&&r._onUserScroll(r.pageRenderer.pagesScrollTop)}),{wait:80},"debounce-updateUserScroll");this.updateUserScroll=function(){r.userScrolling=!0,v()},this.viewer=new su({readonly:a,box:s,pages:u,onNewPageIndex:this.onNewPageIndex});var m=this.whiteboardView.size,b=m.width,x=m.height;this.pageRenderer=new gu({pagesScrollTop:c,pages:this.pages,containerWidth:b,containerHeight:x,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new yu({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:b,containerHeight:x,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:function(e){r.pageScrollTo(e),r.updateUserScroll()}}),this.pageScrollStepper=new du({start:this.pageRenderer.pagesScrollTop,onStep:function(e){r.pageScrollTo(e)}}),this.render()}var t;return x(e,[{key:"mount",value:function(){var e=this;this.viewer.mount(),this.setupScrollListener();var t=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add((function(){var n=new bu(t);return n.observe(e.viewer.$content),function(){return n.disconnect()}})),this.sideEffect.setTimeout((function(){e.userScrolling||e.pageScrollTo(e.pageRenderer.pagesScrollTop)}),100),this.sideEffect.add((function(){var t=function(t){"@netless/_request_save_pdf_"===t.data.type&&t.data.appId===e.appId&&e.toPdf().catch((function(){return e.reportProgress(100,null)}))};return window.addEventListener("message",t),function(){window.removeEventListener("message",t)}})),this}},{key:"unmount",value:function(){return this.viewer.unmount(),this}},{key:"setReadonly",value:function(e){this.readonly!==e&&(this.readonly=e,this.viewer.setReadonly(e),this.scrollbar.setReadonly(e))}},{key:"destroy",value:function(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}},{key:"syncPageScrollTop",value:function(e){!this.userScrolling&&e>=0&&Math.abs(this.pageRenderer.pagesScrollTop-e)>.01&&this.pageScrollStepper.stepTo(e,this.pageRenderer.pagesScrollTop)}},{key:"render",value:function(){this.pageRenderer.mount(this.viewer.$content),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.scrollbar.mount(this.viewer.$content),this.renderRatioHeight()}},{key:"renderRatioHeight",value:function(){var e=this.box.absoluteHeight,t=e<=xu;if(this.viewer.setSmallBox(t),t){var n=26/e,r=Math.max((.08125-(n+0))/2,0);if(this.box.$titleBar){var i=n+r;this.box.$titleBar.style.height="".concat(100*i,"%")}if(this.box.$footer){var o=0+r;this.box.$footer.style.height="".concat(100*o,"%")}}else{if(this.box.$titleBar){var a=Math.max(26/xu,26/e);this.box.$titleBar.style.height="".concat(100*a,"%")}if(this.box.$footer){var s=Math.max(26/xu,26/e);this.box.$footer.style.height="".concat(100*s,"%")}}}},{key:"renderWhiteboardView",value:function(){var e=this;return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.mountWhiteboard(this.$whiteboardView),this.sideEffect.addEventListener(this.$whiteboardView,"wheel",(function(t){cu(t),e.readonly||(e.pageScrollTo(e.pageRenderer.pagesScrollTop+t.deltaY),e.updateUserScroll())}),{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",(function(t){e.readonly||t.touches.length<=1||e.updateUserScroll()}),{passive:!0,capture:!0})),this.$whiteboardView}},{key:"scrollTopPageToEl",value:function(e){return e*this.pageRenderer.scale}},{key:"scrollTopElToPage",value:function(e){return e/this.pageRenderer.scale}},{key:"elScrollTo",value:function(e){this.pageScrollTo(this.scrollTopElToPage(e))}},{key:"pageScrollTo",value:function(e){var t=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:uu(e+t,t,this.pageRenderer.pagesIntrinsicHeight-t),animationMode:"immediately"})}},{key:"scrollToPage",value:function(e){if(!this.readonly&&!Number.isNaN(e)){var t=this.pageRenderer.pagesIntrinsicYs[e];t>=0&&(this.pageScrollTo(t+5/this.pageRenderer.scale),this.updateUserScroll())}}},{key:"setupScrollListener",value:function(){var e=this;this.sideEffect.add((function(){var t=function(t){var n=e.whiteboardView.size,r=n.width,i=n.height;if(!(r<=0||i<=0)){var o=t.centerY-e.pageRenderer.containerHeight/e.pageRenderer.scale/2;e.pageRenderer.pagesScrollTo(o),e.scrollbar.pagesScrollTo(o)}};return e.whiteboardView.callbacks.on("onCameraUpdated",t),function(){return e.whiteboardView.callbacks.off("onCameraUpdated",t)}})),this.sideEffect.add((function(){var t=e.updateUserScroll;return e.whiteboardView.callbacks.on("onCameraUpdatedByDevice",t),function(){return e.whiteboardView.callbacks.off("onCameraUpdatedByDevice",t)}})),this.sideEffect.add((function(){var t=function(t){var n=t.width,r=t.height;if(!(n<=0||r<=0)){e.pageRenderer.setContainerSize(n,r),e.scrollbar.setContainerSize(n,r);var i=e.pageRenderer,o=i.pagesIntrinsicWidth,a=i.pagesIntrinsicHeight;e.whiteboardView.moveCameraToContain({originX:0,originY:e.pageRenderer.pagesScrollTop,width:o,height:r/e.pageRenderer.scale,animationMode:"immediately"}),e.whiteboardView.setCameraBound({damping:1,maxContentMode:function(){return e.pageRenderer.scale},minContentMode:function(){return e.pageRenderer.scale},centerX:o/2,centerY:a/2,width:o,height:a})}};return e.whiteboardView.callbacks.on("onSizeUpdated",t),function(){e.whiteboardView.callbacks.off("onSizeUpdated",t)}}),"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",(function(t){if(!e.readonly&&e.box.focus&&!e.box.minimized&&!hu(t.target)){var n=null;switch(t.key){case"PageDown":n=e.pageRenderer.pagesScrollTop+e.pageRenderer.containerHeight/e.pageRenderer.scale;break;case"PageUp":n=e.pageRenderer.pagesScrollTop-e.pageRenderer.containerHeight/e.pageRenderer.scale;break;case"ArrowDown":n=e.pageRenderer.pagesScrollTop+e.pageRenderer.containerHeight/4/e.pageRenderer.scale;break;case"ArrowUp":n=e.pageRenderer.pagesScrollTop-e.pageRenderer.containerHeight/4/e.pageRenderer.scale}null!==n&&(e._onUserScroll?e._onUserScroll(n):(e.pageScrollTo(n),e.updateUserScroll()))}}),{capture:!0})}},{key:"debounce",value:function(e,t,n){var r=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e)throw new TypeError("Expected the first argument to be a function, got `".concat(_(e),"`"));var n,r,i,o=t.wait,a=void 0===o?0:o,s=t.maxWait,u=void 0===s?Number.Infinity:s,l=t.before,c=void 0!==l&&l,h=t.after,d=void 0===h||h;if(!c&&!d)throw new Error("Both `before` and `after` are false, function wouldn't be called.");var f=function(){for(var t=arguments.length,o=new Array(t),s=0;s0&&u!==Number.Infinity&&!r&&(r=setTimeout(f,u)),p&&(i=e.apply(l,o)),i};return Fo(f,e),f.cancel=function(){n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)},f}(e,t);return this.sideEffect.addDisposer((function(){return r.cancel()}),n),r}},{key:"wrapClassName",value:function(e){return"netless-app-docs-viewer-static-"+e}},{key:"getBase64FromUrl",value:(t=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(this._invalidate(t));case 2:return e.next=4,e.sent.blob();case 4:return n=e.sent,e.abrupt("return",new Promise((function(e){var t=new FileReader;t.readAsDataURL(n),t.onloadend=function(){var n=t.result;e(n)}})));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_invalidate",value:function(e){try{var t=new URL(e);return t.searchParams.set("t",Date.now().toString()),t.toString()}catch(t){return e}}},{key:"reportProgress",value:function(e,t){window.postMessage({type:"@netless/_result_save_pdf_",appId:this.appId,progress:e,result:t})}}]),e}(),wu=function(){function e(t){var n=this,r=t.context,i=t.whiteboardView,o=t.box,a=t.pages;y(this,e),this.sideEffect=new Xo,this.onPlayPPT=function(){var e=n.context.getRoom();e&&e.pptNextStep()},this._scaleDocsToFitImpl=function(){var e=n.pages[n.getPageIndex()];e&&(n.whiteboardView.moveCameraToContain({originX:-e.width/2,originY:-e.height/2,width:e.width,height:e.height,animationMode:"immediately"}),n.whiteboardView.setCameraBound({damping:1,maxContentMode:function(){return n.whiteboardView.camera.scale},minContentMode:function(){return n.whiteboardView.camera.scale},centerX:0,centerY:0,width:e.width,height:e.height}))},this._scaleDocsToFitDebounced=function(){n.sideEffect.setTimeout(n._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=function(){n._scaleDocsToFitImpl(),n._scaleDocsToFitDebounced()},this.onNewPageIndex=function(e){n.jumpToPage(e,!0)},this.context=r,this.whiteboardView=i,this.box=o,this.pages=a,this.displayer=r.getDisplayer(),this.viewer=new su({readonly:!r.getIsWritable(),box:o,pages:a,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add((function(){var e=function(e){n.viewer.setReadonly(!e)};return n.context.emitter.on("writableChange",e),function(){return n.context.emitter.off("writableChange",e)}})),this.sideEffect.add((function(){var e=function(e){n.jumpToPage(e.index)};return n.context.emitter.on("sceneStateChange",e),function(){return n.context.emitter.off("sceneStateChange",e)}}))}return x(e,[{key:"mount",value:function(){var e=this;this.viewer.mount();var t=this.getPageIndex();return 0!==t&&this.jumpToPage(t),this.scaleDocsToFit(),this.sideEffect.add((function(){return e.whiteboardView.callbacks.on("onSizeUpdated",e.scaleDocsToFit),function(){e.whiteboardView.callbacks.off("onSizeUpdated",e.scaleDocsToFit)}})),this}},{key:"unmount",value:function(){return this.viewer.unmount(),this}},{key:"destroy",value:function(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}},{key:"getPageIndex",value:function(){return this.displayer.state.sceneState.index}},{key:"jumpToPage",value:function(e,t){var n,r;if((e=uu(e,0,this.pages.length-1))!==this.getPageIndex()&&this.context.getIsWritable()){var i=this.context.getInitScenePath(),o=null==(r=null==(n=this.context.getScenes())?void 0:n[e])?void 0:r.name;i&&o&&this.context.setScenePath("".concat(i,"/").concat(o)),this.scaleDocsToFit()}if(e!==this.viewer.pageIndex&&this.viewer.setPageIndex(e),t){var a=this.context.getRoom();if(a){var s=a.state.globalState.__pptState;a.setGlobalState({__pptState:s&&{uuid:s.uuid,pageIndex:e,disableAutoPlay:s.disableAutoPlay}})}}}},{key:"render",value:function(){var e=this;this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",(function(t){var n;if(e.box.focus&&!hu(t.target))switch(t.key){case"ArrowUp":case"ArrowLeft":e.jumpToPage(e.getPageIndex()-1,!0);break;case"ArrowRight":case"ArrowDown":null==(n=e.context.getRoom())||n.pptNextStep()}}))}},{key:"renderMask",value:function(){if(!this.$mask){var e=document.createElement("div");e.className=this.wrapClassName("mask"),this.$mask=e,document.createElement("button").className=this.wrapClassName("back"),document.createElement("button").className=this.wrapClassName("next")}return this.$mask}},{key:"renderWhiteboardView",value:function(){var e=this;return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.sideEffect.addEventListener(this.$whiteboardView,"click",(function(t){var n,r=e.context.getRoom();if(r&&"clicker"===r.state.memberState.currentApplianceName){for(var i=t.target;i;i=i.parentElement)if(null!=(n=i.classList)&&n.contains("ppt-event-source"))return;r.pptNextStep()}})),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}},{key:"wrapClassName",value:function(e){return"netless-app-docs-viewer-dynamic-"+e}}]),e}(),Tu={kind:"DocsViewer",setup:function(e){var t=e.getBox(),n=e.getScenes();if(!n)throw new Error("[Docs Viewer]: scenes not found.");var r=e.getView();if(!r)throw new Error("[Docs Viewer]: no whiteboard view.");var i=n.map((function(e){var t=e.ppt;return t?{width:t.width,height:t.height,src:t.src,thumbnail:t.previewURL}:null})).filter((function(e){return Boolean(e)}));if(i.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(".netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview-mask{display:block}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview{transform:translate(0)}.netless-app-docs-viewer-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-docs-viewer-preview-page:hover,.netless-app-docs-viewer-preview-page.netless-app-docs-viewer-preview-page-active{border-color:#444e601a}.netless-app-docs-viewer-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-docs-viewer-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-docs-viewer-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-docs-viewer-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-docs-viewer-footer-btn:hover{background:transparent!important}}.netless-app-docs-viewer-footer-btn>svg{width:100%;height:100%}.netless-app-docs-viewer-footer-btn>svg:nth-of-type(2){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-docs-viewer-footer-btn~.netless-app-docs-viewer-footer-btn{margin-left:15px}.netless-app-docs-viewer-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-docs-viewer-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-docs-viewer-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn:hover{background:transparent}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:active{background:transparent;box-shadow:none}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:disabled{color:inherit}.netless-app-docs-viewer-readonly.netless-app-docs-viewer-float-footer{display:none}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:active,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:focus,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.page-renderer-pages-container{position:relative;overflow:hidden}.page-renderer-page{position:absolute;top:0;left:0;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-pages-container.is-hwa .page-renderer-page{will-change:transform}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-wb-view,.netless-app-docs-viewer-dynamic-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-docs-viewer-dynamic-wb-view .cursor-clicker .ppt-event-source{cursor:pointer}\n"),i[0].src.startsWith("ppt")?function(e,t,n,r){t.disableCameraTransform=!0;var i=new wu({context:e,whiteboardView:t,box:n,pages:r}).mount();e.mountView(i.$whiteboardView),e.isAddApp&&t.callbacks.once("onSizeUpdated",(function(t){var i=t.width,o=t.height;if(r.length>0&&"maximized"!==n.state){var a=r[0],s=a.width,u=a.height/s*i-o;0!==u&&e.getIsWritable()&&e.emitter.emit("setBoxSize",{width:n.width,height:n.height+u/n.containerRect.height})}}))}(e,r,t,i):function(e,t,n,r){var i;t.disableCameraTransform=!e.getIsWritable();var o=new _u({whiteboardView:t,readonly:!e.getIsWritable(),box:n,pages:r,pageScrollTop:null==(i=e.getAttributes())?void 0:i.pageScrollTop,mountWhiteboard:e.mountView.bind(e),onUserScroll:function(t){var r;(null==(r=e.getAttributes())?void 0:r.pageScrollTop)!==t&&!n.readonly&&e.updateAttributes(["pageScrollTop"],t)},baseScenePath:e.getInitScenePath(),appId:e.appId}).mount();e.emitter.on("attributesUpdate",(function(e){e&&null!=e.pageScrollTop&&o.syncPageScrollTop(e.pageScrollTop)})),e.emitter.on("writableChange",(function(e){o.setReadonly(!e),t.disableCameraTransform=!e}))}(e,r,t,i)}};var Mu={exports:{}},Su={},Eu={exports:{}},Au={}; +***************************************************************************** */var Kn=function(e){return function(t){if("string"!=typeof t)return t;for(var n={},r=function(e){return function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))}(e).replace(/(,|\/)/g," ").split(/ \s*/)}(t),i=0;i<4;i++)n[e[i]]=void 0!==r[i]?parseFloat(r[i]):1;return n}},$n=jn(jn({},zn),{transform:function(e){return Math.round(Zn(e))}});function er(e,t){return e.startsWith(t)&&Fn.test(e)}var tr,nr={test:function(e){return"string"==typeof e?er(e,"rgb"):qn(e)},parse:Kn(["red","green","blue","alpha"]),transform:function(e){var t=e.red,n=e.green,r=e.blue,i=e.alpha,o=void 0===i?1:i;return function(e){var t=e.red,n=e.green,r=e.blue,i=e.alpha;return"rgba("+t+", "+n+", "+r+", "+(void 0===i?1:i)+")"}({red:$n.transform(t),green:$n.transform(n),blue:$n.transform(r),alpha:Un(Gn.transform(o))})}},rr={test:function(e){return"string"==typeof e?er(e,"hsl"):Jn(e)},parse:Kn(["hue","saturation","lightness","alpha"]),transform:function(e){var t=e.hue,n=e.saturation,r=e.lightness,i=e.alpha,o=void 0===i?1:i;return function(e){var t=e.hue,n=e.saturation,r=e.lightness,i=e.alpha;return"hsla("+t+", "+n+", "+r+", "+(void 0===i?1:i)+")"}({hue:Math.round(t),saturation:Yn.transform(Un(n)),lightness:Yn.transform(Un(r)),alpha:Un(Gn.transform(o))})}},ir=jn(jn({},nr),{test:function(e){return"string"==typeof e&&er(e,"#")},parse:function(e){var t="",n="",r="";return e.length>4?(t=e.substr(1,2),n=e.substr(3,2),r=e.substr(5,2)):(t=e.substr(1,1),n=e.substr(2,1),r=e.substr(3,1),t+=t,n+=n,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:1}}}),or={test:function(e){return"string"==typeof e&&Fn.test(e)||qn(e)||Jn(e)},parse:function(e){return nr.test(e)?nr.parse(e):rr.test(e)?rr.parse(e):ir.test(e)?ir.parse(e):e},transform:function(e){return qn(e)?nr.transform(e):Jn(e)?rr.transform(e):e}},ar=function(e){var t=e.onRead,n=e.onRender,r=e.uncachedValues,i=void 0===r?new Set:r,o=e.useCache,a=void 0===o||o;return function(e){void 0===e&&(e={});var r=wn(e,[]),o={},s=[],u=!1;function l(e,t){e.startsWith("--")&&(r.hasCSSVariable=!0);var n=o[e];o[e]=t,o[e]!==n&&(-1===s.indexOf(e)&&s.push(e),u||(u=!0,Pn.render(c.render)))}var c={get:function(e,n){return void 0===n&&(n=!1),!n&&a&&!i.has(e)&&void 0!==o[e]?o[e]:t(e,r)},set:function(e,t){if("string"==typeof e)l(e,t);else for(var n in e)l(n,e[n]);return this},render:function(e){return void 0===e&&(e=!1),(u||!0===e)&&(n(o,r,s),u=!1,s.length=0),this}};return c}},sr=/([a-z])([A-Z])/g,ur=function(e){return e.replace(sr,"$1-$2").toLowerCase()},lr=new Map,cr=new Map,hr=["Webkit","Moz","O","ms",""],dr=hr.length,fr="undefined"!=typeof document,pr=function(e,t){return cr.set(e,ur(t))},vr=function(e,t){void 0===t&&(t=!1);var n=t?cr:lr;return n.has(e)||(fr?function(e){tr=tr||document.createElement("div");for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:ri();return this.flush(t),this.disposers.set(t,e()),t}},{key:"addDisposer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ri();return this.flush(t),this.disposers.set(t,e),t}},{key:"addEventListener",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:ri();return this.add((function(){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}),i),i}},{key:"setTimeout",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ri();return this.add((function(){var i=window.setTimeout((function(){n.remove(r),e()}),t);return function(){return window.clearTimeout(i)}}),r)}},{key:"setInterval",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ri();return this.add((function(){var n=window.setInterval(e,t);return function(){return window.clearInterval(n)}}),n)}},{key:"remove",value:function(e){var t=this.disposers.get(e);return this.disposers.delete(e),t}},{key:"flush",value:function(e){var t=this.remove(e);if(t)try{t()}catch(e){console.error(e)}}},{key:"flushAll",value:function(){this.disposers.forEach((function(e){try{e()}catch(e){console.error(e)}})),this.disposers.clear()}}]),e}(),oi=Object.defineProperty,ai=(n(80782),function(e,t,n){return r=e,i="symbol"!=_(t)?t+"":t,o=n,i in r?oi(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o,n;var r,i,o}),si=function(){function e(t,n){y(this,e),ai(this,"_value"),ai(this,"_beforeDestroys"),ai(this,"_subscribers"),this._value=t,n&&(this.compare=n)}return x(e,[{key:"setValue",value:function(e,t){if(!this.compare(e,this._value)){var n=this._value;this._value=e,this._subscribers&&this._subscribers.forEach((function(r){return r(e,n,t)}))}}},{key:"reaction",value:function(e){var t=this;return this._subscribers||(this._subscribers=new Set),this._subscribers.add(e),function(){t._subscribers&&t._subscribers.delete(e)}}},{key:"subscribe",value:function(e,t){var n=this.reaction(e);return e(this._value,void 0,t),n}},{key:"derive",value:function(t,n,r){var i=new e(t(this.value,void 0,r),n),o=this.reaction((function(e,n,r){i.setValue(t(e,n,r))}));return i.addBeforeDestroy(o),i}},{key:"destroy",value:function(){this._beforeDestroys&&(this._beforeDestroys.forEach((function(e){return e()})),this._beforeDestroys.clear()),this._subscribers&&this._subscribers.clear()}},{key:"addBeforeDestroy",value:function(e){var t=this;return this._beforeDestroys||(this._beforeDestroys=new Set),this._beforeDestroys.add(e),function(){t._beforeDestroys&&t._beforeDestroys.delete(e)}}},{key:"compare",value:function(e,t){return e===t}},{key:"value",get:function(){return this._value}}]),e}();function ui(e,t){Object.keys(t).forEach((function(n){!function(e,t,n){var r,i;Object.defineProperties(e,(w(r={},t,{get:function(){return n.value}}),w(r,"_".concat(t,"$"),{value:n}),w(r,"set".concat((i=t)[0].toUpperCase()+i.slice(1)),{value:function(e,t){return n.setValue(e,t)}}),r))}(e,n,t[n])}))}function li(e){var t=function(t){var n=e.addDisposer((function(){t.destroy()}));return t.addBeforeDestroy((function(){e.remove(n)})),t};return{bindSideEffect:t,combine:function(e,n,r,i){return t(function(e,t,n,r){var i=e.map((function(e){return e.value})),o=new si(t(i,void 0,r),n);return e.forEach((function(e,n){var r=e.reaction((function(e,r,a){var s=i.slice();s[n]=e;var u=i;i=s,o.setValue(t(s,u,a),a)}));o.addBeforeDestroy(r)})),o}(e,n,r,i))},createVal:function(e,n){return t(new si(e,n))}}}!function(e){e.Light="light",e.Dark="dark",e.Auto="auto"}(Qr||(Qr={})),function(e){e.Normal="normal",e.Minimized="minimized",e.Maximized="maximized"}(Zr||(Zr={})),function(e){e.DarkMode="dark_mode",e.PrefersColorScheme="prefers_color_scheme",e.Close="close",e.Focus="focus",e.Blur="blur",e.Move="move",e.Resize="resize",e.IntrinsicMove="intrinsic_move",e.IntrinsicResize="intrinsic_resize",e.VisualResize="visual_resize",e.ZIndex="z_index",e.State="state",e.Minimized="minimized",e.Maximized="maximized",e.Readonly="readonly",e.Destroyed="destroyed"}(qr||(qr={})),function(e){e.Close="close",e.Maximize="maximize",e.Minimize="minimize"}(Jr||(Jr={})),function(e){e.North="n",e.South="s",e.West="w",e.East="e",e.NorthWest="nw",e.NorthEast="ne",e.SouthEast="se",e.SouthWest="sw"}(Kr||(Kr={}));var ci="dh";function hi(e,t,n){return Math.min(Math.max(e,t),n)}function di(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function fi(e){return e.touches?e.touches[0]:e}function pi(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}var vi=1;function mi(){return"New Box ".concat(vi++)}function gi(e){return Boolean(e)}function yi(e){return!e}var bi=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.readonly,i=void 0!==r&&r,o=n.title,a=n.buttons,s=n.onEvent,u=n.onDragStart,l=n.namespace,c=void 0===l?"telebox":l,h=n.state,d=void 0===h?Zr.Normal:h;y(this,e),this.$btns=[],this.sideEffect=new ii,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=function(e){var n;if(!(t.readonly||0!==e.button||null!=(n=e.target.dataset)&&n.teleTitleBarNoDblClick)){di(e);var r=Date.now();r-t.lastTitleBarClick.timestamp<=500?Math.abs(e.clientX-t.lastTitleBarClick.clientX)<=5&&Math.abs(e.clientY-t.lastTitleBarClick.clientY)<=5&&t.onEvent&&t.onEvent({type:Jr.Maximize}):t.onDragStart&&t.onDragStart(e),t.lastTitleBarClick.timestamp=r,t.lastTitleBarClick.clientX=e.clientX,t.lastTitleBarClick.clientY=e.clientY}},this.lastTitleBarTouch={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarTouch=function(e){var n;if(!(t.readonly||null!=(n=e.target.dataset)&&n.teleTitleBarNoDblClick)){di(e);var r=Date.now(),i=e.touches[0]||{},o=i.clientX,a=void 0===o?t.lastTitleBarTouch.clientX+100:o,s=i.clientY,u=void 0===s?t.lastTitleBarTouch.clientY+100:s;r-t.lastTitleBarTouch.timestamp<=500?Math.abs(a-t.lastTitleBarTouch.clientX)<=10&&Math.abs(u-t.lastTitleBarTouch.clientY)<=10&&t.onEvent&&t.onEvent({type:Jr.Maximize}):t.onDragStart&&t.onDragStart(e),t.lastTitleBarTouch.timestamp=r,t.lastTitleBarTouch.clientX=a,t.lastTitleBarTouch.clientY=u}},this.readonly=i,this.onEvent=s,this.onDragStart=u,this.namespace=c,this.title=o,this.state=d,this.buttons=a||[{type:Jr.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:Jr.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:function(e){return e===Zr.Maximized}},{type:Jr.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}],this.$dragArea=this.renderDragArea()}return x(e,[{key:"setTitle",value:function(e){this.title=e,this.$title&&(this.$title.textContent=e,this.$title.title=e)}},{key:"setState",value:function(e){var t=this;this.state!==e&&(this.state=e,this.buttons.forEach((function(n,r){n.isActive&&t.$btns[r].classList.toggle("is-active",n.isActive(e))})))}},{key:"setReadonly",value:function(e){this.readonly!==e&&(this.readonly=e)}},{key:"render",value:function(){var e=this;if(!this.$titleBar){this.$titleBar=document.createElement("div"),this.$titleBar.className=this.wrapClassName("titlebar");var t=document.createElement("div");t.className=this.wrapClassName("title-area"),t.dataset.teleBoxHandle=ci,this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle=ci,this.title&&(this.$title.textContent=this.title,this.$title.title=this.title),t.appendChild(this.$title),t.appendChild(this.$dragArea);var n=document.createElement("div");n.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach((function(t,r){var i=t.iconClassName,o=t.isActive,a=String(r),s=document.createElement("button");s.className="".concat(e.wrapClassName("titlebar-btn")," ").concat(i),s.dataset.teleTitleBarBtnIndex=a,s.dataset.teleTitleBarNoDblClick="true",o&&s.classList.toggle("is-active",o(e.state)),e.$btns.push(s),n.appendChild(s)})),this.sideEffect.addEventListener(n,"click",(function(t){var n;if(!e.readonly){var r=t.target,i=Number(null==(n=r.dataset)?void 0:n.teleTitleBarBtnIndex);if(!Number.isNaN(i)&&i0&&void 0!==arguments[0]?arguments[0]:{},r=n.id,i=void 0===r?pi():r,a=n.title,s=void 0===a?mi():a,u=n.prefersColorScheme,l=void 0===u?Qr.Light:u,c=n.darkMode,h=n.visible,d=void 0===h||h,f=n.width,p=void 0===f?.5:f,v=n.height,m=void 0===v?.5:v,g=n.minWidth,b=void 0===g?0:g,x=n.minHeight,_=void 0===x?0:x,w=n.x,T=void 0===w?.1:w,M=n.y,S=void 0===M?.1:M,E=n.minimized,A=void 0!==E&&E,I=n.maximized,C=void 0!==I&&I,N=n.readonly,k=void 0!==N&&N,D=n.resizable,P=void 0===D||D,O=n.draggable,R=void 0===O||O,L=n.fence,j=void 0===L||L,B=n.fixRatio,U=void 0!==B&&B,F=n.focus,z=void 0!==F&&F,G=n.zIndex,H=void 0===G?100:G,V=n.namespace,W=void 0===V?"telebox":V,Y=n.titleBar,X=n.content,Q=n.footer,Z=n.styles,q=n.containerRect,J=void 0===q?{x:0,y:0,width:window.innerWidth,height:window.innerHeight}:q,K=n.collectorRect;y(this,e),this._renderSideEffect=new ii,this.handleTrackStart=function(e){var n;return null==(n=t._handleTrackStart)?void 0:n.call(t,e)},this._sideEffect=new ii,this._valSideEffectBinder=li(this._sideEffect);var $=this._valSideEffectBinder,ee=$.combine,te=$.createVal;this.id=i,this.namespace=W,this.events=new xn,this._delegateEvents=new xn;var ne=te(l);ne.reaction((function(e,n,r){r||t.events.emit(qr.PrefersColorScheme,e)}));var re=te(Boolean(c));null==c&&ne.subscribe((function(e,n,r){t._sideEffect.add((function(){if("auto"===e){var t=window.matchMedia("(prefers-color-scheme: dark)");if(t){re.setValue(t.matches,r);var n=function(e){re.setValue(e.matches,r)};return t.addListener(n),function(){return t.removeListener(n)}}return _i}return re.setValue("dark"===e,r),_i}),"prefers-color-scheme")})),re.reaction((function(e,n,r){r||t.events.emit(qr.DarkMode,e)}));var ie=te(J,$r),oe=te(K,$r),ae=te(s),se=te(d);se.reaction((function(e,n,r){!r&&!e&&t.events.emit(qr.Close)}));var ue=te(k);ue.reaction((function(e,n,r){r||t.events.emit(qr.Readonly,e)}));var le=te(P),ce=te(R),he=te(j),de=te(U),fe=te(H);fe.reaction((function(e,n,r){r||t.events.emit(qr.ZIndex,e)}));var pe=te(z);pe.reaction((function(e,n,r){r||t.events.emit(e?qr.Focus:qr.Blur)}));var ve=te(A);ve.reaction((function(e,n,r){r||t.events.emit(qr.Minimized,e)}));var me=te(C);me.reaction((function(e,n,r){r||t.events.emit(qr.Maximized,e)}));var ge=ee([ve,me],(function(e){var t=o(e,2),n=t[0],r=t[1];return n?Zr.Minimized:r?Zr.Maximized:Zr.Normal}));ge.reaction((function(e,n,r){r||t.events.emit(qr.State,e)}));var ye=te({width:hi(b,0,1),height:hi(_,0,1)},$r),be=te({width:hi(p,ye.value.width,1),height:hi(m,ye.value.height,1)},$r);ye.reaction((function(e,t,n){be.setValue({width:hi(p,e.width,1),height:hi(m,e.height,1)},n)})),be.reaction((function(e,n,r){r||t.events.emit(qr.IntrinsicResize,e)}));var xe=ee([be,me],(function(e){var t=o(e,2),n=t[0];return t[1]?{width:1,height:1}:n}),$r);xe.reaction((function(e,n,r){r||t.events.emit(qr.Resize,e)}));var _e=ee([xe,ve,ie,oe],(function(e){var t=o(e,4),n=t[0],r=t[1],i=t[2],a=t[3];return r&&a?{width:a.width/n.width/i.width,height:a.height/n.height/i.height}:n}),$r);_e.reaction((function(e,n,r){r||t.events.emit(qr.VisualResize,e)}));var we=te({x:hi(T,0,1),y:hi(S,0,1)},$r);we.reaction((function(e,n,r){r||t.events.emit(qr.IntrinsicMove,e)}));var Te=ee([we,be,ie,oe,ve,me],(function(e){var t=o(e,6),n=t[0],r=t[1],i=t[2],a=t[3],s=t[4],u=t[5];return s&&a?u?{x:(a.x+a.width/2)/i.width-.5,y:(a.y+a.height/2)/i.height-.5}:{x:(a.x+a.width/2)/i.width-r.width/2,y:(a.y+a.height/2)/i.height-r.height/2}:u?{x:0,y:0}:n}),$r);Te.reaction((function(e,n,r){r||t.events.emit(qr.Move,e)})),this.titleBar=Y||new bi({readonly:ue.value,title:ae.value,namespace:this.namespace,onDragStart:function(e){var n;return null==(n=t._handleTrackStart)?void 0:n.call(t,e)},onEvent:function(e){if(t._delegateEvents.listeners.length>0)t._delegateEvents.emit(e.type);else switch(e.type){case Jr.Maximize:me.setValue(!me.value);break;case Jr.Minimize:ve.setValue(!0);break;case Jr.Close:se.setValue(!1);break;default:console.error("Unsupported titleBar event:",e)}}}),ue.reaction((function(e){t.titleBar.setReadonly(e)}));var Me=te(X),Se=te(Q),Ee=te(Z);ui(this,{prefersColorScheme:ne,darkMode:re,containerRect:ie,collectorRect:oe,title:ae,visible:se,readonly:ue,resizable:le,draggable:ce,fence:he,fixRatio:de,focus:pe,zIndex:fe,minimized:ve,maximized:me,$userContent:Me,$userFooter:Se,$userStyles:Ee}),this._state$=ge,this._minSize$=ye,this._size$=xe,this._intrinsicSize$=be,this._visualSize$=_e,this._coord$=Te,this._intrinsicCoord$=we,this.fixRatio&&this.transform(Te.value.x,Te.value.y,xe.value.width,xe.value.height,!0),this.$box=this.render()}return x(e,[{key:"setState",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];switch(e){case Zr.Maximized:this.setMinimized(!1,t),this.setMaximized(!0,t);break;case Zr.Minimized:this.setMinimized(!0,t),this.setMaximized(!1,t);break;default:this.setMinimized(!1,t),this.setMaximized(!1,t)}return this}},{key:"setMinWidth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._minSize$.setValue({width:e,height:this.minHeight},t),this}},{key:"setMinHeight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._minSize$.setValue({width:this.minWidth,height:e},t),this}},{key:"resize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._intrinsicSize$.setValue({width:e,height:t},n),this}},{key:"move",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._intrinsicCoord$.setValue({x:e,y:t},n),this}},{key:"transform",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(this.fixRatio){var o=this.intrinsicHeight/this.intrinsicWidth*n;t!==this.intrinsicY&&(t-=o-r),r=o}return t<0&&(t=0,r>this.intrinsicHeight&&(r=this.intrinsicHeight)),this._intrinsicCoord$.setValue({x:n>=this.minWidth?e:this.intrinsicX,y:r>=this.minHeight?t:this.intrinsicY},i),this._intrinsicSize$.setValue({width:hi(n,this.minWidth,1),height:hi(r,this.minHeight,1)},i),this}},{key:"mount",value:function(e){return e.appendChild(this.render()),this}},{key:"unmount",value:function(){return this.$box&&this.$box.remove(),this}},{key:"mountContent",value:function(e){return this.set$userContent(e),this}},{key:"unmountContent",value:function(){return this.set$userContent(void 0),this}},{key:"mountFooter",value:function(e){return this.set$userFooter(e),this}},{key:"unmountFooter",value:function(){return this.set$userFooter(void 0),this}},{key:"getUserStyles",value:function(){return this.$userStyles}},{key:"mountStyles",value:function(e){var t;return"string"==typeof e?(t=document.createElement("style")).textContent=e:t=e,this.set$userStyles(t),this}},{key:"unmountStyles",value:function(){return this.set$userStyles(void 0),this}},{key:"render",value:function(e){var t=this;if(e){if(e===this.$box)return this.$box;this.$box=e}else{if(this.$box)return this.$box;this.$box=document.createElement("div")}this._renderSideEffect.flushAll(),this.$box.classList.add(this.wrapClassName("box"));var n=function(e,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:gi;return t._renderSideEffect.add((function(){var o=t.wrapClassName(r);return n.subscribe((function(t){e.classList.toggle(o,i(t))}))}))};n(this.$box,this._readonly$,"readonly"),n(this.$box,this._draggable$,"no-drag",yi),n(this.$box,this._resizable$,"no-resize",yi),n(this.$box,this._focus$,"blur",yi),n(this.$box,this._darkMode$,"color-scheme-dark"),n(this.$box,this._darkMode$,"color-scheme-light",yi),this._renderSideEffect.add((function(){var e=t.wrapClassName("minimized"),n=t.wrapClassName("maximized"),r="box-maximized-timer";return t._state$.subscribe((function(i){t.$box.classList.toggle(e,i===Zr.Minimized),i===Zr.Maximized?(t._renderSideEffect.flush(r),t.$box.classList.toggle(n,!0)):t._renderSideEffect.setTimeout((function(){t.$box.classList.toggle(n,!1)}),0,r)}))})),this._renderSideEffect.add((function(){return t._visible$.subscribe((function(e){t.$box.style.display=e?"block":"none"}))})),this._renderSideEffect.add((function(){return t._zIndex$.subscribe((function(e){t.$box.style.zIndex=String(e)}))}));var r=Xr(this.$box);this.$box.dataset.teleBoxID=this.id,this.$box.style.width=this.absoluteWidth+"px",this.$box.style.height=this.absoluteHeight+"px";var i=this.x*this.containerRect.width+this.containerRect.x,a=this.y*this.containerRect.height+this.containerRect.y;this.$box.style.transform="translate(".concat(i-10,"px,").concat(a-10,"px)"),this._valSideEffectBinder.combine([this._coord$,this._size$,this._minimized$,this._containerRect$,this._collectorRect$],(function(e){var t=o(e,5),n=t[0],r=t[1],i=t[2],a=t[3],s=t[4],u=r.width*a.width,l=r.height*a.height;return{width:u+(i&&s?1:0),height:l+(i&&s?1:0),x:n.x*a.width,y:n.y*a.height,scaleX:i&&s?s.width/u:1,scaleY:i&&s?s.height/l:1}}),$r).subscribe((function(e){r.set(e)})),r.set({x:i,y:a});var s=document.createElement("div");s.className=this.wrapClassName("box-main"),this.$box.appendChild(s);var u=document.createElement("div");u.className=this.wrapClassName("titlebar-wrap"),u.appendChild(this.titleBar.render()),this.$titleBar=u;var l=document.createElement("div");l.className=this.wrapClassName("content-wrap");var c=document.createElement("div");c.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=c,this._renderSideEffect.add((function(){var e;return t._$userStyles$.subscribe((function(t){e&&e.remove(),e=t,t&&l.appendChild(t)}))})),this._renderSideEffect.add((function(){var e;return t._$userContent$.subscribe((function(t){e&&e.remove(),e=t,t&&c.appendChild(t)}))})),l.appendChild(c);var h=document.createElement("div");return h.className=this.wrapClassName("footer-wrap"),this.$footer=h,this._renderSideEffect.add((function(){var e;return t._$userFooter$.subscribe((function(t){e&&e.remove(),e=t,t&&h.appendChild(t)}))})),s.appendChild(u),s.appendChild(l),s.appendChild(h),this._renderResizeHandlers(),this.$box}},{key:"_renderResizeHandlers",value:function(){var e=this,t=document.createElement("div");t.className=this.wrapClassName("resize-handles"),Object.values(Kr).forEach((function(n){var r=document.createElement("div");r.className=e.wrapClassName(n)+" "+e.wrapClassName("resize-handle"),r.dataset.teleBoxHandle=n,t.appendChild(r)})),this.$box.appendChild(t);var n,r,i="handle-tracking-listener",o=this.wrapClassName("transforming"),a=0,s=0,u=0,l=0,c=0,h=0,d=function(t){if(e.state===Zr.Normal){di(t);var n=fi(t),i=n.pageX,o=n.pageY;o<0&&(o=0);var d=(i-c)/e.containerRect.width,f=(o-h)/e.containerRect.height;switch(r){case Kr.North:e.transform(e.x,s+f,e.width,l-f);break;case Kr.South:e.transform(e.x,e.y,e.width,l+f);break;case Kr.West:e.transform(a+d,e.y,u-d,e.height);break;case Kr.East:e.transform(e.x,e.y,u+d,e.height);break;case Kr.NorthWest:e.transform(a+d,s+f,u-d,l-f);break;case Kr.NorthEast:e.transform(e.x,s+f,u+d,l-f);break;case Kr.SouthEast:e.transform(e.x,e.y,u+d,l+f);break;case Kr.SouthWest:e.transform(a+d,e.y,u-d,l+f);break;default:if(e.fence)e.move(hi(a+d,0,1-e.width),hi(s+f,0,1-e.height));else{var p=20/e.containerRect.width,v=20/e.containerRect.height;e.move(hi(a+d,p-e.width,1-p),hi(s+f,0,1-v))}}}},f=function(t){r=void 0,n&&(di(t),e.$box.classList.toggle(o,!1),e._sideEffect.flush(i),n.remove())},p=function(t){var p;if(!(e.readonly||null!=t.button&&0!==t.button||!e.draggable||r||e.state!==Zr.Normal)){var v=t.target;if(null!=(p=v.dataset)&&p.teleBoxHandle){var m;di(t),a=e.x,s=e.y,u=e.width,l=e.height,m=fi(t),c=m.pageX,h=m.pageY,r=v.dataset.teleBoxHandle,n||(n=document.createElement("div"));var g=r?e.wrapClassName("cursor-".concat(r)):"";n.className=e.wrapClassName("track-mask".concat(g?" ".concat(g):"")),e.$box.appendChild(n),e.$box.classList.add(o),e._sideEffect.add((function(){return window.addEventListener("mousemove",d),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("mouseup",f),window.addEventListener("touchend",f,{passive:!1}),window.addEventListener("touchcancel",f,{passive:!1}),function(){window.removeEventListener("mousemove",d),window.removeEventListener("touchmove",d),window.removeEventListener("mouseup",f),window.removeEventListener("touchend",f),window.removeEventListener("touchcancel",f)}}),i)}}};this._handleTrackStart=p,this._sideEffect.addEventListener(t,"mousedown",p,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(t,"touchstart",p,{passive:!1},"box-resizeHandles-touchstart")}},{key:"destroy",value:function(){this.$box.remove(),this.events.emit(qr.Destroyed),this._sideEffect.flushAll(),this._renderSideEffect.flushAll(),this.events.removeAllListeners(),this._delegateEvents.removeAllListeners()}},{key:"wrapClassName",value:function(e){return"".concat(this.namespace,"-").concat(e)}},{key:"darkMode",get:function(){return this._darkMode$.value}},{key:"state",get:function(){return this._state$.value}},{key:"minWidth",get:function(){return this._minSize$.value.width}},{key:"minHeight",get:function(){return this._minSize$.value.height}},{key:"intrinsicWidth",get:function(){return this._intrinsicSize$.value.width}},{key:"intrinsicHeight",get:function(){return this._intrinsicSize$.value.height}},{key:"width",get:function(){return this._size$.value.width}},{key:"height",get:function(){return this._size$.value.height}},{key:"absoluteWidth",get:function(){return this.width*this.containerRect.width}},{key:"absoluteHeight",get:function(){return this.height*this.containerRect.height}},{key:"visualWidth",get:function(){return this._visualSize$.value.width}},{key:"visualHeight",get:function(){return this._visualSize$.value.height}},{key:"intrinsicX",get:function(){return this._intrinsicCoord$.value.x}},{key:"intrinsicY",get:function(){return this._intrinsicCoord$.value.y}},{key:"x",get:function(){return this._coord$.value.x}},{key:"y",get:function(){return this._coord$.value.y}}]),e}();function _i(){}var wi,Ti=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.visible,i=void 0===r||r,o=n.readonly,a=void 0!==o&&o,s=n.darkMode,u=void 0!==s&&s,l=n.namespace,c=void 0===l?"telebox":l,h=n.styles,d=void 0===h?{}:h,f=n.onClick;y(this,e),this.handleCollectorClick=function(){!t._readonly&&t.onClick&&t.onClick()},this._visible=i,this._readonly=a,this._darkMode=u,this.namespace=c,this.styles=d,this.onClick=f}return x(e,[{key:"mount",value:function(e){return e.appendChild(this.render()),this}},{key:"unmount",value:function(){return this.$collector&&this.$collector.remove(),this}},{key:"setVisible",value:function(e){return this._visible!==e&&(this._visible=e,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-visible"),e)),this}},{key:"setReadonly",value:function(e){return this._readonly!==e&&(this._readonly=e,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-readonly"),e)),this}},{key:"setDarkMode",value:function(e){return this._darkMode!==e&&(this._darkMode=e,this.$collector&&(this.$collector.classList.toggle(this.wrapClassName("color-scheme-dark"),e),this.$collector.classList.toggle(this.wrapClassName("color-scheme-light"),!e))),this}},{key:"setStyles",value:function(e){if(Object.assign(this.styles,e),this.$collector){var t=this.$collector;Object.keys(e).forEach((function(n){var r=e[n];null!=r&&(t.style[n]=r)}))}return this}},{key:"render",value:function(){return this.$collector||(this.$collector=document.createElement("button"),this.$collector.className=this.wrapClassName("collector"),this.$collector.style.backgroundImage="url('".concat("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K","')"),this.$collector.addEventListener("click",this.handleCollectorClick),this._visible&&this.$collector.classList.add(this.wrapClassName("collector-visible")),this._readonly&&this.$collector.classList.add(this.wrapClassName("collector-readonly")),this.$collector.classList.add(this.wrapClassName(this._darkMode?"color-scheme-dark":"color-scheme-light")),this.setStyles(this.styles)),this.$collector}},{key:"destroy",value:function(){this.$collector&&(this.$collector.removeEventListener("click",this.handleCollectorClick),this.$collector.remove(),this.$collector=void 0),this.onClick=void 0}},{key:"wrapClassName",value:function(e){return"".concat(this.namespace,"-").concat(e)}},{key:"visible",get:function(){return this._visible}},{key:"readonly",get:function(){return this._readonly}},{key:"darkMode",get:function(){return this._darkMode}}]),e}();!function(e){e.Focused="focused",e.Blurred="blurred",e.Created="created",e.Removed="removed",e.State="state",e.Maximized="maximized",e.Minimized="minimized",e.Move="move",e.Resize="resize",e.IntrinsicMove="intrinsic_move",e.IntrinsicResize="intrinsic_resize",e.VisualResize="visual_resize",e.ZIndex="z_index",e.PrefersColorScheme="prefers_color_scheme",e.DarkMode="dark_mode"}(wi||(wi={}));var Mi,Si,Ei=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).boxes=e.boxes,r.focusedBox=e.focusedBox,r.containerRect=e.containerRect,r.darkMode=e.darkMode,r}return x(n,[{key:"focusBox",value:function(e){var t;if(!this.focusedBox||this.focusedBox!==e){if(this.$titles&&this.state===Zr.Maximized)for(var n=this.$titles.firstElementChild.children,r=n.length-1;r>=0;r-=1){var i=n[r],o=null==(t=i.dataset)?void 0:t.teleBoxID;o&&(e&&o===e.id?i.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&o===this.focusedBox.id&&i.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}this.focusedBox=e}}},{key:"setContainerRect",value:function(e){if(this.containerRect=e,this.$titleBar){var t=e.x,n=e.y,r=e.width;this.$titleBar.style.transform="translate(".concat(t,"px, ").concat(n,"px)"),this.$titleBar.style.width=r+"px"}}},{key:"setBoxes",value:function(e){this.boxes=e,this.updateTitles()}},{key:"setState",value:function(e){i(v(n.prototype),"setState",this).call(this,e),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),e===Zr.Maximized),this.updateTitles()}},{key:"setReadonly",value:function(e){i(v(n.prototype),"setReadonly",this).call(this,e),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("readonly"),this.readonly)}},{key:"setDarkMode",value:function(e){e!==this.darkMode&&(this.darkMode=e,this.$titleBar&&(this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-dark"),e),this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-light"),!e)))}},{key:"render",value:function(){var e=i(v(n.prototype),"render",this).call(this),t=this.containerRect,r=t.x,o=t.y,a=t.width;e.style.transform="translate(".concat(r,"px, ").concat(o,"px)"),e.style.width=a+"px",e.classList.add(this.wrapClassName("max-titlebar")),e.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===Zr.Maximized),e.classList.toggle(this.wrapClassName("readonly"),this.readonly),e.classList.add(this.wrapClassName(this.darkMode?"color-scheme-dark":"color-scheme-light"));var s=document.createElement("div");return s.classList.add(this.wrapClassName("titles-area")),e.insertBefore(s,e.firstElementChild),this.updateTitles(),e}},{key:"destroy",value:function(){i(v(n.prototype),"destroy",this).call(this),this.$titles=void 0,this.boxes.length=0,this.focusedBox=void 0}},{key:"updateTitles",value:function(){this.$titleBar&&this.state===Zr.Maximized&&(this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-single-title"),1===this.boxes.length),1===this.boxes.length?this.setTitle(this.boxes[0].title):this.$titleBar.replaceChild(this.renderTitles(),this.$titleBar.firstElementChild))}},{key:"renderTitles",value:function(){var e=this;this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.$titles.addEventListener("wheel",(function(e){e.currentTarget.scrollBy({left:e.deltaY>0?250:-250,behavior:"smooth"})}),{passive:!1});var t=document.createElement("div");return t.className=this.wrapClassName("titles-content"),this.$titles.appendChild(t),this.boxes.forEach((function(n){var r=document.createElement("button");r.className=e.wrapClassName("titles-tab"),r.textContent=n.title,r.dataset.teleBoxID=n.id,r.dataset.teleTitleBarNoDblClick="true",e.focusedBox&&n.id===e.focusedBox.id&&r.classList.add(e.wrapClassName("titles-tab-focus")),t.appendChild(r)})),this.$titles}}]),n}(bi),Ai=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.root,i=void 0===r?document.body:r,a=n.prefersColorScheme,s=void 0===a?Qr.Light:a,u=n.minimized,l=void 0!==u&&u,c=n.maximized,h=void 0!==c&&c,d=n.fence,f=void 0===d||d,p=n.containerRect,v=void 0===p?{x:0,y:0,width:window.innerWidth,height:window.innerHeight}:p,m=n.collector,g=n.namespace,b=void 0===g?"telebox":g,x=n.readonly,_=void 0!==x&&x;y(this,e),this.events=new xn,this._sideEffect=new ii;var w=li(this._sideEffect),T=w.combine,M=w.createVal;this.root=i,this.namespace=b,this.boxes$=M([]),this.topBox$=this.boxes$.derive((function(e){if(e.length>0)return e.reduce((function(e,t){return e.zIndex>t.zIndex?e:t}))}));var S=window.matchMedia("(prefers-color-scheme: dark)"),E=M(!1);S&&(E.setValue(S.matches),this._sideEffect.add((function(){var e=function(e){E.setValue(e.matches)};return S.addListener(e),function(){return S.removeListener(e)}})));var A=M(s);A.reaction((function(e,n,r){t.boxes.forEach((function(t){return t.setPrefersColorScheme(e,r)})),r||t.events.emit(wi.PrefersColorScheme,e)})),this._darkMode$=T([E,A],(function(e){var t=o(e,2),n=t[0],r=t[1];return"auto"===r?n:"dark"===r})),this._darkMode$.reaction((function(e,n,r){t.boxes.forEach((function(t){return t.setDarkMode(e,r)})),r||t.events.emit(wi.DarkMode,e)}));var I=M(_);I.reaction((function(e,n,r){t.boxes.forEach((function(t){return t.setReadonly(e,r)}))}));var C=M(l),N=M(h);N.reaction((function(e,n,r){t.boxes.forEach((function(t){return t.setMaximized(e,r)})),r||t.events.emit(wi.Maximized,e)}));var k=T([C,N],(function(e){var t=o(e,2),n=t[0],r=t[1];return n?Zr.Minimized:r?Zr.Maximized:Zr.Normal}));k.reaction((function(e,n,r){t.maxTitleBar.setState(e),r||t.events.emit(wi.State,e)}));var D=M(f);D.subscribe((function(e,n,r){t.boxes.forEach((function(t){return t.setFence(e,r)}))}));var P=M(v,$r);P.reaction((function(e,n,r){t.boxes.forEach((function(t){return t.setContainerRect(e,r)})),t.maxTitleBar.setContainerRect(e)}));var O=M(null===m?null:m||new Ti({visible:l,readonly:_,namespace:b}).mount(i));O.subscribe((function(e){e&&(e.setVisible(C.value),e.setReadonly(I.value),e.setDarkMode(t._darkMode$.value),t._sideEffect.add((function(){return e.onClick=function(){I.value||C.setValue(!1)},function(){return e.destroy()}}),"collect-onClick"))})),I.subscribe((function(e){var t;return null==(t=O.value)?void 0:t.setReadonly(e)})),this._darkMode$.subscribe((function(e){var t;null==(t=O.value)||t.setDarkMode(e)}));var R=function(){var e;if(null!=(e=O.value)&&e.$collector){var n=O.value.$collector.getBoundingClientRect(),r=n.x,i=n.y,o=n.width,a=n.height,s=t.root.getBoundingClientRect();return{x:r-s.x,y:i-s.y,width:o,height:a}}},L=M(C.value?R():void 0);L.subscribe((function(e,n,r){t.boxes.forEach((function(t){t.setCollectorRect(e,r)}))})),C.subscribe((function(e,n,r){var i,o;null==(i=O.value)||i.setVisible(e),e&&null!=(o=O.value)&&o.$collector&&L.setValue(R()),t.boxes.forEach((function(t){return t.setMinimized(e,r)})),r||t.events.emit(wi.Minimized,e)}));var j=this.wrapClassName("titlebar-icon-close"),B=function(e){var n;if(!I.value){var r=e.target;if(r.tagName)for(var i=r;i;i=i.parentElement){if(i.classList&&i.classList.contains(j))return;var o=null==(n=i.dataset)?void 0:n.teleBoxID;if(o){var a=t.getBox(o);if(a)return t.focusBox(a),void t.makeBoxTop(a)}}}};this._sideEffect.addEventListener(window,"mousedown",B,!0),this._sideEffect.addEventListener(window,"touchstart",B,!0),this.maxTitleBar=new Ei({darkMode:this.darkMode,readonly:I.value,namespace:this.namespace,state:k.value,boxes:this.boxes$.value,containerRect:P.value,onEvent:function(e){switch(e.type){case Jr.Maximize:N.setValue(!N.value);break;case Jr.Minimize:C.setValue(!0);break;case qr.Close:t.removeTopBox(),t.focusTopBox()}}}),I.subscribe((function(e){return t.maxTitleBar.setReadonly(e)})),this._darkMode$.subscribe((function(e){t.maxTitleBar.setDarkMode(e)})),this.boxes$.reaction((function(e){t.maxTitleBar.setBoxes(e)})),ui(this,{prefersColorScheme:A,containerRect:P,collector:O,collectorRect:L,readonly:I,fence:D,minimized:C,maximized:N}),this._state$=k,this.root.appendChild(this.maxTitleBar.render())}return x(e,[{key:"setState",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];switch(e){case Zr.Maximized:this.setMinimized(!1,t),this.setMaximized(!0,t);break;case Zr.Minimized:this.setMinimized(!0,t),this.setMaximized(!1,t);break;default:this.setMinimized(!1,t),this.setMaximized(!1,t)}return this}},{key:"create",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=new xi(yn(gn({zIndex:this.topBox?this.topBox.zIndex+1:100},n?this.smartPosition(t):t),{darkMode:this.darkMode,prefersColorScheme:this.prefersColorScheme,maximized:this.maximized,minimized:this.minimized,fence:this.fence,namespace:this.namespace,containerRect:this.containerRect,readonly:this.readonly,collectorRect:this.collectorRect}));return r.mount(this.root),r.focus&&(this.focusBox(r),n&&this.makeBoxTop(r)),this.boxes$.setValue([].concat(a(this.boxes),[r])),r._delegateEvents.on(Jr.Maximize,(function(){e.setMaximized(!e.maximized)})),r._delegateEvents.on(Jr.Minimize,(function(){e.setMinimized(!0)})),r._delegateEvents.on(Jr.Close,(function(){e.remove(r),e.focusTopBox()})),r._coord$.reaction((function(t,n,i){i||e.events.emit(wi.Move,r)})),r._size$.reaction((function(t,n,i){i||e.events.emit(wi.Resize,r)})),r._intrinsicCoord$.reaction((function(t,n,i){i||e.events.emit(wi.IntrinsicMove,r)})),r._intrinsicSize$.reaction((function(t,n,i){i||e.events.emit(wi.IntrinsicResize,r)})),r._visualSize$.reaction((function(t,n,i){i||e.events.emit(wi.VisualResize,r)})),r._zIndex$.reaction((function(t,n,i){if(e.boxes.length>0){var o=e.boxes.reduce((function(e,t){return e.zIndex>t.zIndex?e:t}));e.topBox$.setValue(o)}i||e.events.emit(wi.ZIndex,r)})),this.events.emit(wi.Created,r),r}},{key:"query",value:function(e){return e?this.boxes.filter(this.teleBoxMatcher(e)):a(this.boxes)}},{key:"queryOne",value:function(e){return e?this.boxes.find(this.teleBoxMatcher(e)):this.boxes[0]}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.boxes.find((function(t){return t.id===e}));if(r)return this.updateBox(r,t,n)}},{key:"updateAll",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.boxes.forEach((function(r){t.updateBox(r,e,n)}))}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getBoxIndex(e);if(n>=0){var r=this.boxes.slice(),i=r.splice(n,1);return this.boxes$.setValue(r),i.forEach((function(e){return e.destroy()})),t||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(wi.Removed,i)),i[0]}}},{key:"removeTopBox",value:function(){if(this.topBox)return this.remove(this.topBox)}},{key:"removeAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.boxes$.value;return this.boxes$.setValue([]),t.forEach((function(e){return e.destroy()})),e||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(wi.Removed,t)),t}},{key:"destroy",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.events.removeAllListeners(),this._sideEffect.flushAll(),this.removeAll(t),Object.keys(this).forEach((function(t){var n=e[t];n instanceof si&&n.destroy()}))}},{key:"wrapClassName",value:function(e){return"".concat(this.namespace,"-").concat(e)}},{key:"focusBox",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.getBox(e);r&&(this.boxes.forEach((function(e){if(r===e){var i=!1;r.focus||(i=!0,r.setFocus(!0,n)),i&&!n&&t.events.emit(wi.Focused,r)}else e.focus&&t.blurBox(e,n)})),this.maxTitleBar.focusBox(r))}},{key:"focusTopBox",value:function(){if(this.topBox&&!this.topBox.focus)return this.focusBox(this.topBox)}},{key:"blurBox",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getBox(e);n&&(n.focus&&(n.setFocus(!1,t),t||this.events.emit(wi.Blurred,n)),this.maxTitleBar.focusedBox===n&&this.maxTitleBar.focusBox())}},{key:"blurAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.boxes.forEach((function(n){n.focus&&(n.setFocus(!1,t),t||e.events.emit(wi.Blurred,n))})),this.maxTitleBar.focusedBox&&this.maxTitleBar.focusBox()}},{key:"teleBoxMatcher",value:function(e){var t=Object.keys(e);return function(n){return t.every((function(t){return e[t]===n[t]}))}}},{key:"updateBox",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(null!=t.x||null!=t.y)&&e.move(null==t.x?e.intrinsicX:t.x,null==t.y?e.intrinsicY:t.y,n),(null!=t.width||null!=t.height)&&e.resize(null==t.width?e.intrinsicWidth:t.width,null==t.height?e.intrinsicHeight:t.height,n),null!=t.title&&(e.setTitle(t.title),this.maxTitleBar.updateTitles()),null!=t.visible&&e.setVisible(t.visible,n),null!=t.minHeight&&e.setMinHeight(t.minHeight,n),null!=t.minWidth&&e.setMinWidth(t.minWidth,n),null!=t.resizable&&e.setResizable(t.resizable,n),null!=t.draggable&&e.setDraggable(t.draggable,n),null!=t.fixRatio&&e.setFixRatio(t.fixRatio,n),null!=t.zIndex&&e.setZIndex(t.zIndex,n),null!=t.content&&e.mountContent(t.content),null!=t.footer&&e.mountFooter(t.footer)}},{key:"smartPosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.x,n=e.y,r=e.width,i=void 0===r?.5:r,o=e.height,a=void 0===o?.5:o;if(null==t){var s=20;this.topBox&&((s=this.topBox.intrinsicX*this.containerRect.width+20)>this.containerRect.width-i*this.containerRect.width&&(s=20)),t=s/this.containerRect.width}if(null==n){var u=20;this.topBox&&((u=this.topBox.intrinsicY*this.containerRect.height+20)>this.containerRect.height-a*this.containerRect.height&&(u=20)),n=u/this.containerRect.height}return yn(gn({},e),{x:t,y:n,width:i,height:a})}},{key:"makeBoxTop",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.topBox&&e!==this.topBox&&e.setZIndex(this.topBox.zIndex+1,t)}},{key:"getBoxIndex",value:function(e){return"string"==typeof e?this.boxes.findIndex((function(t){return t.id===e})):this.boxes.findIndex((function(t){return t===e}))}},{key:"getBox",value:function(e){return"string"==typeof e?this.boxes.find((function(t){return t.id===e})):e}},{key:"boxes",get:function(){return this.boxes$.value}},{key:"topBox",get:function(){return this.topBox$.value}},{key:"darkMode",get:function(){return this._darkMode$.value}},{key:"state",get:function(){return this._state$.value}}]),e}(),Ii=function(){function e(t,n){var r=this;y(this,e),this.context=t,this.createTeleBoxManagerConfig=n;var i=t.emitter,o=t.callbacks,a=t.boxEmitter;this.teleBoxManager=this.setupBoxManager(n),this.teleBoxManager._state$.reaction((function(e){o.emit("boxStateChange",e),i.emit("boxStateChange",e)})),this.teleBoxManager._darkMode$.reaction((function(e){o.emit("darkModeChange",e)})),this.teleBoxManager._prefersColorScheme$.reaction((function(e){o.emit("prefersColorSchemeChange",e)})),this.teleBoxManager._minimized$.reaction((function(e){e||setTimeout((function(){var e=.001*(Math.random()>.5?1:-1);r.teleBoxManager.boxes.forEach((function(t){t.resize(t.intrinsicWidth+e,t.intrinsicHeight+e,!0)}))}),400)})),this.teleBoxManager.events.on("minimized",(function(e){if(r.context.safeSetAttributes({minimized:e}),e)r.context.cleanFocus(),r.blurAllBox();else{var t=r.getTopBox();t&&(r.context.setAppFocus(t.id),r.focusBox({appId:t.id},!1))}})),this.teleBoxManager.events.on("maximized",(function(e){r.context.safeSetAttributes({maximized:e})})),this.teleBoxManager.events.on("removed",(function(e){e.forEach((function(e){a.emit("close",{appId:e.id})}))})),this.teleBoxManager.events.on("intrinsic_move",j.debounce((function(e){a.emit("move",{appId:e.id,x:e.intrinsicX,y:e.intrinsicY})}),50)),this.teleBoxManager.events.on("intrinsic_resize",j.debounce((function(e){a.emit("resize",{appId:e.id,width:e.intrinsicWidth,height:e.intrinsicHeight})}),200)),this.teleBoxManager.events.on("focused",(function(e){e&&(r.canOperate?a.emit("focus",{appId:e.id}):r.teleBoxManager.blurBox(e.id))})),this.teleBoxManager.events.on("z_index",(function(e){r.context.updateAppState(e.id,$.ZIndex,e.zIndex)})),i.on("playgroundSizeChange",(function(){return r.updateManagerRect()})),i.on("updateManagerRect",(function(){return r.updateManagerRect()}))}return x(e,[{key:"createBox",value:function(e){var t,n,r;if(this.teleBoxManager){var i=null!=(t=e.app.config)?t:{},o=i.minwidth,a=void 0===o?.4722222222222222:o,s=i.minheight,u=void 0===s?.4722222222222222:s,l=null!=(n=e.app.config)?n:{},c=l.width,h=l.height,d=(null==(r=e.options)?void 0:r.title)||e.appId,f=this.teleBoxManager.containerRect;a>1&&(a/=f.width),u>1&&(u/=f.height);var p={title:d,minWidth:a,minHeight:u,width:c,height:h,id:e.appId};this.teleBoxManager.create(p,e.smartPosition),this.context.emitter.emit("".concat(e.appId).concat(q.WindowCreated))}}},{key:"setBoxInitState",value:function(e){var t=this.teleBoxManager.queryOne({id:e});t&&t.state===Zr.Maximized&&this.context.boxEmitter.emit("resize",{appId:e,x:t.x,y:t.y,width:t.intrinsicWidth,height:t.intrinsicHeight})}},{key:"setupBoxManager",value:function(e){var t=Ib.wrapper?Ib.wrapper:document.body,n=t.getBoundingClientRect(),r={root:t,containerRect:{x:0,y:0,width:n.width,height:n.height},fence:!1,prefersColorScheme:null==e?void 0:e.prefersColorScheme},i=new Ai(r);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=i;var o=(null==e?void 0:e.collectorContainer)||Ib.wrapper;return o&&this.setCollectorContainer(o),i}},{key:"setCollectorContainer",value:function(e){var t,n=new Ti({styles:null==(t=this.createTeleBoxManagerConfig)?void 0:t.collectorStyles}).mount(e);this.teleBoxManager.setCollector(n)}},{key:"getBox",value:function(e){return this.teleBoxManager.queryOne({id:e})}},{key:"closeBox",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.teleBoxManager.remove(e,t)}},{key:"boxIsFocus",value:function(e){var t=this.getBox(e);return null==t?void 0:t.focus}},{key:"getFocusBox",value:function(){return this.teleBoxManager.query({focus:!0})[0]}},{key:"getTopBox",value:function(){return this.teleBoxManager.topBox}},{key:"updateBoxState",value:function(e){var t=this;if(e){var n=this.getBox(e.id);n&&(this.teleBoxManager.update(n.id,{x:e.x,y:e.y,width:e.width||.5,height:e.height||.5,zIndex:e.zIndex},!0),setTimeout((function(){e.focus&&t.teleBoxManager.focusBox(n.id,!0),null!=e.maximized&&t.teleBoxManager.setMaximized(Boolean(e.maximized),!0),null!=e.minimized&&t.teleBoxManager.setMinimized(Boolean(e.minimized),!0)}),50),this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}}},{key:"updateManagerRect",value:function(){var e,t=null==(e=this.mainView.divElement)?void 0:e.getBoundingClientRect();if(t&&t.width>0&&t.height>0){var n={x:0,y:0,width:t.width,height:t.height};this.teleBoxManager.setContainerRect(n),this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect)}}},{key:"moveBox",value:function(e){var t=e.appId,n=e.x,r=e.y;this.teleBoxManager.update(t,{x:n,y:r},!0)}},{key:"focusBox",value:function(e){var t=e.appId,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.teleBoxManager.focusBox(t,n)}},{key:"resizeBox",value:function(e){var t=e.appId,n=e.width,r=e.height,i=e.skipUpdate;this.teleBoxManager.update(t,{width:n,height:r},i)}},{key:"setBoxMinSize",value:function(e){this.teleBoxManager.update(e.appId,{minWidth:e.minWidth,minHeight:e.minHeight},!0)}},{key:"setBoxTitle",value:function(e){this.teleBoxManager.update(e.appId,{title:e.title},!0)}},{key:"blurAllBox",value:function(){this.teleBoxManager.blurAll()}},{key:"updateAll",value:function(e){this.teleBoxManager.updateAll(e)}},{key:"setMaximized",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e!==this.maximized&&this.teleBoxManager.setMaximized(e,t)}},{key:"setMinimized",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.teleBoxManager.setMinimized(e,t)}},{key:"focusTopBox",value:function(){if(this.teleBoxManager.query().length>=1){var e=this.getTopBox();e&&this.focusBox({appId:e.id},!1)}}},{key:"updateBox",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.teleBoxManager.update(e,t,n)}},{key:"setReadonly",value:function(e){this.teleBoxManager.setReadonly(e)}},{key:"setPrefersColorScheme",value:function(e){this.teleBoxManager.setPrefersColorScheme(e)}},{key:"setZIndex",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.teleBoxManager.update(e,{zIndex:t},n)}},{key:"destroy",value:function(){this.teleBoxManager.destroy()}},{key:"mainView",get:function(){return this.context.getMainView()}},{key:"canOperate",get:function(){return this.context.canOperate()}},{key:"boxState",get:function(){return this.teleBoxManager.state}},{key:"maximized",get:function(){return this.teleBoxManager.maximized}},{key:"minimized",get:function(){return this.teleBoxManager.minimized}},{key:"darkMode",get:function(){return this.teleBoxManager.darkMode}},{key:"prefersColorScheme",get:function(){return this.teleBoxManager.prefersColorScheme}},{key:"boxSize",get:function(){return this.teleBoxManager.boxes.length}}]),e}();function Ci(){}function Ni(e){return e()}function ki(){return Object.create(null)}function Di(e){e.forEach(Ni)}function Pi(e){return"function"==typeof e}function Oi(e,t){return e!=e?t==t:e!==t||e&&"object"==_(e)||"function"==typeof e}function Ri(e,t){return Mi||(Mi=document.createElement("a")),Mi.href=t,e===Mi.href}function Li(e,t){e.appendChild(t)}function ji(e,t,n){e.insertBefore(t,n||null)}function Bi(e){e.parentNode.removeChild(e)}function Ui(e){return document.createElement(e)}function Fi(e){return document.createTextNode(e)}function zi(){return Fi(" ")}function Gi(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Hi(e){return Array.from(e.childNodes)}function Vi(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function Wi(e,t,n,r){null===n?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Yi(e){Si=e}var Xi=[],Qi=[],Zi=[],qi=[],Ji=Promise.resolve(),Ki=!1;function $i(e){Zi.push(e)}var eo=new Set,to=0;function no(){var e=Si;do{for(;to7&&void 0!==arguments[7]?arguments[7]:[-1],u=Si;Yi(e);var l=e.$$={fragment:null,ctx:null,props:o,update:Ci,not_equal:i,bound:ki(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:ki(),dirty:s,skip_bound:!1,root:t.target||u.$$.root};a&&a(l.root);var c=!1;if(l.ctx=n?n(e,t.props||{},(function(t,n){var r=!(arguments.length<=2)&&arguments.length-2?arguments.length<=2?void 0:arguments[2]:n;return l.ctx&&i(l.ctx[t],l.ctx[t]=r)&&(!l.skip_bound&&l.bound[t]&&l.bound[t](r),c&&so(e,t)),n})):[],l.update(),c=!0,Di(l.before_update),l.fragment=!!r&&r(l.ctx),t.target){if(t.hydrate){var h=Hi(t.target);l.fragment&&l.fragment.l(h),h.forEach(Bi)}else l.fragment&&l.fragment.c();t.intro&&oo(e.$$.fragment),ao(e,t.target,t.anchor,t.customElement),no()}Yi(u)}(c(r=t.call(this)),e,po,fo,Oi,{cursorName:0,tagName:1,backgroundColor:2,appliance:3,x:4,y:5,src:6,visible:19,avatar:7,theme:8,color:9,cursorTagBackgroundColor:10,opacity:11,pencilEraserSize:20}),r}return n}(uo),mo=function(){function e(t,n,r,i){var o=this;y(this,e),this.manager=t,this.memberId=n,this.cursorManager=r,this.wrapper=i,this.move=function(e){var t;if("main"===e.type){var n=o.cursorManager.wrapperRect;o.component&&n&&(o.autoHidden(),o.moveCursor(e,n,o.manager.mainView))}else{var r=o.cursorManager.focusView,i=null==(t=null==r?void 0:r.divElement)?void 0:t.getBoundingClientRect(),a=null==r?void 0:r.camera;r&&i&&a&&o.component&&(o.autoHidden(),o.moveCursor(e,i,r))}},this.leave=function(){o.hide()},this.updateMember(),this.createCursor(),this.autoHidden()}var t;return x(e,[{key:"moveCursor",value:function(e,t,n){var r,i,o=e.x,a=e.y,s=e.type,u=null==n?void 0:n.screen.convertPointToScreen(o,a);if(u){var l=u.x-2,c=u.y-18;if("app"===s){var h=this.cursorManager.wrapperRect;h&&(l=l+t.x-h.x,c=c+t.y-h.y)}u.x<0||u.x>t.width||u.y<0||u.y>t.height?null==(r=this.component)||r.$set({visible:!1,x:l,y:c}):null==(i=this.component)||i.$set({visible:!0,x:l,y:c})}}},{key:"autoHidden",value:function(){var e=this;this.timer&&clearTimeout(this.timer),this.timer=window.setTimeout((function(){e.hide()}),1e4)}},{key:"createCursor",value:(t=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.member&&this.wrapper&&(this.component=new vo({target:this.wrapper,props:this.initProps()}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"initProps",value:function(){var e;return{x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName,pencilEraserSize:null==(e=this.member)?void 0:e.memberState.pencilEraserSize}}},{key:"getIcon",value:function(){var e;if(this.member){var t=this.cursorManager.applianceIcons,n=t[B.ApplianceNames.shape];if(this.memberApplianceName===B.ApplianceNames.pencilEraser){var r=(null==(e=this.member)?void 0:e.memberState.pencilEraserSize)||1;n=t["".concat(this.memberApplianceName).concat(r)]}else n=t[this.memberApplianceName||B.ApplianceNames.shape];return n||t[B.ApplianceNames.shape]}}},{key:"updateMember",value:function(){return this.member=dt(this.manager.room,this.memberId),this.updateComponent(),this.member}},{key:"updateComponent",value:function(){var e;null==(e=this.component)||e.$set(j.omit(this.initProps(),["x","y"]))}},{key:"destroy",value:function(){this.component&&this.component.$destroy(),this.cursorManager.cursorInstances.delete(this.memberId),this.timer&&clearTimeout(this.timer)}},{key:"hide",value:function(){this.component&&(this.component.$set({visible:!1}),this.destroy())}},{key:"memberApplianceName",get:function(){var e,t;return null==(t=null==(e=this.member)?void 0:e.memberState)?void 0:t.currentApplianceName}},{key:"memberColor",get:function(){var e,t;return"rgb(".concat(null==(t=null==(e=this.member)?void 0:e.memberState)?void 0:t.strokeColor.join(","),")")}},{key:"payload",get:function(){var e;return null==(e=this.member)?void 0:e.payload}},{key:"memberCursorName",get:function(){var e,t;return(null==(e=this.payload)?void 0:e.nickName)||(null==(t=this.payload)?void 0:t.cursorName)||this.memberId}},{key:"memberTheme",get:function(){var e;return null!=(e=this.payload)&&e.theme?"netless-window-manager-cursor-inner-mellow":"netless-window-manager-cursor-inner"}},{key:"memberCursorTextColor",get:function(){var e;return(null==(e=this.payload)?void 0:e.cursorTextColor)||"#FFFFFF"}},{key:"memberCursorTagBackgroundColor",get:function(){var e;return(null==(e=this.payload)?void 0:e.cursorTagBackgroundColor)||this.memberColor}},{key:"memberAvatar",get:function(){var e;return null==(e=this.payload)?void 0:e.avatar}},{key:"memberOpacity",get:function(){return this.memberCursorName||this.memberAvatar?1:0}},{key:"memberTagName",get:function(){var e;return null==(e=this.payload)?void 0:e.cursorTagName}}]),e}(),go=(w(r={},B.ApplianceNames.pencil,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYISURBVHgB7ZpNSCtXFIBPEuvz+dMGpYUKD/sWFX+Qti6kK7Hqpm6e9q0rIoIUFUShPLV10VZx4+JZqa9v20LBhdq9fyBUCtKNPH8qYl2IOw3G38Rkek4y15y5uTOZJDOWggcOSSYzN/ebc+45554JwIM8iBCPyTEP+86T4vyMfsRN4b+nQTKIJp0vzuGvlpID7os8EQNEIBD4oKio6Bm9DwaDv/v9/n/076JgbtWUYPchwrW8qD7UnOvr6wFNkpubm+/wu7f0c7y6mrnlvQufxB0Iau7V1dX3BDA/P6/V1dVpzc3N2uLiIofK1c8VYHys/wRKBUN3/hGHqaysNOjc3FwMis6hc0FtLTHuvYLxCCZgci8uLn4wg5Gh6Fy8Jk+/NkcCAlAAuUkoW4g0B+d5tLS05O/r67O8eGxsDNra2uDy8nKsoKCAwCIQDxQa0yTxgrvCYXyTk5Ml+Orf2dlJeeHIyAigFSE/P38ELfUNqNdSkjgF5FF89jL1TU1NlQwODl5gZPujp6cHWltbUw7Koc7Pz8mkZpHPFeFrJuZeqLnoMoPoZqe0JjDP/IZgnyLUG/o8NDRkuo5Ua2pjY6MC4oFCFf1cA0oKzRSOp6enRfTaGh0d/QxBt+1CUVgnOTs7+xrHfQzGyOcKkK3QTJMnQffZ6e/v/xwttmsHqqmpKXbdycnJCxy7ABLh3FEgVZ6hZJhnFZoFFMF0d3c/w7v+dyookXBnZ2c/xvHfhriVcvXfdBRItsxjnOhYqjwjoAimq6vrCysoGofk+Ph4Esd/F/UdiFtJAGUd2DygTpp5dmBUUJ2dnc9VUALm8PDwJY7/BPU9VD8k3M4RC6kskxZMKigKIMLN9vf3p3H8DyWgfEhEOwOQD9IXOTz7EObbwsLC4YWFBRgeHrY9ECXYo6MjaGlpKWlsbPxkYGDgRW1tbSEWquVlZWXBzc3Nl1VVVa8hXiXc6ioqBqGaPDk7AACJTRZ3NS9lcUp86cJwoSQ7Pj4Op6enfxUXF3/V0NCQv7q6GsCvwrqGUG/01xAD4+VQTOxaSF43d5bBOisrGBJRCtXX17+/trb268rKSgASFgmz97KFkmo6OztWuVyPweiWGc4WRkhFRQVEIpHg8vJyQAIQVlLBROVxvBYQHsXnO8tk62ZcyN0wecLBwcEvYHSzEPscBqOLCRhLC4n9uqaA8UAWAcAKhtbQ3t7eTHl5+Y9gtAp3twhT056CDMQ7MRzIFTeTYKb1yYYVQFH9VdzsqNmYKpfTJBDX3Ixgdnd3XyHMT2AMALJlBBSPaMpNngrIsTyTCgaj288YDGakictrxizvKFNOjgSSBLS+vv6UYHDb7DgMVgsChjTEgCIKGG4ZU+EWkgNBzN1qamq+pAMTExPgFMzW1tZrhHkFyWE5KxgSszx0527RaDRmOSpRshEOU11dPQPG8CwHARHJlMnTSrwSRFIlfXt7m3V5ngJGuJtqzaQtZkFBVNJezN5ZAdmwjKo2k9tVtrcI3OXk4tPgcg7ChCDZ1URgMOu72Xa5VFHOkymQhWVU60YVmjN6wiC7k6p+S1syCACOwJBYFaexV+yhBekNPsMBO6KAEeE4BMaCU67RsoYhSbXgaT//ht709vZCaWmp6YkEbLFmVJWzas04+iBL7EKpm0J7duqu0B7+CTUpNJuyvb1NCfMj1CqI9wLKUOlOUMeG+gGFkHii4HizUF4z/KFUrPsJ8WbEIyx7nnZ0dDynME6BAuce09iFHo+GrnmGltltb2//E4wVAN82y7vOjKOZXSBhJdHNiT3TYWD8OY2PTUJkdd7MkJMnT5wZVQF2RFX6yBMUdzPMvvfqxz3sXHF+GNT9ANXit/10O1sgHkZvdQAOKvs9B5L7ARELGAAXLSTvM8QExTE+YbHe+HURhZp1aRyF4CJXClbbWwGketgkW9VsY+YaiBCVhfgE+XvxRwgZSM4jUVCDZFQ9pytmXR8hUTB2gnidx4XffVWydN0yQjwmx/jkAZJBrIBI5J7ZvQGZWUgVSuU/EqmOAzicKNMVu816DdRWUV1/7xAP8n+SfwF3Du3NF2sYhwAAAABJRU5ErkJggg=="),w(r,B.ApplianceNames.selector,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAxCAYAAABznEEcAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAZoSURBVHgB7VlLSCRXFL3ljNEhEXTGhMQJmOjCz8ZNVLKICz9xIYhCNi7UgINkGEk2En8hW5cBUQNxo05GAoKikuCAmvGzGMdPcCUGjDPxD/4Vv/3JvWW97luvq7ur+hMZ8MKlqrteNfe8e965970GuLVbC5kpJr53+hjHx9yY3TUxJgLMAQG4ITARfp5T4Mri4uL9q6urnxwOxz/oY5eXl1/Pzs7e195X2FX4jZsIhAK7gx5ps9m6nGj9/f3OtbU1pzAE0318fPwVjYHrrN7R3AjU/wpOBwA9Cmf/9ejoqDMtLU31iooKGdA+ATo4OMiXAEWAHhBAGEApXj4rPAik0vPt7e0vCgoKPH4gMzMTSktLIS8vD2JiYgABvcHMTZyennbHxsaOg3udOJmLzwqEYB0ZgRCZENm4u7e39yQuLq65srISZmZmvP5Ybm4u5OfnQ0lJyXWUCAgzNLS+vt6SnJz8WgvYwV5xSlcRgyVg3ha2Dkxzc3MvfZmVlQW+bGxsDBobGyE7O1u94uJPjIqKqklKSvrbbrfPnp+ff7e8vJwMnlSTKWfJjDKhywJo6wLp0YcZ+dyIUr7s4cOHLsrRlQwBTSBFuzc2NiZYhjjVAIyzZBqEwgCQv0OOM/gNzuiP/ijlDxBRjgClpqa6AF1cXDydmpoaLCws3JcAGYHyC4JMzoKaibKysvienp6FtrY2IA/WCFB5ebkqCHSvARo8Ozt7igIxwIJ2gJ+seFMnDoIyEUV+dHT0G3qWVUr5M043DdAB0m2IKZwAYpgZX+qkywR6NFbuR0iDxmAoZRUQKRxSLTMnJ8eIaqqSeVMnIYUOdu+sq6vrp4f+VCoYo8khZaNs01VRlERUu2/BrWAA7sl2Anink1Ao18JGjyY/PDx8hq1GZqgp5c2mp6chMjLy2b179x7hRzvoqeUUwXIzqq4O5nZsNUaEbIbLqPLTou/s7FTvT05OpsA9sXJG1AVsZDwjutqBIN6gUlWjxod8XRBNKXgsrqpqYZfwEqX9h8TExD7wbFm8LmzxHQ0QHSlXKZVSqFC/hkqlaKapTaGgCQTK7PHW1lb/wsLC86KiokkccoV+qV1tcE0pO7AWxmhTxBszDzqRr66ujqanp2cRpQLNBgUsCh8BwQ54bn5+/s+mpqa+4eHhfS1gb52vwuP0trPjhSZCBtLQ0NA3MDDQQIFYAUHBYhuvzjpVbJr1lZWVP3p7e19UVVXNgHumXYrI4uBx6Yqevz02b0FcRQ8CoBQF3dXVpQLZ3d39C7n+ora29vfJyclDYFnWgFyxK3cxhss/+KoT/N6DVkQpKypFGUCp3Ozo6HgSHx//GLW/BwHsg57zl5pzADajwLn52mPL1ZHPloMoRYPMFL6EhAR18e7s7MxVV1fPsAAp4Avteq7dC/c1+wKI4g+EfGzDM+EYHBw8RDrNiA2QL6upqVGvKJ2/gHu2L1nA5wwEB2YDfSYMO1x/px0cgEc2zBY+eo67u6H29vZ/wU2VC8l58JxKNjDOgojNEp08aFVfX++3l6JMEdDx8fEB0FNIBsDXBc8ArwuW1EkeI1RKdLWmCx+1DhkZGRvR0dFfSsHKxYtnW0iqvJAN9xNm6MR/QO5sfapUSkqKmqW5ubmfwVgyZdpw/vPZl2kUEAinBMSUStG+gwra0NDQSynQKyloIxnlewafjDFLJzLRBJqiFMnqyMgIbG5uDuD996Dnv8iAPOMAPmbcm5lVJwA/vZRMKZGZlpaWVtAvUL4GZMqE1fjRJrUd76LHoX+InlhcXPwZnWW2tra6jjrpiBM3UK/weQr6J+gfodMh9HtwncG7YLA3CMSsLmxx5WuDCt8B7vZeicInTjCWlpb6wc15mfey7oc9E8LElpVmMgb9AXoC+qcTExOPKRu4NlTHs6Q10GfhgfYOvRsJQZ76BWMKuDtaolQs+gfoH6Mn436gDg+e+5BKXUQx/C5Je/a+NpbeiQJPKgUdlNXx/BCBKxVdxW5Q0I3XBqFKRhU4KLtjYawi3csuTKdc4FnIXNvKUJkVEGRG20QZAAUpA5DbaYAQLmQzfzxyk/ffdnCD4NWVnGdE7kQBQvQHC5lVEDxgMaM29lkxGCNLKrDnIbFAMkFmBIaDkHstU41coGZ1TZD5UjReCGUAYbNgdNqoXZB/T67yYbFAMiGML3BhYeH8rb0t9h/zgcTBcTNGiQAAAABJRU5ErkJggg=="),w(r,B.ApplianceNames.eraser,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAgrSURBVHgB7ZprTBRXFIDP7gIt8lQppTwE5V0KaAn6o1pqNGkDDTEmTUhsgKRp+gNJw68CFkLbVC2QkDS+gD8KJdWmARvbFBNNWpuIRGPFWBXQRMPDqIki+KLATs+ZnTvcvXtnX8w2beJJToaduTP3fHPOPffcOwC8kP+2WCDwIvahGFxTuN8KmNSZmULPNjLeqF9F8rdPkIEGEn+r+vjx46LQ0NA8/Dsader58+e/h4WFDWntFO7ot6fMFAt3JLWi2lCDpqamCux2+2+KROj82NhYGrXT2lu5Z/DP/deFByElA4Pv3LlTiHY/nJ6eVnbv3q1s2bJFyc7OVrZu3arU1dUp4+PjxPUQoT+g9tp9PkMFgpo9kxljHRoaWp2Xl3duYmIiurKyEvDoclNCQgIcPnxYPc7MzHwcGRnZhaft4Ag7O9fUbRhaITCie4lgcnNzT7qDIaHz27dvh+vXr0NEREQneqoCHKFnAR+8ZCaQGGq2CxcurCGYycnJZHcwTNAzUFFRoUJFRUV1IFQ5OKBsXB9uxSwgl0TQ3d29Yt26dccwoyVXV1d7hGEiQmGi2AzOUHx/hob4K2yuYS9G987s7OwPISEh7xPM6dOnwVfBsIMjR45AZmbmo5s3b76Xnp7+J55egMVxBSAZT0v1ED+76yn66dOnLQSzd+9ev2BIyFP0MjBco1JTU/sxfFeDazp3cYgZHmKqdoaGNISHh9fv378fSJcqlPV6e3sBJ+I/goOD34VFL0k95Y+HxPHCYGxmw5DQ2NuzZw8EBQVtunXr1jvgwUP+hhz/QDXMMCNVE8zx48dNg2FCz6QQjI2N/RA8VBFmANnu3btXihnpG8pM9fX1EAi5du0aeWkVOAMBCF7yN+R0z4yOjq6NiYlpp9CgdBtIwXpPH6vgDKWLt0CygtM6MDCwBuUYZSKaOCksAiVY9wFOBePgDOOytPAGSKzNVCCC2bBhw69YdK7ypgpYimzbtk2dl7CM+hFcveOUHDylbTFO1YdhFbByx44dA1QFUP0VSJj4+Hjo6+sDq9U6iEmHKvFZTedQ50GYbN15SITVlwNlZWUnLRZL8s6dOwMOQ9UCTtKTra2ttdppt9V2kMF5cbmsjxuM43bMNrmUzc6fP6+GQiDGDoOJi4ubwb4qm5ubafyIE6nLxGqTPEsGo1cBOGNX0TyDYafC0CyOaxcVziyh53Z2dkJycvLMvn37PmpoaBgFR4jxYSbWdVIgI89Iq4CjR48CZjlYv369+tssqI6ODsjPz4f+/v668vLycxrEHHfkYdwC8SB6mGEV8Cl64cuuri5oa2tTG+EyGjZu3AiXLl1qefDgwV8lJSUFZkDV1tZCcXExXLx4sbWoqKgPFj0zx8GI9ZwO5W4M6ekZYeqpaqbqmaSqqkpNpcPDw4dwzfM9nrLduHEjEs+X0XV/Sx96LnqE1kLtBQUF3eDwCO8dGQyzV5rl+JyuegfXI29jRotiRlKnpFghHMzKyjqotVXS0tLacKPjF3bdHxjSq1evduAkepAD+ZsDYlC8V5w8ZBVg+PPq2MGMlkInqE4joTf45MmT4YyMjAPcA+ltLSQlJX2BafxnX6HI29QeK44TOTk57mCYZ0QoJ8OBM4yB6dkNkwGlSygsLFQvYtYB3BTMxFL+M+0eFgZqp4mJiU2+QKGX1fGIk/QIrn0aYXGsyDxjmAyMhO2jhaCGoUbX1NSkLSwsPMJqV8Fspu6lIZS6OYhjiOLwdU7fQM1HfRPD7wS1obZ0j0xpb4726Z49ezaJf2/S7s9ATUGNR41BjdJseRnke3WGwhrRTS9pD1mOGoeG15BxOOfoxuCkp0Ih6NeaEaSZGlieJyiCoc1FgsGldokGk8nBvAKOrWIGQ5uPsm0tt0BWDiicAaGuGhkZ+YqMw9StGzU4OKhCnT179hNsswY1FTXdE5QEJhc1S3tGogazXLOBwQSBl3tzIhQPtAL1VQJCTcNx8y1vHIUghSKFZE9PT7H2dlM1b+Wgrr1y5Uq77J75+fnplpaWMg2ch4nlYEI5z7hdensDpI4hrYNErcMMXJ32koG4ztf3pultz83NjWG99Ra2WQ0OL2VjZjwgeufUqVOqV8+cOdPIwdBLSNJeHg8TAh5WqJ6EfSmgt7IMNRJ1JThiOlnrOAMHshprmMKdoGSCpb9s3B3SYLIFGIqICJB7xisYi+RvfiypXw40DWGdlJaWRmMd141hk8V2OWm7ieYTXhBc3+BgaZyqAISjOYxSMVvXsBTNlzdiNQDgRao2AtK3pjggpmrqbGpqSsLPIN/dv38/gaBwUjTshMHcvn27JyUlpRmc5xpPMD599LIYnLNyUKKndKjGxsakXbt2deMCLIE8IVvs0YRM1fjdu3d/wrXN5+BcnzEgvor2uN3rjzAYMp5lPEoQlE5fA0fWo8GfhlCbKVFQ1pKNIfzcOHH58mWqaimVUwJI0+6n59D4pIlzmdZPMPiZzXjDjX47Le5g0Uu8x2zgPqWyKpjVe7x3+AUbq9NYjQbgp2dsBud5o8TP7d5kHAWcQchQfoEmLgn8HjOiBIF7o5hI1x6CEbLNP3bdqYAF44JzyWLzcN1i8DcT/o3awbm8Fz3DAy2A62INwPV/E3wWdx5inmBHuwChCBD6R2JwHge80TIQRQLjt7e8DTkGZgfX8cUMZTDAteFDkveaIlzjX9ySQs8X18r2t2VHUURPKoICmDR+eCO9aSdmOIub3/w9RgpgUpiJhvraXpa6jZKHGEqyusw0GLFzX+5RhN/8kYnMSNMMfyH/V/kHST6OYVElTPAAAAAASUVORK5CYII="),w(r,B.ApplianceNames.shape,"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"),w(r,B.ApplianceNames.text,"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="),w(r,B.ApplianceNames.laserPointer,"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"),w(r,"pencilEraser1","data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMjYiIHZpZXdCb3g9IjAgMCAxOCAyNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIxNyIgaGVpZ2h0PSIyNSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K"),w(r,"pencilEraser2","data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMzQiIHZpZXdCb3g9IjAgMCAyNiAzNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIyNSIgaGVpZ2h0PSIzMyIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K"),w(r,"pencilEraser3","data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iNTAiIHZpZXdCb3g9IjAgMCAzNCA1MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIzMyIgaGVpZ2h0PSI0OSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K"),r),yo=function(){function e(t,n,r){var i,o=this;y(this,e),this.manager=t,this.enableCursor=n,this.cursorInstances=new Map,this.sideEffectManager=new F.SideEffectManager,this.store=this.manager.store,this.applianceIcons=go,this.onCursorMove=function(e){var t=o.initCursorInstance(e.uid);if(e.state===ne.Leave)t.leave();else{var n=t.updateMember();o.canMoveCursor(n)&&t.move(e.position)}},this.initCursorInstance=function(e){var t=o.cursorInstances.get(e);return t||(t=new mo(o.manager,e,o,Ib.wrapper),o.cursorInstances.set(e,t)),t},this.mouseMoveListener_=function(e,t){var n=o.getType(e);o.updateCursor(n,e.clientX,e.clientY),t&&o.showPencilEraserIfNeeded(n,e.clientX,e.clientY)},this.mouseMoveTimer=0,this.mouseMoveListener=function(e){var t="touch"===e.pointerType;if(!t||e.isPrimary){var n=Date.now();n-o.mouseMoveTimer>48&&(o.mouseMoveTimer=n,o.mouseMoveListener_(e,t))}},this.mouseLeaveListener=function(){o.hideCursor(o.manager.uid)},this.getPoint=function(e,t,n){var r,i=null==(r=null==e?void 0:e.divElement)?void 0:r.getBoundingClientRect();if(i)return null==e?void 0:e.convertToPointInWorld({x:t-i.x,y:n-i.y})},this.getType=function(e){var t,n=e.target,r=o.manager.focusApp;switch(n.parentElement){case o.mainViewElement:return{type:"main"};case null==(t=null==r?void 0:r.view)?void 0:t.divElement:return{type:"app"};default:return{type:"main"}}},this.roomMembers=null==(i=this.manager.room)?void 0:i.state.roomMembers;var a=Ib.wrapper;a&&this.setupWrapper(a),this.sideEffectManager.add((function(){return ue.on("cursorMove",o.onCursorMove)})),this.sideEffectManager.add((function(){return ue.on("playgroundSizeChange",(function(){return o.updateContainerRect()}))})),r&&(this.applianceIcons=P(P({},go),r))}return x(e,[{key:"canMoveCursor",value:function(e){var t=(null==e?void 0:e.memberState.currentApplianceName)===B.ApplianceNames.laserPointer;return this.enableCursor||t}},{key:"setupWrapper",value:function(e){var t=this;this.sideEffectManager.add((function(){return e.addEventListener("pointerenter",t.mouseMoveListener),e.addEventListener("pointermove",t.mouseMoveListener),e.addEventListener("pointerleave",t.mouseLeaveListener),function(){e.removeEventListener("pointerenter",t.mouseMoveListener),e.removeEventListener("pointermove",t.mouseMoveListener),e.removeEventListener("pointerleave",t.mouseLeaveListener)}})),this.wrapperRect=e.getBoundingClientRect()}},{key:"setMainViewDivElement",value:function(e){this.mainViewElement=e}},{key:"showPencilEraserIfNeeded",value:function(e,t,n){var r=dt(this.manager.room,this.manager.uid),i=(null==r?void 0:r.memberState.currentApplianceName)===B.ApplianceNames.pencilEraser;if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)&&i){var o="main"===e.type?this.manager.mainView:this.focusView,a=this.getPoint(o,t,n);a&&this.onCursorMove({uid:this.manager.uid,position:{x:a.x,y:a.y,type:e.type}})}}},{key:"updateCursor",value:function(e,t,n){var r=dt(this.manager.room,this.manager.uid);if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)){var i="main"===e.type?this.manager.mainView:this.focusView,o=this.getPoint(i,t,n);o&&this.manager.dispatchInternalEvent(q.CursorMove,{uid:this.manager.uid,position:{x:o.x,y:o.y,type:e.type}})}}},{key:"updateContainerRect",value:function(){var e,t;this.containerRect=null==(e=Ib.container)?void 0:e.getBoundingClientRect(),this.wrapperRect=null==(t=Ib.wrapper)?void 0:t.getBoundingClientRect()}},{key:"deleteCursor",value:function(e){this.store.cleanCursor(e);var t=this.cursorInstances.get(e);t&&t.destroy()}},{key:"hideCursor",value:function(e){var t=this.cursorInstances.get(e);t&&t.hide()}},{key:"destroy",value:function(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach((function(e){e.destroy()})),this.cursorInstances.clear())}},{key:"boxState",get:function(){return this.store.getBoxState()}},{key:"focusView",get:function(){var e;return null==(e=this.manager.focusApp)?void 0:e.view}}]),e}(),bo=function(){function e(t){var n=this;y(this,e),this.manager=t,ue.on("changePageState",(function(){ae.emit("pageStateChange",n.toObject())}))}return x(e,[{key:"toObject",value:function(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}},{key:"index",get:function(){return this.manager.store.getMainViewSceneIndex()||0}},{key:"length",get:function(){return this.manager.mainViewScenesLength||0}}]),e}(),xo=function(){function e(t){var n=this;y(this,e),this.ctx=t,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=function(){var e=g(regeneratorRuntime.mark((function e(t){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t===B.RoomPhase.Reconnecting&&n.ctx.emitter.emit("startReconnect"),e.t0=t===B.RoomPhase.Connected&&n.phase===B.RoomPhase.Reconnecting,!e.t0){e.next=10;break}if(null==(r=n.room)||!r.isWritable){e.next=7;break}null==(i=n.room)||i.dispatchMagixEvent(K,{}),e.next=10;break;case 7:return e.next=9,ke(500);case 9:n.onReconnected();case 10:n.phase=t;case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.onReconnected=j.debounce((function(){n._onReconnected()}),1e3),this._onReconnected=function(){tt("onReconnected refresh reactors"),n.releaseDisposers(),n.reactors.forEach((function(e,t){j.isFunction(e)&&n.disposers.set(t,e())})),n.ctx.emitter.emit("onReconnected")}}return x(e,[{key:"setRoom",value:function(e){var t=this;this.room=e,this.phase=null==e?void 0:e.phase,e&&(e.callbacks.off("onPhaseChanged",this.onPhaseChanged),e.callbacks.on("onPhaseChanged",this.onPhaseChanged),e.addMagixEventListener(K,(function(n){n.authorId===e.observerId&&t.onReconnected()}),{fireSelfEventAfterCommit:!0}))}},{key:"setContext",value:function(e){this.ctx=e}},{key:"releaseDisposers",value:function(){this.disposers.forEach((function(e){j.isFunction(e)&&e()})),this.disposers.clear()}},{key:"refresh",value:function(){this._onReconnected()}},{key:"add",value:function(e,t){var n=this.disposers.get(e);n&&j.isFunction(n)&&n(),j.isFunction(t)&&(this.reactors.set(e,t),this.disposers.set(e,t()))}},{key:"remove",value:function(e){this.reactors.has(e)&&this.reactors.delete(e);var t=this.disposers.get(e);t&&(j.isFunction(t)&&t(),this.disposers.delete(e))}},{key:"hasReactor",value:function(e){return this.reactors.has(e)}},{key:"destroy",value:function(){var e,t;null==(e=this.room)||e.callbacks.off("onPhaseChanged",this.onPhaseChanged),null==(t=this.room)||t.removeMagixEventListener(K,this.onReconnected),this.releaseDisposers()}}]),e}(),_o=function(e,t){if(B.isPlayer(e))To(e);else{if(e=e,Object.getOwnPropertyDescriptor(e,"disableCameraTransform"))return;Object.defineProperty(e,"disableCameraTransform",{get:function(){return t.mainView.disableCameraTransform},set:function(e){t.mainView.disableCameraTransform=e}}),Object.defineProperty(e,"canUndoSteps",{get:function(){return t.canUndoSteps}}),Object.defineProperty(e,"canRedoSteps",{get:function(){return t.canRedoSteps}}),e.moveCamera=function(e){return t.moveCamera(e)},e.moveCameraToContain=function(){return t.moveCameraToContain.apply(t,arguments)},e.convertToPointInWorld=function(){var e;return(e=t.mainView).convertToPointInWorld.apply(e,arguments)},e.setCameraBound=function(){var e;return(e=t.mainView).setCameraBound.apply(e,arguments)},e.scenePreview=function(){var e;return(e=t.mainView).scenePreview.apply(e,arguments)},e.fillSceneSnapshot=function(){var e;return(e=t.mainView).fillSceneSnapshot.apply(e,arguments)},e.generateScreenshot=function(){var e;return(e=t.mainView).generateScreenshot.apply(e,arguments)},e.setMemberState=function(){var e;return(e=t.mainView).setMemberState.apply(e,arguments)},e.redo=function(){return t.redo()},e.undo=function(){return t.undo()},e.cleanCurrentScene=function(){return t.cleanCurrentScene()},e.delete=function(){return t.delete()},e.copy=function(){return t.copy()},e.paste=function(){return t.paste()},e.duplicate=function(){return t.duplicate()},e.insertImage=function(){return t.insertImage.apply(t,arguments)},e.completeImageUpload=function(){return t.completeImageUpload.apply(t,arguments)},e.insertText=function(){return t.insertText.apply(t,arguments)},e.lockImage=function(){return t.lockImage.apply(t,arguments)},e.lockImages=function(){return t.lockImages.apply(t,arguments)},wo(e,t)}},wo=function(e,t){var n=e.removeScenes;e.removeScenes=function(r,i){var o;r===ie&&(null==(o=t.appManager)||o.updateRootDirRemoving(!0));var a=n.call(e,r);return ue.emit("removeScenes",{scenePath:r,index:i}),a}},To=function(e){var t=e.seekToProgressTime;function n(){return(n=g(regeneratorRuntime.mark((function n(r){var i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,ue.emit("seekStart");case 2:return n.next=4,t.call(e,r);case 4:return i=n.sent,n.abrupt("return",(ue.emit("seek",r),i));case 6:case"end":return n.stop()}}),n)})))).apply(this,arguments)}e.seekToProgressTime=function(e){return n.apply(this,arguments)}},Mo=Object.defineProperty,So=Object.defineProperties,Eo=Object.getOwnPropertyDescriptors,Ao=Object.getOwnPropertySymbols,Io=Object.prototype.hasOwnProperty,Co=Object.prototype.propertyIsEnumerable,No=function(e,t,n){return t in e?Mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ko=function(e,t){for(var n in t||(t={}))Io.call(t,n)&&No(e,n,t[n]);if(Ao){var r,i=T(Ao(t));try{for(i.s();!(r=i.n()).done;){n=r.value;Co.call(t,n)&&No(e,n,t[n])}}catch(e){i.e(e)}finally{i.f()}}return e},Do=function(e,t){return So(e,Eo(t))},Po=function(e,t,n,r){if("length"!==n&&"prototype"!==n&&"arguments"!==n&&"caller"!==n){var i=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);!Oo(i,o)&&r||Object.defineProperty(e,n,o)}},Oo=function(e,t){return void 0===e||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Ro=function(e,t){var n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},Lo=function(e,t){return"/* Wrapped ".concat(e,"*/\n").concat(t)},jo=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Bo=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Uo=function(e,t,n){var r=""===n?"":"with ".concat(n.trim(),"() "),i=Lo.bind(null,r,t.toString());Object.defineProperty(i,"name",Bo),Object.defineProperty(e,"toString",Do(ko({},jo),{value:i}))};function Fo(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.ignoreNonConfigurable,o=void 0!==i&&i,a=e.name,s=T(Reflect.ownKeys(t));try{for(s.s();!(n=s.n()).done;){var u=n.value;Po(e,t,u,o)}}catch(e){s.e(e)}finally{s.f()}return Ro(e,t),Uo(e,t,a),e}var zo=[],Go=function(){for(var e=0;e<20;e++)zo[e]="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(87*Math.random());return zo.join("")};function Ho(e){try{return e()}catch(e){console.error(e)}}var Vo=function(){function e(){y(this,e),this.push=this.addDisposer,this.disposers=new Map}return x(e,[{key:"addDisposer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.genUID();return this.flush(t),this.disposers.set(t,Array.isArray(e)?Wo(e):e),t}},{key:"add",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.genUID(),n=e();return n?this.addDisposer(n,t):t}},{key:"addEventListener",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.genUID();return e.addEventListener(t,n,r),this.addDisposer((function(){return e.removeEventListener(t,n,r)}),i),i}},{key:"setTimeout",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.genUID(),i=window.setTimeout((function(){n.remove(r),e()}),t);return this.addDisposer((function(){return window.clearTimeout(i)}),r)}},{key:"setInterval",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.genUID(),r=window.setInterval(e,t);return this.addDisposer((function(){return window.clearInterval(r)}),n)}},{key:"remove",value:function(e){var t=this.disposers.get(e);return this.disposers.delete(e),t}},{key:"flush",value:function(e){var t=this.remove(e);t&&t()}},{key:"flushAll",value:function(){this.disposers.forEach(Ho),this.disposers.clear()}},{key:"genUID",value:function(){var e;do{e=Go()}while(this.disposers.has(e));return e}}]),e}();function Wo(e){return function(){return e.forEach(Ho)}}var Yo,Xo=[],Qo="ResizeObserver loop completed with undelivered notifications.";!function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(Yo||(Yo={}));var Zo,qo=function(e){return Object.freeze(e)},Jo=function(e,t){this.inlineSize=e,this.blockSize=t,qo(this)},Ko=function(){function e(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,qo(this)}return e.prototype.toJSON=function(){var e=this;return{x:e.x,y:e.y,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),$o=function(e){return e instanceof SVGElement&&"getBBox"in e},ea=function(e){if($o(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var i=e,o=i.offsetWidth,a=i.offsetHeight;return!(o||a||e.getClientRects().length)},ta=function(e){var t;if(e instanceof Element)return!0;var n=null===(t=null==e?void 0:e.ownerDocument)||void 0===t?void 0:t.defaultView;return!!(n&&e instanceof n.Element)},na="undefined"!=typeof window?window:{},ra=new WeakMap,ia=/auto|scroll/,oa=/^tb|vertical/,aa=/msie|trident/i.test(na.navigator&&na.navigator.userAgent),sa=function(e){return parseFloat(e||"0")},ua=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=!1),new Jo((n?t:e)||0,(n?e:t)||0)},la=qo({devicePixelContentBoxSize:ua(),borderBoxSize:ua(),contentBoxSize:ua(),contentRect:new Ko(0,0,0,0)}),ca=function(e,t){if(void 0===t&&(t=!1),ra.has(e)&&!t)return ra.get(e);if(ea(e))return ra.set(e,la),la;var n=getComputedStyle(e),r=$o(e)&&e.ownerSVGElement&&e.getBBox(),i=!aa&&"border-box"===n.boxSizing,o=oa.test(n.writingMode||""),a=!r&&ia.test(n.overflowY||""),s=!r&&ia.test(n.overflowX||""),u=r?0:sa(n.paddingTop),l=r?0:sa(n.paddingRight),c=r?0:sa(n.paddingBottom),h=r?0:sa(n.paddingLeft),d=r?0:sa(n.borderTopWidth),f=r?0:sa(n.borderRightWidth),p=r?0:sa(n.borderBottomWidth),v=h+l,m=u+c,g=(r?0:sa(n.borderLeftWidth))+f,y=d+p,b=s?e.offsetHeight-y-e.clientHeight:0,x=a?e.offsetWidth-g-e.clientWidth:0,_=i?v+g:0,w=i?m+y:0,T=r?r.width:sa(n.width)-_-x,M=r?r.height:sa(n.height)-w-b,S=T+v+x+g,E=M+m+b+y,A=qo({devicePixelContentBoxSize:ua(Math.round(T*devicePixelRatio),Math.round(M*devicePixelRatio),o),borderBoxSize:ua(S,E,o),contentBoxSize:ua(T,M,o),contentRect:new Ko(h,u,T,M)});return ra.set(e,A),A},ha=function(e,t,n){var r=ca(e,n),i=r.borderBoxSize,o=r.contentBoxSize,a=r.devicePixelContentBoxSize;switch(t){case Yo.DEVICE_PIXEL_CONTENT_BOX:return a;case Yo.BORDER_BOX:return i;default:return o}},da=function(e){var t=ca(e);this.target=e,this.contentRect=t.contentRect,this.borderBoxSize=qo([t.borderBoxSize]),this.contentBoxSize=qo([t.contentBoxSize]),this.devicePixelContentBoxSize=qo([t.devicePixelContentBoxSize])},fa=function(e){if(ea(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},pa=function(){var e=1/0,t=[];Xo.forEach((function(n){if(0!==n.activeTargets.length){var r=[];n.activeTargets.forEach((function(t){var n=new da(t.target),i=fa(t.target);r.push(n),t.lastReportedSize=ha(t.target,t.observedBox),ie?t.activeTargets.push(n):t.skippedTargets.push(n))}))}))},ma=function(){var e=0;for(va(e);Xo.some((function(e){return e.activeTargets.length>0}));)e=pa(),va(e);return Xo.some((function(e){return e.skippedTargets.length>0}))&&function(){var e;"function"==typeof ErrorEvent?e=new ErrorEvent("error",{message:Qo}):((e=document.createEvent("Event")).initEvent("error",!1,!1),e.message=Qo),window.dispatchEvent(e)}(),e>0},ga=[],ya=function(e){if(!Zo){var t=0,n=document.createTextNode("");new MutationObserver((function(){return ga.splice(0).forEach((function(e){return e()}))})).observe(n,{characterData:!0}),Zo=function(){n.textContent="".concat(t?t--:t++)}}ga.push(e),Zo()},ba=0,xa={attributes:!0,characterData:!0,childList:!0,subtree:!0},_a=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],wa=function(e){return void 0===e&&(e=0),Date.now()+e},Ta=!1,Ma=function(){function e(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return e.prototype.run=function(e){var t=this;if(void 0===e&&(e=250),!Ta){Ta=!0;var n=wa(e);!function(e){ya((function(){requestAnimationFrame(e)}))}((function(){var r=!1;try{r=ma()}finally{if(Ta=!1,e=n-wa(),!ba)return;r?t.run(1e3):e>0?t.run(e):t.start()}}))}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var e=this,t=function(){return e.observer&&e.observer.observe(document.body,xa)};document.body?t():na.addEventListener("DOMContentLoaded",t)},e.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),_a.forEach((function(t){return na.addEventListener(t,e.listener,!0)})))},e.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),_a.forEach((function(t){return na.removeEventListener(t,e.listener,!0)})),this.stopped=!0)},e}(),Sa=new Ma,Ea=function(e){!ba&&e>0&&Sa.start(),!(ba+=e)&&Sa.stop()},Aa=function(){function e(e,t){this.target=e,this.observedBox=t||Yo.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var e=ha(this.target,this.observedBox,!0);return function(e){return!$o(e)&&!function(e){switch(e.tagName){case"INPUT":if("image"!==e.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(e)&&"inline"===getComputedStyle(e).display}(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},e}(),Ia=function(e,t){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=t},Ca=new WeakMap,Na=function(e,t){for(var n=0;n=0&&(i&&Xo.splice(Xo.indexOf(n),1),n.observationTargets.splice(r,1),Ea(-1))},e.disconnect=function(e){var t=this,n=Ca.get(e);n.observationTargets.slice().forEach((function(n){return t.unobserve(e,n.target)})),n.activeTargets.splice(0,n.activeTargets.length)},e}(),Da=function(){function e(e){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof e)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");ka.connect(this,e)}return e.prototype.observe=function(e,t){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ta(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ka.observe(this,e,t)},e.prototype.unobserve=function(e){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ta(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ka.unobserve(this,e)},e.prototype.disconnect=function(){ka.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();var Pa="undefined"!=typeof window,Oa=Pa&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Ra=Pa&&"IntersectionObserver"in window,La=Pa&&"classList"in document.createElement("p"),ja=Pa&&window.devicePixelRatio>1,Ba={elements_selector:".lazy",container:Oa||Pa?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},Ua=function(e){return Object.assign({},Ba,e)},Fa=function(e,t){var n,r="LazyLoad::Initialized",i=new e(t);try{n=new CustomEvent(r,{detail:{instance:i}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent(r,!1,!1,{instance:i})}window.dispatchEvent(n)},za="src",Ga="srcset",Ha="sizes",Va="poster",Wa="llOriginalAttrs",Ya="data",Xa="loading",Qa="loaded",Za="applied",qa="error",Ja="native",Ka="data-",$a="ll-status",es=function(e,t){return e.getAttribute(Ka+t)},ts=function(e){return es(e,$a)},ns=function(e,t){return function(e,t,n){var r=Ka+t;null!==n?e.setAttribute(r,n):e.removeAttribute(r)}(e,$a,t)},rs=function(e){return ns(e,null)},is=function(e){return null===ts(e)},os=function(e){return ts(e)===Ja},as=[Xa,Qa,Za,qa],ss=function(e,t,n,r){if(e){if(void 0!==r)return void e(t,n,r);if(void 0!==n)return void e(t,n);e(t)}},us=function(e,t){La?e.classList.add(t):e.className+=(e.className?" ":"")+t},ls=function(e,t){La?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},cs=function(e){return e.llTempImage},hs=function(e,t){if(t){var n=t._observer;!n||n.unobserve(e)}},ds=function(e,t){!e||(e.loadingCount+=t)},fs=function(e,t){!e||(e.toLoadCount=t)},ps=function(e){for(var t,n=[],r=0;t=e.children[r];r+=1)"SOURCE"===t.tagName&&n.push(t);return n},vs=function(e,t){var n=e.parentNode;n&&"PICTURE"===n.tagName&&ps(n).forEach(t)},ms=function(e,t){ps(e).forEach(t)},gs=[za],ys=[za,Va],bs=[za,Ga,Ha],xs=[Ya],_s=function(e){return!!e[Wa]},ws=function(e){return e[Wa]},Ts=function(e){return delete e[Wa]},Ms=function(e,t){if(!_s(e)){var n={};t.forEach((function(t){n[t]=e.getAttribute(t)})),e[Wa]=n}},Ss=function(e,t){if(_s(e)){var n=ws(e);t.forEach((function(t){!function(e,t,n){n?e.setAttribute(t,n):e.removeAttribute(t)}(e,t,n[t])}))}},Es=function(e,t,n){us(e,t.class_applied),ns(e,Za),n&&(t.unobserve_completed&&hs(e,t),ss(t.callback_applied,e,n))},As=function(e,t,n){us(e,t.class_loading),ns(e,Xa),n&&(ds(n,1),ss(t.callback_loading,e,n))},Is=function(e,t,n){!n||e.setAttribute(t,n)},Cs=function(e,t){Is(e,Ha,es(e,t.data_sizes)),Is(e,Ga,es(e,t.data_srcset)),Is(e,za,es(e,t.data_src))},Ns={IMG:function(e,t){vs(e,(function(e){Ms(e,bs),Cs(e,t)})),Ms(e,bs),Cs(e,t)},IFRAME:function(e,t){Ms(e,gs),Is(e,za,es(e,t.data_src))},VIDEO:function(e,t){ms(e,(function(e){Ms(e,gs),Is(e,za,es(e,t.data_src))})),Ms(e,ys),Is(e,Va,es(e,t.data_poster)),Is(e,za,es(e,t.data_src)),e.load()},OBJECT:function(e,t){Ms(e,xs),Is(e,Ya,es(e,t.data_src))}},ks=["IMG","IFRAME","VIDEO","OBJECT"],Ds=function(e,t){t&&!function(e){return e.loadingCount>0}(t)&&!function(e){return e.toLoadCount>0}(t)&&ss(e.callback_finish,t)},Ps=function(e,t,n){e.addEventListener(t,n),e.llEvLisnrs[t]=n},Os=function(e,t,n){e.removeEventListener(t,n)},Rs=function(e){return!!e.llEvLisnrs},Ls=function(e){if(Rs(e)){var t=e.llEvLisnrs;for(var n in t){var r=t[n];Os(e,n,r)}delete e.llEvLisnrs}},js=function(e,t,n){(function(e){delete e.llTempImage})(e),ds(n,-1),function(e){!e||(e.toLoadCount-=1)}(n),ls(e,t.class_loading),t.unobserve_completed&&hs(e,n)},Bs=function(e,t,n){var r=cs(e)||e;Rs(r)||function(e,t,n){Rs(e)||(e.llEvLisnrs={});var r="VIDEO"===e.tagName?"loadeddata":"load";Ps(e,r,t),Ps(e,"error",n)}(r,(function(i){(function(e,t,n,r){var i=os(t);js(t,n,r),us(t,n.class_loaded),ns(t,Qa),ss(n.callback_loaded,t,r),i||Ds(n,r)})(0,e,t,n),Ls(r)}),(function(i){(function(e,t,n,r){var i=os(t);js(t,n,r),us(t,n.class_error),ns(t,qa),ss(n.callback_error,t,r),n.restore_on_error&&Ss(t,bs),i||Ds(n,r)})(0,e,t,n),Ls(r)}))},Us=function(e,t,n){(function(e){e.llTempImage=document.createElement("IMG")})(e),Bs(e,t,n),function(e){_s(e)||(e[Wa]={backgroundImage:e.style.backgroundImage})}(e),function(e,t,n){var r=es(e,t.data_bg),i=es(e,t.data_bg_hidpi),o=ja&&i?i:r;!o||(e.style.backgroundImage='url("'.concat(o,'")'),cs(e).setAttribute(za,o),As(e,t,n))}(e,t,n),function(e,t,n){var r=es(e,t.data_bg_multi),i=es(e,t.data_bg_multi_hidpi),o=ja&&i?i:r;!o||(e.style.backgroundImage=o,Es(e,t,n))}(e,t,n),function(e,t,n){var r=es(e,t.data_bg_set);if(r){var i=r.split("|"),o=i.map((function(e){return"image-set(".concat(e,")")}));e.style.backgroundImage=o.join(),""===e.style.backgroundImage&&(o=i.map((function(e){return"-webkit-image-set(".concat(e,")")})),e.style.backgroundImage=o.join()),Es(e,t,n)}}(e,t,n)},Fs=function(e,t,n){Bs(e,t,n),function(e,t,n){var r=Ns[e.tagName];!r||(r(e,t),As(e,t,n))}(e,t,n)},zs=function(e,t,n){!function(e){return ks.indexOf(e.tagName)>-1}(e)?Us(e,t,n):Fs(e,t,n)},Gs=function(e,t,n){e.setAttribute("loading","lazy"),Bs(e,t,n),function(e,t){var n=Ns[e.tagName];!n||n(e,t)}(e,t),ns(e,Ja)},Hs=function(e){e.removeAttribute(za),e.removeAttribute(Ga),e.removeAttribute(Ha)},Vs=function(e){vs(e,(function(e){Ss(e,bs)})),Ss(e,bs)},Ws={IMG:Vs,IFRAME:function(e){Ss(e,gs)},VIDEO:function(e){ms(e,(function(e){Ss(e,gs)})),Ss(e,ys),e.load()},OBJECT:function(e){Ss(e,xs)}},Ys=function(e){var t=Ws[e.tagName];t?t(e):function(e){if(_s(e)){var t=ws(e);e.style.backgroundImage=t.backgroundImage}}(e)},Xs=function(e,t){Ys(e),function(e,t){is(e)||os(e)||(ls(e,t.class_entered),ls(e,t.class_exited),ls(e,t.class_applied),ls(e,t.class_loading),ls(e,t.class_loaded),ls(e,t.class_error))}(e,t),rs(e),Ts(e)},Qs=function(e,t,n,r){!n.cancel_on_exit||!function(e){return ts(e)===Xa}(e)||"IMG"===e.tagName&&(Ls(e),function(e){vs(e,(function(e){Hs(e)})),Hs(e)}(e),Vs(e),ls(e,n.class_loading),ds(r,-1),rs(e),ss(n.callback_cancel,e,t,r))},Zs=function(e,t,n,r){var i=function(e){return as.indexOf(ts(e))>=0}(e);ns(e,"entered"),us(e,n.class_entered),ls(e,n.class_exited),function(e,t,n){t.unobserve_entered&&hs(e,n)}(e,n,r),ss(n.callback_enter,e,t,r),!i&&zs(e,n,r)},qs=["IMG","IFRAME","VIDEO"],Js=function(e){return e.use_native&&"loading"in HTMLImageElement.prototype},Ks=function(e,t,n){e.forEach((function(e){return function(e){return e.isIntersecting||e.intersectionRatio>0}(e)?Zs(e.target,e,t,n):function(e,t,n,r){is(e)||(us(e,n.class_exited),Qs(e,t,n,r),ss(n.callback_exit,e,t,r))}(e.target,e,t,n)}))},$s=function(e,t){!Ra||Js(e)||(t._observer=new IntersectionObserver((function(n){Ks(n,e,t)}),function(e){return{root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}}(e)))},eu=function(e){return Array.prototype.slice.call(e)},tu=function(e){return e.container.querySelectorAll(e.elements_selector)},nu=function(e){return function(e){return ts(e)===qa}(e)},ru=function(e,t){return function(e){return eu(e).filter(is)}(e||tu(t))},iu=function(e,t){(function(e){return eu(e).filter(nu)})(tu(e)).forEach((function(t){ls(t,e.class_error),rs(t)})),t.update()},ou=function(e,t){var n=Ua(e);this._settings=n,this.loadingCount=0,$s(n,this),function(e,t){!Pa||(t._onlineHandler=function(){iu(e,t)},window.addEventListener("online",t._onlineHandler))}(n,this),this.update(t)};ou.prototype={update:function(e){var t=this._settings,n=ru(e,t);fs(this,n.length),!Oa&&Ra?Js(t)?function(e,t,n){e.forEach((function(e){-1!==qs.indexOf(e.tagName)&&Gs(e,t,n)})),fs(n,0)}(n,t,this):function(e,t){(function(e){e.disconnect()})(e),function(e,t){t.forEach((function(t){e.observe(t)}))}(e,t)}(this._observer,n):this.loadAll(n)},destroy:function(){this._observer&&this._observer.disconnect(),function(e){!Pa||window.removeEventListener("online",e._onlineHandler)}(this),tu(this._settings).forEach((function(e){Ts(e)})),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){var t=this,n=this._settings;ru(e,n).forEach((function(e){hs(e,t),zs(e,n,t)}))},restoreAll:function(){var e=this._settings;tu(e).forEach((function(t){Xs(t,e)}))}},ou.load=function(e,t){var n=Ua(t);zs(e,n)},ou.resetStatus=function(e){rs(e)},Pa&&function(e,t){if(t)if(t.length)for(var n,r=0;n=t[r];r+=1)Fa(e,n);else Fa(e,t)}(ou,window.lazyLoadOptions);var au=function(){function e(t){var n=t.readonly,r=t.box,i=t.pages,o=t.onNewPageIndex,a=t.onPlay;if(y(this,e),this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new Vo,i.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=n,this.box=r,this.pages=i,this.onNewPageIndex=o,this.onPlay=a,this.onPageIndexChanged=function(){},this.render()}return x(e,[{key:"mount",value:function(){var e=this;this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add((function(){var t=new ou({container:e.$preview,elements_selector:".".concat(e.wrapClassName("preview-page>img"))});return function(){return t.destroy()}}),"preview-lazyload")}},{key:"unmount",value:function(){this.$content.remove(),this.$footer.remove()}},{key:"setReadonly",value:function(e){this.readonly!==e&&(this.readonly=e,this.$content.classList.toggle(this.wrapClassName("readonly"),e),this.$footer.classList.toggle(this.wrapClassName("readonly"),e),this.$pageNumberInput.disabled=e)}},{key:"destroy",value:function(){this.sideEffect.flushAll(),this.unmount()}},{key:"setPageIndex",value:function(e){Number.isNaN(e)||(this.pageIndex=e,this.$pageNumberInput.value=String(e+1),this.onPageIndexChanged(e))}},{key:"setSmallBox",value:function(e){this.isSmallBox!==e&&(this.isSmallBox=e,this.$footer.classList.toggle(this.wrapClassName("float-footer"),e))}},{key:"render",value:function(){return this.renderContent(),this.renderFooter(),this.$content}},{key:"renderContent",value:function(){if(!this.$content){var e=document.createElement("div");e.className=this.wrapClassName("content"),this.$content=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),e.appendChild(this.renderPreviewMask()),e.appendChild(this.renderPreview())}return this.$content}},{key:"renderPreview",value:function(){var e=this;if(!this.$preview){var t=document.createElement("div");t.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=t;var n=this.wrapClassName("preview-page"),r=this.wrapClassName("preview-page-name");this.pages.forEach((function(i,o){var a,s=null!=(a=i.thumbnail)?a:i.src.startsWith("ppt")?void 0:i.src;if(s){var u=String(o),l=document.createElement("a");l.className=n+" "+e.wrapClassName("preview-page-".concat(o)),l.setAttribute("href","#"),l.dataset.pageIndex=u;var c=document.createElement("span");c.className=r,c.textContent=String(o+1),c.dataset.pageIndex=u;var h=document.createElement("img");h.width=i.width,h.height=i.height,h.dataset.src=s,h.dataset.pageIndex=u,l.appendChild(h),l.appendChild(c),t.appendChild(l)}})),this.sideEffect.addEventListener(t,"click",(function(t){var n;if(!e.readonly){var r=null==(n=t.target.dataset)?void 0:n.pageIndex;r&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),e.onNewPageIndex(Number(r)),e.togglePreview(!1))}}))}return this.$preview}},{key:"renderPreviewMask",value:function(){var e=this;return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",(function(t){e.readonly||t.target===e.$previewMask&&e.togglePreview(!1)}))),this.$previewMask}},{key:"renderFooter",value:function(){var e=this;if(!this.$footer){var t=document.createElement("div");if(t.className=this.wrapClassName("footer"),this.$footer=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&t.classList.add(this.wrapClassName("float-footer")),this.pages.some((function(e){return e.thumbnail||!e.src.startsWith("ppt")}))){var n=this.renderFooterBtn("btn-sidebar",function(e){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("class","".concat(e,"-footer-icon-sidebar")),n.setAttribute("viewBox","0 0 64 64");var r=document.createElementNS(t,"path");return r.setAttribute("fill","currentColor"),r.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),n.appendChild(r),n}(this.namespace));this.sideEffect.addEventListener(n,"click",(function(){e.readonly||e.togglePreview()})),this.$footer.appendChild(n)}var r=document.createElement("div");r.className=this.wrapClassName("page-jumps");var i=this.renderFooterBtn("btn-page-back",function(e){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("class","".concat(e,"-footer-icon-arrow-left")),n.setAttribute("viewBox","0 0 500 500");var r=document.createElementNS(t,"path");return r.setAttribute("fill","currentColor"),r.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),n.appendChild(r),n}(this.namespace));if(this.sideEffect.addEventListener(i,"click",(function(){e.readonly||e.onNewPageIndex(e.pageIndex-1)})),r.appendChild(i),this.onPlay){var o=this.renderFooterBtn("btn-page-play",function(e){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("class","".concat(e,"-footer-icon-play")),n.setAttribute("viewBox","0 0 500 500");var r=document.createElementNS(t,"path");return r.setAttribute("fill","currentColor"),r.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),n.appendChild(r),n}(this.namespace),function(e){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("class","".concat(e,"-footer-icon-pause")),n.setAttribute("viewBox","0 0 500 500");var r=document.createElementNS(t,"path");return r.setAttribute("fill","currentColor"),r.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),n.appendChild(r),n}(this.namespace));this.sideEffect.addEventListener(o,"click",(function(){e.readonly||(o.classList.toggle(e.wrapClassName("footer-btn-playing"),!0),e.onPlay&&e.onPlay(),e.sideEffect.setTimeout((function(){o.classList.toggle(e.wrapClassName("footer-btn-playing"),!1)}),500,"returnPlay"))})),r.appendChild(o)}var a=this.renderFooterBtn("btn-page-next",function(e){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("class","".concat(e,"-footer-icon-arrow-right")),n.setAttribute("viewBox","0 0 500 500");var r=document.createElementNS(t,"path");return r.setAttribute("fill","currentColor"),r.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),n.appendChild(r),n}(this.namespace));this.sideEffect.addEventListener(a,"click",(function(){e.readonly||e.onNewPageIndex(e.pageIndex+1)})),r.appendChild(a);var s=document.createElement("div");s.className=this.wrapClassName("page-number");var u=document.createElement("input");u.className=this.wrapClassName("page-number-input"),u.value=String(this.pageIndex+1),this.readonly&&(u.disabled=!0),this.$pageNumberInput=u,this.sideEffect.addEventListener(u,"focus",(function(){u.select()})),this.sideEffect.addEventListener(u,"change",(function(){e.readonly||u.value&&e.onNewPageIndex(Number(u.value)-1)}));var l=document.createElement("span");l.textContent=" / "+this.pages.length,s.appendChild(u),s.appendChild(l),this.$footer.appendChild(r),this.$footer.appendChild(s)}return this.$footer}},{key:"renderFooterBtn",value:function(e,t,n){var r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(t),n&&r.appendChild(n),r}},{key:"togglePreview",value:function(e){if(this.isShowPreview=null!=e?e:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){var t=this.$preview.querySelector("."+this.wrapClassName("preview-page-".concat(this.pageIndex)));t&&this.$preview.scrollTo({top:t.offsetTop-16})}}},{key:"wrapClassName",value:function(e){return"".concat(this.namespace,"-").concat(e)}}]),e}();function su(e,t,n){return Math.min(Math.max(e,t),n)}function uu(e){return e.touches?e.touches[0]:e}function lu(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function cu(e){if(!e)return!1;var t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t}var hu=function(){function e(t){var n,r,i,o=this;y(this,e),this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=function(e){if(!o.paused){var t=Math.floor((e-o._loopTimestamp)/1e3*60)+1;for(o._loopTimestamp=e;t-- >0;)o.stepper();o.onStep(o.current,o),!o.paused&&o.current!==o.target&&window.requestAnimationFrame(o.looper)}},this.current=null!=(n=t.start)?n:0,this.target=this.current,this.stiffness=null!=(r=t.stiffness)?r:170,this.damping=null!=(i=t.damping)?i:26,this.onStep=t.onStep}return x(e,[{key:"stepTo",value:function(e,t){this.paused&&null!=t&&(this.current=t),this.paused=!1,this.target=e,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}},{key:"pause",value:function(){this.paused=!0}},{key:"destroy",value:function(){this.pause()}},{key:"stepper",value:function(){var e=-this.stiffness*(this.current-this.target),t=-this.damping*this.velocity,n=this.velocity+(e+t)/60,r=this.current+n/60;Math.abs(n-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=r,this.velocity=n)}}]),e}(),du=function(){function e(t,n,r,i){y(this,e),this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=t,this.page=n,this.scale=r,this.pageOffsetX=(i-n.width)/2;var o=document.createElement("div");o.className="page-renderer-page",o.dataset.index="".concat(t),o.style.width="".concat(n.width*r,"px"),o.style.height="".concat(n.height*r,"px"),n.thumbnail&&(o.style.backgroundImage='url("'.concat(n.thumbnail,'")'));var a=document.createElement("img");a.className="page-renderer-page-img",a.width=n.width,a.height=n.height,a.src=n.src,o.appendChild(a),this.$page=o}return x(e,[{key:"translateY",value:function(e){Math.abs(e-this.pageOffsetY)>=.001&&(this.pageOffsetY=e,this.$page.style.transform="translate(".concat(this.pageOffsetX*this.scale,"px, ").concat(this.pageOffsetY*this.scale,"px)"))}},{key:"setScale",value:function(e){Math.abs(e-this.scale)>=.001&&(this.scale=e,this.$page.style.width="".concat(this.page.width*this.scale,"px"),this.$page.style.height="".concat(this.page.height*this.scale,"px"),this.$page.style.transform="translate(".concat(this.pageOffsetX*this.scale,"px, ").concat(this.pageOffsetY*this.scale,"px)"))}},{key:"setVisible",value:function(e){e!==this.visible&&(this.visible=e,this.$page.style.opacity=e?"1":"0")}}]),e}(),fu=window.requestIdleCallback||function(e){return window.setTimeout(e,5e3)},pu=window.cancelIdleCallback||window.clearTimeout,vu=function(){function e(t,n,r){var i=this;y(this,e),this.pages=t,this.pagesIntrinsicWidth=n,this.scale=r,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=function(){if(i.gcTimer=null,i.els.size>i.maxElCount)for(var e=a(i.els.values()).sort((function(e,t){return t.lastVisit-e.lastVisit})),t=Math.floor(i.maxElCount/4);tthis.maxElCount&&null===this.gcTimer&&(this.gcTimer=fu(this.gc)),t}},{key:"setScale",value:function(e){e!==this.scale&&(this.scale=e,this.els.forEach((function(t){return t.setScale(e)})))}},{key:"destroy",value:function(){this.els.clear(),null!==this.gcTimer&&(pu(this.gcTimer),this.gcTimer=null)}}]),e}(),mu=function(){function e(t){var n=this;y(this,e),this._hwaTimeout=NaN,this._turnOffHWA=function(){window.clearTimeout(n._hwaTimeout),n._hwaTimeout=NaN,n.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=t.pagesScrollTop||0,this.containerWidth=t.containerWidth||1,this.containerHeight=t.containerHeight||1,this.pages=t.pages.map((function(e){if(e.thumbnail)return e;try{var t=new URL(e.src);return t.searchParams.set("x-oss-process","image/resize,l_50"),Do(ko({},e),{thumbnail:t.toString()})}catch(t){return console.error(t),e}}));var r=Array(this.pages.length),i=1/0,o=0;this.pagesIntrinsicHeight=this.pages.reduce((function(e,t,n){return r[n]=e,t.width>o&&(o=t.width),t.height<=i&&(i=t.height),e+t.height}),0),this.pagesIntrinsicWidth=o,this.pagesMinHeight=i,this.pagesIntrinsicYs=r,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=t.onPageIndexChanged,this.pageScrollIndex=0,0!==this.pagesScrollTop&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new vu(this.pages,o,this.scale),this.$pages=this.renderPages()}return x(e,[{key:"setContainerSize",value:function(e,t){e>0&&t>0&&(e!==this.containerWidth||t!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=t,this.$pages.style.width="".concat(this.containerWidth,"px"),this.$pages.style.height="".concat(this.containerHeight,"px"),this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.pageElManager.setScale(this.scale),this.$pages.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}},{key:"renderPages",value:function(){var e=document.createElement("div");return e.className="page-renderer-pages-container",e.style.width="".concat(this.containerWidth,"px"),e.style.height="".concat(this.containerHeight,"px"),e}},{key:"pagesScrollTo",value:function(e,t){if(e=su(e,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),t||Math.abs(e-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=e;for(var n=this.findScrollPageIndex(),r=Math.max(n-this.threshold,0),i=Math.min(n+this.threshold,this.pages.length-1),o=0;o=r&&s<=i||(a.remove(),o--)}for(var u=r;u<=i;u++){var l=this.pageElManager.getEl(u);l.$page.parentElement!==this.$pages&&this.$pages.appendChild(l.$page),l.translateY(this.pagesIntrinsicYs[u]-this.pagesScrollTop)}n!==this.pageScrollIndex&&(this.pageScrollIndex=n,this.onPageIndexChanged&&this.onPageIndexChanged(n))}}},{key:"findScrollPageIndex",value:function(){for(var e=0;e=.001)return e;return this.pagesIntrinsicYs.length-1}},{key:"mount",value:function(e){e.appendChild(this.$pages),this.pagesScrollTo(this.pagesScrollTop,!0)}},{key:"unmount",value:function(){this.$pages.remove()}},{key:"destroy",value:function(){this.unmount(),this.onPageIndexChanged=void 0,this.pageElManager.destroy(),this._hwaTimeout&&(window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN)}},{key:"_calcScale",value:function(){return this.containerWidth/this.pagesIntrinsicWidth||1}},{key:"_calcThreshold",value:function(){return su(Math.ceil(this.containerHeight/this.scale/this.pagesMinHeight/2),1,this.pages.length)}},{key:"_turnOnHWA",value:function(){this._hwaTimeout?window.clearTimeout(this._hwaTimeout):this.$pages.classList.toggle("is-hwa",!0),this._hwaTimeout=window.setTimeout(this._turnOffHWA,1e3)}}]),e}(),gu=function(){function e(t){y(this,e),this.sideEffect=new Vo,this.pagesScrollTop=t.pagesScrollTop||0,this.containerWidth=t.containerWidth||1,this.containerHeight=t.containerHeight||1,this.pagesWidth=t.pagesWidth||1,this.pagesHeight=t.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=t.scrollbarMinHeight||30,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=t.readonly,this.wrapClassName=t.wrapClassName,this.onDragScroll=t.onDragScroll,this.$scrollbar=this.renderScrollbar()}return x(e,[{key:"mount",value:function(e){e.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}},{key:"unmount",value:function(){this.$scrollbar.remove()}},{key:"setReadonly",value:function(e){this.readonly=e}},{key:"setContainerSize",value:function(e,t){e>0&&t>0&&(e!==this.containerWidth||t!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=t,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}},{key:"pagesScrollTo",value:function(e,t){var n=this;if(e=su(e,0,this.pagesHeight-this.containerHeight/this.scale),t||Math.abs(e-this.pagesScrollTop)>=.001){this.pagesScrollTop=e;var r=this.pagesScrollTop*this.scale/(this.pagesHeight*this.scale-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame((function(){n.$scrollbar.style.transform="translateY(".concat(r,"px)")})):this.$scrollbar.style.transform="translateY(".concat(r,"px)")}}},{key:"destroy",value:function(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}},{key:"renderScrollbar",value:function(){var e=this,t=document.createElement("button");t.className=this.wrapClassName("scrollbar"),t.style.minHeight="".concat(this.scrollbarMinHeight,"px"),t.style.height="".concat(this.scrollbarHeight,"px");var n=function(n){if(!(e.readonly||null!=n.button&&0!==n.button)){lu(n);var r=e.wrapClassName("scrollbar-dragging");t.classList.toggle(r,!0);var i=e.pagesScrollTop,o=uu(n).clientY,a=function(t){if(!e.readonly){var n=(uu(t).clientY-o)/e.scale;Math.abs(n)>0&&e.onDragScroll&&e.onDragScroll(i+n*(e.pagesHeight*e.scale/e.containerHeight))}},s=function e(){t.classList.toggle(r,!1),window.removeEventListener("mousemove",a,!0),window.removeEventListener("touchmove",a,!0),window.removeEventListener("mouseup",e,!0),window.removeEventListener("touchend",e,!0),window.removeEventListener("touchcancel",e,!0)};window.addEventListener("mousemove",a,!0),window.addEventListener("touchmove",a,!0),window.addEventListener("mouseup",s,!0),window.addEventListener("touchend",s,!0),window.addEventListener("touchcancel",s,!0)}};return this.sideEffect.addEventListener(t,"mousedown",n),this.sideEffect.addEventListener(t,"touchstart",n),t}},{key:"_calcScale",value:function(){return this.containerWidth/this.pagesWidth||1}},{key:"_calcScrollbarHeight",value:function(){return su(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}},{key:"_updateScrollbarHeight",value:function(){var e=this._calcScrollbarHeight();Math.abs(e-this.scrollbarHeight)>.001&&(this.scrollbarHeight=e,this.$scrollbar.style.height="".concat(e,"px"))}}]),e}(),yu=window.ResizeObserver||Da,bu=640,xu=function(){function e(t){var r=this,i=t.whiteboardView,a=t.readonly,s=t.box,u=t.pages,l=t.pageScrollTop,c=void 0===l?0:l,h=t.mountWhiteboard,d=t.onUserScroll,f=t.baseScenePath,p=t.appId;y(this,e),this.sideEffect=new Vo,this.userScrolling=!1,this.onNewPageIndex=function(e){r.scrollToPage(e)},this.toPdf=g(regeneratorRuntime.mark((function e(){var t,i,a,s,u,l,c,h,d,f,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=document.createElement("canvas"),(i=t.getContext("2d"))&&r.baseScenePath){e.next=4;break}return r.reportProgress(100,null),e.abrupt("return");case 4:return a=r.whiteboardView.focusScenePath||"".concat(r.baseScenePath,"/1"),s=r.pages[0],e.next=8,Promise.resolve().then((function(){return V(n(88877))}));case 8:u=e.sent,l=u.jsPDF,c=new l({format:[s.width,s.height],orientation:s.width>s.height?"l":"p",compress:!0}),h=T(r.pages.entries()),e.prev=12,f=regeneratorRuntime.mark((function e(){var n,s,u,l,h,f,p,v,m,g,y;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o(d.value,2),s=n[0],u=n[1],l=u.width,h=u.height,f=u.src,t.width=l,t.height=h,p=l>h?"l":"p",s>0&&c.addPage([l,h],p),e.next=7,r.getBase64FromUrl(f);case 7:return v=e.sent,(m=document.createElement("img")).src=v,e.next=12,new Promise((function(e){return m.onload=e}));case 12:i.drawImage(m,0,0),g=t.toDataURL("image/jpeg",.6),i.clearRect(0,0,l,h),r.whiteboardView.screenshotToCanvas(i,a,l,h,{centerX:l/2,centerY:h/2+s*h,scale:1}),y=t.toDataURL("image/png"),c.addImage(g,"JPEG",0,0,l,h,"","FAST"),c.addImage(y,"PNG",0,0,l,h,"","FAST"),i.clearRect(0,0,l,h),Math.ceil((s+1)/r.pages.length*100)<100&&r.reportProgress(Math.ceil((s+1)/r.pages.length*100),null);case 17:case"end":return e.stop()}}),e)})),h.s();case 15:if((d=h.n()).done){e.next=19;break}return e.delegateYield(f(),"t0",17);case 17:e.next=15;break;case 19:e.next=24;break;case 21:e.prev=21,e.t1=e.catch(12),h.e(e.t1);case 24:return e.prev=24,h.f(),e.finish(24);case 27:p=c.output("arraybuffer"),r.reportProgress(100,{pdf:p,title:r.box.title});case 29:case"end":return e.stop()}}),e,null,[[12,21,24,27]])}))),this.whiteboardView=i,this.readonly=a,this.box=s,this.pages=u,this.baseScenePath=f,this.appId=p,this.mountWhiteboard=h,this._onUserScroll=d;var v=this.debounce((function(){r.userScrolling=!1,r._onUserScroll&&r._onUserScroll(r.pageRenderer.pagesScrollTop)}),{wait:80},"debounce-updateUserScroll");this.updateUserScroll=function(){r.userScrolling=!0,v()},this.viewer=new au({readonly:a,box:s,pages:u,onNewPageIndex:this.onNewPageIndex});var m=this.whiteboardView.size,b=m.width,x=m.height;this.pageRenderer=new mu({pagesScrollTop:c,pages:this.pages,containerWidth:b,containerHeight:x,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new gu({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:b,containerHeight:x,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:function(e){r.pageScrollTo(e),r.updateUserScroll()}}),this.pageScrollStepper=new hu({start:this.pageRenderer.pagesScrollTop,onStep:function(e){r.pageScrollTo(e)}}),this.render()}var t;return x(e,[{key:"mount",value:function(){var e=this;this.viewer.mount(),this.setupScrollListener();var t=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add((function(){var n=new yu(t);return n.observe(e.viewer.$content),function(){return n.disconnect()}})),this.sideEffect.setTimeout((function(){e.userScrolling||e.pageScrollTo(e.pageRenderer.pagesScrollTop)}),100),this.sideEffect.add((function(){var t=function(t){"@netless/_request_save_pdf_"===t.data.type&&t.data.appId===e.appId&&e.toPdf().catch((function(){return e.reportProgress(100,null)}))};return window.addEventListener("message",t),function(){window.removeEventListener("message",t)}})),this}},{key:"unmount",value:function(){return this.viewer.unmount(),this}},{key:"setReadonly",value:function(e){this.readonly!==e&&(this.readonly=e,this.viewer.setReadonly(e),this.scrollbar.setReadonly(e))}},{key:"destroy",value:function(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}},{key:"syncPageScrollTop",value:function(e){!this.userScrolling&&e>=0&&Math.abs(this.pageRenderer.pagesScrollTop-e)>.01&&this.pageScrollStepper.stepTo(e,this.pageRenderer.pagesScrollTop)}},{key:"render",value:function(){this.pageRenderer.mount(this.viewer.$content),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.scrollbar.mount(this.viewer.$content),this.renderRatioHeight()}},{key:"renderRatioHeight",value:function(){var e=this.box.absoluteHeight,t=e<=bu;if(this.viewer.setSmallBox(t),t){var n=26/e,r=Math.max((.08125-(n+0))/2,0);if(this.box.$titleBar){var i=n+r;this.box.$titleBar.style.height="".concat(100*i,"%")}if(this.box.$footer){var o=0+r;this.box.$footer.style.height="".concat(100*o,"%")}}else{if(this.box.$titleBar){var a=Math.max(26/bu,26/e);this.box.$titleBar.style.height="".concat(100*a,"%")}if(this.box.$footer){var s=Math.max(26/bu,26/e);this.box.$footer.style.height="".concat(100*s,"%")}}}},{key:"renderWhiteboardView",value:function(){var e=this;return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.mountWhiteboard(this.$whiteboardView),this.sideEffect.addEventListener(this.$whiteboardView,"wheel",(function(t){lu(t),e.readonly||(e.pageScrollTo(e.pageRenderer.pagesScrollTop+t.deltaY),e.updateUserScroll())}),{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",(function(t){e.readonly||t.touches.length<=1||e.updateUserScroll()}),{passive:!0,capture:!0})),this.$whiteboardView}},{key:"scrollTopPageToEl",value:function(e){return e*this.pageRenderer.scale}},{key:"scrollTopElToPage",value:function(e){return e/this.pageRenderer.scale}},{key:"elScrollTo",value:function(e){this.pageScrollTo(this.scrollTopElToPage(e))}},{key:"pageScrollTo",value:function(e){var t=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:su(e+t,t,this.pageRenderer.pagesIntrinsicHeight-t),animationMode:"immediately"})}},{key:"scrollToPage",value:function(e){if(!this.readonly&&!Number.isNaN(e)){var t=this.pageRenderer.pagesIntrinsicYs[e];t>=0&&(this.pageScrollTo(t+5/this.pageRenderer.scale),this.updateUserScroll())}}},{key:"setupScrollListener",value:function(){var e=this;this.sideEffect.add((function(){var t=function(t){var n=e.whiteboardView.size,r=n.width,i=n.height;if(!(r<=0||i<=0)){var o=t.centerY-e.pageRenderer.containerHeight/e.pageRenderer.scale/2;e.pageRenderer.pagesScrollTo(o),e.scrollbar.pagesScrollTo(o)}};return e.whiteboardView.callbacks.on("onCameraUpdated",t),function(){return e.whiteboardView.callbacks.off("onCameraUpdated",t)}})),this.sideEffect.add((function(){var t=e.updateUserScroll;return e.whiteboardView.callbacks.on("onCameraUpdatedByDevice",t),function(){return e.whiteboardView.callbacks.off("onCameraUpdatedByDevice",t)}})),this.sideEffect.add((function(){var t=function(t){var n=t.width,r=t.height;if(!(n<=0||r<=0)){e.pageRenderer.setContainerSize(n,r),e.scrollbar.setContainerSize(n,r);var i=e.pageRenderer,o=i.pagesIntrinsicWidth,a=i.pagesIntrinsicHeight;e.whiteboardView.moveCameraToContain({originX:0,originY:e.pageRenderer.pagesScrollTop,width:o,height:r/e.pageRenderer.scale,animationMode:"immediately"}),e.whiteboardView.setCameraBound({damping:1,maxContentMode:function(){return e.pageRenderer.scale},minContentMode:function(){return e.pageRenderer.scale},centerX:o/2,centerY:a/2,width:o,height:a})}};return e.whiteboardView.callbacks.on("onSizeUpdated",t),function(){e.whiteboardView.callbacks.off("onSizeUpdated",t)}}),"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",(function(t){if(!e.readonly&&e.box.focus&&!e.box.minimized&&!cu(t.target)){var n=null;switch(t.key){case"PageDown":n=e.pageRenderer.pagesScrollTop+e.pageRenderer.containerHeight/e.pageRenderer.scale;break;case"PageUp":n=e.pageRenderer.pagesScrollTop-e.pageRenderer.containerHeight/e.pageRenderer.scale;break;case"ArrowDown":n=e.pageRenderer.pagesScrollTop+e.pageRenderer.containerHeight/4/e.pageRenderer.scale;break;case"ArrowUp":n=e.pageRenderer.pagesScrollTop-e.pageRenderer.containerHeight/4/e.pageRenderer.scale}null!==n&&(e._onUserScroll?e._onUserScroll(n):(e.pageScrollTo(n),e.updateUserScroll()))}}),{capture:!0})}},{key:"debounce",value:function(e,t,n){var r=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e)throw new TypeError("Expected the first argument to be a function, got `".concat(_(e),"`"));var n,r,i,o=t.wait,a=void 0===o?0:o,s=t.maxWait,u=void 0===s?Number.Infinity:s,l=t.before,c=void 0!==l&&l,h=t.after,d=void 0===h||h;if(!c&&!d)throw new Error("Both `before` and `after` are false, function wouldn't be called.");var f=function(){for(var t=arguments.length,o=new Array(t),s=0;s0&&u!==Number.Infinity&&!r&&(r=setTimeout(f,u)),p&&(i=e.apply(l,o)),i};return Fo(f,e),f.cancel=function(){n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)},f}(e,t);return this.sideEffect.addDisposer((function(){return r.cancel()}),n),r}},{key:"wrapClassName",value:function(e){return"netless-app-docs-viewer-static-"+e}},{key:"getBase64FromUrl",value:(t=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(this._invalidate(t));case 2:return e.next=4,e.sent.blob();case 4:return n=e.sent,e.abrupt("return",new Promise((function(e){var t=new FileReader;t.readAsDataURL(n),t.onloadend=function(){var n=t.result;e(n)}})));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_invalidate",value:function(e){try{var t=new URL(e);return t.searchParams.set("t",Date.now().toString()),t.toString()}catch(t){return e}}},{key:"reportProgress",value:function(e,t){window.postMessage({type:"@netless/_result_save_pdf_",appId:this.appId,progress:e,result:t})}}]),e}(),_u=function(){function e(t){var n=this,r=t.context,i=t.whiteboardView,o=t.box,a=t.pages;y(this,e),this.sideEffect=new Vo,this.onPlayPPT=function(){var e=n.context.getRoom();e&&e.pptNextStep()},this._scaleDocsToFitImpl=function(){var e=n.pages[n.getPageIndex()];e&&(n.whiteboardView.moveCameraToContain({originX:-e.width/2,originY:-e.height/2,width:e.width,height:e.height,animationMode:"immediately"}),n.whiteboardView.setCameraBound({damping:1,maxContentMode:function(){return n.whiteboardView.camera.scale},minContentMode:function(){return n.whiteboardView.camera.scale},centerX:0,centerY:0,width:e.width,height:e.height}))},this._scaleDocsToFitDebounced=function(){n.sideEffect.setTimeout(n._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=function(){n._scaleDocsToFitImpl(),n._scaleDocsToFitDebounced()},this.onNewPageIndex=function(e){n.jumpToPage(e,!0)},this.context=r,this.whiteboardView=i,this.box=o,this.pages=a,this.displayer=r.getDisplayer(),this.viewer=new au({readonly:!r.getIsWritable(),box:o,pages:a,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add((function(){var e=function(e){n.viewer.setReadonly(!e)};return n.context.emitter.on("writableChange",e),function(){return n.context.emitter.off("writableChange",e)}})),this.sideEffect.add((function(){var e=function(e){n.jumpToPage(e.index)};return n.context.emitter.on("sceneStateChange",e),function(){return n.context.emitter.off("sceneStateChange",e)}}))}return x(e,[{key:"mount",value:function(){var e=this;this.viewer.mount();var t=this.getPageIndex();return 0!==t&&this.jumpToPage(t),this.scaleDocsToFit(),this.sideEffect.add((function(){return e.whiteboardView.callbacks.on("onSizeUpdated",e.scaleDocsToFit),function(){e.whiteboardView.callbacks.off("onSizeUpdated",e.scaleDocsToFit)}})),this}},{key:"unmount",value:function(){return this.viewer.unmount(),this}},{key:"destroy",value:function(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}},{key:"getPageIndex",value:function(){return this.displayer.state.sceneState.index}},{key:"jumpToPage",value:function(e,t){var n,r;if((e=su(e,0,this.pages.length-1))!==this.getPageIndex()&&this.context.getIsWritable()){var i=this.context.getInitScenePath(),o=null==(r=null==(n=this.context.getScenes())?void 0:n[e])?void 0:r.name;i&&o&&this.context.setScenePath("".concat(i,"/").concat(o)),this.scaleDocsToFit()}if(e!==this.viewer.pageIndex&&this.viewer.setPageIndex(e),t){var a=this.context.getRoom();if(a){var s=a.state.globalState.__pptState;a.setGlobalState({__pptState:s&&{uuid:s.uuid,pageIndex:e,disableAutoPlay:s.disableAutoPlay}})}}}},{key:"render",value:function(){var e=this;this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",(function(t){var n;if(e.box.focus&&!cu(t.target))switch(t.key){case"ArrowUp":case"ArrowLeft":e.jumpToPage(e.getPageIndex()-1,!0);break;case"ArrowRight":case"ArrowDown":null==(n=e.context.getRoom())||n.pptNextStep()}}))}},{key:"renderMask",value:function(){if(!this.$mask){var e=document.createElement("div");e.className=this.wrapClassName("mask"),this.$mask=e,document.createElement("button").className=this.wrapClassName("back"),document.createElement("button").className=this.wrapClassName("next")}return this.$mask}},{key:"renderWhiteboardView",value:function(){var e=this;return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.sideEffect.addEventListener(this.$whiteboardView,"click",(function(t){var n,r=e.context.getRoom();if(r&&"clicker"===r.state.memberState.currentApplianceName){for(var i=t.target;i;i=i.parentElement)if(null!=(n=i.classList)&&n.contains("ppt-event-source"))return;r.pptNextStep()}})),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}},{key:"wrapClassName",value:function(e){return"netless-app-docs-viewer-dynamic-"+e}}]),e}(),wu={kind:"DocsViewer",setup:function(e){var t=e.getBox(),n=e.getScenes();if(!n)throw new Error("[Docs Viewer]: scenes not found.");var r=e.getView();if(!r)throw new Error("[Docs Viewer]: no whiteboard view.");var i=n.map((function(e){var t=e.ppt;return t?{width:t.width,height:t.height,src:t.src,thumbnail:t.previewURL}:null})).filter((function(e){return Boolean(e)}));if(i.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(".netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview-mask{display:block}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview{transform:translate(0)}.netless-app-docs-viewer-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-docs-viewer-preview-page:hover,.netless-app-docs-viewer-preview-page.netless-app-docs-viewer-preview-page-active{border-color:#444e601a}.netless-app-docs-viewer-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-docs-viewer-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-docs-viewer-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-docs-viewer-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-docs-viewer-footer-btn:hover{background:transparent!important}}.netless-app-docs-viewer-footer-btn>svg{width:100%;height:100%}.netless-app-docs-viewer-footer-btn>svg:nth-of-type(2){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-docs-viewer-footer-btn~.netless-app-docs-viewer-footer-btn{margin-left:15px}.netless-app-docs-viewer-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-docs-viewer-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-docs-viewer-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn:hover{background:transparent}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:active{background:transparent;box-shadow:none}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:disabled{color:inherit}.netless-app-docs-viewer-readonly.netless-app-docs-viewer-float-footer{display:none}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:active,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:focus,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.page-renderer-pages-container{position:relative;overflow:hidden}.page-renderer-page{position:absolute;top:0;left:0;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-pages-container.is-hwa .page-renderer-page{will-change:transform}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-wb-view,.netless-app-docs-viewer-dynamic-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-docs-viewer-dynamic-wb-view .cursor-clicker .ppt-event-source{cursor:pointer}\n"),i[0].src.startsWith("ppt")?function(e,t,n,r){t.disableCameraTransform=!0;var i=new _u({context:e,whiteboardView:t,box:n,pages:r}).mount();i.viewer.onPageIndexChanged=function(t){e.dispatchAppEvent("pageStateChange",{index:t,length:r.length})},e.dispatchAppEvent("pageStateChange",{index:i.getPageIndex(),length:r.length}),e.mountView(i.$whiteboardView),e.isAddApp&&t.callbacks.once("onSizeUpdated",(function(t){var i=t.width,o=t.height;if(r.length>0&&"maximized"!==n.state){var a=r[0],s=a.width,u=a.height/s*i-o;0!==u&&e.getIsWritable()&&e.emitter.emit("setBoxSize",{width:n.width,height:n.height+u/n.containerRect.height})}}))}(e,r,t,i):function(e,t,n,r){var i;t.disableCameraTransform=!e.getIsWritable();var o=new xu({whiteboardView:t,readonly:!e.getIsWritable(),box:n,pages:r,pageScrollTop:null==(i=e.getAttributes())?void 0:i.pageScrollTop,mountWhiteboard:e.mountView.bind(e),onUserScroll:function(t){var r;(null==(r=e.getAttributes())?void 0:r.pageScrollTop)!==t&&!n.readonly&&e.updateAttributes(["pageScrollTop"],t)},baseScenePath:e.getInitScenePath(),appId:e.appId}).mount();o.viewer.onPageIndexChanged=function(t){e.dispatchAppEvent("pageStateChange",{index:t,length:r.length})},e.dispatchAppEvent("pageStateChange",{index:o.viewer.pageIndex,length:r.length}),e.emitter.on("attributesUpdate",(function(e){e&&null!=e.pageScrollTop&&o.syncPageScrollTop(e.pageScrollTop)})),e.emitter.on("writableChange",(function(e){o.setReadonly(!e),t.disableCameraTransform=!e}))}(e,r,t,i)}};var Tu={exports:{}},Mu={},Su={exports:{}},Eu={}; /** @license React v0.19.1 * scheduler.production.min.js * @@ -297,7 +297,7 @@ PERFORMANCE OF THIS SOFTWARE. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. -*/!function(e){var t,n,r,i,o;if("undefined"==typeof window||"function"!=typeof MessageChannel){var a=null,s=null,u=function t(){if(null!==a)try{var n=e.unstable_now();a(!0,n),a=null}catch(e){throw setTimeout(t,0),e}},l=Date.now();e.unstable_now=function(){return Date.now()-l},t=function(e){null!==a?setTimeout(t,0,e):(a=e,setTimeout(u,0))},n=function(e,t){s=setTimeout(e,t)},r=function(){clearTimeout(s)},i=function(){return!1},o=e.unstable_forceFrameRate=function(){}}else{var c=window.performance,h=window.Date,d=window.setTimeout,f=window.clearTimeout;if("undefined"!=typeof console){var p=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==_(c)&&"function"==typeof c.now)e.unstable_now=function(){return c.now()};else{var v=h.now();e.unstable_now=function(){return h.now()-v}}var m=!1,g=null,y=-1,b=5,x=0;i=function(){return e.unstable_now()>=x},o=function(){},e.unstable_forceFrameRate=function(e){0>e||125>>1,i=e[r];if(!(void 0!==i&&0A(a,n))void 0!==u&&0>A(u,a)?(e[r]=u,e[s]=n,r=s):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==u&&0>A(u,n)))break e;e[r]=u,e[s]=n,r=s}}}return t}return null}function A(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var I=[],C=[],N=1,k=null,D=3,P=!1,O=!1,R=!1;function L(e){for(var t=S(C);null!==t;){if(null===t.callback)E(C);else{if(!(t.startTime<=e))break;E(C),t.sortIndex=t.expirationTime,M(I,t)}t=S(C)}}function j(e){if(R=!1,L(e),!O)if(null!==S(I))O=!0,t(B);else{var r=S(C);null!==r&&n(j,r.startTime-e)}}function B(t,o){O=!1,R&&(R=!1,r()),P=!0;var a=D;try{for(L(o),k=S(I);null!==k&&(!(k.expirationTime>o)||t&&!i());){var s=k.callback;if(null!==s){k.callback=null,D=k.priorityLevel;var u=s(k.expirationTime<=o);o=e.unstable_now(),"function"==typeof u?k.callback=u:k===S(I)&&E(I),L(o)}else E(I);k=S(I)}if(null!==k)var l=!0;else{var c=S(C);null!==c&&n(j,c.startTime-o),l=!1}return l}finally{k=null,D=a,P=!1}}function U(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var F=o;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(){O||P||(O=!0,t(B))},e.unstable_getCurrentPriorityLevel=function(){return D},e.unstable_getFirstCallbackNode=function(){return S(I)},e.unstable_next=function(e){switch(D){case 1:case 2:case 3:var t=3;break;default:t=D}var n=D;D=t;try{return e()}finally{D=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=F,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=D;D=e;try{return t()}finally{D=n}},e.unstable_scheduleCallback=function(i,o,a){var s=e.unstable_now();if("object"==_(a)&&null!==a){var u=a.delay;u="number"==typeof u&&0s?(i.sortIndex=u,M(C,i),null===S(I)&&i===S(C)&&(R?r():R=!0,n(j,u-s))):(i.sortIndex=a,M(I,i),O||P||(O=!0,t(B))),i},e.unstable_shouldYield=function(){var t=e.unstable_now();L(t);var n=S(I);return n!==k&&null!==k&&null!==n&&null!==n.callback&&n.startTime<=t&&n.expirationTime=x},o=function(){},e.unstable_forceFrameRate=function(e){0>e||125>>1,i=e[r];if(!(void 0!==i&&0A(a,n))void 0!==u&&0>A(u,a)?(e[r]=u,e[s]=n,r=s):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==u&&0>A(u,n)))break e;e[r]=u,e[s]=n,r=s}}}return t}return null}function A(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var I=[],C=[],N=1,k=null,D=3,P=!1,O=!1,R=!1;function L(e){for(var t=S(C);null!==t;){if(null===t.callback)E(C);else{if(!(t.startTime<=e))break;E(C),t.sortIndex=t.expirationTime,M(I,t)}t=S(C)}}function j(e){if(R=!1,L(e),!O)if(null!==S(I))O=!0,t(B);else{var r=S(C);null!==r&&n(j,r.startTime-e)}}function B(t,o){O=!1,R&&(R=!1,r()),P=!0;var a=D;try{for(L(o),k=S(I);null!==k&&(!(k.expirationTime>o)||t&&!i());){var s=k.callback;if(null!==s){k.callback=null,D=k.priorityLevel;var u=s(k.expirationTime<=o);o=e.unstable_now(),"function"==typeof u?k.callback=u:k===S(I)&&E(I),L(o)}else E(I);k=S(I)}if(null!==k)var l=!0;else{var c=S(C);null!==c&&n(j,c.startTime-o),l=!1}return l}finally{k=null,D=a,P=!1}}function U(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var F=o;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(){O||P||(O=!0,t(B))},e.unstable_getCurrentPriorityLevel=function(){return D},e.unstable_getFirstCallbackNode=function(){return S(I)},e.unstable_next=function(e){switch(D){case 1:case 2:case 3:var t=3;break;default:t=D}var n=D;D=t;try{return e()}finally{D=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=F,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=D;D=e;try{return t()}finally{D=n}},e.unstable_scheduleCallback=function(i,o,a){var s=e.unstable_now();if("object"==_(a)&&null!==a){var u=a.delay;u="number"==typeof u&&0s?(i.sortIndex=u,M(C,i),null===S(I)&&i===S(C)&&(R?r():R=!0,n(j,u-s))):(i.sortIndex=a,M(I,i),O||P||(O=!0,t(B))),i},e.unstable_shouldYield=function(){var t=e.unstable_now();L(t);var n=S(I);return n!==k&&null!==k&&null!==n&&null!==n.callback&&n.startTime<=t&&n.expirationTimet}return!1}function yl(e,t,n,r,i,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o}var bl={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){bl[e]=new yl(e,0,!1,e,null,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];bl[t]=new yl(t,1,!1,e[1],null,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){bl[e]=new yl(e,2,!1,e.toLowerCase(),null,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){bl[e]=new yl(e,2,!1,e,null,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){bl[e]=new yl(e,3,!1,e.toLowerCase(),null,!1)})),["checked","multiple","muted","selected"].forEach((function(e){bl[e]=new yl(e,3,!0,e,null,!1)})),["capture","download"].forEach((function(e){bl[e]=new yl(e,4,!1,e,null,!1)})),["cols","rows","size","span"].forEach((function(e){bl[e]=new yl(e,6,!1,e,null,!1)})),["rowSpan","start"].forEach((function(e){bl[e]=new yl(e,5,!1,e.toLowerCase(),null,!1)}));var xl=/[\-:]([a-z])/g;function _l(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(xl,_l);bl[t]=new yl(t,1,!1,e,null,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(xl,_l);bl[t]=new yl(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(xl,_l);bl[t]=new yl(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)})),["tabIndex","crossOrigin"].forEach((function(e){bl[e]=new yl(e,1,!1,e.toLowerCase(),null,!1)})),bl.xlinkHref=new yl("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0),["src","href","action","formAction"].forEach((function(e){bl[e]=new yl(e,1,!1,e.toLowerCase(),null,!0)}));var wl=Iu.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Tl(e,t,n,r){var i=bl.hasOwnProperty(t)?bl[t]:null;(null!==i?0===i.type:!r&&!(!(2=n.length))throw Error(ku(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:Vl(n)}}function ic(e,t){var n=Vl(t.value),r=Vl(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function oc(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var ac="http://www.w3.org/1999/xhtml",sc="http://www.w3.org/2000/svg";function uc(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function lc(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?uc(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var cc,hc=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction((function(){return e(t,n)}))}:e}((function(e,t){if(e.namespaceURI!==sc||"innerHTML"in e)e.innerHTML=t;else{for((cc=cc||document.createElement("div")).innerHTML=""+t.valueOf().toString()+"",t=cc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}));function dc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}function fc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var pc={animationend:fc("Animation","AnimationEnd"),animationiteration:fc("Animation","AnimationIteration"),animationstart:fc("Animation","AnimationStart"),transitionend:fc("Transition","TransitionEnd")},vc={},mc={};function gc(e){if(vc[e])return vc[e];if(!pc[e])return e;var t,n=pc[e];for(t in n)if(n.hasOwnProperty(t)&&t in mc)return vc[e]=n[t];return e}Ku&&(mc=document.createElement("div").style,"AnimationEvent"in window||(delete pc.animationend.animation,delete pc.animationiteration.animation,delete pc.animationstart.animation),"TransitionEvent"in window||delete pc.transitionend.transition);var yc=gc("animationend"),bc=gc("animationiteration"),xc=gc("animationstart"),_c=gc("transitionend"),wc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Tc=new("function"==typeof WeakMap?WeakMap:Map);function Mc(e){var t=Tc.get(e);return void 0===t&&(t=new Map,Tc.set(e,t)),t}function Sc(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).effectTag)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Ec(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Ac(e){if(Sc(e)!==e)throw Error(ku(188))}function Ic(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=Sc(e)))throw Error(ku(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Ac(i),e;if(o===r)return Ac(i),t;o=o.sibling}throw Error(ku(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,s=i.child;s;){if(s===n){a=!0,n=i,r=o;break}if(s===r){a=!0,r=i,n=o;break}s=s.sibling}if(!a){for(s=o.child;s;){if(s===n){a=!0,n=o,r=i;break}if(s===r){a=!0,r=o,n=i;break}s=s.sibling}if(!a)throw Error(ku(189))}}if(n.alternate!==r)throw Error(ku(190))}if(3!==n.tag)throw Error(ku(188));return n.stateNode.current===n?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Cc(e,t){if(null==t)throw Error(ku(30));return null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function Nc(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var kc=null;function Dc(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;rLc.length&&Lc.push(e)}function Bc(e,t,n,r){if(Lc.length){var i=Lc.pop();return i.topLevelType=e,i.eventSystemFlags=r,i.nativeEvent=t,i.targetInst=n,i}return{topLevelType:e,eventSystemFlags:r,nativeEvent:t,targetInst:n,ancestors:[]}}function Uc(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r=n;if(3===r.tag)r=r.stateNode.containerInfo;else{for(;r.return;)r=r.return;r=3!==r.tag?null:r.stateNode.containerInfo}if(!r)break;5!==(t=n.tag)&&6!==t||e.ancestors.push(n),n=td(r)}while(n);for(n=0;n=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Lh(r)}}function Bh(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?Bh(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function Uh(){for(var e=window,t=Rh();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Rh((e=t.contentWindow).document)}return t}function Fh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var zh="$?",Gh="$!",Hh=null,Vh=null;function Wh(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Yh(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==_(t.dangerouslySetInnerHTML)&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Xh="function"==typeof setTimeout?setTimeout:void 0,Qh="function"==typeof clearTimeout?clearTimeout:void 0;function Zh(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function qh(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||n===Gh||n===zh){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var Jh=Math.random().toString(36).slice(2),Kh="__reactInternalInstance$"+Jh,$h="__reactEventHandlers$"+Jh,ed="__reactContainere$"+Jh;function td(e){var t=e[Kh];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ed]||n[Kh]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=qh(e);null!==e;){if(n=e[Kh])return n;e=qh(e)}return t}n=(e=n).parentNode}return null}function nd(e){return!(e=e[Kh]||e[ed])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function rd(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(ku(33))}function id(e){return e[$h]||null}function od(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function ad(e,t){var n=e.stateNode;if(!n)return null;var r=Uu(n);if(!r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(ku(231,t,_(n)));return n}function sd(e,t,n){(t=ad(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=Cc(n._dispatchListeners,t),n._dispatchInstances=Cc(n._dispatchInstances,e))}function ud(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=od(t);for(t=n.length;0this.eventPool.length&&this.eventPool.push(e)}function _d(e){e.eventPool=[],e.getPooled=bd,e.release=xd}Cu(yd.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=md)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=md)},persist:function(){this.isPersistent=md},isPersistent:gd,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=gd,this._dispatchInstances=this._dispatchListeners=null}}),yd.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},yd.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var i=new t;return Cu(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=Cu({},r.Interface,e),n.extend=r.extend,_d(n),n},_d(yd);var wd=yd.extend({data:null}),Td=yd.extend({data:null}),Md=[9,13,27,32],Sd=Ku&&"CompositionEvent"in window,Ed=null;Ku&&"documentMode"in document&&(Ed=document.documentMode);var Ad=Ku&&"TextEvent"in window&&!Ed,Id=Ku&&(!Sd||Ed&&8=Ed),Cd=String.fromCharCode(32),Nd={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},kd=!1;function Dd(e,t){switch(e){case"keyup":return-1!==Md.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Pd(e){return"object"==_(e=e.detail)&&"data"in e?e.data:null}var Od=!1;var Rd={eventTypes:Nd,extractEvents:function(e,t,n,r){var i;if(Sd)e:{switch(e){case"compositionstart":var o=Nd.compositionStart;break e;case"compositionend":o=Nd.compositionEnd;break e;case"compositionupdate":o=Nd.compositionUpdate;break e}o=void 0}else Od?Dd(e,n)&&(o=Nd.compositionEnd):"keydown"===e&&229===n.keyCode&&(o=Nd.compositionStart);return o?(Id&&"ko"!==n.locale&&(Od||o!==Nd.compositionStart?o===Nd.compositionEnd&&Od&&(i=vd()):(fd="value"in(dd=r)?dd.value:dd.textContent,Od=!0)),o=wd.getPooled(o,t,n,r),i?o.data=i:null!==(i=Pd(n))&&(o.data=i),hd(o),i=o):i=null,(e=Ad?function(e,t){switch(e){case"compositionend":return Pd(t);case"keypress":return 32!==t.which?null:(kd=!0,Cd);case"textInput":return(e=t.data)===Cd&&kd?null:e;default:return null}}(e,n):function(e,t){if(Od)return"compositionend"===e||!Sd&&Dd(e,t)?(e=vd(),pd=fd=dd=null,Od=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=document.documentMode,mf={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},gf=null,yf=null,bf=null,xf=!1;function _f(e,t){var n=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;return xf||null==gf||gf!==Rh(n)?null:("selectionStart"in(n=gf)&&Fh(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},bf&&pf(bf,n)?null:(bf=n,(e=yd.getPooled(mf.select,yf,e,t)).type="select",e.target=gf,hd(e),e))}var wf={eventTypes:mf,extractEvents:function(e,t,n,r,i,o){if(!(o=!(i=o||(r.window===r?r.document:9===r.nodeType?r:r.ownerDocument)))){e:{i=Mc(i),o=qu.onSelect;for(var a=0;aLf||(e.current=Rf[Lf],Rf[Lf]=null,Lf--)}function Bf(e,t){Lf++,Rf[Lf]=e.current,e.current=t}var Uf={},Ff={current:Uf},zf={current:!1},Gf=Uf;function Hf(e,t){var n=e.type.contextTypes;if(!n)return Uf;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Vf(e){return null!=(e=e.childContextTypes)}function Wf(){jf(zf),jf(Ff)}function Yf(e,t,n){if(Ff.current!==Uf)throw Error(ku(168));Bf(Ff,t),Bf(zf,n)}function Xf(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in e))throw Error(ku(108,Gl(t)||"Unknown",i));return Cu({},n,{},r)}function Qf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Uf,Gf=Ff.current,Bf(Ff,e),Bf(zf,zf.current),!0}function Zf(e,t,n){var r=e.stateNode;if(!r)throw Error(ku(169));n?(e=Xf(e,t,Gf),r.__reactInternalMemoizedMergedChildContext=e,jf(zf),jf(Ff),Bf(Ff,e)):jf(zf),Bf(zf,n)}var qf=Nu.unstable_runWithPriority,Jf=Nu.unstable_scheduleCallback,Kf=Nu.unstable_cancelCallback,$f=Nu.unstable_requestPaint,ep=Nu.unstable_now,tp=Nu.unstable_getCurrentPriorityLevel,np=Nu.unstable_ImmediatePriority,rp=Nu.unstable_UserBlockingPriority,ip=Nu.unstable_NormalPriority,op=Nu.unstable_LowPriority,ap=Nu.unstable_IdlePriority,sp={},up=Nu.unstable_shouldYield,lp=void 0!==$f?$f:function(){},cp=null,hp=null,dp=!1,fp=ep(),pp=1e4>fp?ep:function(){return ep()-fp};function vp(){switch(tp()){case np:return 99;case rp:return 98;case ip:return 97;case op:return 96;case ap:return 95;default:throw Error(ku(332))}}function mp(e){switch(e){case 99:return np;case 98:return rp;case 97:return ip;case 96:return op;case 95:return ap;default:throw Error(ku(332))}}function gp(e,t){return e=mp(e),qf(e,t)}function yp(e,t,n){return e=mp(e),Jf(e,t,n)}function bp(e){return null===cp?(cp=[e],hp=Jf(np,_p)):cp.push(e),sp}function xp(){if(null!==hp){var e=hp;hp=null,Kf(e)}_p()}function _p(){if(!dp&&null!==cp){dp=!0;var e=0;try{var t=cp;gp(99,(function(){for(;e=t&&(im=!0),e.firstContext=null)}function Dp(e,t){if(Ap!==e&&!1!==t&&0!==t)if(("number"!=typeof t||1073741823===t)&&(Ap=e,t=1073741823),t={context:e,observedBits:t,next:null},null===Ep){if(null===Sp)throw Error(ku(308));Ep=t,Sp.dependencies={expirationTime:0,firstContext:t,responders:null}}else Ep=Ep.next=t;return e._currentValue}var Pp=!1;function Op(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function Rp(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function Lp(e,t){return(e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null}).next=e}function jp(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function Bp(e,t){var n=e.alternate;null!==n&&Rp(n,e),null===(n=(e=e.updateQueue).baseQueue)?(e.baseQueue=t.next=t,t.next=t):(t.next=n.next,n.next=t)}function Up(e,t,n,r){var i=e.updateQueue;Pp=!1;var o=i.baseQueue,a=i.shared.pending;if(null!==a){if(null!==o){var s=o.next;o.next=a.next,a.next=s}o=a,i.shared.pending=null,null!==(s=e.alternate)&&(null!==(s=s.updateQueue)&&(s.baseQueue=a))}if(null!==o){s=o.next;var u=i.baseState,l=0,c=null,h=null,d=null;if(null!==s)for(var f=s;;){if((a=f.expirationTime)l&&(l=a)}else{null!==d&&(d=d.next={expirationTime:1073741823,suspenseConfig:f.suspenseConfig,tag:f.tag,payload:f.payload,callback:f.callback,next:null}),jg(a,f.suspenseConfig);e:{var v=e,m=f;switch(a=t,p=n,m.tag){case 1:if("function"==typeof(v=m.payload)){u=v.call(p,u,a);break e}u=v;break e;case 3:v.effectTag=-4097&v.effectTag|64;case 0:if(null==(a="function"==typeof(v=m.payload)?v.call(p,u,a):v))break e;u=Cu({},u,a);break e;case 2:Pp=!0}}null!==f.callback&&(e.effectTag|=32,null===(a=i.effects)?i.effects=[f]:a.push(f))}if(null===(f=f.next)||f===s){if(null===(a=i.shared.pending))break;f=o.next=a.next,a.next=s,i.baseQueue=o=a,i.shared.pending=null}}null===d?c=u:d.next=h,i.baseState=c,i.baseQueue=d,Bg(l),e.expirationTime=l,e.memoizedState=u}}function Fp(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;tv?(m=p,p=null):m=p.sibling;var g=d(i,p,s[v],u);if(null===g){null===p&&(p=m);break}e&&p&&null===g.alternate&&t(i,p),a=o(g,a,v),null===c?l=g:c.sibling=g,c=g,p=m}if(v===s.length)return n(i,p),l;if(null===p){for(;vv?(m=p,p=null):m=p.sibling;var y=d(i,p,g.value,u);if(null===y){null===p&&(p=m);break}e&&p&&null===y.alternate&&t(i,p),a=o(y,a,v),null===c?l=y:c.sibling=y,c=y,p=m}if(g.done)return n(i,p),l;if(null===p){for(;!g.done;v++,g=s.next())null!==(g=h(i,g.value,u))&&(a=o(g,a,v),null===c?l=g:c.sibling=g,c=g);return l}for(p=r(i,p);!g.done;v++,g=s.next())null!==(g=f(p,i,v,g.value,u))&&(e&&null!==g.alternate&&p.delete(null===g.key?v:g.key),a=o(g,a,v),null===c?l=g:c.sibling=g,c=g);return e&&p.forEach((function(e){return t(i,e)})),l}(s,u,l,c);if(v&&Jp(s,l),void 0===l&&!p)switch(s.tag){case 1:case 0:throw s=s.type,Error(ku(152,s.displayName||s.name||"Component"))}return n(s,u)}}var $p=Kp(!0),ev=Kp(!1),tv={},nv={current:tv},rv={current:tv},iv={current:tv};function ov(e){if(e===tv)throw Error(ku(174));return e}function av(e,t){switch(Bf(iv,t),Bf(rv,e),Bf(nv,tv),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:lc(null,"");break;default:t=lc(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}jf(nv),Bf(nv,t)}function sv(){jf(nv),jf(rv),jf(iv)}function uv(e){ov(iv.current);var t=ov(nv.current),n=lc(t,e.type);t!==n&&(Bf(rv,e),Bf(nv,n))}function lv(e){rv.current===e&&(jf(nv),jf(rv))}var cv={current:0};function hv(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||n.data===zh||n.data===Gh))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.effectTag))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function dv(e,t){return{responder:e,props:t}}var fv=wl.ReactCurrentDispatcher,pv=wl.ReactCurrentBatchConfig,vv=0,mv=null,gv=null,yv=null,bv=!1;function xv(){throw Error(ku(321))}function _v(e,t){if(null===t)return!1;for(var n=0;no))throw Error(ku(301));o+=1,yv=gv=null,t.updateQueue=null,fv.current=Xv,e=n(r,i)}while(t.expirationTime===vv)}if(fv.current=Vv,t=null!==gv&&null!==gv.next,vv=0,yv=gv=mv=null,bv=!1,t)throw Error(ku(300));return e}function Tv(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===yv?mv.memoizedState=yv=e:yv=yv.next=e,yv}function Mv(){if(null===gv){var e=mv.alternate;e=null!==e?e.memoizedState:null}else e=gv.next;var t=null===yv?mv.memoizedState:yv.next;if(null!==t)yv=t,gv=e;else{if(null===e)throw Error(ku(310));e={memoizedState:(gv=e).memoizedState,baseState:gv.baseState,baseQueue:gv.baseQueue,queue:gv.queue,next:null},null===yv?mv.memoizedState=yv=e:yv=yv.next=e}return yv}function Sv(e,t){return"function"==typeof t?t(e):t}function Ev(e){var t=Mv(),n=t.queue;if(null===n)throw Error(ku(311));n.lastRenderedReducer=e;var r=gv,i=r.baseQueue,o=n.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var s=a=o=null,u=i;do{var l=u.expirationTime;if(lmv.expirationTime&&(mv.expirationTime=l,Bg(l))}else null!==s&&(s=s.next={expirationTime:1073741823,suspenseConfig:u.suspenseConfig,action:u.action,eagerReducer:u.eagerReducer,eagerState:u.eagerState,next:null}),jg(l,u.suspenseConfig),r=u.eagerReducer===e?u.eagerState:e(r,u.action);u=u.next}while(null!==u&&u!==i);null===s?o=r:s.next=a,df(r,t.memoizedState)||(im=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=s,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function Av(e){var t=Mv(),n=t.queue;if(null===n)throw Error(ku(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);df(o,t.memoizedState)||(im=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Iv(e){var t=Tv();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:Sv,lastRenderedState:e}).dispatch=Hv.bind(null,mv,e),[t.memoizedState,e]}function Cv(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=mv.updateQueue)?(t={lastEffect:null},mv.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Nv(){return Mv().memoizedState}function kv(e,t,n,r){var i=Tv();mv.effectTag|=e,i.memoizedState=Cv(1|t,n,void 0,void 0===r?null:r)}function Dv(e,t,n,r){var i=Mv();r=void 0===r?null:r;var o=void 0;if(null!==gv){var a=gv.memoizedState;if(o=a.destroy,null!==r&&_v(r,a.deps))return void Cv(t,n,o,r)}mv.effectTag|=e,i.memoizedState=Cv(1|t,n,o,r)}function Pv(e,t){return kv(516,4,e,t)}function Ov(e,t){return Dv(516,4,e,t)}function Rv(e,t){return Dv(4,2,e,t)}function Lv(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function jv(e,t,n){return n=null!=n?n.concat([e]):null,Dv(4,2,Lv.bind(null,t,e),n)}function Bv(){}function Uv(e,t){return Tv().memoizedState=[e,void 0===t?null:t],e}function Fv(e,t){var n=Mv();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&_v(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function zv(e,t){var n=Mv();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&_v(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Gv(e,t,n){var r=vp();gp(98>r?98:r,(function(){e(!0)})),gp(97<\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=a.createElement(i,{is:r.is}):(e=a.createElement(i),"select"===i&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,i),e[Kh]=t,e[$h]=r,pm(e,t),t.stateNode=e,a=kh(i,r),i){case"iframe":case"object":case"embed":bh("load",e),s=r;break;case"video":case"audio":for(s=0;sr.tailExpiration&&1t)&&xg.set(e,t))}}function Ag(e,t){e.expirationTime=(e=n>(e=e.nextKnownPendingLevel)?n:e)&&t!==e?0:e}function Cg(e){if(0!==e.lastExpiredTime)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=bp(kg.bind(null,e));else{var t=Ig(e),n=e.callbackNode;if(0===t)null!==n&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var r=Mg();if(1073741823===t?r=99:1===t||2===t?r=95:r=0>=(r=10*(1073741821-t)-10*(1073741821-r))?99:250>=r?98:5250>=r?97:95,null!==n){var i=e.callbackPriority;if(e.callbackExpirationTime===t&&i>=r)return;n!==sp&&Kf(n)}e.callbackExpirationTime=t,e.callbackPriority=r,t=1073741823===t?bp(kg.bind(null,e)):yp(r,Ng.bind(null,e),{timeout:10*(1073741821-t)-pp()}),e.callbackNode=t}}}function Ng(e,t){if(Tg=0,t)return fy(e,t=Mg()),Cg(e),null;var n=Ig(e);if(0!==n){if(t=e.callbackNode,0!=(48&tg))throw Error(ku(327));if(Xg(),e===ng&&n===ig||Og(e,n),null!==rg){var r=tg;tg|=qm;for(var i=Lg();;)try{Fg();break}catch(t){Rg(e,t)}if(Ip(),tg=r,Qm.current=i,1===og)throw t=ag,Og(e,n),hy(e,n),Cg(e),t;if(null===rg)switch(i=e.finishedWork=e.current.alternate,e.finishedExpirationTime=n,r=og,ng=null,r){case Km:case 1:throw Error(ku(345));case 2:fy(e,2=n){e.lastPingedTime=n,Og(e,n);break}}if(0!==(o=Ig(e))&&o!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}e.timeoutHandle=Xh(Vg.bind(null,e),i);break}Vg(e);break;case eg:if(hy(e,n),n===(r=e.lastSuspendedTime)&&(e.nextKnownPendingLevel=Hg(i)),hg&&(0===(i=e.lastPingedTime)||i>=n)){e.lastPingedTime=n,Og(e,n);break}if(0!==(i=Ig(e))&&i!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}if(1073741823!==ug?r=10*(1073741821-ug)-pp():1073741823===sg?r=0:(r=10*(1073741821-sg)-5e3,0>(r=(i=pp())-r)&&(r=0),(n=10*(1073741821-n)-i)<(r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Xm(r/1960))-r)&&(r=n)),10=(r=0|a.busyMinDurationMs)?r=0:(i=0|a.busyDelayMs,r=(o=pp()-(10*(1073741821-o)-(0|a.timeoutMs||5e3)))<=i?0:i+r-o),10 component higher in the tree to provide a loading indicator or placeholder to display."+Hl(a))}5!==og&&(og=2),s=Em(s,a),h=o;do{switch(h.tag){case 3:u=s,h.effectTag|=4096,h.expirationTime=t,Bp(h,Vm(h,u,t));break e;case 1:u=s;var x=h.type,w=h.stateNode;if(0==(64&h.effectTag)&&("function"==typeof x.getDerivedStateFromError||null!==w&&"function"==typeof w.componentDidCatch&&(null===mg||!mg.has(w)))){h.effectTag|=4096,h.expirationTime=t,Bp(h,Wm(h,u,t));break e}}h=h.return}while(null!==h)}rg=Gg(rg)}catch(e){t=e;continue}break}}function Lg(){var e=Qm.current;return Qm.current=Vv,null===e?Vv:e}function jg(e,t){ecg&&(cg=e)}function Ug(){for(;null!==rg;)rg=zg(rg)}function Fg(){for(;null!==rg&&!up();)rg=zg(rg)}function zg(e){var t=Ym(e.alternate,e,ig);return e.memoizedProps=e.pendingProps,null===t&&(t=Gg(e)),Zm.current=null,t}function Gg(e){rg=e;do{var t=rg.alternate;if(e=rg.return,0==(2048&rg.effectTag)){if(t=Mm(t,rg,ig),1===ig||1!==rg.childExpirationTime){for(var n=0,r=rg.child;null!==r;){var i=r.expirationTime,o=r.childExpirationTime;i>n&&(n=i),o>n&&(n=o),r=r.sibling}rg.childExpirationTime=n}if(null!==t)return t;null!==e&&0==(2048&e.effectTag)&&(null===e.firstEffect&&(e.firstEffect=rg.firstEffect),null!==rg.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=rg.firstEffect),e.lastEffect=rg.lastEffect),1(e=e.childExpirationTime)?t:e}function Vg(e){var t=vp();return gp(99,Wg.bind(null,e,t)),null}function Wg(e,t){do{Xg()}while(null!==yg);if(0!=(48&tg))throw Error(ku(327));var n=e.finishedWork,r=e.finishedExpirationTime;if(null===n)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,n===e.current)throw Error(ku(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var i=Hg(n);if(e.firstPendingTime=i,r<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:r<=e.firstSuspendedTime&&(e.firstSuspendedTime=r-1),r<=e.lastPingedTime&&(e.lastPingedTime=0),r<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===ng&&(rg=ng=null,ig=0),1s&&(l=s,s=a,a=l),l=jh(b,a),c=jh(b,s),l&&c&&(1!==_.rangeCount||_.anchorNode!==l.node||_.anchorOffset!==l.offset||_.focusNode!==c.node||_.focusOffset!==c.offset)&&((x=x.createRange()).setStart(l.node,l.offset),_.removeAllRanges(),a>s?(_.addRange(x),_.extend(c.node,c.offset)):(x.setEnd(c.node,c.offset),_.addRange(x))))),x=[],_=b);_=_.parentNode;)1===_.nodeType&&x.push({element:_,left:_.scrollLeft,top:_.scrollTop});for("function"==typeof b.focus&&b.focus(),b=0;b=n?ym(e,t,n):(Bf(cv,1&cv.current),null!==(t=wm(e,t,n))?t.sibling:null);Bf(cv,1&cv.current);break;case 19:if(r=t.childExpirationTime>=n,0!=(64&e.effectTag)){if(r)return _m(e,t,n);t.effectTag|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null),Bf(cv,cv.current),!r)return null}return wm(e,t,n)}im=!1}}else im=!1;switch(t.expirationTime=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,i=Hf(t,Ff.current),kp(t,n),i=wv(null,t,r,e,i,n),t.effectTag|=1,"object"==_(i)&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,Vf(r)){var o=!0;Qf(t)}else o=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,Op(t);var a=r.getDerivedStateFromProps;"function"==typeof a&&Hp(t,r,a,e),i.updater=Vp,t.stateNode=i,i._reactInternalFiber=t,Qp(t,r,e,n),t=dm(null,t,r,!0,o,n)}else t.tag=0,om(null,t,i,n),t=t.child;return t;case 16:e:{if(i=t.elementType,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,function(e){if(-1===e._status){e._status=0;var t=e._ctor;t=t(),e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}}(i),1!==i._status)throw i._result;switch(i=i._result,t.type=i,o=t.tag=function(e){if("function"==typeof e)return ry(e)?1:0;if(null!=e){if((e=e.$$typeof)===Ol)return 11;if(e===jl)return 14}return 2}(i),e=Tp(i,e),o){case 0:t=cm(null,t,i,e,n);break e;case 1:t=hm(null,t,i,e,n);break e;case 11:t=am(null,t,i,e,n);break e;case 14:t=sm(null,t,i,Tp(i.type,e),r,n);break e}throw Error(ku(306,i,""))}return t;case 0:return r=t.type,i=t.pendingProps,cm(e,t,r,i=t.elementType===r?i:Tp(r,i),n);case 1:return r=t.type,i=t.pendingProps,hm(e,t,r,i=t.elementType===r?i:Tp(r,i),n);case 3:if(fm(t),r=t.updateQueue,null===e||null===r)throw Error(ku(282));if(r=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,Rp(e,t),Up(t,r,null,n),(r=t.memoizedState.element)===i)nm(),t=wm(e,t,n);else{if((i=t.stateNode.hydrate)&&(Zv=Zh(t.stateNode.containerInfo.firstChild),Qv=t,i=qv=!0),i)for(n=ev(t,null,r,n),t.child=n;n;)n.effectTag=-3&n.effectTag|1024,n=n.sibling;else om(e,t,r,n),nm();t=t.child}return t;case 5:return uv(t),null===e&&$v(t),r=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,a=i.children,Yh(r,i)?a=null:null!==o&&Yh(r,o)&&(t.effectTag|=16),lm(e,t),4&t.mode&&1!==n&&i.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(om(e,t,a,n),t=t.child),t;case 6:return null===e&&$v(t),null;case 13:return ym(e,t,n);case 4:return av(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=$p(t,null,r,n):om(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,am(e,t,r,i=t.elementType===r?i:Tp(r,i),n);case 7:return om(e,t,t.pendingProps,n),t.child;case 8:case 12:return om(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value;var s=t.type._context;if(Bf(Mp,s._currentValue),s._currentValue=o,null!==a)if(s=a.value,0===(o=df(s,o)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(s,o):1073741823))){if(a.children===i.children&&!zf.current){t=wm(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var u=s.dependencies;if(null!==u){a=s.child;for(var l=u.firstContext;null!==l;){if(l.context===r&&0!=(l.observedBits&o)){1===s.tag&&((l=Lp(n,null)).tag=2,jp(s,l)),s.expirationTime=t&&e<=t}function hy(e,t){var n=e.firstSuspendedTime,r=e.lastSuspendedTime;nt||0===n)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function dy(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var n=e.firstSuspendedTime;0!==n&&(t>=n?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function fy(e,t){var n=e.lastExpiredTime;(0===n||n>t)&&(e.lastExpiredTime=t)}function py(e,t,n,r){var i=t.current,o=Mg(),a=zp.suspense;o=Sg(o,i,a);e:if(n){t:{if(Sc(n=n._reactInternalFiber)!==n||1!==n.tag)throw Error(ku(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break t;case 1:if(Vf(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break t}}s=s.return}while(null!==s);throw Error(ku(171))}if(1===n.tag){var u=n.type;if(Vf(u)){n=Xf(n,u,s);break e}}n=s}else n=Uf;return null===t.context?t.context=n:t.pendingContext=n,(t=Lp(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),jp(i,t),Eg(i,o),o}function vy(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function my(e,t){null!==(e=e.memoizedState)&&null!==e.dehydrated&&e.retryTime=t||n<0||h&&e-l>=o}function m(){var e,n,r=rb();if(v(r))return g(r);s=setTimeout(m,(n=t-((e=r)-u),h?ob(n,o-(e-l)):n))}function g(e){return s=void 0,d&&r?f(e):(r=i=void 0,a)}function y(){var e=rb(),n=v(e);if(r=arguments,i=this,u=e,n){if(void 0===s)return p(u);if(h)return clearTimeout(s),s=setTimeout(m,t),f(u)}return void 0===s&&(s=setTimeout(m,t)),a}return t=nb(t)||0,Jy(n)&&(c=!!n.leading,o=(h="maxWait"in n)?ib(nb(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=u=i=s=void 0},y.flush=function(){return void 0===s?a:g(rb())},y}var sb=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).seeking=!1,r.mobileSeeking=!1,r.track=null,r.hoverTime=null,r.offset=0,r.secondsPrefix="00:00:",r.minutesPrefix="00:",r.seekPause=!1,r.handleTouchSeeking=function(e){for(var t=0,n=0;nthis.state.trackWidth&&(e=this.state.trackWidth-this.hoverTime.offsetWidth))),{transform:"translateX(".concat(e,"px)")}}},{key:"secondsToTime",value:function(e){e=Math.round(e+this.offset);var t=Math.floor(e/3600),n=e%3600,r=Math.floor(n/60),i=Math.ceil(n%60);return{hh:t.toString(),mm:r<10?"0"+r:r.toString(),ss:i<10?"0"+i:i.toString()}}},{key:"getHoverTime",value:function(){var e=100*this.state.seekHoverPosition/this.state.trackWidth,t=Math.floor(+e*(this.props.total/100)),n=this.secondsToTime(t);return this.props.total+this.offset<60?this.secondsPrefix+n.ss:this.props.total+this.offset<3600?this.minutesPrefix+n.mm+":"+n.ss:n.hh+":"+n.mm+":"+n.ss}},{key:"isThumbActive",value:function(){return this.state.seekHoverPosition>0||this.seeking}},{key:"drawHoverTime",value:function(){var e=this;return this.props.hideHoverTime?null:ln.createElement("div",{className:this.isThumbActive()?"hover-time active":"hover-time",style:this.getHoverTimePosition(),ref:function(t){return e.hoverTime=t}},this.getHoverTime())}},{key:"render",value:function(){var e=this;return ln.createElement("div",{className:"seek-slider"},ln.createElement("div",{className:"track",ref:function(t){return e.track=t},onMouseMove:function(t){return e.handleTrackHover(!1,t)},onMouseLeave:function(t){return e.handleTrackHover(!0,t)},onMouseDown:this.onMouseDown,onTouchStart:function(t){e.setMobileSeeking(!0),e.onMouseDown(t)},onMouseUp:this.onMouseUp,onTouchEnd:this.onMouseUp},ln.createElement("div",{className:"main"},this.renderBufferProgress(),this.renderHoverProgress(),this.renderProgress())),this.drawHoverTime(),this.renderThumb())}}]),n}(mt.exports.Component),ub=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).stageVolume=0,r.updateVolumeTimer=0,r.onVolumeSeeking=!1,r.onClickOperationButton=function(){r.props.paused?r.props.play():r.props.pause()},r.operationButton=function(){return r.props.paused?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1LjE0djE0bDExLTdsLTExLTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMTloNFY1aC00TTYgMTloNFY1SDZ2MTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="})},r.operationVolumeButton=function(){return r.props.volume>.9?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg0LTUgNi43djIuMDdjNC0uOTEgNy00LjQ5IDctOC43N2MwLTQuMjgtMy03Ljg2LTctOC43N00xNi41IDEyYzAtMS43Ny0xLTMuMjktMi41LTQuMDNWMTZjMS41LS43MSAyLjUtMi4yNCAyLjUtNE0zIDl2Nmg0bDUgNVY0TDcgOUgzeiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}):0===r.props.volume?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNyA5djZoNGw1IDVWNGwtNSA1SDd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNSA5djZoNGw1IDVWNEw5IDltOS41IDNjMC0xLjc3LTEtMy4yOS0yLjUtNC4wM1YxNmMxLjUtLjcxIDIuNS0yLjI0IDIuNS00eiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="})},r.handleClickVolume=function(){0===r.props.volume?0!==r.stageVolume?r.props.setVolume(r.stageVolume):r.props.setVolume(1):(r.stageVolume=r.props.volume,r.props.setVolume(0))},r.onChange=function(e){r.setState({currentTime:e}),e&&r.changeTime(e)},r.changeTime=ab((function(e){r.props.setCurrentTime(e)}),50),r.onVolumeChange=function(e){r.changeVolume(e),r.setState({seekVolume:e/100})},r.changeVolume=ab((function(e){r.props.setVolume(e/100)}),50),r.onVolumeSeekStart=function(){r.onVolumeSeeking=!0},r.onVolumeSeekEnd=ab((function(){r.onVolumeSeeking=!1}),500),r.onProgressSeekStart=function(){return r.setState({isPlayerSeeking:!0})},r.onProgressSeekEnd=ab((function(){r.setState({isPlayerSeeking:!1})}),500),r.state={isPlayerSeeking:!1,isVolumeHover:!1,seekVolume:1,visible:!0,currentTime:0},r.stageVolume=e.volume,r}return x(n,[{key:"componentDidMount",value:function(){var e=this;this.updateVolumeTimer=setInterval((function(){e.onVolumeSeeking||e.setState({seekVolume:e.props.volume}),e.state.isPlayerSeeking||e.setState({currentTime:e.props.currentTime})}),100)}},{key:"componentWillUnmount",value:function(){this.updateVolumeTimer&&clearInterval(this.updateVolumeTimer)}},{key:"render",value:function(){var e=this,t=this.props,n=t.duration,r=t.currentTime;return ln.createElement("div",{className:"player-controller",style:{opacity:this.props.visible?"1":"0"}},ln.createElement("div",{className:"player-controller-progress"},ln.createElement(sb,{total:n,current:this.state.currentTime,onChange:this.onChange,buffered:this.props.buffered,bufferColor:"rgba(255,255,255,0.3)",hideHoverTime:!0,limitTimeTooltipBySides:!0,onSeekStart:this.onProgressSeekStart,onSeekEnd:this.onProgressSeekEnd,play:this.props.play,pause:this.props.pause,paused:this.props.paused,scale:this.props.scale})),ln.createElement("div",{className:"player-controller-actions"},ln.createElement("div",{className:"player-controller-actions-left"},ln.createElement("div",{onClick:this.onClickOperationButton,className:"player-controller-play"},this.operationButton()),ln.createElement("div",{className:"player-volume-box",onMouseEnter:function(){return e.setState({isVolumeHover:!0})},onMouseLeave:function(){return e.setState({isVolumeHover:!1})}},ln.createElement("div",{onClick:this.handleClickVolume,className:"player-volume"},this.operationVolumeButton()),ln.createElement("div",{className:"player-volume-slider"},ln.createElement(sb,{total:100,current:100*this.state.seekVolume,onChange:this.onVolumeChange,onSeekStart:this.onVolumeSeekStart,onSeekEnd:this.onVolumeSeekEnd,scale:this.props.scale,limitTimeTooltipBySides:!0,hideHoverTime:!0})))),ln.createElement("div",{className:"player-mid-box-time"},lb(Math.floor(r/1e3))," /"," ",lb(Math.floor(n/1e3)))))}}]),n}(mt.exports.Component);function lb(e){var t=e%60,n=(e-t)/60;if(n>=60){var r=n%60;return"".concat(cb((n-r)/60),":").concat(cb(r),":").concat(cb(t))}return"".concat(cb(n),":").concat(cb(t))}function cb(e){return e<=9?"0".concat(e):"".concat(e)}var hb=function(e){s(n,e);var t=u(n);function n(){var e;return y(this,n),(e=t.apply(this,arguments)).putAttributes=function(t){var n=e.props.context,r=n.getAttributes()||{};for(var i in t)r[i]!==t[i]&&n.updateAttributes([i],t[i])},e}return x(n,[{key:"render",value:function(){var e=this.props.context,t=e.getRoom(),n=t?void 0:e.getDisplayer(),r=this.putAttributes;return ln.createElement(db,{room:t,player:n,context:e,plugin:{putAttributes:r}})}}]),n}(mt.exports.Component),db=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).alertMask=null,r.container=ln.createRef(),r.controllerHiddenTimer=0,r.syncPlayerTimer=0,r.retryCount=0,r.decreaseRetryTimer=0,r.noSoundSyncCount=0,r.showController=function(){r.setState({controllerVisible:!0}),r.debounceHidingController()},r.play=function(){var e,t=null==(e=r.props.room)?void 0:e.calibrationTimestamp;r.debug(">>> play",{paused:!1,hostTime:t}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!1,hostTime:t})},r.pause=function(){var e=Ly(r.getAttributes(),r.props);r.debug(">>> pause",{paused:!0,currentTime:e}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!0,currentTime:e})},r.setVolume=function(e){r.debug(">>> volume",{volume:e}),r.isEnabled()&&r.props.plugin.putAttributes({volume:e}),r.isEnabled()&&r.props.plugin.putAttributes({volume:e,muted:0===e})},r.setCurrentTime=function(e){var t,n=null==(t=r.props.room)?void 0:t.calibrationTimestamp;r.debug(">>> seek",{currentTime:e/1e3,hostTime:n}),r.isEnabled()&&r.props.plugin.putAttributes({currentTime:e/1e3,hostTime:n})},r.resetPlayer=function(){var e;null==(e=r.player)||e.autoplay(!1),r.state.NoSound||(r.debug(">>> ended",{paused:!0,currentTime:0}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!0,currentTime:0}))},r.syncPlayerWithAttributes=function(){var e,t=r.getAttributes();if(t){var n=r.player;if(n&&(!r.state.NoSound||(r.noSoundSyncCount+=1)%8==0)){n.paused()!==t.paused&&(r.debug("<<< paused -> %o",t.paused),t.paused?n.pause():null==(e=n.play())||e.catch(r.catchPlayFail)),n.muted()!==t.muted&&(r.debug("<<< muted -> %o",t.muted),n.muted(t.muted)),n.volume()!==t.volume&&(r.debug("<<< volume -> %o",t.volume),n.volume(t.volume));var i=Ly(t,r.props),o=Ry.currentTimeMaxError;r.state.NoSound&&(o*=3),i>n.duration()?r.resetPlayer():Math.abs(n.currentTime()-i)>o&&(r.debug("<<< currentTime -> %o",i),n.currentTime(i))}}},r.debounceHidingController=function(){r.controllerHiddenTimer&&(clearTimeout(r.controllerHiddenTimer),r.controllerHiddenTimer=0),r.controllerHiddenTimer=setTimeout((function(){r.setState({controllerVisible:!1}),r.controllerHiddenTimer=0}),3e3)},r.decreaseRetryCount=function(){r.player&&r.retryCount>0&&(r.retryCount=r.retryCount-1)},r.catchPlayFail=function(e){var t,n,i=String(e);if(jy&&i.includes("NotAllowedError")||i.includes("interact"))null==(t=r.player)||t.autoplay("any"),r.setState({NoSound:!0});else{var o=null==(n=r.player)?void 0:n.error();o&&(r.retryCount<=3?(r.initPlayer(),r.retryCount=r.retryCount+1):(r.debug("catch videojs media error",o),r.setState({MediaError:!0}))),r.debug("catch error",e)}},r.fixPlayFail=function(){r.debug("try to fix play state"),r.setState({NoSound:!1});var e=r.getAttributes(),t=e.muted,n=e.volume;r.player&&(r.player.muted(t),r.player.volume(n))},r.initPlayer=g(regeneratorRuntime.mark((function e(){var t,n,i,o,a,s,u,l,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null==(t=r.player)||t.dispose(),r.player=void 0,r.debug("creating elements ..."),n=r.getAttributes(),i=n.type,o=n.src,a=n.poster,(s=document.createElement("div")).setAttribute("data-vjs-player",""),(u=document.createElement("video")).className="video-js",a&&(u.poster=a),u.setAttribute("playsInline",""),u.setAttribute("webkit-playsinline",""),l=document.createElement("source"),new URL(o).pathname.endsWith(".m3u8")?l.type="application/x-mpegURL":u.src=o,l.src=o,i&&(l.type=i),u.appendChild(l),s.appendChild(u),r.container.current.appendChild(s),e.next=14,new Promise((function(e){return(window.requestAnimationFrame||window.setTimeout)(e)}));case 14:r.debug("initializing videojs() ..."),c=Z.default(u),r.player=c,window.player=c,c.one("loadedmetadata",r.gracefullyUpdate),c.on("ready",(function(){var e;null==(e=Ry.onPlayer)||e.call(Ry,c),c.on("timeupdate",r.gracefullyUpdate),c.on("volumechange",r.gracefullyUpdate),c.on("seeked",r.gracefullyUpdate),c.on("play",r.gracefullyUpdate),c.on("pause",r.gracefullyUpdate),c.on("ended",r.resetPlayer)})),c.on("error",r.catchPlayFail),r.setState({MediaError:!1});case 17:case"end":return e.stop()}}),e)}))),r.gracefullyUpdate=function(){return r.setState({updater:!r.state.updater})},r.setupAlert=function(e){e&&(e.addEventListener("touchstart",r.fixPlayFail),e.addEventListener("click",r.fixPlayFail)),r.alertMask=e},r.setupReload=function(e){e&&(e.addEventListener("touchstart",r.initPlayer),e.addEventListener("click",r.initPlayer))},r.state={NoSound:!1,MediaError:!1,updater:!1,controllerVisible:!1},e.room&&function(e){if(!e.calibrationTimestamp)throw new Error("@netless/app-media-player@0.1.0-alpha.5 requires white-web-sdk@^2.13.8 to work properly.")}(e.room),r}return x(n,[{key:"getAttributes",value:function(){var e=this.props.context.getAttributes();if(e){if(e=Dy(Dy({},Py),e),this.player){var t=Ly(e,this.props),n=this.player.duration();!e.paused&&t>n&&(r=Dy({},e),e=Ey(r,Ay({currentTime:0,paused:!0})),this.resetPlayer())}var r;return e}}},{key:"isShowingPoster",value:function(){var e=this.getAttributes();return!(null!=e&&e.src)||By.some((function(t){return e.src.endsWith(t)}))}},{key:"render",value:function(){var e,t;if(!this.props.room&&!this.props.player)return null;var n=this.getAttributes();if(!n)return null;var r=1e3*((null==(e=this.player)?void 0:e.duration())||1e3),i=(null==(t=this.player)?void 0:t.bufferedPercent())||0;return ln.createElement("div",{className:this.isEnabled()?"vjs-p":"vjs-p disabled",onMouseEnter:this.showController,onMouseMove:this.showController},ln.createElement("div",{className:"video-js-plugin-player",ref:this.container}),this.isShowingPoster()&&ln.createElement("div",{className:"video-js-plugin-poster"},n.poster&&ln.createElement("img",{src:n.poster,alt:"",draggable:!1})),ln.createElement(ub,{duration:r,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*Ly(n,this.props),setCurrentTime:this.setCurrentTime,buffered:r*i,visible:!0}),this.state.NoSound&&ln.createElement("div",{ref:this.setupAlert,className:"videojs-plugin-muted-alert"}),this.state.MediaError&&ln.createElement("div",{className:"videojs-plugin-recovery-mode"},ln.createElement("button",{ref:this.setupReload},"Reload Player")))}},{key:"debug",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:B.AnimationMode.Immediately;if(this.inDisplaySceneDir){var t=this.attributes,n=t.width,r=void 0===n?1280:n,i=t.height,o=void 0===i?720:i,a=r?-r/2:0,s=o?-o/2:0;this.manager.moveCameraToContain({originX:a,originY:s,width:r,height:o,animationMode:e})}}},{key:"handleSetPage",value:function(e){if(!this.isReplay&&this.attributes.displaySceneDir){var t=e.payload,n=this.displayer,r=n.entireScenes()[this.attributes.displaySceneDir];if(!r||r.length!==t){var i=function(e,t){return new Array(e).fill(0).map((function(e,n){return t(n)}))}(t,(function(e){return{name:String(e+1)}}));n.putScenes(this.attributes.displaySceneDir,i),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}}},{key:"listenIframe",value:function(t){var n=this;t.url&&this.iframe.src!==t.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=t.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=t.url)),this.iframe.width="".concat(t.width,"px"),this.iframe.height="".concat(t.height,"px"),this.sideEffectManager.addEventListener(this.iframe,"load",(function(t){var r;n.postMessage({kind:"Init",payload:{attributes:n.attributes,roomState:null==(r=e.displayer)?void 0:r.state,currentPage:n.currentPage,observerId:n.displayer.observerId}}),e.emitter.emit("IframeLoad",t),n.sideEffectManager.addDisposer(e.emitter.on("Ready",(function(){var e;n.postMessage(null==(e=n.attributes.lastEvent)?void 0:e.payload)})),gb),n.computedStyleAndIframeDisplay()}),void 0,_b)}},{key:"listenDisplayerState",value:function(){var e=this;this.isReplay&&(this.displayer._phase===B.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add((function(){return e.displayer.callbacks.on("onPhaseChanged",e.onPhaseChangedListener),function(){return e.displayer.callbacks.off("onPhaseChanged",e.onPhaseChangedListener)}}),wb)),this.computedStyleAndIframeDisplay()}},{key:"computedStyleAndIframeDisplay",value:function(){this.computedStyle(this.displayer.state),this.computedIframeDisplay(this.displayer.state,this.attributes)}},{key:"listenDisplayerCallbacks",value:function(){this.displayer.callbacks.on(this.callbackName,this.stateChangeListener)}},{key:"computedStyle",value:function(e){var t=this.manager.cameraState,n=this.attributes.width||1280,r=this.attributes.height||720;if(this.iframe){var i=t.width,o=t.height,a=t.scale,s=t.centerX,u=t.centerY,l=this.rootRect||{x:0,y:0},c="".concat(i/2+l.x,"px"),h="".concat(o/2+l.y,"px"),d=-u*a+(o-r)/2*a,f=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;","transform-origin: ".concat(c," ").concat(h,";"),"transform: translate(".concat(-s*a+(i-n)/2*a,"px,").concat(d,"px) scale(").concat(a,", ").concat(a,");")];this.cssList=f,this.computedZindex(),this.updateStyle()}}},{key:"computedIframeDisplay",value:function(t,n){this.inDisplaySceneDir?e.emitter.emit("DispayIframe"):e.emitter.emit("HideIframe")}},{key:"computedZindex",value:function(){var e="z-index: -1;",t=this.cssList.findIndex((function(t){return t===e}));-1!==t&&this.cssList.splice(t,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(e)}},{key:"updateStyle",value:function(){this.iframe.style.cssText=this.cssList.join(" ")}},{key:"messageListener",value:function(e){if(tt("<<<",JSON.stringify(e.data)),e.origin===this.iframeOrigin){var t=e.data;switch(t.kind){case"SetAttributes":this.handleSetAttributes(t);break;case"RegisterMagixEvent":this.handleRegisterMagixEvent(t);break;case"RemoveMagixEvent":this.handleRemoveMagixEvent(t);break;case"DispatchMagixEvent":this.handleDispatchMagixEvent(t);break;case"RemoveAllMagixEvent":this.handleRemoveAllMagixEvent();break;case"NextPage":this.handleNextPage();break;case"PrevPage":this.handlePrevPage();break;case"SDKCreate":this.handleSDKCreate();break;case"SetPage":this.handleSetPage(t);break;case"GetAttributes":this.handleGetAttributes();break;case"PageTo":this.handlePageTo(t);break;default:tt("".concat(t.kind," not allow event."))}}}},{key:"handleSDKCreate",value:function(){this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:this.displayer.state,currentPage:this.currentPage,observerId:this.displayer.observerId}})}},{key:"handleDispatchMagixEvent",value:function(e){var t=e.payload;this.appManager.safeDispatchMagixEvent(t.event,t.payload)}},{key:"handleSetAttributes",value:function(e){this.setAttributes(e.payload)}},{key:"handleRegisterMagixEvent",value:function(e){var t=this,n=e.payload,r=function(e){e.authorId!==t.displayer.observerId&&t.postMessage({kind:"ReciveMagixEvent",payload:e})};this.magixEventMap.set(n,r),this.displayer.addMagixEventListener(n,r)}},{key:"handleRemoveMagixEvent",value:function(e){var t=e.payload,n=this.magixEventMap.get(t);this.displayer.removeMagixEventListener(t,n)}},{key:"handleNextPage",value:function(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}},{key:"handlePrevPage",value:function(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}},{key:"handlePageTo",value:function(e){if(this.manager.canOperate){var t=e.payload;if(!Number.isSafeInteger(t)||t<=0)return;this.manager.setMainViewSceneIndex(t-1),this.dispatchMagixEvent("PageTo",t-1)}}},{key:"handleRemoveAllMagixEvent",value:function(){var e=this;this.magixEventMap.forEach((function(t,n){e.displayer.removeMagixEventListener(n,t)})),this.magixEventMap.clear()}},{key:"handleGetAttributes",value:function(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}},{key:"postMessage",value:function(e){var t;this.iframe&&(null==(t=this.iframe.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),"*"))}},{key:"dispatchMagixEvent",value:function(e,t){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:e,payload:t}}),this.displayer.dispatchMagixEvent(e,t))}},{key:"isClicker",value:function(){if(this.readonly)return!1;var e=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(e)}},{key:"attributes",get:function(){return this.appManager.store.getIframeBridge()}},{key:"isReplay",get:function(){return this.manager.isReplay}},{key:"callbackName",get:function(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}},{key:"iframeOrigin",get:function(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(e){console.warn(e)}}},{key:"currentIndex",get:function(){return this.manager.mainViewSceneIndex}},{key:"currentPage",get:function(){return this.currentIndex+1}},{key:"totalPage",get:function(){return this.manager.mainViewScenesLength}},{key:"readonly",get:function(){return!this.displayer.isWritable}},{key:"inDisplaySceneDir",get:function(){return this.manager.mainViewSceneDir===this.attributes.displaySceneDir}},{key:"isDisableInput",get:function(){return!("disableDeviceInputs"in this.displayer)||this.displayer.disableDeviceInputs}}],[{key:"onCreate",value:function(t){e.emitter.emit("StartCreate"),e.emitter.emit("OnCreate",t),e.emitter.emit("created")}}]),e}(),Eb=Sb;Eb.kind="IframeBridge",Eb.hiddenClass="netless-iframe-brdige-hidden",Eb.emitter=new Q.default,Eb.displayer=null,Eb.alreadyCreate=!1;var Ab=new xo({emitter:ue}),Ib=function(e){s(b,e);var t,n,r,i,o,a,l,c,h,d,f,p,v,m=u(b);function b(e){var t;return y(this,b),(t=m.call(this,e)).version="0.4.65",t.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.2.27",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^0.1.5",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.16","@netless/app-media-player":"0.1.0-beta.5","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",jspdf:"^2.5.1",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3",vitest:"^0.14.1","white-web-sdk":"2.16.43"}},t.emitter=ae,t.viewMode=B.ViewMode.Broadcaster,t.isReplay=B.isPlayer(t.displayer),t.containerSizeRatio=b.containerSizeRatio,b.displayer=e.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.2.27",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^0.1.5",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.16","@netless/app-media-player":"0.1.0-beta.5","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",jspdf:"^2.5.1",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3",vitest:"^0.14.1","white-web-sdk":"2.16.43"}},t}return x(b,[{key:"bindContainer",value:function(e){var t,n,r,i,o,a;if(B.isRoom(this.displayer)&&this.room.phase!==B.RoomPhase.Connected)throw new Ge;if(b.isCreated&&b.container)b.container.firstChild&&e.appendChild(b.container.firstChild);else if(b.params){var s=b.params,u=b.initContainer(this,e,s);this.boxManager&&this.boxManager.destroy();var l=function(e,t,n,r,i){return new Ii({safeSetAttributes:function(t){return e.safeSetAttributes(t)},getMainView:function(){return e.mainView},updateAppState:function(){var t,n;return null==(n=e.appManager)?void 0:(t=n.store).updateAppState.apply(t,arguments)},canOperate:function(){return e.canOperate},notifyContainerRectUpdate:function(t){var n;return null==(n=e.appManager)?void 0:n.notifyContainerRectUpdate(t)},cleanFocus:function(){var t;return null==(t=e.appManager)?void 0:t.store.cleanFocus()},setAppFocus:function(t){var n;return null==(n=e.appManager)?void 0:n.store.setAppFocus(t,!0)},callbacks:t,emitter:n,boxEmitter:r},i)}(this,ae,ue,rt,{collectorContainer:s.collectorContainer,collectorStyles:s.collectorStyles,prefersColorScheme:s.prefersColorScheme});this.boxManager=l,null==(t=this.appManager)||t.setBoxManager(l),this.bindMainView(u,s.disableCameraTransform),b.wrapper&&(null==(n=this.cursorManager)||n.setupWrapper(b.wrapper))}ue.emit("updateManagerRect"),null==(r=this.appManager)||r.refresh(),null==(i=this.appManager)||i.resetMaximized(),null==(o=this.appManager)||o.resetMinimized(),null==(a=this.appManager)||a.displayerWritableListener(!this.room.isWritable),b.container=e}},{key:"bindCollectorContainer",value:function(e){b.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(e):b.params&&(b.params.collectorContainer=e)}},{key:"addApp",value:(v=g(regeneratorRuntime.mark((function e(t){var n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=2;break}return e.abrupt("return",this.appManager.rootDirRemoving?new Promise((function(e,r){ue.once("rootDirRemoved").then(g(regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,n._addApp(t);case 3:o=i.sent,e(o),i.next=10;break;case 7:i.prev=7,i.t0=i.catch(0),r(i.t0.message);case 10:case"end":return i.stop()}}),i,null,[[0,7]])}))))})):this._addApp(t));case 2:throw new Le;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"_addApp",value:(p=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=20;break}if(t.kind&&"string"==typeof t.kind){e.next=3;break}throw new Be;case 3:return e.next=5,null==(n=xe.appClasses.get(t.kind))?void 0:n();case 5:if(!((o=e.sent)&&(null==(r=o.config)?void 0:r.singleton)&&this.appManager.appProxies.has(t.kind))){e.next=8;break}throw new Oe;case 8:if(void 0!==(a=this.setupScenePath(t,this.appManager))){e.next=13;break}e.t0=void 0,e.next=17;break;case 13:return null!=(i=null==t?void 0:t.options)&&i.scenePath&&(t.options.scenePath=Ce(t.options.scenePath)),e.next=16,this.appManager.addApp(t,Boolean(a));case 16:e.t0=e.sent;case 17:return e.abrupt("return",e.t0);case 20:throw new Le;case 21:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"setupScenePath",value:function(e,t){var n=!1;if(e.options){var r=e.options,i=r.scenePath,o=r.scenes;if(i){if(!function(e){return e.startsWith("/")}(i))throw new Fe;for(var a=0,s=Object.keys(this.apps||{});a0&&(this.isDynamicPPT(o)?(n=!0,Ee(this.displayer)[i]||Ae(this.room,i,o)):Ee(this.displayer)[i]||Ae(this.room,i,[{name:o[0].name}])),i&&void 0===o&&Ae(this.room,i,[{}])}return n}},{key:"setMainViewScenePath",value:(f=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.appManager,!e.t0){e.next=4;break}return e.next=4,this.appManager.setMainViewScenePath(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"setMainViewSceneIndex",value:(d=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.appManager,!e.t0){e.next=4;break}return e.next=4,this.appManager.setMainViewSceneIndex(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"nextPage",value:(h=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=12;break}if(!((t=this.mainViewSceneIndex+1)>=this.mainViewScenesLength)){e.next=6;break}e.t0=(console.warn("[WindowManager]: current page is the last page"),!1),e.next=9;break;case 6:return e.next=8,this.appManager.setMainViewSceneIndex(t);case 8:e.t0=!0;case 9:return e.abrupt("return",e.t0);case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"prevPage",value:(c=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=12;break}if(!((t=this.mainViewSceneIndex-1)<0)){e.next=6;break}e.t0=(console.warn("[WindowManager]: current page is the first page"),!1),e.next=9;break;case 6:return e.next=8,this.appManager.setMainViewSceneIndex(t);case 8:e.t0=!0;case 9:return e.abrupt("return",e.t0);case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"jumpPage",value:(l=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=11;break}if(!(t<0||t>=this.pageState.length)){e.next=5;break}e.t1=(console.warn("[WindowManager]: index ".concat(t," out of range")),!1),e.next=8;break;case 5:return e.next=7,this.appManager.setMainViewSceneIndex(t);case 7:e.t1=!0;case 8:e.t0=e.t1,e.next=12;break;case 11:e.t0=!1;case 12:return e.abrupt("return",e.t0);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"addPage",value:(a=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appManager&&(n=null==t?void 0:t.after,r=null==t?void 0:t.scene,n?(i=this.mainViewSceneIndex+1,this.room.putScenes(ie,[r||{}],i)):this.room.putScenes(ie,[r||{}]));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"removePage",value:(o=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=5;break}return n=void 0===t?this.pageState.index:t,e.abrupt("return",1===this.pageState.length?(console.warn("[WindowManager]: can not remove the last page"),!1):n<0||n>=this.pageState.length?(console.warn("[WindowManager]: index ".concat(t," out of range")),!1):this.appManager.removeSceneByIndex(n));case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getMainViewScenePath",value:function(){var e;return null==(e=this.appManager)?void 0:e.store.getMainViewScenePath()}},{key:"getMainViewSceneIndex",value:function(){var e;return null==(e=this.appManager)?void 0:e.store.getMainViewSceneIndex()}},{key:"setReadonly",value:function(e){var t;this.readonly=e,null==(t=this.boxManager)||t.setReadonly(e),ue.emit("setReadonly",e)}},{key:"switchMainViewToWriter",value:function(){var e;return null==(e=this.appManager)?void 0:e.mainViewProxy.mainViewClickHandler()}},{key:"onAppDestroy",value:function(e,t){!function(e,t){ue.once(e).then(t)}("destroy-".concat(e),t)}},{key:"setViewMode",value:function(e){var t,n,r,i;(e===B.ViewMode.Broadcaster||e===B.ViewMode.Follower)&&(this.canOperate&&e===B.ViewMode.Broadcaster&&(null==(t=this.appManager)||t.mainViewProxy.setCameraAndSize()),null==(n=this.appManager)||n.mainViewProxy.start()),e===B.ViewMode.Freedom&&(null==(r=this.appManager)||r.mainViewProxy.stop()),this.viewMode=e,null==(i=this.appManager)||i.mainViewProxy.setViewMode(e)}},{key:"setBoxState",value:function(e){if(this.canOperate)switch(e){case"normal":this.setMaximized(!1),this.setMinimized(!1);break;case"maximized":this.setMaximized(!0),this.setMinimized(!1);break;case"minimized":this.setMinimized(!0)}}},{key:"setMaximized",value:function(e){var t;!this.canOperate||null==(t=this.boxManager)||t.setMaximized(e,!1)}},{key:"setMinimized",value:function(e){var t;!this.canOperate||null==(t=this.boxManager)||t.setMinimized(e,!1)}},{key:"setFullscreen",value:function(e){var t;this._fullscreen!==e&&(this._fullscreen=e,null==(t=b.sizer)||t.classList.toggle("netless-window-manager-fullscreen",e),ae.emit("fullscreenChange",e))}},{key:"queryAll",value:function(){var e;return Array.from((null==(e=this.appManager)?void 0:e.appProxies.values())||[])}},{key:"queryOne",value:function(e){var t;return null==(t=this.appManager)?void 0:t.appProxies.get(e)}},{key:"closeApp",value:(i=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null==(n=this.appManager)?void 0:n.closeApp(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"focusApp",value:function(e){var t,n,r,i=null==(t=this.boxManager)?void 0:t.getBox(e);i&&(null==(n=this.boxManager)||n.focusBox({appId:e},!1),(null==(r=this.boxManager)?void 0:r.teleBoxManager).makeBoxTop(i,!1))}},{key:"moveCamera",value:function(e){var t,n=this,r=j.omit(e,["animationMode"]),i=P({},this.mainView.camera);j.isEqual(P(P({},i),r),i)||(this.mainView.moveCamera(e),null==(t=this.appManager)||t.dispatchInternalEvent(q.MoveCamera,e),setTimeout((function(){var e;null==(e=n.appManager)||e.mainViewProxy.setCameraAndSize()}),500))}},{key:"moveCameraToContain",value:function(e){var t,n=this;this.mainView.moveCameraToContain(e),null==(t=this.appManager)||t.dispatchInternalEvent(q.MoveCameraToContain,e),setTimeout((function(){var e;null==(e=n.appManager)||e.mainViewProxy.setCameraAndSize()}),500)}},{key:"convertToPointInWorld",value:function(e){return this.mainView.convertToPointInWorld(e)}},{key:"setCameraBound",value:function(e){this.mainView.setCameraBound(e)}},{key:"onDestroy",value:function(){this._destroy()}},{key:"destroy",value:function(){this._destroy()}},{key:"_destroy",value:function(){var e,t,n,r,i;null==(e=this.containerResizeObserver)||e.disconnect(),null==(t=this.appManager)||t.destroy(),null==(n=this.cursorManager)||n.destroy(),b.container=void 0,b.wrapper=void 0,b.sizer=void 0,b.isCreated=!1,b.playground&&(null==(r=b.playground.parentNode)||r.removeChild(b.playground)),b.params=void 0,null==(i=this._iframeBridge)||i.destroy(),this._iframeBridge=void 0,tt("Destroyed")}},{key:"bindMainView",value:function(e,t){var n;this.appManager&&(this.appManager.bindMainView(e,Boolean(t)),null==(n=this.cursorManager)||n.setMainViewDivElement(e))}},{key:"safeSetAttributes",value:function(e){this.canOperate&&this.setAttributes(e)}},{key:"safeUpdateAttributes",value:function(e,t){this.canOperate&&this.updateAttributes(e,t)}},{key:"setPrefersColorScheme",value:function(e){var t,n;null==(n=null==(t=this.appManager)?void 0:t.boxManager)||n.setPrefersColorScheme(e)}},{key:"cleanCurrentScene",value:function(){var e;tt("clean current scene"),null==(e=this.focusedView)||e.cleanCurrentScene()}},{key:"redo",value:function(){var e;return(null==(e=this.focusedView)?void 0:e.redo())||0}},{key:"undo",value:function(){var e;return(null==(e=this.focusedView)?void 0:e.undo())||0}},{key:"delete",value:function(){var e;null==(e=this.focusedView)||e.delete()}},{key:"copy",value:function(){var e;null==(e=this.focusedView)||e.copy()}},{key:"paste",value:function(){var e;null==(e=this.focusedView)||e.paste()}},{key:"duplicate",value:function(){var e;null==(e=this.focusedView)||e.duplicate()}},{key:"insertText",value:function(e,t,n){var r;return(null==(r=this.focusedView)?void 0:r.insertText(e,t,n))||""}},{key:"insertImage",value:function(e){var t;return null==(t=this.focusedView)?void 0:t.insertImage(e)}},{key:"completeImageUpload",value:function(e,t){var n;return null==(n=this.focusedView)?void 0:n.completeImageUpload(e,t)}},{key:"lockImage",value:function(e,t){var n;return null==(n=this.focusedView)?void 0:n.lockImage(e,t)}},{key:"lockImages",value:function(e){var t;return null==(t=this.focusedView)?void 0:t.lockImages(e)}},{key:"refresh",value:function(){var e;this._refresh(),null==(e=this.appManager)||e.dispatchInternalEvent(q.Refresh)}},{key:"_refresh",value:function(){var e,t,n;null==(e=this.appManager)||e.mainViewProxy.rebind(),b.container&&this.bindContainer(b.container),null==(n=null==(t=this.appManager)?void 0:t.refresher)||n.refresh()}},{key:"setContainerSizeRatio",value:function(e){if(!(j.isNumber(e)&&e>0))throw new Error("[WindowManager]: updateContainerSizeRatio error, ratio must be a positive number. but got ".concat(e));b.containerSizeRatio=e,this.containerSizeRatio=e,ue.emit("containerSizeRatioUpdate",e)}},{key:"isDynamicPPT",value:function(e){var t,n,r=null==(n=null==(t=e[0])?void 0:t.ppt)?void 0:n.src;return null==r?void 0:r.startsWith("pptx://")}},{key:"ensureAttributes",value:(r=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=j.isNull(this.attributes),!e.t0){e.next=4;break}return e.next=4,ke(50);case 4:j.isObject(this.attributes)&&(this.attributes[$e.Apps]||this.safeSetAttributes(w({},$e.Apps,{})),this.attributes[$e.Cursors]||this.safeSetAttributes(w({},$e.Cursors,{})),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:oe}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[$e.Registered]||this.safeSetAttributes(w({},$e.Registered,{})),this.attributes[$e.IframeBridge]||this.safeSetAttributes(w({},$e.IframeBridge,{})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getIframeBridge",value:function(){if(!this.appManager)throw new Error("[WindowManager]: should call getIframeBridge() after await mount()");return this._iframeBridge||(this._iframeBridge=new Eb(this,this.appManager)),this._iframeBridge}},{key:"mainView",get:function(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new Le}},{key:"camera",get:function(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new Le}},{key:"cameraState",get:function(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new Le}},{key:"apps",get:function(){var e;return null==(e=this.appManager)?void 0:e.store.apps()}},{key:"boxState",get:function(){var e;if(this.appManager)return null==(e=this.appManager.boxManager)?void 0:e.boxState;throw new Le}},{key:"darkMode",get:function(){var e,t;return Boolean(null==(t=null==(e=this.appManager)?void 0:e.boxManager)?void 0:t.darkMode)}},{key:"prefersColorScheme",get:function(){var e;if(this.appManager)return null==(e=this.appManager.boxManager)?void 0:e.prefersColorScheme;throw new Le}},{key:"focused",get:function(){return this.attributes.focus}},{key:"focusedView",get:function(){var e,t;return(null==(t=null==(e=this.appManager)?void 0:e.focusApp)?void 0:t.view)||this.mainView}},{key:"mainViewSceneIndex",get:function(){var e;return(null==(e=this._pageState)?void 0:e.index)||0}},{key:"mainViewSceneDir",get:function(){var e;if(this.appManager)return null==(e=this.appManager)?void 0:e.getMainViewSceneDir();throw new Le}},{key:"topApp",get:function(){var e,t;return null==(t=null==(e=this.boxManager)?void 0:e.getTopBox())?void 0:t.id}},{key:"mainViewScenesLength",get:function(){var e;return(null==(e=this._pageState)?void 0:e.length)||0}},{key:"canRedoSteps",get:function(){var e;return(null==(e=this.focusedView)?void 0:e.canRedoSteps)||0}},{key:"canUndoSteps",get:function(){var e;return(null==(e=this.focusedView)?void 0:e.canUndoSteps)||0}},{key:"sceneState",get:function(){if(this.appManager)return this.appManager.sceneState;throw new Le}},{key:"pageState",get:function(){if(this._pageState)return this._pageState.toObject();throw new Le}},{key:"fullscreen",get:function(){return Boolean(this._fullscreen)}},{key:"canOperate",get:function(){return!!B.isRoom(this.displayer)&&(this.displayer.isWritable&&this.displayer.phase===B.RoomPhase.Connected)}},{key:"room",get:function(){return this.displayer}}],[{key:"mount",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.room,b.container=t.container,r=t.containerSizeRatio,i=t.debug,o=t.cursor,b.params=t,b.displayer=t.room,ht(),!B.isRoom(n)){e.next=11;break}if(n.phase===B.RoomPhase.Connected){e.next=7;break}throw new Error("[WindowManager]: Room only Connected can be mount");case 7:return n.phase===B.RoomPhase.Connected&&n.isWritable&&(n.disableSerialization=!1),e.next=10,this.initManager(n);case 10:a=e.sent;case 11:if(!b.isCreated){e.next=13;break}throw new Error("[WindowManager]: Already created cannot be created again");case 13:if(this.debug=Boolean(i),tt("Already insert room",a),!B.isRoom(this.displayer)){e.next=18;break}if(a){e.next=16;break}throw new Error("[WindowManager]: init InvisiblePlugin failed");case 16:e.next=20;break;case 18:return e.next=20,X.default(function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getInvisiblePlugin(b.kind);case 2:if(a=e.sent){e.next=5;break}throw tt("manager is empty. retrying ".concat(t)),new Error;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),{retries:10,maxTimeout:5e3});case 20:if(a){e.next=22;break}throw new Error("[WindowManager]: create manager failed");case 22:return r&&(b.containerSizeRatio=r),e.next=25,a.ensureAttributes();case 25:return a._fullscreen=t.fullscreen,a.appManager=new ct(a),a._pageState=new bo(a.appManager),a.cursorManager=new yo(a.appManager,Boolean(o),t.applianceIcons),r&&(a.containerSizeRatio=r),t.container&&a.bindContainer(t.container),_o(n,a),ue.emit("onCreated"),b.isCreated=!0,e.prev=34,e.next=37,le();case 37:e.next=42;break;case 39:e.prev=39,e.t0=e.catch(34),console.warn("[WindowManager]: indexedDB open failed"),console.log(e.t0);case 42:return e.abrupt("return",a);case 43:case"end":return e.stop()}}),e,this,[[34,39]])}))),function(e){return n.apply(this,arguments)})},{key:"initManager",value:(t=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.getInvisiblePlugin(b.kind))||!B.isRoom(t)){e.next=24;break}if(!1!==t.isWritable){e.next=21;break}return e.prev=3,e.next=6,t.setWritable(!0);case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),new Error("[WindowManger]: room must be switched to be writable");case 11:return e.next=13,ft(t);case 13:return null==(n=e.sent)||n.ensureAttributes(),e.next=17,ke(500);case 17:return e.next=19,t.setWritable(!1);case 19:e.next=24;break;case 21:return e.next=23,ft(t);case 23:n=e.sent;case 24:return e.abrupt("return",n);case 25:case"end":return e.stop()}}),e,null,[[3,8]])}))),function(e){return t.apply(this,arguments)})},{key:"initContainer",value:function(e,t,n){var r=n.chessboard,i=n.overwriteStyles,o=n.fullscreen;b.container||(b.container=t);var a=function(e){var t=document.createElement("div");t.className="netless-window-manager-playground";var n=document.createElement("div");n.className="netless-window-manager-sizer";var r=document.createElement("div");r.className="netless-window-manager-wrapper";var i=document.createElement("div");return i.className="netless-window-manager-main-view",t.appendChild(n),n.appendChild(r),r.appendChild(i),e.appendChild(t),Cb.wrapper=r,{playground:t,wrapper:r,sizer:n,mainViewElement:i}}(t),s=a.playground,u=a.wrapper,l=a.sizer,c=a.mainViewElement;if(b.playground=s,r&&l.classList.add("netless-window-manager-chess-sizer"),o&&l.classList.add("netless-window-manager-fullscreen"),i){var h=document.createElement("style");h.textContent=i,s.appendChild(h)}return e.containerResizeObserver=vt.create(s,l,u,ue),b.wrapper=u,b.sizer=l,c}},{key:"register",value:function(e){return xe.register(e)}},{key:"unregister",value:function(e){return xe.unregister(e)}},{key:"registered",get:function(){return xe.registered}}]),b}(B.InvisiblePlugin),Cb=Ib;Cb.kind="WindowManager",Cb.debug=!1,Cb.containerSizeRatio=9/16,Cb.isCreated=!1,Cb.debug&&function(e){Ry=Dy(Dy({},Oy),e)}({verbose:!0}),Cb.register({kind:Tu.kind,src:Tu}),Cb.register({kind:fb.kind,src:fb}),t.AppCreateError=Oe,t.AppManagerNotInitError=Le,t.AppNotRegisterError=Re,t.BindContainerRoomPhaseInvalidError=Ge,t.BoxManagerNotFoundError=ze,t.BoxNotCreatedError=Ue,t.BuiltinApps=pb,t.DomEvents=mb,t.IframeBridge=Eb,t.IframeEvents=vb,t.InvalidScenePath=Fe,t.ParamsInvalidError=Be,t.WhiteWebSDKInvalidError=je,t.WindowManager=Cb,t.calculateNextIndex=nt,t.reconnectRefresher=Ab},6513:function(e,t,n){var r=n(49766).Buffer;function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}Object.defineProperty(t,"__esModule",{value:!0}),t.xml2json=t.xml2js=t.json2xml=t.js2xml=void 0;var a=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},s=[],u=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,c=!1;function h(){c=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}function f(e){var t;c||h();for(var n=e.length,r=n%3,i="",o=[],a=16383,u=0,l=n-r;ul?l:u+a));return 1===r?(t=e[n-1],i+=s[t>>2],i+=s[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=s[t>>10],i+=s[t>>4&63],i+=s[t<<2&63],i+="="),o.push(i),o.join("")}function p(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,c=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+h],h+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+h],h+=d,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=l}return(f?-1:1)*a*Math.pow(2,o-r)}function v(e,t,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;e[n+f]=255&a,f+=p,a/=256,l-=8);e[n+f-p]|=128*v}var m={}.toString,g=Array.isArray||function(e){return"[object Array]"==m.call(e)};function y(){return x.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function b(e,t){if(y()=y())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y().toString(16)+" bytes");return 0|e}function E(e){return!(null==e||!e._isBuffer)}function A(e,t){if(E(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ee(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return te(e).length;default:if(r)return ee(e).length;t=(""+t).toLowerCase(),r=!0}}function I(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return H(this,t,n);case"utf8":case"utf-8":return U(this,t,n);case"ascii":return z(this,t,n);case"latin1":case"binary":return G(this,t,n);case"base64":return B(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function C(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function N(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=x.from(t,r)),E(t))return 0===t.length?-1:k(e,t,n,r,i);if("number"==typeof t)return t&=255,x.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function k(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function B(e,t,n){return 0===t&&n===e.length?f(e):f(e.slice(t,n))}function U(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(e){var t=e.length;if(t<=F)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},x.prototype.compare=function(e,t,n,r,i){if(!E(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n),c=0;ci)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return D(this,e,t,n);case"utf8":case"utf-8":return P(this,e,t,n);case"ascii":return O(this,e,t,n);case"latin1":case"binary":return R(this,e,t,n);case"base64":return L(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},x.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var F=4096;function z(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function Y(e,t,n,r,i,o){if(!E(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function X(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function Q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function Z(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function q(e,t,n,r,i){return i||Z(e,0,n,4),v(e,t,n,r,23,4),n+4}function J(e,t,n,r,i){return i||Z(e,0,n,8),v(e,t,n,r,52,8),n+8}x.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},x.prototype.readUInt8=function(e,t){return t||W(e,1,this.length),this[e]},x.prototype.readUInt16LE=function(e,t){return t||W(e,2,this.length),this[e]|this[e+1]<<8},x.prototype.readUInt16BE=function(e,t){return t||W(e,2,this.length),this[e]<<8|this[e+1]},x.prototype.readUInt32LE=function(e,t){return t||W(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},x.prototype.readUInt32BE=function(e,t){return t||W(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},x.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||W(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},x.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||W(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},x.prototype.readInt8=function(e,t){return t||W(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},x.prototype.readInt16LE=function(e,t){t||W(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},x.prototype.readInt16BE=function(e,t){t||W(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},x.prototype.readInt32LE=function(e,t){return t||W(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},x.prototype.readInt32BE=function(e,t){return t||W(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},x.prototype.readFloatLE=function(e,t){return t||W(e,4,this.length),p(this,e,!0,23,4)},x.prototype.readFloatBE=function(e,t){return t||W(e,4,this.length),p(this,e,!1,23,4)},x.prototype.readDoubleLE=function(e,t){return t||W(e,8,this.length),p(this,e,!0,52,8)},x.prototype.readDoubleBE=function(e,t){return t||W(e,8,this.length),p(this,e,!1,52,8)},x.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||Y(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},x.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,1,255,0),x.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},x.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,65535,0),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},x.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,65535,0),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},x.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,4294967295,0),x.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Q(this,e,t,!0),t+4},x.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,4294967295,0),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Q(this,e,t,!1),t+4},x.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Y(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},x.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Y(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},x.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,1,127,-128),x.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},x.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,32767,-32768),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},x.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,32767,-32768),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},x.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,2147483647,-2147483648),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Q(this,e,t,!0),t+4},x.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Q(this,e,t,!1),t+4},x.prototype.writeFloatLE=function(e,t,n){return q(this,e,t,!0,n)},x.prototype.writeFloatBE=function(e,t,n){return q(this,e,t,!1,n)},x.prototype.writeDoubleLE=function(e,t,n){return J(this,e,t,!0,n)},x.prototype.writeDoubleBE=function(e,t,n){return J(this,e,t,!1,n)},x.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!x.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function te(e){return function(e){var t,n,r,i,o,a;c||h();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new l(3*s/4-o),r=o>0?s-4:s;var d=0;for(t=0,n=0;t>16&255,a[d++]=i>>8&255,a[d++]=255&i;return 2===o?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,a[d++]=255&i):1===o&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,a[d++]=i>>8&255,a[d++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ne(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function re(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ie={};function oe(){}function ae(){ae.init.call(this)}function se(e){return void 0===e._maxListeners?ae.defaultMaxListeners:e._maxListeners}function ue(e,t,n){if(t)e.call(n);else for(var r=e.length,i=me(e,r),o=0;o0&&a.length>i){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function pe(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function ve(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function me(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}function ge(){throw new Error("setTimeout has not been defined")}function ye(){throw new Error("clearTimeout has not been defined")}oe.prototype=Object.create(null),ae.EventEmitter=ae,ae.usingDomains=!1,ae.prototype.domain=void 0,ae.prototype._events=void 0,ae.prototype._maxListeners=void 0,ae.defaultMaxListeners=10,ae.init=function(){this.domain=null,ae.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new oe,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ae.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ae.prototype.getMaxListeners=function(){return se(this)},ae.prototype.emit=function(e){var t,n,r,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:ue(n,c,this);break;case 2:le(n,c,this,arguments[1]);break;case 3:ce(n,c,this,arguments[1],arguments[2]);break;case 4:he(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new oe,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r0?Reflect.ownKeys(this._events):[]};var be=ge,xe=ye;function _e(e){if(be===setTimeout)return setTimeout(e,0);if((be===ge||!be)&&setTimeout)return be=setTimeout,setTimeout(e,0);try{return be(e,0)}catch(t){try{return be.call(null,e,0)}catch(t){return be.call(this,e,0)}}}"function"==typeof a.setTimeout&&(be=setTimeout),"function"==typeof a.clearTimeout&&(xe=clearTimeout);var we,Te=[],Me=!1,Se=-1;function Ee(){Me&&we&&(Me=!1,we.length?Te=we.concat(Te):Se=-1,Te.length&&Ae())}function Ae(){if(!Me){var e=_e(Ee);Me=!0;for(var t=Te.length;t;){for(we=Te,Te=[];++Se1)for(var n=1;n=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),et(t)?n.showHidden=t:t&&ct(n,t),rt(n.showHidden)&&(n.showHidden=!1),rt(n.depth)&&(n.depth=2),rt(n.colors)&&(n.colors=!1),rt(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Ze),Je(n,e,n.depth)}function Ze(e,t){var n=Qe.styles[t];return n?"["+Qe.colors[n][0]+"m"+e+"["+Qe.colors[n][1]+"m":e}function qe(e,t){return e}function Je(e,t,n){if(e.customInspect&&t&&ut(t.inspect)&&t.inspect!==Qe&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return nt(r)||(r=Je(e,r,n)),r}var i=function(e,t){if(rt(t))return e.stylize("undefined","undefined");if(nt(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(r=t,"number"==typeof r)return e.stylize(""+t,"number");var r;if(et(t))return e.stylize(""+t,"boolean");if(tt(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),st(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Ke(t);if(0===o.length){if(ut(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(it(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(at(t))return e.stylize(Date.prototype.toString.call(t),"date");if(st(t))return Ke(t)}var u,l,c="",h=!1,d=["{","}"];(u=t,Array.isArray(u)&&(h=!0,d=["[","]"]),ut(t))&&(c=" [Function"+(t.name?": "+t.name:"")+"]");return it(t)&&(c=" "+RegExp.prototype.toString.call(t)),at(t)&&(c=" "+Date.prototype.toUTCString.call(t)),st(t)&&(c=" "+Ke(t)),0!==o.length||h&&0!=t.length?n<0?it(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=h?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,c,d)):d[0]+c+d[1]}function Ke(e){return"["+Error.prototype.toString.call(e)+"]"}function $e(e,t,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),ht(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=tt(n)?Je(e,u.value,null):Je(e,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),rt(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function et(e){return"boolean"==typeof e}function tt(e){return null===e}function nt(e){return"string"==typeof e}function rt(e){return void 0===e}function it(e){return ot(e)&&"[object RegExp]"===lt(e)}function ot(e){return"object"===i(e)&&null!==e}function at(e){return ot(e)&&"[object Date]"===lt(e)}function st(e){return ot(e)&&("[object Error]"===lt(e)||e instanceof Error)}function ut(e){return"function"==typeof e}function lt(e){return Object.prototype.toString.call(e)}function ct(e,t){if(!t||!ot(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function ht(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function dt(){this.head=null,this.tail=null,this.length=0}Qe.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Qe.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},dt.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},dt.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},dt.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},dt.prototype.clear=function(){this.head=this.tail=null,this.length=0},dt.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},dt.prototype.concat=function(e){if(0===this.length)return x.alloc(0);if(1===this.length)return this.head.data;for(var t=x.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var ft=x.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function pt(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!ft(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=mt;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=gt;break;default:return void(this.write=vt)}this.charBuffer=new x(6),this.charReceived=0,this.charLength=0}function vt(e){return e.toString(this.encoding)}function mt(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function gt(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}pt.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,r)}return t},pt.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},pt.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var yt=Object.freeze({__proto__:null,StringDecoder:pt});_t.ReadableState=xt;var bt=function(e){if(rt(Ye)&&(Ye=ze.env.NODE_DEBUG||""),e=e.toUpperCase(),!Xe[e])if(new RegExp("\\b"+e+"\\b","i").test(Ye)){Xe[e]=function(){var t=Ve.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else Xe[e]=function(){};return Xe[e]}("stream");function xt(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Zt&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new dt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new pt(e.encoding),this.encoding=e.encoding)}function _t(e){if(!(this instanceof _t))return new _t(e);this._readableState=new xt(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),ae.call(this)}function wt(e,t,n,r,i){var o=function(e,t){var n=null;x.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,St(e)}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&St(e))),function(e,t){t.readingMore||(t.readingMore=!0,Ie(At,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=Tt?e=Tt:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function St(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(bt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Ie(Et,e):Et(e))}function Et(e){bt("emit readable"),e.emit("readable"),Nt(e)}function At(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=x.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0===(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function Dt(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Ie(Pt,t,e))}function Pt(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Ot(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return bt("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Dt(this):St(this),null;if(0===(e=Mt(e,t))&&t.ended)return 0===t.length&&Dt(this),null;var r,i=t.needReadable;return bt("need readable",i),(0===t.length||t.length-e0?kt(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Dt(this)),null!==r&&this.emit("data",r),r},_t.prototype._read=function(e){this.emit("error",new Error("not implemented"))},_t.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,bt("pipe count=%d opts=%j",r.pipesCount,t);var i=!t||!1!==t.end?a:l;function o(e){bt("onunpipe"),e===n&&l()}function a(){bt("onend"),e.end()}r.endEmitted?Ie(i):n.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;bt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,Nt(e))}}(n);e.on("drain",s);var u=!1;function l(){bt("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",d),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",l),n.removeListener("data",h),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var c=!1;function h(t){bt("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==Ot(r.pipes,e))&&!u&&(bt("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function d(t){var n;bt("onerror",t),v(),e.removeListener("error",d),0===(n="error",e.listeners(n).length)&&e.emit("error",t)}function f(){e.removeListener("finish",p),v()}function p(){bt("onfinish"),e.removeListener("close",f),v()}function v(){bt("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",n),r.flowing||(bt("pipe resume"),n.resume()),e},_t.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Bt.prototype._write=function(e,t,n){n(new Error("not implemented"))},Bt.prototype._writev=null,Bt.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,Vt(e,t),n&&(t.finished?Ie(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Ge(Zt,_t);for(var Yt=Object.keys(Bt.prototype),Xt=0;Xt"===a?(E(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=T.TEXT):v(a)?(r.state=T.SGML_DECL_QUOTED,r.sgmlDecl+=a):r.sgmlDecl+=a;continue;case T.SGML_DECL_QUOTED:a===r.q&&(r.state=T.SGML_DECL,r.q=""),r.sgmlDecl+=a;continue;case T.DOCTYPE:">"===a?(r.state=T.TEXT,E(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=a,"["===a?r.state=T.DOCTYPE_DTD:v(a)&&(r.state=T.DOCTYPE_QUOTED,r.q=a));continue;case T.DOCTYPE_QUOTED:r.doctype+=a,a===r.q&&(r.q="",r.state=T.DOCTYPE);continue;case T.DOCTYPE_DTD:r.doctype+=a,"]"===a?r.state=T.DOCTYPE:v(a)&&(r.state=T.DOCTYPE_DTD_QUOTED,r.q=a);continue;case T.DOCTYPE_DTD_QUOTED:r.doctype+=a,a===r.q&&(r.state=T.DOCTYPE_DTD,r.q="");continue;case T.COMMENT:"-"===a?r.state=T.COMMENT_ENDING:r.comment+=a;continue;case T.COMMENT_ENDING:"-"===a?(r.state=T.COMMENT_ENDED,r.comment=I(r.opt,r.comment),r.comment&&E(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+a,r.state=T.COMMENT);continue;case T.COMMENT_ENDED:">"!==a?(k(r,"Malformed comment"),r.comment+="--"+a,r.state=T.COMMENT):r.state=T.TEXT;continue;case T.CDATA:"]"===a?r.state=T.CDATA_ENDING:r.cdata+=a;continue;case T.CDATA_ENDING:"]"===a?r.state=T.CDATA_ENDING_2:(r.cdata+="]"+a,r.state=T.CDATA);continue;case T.CDATA_ENDING_2:">"===a?(r.cdata&&E(r,"oncdata",r.cdata),E(r,"onclosecdata"),r.cdata="",r.state=T.TEXT):"]"===a?r.cdata+="]":(r.cdata+="]]"+a,r.state=T.CDATA);continue;case T.PROC_INST:"?"===a?r.state=T.PROC_INST_ENDING:p(a)?r.state=T.PROC_INST_BODY:r.procInstName+=a;continue;case T.PROC_INST_BODY:if(!r.procInstBody&&p(a))continue;"?"===a?r.state=T.PROC_INST_ENDING:r.procInstBody+=a;continue;case T.PROC_INST_ENDING:">"===a?(E(r,"onprocessinginstruction",{name:r.procInstName,body:r.procInstBody}),r.procInstName=r.procInstBody="",r.state=T.TEXT):(r.procInstBody+="?"+a,r.state=T.PROC_INST_BODY);continue;case T.OPEN_TAG:g(h,a)?r.tagName+=a:(D(r),">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:(p(a)||k(r,"Invalid character in tag name"),r.state=T.ATTRIB));continue;case T.OPEN_TAG_SLASH:">"===a?(R(r,!0),L(r)):(k(r,"Forward-slash in opening tag not followed by >"),r.state=T.ATTRIB);continue;case T.ATTRIB:if(p(a))continue;">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:g(c,a)?(r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):k(r,"Invalid attribute name");continue;case T.ATTRIB_NAME:"="===a?r.state=T.ATTRIB_VALUE:">"===a?(k(r,"Attribute without value"),r.attribValue=r.attribName,O(r),R(r)):p(a)?r.state=T.ATTRIB_NAME_SAW_WHITE:g(h,a)?r.attribName+=a:k(r,"Invalid attribute name");continue;case T.ATTRIB_NAME_SAW_WHITE:if("="===a)r.state=T.ATTRIB_VALUE;else{if(p(a))continue;k(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",E(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",">"===a?R(r):g(c,a)?(r.attribName=a,r.state=T.ATTRIB_NAME):(k(r,"Invalid attribute name"),r.state=T.ATTRIB)}continue;case T.ATTRIB_VALUE:if(p(a))continue;v(a)?(r.q=a,r.state=T.ATTRIB_VALUE_QUOTED):(k(r,"Unquoted attribute value"),r.state=T.ATTRIB_VALUE_UNQUOTED,r.attribValue=a);continue;case T.ATTRIB_VALUE_QUOTED:if(a!==r.q){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=a;continue}O(r),r.q="",r.state=T.ATTRIB_VALUE_CLOSED;continue;case T.ATTRIB_VALUE_CLOSED:p(a)?r.state=T.ATTRIB:">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:g(c,a)?(k(r,"No whitespace between attributes"),r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):k(r,"Invalid attribute name");continue;case T.ATTRIB_VALUE_UNQUOTED:if(!m(a)){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_U:r.attribValue+=a;continue}O(r),">"===a?R(r):r.state=T.ATTRIB;continue;case T.CLOSE_TAG:if(r.tagName)">"===a?L(r):g(h,a)?r.tagName+=a:r.script?(r.script+=""===a?L(r):k(r,"Invalid characters in closing tag");continue;case T.TEXT_ENTITY:case T.ATTRIB_VALUE_ENTITY_Q:case T.ATTRIB_VALUE_ENTITY_U:var l,b;switch(r.state){case T.TEXT_ENTITY:l=T.TEXT,b="textNode";break;case T.ATTRIB_VALUE_ENTITY_Q:l=T.ATTRIB_VALUE_QUOTED,b="attribValue";break;case T.ATTRIB_VALUE_ENTITY_U:l=T.ATTRIB_VALUE_UNQUOTED,b="attribValue"}";"===a?(r[b]+=j(r),r.entity="",r.state=l):g(r.entity.length?f:d,a)?r.entity+=a:(k(r,"Invalid character in entity name"),r[b]+="&"+r.entity+a,r.entity="",r.state=l);continue;default:throw new Error(r,"Unknown state: "+r.state)}r.position>=r.bufferCheckPosition&&function(t){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,o=0,a=n.length;or)switch(n[o]){case"textNode":A(t);break;case"cdata":E(t,"oncdata",t.cdata),t.cdata="";break;case"script":E(t,"onscript",t.script),t.script="";break;default:C(t,"Max buffer length exceeded: "+n[o])}i=Math.max(i,s)}var u=e.MAX_BUFFER_LENGTH-i;t.bufferCheckPosition=u+t.position}(r);return r} +var Au=mt.exports,Iu=wt,Cu=Su.exports;function Nu(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;nt}return!1}function gl(e,t,n,r,i,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o}var yl={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){yl[e]=new gl(e,0,!1,e,null,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];yl[t]=new gl(t,1,!1,e[1],null,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){yl[e]=new gl(e,2,!1,e.toLowerCase(),null,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){yl[e]=new gl(e,2,!1,e,null,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){yl[e]=new gl(e,3,!1,e.toLowerCase(),null,!1)})),["checked","multiple","muted","selected"].forEach((function(e){yl[e]=new gl(e,3,!0,e,null,!1)})),["capture","download"].forEach((function(e){yl[e]=new gl(e,4,!1,e,null,!1)})),["cols","rows","size","span"].forEach((function(e){yl[e]=new gl(e,6,!1,e,null,!1)})),["rowSpan","start"].forEach((function(e){yl[e]=new gl(e,5,!1,e.toLowerCase(),null,!1)}));var bl=/[\-:]([a-z])/g;function xl(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(bl,xl);yl[t]=new gl(t,1,!1,e,null,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(bl,xl);yl[t]=new gl(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(bl,xl);yl[t]=new gl(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)})),["tabIndex","crossOrigin"].forEach((function(e){yl[e]=new gl(e,1,!1,e.toLowerCase(),null,!1)})),yl.xlinkHref=new gl("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0),["src","href","action","formAction"].forEach((function(e){yl[e]=new gl(e,1,!1,e.toLowerCase(),null,!0)}));var _l=Au.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function wl(e,t,n,r){var i=yl.hasOwnProperty(t)?yl[t]:null;(null!==i?0===i.type:!r&&!(!(2=n.length))throw Error(Nu(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:Hl(n)}}function rc(e,t){var n=Hl(t.value),r=Hl(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ic(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var oc="http://www.w3.org/1999/xhtml",ac="http://www.w3.org/2000/svg";function sc(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function uc(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?sc(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var lc,cc=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction((function(){return e(t,n)}))}:e}((function(e,t){if(e.namespaceURI!==ac||"innerHTML"in e)e.innerHTML=t;else{for((lc=lc||document.createElement("div")).innerHTML=""+t.valueOf().toString()+"",t=lc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}));function hc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}function dc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var fc={animationend:dc("Animation","AnimationEnd"),animationiteration:dc("Animation","AnimationIteration"),animationstart:dc("Animation","AnimationStart"),transitionend:dc("Transition","TransitionEnd")},pc={},vc={};function mc(e){if(pc[e])return pc[e];if(!fc[e])return e;var t,n=fc[e];for(t in n)if(n.hasOwnProperty(t)&&t in vc)return pc[e]=n[t];return e}Ju&&(vc=document.createElement("div").style,"AnimationEvent"in window||(delete fc.animationend.animation,delete fc.animationiteration.animation,delete fc.animationstart.animation),"TransitionEvent"in window||delete fc.transitionend.transition);var gc=mc("animationend"),yc=mc("animationiteration"),bc=mc("animationstart"),xc=mc("transitionend"),_c="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),wc=new("function"==typeof WeakMap?WeakMap:Map);function Tc(e){var t=wc.get(e);return void 0===t&&(t=new Map,wc.set(e,t)),t}function Mc(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).effectTag)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Sc(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Ec(e){if(Mc(e)!==e)throw Error(Nu(188))}function Ac(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=Mc(e)))throw Error(Nu(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Ec(i),e;if(o===r)return Ec(i),t;o=o.sibling}throw Error(Nu(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,s=i.child;s;){if(s===n){a=!0,n=i,r=o;break}if(s===r){a=!0,r=i,n=o;break}s=s.sibling}if(!a){for(s=o.child;s;){if(s===n){a=!0,n=o,r=i;break}if(s===r){a=!0,r=o,n=i;break}s=s.sibling}if(!a)throw Error(Nu(189))}}if(n.alternate!==r)throw Error(Nu(190))}if(3!==n.tag)throw Error(Nu(188));return n.stateNode.current===n?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Ic(e,t){if(null==t)throw Error(Nu(30));return null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function Cc(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var Nc=null;function kc(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;rRc.length&&Rc.push(e)}function jc(e,t,n,r){if(Rc.length){var i=Rc.pop();return i.topLevelType=e,i.eventSystemFlags=r,i.nativeEvent=t,i.targetInst=n,i}return{topLevelType:e,eventSystemFlags:r,nativeEvent:t,targetInst:n,ancestors:[]}}function Bc(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r=n;if(3===r.tag)r=r.stateNode.containerInfo;else{for(;r.return;)r=r.return;r=3!==r.tag?null:r.stateNode.containerInfo}if(!r)break;5!==(t=n.tag)&&6!==t||e.ancestors.push(n),n=ed(r)}while(n);for(n=0;n=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Rh(r)}}function jh(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?jh(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function Bh(){for(var e=window,t=Oh();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Oh((e=t.contentWindow).document)}return t}function Uh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var Fh="$?",zh="$!",Gh=null,Hh=null;function Vh(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Wh(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==_(t.dangerouslySetInnerHTML)&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Yh="function"==typeof setTimeout?setTimeout:void 0,Xh="function"==typeof clearTimeout?clearTimeout:void 0;function Qh(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function Zh(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||n===zh||n===Fh){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var qh=Math.random().toString(36).slice(2),Jh="__reactInternalInstance$"+qh,Kh="__reactEventHandlers$"+qh,$h="__reactContainere$"+qh;function ed(e){var t=e[Jh];if(t)return t;for(var n=e.parentNode;n;){if(t=n[$h]||n[Jh]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Zh(e);null!==e;){if(n=e[Jh])return n;e=Zh(e)}return t}n=(e=n).parentNode}return null}function td(e){return!(e=e[Jh]||e[$h])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function nd(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(Nu(33))}function rd(e){return e[Kh]||null}function id(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function od(e,t){var n=e.stateNode;if(!n)return null;var r=Bu(n);if(!r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(Nu(231,t,_(n)));return n}function ad(e,t,n){(t=od(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=Ic(n._dispatchListeners,t),n._dispatchInstances=Ic(n._dispatchInstances,e))}function sd(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=id(t);for(t=n.length;0this.eventPool.length&&this.eventPool.push(e)}function xd(e){e.eventPool=[],e.getPooled=yd,e.release=bd}Iu(gd.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=vd)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=vd)},persist:function(){this.isPersistent=vd},isPersistent:md,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=md,this._dispatchInstances=this._dispatchListeners=null}}),gd.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},gd.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var i=new t;return Iu(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=Iu({},r.Interface,e),n.extend=r.extend,xd(n),n},xd(gd);var _d=gd.extend({data:null}),wd=gd.extend({data:null}),Td=[9,13,27,32],Md=Ju&&"CompositionEvent"in window,Sd=null;Ju&&"documentMode"in document&&(Sd=document.documentMode);var Ed=Ju&&"TextEvent"in window&&!Sd,Ad=Ju&&(!Md||Sd&&8=Sd),Id=String.fromCharCode(32),Cd={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},Nd=!1;function kd(e,t){switch(e){case"keyup":return-1!==Td.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Dd(e){return"object"==_(e=e.detail)&&"data"in e?e.data:null}var Pd=!1;var Od={eventTypes:Cd,extractEvents:function(e,t,n,r){var i;if(Md)e:{switch(e){case"compositionstart":var o=Cd.compositionStart;break e;case"compositionend":o=Cd.compositionEnd;break e;case"compositionupdate":o=Cd.compositionUpdate;break e}o=void 0}else Pd?kd(e,n)&&(o=Cd.compositionEnd):"keydown"===e&&229===n.keyCode&&(o=Cd.compositionStart);return o?(Ad&&"ko"!==n.locale&&(Pd||o!==Cd.compositionStart?o===Cd.compositionEnd&&Pd&&(i=pd()):(dd="value"in(hd=r)?hd.value:hd.textContent,Pd=!0)),o=_d.getPooled(o,t,n,r),i?o.data=i:null!==(i=Dd(n))&&(o.data=i),cd(o),i=o):i=null,(e=Ed?function(e,t){switch(e){case"compositionend":return Dd(t);case"keypress":return 32!==t.which?null:(Nd=!0,Id);case"textInput":return(e=t.data)===Id&&Nd?null:e;default:return null}}(e,n):function(e,t){if(Pd)return"compositionend"===e||!Md&&kd(e,t)?(e=pd(),fd=dd=hd=null,Pd=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=document.documentMode,vf={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},mf=null,gf=null,yf=null,bf=!1;function xf(e,t){var n=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;return bf||null==mf||mf!==Oh(n)?null:("selectionStart"in(n=mf)&&Uh(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},yf&&ff(yf,n)?null:(yf=n,(e=gd.getPooled(vf.select,gf,e,t)).type="select",e.target=mf,cd(e),e))}var _f={eventTypes:vf,extractEvents:function(e,t,n,r,i,o){if(!(o=!(i=o||(r.window===r?r.document:9===r.nodeType?r:r.ownerDocument)))){e:{i=Tc(i),o=Zu.onSelect;for(var a=0;aRf||(e.current=Of[Rf],Of[Rf]=null,Rf--)}function jf(e,t){Rf++,Of[Rf]=e.current,e.current=t}var Bf={},Uf={current:Bf},Ff={current:!1},zf=Bf;function Gf(e,t){var n=e.type.contextTypes;if(!n)return Bf;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Hf(e){return null!=(e=e.childContextTypes)}function Vf(){Lf(Ff),Lf(Uf)}function Wf(e,t,n){if(Uf.current!==Bf)throw Error(Nu(168));jf(Uf,t),jf(Ff,n)}function Yf(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in e))throw Error(Nu(108,zl(t)||"Unknown",i));return Iu({},n,{},r)}function Xf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Bf,zf=Uf.current,jf(Uf,e),jf(Ff,Ff.current),!0}function Qf(e,t,n){var r=e.stateNode;if(!r)throw Error(Nu(169));n?(e=Yf(e,t,zf),r.__reactInternalMemoizedMergedChildContext=e,Lf(Ff),Lf(Uf),jf(Uf,e)):Lf(Ff),jf(Ff,n)}var Zf=Cu.unstable_runWithPriority,qf=Cu.unstable_scheduleCallback,Jf=Cu.unstable_cancelCallback,Kf=Cu.unstable_requestPaint,$f=Cu.unstable_now,ep=Cu.unstable_getCurrentPriorityLevel,tp=Cu.unstable_ImmediatePriority,np=Cu.unstable_UserBlockingPriority,rp=Cu.unstable_NormalPriority,ip=Cu.unstable_LowPriority,op=Cu.unstable_IdlePriority,ap={},sp=Cu.unstable_shouldYield,up=void 0!==Kf?Kf:function(){},lp=null,cp=null,hp=!1,dp=$f(),fp=1e4>dp?$f:function(){return $f()-dp};function pp(){switch(ep()){case tp:return 99;case np:return 98;case rp:return 97;case ip:return 96;case op:return 95;default:throw Error(Nu(332))}}function vp(e){switch(e){case 99:return tp;case 98:return np;case 97:return rp;case 96:return ip;case 95:return op;default:throw Error(Nu(332))}}function mp(e,t){return e=vp(e),Zf(e,t)}function gp(e,t,n){return e=vp(e),qf(e,t,n)}function yp(e){return null===lp?(lp=[e],cp=qf(tp,xp)):lp.push(e),ap}function bp(){if(null!==cp){var e=cp;cp=null,Jf(e)}xp()}function xp(){if(!hp&&null!==lp){hp=!0;var e=0;try{var t=lp;mp(99,(function(){for(;e=t&&(rm=!0),e.firstContext=null)}function kp(e,t){if(Ep!==e&&!1!==t&&0!==t)if(("number"!=typeof t||1073741823===t)&&(Ep=e,t=1073741823),t={context:e,observedBits:t,next:null},null===Sp){if(null===Mp)throw Error(Nu(308));Sp=t,Mp.dependencies={expirationTime:0,firstContext:t,responders:null}}else Sp=Sp.next=t;return e._currentValue}var Dp=!1;function Pp(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function Op(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function Rp(e,t){return(e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null}).next=e}function Lp(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function jp(e,t){var n=e.alternate;null!==n&&Op(n,e),null===(n=(e=e.updateQueue).baseQueue)?(e.baseQueue=t.next=t,t.next=t):(t.next=n.next,n.next=t)}function Bp(e,t,n,r){var i=e.updateQueue;Dp=!1;var o=i.baseQueue,a=i.shared.pending;if(null!==a){if(null!==o){var s=o.next;o.next=a.next,a.next=s}o=a,i.shared.pending=null,null!==(s=e.alternate)&&(null!==(s=s.updateQueue)&&(s.baseQueue=a))}if(null!==o){s=o.next;var u=i.baseState,l=0,c=null,h=null,d=null;if(null!==s)for(var f=s;;){if((a=f.expirationTime)l&&(l=a)}else{null!==d&&(d=d.next={expirationTime:1073741823,suspenseConfig:f.suspenseConfig,tag:f.tag,payload:f.payload,callback:f.callback,next:null}),Lg(a,f.suspenseConfig);e:{var v=e,m=f;switch(a=t,p=n,m.tag){case 1:if("function"==typeof(v=m.payload)){u=v.call(p,u,a);break e}u=v;break e;case 3:v.effectTag=-4097&v.effectTag|64;case 0:if(null==(a="function"==typeof(v=m.payload)?v.call(p,u,a):v))break e;u=Iu({},u,a);break e;case 2:Dp=!0}}null!==f.callback&&(e.effectTag|=32,null===(a=i.effects)?i.effects=[f]:a.push(f))}if(null===(f=f.next)||f===s){if(null===(a=i.shared.pending))break;f=o.next=a.next,a.next=s,i.baseQueue=o=a,i.shared.pending=null}}null===d?c=u:d.next=h,i.baseState=c,i.baseQueue=d,jg(l),e.expirationTime=l,e.memoizedState=u}}function Up(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;tv?(m=p,p=null):m=p.sibling;var g=d(i,p,s[v],u);if(null===g){null===p&&(p=m);break}e&&p&&null===g.alternate&&t(i,p),a=o(g,a,v),null===c?l=g:c.sibling=g,c=g,p=m}if(v===s.length)return n(i,p),l;if(null===p){for(;vv?(m=p,p=null):m=p.sibling;var y=d(i,p,g.value,u);if(null===y){null===p&&(p=m);break}e&&p&&null===y.alternate&&t(i,p),a=o(y,a,v),null===c?l=y:c.sibling=y,c=y,p=m}if(g.done)return n(i,p),l;if(null===p){for(;!g.done;v++,g=s.next())null!==(g=h(i,g.value,u))&&(a=o(g,a,v),null===c?l=g:c.sibling=g,c=g);return l}for(p=r(i,p);!g.done;v++,g=s.next())null!==(g=f(p,i,v,g.value,u))&&(e&&null!==g.alternate&&p.delete(null===g.key?v:g.key),a=o(g,a,v),null===c?l=g:c.sibling=g,c=g);return e&&p.forEach((function(e){return t(i,e)})),l}(s,u,l,c);if(v&&qp(s,l),void 0===l&&!p)switch(s.tag){case 1:case 0:throw s=s.type,Error(Nu(152,s.displayName||s.name||"Component"))}return n(s,u)}}var Kp=Jp(!0),$p=Jp(!1),ev={},tv={current:ev},nv={current:ev},rv={current:ev};function iv(e){if(e===ev)throw Error(Nu(174));return e}function ov(e,t){switch(jf(rv,t),jf(nv,e),jf(tv,ev),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:uc(null,"");break;default:t=uc(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Lf(tv),jf(tv,t)}function av(){Lf(tv),Lf(nv),Lf(rv)}function sv(e){iv(rv.current);var t=iv(tv.current),n=uc(t,e.type);t!==n&&(jf(nv,e),jf(tv,n))}function uv(e){nv.current===e&&(Lf(tv),Lf(nv))}var lv={current:0};function cv(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||n.data===Fh||n.data===zh))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.effectTag))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function hv(e,t){return{responder:e,props:t}}var dv=_l.ReactCurrentDispatcher,fv=_l.ReactCurrentBatchConfig,pv=0,vv=null,mv=null,gv=null,yv=!1;function bv(){throw Error(Nu(321))}function xv(e,t){if(null===t)return!1;for(var n=0;no))throw Error(Nu(301));o+=1,gv=mv=null,t.updateQueue=null,dv.current=Yv,e=n(r,i)}while(t.expirationTime===pv)}if(dv.current=Hv,t=null!==mv&&null!==mv.next,pv=0,gv=mv=vv=null,yv=!1,t)throw Error(Nu(300));return e}function wv(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===gv?vv.memoizedState=gv=e:gv=gv.next=e,gv}function Tv(){if(null===mv){var e=vv.alternate;e=null!==e?e.memoizedState:null}else e=mv.next;var t=null===gv?vv.memoizedState:gv.next;if(null!==t)gv=t,mv=e;else{if(null===e)throw Error(Nu(310));e={memoizedState:(mv=e).memoizedState,baseState:mv.baseState,baseQueue:mv.baseQueue,queue:mv.queue,next:null},null===gv?vv.memoizedState=gv=e:gv=gv.next=e}return gv}function Mv(e,t){return"function"==typeof t?t(e):t}function Sv(e){var t=Tv(),n=t.queue;if(null===n)throw Error(Nu(311));n.lastRenderedReducer=e;var r=mv,i=r.baseQueue,o=n.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var s=a=o=null,u=i;do{var l=u.expirationTime;if(lvv.expirationTime&&(vv.expirationTime=l,jg(l))}else null!==s&&(s=s.next={expirationTime:1073741823,suspenseConfig:u.suspenseConfig,action:u.action,eagerReducer:u.eagerReducer,eagerState:u.eagerState,next:null}),Lg(l,u.suspenseConfig),r=u.eagerReducer===e?u.eagerState:e(r,u.action);u=u.next}while(null!==u&&u!==i);null===s?o=r:s.next=a,hf(r,t.memoizedState)||(rm=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=s,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function Ev(e){var t=Tv(),n=t.queue;if(null===n)throw Error(Nu(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);hf(o,t.memoizedState)||(rm=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Av(e){var t=wv();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:Mv,lastRenderedState:e}).dispatch=Gv.bind(null,vv,e),[t.memoizedState,e]}function Iv(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=vv.updateQueue)?(t={lastEffect:null},vv.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Cv(){return Tv().memoizedState}function Nv(e,t,n,r){var i=wv();vv.effectTag|=e,i.memoizedState=Iv(1|t,n,void 0,void 0===r?null:r)}function kv(e,t,n,r){var i=Tv();r=void 0===r?null:r;var o=void 0;if(null!==mv){var a=mv.memoizedState;if(o=a.destroy,null!==r&&xv(r,a.deps))return void Iv(t,n,o,r)}vv.effectTag|=e,i.memoizedState=Iv(1|t,n,o,r)}function Dv(e,t){return Nv(516,4,e,t)}function Pv(e,t){return kv(516,4,e,t)}function Ov(e,t){return kv(4,2,e,t)}function Rv(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Lv(e,t,n){return n=null!=n?n.concat([e]):null,kv(4,2,Rv.bind(null,t,e),n)}function jv(){}function Bv(e,t){return wv().memoizedState=[e,void 0===t?null:t],e}function Uv(e,t){var n=Tv();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&xv(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Fv(e,t){var n=Tv();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&xv(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function zv(e,t,n){var r=pp();mp(98>r?98:r,(function(){e(!0)})),mp(97<\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=a.createElement(i,{is:r.is}):(e=a.createElement(i),"select"===i&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,i),e[Jh]=t,e[Kh]=r,fm(e,t),t.stateNode=e,a=Nh(i,r),i){case"iframe":case"object":case"embed":yh("load",e),s=r;break;case"video":case"audio":for(s=0;s<_c.length;s++)yh(_c[s],e);s=r;break;case"source":yh("error",e),s=r;break;case"img":case"image":case"link":yh("error",e),yh("load",e),s=r;break;case"form":yh("reset",e),yh("submit",e),s=r;break;case"details":yh("toggle",e),s=r;break;case"input":Ql(e,r),s=Xl(e,r),yh("invalid",e),Dh(n,"onChange");break;case"option":s=$l(e,r);break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Iu({},r,{value:void 0}),yh("invalid",e),Dh(n,"onChange");break;case"textarea":nc(e,r),s=tc(e,r),yh("invalid",e),Dh(n,"onChange");break;default:s=r}Ch(i,s);var u=s;for(o in u)if(u.hasOwnProperty(o)){var l=u[o];"style"===o?Ah(e,l):"dangerouslySetInnerHTML"===o?null!=(l=l?l.__html:void 0)&&cc(e,l):"children"===o?"string"==typeof l?("textarea"!==i||""!==l)&&hc(e,l):"number"==typeof l&&hc(e,""+l):"suppressContentEditableWarning"!==o&&"suppressHydrationWarning"!==o&&"autoFocus"!==o&&(Qu.hasOwnProperty(o)?null!=l&&Dh(n,o):null!=l&&wl(e,o,l,a))}switch(i){case"input":Wl(e),Jl(e,r,!1);break;case"textarea":Wl(e),ic(e);break;case"option":null!=r.value&&e.setAttribute("value",""+Hl(r.value));break;case"select":e.multiple=!!r.multiple,null!=(n=r.value)?ec(e,!!r.multiple,n,!1):null!=r.defaultValue&&ec(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof s.onClick&&(e.onclick=Ph)}Vh(i,r)&&(t.effectTag|=4)}null!==t.ref&&(t.effectTag|=128)}return null;case 6:if(e&&null!=t.stateNode)vm(0,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(Nu(166));n=iv(rv.current),iv(tv.current),em(t)?(n=t.stateNode,r=t.memoizedProps,n[Jh]=t,n.nodeValue!==r&&(t.effectTag|=4)):((n=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[Jh]=t,t.stateNode=n)}return null;case 13:return Lf(lv),r=t.memoizedState,0!=(64&t.effectTag)?(t.expirationTime=n,t):(n=null!==r,r=!1,null===e?void 0!==t.memoizedProps.fallback&&em(t):(r=null!==(i=e.memoizedState),n||null===i||null!==(i=e.child.sibling)&&(null!==(o=t.firstEffect)?(t.firstEffect=i,i.nextEffect=o):(t.firstEffect=t.lastEffect=i,i.nextEffect=null),i.effectTag=8)),n&&!r&&0!=(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!=(1&lv.current)?ig===Jm&&(ig=Km):((ig===Jm||ig===Km)&&(ig=$m),0!==lg&&null!==tg&&(cy(tg,rg),hy(tg,lg)))),(n||r)&&(t.effectTag|=4),null);case 4:return av(),null;case 10:return Ip(t),null;case 19:if(Lf(lv),null===(r=t.memoizedState))return null;if(i=0!=(64&t.effectTag),null===(o=r.rendering)){if(i)wm(r,!1);else if(ig!==Jm||null!==e&&0!=(64&e.effectTag))for(o=t.child;null!==o;){if(null!==(e=cv(o))){for(t.effectTag|=64,wm(r,!1),null!==(i=e.updateQueue)&&(t.updateQueue=i,t.effectTag|=4),null===r.lastEffect&&(t.firstEffect=null),t.lastEffect=r.lastEffect,r=t.child;null!==r;)o=n,(i=r).effectTag&=2,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null,null===(e=i.alternate)?(i.childExpirationTime=0,i.expirationTime=o,i.child=null,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null):(i.childExpirationTime=e.childExpirationTime,i.expirationTime=e.expirationTime,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,o=e.dependencies,i.dependencies=null===o?null:{expirationTime:o.expirationTime,firstContext:o.firstContext,responders:o.responders}),r=r.sibling;return jf(lv,1&lv.current|2),t.child}o=o.sibling}}else{if(!i)if(null!==(e=cv(o))){if(t.effectTag|=64,i=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.effectTag|=4),wm(r,!0),null===r.tail&&"hidden"===r.tailMode&&!o.alternate)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*fp()-r.renderingStartTime>r.tailExpiration&&1t)&&bg.set(e,t))}}function Eg(e,t){e.expirationTime=(e=n>(e=e.nextKnownPendingLevel)?n:e)&&t!==e?0:e}function Ig(e){if(0!==e.lastExpiredTime)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=yp(Ng.bind(null,e));else{var t=Ag(e),n=e.callbackNode;if(0===t)null!==n&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var r=Tg();if(1073741823===t?r=99:1===t||2===t?r=95:r=0>=(r=10*(1073741821-t)-10*(1073741821-r))?99:250>=r?98:5250>=r?97:95,null!==n){var i=e.callbackPriority;if(e.callbackExpirationTime===t&&i>=r)return;n!==ap&&Jf(n)}e.callbackExpirationTime=t,e.callbackPriority=r,t=1073741823===t?yp(Ng.bind(null,e)):gp(r,Cg.bind(null,e),{timeout:10*(1073741821-t)-fp()}),e.callbackNode=t}}}function Cg(e,t){if(wg=0,t)return dy(e,t=Tg()),Ig(e),null;var n=Ag(e);if(0!==n){if(t=e.callbackNode,0!=(48&eg))throw Error(Nu(327));if(Yg(),e===tg&&n===rg||Pg(e,n),null!==ng){var r=eg;eg|=Zm;for(var i=Rg();;)try{Ug();break}catch(t){Og(e,t)}if(Ap(),eg=r,Xm.current=i,1===ig)throw t=og,Pg(e,n),cy(e,n),Ig(e),t;if(null===ng)switch(i=e.finishedWork=e.current.alternate,e.finishedExpirationTime=n,r=ig,tg=null,r){case Jm:case 1:throw Error(Nu(345));case 2:dy(e,2=n){e.lastPingedTime=n,Pg(e,n);break}}if(0!==(o=Ag(e))&&o!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}e.timeoutHandle=Yh(Hg.bind(null,e),i);break}Hg(e);break;case $m:if(cy(e,n),n===(r=e.lastSuspendedTime)&&(e.nextKnownPendingLevel=Gg(i)),cg&&(0===(i=e.lastPingedTime)||i>=n)){e.lastPingedTime=n,Pg(e,n);break}if(0!==(i=Ag(e))&&i!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}if(1073741823!==sg?r=10*(1073741821-sg)-fp():1073741823===ag?r=0:(r=10*(1073741821-ag)-5e3,0>(r=(i=fp())-r)&&(r=0),(n=10*(1073741821-n)-i)<(r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ym(r/1960))-r)&&(r=n)),10=(r=0|a.busyMinDurationMs)?r=0:(i=0|a.busyDelayMs,r=(o=fp()-(10*(1073741821-o)-(0|a.timeoutMs||5e3)))<=i?0:i+r-o),10 component higher in the tree to provide a loading indicator or placeholder to display."+Gl(a))}5!==ig&&(ig=2),s=Sm(s,a),h=o;do{switch(h.tag){case 3:u=s,h.effectTag|=4096,h.expirationTime=t,jp(h,Hm(h,u,t));break e;case 1:u=s;var x=h.type,w=h.stateNode;if(0==(64&h.effectTag)&&("function"==typeof x.getDerivedStateFromError||null!==w&&"function"==typeof w.componentDidCatch&&(null===vg||!vg.has(w)))){h.effectTag|=4096,h.expirationTime=t,jp(h,Vm(h,u,t));break e}}h=h.return}while(null!==h)}ng=zg(ng)}catch(e){t=e;continue}break}}function Rg(){var e=Xm.current;return Xm.current=Hv,null===e?Hv:e}function Lg(e,t){elg&&(lg=e)}function Bg(){for(;null!==ng;)ng=Fg(ng)}function Ug(){for(;null!==ng&&!sp();)ng=Fg(ng)}function Fg(e){var t=Wm(e.alternate,e,rg);return e.memoizedProps=e.pendingProps,null===t&&(t=zg(e)),Qm.current=null,t}function zg(e){ng=e;do{var t=ng.alternate;if(e=ng.return,0==(2048&ng.effectTag)){if(t=Tm(t,ng,rg),1===rg||1!==ng.childExpirationTime){for(var n=0,r=ng.child;null!==r;){var i=r.expirationTime,o=r.childExpirationTime;i>n&&(n=i),o>n&&(n=o),r=r.sibling}ng.childExpirationTime=n}if(null!==t)return t;null!==e&&0==(2048&e.effectTag)&&(null===e.firstEffect&&(e.firstEffect=ng.firstEffect),null!==ng.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=ng.firstEffect),e.lastEffect=ng.lastEffect),1(e=e.childExpirationTime)?t:e}function Hg(e){var t=pp();return mp(99,Vg.bind(null,e,t)),null}function Vg(e,t){do{Yg()}while(null!==gg);if(0!=(48&eg))throw Error(Nu(327));var n=e.finishedWork,r=e.finishedExpirationTime;if(null===n)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,n===e.current)throw Error(Nu(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var i=Gg(n);if(e.firstPendingTime=i,r<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:r<=e.firstSuspendedTime&&(e.firstSuspendedTime=r-1),r<=e.lastPingedTime&&(e.lastPingedTime=0),r<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===tg&&(ng=tg=null,rg=0),1s&&(l=s,s=a,a=l),l=Lh(b,a),c=Lh(b,s),l&&c&&(1!==_.rangeCount||_.anchorNode!==l.node||_.anchorOffset!==l.offset||_.focusNode!==c.node||_.focusOffset!==c.offset)&&((x=x.createRange()).setStart(l.node,l.offset),_.removeAllRanges(),a>s?(_.addRange(x),_.extend(c.node,c.offset)):(x.setEnd(c.node,c.offset),_.addRange(x))))),x=[],_=b);_=_.parentNode;)1===_.nodeType&&x.push({element:_,left:_.scrollLeft,top:_.scrollTop});for("function"==typeof b.focus&&b.focus(),b=0;b=n?gm(e,t,n):(jf(lv,1&lv.current),null!==(t=_m(e,t,n))?t.sibling:null);jf(lv,1&lv.current);break;case 19:if(r=t.childExpirationTime>=n,0!=(64&e.effectTag)){if(r)return xm(e,t,n);t.effectTag|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null),jf(lv,lv.current),!r)return null}return _m(e,t,n)}rm=!1}}else rm=!1;switch(t.expirationTime=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,i=Gf(t,Uf.current),Np(t,n),i=_v(null,t,r,e,i,n),t.effectTag|=1,"object"==_(i)&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,Hf(r)){var o=!0;Xf(t)}else o=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,Pp(t);var a=r.getDerivedStateFromProps;"function"==typeof a&&Gp(t,r,a,e),i.updater=Hp,t.stateNode=i,i._reactInternalFiber=t,Xp(t,r,e,n),t=hm(null,t,r,!0,o,n)}else t.tag=0,im(null,t,i,n),t=t.child;return t;case 16:e:{if(i=t.elementType,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,function(e){if(-1===e._status){e._status=0;var t=e._ctor;t=t(),e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}}(i),1!==i._status)throw i._result;switch(i=i._result,t.type=i,o=t.tag=function(e){if("function"==typeof e)return ny(e)?1:0;if(null!=e){if((e=e.$$typeof)===Pl)return 11;if(e===Ll)return 14}return 2}(i),e=wp(i,e),o){case 0:t=lm(null,t,i,e,n);break e;case 1:t=cm(null,t,i,e,n);break e;case 11:t=om(null,t,i,e,n);break e;case 14:t=am(null,t,i,wp(i.type,e),r,n);break e}throw Error(Nu(306,i,""))}return t;case 0:return r=t.type,i=t.pendingProps,lm(e,t,r,i=t.elementType===r?i:wp(r,i),n);case 1:return r=t.type,i=t.pendingProps,cm(e,t,r,i=t.elementType===r?i:wp(r,i),n);case 3:if(dm(t),r=t.updateQueue,null===e||null===r)throw Error(Nu(282));if(r=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,Op(e,t),Bp(t,r,null,n),(r=t.memoizedState.element)===i)tm(),t=_m(e,t,n);else{if((i=t.stateNode.hydrate)&&(Qv=Qh(t.stateNode.containerInfo.firstChild),Xv=t,i=Zv=!0),i)for(n=$p(t,null,r,n),t.child=n;n;)n.effectTag=-3&n.effectTag|1024,n=n.sibling;else im(e,t,r,n),tm();t=t.child}return t;case 5:return sv(t),null===e&&Kv(t),r=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,a=i.children,Wh(r,i)?a=null:null!==o&&Wh(r,o)&&(t.effectTag|=16),um(e,t),4&t.mode&&1!==n&&i.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(im(e,t,a,n),t=t.child),t;case 6:return null===e&&Kv(t),null;case 13:return gm(e,t,n);case 4:return ov(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Kp(t,null,r,n):im(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,om(e,t,r,i=t.elementType===r?i:wp(r,i),n);case 7:return im(e,t,t.pendingProps,n),t.child;case 8:case 12:return im(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value;var s=t.type._context;if(jf(Tp,s._currentValue),s._currentValue=o,null!==a)if(s=a.value,0===(o=hf(s,o)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(s,o):1073741823))){if(a.children===i.children&&!Ff.current){t=_m(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var u=s.dependencies;if(null!==u){a=s.child;for(var l=u.firstContext;null!==l;){if(l.context===r&&0!=(l.observedBits&o)){1===s.tag&&((l=Rp(n,null)).tag=2,Lp(s,l)),s.expirationTime=t&&e<=t}function cy(e,t){var n=e.firstSuspendedTime,r=e.lastSuspendedTime;nt||0===n)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function hy(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var n=e.firstSuspendedTime;0!==n&&(t>=n?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function dy(e,t){var n=e.lastExpiredTime;(0===n||n>t)&&(e.lastExpiredTime=t)}function fy(e,t,n,r){var i=t.current,o=Tg(),a=Fp.suspense;o=Mg(o,i,a);e:if(n){t:{if(Mc(n=n._reactInternalFiber)!==n||1!==n.tag)throw Error(Nu(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break t;case 1:if(Hf(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break t}}s=s.return}while(null!==s);throw Error(Nu(171))}if(1===n.tag){var u=n.type;if(Hf(u)){n=Yf(n,u,s);break e}}n=s}else n=Bf;return null===t.context?t.context=n:t.pendingContext=n,(t=Rp(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),Lp(i,t),Sg(i,o),o}function py(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function vy(e,t){null!==(e=e.memoizedState)&&null!==e.dehydrated&&e.retryTime=t||n<0||h&&e-l>=o}function m(){var e,n,r=nb();if(v(r))return g(r);s=setTimeout(m,(n=t-((e=r)-u),h?ib(n,o-(e-l)):n))}function g(e){return s=void 0,d&&r?f(e):(r=i=void 0,a)}function y(){var e=nb(),n=v(e);if(r=arguments,i=this,u=e,n){if(void 0===s)return p(u);if(h)return clearTimeout(s),s=setTimeout(m,t),f(u)}return void 0===s&&(s=setTimeout(m,t)),a}return t=tb(t)||0,qy(n)&&(c=!!n.leading,o=(h="maxWait"in n)?rb(tb(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=u=i=s=void 0},y.flush=function(){return void 0===s?a:g(nb())},y}var ab=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).seeking=!1,r.mobileSeeking=!1,r.track=null,r.hoverTime=null,r.offset=0,r.secondsPrefix="00:00:",r.minutesPrefix="00:",r.seekPause=!1,r.handleTouchSeeking=function(e){for(var t=0,n=0;nthis.state.trackWidth&&(e=this.state.trackWidth-this.hoverTime.offsetWidth))),{transform:"translateX(".concat(e,"px)")}}},{key:"secondsToTime",value:function(e){e=Math.round(e+this.offset);var t=Math.floor(e/3600),n=e%3600,r=Math.floor(n/60),i=Math.ceil(n%60);return{hh:t.toString(),mm:r<10?"0"+r:r.toString(),ss:i<10?"0"+i:i.toString()}}},{key:"getHoverTime",value:function(){var e=100*this.state.seekHoverPosition/this.state.trackWidth,t=Math.floor(+e*(this.props.total/100)),n=this.secondsToTime(t);return this.props.total+this.offset<60?this.secondsPrefix+n.ss:this.props.total+this.offset<3600?this.minutesPrefix+n.mm+":"+n.ss:n.hh+":"+n.mm+":"+n.ss}},{key:"isThumbActive",value:function(){return this.state.seekHoverPosition>0||this.seeking}},{key:"drawHoverTime",value:function(){var e=this;return this.props.hideHoverTime?null:ln.createElement("div",{className:this.isThumbActive()?"hover-time active":"hover-time",style:this.getHoverTimePosition(),ref:function(t){return e.hoverTime=t}},this.getHoverTime())}},{key:"render",value:function(){var e=this;return ln.createElement("div",{className:"seek-slider"},ln.createElement("div",{className:"track",ref:function(t){return e.track=t},onMouseMove:function(t){return e.handleTrackHover(!1,t)},onMouseLeave:function(t){return e.handleTrackHover(!0,t)},onMouseDown:this.onMouseDown,onTouchStart:function(t){e.setMobileSeeking(!0),e.onMouseDown(t)},onMouseUp:this.onMouseUp,onTouchEnd:this.onMouseUp},ln.createElement("div",{className:"main"},this.renderBufferProgress(),this.renderHoverProgress(),this.renderProgress())),this.drawHoverTime(),this.renderThumb())}}]),n}(mt.exports.Component),sb=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).stageVolume=0,r.updateVolumeTimer=0,r.onVolumeSeeking=!1,r.onClickOperationButton=function(){r.props.paused?r.props.play():r.props.pause()},r.operationButton=function(){return r.props.paused?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1LjE0djE0bDExLTdsLTExLTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMTloNFY1aC00TTYgMTloNFY1SDZ2MTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="})},r.operationVolumeButton=function(){return r.props.volume>.9?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg0LTUgNi43djIuMDdjNC0uOTEgNy00LjQ5IDctOC43N2MwLTQuMjgtMy03Ljg2LTctOC43N00xNi41IDEyYzAtMS43Ny0xLTMuMjktMi41LTQuMDNWMTZjMS41LS43MSAyLjUtMi4yNCAyLjUtNE0zIDl2Nmg0bDUgNVY0TDcgOUgzeiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}):0===r.props.volume?ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNyA5djZoNGw1IDVWNGwtNSA1SDd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):ln.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNSA5djZoNGw1IDVWNEw5IDltOS41IDNjMC0xLjc3LTEtMy4yOS0yLjUtNC4wM1YxNmMxLjUtLjcxIDIuNS0yLjI0IDIuNS00eiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="})},r.handleClickVolume=function(){0===r.props.volume?0!==r.stageVolume?r.props.setVolume(r.stageVolume):r.props.setVolume(1):(r.stageVolume=r.props.volume,r.props.setVolume(0))},r.onChange=function(e){r.setState({currentTime:e}),e&&r.changeTime(e)},r.changeTime=ob((function(e){r.props.setCurrentTime(e)}),50),r.onVolumeChange=function(e){r.changeVolume(e),r.setState({seekVolume:e/100})},r.changeVolume=ob((function(e){r.props.setVolume(e/100)}),50),r.onVolumeSeekStart=function(){r.onVolumeSeeking=!0},r.onVolumeSeekEnd=ob((function(){r.onVolumeSeeking=!1}),500),r.onProgressSeekStart=function(){return r.setState({isPlayerSeeking:!0})},r.onProgressSeekEnd=ob((function(){r.setState({isPlayerSeeking:!1})}),500),r.state={isPlayerSeeking:!1,isVolumeHover:!1,seekVolume:1,visible:!0,currentTime:0},r.stageVolume=e.volume,r}return x(n,[{key:"componentDidMount",value:function(){var e=this;this.updateVolumeTimer=setInterval((function(){e.onVolumeSeeking||e.setState({seekVolume:e.props.volume}),e.state.isPlayerSeeking||e.setState({currentTime:e.props.currentTime})}),100)}},{key:"componentWillUnmount",value:function(){this.updateVolumeTimer&&clearInterval(this.updateVolumeTimer)}},{key:"render",value:function(){var e=this,t=this.props,n=t.duration,r=t.currentTime;return ln.createElement("div",{className:"player-controller",style:{opacity:this.props.visible?"1":"0"}},ln.createElement("div",{className:"player-controller-progress"},ln.createElement(ab,{total:n,current:this.state.currentTime,onChange:this.onChange,buffered:this.props.buffered,bufferColor:"rgba(255,255,255,0.3)",hideHoverTime:!0,limitTimeTooltipBySides:!0,onSeekStart:this.onProgressSeekStart,onSeekEnd:this.onProgressSeekEnd,play:this.props.play,pause:this.props.pause,paused:this.props.paused,scale:this.props.scale})),ln.createElement("div",{className:"player-controller-actions"},ln.createElement("div",{className:"player-controller-actions-left"},ln.createElement("div",{onClick:this.onClickOperationButton,className:"player-controller-play"},this.operationButton()),ln.createElement("div",{className:"player-volume-box",onMouseEnter:function(){return e.setState({isVolumeHover:!0})},onMouseLeave:function(){return e.setState({isVolumeHover:!1})}},ln.createElement("div",{onClick:this.handleClickVolume,className:"player-volume"},this.operationVolumeButton()),ln.createElement("div",{className:"player-volume-slider"},ln.createElement(ab,{total:100,current:100*this.state.seekVolume,onChange:this.onVolumeChange,onSeekStart:this.onVolumeSeekStart,onSeekEnd:this.onVolumeSeekEnd,scale:this.props.scale,limitTimeTooltipBySides:!0,hideHoverTime:!0})))),ln.createElement("div",{className:"player-mid-box-time"},ub(Math.floor(r/1e3))," /"," ",ub(Math.floor(n/1e3)))))}}]),n}(mt.exports.Component);function ub(e){var t=e%60,n=(e-t)/60;if(n>=60){var r=n%60;return"".concat(lb((n-r)/60),":").concat(lb(r),":").concat(lb(t))}return"".concat(lb(n),":").concat(lb(t))}function lb(e){return e<=9?"0".concat(e):"".concat(e)}var cb=function(e){s(n,e);var t=u(n);function n(){var e;return y(this,n),(e=t.apply(this,arguments)).putAttributes=function(t){var n=e.props.context,r=n.getAttributes()||{};for(var i in t)r[i]!==t[i]&&n.updateAttributes([i],t[i])},e}return x(n,[{key:"render",value:function(){var e=this.props.context,t=e.getRoom(),n=t?void 0:e.getDisplayer(),r=this.putAttributes;return ln.createElement(hb,{room:t,player:n,context:e,plugin:{putAttributes:r}})}}]),n}(mt.exports.Component),hb=function(e){s(n,e);var t=u(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).alertMask=null,r.container=ln.createRef(),r.controllerHiddenTimer=0,r.syncPlayerTimer=0,r.retryCount=0,r.decreaseRetryTimer=0,r.noSoundSyncCount=0,r.showController=function(){r.setState({controllerVisible:!0}),r.debounceHidingController()},r.play=function(){var e,t=null==(e=r.props.room)?void 0:e.calibrationTimestamp;r.debug(">>> play",{paused:!1,hostTime:t}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!1,hostTime:t})},r.pause=function(){var e=Ry(r.getAttributes(),r.props);r.debug(">>> pause",{paused:!0,currentTime:e}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!0,currentTime:e})},r.setVolume=function(e){r.debug(">>> volume",{volume:e}),r.isEnabled()&&r.props.plugin.putAttributes({volume:e}),r.isEnabled()&&r.props.plugin.putAttributes({volume:e,muted:0===e})},r.setCurrentTime=function(e){var t,n=null==(t=r.props.room)?void 0:t.calibrationTimestamp;r.debug(">>> seek",{currentTime:e/1e3,hostTime:n}),r.isEnabled()&&r.props.plugin.putAttributes({currentTime:e/1e3,hostTime:n})},r.resetPlayer=function(){var e;null==(e=r.player)||e.autoplay(!1),r.state.NoSound||(r.debug(">>> ended",{paused:!0,currentTime:0}),r.isEnabled()&&r.props.plugin.putAttributes({paused:!0,currentTime:0}))},r.syncPlayerWithAttributes=function(){var e,t=r.getAttributes();if(t){var n=r.player;if(n&&(!r.state.NoSound||(r.noSoundSyncCount+=1)%8==0)){n.paused()!==t.paused&&(r.debug("<<< paused -> %o",t.paused),t.paused?n.pause():null==(e=n.play())||e.catch(r.catchPlayFail)),n.muted()!==t.muted&&(r.debug("<<< muted -> %o",t.muted),n.muted(t.muted)),n.volume()!==t.volume&&(r.debug("<<< volume -> %o",t.volume),n.volume(t.volume));var i=Ry(t,r.props),o=Oy.currentTimeMaxError;r.state.NoSound&&(o*=3),i>n.duration()?r.resetPlayer():Math.abs(n.currentTime()-i)>o&&(r.debug("<<< currentTime -> %o",i),n.currentTime(i))}}},r.debounceHidingController=function(){r.controllerHiddenTimer&&(clearTimeout(r.controllerHiddenTimer),r.controllerHiddenTimer=0),r.controllerHiddenTimer=setTimeout((function(){r.setState({controllerVisible:!1}),r.controllerHiddenTimer=0}),3e3)},r.decreaseRetryCount=function(){r.player&&r.retryCount>0&&(r.retryCount=r.retryCount-1)},r.catchPlayFail=function(e){var t,n,i=String(e);if(Ly&&i.includes("NotAllowedError")||i.includes("interact"))null==(t=r.player)||t.autoplay("any"),r.setState({NoSound:!0});else{var o=null==(n=r.player)?void 0:n.error();o&&(r.retryCount<=3?(r.initPlayer(),r.retryCount=r.retryCount+1):(r.debug("catch videojs media error",o),r.setState({MediaError:!0}))),r.debug("catch error",e)}},r.fixPlayFail=function(){r.debug("try to fix play state"),r.setState({NoSound:!1});var e=r.getAttributes(),t=e.muted,n=e.volume;r.player&&(r.player.muted(t),r.player.volume(n))},r.initPlayer=g(regeneratorRuntime.mark((function e(){var t,n,i,o,a,s,u,l,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null==(t=r.player)||t.dispose(),r.player=void 0,r.debug("creating elements ..."),n=r.getAttributes(),i=n.type,o=n.src,a=n.poster,(s=document.createElement("div")).setAttribute("data-vjs-player",""),(u=document.createElement("video")).className="video-js",a&&(u.poster=a),u.setAttribute("playsInline",""),u.setAttribute("webkit-playsinline",""),l=document.createElement("source"),new URL(o).pathname.endsWith(".m3u8")?l.type="application/x-mpegURL":u.src=o,l.src=o,i&&(l.type=i),u.appendChild(l),s.appendChild(u),r.container.current.appendChild(s),e.next=14,new Promise((function(e){return(window.requestAnimationFrame||window.setTimeout)(e)}));case 14:r.debug("initializing videojs() ..."),c=Z.default(u),r.player=c,window.player=c,c.one("loadedmetadata",r.gracefullyUpdate),c.on("ready",(function(){var e;null==(e=Oy.onPlayer)||e.call(Oy,c),c.on("timeupdate",r.gracefullyUpdate),c.on("volumechange",r.gracefullyUpdate),c.on("seeked",r.gracefullyUpdate),c.on("play",r.gracefullyUpdate),c.on("pause",r.gracefullyUpdate),c.on("ended",r.resetPlayer)})),c.on("error",r.catchPlayFail),r.setState({MediaError:!1});case 17:case"end":return e.stop()}}),e)}))),r.gracefullyUpdate=function(){return r.setState({updater:!r.state.updater})},r.setupAlert=function(e){e&&(e.addEventListener("touchstart",r.fixPlayFail),e.addEventListener("click",r.fixPlayFail)),r.alertMask=e},r.setupReload=function(e){e&&(e.addEventListener("touchstart",r.initPlayer),e.addEventListener("click",r.initPlayer))},r.state={NoSound:!1,MediaError:!1,updater:!1,controllerVisible:!1},e.room&&function(e){if(!e.calibrationTimestamp)throw new Error("@netless/app-media-player@0.1.0-alpha.5 requires white-web-sdk@^2.13.8 to work properly.")}(e.room),r}return x(n,[{key:"getAttributes",value:function(){var e=this.props.context.getAttributes();if(e){if(e=ky(ky({},Dy),e),this.player){var t=Ry(e,this.props),n=this.player.duration();!e.paused&&t>n&&(r=ky({},e),e=Sy(r,Ey({currentTime:0,paused:!0})),this.resetPlayer())}var r;return e}}},{key:"isShowingPoster",value:function(){var e=this.getAttributes();return!(null!=e&&e.src)||jy.some((function(t){return e.src.endsWith(t)}))}},{key:"render",value:function(){var e,t;if(!this.props.room&&!this.props.player)return null;var n=this.getAttributes();if(!n)return null;var r=1e3*((null==(e=this.player)?void 0:e.duration())||1e3),i=(null==(t=this.player)?void 0:t.bufferedPercent())||0;return ln.createElement("div",{className:this.isEnabled()?"vjs-p":"vjs-p disabled",onMouseEnter:this.showController,onMouseMove:this.showController},ln.createElement("div",{className:"video-js-plugin-player",ref:this.container}),this.isShowingPoster()&&ln.createElement("div",{className:"video-js-plugin-poster"},n.poster&&ln.createElement("img",{src:n.poster,alt:"",draggable:!1})),ln.createElement(sb,{duration:r,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*Ry(n,this.props),setCurrentTime:this.setCurrentTime,buffered:r*i,visible:!0}),this.state.NoSound&&ln.createElement("div",{ref:this.setupAlert,className:"videojs-plugin-muted-alert"}),this.state.MediaError&&ln.createElement("div",{className:"videojs-plugin-recovery-mode"},ln.createElement("button",{ref:this.setupReload},"Reload Player")))}},{key:"debug",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:B.AnimationMode.Immediately;if(this.inDisplaySceneDir){var t=this.attributes,n=t.width,r=void 0===n?1280:n,i=t.height,o=void 0===i?720:i,a=r?-r/2:0,s=o?-o/2:0;this.manager.moveCameraToContain({originX:a,originY:s,width:r,height:o,animationMode:e})}}},{key:"handleSetPage",value:function(e){if(!this.isReplay&&this.attributes.displaySceneDir){var t=e.payload,n=this.displayer,r=n.entireScenes()[this.attributes.displaySceneDir];if(!r||r.length!==t){var i=function(e,t){return new Array(e).fill(0).map((function(e,n){return t(n)}))}(t,(function(e){return{name:String(e+1)}}));n.putScenes(this.attributes.displaySceneDir,i),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}}},{key:"listenIframe",value:function(t){var n=this;t.url&&this.iframe.src!==t.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=t.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=t.url)),this.iframe.width="".concat(t.width,"px"),this.iframe.height="".concat(t.height,"px"),this.sideEffectManager.addEventListener(this.iframe,"load",(function(t){var r;n.postMessage({kind:"Init",payload:{attributes:n.attributes,roomState:null==(r=e.displayer)?void 0:r.state,currentPage:n.currentPage,observerId:n.displayer.observerId}}),e.emitter.emit("IframeLoad",t),n.sideEffectManager.addDisposer(e.emitter.on("Ready",(function(){var e;n.postMessage(null==(e=n.attributes.lastEvent)?void 0:e.payload)})),mb),n.computedStyleAndIframeDisplay()}),void 0,xb)}},{key:"listenDisplayerState",value:function(){var e=this;this.isReplay&&(this.displayer._phase===B.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add((function(){return e.displayer.callbacks.on("onPhaseChanged",e.onPhaseChangedListener),function(){return e.displayer.callbacks.off("onPhaseChanged",e.onPhaseChangedListener)}}),_b)),this.computedStyleAndIframeDisplay()}},{key:"computedStyleAndIframeDisplay",value:function(){this.computedStyle(this.displayer.state),this.computedIframeDisplay(this.displayer.state,this.attributes)}},{key:"listenDisplayerCallbacks",value:function(){this.displayer.callbacks.on(this.callbackName,this.stateChangeListener)}},{key:"computedStyle",value:function(e){var t=this.manager.cameraState,n=this.attributes.width||1280,r=this.attributes.height||720;if(this.iframe){var i=t.width,o=t.height,a=t.scale,s=t.centerX,u=t.centerY,l=this.rootRect||{x:0,y:0},c="".concat(i/2+l.x,"px"),h="".concat(o/2+l.y,"px"),d=-u*a+(o-r)/2*a,f=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;","transform-origin: ".concat(c," ").concat(h,";"),"transform: translate(".concat(-s*a+(i-n)/2*a,"px,").concat(d,"px) scale(").concat(a,", ").concat(a,");")];this.cssList=f,this.computedZindex(),this.updateStyle()}}},{key:"computedIframeDisplay",value:function(t,n){this.inDisplaySceneDir?e.emitter.emit("DispayIframe"):e.emitter.emit("HideIframe")}},{key:"computedZindex",value:function(){var e="z-index: -1;",t=this.cssList.findIndex((function(t){return t===e}));-1!==t&&this.cssList.splice(t,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(e)}},{key:"updateStyle",value:function(){this.iframe.style.cssText=this.cssList.join(" ")}},{key:"messageListener",value:function(e){if(tt("<<<",JSON.stringify(e.data)),e.origin===this.iframeOrigin){var t=e.data;switch(t.kind){case"SetAttributes":this.handleSetAttributes(t);break;case"RegisterMagixEvent":this.handleRegisterMagixEvent(t);break;case"RemoveMagixEvent":this.handleRemoveMagixEvent(t);break;case"DispatchMagixEvent":this.handleDispatchMagixEvent(t);break;case"RemoveAllMagixEvent":this.handleRemoveAllMagixEvent();break;case"NextPage":this.handleNextPage();break;case"PrevPage":this.handlePrevPage();break;case"SDKCreate":this.handleSDKCreate();break;case"SetPage":this.handleSetPage(t);break;case"GetAttributes":this.handleGetAttributes();break;case"PageTo":this.handlePageTo(t);break;default:tt("".concat(t.kind," not allow event."))}}}},{key:"handleSDKCreate",value:function(){this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:this.displayer.state,currentPage:this.currentPage,observerId:this.displayer.observerId}})}},{key:"handleDispatchMagixEvent",value:function(e){var t=e.payload;this.appManager.safeDispatchMagixEvent(t.event,t.payload)}},{key:"handleSetAttributes",value:function(e){this.setAttributes(e.payload)}},{key:"handleRegisterMagixEvent",value:function(e){var t=this,n=e.payload,r=function(e){e.authorId!==t.displayer.observerId&&t.postMessage({kind:"ReciveMagixEvent",payload:e})};this.magixEventMap.set(n,r),this.displayer.addMagixEventListener(n,r)}},{key:"handleRemoveMagixEvent",value:function(e){var t=e.payload,n=this.magixEventMap.get(t);this.displayer.removeMagixEventListener(t,n)}},{key:"handleNextPage",value:function(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}},{key:"handlePrevPage",value:function(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}},{key:"handlePageTo",value:function(e){if(this.manager.canOperate){var t=e.payload;if(!Number.isSafeInteger(t)||t<=0)return;this.manager.setMainViewSceneIndex(t-1),this.dispatchMagixEvent("PageTo",t-1)}}},{key:"handleRemoveAllMagixEvent",value:function(){var e=this;this.magixEventMap.forEach((function(t,n){e.displayer.removeMagixEventListener(n,t)})),this.magixEventMap.clear()}},{key:"handleGetAttributes",value:function(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}},{key:"postMessage",value:function(e){var t;this.iframe&&(null==(t=this.iframe.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),"*"))}},{key:"dispatchMagixEvent",value:function(e,t){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:e,payload:t}}),this.displayer.dispatchMagixEvent(e,t))}},{key:"isClicker",value:function(){if(this.readonly)return!1;var e=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(e)}},{key:"attributes",get:function(){return this.appManager.store.getIframeBridge()}},{key:"isReplay",get:function(){return this.manager.isReplay}},{key:"callbackName",get:function(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}},{key:"iframeOrigin",get:function(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(e){console.warn(e)}}},{key:"currentIndex",get:function(){return this.manager.mainViewSceneIndex}},{key:"currentPage",get:function(){return this.currentIndex+1}},{key:"totalPage",get:function(){return this.manager.mainViewScenesLength}},{key:"readonly",get:function(){return!this.displayer.isWritable}},{key:"inDisplaySceneDir",get:function(){return this.manager.mainViewSceneDir===this.attributes.displaySceneDir}},{key:"isDisableInput",get:function(){return!("disableDeviceInputs"in this.displayer)||this.displayer.disableDeviceInputs}}],[{key:"onCreate",value:function(t){e.emitter.emit("StartCreate"),e.emitter.emit("OnCreate",t),e.emitter.emit("created")}}]),e}(),Sb=Mb;Sb.kind="IframeBridge",Sb.hiddenClass="netless-iframe-brdige-hidden",Sb.emitter=new Q.default,Sb.displayer=null,Sb.alreadyCreate=!1;var Eb=new xo({emitter:ue}),Ab=function(e){s(b,e);var t,n,r,i,o,a,l,c,h,d,f,p,v,m=u(b);function b(e){var t;return y(this,b),(t=m.call(this,e)).version="0.4.66-beta.0",t.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.2.27",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^0.1.5",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.17","@netless/app-media-player":"0.1.0-beta.5","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",jspdf:"^2.5.1",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3",vitest:"^0.14.1","white-web-sdk":"2.16.43"}},t.emitter=ae,t.viewMode=B.ViewMode.Broadcaster,t.isReplay=B.isPlayer(t.displayer),t.containerSizeRatio=b.containerSizeRatio,b.displayer=e.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.2.27",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^0.1.5",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.17","@netless/app-media-player":"0.1.0-beta.5","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",jspdf:"^2.5.1",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3",vitest:"^0.14.1","white-web-sdk":"2.16.43"}},t}return x(b,[{key:"bindContainer",value:function(e){var t,n,r,i,o,a;if(B.isRoom(this.displayer)&&this.room.phase!==B.RoomPhase.Connected)throw new Ge;if(b.isCreated&&b.container)b.container.firstChild&&e.appendChild(b.container.firstChild);else if(b.params){var s=b.params,u=b.initContainer(this,e,s);this.boxManager&&this.boxManager.destroy();var l=function(e,t,n,r,i){return new Ii({safeSetAttributes:function(t){return e.safeSetAttributes(t)},getMainView:function(){return e.mainView},updateAppState:function(){var t,n;return null==(n=e.appManager)?void 0:(t=n.store).updateAppState.apply(t,arguments)},canOperate:function(){return e.canOperate},notifyContainerRectUpdate:function(t){var n;return null==(n=e.appManager)?void 0:n.notifyContainerRectUpdate(t)},cleanFocus:function(){var t;return null==(t=e.appManager)?void 0:t.store.cleanFocus()},setAppFocus:function(t){var n;return null==(n=e.appManager)?void 0:n.store.setAppFocus(t,!0)},callbacks:t,emitter:n,boxEmitter:r},i)}(this,ae,ue,rt,{collectorContainer:s.collectorContainer,collectorStyles:s.collectorStyles,prefersColorScheme:s.prefersColorScheme});this.boxManager=l,null==(t=this.appManager)||t.setBoxManager(l),this.bindMainView(u,s.disableCameraTransform),b.wrapper&&(null==(n=this.cursorManager)||n.setupWrapper(b.wrapper))}ue.emit("updateManagerRect"),null==(r=this.appManager)||r.refresh(),null==(i=this.appManager)||i.resetMaximized(),null==(o=this.appManager)||o.resetMinimized(),null==(a=this.appManager)||a.displayerWritableListener(!this.room.isWritable),b.container=e}},{key:"bindCollectorContainer",value:function(e){b.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(e):b.params&&(b.params.collectorContainer=e)}},{key:"addApp",value:(v=g(regeneratorRuntime.mark((function e(t){var n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=2;break}return e.abrupt("return",this.appManager.rootDirRemoving?new Promise((function(e,r){ue.once("rootDirRemoved").then(g(regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,n._addApp(t);case 3:o=i.sent,e(o),i.next=10;break;case 7:i.prev=7,i.t0=i.catch(0),r(i.t0.message);case 10:case"end":return i.stop()}}),i,null,[[0,7]])}))))})):this._addApp(t));case 2:throw new Le;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"_addApp",value:(p=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=20;break}if(t.kind&&"string"==typeof t.kind){e.next=3;break}throw new Be;case 3:return e.next=5,null==(n=xe.appClasses.get(t.kind))?void 0:n();case 5:if(!((o=e.sent)&&(null==(r=o.config)?void 0:r.singleton)&&this.appManager.appProxies.has(t.kind))){e.next=8;break}throw new Oe;case 8:if(void 0!==(a=this.setupScenePath(t,this.appManager))){e.next=13;break}e.t0=void 0,e.next=17;break;case 13:return null!=(i=null==t?void 0:t.options)&&i.scenePath&&(t.options.scenePath=Ce(t.options.scenePath)),e.next=16,this.appManager.addApp(t,Boolean(a));case 16:e.t0=e.sent;case 17:return e.abrupt("return",e.t0);case 20:throw new Le;case 21:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"setupScenePath",value:function(e,t){var n=!1;if(e.options){var r=e.options,i=r.scenePath,o=r.scenes;if(i){if(!function(e){return e.startsWith("/")}(i))throw new Fe;for(var a=0,s=Object.keys(this.apps||{});a0&&(this.isDynamicPPT(o)?(n=!0,Ee(this.displayer)[i]||Ae(this.room,i,o)):Ee(this.displayer)[i]||Ae(this.room,i,[{name:o[0].name}])),i&&void 0===o&&Ae(this.room,i,[{}])}return n}},{key:"setMainViewScenePath",value:(f=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.appManager,!e.t0){e.next=4;break}return e.next=4,this.appManager.setMainViewScenePath(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"setMainViewSceneIndex",value:(d=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.appManager,!e.t0){e.next=4;break}return e.next=4,this.appManager.setMainViewSceneIndex(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"nextPage",value:(h=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=12;break}if(!((t=this.mainViewSceneIndex+1)>=this.mainViewScenesLength)){e.next=6;break}e.t0=(console.warn("[WindowManager]: current page is the last page"),!1),e.next=9;break;case 6:return e.next=8,this.appManager.setMainViewSceneIndex(t);case 8:e.t0=!0;case 9:return e.abrupt("return",e.t0);case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"prevPage",value:(c=g(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=12;break}if(!((t=this.mainViewSceneIndex-1)<0)){e.next=6;break}e.t0=(console.warn("[WindowManager]: current page is the first page"),!1),e.next=9;break;case 6:return e.next=8,this.appManager.setMainViewSceneIndex(t);case 8:e.t0=!0;case 9:return e.abrupt("return",e.t0);case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"jumpPage",value:(l=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=11;break}if(!(t<0||t>=this.pageState.length)){e.next=5;break}e.t1=(console.warn("[WindowManager]: index ".concat(t," out of range")),!1),e.next=8;break;case 5:return e.next=7,this.appManager.setMainViewSceneIndex(t);case 7:e.t1=!0;case 8:e.t0=e.t1,e.next=12;break;case 11:e.t0=!1;case 12:return e.abrupt("return",e.t0);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"addPage",value:(a=g(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.appManager&&(n=null==t?void 0:t.after,r=null==t?void 0:t.scene,n?(i=this.mainViewSceneIndex+1,this.room.putScenes(ie,[r||{}],i)):this.room.putScenes(ie,[r||{}]));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"removePage",value:(o=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.appManager){e.next=5;break}return n=void 0===t?this.pageState.index:t,e.abrupt("return",1===this.pageState.length?(console.warn("[WindowManager]: can not remove the last page"),!1):n<0||n>=this.pageState.length?(console.warn("[WindowManager]: index ".concat(t," out of range")),!1):this.appManager.removeSceneByIndex(n));case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getMainViewScenePath",value:function(){var e;return null==(e=this.appManager)?void 0:e.store.getMainViewScenePath()}},{key:"getMainViewSceneIndex",value:function(){var e;return null==(e=this.appManager)?void 0:e.store.getMainViewSceneIndex()}},{key:"setReadonly",value:function(e){var t;this.readonly=e,null==(t=this.boxManager)||t.setReadonly(e),ue.emit("setReadonly",e)}},{key:"switchMainViewToWriter",value:function(){var e;return null==(e=this.appManager)?void 0:e.mainViewProxy.mainViewClickHandler()}},{key:"onAppDestroy",value:function(e,t){!function(e,t){ue.once(e).then(t)}("destroy-".concat(e),t)}},{key:"onAppEvent",value:function(e,t){return ue.on("custom-".concat(e),t)}},{key:"setViewMode",value:function(e){var t,n,r,i;(e===B.ViewMode.Broadcaster||e===B.ViewMode.Follower)&&(this.canOperate&&e===B.ViewMode.Broadcaster&&(null==(t=this.appManager)||t.mainViewProxy.setCameraAndSize()),null==(n=this.appManager)||n.mainViewProxy.start()),e===B.ViewMode.Freedom&&(null==(r=this.appManager)||r.mainViewProxy.stop()),this.viewMode=e,null==(i=this.appManager)||i.mainViewProxy.setViewMode(e)}},{key:"setBoxState",value:function(e){if(this.canOperate)switch(e){case"normal":this.setMaximized(!1),this.setMinimized(!1);break;case"maximized":this.setMaximized(!0),this.setMinimized(!1);break;case"minimized":this.setMinimized(!0)}}},{key:"setMaximized",value:function(e){var t;!this.canOperate||null==(t=this.boxManager)||t.setMaximized(e,!1)}},{key:"setMinimized",value:function(e){var t;!this.canOperate||null==(t=this.boxManager)||t.setMinimized(e,!1)}},{key:"setFullscreen",value:function(e){var t;this._fullscreen!==e&&(this._fullscreen=e,null==(t=b.sizer)||t.classList.toggle("netless-window-manager-fullscreen",e),ae.emit("fullscreenChange",e))}},{key:"queryAll",value:function(){var e;return Array.from((null==(e=this.appManager)?void 0:e.appProxies.values())||[])}},{key:"queryOne",value:function(e){var t;return null==(t=this.appManager)?void 0:t.appProxies.get(e)}},{key:"closeApp",value:(i=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null==(n=this.appManager)?void 0:n.closeApp(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"focusApp",value:function(e){var t,n,r,i=null==(t=this.boxManager)?void 0:t.getBox(e);i&&(null==(n=this.boxManager)||n.focusBox({appId:e},!1),(null==(r=this.boxManager)?void 0:r.teleBoxManager).makeBoxTop(i,!1))}},{key:"moveCamera",value:function(e){var t,n=this,r=j.omit(e,["animationMode"]),i=P({},this.mainView.camera);j.isEqual(P(P({},i),r),i)||(this.mainView.moveCamera(e),null==(t=this.appManager)||t.dispatchInternalEvent(q.MoveCamera,e),setTimeout((function(){var e;null==(e=n.appManager)||e.mainViewProxy.setCameraAndSize()}),500))}},{key:"moveCameraToContain",value:function(e){var t,n=this;this.mainView.moveCameraToContain(e),null==(t=this.appManager)||t.dispatchInternalEvent(q.MoveCameraToContain,e),setTimeout((function(){var e;null==(e=n.appManager)||e.mainViewProxy.setCameraAndSize()}),500)}},{key:"convertToPointInWorld",value:function(e){return this.mainView.convertToPointInWorld(e)}},{key:"setCameraBound",value:function(e){this.mainView.setCameraBound(e)}},{key:"onDestroy",value:function(){this._destroy()}},{key:"destroy",value:function(){this._destroy()}},{key:"_destroy",value:function(){var e,t,n,r,i;null==(e=this.containerResizeObserver)||e.disconnect(),null==(t=this.appManager)||t.destroy(),null==(n=this.cursorManager)||n.destroy(),b.container=void 0,b.wrapper=void 0,b.sizer=void 0,b.isCreated=!1,b.playground&&(null==(r=b.playground.parentNode)||r.removeChild(b.playground)),b.params=void 0,null==(i=this._iframeBridge)||i.destroy(),this._iframeBridge=void 0,tt("Destroyed")}},{key:"bindMainView",value:function(e,t){var n;this.appManager&&(this.appManager.bindMainView(e,Boolean(t)),null==(n=this.cursorManager)||n.setMainViewDivElement(e))}},{key:"safeSetAttributes",value:function(e){this.canOperate&&this.setAttributes(e)}},{key:"safeUpdateAttributes",value:function(e,t){this.canOperate&&this.updateAttributes(e,t)}},{key:"setPrefersColorScheme",value:function(e){var t,n;null==(n=null==(t=this.appManager)?void 0:t.boxManager)||n.setPrefersColorScheme(e)}},{key:"cleanCurrentScene",value:function(){var e;tt("clean current scene"),null==(e=this.focusedView)||e.cleanCurrentScene()}},{key:"redo",value:function(){var e;return(null==(e=this.focusedView)?void 0:e.redo())||0}},{key:"undo",value:function(){var e;return(null==(e=this.focusedView)?void 0:e.undo())||0}},{key:"delete",value:function(){var e;null==(e=this.focusedView)||e.delete()}},{key:"copy",value:function(){var e;null==(e=this.focusedView)||e.copy()}},{key:"paste",value:function(){var e;null==(e=this.focusedView)||e.paste()}},{key:"duplicate",value:function(){var e;null==(e=this.focusedView)||e.duplicate()}},{key:"insertText",value:function(e,t,n){var r;return(null==(r=this.focusedView)?void 0:r.insertText(e,t,n))||""}},{key:"insertImage",value:function(e){var t;return null==(t=this.focusedView)?void 0:t.insertImage(e)}},{key:"completeImageUpload",value:function(e,t){var n;return null==(n=this.focusedView)?void 0:n.completeImageUpload(e,t)}},{key:"lockImage",value:function(e,t){var n;return null==(n=this.focusedView)?void 0:n.lockImage(e,t)}},{key:"lockImages",value:function(e){var t;return null==(t=this.focusedView)?void 0:t.lockImages(e)}},{key:"refresh",value:function(){var e;this._refresh(),null==(e=this.appManager)||e.dispatchInternalEvent(q.Refresh)}},{key:"_refresh",value:function(){var e,t,n;null==(e=this.appManager)||e.mainViewProxy.rebind(),b.container&&this.bindContainer(b.container),null==(n=null==(t=this.appManager)?void 0:t.refresher)||n.refresh()}},{key:"setContainerSizeRatio",value:function(e){if(!(j.isNumber(e)&&e>0))throw new Error("[WindowManager]: updateContainerSizeRatio error, ratio must be a positive number. but got ".concat(e));b.containerSizeRatio=e,this.containerSizeRatio=e,ue.emit("containerSizeRatioUpdate",e)}},{key:"isDynamicPPT",value:function(e){var t,n,r=null==(n=null==(t=e[0])?void 0:t.ppt)?void 0:n.src;return null==r?void 0:r.startsWith("pptx://")}},{key:"ensureAttributes",value:(r=g(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=j.isNull(this.attributes),!e.t0){e.next=4;break}return e.next=4,ke(50);case 4:j.isObject(this.attributes)&&(this.attributes[$e.Apps]||this.safeSetAttributes(w({},$e.Apps,{})),this.attributes[$e.Cursors]||this.safeSetAttributes(w({},$e.Cursors,{})),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:oe}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[$e.Registered]||this.safeSetAttributes(w({},$e.Registered,{})),this.attributes[$e.IframeBridge]||this.safeSetAttributes(w({},$e.IframeBridge,{})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getIframeBridge",value:function(){if(!this.appManager)throw new Error("[WindowManager]: should call getIframeBridge() after await mount()");return this._iframeBridge||(this._iframeBridge=new Sb(this,this.appManager)),this._iframeBridge}},{key:"mainView",get:function(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new Le}},{key:"camera",get:function(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new Le}},{key:"cameraState",get:function(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new Le}},{key:"apps",get:function(){var e;return null==(e=this.appManager)?void 0:e.store.apps()}},{key:"boxState",get:function(){var e;if(this.appManager)return null==(e=this.appManager.boxManager)?void 0:e.boxState;throw new Le}},{key:"darkMode",get:function(){var e,t;return Boolean(null==(t=null==(e=this.appManager)?void 0:e.boxManager)?void 0:t.darkMode)}},{key:"prefersColorScheme",get:function(){var e;if(this.appManager)return null==(e=this.appManager.boxManager)?void 0:e.prefersColorScheme;throw new Le}},{key:"focused",get:function(){return this.attributes.focus}},{key:"focusedView",get:function(){var e,t;return(null==(t=null==(e=this.appManager)?void 0:e.focusApp)?void 0:t.view)||this.mainView}},{key:"mainViewSceneIndex",get:function(){var e;return(null==(e=this._pageState)?void 0:e.index)||0}},{key:"mainViewSceneDir",get:function(){var e;if(this.appManager)return null==(e=this.appManager)?void 0:e.getMainViewSceneDir();throw new Le}},{key:"topApp",get:function(){var e,t;return null==(t=null==(e=this.boxManager)?void 0:e.getTopBox())?void 0:t.id}},{key:"mainViewScenesLength",get:function(){var e;return(null==(e=this._pageState)?void 0:e.length)||0}},{key:"canRedoSteps",get:function(){var e;return(null==(e=this.focusedView)?void 0:e.canRedoSteps)||0}},{key:"canUndoSteps",get:function(){var e;return(null==(e=this.focusedView)?void 0:e.canUndoSteps)||0}},{key:"sceneState",get:function(){if(this.appManager)return this.appManager.sceneState;throw new Le}},{key:"pageState",get:function(){if(this._pageState)return this._pageState.toObject();throw new Le}},{key:"fullscreen",get:function(){return Boolean(this._fullscreen)}},{key:"canOperate",get:function(){return!!B.isRoom(this.displayer)&&(this.displayer.isWritable&&this.displayer.phase===B.RoomPhase.Connected)}},{key:"room",get:function(){return this.displayer}}],[{key:"mount",value:(n=g(regeneratorRuntime.mark((function e(t){var n,r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.room,b.container=t.container,r=t.containerSizeRatio,i=t.debug,o=t.cursor,b.params=t,b.displayer=t.room,ht(),!B.isRoom(n)){e.next=11;break}if(n.phase===B.RoomPhase.Connected){e.next=7;break}throw new Error("[WindowManager]: Room only Connected can be mount");case 7:return n.phase===B.RoomPhase.Connected&&n.isWritable&&(n.disableSerialization=!1),e.next=10,this.initManager(n);case 10:a=e.sent;case 11:if(!b.isCreated){e.next=13;break}throw new Error("[WindowManager]: Already created cannot be created again");case 13:if(this.debug=Boolean(i),tt("Already insert room",a),!B.isRoom(this.displayer)){e.next=18;break}if(a){e.next=16;break}throw new Error("[WindowManager]: init InvisiblePlugin failed");case 16:e.next=20;break;case 18:return e.next=20,X.default(function(){var e=g(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getInvisiblePlugin(b.kind);case 2:if(a=e.sent){e.next=5;break}throw tt("manager is empty. retrying ".concat(t)),new Error;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),{retries:10,maxTimeout:5e3});case 20:if(a){e.next=22;break}throw new Error("[WindowManager]: create manager failed");case 22:return r&&(b.containerSizeRatio=r),e.next=25,a.ensureAttributes();case 25:return a._fullscreen=t.fullscreen,a.appManager=new ct(a),a._pageState=new bo(a.appManager),a.cursorManager=new yo(a.appManager,Boolean(o),t.applianceIcons),r&&(a.containerSizeRatio=r),t.container&&a.bindContainer(t.container),_o(n,a),ue.emit("onCreated"),b.isCreated=!0,e.prev=34,e.next=37,le();case 37:e.next=42;break;case 39:e.prev=39,e.t0=e.catch(34),console.warn("[WindowManager]: indexedDB open failed"),console.log(e.t0);case 42:return e.abrupt("return",a);case 43:case"end":return e.stop()}}),e,this,[[34,39]])}))),function(e){return n.apply(this,arguments)})},{key:"initManager",value:(t=g(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.getInvisiblePlugin(b.kind))||!B.isRoom(t)){e.next=24;break}if(!1!==t.isWritable){e.next=21;break}return e.prev=3,e.next=6,t.setWritable(!0);case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),new Error("[WindowManger]: room must be switched to be writable");case 11:return e.next=13,ft(t);case 13:return null==(n=e.sent)||n.ensureAttributes(),e.next=17,ke(500);case 17:return e.next=19,t.setWritable(!1);case 19:e.next=24;break;case 21:return e.next=23,ft(t);case 23:n=e.sent;case 24:return e.abrupt("return",n);case 25:case"end":return e.stop()}}),e,null,[[3,8]])}))),function(e){return t.apply(this,arguments)})},{key:"initContainer",value:function(e,t,n){var r=n.chessboard,i=n.overwriteStyles,o=n.fullscreen;b.container||(b.container=t);var a=function(e){var t=document.createElement("div");t.className="netless-window-manager-playground";var n=document.createElement("div");n.className="netless-window-manager-sizer";var r=document.createElement("div");r.className="netless-window-manager-wrapper";var i=document.createElement("div");return i.className="netless-window-manager-main-view",t.appendChild(n),n.appendChild(r),r.appendChild(i),e.appendChild(t),Ib.wrapper=r,{playground:t,wrapper:r,sizer:n,mainViewElement:i}}(t),s=a.playground,u=a.wrapper,l=a.sizer,c=a.mainViewElement;if(b.playground=s,r&&l.classList.add("netless-window-manager-chess-sizer"),o&&l.classList.add("netless-window-manager-fullscreen"),i){var h=document.createElement("style");h.textContent=i,s.appendChild(h)}return e.containerResizeObserver=vt.create(s,l,u,ue),b.wrapper=u,b.sizer=l,c}},{key:"register",value:function(e){return xe.register(e)}},{key:"unregister",value:function(e){return xe.unregister(e)}},{key:"registered",get:function(){return xe.registered}}]),b}(B.InvisiblePlugin),Ib=Ab;Ib.kind="WindowManager",Ib.debug=!1,Ib.containerSizeRatio=9/16,Ib.isCreated=!1,Ib.debug&&function(e){Oy=ky(ky({},Py),e)}({verbose:!0}),Ib.register({kind:wu.kind,src:wu}),Ib.register({kind:db.kind,src:db}),t.AppCreateError=Oe,t.AppManagerNotInitError=Le,t.AppNotRegisterError=Re,t.BindContainerRoomPhaseInvalidError=Ge,t.BoxManagerNotFoundError=ze,t.BoxNotCreatedError=Ue,t.BuiltinApps=fb,t.DomEvents=vb,t.IframeBridge=Sb,t.IframeEvents=pb,t.InvalidScenePath=Fe,t.ParamsInvalidError=Be,t.WhiteWebSDKInvalidError=je,t.WindowManager=Ib,t.calculateNextIndex=nt,t.reconnectRefresher=Eb},6513:function(e,t,n){var r=n(49766).Buffer;function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}Object.defineProperty(t,"__esModule",{value:!0}),t.xml2json=t.xml2js=t.json2xml=t.js2xml=void 0;var a=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},s=[],u=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,c=!1;function h(){c=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}function f(e){var t;c||h();for(var n=e.length,r=n%3,i="",o=[],a=16383,u=0,l=n-r;ul?l:u+a));return 1===r?(t=e[n-1],i+=s[t>>2],i+=s[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=s[t>>10],i+=s[t>>4&63],i+=s[t<<2&63],i+="="),o.push(i),o.join("")}function p(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,c=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+h],h+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+h],h+=d,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=l}return(f?-1:1)*a*Math.pow(2,o-r)}function v(e,t,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;e[n+f]=255&a,f+=p,a/=256,l-=8);e[n+f-p]|=128*v}var m={}.toString,g=Array.isArray||function(e){return"[object Array]"==m.call(e)};function y(){return x.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function b(e,t){if(y()=y())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y().toString(16)+" bytes");return 0|e}function E(e){return!(null==e||!e._isBuffer)}function A(e,t){if(E(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ee(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return te(e).length;default:if(r)return ee(e).length;t=(""+t).toLowerCase(),r=!0}}function I(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return H(this,t,n);case"utf8":case"utf-8":return U(this,t,n);case"ascii":return z(this,t,n);case"latin1":case"binary":return G(this,t,n);case"base64":return B(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function C(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function N(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=x.from(t,r)),E(t))return 0===t.length?-1:k(e,t,n,r,i);if("number"==typeof t)return t&=255,x.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function k(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function B(e,t,n){return 0===t&&n===e.length?f(e):f(e.slice(t,n))}function U(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(e){var t=e.length;if(t<=F)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},x.prototype.compare=function(e,t,n,r,i){if(!E(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n),c=0;ci)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return D(this,e,t,n);case"utf8":case"utf-8":return P(this,e,t,n);case"ascii":return O(this,e,t,n);case"latin1":case"binary":return R(this,e,t,n);case"base64":return L(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},x.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var F=4096;function z(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function Y(e,t,n,r,i,o){if(!E(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function X(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function Q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function Z(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function q(e,t,n,r,i){return i||Z(e,0,n,4),v(e,t,n,r,23,4),n+4}function J(e,t,n,r,i){return i||Z(e,0,n,8),v(e,t,n,r,52,8),n+8}x.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},x.prototype.readUInt8=function(e,t){return t||W(e,1,this.length),this[e]},x.prototype.readUInt16LE=function(e,t){return t||W(e,2,this.length),this[e]|this[e+1]<<8},x.prototype.readUInt16BE=function(e,t){return t||W(e,2,this.length),this[e]<<8|this[e+1]},x.prototype.readUInt32LE=function(e,t){return t||W(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},x.prototype.readUInt32BE=function(e,t){return t||W(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},x.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||W(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},x.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||W(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},x.prototype.readInt8=function(e,t){return t||W(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},x.prototype.readInt16LE=function(e,t){t||W(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},x.prototype.readInt16BE=function(e,t){t||W(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},x.prototype.readInt32LE=function(e,t){return t||W(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},x.prototype.readInt32BE=function(e,t){return t||W(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},x.prototype.readFloatLE=function(e,t){return t||W(e,4,this.length),p(this,e,!0,23,4)},x.prototype.readFloatBE=function(e,t){return t||W(e,4,this.length),p(this,e,!1,23,4)},x.prototype.readDoubleLE=function(e,t){return t||W(e,8,this.length),p(this,e,!0,52,8)},x.prototype.readDoubleBE=function(e,t){return t||W(e,8,this.length),p(this,e,!1,52,8)},x.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||Y(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},x.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,1,255,0),x.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},x.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,65535,0),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},x.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,65535,0),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},x.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,4294967295,0),x.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Q(this,e,t,!0),t+4},x.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,4294967295,0),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Q(this,e,t,!1),t+4},x.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Y(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},x.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Y(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},x.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,1,127,-128),x.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},x.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,32767,-32768),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},x.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,2,32767,-32768),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},x.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,2147483647,-2147483648),x.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Q(this,e,t,!0),t+4},x.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),x.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Q(this,e,t,!1),t+4},x.prototype.writeFloatLE=function(e,t,n){return q(this,e,t,!0,n)},x.prototype.writeFloatBE=function(e,t,n){return q(this,e,t,!1,n)},x.prototype.writeDoubleLE=function(e,t,n){return J(this,e,t,!0,n)},x.prototype.writeDoubleBE=function(e,t,n){return J(this,e,t,!1,n)},x.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!x.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function te(e){return function(e){var t,n,r,i,o,a;c||h();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new l(3*s/4-o),r=o>0?s-4:s;var d=0;for(t=0,n=0;t>16&255,a[d++]=i>>8&255,a[d++]=255&i;return 2===o?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,a[d++]=255&i):1===o&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,a[d++]=i>>8&255,a[d++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ne(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function re(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ie={};function oe(){}function ae(){ae.init.call(this)}function se(e){return void 0===e._maxListeners?ae.defaultMaxListeners:e._maxListeners}function ue(e,t,n){if(t)e.call(n);else for(var r=e.length,i=me(e,r),o=0;o0&&a.length>i){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function pe(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function ve(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function me(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}function ge(){throw new Error("setTimeout has not been defined")}function ye(){throw new Error("clearTimeout has not been defined")}oe.prototype=Object.create(null),ae.EventEmitter=ae,ae.usingDomains=!1,ae.prototype.domain=void 0,ae.prototype._events=void 0,ae.prototype._maxListeners=void 0,ae.defaultMaxListeners=10,ae.init=function(){this.domain=null,ae.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new oe,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ae.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ae.prototype.getMaxListeners=function(){return se(this)},ae.prototype.emit=function(e){var t,n,r,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:ue(n,c,this);break;case 2:le(n,c,this,arguments[1]);break;case 3:ce(n,c,this,arguments[1],arguments[2]);break;case 4:he(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new oe,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r0?Reflect.ownKeys(this._events):[]};var be=ge,xe=ye;function _e(e){if(be===setTimeout)return setTimeout(e,0);if((be===ge||!be)&&setTimeout)return be=setTimeout,setTimeout(e,0);try{return be(e,0)}catch(t){try{return be.call(null,e,0)}catch(t){return be.call(this,e,0)}}}"function"==typeof a.setTimeout&&(be=setTimeout),"function"==typeof a.clearTimeout&&(xe=clearTimeout);var we,Te=[],Me=!1,Se=-1;function Ee(){Me&&we&&(Me=!1,we.length?Te=we.concat(Te):Se=-1,Te.length&&Ae())}function Ae(){if(!Me){var e=_e(Ee);Me=!0;for(var t=Te.length;t;){for(we=Te,Te=[];++Se1)for(var n=1;n=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),et(t)?n.showHidden=t:t&&ct(n,t),rt(n.showHidden)&&(n.showHidden=!1),rt(n.depth)&&(n.depth=2),rt(n.colors)&&(n.colors=!1),rt(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Ze),Je(n,e,n.depth)}function Ze(e,t){var n=Qe.styles[t];return n?"["+Qe.colors[n][0]+"m"+e+"["+Qe.colors[n][1]+"m":e}function qe(e,t){return e}function Je(e,t,n){if(e.customInspect&&t&&ut(t.inspect)&&t.inspect!==Qe&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return nt(r)||(r=Je(e,r,n)),r}var i=function(e,t){if(rt(t))return e.stylize("undefined","undefined");if(nt(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(r=t,"number"==typeof r)return e.stylize(""+t,"number");var r;if(et(t))return e.stylize(""+t,"boolean");if(tt(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),st(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Ke(t);if(0===o.length){if(ut(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(it(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(at(t))return e.stylize(Date.prototype.toString.call(t),"date");if(st(t))return Ke(t)}var u,l,c="",h=!1,d=["{","}"];(u=t,Array.isArray(u)&&(h=!0,d=["[","]"]),ut(t))&&(c=" [Function"+(t.name?": "+t.name:"")+"]");return it(t)&&(c=" "+RegExp.prototype.toString.call(t)),at(t)&&(c=" "+Date.prototype.toUTCString.call(t)),st(t)&&(c=" "+Ke(t)),0!==o.length||h&&0!=t.length?n<0?it(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=h?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,c,d)):d[0]+c+d[1]}function Ke(e){return"["+Error.prototype.toString.call(e)+"]"}function $e(e,t,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),ht(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=tt(n)?Je(e,u.value,null):Je(e,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),rt(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function et(e){return"boolean"==typeof e}function tt(e){return null===e}function nt(e){return"string"==typeof e}function rt(e){return void 0===e}function it(e){return ot(e)&&"[object RegExp]"===lt(e)}function ot(e){return"object"===i(e)&&null!==e}function at(e){return ot(e)&&"[object Date]"===lt(e)}function st(e){return ot(e)&&("[object Error]"===lt(e)||e instanceof Error)}function ut(e){return"function"==typeof e}function lt(e){return Object.prototype.toString.call(e)}function ct(e,t){if(!t||!ot(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function ht(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function dt(){this.head=null,this.tail=null,this.length=0}Qe.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Qe.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},dt.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},dt.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},dt.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},dt.prototype.clear=function(){this.head=this.tail=null,this.length=0},dt.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},dt.prototype.concat=function(e){if(0===this.length)return x.alloc(0);if(1===this.length)return this.head.data;for(var t=x.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var ft=x.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function pt(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!ft(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=mt;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=gt;break;default:return void(this.write=vt)}this.charBuffer=new x(6),this.charReceived=0,this.charLength=0}function vt(e){return e.toString(this.encoding)}function mt(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function gt(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}pt.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,r)}return t},pt.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},pt.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var yt=Object.freeze({__proto__:null,StringDecoder:pt});_t.ReadableState=xt;var bt=function(e){if(rt(Ye)&&(Ye=ze.env.NODE_DEBUG||""),e=e.toUpperCase(),!Xe[e])if(new RegExp("\\b"+e+"\\b","i").test(Ye)){Xe[e]=function(){var t=Ve.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else Xe[e]=function(){};return Xe[e]}("stream");function xt(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Zt&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new dt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new pt(e.encoding),this.encoding=e.encoding)}function _t(e){if(!(this instanceof _t))return new _t(e);this._readableState=new xt(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),ae.call(this)}function wt(e,t,n,r,i){var o=function(e,t){var n=null;x.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,St(e)}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&St(e))),function(e,t){t.readingMore||(t.readingMore=!0,Ie(At,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=Tt?e=Tt:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function St(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(bt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Ie(Et,e):Et(e))}function Et(e){bt("emit readable"),e.emit("readable"),Nt(e)}function At(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=x.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0===(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function Dt(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Ie(Pt,t,e))}function Pt(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Ot(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return bt("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Dt(this):St(this),null;if(0===(e=Mt(e,t))&&t.ended)return 0===t.length&&Dt(this),null;var r,i=t.needReadable;return bt("need readable",i),(0===t.length||t.length-e0?kt(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Dt(this)),null!==r&&this.emit("data",r),r},_t.prototype._read=function(e){this.emit("error",new Error("not implemented"))},_t.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,bt("pipe count=%d opts=%j",r.pipesCount,t);var i=!t||!1!==t.end?a:l;function o(e){bt("onunpipe"),e===n&&l()}function a(){bt("onend"),e.end()}r.endEmitted?Ie(i):n.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;bt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,Nt(e))}}(n);e.on("drain",s);var u=!1;function l(){bt("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",d),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",l),n.removeListener("data",h),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var c=!1;function h(t){bt("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==Ot(r.pipes,e))&&!u&&(bt("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function d(t){var n;bt("onerror",t),v(),e.removeListener("error",d),0===(n="error",e.listeners(n).length)&&e.emit("error",t)}function f(){e.removeListener("finish",p),v()}function p(){bt("onfinish"),e.removeListener("close",f),v()}function v(){bt("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",n),r.flowing||(bt("pipe resume"),n.resume()),e},_t.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Bt.prototype._write=function(e,t,n){n(new Error("not implemented"))},Bt.prototype._writev=null,Bt.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,Vt(e,t),n&&(t.finished?Ie(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Ge(Zt,_t);for(var Yt=Object.keys(Bt.prototype),Xt=0;Xt"===a?(E(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=T.TEXT):v(a)?(r.state=T.SGML_DECL_QUOTED,r.sgmlDecl+=a):r.sgmlDecl+=a;continue;case T.SGML_DECL_QUOTED:a===r.q&&(r.state=T.SGML_DECL,r.q=""),r.sgmlDecl+=a;continue;case T.DOCTYPE:">"===a?(r.state=T.TEXT,E(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=a,"["===a?r.state=T.DOCTYPE_DTD:v(a)&&(r.state=T.DOCTYPE_QUOTED,r.q=a));continue;case T.DOCTYPE_QUOTED:r.doctype+=a,a===r.q&&(r.q="",r.state=T.DOCTYPE);continue;case T.DOCTYPE_DTD:r.doctype+=a,"]"===a?r.state=T.DOCTYPE:v(a)&&(r.state=T.DOCTYPE_DTD_QUOTED,r.q=a);continue;case T.DOCTYPE_DTD_QUOTED:r.doctype+=a,a===r.q&&(r.state=T.DOCTYPE_DTD,r.q="");continue;case T.COMMENT:"-"===a?r.state=T.COMMENT_ENDING:r.comment+=a;continue;case T.COMMENT_ENDING:"-"===a?(r.state=T.COMMENT_ENDED,r.comment=I(r.opt,r.comment),r.comment&&E(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+a,r.state=T.COMMENT);continue;case T.COMMENT_ENDED:">"!==a?(k(r,"Malformed comment"),r.comment+="--"+a,r.state=T.COMMENT):r.state=T.TEXT;continue;case T.CDATA:"]"===a?r.state=T.CDATA_ENDING:r.cdata+=a;continue;case T.CDATA_ENDING:"]"===a?r.state=T.CDATA_ENDING_2:(r.cdata+="]"+a,r.state=T.CDATA);continue;case T.CDATA_ENDING_2:">"===a?(r.cdata&&E(r,"oncdata",r.cdata),E(r,"onclosecdata"),r.cdata="",r.state=T.TEXT):"]"===a?r.cdata+="]":(r.cdata+="]]"+a,r.state=T.CDATA);continue;case T.PROC_INST:"?"===a?r.state=T.PROC_INST_ENDING:p(a)?r.state=T.PROC_INST_BODY:r.procInstName+=a;continue;case T.PROC_INST_BODY:if(!r.procInstBody&&p(a))continue;"?"===a?r.state=T.PROC_INST_ENDING:r.procInstBody+=a;continue;case T.PROC_INST_ENDING:">"===a?(E(r,"onprocessinginstruction",{name:r.procInstName,body:r.procInstBody}),r.procInstName=r.procInstBody="",r.state=T.TEXT):(r.procInstBody+="?"+a,r.state=T.PROC_INST_BODY);continue;case T.OPEN_TAG:g(h,a)?r.tagName+=a:(D(r),">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:(p(a)||k(r,"Invalid character in tag name"),r.state=T.ATTRIB));continue;case T.OPEN_TAG_SLASH:">"===a?(R(r,!0),L(r)):(k(r,"Forward-slash in opening tag not followed by >"),r.state=T.ATTRIB);continue;case T.ATTRIB:if(p(a))continue;">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:g(c,a)?(r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):k(r,"Invalid attribute name");continue;case T.ATTRIB_NAME:"="===a?r.state=T.ATTRIB_VALUE:">"===a?(k(r,"Attribute without value"),r.attribValue=r.attribName,O(r),R(r)):p(a)?r.state=T.ATTRIB_NAME_SAW_WHITE:g(h,a)?r.attribName+=a:k(r,"Invalid attribute name");continue;case T.ATTRIB_NAME_SAW_WHITE:if("="===a)r.state=T.ATTRIB_VALUE;else{if(p(a))continue;k(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",E(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",">"===a?R(r):g(c,a)?(r.attribName=a,r.state=T.ATTRIB_NAME):(k(r,"Invalid attribute name"),r.state=T.ATTRIB)}continue;case T.ATTRIB_VALUE:if(p(a))continue;v(a)?(r.q=a,r.state=T.ATTRIB_VALUE_QUOTED):(k(r,"Unquoted attribute value"),r.state=T.ATTRIB_VALUE_UNQUOTED,r.attribValue=a);continue;case T.ATTRIB_VALUE_QUOTED:if(a!==r.q){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=a;continue}O(r),r.q="",r.state=T.ATTRIB_VALUE_CLOSED;continue;case T.ATTRIB_VALUE_CLOSED:p(a)?r.state=T.ATTRIB:">"===a?R(r):"/"===a?r.state=T.OPEN_TAG_SLASH:g(c,a)?(k(r,"No whitespace between attributes"),r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):k(r,"Invalid attribute name");continue;case T.ATTRIB_VALUE_UNQUOTED:if(!m(a)){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_U:r.attribValue+=a;continue}O(r),">"===a?R(r):r.state=T.ATTRIB;continue;case T.CLOSE_TAG:if(r.tagName)">"===a?L(r):g(h,a)?r.tagName+=a:r.script?(r.script+=""===a?L(r):k(r,"Invalid characters in closing tag");continue;case T.TEXT_ENTITY:case T.ATTRIB_VALUE_ENTITY_Q:case T.ATTRIB_VALUE_ENTITY_U:var l,b;switch(r.state){case T.TEXT_ENTITY:l=T.TEXT,b="textNode";break;case T.ATTRIB_VALUE_ENTITY_Q:l=T.ATTRIB_VALUE_QUOTED,b="attribValue";break;case T.ATTRIB_VALUE_ENTITY_U:l=T.ATTRIB_VALUE_UNQUOTED,b="attribValue"}";"===a?(r[b]+=j(r),r.entity="",r.state=l):g(r.entity.length?f:d,a)?r.entity+=a:(k(r,"Invalid character in entity name"),r[b]+="&"+r.entity+a,r.entity="",r.state=l);continue;default:throw new Error(r,"Unknown state: "+r.state)}r.position>=r.bufferCheckPosition&&function(t){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,o=0,a=n.length;or)switch(n[o]){case"textNode":A(t);break;case"cdata":E(t,"oncdata",t.cdata),t.cdata="";break;case"script":E(t,"onscript",t.script),t.script="";break;default:C(t,"Max buffer length exceeded: "+n[o])}i=Math.max(i,s)}var u=e.MAX_BUFFER_LENGTH-i;t.bufferCheckPosition=u+t.position}(r);return r} /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var e;A(e=this),""!==e.cdata&&(E(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(E(e,"onscript",e.script),e.script="")}};try{t=rn.Stream}catch(e){t=function(){}}var o=e.EVENTS.filter((function(e){return"error"!==e&&"end"!==e}));function a(e,n){if(!(this instanceof a))return new a(e,n);t.apply(this),this._parser=new r(e,n),this.writable=!0,this.readable=!0;var i=this;this._parser.onend=function(){i.emit("end")},this._parser.onerror=function(e){i.emit("error",e),i._parser.error=null},this._decoder=null,o.forEach((function(e){Object.defineProperty(i,"on"+e,{get:function(){return i._parser["on"+e]},set:function(t){if(!t)return i.removeAllListeners(e),i._parser["on"+e]=t,t;i.on(e,t)},enumerable:!0,configurable:!1})}))}a.prototype=Object.create(t.prototype,{constructor:{value:a}}),a.prototype.write=function(e){if("function"==typeof x.isBuffer&&x.isBuffer(e)){if(!this._decoder){var t=on.StringDecoder;this._decoder=new t("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},a.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},a.prototype.on=function(e,n){var r=this;return r._parser["on"+e]||-1===o.indexOf(e)||(r._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),r.emit.apply(r,t)}),t.prototype.on.call(r,e,n)};var s="http://www.w3.org/XML/1998/namespace",u="http://www.w3.org/2000/xmlns/",l={xml:s,xmlns:u},c=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,h=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,d=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,f=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function p(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function v(e){return'"'===e||"'"===e}function m(e){return">"===e||p(e)}function g(e,t){return e.test(t)}function y(e,t){return!g(e,t)}var b,_,w,T=0;for(var M in e.STATE={BEGIN:T++,BEGIN_WHITESPACE:T++,TEXT:T++,TEXT_ENTITY:T++,OPEN_WAKA:T++,SGML_DECL:T++,SGML_DECL_QUOTED:T++,DOCTYPE:T++,DOCTYPE_QUOTED:T++,DOCTYPE_DTD:T++,DOCTYPE_DTD_QUOTED:T++,COMMENT_STARTING:T++,COMMENT:T++,COMMENT_ENDING:T++,COMMENT_ENDED:T++,CDATA:T++,CDATA_ENDING:T++,CDATA_ENDING_2:T++,PROC_INST:T++,PROC_INST_BODY:T++,PROC_INST_ENDING:T++,OPEN_TAG:T++,OPEN_TAG_SLASH:T++,ATTRIB:T++,ATTRIB_NAME:T++,ATTRIB_NAME_SAW_WHITE:T++,ATTRIB_VALUE:T++,ATTRIB_VALUE_QUOTED:T++,ATTRIB_VALUE_CLOSED:T++,ATTRIB_VALUE_UNQUOTED:T++,ATTRIB_VALUE_ENTITY_Q:T++,ATTRIB_VALUE_ENTITY_U:T++,CLOSE_TAG:T++,CLOSE_TAG_SAW_WHITE:T++,SCRIPT:T++,SCRIPT_ENDING:T++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var n=e.ENTITIES[t],r="number"==typeof n?String.fromCharCode(n):n;e.ENTITIES[t]=r})),e.STATE)e.STATE[e.STATE[M]]=M;function S(e,t,n){e[t]&&e[t](n)}function E(e,t,n){e.textNode&&A(e),S(e,t,n)}function A(e){e.textNode=I(e.opt,e.textNode),e.textNode&&S(e,"ontext",e.textNode),e.textNode=""}function I(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function C(e,t){return A(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,S(e,"onerror",t),e}function N(e){return e.sawRoot&&!e.closedRoot&&k(e,"Unclosed root tag"),e.state!==T.BEGIN&&e.state!==T.BEGIN_WHITESPACE&&e.state!==T.TEXT&&C(e,"Unexpected end"),A(e),e.c="",e.closed=!0,S(e,"onend"),r.call(e,e.strict,e.opt),e}function k(e,t){if("object"!==i(e)||!(e instanceof r))throw new Error("bad call to strictFail");e.strict&&C(e,t)}function D(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,n=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(n.ns=t.ns),e.attribList.length=0,E(e,"onopentagstart",n)}function P(e,t){var n=e.indexOf(":")<0?["",e]:e.split(":"),r=n[0],i=n[1];return t&&"xmlns"===e&&(r="xmlns",i=""),{prefix:r,local:i}}function O(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=P(e.attribName,!0),n=t.prefix,r=t.local;if("xmlns"===n)if("xml"===r&&e.attribValue!==s)k(e,"xml: prefix must be bound to "+s+"\nActual: "+e.attribValue);else if("xmlns"===r&&e.attribValue!==u)k(e,"xmlns: prefix must be bound to "+u+"\nActual: "+e.attribValue);else{var i=e.tag,o=e.tags[e.tags.length-1]||e;i.ns===o.ns&&(i.ns=Object.create(o.ns)),i.ns[r]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,E(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function R(e,t){if(e.opt.xmlns){var n=e.tag,r=P(e.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(k(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),n.uri=r.prefix);var i=e.tags[e.tags.length-1]||e;n.ns&&i.ns!==n.ns&&Object.keys(n.ns).forEach((function(t){E(e,"onopennamespace",{prefix:t,uri:n.ns[t]})}));for(var o=0,a=e.attribList.length;o",e.tagName="",void(e.state=T.SCRIPT);E(e,"onscript",e.script),e.script=""}var t=e.tags.length,n=e.tagName;e.strict||(n=n[e.looseCase]());for(var r=n;t--;){if(e.tags[t].name===r)break;k(e,"Unexpected close tag")}if(t<0)return k(e,"Unmatched closing tag: "+e.tagName),e.textNode+="",void(e.state=T.TEXT);e.tagName=n;for(var i=e.tags.length;i-- >t;){var o=e.tag=e.tags.pop();e.tagName=e.tag.name,E(e,"onclosetag",e.tagName);var a={};for(var s in o.ns)a[s]=o.ns[s];var u=e.tags[e.tags.length-1]||e;e.opt.xmlns&&o.ns!==u.ns&&Object.keys(o.ns).forEach((function(t){var n=o.ns[t];E(e,"onclosenamespace",{prefix:t,uri:n})}))}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=T.TEXT}function j(e){var t,n=e.entity,r=n.toLowerCase(),i="";return e.ENTITIES[n]?e.ENTITIES[n]:e.ENTITIES[r]?e.ENTITIES[r]:("#"===(n=r).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),i=(t=parseInt(n,16)).toString(16)):(n=n.slice(1),i=(t=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),isNaN(t)||i.toLowerCase()!==n?(k(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function B(e,t){"<"===t?(e.state=T.OPEN_WAKA,e.startTagPosition=e.position):p(t)||(k(e,"Non-whitespace before first tag."),e.textNode=t,e.state=T.TEXT)}function U(e,t){var n="";return t1114111||_(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?r.push(s):(e=55296+((s-=65536)>>10),t=s%1024+56320,r.push(e,t)),(i+1===o||r.length>n)&&(a+=b.apply(null,r),r.length=0)}return a},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:w,configurable:!0,writable:!0}):String.fromCodePoint=w)}(e)}(ie);var an,sn,un=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)},ln=un,cn={copyOptions:function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},ensureFlagExists:function(e,t){e in t&&"boolean"==typeof t[e]||(t[e]=!1)},ensureSpacesExists:function(e){(!("spaces"in e)||"number"!=typeof e.spaces&&"string"!=typeof e.spaces)&&(e.spaces=0)},ensureAlwaysArrayExists:function(e){"alwaysArray"in e&&("boolean"==typeof e.alwaysArray||ln(e.alwaysArray))||(e.alwaysArray=!1)},ensureKeyExists:function(e,t){e+"Key"in t&&"string"==typeof t[e+"Key"]||(t[e+"Key"]=t.compact?"_"+e:e)},checkFnExists:function(e,t){return e+"Fn"in t}},hn=ie,dn=cn,fn=un;function pn(e){var t=Number(e);if(!isNaN(t))return t;var n=e.toLowerCase();return"true"===n||"false"!==n&&e}function vn(e,t){var n;if(an.compact){if(!sn[an[e+"Key"]]&&(fn(an.alwaysArray)?-1!==an.alwaysArray.indexOf(an[e+"Key"]):an.alwaysArray)&&(sn[an[e+"Key"]]=[]),sn[an[e+"Key"]]&&!fn(sn[an[e+"Key"]])&&(sn[an[e+"Key"]]=[sn[an[e+"Key"]]]),e+"Fn"in an&&"string"==typeof t&&(t=an[e+"Fn"](t,sn)),"instruction"===e&&("instructionFn"in an||"instructionNameFn"in an))for(n in t)if(t.hasOwnProperty(n))if("instructionFn"in an)t[n]=an.instructionFn(t[n],n,sn);else{var r=t[n];delete t[n],t[an.instructionNameFn(n,r,sn)]=r}fn(sn[an[e+"Key"]])?sn[an[e+"Key"]].push(t):sn[an[e+"Key"]]=t}else{sn[an.elementsKey]||(sn[an.elementsKey]=[]);var i={};if(i[an.typeKey]=e,"instruction"===e){for(n in t)if(t.hasOwnProperty(n))break;i[an.nameKey]="instructionNameFn"in an?an.instructionNameFn(n,t,sn):n,an.instructionHasAttributes?(i[an.attributesKey]=t[n][an.attributesKey],"instructionFn"in an&&(i[an.attributesKey]=an.instructionFn(i[an.attributesKey],n,sn))):("instructionFn"in an&&(t[n]=an.instructionFn(t[n],n,sn)),i[an.instructionKey]=t[n])}else e+"Fn"in an&&(t=an[e+"Fn"](t,sn)),i[an[e+"Key"]]=t;an.addParent&&(i[an.parentKey]=sn),sn[an.elementsKey].push(i)}}function mn(e){var t;if("attributesFn"in an&&e&&(e=an.attributesFn(e,sn)),(an.trim||"attributeValueFn"in an||"attributeNameFn"in an||an.nativeTypeAttributes)&&e)for(t in e)if(e.hasOwnProperty(t)&&(an.trim&&(e[t]=e[t].trim()),an.nativeTypeAttributes&&(e[t]=pn(e[t])),"attributeValueFn"in an&&(e[t]=an.attributeValueFn(e[t],t,sn)),"attributeNameFn"in an)){var n=e[t];delete e[t],e[an.attributeNameFn(t,e[t],sn)]=n}return e}function gn(e){var t={};if(e.body&&("xml"===e.name.toLowerCase()||an.instructionHasAttributes)){for(var n,r=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g;null!==(n=r.exec(e.body));)t[n[1]]=n[2]||n[3]||n[4];t=mn(t)}if("xml"===e.name.toLowerCase()){if(an.ignoreDeclaration)return;sn[an.declarationKey]={},Object.keys(t).length&&(sn[an.declarationKey][an.attributesKey]=t),an.addParent&&(sn[an.declarationKey][an.parentKey]=sn)}else{if(an.ignoreInstruction)return;an.trim&&(e.body=e.body.trim());var i={};an.instructionHasAttributes&&Object.keys(t).length?(i[e.name]={},i[e.name][an.attributesKey]=t):i[e.name]=e.body,vn("instruction",i)}}function yn(e,t){var n;if("object"===i(e)&&(t=e.attributes,e=e.name),t=mn(t),"elementNameFn"in an&&(e=an.elementNameFn(e,sn)),an.compact){var r;if(n={},!an.ignoreAttributes&&t&&Object.keys(t).length)for(r in n[an.attributesKey]={},t)t.hasOwnProperty(r)&&(n[an.attributesKey][r]=t[r]);!(e in sn)&&(fn(an.alwaysArray)?-1!==an.alwaysArray.indexOf(e):an.alwaysArray)&&(sn[e]=[]),sn[e]&&!fn(sn[e])&&(sn[e]=[sn[e]]),fn(sn[e])?sn[e].push(n):sn[e]=n}else sn[an.elementsKey]||(sn[an.elementsKey]=[]),(n={})[an.typeKey]="element",n[an.nameKey]=e,!an.ignoreAttributes&&t&&Object.keys(t).length&&(n[an.attributesKey]=t),an.alwaysChildren&&(n[an.elementsKey]=[]),sn[an.elementsKey].push(n);n[an.parentKey]=sn,sn=n}function bn(e){an.ignoreText||(e.trim()||an.captureSpacesBetweenElements)&&(an.trim&&(e=e.trim()),an.nativeType&&(e=pn(e)),an.sanitize&&(e=e.replace(/&/g,"&").replace(//g,">")),vn("text",e))}function xn(e){an.ignoreComment||(an.trim&&(e=e.trim()),vn("comment",e))}function _n(e){var t=sn[an.parentKey];an.addParent||delete sn[an.parentKey],sn=t}function wn(e){an.ignoreCdata||(an.trim&&(e=e.trim()),vn("cdata",e))}function Tn(e){an.ignoreDoctype||(e=e.replace(/^ /,""),an.trim&&(e=e.trim()),vn("doctype",e))}function Mn(e){e.note=e,"onErrorFn"in an&&an.onErrorFn(e)}var Sn=function(e,t){var n=hn.parser(!0,{}),r={};sn=r,an=function(e){return an=dn.copyOptions(e),dn.ensureFlagExists("ignoreDeclaration",an),dn.ensureFlagExists("ignoreInstruction",an),dn.ensureFlagExists("ignoreAttributes",an),dn.ensureFlagExists("ignoreText",an),dn.ensureFlagExists("ignoreComment",an),dn.ensureFlagExists("ignoreCdata",an),dn.ensureFlagExists("ignoreDoctype",an),dn.ensureFlagExists("compact",an),dn.ensureFlagExists("alwaysChildren",an),dn.ensureFlagExists("addParent",an),dn.ensureFlagExists("trim",an),dn.ensureFlagExists("nativeType",an),dn.ensureFlagExists("nativeTypeAttributes",an),dn.ensureFlagExists("sanitize",an),dn.ensureFlagExists("instructionHasAttributes",an),dn.ensureFlagExists("captureSpacesBetweenElements",an),dn.ensureAlwaysArrayExists(an),dn.ensureKeyExists("declaration",an),dn.ensureKeyExists("instruction",an),dn.ensureKeyExists("attributes",an),dn.ensureKeyExists("text",an),dn.ensureKeyExists("comment",an),dn.ensureKeyExists("cdata",an),dn.ensureKeyExists("doctype",an),dn.ensureKeyExists("type",an),dn.ensureKeyExists("name",an),dn.ensureKeyExists("elements",an),dn.ensureKeyExists("parent",an),an}(t),n.opt={strictEntities:!0},n.onopentag=yn,n.ontext=bn,n.oncomment=xn,n.onclosetag=_n,n.onerror=Mn,n.oncdata=wn,n.ondoctype=Tn,n.onprocessinginstruction=gn;try{n.write(e).close()}catch(e){}if(r[an.elementsKey]){var i=r[an.elementsKey];delete r[an.elementsKey],r[an.elementsKey]=i,delete r.text}return r};t.xml2js=Sn;var En=cn,An=Sn;t.xml2json=function(e,t){var n,r,i,o;return n=function(e){var t=En.copyOptions(e);return En.ensureSpacesExists(t),t}(t),r=An(e,n),o="compact"in n&&n.compact?"_parent":"parent",i="addParent"in n&&n.addParent?JSON.stringify(r,(function(e,t){return e===o?"_":t}),n.spaces):JSON.stringify(r,null,n.spaces),i.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};var In,Cn,Nn=cn,kn=un;function Dn(e,t,n){return(!n&&e.spaces?"\n":"")+Array(t+1).join(e.spaces)}function Pn(e,t,n){if(t.ignoreAttributes)return"";"attributesFn"in t&&(e=t.attributesFn(e,Cn,In));var r,i,o,a,s=[];for(r in e)e.hasOwnProperty(r)&&null!==e[r]&&void 0!==e[r]&&(a=t.noQuotesForNativeAttributes&&"string"!=typeof e[r]?"":'"',i=(i=""+e[r]).replace(/&/g,"&").replace(/"}function Rn(e,t,n){if(t.ignoreInstruction)return"";var r;for(r in e)if(e.hasOwnProperty(r))break;var o="instructionNameFn"in t?t.instructionNameFn(r,e[r],Cn,In):r;if("object"===i(e[r]))return In=e,Cn=o,"";var a=e[r]?e[r]:"";return"instructionFn"in t&&(a=t.instructionFn(a,r,Cn,In)),""}function Ln(e,t){return t.ignoreComment?"":"\x3c!--"+("commentFn"in t?t.commentFn(e,Cn,In):e)+"--\x3e"}function jn(e,t){return t.ignoreCdata?"":"","]]]]>"))+"]]>"}function Bn(e,t){return t.ignoreDoctype?"":""}function Un(e,t){return t.ignoreText?"":(e=(e=(e=""+e).replace(/&/g,"&")).replace(/&/g,"&").replace(//g,">"),"textFn"in t?t.textFn(e,Cn,In):e)}function Fn(e,t,n,r){return e.reduce((function(e,i){var o=Dn(t,n,r&&!e);switch(i.type){case"element":return e+o+function(e,t,n){In=e,Cn=e.name;var r=[],i="elementNameFn"in t?t.elementNameFn(e.name,e):e.name;r.push("<"+i),e[t.attributesKey]&&r.push(Pn(e[t.attributesKey],t,n));var o=e[t.elementsKey]&&e[t.elementsKey].length||e[t.attributesKey]&&"preserve"===e[t.attributesKey]["xml:space"];return o||(o="fullTagEmptyElementFn"in t?t.fullTagEmptyElementFn(e.name,e):t.fullTagEmptyElement),o?(r.push(">"),e[t.elementsKey]&&e[t.elementsKey].length&&(r.push(Fn(e[t.elementsKey],t,n+1)),In=e,Cn=e.name),r.push(t.spaces&&function(e,t){var n;if(e.elements&&e.elements.length)for(n=0;n")):r.push("/>"),r.join("")}(i,t,n);case"comment":return e+o+Ln(i[t.commentKey],t);case"doctype":return e+o+Bn(i[t.doctypeKey],t);case"cdata":return e+(t.indentCdata?o:"")+jn(i[t.cdataKey],t);case"text":return e+(t.indentText?o:"")+Un(i[t.textKey],t);case"instruction":var a={};return a[i[t.nameKey]]=i[t.attributesKey]?i:i[t.instructionKey],e+(t.indentInstruction?o:"")+Rn(a,t,n)}}),"")}function zn(e,t,n){var r;for(r in e)if(e.hasOwnProperty(r))switch(r){case t.parentKey:case t.attributesKey:break;case t.textKey:if(t.indentText||n)return!0;break;case t.cdataKey:if(t.indentCdata||n)return!0;break;case t.instructionKey:if(t.indentInstruction||n)return!0;break;case t.doctypeKey:case t.commentKey:default:return!0}return!1}function Gn(e,t,n,r,o){In=e,Cn=t;var a="elementNameFn"in n?n.elementNameFn(t,e):t;if(null==e||""===e)return"fullTagEmptyElementFn"in n&&n.fullTagEmptyElementFn(t,e)||n.fullTagEmptyElement?"<"+a+">":"<"+a+"/>";var s=[];if(t){if(s.push("<"+a),"object"!==i(e))return s.push(">"+Un(e,n)+""),s.join("");e[n.attributesKey]&&s.push(Pn(e[n.attributesKey],n,r));var u=zn(e,n,!0)||e[n.attributesKey]&&"preserve"===e[n.attributesKey]["xml:space"];if(u||(u="fullTagEmptyElementFn"in n?n.fullTagEmptyElementFn(t,e):n.fullTagEmptyElement),!u)return s.push("/>"),s.join("");s.push(">")}return s.push(Hn(e,n,r+1,!1)),In=e,Cn=t,t&&s.push((o?Dn(n,r,!1):"")+""),s.join("")}function Hn(e,t,n,r){var i,o,a,s=[];for(o in e)if(e.hasOwnProperty(o))for(a=kn(e[o])?e[o]:[e[o]],i=0;i