@netless/window-manager 1.0.17-beta.0 → 1.0.17-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-docs-viewer.js +4 -0
- package/dist/app-docs-viewer.js.map +1 -0
- package/dist/app-media-player.js +31 -0
- package/dist/app-media-player.js.map +1 -0
- package/dist/app-presentation.js +21 -0
- package/dist/app-presentation.js.map +1 -0
- package/dist/index.js +5 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/BuiltinApps.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var
|
|
2
|
-
;return ${t}`)();return typeof i=="undefined"&&(i=window[t]),i},dP=async(e,t,i)=>{const n=i||uP+t;ke.emit("loadApp",{kind:t,status:"start"});let s;try{if(s=await hP(e),!s||s.length===0)throw ke.emit("loadApp",{kind:t,status:"failed",reason:"script is empty."}),new Error("[WindowManager]: script is empty.")}catch(o){throw ke.emit("loadApp",{kind:t,status:"failed",reason:o.message}),o}return fP(s,n,t)},fP=(e,t,i)=>{try{const n=Dv(e,t);return ke.emit("loadApp",{kind:i,status:"success"}),n}catch(n){if(n.message.includes("Can only have one anonymous define call per script file")){const s=window.define;typeof s=="function"&&s.amd&&delete s.amd;const o=Dv(e,t);return ke.emit("loadApp",{kind:i,status:"success"}),o}throw ke.emit("loadApp",{kind:i,status:"failed",reason:n.message}),n}};async function pP(e,t){const{timeout:i=1e4}=t,n=new AbortController,s=setTimeout(()=>n.abort(),i),o=await fetch(e,{...t,signal:n.signal,headers:{"content-type":"text/plain"}});return clearTimeout(s),o}class gP{constructor(){this.kindEmitters=new Map,this.registered=new Map,this.appClassesCache=new Map,this.appClasses=new Map,this.syncRegisterApp=null,this.onSyncRegisterAppChange=t=>{this.register({kind:t.kind,src:t.src})}}setSyncRegisterApp(t){this.syncRegisterApp=t}async register(t){this.appClassesCache.delete(t.kind),this.registered.set(t.kind,t);const i=t.src;let n;if(typeof i=="string"&&(n=async()=>{const s=await dP(i,t.kind,t.name);return s.__esModule?s.default:s},this.syncRegisterApp&&this.syncRegisterApp({kind:t.kind,src:i,name:t.name})),typeof i=="function"&&(n=async()=>{let s=await i();if(s)return(s.__esModule||s.default)&&(s=s.default),s;throw new Error(`[WindowManager]: load remote script failed, ${i}`)}),typeof i=="object"&&(n=async()=>i),this.appClasses.set(t.kind,async()=>{let s=this.appClassesCache.get(t.kind);return s||(s=n(),this.appClassesCache.set(t.kind,s)),s}),t.addHooks){const s=this.createKindEmitter(t.kind);s&&t.addHooks(s)}}unregister(t){this.appClasses.delete(t),this.appClassesCache.delete(t),this.registered.delete(t);const i=this.kindEmitters.get(t);i&&(i.clearListeners(),this.kindEmitters.delete(t))}async notifyApp(t,i,n){const s=this.kindEmitters.get(t);await(s==null?void 0:s.emit(i,n))}createKindEmitter(t){if(!this.kindEmitters.has(t)){const i=new qr.default;this.kindEmitters.set(t,i)}return this.kindEmitters.get(t)}}const Rt=new gP,mP=async e=>{var i,n;const t=await((i=Rt.appClasses.get(e))==null?void 0:i());return t&&((n=t.config)==null?void 0:n.singleton)?e:`${e}-${G_.v4().replace("-","").slice(0,8)}`},Zr=(e,t)=>{if(e.focusScenePath!==t)return e.focusScenePath=t,e},cd=(e,t)=>{if(e&&e.isWritable&&e.state.sceneState.scenePath!==t){const i=t==="/"?"":t;e.setScenePath(i)}},vP=(e,t,i)=>{var n;if(e&&t){const o=(n=Os(e)[t])==null?void 0:n[i];if(o)return`${t}/${o.name}`}},hd=(e,t,i)=>{e&&e.scenePathType(t)!==H.ScenePathType.None&&e.removeScenes(t,i)},wP=(e,t)=>{fe.once(e).then(t)};Y.debounce((e,t)=>{e.emit("mainViewModeChange",t)},200);const yP=(e,t,i=0)=>{const n=Os(e)[t];if(!n)return;const s=n[i];if(!s)return;const o=s.name;return t===Qt?`/${o}`:`${t}/${o}`},Os=e=>e.entireScenes(),Da=(e,t,i,n)=>{var s;for(let o=0;o<i.length;++o)if((s=i[o].name)!=null&&s.includes("/"))throw new Error("scenes name can not have '/'");return e==null?void 0:e.putScenes(t,i,n)},xP=e=>e.startsWith("/"),Ph=e=>{const t=e.split("/");t.pop();let i=t.join("/");return i===""&&(i="/"),i},SP=e=>e.endsWith("/")?e.slice(0,-1):e,Lv=e=>{const t=e.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(t)},G0=e=>new Promise(t=>setTimeout(t,e)),MP=e=>e.split("").reduce((i,n)=>(n===Qt&&(i+=1),i),0)===1;class bP{constructor(t){this.manager=t,this.displayer=this.manager.displayer,this.mainMagixEventListener=i=>{if(i.authorId!==this.displayer.observerId){const n=i.payload;switch(n.eventName){case qe.AppMove:{this.appMoveHandler(n.payload);break}case qe.AppResize:{this.appResizeHandler(n.payload);break}case qe.AppBoxStateChange:{this.boxStateChangeHandler(n.payload);break}case qe.SetMainViewScenePath:{this.setMainViewScenePathHandler(n.payload);break}case qe.CursorMove:{this.cursorMoveHandler(n.payload);break}case qe.RootDirRemoved:{this.rootDirRemovedHandler();break}case qe.Refresh:{this.refreshHandler();break}case qe.InitMainViewCamera:{this.initMainViewCameraHandler();break}case qe.SetAppFocusIndex:{this.setAppFocusViewIndexHandler(n.payload);break}}}},this.appMoveHandler=i=>{var n;(n=this.boxManager)==null||n.moveBox(i)},this.appResizeHandler=i=>{var n,s;(n=this.boxManager)==null||n.resizeBox(Object.assign(i,{skipUpdate:!0})),(s=this.manager.room)==null||s.refreshViewSize()},this.boxStateChangeHandler=i=>{ke.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{Zr(this.manager.mainView,i),ke.emit("mainViewScenePathChange",i)},this.cursorMoveHandler=i=>{fe.emit("cursorMove",i)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),fe.emit("rootDirRemoved")},this.refreshHandler=()=>{this.manager.windowManger._refresh()},this.initMainViewCameraHandler=()=>{this.manager.mainViewProxy.addCameraReaction()},this.setAppFocusViewIndexHandler=i=>{if(i.type==="main")this.manager.setSceneIndexWithoutSync(i.index);else if(i.type==="app"&&i.appID){const n=this.manager.appProxies.get(i.appID);n&&n.setSceneIndexWithoutSync(i.index)}}}get boxManager(){return this.manager.boxManager}addListeners(){this.displayer.addMagixEventListener(od,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(od,this.mainMagixEventListener)}}class X0 extends Error{constructor(){super(...arguments),this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class CP extends Error{constructor(t){super(`[WindowManager]: app ${t} need register or provide src`)}}class ci extends Error{constructor(){super(...arguments),this.message="[WindowManager]: AppManager must be initialized"}}class J0 extends Error{constructor(t){super(`[WindowManager]: white-web-sdk version must large than ${t}`)}}class K0 extends Error{constructor(){super(...arguments),this.message="[WindowManager]: kind must be a valid string"}}class q0 extends Error{constructor(){super(...arguments),this.message="[WindowManager]: box need created"}}class ey extends Error{constructor(){super(...arguments),this.message='[WindowManager]: ScenePath should start with "/"'}}class ty extends Error{constructor(){super(...arguments),this.message="[WindowManager]: boxManager not found"}}class iy extends Error{constructor(){super(...arguments),this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const ny="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",IP=ny.length,Rv=Array(20),ys=()=>{for(let e=0;e<20;e++)Rv[e]=ny.charAt(Math.random()*IP);return Rv.join("")};class po{constructor(){this.disposers=new Map}add(t,i=ys()){return this.flush(i),this.disposers.set(i,t()),i}addDisposer(t,i=ys()){return this.flush(i),this.disposers.set(i,t),i}addEventListener(t,i,n,s,o=ys()){return this.add(()=>(t.addEventListener(i,n,s),()=>t.removeEventListener(i,n,s)),o),o}setTimeout(t,i,n=ys()){return this.add(()=>{const s=window.setTimeout(()=>{this.remove(n),t()},i);return()=>window.clearTimeout(s)},n)}setInterval(t,i,n=ys()){return this.add(()=>{const s=window.setInterval(t,i);return()=>window.clearInterval(s)},n)}remove(t){const i=this.disposers.get(t);return this.disposers.delete(t),i}flush(t){const i=this.remove(t);if(i)try{i()}catch(n){console.error(n)}}flushAll(){this.disposers.forEach(t=>{try{t()}catch(i){console.error(i)}}),this.disposers.clear()}}const ry=e=>(t,i)=>{if(t!==void 0)if(H.listenUpdated){const n=s=>{s.map(l=>l.kind).includes(e)&&i()};return H.listenUpdated(t,n),i(),()=>H.unlistenUpdated(t,n)}else return H.reaction(()=>t,()=>{i()},{fireImmediately:!0})},_a=(e,t,i)=>{let n=null;const s=H.reaction(e,()=>{n&&(n(),n=null);const o=e();Y.isObject(o)?(n=()=>H.unlistenUpdated(o,t),H.listenUpdated(o,t)):i==null||i(o)},{fireImmediately:!0});return()=>{n==null||n(),s()}};ry(H.UpdateEventKind.Removed);ry(H.UpdateEventKind.Inserted);class AP{constructor(){this.listeners=new Set}get length(){return this.listeners.size}dispatch(t){this.listeners.forEach(i=>i(t))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}}const Nh=Object.keys;function Ov(e){return Boolean(Y.has(e,"__isRef"))}function TP(e){return{k:ys(),v:e,__isRef:!0}}const Li="_WM-STORAGE_";class Vv{constructor(t,i,n){if(this.maxIllusionQueueSize=500,this._sideEffect=new po,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new AP,n&&!Y.isObject(n))throw new Error(`Default state for Storage ${i} is not an object.`);this._context=t,this.id=i||null,this._state={};const s=this._getRawState(this._state);this._context.getIsWritable()&&(this.id===null?t.isAddApp&&n&&this.setState(n):(s===this._state||!Y.isObject(s))&&(Y.get(this._context.getAttributes(),[Li])||this._context.updateAttributes([Li],{}),this._context.updateAttributes([Li,this.id],this._state),n&&this.setState(n))),Nh(s).forEach(o=>{if(!(this.id===null&&o===Li))try{const l=Y.isObject(s[o])?JSON.parse(JSON.stringify(s[o])):s[o];Ov(l)?(this._state[o]=l.v,Y.isObject(l.v)&&this._refMap.set(l.v,l)):this._state[o]=l}catch(l){console.error(l)}}),this._sideEffect.addDisposer(_a(()=>this.id===null?t.getAttributes():Y.get(t.getAttributes(),[Li,this.id]),this._updateProperties.bind(this),this.destroy.bind(this)))}get state(){return this._destroyed&&console.warn(`Accessing state on destroyed Storage "${this.id}"`),this._state}addStateChangedListener(t){return this.onStateChanged.addListener(t),()=>this.onStateChanged.removeListener(t)}ensureState(t){return this.setState(Nh(t).reduce((i,n)=>(Y.has(this._state,n)||(i[n]=t[n]),i),{}))}setState(t){if(this._destroyed){console.error(new Error(`Cannot call setState on destroyed Storage "${this.id}".`));return}if(!this._context.getIsWritable()){console.error(new Error(`Cannot setState on Storage "${this.id}" without writable access`),t);return}const i=Nh(t);i.length>0&&i.forEach(n=>{const s=t[n];if(s!==this._state[n])if(s===void 0)this._lastValue.set(n,this._state[n]),delete this._state[n],this._setRawState(n,s);else{this._lastValue.set(n,this._state[n]),this._state[n]=s;let o=s;if(Y.isObject(s)){let l=this._refMap.get(s);l||(l=TP(s),this._refMap.set(s,l)),o=l}this._setRawState(n,o)}})}emptyStorage(){if(!(Y.size(this._state)<=0)){if(this._destroyed){console.error(new Error(`Cannot empty destroyed Storage "${this.id}".`));return}if(!this._context.getIsWritable()){console.error(new Error(`Cannot empty Storage "${this.id}" without writable access.`));return}this.setState(Y.mapValues(this._state,Y.noop))}}deleteStorage(){if(this.id===null)throw new Error("Cannot delete main Storage");if(!this._context.getIsWritable()){console.error(new Error(`Cannot delete Storage "${this.id}" without writable access.`));return}this.destroy(),this._context.updateAttributes([Li,this.id],void 0)}get destroyed(){return this._destroyed}destroy(){this._destroyed=!0,this._sideEffect.flushAll()}_getRawState(t){var i;return this.id===null?(i=this._context.getAttributes())!=null?i:t:Y.get(this._context.getAttributes(),[Li,this.id],t)}_setRawState(t,i){if(this.id===null){if(t===Li)throw new Error(`Cannot set attribute internal filed "${Li}"`);return this._context.updateAttributes([t],i)}else return this._context.updateAttributes([Li,this.id,t],i)}_updateProperties(t){var i;if(this._destroyed){console.error(new Error(`Cannot call _updateProperties on destroyed Storage "${this.id}".`));return}if(t.length>0){const n={};for(let s=0;s<t.length;s++)try{const o=t[s],l=o.key;if(this.id===null&&l===Li)continue;const c=Y.isObject(o.value)?JSON.parse(JSON.stringify(o.value)):o.value;let d;switch(this._lastValue.has(l)&&(d=this._lastValue.get(l),this._lastValue.delete(l)),o.kind){case 2:{Y.has(this._state,l)&&(d=this._state[l],delete this._state[l]),n[l]={oldValue:d};break}default:{let f=c;if(Ov(c)){const{k:g,v}=c,M=this._state[l];Y.isObject(M)&&((i=this._refMap.get(M))==null?void 0:i.k)===g?f=M:(f=v,Y.isObject(v)&&this._refMap.set(v,c))}f!==this._state[l]&&(d=this._state[l],this._state[l]=f),n[l]={newValue:f,oldValue:d};break}}}catch(o){console.error(o)}this.onStateChanged.dispatch(n)}}}class go{constructor(t,i,n,s,o){this.manager=t,this.boxManager=i,this.appId=n,this.appProxy=s,this.appOptions=o,this.mobxUtils={autorun:H.autorun,reaction:H.reaction,toJS:H.toJS},this.objectUtils={listenUpdated:H.listenUpdated,unlistenUpdated:H.unlistenUpdated,listenDisposed:H.listenDisposed,unlistenDisposed:H.unlistenDisposed},this.store=this.manager.store,this.isReplay=this.manager.isReplay,this.getManager=()=>this.manager,this.getBoxManager=()=>this.boxManager,this.getWindowManager=()=>this.manager.windowManger,this.getBoxStatus=()=>this.manager.store.getBoxStatus(this.appId),this.getLastNotMinimizedBoxStatus=()=>this.manager.store.getLastNotMinimizedBoxStatus(this.appId),this.getDisplayer=()=>this.manager.displayer,this.getAppProxy=()=>this.appProxy,this.getAttributes=()=>this.appProxy.attributes,this.getScenes=()=>{const l=this.store.getAppAttributes(this.appId);return l!=null&&l.isDynamicPPT?this.appProxy.scenes:l==null?void 0:l.options.scenes},this.getView=()=>this.appProxy.view,this.mountView=l=>{const c=this.getView();c&&(c.divElement=l,setTimeout(()=>{var d;(d=this.getRoom())==null||d.refreshViewSize(),ke.emit("onAppViewMounted",{appId:this.appId,view:c})},1e3))},this.getInitScenePath=()=>this.manager.getAppInitPath(this.appId),this.getIsWritable=()=>this.manager.canOperate,this.getBox=()=>{const l=this.boxManager.getBox(this.appId);if(l)return l;throw new q0},this.getRoom=()=>this.manager.room,this.setAttributes=l=>{this.manager.safeSetAttributes({[this.appId]:l})},this.updateAttributes=(l,c)=>{this.manager.attributes[this.appId]&&this.manager.safeUpdateAttributes([this.appId,...l],c)},this.setScenePath=async l=>{var c;!this.appProxy.box||(this.appProxy.setFullPath(l),(c=this.getRoom())==null||c.setScenePath(l))},this.getAppOptions=()=>typeof this.appOptions=="function"?this.appOptions():this.appOptions,this.createStorage=(l,c)=>{const d=new Vv(this,l,c);return this.emitter.on("destroy",()=>{d.destroy()}),d},this.dispatchMagixEvent=(...l)=>{var d;const c=`${this.appId}:${l[0]}`;return(d=this.manager.room)==null?void 0:d.dispatchMagixEvent(c,l[1])},this.addMagixEventListener=(l,c,d)=>{const f=`${this.appId}:${l}`;return this.manager.displayer.addMagixEventListener(f,c,d),()=>this.manager.displayer.removeMagixEventListener(f,c)},this.removeMagixEventListener=this.manager.displayer.removeMagixEventListener.bind(this.manager.displayer),this.nextPage=async()=>{const l=this.pageState.index+1;return l>this.pageState.length-1?(console.warn("[WindowManager] nextPage: index out of range"),!1):(this.appProxy.setSceneIndex(l),!0)},this.jumpPage=async l=>0<=l&&l<this.pageState.length?(this.appProxy.setSceneIndex(l),!0):(console.warn("[WindowManager] nextPage: index out of range"),!1),this.prevPage=async()=>{const l=this.pageState.index-1;return l<0?(console.warn("[WindowManager] prevPage: index out of range"),!1):(this.appProxy.setSceneIndex(l),!0)},this.addPage=async l=>{const c=l==null?void 0:l.after,d=l==null?void 0:l.scene,f=this.appProxy.scenePath;if(!!f)if(c){const g=this.pageState.index+1;Da(this.manager.room,f,[d||{}],g)}else Da(this.manager.room,f,[d||{}])},this.removePage=async l=>{const c=l===void 0?this.pageState.index:l;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):c<0||c>=this.pageState.length?(console.warn(`[WindowManager]: page index ${l} out of range`),!1):this.appProxy.removeSceneByIndex(c)},this.emitter=s.appEmitter,this.isAddApp=s.isAddApp}get storage(){return this._storage||(this._storage=new Vv(this)),this._storage}get pageState(){return this.appProxy.pageState}get kind(){return this.appProxy.kind}dispatchAppEvent(t,i){fe.emit(`custom-${this.kind}`,{kind:this.kind,appId:this.appId,type:t,value:i})}}go.kind="AppContext";class EP{constructor(t){this.params=t,this.sceneNode=null,this.onSceneChange=s=>{this.sceneNode=s,this.params.notifyPageStateChange()};const{displayer:i,scenePath:n}=this.params;n&&(this.sceneNode=i.createScenesCallback(n,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}getFullPath(t){var n;const i=(n=this.sceneNode)==null?void 0:n.scenes;if(this.params.scenePath&&i){const s=i[t];if(s)return`${this.params.scenePath}/${s}`}}toObject(){var t,i;return{index:((t=this.params.view)==null?void 0:t.focusSceneIndex)||0,length:((i=this.sceneNode)==null?void 0:i.scenes.length)||0}}destroy(){var t;(t=this.sceneNode)==null||t.dispose()}}var sy={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(i=!1));function s(d,f,g){this.fn=d,this.context=f,this.once=g||!1}function o(d,f,g,v,M){if(typeof g!="function")throw new TypeError("The listener must be a function");var E=new s(g,v||d,M),_=i?i+f:f;return d._events[_]?d._events[_].fn?d._events[_]=[d._events[_],E]:d._events[_].push(E):(d._events[_]=E,d._eventsCount++),d}function l(d,f){--d._eventsCount===0?d._events=new n:delete d._events[f]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var f=[],g,v;if(this._eventsCount===0)return f;for(v in g=this._events)t.call(g,v)&&f.push(i?v.slice(1):v);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(g)):f},c.prototype.listeners=function(f){var g=i?i+f:f,v=this._events[g];if(!v)return[];if(v.fn)return[v.fn];for(var M=0,E=v.length,_=new Array(E);M<E;M++)_[M]=v[M].fn;return _},c.prototype.listenerCount=function(f){var g=i?i+f:f,v=this._events[g];return v?v.fn?1:v.length:0},c.prototype.emit=function(f,g,v,M,E,_){var P=i?i+f:f;if(!this._events[P])return!1;var y=this._events[P],x=arguments.length,I,C;if(y.fn){switch(y.once&&this.removeListener(f,y.fn,void 0,!0),x){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,g),!0;case 3:return y.fn.call(y.context,g,v),!0;case 4:return y.fn.call(y.context,g,v,M),!0;case 5:return y.fn.call(y.context,g,v,M,E),!0;case 6:return y.fn.call(y.context,g,v,M,E,_),!0}for(C=1,I=new Array(x-1);C<x;C++)I[C-1]=arguments[C];y.fn.apply(y.context,I)}else{var k=y.length,L;for(C=0;C<k;C++)switch(y[C].once&&this.removeListener(f,y[C].fn,void 0,!0),x){case 1:y[C].fn.call(y[C].context);break;case 2:y[C].fn.call(y[C].context,g);break;case 3:y[C].fn.call(y[C].context,g,v);break;case 4:y[C].fn.call(y[C].context,g,v,M);break;default:if(!I)for(L=1,I=new Array(x-1);L<x;L++)I[L-1]=arguments[L];y[C].fn.apply(y[C].context,I)}}return!0},c.prototype.on=function(f,g,v){return o(this,f,g,v,!1)},c.prototype.once=function(f,g,v){return o(this,f,g,v,!0)},c.prototype.removeListener=function(f,g,v,M){var E=i?i+f:f;if(!this._events[E])return this;if(!g)return l(this,E),this;var _=this._events[E];if(_.fn)_.fn===g&&(!M||_.once)&&(!v||_.context===v)&&l(this,E);else{for(var P=0,y=[],x=_.length;P<x;P++)(_[P].fn!==g||M&&!_[P].once||v&&_[P].context!==v)&&y.push(_[P]);y.length?this._events[E]=y.length===1?y[0]:y:l(this,E)}return this},c.prototype.removeAllListeners=function(f){var g;return f?(g=i?i+f:f,this._events[g]&&l(this,g)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=i,c.EventEmitter=c,e.exports=c})(sy);var dd=sy.exports;/*! *****************************************************************************
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var er=require("p-retry"),tr=require("emittery"),w=require("lodash"),f=require("white-web-sdk"),ir=require("uuid"),sr=require("@juggle/resize-observer");function es(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var ts=es(er),ve=es(tr),R=(i=>(i.AppMove="AppMove",i.AppFocus="AppFocus",i.AppResize="AppResize",i.AppBoxStateChange="AppBoxStateChange",i.GetAttributes="GetAttributes",i.UpdateWindowManagerWrapper="UpdateWindowManagerWrapper",i.InitReplay="InitReplay",i.WindowCreated="WindowCreated",i.SetMainViewScenePath="SetMainViewScenePath",i.SetMainViewSceneIndex="SetMainViewSceneIndex",i.SetAppFocusIndex="SetAppFocusIndex",i.SwitchViewsToFreedom="SwitchViewsToFreedom",i.MoveCamera="MoveCamera",i.MoveCameraToContain="MoveCameraToContain",i.CursorMove="CursorMove",i.RootDirRemoved="RootDirRemoved",i.Refresh="Refresh",i.InitMainViewCamera="InitMainViewCamera",i))(R||{});const Gt="__WindowManger",Lt="__WindowMangerEnsureReconnected__";var ee=(i=>(i.Size="size",i.Position="position",i.SceneIndex="SceneIndex",i.ZIndex="zIndex",i))(ee||{}),is=(i=>(i.setBoxSize="setBoxSize",i.setBoxMinSize="setBoxMinSize",i.destroy="destroy",i))(is||{}),Qt=(i=>(i.StartCreate="StartCreate",i))(Qt||{}),Yt=(i=>(i.Leave="leave",i.Normal="normal",i))(Yt||{});const Bi="2.16.1",rr=340/720,ar=340/720,nr=9/16,q="/",ss="/init",rs=50,L=new ve.default;class or{constructor(){this.list=[],this.isEmit=!1,this.invoked=()=>{this.currentInvoker=void 0,this.list.length===0&&(this.clear(),this.emitReady())},this.clear=()=>{clearInterval(this.timer),this.timer=void 0}}initInterval(){return setInterval(()=>{this.invoke()},50)}push(e){this.list.push(e),this.invoke(),this.timer===void 0&&this.list.length>0&&(this.timer=this.initInterval())}invoke(){if(this.list.length===0||this.currentInvoker!==void 0)return;const e=this.list.shift();e&&(this.currentInvoker=e,e().then(()=>{this.invoked()}).catch(t=>{console.error(`[WindowManager]: create app error: ${t.message}`),this.invoked()}))}emitReady(){this.isEmit||setTimeout(()=>{L.emit("ready")},rs),this.isEmit=!0}empty(){this.list=[],this.clear()}destroy(){this.timer&&this.clear()}}const A=new ve.default,hr="__WindowManagerAppCache";let He,Ni;const cr=async()=>{He=await dr()},lr=(i,e)=>{if(!!He)return pr(He,{kind:i,sourceCode:e})},ur=async i=>He?await gr(He,i):null;function dr(){return new Promise((i,e)=>{const t=indexedDB.open(hr,2);t.onerror=s=>{e(s)},t.onupgradeneeded=s=>{const r=s.target.result;r.objectStoreNames.contains("apps")||(Ni=r.createObjectStore("apps",{keyPath:"kind"}),Ni.createIndex("kind","kind",{unique:!0}))},t.onsuccess=()=>{const s=t.result;i(s)}})}function gr(i,e){return new Promise((t,s)=>{const n=i.transaction(["apps"]).objectStore("apps").index("kind").get(e);n.onerror=a=>s(a),n.onsuccess=()=>{n.result?t(n.result):t(null)}})}function pr(i,e){return new Promise((t,s)=>{const r=i.transaction(["apps"],"readwrite").objectStore("apps").add(e);r.onsuccess=()=>t(),r.onerror=()=>s()})}const mr="NetlessApp",fr=1e4,Mr=async i=>{const e=await ur(i);if(e)return e.sourceCode;{const s=await(await Sr(i,{timeout:fr})).text();return await lr(i,s),s}},zi=(i,e)=>{let t=Function(i+`
|
|
2
|
+
;return ${e}`)();return typeof t=="undefined"&&(t=window[e]),t},wr=async(i,e,t)=>{const s=t||mr+e;L.emit("loadApp",{kind:e,status:"start"});let r;try{if(r=await Mr(i),!r||r.length===0)throw L.emit("loadApp",{kind:e,status:"failed",reason:"script is empty."}),new Error("[WindowManager]: script is empty.")}catch(n){throw L.emit("loadApp",{kind:e,status:"failed",reason:n.message}),n}return xr(r,s,e)},xr=(i,e,t)=>{try{const s=zi(i,e);return L.emit("loadApp",{kind:t,status:"success"}),s}catch(s){if(s.message.includes("Can only have one anonymous define call per script file")){const r=window.define;typeof r=="function"&&r.amd&&delete r.amd;const n=zi(i,e);return L.emit("loadApp",{kind:t,status:"success"}),n}throw L.emit("loadApp",{kind:t,status:"failed",reason:s.message}),s}};async function Sr(i,e){const{timeout:t=1e4}=e,s=new AbortController,r=setTimeout(()=>s.abort(),t),n=await fetch(i,{...e,signal:s.signal,headers:{"content-type":"text/plain"}});return clearTimeout(r),n}class br{constructor(){this.kindEmitters=new Map,this.registered=new Map,this.appClassesCache=new Map,this.appClasses=new Map,this.syncRegisterApp=null,this.onSyncRegisterAppChange=e=>{this.register({kind:e.kind,src:e.src})}}setSyncRegisterApp(e){this.syncRegisterApp=e}async register(e){this.appClassesCache.delete(e.kind),this.registered.set(e.kind,e);const t=e.src;let s;if(typeof t=="string"&&(s=async()=>{const r=await wr(t,e.kind,e.name);return r.__esModule?r.default:r},this.syncRegisterApp&&this.syncRegisterApp({kind:e.kind,src:t,name:e.name})),typeof t=="function"&&(s=async()=>{let r=await t();if(r)return(r.__esModule||r.default)&&(r=r.default),r;throw new Error(`[WindowManager]: load remote script failed, ${t}`)}),typeof t=="object"&&(s=async()=>t),this.appClasses.set(e.kind,async()=>{let r=this.appClassesCache.get(e.kind);return r||(r=s(),this.appClassesCache.set(e.kind,r)),r}),e.addHooks){const r=this.createKindEmitter(e.kind);r&&e.addHooks(r)}}unregister(e){this.appClasses.delete(e),this.appClassesCache.delete(e),this.registered.delete(e);const t=this.kindEmitters.get(e);t&&(t.clearListeners(),this.kindEmitters.delete(e))}async notifyApp(e,t,s){const r=this.kindEmitters.get(e);await(r==null?void 0:r.emit(t,s))}createKindEmitter(e){if(!this.kindEmitters.has(e)){const t=new ve.default;this.kindEmitters.set(e,t)}return this.kindEmitters.get(e)}}const J=new br,vr=async i=>{var t,s;const e=await((t=J.appClasses.get(i))==null?void 0:t());return e&&((s=e.config)==null?void 0:s.singleton)?i:`${i}-${ir.v4().replace("-","").slice(0,8)}`},be=(i,e)=>{if(i.focusScenePath!==e)return i.focusScenePath=e,i},Ht=(i,e)=>{if(i&&i.isWritable&&i.state.sceneState.scenePath!==e){const t=e==="/"?"":e;i.setScenePath(t)}},Ir=(i,e,t)=>{var s;if(i&&e){const n=(s=Pe(i)[e])==null?void 0:s[t];if(n)return`${e}/${n.name}`}},Jt=(i,e,t)=>{i&&i.scenePathType(e)!==f.ScenePathType.None&&i.removeScenes(e,t)},yr=(i,e)=>{A.once(i).then(e)};w.debounce((i,e)=>{i.emit("mainViewModeChange",e)},200);const Cr=(i,e,t=0)=>{const s=Pe(i)[e];if(!s)return;const r=s[t];if(!r)return;const n=r.name;return e===q?`/${n}`:`${e}/${n}`},Pe=i=>i.entireScenes(),$e=(i,e,t,s)=>{var r;for(let n=0;n<t.length;++n)if((r=t[n].name)!=null&&r.includes("/"))throw new Error("scenes name can not have '/'");return i==null?void 0:i.putScenes(e,t,s)},Ar=i=>i.startsWith("/"),Et=i=>{const e=i.split("/");e.pop();let t=e.join("/");return t===""&&(t="/"),t},Br=i=>i.endsWith("/")?i.slice(0,-1):i,Di=i=>{const e=i.split(".").map(t=>t.padStart(2,"0")).join("");return parseInt(e)},as=i=>new Promise(e=>setTimeout(e,i)),Nr=i=>i.split("").reduce((t,s)=>(s===q&&(t+=1),t),0)===1;class zr{constructor(e){this.manager=e,this.displayer=this.manager.displayer,this.mainMagixEventListener=t=>{if(t.authorId!==this.displayer.observerId){const s=t.payload;switch(s.eventName){case R.AppMove:{this.appMoveHandler(s.payload);break}case R.AppResize:{this.appResizeHandler(s.payload);break}case R.AppBoxStateChange:{this.boxStateChangeHandler(s.payload);break}case R.SetMainViewScenePath:{this.setMainViewScenePathHandler(s.payload);break}case R.CursorMove:{this.cursorMoveHandler(s.payload);break}case R.RootDirRemoved:{this.rootDirRemovedHandler();break}case R.Refresh:{this.refreshHandler();break}case R.InitMainViewCamera:{this.initMainViewCameraHandler();break}case R.SetAppFocusIndex:{this.setAppFocusViewIndexHandler(s.payload);break}}}},this.appMoveHandler=t=>{var s;(s=this.boxManager)==null||s.moveBox(t)},this.appResizeHandler=t=>{var s,r;(s=this.boxManager)==null||s.resizeBox(Object.assign(t,{skipUpdate:!0})),(r=this.manager.room)==null||r.refreshViewSize()},this.boxStateChangeHandler=t=>{L.emit("boxStateChange",t)},this.setMainViewScenePathHandler=({nextScenePath:t})=>{be(this.manager.mainView,t),L.emit("mainViewScenePathChange",t)},this.cursorMoveHandler=t=>{A.emit("cursorMove",t)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),A.emit("rootDirRemoved")},this.refreshHandler=()=>{this.manager.windowManger._refresh()},this.initMainViewCameraHandler=()=>{this.manager.mainViewProxy.addCameraReaction()},this.setAppFocusViewIndexHandler=t=>{if(t.type==="main")this.manager.setSceneIndexWithoutSync(t.index);else if(t.type==="app"&&t.appID){const s=this.manager.appProxies.get(t.appID);s&&s.setSceneIndexWithoutSync(t.index)}}}get boxManager(){return this.manager.boxManager}addListeners(){this.displayer.addMagixEventListener(Gt,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(Gt,this.mainMagixEventListener)}}class ns extends Error{constructor(){super(...arguments),this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class Dr extends Error{constructor(e){super(`[WindowManager]: app ${e} need register or provide src`)}}class te extends Error{constructor(){super(...arguments),this.message="[WindowManager]: AppManager must be initialized"}}class os extends Error{constructor(e){super(`[WindowManager]: white-web-sdk version must large than ${e}`)}}class hs extends Error{constructor(){super(...arguments),this.message="[WindowManager]: kind must be a valid string"}}class cs extends Error{constructor(){super(...arguments),this.message="[WindowManager]: box need created"}}class ls extends Error{constructor(){super(...arguments),this.message='[WindowManager]: ScenePath should start with "/"'}}class us extends Error{constructor(){super(...arguments),this.message="[WindowManager]: boxManager not found"}}class ds extends Error{constructor(){super(...arguments),this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const gs="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Tr=gs.length,Ti=Array(20),Be=()=>{for(let i=0;i<20;i++)Ti[i]=gs.charAt(Math.random()*Tr);return Ti.join("")};class Ke{constructor(){this.disposers=new Map}add(e,t=Be()){return this.flush(t),this.disposers.set(t,e()),t}addDisposer(e,t=Be()){return this.flush(t),this.disposers.set(t,e),t}addEventListener(e,t,s,r,n=Be()){return this.add(()=>(e.addEventListener(t,s,r),()=>e.removeEventListener(t,s,r)),n),n}setTimeout(e,t,s=Be()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(s),e()},t);return()=>window.clearTimeout(r)},s)}setInterval(e,t,s=Be()){return this.add(()=>{const r=window.setInterval(e,t);return()=>window.clearInterval(r)},s)}remove(e){const t=this.disposers.get(e);return this.disposers.delete(e),t}flush(e){const t=this.remove(e);if(t)try{t()}catch(s){console.error(s)}}flushAll(){this.disposers.forEach(e=>{try{e()}catch(t){console.error(t)}}),this.disposers.clear()}}const ps=i=>(e,t)=>{if(e!==void 0)if(f.listenUpdated){const s=r=>{r.map(a=>a.kind).includes(i)&&t()};return f.listenUpdated(e,s),t(),()=>f.unlistenUpdated(e,s)}else return f.reaction(()=>e,()=>{t()},{fireImmediately:!0})},_e=(i,e,t)=>{let s=null;const r=f.reaction(i,()=>{s&&(s(),s=null);const n=i();w.isObject(n)?(s=()=>f.unlistenUpdated(n,e),f.listenUpdated(n,e)):t==null||t(n)},{fireImmediately:!0});return()=>{s==null||s(),r()}};ps(f.UpdateEventKind.Removed);ps(f.UpdateEventKind.Inserted);class Pr{constructor(){this.listeners=new Set}get length(){return this.listeners.size}dispatch(e){this.listeners.forEach(t=>t(e))}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}}const Vt=Object.keys;function Pi(i){return Boolean(w.has(i,"__isRef"))}function Lr(i){return{k:Be(),v:i,__isRef:!0}}const se="_WM-STORAGE_";class Li{constructor(e,t,s){if(this.maxIllusionQueueSize=500,this._sideEffect=new Ke,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new Pr,s&&!w.isObject(s))throw new Error(`Default state for Storage ${t} is not an object.`);this._context=e,this.id=t||null,this._state={};const r=this._getRawState(this._state);this._context.getIsWritable()&&(this.id===null?e.isAddApp&&s&&this.setState(s):(r===this._state||!w.isObject(r))&&(w.get(this._context.getAttributes(),[se])||this._context.updateAttributes([se],{}),this._context.updateAttributes([se,this.id],this._state),s&&this.setState(s))),Vt(r).forEach(n=>{if(!(this.id===null&&n===se))try{const a=w.isObject(r[n])?JSON.parse(JSON.stringify(r[n])):r[n];Pi(a)?(this._state[n]=a.v,w.isObject(a.v)&&this._refMap.set(a.v,a)):this._state[n]=a}catch(a){console.error(a)}}),this._sideEffect.addDisposer(_e(()=>this.id===null?e.getAttributes():w.get(e.getAttributes(),[se,this.id]),this._updateProperties.bind(this),this.destroy.bind(this)))}get state(){return this._destroyed&&console.warn(`Accessing state on destroyed Storage "${this.id}"`),this._state}addStateChangedListener(e){return this.onStateChanged.addListener(e),()=>this.onStateChanged.removeListener(e)}ensureState(e){return this.setState(Vt(e).reduce((t,s)=>(w.has(this._state,s)||(t[s]=e[s]),t),{}))}setState(e){if(this._destroyed){console.error(new Error(`Cannot call setState on destroyed Storage "${this.id}".`));return}if(!this._context.getIsWritable()){console.error(new Error(`Cannot setState on Storage "${this.id}" without writable access`),e);return}const t=Vt(e);t.length>0&&t.forEach(s=>{const r=e[s];if(r!==this._state[s])if(r===void 0)this._lastValue.set(s,this._state[s]),delete this._state[s],this._setRawState(s,r);else{this._lastValue.set(s,this._state[s]),this._state[s]=r;let n=r;if(w.isObject(r)){let a=this._refMap.get(r);a||(a=Lr(r),this._refMap.set(r,a)),n=a}this._setRawState(s,n)}})}emptyStorage(){if(!(w.size(this._state)<=0)){if(this._destroyed){console.error(new Error(`Cannot empty destroyed Storage "${this.id}".`));return}if(!this._context.getIsWritable()){console.error(new Error(`Cannot empty Storage "${this.id}" without writable access.`));return}this.setState(w.mapValues(this._state,w.noop))}}deleteStorage(){if(this.id===null)throw new Error("Cannot delete main Storage");if(!this._context.getIsWritable()){console.error(new Error(`Cannot delete Storage "${this.id}" without writable access.`));return}this.destroy(),this._context.updateAttributes([se,this.id],void 0)}get destroyed(){return this._destroyed}destroy(){this._destroyed=!0,this._sideEffect.flushAll()}_getRawState(e){var t;return this.id===null?(t=this._context.getAttributes())!=null?t:e:w.get(this._context.getAttributes(),[se,this.id],e)}_setRawState(e,t){if(this.id===null){if(e===se)throw new Error(`Cannot set attribute internal filed "${se}"`);return this._context.updateAttributes([e],t)}else return this._context.updateAttributes([se,this.id,e],t)}_updateProperties(e){var t;if(this._destroyed){console.error(new Error(`Cannot call _updateProperties on destroyed Storage "${this.id}".`));return}if(e.length>0){const s={};for(let r=0;r<e.length;r++)try{const n=e[r],a=n.key;if(this.id===null&&a===se)continue;const o=w.isObject(n.value)?JSON.parse(JSON.stringify(n.value)):n.value;let h;switch(this._lastValue.has(a)&&(h=this._lastValue.get(a),this._lastValue.delete(a)),n.kind){case 2:{w.has(this._state,a)&&(h=this._state[a],delete this._state[a]),s[a]={oldValue:h};break}default:{let c=o;if(Pi(o)){const{k:l,v:u}=o,d=this._state[a];w.isObject(d)&&((t=this._refMap.get(d))==null?void 0:t.k)===l?c=d:(c=u,w.isObject(u)&&this._refMap.set(u,o))}c!==this._state[a]&&(h=this._state[a],this._state[a]=c),s[a]={newValue:c,oldValue:h};break}}}catch(n){console.error(n)}this.onStateChanged.dispatch(s)}}}class qe{constructor(e,t,s,r,n){this.manager=e,this.boxManager=t,this.appId=s,this.appProxy=r,this.appOptions=n,this.mobxUtils={autorun:f.autorun,reaction:f.reaction,toJS:f.toJS},this.objectUtils={listenUpdated:f.listenUpdated,unlistenUpdated:f.unlistenUpdated,listenDisposed:f.listenDisposed,unlistenDisposed:f.unlistenDisposed},this.store=this.manager.store,this.isReplay=this.manager.isReplay,this.getManager=()=>this.manager,this.getBoxManager=()=>this.boxManager,this.getWindowManager=()=>this.manager.windowManger,this.getBoxStatus=()=>this.manager.store.getBoxStatus(this.appId),this.getLastNotMinimizedBoxStatus=()=>this.manager.store.getLastNotMinimizedBoxStatus(this.appId),this.getDisplayer=()=>this.manager.displayer,this.getAppProxy=()=>this.appProxy,this.getAttributes=()=>this.appProxy.attributes,this.getScenes=()=>{const a=this.store.getAppAttributes(this.appId);return a!=null&&a.isDynamicPPT?this.appProxy.scenes:a==null?void 0:a.options.scenes},this.getView=()=>this.appProxy.view,this.mountView=a=>{const o=this.getView();o&&(o.divElement=a,setTimeout(()=>{var h;(h=this.getRoom())==null||h.refreshViewSize(),L.emit("onAppViewMounted",{appId:this.appId,view:o})},1e3))},this.getInitScenePath=()=>this.manager.getAppInitPath(this.appId),this.getIsWritable=()=>this.manager.canOperate,this.getBox=()=>{const a=this.boxManager.getBox(this.appId);if(a)return a;throw new cs},this.getRoom=()=>this.manager.room,this.setAttributes=a=>{this.manager.safeSetAttributes({[this.appId]:a})},this.updateAttributes=(a,o)=>{this.manager.attributes[this.appId]&&this.manager.safeUpdateAttributes([this.appId,...a],o)},this.setScenePath=async a=>{var o;!this.appProxy.box||(this.appProxy.setFullPath(a),(o=this.getRoom())==null||o.setScenePath(a))},this.getAppOptions=()=>typeof this.appOptions=="function"?this.appOptions():this.appOptions,this.createStorage=(a,o)=>{const h=new Li(this,a,o);return this.emitter.on("destroy",()=>{h.destroy()}),h},this.dispatchMagixEvent=(...a)=>{var h;const o=`${this.appId}:${a[0]}`;return(h=this.manager.room)==null?void 0:h.dispatchMagixEvent(o,a[1])},this.addMagixEventListener=(a,o,h)=>{const c=`${this.appId}:${a}`;return this.manager.displayer.addMagixEventListener(c,o,h),()=>this.manager.displayer.removeMagixEventListener(c,o)},this.removeMagixEventListener=this.manager.displayer.removeMagixEventListener.bind(this.manager.displayer),this.nextPage=async()=>{const a=this.pageState.index+1;return a>this.pageState.length-1?(console.warn("[WindowManager] nextPage: index out of range"),!1):(this.appProxy.setSceneIndex(a),!0)},this.jumpPage=async a=>0<=a&&a<this.pageState.length?(this.appProxy.setSceneIndex(a),!0):(console.warn("[WindowManager] nextPage: index out of range"),!1),this.prevPage=async()=>{const a=this.pageState.index-1;return a<0?(console.warn("[WindowManager] prevPage: index out of range"),!1):(this.appProxy.setSceneIndex(a),!0)},this.addPage=async a=>{const o=a==null?void 0:a.after,h=a==null?void 0:a.scene,c=this.appProxy.scenePath;if(!!c)if(o){const l=this.pageState.index+1;$e(this.manager.room,c,[h||{}],l)}else $e(this.manager.room,c,[h||{}])},this.removePage=async a=>{const o=a===void 0?this.pageState.index:a;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):o<0||o>=this.pageState.length?(console.warn(`[WindowManager]: page index ${a} out of range`),!1):this.appProxy.removeSceneByIndex(o)},this.emitter=r.appEmitter,this.isAddApp=r.isAddApp}get storage(){return this._storage||(this._storage=new Li(this)),this._storage}get pageState(){return this.appProxy.pageState}get kind(){return this.appProxy.kind}dispatchAppEvent(e,t){A.emit(`custom-${this.kind}`,{kind:this.kind,appId:this.appId,type:e,value:t})}}qe.kind="AppContext";class Er{constructor(e){this.params=e,this.sceneNode=null,this.onSceneChange=r=>{this.sceneNode=r,this.params.notifyPageStateChange()};const{displayer:t,scenePath:s}=this.params;s&&(this.sceneNode=t.createScenesCallback(s,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}getFullPath(e){var s;const t=(s=this.sceneNode)==null?void 0:s.scenes;if(this.params.scenePath&&t){const r=t[e];if(r)return`${this.params.scenePath}/${r}`}}toObject(){var e,t;return{index:((e=this.params.view)==null?void 0:e.focusSceneIndex)||0,length:((t=this.sceneNode)==null?void 0:t.scenes.length)||0}}destroy(){var e;(e=this.sceneNode)==null||e.dispose()}}var ms={exports:{}};(function(i){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function r(h,c,l){this.fn=h,this.context=c,this.once=l||!1}function n(h,c,l,u,d){if(typeof l!="function")throw new TypeError("The listener must be a function");var m=new r(l,u||h,d),g=t?t+c:c;return h._events[g]?h._events[g].fn?h._events[g]=[h._events[g],m]:h._events[g].push(m):(h._events[g]=m,h._eventsCount++),h}function a(h,c){--h._eventsCount===0?h._events=new s:delete h._events[c]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],l,u;if(this._eventsCount===0)return c;for(u in l=this._events)e.call(l,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(l)):c},o.prototype.listeners=function(c){var l=t?t+c:c,u=this._events[l];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,m=u.length,g=new Array(m);d<m;d++)g[d]=u[d].fn;return g},o.prototype.listenerCount=function(c){var l=t?t+c:c,u=this._events[l];return u?u.fn?1:u.length:0},o.prototype.emit=function(c,l,u,d,m,g){var b=t?t+c:c;if(!this._events[b])return!1;var M=this._events[b],N=arguments.length,z,v;if(M.fn){switch(M.once&&this.removeListener(c,M.fn,void 0,!0),N){case 1:return M.fn.call(M.context),!0;case 2:return M.fn.call(M.context,l),!0;case 3:return M.fn.call(M.context,l,u),!0;case 4:return M.fn.call(M.context,l,u,d),!0;case 5:return M.fn.call(M.context,l,u,d,m),!0;case 6:return M.fn.call(M.context,l,u,d,m,g),!0}for(v=1,z=new Array(N-1);v<N;v++)z[v-1]=arguments[v];M.fn.apply(M.context,z)}else{var Z=M.length,_;for(v=0;v<Z;v++)switch(M[v].once&&this.removeListener(c,M[v].fn,void 0,!0),N){case 1:M[v].fn.call(M[v].context);break;case 2:M[v].fn.call(M[v].context,l);break;case 3:M[v].fn.call(M[v].context,l,u);break;case 4:M[v].fn.call(M[v].context,l,u,d);break;default:if(!z)for(_=1,z=new Array(N-1);_<N;_++)z[_-1]=arguments[_];M[v].fn.apply(M[v].context,z)}}return!0},o.prototype.on=function(c,l,u){return n(this,c,l,u,!1)},o.prototype.once=function(c,l,u){return n(this,c,l,u,!0)},o.prototype.removeListener=function(c,l,u,d){var m=t?t+c:c;if(!this._events[m])return this;if(!l)return a(this,m),this;var g=this._events[m];if(g.fn)g.fn===l&&(!d||g.once)&&(!u||g.context===u)&&a(this,m);else{for(var b=0,M=[],N=g.length;b<N;b++)(g[b].fn!==l||d&&!g[b].once||u&&g[b].context!==u)&&M.push(g[b]);M.length?this._events[m]=M.length===1?M[0]:M:a(this,m)}return this},o.prototype.removeAllListeners=function(c){var l;return c?(l=t?t+c:c,this._events[l]&&a(this,l)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,i.exports=o})(ms);var Xt=ms.exports;/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
5
5
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -12,57 +12,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var Ot=function(){return Ot=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++){i=arguments[n];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},Ot.apply(this,arguments)};function bf(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(i[n[s]]=e[n[s]]);return i}var kh=0,ay=typeof window!="undefined"&&window.requestAnimationFrame!==void 0?function(e){return window.requestAnimationFrame(e)}:function(e){var t=Date.now(),i=Math.max(0,16.7-(t-kh));kh=t+i,setTimeout(function(){return e(kh)},i)},_P=function(e){var t=[],i=[],n=0,s=!1,o=0,l=new WeakSet,c=new WeakSet,d={cancel:function(f){var g=i.indexOf(f);l.add(f),g!==-1&&i.splice(g,1)},process:function(f){var g;if(s=!0,g=[i,t],t=g[0],i=g[1],i.length=0,n=t.length,n){var v;for(o=0;o<n;o++)v=t[o],v(f),c.has(v)===!0&&!l.has(v)&&(d.schedule(v),e(!0))}s=!1},schedule:function(f,g,v){g===void 0&&(g=!1),v===void 0&&(v=!1);var M=v&&s,E=M?t:i;l.delete(f),g&&c.add(f),E.indexOf(f)===-1&&(E.push(f),M&&(n=t.length))}};return d},PP=40,$v=1/60*1e3,Gl=!0,Ja=!1,fd=!1,Pa={delta:0,timestamp:0},Cf=["read","update","preRender","render","postRender"],NP=function(e){return Ja=e},oy=Cf.reduce(function(e,t){return e[t]=_P(NP),e},{}),kP=Cf.reduce(function(e,t){var i=oy[t];return e[t]=function(n,s,o){return s===void 0&&(s=!1),o===void 0&&(o=!1),Ja||zP(),i.schedule(n,s,o),n},e},{}),BP=function(e){return oy[e].process(Pa)},ly=function(e){Ja=!1,Pa.delta=Gl?$v:Math.max(Math.min(e-Pa.timestamp,PP),1),Gl||($v=Pa.delta),Pa.timestamp=e,fd=!0,Cf.forEach(BP),fd=!1,Ja&&(Gl=!1,ay(ly))},zP=function(){Ja=!0,Gl=!0,fd||ay(ly)},uy=function(e,t){return function(i){return Math.max(Math.min(i,t),e)}},Xl=function(e){return e%1?Number(e.toFixed(5)):e},cy=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,Hu={test:function(e){return typeof e=="number"},parse:parseFloat,transform:function(e){return e}},La=Ot(Ot({},Hu),{transform:uy(0,1)}),Tl=Ot(Ot({},Hu),{default:1}),If=function(e){return{test:function(t){return typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1},parse:parseFloat,transform:function(t){return""+t+e}}},_r=If("deg"),Ra=If("%"),Se=If("px"),jv=Ot(Ot({},Ra),{parse:function(e){return Ra.parse(e)/100},transform:function(e){return Ra.transform(e*100)}}),DP=function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))},LP=uy(0,255),pd=function(e){return e.red!==void 0},gd=function(e){return e.hue!==void 0};function RP(e){return DP(e).replace(/(,|\/)/g," ").split(/ \s*/)}var hy=function(e){return function(t){if(typeof t!="string")return t;for(var i={},n=RP(t),s=0;s<4;s++)i[e[s]]=n[s]!==void 0?parseFloat(n[s]):1;return i}},OP=function(e){var t=e.red,i=e.green,n=e.blue,s=e.alpha,o=s===void 0?1:s;return"rgba("+t+", "+i+", "+n+", "+o+")"},VP=function(e){var t=e.hue,i=e.saturation,n=e.lightness,s=e.alpha,o=s===void 0?1:s;return"hsla("+t+", "+i+", "+n+", "+o+")"},Bh=Ot(Ot({},Hu),{transform:function(e){return Math.round(LP(e))}});function Af(e,t){return e.startsWith(t)&&cy.test(e)}var Jl={test:function(e){return typeof e=="string"?Af(e,"rgb"):pd(e)},parse:hy(["red","green","blue","alpha"]),transform:function(e){var t=e.red,i=e.green,n=e.blue,s=e.alpha,o=s===void 0?1:s;return OP({red:Bh.transform(t),green:Bh.transform(i),blue:Bh.transform(n),alpha:Xl(La.transform(o))})}},zh={test:function(e){return typeof e=="string"?Af(e,"hsl"):gd(e)},parse:hy(["hue","saturation","lightness","alpha"]),transform:function(e){var t=e.hue,i=e.saturation,n=e.lightness,s=e.alpha,o=s===void 0?1:s;return VP({hue:Math.round(t),saturation:Ra.transform(Xl(i)),lightness:Ra.transform(Xl(n)),alpha:Xl(La.transform(o))})}},Uv=Ot(Ot({},Jl),{test:function(e){return typeof e=="string"&&Af(e,"#")},parse:function(e){var t="",i="",n="";return e.length>4?(t=e.substr(1,2),i=e.substr(3,2),n=e.substr(5,2)):(t=e.substr(1,1),i=e.substr(2,1),n=e.substr(3,1),t+=t,i+=i,n+=n),{red:parseInt(t,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:1}}}),Qi={test:function(e){return typeof e=="string"&&cy.test(e)||pd(e)||gd(e)},parse:function(e){return Jl.test(e)?Jl.parse(e):zh.test(e)?zh.parse(e):Uv.test(e)?Uv.parse(e):e},transform:function(e){return pd(e)?Jl.transform(e):gd(e)?zh.transform(e):e}},Tf=function(e){var t=e.onRead,i=e.onRender,n=e.uncachedValues,s=n===void 0?new Set:n,o=e.useCache,l=o===void 0?!0:o;return function(c){c===void 0&&(c={});var d=bf(c,[]),f={},g=[],v=!1;function M(_,P){_.startsWith("--")&&(d.hasCSSVariable=!0);var y=f[_];f[_]=P,f[_]!==y&&(g.indexOf(_)===-1&&g.push(_),v||(v=!0,kP.render(E.render)))}var E={get:function(_,P){P===void 0&&(P=!1);var y=!P&&l&&!s.has(_)&&f[_]!==void 0;return y?f[_]:t(_,d)},set:function(_,P){if(typeof _=="string")M(_,P);else for(var y in _)M(y,_[y]);return this},render:function(_){return _===void 0&&(_=!1),(v||_===!0)&&(i(f,d,g),v=!1,g.length=0),this}};return E}},$P=/([a-z])([A-Z])/g,jP="$1-$2",Zu=function(e){return e.replace($P,jP).toLowerCase()},dy=new Map,Ef=new Map,fy=["Webkit","Moz","O","ms",""],UP=fy.length,WP=typeof document!="undefined",Dh,py=function(e,t){return Ef.set(e,Zu(t))},FP=function(e){Dh=Dh||document.createElement("div");for(var t=0;t<UP;t++){var i=fy[t],n=i==="",s=n?e:i+e.charAt(0).toUpperCase()+e.slice(1);if(s in Dh.style||n){if(n&&e==="clipPath"&&Ef.has(e))return;dy.set(e,s),py(e,(n?"":"-")+Zu(s))}}},HP=function(e){return py(e,e)},gy=function(e,t){t===void 0&&(t=!1);var i=t?Ef:dy;return i.has(e)||(WP?FP(e):HP(e)),i.get(e)||e},ZP=["","X","Y","Z"],QP=["translate","scale","rotate","skew","transformPerspective"],md=QP.reduce(function(e,t){return ZP.reduce(function(i,n){return i.push(t+n),i},e)},["x","y","z"]),YP=md.reduce(function(e,t){return e[t]=!0,e},{});function _f(e){return YP[e]===!0}function GP(e,t){return md.indexOf(e)-md.indexOf(t)}var XP=new Set(["originX","originY","originZ"]);function JP(e){return XP.has(e)}var Wv=Ot(Ot({},Hu),{transform:Math.round}),KP={color:Qi,backgroundColor:Qi,outlineColor:Qi,fill:Qi,stroke:Qi,borderColor:Qi,borderTopColor:Qi,borderRightColor:Qi,borderBottomColor:Qi,borderLeftColor:Qi,borderWidth:Se,borderTopWidth:Se,borderRightWidth:Se,borderBottomWidth:Se,borderLeftWidth:Se,borderRadius:Se,radius:Se,borderTopLeftRadius:Se,borderTopRightRadius:Se,borderBottomRightRadius:Se,borderBottomLeftRadius:Se,width:Se,maxWidth:Se,height:Se,maxHeight:Se,size:Se,top:Se,right:Se,bottom:Se,left:Se,padding:Se,paddingTop:Se,paddingRight:Se,paddingBottom:Se,paddingLeft:Se,margin:Se,marginTop:Se,marginRight:Se,marginBottom:Se,marginLeft:Se,rotate:_r,rotateX:_r,rotateY:_r,rotateZ:_r,scale:Tl,scaleX:Tl,scaleY:Tl,scaleZ:Tl,skew:_r,skewX:_r,skewY:_r,distance:Se,translateX:Se,translateY:Se,translateZ:Se,x:Se,y:Se,z:Se,perspective:Se,opacity:La,originX:jv,originY:jv,originZ:Se,zIndex:Wv,fillOpacity:La,strokeOpacity:La,numOctaves:Wv},Pf=function(e){return KP[e]},qP=function(e,t){return t&&typeof e=="number"?t.transform(e):e},Oa="scrollLeft",Va="scrollTop",my=new Set([Oa,Va]),eN=new Set([Oa,Va,"transform"]),tN={x:"translateX",y:"translateY",z:"translateZ"};function vy(e){return typeof e=="function"}function iN(e,t,i,n,s,o){o===void 0&&(o=!0);var l="",c=!1;i.sort(GP);for(var d=i.length,f=0;f<d;f++){var g=i[f];l+=(tN[g]||g)+"("+t[g]+") ",c=g==="z"?!0:c}return!c&&s?l+="translateZ(0)":l=l.trim(),vy(e.transform)?l=e.transform(t,n?"":l):o&&n&&(l="none"),l}function nN(e,t,i,n,s,o,l,c){t===void 0&&(t=!0),i===void 0&&(i={}),n===void 0&&(n={}),s===void 0&&(s={}),o===void 0&&(o=[]),l===void 0&&(l=!1),c===void 0&&(c=!0);var d=!0,f=!1,g=!1;for(var v in e){var M=e[v],E=Pf(v),_=qP(M,E);_f(v)?(f=!0,n[v]=_,o.push(v),d&&(E.default&&M!==E.default||!E.default&&M!==0)&&(d=!1)):JP(v)?(s[v]=_,g=!0):(!eN.has(v)||!vy(_))&&(i[gy(v,l)]=_)}return(f||typeof e.transform=="function")&&(i.transform=iN(e,n,o,d,t,c)),g&&(i.transformOrigin=(s.originX||"50%")+" "+(s.originY||"50%")+" "+(s.originZ||0)),i}function Nf(e){var t=e===void 0?{}:e,i=t.enableHardwareAcceleration,n=i===void 0?!0:i,s=t.isDashCase,o=s===void 0?!0:s,l=t.allowTransformNone,c=l===void 0?!0:l,d={},f={},g={},v=[];return function(M){return v.length=0,nN(M,n,d,f,g,v,o,c),d}}function rN(e,t){var i=t.element,n=t.preparseOutput,s=Pf(e);if(_f(e))return s&&s.default||0;if(my.has(e))return i[e];var o=window.getComputedStyle(i,null).getPropertyValue(gy(e,!0))||0;return n&&s&&s.test(o)&&s.parse?s.parse(o):o}function sN(e,t,i){var n=t.element,s=t.buildStyles,o=t.hasCSSVariable;if(Object.assign(n.style,s(e)),o)for(var l=i.length,c=0;c<l;c++){var d=i[c];d.startsWith("--")&&n.style.setProperty(d,e[d])}i.indexOf(Oa)!==-1&&(n[Oa]=e[Oa]),i.indexOf(Va)!==-1&&(n[Va]=e[Va])}var aN=Tf({onRead:rN,onRender:sN,uncachedValues:my});function oN(e,t){t===void 0&&(t={});var i=t.enableHardwareAcceleration,n=t.allowTransformNone,s=bf(t,["enableHardwareAcceleration","allowTransformNone"]);return aN(Ot({element:e,buildStyles:Nf({enableHardwareAcceleration:i,allowTransformNone:n}),preparseOutput:!0},s))}var wy=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Fv=.5,yy=function(){return{style:{}}},Lh=function(e,t){return Se.transform(e*t)},lN={x:0,y:0,width:0,height:0};function Hv(e,t,i){return typeof e=="string"?e:Se.transform(t+i*e)}function uN(e,t,i){return Hv(t,e.x,e.width)+" "+Hv(i,e.y,e.height)}var xy={enableHardwareAcceleration:!1,isDashCase:!1};function cN(e,t,i,n,s,o){t===void 0&&(t=lN),n===void 0&&(n=Nf(xy)),s===void 0&&(s=yy()),o===void 0&&(o=!0);var l=e.attrX,c=e.attrY,d=e.originX,f=e.originY,g=e.pathLength,v=e.pathSpacing,M=v===void 0?1:v,E=e.pathOffset,_=E===void 0?0:E,P=bf(e,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),y=n(P);for(var x in y)if(x==="transform")s.style.transform=y[x];else{var I=o&&!wy.has(x)?Zu(x):x;s[I]=y[x]}return(d!==void 0||f!==void 0||y.transform)&&(s.style.transformOrigin=uN(t,d!==void 0?d:Fv,f!==void 0?f:Fv)),l!==void 0&&(s.x=l),c!==void 0&&(s.y=c),i!==void 0&&g!==void 0&&(s[o?"stroke-dashoffset":"strokeDashoffset"]=Lh(-_,i),s[o?"stroke-dasharray":"strokeDasharray"]=Lh(g,i)+" "+Lh(M,i)),s}function hN(e,t,i){i===void 0&&(i=!0);var n=yy(),s=Nf(xy);return function(o){return cN(o,e,t,s,n,i)}}var dN=function(e){return typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()},fN=function(e){try{return dN(e)}catch{return{x:0,y:0,width:0,height:0}}},pN=function(e){return e.tagName==="path"},gN=Tf({onRead:function(e,t){var i=t.element;if(e=wy.has(e)?e:Zu(e),_f(e)){var n=Pf(e);return n&&n.default||0}else return i.getAttribute(e)},onRender:function(e,t){var i=t.element,n=t.buildAttrs,s=n(e);for(var o in s)o==="style"?Object.assign(i.style,s.style):i.setAttribute(o,s[o])}}),mN=function(e){var t=fN(e),i=pN(e)&&e.getTotalLength?e.getTotalLength():void 0;return gN({element:e,buildAttrs:hN(t,i)})},vN=Tf({useCache:!1,onRead:function(e){return e==="scrollTop"?window.pageYOffset:window.pageXOffset},onRender:function(e){var t=e.scrollTop,i=t===void 0?0:t,n=e.scrollLeft,s=n===void 0?0:n;return window.scrollTo(s,i)}}),vd=new WeakMap,wN=function(e){return e instanceof HTMLElement||typeof e.click=="function"},yN=function(e){return e instanceof SVGElement||"ownerSVGElement"in e},xN=function(e,t){var i;return e===window?i=vN(e):wN(e)?i=oN(e,t):yN(e)&&(i=mN(e)),vd.set(e,i),i},SN=function(e,t){return vd.has(e)?vd.get(e):xN(e,t)};function MN(e,t){var i=typeof e=="string"?document.querySelector(e):e;return SN(i,t)}var Gi=function(t,i,n,s){var o=n?n.call(s,t,i):void 0;if(o!==void 0)return!!o;if(t===i)return!0;if(typeof t!="object"||!t||typeof i!="object"||!i)return!1;var l=Object.keys(t),c=Object.keys(i);if(l.length!==c.length)return!1;for(var d=Object.prototype.hasOwnProperty.bind(i),f=0;f<l.length;f++){var g=l[f];if(!d(g))return!1;var v=t[g],M=i[g];if(o=n?n.call(s,v,M,g):void 0,o===!1||o===void 0&&v!==M)return!1}return!0};const Sy="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",bN=Sy.length,Zv=Array(20),va=()=>{for(let e=0;e<20;e++)Zv[e]=Sy.charAt(Math.random()*bN);return Zv.join("")};class fu{constructor(){this.disposers=new Map}add(t,i=va()){return this.flush(i),this.disposers.set(i,t()),i}addDisposer(t,i=va()){return this.flush(i),this.disposers.set(i,t),i}addEventListener(t,i,n,s,o=va()){return this.add(()=>(t.addEventListener(i,n,s),()=>t.removeEventListener(i,n,s)),o),o}setTimeout(t,i,n=va()){return this.add(()=>{const s=window.setTimeout(()=>{this.remove(n),t()},i);return()=>window.clearTimeout(s)},n)}setInterval(t,i,n=va()){return this.add(()=>{const s=window.setInterval(t,i);return()=>window.clearInterval(s)},n)}remove(t){const i=this.disposers.get(t);return this.disposers.delete(t),i}flush(t){const i=this.remove(t);if(i)try{i()}catch(n){console.error(n)}}flushAll(){this.disposers.forEach(t=>{try{t()}catch(i){console.error(i)}}),this.disposers.clear()}}var CN=Object.defineProperty,Rh=(typeof require!="undefined"&&require,(e,t,i)=>(((n,s,o)=>{s in n?CN(n,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[s]=o})(e,typeof t!="symbol"?t+"":t,i),i));class mo{constructor(t,i){Rh(this,"_value"),Rh(this,"_beforeDestroys"),Rh(this,"_subscribers"),this._value=t,i&&(this.compare=i)}get value(){return this._value}setValue(t,i){if(!this.compare(t,this._value)){const n=this._value;this._value=t,this._subscribers&&this._subscribers.forEach(s=>s(t,n,i))}}reaction(t){return this._subscribers||(this._subscribers=new Set),this._subscribers.add(t),()=>{this._subscribers&&this._subscribers.delete(t)}}subscribe(t,i){const n=this.reaction(t);return t(this._value,void 0,i),n}derive(t,i,n){const s=new mo(t(this.value,void 0,n),i),o=this.reaction((l,c,d)=>{s.setValue(t(l,c,d))});return s.addBeforeDestroy(o),s}destroy(){this._beforeDestroys&&(this._beforeDestroys.forEach(t=>t()),this._beforeDestroys.clear()),this._subscribers&&this._subscribers.clear()}addBeforeDestroy(t){return this._beforeDestroys||(this._beforeDestroys=new Set),this._beforeDestroys.add(t),()=>{this._beforeDestroys&&this._beforeDestroys.delete(t)}}compare(t,i){return t===i}}function IN(e,t,i,n){let s=e.map(l=>l.value);const o=new mo(t(s,void 0,n),i);return e.forEach((l,c)=>{const d=l.reaction((f,g,v)=>{const M=s.slice();M[c]=f;const E=s;s=M,o.setValue(t(M,E,v),v)});o.addBeforeDestroy(d)}),o}function My(e,t){Object.keys(t).forEach(i=>{AN(e,i,t[i])})}function AN(e,t,i){var n;return Object.defineProperties(e,{[t]:{get:()=>i.value},[`_${t}$`]:{value:i},[`set${n=t,n[0].toUpperCase()+n.slice(1)}`]:{value:(s,o)=>i.setValue(s,o)}}),e}function by(e){const t=i=>{const n=e.addDisposer(()=>{i.destroy()});return i.addBeforeDestroy(()=>{e.remove(n)}),i};return{bindSideEffect:t,combine:(i,n,s,o)=>t(IN(i,n,s,o)),createVal:(i,n)=>t(new mo(i,n))}}var kf=(e=>(e.Light="light",e.Dark="dark",e.Auto="auto",e))(kf||{}),X=(e=>(e.Normal="normal",e.Minimized="minimized",e.Maximized="maximized",e))(X||{}),tt=(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",e.BoxStatus="box_status",e.LastNotMinimizedBoxStatus="last_not_minimized_box_status",e.ForceTop="force_top",e.ForceNormal="force_normal",e))(tt||{}),Lt=(e=>(e.Close="close",e.Maximize="maximize",e.Minimize="minimize",e))(Lt||{}),Xi=(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",e))(Xi||{});const Oh="dh";function Zt(e,t,i){return Math.min(Math.max(e,t),i)}function _s(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function Qv(e){return e.touches?e.touches[0]:e}function TN(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}let EN=1;function _N(){return`New Box ${EN++}`}function PN(e){return Boolean(e)}function El(e){return!e}class Cy{constructor({readonly:t=!1,title:i,buttons:n,onEvent:s,onDragStart:o,namespace:l="telebox",state:c=X.Normal,boxStatus:d,forceTop:f=!1,forceNormal:g=!1}={}){this.$btns=[],this.sideEffect=new fu,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=v=>{var M;if(this.readonly||v.button!==0||(M=v.target.dataset)!=null&&M.teleTitleBarNoDblClick)return;_s(v);const E=Date.now();E-this.lastTitleBarClick.timestamp<=500?Math.abs(v.clientX-this.lastTitleBarClick.clientX)<=5&&Math.abs(v.clientY-this.lastTitleBarClick.clientY)<=5&&this.onEvent&&this.onEvent({type:Lt.Maximize}):this.onDragStart&&this.onDragStart(v),this.lastTitleBarClick.timestamp=E,this.lastTitleBarClick.clientX=v.clientX,this.lastTitleBarClick.clientY=v.clientY},this.lastTitleBarTouch={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarTouch=v=>{var M;if(this.readonly||(M=v.target.dataset)!=null&&M.teleTitleBarNoDblClick)return;_s(v);const E=Date.now(),{clientX:_=this.lastTitleBarTouch.clientX+100,clientY:P=this.lastTitleBarTouch.clientY+100}=v.touches[0]||{};E-this.lastTitleBarTouch.timestamp<=500?Math.abs(_-this.lastTitleBarTouch.clientX)<=10&&Math.abs(P-this.lastTitleBarTouch.clientY)<=10&&this.onEvent&&this.onEvent({type:Lt.Maximize}):this.onDragStart&&this.onDragStart(v),this.lastTitleBarTouch.timestamp=E,this.lastTitleBarTouch.clientX=_,this.lastTitleBarTouch.clientY=P},this.readonly=t,this.onEvent=s,this.onDragStart=o,this.namespace=l,this.title=i,this.state=c,this.boxStatus=d,this.forceTop=f,this.forceNormal=g,this.buttons=n||(g?[{type:Lt.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}]:[{type:Lt.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:Lt.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:v=>v===X.Maximized},{type:Lt.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}]),this.$dragArea=this.renderDragArea()}setTitle(t){this.title=t,this.$title&&(this.$title.textContent=t,this.$title.title=t)}setState(t){this.state!==t&&(this.state=t,this.buttons.forEach((i,n)=>{i.isActive&&this.$btns[n].classList.toggle("is-active",i.isActive(t))}))}setBoxStatus(t){this.boxStatus!==t&&(this.boxStatus=t,t&&this.buttons.forEach((i,n)=>{i.isActive&&this.$btns[n].classList.toggle("is-active",i.isActive(t))}))}setReadonly(t){this.readonly!==t&&(this.readonly=t)}render(){if(!this.$titleBar){this.$titleBar=document.createElement("div"),this.$titleBar.className=this.wrapClassName("titlebar");const t=document.createElement("div");t.className=this.wrapClassName("title-area"),t.dataset.teleBoxHandle=Oh,this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle=Oh,this.title&&(this.$title.textContent=this.title,this.$title.title=this.title),t.appendChild(this.$title),t.appendChild(this.$dragArea);const i=document.createElement("div");i.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:n,isActive:s},o)=>{const l=String(o),c=document.createElement("button");c.className=`${this.wrapClassName("titlebar-btn")} ${n}`,c.dataset.teleTitleBarBtnIndex=l,c.dataset.teleTitleBarNoDblClick="true",s&&c.classList.toggle("is-active",s(this.boxStatus||this.state)),this.$btns.push(c),i.appendChild(c)}),this.sideEffect.addEventListener(i,"click",n=>{var s;if(this.readonly)return;const o=n.target,l=Number((s=o.dataset)==null?void 0:s.teleTitleBarBtnIndex);if(!Number.isNaN(l)&&l<this.buttons.length){_s(n);const c=this.buttons[l];this.onEvent&&this.onEvent({type:c.type,value:c.value})}}),this.$titleBar.appendChild(t),this.$titleBar.appendChild(i)}return this.$titleBar}renderDragArea(){const t=document.createElement("div");return t.className=this.wrapClassName("drag-area"),t.dataset.teleBoxHandle=Oh,this.sideEffect.addEventListener(t,"mousedown",this.handleTitleBarClick),this.sideEffect.addEventListener(t,"touchstart",this.handleTitleBarTouch,{passive:!0}),t}dragHandle(){return this.$titleBar}wrapClassName(t){return`${this.namespace}-${t}`}destroy(){this.sideEffect.flushAll(),this.$titleBar&&(this.$titleBar=void 0,this.$title=void 0,this.$btns.length=0,this.onDragStart=void 0,this.onEvent=void 0)}}class NN{constructor({id:t=TN(),title:i=_N(),prefersColorScheme:n=kf.Light,darkMode:s,visible:o=!0,width:l=.5,height:c=.5,minWidth:d=0,minHeight:f=0,x:g=.1,y:v=.1,minimized:M=!1,maximized:E=!1,readonly:_=!1,resizable:P=!0,draggable:y=!0,fence:x=!0,fixRatio:I=!1,focus:C=!1,zIndex:k=100,namespace:L="telebox",titleBar:W,content:Q,footer:J,styles:K,containerRect:De={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collectorRect:U,boxStatus:z,lastNotMinimizedBoxStatus:oe,forceTop:ie=!1,forceNormal:be=!1,isDragContent:Ve=!1}={}){this._renderSideEffect=new fu,this.handleTrackStart=ee=>{var Ce;return(Ce=this._handleTrackStart)==null?void 0:Ce.call(this,ee)},this._sideEffect=new fu,this._valSideEffectBinder=by(this._sideEffect);const{combine:Le,createVal:le}=this._valSideEffectBinder;this.id=t,this.namespace=L,this.events=new dd,this._delegateEvents=new dd;const pt=le(z),Ct=le(oe),ot=le(n);ot.reaction((ee,Ce,re)=>{re||this.events.emit(tt.PrefersColorScheme,ee)});const ti=le(Boolean(s));s==null&&ot.subscribe((ee,Ce,re)=>{this._sideEffect.add(()=>{if(ee==="auto"){const We=window.matchMedia("(prefers-color-scheme: dark)");if(We){ti.setValue(We.matches,re);const ii=yi=>{ti.setValue(yi.matches,re)};return We.addListener(ii),()=>We.removeListener(ii)}else return Yv}else return ti.setValue(ee==="dark",re),Yv},"prefers-color-scheme")}),ti.reaction((ee,Ce,re)=>{re||this.events.emit(tt.DarkMode,ee)});const zn=le(De,Gi),F=le(U,Gi),q=le(ie);q.reaction((ee,Ce,re)=>{re||this.events.emit(tt.ForceTop,ee||!1)});const B=le(be);B.reaction((ee,Ce,re)=>{re||this.events.emit(tt.ForceNormal,ee||!1)});const $=le(Ve),Z=le(i);Z.reaction((ee,Ce,re)=>{re||this.titleBar.setTitle(ee)});const ne=le(o);ne.reaction((ee,Ce,re)=>{!re&&!ee&&this.events.emit(tt.Close)});const pe=le(_);pe.reaction((ee,Ce,re)=>{re||this.events.emit(tt.Readonly,ee)});const ve=le(P),ge=le(y),Xe=le(x),Ze=le(I),Ue=le(k);Ue.reaction((ee,Ce,re)=>{re||this.events.emit(tt.ZIndex,ee)});const ut=le(C);ut.reaction((ee,Ce,re)=>{re||this.events.emit(ee?tt.Focus:tt.Blur)});const Qe=le(M);Qe.reaction((ee,Ce,re)=>{re||this.events.emit(tt.Minimized,ee)});const jt=le(E);jt.reaction((ee,Ce,re)=>{re||this.events.emit(tt.Maximized,ee)});const Dn=Le([Qe,jt,pt],([ee,Ce,re])=>ee?X.Minimized:Ce?X.Maximized:re||X.Normal);Dn.reaction((ee,Ce,re)=>{re||this.events.emit(tt.State,ee)});const mi=le({width:Zt(d,0,1),height:Zt(f,0,1)},Gi),ct=le({width:Zt(l,mi.value.width,1),height:Zt(c,mi.value.height,1)},Gi);mi.reaction((ee,Ce,re)=>{ct.setValue({width:Zt(l,ee.width,1),height:Zt(c,ee.height,1)},re)}),ct.reaction((ee,Ce,re)=>{re||this.events.emit(tt.IntrinsicResize,ee)});const gt=Le([ct,jt,pt],([ee,Ce,re])=>Ce||re===X.Maximized?{width:1,height:1}:ee,Gi);gt.reaction((ee,Ce,re)=>{re||this.events.emit(tt.Resize,ee)});const Ui=Le([gt,Qe,zn,F,pt],([ee,Ce,re,We,ii])=>(Ce||ii===X.Minimized)&&We?{width:We.width/ee.width/re.width,height:We.height/ee.height/re.height}:ee,Gi);Ui.reaction((ee,Ce,re)=>{re||this.events.emit(tt.VisualResize,ee)});const vr=le({x:Zt(g,0,1),y:Zt(v,0,1)},Gi);vr.reaction((ee,Ce,re)=>{re||this.events.emit(tt.IntrinsicMove,ee)});const vi=Le([vr,ct,zn,F,Qe,jt,pt,Ct],([ee,Ce,re,We,ii,yi,Wi,yr])=>(ii||Wi===X.Minimized)&&We?yi||yr===X.Maximized?{x:(We.x+We.width/2)/re.width-1/2,y:(We.y+We.height/2)/re.height-1/2}:{x:(We.x+We.width/2)/re.width-Ce.width/2,y:(We.y+We.height/2)/re.height-Ce.height/2}:yi||Wi===X.Maximized?{x:0,y:0}:ee,Gi);vi.reaction((ee,Ce,re)=>{re||this.events.emit(tt.Move,ee)}),this.titleBar=W||new Cy({readonly:pe.value,title:Z.value,namespace:this.namespace,boxStatus:pt.value,forceTop:q.value,forceNormal:B.value,onDragStart:ee=>{var Ce;return(Ce=this._handleTrackStart)==null?void 0:Ce.call(this,ee)},onEvent:ee=>{if(this._delegateEvents.listeners.length>0)this._delegateEvents.emit(ee.type);else switch(ee.type){case Lt.Maximize:{pt.value||jt.setValue(!jt.value);break}case Lt.Minimize:{pt.value||Qe.setValue(!0);break}case Lt.Close:{ne.setValue(!1);break}default:{console.error("Unsupported titleBar event:",ee);break}}}}),pe.reaction(ee=>{this.titleBar.setReadonly(ee)}),pt.reaction(ee=>{this.titleBar.setBoxStatus(ee)});const ta=le(Q),un=le(J),wi=le(K);My(this,{prefersColorScheme:ot,darkMode:ti,containerRect:zn,collectorRect:F,title:Z,visible:ne,readonly:pe,resizable:ve,draggable:ge,fence:Xe,fixRatio:Ze,focus:ut,zIndex:Ue,minimized:Qe,maximized:jt,$userContent:ta,$userFooter:un,$userStyles:wi,forceTop:q,forceNormal:B,isDragContent:$}),this._state$=Dn,this._minSize$=mi,this._size$=gt,this._intrinsicSize$=ct,this._visualSize$=Ui,this._coord$=vi,this._intrinsicCoord$=vr,this._boxStatus$=pt,this._lastNotMinimizedBoxStatus$=Ct,this.fixRatio&&this.transform(vi.value.x,vi.value.y,gt.value.width,gt.value.height,!0),this.$box=this.render()}get boxStatus(){return this._boxStatus$.value}set boxStatus(t){this._boxStatus$.setValue(t)}get lastNotMinimizedBoxStatus(){return this._lastNotMinimizedBoxStatus$.value}get darkMode(){return this._darkMode$.value}get state(){return this._state$.value}setState(t,i=!1){switch(t){case X.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case X.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}setBoxStatus(t,i=!1){return t===X.Minimized?this._boxStatus$.value&&this._boxStatus$.value!==X.Minimized&&this.setLastNotMinimizedBoxStatus(this._boxStatus$.value,i):this.setLastNotMinimizedBoxStatus(void 0,i),this._boxStatus$.setValue(t,i),i||this.events.emit(tt.BoxStatus,{id:this.id,boxStatus:t}),this}setLastNotMinimizedBoxStatus(t,i=!1){return this._lastNotMinimizedBoxStatus$.setValue(t,i),i||this.events.emit(tt.LastNotMinimizedBoxStatus,{id:this.id,lastNotMinimizedBoxStatus:t}),this}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(t,i=!1){return this._minSize$.setValue({width:t,height:this.minHeight},i),this}setMinHeight(t,i=!1){return this._minSize$.setValue({width:this.minWidth,height:t},i),this}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}resize(t,i,n=!1){return this._intrinsicSize$.setValue({width:t,height:i},n),this}get width(){return this._size$.value.width}get height(){return this._size$.value.height}get absoluteWidth(){return this.width*this.containerRect.width}get absoluteHeight(){return this.height*this.containerRect.height}get visualWidth(){return this._visualSize$.value.width}get visualHeight(){return this._visualSize$.value.height}get intrinsicX(){return this._intrinsicCoord$.value.x}get intrinsicY(){return this._intrinsicCoord$.value.y}move(t,i,n=!1){return this._intrinsicCoord$.setValue({x:t,y:i},n),this}get x(){return this._coord$.value.x}get y(){return this._coord$.value.y}transform(t,i,n,s,o=!1){if(this.fixRatio){const l=this.intrinsicHeight/this.intrinsicWidth*n;i!==this.intrinsicY&&(i-=l-s),s=l}return i<0&&(i=0,s>this.intrinsicHeight&&(s=this.intrinsicHeight)),this._intrinsicCoord$.setValue({x:n>=this.minWidth?t:this.intrinsicX,y:s>=this.minHeight?i:this.intrinsicY},o),this._intrinsicSize$.setValue({width:Zt(n,this.minWidth,1),height:Zt(s,this.minHeight,1)},o),this}mount(t){return t.appendChild(this.render()),this}unmount(){return this.$box&&this.$box.remove(),this}mountContent(t){return this.set$userContent(t),this}unmountContent(){return this.set$userContent(void 0),this}mountFooter(t){return this.set$userFooter(t),this}unmountFooter(){return this.set$userFooter(void 0),this}getUserStyles(){return this.$userStyles}mountStyles(t){let i;return typeof t=="string"?(i=document.createElement("style"),i.textContent=t):i=t,this.set$userStyles(i),this}unmountStyles(){return this.set$userStyles(void 0),this}render(t){if(t){if(t===this.$box)return this.$box;this.$box=t}else{if(this.$box)return this.$box;this.$box=document.createElement("div")}this._renderSideEffect.flushAll(),this.$box.classList.add(this.wrapClassName("box"));const i=(v,M,E,_=PN)=>this._renderSideEffect.add(()=>{const P=this.wrapClassName(E);return M.subscribe(y=>{v.classList.toggle(P,_(y))})});i(this.$box,this._readonly$,"readonly"),i(this.$box,this._draggable$,"no-drag",El),i(this.$box,this._resizable$,"no-resize",El),i(this.$box,this._focus$,"blur",El),i(this.$box,this._darkMode$,"color-scheme-dark"),i(this.$box,this._darkMode$,"color-scheme-light",El),this._renderSideEffect.add(()=>{const v=this.wrapClassName("minimized"),M=this.wrapClassName("maximized"),E="box-maximized-timer";return this._state$.subscribe(_=>{this.$box.classList.toggle(v,_===X.Minimized),_===X.Maximized?(this._renderSideEffect.flush(E),this.$box.classList.toggle(M,!0)):this._renderSideEffect.setTimeout(()=>{this.$box.classList.toggle(M,!1)},0,E)})}),this._renderSideEffect.add(()=>this._visible$.subscribe(v=>{v?this.$box.style.removeProperty("display"):this.$box.style.display="none"})),this._renderSideEffect.add(()=>this._zIndex$.subscribe(v=>{this.$box.style.zIndex=String(v)}));const n=MN(this.$box);this.$box.dataset.teleBoxID=this.id,this.$box.style.width=this.absoluteWidth+"px",this.$box.style.height=this.absoluteHeight+"px";const s=this.x*this.containerRect.width+this.containerRect.x,o=this.y*this.containerRect.height+this.containerRect.y;this.$box.style.transform=`translate(${s-10}px,${o-10}px)`,this._valSideEffectBinder.combine([this._coord$,this._size$,this._minimized$,this._containerRect$,this._collectorRect$,this._boxStatus$],([v,M,E,_,P,y])=>{const x=M.width*_.width,I=M.height*_.height;return{width:x+((E||y===X.Minimized)&&P?1:0),height:I+((E||y===X.Minimized)&&P?1:0),x:v.x*_.width,y:v.y*_.height,scaleX:(E||y===X.Minimized)&&P?P.width/x:1,scaleY:(E||y===X.Minimized)&&P?P.height/I:1}},Gi).subscribe(v=>{n.set(v)}),n.set({x:s,y:o});const l=document.createElement("div");l.className=this.wrapClassName("box-main"),this.$box.appendChild(l);const c=document.createElement("div");c.className=this.wrapClassName("titlebar-wrap"),c.appendChild(this.titleBar.render()),this.$titleBar=c;const d=document.createElement("div");d.className=this.wrapClassName("content-wrap");const f=document.createElement("div");f.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=f,this.isDragContent&&this.$content.appendChild(this.titleBar.$dragArea),this._renderSideEffect.add(()=>{let v;return this._$userStyles$.subscribe(M=>{v&&v.remove(),v=M,M&&d.appendChild(M)})}),this._renderSideEffect.add(()=>{let v;return this._$userContent$.subscribe(M=>{v&&v.remove(),v=M,M&&f.appendChild(M)})}),d.appendChild(f);const g=document.createElement("div");return g.className=this.wrapClassName("footer-wrap"),this.$footer=g,this._renderSideEffect.add(()=>{let v;return this._$userFooter$.subscribe(M=>{v&&v.remove(),v=M,M&&g.appendChild(M)})}),l.appendChild(c),l.appendChild(d),l.appendChild(g),this._renderResizeHandlers(),this.$box}_renderResizeHandlers(){const t=document.createElement("div");t.className=this.wrapClassName("resize-handles"),Object.values(Xi).forEach(P=>{const y=document.createElement("div");y.className=this.wrapClassName(P)+" "+this.wrapClassName("resize-handle"),y.dataset.teleBoxHandle=P,t.appendChild(y)}),this.$box.appendChild(t);const i="handle-tracking-listener",n=this.wrapClassName("transforming");let s,o=0,l=0,c=0,d=0,f=0,g=0,v;const M=P=>{if(this.state!==X.Normal)return;_s(P);let{pageX:y,pageY:x}=Qv(P);x<0&&(x=0);const I=(y-f)/this.containerRect.width,C=(x-g)/this.containerRect.height;switch(v){case Xi.North:{this.transform(this.x,l+C,this.width,d-C);break}case Xi.South:{this.transform(this.x,this.y,this.width,d+C);break}case Xi.West:{this.transform(o+I,this.y,c-I,this.height);break}case Xi.East:{this.transform(this.x,this.y,c+I,this.height);break}case Xi.NorthWest:{this.transform(o+I,l+C,c-I,d-C);break}case Xi.NorthEast:{this.transform(this.x,l+C,c+I,d-C);break}case Xi.SouthEast:{this.transform(this.x,this.y,c+I,d+C);break}case Xi.SouthWest:{this.transform(o+I,this.y,c-I,d+C);break}default:{if(this.fence)this.move(Zt(o+I,0,1-this.width),Zt(l+C,0,1-this.height));else{const k=20/this.containerRect.width,L=20/this.containerRect.height;this.move(Zt(o+I,k-this.width,1-k),Zt(l+C,0,1-L))}break}}},E=P=>{v=void 0,s&&(_s(P),this.$box.classList.toggle(n,!1),this._sideEffect.flush(i),s.remove())},_=P=>{var y;if(this.readonly||P.button!=null&&P.button!==0||!this.draggable||v||this.state!==X.Normal)return;const x=P.target;if((y=x.dataset)!=null&&y.teleBoxHandle){_s(P),o=this.x,l=this.y,c=this.width,d=this.height,{pageX:f,pageY:g}=Qv(P),v=x.dataset.teleBoxHandle,s||(s=document.createElement("div"));const I=v?this.wrapClassName(`cursor-${v}`):"";s.className=this.wrapClassName(`track-mask${I?` ${I}`:""}`),this.$box.appendChild(s),this.$box.classList.add(n),this._sideEffect.add(()=>(window.addEventListener("mousemove",M),window.addEventListener("touchmove",M,{passive:!1}),window.addEventListener("mouseup",E),window.addEventListener("touchend",E,{passive:!1}),window.addEventListener("touchcancel",E,{passive:!1}),()=>{window.removeEventListener("mousemove",M),window.removeEventListener("touchmove",M),window.removeEventListener("mouseup",E),window.removeEventListener("touchend",E),window.removeEventListener("touchcancel",E)}),i)}};this._handleTrackStart=_,this._sideEffect.addEventListener(t,"mousedown",_,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(t,"touchstart",_,{passive:!1},"box-resizeHandles-touchstart")}destroy(){this.$box.remove(),this.events.emit(tt.Destroyed),this._sideEffect.flushAll(),this._renderSideEffect.flushAll(),this.events.removeAllListeners(),this._delegateEvents.removeAllListeners()}wrapClassName(t){return`${this.namespace}-${t}`}}function Yv(){}var kN="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class Ys{constructor({visible:t=!0,readonly:i=!1,darkMode:n=!1,namespace:s="telebox",styles:o={},onClick:l,getBoxesStatus:c}){this.$appMenuContainer=document.createElement("div"),this.handleCollectorClick=()=>{!this._readonly&&this.onClick&&this.onClick()},this._visible=t,this._readonly=i,this._darkMode=n,this.namespace=s,this.styles=o,this.onClick=l,this.getBoxesStatus=c}get boxesStatus(){var t;return(t=this.getBoxesStatus)==null?void 0:t.call(this)}get visible(){return this._visible}get readonly(){return this._readonly}get darkMode(){return this._darkMode}mount(t){return t.appendChild(this.render()),this}unmount(){return this.$collector&&this.$collector.remove(),this}hasMinimizedBox(){const t=this.boxesStatus;if(t){for(const i of t.values())if(i===X.Minimized)return!0}return!1}updateBoxesStatus(){const t=this.hasMinimizedBox();this.setVisible(t)}setVisible(t){return this._visible!==t&&(this._visible=t,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-visible"),t)),this}setReadonly(t){return this._readonly!==t&&(this._readonly=t,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-readonly"),t)),this}setDarkMode(t){return this._darkMode!==t&&(this._darkMode=t,this.$collector&&(this.$collector.classList.toggle(this.wrapClassName("color-scheme-dark"),t),this.$collector.classList.toggle(this.wrapClassName("color-scheme-light"),!t))),this}setStyles(t){if(Object.assign(this.styles,t),this.$collector){const i=this.$collector;Object.keys(t).forEach(n=>{const s=t[n];s!=null&&(i.style[n]=s)})}return this}render(){return this.$collector||(this.$collector=document.createElement("button"),this.$collector.className=this.wrapClassName("collector"),this.$collector.style.backgroundImage=`url('${kN}')`,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.$appMenuContainer.classList.add(this.wrapClassName("collector-shadow")),this.$collector.append(this.$appMenuContainer),this.setStyles(this.styles)),this.$collector}destroy(){this.$collector&&(this.$collector.removeEventListener("click",this.handleCollectorClick),this.$collector.remove(),this.$collector=void 0),this.onClick=void 0}wrapClassName(t){return`${this.namespace}-${t}`}}Ys.kind="TeleBoxCollector";var lt=(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",e.BoxStatus="box_status",e.LastNotMinimizedBoxStatus="last_not_minimized_box_status",e))(lt||{});class BN extends Cy{constructor(t){super(t),this.boxes=t.boxes,this.focusedBox=t.focusedBox,this.containerRect=t.containerRect,this.darkMode=t.darkMode,this.getBoxesStatus=t.getBoxesStatus}get boxesStatus(){var t;return(t=this.getBoxesStatus)==null?void 0:t.call(this)}hasMaximizedBoxInStatus(){if(this.getBoxesStatus){const t=this.getBoxesStatus();if(t.size)return!![...t.values()].find(n=>n===X.Maximized)}return!1}get MaximizedBoxes(){if(this.getBoxesStatus){const t=this.getBoxesStatus();if(t)return this.boxes.filter(i=>t&&t.get(i.id)===X.Maximized&&!i.forceTop)}return[]}focusBox(t){var i,n;if(!(this.focusedBox&&this.focusedBox===t)){if(this.$titles){const{children:s}=this.$titles.firstElementChild;if(this.state===X.Maximized&&!this.hasMaximizedBoxInStatus())for(let o=s.length-1;o>=0;o-=1){const l=s[o],c=(i=l.dataset)==null?void 0:i.teleBoxID;c&&(t&&c===t.id?l.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&c===this.focusedBox.id&&l.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}else if(this.hasMaximizedBoxInStatus())for(let o=s.length-1;o>=0;o-=1){const l=s[o],c=(n=l.dataset)==null?void 0:n.teleBoxID;c&&(t&&c===t.id?l.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&c===this.focusedBox.id&&l.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}}this.focusedBox=t}}setContainerRect(t){if(this.containerRect=t,this.$titleBar){const{x:i,y:n,width:s}=t;this.$titleBar.style.transform=`translate(${i}px, ${n}px)`,this.$titleBar.style.width=s+"px"}}updateBoxesStatus(){this.hasMaximizedBoxInStatus()&&this.setBoxStatus(X.Maximized),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===X.Maximized&&this.boxes.length>0||this.hasMaximizedBoxInStatus()),this.updateTitles()}setBoxes(t){this.boxes=t,this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===X.Maximized&&t.length>0||this.hasMaximizedBoxInStatus()),this.updateTitles()}setState(t){super.setState(t),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),t===X.Maximized&&this.boxes.length>0||this.hasMaximizedBoxInStatus()),this.updateTitles()}setReadonly(t){super.setReadonly(t),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("readonly"),this.readonly)}setDarkMode(t){t!==this.darkMode&&(this.darkMode=t,this.$titleBar&&(this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-dark"),t),this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-light"),!t)))}render(){const t=super.render(),{x:i,y:n,width:s}=this.containerRect;t.style.transform=`translate(${i}px, ${n}px)`,t.style.width=s+"px",t.classList.add(this.wrapClassName("max-titlebar")),t.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===X.Maximized&&this.boxes.length>0),t.classList.toggle(this.wrapClassName("readonly"),this.readonly),t.classList.add(this.wrapClassName(this.darkMode?"color-scheme-dark":"color-scheme-light"));const o=document.createElement("div");return o.classList.add(this.wrapClassName("titles-area")),t.insertBefore(o,t.firstElementChild),this.updateTitles(),t}destroy(){super.destroy(),this.$titles=void 0,this.boxes.length=0,this.focusedBox=void 0}updateTitles(){this.$titleBar&&(this.state===X.Maximized||this.hasMaximizedBoxInStatus())&&(this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-single-title"),this.boxes.length===1||this.hasMaximizedBoxInStatus()&&this.MaximizedBoxes.length===1),this.boxes.length===1||this.hasMaximizedBoxInStatus()&&this.MaximizedBoxes.length===1?this.setTitle(this.boxes[0].title):this.$titleBar.replaceChild(this.renderTitles(),this.$titleBar.firstElementChild))}renderTitles(){this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.$titles.addEventListener("wheel",i=>{i.currentTarget.scrollBy({left:i.deltaY>0?250:-250,behavior:"smooth"})},{passive:!1});const t=document.createElement("div");return t.className=this.wrapClassName("titles-content"),this.$titles.appendChild(t),(this.hasMaximizedBoxInStatus()?this.MaximizedBoxes:this.boxes).forEach(i=>{const n=document.createElement("button");n.className=this.wrapClassName("titles-tab"),n.textContent=i.title,n.dataset.teleBoxID=i.id,n.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&i.id===this.focusedBox.id&&n.classList.add(this.wrapClassName("titles-tab-focus")),t.appendChild(n)}),this.$titles}}class zN{constructor(t){this.namespace="telebox-app-menu",this.badge=document.createElement("div"),this.menuView=document.createElement("div"),this.containerClickHandler=()=>{if(this.manager.readonly)return;getComputedStyle(this.menuView).display==="flex"?this.menuView.style.display="none":this.menuView.style.display="flex"},this.menuViewClickHandler=i=>{i.stopPropagation(),i.stopImmediatePropagation();const s=i.target.getAttribute(`data-${this.c("app-id")}`);if(s){const o=this.manager.getLastNotMinimizedBoxStatus(s)||X.Normal,l=(o===X.Maximized?this.manager.getMaxMaximizedBoxZIndex():this.manager.getMaxNormalBoxZIndex())+1;this.manager.setBox(s,{status:o,zIndex:l},!1,()=>{this.manager.focusBox(s)});return}},this.updatePrefersColorSchemeHandler=()=>{this.container.classList.remove(this.theme),this.theme=this.manager.prefersColorScheme,this.container.classList.add(this.theme)},this.appMenuChange=()=>{const i=this.manager.getMinimizedBoxesStatus();this.render(i)},this.container=t.container,this.manager=t.manager,this.theme=t.theme,this.getBoxesStatus=t.getBoxesStatus,this.init()}get boxesStatus(){var t;return((t=this.getBoxesStatus)==null?void 0:t.call(this))||new Map}get minimizedBoxesStatus(){const t=[];return this.boxesStatus.forEach(i=>{i===X.Minimized&&t.push(i)}),t}c(t){return`${this.namespace}-${t}`}setContainer(t){this.container&&this.container.remove(),this.container=t,this.init()}createDefaultAppMenu(){this.badge.classList.add(this.c("app-menu-badge")),this.menuView.classList.add(this.c("app-menu-tooltip")),this.container.classList.add(this.c("app-menu-container"),this.theme),this.menuView.addEventListener("click",this.menuViewClickHandler),this.container.append(this.badge,this.menuView)}async init(){this.createDefaultAppMenu(),this.appMenuChange()}createMinimizedItem(t){const i=document.createElement("div");i.classList.add(this.c("app-menu-item")),i.setAttribute(`data-${this.c("app-id")}`,t);const n=document.createElement("div");n.classList.add(this.c("app-menu-item-title"));const s=this.manager.getBox(t);return n.innerText=(s==null?void 0:s.title)||t,i.appendChild(n),i}renderMenuView(t){const i=[];t.forEach((n,s)=>{i.push(this.createMinimizedItem(s))}),this.menuView.append(...i)}render(t){this.menuView.style.display="none",this.badge.innerText="",this.menuView.innerHTML="",t.size===0?this.container.style.display="none":(this.badge.innerText=t.size.toString(),this.renderMenuView(t),this.container.style.display="block")}destroy(){this.badge.remove(),this.menuView.removeEventListener("click",this.menuViewClickHandler),this.menuView.remove(),this.container.remove()}}class vo{constructor({root:t=document.body,prefersColorScheme:i=kf.Light,minimized:n=!1,maximized:s=!1,fence:o=!0,containerRect:l={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collector:c,namespace:d="telebox",readonly:f=!1,useBoxesStatus:g=!1}={}){this.events=new dd,this._sideEffect=new fu,this.useBoxesStatus=g;const{combine:v,createVal:M}=by(this._sideEffect);this.root=t,this.namespace=d,this.boxes$=M([]),this.topBox$=this.boxes$.derive(U=>{if(U.length>0){let z;return U.reduce((ie,be)=>be.forceTop||be.boxStatus&&be.boxStatus===X.Minimized?ie:ie?ie.zIndex>be.zIndex?ie:be:(ie=be,ie),z)}}),this.boxesStatus$=new Map,this.lastNotMinimizedBoxesStatus$=new Map;const E=window.matchMedia("(prefers-color-scheme: dark)"),_=M(!1);E&&(_.setValue(E.matches),this._sideEffect.add(()=>{const U=z=>{_.setValue(z.matches)};return E.addListener(U),()=>E.removeListener(U)}));const P=M(i);P.reaction((U,z,oe)=>{this.boxes.forEach(ie=>ie.setPrefersColorScheme(U,oe)),oe||this.events.emit(lt.PrefersColorScheme,U)}),this._darkMode$=v([_,P],([U,z])=>z==="auto"?U:z==="dark"),this._darkMode$.reaction((U,z,oe)=>{this.boxes.forEach(ie=>ie.setDarkMode(U,oe)),oe||this.events.emit(lt.DarkMode,U)});const y=M(f);y.reaction((U,z,oe)=>{this.boxes.forEach(ie=>ie.setReadonly(U,oe))});const x=M(n),I=M(s);I.reaction((U,z,oe)=>{this.boxes.forEach(ie=>ie.setMaximized(U,oe)),oe||this.events.emit(lt.Maximized,U)});const C=v([x,I],([U,z])=>U?X.Minimized:z?X.Maximized:X.Normal);C.reaction((U,z,oe)=>{this.maxTitleBar.setState(U),oe||this.events.emit(lt.State,U)});const k=M(o);k.subscribe((U,z,oe)=>{this.boxes.forEach(ie=>ie.setFence(U,oe))});const L=M(l,Gi);L.reaction((U,z,oe)=>{this.boxes.forEach(ie=>ie.setContainerRect(U,oe)),this.maxTitleBar.setContainerRect(U)});const W=M(c===null?null:c||new Ys({visible:n,readonly:f,namespace:d}).mount(t));W.subscribe(U=>{U&&(U.setVisible(x.value),U.setReadonly(y.value),U.setDarkMode(this._darkMode$.value),this.useBoxesStatus&&this.appMenu&&this.appMenu.setContainer(U.$appMenuContainer),this._sideEffect.add(()=>(U.getBoxesStatus=()=>this.boxesStatus$,U.onClick=()=>{y.value||(this.useBoxesStatus?this.useBoxesStatus&&this.appMenu&&this.appMenu.containerClickHandler():x.setValue(!1))},()=>U.destroy()),"collect-onClick"))}),y.subscribe(U=>{var z;return(z=W.value)==null?void 0:z.setReadonly(U)}),this._darkMode$.subscribe(U=>{var z;(z=W.value)==null||z.setDarkMode(U)}),this._calcCollectorRect=()=>{var U;if((U=W.value)!=null&&U.$collector){const{x:z,y:oe,width:ie,height:be}=W.value.$collector.getBoundingClientRect(),Ve=this.root.getBoundingClientRect();return{x:z-Ve.x,y:oe-Ve.y,width:ie,height:be}}},this._setCollectorRect=U=>{var z;(z=W.value)!=null&&z.$collector&&Q.setValue(U)};const Q=M(x.value?this._calcCollectorRect():void 0);Q.subscribe((U,z,oe)=>{this.boxes.forEach(ie=>{ie.setCollectorRect(U,oe)})}),x.subscribe((U,z,oe)=>{var ie;(ie=W.value)==null||ie.setVisible(U),U&&this._setCollectorRect(this._calcCollectorRect()),this.boxes.forEach(be=>be.setMinimized(U,oe)),oe||this.events.emit(lt.Minimized,U)});const J=this.wrapClassName("titlebar-icon-close"),K=U=>{var z;if(y.value)return;const oe=U.target;if(!!oe.tagName)for(let ie=oe;ie;ie=ie.parentElement){if(ie.classList&&ie.classList.contains(J))return;const be=(z=ie.dataset)==null?void 0:z.teleBoxID;if(be){const Ve=this.getBox(be);if(Ve){if(!this.useBoxesStatus)this.makeBoxTop(Ve);else if(Ve.boxStatus&&Ve.boxStatus===X.Normal){const Le=this.getMaxNormalBoxZIndex();Le>Ve.zIndex&&this.setBox(Ve,{zIndex:Le+1},!1)}else if(Ve.boxStatus&&Ve.boxStatus===X.Maximized){const Le=this.getMaxMaximizedBoxZIndex();Le>Ve.zIndex&&this.setBox(Ve,{zIndex:Le+1},!1),this.makeMaximizedTopBoxFocus()}this.focusBox(Ve);return}}}};this._sideEffect.addEventListener(window,"mousedown",K,!0),this._sideEffect.addEventListener(window,"touchstart",K,!0),this.maxTitleBar=new BN({darkMode:this.darkMode,readonly:y.value,namespace:this.namespace,state:C.value,boxes:this.boxes$.value,containerRect:L.value,getBoxesStatus:()=>this.boxesStatus$,onEvent:U=>{switch(U.type){case Lt.Maximize:{if(this.hasBoxesStatus()){let z=this.maxTitleBar.focusedBox;if(z||(z=this.getMaximizedTopBox()),z!=null&&z.id){const oe=this.getBox(z.id);oe&&this.setBox(oe,{status:X.Normal,zIndex:this.getMaxNormalBoxZIndex()+1},!1,()=>{this.makeMaximizedTopBoxFocus()})}}else I.setValue(!I.value);break}case Lt.Minimize:{if(this.hasBoxesStatus()){let z=this.maxTitleBar.focusedBox;if(z||(z=this.getMaximizedTopBox()),z!=null&&z.id){const oe=this.getBox(z.id);if(oe){let ie=!1;oe.focus&&(this.blurBox(oe),ie=!0),this.setBox(oe,{status:X.Minimized,zIndex:-1},!1),ie?this.focusTopBox():this.makeMaximizedTopBoxFocus()}}}else x.setValue(!0);break}case tt.Close:{if(this.hasBoxesStatus()){let z=this.maxTitleBar.focusedBox;if(z||(z=this.getMaximizedTopBox()),z!=null&&z.id){const oe=this.getBox(z.id);if(oe){let ie=!1;oe.focus&&(this.blurBox(oe),ie=!0),this.remove(oe,!1),ie?this.focusTopBox():this.makeMaximizedTopBoxFocus()}}}else this.removeTopBox(),this.focusTopBox();break}}}}),y.subscribe(U=>this.maxTitleBar.setReadonly(U)),this._darkMode$.subscribe(U=>{this.maxTitleBar.setDarkMode(U)}),this.boxes$.reaction(U=>{this.maxTitleBar.setBoxes(U)}),My(this,{prefersColorScheme:P,containerRect:L,collector:W,collectorRect:Q,readonly:y,fence:k,minimized:x,maximized:I}),this._state$=C,this.root.appendChild(this.maxTitleBar.render()),g&&(this.appMenu=this.createMinimizedAppMenu())}get boxes(){return this.boxes$.value}get topBox(){return this.topBox$.value}get forceTopBoxes(){return this.boxes.find(t=>t.forceTop)}get maxForceTopBox(){return this.boxes.reduce((t,i)=>{var n;return i.forceTop&&i.zIndex>((n=t==null?void 0:t.zIndex)!=null?n:0)?i:t},void 0)}get forceNormalBoxes(){return this.boxes.find(t=>t.forceNormal)}get darkMode(){return this._darkMode$.value}get state(){return this._state$.value}setState(t,i=!1){switch(t){case X.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case X.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}setBoxStatus(t,i,n=!1){if(i){const s=this.boxesStatus$.get(t);this.boxesStatus$.set(t,i),i===X.Minimized&&s!==X.Minimized?this.setLastNotMinimizedBoxStatus(t,s,n):s===X.Minimized&&i!==X.Minimized&&this.setLastNotMinimizedBoxStatus(t,void 0,n)}else this.boxesStatus$.delete(t),this.setLastNotMinimizedBoxStatus(t,void 0,n);n||this.events.emit(lt.BoxStatus,{id:t,boxStatus:i})}getBoxStatus(t){return this.boxesStatus$.get(t)}get boxesStatus(){return this.boxesStatus$}get lastNotMinimizedBoxesStatus(){return this.lastNotMinimizedBoxesStatus$}setBoxesStatus(t,i=!1){this.boxesStatus$=t,this.effectBoxesStatusChange(i)}getBoxesStatus(){return this.boxesStatus$}effectBoxStatusChange(){!this.useBoxesStatus||(this.collector&&(this.collector.updateBoxesStatus(),this.hasMinimizedBox()&&this._setCollectorRect(this._calcCollectorRect())),this.appMenu&&this.appMenu.appMenuChange(),this.maxTitleBar&&this.maxTitleBar.updateBoxesStatus())}effectBoxesStatusTimerFunc(t){if(!this.useBoxesStatus)return;let i;const n=this.topBox;this.boxes.forEach(s=>{var o;const l=this.boxesStatus$.get(s.id);l&&(l!==X.Minimized&&!this.isForceTop(s)&&s.zIndex>((o=i==null?void 0:i.zIndex)!=null?o:0)&&(i=s),s.setBoxStatus(l,t))}),this.effectBoxStatusChange(),i&&n!==i&&this.topBox$.setValue(i),!i&&n&&this.topBox$.setValue(void 0)}async effectBoxesStatusChange(t=!1){var i,n;if(!this.useBoxesStatus){this.effectBoxesStatusTimer&&this.effectBoxesStatusTimer.timer&&(clearTimeout(this.effectBoxesStatusTimer.timer),this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(!!((i=this.effectBoxesStatusTimer)!=null&&i.skipUpdate))),this.effectBoxesStatusTimer=void 0;return}if(this.effectBoxesStatusTimer&&this.effectBoxesStatusTimer.timer)if(this.effectBoxesStatusTimer.skipUpdate!==t)clearTimeout(this.effectBoxesStatusTimer.timer),this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(!!((n=this.effectBoxesStatusTimer)!=null&&n.skipUpdate)),this.effectBoxesStatusTimer.skipUpdate=t;else return;if(this.effectBoxesStatusTimer||(this.effectBoxesStatusTimer={skipUpdate:t,timer:void 0,resolve:void 0}),this.effectBoxesStatusTimer){const s=await new Promise(o=>{this.effectBoxesStatusTimer.resolve=o,this.effectBoxesStatusTimer.timer=setTimeout(()=>{this.effectBoxesStatusTimer&&this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(this.effectBoxesStatusTimer.skipUpdate)},100)});this.effectBoxesStatusTimerFunc(s),this.effectBoxesStatusTimer=void 0}}hasBoxesStatus(){return this.useBoxesStatus?this.boxesStatus$.size>0:!1}hasMinimizedBox(){return this.useBoxesStatus?this.boxes.some(t=>t.boxStatus&&t.boxStatus===X.Minimized):!1}getMinimizedBoxesStatus(){const t=new Map;return this.boxesStatus$.forEach((i,n)=>{i===X.Minimized&&t.set(n,i)}),t}getNotMinimizedBoxesStatus(){const t=new Map;return this.boxesStatus$.forEach((i,n)=>{i!==X.Minimized&&t.set(n,i)}),t}getAllMaximizedBoxesStatus(){const t=new Map;return this.boxesStatus$.forEach((i,n)=>{i===X.Maximized&&t.set(n,i)}),t}getAllNormalBoxesStatus(){const t=new Map;return this.boxesStatus$.forEach((i,n)=>{i===X.Normal&&t.set(n,i)}),t}getLastNotMinimizedBoxStatus(t){return this.lastNotMinimizedBoxesStatus$.get(t)}setLastNotMinimizedBoxStatus(t,i,n=!1){i?this.lastNotMinimizedBoxesStatus$.set(t,i):this.lastNotMinimizedBoxesStatus$.delete(t),n||this.events.emit(lt.LastNotMinimizedBoxStatus,{id:t,boxStatus:i})}setLastNotMinimizedBoxesStatus(t,i=!1){this.lastNotMinimizedBoxesStatus$=t,this.effectLastNotMinimizedBoxStatusChange(i)}async effectLastNotMinimizedBoxStatusChange(t=!1){var i,n;if(!this.useBoxesStatus){this.effectLastNotMinimizedBoxStatusTimer&&this.effectLastNotMinimizedBoxStatusTimer.timer&&(clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer),this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((i=this.effectLastNotMinimizedBoxStatusTimer)!=null&&i.skipUpdate))),this.effectLastNotMinimizedBoxStatusTimer=void 0;return}if(this.effectLastNotMinimizedBoxStatusTimer&&this.effectLastNotMinimizedBoxStatusTimer.timer)if(clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer),this.effectLastNotMinimizedBoxStatusTimer.skipUpdate!==t)this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((n=this.effectLastNotMinimizedBoxStatusTimer)!=null&&n.skipUpdate)),this.effectLastNotMinimizedBoxStatusTimer.skipUpdate=t;else return;if(this.effectLastNotMinimizedBoxStatusTimer||(this.effectLastNotMinimizedBoxStatusTimer={skipUpdate:t,timer:void 0,resolve:void 0}),this.effectLastNotMinimizedBoxStatusTimer){const s=await new Promise(o=>{this.effectLastNotMinimizedBoxStatusTimer.resolve=o,this.effectLastNotMinimizedBoxStatusTimer.timer=setTimeout(()=>{this.effectLastNotMinimizedBoxStatusTimer&&this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(this.effectLastNotMinimizedBoxStatusTimer.skipUpdate)},100)});this.effectLastNotMinimizedBoxStatusFunc(s),this.effectLastNotMinimizedBoxStatusTimer=void 0}}effectLastNotMinimizedBoxStatusFunc(t=!1){!this.useBoxesStatus||this.boxes.forEach(i=>{const n=this.lastNotMinimizedBoxesStatus$.get(i.id);n&&i.setLastNotMinimizedBoxStatus(n,t)})}getUnabledBoxesStatusZIndex(){return this.topBox?this.topBox.zIndex:99}getMaxMaximizedBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((t,i)=>i.boxStatus&&i.boxStatus===X.Maximized&&!this.isForceTop(i)?Math.max(t,i.zIndex):t,99):this.getUnabledBoxesStatusZIndex()}getMaxNormalBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((t,i)=>i.boxStatus&&i.boxStatus===X.Normal&&!this.isForceTop(i)?Math.max(t,i.zIndex):t,299):this.getUnabledBoxesStatusZIndex()}getMaxForceTopBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((t,i)=>i.boxStatus&&this.isForceTop(i)?Math.max(t,i.zIndex):t,699):this.getUnabledBoxesStatusZIndex()}isForceNormal(t){return t._forceNormal$.value}isForceTop(t){return t._forceTop$.value}create(t={},i=!0){const n=new NN({zIndex:t.forceTop?this.getMaxForceTopBoxZIndex()+1:this.getMaxNormalBoxZIndex()+1,...i?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 n.mount(this.root),this.boxes$.setValue([...this.boxes,n]),n.boxStatus&&this.useBoxesStatus&&this.setBox(n,{status:n.boxStatus,lastNotMinimizedBoxStatus:n._lastNotMinimizedBoxStatus$.value},!0),n.focus&&(this.focusBox(n),i&&this.makeBoxTop(n)),n._delegateEvents.on(Lt.Maximize,()=>{if(this.useBoxesStatus&&n.boxStatus){if(n._forceNormal$.value)return;n.boxStatus===X.Maximized?this.setBox(n.id,{status:X.Normal,zIndex:this.getMaxNormalBoxZIndex()+1},!1):([...this.boxes].filter(s=>s.boxStatus===X.Normal&&!this.isForceNormal(s)).sort((s,o)=>s.zIndex-o.zIndex).forEach(s=>{s.boxStatus===X.Normal&&this.setBox(s.id,{status:X.Maximized,zIndex:this.getMaxMaximizedBoxZIndex()+1},!1)}),this.makeMaximizedTopBoxFocus())}else this.setMaximized(!this.maximized)}),n._delegateEvents.on(Lt.Minimize,()=>{if(n.boxStatus&&this.useBoxesStatus){if(n._forceNormal$.value)return;n.focus&&this.blurBox(n),this.setBox(n,{status:X.Minimized,zIndex:-1},!1,()=>{this.focusTopBox()})}else this.setMinimized(!0)}),n._delegateEvents.on(Lt.Close,()=>{this.useBoxesStatus&&n.focus&&this.blurBox(n),this.remove(n),this.focusTopBox()}),n._coord$.reaction((s,o,l)=>{l||this.events.emit(lt.Move,n)}),n._size$.reaction((s,o,l)=>{l||this.events.emit(lt.Resize,n)}),n._intrinsicCoord$.reaction((s,o,l)=>{l||this.events.emit(lt.IntrinsicMove,n)}),n._intrinsicSize$.reaction((s,o,l)=>{l||this.events.emit(lt.IntrinsicResize,n)}),n._visualSize$.reaction((s,o,l)=>{l||this.events.emit(lt.VisualResize,n)}),n._zIndex$.reaction((s,o,l)=>{if(this.boxes.length>0){let c;const d=this.boxes.reduce((f,g)=>this.isForceTop(g)||g.boxStatus&&g.boxStatus===X.Minimized?f:f?f.zIndex>g.zIndex?f:g:(f=g,f),c);this.topBox$.setValue(d)}l||this.events.emit(lt.ZIndex,n)}),this.events.emit(lt.Created,n),n}query(t){return t?this.boxes.filter(this.teleBoxMatcher(t)):[...this.boxes]}queryOne(t){return t?this.boxes.find(this.teleBoxMatcher(t)):this.boxes[0]}update(t,i,n=!1){const s=this.boxes.find(o=>o.id===t);if(s)return this.updateBox(s,i,n)}updateAll(t,i=!1){this.boxes.forEach(n=>{this.updateBox(n,t,i)})}setBox(t,i,n=!1,s){const o=this.getBox(t);if(o){const{status:l,zIndex:c,lastNotMinimizedBoxStatus:d}=i;l&&(this.setBoxStatus(o.id,l,n),o.setBoxStatus(l,n),this.effectBoxStatusChange()),c&&o.setZIndex(c,n),d&&(this.setLastNotMinimizedBoxStatus(o.id,d,n),o.setLastNotMinimizedBoxStatus(d,n)),s&&s()}}remove(t,i=!1,n){const s=this.getBox(t),o=this.getBoxIndex(t);if(o>=0){const l=this.boxes.slice(),c=l.splice(o,1);return this.boxes$.setValue(l),c.forEach(d=>d.destroy()),s&&this.useBoxesStatus&&(this.setBoxStatus(s.id,void 0,i),this.setLastNotMinimizedBoxStatus(s.id,void 0,i),this.effectBoxStatusChange(),n&&n()),i||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(lt.Removed,c)),c[0]}}removeTopBox(){if(this.topBox)return this.remove(this.topBox)}removeAll(t=!1){const i=this.boxes$.value;return this.boxes$.setValue([]),i.forEach(n=>n.destroy()),this.boxesStatus$.clear(),this.lastNotMinimizedBoxesStatus$.clear(),t||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(lt.Removed,i)),i}destroy(t=!1){this.events.removeAllListeners(),this._sideEffect.flushAll(),this.removeAll(t),Object.keys(this).forEach(i=>{const n=this[i];n instanceof mo&&n.destroy()})}wrapClassName(t){return`${this.namespace}-${t}`}focusBox(t,i=!1){const n=this.getBox(t);n&&(this.boxes.forEach(s=>{if(n===s){let o=!1;n.focus||(o=!0,n.setFocus(!0,i)),o&&!i&&this.events.emit(lt.Focused,n)}else s.focus&&this.blurBox(s,i)}),this.useBoxesStatus?this.useBoxesStatus&&this.maxTitleBar.hasMaximizedBoxInStatus()&&this.makeMaximizedTopBoxFocus():this.maxTitleBar.focusBox(n))}focusTopBox(){if(this.topBox&&!this.topBox.focus)return this.focusBox(this.topBox)}blurBox(t,i=!1){const n=this.getBox(t);n&&(n.focus&&(n.setFocus(!1,i),i||this.events.emit(lt.Blurred,n)),this.maxTitleBar.focusedBox===n&&this.maxTitleBar.focusBox())}blurAll(t=!1){this.boxes.forEach(i=>{i.focus&&(i.setFocus(!1,t),t||this.events.emit(lt.Blurred,i))}),this.maxTitleBar.focusedBox&&this.maxTitleBar.focusBox()}teleBoxMatcher(t){const i=Object.keys(t);return n=>i.every(s=>t[s]===n[s])}updateBox(t,i,n=!1){(i.x!=null||i.y!=null)&&t.move(i.x==null?t.intrinsicX:i.x,i.y==null?t.intrinsicY:i.y,n),(i.width!=null||i.height!=null)&&t.resize(i.width==null?t.intrinsicWidth:i.width,i.height==null?t.intrinsicHeight:i.height,n),i.title!=null&&(t.setTitle(i.title),this.maxTitleBar.updateTitles()),i.visible!=null&&t.setVisible(i.visible,n),i.minHeight!=null&&t.setMinHeight(i.minHeight,n),i.minWidth!=null&&t.setMinWidth(i.minWidth,n),i.resizable!=null&&t.setResizable(i.resizable,n),i.draggable!=null&&t.setDraggable(i.draggable,n),i.fixRatio!=null&&t.setFixRatio(i.fixRatio,n),i.zIndex!=null&&t.setZIndex(i.zIndex,n),i.content!=null&&t.mountContent(i.content),i.footer!=null&&t.mountFooter(i.footer),this.useBoxesStatus&&(i.boxStatus||i.lastNotMinimizedBoxStatus)&&this.setBox(t,{status:i.boxStatus,lastNotMinimizedBoxStatus:i.lastNotMinimizedBoxStatus},n),i.forceTop!=null&&t.setForceTop(i.forceTop,n),i.forceNormal!=null&&t.setForceNormal(i.forceNormal,n)}smartPosition(t={}){let{x:i,y:n}=t;const{width:s=.5,height:o=.5}=t;if(i==null){let l=20;if(t.forceTop){const c=this.maxForceTopBox||this.topBox;c&&(l=c.intrinsicX*this.containerRect.width+20,l>this.containerRect.width-s*this.containerRect.width&&(l=20))}else this.topBox?(l=this.topBox.intrinsicX*this.containerRect.width+20,l>this.containerRect.width-s*this.containerRect.width&&(l=20)):this.hasMinimizedBox()&&(l=[...this.boxes].filter(c=>c.boxStatus&&c.boxStatus===X.Minimized&&c.lastNotMinimizedBoxStatus&&c.lastNotMinimizedBoxStatus===X.Normal).reduce((c,d)=>Math.max(c,d.intrinsicX*this.containerRect.width+20),l));i=l/this.containerRect.width}if(n==null){let l=20;if(t.forceTop){const c=this.maxForceTopBox||this.topBox;c&&(l=c.intrinsicY*this.containerRect.height+20,l>this.containerRect.height-o*this.containerRect.height&&(l=20))}else this.topBox?(l=this.topBox.intrinsicY*this.containerRect.height+20,l>this.containerRect.height-o*this.containerRect.height&&(l=20)):this.hasMinimizedBox()&&(l=[...this.boxes].filter(c=>c.boxStatus&&c.boxStatus===X.Minimized&&c.lastNotMinimizedBoxStatus&&c.lastNotMinimizedBoxStatus===X.Normal).reduce((c,d)=>Math.max(c,d.intrinsicY*this.containerRect.height+20),l));n=l/this.containerRect.height}return{...t,x:i,y:n,width:s,height:o}}makeBoxTop(t,i=!1){!this.useBoxesStatus&&this.topBox?t!==this.topBox&&t.setZIndex(this.topBox.zIndex+1,i):this.useBoxesStatus}getMaximizedTopBox(){if(!this.useBoxesStatus)return;let t;return this.maxTitleBar.hasMaximizedBoxInStatus()&&(t=this.maxTitleBar.MaximizedBoxes.reduce((i,n)=>i&&i.zIndex>n.zIndex?i:n)),t}makeMaximizedTopBoxFocus(){if(!this.useBoxesStatus)return;const t=this.getMaximizedTopBox();this.maxTitleBar.focusBox(t)}getBoxIndex(t){return typeof t=="string"?this.boxes.findIndex(i=>i.id===t):this.boxes.findIndex(i=>i===t)}getBox(t){return typeof t=="string"?this.boxes.find(i=>i.id===t):t}createMinimizedAppMenu(){var t,i;if((t=this.collector)!=null&&t.$appMenuContainer)return new zN({manager:this,container:(i=this.collector)==null?void 0:i.$appMenuContainer,theme:this.prefersColorScheme?"dark":"light",getBoxesStatus:()=>this.boxesStatus$})}}vo.kind="TeleBoxManager";const DN=(e,t,i,n,s)=>{const o=Pn(wo,Te.extendClass);return new o({safeSetAttributes:l=>e.safeSetAttributes(l),getMainView:()=>e.mainView,updateAppState:(...l)=>{var c;return(c=e.appManager)==null?void 0:c.store.updateAppState(...l)},setBoxStatus:(l,c)=>{var d;return(d=e.appManager)==null?void 0:d.store.setBoxStatus(l,c)},setLastNotMinimizedBoxStatus:(l,c)=>{var d;return(d=e.appManager)==null?void 0:d.store.setLastNotMinimizedBoxStatus(l,c)},canOperate:()=>e.canOperate,notifyContainerRectUpdate:l=>{var c;return(c=e.appManager)==null?void 0:c.notifyContainerRectUpdate(l)},cleanFocus:()=>{var l;return(l=e.appManager)==null?void 0:l.store.cleanFocus()},setAppFocus:l=>{var c;return(c=e.appManager)==null?void 0:c.store.setAppFocus(l,!0)},callbacks:t,emitter:i,boxEmitter:n},s)};class wo{constructor(t,i){this.context=t,this.createTeleBoxManagerConfig=i;const{emitter:n,callbacks:s,boxEmitter:o}=t;this.teleBoxManager=this.setupBoxManager(i),this.teleBoxManager._state$.reaction(l=>{s.emit("boxStateChange",l),n.emit("boxStateChange",l)}),this.teleBoxManager._darkMode$.reaction(l=>{s.emit("darkModeChange",l)}),this.teleBoxManager._prefersColorScheme$.reaction(l=>{s.emit("prefersColorSchemeChange",l)}),this.teleBoxManager._minimized$.reaction(l=>{l||setTimeout(()=>{const c=.001*(Math.random()>.5?1:-1);this.teleBoxManager.boxes.forEach(d=>{d.resize(d.intrinsicWidth+c,d.intrinsicHeight+c,!0)})},400)}),this.teleBoxManager.events.on("minimized",l=>{if(this.context.safeSetAttributes({minimized:l}),l)this.context.cleanFocus(),this.blurAllBox();else{const c=this.getTopBox();c&&(this.context.setAppFocus(c.id),this.focusBox({appId:c.id},!1))}}),this.teleBoxManager.events.on("maximized",l=>{this.context.safeSetAttributes({maximized:l})}),this.teleBoxManager.events.on("removed",l=>{l.forEach(c=>{o.emit("close",{appId:c.id})})}),this.teleBoxManager.events.on("intrinsic_move",Y.debounce(l=>{o.emit("move",{appId:l.id,x:l.intrinsicX,y:l.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",Y.debounce(l=>{o.emit("resize",{appId:l.id,width:l.intrinsicWidth,height:l.intrinsicHeight})},200)),this.teleBoxManager.events.on("focused",l=>{l&&(this.canOperate?o.emit("focus",{appId:l.id}):this.teleBoxManager.blurBox(l.id))}),this.teleBoxManager.events.on("blurred",l=>{l&&this.canOperate&&o.emit("blurred",{appId:l.id})}),this.teleBoxManager.events.on("z_index",l=>{this.context.updateAppState(l.id,Yt.ZIndex,l.zIndex)}),this.teleBoxManager.events.on("box_status",l=>{this.canOperate&&this.context.setBoxStatus(l.id,l.boxStatus)}),this.teleBoxManager.events.on("last_not_minimized_box_status",l=>{this.canOperate&&this.context.setLastNotMinimizedBoxStatus(l.id,l.boxStatus)}),n.on("playgroundSizeChange",()=>this.updateManagerRect()),n.on("updateManagerRect",()=>this.updateManagerRect())}get mainView(){return this.context.getMainView()}get canOperate(){return this.context.canOperate()}get boxState(){return this.teleBoxManager.state}get maximized(){return this.teleBoxManager.maximized}get minimized(){return this.teleBoxManager.minimized}get darkMode(){return this.teleBoxManager.darkMode}get prefersColorScheme(){return this.teleBoxManager.prefersColorScheme}get boxSize(){return this.teleBoxManager.boxes.length}createBox(t){var f,g,v;if(!this.teleBoxManager)return;let{minwidth:i=K_,minheight:n=q_}=(f=t.app.config)!=null?f:{};const{width:s,height:o}=(g=t.app.config)!=null?g:{},l=((v=t.options)==null?void 0:v.title)||t.appId,c=this.teleBoxManager.containerRect;i>1&&(i=i/c.width),n>1&&(n=n/c.height);const d={title:l,minWidth:i,minHeight:n,width:s,height:o,id:t.appId,boxStatus:t.boxStatus,forceTop:t.forceTop,forceNormal:t.forceNormal,isDragContent:t.isDragContent};this.teleBoxManager.create(d,t.smartPosition),this.context.emitter.emit(`${t.appId}${qe.WindowCreated}`)}setBoxInitState(t){const i=this.teleBoxManager.queryOne({id:t});i&&i.state===X.Maximized&&this.context.boxEmitter.emit("resize",{appId:t,x:i.x,y:i.y,width:i.intrinsicWidth,height:i.intrinsicHeight})}setBoxesStatus(t){const i=new Map(Object.entries(t!=null?t:{}));this.teleBoxManager.setBoxesStatus(i,!0),this.context.callbacks.emit("onBoxesStatusChange",i),this.context.emitter.emit("boxesStatusChange",i)}setLastNotMinimizedBoxesStatus(t){const i=new Map(Object.entries(t!=null?t:{}));this.teleBoxManager.setLastNotMinimizedBoxesStatus(i,!0),this.context.callbacks.emit("onLastNotMinimizedBoxesStatusChange",i),this.context.emitter.emit("lastNotMinimizedBoxesStatusChange",i)}setupBoxManager(t){const i=Te.wrapper?Te.wrapper:document.body,n=i.getBoundingClientRect(),s={root:i,containerRect:{x:0,y:0,width:n.width,height:n.height},fence:!1,prefersColorScheme:t==null?void 0:t.prefersColorScheme,useBoxesStatus:(t==null?void 0:t.useBoxesStatus)||!1},o=Pn(vo,Te.extendClass),l=new o(s);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=l;const c=(t==null?void 0:t.collectorContainer)||Te.wrapper;return c&&this.setCollectorContainer(c),l}setCollectorContainer(t){var s;const i=Pn(Ys,Te.extendClass),n=new i({styles:(s=this.createTeleBoxManagerConfig)==null?void 0:s.collectorStyles}).mount(t);this.teleBoxManager.setCollector(n)}getBox(t){return this.teleBoxManager.queryOne({id:t})}closeBox(t,i=!1){return this.teleBoxManager.remove(t,i)}boxIsFocus(t){const i=this.getBox(t);return i==null?void 0:i.focus}getFocusBox(){return this.teleBoxManager.query({focus:!0})[0]}getTopBox(){return this.teleBoxManager.topBox}updateBoxState(t){if(!t)return;const i=this.getBox(t.id);i&&(this.teleBoxManager.update(i.id,{x:t.x,y:t.y,width:t.width||.5,height:t.height||.5,zIndex:t.zIndex,boxStatus:t.boxStatus,lastNotMinimizedBoxStatus:t.lastNotMinimizedBoxStatus,forceTop:t.forceTop,forceNormal:t.forceNormal,isDragContent:t.isDragContent},!0),setTimeout(()=>{t.focus&&this.teleBoxManager.focusBox(i.id,!0),t.maximized!=null&&this.teleBoxManager.setMaximized(Boolean(t.maximized),!0),t.minimized!=null&&this.teleBoxManager.setMinimized(Boolean(t.minimized),!0)},50),t.boxStatus||this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}updateManagerRect(){var i;const t=(i=this.mainView.divElement)==null?void 0:i.getBoundingClientRect();if(t&&t.width>0&&t.height>0){const n={x:0,y:0,width:t.width,height:t.height};this.teleBoxManager.setContainerRect(n),this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect)}}moveBox({appId:t,x:i,y:n}){this.teleBoxManager.update(t,{x:i,y:n},!0)}focusBox({appId:t},i=!0){this.teleBoxManager.focusBox(t,i)}resizeBox({appId:t,width:i,height:n,skipUpdate:s}){this.teleBoxManager.update(t,{width:i,height:n},s)}setBoxMinSize(t){this.teleBoxManager.update(t.appId,{minWidth:t.minWidth,minHeight:t.minHeight},!0)}setBoxTitle(t){this.teleBoxManager.update(t.appId,{title:t.title},!0)}blurAllBox(){this.teleBoxManager.blurAll()}updateAll(t){this.teleBoxManager.updateAll(t)}setMaximized(t,i=!0){t!==this.maximized&&this.teleBoxManager.setMaximized(t,i)}setMinimized(t,i=!0){this.teleBoxManager.setMinimized(t,i)}focusTopBox(){if(this.teleBoxManager.query().length>=1){const i=this.getTopBox();i&&this.focusBox({appId:i.id},!1)}}updateBox(t,i,n=!0){this.teleBoxManager.update(t,i,n)}setReadonly(t){this.teleBoxManager.setReadonly(t)}setPrefersColorScheme(t){this.teleBoxManager.setPrefersColorScheme(t)}setZIndex(t,i,n=!0){this.teleBoxManager.update(t,{zIndex:i},n)}destroy(){this.teleBoxManager.destroy()}}wo.kind="BoxManager";function Gv(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)?e:JSON.stringify(e)}function kr(e,t){if(e===void 0)return"undefined";if(e===null)return"null";const i=typeof e;if(i==="bigint")return`${e}n`;if(i==="symbol")return String(e);if(i==="function")return`[Function ${e.name||"anonymous"}]`;if(i!=="object")return i==="string"?JSON.stringify(e):String(e);const n=e;if(t!=null&&t.has(n))return"[Circular]";const s=t!=null?t:new WeakSet;s.add(n);try{return Array.isArray(e)?`[${Array.from(e,c=>kr(c,s)).join(",")}]`:e instanceof Date?JSON.stringify(e.toISOString()):e instanceof RegExp?String(e):`{${Object.keys(n).map(c=>{let d;try{d=n[c]}catch{return`${Gv(c)}:[Threw]`}return`${Gv(c)}:${kr(d,s)}`}).join(",")}}`}catch{return"[Unserializable]"}finally{s.delete(n)}}function LN(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)&&!(e instanceof RegExp)}const Xv=1500;function RN(e){if(e.length<=Xv)return e;const t="\u2026";return e.slice(0,Xv-t.length)+t}function ON(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}const Oi=(...e)=>{Te.debug&&console.log("[WindowManager]:",...e)};class Na{constructor(t,i){this.name=t,this.debounceTime=i,this.pendingArgs=null,this.flushTimer=null}flush(){this.flushTimer=null;const t=this.pendingArgs;this.pendingArgs=null,t!==null&&console.log(`[window-manager][${this.name}]: ${t.join(", ")}`)}log(...t){const i=this.debounceTime;if(i!=null&&i>0){this.pendingArgs=t,this.flushTimer!=null&&clearTimeout(this.flushTimer),this.flushTimer=setTimeout(()=>this.flush(),i);return}console.log(`[window-manager][${this.name}]: ${t.join(", ")}`)}destroy(){this.flushTimer!=null&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.pendingArgs=null}}class VN{constructor(t,i,n){this.logger=t,this.name=i,this.debounceTime=n,this.pendingArgs=null,this.flushTimer=null,this.pendingShallowMerge=null,this.shallowMergeTimer=null,this.pendingUpdateSegments=null,this.updateMergeTimer=null}emitInfo(t){this.logger.info(RN(t))}flush(){this.flushTimer=null;const t=this.pendingArgs;this.pendingArgs=null,t!==null&&this.emitInfo(`[WindowManager][${this.name}]: ${t.join(", ")}`)}flushShallowMerge(){this.shallowMergeTimer=null;const t=this.pendingShallowMerge;if(this.pendingShallowMerge=null,t===null)return;const i=t.kind==="record"?kr(t.data):kr(t.value);if(this.emitInfo(`[WindowManager][${this.name}]: ${t.label} ${i}`),t.kind==="record")for(const n of Object.keys(t.data))delete t.data[n]}log(...t){const i=this.debounceTime;if(i!=null&&i>0){this.pendingArgs=t,this.flushTimer!=null&&clearTimeout(this.flushTimer),this.flushTimer=setTimeout(()=>this.flush(),i);return}this.emitInfo(`[WindowManager][${this.name}]: ${t.join(", ")}`)}logDebouncedShallowMerge(t,i){var l;const n=this.debounceTime,s=n!=null&&n>0,o=c=>{this.emitInfo(`[WindowManager][${this.name}]: ${t} ${c}`)};if(!s){o(kr(i));return}this.shallowMergeTimer!=null&&(clearTimeout(this.shallowMergeTimer),this.shallowMergeTimer=null),LN(i)?((l=this.pendingShallowMerge)==null?void 0:l.kind)==="record"?this.pendingShallowMerge={kind:"record",label:t,data:{...this.pendingShallowMerge.data,...i}}:this.pendingShallowMerge={kind:"record",label:t,data:{...i}}:this.pendingShallowMerge={kind:"atom",label:t,value:i},this.shallowMergeTimer=setTimeout(()=>this.flushShallowMerge(),n)}flushUpdateAttributesMerge(){this.updateMergeTimer=null;const t=this.pendingUpdateSegments;if(this.pendingUpdateSegments=null,t===null||t.length===0)return;const i=t.map(n=>`${n.keys.join(", ")} ${kr(n.value)}`);this.emitInfo(`[WindowManager][${this.name}]: safeUpdateAttributes ${i.join(" | ")}`);for(const n of t)n.keys.length=0,n.value=void 0;t.length=0}logDebouncedUpdateAttributes(t,i){const n=this.debounceTime,s=n!=null&&n>0,o=[...t];if(!s){this.emitInfo(`[WindowManager][${this.name}]: safeUpdateAttributes ${o.join(", ")} ${kr(i)}`);return}if(this.updateMergeTimer!=null&&(clearTimeout(this.updateMergeTimer),this.updateMergeTimer=null),this.pendingUpdateSegments===null||this.pendingUpdateSegments.length===0)this.pendingUpdateSegments=[{keys:o,value:i}];else{const l=this.pendingUpdateSegments[this.pendingUpdateSegments.length-1];ON(l.keys,o)?l.value=i:this.pendingUpdateSegments.push({keys:o,value:i})}this.updateMergeTimer=setTimeout(()=>this.flushUpdateAttributesMerge(),n)}destroy(){this.flushTimer!=null&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.shallowMergeTimer!=null&&(clearTimeout(this.shallowMergeTimer),this.shallowMergeTimer=null),this.updateMergeTimer!=null&&(clearTimeout(this.updateMergeTimer),this.updateMergeTimer=null),this.pendingArgs=null,this.pendingShallowMerge=null,this.pendingUpdateSegments=null}dispose(){this.destroy()}}const $N=e=>{const t=document.createElement("div");t.className="netless-window-manager-playground";const i=document.createElement("div");i.className="netless-window-manager-sizer";const n=document.createElement("div");n.className="netless-window-manager-wrapper";const s=document.createElement("div");return s.className="netless-window-manager-main-view",t.appendChild(i),i.appendChild(n),n.appendChild(s),e.appendChild(t),Te.wrapper=n,{playground:t,wrapper:n,sizer:i,mainViewElement:s}},jN=()=>{if(Lv(H.WhiteVersion)<Lv(Bv))throw new J0(Bv)},wd=(e,t)=>{var o;const i=(e==null?void 0:e.state.roomMembers)||[];let n=-1,s;for(const l of i)((o=l.payload)==null?void 0:o.uid)===t&&n<l.memberId&&(n=l.memberId,s=l);return s},UN=async e=>{let t=e.getInvisiblePlugin(Te.kind);if(t)return t;let i;const n=new Promise(f=>{Te._resolve=i=f});let s=!1;const o=WN(e);!e.isWritable&&o&&(s=!0,await H0.default(async f=>{Oi(`switching to writable (x${f})`),await e.setWritable(!0)},{retries:10,maxTimeout:5e3})),e.isWritable?(Oi("creating InvisiblePlugin..."),e.createInvisiblePlugin(Te,{}).catch(console.warn)):(o&&console.warn("[WindowManager]: failed to switch to writable"),console.warn("[WindowManager]: waiting for others to create the plugin..."));const l=setTimeout(()=>{console.warn("[WindowManager]: no one called createInvisiblePlugin() after 20 seconds")},2e4),c=setTimeout(()=>{throw new Error("[WindowManager]: no one called createInvisiblePlugin() after 60 seconds")},6e4),d=setInterval(()=>{t=e.getInvisiblePlugin(Te.kind),t&&(clearTimeout(c),clearTimeout(l),clearInterval(d),i(t),s&&e.isWritable&&setTimeout(()=>e.setWritable(!1).catch(console.warn),500))},200);return n},WN=e=>{try{const t=atob(e.roomToken.slice(12)),i=t.indexOf("&role=");return+t[i+6]<2}catch(t){return console.error(t),!1}};function Ka(){}function Iy(e){return e()}function Jv(){return Object.create(null)}function Qu(e){e.forEach(Iy)}function Ay(e){return typeof e=="function"}function FN(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let _l;function pu(e,t){return _l||(_l=document.createElement("a")),_l.href=t,e===_l.href}function HN(e){return Object.keys(e).length===0}function Cn(e,t){e.appendChild(t)}function Yu(e,t,i){e.insertBefore(t,i||null)}function yo(e){e.parentNode&&e.parentNode.removeChild(e)}function qn(e){return document.createElement(e)}function Bf(e){return document.createTextNode(e)}function yd(){return Bf(" ")}function st(e,t,i){i==null?e.removeAttribute(t):e.getAttribute(t)!==i&&e.setAttribute(t,i)}function ZN(e){return Array.from(e.childNodes)}function Ty(e,t){t=""+t,e.data!==t&&(e.data=t)}function Tt(e,t,i,n){i==null?e.style.removeProperty(t):e.style.setProperty(t,i,n?"important":"")}let zf;function $a(e){zf=e}const xs=[],Kv=[];let Ps=[];const qv=[],QN=Promise.resolve();let xd=!1;function YN(){xd||(xd=!0,QN.then(Ey))}function Sd(e){Ps.push(e)}const Vh=new Set;let vs=0;function Ey(){if(vs!==0)return;const e=zf;do{try{for(;vs<xs.length;){const t=xs[vs];vs++,$a(t),GN(t.$$)}}catch(t){throw xs.length=0,vs=0,t}for($a(null),xs.length=0,vs=0;Kv.length;)Kv.pop()();for(let t=0;t<Ps.length;t+=1){const i=Ps[t];Vh.has(i)||(Vh.add(i),i())}Ps.length=0}while(xs.length);for(;qv.length;)qv.pop()();xd=!1,Vh.clear(),$a(e)}function GN(e){if(e.fragment!==null){e.update(),Qu(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(Sd)}}function XN(e){const t=[],i=[];Ps.forEach(n=>e.indexOf(n)===-1?t.push(n):i.push(n)),i.forEach(n=>n()),Ps=t}const JN=new Set;function KN(e,t){e&&e.i&&(JN.delete(e),e.i(t))}function qN(e,t,i,n){const{fragment:s,after_update:o}=e.$$;s&&s.m(t,i),n||Sd(()=>{const l=e.$$.on_mount.map(Iy).filter(Ay);e.$$.on_destroy?e.$$.on_destroy.push(...l):Qu(l),e.$$.on_mount=[]}),o.forEach(Sd)}function ek(e,t){const i=e.$$;i.fragment!==null&&(XN(i.after_update),Qu(i.on_destroy),i.fragment&&i.fragment.d(t),i.on_destroy=i.fragment=null,i.ctx=[])}function tk(e,t){e.$$.dirty[0]===-1&&(xs.push(e),YN(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function ik(e,t,i,n,s,o,l,c=[-1]){const d=zf;$a(e);const f=e.$$={fragment:null,ctx:[],props:o,update:Ka,not_equal:s,bound:Jv(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(d?d.$$.context:[])),callbacks:Jv(),dirty:c,skip_bound:!1,root:t.target||d.$$.root};l&&l(f.root);let g=!1;if(f.ctx=i?i(e,t.props||{},(v,M,...E)=>{const _=E.length?E[0]:M;return f.ctx&&s(f.ctx[v],f.ctx[v]=_)&&(!f.skip_bound&&f.bound[v]&&f.bound[v](_),g&&tk(e,v)),M}):[],f.update(),g=!0,Qu(f.before_update),f.fragment=n?n(f.ctx):!1,t.target){if(t.hydrate){const v=ZN(t.target);f.fragment&&f.fragment.l(v),v.forEach(yo)}else f.fragment&&f.fragment.c();t.intro&&KN(e.$$.fragment),qN(e,t.target,t.anchor,t.customElement),Ey()}$a(d)}class nk{$destroy(){ek(this,1),this.$destroy=Ka}$on(t,i){if(!Ay(i))return Ka;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(i),()=>{const s=n.indexOf(i);s!==-1&&n.splice(s,1)}}$set(t){this.$$set&&!HN(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function ew(e){let t,i,n,s,o,l,c,d=e[18]&&tw(e),f=e[19]&&iw(e);return{c(){t=qn("div"),i=qn("div"),d&&d.c(),n=yd(),s=qn("span"),o=Bf(e[1]),l=yd(),f&&f.c(),Tt(s,"overflow","hidden"),Tt(s,"white-space","nowrap"),Tt(s,"text-overflow","ellipsis"),Tt(s,"max-width","80px"),st(i,"class",e[9]),Tt(i,"background-color",e[3]),Tt(i,"color",e[10]),Tt(i,"opacity",e[12]),st(t,"class",c="netless-window-manager-cursor-name "+e[16]+" "+e[15])},m(g,v){Yu(g,t,v),Cn(t,i),d&&d.m(i,null),Cn(i,n),Cn(i,s),Cn(s,o),Cn(i,l),f&&f.m(i,null)},p(g,v){g[18]?d?d.p(g,v):(d=tw(g),d.c(),d.m(i,n)):d&&(d.d(1),d=null),v&2&&Ty(o,g[1]),g[19]?f?f.p(g,v):(f=iw(g),f.c(),f.m(i,null)):f&&(f.d(1),f=null),v&512&&st(i,"class",g[9]),v&8&&Tt(i,"background-color",g[3]),v&1024&&Tt(i,"color",g[10]),v&4096&&Tt(i,"opacity",g[12]),v&98304&&c!==(c="netless-window-manager-cursor-name "+g[16]+" "+g[15])&&st(t,"class",c)},d(g){g&&yo(t),d&&d.d(),f&&f.d()}}}function tw(e){let t,i;return{c(){t=qn("img"),st(t,"class","netless-window-manager-cursor-selector-avatar"),st(t,"style",e[20]()),pu(t.src,i=e[8])||st(t,"src",i),st(t,"alt","avatar")},m(n,s){Yu(n,t,s)},p(n,s){s&256&&!pu(t.src,i=n[8])&&st(t,"src",i)},d(n){n&&yo(t)}}}function iw(e){let t,i;return{c(){t=qn("span"),i=Bf(e[2]),st(t,"class","netless-window-manager-cursor-tag-name"),Tt(t,"background-color",e[11])},m(n,s){Yu(n,t,s),Cn(t,i)},p(n,s){s&4&&Ty(i,n[2]),s&2048&&Tt(t,"background-color",n[11])},d(n){n&&yo(t)}}}function rk(e){let t,i,n,s,o,l,c,d=!e[14]&&ew(e);return{c(){t=qn("div"),d&&d.c(),i=yd(),n=qn("div"),s=qn("img"),st(s,"class",o="netless-window-manager-cursor-"+e[4]+"-image "+e[15]),pu(s.src,l=e[7])||st(s,"src",l),st(s,"alt",e[4]),st(n,"class","cursor-image-wrapper"),st(t,"class",c="netless-window-manager-cursor-mid"+(e[13]?" netless-window-manager-cursor-custom":"")),Tt(t,"transform","translateX("+e[5]+"px) translateY("+e[6]+"px)"),Tt(t,"display",e[17]),st(t,"data-cursor-uid",e[0])},m(f,g){Yu(f,t,g),d&&d.m(t,null),Cn(t,i),Cn(t,n),Cn(n,s)},p(f,[g]){f[14]?d&&(d.d(1),d=null):d?d.p(f,g):(d=ew(f),d.c(),d.m(t,i)),g&32784&&o!==(o="netless-window-manager-cursor-"+f[4]+"-image "+f[15])&&st(s,"class",o),g&128&&!pu(s.src,l=f[7])&&st(s,"src",l),g&16&&st(s,"alt",f[4]),g&8192&&c!==(c="netless-window-manager-cursor-mid"+(f[13]?" netless-window-manager-cursor-custom":""))&&st(t,"class",c),g&96&&Tt(t,"transform","translateX("+f[5]+"px) translateY("+f[6]+"px)"),g&131072&&Tt(t,"display",f[17]),g&1&&st(t,"data-cursor-uid",f[0])},i:Ka,o:Ka,d(f){f&&yo(t),d&&d.d()}}}function sk(e,t,i){let n,s,o,l,c,d,f,g,{uid:v}=t,{cursorName:M}=t,{tagName:E}=t,{backgroundColor:_}=t,{appliance:P}=t,{x:y}=t,{y:x}=t,{src:I}=t,{visible:C}=t,{avatar:k}=t,{theme:L}=t,{color:W}=t,{cursorTagBackgroundColor:Q}=t,{opacity:J}=t,{pencilEraserSize:K}=t,{custom:De}=t;const U=()=>Object.entries({width:(n?19:28)+"px",height:(n?19:28)+"px",position:n?"initial":"absolute","border-color":n?"white":_,"margin-right":(n?4:0)+"px"}).map(([z,oe])=>`${z}: ${oe}`).join(";");return e.$$set=z=>{"uid"in z&&i(0,v=z.uid),"cursorName"in z&&i(1,M=z.cursorName),"tagName"in z&&i(2,E=z.tagName),"backgroundColor"in z&&i(3,_=z.backgroundColor),"appliance"in z&&i(4,P=z.appliance),"x"in z&&i(5,y=z.x),"y"in z&&i(6,x=z.y),"src"in z&&i(7,I=z.src),"visible"in z&&i(21,C=z.visible),"avatar"in z&&i(8,k=z.avatar),"theme"in z&&i(9,L=z.theme),"color"in z&&i(10,W=z.color),"cursorTagBackgroundColor"in z&&i(11,Q=z.cursorTagBackgroundColor),"opacity"in z&&i(12,J=z.opacity),"pencilEraserSize"in z&&i(22,K=z.pencilEraserSize),"custom"in z&&i(13,De=z.custom)},e.$$.update=()=>{e.$$.dirty&2&&(n=!Y.isEmpty(M)),e.$$.dirty&4&&i(19,s=!Y.isEmpty(E)),e.$$.dirty&256&&i(18,o=!Y.isEmpty(k)),e.$$.dirty&2097152&&i(17,l=C?"":"none"),e.$$.dirty&16&&i(14,c=P===H.ApplianceNames.laserPointer),e.$$.dirty&16400&&i(23,d=c||P===H.ApplianceNames.pencilEraser),e.$$.dirty&8388608&&i(16,f=d?"netless-window-manager-laserPointer-pencilEraser-offset":""),e.$$.dirty&4194304&&i(15,g=K===3?"netless-window-manager-pencilEraser-3-offset":"")},[v,M,E,_,P,y,x,I,k,L,W,Q,J,De,c,g,f,l,o,s,U,C,K,d]}class ak extends nk{constructor(t){super(),ik(this,t,sk,rk,FN,{uid:0,cursorName:1,tagName:2,backgroundColor:3,appliance:4,x:5,y:6,src:7,visible:21,avatar:8,theme:9,color:10,cursorTagBackgroundColor:11,opacity:12,pencilEraserSize:22,custom:13})}}const _y="data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='12' cy='12' r='2.5' stroke='%23000' stroke-linejoin='square'/%3E%3Ccircle cx='12' cy='12' r='3.5' stroke='%23FFF'/%3E%3C/g%3E%3C/svg%3E";function Py(e){return`data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='12' cy='12' r='2.5' stroke='%23${e}' stroke-linejoin='square'/%3E%3Ccircle cx='12' cy='12' r='3.5' stroke='%23${e}'/%3E%3C/g%3E%3C/svg%3E`}function Ss(e){return`data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg' fill='none'%3E%3Cpath d='M5 12H19' stroke='%23${e}' stroke-linejoin='round'/%3E%3Cpath d='M12 5V19' stroke='%23${e}' stroke-linejoin='round'/%3E%3C/svg%3E`}function Pr(e){return`url("${e}") 12 12, auto`}function ok(e){let t="";for(const i in e)t+=`.netless-whiteboard.${i} {cursor: ${e[i]}}
|
|
16
|
-
`;return t}const Pl=document.createElement("style");function lk(e){const[t,i,n]=e.strokeColor,s=((1<<24)+(t<<16)+(i<<8)+n).toString(16).slice(1);return Pl.textContent=ok({"cursor-pencil":Pr(Py(s)),"cursor-eraser":Pr(_y),"cursor-rectangle":Pr(Ss(s)),"cursor-ellipse":Pr(Ss(s)),"cursor-straight":Pr(Ss(s)),"cursor-arrow":Pr(Ss(s)),"cursor-shape":Pr(Ss(s))}),document.head.appendChild(Pl),()=>{Pl.parentNode!=null&&document.head.removeChild(Pl)}}const uk=new Set([H.ApplianceNames.rectangle,H.ApplianceNames.ellipse,H.ApplianceNames.straight,H.ApplianceNames.arrow,H.ApplianceNames.shape]);function nw(e,t){if(e===H.ApplianceNames.pencil)return Py(t);if(e===H.ApplianceNames.eraser)return _y;if(uk.has(e))return Ss(t)}class ck{constructor(t,i,n,s){this.manager=t,this.memberId=i,this.cursorManager=n,this.wrapper=s,this.style="default",this.move=o=>{var l;if(o.type==="main"){const c=this.cursorManager.wrapperRect;this.component&&c&&(this.autoHidden(),this.moveCursor(o,c,this.manager.mainView))}else{const c=this.cursorManager.focusView,d=(l=c==null?void 0:c.divElement)==null?void 0:l.getBoundingClientRect(),f=c==null?void 0:c.camera;c&&d&&f&&this.component&&(this.autoHidden(),this.moveCursor(o,d,c))}},this.setStyle=o=>{this.style=o,this.component&&this.component.$set({src:this.getIcon(),custom:this.isCustomIcon()})},this.leave=()=>{this.hide()},this.updateMember(),this.createCursor(),this.autoHidden(),this.setStyle(n.style)}moveCursor(t,i,n){var d,f;const{x:s,y:o,type:l}=t,c=n==null?void 0:n.screen.convertPointToScreen(s,o);if(c){let g=c.x-2,v=c.y-18;if(this.isCustomIcon()&&(g-=11,v+=4),l==="app"){const M=this.cursorManager.wrapperRect;M&&(g=g+i.x-M.x,v=v+i.y-M.y)}c.x<0||c.x>i.width||c.y<0||c.y>i.height?(d=this.component)==null||d.$set({visible:!1,x:g,y:v}):(f=this.component)==null||f.$set({visible:!0,x:g,y:v})}}get memberApplianceName(){var t,i;return(i=(t=this.member)==null?void 0:t.memberState)==null?void 0:i.currentApplianceName}get memberColor(){var i,n;return`rgb(${(n=(i=this.member)==null?void 0:i.memberState)==null?void 0:n.strokeColor.join(",")})`}get memberColorHex(){var s,o;const[t,i,n]=((o=(s=this.member)==null?void 0:s.memberState)==null?void 0:o.strokeColor)||[236,52,85];return((1<<24)+(t<<16)+(i<<8)+n).toString(16).slice(1)}get payload(){var t;return(t=this.member)==null?void 0:t.payload}get memberCursorName(){var t,i;return((t=this.payload)==null?void 0:t.nickName)||((i=this.payload)==null?void 0:i.cursorName)||this.memberId}get memberTheme(){var t;return(t=this.payload)!=null&&t.theme?"netless-window-manager-cursor-inner-mellow":"netless-window-manager-cursor-inner"}get memberCursorTextColor(){var t;return((t=this.payload)==null?void 0:t.cursorTextColor)||"#FFFFFF"}get memberCursorTagBackgroundColor(){var t;return((t=this.payload)==null?void 0:t.cursorTagBackgroundColor)||this.memberColor}get memberAvatar(){var t;return(t=this.payload)==null?void 0:t.avatar}get memberOpacity(){return!this.memberCursorName&&!this.memberAvatar?0:1}get memberTagName(){var t;return(t=this.payload)==null?void 0:t.cursorTagName}autoHidden(){this.timer&&clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.hide()},1e3*10)}async createCursor(){this.member&&this.wrapper&&(this.component=new ak({target:this.wrapper,props:this.initProps()}))}initProps(){var t;return{uid:this.memberId,x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),custom:this.isCustomIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName,pencilEraserSize:(t=this.member)==null?void 0:t.memberState.pencilEraserSize}}getIcon(){var d;if(!this.member)return;const{memberApplianceName:t,memberColorHex:i}=this,{userApplianceIcons:n,applianceIcons:s}=this.cursorManager;let o=this.memberApplianceName;o===H.ApplianceNames.pencilEraser&&(o=`${o}${((d=this.member)==null?void 0:d.memberState.pencilEraserSize)||1}`);const l=o&&n[o];if(l)return l;if(this.style==="custom"&&t){const f=nw(t,i);if(f)return f}return s[o||H.ApplianceNames.shape]||s[H.ApplianceNames.shape]}isCustomIcon(){var l;if(!this.member)return!1;const{memberApplianceName:t,memberColorHex:i}=this,{userApplianceIcons:n}=this.cursorManager;let s=this.memberApplianceName;return s===H.ApplianceNames.pencilEraser&&(s=`${s}${((l=this.member)==null?void 0:l.memberState.pencilEraserSize)||1}`),s&&n[s]?!1:!!(this.style==="custom"&&t&&nw(t,i))}updateMember(){return this.member=wd(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var t;(t=this.component)==null||t.$set(Y.omit(this.initProps(),["x","y"]))}destroy(){this.component&&this.component.$destroy(),this.cursorManager.cursorInstances.delete(this.memberId),this.timer&&clearTimeout(this.timer)}hide(){this.component&&(this.component.$set({visible:!1}),this.destroy())}}var hk="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==",dk="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==",fk="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=",pk="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",gk="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",mk="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",vk="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMjYiIHZpZXdCb3g9IjAgMCAxOCAyNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIxNyIgaGVpZ2h0PSIyNSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",wk="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMzQiIHZpZXdCb3g9IjAgMCAyNiAzNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIyNSIgaGVpZ2h0PSIzMyIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",yk="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iNTAiIHZpZXdCb3g9IjAgMCAzNCA1MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIzMyIgaGVpZ2h0PSI0OSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K";const xk={[H.ApplianceNames.pencil]:hk,[H.ApplianceNames.selector]:dk,[H.ApplianceNames.eraser]:fk,[H.ApplianceNames.shape]:pk,[H.ApplianceNames.text]:gk,[H.ApplianceNames.laserPointer]:mk,pencilEraser1:vk,pencilEraser2:wk,pencilEraser3:yk},rw="local-cursor";class xo{constructor(t,i,n,s){var c;this.manager=t,this.enableCursor=i,this.cursorInstances=new Map,this.userApplianceIcons={},this.sideEffectManager=new po,this.store=this.manager.store,this.leaveFlag=!0,this._style="default",this.onCursorMove=d=>{const f=this.initCursorInstance(d.uid);if(d.state===ud.Leave)f.leave();else{const g=f.updateMember();this.canMoveCursor(g)&&f.move(d.position)}},this.initCursorInstance=d=>{let f=this.cursorInstances.get(d);return f||(f=new ck(this.manager,d,this,Te.wrapper),this.cursorInstances.set(d,f)),f},this.mouseMoveListener_=(d,f)=>{const g=this.getType(d);this.updateCursor(g,d.clientX,d.clientY),f&&this.showPencilEraserIfNeeded(g,d.clientX,d.clientY)},this.mouseMoveTimer=0,this.mouseMoveListener=d=>{const f=d.pointerType==="touch";if(f&&!d.isPrimary)return;const g=Date.now();if(g-this.mouseMoveTimer>48){if(this.mouseMoveTimer=g,Te.supportAppliancePlugin&&H.isRoom(Te.displayer)&&Te.displayer.disableDeviceInputs){this.leaveFlag&&(this.manager.dispatchInternalEvent(qe.CursorMove,{uid:this.manager.uid,state:ud.Leave}),this.leaveFlag=!1);return}this.mouseMoveListener_(d,f),this.leaveFlag=!0}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.getPoint=(d,f,g)=>{var M;const v=(M=d==null?void 0:d.divElement)==null?void 0:M.getBoundingClientRect();if(v)return d==null?void 0:d.convertToPointInWorld({x:f-v.x,y:g-v.y})},this.getType=d=>{var v;const f=d.target,g=this.manager.focusApp;switch(f.parentElement){case this.mainViewElement:return{type:"main"};case((v=g==null?void 0:g.view)==null?void 0:v.divElement):return{type:"app"};default:return{type:"main"}}},this.roomMembers=(c=this.manager.room)==null?void 0:c.state.roomMembers;const o=Te.wrapper;o&&this.setupWrapper(o),this.sideEffectManager.add(()=>fe.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>fe.on("playgroundSizeChange",()=>this.updateContainerRect()));const l=this.manager.room;l&&this.sideEffectManager.add(()=>{const d=f=>{this.style==="custom"&&f.memberState&&this.enableCustomCursor()};return l.callbacks.on("onRoomStateChanged",d),()=>l.callbacks.off("onRoomStateChanged",d)}),s&&(this.userApplianceIcons=s),this.style=(n==null?void 0:n.style)||"default"}get applianceIcons(){return{...xk,...this.userApplianceIcons}}get style(){return this._style}set style(t){this._style!==t&&(this._style=t,this.cursorInstances.forEach(i=>{i.setStyle(t)}),t==="custom"?this.enableCustomCursor():this.sideEffectManager.flush(rw))}enableCustomCursor(){this.sideEffectManager.add(()=>lk(this.manager.getMemberState()),rw)}canMoveCursor(t){const i=(t==null?void 0:t.memberState.currentApplianceName)===H.ApplianceNames.laserPointer;return this.enableCursor||i}setupWrapper(t){this.sideEffectManager.add(()=>(t.addEventListener("pointerenter",this.mouseMoveListener),t.addEventListener("pointermove",this.mouseMoveListener),t.addEventListener("pointerleave",this.mouseLeaveListener),()=>{t.removeEventListener("pointerenter",this.mouseMoveListener),t.removeEventListener("pointermove",this.mouseMoveListener),t.removeEventListener("pointerleave",this.mouseLeaveListener)})),this.wrapperRect=t.getBoundingClientRect()}setMainViewDivElement(t){this.mainViewElement=t}get boxState(){return this.store.getBoxState()}get focusView(){var t;return(t=this.manager.focusApp)==null?void 0:t.view}showPencilEraserIfNeeded(t,i,n){const s=wd(this.manager.room,this.manager.uid),o=(s==null?void 0:s.memberState.currentApplianceName)===H.ApplianceNames.pencilEraser;if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(s)&&o){const l=t.type==="main"?this.manager.mainView:this.focusView,c=this.getPoint(l,i,n);c&&this.onCursorMove({uid:this.manager.uid,position:{x:c.x,y:c.y,type:t.type}})}}updateCursor(t,i,n){const s=wd(this.manager.room,this.manager.uid);if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(s)){const o=t.type==="main"?this.manager.mainView:this.focusView,l=this.getPoint(o,i,n);l&&this.manager.dispatchInternalEvent(qe.CursorMove,{uid:this.manager.uid,position:{x:l.x,y:l.y,type:t.type}})}}updateContainerRect(){var t,i;this.containerRect=(t=Te.container)==null?void 0:t.getBoundingClientRect(),this.wrapperRect=(i=Te.wrapper)==null?void 0:i.getBoundingClientRect()}deleteCursor(t){this.store.cleanCursor(t);const i=this.cursorInstances.get(t);i&&i.destroy()}hideCursor(t){const i=this.cursorInstances.get(t);i&&i.hide()}destroy(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach(t=>{t.destroy()}),this.cursorInstances.clear())}}xo.kind="CursorManager";function Pn(e,t){if(e.kind&&t&&Object.keys(t).includes(e.kind))switch(e.kind){case"AppManager":return(t==null?void 0:t.AppManager)||bo;case"BoxManager":return(t==null?void 0:t.BoxManager)||wo;case"AttributesDelegate":return(t==null?void 0:t.AttributesDelegate)||So;case"CursorManager":return(t==null?void 0:t.CursorManager)||xo;case"AppProxy":return(t==null?void 0:t.AppProxy)||Mo;case"AppContext":return(t==null?void 0:t.AppContext)||go;case"TeleBoxManager":return(t==null?void 0:t.TeleBoxManager)||vo;case"TeleBoxCollector":return(t==null?void 0:t.TeleBoxCollector)||Ys;default:return e}return e}var Et=(e=>(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.BoxesStatus="boxesStatus",e.LastNotMinimizedBoxesStatus="lastNotMinimizedBoxesStatus",e))(Et||{});class So{constructor(t){this.context=t,this.setAppFocus=(i,n)=>{n?this.context.safeSetAttributes({focus:i}):this.context.safeSetAttributes({focus:void 0})}}setContext(t){this.context=t}get attributes(){return this.context.getAttributes()}apps(){return Y.get(this.attributes,["apps"])}get focus(){return Y.get(this.attributes,["focus"])}getAppAttributes(t){return Y.get(this.apps(),[t])}getAppState(t){return Y.get(this.apps(),[t,"state"])}getMaximized(){return Y.get(this.attributes,["maximized"])}getMinimized(){return Y.get(this.attributes,["minimized"])}getBoxesStatus(){return Y.get(this.attributes,["boxesStatus"])}getBoxStatus(t){return Y.get(this.attributes,["boxesStatus",t])}setBoxStatus(t,i){this.attributes.boxesStatus||this.context.safeSetAttributes({boxesStatus:{}}),this.getBoxStatus(t)!==i&&this.context.safeUpdateAttributes(["boxesStatus",t],i)}getLastNotMinimizedBoxesStatus(){return Y.get(this.attributes,["lastNotMinimizedBoxesStatus"])}getLastNotMinimizedBoxStatus(t){return Y.get(this.attributes,["lastNotMinimizedBoxesStatus",t])}setLastNotMinimizedBoxStatus(t,i){this.attributes.lastNotMinimizedBoxesStatus||this.context.safeSetAttributes({lastNotMinimizedBoxesStatus:{}}),this.getLastNotMinimizedBoxStatus(t)!==i&&this.context.safeUpdateAttributes(["lastNotMinimizedBoxesStatus",t],i)}setupAppAttributes(t,i,n){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const o=["scenePath","title"];n||o.push("scenes");const l=Y.pick(t.options,o),c={kind:t.kind,options:l,isDynamicPPT:n,forceTop:t.forceTop,forceNormal:t.forceNormal,isDragContent:t.isDragContent};typeof t.src=="string"&&(c.src=t.src),c.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",i],c),this.context.safeUpdateAttributes(["apps",i,"state"],{[Yt.Size]:{},[Yt.Position]:{},[Yt.SceneIndex]:0})}updateAppState(t,i,n){Y.get(this.attributes,["apps",t,"state"])&&this.context.safeUpdateAttributes(["apps",t,"state",i],n)}cleanAppAttributes(t){this.context.safeUpdateAttributes(["apps",t],void 0),this.context.safeSetAttributes({[t]:void 0}),this.attributes.focus===t&&this.cleanFocus()}cleanFocus(){this.context.safeSetAttributes({focus:void 0})}getAppSceneIndex(t){var i;return(i=this.getAppState(t))==null?void 0:i[Yt.SceneIndex]}getAppScenePath(t){var i,n;return(n=(i=this.getAppAttributes(t))==null?void 0:i.options)==null?void 0:n.scenePath}getMainViewScenePath(){return this.attributes._mainScenePath}getMainViewSceneIndex(){return this.attributes._mainSceneIndex}getBoxState(){return this.attributes.boxState}setMainViewScenePath(t){this.context.safeSetAttributes({_mainScenePath:t})}setMainViewSceneIndex(t){this.context.safeSetAttributes({_mainSceneIndex:t})}getMainViewCamera(){return Y.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return Y.get(this.attributes,["mainViewSize"])}setMainViewCamera(t){this.context.safeSetAttributes({mainViewCamera:{...t}})}setMainViewSize(t){t.width===0||t.height===0||this.context.safeSetAttributes({mainViewSize:{...t}})}setMainViewCameraAndSize(t,i){i.width===0||i.height===0||this.context.safeSetAttributes({mainViewCamera:{...t},mainViewSize:{...i}})}updateCursor(t,i){Y.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),Y.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"position"],i)}updateCursorState(t,i){Y.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"cursorState"],i)}getCursorState(t){return Y.get(this.attributes,["cursors",t,"cursorState"])}cleanCursor(t){this.context.safeUpdateAttributes(["cursors",t],void 0)}setMainViewFocusPath(t){const i=this.getMainViewScenePath();i&&Zr(t,i)}getIframeBridge(){return Y.get(this.attributes,["iframeBridge"])}setIframeBridge(t){if(Y.isObject(t)){const i=this.getIframeBridge();for(const n in t){const s=t[n];i[n]!==s&&this.context.safeUpdateAttributes(["iframeBridge",n],s)}}}}So.kind="AttributesDelegate";const Sk=(e,t={getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}})=>{const i=Pn(So,e);return new i(t)},Df=(e,t)=>{let i=0;const n=t.length-1;return e===t.index?e===n?i=e-1:i=t.index+1:i=t.index,i},Ji=new qr.default,Ny=class{constructor(e,t,i,n){var s;this.params=e,this.manager=t,this.boxManager=this.manager.boxManager,this.appProxies=this.manager.appProxies,this.viewManager=this.manager.viewManager,this.store=this.manager.store,this.status="normal",this.getAppInitState=o=>{var k,L,W,Q;const l=this.store.getAppState(o);if(!l)return;const c=l==null?void 0:l[Yt.Position],d=this.store.focus,f=l==null?void 0:l[Yt.Size],g=l==null?void 0:l[Yt.SceneIndex],v=(k=this.attributes)==null?void 0:k.maximized,M=(L=this.attributes)==null?void 0:L.minimized,E=(W=this.store.getBoxStatus(o))!=null?W:void 0,_=(Q=this.store.getLastNotMinimizedBoxStatus(o))!=null?Q:void 0,{forceTop:P,forceNormal:y,isDragContent:x}=this.store.getAppAttributes(o),I=l==null?void 0:l.zIndex;let C={maximized:v,minimized:M,zIndex:I};return c&&(C={...C,id:o,x:c.x,y:c.y}),d===o&&(C={...C,focus:!0}),f&&(C={...C,width:f.width,height:f.height}),g&&(C={...C,sceneIndex:g}),E&&(C={...C,boxStatus:E}),_&&(C={...C,lastNotMinimizedBoxStatus:_}),P&&(C={...C,forceTop:P}),y&&(C={...C,forceNormal:y}),x&&(C={...C,isDragContent:x}),C},this.appAttributesUpdateListener=o=>{this.manager.refresher.add(o,()=>H.autorun(()=>{const l=this.manager.attributes[o];l&&this.appEmitter.emit("attributesUpdate",l)})),this.manager.refresher.add(this.stateKey,()=>H.autorun(()=>{var c,d,f,g;const l=(c=this.appAttributes)==null?void 0:c.state;(l==null?void 0:l.zIndex)>0&&l.zIndex!==((d=this.box)==null?void 0:d.zIndex)&&((f=this.boxManager)==null||f.setZIndex(o,l.zIndex),(g=this.boxManager)==null||g.focusBox({appId:o}))})),this.manager.refresher.add(`${o}-fullPath`,()=>H.autorun(()=>{var c;const l=(c=this.appAttributes)==null?void 0:c.fullPath;this.setFocusScenePathHandler(l),this._prevFullPath!==l&&(this.notifyPageStateChange(),this._prevFullPath=l)}))},this.setFocusScenePathHandler=Y.debounce(o=>{var l;this.view&&o&&o!==((l=this.view)==null?void 0:l.focusScenePath)&&(Zr(this.view,o),ke.emit("onAppScenePathChange",{appId:this.id,view:this.view}))},50),this.notifyPageStateChange=Y.debounce(()=>{this.appEmitter.emit("pageStateChange",this.pageState)},50),this.notifyBoxStatusChange=o=>{this.appEmitter.emit("boxStatusChange",{appId:this.id,status:o})},this.kind=e.kind,this.id=i,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new qr.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=n,this.initScenes(),(s=this.params.options)!=null&&s.scenePath&&this.createView(),this._pageState=new EP({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}initScenes(){var t;const e=this.params.options;e&&(this.scenePath=e.scenePath,((t=this.appAttributes)==null?void 0:t.isDynamicPPT)&&this.scenePath?this.scenes=Os(this.manager.displayer)[this.scenePath]:this.scenes=e.scenes)}get view(){return this.manager.viewManager.getView(this.id)}get viewIndex(){var e;return(e=this.view)==null?void 0:e.focusSceneIndex}get isWritable(){var e;return this.manager.canOperate&&!((e=this.box)!=null&&e.readonly)}get attributes(){return this.manager.attributes[this.id]}get appAttributes(){return this.store.getAppAttributes(this.id)}get Logger(){return this.manager.windowManger.Logger}getFullScenePath(){if(this.scenePath)return Y.get(this.appAttributes,[Et.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const e=Y.get(this.appAttributes,["state","SceneIndex"],0),t=vP(this.manager.room,this.scenePath,e);return t&&this.setFullPath(t),t}setFullPath(e){this.manager.safeUpdateAttributes(["apps",this.id,Et.FullPath],e)}async baseInsertApp(e=!1,t=X.Normal){var l;const i=this.params;if(!i.kind)throw this.Logger&&this.Logger.error("[WindowManager]: kind require"),new Error("[WindowManager]: kind require");const n=await((l=Rt.appClasses.get(i.kind))==null?void 0:l()),s=Rt.registered.get(i.kind),o=this.manager.windowManger.resolveAppOptions(i.kind,s==null?void 0:s.appOptions);if(n)await this.setupApp(this.id,e,n,i.options,o,this.manager.useBoxesStatus?t:void 0,i.forceTop,i.forceNormal,i.isDragContent);else throw this.Logger&&this.Logger.error(`[WindowManager]: app load failed ${i.kind} ${i.src}`),new Error(`[WindowManager]: app load failed ${i.kind} ${i.src}`);return fe.emit("updateManagerRect"),{appId:this.id,app:n}}get box(){var e;return(e=this.boxManager)==null?void 0:e.getBox(this.id)}async setupApp(e,t,i,n,s,o,l,c,d){var v;if(Oi("setupApp",e,i,n,o,l,c,d),!this.boxManager)throw new ty;const f=Pn(go,Te.extendClass),g=new f(this.manager,this.boxManager,e,this,s);this.appContext=g;try{fe.once(`${e}${qe.WindowCreated}`).then(async()=>{var _;let M;t||(M=this.getAppInitState(e),(_=this.boxManager)==null||_.updateBoxState(M)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(e),this.setViewFocusScenePath();let E;this.manager.isReplay&&(E=this.manager.mainView.scenePath),setTimeout(async()=>{this.Logger&&this.Logger.info(`[WindowManager]: setup app ${this.kind}, appId: ${e}`);const P=await i.setup(g);this.appResult=P,Rt.notifyApp(this.kind,"created",{appId:e,result:P}),this.afterSetupApp(M),this.fixMobileSize(),E&&this.manager.mainViewProxy.setFocusScenePath(E),ke.emit("onAppSetup",e)},Y0)}),(v=this.boxManager)==null||v.createBox({appId:e,app:i,options:n,canOperate:this.manager.canOperate,smartPosition:this.isAddApp,boxStatus:o,forceTop:l,forceNormal:c,isDragContent:d}),this.isAddApp&&this.box&&(o&&this.store.setBoxStatus(e,o),this.store.updateAppState(e,Yt.ZIndex,this.box.zIndex),this.store.updateAppState(e,Yt.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:e},!1))}catch(M){throw this.Logger&&this.Logger.error(`[WindowManager]: app setup error: ${M.message}`),new Error(`[WindowManager]: app setup error: ${M.message}`)}}fixMobileSize(){var t,i;const e=(t=this.boxManager)==null?void 0:t.getBox(this.id);e&&((i=this.boxManager)==null||i.resizeBox({appId:this.id,width:e.intrinsicWidth+.001,height:e.intrinsicHeight+.001,skipUpdate:!0}))}afterSetupApp(e){var t;e&&(!(e!=null&&e.x)||!e.y)&&((t=this.boxManager)==null||t.setBoxInitState(this.id))}async onSeek(e){var i;this.appEmitter.emit("seek",e).catch(n=>{console.log(`[WindowManager]: emit seek error: ${n.message}`)});const t=this.getAppInitState(this.id);(i=this.boxManager)==null||i.updateBoxState(t)}async onReconnected(){var o;if(!Boolean(this.manager.attributes.apps[this.id])){await this.destroy(!0,!1,!0);return}this.appEmitter.emit("reconnected",void 0);const t=this.getAppInitState(this.id);await this.destroy(!0,!1,!0);const i=this.params,n=Pn(Ny,Te.extendClass);await new n(i,this.manager,this.id,this.isAddApp).baseInsertApp(!0,t==null?void 0:t.boxStatus),(o=this.boxManager)==null||o.updateBoxState(t)}async onRemoveScene(e){if(this.scenePath&&e.startsWith(this.scenePath+"/")){let t=this.pageState.index,i=this._pageState.getFullPath(t);i||(t=0,i=this._pageState.getFullPath(t)),i&&this.setFullPath(i),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=t)}}emitAppSceneStateChange(e){this.appEmitter.emit("sceneStateChange",e)}emitAppIsWritableChange(){this.appEmitter.emit("writableChange",this.isWritable)}makeAppEventListener(e){return(t,i)=>{var n,s,o,l;if(!!this.manager.canOperate)switch(t){case"setBoxSize":{(n=this.boxManager)==null||n.resizeBox({appId:e,width:i.width,height:i.height,skipUpdate:!1});break}case"setBoxMinSize":{(s=this.boxManager)==null||s.setBoxMinSize({appId:e,minWidth:i.minwidth,minHeight:i.minheight});break}case"setBoxTitle":{(o=this.boxManager)==null||o.setBoxTitle({appId:e,title:i.title});break}case Z0.destroy:{if(this.status==="destroyed")return;this.destroy(!0,!1,!0,i==null?void 0:i.error),i!=null&&i.error&&console.error(i==null?void 0:i.error);break}case"focus":{(l=this.boxManager)==null||l.focusBox({appId:this.id}),Ji.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const e=this.getFullScenePath();this.manager.room&&e&&this.view&&cd(this.manager.room,e)}setViewFocusScenePath(){const e=this.getFullScenePath();return e&&this.view&&Zr(this.view,e),e}async createView(){const e=await this.viewManager.createView(this.id);return this.setViewFocusScenePath(),e}get pageState(){return this._pageState.toObject()}async removeSceneByIndex(e){const t=this._pageState.getFullPath(e);if(t){const i=Df(e,this.pageState);return this.setSceneIndexWithoutSync(i),this.manager.dispatchInternalEvent(qe.SetAppFocusIndex,{type:"app",appID:this.id,index:i}),setTimeout(()=>{hd(this.manager.room,t,e)},100),!0}else return!1}setSceneIndexWithoutSync(e){this.view&&(this.view.focusSceneIndex=e)}setSceneIndex(e){if(this.view){this.view.focusSceneIndex=e;const t=this._pageState.getFullPath(e);t&&this.setFullPath(t)}}async destroy(e,t,i,n){var s;if(this.status!=="destroyed"){this.status="destroyed";try{await Rt.notifyApp(this.kind,"destroy",{appId:this.id}),await this.appEmitter.emit("destroy",{error:n})}catch(o){this.Logger&&this.Logger.error(`[WindowManager]: notifyApp error: ${o.message}`),console.error("[WindowManager]: notifyApp error",o.message,o.stack)}this.appEmitter.clearListeners(),fe.emit(`destroy-${this.id}`,{error:n}),e&&((s=this.boxManager)==null||s.closeBox(this.id,i)),t&&(this.store.cleanAppAttributes(this.id),this.scenePath&&hd(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this._pageState.destroy(),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),this.manager.refresher.remove(this.id),this.manager.refresher.remove(this.stateKey),this.manager.refresher.remove(`${this.id}-fullPath`),this._prevFullPath=void 0,this.Logger&&this.Logger.info(`[WindowManager]: destroy app ${this.kind} appId: ${this.id}`)}}close(){return this.destroy(!0,!0,!1)}};let Mo=Ny;Mo.kind="AppProxy";class Mk{constructor(t){this.displayer=t,this.views=new Map}createView(t){const i=ky(this.displayer);return this.views.set(t,i),i}getView(t){return this.views.get(t)}destroyView(t){const i=this.views.get(t);if(i){try{i.release()}catch{}this.views.delete(t)}}setViewScenePath(t,i){const n=this.views.get(t);n&&(n.focusScenePath=i)}destroy(){this.views.forEach(t=>{try{t.release()}catch{}}),this.views.clear()}}const ky=e=>{const t=e.views.createView();return bk(t),t},bk=e=>{e.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class Ck{constructor(t){this.manager=t,this.polling=!1,this.started=!1,this.mainViewIsAddListener=!1,this.isForcingMainViewDivElement=!1,this.wrapperRectWorkaroundFrame=0,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new po,this.playgroundSizeChangeListenerLocalConsole=new Na("playgroundSizeChangeListener",100),this.sizeUpdatedLocalConsole=new Na("sizeUpdated",100),this.cameraUpdatedLocalConsole=new Na("cameraUpdated",100),this.cameraReactionLocalConsole=new Na("cameraReaction",100),this.syncCamera=()=>{if(!this.polling||this.viewMode!==H.ViewMode.Broadcaster)return;const{mainViewCamera:n}=this;n&&n.id!==this.manager.uid&&this.moveCameraSizeByAttributes()},this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>fe.on("writableChange",n=>{n&&this.ensureCameraAndSize(),this.manager.room&&this.syncMainView(this.manager.room)}))},this.onWrapperRectChange=n=>{this.pendingWrapperRectChange=n,this.wrapperRectWorkaroundFrame&&cancelAnimationFrame(this.wrapperRectWorkaroundFrame),this.wrapperRectWorkaroundFrame=requestAnimationFrame(this.runWrapperRectWorkaround)},this.runWrapperRectWorkaround=()=>{this.wrapperRectWorkaroundFrame=0;const n=this.pendingWrapperRectChange,s=this.mainView.divElement;if(this.pendingWrapperRectChange=void 0,!n||!s)return;const o=s.getBoundingClientRect(),l={width:o.width,height:o.height},c=Math.abs(n.width-l.width)<=.5&&Math.abs(n.height-l.height)<=.5,d=Math.abs(this.mainView.size.width-l.width)>.5||Math.abs(this.mainView.size.height-l.height)>.5;c&&d&&this.forceSyncMainViewDivElement(`wrapperRectChange:${n.origin||"unknown"}`,l,s)},this.addCameraReaction=()=>{this.manager.refresher.add(Et.MainViewCamera,this.cameraReaction)},this.cameraReaction=()=>H.reaction(()=>this.mainViewCamera,n=>{n&&n.id!==this.manager.uid&&(this.moveCameraToContian(this.mainViewSize),this.moveCamera(n),this.cameraReactionLocalConsole.log(`camera: ${JSON.stringify(n)}, current size: ${JSON.stringify(this.mainViewSize)}`))},{fireImmediately:!0}),this.sizeChangeHandler=Y.debounce(n=>{n&&(this.moveCameraToContian(n),this.moveCamera(this.mainViewCamera),console.log("[window-manager] sizeChangeHandler current size and camera"+JSON.stringify(n)+JSON.stringify(this.mainViewCamera)+JSON.stringify(this.mainView.camera)+JSON.stringify(this.mainView.size))),this.ensureMainViewSize()},30),this.onUpdateContainerSizeRatio=()=>{const n=this.store.getMainViewSize();console.log("[window-manager] onUpdateContainerSizeRatio "+JSON.stringify(n)),this.sizeChangeHandler(n)},this.onCameraUpdatedByDevice=n=>{this.viewMode!==H.ViewMode.Follower&&(this.store.setMainViewCamera({...n,id:this.manager.uid}),Y.isEqual(this.mainViewSize,{...this.mainView.size,id:this.manager.uid})||this.setMainViewSize(this.view.size))},this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=Y.debounce(n=>{this.store.setMainViewSize({...n,id:this.manager.uid})},50),this._syncMainViewTimer=0,this.handleCameraOrSizeUpdated=()=>{ke.emit("cameraStateChange",this.cameraState),this.manager.room&&this.manager.room.syncMainView&&(clearTimeout(this._syncMainViewTimer),this._syncMainViewTimer=setTimeout(this.syncMainView,100,this.manager.room)),this.ensureMainViewSize()},this.onCameraUpdated=n=>{this.cameraUpdatedLocalConsole.log(JSON.stringify(n)),this.handleCameraOrSizeUpdated()},this.onSizeUpdated=n=>{this.sizeUpdatedLocalConsole.log(JSON.stringify(n)),this.handleCameraOrSizeUpdated()},this.syncMainView=n=>{n.isWritable&&n.syncMainView(this.mainView)},this.setViewMode=n=>{this.viewMode=n},this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),fe.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()});const i=()=>{var n,s,o,l,c,d,f,g;this.playgroundSizeChangeListenerLocalConsole.log(JSON.stringify(this.mainView.camera),JSON.stringify(this.mainView.size),JSON.stringify(this.mainViewSize),JSON.stringify(this.mainViewCamera),window.outerHeight,window.outerWidth,(s=(n=window.visualViewport)==null?void 0:n.width)!=null?s:"null",(l=(o=window.visualViewport)==null?void 0:o.height)!=null?l:"null",(d=(c=window.visualViewport)==null?void 0:c.offsetLeft)!=null?d:"null",(g=(f=window.visualViewport)==null?void 0:f.offsetTop)!=null?g:"null"),this.sizeChangeHandler(this.mainViewSize)};this.sideEffectManager.add(()=>fe.on("playgroundSizeChange",i)),this.sideEffectManager.add(()=>fe.on("containerSizeRatioUpdate",this.onUpdateContainerSizeRatio)),this.sideEffectManager.add(()=>fe.on("wrapperRectChange",this.onWrapperRectChange)),this.sideEffectManager.add(()=>fe.on("startReconnect",()=>{this.didRelease||this.mainView.release()})),this.sideEffectManager.setInterval(this.syncCamera,1500)}ensureCameraAndSize(){this.viewMode===H.ViewMode.Broadcaster&&(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(qe.InitMainViewCamera),this.setCameraAndSize())}get mainViewCamera(){return this.store.getMainViewCamera()}get mainViewSize(){return this.store.getMainViewSize()}get didRelease(){return Y.get(this.view,["didRelease"])}moveCameraSizeByAttributes(){this.moveCameraToContian(this.mainViewSize),this.moveCamera(this.mainViewCamera)}forceSyncMainViewDivElement(t,i,n){var c,d;const{width:s,height:o}=this.mainView.size,l=n;if(!(Math.abs(s-i.width)<=.5&&Math.abs(o-i.height)<=.5)){if(this.isForcingMainViewDivElement){console.log("[window-manager] skipForceSyncMainViewDivElement "+JSON.stringify({reason:t,observedSize:i,viewSize:this.mainView.size}));return}this.isForcingMainViewDivElement=!0;try{const g=this.mainView.screen,v=g==null?void 0:g.resizeObserver;typeof(g==null?void 0:g.refreshSize)=="function"&&(console.log("[window-manager] forceSyncMainViewDivElement observerReset "+JSON.stringify({reason:t,viewSize:this.mainView.size,observedSize:i})),(c=v==null?void 0:v.disconnect)==null||c.call(v),g.refreshSize(i.width,i.height),(d=v==null?void 0:v.observe)==null||d.call(v,n))}finally{queueMicrotask(()=>{const f=l.getBoundingClientRect();console.log("[window-manager] forceSyncMainViewDivElementResult "+JSON.stringify({reason:t,viewSize:this.mainView.size,rect:{width:f.width,height:f.height}})),this.isForcingMainViewDivElement=!1})}}}start(){console.log("[window-manager] start attributes size:"+JSON.stringify(this.mainViewSize)),this.sizeChangeHandler(this.mainViewSize),!this.started&&(this.addCameraListener(),this.addCameraReaction(),this.manager.room&&this.syncMainView(this.manager.room),this.started=!0,this.mainView.focusScenePath&&this.manager.windowManger.onMainViewScenePathChangeHandler(this.mainView.focusScenePath),console.log("[window-manager] start end mainView size:"+JSON.stringify(this.mainView.size)))}setCameraAndSize(){const t={...this.mainView.camera,id:this.manager.uid},i={...this.mainView.size,id:this.manager.uid};this.store.setMainViewCameraAndSize(t,i)}get view(){return this.mainView}get cameraState(){return{...this.view.camera,...this.view.size}}createMainView(){const t=ky(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&Zr(t,i),t}onReconnect(){if(this.didRelease)this.rebind();else{const t=this.store.getMainViewScenePath();this.setFocusScenePath(t)}}setFocusScenePath(t){if(t)return Zr(this.view,t)}rebind(){const t=this.mainView.divElement,i=this.mainView.disableCameraTransform;this.stop(),this.didRelease||this.mainView.release(),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=i,this.mainView.divElement=t,this.addMainViewListener(),this.start(),ke.emit("onMainViewRebind",this.mainView)}addMainViewListener(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}removeMainViewListener(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}async mainViewClickHandler(){var t;!this.manager.canOperate||(this.store.cleanFocus(),(t=this.manager.boxManager)==null||t.blurAllBox())}addCameraListener(){this.view.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.on("onCameraUpdated",this.onCameraUpdated),this.view.callbacks.on("onSizeUpdated",this.onSizeUpdated)}removeCameraListener(){this.view.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.off("onCameraUpdated",this.onCameraUpdated),this.view.callbacks.off("onSizeUpdated",this.onSizeUpdated)}ensureMainViewSize(){(!this.mainViewSize||this.mainViewSize.width===0||this.mainViewSize.height===0)&&this.mainView.size.width>0&&this.mainView.size.height>0&&this.setMainViewSize(this.mainView.size)}moveCameraToContian(t){Y.isEmpty(t)||(this.view.moveCameraToContain({width:t.width,height:t.height,originX:-t.width/2,originY:-t.height/2,animationMode:H.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}moveCamera(t){if(!Y.isEmpty(t)){if(Y.isEqual(t,this.view.camera))return;const{centerX:i,centerY:n,scale:s}=t,o=s*(this.scale||1);this.view.moveCamera({centerX:i,centerY:n,scale:o,animationMode:H.AnimationMode.Immediately})}}stop(){this.removeCameraListener(),this.manager.refresher.remove(Et.MainViewCamera),this.manager.refresher.remove(Et.MainViewSize),this.started=!1}destroy(){console.log("[window-manager] destroy "),this.wrapperRectWorkaroundFrame&&(cancelAnimationFrame(this.wrapperRectWorkaroundFrame),this.wrapperRectWorkaroundFrame=0),this.playgroundSizeChangeListenerLocalConsole.destroy(),this.sizeUpdatedLocalConsole.destroy(),this.cameraUpdatedLocalConsole.destroy(),this.cameraReactionLocalConsole.destroy(),this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class Ik{constructor(t){this.context=t,this.addRedoUndoListeners=i=>{if(i===void 0)this.addViewCallbacks(this.context.mainView(),this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate);else{const n=this.context.getAppProxy(i);n&&n.view&&this.addViewCallbacks(n.view,this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate)}},this.addViewCallbacks=(i,n,s)=>{n(i.canRedoSteps),s(i.canUndoSteps),i.callbacks.on("onCanRedoStepsUpdate",n),i.callbacks.on("onCanUndoStepsUpdate",s)},this.disposeViewCallbacks=i=>{i.callbacks.off("onCanRedoStepsUpdate",this.onCanRedoStepsUpdate),i.callbacks.off("onCanUndoStepsUpdate",this.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=i=>{ke.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{ke.emit("canUndoStepsChange",i)},this.disposePrevFocusViewRedoUndoListeners=i=>{let n;if(i===void 0)n=this.context.mainView();else{const s=this.context.getAppProxy(i);s&&s.view&&(n=s.view)}n&&this.disposeViewCallbacks(n)},fe.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),fe.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(t.focus()),this.addRedoUndoListeners(t.focus())}),this.addRedoUndoListeners(t.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class bo{constructor(t){this.windowManger=t,this.appProxies=new Map,this.appStatus=new Map,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new tP,this.sideEffectManager=new po,this.sceneState=null,this.rootDirRemoving=!1,this._useBoxesStatus=!1,this.onRemoveScenes=async i=>{var s,o;const{scenePath:n}=i;if(n===Qt){console.log("[window-manager] onRemoveScenes ROOT_DIR"),await this.onRootDirRemoved(),this.dispatchInternalEvent(qe.RootDirRemoved);return}if(MP(n)){let l=this.mainView.focusSceneIndex||0,c=(s=this.callbacksNode)==null?void 0:s.scenes[l];c||(l=0,c=(o=this.callbacksNode)==null?void 0:o.scenes[l]),c&&(console.log(`[window-manager] onRemoveScenes setMainViewScenePath ${Qt}${c}`),this.setMainViewScenePath(`${Qt}${c}`)),await this.setMainViewSceneIndex(l)}else this.appProxies.forEach(l=>{l.onRemoveScene(n)})},this.onReadonlyChanged=()=>{this.appProxies.forEach(i=>{i.emitAppIsWritableChange()})},this.onPlayerSeekStart=async()=>{await this.closeAll()},this.onPlayerSeekDone=async i=>{await this._attributesUpdateCallback(this.attributes.apps),this.appProxies.forEach(n=>{n.onSeek(i)})},this.createRootDirScenesCallback=()=>{let i=!1;this.callbacksNode&&(this.callbacksNode.dispose(),i=!0),this.callbacksNode=this.displayer.createScenesCallback(Qt,{onAddScene:this.onSceneChange,onRemoveScene:async(n,s)=>{await this.onSceneChange(n),fe.emit("rootDirSceneRemoved",s)}}),this.callbacksNode&&(this.updateSceneState(this.callbacksNode),this.mainViewScenesLength=this.callbacksNode.scenes.length,i&&this.emitMainViewScenesChange(this.callbacksNode.scenes.length))},this.removeSceneByIndex=async i=>{var o;const n=Df(i,this.windowManger.pageState);this.setSceneIndexWithoutSync(n),this.dispatchInternalEvent(qe.SetAppFocusIndex,{type:"main",index:n});const s=(o=this.callbacksNode)==null?void 0:o.scenes[i];return setTimeout(()=>{s&&hd(this.room,`${Qt}${s}`,i)},100),new Promise((l,c)=>{fe.once("rootDirSceneRemoved").then(d=>{d===s&&l(!0)}).catch(d=>{console.log(`[WindowManager]: removePage error: ${d}`),c(!1)})})},this.setSceneIndexWithoutSync=i=>{var s;const n=(s=this.callbacksNode)==null?void 0:s.scenes[i];n&&this.mainViewProxy.setFocusScenePath(`${Qt}${n}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([ke.emit("mainViewScenesLengthChange",i),fe.emit("changePageState")]),this.updateSceneState=i=>{const n=this.store.getMainViewSceneIndex()||0;let s=i.scenes[n];s||(s=i.scenes[this.mainView.focusSceneIndex||0]),this.sceneState={scenePath:`${Qt}${s}`,contextPath:i.path,index:n,scenes:i.scenes.map(o=>({name:o})),sceneName:s},ke.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(qe.AppMove,i),this.store.updateAppState(i.appId,Yt.Position,{x:i.x,y:i.y}),ke.emit("onBoxMove",i)},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(qe.AppResize,i),this.store.updateAppState(i.appId,Yt.Size,{width:i.width,height:i.height}),ke.emit("onBoxResize",i))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId}),ke.emit("onBoxFocus",i)},this.onBoxBlurred=i=>{this.attributes.focus===i.appId&&(this.windowManger.safeSetAttributes({focus:void 0}),ke.emit("onBoxBlurred",i))},this.onBoxClose=i=>{const n=this.appProxies.get(i.appId);n&&n.destroy(!1,!0,!0,i.error),ke.emit("onBoxClose",i)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(qe.AppBoxStateChange,i),ke.emit("onBoxStateChange",i)},this.notifyBoxesStatusChange=Y.debounce(()=>{var n;(n=this.boxManager)==null||n.setBoxesStatus(this.attributes.boxesStatus);const i=Object.entries(this.attributes.boxesStatus);i.length>0&&i.forEach(([s,o])=>{const l=this.appProxies.get(s);l&&l.notifyBoxStatusChange(o)})},100),this.addBoxesStatusChangeListener=()=>{this.refresher.add("boxesStatus",()=>_a(()=>this.attributes.boxesStatus,()=>{this.notifyBoxesStatusChange()})),this.refresher.add("lastNotMinimizedBoxesStatus",()=>_a(()=>this.attributes.lastNotMinimizedBoxesStatus,()=>{var i;(i=this.boxManager)==null||i.setLastNotMinimizedBoxesStatus(this.attributes.lastNotMinimizedBoxesStatus)}))},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>_a(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{this.refresher.add("appsClose",()=>_a(()=>this.attributes.apps,i=>{i.some(n=>n.kind===H.UpdateEventKind.Removed)&&this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this._prevSceneIndex!==i&&(ke.emit("mainViewSceneIndexChange",i),fe.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this._prevSceneIndex=i)},this.onFocusChange=i=>{var n;this._prevFocused!==i&&(ke.emit("focusedChange",i),fe.emit("focusedChange",{focused:i,prev:this._prevFocused}),this._prevFocused=i,i!==void 0&&((n=this.boxManager)==null||n.focusBox({appId:i}),setTimeout(()=>{const s=this.appProxies.get(i);s&&Rt.notifyApp(s.kind,"focus",{appId:i})},0)))},this.attributesUpdateCallback=Y.debounce(i=>this._attributesUpdateCallback(i),100),this._appIds=[],this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([n,s])=>{Rt.appClasses.has(n)||Rt.register({kind:n,src:s.src,name:s.name})})},this.onMinimized=i=>{var n,s;((n=this.boxManager)==null?void 0:n.minimized)!==i&&(i===!0&&((s=this.boxManager)==null||s.blurAllBox()),setTimeout(()=>{var o;(o=this.boxManager)==null||o.setMinimized(Boolean(i))},0))},this.onAppDelete=async i=>{const n=Object.keys(i);for(const[s,o]of this.appProxies.entries())n.includes(s)||await o.destroy(!0,!1,!0)},this.closeAll=async()=>{for(const[i,n]of this.appProxies.entries())await n.destroy(!0,!1,!0)},this.displayerStateListener=i=>{this.appProxies.forEach(n=>{n.appEmitter.emit("roomStateChange",i)}),fe.emit("observerIdChange",this.displayer.observerId)},this.displayerWritableListener=i=>{var o,l;const n=!i,s=this.windowManger.readonly===void 0||this.windowManger.readonly===!1;this.windowManger.readonly===void 0?(o=this.boxManager)==null||o.setReadonly(i):(l=this.boxManager)==null||l.setReadonly(!(n&&s)),this.appProxies.forEach(c=>{c.emitAppIsWritableChange()}),fe.emit("writableChange",n)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),n=Ph(i),s=Os(this.displayer)[n];if(s.length){const o=i.replace(n,"").replace("/",""),l=s.findIndex(c=>c.name===o);Y.isInteger(l)&&l>=0&&this.safeSetAttributes({_mainSceneIndex:l})}},this.updateRootDirRemoving=i=>{this.rootDirRemoving=i},this.displayer=t.displayer,this.store=Sk(Te.extendClass,{getAttributes:()=>this.attributes,safeSetAttributes:i=>this.safeSetAttributes(i),safeUpdateAttributes:(i,n)=>this.safeUpdateAttributes(i,n)}),this.mainViewProxy=new Ck(this),this.viewManager=new Mk(this.displayer),this.appListeners=new bP(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=zy,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:fe}),this.sideEffectManager.addDisposer(()=>{var i,n;this.appCreateQueue.destroy(),this.mainViewProxy.destroy(),this.refresher.destroy(),this.viewManager.destroy(),(i=this.boxManager)==null||i.destroy(),(n=this.callbacksNode)==null||n.dispose()}),fe.once("onCreated").then(()=>this.onCreated()),fe.on("onReconnected",()=>this.onReconnected()),H.isPlayer(this.displayer)&&(fe.on("seekStart",this.onPlayerSeekStart),fe.on("seek",this.onPlayerSeekDone)),fe.on("removeScenes",this.onRemoveScenes),fe.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),Rt.setSyncRegisterApp(i=>{this.safeUpdateAttributes([Et.Registered,i.kind],i)})}get useBoxesStatus(){return this._useBoxesStatus}set useBoxesStatus(t){this._useBoxesStatus=t}getMemberState(){var t;return((t=this.room)==null?void 0:t.state.memberState)||{strokeColor:[0,0,0]}}async onRootDirRemoved(t=!0){this.setMainViewScenePath(Q0),this.createRootDirScenesCallback();for(const[i,n]of this.appProxies.entries())n.view&&await this.closeApp(i,t);this.mainViewProxy.rebind(),fe.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return H.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return H.isRoom(this.displayer)?this.displayer:void 0}get mainView(){return this.mainViewProxy.view}get polling(){return this.mainViewProxy.polling}set polling(t){this.mainViewProxy.polling=t}get focusApp(){if(this.store.focus)return this.appProxies.get(this.store.focus)}get uid(){var t;return((t=this.room)==null?void 0:t.uid)||""}get Logger(){return this.windowManger.Logger}getMainViewSceneDir(){const t=this.store.getMainViewScenePath();if(t)return Ph(t);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var t;if(Object.keys(this.attributes.apps).length&&this.store.focus&&(this._focusAppId=this.store.focus,await new Promise(i=>{this._focusAppCreatedResolve=i,this._resolveTimer=setTimeout(()=>{i(this.appProxies.get(this._focusAppId||""))},500)}).then(()=>{this._resolveTimer=void 0,this._focusAppCreatedResolve=void 0,this.focusByAttributes(this.attributes.apps)})),await this._attributesUpdateCallback(this.attributes.apps),fe.emit("updateManagerRect"),Ji.on("move",this.onBoxMove),Ji.on("resize",this.onBoxResize),Ji.on("focus",this.onBoxFocus),Ji.on("close",this.onBoxClose),Ji.on("boxStateChange",this.onBoxStateChange),Ji.on("blurred",this.onBoxBlurred),this.addAppsChangeListener(),this.addAppCloseListener(),this.addBoxesStatusChangeListener(),this.refresher.add("maximized",()=>H.autorun(()=>{var n;const i=this.attributes.maximized;(n=this.boxManager)==null||n.setMaximized(Boolean(i))})),this.refresher.add("minimized",()=>H.autorun(()=>{const i=this.attributes.minimized;this.onMinimized(i)})),this.refresher.add("mainViewIndex",()=>H.autorun(()=>{const i=Y.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>H.autorun(()=>{const i=Y.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>H.autorun(()=>{const i=Y.get(this.attributes,Et.Registered);this.onRegisteredChange(i)})),!this.attributes.apps||Object.keys(this.attributes.apps).length===0){const i=this.store.getMainViewScenePath();if(!i)return;this.resetScenePath(i)}this.displayerWritableListener(!((t=this.room)!=null&&t.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this.focusByAttributes(this.attributes.apps),this._prevFocused=this.attributes.focus,Te.supportAppliancePlugin||this.sideEffectManager.add(()=>{const i=new Ik({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:n=>this.appProxies.get(n)});return()=>i.destroy()})}notifyAppsChange(t){(this._appIds.length!==t.length||!this._appIds.every(i=>t.includes(i)))&&(this._appIds=t,ke.emit("appsChange",t))}async _attributesUpdateCallback(t){if(t&&Te.container){const i=Object.keys(t);i.length===0&&this.appCreateQueue.emitReady();const s=Y.orderBy(i.map(o=>({id:o,createdAt:t[o].createdAt})),"createdAt","asc").map(({id:o})=>o);this.notifyAppsChange(s);for(const o of s)if(!this.appProxies.has(o)&&!this.appStatus.has(o)){const l=t[o];try{if(!this.attributes[o])throw this.Logger&&this.Logger.error(`[WindowManager]: appAttributes is undefined, appId: ${o}`),new Error("appAttributes is undefined");this.appCreateQueue.push(async()=>{this.appStatus.set(o,ld.StartCreate);const d=await this.baseInsertApp({kind:l.kind,options:l.options,isDynamicPPT:l.isDynamicPPT,forceNormal:l.forceNormal,forceTop:l.forceTop,isDragContent:l.isDragContent},o,!1);return d&&this._focusAppId===o&&this._focusAppCreatedResolve&&(this._resolveTimer&&clearTimeout(this._resolveTimer),this._focusAppCreatedResolve(d)),d}),this.focusByAttributes(t)}catch(c){console.warn("[WindowManager]: Insert App Error",c)}}}}refresh(){this.attributesUpdateCallback(this.attributes.apps)}setBoxManager(t){this.boxManager=t}resetMaximized(){var t;(t=this.boxManager)==null||t.setMaximized(Boolean(this.store.getMaximized()))}resetMinimized(){var t;(t=this.boxManager)==null||t.setMinimized(Boolean(this.store.getMinimized()))}bindMainView(t,i){const n=this.mainViewProxy.view;n.disableCameraTransform=i,n.divElement=t,n.focusScenePath||this.setMainViewFocusPath(),fe.emit("mainViewMounted"),ke.emit("onMainViewMounted",n);const s=this.hasRoot(n.divElement),o=this.getRectByDivElement(n.divElement);let l=`[window-manager] bindMainView hasRoot:${s}, rect:${JSON.stringify(o)}, outerHeight:${window.outerHeight}, outerWidth:${window.outerWidth}`;const c=window.visualViewport;c&&(l+=`, visualViewportWidth:${c.width}, visualViewportHeight:${c.height}, visualViewportOffsetLeft:${c.offsetLeft}, visualViewportOffsetTop:${c.offsetTop}`),console.log(l)}hasRoot(t){let i=t;for(;i;){if(i.parentElement===document.body)return!0;i=i.parentElement}return!1}getRectByDivElement(t){return t.getBoundingClientRect()}setMainViewFocusPath(t){var n;const i=t||this.store.getMainViewScenePath();if(i)return Zr(this.mainView,i),((n=this.mainView)==null?void 0:n.focusScenePath)===i}resetScenePath(t){this.displayer.state.sceneState.scenePath!==t&&cd(this.room,t)}async addApp(t,i){var l;Oi("addApp",t),(l=this.windowManger.Logger)==null||l.info(`[WindowManager]: addApp ${t.kind}, isDynamicPPT: ${i}`);const{appId:n,needFocus:s}=await this.beforeAddApp(t,i),o=await this.baseInsertApp(t,n,!0,s);return this.afterAddApp(o),o==null?void 0:o.id}async beforeAddApp(t,i){var l,c;const n=await mP(t.kind);this.appStatus.set(n,ld.StartCreate);const s=(l=t.attributes)!=null?l:{};this.safeUpdateAttributes([n],s),this.store.setupAppAttributes(t,n,i);const o=!((c=this.boxManager)!=null&&c.minimized);return o&&this.store.setAppFocus(n,!0),{appId:n,needFocus:o}}afterAddApp(t){var i,n;if(t&&t.box){const s=t.box;Ji.emit("move",{appId:t.id,x:s==null?void 0:s.intrinsicX,y:s==null?void 0:s.intrinsicY}),this.store.updateAppState(t.id,Yt.ZIndex,s.zIndex)}(i=this.boxManager)!=null&&i.minimized&&((n=this.boxManager)==null||n.setMinimized(!1,!1))}async closeApp(t,i=!0){const n=this.appProxies.get(t);n&&await n.destroy(!0,i,!1)}async baseInsertApp(t,i,n,s){var c;if(this.appProxies.has(i)){(c=this.windowManger.Logger)==null||c.warn(`[WindowManager]: app duplicate exists and cannot be created again, appId: ${i}`);return}const o=Pn(Mo,Te.extendClass),l=new o(t,this,i,n);if(l)return await l.baseInsertApp(s),this.appStatus.delete(i),l;throw this.appStatus.delete(i),this.Logger&&this.Logger.error(`[WindowManager]: initialize AppProxy failed, appId: ${i}`),new Error("[WindowManger]: initialize AppProxy failed")}safeSetAttributes(t){this.windowManger.safeSetAttributes(t)}safeUpdateAttributes(t,i){this.windowManger.safeUpdateAttributes(t,i)}async setMainViewScenePath(t){if(this.room){const i=this.displayer.scenePathType(t);if(Ph(t)!==Qt)throw this.Logger&&this.Logger.error('[WindowManager]: main view scenePath must in root dir "/"'),new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===H.ScenePathType.None)throw this.Logger&&this.Logger.error(`[WindowManager]: ${t} not valid scene`),new Error(`[WindowManager]: ${t} not valid scene`);if(i===H.ScenePathType.Page)await this._setMainViewScenePath(t);else if(i===H.ScenePathType.Dir){const s=yP(this.displayer,t);s&&await this._setMainViewScenePath(s)}}}async _setMainViewScenePath(t){this.setMainViewFocusPath(t)&&(this.safeSetAttributes({_mainScenePath:t}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(t))}async setMainViewSceneIndex(t){var i;if(this.room){if(this.store.getMainViewSceneIndex()===t)return;const n=(i=this.callbacksNode)==null?void 0:i.scenes[t],s=`${Qt}${n}`;if(n)this.setMainViewFocusPath(s)&&(this.store.setMainViewScenePath(s),this.store.setMainViewSceneIndex(t),this.dispatchSetMainViewScenePath(s));else throw this.Logger&&this.Logger.error(`[WindowManager]: ${t} not valid index`),new Error(`[WindowManager]: ${t} not valid index`)}}dispatchSetMainViewScenePath(t){this.dispatchInternalEvent(qe.SetMainViewScenePath,{nextScenePath:t}),ke.emit("mainViewScenePathChange",t),cd(this.room,t)}getAppInitPath(t){var n;const i=this.store.getAppAttributes(t);if(i)return(n=i==null?void 0:i.options)==null?void 0:n.scenePath}safeDispatchMagixEvent(t,i){this.canOperate&&this.displayer.dispatchMagixEvent(t,i)}focusByAttributes(t){var i;if(t&&Object.keys(t).length===((i=this.boxManager)==null?void 0:i.boxSize)){const n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}async onReconnected(){await this._attributesUpdateCallback(this.attributes.apps);const i=Array.from(this.appProxies.values()).map(n=>n.onReconnected());this.mainViewProxy.onReconnect(),await Promise.all(i),this.callbacksNode&&this.onSceneChange(this.callbacksNode)}notifyContainerRectUpdate(t){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",t)})}dispatchInternalEvent(t,i){this.safeDispatchMagixEvent(od,{eventName:t,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),Ji.clearListeners(),fe.clearListeners(),this.appProxies.size&&this.appProxies.forEach(t=>{t.destroy(!0,!1,!0)}),ke.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0,this._resolveTimer&&clearTimeout(this._resolveTimer),this._focusAppCreatedResolve=void 0,this._resolveTimer=void 0}}bo.kind="AppManager";const Ak=window.ResizeObserver||X_.ResizeObserver;class Lf{constructor(t){this.emitter=t,this.updateSizerLocalConsole=new Na("updateSizer",100)}static create(t,i,n,s){const o=new Lf(s);return o.observePlaygroundSize(t,i,n),o}observePlaygroundSize(t,i,n){this.updateSizer(t.getBoundingClientRect(),i,n,"observePlaygroundSize"),this.containerResizeObserver=new Ak(s=>{var l;const o=(l=s[0])==null?void 0:l.contentRect;o&&(this.updateSizer(o,i,n,"containerResizeObserver"),this.emitter.emit("playgroundSizeChange",o))}),this.disposer=this.emitter.on("containerSizeRatioUpdate",()=>{const s=t.getBoundingClientRect();this.updateSizer(s,i,n,"containerSizeRatioUpdate"),this.emitter.emit("playgroundSizeChange",s)}),this.containerResizeObserver.observe(t)}updateSizer({width:t,height:i},n,s,o){if(t&&i){i/t>Te.containerSizeRatio?(i=t*Te.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(t=i/Te.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!1)),s.style.width=`${t}px`,s.style.height=`${i}px`;const l=s.getBoundingClientRect();this.updateSizerLocalConsole.log(`from ${o}, traget size: ${JSON.stringify({width:t,height:i})}, wrapperRect: ${l.width} ${l.height}`),this.emitter.emit("wrapperRectChange",{width:l.width,height:l.height,origin:o})}}disconnect(){var t,i;this.updateSizerLocalConsole.destroy(),(t=this.containerResizeObserver)==null||t.disconnect(),(i=this.disposer)==null||i.call(this),this.disposer=void 0}}class Tk{constructor(t){this.manager=t,fe.on("changePageState",()=>{ke.emit("pageStateChange",this.toObject())})}get index(){return this.manager.store.getMainViewSceneIndex()||0}get length(){return this.manager.mainViewScenesLength||0}toObject(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}}class Ek{constructor(t){this.ctx=t,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=async i=>{var n,s;i===H.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===H.RoomPhase.Connected&&this.phase===H.RoomPhase.Reconnecting&&((n=this.room)!=null&&n.isWritable?(s=this.room)==null||s.dispatchMagixEvent(_h,{}):(await G0(500),this.onReconnected())),this.phase=i},this.onReconnected=Y.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{Oi("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,n)=>{Y.isFunction(i)&&this.disposers.set(n,i())}),this.ctx.emitter.emit("onReconnected")}}setRoom(t){this.room=t,this.phase=t==null?void 0:t.phase,t&&(t.callbacks.off("onPhaseChanged",this.onPhaseChanged),t.callbacks.on("onPhaseChanged",this.onPhaseChanged),t.addMagixEventListener(_h,i=>{i.authorId===t.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(t){this.ctx=t}releaseDisposers(){this.disposers.forEach(t=>{Y.isFunction(t)&&t()}),this.disposers.clear()}refresh(){this._onReconnected()}add(t,i){const n=this.disposers.get(t);n&&Y.isFunction(n)&&n(),Y.isFunction(i)&&(this.reactors.set(t,i),this.disposers.set(t,i()))}remove(t){this.reactors.has(t)&&this.reactors.delete(t);const i=this.disposers.get(t);i&&(Y.isFunction(i)&&i(),this.disposers.delete(t))}hasReactor(t){return this.reactors.has(t)}destroy(){var t,i;(t=this.room)==null||t.callbacks.off("onPhaseChanged",this.onPhaseChanged),(i=this.room)==null||i.removeMagixEventListener(_h,this.onReconnected),this.releaseDisposers()}}const _k=(e,t)=>{if(H.isPlayer(e))Nk(e);else{if(e=e,Object.getOwnPropertyDescriptor(e,"disableCameraTransform"))return;Object.defineProperty(e,"disableCameraTransform",{get(){return t.mainView.disableCameraTransform},set(o){t.mainView.disableCameraTransform=o}}),Object.defineProperty(e,"canUndoSteps",{get(){return t.canUndoSteps}}),Object.defineProperty(e,"canRedoSteps",{get(){return t.canRedoSteps}});const n=e.scalePptToFit;e.scalePptToFit=(...o)=>{var l;n.call(e,...o),(l=t.appManager)!=null&&l.mainViewProxy&&t.appManager.mainViewProxy.setCameraAndSize()};const s=e.putScenes;e.putScenes=(...o)=>{const[l,c]=o,d=t.mainView.focusScenePath;if(d&&l&&c){console.log("[window-manager] putScenes "+JSON.stringify(o));for(const f of c)if(`${l}${f.name}`===d){console.error(`[window-manager] putScenes: scene name can not be the same as the current scene path: ${d}`);return}}return s.call(e,...o)},e.moveCamera=o=>t.moveCamera(o),e.moveCameraToContain=(...o)=>t.moveCameraToContain(...o),e.convertToPointInWorld=(...o)=>t.mainView.convertToPointInWorld(...o),e.setCameraBound=(...o)=>t.mainView.setCameraBound(...o),e.scenePreview=(...o)=>t.mainView.scenePreview(...o),e.fillSceneSnapshot=(...o)=>t.mainView.fillSceneSnapshot(...o),e.generateScreenshot=(...o)=>t.mainView.generateScreenshot(...o),e.setMemberState=(...o)=>t.mainView.setMemberState(...o),e.redo=()=>t.redo(),e.undo=()=>t.undo(),e.cleanCurrentScene=()=>t.cleanCurrentScene(),e.delete=()=>t.delete(),e.copy=()=>t.copy(),e.paste=()=>t.paste(),e.duplicate=()=>t.duplicate(),e.insertImage=(...o)=>t.insertImage(...o),e.completeImageUpload=(...o)=>t.completeImageUpload(...o),e.insertText=(...o)=>t.insertText(...o),e.lockImage=(...o)=>t.lockImage(...o),e.lockImages=(...o)=>t.lockImages(...o),Pk(e,t)}},Pk=(e,t)=>{const i=e.removeScenes;e.removeScenes=(n,s)=>{var l;n===Qt&&((l=t.appManager)==null||l.updateRootDirRemoving(!0));const o=i.call(e,n);return fe.emit("removeScenes",{scenePath:n,index:s}),o}},Nk=e=>{const t=e.seekToProgressTime;async function i(n){await fe.emit("seekStart");const s=await t.call(e,n);return fe.emit("seek",n),s}e.seekToProgressTime=i},kk=async()=>{const e=await Promise.resolve().then(function(){return ID});return Te.debug&&e.setOptions({verbose:!0}),e.default||e},Bk=async()=>{const e=await Promise.resolve().then(function(){return DR});return e.default||e},zk=async()=>{const e=await Promise.resolve().then(function(){return b2});return e.default||e},Dk=()=>{Te.register({kind:An.DocsViewer,src:Bk}),Te.register({kind:An.MediaPlayer,src:kk}),Te.register({kind:An.Presentation,src:zk,appOptions:{debounceSync:!0,useScrollbar:!0}})},An={DocsViewer:"DocsViewer",MediaPlayer:"MediaPlayer",Presentation:"Presentation"};const Zn={Ready:"Ready",RootRect:"ReplayRootRect",Message:"message",ComputeStyle:"computeStyle",Load:"load",DisplayerState:"displayerState",Show:"show",Hide:"hide"},Lk=(e,t)=>new Array(e).fill(0).map((i,n)=>t(n)),He=class{constructor(e,t){this.manager=e,this.appManager=t,this.magixEventMap=new Map,this.cssList=[],this.allowAppliances=["clicker"],this.bridgeDisposer=Y.noop,this.rootRect=null,this.sideEffectManager=new po,this.execListenIframe=Y.debounce(i=>{this.listenIframe(i)},50),this.onPhaseChangedListener=i=>{i===H.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay()},this.stateChangeListener=i=>{i={...i},i.cameraState=this.manager.cameraState,this.postMessage({kind:"RoomStateChanged",payload:i}),i.cameraState&&(He.emitter.emit("GetRootRect"),this.computedStyle(i)),i.memberState&&(this.computedZindex(),this.updateStyle()),i.sceneState&&this.computedIframeDisplay(i,this.attributes)},this.displayer=He.displayer=t.displayer,this.iframe=this._createIframe(),this.sideEffectManager.addDisposer(He.emitter.on("ReplayRootRect",i=>{this.rootRect=i}),Zn.RootRect),this.sideEffectManager.addDisposer(He.emitter.on("HideIframe",()=>{this.iframe.className=He.hiddenClass}),Zn.Hide),this.sideEffectManager.addDisposer(He.emitter.on("DispayIframe",()=>{this.iframe.className=""}),Zn.Show),this.sideEffectManager.addDisposer(He.emitter.on("created",()=>{this.bridgeDisposer(),this.bridgeDisposer=H.autorun(()=>{var n;const i=this.attributes;if(i.url){const s=(n=this.iframe)==null?void 0:n.src;s&&s!==i.url&&this.execListenIframe(i)}i.displaySceneDir&&this.computedIframeDisplay(this.displayer.state,i),(i.width||i.height)&&this.iframe&&(this.iframe.width=`${i.width}px`,this.iframe.height=`${i.height}px`),this.postMessage({kind:"AttributesUpdate",payload:i})})})),this.sideEffectManager.addDisposer(e.emitter.on("cameraStateChange",()=>{this.computedStyle(this.displayer.state)})),He.onCreate(this)}static onCreate(e){He.emitter.emit("StartCreate"),He.emitter.emit("OnCreate",e),He.emitter.emit("created")}insert(e){const t={url:e.url,width:e.width,height:e.height,displaySceneDir:e.displaySceneDir,useClicker:e.useClicker||!1,useSelector:e.useSelector};this.setAttributes(t);const i=()=>{this.getIframe(),this.listenIframe(this.attributes),this.listenDisplayerState(),He.emitter.emit("GetRootRect")};if(this.getIframe())i();else{const n=this.sideEffectManager.addDisposer(He.emitter.on("WrapperDidMount",()=>{i(),this.sideEffectManager.flush(n)})),s=this.sideEffectManager.addDisposer(He.emitter.on("WrapperDidUpdate",()=>{i(),this.sideEffectManager.flush(s)}))}return this.attributes.useSelector&&this.allowAppliances.push("selector"),this.computedStyle(this.displayer.state),this.listenDisplayerCallbacks(),this.getComputedIframeStyle(),this.sideEffectManager.addEventListener(window,"message",this.messageListener.bind(this),void 0,Zn.Message),He.alreadyCreate=!0,this}getComputedIframeStyle(){this.sideEffectManager.setTimeout(()=>{this.iframe&&getComputedStyle(this.iframe)},200,Zn.ComputeStyle)}destroy(){this.sideEffectManager.flushAll(),He.emitter.emit("Destory"),He.alreadyCreate=!1,He.emitter.clearListeners()}getIframe(){return this.iframe||(this.iframe=this._createIframe()),this.iframe}setIframeSize(e){this.iframe&&(this.iframe.width=`${e.width}px`,this.iframe.height=`${e.height}px`,this.setAttributes({width:e.width,height:e.height}))}get attributes(){return this.appManager.store.getIframeBridge()}setAttributes(e){this.appManager.store.setIframeBridge(e)}_createIframe(){const e=document.createElement("iframe");return e.id="IframeBridge",e.className=He.hiddenClass,this.appManager.mainView.divElement&&this.appManager.mainView.divElement.appendChild(e),e}scaleIframeToFit(e=H.AnimationMode.Immediately){if(!this.inDisplaySceneDir)return;const{width:t=1280,height:i=720}=this.attributes,n=t?-t/2:0,s=i?-i/2:0;this.manager.moveCameraToContain({originX:n,originY:s,width:t,height:i,animationMode:e})}get isReplay(){return this.manager.isReplay}handleSetPage(e){if(this.isReplay||!this.attributes.displaySceneDir)return;const t=e.payload,i=this.displayer,n=i.entireScenes()[this.attributes.displaySceneDir];if(!n||n.length!==t){const s=Lk(t,o=>({name:String(o+1)}));i.putScenes(this.attributes.displaySceneDir,s),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}listenIframe(e){const t=i=>{var n;this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:(n=He.displayer)==null?void 0:n.state,currentPage:this.currentPage,observerId:this.displayer.observerId}}),He.emitter.emit("IframeLoad",i),this.sideEffectManager.addDisposer(He.emitter.on("Ready",()=>{var s;this.postMessage((s=this.attributes.lastEvent)==null?void 0:s.payload)}),Zn.Ready),this.computedStyleAndIframeDisplay()};e.url&&this.iframe.src!==e.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=e.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=e.url)),this.iframe.width=`${e.width}px`,this.iframe.height=`${e.height}px`,this.sideEffectManager.addEventListener(this.iframe,"load",t,void 0,Zn.Load)}listenDisplayerState(){this.isReplay&&(this.displayer._phase===H.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add(()=>(this.displayer.callbacks.on("onPhaseChanged",this.onPhaseChangedListener),()=>this.displayer.callbacks.off("onPhaseChanged",this.onPhaseChangedListener)),Zn.DisplayerState)),this.computedStyleAndIframeDisplay()}computedStyleAndIframeDisplay(){this.computedStyle(this.displayer.state),this.computedIframeDisplay(this.displayer.state,this.attributes)}listenDisplayerCallbacks(){this.displayer.callbacks.on(this.callbackName,this.stateChangeListener)}get callbackName(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}computedStyle(e){const t=this.manager.cameraState,i=this.attributes.width||1280,n=this.attributes.height||720;if(this.iframe){const{width:s,height:o,scale:l,centerX:c,centerY:d}=t,f=this.rootRect||{x:0,y:0},g=`${s/2+f.x}px`,v=`${o/2+f.y}px`,M=`transform-origin: ${g} ${v};`,E=(s-i)/2*l,_=(o-n)/2*l,P=-(c*l)+E,y=-(d*l)+_,x=`transform: translate(${P}px,${y}px) scale(${l}, ${l});`,W=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;",M,x];this.cssList=W,this.computedZindex(),this.updateStyle()}}computedIframeDisplay(e,t){this.inDisplaySceneDir?He.emitter.emit("DispayIframe"):He.emitter.emit("HideIframe")}computedZindex(){const e="z-index: -1;",t=this.cssList.findIndex(i=>i===e);t!==-1&&this.cssList.splice(t,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(e)}updateStyle(){this.iframe.style.cssText=this.cssList.join(" ")}get iframeOrigin(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(e){console.warn(e)}}messageListener(e){if(Oi("<<<",JSON.stringify(e.data)),e.origin!==this.iframeOrigin)return;const 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:{Oi(`${t.kind} not allow event.`);break}}}handleSDKCreate(){this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:this.displayer.state,currentPage:this.currentPage,observerId:this.displayer.observerId}})}handleDispatchMagixEvent(e){const t=e.payload;this.appManager.safeDispatchMagixEvent(t.event,t.payload)}handleSetAttributes(e){this.setAttributes(e.payload)}handleRegisterMagixEvent(e){const t=e.payload,i=n=>{n.authorId!==this.displayer.observerId&&this.postMessage({kind:"ReciveMagixEvent",payload:n})};this.magixEventMap.set(t,i),this.displayer.addMagixEventListener(t,i)}handleRemoveMagixEvent(e){const t=e.payload,i=this.magixEventMap.get(t);this.displayer.removeMagixEventListener(t,i)}handleNextPage(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}handlePrevPage(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}handlePageTo(e){if(this.manager.canOperate){const t=e.payload;if(!Number.isSafeInteger(t)||t<=0)return;this.manager.setMainViewSceneIndex(t-1),this.dispatchMagixEvent("PageTo",t-1)}}handleRemoveAllMagixEvent(){this.magixEventMap.forEach((e,t)=>{this.displayer.removeMagixEventListener(t,e)}),this.magixEventMap.clear()}handleGetAttributes(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}postMessage(e){var t;this.iframe&&((t=this.iframe.contentWindow)==null||t.postMessage(JSON.parse(JSON.stringify(e)),"*"))}dispatchMagixEvent(e,t){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:e,payload:t}}),this.displayer.dispatchMagixEvent(e,t))}get currentIndex(){return this.manager.mainViewSceneIndex}get currentPage(){return this.currentIndex+1}get totalPage(){return this.manager.mainViewScenesLength}get readonly(){return!this.displayer.isWritable}get inDisplaySceneDir(){return this.manager.mainViewSceneDir===this.attributes.displaySceneDir}isClicker(){if(this.readonly)return!1;const e=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(e)}get isDisableInput(){return"disableDeviceInputs"in this.displayer?this.displayer.disableDeviceInputs:!0}};let Gs=He;Gs.kind="IframeBridge";Gs.hiddenClass="netless-iframe-brdige-hidden";Gs.emitter=new qr.default;Gs.displayer=null;Gs.alreadyCreate=!1;class Rk extends qr.default{_inject(t){this.context=t}}class By{constructor(t){this.extends=new Map,this.context={manager:this,windowManager:t.windowManager,internalEmitter:t.internalEmitter},t.container&&this.refreshContainer(t.container)}refreshContainer(t){this.context.windowManagerContainer=t,this.extends.forEach(i=>{i._inject(this.context)})}hasRegister(t){return Rt.appClasses.has(t)}use(t){this.extends.set(t.kind,t),t._inject(this.context),t.onCreate()}destroy(){this.extends.forEach(t=>{this.extends.delete(t.kind),t.onDestroy()})}}function Ok(e,t){return t===void 0?e:()=>({...typeof e=="function"?e():e,...t})}function Vk(e,t){if(e.kind&&t&&Object.keys(t).includes(e.kind))switch(e.kind){case"AppManager":return(t==null?void 0:t.AppManager)||bo;case"BoxManager":return(t==null?void 0:t.BoxManager)||wo;case"AttributesDelegate":return(t==null?void 0:t.AttributesDelegate)||So;case"CursorManager":return(t==null?void 0:t.CursorManager)||xo;case"AppProxy":return(t==null?void 0:t.AppProxy)||Mo;case"AppContext":return(t==null?void 0:t.AppContext)||go;case"TeleBoxManager":return(t==null?void 0:t.TeleBoxManager)||vo;case"TeleBoxCollector":return(t==null?void 0:t.TeleBoxCollector)||Ys;default:return e}return e}const $h="Slide",jh=An.Presentation,$k=1,jk=4;function sw(e){return typeof e=="number"&&Number.isFinite(e)&&e>=$k&&e<=jk}const zy=new Ek({emitter:fe}),de=class extends H.InvisiblePlugin{constructor(e){super(e),this.version="1.0.17-beta.0",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.55"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@netless/app-presentation":"^0.1.9","@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.30","@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","side-effect-manager":"0.1.5",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.9.9",vitest:"^0.14.1","white-web-sdk":"^2.16.55"}},this.emitter=ke,this.viewMode=H.ViewMode.Broadcaster,this.isReplay=H.isPlayer(this.displayer),this._cursorUIDs=[],this.containerSizeRatio=de.containerSizeRatio,this.onMainViewScenePathChangeHandler=t=>{const i=this.mainView.divElement;if(i){const n=i.querySelector(".background img");if(n){const s=n==null?void 0:n.getBoundingClientRect(),o=window.getComputedStyle(n),l=(s==null?void 0:s.width)>0&&(s==null?void 0:s.height)>0&&o.display!=="none",c=this.mainView.camera;console.log("[window-manager] backgroundImageVisible:"+l+" camera:"+JSON.stringify(c));return}console.log("[window-manager] onMainViewScenePathChange scenePath:"+t+" backgroundImageVisible is not found");return}console.log("[window-manager] onMainViewScenePathChange scenePath:"+t+" mainViewElement is not found")},de.displayer=e.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.55"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@netless/app-presentation":"^0.1.9","@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.30","@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","side-effect-manager":"0.1.5",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.9.9",vitest:"^0.14.1","white-web-sdk":"^2.16.55"}},this.emitter.on("mainViewScenePathChange",this.onMainViewScenePathChangeHandler)}get Logger(){return this._roomLogger}static onCreate(e){de._resolve(e)}static async mount(e,t){var f;const i=e.room;de.container=e.container,de.supportAppliancePlugin=e.supportAppliancePlugin;const n=e.containerSizeRatio,s=e.debug,o=e.cursor;de.params=e,de.extendClass=t,de.displayer=e.room,jN();let l;if(H.isRoom(i)){if(i.phase!==H.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");i.phase===H.RoomPhase.Connected&&i.isWritable&&(i.disableSerialization=!1),l=await this.initManager(i),l&&(l._roomLogger=i.logger,l.attributesDeboundceLog=new VN(l._roomLogger,"attributes",300),de.registered.size>0&&l._roomLogger.info(`[WindowManager] registered apps: ${JSON.stringify(Array.from(de.registered.keys()))}`))}if(de.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(s),l!=null&&l._roomLogger?l._roomLogger.info(`[WindowManager] Already insert room version: ${l.version}`):Oi("Already insert room",l),H.isRoom(this.displayer)){if(!l)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await H0.default(async g=>{if(l=i.getInvisiblePlugin(de.kind),!l)throw Oi(`manager is empty. retrying ${g}`),new Error},{retries:10,maxTimeout:5e3});if(!l)throw new Error("[WindowManager]: create manager failed");l.builtinAppOptions=e.builtinAppOptions,n&&(de.containerSizeRatio=n),await l.ensureAttributes();const c=Pn(bo,de.extendClass),d=Pn(xo,de.extendClass);l._fullscreen=e.fullscreen,l.appManager=new c(l),l.appManager.polling=e.polling||!1,l._pageState=new Tk(l.appManager),l.cursorManager=new d(l.appManager,Boolean(o),e.cursorOptions,e.applianceIcons),l.extendPluginManager=new By({internalEmitter:fe,windowManager:l}),n&&(l.containerSizeRatio=n),e.container&&l.bindContainer(e.container),_k(i,l),fe.emit("onCreated"),de.isCreated=!0,l._roomLogger&&l.attributes.registered&&Object.keys(l.attributes.registered).length>0&&l._roomLogger.info(`[WindowManager] attributes registered apps: ${JSON.stringify(Array.from(Object.keys(l.attributes.registered)))}`);try{await nP()}catch(g){(f=l._roomLogger)==null||f.warn(`[WindowManager] indexedDB open failed: ${g.message}`),console.warn("[WindowManager]: indexedDB open failed"),console.log(g)}return l.emitter.on("mainViewScenePathChange",l.onMainViewScenePathChangeHandler),l}static initManager(e){return UN(e)}static initContainer(e,t,i){const{chessboard:n,overwriteStyles:s,fullscreen:o}=i;de.container||(de.container=t);const{playground:l,wrapper:c,sizer:d,mainViewElement:f}=$N(t);if(de.playground=l,n&&d.classList.add("netless-window-manager-chess-sizer"),o&&d.classList.add("netless-window-manager-fullscreen"),s){const g=document.createElement("style");g.textContent=s,l.appendChild(g)}return e.containerResizeObserver=Lf.create(l,d,c,fe),de.wrapper=c,de.sizer=d,f}static get registered(){return Rt.registered}bindContainer(e){var t,i,n,s,o,l;if(H.isRoom(this.displayer)&&this.room.phase!==H.RoomPhase.Connected)throw new iy;if(de.isCreated&&de.container)de.container.firstChild&&e.appendChild(de.container.firstChild);else if(de.params){const c=de.params,d=de.initContainer(this,e,c);this.boxManager&&this.boxManager.destroy();const f=DN(this,ke,fe,Ji,{collectorContainer:c.collectorContainer,collectorStyles:c.collectorStyles,prefersColorScheme:c.prefersColorScheme,useBoxesStatus:c.useBoxesStatus});this.boxManager=f,this.appManager&&(this.appManager.useBoxesStatus=c.useBoxesStatus||!1,this.appManager.setBoxManager(f)),this.bindMainView(d,c.disableCameraTransform),de.wrapper&&((t=this.cursorManager)==null||t.setupWrapper(de.wrapper))}fe.emit("updateManagerRect"),(i=this.appManager)==null||i.refresh(),(n=this.appManager)==null||n.resetMaximized(),(s=this.appManager)==null||s.resetMinimized(),(o=this.appManager)==null||o.displayerWritableListener(!this.room.isWritable),de.container=e,(l=this.extendPluginManager)==null||l.refreshContainer(e)}bindCollectorContainer(e){de.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(e):de.params&&(de.params.collectorContainer=e)}static register(e){return Rt.register(e)}static unregister(e){return Rt.unregister(e)}resolveAppOptions(e,t){var n;const i=e===An.Presentation?(n=this.builtinAppOptions)==null?void 0:n.Presentation:void 0;return Ok(t,i)}async addApp(e){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((t,i)=>{fe.once("rootDirRemoved").then(async()=>{try{const n=await this._addApp(e);t(n)}catch(n){i(n.message)}})}):this._addApp(e);throw new ci}async _addApp(e){var t,i,n;if(this.appManager){if(!e.kind||typeof e.kind!="string")throw new K0;e.src&&typeof e.src=="string"&&Rt.register({kind:e.kind,src:e.src});const s=await((t=Rt.appClasses.get(e.kind))==null?void 0:t());if(s&&((i=s.config)==null?void 0:i.singleton)&&this.appManager.appProxies.has(e.kind))throw new X0;const o=this.setupScenePath(e,this.appManager);return o===void 0?void 0:((n=e==null?void 0:e.options)!=null&&n.scenePath&&(e.options.scenePath=SP(e.options.scenePath)),await this.appManager.addApp(e,Boolean(o)))}else throw new ci}setupScenePath(e,t){let i=!1;if(e.options){const{scenePath:n,scenes:s}=e.options;if(n){if(!xP(n))throw new ey;const o=Object.keys(this.apps||{});for(const l of o){const c=t.store.getAppScenePath(l);if(c&&c===n){if(console.warn(`[WindowManager]: ScenePath "${n}" already opened`),this.boxManager){const d=this.boxManager.getTopBox();d&&(this.boxManager.setZIndex(l,d.zIndex+1,!1),this.boxManager.focusBox({appId:l},!1))}return}}}n&&s&&s.length>0&&(this.isDynamicPPT(s)?(i=!0,Os(this.displayer)[n]||Da(this.room,n,s)):Os(this.displayer)[n]||Da(this.room,n,[{name:s[0].name}])),n&&s===void 0&&Da(this.room,n,[{}])}return i}async setMainViewScenePath(e){this.appManager&&await this.appManager.setMainViewScenePath(e)}async setMainViewSceneIndex(e){this.appManager&&await this.appManager.setMainViewSceneIndex(e)}async nextPage(){if(this.appManager){const e=this.mainViewSceneIndex+1;return e>=this.mainViewScenesLength?(console.warn("[WindowManager]: current page is the last page"),!1):(await this.appManager.setMainViewSceneIndex(e),!0)}else return!1}async prevPage(){if(this.appManager){const e=this.mainViewSceneIndex-1;return e<0?(console.warn("[WindowManager]: current page is the first page"),!1):(await this.appManager.setMainViewSceneIndex(e),!0)}else return!1}async jumpPage(e){return this.appManager?e<0||e>=this.pageState.length?(console.warn(`[WindowManager]: index ${e} out of range`),!1):(await this.appManager.setMainViewSceneIndex(e),!0):!1}async addPage(e){if(this.appManager){const t=e==null?void 0:e.after,i=e==null?void 0:e.scene;if(t){const n=this.mainViewSceneIndex+1;this.room.putScenes(Qt,[i||{}],n)}else this.room.putScenes(Qt,[i||{}])}}async removePage(e){if(this.appManager){const t=e===void 0?this.pageState.index:e;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):t<0||t>=this.pageState.length?(console.warn(`[WindowManager]: index ${e} out of range`),!1):this.appManager.removeSceneByIndex(t)}else return!1}getMainViewScenePath(){var e;return(e=this.appManager)==null?void 0:e.store.getMainViewScenePath()}getMainViewSceneIndex(){var e;return(e=this.appManager)==null?void 0:e.store.getMainViewSceneIndex()}setReadonly(e){var t;this.readonly=e,(t=this.boxManager)==null||t.setReadonly(e),fe.emit("setReadonly",e)}switchMainViewToWriter(){var e;return(e=this.appManager)==null?void 0:e.mainViewProxy.mainViewClickHandler()}onAppDestroy(e,t){wP(`destroy-${e}`,t)}onAppEvent(e,t){return fe.on(`custom-${e}`,t)}setViewMode(e){var t,i,n,s;(e===H.ViewMode.Broadcaster||e===H.ViewMode.Follower)&&(this.canOperate&&e===H.ViewMode.Broadcaster&&((t=this.appManager)==null||t.mainViewProxy.setCameraAndSize()),(i=this.appManager)==null||i.mainViewProxy.start()),e===H.ViewMode.Freedom&&((n=this.appManager)==null||n.mainViewProxy.stop()),this.viewMode=e,(s=this.appManager)==null||s.mainViewProxy.setViewMode(e)}setBoxState(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);break}}setMaximized(e){var t;!this.canOperate||(t=this.boxManager)==null||t.setMaximized(e,!1)}setMinimized(e){var t;!this.canOperate||(t=this.boxManager)==null||t.setMinimized(e,!1)}setBoxStatus(e,t){var i;!this.canOperate||(i=this.appManager)==null||i.store.setBoxStatus(e,t)}setLastNotMinimizedBoxStatus(e,t){var i;!this.canOperate||(i=this.appManager)==null||i.store.setLastNotMinimizedBoxStatus(e,t)}setFullscreen(e){var t;this._fullscreen!==e&&(this._fullscreen=e,(t=de.sizer)==null||t.classList.toggle("netless-window-manager-fullscreen",e),ke.emit("fullscreenChange",e))}get cursorUIDs(){return this._cursorUIDs}setCursorUIDs(e){var t,i;if(this._cursorUIDs=e||[],this._cursorUIDs.length===0)(t=this._cursorUIDsStyleDOM)==null||t.remove();else{this._cursorUIDsStyleDOM||(this._cursorUIDsStyleDOM=document.createElement("style")),(i=de.playground)==null||i.appendChild(this._cursorUIDsStyleDOM);let n="[data-cursor-uid] { display: none }";for(const s of this._cursorUIDs)n+=`
|
|
17
|
-
[data-cursor-uid="${s}"] { display: flex }`;this._cursorUIDsStyleDOM.textContent=n}}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new ci}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new ci}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new ci}get apps(){var e;return(e=this.appManager)==null?void 0:e.store.apps()}get boxState(){var e;if(this.appManager)return(e=this.appManager.boxManager)==null?void 0:e.boxState;throw new ci}get boxStatus(){if(this.appManager)return this.appManager.store.getBoxesStatus();throw new ci}get lastNotMinimizedBoxStatus(){if(this.appManager)return this.appManager.store.getLastNotMinimizedBoxesStatus();throw new ci}get darkMode(){var e,t;return Boolean((t=(e=this.appManager)==null?void 0:e.boxManager)==null?void 0:t.darkMode)}get prefersColorScheme(){var e;if(this.appManager)return(e=this.appManager.boxManager)==null?void 0:e.prefersColorScheme;throw new ci}get focused(){return this.attributes.focus}get focusedView(){var e,t;return((t=(e=this.appManager)==null?void 0:e.focusApp)==null?void 0:t.view)||this.mainView}get polling(){var e;return((e=this.appManager)==null?void 0:e.polling)||!1}set polling(e){this.appManager&&(this.appManager.polling=e)}get cursorStyle(){var e;return((e=this.cursorManager)==null?void 0:e.style)||"default"}set cursorStyle(e){if(!this.cursorManager)throw new Error("[WindowManager]: cursor is not enabled, please set { cursor: true }.");this.cursorManager.style=e}get mainViewSceneIndex(){var e;return((e=this._pageState)==null?void 0:e.index)||0}get mainViewSceneDir(){var e;if(this.appManager)return(e=this.appManager)==null?void 0:e.getMainViewSceneDir();throw new ci}get topApp(){var e,t;return(t=(e=this.boxManager)==null?void 0:e.getTopBox())==null?void 0:t.id}get mainViewScenesLength(){var e;return((e=this._pageState)==null?void 0:e.length)||0}get canRedoSteps(){var e;return((e=this.focusedView)==null?void 0:e.canRedoSteps)||0}get canUndoSteps(){var e;return((e=this.focusedView)==null?void 0:e.canUndoSteps)||0}get sceneState(){if(this.appManager)return this.appManager.sceneState;throw new ci}get pageState(){if(this._pageState)return this._pageState.toObject();throw new ci}get fullscreen(){return Boolean(this._fullscreen)}queryAll(){var e;return Array.from(((e=this.appManager)==null?void 0:e.appProxies.values())||[])}queryOne(e){var t;return(t=this.appManager)==null?void 0:t.appProxies.get(e)}dispatchDocsEvent(e,t={}){var v;const i=t.appId||this.focused;if(!i)return console.warn("not found "+(t.appId||"focused app")),!1;const n=this.queryOne(i);if(!n)return console.warn("not found app with id "+i),!1;const s=i.startsWith(`${An.DocsViewer}-`)||n.kind===An.DocsViewer,o=i.startsWith(`${jh}-`)||n.kind===jh,l=i.startsWith(`${$h}-`)||n.kind===$h;let c=n.kind;if(s?c=An.DocsViewer:o?c=jh:l&&(c=$h),!de.registered.has(c))return console.warn("not registered app kind "+c),!1;let d,f,g;if(s){const M=(v=n.box)==null?void 0:v.$footer;if(!M)return console.warn("not found app with id "+i),!1;const E=_=>{_&&_.dispatchEvent(new MouseEvent("click"))};switch(e){case"prevPage":case"prevStep":E(M.querySelector('button[class$="btn-page-back"]'));break;case"nextPage":case"nextStep":E(M.querySelector('button[class$="btn-page-next"]'));break;case"jumpToPage":if(d=t.page,f=M.querySelector('input[class$="page-number-input"]'),!f||typeof d!="number")return console.warn("failed to jump"+(d?" to page "+d:"")),!1;f.value=""+d,f.dispatchEvent(new InputEvent("change"));break;case"scalePage":return console.warn("not supported event "+e+" for app kind "+c),!1;default:return console.warn("unknown event "+e),!1}return!0}if(o){const M=n.appResult;if(!M)return console.warn("not found app with id "+i),!1;switch(e){case"prevPage":case"prevStep":return M.prevPage();case"nextPage":case"nextStep":return M.nextPage();case"jumpToPage":return d=t.page,typeof d!="number"?(console.warn("failed to jump"+(d?" to page "+d:"")),!1):M.jumpPage(d-1);case"scalePage":if(g=t.scale,!sw(g))return console.warn("failed to scale, scale should be a number from 1 to 4"),!1;try{return M.moveCamera({centerX:0,centerY:0,scale:M.getOriginScale()*g}),!0}catch(E){return console.warn(E),!1}default:return console.warn("unknown event "+e),!1}}if(l){const M=n.appResult;if(!M)return console.warn("not found app with id "+i),!1;switch(e){case"prevPage":return M.prevPage();case"nextPage":return M.nextPage();case"prevStep":return M.prevStep();case"nextStep":return M.nextStep();case"jumpToPage":return d=t.page,typeof d!="number"?(console.warn("failed to jump"+(d?" to page "+d:"")),!1):M.jumpToPage(d);case"scalePage":return g=t.scale,sw(g)?(M.scaleView(g),!0):(console.warn("failed to scale, scale should be a number from 1 to 4"),!1);default:return console.warn("unknown event "+e),!1}}return console.warn("not supported app kind "+n.kind),!1}async closeApp(e){var t;return(t=this.appManager)==null?void 0:t.closeApp(e)}focusApp(e){var i,n,s;const t=(i=this.boxManager)==null?void 0:i.getBox(e);t&&((n=this.boxManager)==null||n.focusBox({appId:e},!1),((s=this.boxManager)==null?void 0:s.teleBoxManager).makeBoxTop(t,!1))}moveCamera(e){const t=Y.omit(e,["animationMode"]),i={...this.mainView.camera};Y.isEqual({...i,...t},i)||(this.mainView.moveCamera(e),setTimeout(()=>{var n;(n=this.appManager)==null||n.mainViewProxy.setCameraAndSize()},500))}moveCameraToContain(e){this.mainView.moveCameraToContain(e),setTimeout(()=>{var t;(t=this.appManager)==null||t.mainViewProxy.setCameraAndSize()},500)}convertToPointInWorld(e){return this.mainView.convertToPointInWorld(e)}setCameraBound(e){this.mainView.setCameraBound(e)}onDestroy(){this._destroy()}destroy(){this._destroy()}_destroy(){var e,t,i,n,s,o,l;(e=this.attributesDeboundceLog)==null||e.destroy(),this.attributesDeboundceLog=void 0,(t=this.containerResizeObserver)==null||t.disconnect(),(i=this.appManager)==null||i.destroy(),(n=this.cursorManager)==null||n.destroy(),(s=this.extendPluginManager)==null||s.destroy(),de.container=void 0,de.wrapper=void 0,de.sizer=void 0,de.isCreated=!1,de.playground&&((o=de.playground.parentNode)==null||o.removeChild(de.playground)),de.params=void 0,this.emitter.off("mainViewScenePathChange",this.onMainViewScenePathChangeHandler),(l=this._iframeBridge)==null||l.destroy(),this._iframeBridge=void 0,Oi("Destroyed")}bindMainView(e,t){var i;this.appManager&&(this.appManager.bindMainView(e,Boolean(t)),(i=this.cursorManager)==null||i.setMainViewDivElement(e))}get canOperate(){return H.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===H.RoomPhase.Connected:!1}get room(){return this.displayer}safeSetAttributes(e){this.canOperate&&(this.setAttributes(e),this.attributesDeboundceLog&&this.attributesDeboundceLog.logDebouncedShallowMerge("safeSetAttributes",e))}safeUpdateAttributes(e,t){this.canOperate&&(this.updateAttributes(e,t),this.attributesDeboundceLog&&this.attributesDeboundceLog.logDebouncedUpdateAttributes(e,t))}setPrefersColorScheme(e){var t,i;(i=(t=this.appManager)==null?void 0:t.boxManager)==null||i.setPrefersColorScheme(e)}cleanCurrentScene(){var e,t;Oi("clean current scene"),(e=this.focusedView)==null||e.cleanCurrentScene(),this.Logger&&this.Logger.info(`[WindowManager]: cleanCurrentScene ${(t=this.focusedView)==null?void 0:t.focusScenePath}`)}redo(){var e;return((e=this.focusedView)==null?void 0:e.redo())||0}undo(){var e;return((e=this.focusedView)==null?void 0:e.undo())||0}delete(){var e,t;(e=this.focusedView)==null||e.delete(),this.Logger&&this.Logger.info(`[WindowManager]: delete ${(t=this.focusedView)==null?void 0:t.focusScenePath}`)}copy(){var e;(e=this.focusedView)==null||e.copy()}paste(){var e;(e=this.focusedView)==null||e.paste()}duplicate(){var e;(e=this.focusedView)==null||e.duplicate()}insertText(e,t,i){var n;return((n=this.focusedView)==null?void 0:n.insertText(e,t,i))||""}insertImage(e){var t;return(t=this.focusedView)==null?void 0:t.insertImage(e)}completeImageUpload(e,t){var i;return(i=this.focusedView)==null?void 0:i.completeImageUpload(e,t)}lockImage(e,t){var i;return(i=this.focusedView)==null?void 0:i.lockImage(e,t)}lockImages(e){var t;return(t=this.focusedView)==null?void 0:t.lockImages(e)}refresh(){var e;this._refresh(),(e=this.appManager)==null||e.dispatchInternalEvent(qe.Refresh)}_refresh(){var e,t;(e=this.appManager)==null||e.mainViewProxy.rebind(),de.container&&this.bindContainer(de.container),(t=this.appManager)==null||t.refresher.refresh()}setContainerSizeRatio(e){if(!Y.isNumber(e)||!(e>0))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a positive number. but got ${e}`);de.containerSizeRatio=e,this.containerSizeRatio=e,fe.emit("containerSizeRatioUpdate",e)}isDynamicPPT(e){var i,n;const t=(n=(i=e[0])==null?void 0:i.ppt)==null?void 0:n.src;return t==null?void 0:t.startsWith("pptx://")}async ensureAttributes(){Y.isNull(this.attributes)&&await G0(50),Y.isObject(this.attributes)&&(this.attributes[Et.Apps]||this.safeSetAttributes({[Et.Apps]:{}}),this.attributes[Et.Cursors]||this.safeSetAttributes({[Et.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:Q0}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[Et.Registered]||this.safeSetAttributes({[Et.Registered]:{}}),this.attributes[Et.IframeBridge]||this.safeSetAttributes({[Et.IframeBridge]:{}}))}getIframeBridge(){if(!this.appManager)throw new Error("[WindowManager]: should call getIframeBridge() after await mount()");return this._iframeBridge||(this._iframeBridge=new Gs(this,this.appManager)),this._iframeBridge}useExtendPlugin(e){var t;(t=this.extendPluginManager)==null||t.use(e)}};let Te=de;Te.kind="WindowManager";Te.debug=!1;Te.containerSizeRatio=eP;Te.isCreated=!1;Te._resolve=e=>{};Dk();var es={exports:{}},Oe={};/*
|
|
18
|
-
object-assign
|
|
19
|
-
(c) Sindre Sorhus
|
|
20
|
-
@license MIT
|
|
21
|
-
*/var aw=Object.getOwnPropertySymbols,Uk=Object.prototype.hasOwnProperty,Wk=Object.prototype.propertyIsEnumerable;function Fk(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function Hk(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},i=0;i<10;i++)t["_"+String.fromCharCode(i)]=i;var n=Object.getOwnPropertyNames(t).map(function(o){return t[o]});if(n.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(o){s[o]=o}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var Dy=Hk()?Object.assign:function(e,t){for(var i,n=Fk(e),s,o=1;o<arguments.length;o++){i=Object(arguments[o]);for(var l in i)Uk.call(i,l)&&(n[l]=i[l]);if(aw){s=aw(i);for(var c=0;c<s.length;c++)Wk.call(i,s[c])&&(n[s[c]]=i[s[c]])}}return n};/** @license React v16.14.0
|
|
22
|
-
* react.production.min.js
|
|
23
|
-
*
|
|
24
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
25
|
-
*
|
|
26
|
-
* This source code is licensed under the MIT license found in the
|
|
27
|
-
* LICENSE file in the root directory of this source tree.
|
|
28
|
-
*/var Rf=Dy,ji=typeof Symbol=="function"&&Symbol.for,Co=ji?Symbol.for("react.element"):60103,Zk=ji?Symbol.for("react.portal"):60106,Qk=ji?Symbol.for("react.fragment"):60107,Yk=ji?Symbol.for("react.strict_mode"):60108,Gk=ji?Symbol.for("react.profiler"):60114,Xk=ji?Symbol.for("react.provider"):60109,Jk=ji?Symbol.for("react.context"):60110,Kk=ji?Symbol.for("react.forward_ref"):60112,qk=ji?Symbol.for("react.suspense"):60113,eB=ji?Symbol.for("react.memo"):60115,tB=ji?Symbol.for("react.lazy"):60116,ow=typeof Symbol=="function"&&Symbol.iterator;function Io(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Ly={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ry={};function Xs(e,t,i){this.props=e,this.context=t,this.refs=Ry,this.updater=i||Ly}Xs.prototype.isReactComponent={};Xs.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error(Io(85));this.updater.enqueueSetState(this,e,t,"setState")};Xs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Oy(){}Oy.prototype=Xs.prototype;function Of(e,t,i){this.props=e,this.context=t,this.refs=Ry,this.updater=i||Ly}var Vf=Of.prototype=new Oy;Vf.constructor=Of;Rf(Vf,Xs.prototype);Vf.isPureReactComponent=!0;var $f={current:null},Vy=Object.prototype.hasOwnProperty,$y={key:!0,ref:!0,__self:!0,__source:!0};function jy(e,t,i){var n,s={},o=null,l=null;if(t!=null)for(n in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(o=""+t.key),t)Vy.call(t,n)&&!$y.hasOwnProperty(n)&&(s[n]=t[n]);var c=arguments.length-2;if(c===1)s.children=i;else if(1<c){for(var d=Array(c),f=0;f<c;f++)d[f]=arguments[f+2];s.children=d}if(e&&e.defaultProps)for(n in c=e.defaultProps,c)s[n]===void 0&&(s[n]=c[n]);return{$$typeof:Co,type:e,key:o,ref:l,props:s,_owner:$f.current}}function iB(e,t){return{$$typeof:Co,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function jf(e){return typeof e=="object"&&e!==null&&e.$$typeof===Co}function nB(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(i){return t[i]})}var Uy=/\/+/g,gu=[];function Wy(e,t,i,n){if(gu.length){var s=gu.pop();return s.result=e,s.keyPrefix=t,s.func=i,s.context=n,s.count=0,s}return{result:e,keyPrefix:t,func:i,context:n,count:0}}function Fy(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>gu.length&&gu.push(e)}function Md(e,t,i,n){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Co:case Zk:o=!0}}if(o)return i(n,e,t===""?"."+Uh(e,0):t),1;if(o=0,t=t===""?".":t+":",Array.isArray(e))for(var l=0;l<e.length;l++){s=e[l];var c=t+Uh(s,l);o+=Md(s,c,i,n)}else if(e===null||typeof e!="object"?c=null:(c=ow&&e[ow]||e["@@iterator"],c=typeof c=="function"?c:null),typeof c=="function")for(e=c.call(e),l=0;!(s=e.next()).done;)s=s.value,c=t+Uh(s,l++),o+=Md(s,c,i,n);else if(s==="object")throw i=""+e,Error(Io(31,i==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":i,""));return o}function bd(e,t,i){return e==null?0:Md(e,"",t,i)}function Uh(e,t){return typeof e=="object"&&e!==null&&e.key!=null?nB(e.key):t.toString(36)}function rB(e,t){e.func.call(e.context,t,e.count++)}function sB(e,t,i){var n=e.result,s=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?Cd(e,n,i,function(o){return o}):e!=null&&(jf(e)&&(e=iB(e,s+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(Uy,"$&/")+"/")+i)),n.push(e))}function Cd(e,t,i,n,s){var o="";i!=null&&(o=(""+i).replace(Uy,"$&/")+"/"),t=Wy(t,o,n,s),bd(e,sB,t),Fy(t)}var Hy={current:null};function Bn(){var e=Hy.current;if(e===null)throw Error(Io(321));return e}var aB={ReactCurrentDispatcher:Hy,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:$f,IsSomeRendererActing:{current:!1},assign:Rf};Oe.Children={map:function(e,t,i){if(e==null)return e;var n=[];return Cd(e,n,null,t,i),n},forEach:function(e,t,i){if(e==null)return e;t=Wy(null,null,t,i),bd(e,rB,t),Fy(t)},count:function(e){return bd(e,function(){return null},null)},toArray:function(e){var t=[];return Cd(e,t,null,function(i){return i}),t},only:function(e){if(!jf(e))throw Error(Io(143));return e}};Oe.Component=Xs;Oe.Fragment=Qk;Oe.Profiler=Gk;Oe.PureComponent=Of;Oe.StrictMode=Yk;Oe.Suspense=qk;Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=aB;Oe.cloneElement=function(e,t,i){if(e==null)throw Error(Io(267,e));var n=Rf({},e.props),s=e.key,o=e.ref,l=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,l=$f.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(d in t)Vy.call(t,d)&&!$y.hasOwnProperty(d)&&(n[d]=t[d]===void 0&&c!==void 0?c[d]:t[d])}var d=arguments.length-2;if(d===1)n.children=i;else if(1<d){c=Array(d);for(var f=0;f<d;f++)c[f]=arguments[f+2];n.children=c}return{$$typeof:Co,type:e.type,key:s,ref:o,props:n,_owner:l}};Oe.createContext=function(e,t){return t===void 0&&(t=null),e={$$typeof:Jk,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider={$$typeof:Xk,_context:e},e.Consumer=e};Oe.createElement=jy;Oe.createFactory=function(e){var t=jy.bind(null,e);return t.type=e,t};Oe.createRef=function(){return{current:null}};Oe.forwardRef=function(e){return{$$typeof:Kk,render:e}};Oe.isValidElement=jf;Oe.lazy=function(e){return{$$typeof:tB,_ctor:e,_status:-1,_result:null}};Oe.memo=function(e,t){return{$$typeof:eB,type:e,compare:t===void 0?null:t}};Oe.useCallback=function(e,t){return Bn().useCallback(e,t)};Oe.useContext=function(e,t){return Bn().useContext(e,t)};Oe.useDebugValue=function(){};Oe.useEffect=function(e,t){return Bn().useEffect(e,t)};Oe.useImperativeHandle=function(e,t,i){return Bn().useImperativeHandle(e,t,i)};Oe.useLayoutEffect=function(e,t){return Bn().useLayoutEffect(e,t)};Oe.useMemo=function(e,t){return Bn().useMemo(e,t)};Oe.useReducer=function(e,t,i){return Bn().useReducer(e,t,i)};Oe.useRef=function(e){return Bn().useRef(e)};Oe.useState=function(e){return Bn().useState(e)};Oe.version="16.14.0";es.exports=Oe;var _e=es.exports,Zy={exports:{}},Ni={},Qy={exports:{}},Yy={};/** @license React v0.19.1
|
|
29
|
-
* scheduler.production.min.js
|
|
30
|
-
*
|
|
31
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the MIT license found in the
|
|
34
|
-
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/(function(e){var t,i,n,s,o;if(typeof window=="undefined"||typeof MessageChannel!="function"){var l=null,c=null,d=function(){if(l!==null)try{var F=e.unstable_now();l(!0,F),l=null}catch(q){throw setTimeout(d,0),q}},f=Date.now();e.unstable_now=function(){return Date.now()-f},t=function(F){l!==null?setTimeout(t,0,F):(l=F,setTimeout(d,0))},i=function(F,q){c=setTimeout(F,q)},n=function(){clearTimeout(c)},s=function(){return!1},o=e.unstable_forceFrameRate=function(){}}else{var g=window.performance,v=window.Date,M=window.setTimeout,E=window.clearTimeout;if(typeof console!="undefined"){var _=window.cancelAnimationFrame;typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),typeof _!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if(typeof g=="object"&&typeof g.now=="function")e.unstable_now=function(){return g.now()};else{var P=v.now();e.unstable_now=function(){return v.now()-P}}var y=!1,x=null,I=-1,C=5,k=0;s=function(){return e.unstable_now()>=k},o=function(){},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):C=0<F?Math.floor(1e3/F):5};var L=new MessageChannel,W=L.port2;L.port1.onmessage=function(){if(x!==null){var F=e.unstable_now();k=F+C;try{x(!0,F)?W.postMessage(null):(y=!1,x=null)}catch(q){throw W.postMessage(null),q}}else y=!1},t=function(F){x=F,y||(y=!0,W.postMessage(null))},i=function(F,q){I=M(function(){F(e.unstable_now())},q)},n=function(){E(I),I=-1}}function Q(F,q){var B=F.length;F.push(q);e:for(;;){var $=B-1>>>1,Z=F[$];if(Z!==void 0&&0<De(Z,q))F[$]=q,F[B]=Z,B=$;else break e}}function J(F){return F=F[0],F===void 0?null:F}function K(F){var q=F[0];if(q!==void 0){var B=F.pop();if(B!==q){F[0]=B;e:for(var $=0,Z=F.length;$<Z;){var ne=2*($+1)-1,pe=F[ne],ve=ne+1,ge=F[ve];if(pe!==void 0&&0>De(pe,B))ge!==void 0&&0>De(ge,pe)?(F[$]=ge,F[ve]=B,$=ve):(F[$]=pe,F[ne]=B,$=ne);else if(ge!==void 0&&0>De(ge,B))F[$]=ge,F[ve]=B,$=ve;else break e}}return q}return null}function De(F,q){var B=F.sortIndex-q.sortIndex;return B!==0?B:F.id-q.id}var U=[],z=[],oe=1,ie=null,be=3,Ve=!1,Le=!1,le=!1;function pt(F){for(var q=J(z);q!==null;){if(q.callback===null)K(z);else if(q.startTime<=F)K(z),q.sortIndex=q.expirationTime,Q(U,q);else break;q=J(z)}}function Ct(F){if(le=!1,pt(F),!Le)if(J(U)!==null)Le=!0,t(ot);else{var q=J(z);q!==null&&i(Ct,q.startTime-F)}}function ot(F,q){Le=!1,le&&(le=!1,n()),Ve=!0;var B=be;try{for(pt(q),ie=J(U);ie!==null&&(!(ie.expirationTime>q)||F&&!s());){var $=ie.callback;if($!==null){ie.callback=null,be=ie.priorityLevel;var Z=$(ie.expirationTime<=q);q=e.unstable_now(),typeof Z=="function"?ie.callback=Z:ie===J(U)&&K(U),pt(q)}else K(U);ie=J(U)}if(ie!==null)var ne=!0;else{var pe=J(z);pe!==null&&i(Ct,pe.startTime-q),ne=!1}return ne}finally{ie=null,be=B,Ve=!1}}function ti(F){switch(F){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var zn=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(F){F.callback=null},e.unstable_continueExecution=function(){Le||Ve||(Le=!0,t(ot))},e.unstable_getCurrentPriorityLevel=function(){return be},e.unstable_getFirstCallbackNode=function(){return J(U)},e.unstable_next=function(F){switch(be){case 1:case 2:case 3:var q=3;break;default:q=be}var B=be;be=q;try{return F()}finally{be=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=zn,e.unstable_runWithPriority=function(F,q){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var B=be;be=F;try{return q()}finally{be=B}},e.unstable_scheduleCallback=function(F,q,B){var $=e.unstable_now();if(typeof B=="object"&&B!==null){var Z=B.delay;Z=typeof Z=="number"&&0<Z?$+Z:$,B=typeof B.timeout=="number"?B.timeout:ti(F)}else B=ti(F),Z=$;return B=Z+B,F={id:oe++,callback:q,priorityLevel:F,startTime:Z,expirationTime:B,sortIndex:-1},Z>$?(F.sortIndex=Z,Q(z,F),J(U)===null&&F===J(z)&&(le?n():le=!0,i(Ct,Z-$))):(F.sortIndex=B,Q(U,F),Le||Ve||(Le=!0,t(ot))),F},e.unstable_shouldYield=function(){var F=e.unstable_now();pt(F);var q=J(U);return q!==ie&&ie!==null&&q!==null&&q.callback!==null&&q.startTime<=F&&q.expirationTime<ie.expirationTime||s()},e.unstable_wrapCallback=function(F){var q=be;return function(){var B=be;be=q;try{return F.apply(this,arguments)}finally{be=B}}}})(Yy);Qy.exports=Yy;/** @license React v16.14.0
|
|
36
|
-
* react-dom.production.min.js
|
|
37
|
-
*
|
|
38
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the MIT license found in the
|
|
41
|
-
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var Gu=es.exports,Vt=Dy,Mt=Qy.exports;function j(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!Gu)throw Error(j(227));function oB(e,t,i,n,s,o,l,c,d){var f=Array.prototype.slice.call(arguments,3);try{t.apply(i,f)}catch(g){this.onError(g)}}var ja=!1,mu=null,vu=!1,Id=null,lB={onError:function(e){ja=!0,mu=e}};function uB(e,t,i,n,s,o,l,c,d){ja=!1,mu=null,oB.apply(lB,arguments)}function cB(e,t,i,n,s,o,l,c,d){if(uB.apply(this,arguments),ja){if(ja){var f=mu;ja=!1,mu=null}else throw Error(j(198));vu||(vu=!0,Id=f)}}var Uf=null,Gy=null,Xy=null;function lw(e,t,i){var n=e.type||"unknown-event";e.currentTarget=Xy(i),cB(n,t,void 0,e),e.currentTarget=null}var wu=null,Ms={};function Jy(){if(wu)for(var e in Ms){var t=Ms[e],i=wu.indexOf(e);if(!(-1<i))throw Error(j(96,e));if(!yu[i]){if(!t.extractEvents)throw Error(j(97,e));yu[i]=t,i=t.eventTypes;for(var n in i){var s=void 0,o=i[n],l=t,c=n;if(Ad.hasOwnProperty(c))throw Error(j(99,c));Ad[c]=o;var d=o.phasedRegistrationNames;if(d){for(s in d)d.hasOwnProperty(s)&&uw(d[s],l,c);s=!0}else o.registrationName?(uw(o.registrationName,l,c),s=!0):s=!1;if(!s)throw Error(j(98,n,e))}}}}function uw(e,t,i){if(Vs[e])throw Error(j(100,e));Vs[e]=t,Wf[e]=t.eventTypes[i].dependencies}var yu=[],Ad={},Vs={},Wf={};function Ky(e){var t=!1,i;for(i in e)if(e.hasOwnProperty(i)){var n=e[i];if(!Ms.hasOwnProperty(i)||Ms[i]!==n){if(Ms[i])throw Error(j(102,i));Ms[i]=n,t=!0}}t&&Jy()}var dr=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),Td=null,Ns=null,ks=null;function cw(e){if(e=Gy(e)){if(typeof Td!="function")throw Error(j(280));var t=e.stateNode;t&&(t=Uf(t),Td(e.stateNode,e.type,t))}}function qy(e){Ns?ks?ks.push(e):ks=[e]:Ns=e}function ex(){if(Ns){var e=Ns,t=ks;if(ks=Ns=null,cw(e),t)for(e=0;e<t.length;e++)cw(t[e])}}function Ff(e,t){return e(t)}function tx(e,t,i,n,s){return e(t,i,n,s)}function Hf(){}var ix=Ff,zr=!1,Wh=!1;function Zf(){(Ns!==null||ks!==null)&&(Hf(),ex())}function nx(e,t,i){if(Wh)return e(t,i);Wh=!0;try{return ix(e,t,i)}finally{Wh=!1,Zf()}}var hB=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,hw=Object.prototype.hasOwnProperty,dw={},fw={};function dB(e){return hw.call(fw,e)?!0:hw.call(dw,e)?!1:hB.test(e)?fw[e]=!0:(dw[e]=!0,!1)}function fB(e,t,i,n){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function pB(e,t,i,n){if(t===null||typeof t=="undefined"||fB(e,t,i,n))return!0;if(n)return!1;if(i!==null)switch(i.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function $t(e,t,i,n,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=o}var bt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){bt[e]=new $t(e,0,!1,e,null,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];bt[t]=new $t(t,1,!1,e[1],null,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){bt[e]=new $t(e,2,!1,e.toLowerCase(),null,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){bt[e]=new $t(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){bt[e]=new $t(e,3,!1,e.toLowerCase(),null,!1)});["checked","multiple","muted","selected"].forEach(function(e){bt[e]=new $t(e,3,!0,e,null,!1)});["capture","download"].forEach(function(e){bt[e]=new $t(e,4,!1,e,null,!1)});["cols","rows","size","span"].forEach(function(e){bt[e]=new $t(e,6,!1,e,null,!1)});["rowSpan","start"].forEach(function(e){bt[e]=new $t(e,5,!1,e.toLowerCase(),null,!1)});var Qf=/[\-:]([a-z])/g;function Yf(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(Qf,Yf);bt[t]=new $t(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(Qf,Yf);bt[t]=new $t(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Qf,Yf);bt[t]=new $t(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)});["tabIndex","crossOrigin"].forEach(function(e){bt[e]=new $t(e,1,!1,e.toLowerCase(),null,!1)});bt.xlinkHref=new $t("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0);["src","href","action","formAction"].forEach(function(e){bt[e]=new $t(e,1,!1,e.toLowerCase(),null,!0)});var Vi=Gu.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Vi.hasOwnProperty("ReactCurrentDispatcher")||(Vi.ReactCurrentDispatcher={current:null});Vi.hasOwnProperty("ReactCurrentBatchConfig")||(Vi.ReactCurrentBatchConfig={suspense:null});function Gf(e,t,i,n){var s=bt.hasOwnProperty(t)?bt[t]:null,o=s!==null?s.type===0:n?!1:!(!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N");o||(pB(t,i,s,n)&&(i=null),n||s===null?dB(t)&&(i===null?e.removeAttribute(t):e.setAttribute(t,""+i)):s.mustUseProperty?e[s.propertyName]=i===null?s.type===3?!1:"":i:(t=s.attributeName,n=s.attributeNamespace,i===null?e.removeAttribute(t):(s=s.type,i=s===3||s===4&&i===!0?"":""+i,n?e.setAttributeNS(n,t,i):e.setAttribute(t,i))))}var gB=/^(.*)[\\\/]/,ei=typeof Symbol=="function"&&Symbol.for,Nl=ei?Symbol.for("react.element"):60103,bs=ei?Symbol.for("react.portal"):60106,Br=ei?Symbol.for("react.fragment"):60107,rx=ei?Symbol.for("react.strict_mode"):60108,Kl=ei?Symbol.for("react.profiler"):60114,sx=ei?Symbol.for("react.provider"):60109,ax=ei?Symbol.for("react.context"):60110,mB=ei?Symbol.for("react.concurrent_mode"):60111,Xf=ei?Symbol.for("react.forward_ref"):60112,ql=ei?Symbol.for("react.suspense"):60113,Ed=ei?Symbol.for("react.suspense_list"):60120,Jf=ei?Symbol.for("react.memo"):60115,ox=ei?Symbol.for("react.lazy"):60116,lx=ei?Symbol.for("react.block"):60121,pw=typeof Symbol=="function"&&Symbol.iterator;function wa(e){return e===null||typeof e!="object"?null:(e=pw&&e[pw]||e["@@iterator"],typeof e=="function"?e:null)}function vB(e){if(e._status===-1){e._status=0;var t=e._ctor;t=t(),e._result=t,t.then(function(i){e._status===0&&(i=i.default,e._status=1,e._result=i)},function(i){e._status===0&&(e._status=2,e._result=i)})}}function _n(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Br:return"Fragment";case bs:return"Portal";case Kl:return"Profiler";case rx:return"StrictMode";case ql:return"Suspense";case Ed:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ax:return"Context.Consumer";case sx:return"Context.Provider";case Xf:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case Jf:return _n(e.type);case lx:return _n(e.render);case ox:if(e=e._status===1?e._result:null)return _n(e)}return null}function Kf(e){var t="";do{e:switch(e.tag){case 3:case 4:case 6:case 7:case 10:case 9:var i="";break e;default:var n=e._debugOwner,s=e._debugSource,o=_n(e.type);i=null,n&&(i=_n(n.type)),n=o,o="",s?o=" (at "+s.fileName.replace(gB,"")+":"+s.lineNumber+")":i&&(o=" (created by "+i+")"),i=`
|
|
43
|
-
in `+(n||"Unknown")+o}t+=i,e=e.return}while(e);return t}function ur(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function ux(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wB(e){var t=ux(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof i!="undefined"&&typeof i.get=="function"&&typeof i.set=="function"){var s=i.get,o=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(l){n=""+l,o.call(this,l)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(l){n=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function kl(e){e._valueTracker||(e._valueTracker=wB(e))}function cx(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),n="";return e&&(n=ux(e)?e.checked?"true":"false":e.value),e=n,e!==i?(t.setValue(e),!0):!1}function _d(e,t){var i=t.checked;return Vt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i!=null?i:e._wrapperState.initialChecked})}function gw(e,t){var i=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;i=ur(t.value!=null?t.value:i),e._wrapperState={initialChecked:n,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function hx(e,t){t=t.checked,t!=null&&Gf(e,"checked",t,!1)}function Pd(e,t){hx(e,t);var i=ur(t.value),n=t.type;if(i!=null)n==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Nd(e,t.type,i):t.hasOwnProperty("defaultValue")&&Nd(e,t.type,ur(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function mw(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function Nd(e,t,i){(t!=="number"||e.ownerDocument.activeElement!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}function yB(e){var t="";return Gu.Children.forEach(e,function(i){i!=null&&(t+=i)}),t}function kd(e,t){return e=Vt({children:void 0},t),(t=yB(t.children))&&(e.children=t),e}function Bs(e,t,i,n){if(e=e.options,t){t={};for(var s=0;s<i.length;s++)t["$"+i[s]]=!0;for(i=0;i<e.length;i++)s=t.hasOwnProperty("$"+e[i].value),e[i].selected!==s&&(e[i].selected=s),s&&n&&(e[i].defaultSelected=!0)}else{for(i=""+ur(i),t=null,s=0;s<e.length;s++){if(e[s].value===i){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Bd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(j(91));return Vt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function vw(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(j(92));if(Array.isArray(i)){if(!(1>=i.length))throw Error(j(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:ur(i)}}function dx(e,t){var i=ur(t.value),n=ur(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),n!=null&&(e.defaultValue=""+n)}function ww(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}var fx={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function px(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 zd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?px(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Bl,gx=function(e){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(t,i,n,s){MSApp.execUnsafeLocalFunction(function(){return e(t,i,n,s)})}:e}(function(e,t){if(e.namespaceURI!==fx.svg||"innerHTML"in e)e.innerHTML=t;else{for(Bl=Bl||document.createElement("div"),Bl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Bl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function qa(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}function zl(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Cs={animationend:zl("Animation","AnimationEnd"),animationiteration:zl("Animation","AnimationIteration"),animationstart:zl("Animation","AnimationStart"),transitionend:zl("Transition","TransitionEnd")},Fh={},mx={};dr&&(mx=document.createElement("div").style,"AnimationEvent"in window||(delete Cs.animationend.animation,delete Cs.animationiteration.animation,delete Cs.animationstart.animation),"TransitionEvent"in window||delete Cs.transitionend.transition);function Xu(e){if(Fh[e])return Fh[e];if(!Cs[e])return e;var t=Cs[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in mx)return Fh[e]=t[i];return e}var vx=Xu("animationend"),wx=Xu("animationiteration"),yx=Xu("animationstart"),xx=Xu("transitionend"),ka="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),yw=new(typeof WeakMap=="function"?WeakMap:Map);function qf(e){var t=yw.get(e);return t===void 0&&(t=new Map,yw.set(e,t)),t}function ts(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.effectTag&1026)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function Sx(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function xw(e){if(ts(e)!==e)throw Error(j(188))}function xB(e){var t=e.alternate;if(!t){if(t=ts(e),t===null)throw Error(j(188));return t!==e?null:e}for(var i=e,n=t;;){var s=i.return;if(s===null)break;var o=s.alternate;if(o===null){if(n=s.return,n!==null){i=n;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===i)return xw(s),e;if(o===n)return xw(s),t;o=o.sibling}throw Error(j(188))}if(i.return!==n.return)i=s,n=o;else{for(var l=!1,c=s.child;c;){if(c===i){l=!0,i=s,n=o;break}if(c===n){l=!0,n=s,i=o;break}c=c.sibling}if(!l){for(c=o.child;c;){if(c===i){l=!0,i=o,n=s;break}if(c===n){l=!0,n=o,i=s;break}c=c.sibling}if(!l)throw Error(j(189))}}if(i.alternate!==n)throw Error(j(190))}if(i.tag!==3)throw Error(j(188));return i.stateNode.current===i?e:t}function Mx(e){if(e=xB(e),!e)return null;for(var t=e;;){if(t.tag===5||t.tag===6)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 $s(e,t){if(t==null)throw Error(j(30));return e==null?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 ep(e,t,i){Array.isArray(e)?e.forEach(t,i):e&&t.call(i,e)}var ya=null;function SB(e){if(e){var t=e._dispatchListeners,i=e._dispatchInstances;if(Array.isArray(t))for(var n=0;n<t.length&&!e.isPropagationStopped();n++)lw(e,t[n],i[n]);else t&&lw(e,t,i);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function Ju(e){if(e!==null&&(ya=$s(ya,e)),e=ya,ya=null,e){if(ep(e,SB),ya)throw Error(j(95));if(vu)throw e=Id,vu=!1,Id=null,e}}function tp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}function bx(e){if(!dr)return!1;e="on"+e;var t=e in document;return t||(t=document.createElement("div"),t.setAttribute(e,"return;"),t=typeof t[e]=="function"),t}var xu=[];function Cx(e){e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>xu.length&&xu.push(e)}function Ix(e,t,i,n){if(xu.length){var s=xu.pop();return s.topLevelType=e,s.eventSystemFlags=n,s.nativeEvent=t,s.targetInst=i,s}return{topLevelType:e,eventSystemFlags:n,nativeEvent:t,targetInst:i,ancestors:[]}}function Ax(e){var t=e.targetInst,i=t;do{if(!i){e.ancestors.push(i);break}var n=i;if(n.tag===3)n=n.stateNode.containerInfo;else{for(;n.return;)n=n.return;n=n.tag!==3?null:n.stateNode.containerInfo}if(!n)break;t=i.tag,t!==5&&t!==6||e.ancestors.push(i),i=To(n)}while(i);for(i=0;i<e.ancestors.length;i++){t=e.ancestors[i];var s=tp(e.nativeEvent);n=e.topLevelType;var o=e.nativeEvent,l=e.eventSystemFlags;i===0&&(l|=64);for(var c=null,d=0;d<yu.length;d++){var f=yu[d];f&&(f=f.extractEvents(n,t,o,s,l))&&(c=$s(c,f))}Ju(c)}}function Dd(e,t,i){if(!i.has(e)){switch(e){case"scroll":Ba(t,"scroll",!0);break;case"focus":case"blur":Ba(t,"focus",!0),Ba(t,"blur",!0),i.set("blur",null),i.set("focus",null);break;case"cancel":case"close":bx(e)&&Ba(t,e,!0);break;case"invalid":case"submit":case"reset":break;default:ka.indexOf(e)===-1&&Ke(e,t)}i.set(e,null)}}var Tx,ip,Ex,Ld=!1,tn=[],er=null,tr=null,ir=null,eo=new Map,to=new Map,xa=[],Rd="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput close cancel copy cut paste click change contextmenu reset submit".split(" "),MB="focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture".split(" ");function bB(e,t){var i=qf(t);Rd.forEach(function(n){Dd(n,t,i)}),MB.forEach(function(n){Dd(n,t,i)})}function Od(e,t,i,n,s){return{blockedOn:e,topLevelType:t,eventSystemFlags:i|32,nativeEvent:s,container:n}}function Sw(e,t){switch(e){case"focus":case"blur":er=null;break;case"dragenter":case"dragleave":tr=null;break;case"mouseover":case"mouseout":ir=null;break;case"pointerover":case"pointerout":eo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":to.delete(t.pointerId)}}function Sa(e,t,i,n,s,o){return e===null||e.nativeEvent!==o?(e=Od(t,i,n,s,o),t!==null&&(t=Eo(t),t!==null&&ip(t)),e):(e.eventSystemFlags|=n,e)}function CB(e,t,i,n,s){switch(t){case"focus":return er=Sa(er,e,t,i,n,s),!0;case"dragenter":return tr=Sa(tr,e,t,i,n,s),!0;case"mouseover":return ir=Sa(ir,e,t,i,n,s),!0;case"pointerover":var o=s.pointerId;return eo.set(o,Sa(eo.get(o)||null,e,t,i,n,s)),!0;case"gotpointercapture":return o=s.pointerId,to.set(o,Sa(to.get(o)||null,e,t,i,n,s)),!0}return!1}function IB(e){var t=To(e.target);if(t!==null){var i=ts(t);if(i!==null){if(t=i.tag,t===13){if(t=Sx(i),t!==null){e.blockedOn=t,Mt.unstable_runWithPriority(e.priority,function(){Ex(i)});return}}else if(t===3&&i.stateNode.hydrate){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function eu(e){if(e.blockedOn!==null)return!1;var t=sp(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);if(t!==null){var i=Eo(t);return i!==null&&ip(i),e.blockedOn=t,!1}return!0}function Mw(e,t,i){eu(e)&&i.delete(t)}function AB(){for(Ld=!1;0<tn.length;){var e=tn[0];if(e.blockedOn!==null){e=Eo(e.blockedOn),e!==null&&Tx(e);break}var t=sp(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);t!==null?e.blockedOn=t:tn.shift()}er!==null&&eu(er)&&(er=null),tr!==null&&eu(tr)&&(tr=null),ir!==null&&eu(ir)&&(ir=null),eo.forEach(Mw),to.forEach(Mw)}function Ma(e,t){e.blockedOn===t&&(e.blockedOn=null,Ld||(Ld=!0,Mt.unstable_scheduleCallback(Mt.unstable_NormalPriority,AB)))}function _x(e){function t(s){return Ma(s,e)}if(0<tn.length){Ma(tn[0],e);for(var i=1;i<tn.length;i++){var n=tn[i];n.blockedOn===e&&(n.blockedOn=null)}}for(er!==null&&Ma(er,e),tr!==null&&Ma(tr,e),ir!==null&&Ma(ir,e),eo.forEach(t),to.forEach(t),i=0;i<xa.length;i++)n=xa[i],n.blockedOn===e&&(n.blockedOn=null);for(;0<xa.length&&(i=xa[0],i.blockedOn===null);)IB(i),i.blockedOn===null&&xa.shift()}var Px={},Nx=new Map,np=new Map,TB=["abort","abort",vx,"animationEnd",wx,"animationIteration",yx,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",xx,"transitionEnd","waiting","waiting"];function rp(e,t){for(var i=0;i<e.length;i+=2){var n=e[i],s=e[i+1],o="on"+(s[0].toUpperCase()+s.slice(1));o={phasedRegistrationNames:{bubbled:o,captured:o+"Capture"},dependencies:[n],eventPriority:t},np.set(n,t),Nx.set(n,o),Px[s]=o}}rp("blur blur cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focus focus input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0);rp("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1);rp(TB,2);for(var bw="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Hh=0;Hh<bw.length;Hh++)np.set(bw[Hh],0);var EB=Mt.unstable_UserBlockingPriority,_B=Mt.unstable_runWithPriority,tu=!0;function Ke(e,t){Ba(t,e,!1)}function Ba(e,t,i){var n=np.get(t);switch(n===void 0?2:n){case 0:n=PB.bind(null,t,1,e);break;case 1:n=NB.bind(null,t,1,e);break;default:n=Ku.bind(null,t,1,e)}i?e.addEventListener(t,n,!0):e.addEventListener(t,n,!1)}function PB(e,t,i,n){zr||Hf();var s=Ku,o=zr;zr=!0;try{tx(s,e,t,i,n)}finally{(zr=o)||Zf()}}function NB(e,t,i,n){_B(EB,Ku.bind(null,e,t,i,n))}function Ku(e,t,i,n){if(tu)if(0<tn.length&&-1<Rd.indexOf(e))e=Od(null,e,t,i,n),tn.push(e);else{var s=sp(e,t,i,n);if(s===null)Sw(e,n);else if(-1<Rd.indexOf(e))e=Od(s,e,t,i,n),tn.push(e);else if(!CB(s,e,t,i,n)){Sw(e,n),e=Ix(e,n,null,t);try{nx(Ax,e)}finally{Cx(e)}}}}function sp(e,t,i,n){if(i=tp(n),i=To(i),i!==null){var s=ts(i);if(s===null)i=null;else{var o=s.tag;if(o===13){if(i=Sx(s),i!==null)return i;i=null}else if(o===3){if(s.stateNode.hydrate)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}e=Ix(e,n,i,t);try{nx(Ax,e)}finally{Cx(e)}return null}var Ua={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},kB=["Webkit","ms","Moz","O"];Object.keys(Ua).forEach(function(e){kB.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ua[t]=Ua[e]})});function kx(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||Ua.hasOwnProperty(e)&&Ua[e]?(""+t).trim():t+"px"}function Bx(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var n=i.indexOf("--")===0,s=kx(i,t[i],n);i==="float"&&(i="cssFloat"),n?e.setProperty(i,s):e[i]=s}}var BB=Vt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Vd(e,t){if(t){if(BB[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(j(137,e,""));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(j(60));if(!(typeof t.dangerouslySetInnerHTML=="object"&&"__html"in t.dangerouslySetInnerHTML))throw Error(j(61))}if(t.style!=null&&typeof t.style!="object")throw Error(j(62,""))}}function $d(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Cw=fx.html;function xn(e,t){e=e.nodeType===9||e.nodeType===11?e:e.ownerDocument;var i=qf(e);t=Wf[t];for(var n=0;n<t.length;n++)Dd(t[n],e,i)}function Su(){}function jd(e){if(e=e||(typeof document!="undefined"?document:void 0),typeof e=="undefined")return null;try{return e.activeElement||e.body}catch{return e.body}}function Iw(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Aw(e,t){var i=Iw(e);e=0;for(var n;i;){if(i.nodeType===3){if(n=e+i.textContent.length,e<=t&&n>=t)return{node:i,offset:t-e};e=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Iw(i)}}function zx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?zx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tw(){for(var e=window,t=jd();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=jd(e.document)}return t}function Ud(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Dx="$",Lx="/$",ap="$?",op="$!",Zh=null,Qh=null;function Rx(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Wd(e,t){return e==="textarea"||e==="option"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Yh=typeof setTimeout=="function"?setTimeout:void 0,zB=typeof clearTimeout=="function"?clearTimeout:void 0;function zs(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break}return e}function Ew(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i===Dx||i===op||i===ap){if(t===0)return e;t--}else i===Lx&&t++}e=e.previousSibling}return null}var lp=Math.random().toString(36).slice(2),Yn="__reactInternalInstance$"+lp,Mu="__reactEventHandlers$"+lp,Ao="__reactContainere$"+lp;function To(e){var t=e[Yn];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Ao]||i[Yn]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Ew(e);e!==null;){if(i=e[Yn])return i;e=Ew(e)}return t}e=i,i=e.parentNode}return null}function Eo(e){return e=e[Yn]||e[Ao],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Qr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(j(33))}function up(e){return e[Mu]||null}function Sn(e){do e=e.return;while(e&&e.tag!==5);return e||null}function Ox(e,t){var i=e.stateNode;if(!i)return null;var n=Uf(i);if(!n)return null;i=n[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":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(j(231,t,typeof i));return i}function _w(e,t,i){(t=Ox(e,i.dispatchConfig.phasedRegistrationNames[t]))&&(i._dispatchListeners=$s(i._dispatchListeners,t),i._dispatchInstances=$s(i._dispatchInstances,e))}function DB(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,i=[];t;)i.push(t),t=Sn(t);for(t=i.length;0<t--;)_w(i[t],"captured",e);for(t=0;t<i.length;t++)_w(i[t],"bubbled",e)}}function Fd(e,t,i){e&&i&&i.dispatchConfig.registrationName&&(t=Ox(e,i.dispatchConfig.registrationName))&&(i._dispatchListeners=$s(i._dispatchListeners,t),i._dispatchInstances=$s(i._dispatchInstances,e))}function LB(e){e&&e.dispatchConfig.registrationName&&Fd(e._targetInst,null,e)}function js(e){ep(e,DB)}var Gn=null,cp=null,iu=null;function Vx(){if(iu)return iu;var e,t=cp,i=t.length,n,s="value"in Gn?Gn.value:Gn.textContent,o=s.length;for(e=0;e<i&&t[e]===s[e];e++);var l=i-e;for(n=1;n<=l&&t[i-n]===s[o-n];n++);return iu=s.slice(e,1<n?1-n:void 0)}function nu(){return!0}function bu(){return!1}function gi(e,t,i,n){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=i,e=this.constructor.Interface;for(var s in e)e.hasOwnProperty(s)&&((t=e[s])?this[s]=t(i):s==="target"?this.target=n:this[s]=i[s]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?nu:bu,this.isPropagationStopped=bu,this}Vt(gi.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!="unknown"&&(e.returnValue=!1),this.isDefaultPrevented=nu)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!="unknown"&&(e.cancelBubble=!0),this.isPropagationStopped=nu)},persist:function(){this.isPersistent=nu},isPersistent:bu,destructor:function(){var e=this.constructor.Interface,t;for(t in e)this[t]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=bu,this._dispatchInstances=this._dispatchListeners=null}});gi.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};gi.extend=function(e){function t(){}function i(){return n.apply(this,arguments)}var n=this;t.prototype=n.prototype;var s=new t;return Vt(s,i.prototype),i.prototype=s,i.prototype.constructor=i,i.Interface=Vt({},n.Interface,e),i.extend=n.extend,$x(i),i};$x(gi);function RB(e,t,i,n){if(this.eventPool.length){var s=this.eventPool.pop();return this.call(s,e,t,i,n),s}return new this(e,t,i,n)}function OB(e){if(!(e instanceof this))throw Error(j(279));e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function $x(e){e.eventPool=[],e.getPooled=RB,e.release=OB}var VB=gi.extend({data:null}),$B=gi.extend({data:null}),jB=[9,13,27,32],hp=dr&&"CompositionEvent"in window,Wa=null;dr&&"documentMode"in document&&(Wa=document.documentMode);var UB=dr&&"TextEvent"in window&&!Wa,jx=dr&&(!hp||Wa&&8<Wa&&11>=Wa),Pw=String.fromCharCode(32),yn={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(" ")}},Nw=!1;function Ux(e,t){switch(e){case"keyup":return jB.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Wx(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Is=!1;function WB(e,t){switch(e){case"compositionend":return Wx(t);case"keypress":return t.which!==32?null:(Nw=!0,Pw);case"textInput":return e=t.data,e===Pw&&Nw?null:e;default:return null}}function FB(e,t){if(Is)return e==="compositionend"||!hp&&Ux(e,t)?(e=Vx(),iu=cp=Gn=null,Is=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return jx&&t.locale!=="ko"?null:t.data;default:return null}}var HB={eventTypes:yn,extractEvents:function(e,t,i,n){var s;if(hp)e:{switch(e){case"compositionstart":var o=yn.compositionStart;break e;case"compositionend":o=yn.compositionEnd;break e;case"compositionupdate":o=yn.compositionUpdate;break e}o=void 0}else Is?Ux(e,i)&&(o=yn.compositionEnd):e==="keydown"&&i.keyCode===229&&(o=yn.compositionStart);return o?(jx&&i.locale!=="ko"&&(Is||o!==yn.compositionStart?o===yn.compositionEnd&&Is&&(s=Vx()):(Gn=n,cp="value"in Gn?Gn.value:Gn.textContent,Is=!0)),o=VB.getPooled(o,t,i,n),s?o.data=s:(s=Wx(i),s!==null&&(o.data=s)),js(o),s=o):s=null,(e=UB?WB(e,i):FB(e,i))?(t=$B.getPooled(yn.beforeInput,t,i,n),t.data=e,js(t)):t=null,s===null?t:t===null?s:[s,t]}},ZB={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Fx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ZB[e.type]:t==="textarea"}var Hx={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Zx(e,t,i){return e=gi.getPooled(Hx.change,e,t,i),e.type="change",qy(i),js(e),e}var Fa=null,io=null;function QB(e){Ju(e)}function qu(e){var t=Qr(e);if(cx(t))return e}function YB(e,t){if(e==="change")return t}var Hd=!1;dr&&(Hd=bx("input")&&(!document.documentMode||9<document.documentMode));function kw(){Fa&&(Fa.detachEvent("onpropertychange",Qx),io=Fa=null)}function Qx(e){if(e.propertyName==="value"&&qu(io))if(e=Zx(io,e,tp(e)),zr)Ju(e);else{zr=!0;try{Ff(QB,e)}finally{zr=!1,Zf()}}}function GB(e,t,i){e==="focus"?(kw(),Fa=t,io=i,Fa.attachEvent("onpropertychange",Qx)):e==="blur"&&kw()}function XB(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return qu(io)}function JB(e,t){if(e==="click")return qu(t)}function KB(e,t){if(e==="input"||e==="change")return qu(t)}var qB={eventTypes:Hx,_isInputEventSupported:Hd,extractEvents:function(e,t,i,n){var s=t?Qr(t):window,o=s.nodeName&&s.nodeName.toLowerCase();if(o==="select"||o==="input"&&s.type==="file")var l=YB;else if(Fx(s))if(Hd)l=KB;else{l=XB;var c=GB}else(o=s.nodeName)&&o.toLowerCase()==="input"&&(s.type==="checkbox"||s.type==="radio")&&(l=JB);if(l&&(l=l(e,t)))return Zx(l,i,n);c&&c(e,s,t),e==="blur"&&(e=s._wrapperState)&&e.controlled&&s.type==="number"&&Nd(s,"number",s.value)}},_o=gi.extend({view:null,detail:null}),ez={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tz(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ez[e])?!!t[e]:!1}function dp(){return tz}var Bw=0,zw=0,Dw=!1,Lw=!1,Po=_o.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:dp,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},movementX:function(e){if("movementX"in e)return e.movementX;var t=Bw;return Bw=e.screenX,Dw?e.type==="mousemove"?e.screenX-t:0:(Dw=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=zw;return zw=e.screenY,Lw?e.type==="mousemove"?e.screenY-t:0:(Lw=!0,0)}}),Yx=Po.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),ba={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},iz={eventTypes:ba,extractEvents:function(e,t,i,n,s){var o=e==="mouseover"||e==="pointerover",l=e==="mouseout"||e==="pointerout";if(o&&(s&32)===0&&(i.relatedTarget||i.fromElement)||!l&&!o)return null;if(o=n.window===n?n:(o=n.ownerDocument)?o.defaultView||o.parentWindow:window,l){if(l=t,t=(t=i.relatedTarget||i.toElement)?To(t):null,t!==null){var c=ts(t);(t!==c||t.tag!==5&&t.tag!==6)&&(t=null)}}else l=null;if(l===t)return null;if(e==="mouseout"||e==="mouseover")var d=Po,f=ba.mouseLeave,g=ba.mouseEnter,v="mouse";else(e==="pointerout"||e==="pointerover")&&(d=Yx,f=ba.pointerLeave,g=ba.pointerEnter,v="pointer");if(e=l==null?o:Qr(l),o=t==null?o:Qr(t),f=d.getPooled(f,l,i,n),f.type=v+"leave",f.target=e,f.relatedTarget=o,i=d.getPooled(g,t,i,n),i.type=v+"enter",i.target=o,i.relatedTarget=e,n=l,v=t,n&&v)e:{for(d=n,g=v,l=0,e=d;e;e=Sn(e))l++;for(e=0,t=g;t;t=Sn(t))e++;for(;0<l-e;)d=Sn(d),l--;for(;0<e-l;)g=Sn(g),e--;for(;l--;){if(d===g||d===g.alternate)break e;d=Sn(d),g=Sn(g)}d=null}else d=null;for(g=d,d=[];n&&n!==g&&(l=n.alternate,!(l!==null&&l===g));)d.push(n),n=Sn(n);for(n=[];v&&v!==g&&(l=v.alternate,!(l!==null&&l===g));)n.push(v),v=Sn(v);for(v=0;v<d.length;v++)Fd(d[v],"bubbled",f);for(v=n.length;0<v--;)Fd(n[v],"captured",i);return(s&64)===0?[f]:[f,i]}};function nz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yr=typeof Object.is=="function"?Object.is:nz,rz=Object.prototype.hasOwnProperty;function no(e,t){if(Yr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(n=0;n<i.length;n++)if(!rz.call(t,i[n])||!Yr(e[i[n]],t[i[n]]))return!1;return!0}var sz=dr&&"documentMode"in document&&11>=document.documentMode,Gx={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},As=null,Zd=null,Ha=null,Qd=!1;function Rw(e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;return Qd||As==null||As!==jd(i)?null:(i=As,"selectionStart"in i&&Ud(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ha&&no(Ha,i)?null:(Ha=i,e=gi.getPooled(Gx.select,Zd,e,t),e.type="select",e.target=As,js(e),e))}var az={eventTypes:Gx,extractEvents:function(e,t,i,n,s,o){if(s=o||(n.window===n?n.document:n.nodeType===9?n:n.ownerDocument),!(o=!s)){e:{s=qf(s),o=Wf.onSelect;for(var l=0;l<o.length;l++)if(!s.has(o[l])){s=!1;break e}s=!0}o=!s}if(o)return null;switch(s=t?Qr(t):window,e){case"focus":(Fx(s)||s.contentEditable==="true")&&(As=s,Zd=t,Ha=null);break;case"blur":Ha=Zd=As=null;break;case"mousedown":Qd=!0;break;case"contextmenu":case"mouseup":case"dragend":return Qd=!1,Rw(i,n);case"selectionchange":if(sz)break;case"keydown":case"keyup":return Rw(i,n)}return null}},oz=gi.extend({animationName:null,elapsedTime:null,pseudoElement:null}),lz=gi.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),uz=_o.extend({relatedTarget:null});function ru(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}var cz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hz={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},dz=_o.extend({key:function(e){if(e.key){var t=cz[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ru(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?hz[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:dp,charCode:function(e){return e.type==="keypress"?ru(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ru(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),fz=Po.extend({dataTransfer:null}),pz=_o.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:dp}),gz=gi.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),mz=Po.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),vz={eventTypes:Px,extractEvents:function(e,t,i,n){var s=Nx.get(e);if(!s)return null;switch(e){case"keypress":if(ru(i)===0)return null;case"keydown":case"keyup":e=dz;break;case"blur":case"focus":e=uz;break;case"click":if(i.button===2)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":e=Po;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=fz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=pz;break;case vx:case wx:case yx:e=oz;break;case xx:e=gz;break;case"scroll":e=_o;break;case"wheel":e=mz;break;case"copy":case"cut":case"paste":e=lz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=Yx;break;default:e=gi}return t=e.getPooled(s,t,i,n),js(t),t}};if(wu)throw Error(j(101));wu=Array.prototype.slice.call("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));Jy();var wz=Eo;Uf=up;Gy=wz;Xy=Qr;Ky({SimpleEventPlugin:vz,EnterLeaveEventPlugin:iz,ChangeEventPlugin:qB,SelectEventPlugin:az,BeforeInputEventPlugin:HB});var Yd=[],Ts=-1;function Ge(e){0>Ts||(e.current=Yd[Ts],Yd[Ts]=null,Ts--)}function at(e,t){Ts++,Yd[Ts]=e.current,e.current=t}var cr={},Nt={current:cr},Gt={current:!1},Gr=cr;function Us(e,t){var i=e.type.contextTypes;if(!i)return cr;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in i)s[o]=t[o];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Xt(e){return e=e.childContextTypes,e!=null}function Cu(){Ge(Gt),Ge(Nt)}function Ow(e,t,i){if(Nt.current!==cr)throw Error(j(168));at(Nt,t),at(Gt,i)}function Xx(e,t,i){var n=e.stateNode;if(e=t.childContextTypes,typeof n.getChildContext!="function")return i;n=n.getChildContext();for(var s in n)if(!(s in e))throw Error(j(108,_n(t)||"Unknown",s));return Vt({},i,{},n)}function su(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||cr,Gr=Nt.current,at(Nt,e),at(Gt,Gt.current),!0}function Vw(e,t,i){var n=e.stateNode;if(!n)throw Error(j(169));i?(e=Xx(e,t,Gr),n.__reactInternalMemoizedMergedChildContext=e,Ge(Gt),Ge(Nt),at(Nt,e)):Ge(Gt),at(Gt,i)}var yz=Mt.unstable_runWithPriority,fp=Mt.unstable_scheduleCallback,Jx=Mt.unstable_cancelCallback,$w=Mt.unstable_requestPaint,Gd=Mt.unstable_now,xz=Mt.unstable_getCurrentPriorityLevel,ec=Mt.unstable_ImmediatePriority,Kx=Mt.unstable_UserBlockingPriority,qx=Mt.unstable_NormalPriority,eS=Mt.unstable_LowPriority,tS=Mt.unstable_IdlePriority,iS={},Sz=Mt.unstable_shouldYield,Mz=$w!==void 0?$w:function(){},bn=null,au=null,Gh=!1,jw=Gd(),Ei=1e4>jw?Gd:function(){return Gd()-jw};function tc(){switch(xz()){case ec:return 99;case Kx:return 98;case qx:return 97;case eS:return 96;case tS:return 95;default:throw Error(j(332))}}function nS(e){switch(e){case 99:return ec;case 98:return Kx;case 97:return qx;case 96:return eS;case 95:return tS;default:throw Error(j(332))}}function hr(e,t){return e=nS(e),yz(e,t)}function rS(e,t,i){return e=nS(e),fp(e,t,i)}function Uw(e){return bn===null?(bn=[e],au=fp(ec,sS)):bn.push(e),iS}function ln(){if(au!==null){var e=au;au=null,Jx(e)}sS()}function sS(){if(!Gh&&bn!==null){Gh=!0;var e=0;try{var t=bn;hr(99,function(){for(;e<t.length;e++){var i=t[e];do i=i(!0);while(i!==null)}}),bn=null}catch(i){throw bn!==null&&(bn=bn.slice(e+1)),fp(ec,ln),i}finally{Gh=!1}}}function ou(e,t,i){return i/=10,1073741821-(((1073741821-e+t/10)/i|0)+1)*i}function Ri(e,t){if(e&&e.defaultProps){t=Vt({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i])}return t}var Iu={current:null},Au=null,Es=null,Tu=null;function pp(){Tu=Es=Au=null}function gp(e){var t=Iu.current;Ge(Iu),e.type._context._currentValue=t}function aS(e,t){for(;e!==null;){var i=e.alternate;if(e.childExpirationTime<t)e.childExpirationTime=t,i!==null&&i.childExpirationTime<t&&(i.childExpirationTime=t);else if(i!==null&&i.childExpirationTime<t)i.childExpirationTime=t;else break;e=e.return}}function Ds(e,t){Au=e,Tu=Es=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.expirationTime>=t&&(nn=!0),e.firstContext=null)}function Pi(e,t){if(Tu!==e&&t!==!1&&t!==0)if((typeof t!="number"||t===1073741823)&&(Tu=e,t=1073741823),t={context:e,observedBits:t,next:null},Es===null){if(Au===null)throw Error(j(308));Es=t,Au.dependencies={expirationTime:0,firstContext:t,responders:null}}else Es=Es.next=t;return e._currentValue}var Qn=!1;function mp(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function vp(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function nr(e,t){return e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null},e.next=e}function rr(e,t){if(e=e.updateQueue,e!==null){e=e.shared;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}}function Ww(e,t){var i=e.alternate;i!==null&&vp(i,e),e=e.updateQueue,i=e.baseQueue,i===null?(e.baseQueue=t.next=t,t.next=t):(t.next=i.next,i.next=t)}function ro(e,t,i,n){var s=e.updateQueue;Qn=!1;var o=s.baseQueue,l=s.shared.pending;if(l!==null){if(o!==null){var c=o.next;o.next=l.next,l.next=c}o=l,s.shared.pending=null,c=e.alternate,c!==null&&(c=c.updateQueue,c!==null&&(c.baseQueue=l))}if(o!==null){c=o.next;var d=s.baseState,f=0,g=null,v=null,M=null;if(c!==null){var E=c;do{if(l=E.expirationTime,l<n){var _={expirationTime:E.expirationTime,suspenseConfig:E.suspenseConfig,tag:E.tag,payload:E.payload,callback:E.callback,next:null};M===null?(v=M=_,g=d):M=M.next=_,l>f&&(f=l)}else{M!==null&&(M=M.next={expirationTime:1073741823,suspenseConfig:E.suspenseConfig,tag:E.tag,payload:E.payload,callback:E.callback,next:null}),LS(l,E.suspenseConfig);e:{var P=e,y=E;switch(l=t,_=i,y.tag){case 1:if(P=y.payload,typeof P=="function"){d=P.call(_,d,l);break e}d=P;break e;case 3:P.effectTag=P.effectTag&-4097|64;case 0:if(P=y.payload,l=typeof P=="function"?P.call(_,d,l):P,l==null)break e;d=Vt({},d,l);break e;case 2:Qn=!0}}E.callback!==null&&(e.effectTag|=32,l=s.effects,l===null?s.effects=[E]:l.push(E))}if(E=E.next,E===null||E===c){if(l=s.shared.pending,l===null)break;E=o.next=l.next,l.next=c,s.baseQueue=o=l,s.shared.pending=null}}while(1)}M===null?g=d:M.next=v,s.baseState=g,s.baseQueue=M,ac(f),e.expirationTime=f,e.memoizedState=d}}function Fw(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],s=n.callback;if(s!==null){if(n.callback=null,n=s,s=i,typeof n!="function")throw Error(j(191,n));n.call(s)}}}var Za=Vi.ReactCurrentBatchConfig,oS=new Gu.Component().refs;function Eu(e,t,i,n){t=e.memoizedState,i=i(n,t),i=i==null?t:Vt({},t,i),e.memoizedState=i,e.expirationTime===0&&(e.updateQueue.baseState=i)}var ic={isMounted:function(e){return(e=e._reactInternalFiber)?ts(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternalFiber;var n=an(),s=Za.suspense;n=Ur(n,e,s),s=nr(n,s),s.payload=t,i!=null&&(s.callback=i),rr(e,s),ar(e,n)},enqueueReplaceState:function(e,t,i){e=e._reactInternalFiber;var n=an(),s=Za.suspense;n=Ur(n,e,s),s=nr(n,s),s.tag=1,s.payload=t,i!=null&&(s.callback=i),rr(e,s),ar(e,n)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var i=an(),n=Za.suspense;i=Ur(i,e,n),n=nr(i,n),n.tag=2,t!=null&&(n.callback=t),rr(e,n),ar(e,i)}};function Hw(e,t,i,n,s,o,l){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,o,l):t.prototype&&t.prototype.isPureReactComponent?!no(i,n)||!no(s,o):!0}function lS(e,t,i){var n=!1,s=cr,o=t.contextType;return typeof o=="object"&&o!==null?o=Pi(o):(s=Xt(t)?Gr:Nt.current,n=t.contextTypes,o=(n=n!=null)?Us(e,s):cr),t=new t(i,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ic,e.stateNode=t,t._reactInternalFiber=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=o),t}function Zw(e,t,i,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,n),t.state!==e&&ic.enqueueReplaceState(t,t.state,null)}function Xd(e,t,i,n){var s=e.stateNode;s.props=i,s.state=e.memoizedState,s.refs=oS,mp(e);var o=t.contextType;typeof o=="object"&&o!==null?s.context=Pi(o):(o=Xt(t)?Gr:Nt.current,s.context=Us(e,o)),ro(e,i,s,n),s.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Eu(e,t,o,i),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&ic.enqueueReplaceState(s,s.state,null),ro(e,i,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.effectTag|=4)}var Dl=Array.isArray;function Ca(e,t,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(j(309));var n=i.stateNode}if(!n)throw Error(j(147,e));var s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=n.refs;l===oS&&(l=n.refs={}),o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(j(284));if(!i._owner)throw Error(j(290,e))}return e}function Ll(e,t){if(e.type!=="textarea")throw Error(j(31,Object.prototype.toString.call(t)==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":t,""))}function uS(e){function t(y,x){if(e){var I=y.lastEffect;I!==null?(I.nextEffect=x,y.lastEffect=x):y.firstEffect=y.lastEffect=x,x.nextEffect=null,x.effectTag=8}}function i(y,x){if(!e)return null;for(;x!==null;)t(y,x),x=x.sibling;return null}function n(y,x){for(y=new Map;x!==null;)x.key!==null?y.set(x.key,x):y.set(x.index,x),x=x.sibling;return y}function s(y,x){return y=Xr(y,x),y.index=0,y.sibling=null,y}function o(y,x,I){return y.index=I,e?(I=y.alternate,I!==null?(I=I.index,I<x?(y.effectTag=2,x):I):(y.effectTag=2,x)):x}function l(y){return e&&y.alternate===null&&(y.effectTag=2),y}function c(y,x,I,C){return x===null||x.tag!==6?(x=td(I,y.mode,C),x.return=y,x):(x=s(x,I),x.return=y,x)}function d(y,x,I,C){return x!==null&&x.elementType===I.type?(C=s(x,I.props),C.ref=Ca(y,x,I),C.return=y,C):(C=hu(I.type,I.key,I.props,null,y.mode,C),C.ref=Ca(y,x,I),C.return=y,C)}function f(y,x,I,C){return x===null||x.tag!==4||x.stateNode.containerInfo!==I.containerInfo||x.stateNode.implementation!==I.implementation?(x=id(I,y.mode,C),x.return=y,x):(x=s(x,I.children||[]),x.return=y,x)}function g(y,x,I,C,k){return x===null||x.tag!==7?(x=Kn(I,y.mode,C,k),x.return=y,x):(x=s(x,I),x.return=y,x)}function v(y,x,I){if(typeof x=="string"||typeof x=="number")return x=td(""+x,y.mode,I),x.return=y,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Nl:return I=hu(x.type,x.key,x.props,null,y.mode,I),I.ref=Ca(y,null,x),I.return=y,I;case bs:return x=id(x,y.mode,I),x.return=y,x}if(Dl(x)||wa(x))return x=Kn(x,y.mode,I,null),x.return=y,x;Ll(y,x)}return null}function M(y,x,I,C){var k=x!==null?x.key:null;if(typeof I=="string"||typeof I=="number")return k!==null?null:c(y,x,""+I,C);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case Nl:return I.key===k?I.type===Br?g(y,x,I.props.children,C,k):d(y,x,I,C):null;case bs:return I.key===k?f(y,x,I,C):null}if(Dl(I)||wa(I))return k!==null?null:g(y,x,I,C,null);Ll(y,I)}return null}function E(y,x,I,C,k){if(typeof C=="string"||typeof C=="number")return y=y.get(I)||null,c(x,y,""+C,k);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Nl:return y=y.get(C.key===null?I:C.key)||null,C.type===Br?g(x,y,C.props.children,k,C.key):d(x,y,C,k);case bs:return y=y.get(C.key===null?I:C.key)||null,f(x,y,C,k)}if(Dl(C)||wa(C))return y=y.get(I)||null,g(x,y,C,k,null);Ll(x,C)}return null}function _(y,x,I,C){for(var k=null,L=null,W=x,Q=x=0,J=null;W!==null&&Q<I.length;Q++){W.index>Q?(J=W,W=null):J=W.sibling;var K=M(y,W,I[Q],C);if(K===null){W===null&&(W=J);break}e&&W&&K.alternate===null&&t(y,W),x=o(K,x,Q),L===null?k=K:L.sibling=K,L=K,W=J}if(Q===I.length)return i(y,W),k;if(W===null){for(;Q<I.length;Q++)W=v(y,I[Q],C),W!==null&&(x=o(W,x,Q),L===null?k=W:L.sibling=W,L=W);return k}for(W=n(y,W);Q<I.length;Q++)J=E(W,y,Q,I[Q],C),J!==null&&(e&&J.alternate!==null&&W.delete(J.key===null?Q:J.key),x=o(J,x,Q),L===null?k=J:L.sibling=J,L=J);return e&&W.forEach(function(De){return t(y,De)}),k}function P(y,x,I,C){var k=wa(I);if(typeof k!="function")throw Error(j(150));if(I=k.call(I),I==null)throw Error(j(151));for(var L=k=null,W=x,Q=x=0,J=null,K=I.next();W!==null&&!K.done;Q++,K=I.next()){W.index>Q?(J=W,W=null):J=W.sibling;var De=M(y,W,K.value,C);if(De===null){W===null&&(W=J);break}e&&W&&De.alternate===null&&t(y,W),x=o(De,x,Q),L===null?k=De:L.sibling=De,L=De,W=J}if(K.done)return i(y,W),k;if(W===null){for(;!K.done;Q++,K=I.next())K=v(y,K.value,C),K!==null&&(x=o(K,x,Q),L===null?k=K:L.sibling=K,L=K);return k}for(W=n(y,W);!K.done;Q++,K=I.next())K=E(W,y,Q,K.value,C),K!==null&&(e&&K.alternate!==null&&W.delete(K.key===null?Q:K.key),x=o(K,x,Q),L===null?k=K:L.sibling=K,L=K);return e&&W.forEach(function(U){return t(y,U)}),k}return function(y,x,I,C){var k=typeof I=="object"&&I!==null&&I.type===Br&&I.key===null;k&&(I=I.props.children);var L=typeof I=="object"&&I!==null;if(L)switch(I.$$typeof){case Nl:e:{for(L=I.key,k=x;k!==null;){if(k.key===L){switch(k.tag){case 7:if(I.type===Br){i(y,k.sibling),x=s(k,I.props.children),x.return=y,y=x;break e}break;default:if(k.elementType===I.type){i(y,k.sibling),x=s(k,I.props),x.ref=Ca(y,k,I),x.return=y,y=x;break e}}i(y,k);break}else t(y,k);k=k.sibling}I.type===Br?(x=Kn(I.props.children,y.mode,C,I.key),x.return=y,y=x):(C=hu(I.type,I.key,I.props,null,y.mode,C),C.ref=Ca(y,x,I),C.return=y,y=C)}return l(y);case bs:e:{for(k=I.key;x!==null;){if(x.key===k)if(x.tag===4&&x.stateNode.containerInfo===I.containerInfo&&x.stateNode.implementation===I.implementation){i(y,x.sibling),x=s(x,I.children||[]),x.return=y,y=x;break e}else{i(y,x);break}else t(y,x);x=x.sibling}x=id(I,y.mode,C),x.return=y,y=x}return l(y)}if(typeof I=="string"||typeof I=="number")return I=""+I,x!==null&&x.tag===6?(i(y,x.sibling),x=s(x,I),x.return=y,y=x):(i(y,x),x=td(I,y.mode,C),x.return=y,y=x),l(y);if(Dl(I))return _(y,x,I,C);if(wa(I))return P(y,x,I,C);if(L&&Ll(y,I),typeof I=="undefined"&&!k)switch(y.tag){case 1:case 0:throw y=y.type,Error(j(152,y.displayName||y.name||"Component"))}return i(y,x)}}var Ws=uS(!0),wp=uS(!1),No={},sn={current:No},so={current:No},ao={current:No};function Dr(e){if(e===No)throw Error(j(174));return e}function Jd(e,t){switch(at(ao,t),at(so,e),at(sn,No),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:zd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=zd(t,e)}Ge(sn),at(sn,t)}function Fs(){Ge(sn),Ge(so),Ge(ao)}function Qw(e){Dr(ao.current);var t=Dr(sn.current),i=zd(t,e.type);t!==i&&(at(so,e),at(sn,i))}function yp(e){so.current===e&&(Ge(sn),Ge(so))}var it={current:0};function _u(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data===ap||i.data===op))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.effectTag&64)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function xp(e,t){return{responder:e,props:t}}var lu=Vi.ReactCurrentDispatcher,_i=Vi.ReactCurrentBatchConfig,Xn=0,ft=null,_t=null,Pt=null,Pu=!1;function ui(){throw Error(j(321))}function Sp(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Yr(e[i],t[i]))return!1;return!0}function Mp(e,t,i,n,s,o){if(Xn=o,ft=t,t.memoizedState=null,t.updateQueue=null,t.expirationTime=0,lu.current=e===null||e.memoizedState===null?bz:Cz,e=i(n,s),t.expirationTime===Xn){o=0;do{if(t.expirationTime=0,!(25>o))throw Error(j(301));o+=1,Pt=_t=null,t.updateQueue=null,lu.current=Iz,e=i(n,s)}while(t.expirationTime===Xn)}if(lu.current=Bu,t=_t!==null&&_t.next!==null,Xn=0,Pt=_t=ft=null,Pu=!1,t)throw Error(j(300));return e}function Ls(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?ft.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function Js(){if(_t===null){var e=ft.alternate;e=e!==null?e.memoizedState:null}else e=_t.next;var t=Pt===null?ft.memoizedState:Pt.next;if(t!==null)Pt=t,_t=e;else{if(e===null)throw Error(j(310));_t=e,e={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},Pt===null?ft.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function Vr(e,t){return typeof t=="function"?t(e):t}function Rl(e){var t=Js(),i=t.queue;if(i===null)throw Error(j(311));i.lastRenderedReducer=e;var n=_t,s=n.baseQueue,o=i.pending;if(o!==null){if(s!==null){var l=s.next;s.next=o.next,o.next=l}n.baseQueue=s=o,i.pending=null}if(s!==null){s=s.next,n=n.baseState;var c=l=o=null,d=s;do{var f=d.expirationTime;if(f<Xn){var g={expirationTime:d.expirationTime,suspenseConfig:d.suspenseConfig,action:d.action,eagerReducer:d.eagerReducer,eagerState:d.eagerState,next:null};c===null?(l=c=g,o=n):c=c.next=g,f>ft.expirationTime&&(ft.expirationTime=f,ac(f))}else c!==null&&(c=c.next={expirationTime:1073741823,suspenseConfig:d.suspenseConfig,action:d.action,eagerReducer:d.eagerReducer,eagerState:d.eagerState,next:null}),LS(f,d.suspenseConfig),n=d.eagerReducer===e?d.eagerState:e(n,d.action);d=d.next}while(d!==null&&d!==s);c===null?o=n:c.next=l,Yr(n,t.memoizedState)||(nn=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=c,i.lastRenderedState=n}return[t.memoizedState,i.dispatch]}function Ol(e){var t=Js(),i=t.queue;if(i===null)throw Error(j(311));i.lastRenderedReducer=e;var n=i.dispatch,s=i.pending,o=t.memoizedState;if(s!==null){i.pending=null;var l=s=s.next;do o=e(o,l.action),l=l.next;while(l!==s);Yr(o,t.memoizedState)||(nn=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),i.lastRenderedState=o}return[o,n]}function Xh(e){var t=Ls();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e=t.queue={pending:null,dispatch:null,lastRenderedReducer:Vr,lastRenderedState:e},e=e.dispatch=gS.bind(null,ft,e),[t.memoizedState,e]}function Kd(e,t,i,n){return e={tag:e,create:t,destroy:i,deps:n,next:null},t=ft.updateQueue,t===null?(t={lastEffect:null},ft.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(n=i.next,i.next=e,e.next=n,t.lastEffect=e)),e}function cS(){return Js().memoizedState}function qd(e,t,i,n){var s=Ls();ft.effectTag|=e,s.memoizedState=Kd(1|t,i,void 0,n===void 0?null:n)}function bp(e,t,i,n){var s=Js();n=n===void 0?null:n;var o=void 0;if(_t!==null){var l=_t.memoizedState;if(o=l.destroy,n!==null&&Sp(n,l.deps)){Kd(t,i,o,n);return}}ft.effectTag|=e,s.memoizedState=Kd(1|t,i,o,n)}function Yw(e,t){return qd(516,4,e,t)}function Nu(e,t){return bp(516,4,e,t)}function hS(e,t){return bp(4,2,e,t)}function dS(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fS(e,t,i){return i=i!=null?i.concat([e]):null,bp(4,2,dS.bind(null,t,e),i)}function Cp(){}function Gw(e,t){return Ls().memoizedState=[e,t===void 0?null:t],e}function ku(e,t){var i=Js();t=t===void 0?null:t;var n=i.memoizedState;return n!==null&&t!==null&&Sp(t,n[1])?n[0]:(i.memoizedState=[e,t],e)}function pS(e,t){var i=Js();t=t===void 0?null:t;var n=i.memoizedState;return n!==null&&t!==null&&Sp(t,n[1])?n[0]:(e=e(),i.memoizedState=[e,t],e)}function Ip(e,t,i){var n=tc();hr(98>n?98:n,function(){e(!0)}),hr(97<n?97:n,function(){var s=_i.suspense;_i.suspense=t===void 0?null:t;try{e(!1),i()}finally{_i.suspense=s}})}function gS(e,t,i){var n=an(),s=Za.suspense;n=Ur(n,e,s),s={expirationTime:n,suspenseConfig:s,action:i,eagerReducer:null,eagerState:null,next:null};var o=t.pending;if(o===null?s.next=s:(s.next=o.next,o.next=s),t.pending=s,o=e.alternate,e===ft||o!==null&&o===ft)Pu=!0,s.expirationTime=Xn,ft.expirationTime=Xn;else{if(e.expirationTime===0&&(o===null||o.expirationTime===0)&&(o=t.lastRenderedReducer,o!==null))try{var l=t.lastRenderedState,c=o(l,i);if(s.eagerReducer=o,s.eagerState=c,Yr(c,l))return}catch{}finally{}ar(e,n)}}var Bu={readContext:Pi,useCallback:ui,useContext:ui,useEffect:ui,useImperativeHandle:ui,useLayoutEffect:ui,useMemo:ui,useReducer:ui,useRef:ui,useState:ui,useDebugValue:ui,useResponder:ui,useDeferredValue:ui,useTransition:ui},bz={readContext:Pi,useCallback:Gw,useContext:Pi,useEffect:Yw,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,qd(4,2,dS.bind(null,t,e),i)},useLayoutEffect:function(e,t){return qd(4,2,e,t)},useMemo:function(e,t){var i=Ls();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var n=Ls();return t=i!==void 0?i(t):t,n.memoizedState=n.baseState=t,e=n.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},e=e.dispatch=gS.bind(null,ft,e),[n.memoizedState,e]},useRef:function(e){var t=Ls();return e={current:e},t.memoizedState=e},useState:Xh,useDebugValue:Cp,useResponder:xp,useDeferredValue:function(e,t){var i=Xh(e),n=i[0],s=i[1];return Yw(function(){var o=_i.suspense;_i.suspense=t===void 0?null:t;try{s(e)}finally{_i.suspense=o}},[e,t]),n},useTransition:function(e){var t=Xh(!1),i=t[0];return t=t[1],[Gw(Ip.bind(null,t,e),[t,e]),i]}},Cz={readContext:Pi,useCallback:ku,useContext:Pi,useEffect:Nu,useImperativeHandle:fS,useLayoutEffect:hS,useMemo:pS,useReducer:Rl,useRef:cS,useState:function(){return Rl(Vr)},useDebugValue:Cp,useResponder:xp,useDeferredValue:function(e,t){var i=Rl(Vr),n=i[0],s=i[1];return Nu(function(){var o=_i.suspense;_i.suspense=t===void 0?null:t;try{s(e)}finally{_i.suspense=o}},[e,t]),n},useTransition:function(e){var t=Rl(Vr),i=t[0];return t=t[1],[ku(Ip.bind(null,t,e),[t,e]),i]}},Iz={readContext:Pi,useCallback:ku,useContext:Pi,useEffect:Nu,useImperativeHandle:fS,useLayoutEffect:hS,useMemo:pS,useReducer:Ol,useRef:cS,useState:function(){return Ol(Vr)},useDebugValue:Cp,useResponder:xp,useDeferredValue:function(e,t){var i=Ol(Vr),n=i[0],s=i[1];return Nu(function(){var o=_i.suspense;_i.suspense=t===void 0?null:t;try{s(e)}finally{_i.suspense=o}},[e,t]),n},useTransition:function(e){var t=Ol(Vr),i=t[0];return t=t[1],[ku(Ip.bind(null,t,e),[t,e]),i]}},Tn=null,Jn=null,$r=!1;function mS(e,t){var i=rn(5,null,null,0);i.elementType="DELETED",i.type="DELETED",i.stateNode=t,i.return=e,i.effectTag=8,e.lastEffect!==null?(e.lastEffect.nextEffect=i,e.lastEffect=i):e.firstEffect=e.lastEffect=i}function Xw(e,t){switch(e.tag){case 5:var i=e.type;return t=t.nodeType!==1||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,!0):!1;case 13:return!1;default:return!1}}function ef(e){if($r){var t=Jn;if(t){var i=t;if(!Xw(e,t)){if(t=zs(i.nextSibling),!t||!Xw(e,t)){e.effectTag=e.effectTag&-1025|2,$r=!1,Tn=e;return}mS(Tn,i)}Tn=e,Jn=zs(t.firstChild)}else e.effectTag=e.effectTag&-1025|2,$r=!1,Tn=e}}function Jw(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Tn=e}function Vl(e){if(e!==Tn)return!1;if(!$r)return Jw(e),$r=!0,!1;var t=e.type;if(e.tag!==5||t!=="head"&&t!=="body"&&!Wd(t,e.memoizedProps))for(t=Jn;t;)mS(e,t),t=zs(t.nextSibling);if(Jw(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(j(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i===Lx){if(t===0){Jn=zs(e.nextSibling);break e}t--}else i!==Dx&&i!==op&&i!==ap||t++}e=e.nextSibling}Jn=null}}else Jn=Tn?zs(e.stateNode.nextSibling):null;return!0}function Jh(){Jn=Tn=null,$r=!1}var Az=Vi.ReactCurrentOwner,nn=!1;function hi(e,t,i,n){t.child=e===null?wp(t,null,i,n):Ws(t,e.child,i,n)}function Kw(e,t,i,n,s){i=i.render;var o=t.ref;return Ds(t,s),n=Mp(e,t,i,n,o,s),e!==null&&!nn?(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=s&&(e.expirationTime=0),En(e,t,s)):(t.effectTag|=1,hi(e,t,n,s),t.child)}function qw(e,t,i,n,s,o){if(e===null){var l=i.type;return typeof l=="function"&&!Pp(l)&&l.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=l,vS(e,t,l,n,s,o)):(e=hu(i.type,null,n,null,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}return l=e.child,s<o&&(s=l.memoizedProps,i=i.compare,i=i!==null?i:no,i(s,n)&&e.ref===t.ref)?En(e,t,o):(t.effectTag|=1,e=Xr(l,n),e.ref=t.ref,e.return=t,t.child=e)}function vS(e,t,i,n,s,o){return e!==null&&no(e.memoizedProps,n)&&e.ref===t.ref&&(nn=!1,s<o)?(t.expirationTime=e.expirationTime,En(e,t,o)):tf(e,t,i,n,o)}function wS(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.effectTag|=128)}function tf(e,t,i,n,s){var o=Xt(i)?Gr:Nt.current;return o=Us(t,o),Ds(t,s),i=Mp(e,t,i,n,o,s),e!==null&&!nn?(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=s&&(e.expirationTime=0),En(e,t,s)):(t.effectTag|=1,hi(e,t,i,s),t.child)}function e0(e,t,i,n,s){if(Xt(i)){var o=!0;su(t)}else o=!1;if(Ds(t,s),t.stateNode===null)e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),lS(t,i,n),Xd(t,i,n,s),n=!0;else if(e===null){var l=t.stateNode,c=t.memoizedProps;l.props=c;var d=l.context,f=i.contextType;typeof f=="object"&&f!==null?f=Pi(f):(f=Xt(i)?Gr:Nt.current,f=Us(t,f));var g=i.getDerivedStateFromProps,v=typeof g=="function"||typeof l.getSnapshotBeforeUpdate=="function";v||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(c!==n||d!==f)&&Zw(t,l,n,f),Qn=!1;var M=t.memoizedState;l.state=M,ro(t,n,l,s),d=t.memoizedState,c!==n||M!==d||Gt.current||Qn?(typeof g=="function"&&(Eu(t,i,g,n),d=t.memoizedState),(c=Qn||Hw(t,i,c,n,M,d,f))?(v||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(t.effectTag|=4)):(typeof l.componentDidMount=="function"&&(t.effectTag|=4),t.memoizedProps=n,t.memoizedState=d),l.props=n,l.state=d,l.context=f,n=c):(typeof l.componentDidMount=="function"&&(t.effectTag|=4),n=!1)}else l=t.stateNode,vp(e,t),c=t.memoizedProps,l.props=t.type===t.elementType?c:Ri(t.type,c),d=l.context,f=i.contextType,typeof f=="object"&&f!==null?f=Pi(f):(f=Xt(i)?Gr:Nt.current,f=Us(t,f)),g=i.getDerivedStateFromProps,(v=typeof g=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(c!==n||d!==f)&&Zw(t,l,n,f),Qn=!1,d=t.memoizedState,l.state=d,ro(t,n,l,s),M=t.memoizedState,c!==n||d!==M||Gt.current||Qn?(typeof g=="function"&&(Eu(t,i,g,n),M=t.memoizedState),(g=Qn||Hw(t,i,c,n,d,M,f))?(v||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(n,M,f),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(n,M,f)),typeof l.componentDidUpdate=="function"&&(t.effectTag|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(t.effectTag|=256)):(typeof l.componentDidUpdate!="function"||c===e.memoizedProps&&d===e.memoizedState||(t.effectTag|=4),typeof l.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&d===e.memoizedState||(t.effectTag|=256),t.memoizedProps=n,t.memoizedState=M),l.props=n,l.state=M,l.context=f,n=g):(typeof l.componentDidUpdate!="function"||c===e.memoizedProps&&d===e.memoizedState||(t.effectTag|=4),typeof l.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&d===e.memoizedState||(t.effectTag|=256),n=!1);return nf(e,t,i,n,o,s)}function nf(e,t,i,n,s,o){wS(e,t);var l=(t.effectTag&64)!==0;if(!n&&!l)return s&&Vw(t,i,!1),En(e,t,o);n=t.stateNode,Az.current=t;var c=l&&typeof i.getDerivedStateFromError!="function"?null:n.render();return t.effectTag|=1,e!==null&&l?(t.child=Ws(t,e.child,null,o),t.child=Ws(t,null,c,o)):hi(e,t,c,o),t.memoizedState=n.state,s&&Vw(t,i,!0),t.child}function t0(e){var t=e.stateNode;t.pendingContext?Ow(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ow(e,t.context,!1),Jd(e,t.containerInfo)}var Kh={dehydrated:null,retryTime:0};function i0(e,t,i){var n=t.mode,s=t.pendingProps,o=it.current,l=!1,c;if((c=(t.effectTag&64)!==0)||(c=(o&2)!==0&&(e===null||e.memoizedState!==null)),c?(l=!0,t.effectTag&=-65):e!==null&&e.memoizedState===null||s.fallback===void 0||s.unstable_avoidThisFallback===!0||(o|=1),at(it,o&1),e===null){if(s.fallback!==void 0&&ef(t),l){if(l=s.fallback,s=Kn(null,n,0,null),s.return=t,(t.mode&2)===0)for(e=t.memoizedState!==null?t.child.child:t.child,s.child=e;e!==null;)e.return=s,e=e.sibling;return i=Kn(l,n,i,null),i.return=t,s.sibling=i,t.memoizedState=Kh,t.child=s,i}return n=s.children,t.memoizedState=null,t.child=wp(t,null,n,i)}if(e.memoizedState!==null){if(e=e.child,n=e.sibling,l){if(s=s.fallback,i=Xr(e,e.pendingProps),i.return=t,(t.mode&2)===0&&(l=t.memoizedState!==null?t.child.child:t.child,l!==e.child))for(i.child=l;l!==null;)l.return=i,l=l.sibling;return n=Xr(n,s),n.return=t,i.sibling=n,i.childExpirationTime=0,t.memoizedState=Kh,t.child=i,n}return i=Ws(t,e.child,s.children,i),t.memoizedState=null,t.child=i}if(e=e.child,l){if(l=s.fallback,s=Kn(null,n,0,null),s.return=t,s.child=e,e!==null&&(e.return=s),(t.mode&2)===0)for(e=t.memoizedState!==null?t.child.child:t.child,s.child=e;e!==null;)e.return=s,e=e.sibling;return i=Kn(l,n,i,null),i.return=t,s.sibling=i,i.effectTag|=2,s.childExpirationTime=0,t.memoizedState=Kh,t.child=s,i}return t.memoizedState=null,t.child=Ws(t,e,s.children,i)}function n0(e,t){e.expirationTime<t&&(e.expirationTime=t);var i=e.alternate;i!==null&&i.expirationTime<t&&(i.expirationTime=t),aS(e.return,t)}function qh(e,t,i,n,s,o){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:i,tailExpiration:0,tailMode:s,lastEffect:o}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=n,l.tail=i,l.tailExpiration=0,l.tailMode=s,l.lastEffect=o)}function r0(e,t,i){var n=t.pendingProps,s=n.revealOrder,o=n.tail;if(hi(e,t,n.children,i),n=it.current,(n&2)!==0)n=n&1|2,t.effectTag|=64;else{if(e!==null&&(e.effectTag&64)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&n0(e,i);else if(e.tag===19)n0(e,i);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(at(it,n),(t.mode&2)===0)t.memoizedState=null;else switch(s){case"forwards":for(i=t.child,s=null;i!==null;)e=i.alternate,e!==null&&_u(e)===null&&(s=i),i=i.sibling;i=s,i===null?(s=t.child,t.child=null):(s=i.sibling,i.sibling=null),qh(t,!1,s,i,o,t.lastEffect);break;case"backwards":for(i=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&_u(e)===null){t.child=s;break}e=s.sibling,s.sibling=i,i=s,s=e}qh(t,!0,i,null,o,t.lastEffect);break;case"together":qh(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function En(e,t,i){e!==null&&(t.dependencies=e.dependencies);var n=t.expirationTime;if(n!==0&&ac(n),t.childExpirationTime<i)return null;if(e!==null&&t.child!==e.child)throw Error(j(153));if(t.child!==null){for(e=t.child,i=Xr(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Xr(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}var yS,rf,xS,SS;yS=function(e,t){for(var i=t.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};rf=function(){};xS=function(e,t,i,n,s){var o=e.memoizedProps;if(o!==n){var l=t.stateNode;switch(Dr(sn.current),e=null,i){case"input":o=_d(l,o),n=_d(l,n),e=[];break;case"option":o=kd(l,o),n=kd(l,n),e=[];break;case"select":o=Vt({},o,{value:void 0}),n=Vt({},n,{value:void 0}),e=[];break;case"textarea":o=Bd(l,o),n=Bd(l,n),e=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(l.onclick=Su)}Vd(i,n);var c,d;i=null;for(c in o)if(!n.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style")for(d in l=o[c],l)l.hasOwnProperty(d)&&(i||(i={}),i[d]="");else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Vs.hasOwnProperty(c)?e||(e=[]):(e=e||[]).push(c,null));for(c in n){var f=n[c];if(l=o!=null?o[c]:void 0,n.hasOwnProperty(c)&&f!==l&&(f!=null||l!=null))if(c==="style")if(l){for(d in l)!l.hasOwnProperty(d)||f&&f.hasOwnProperty(d)||(i||(i={}),i[d]="");for(d in f)f.hasOwnProperty(d)&&l[d]!==f[d]&&(i||(i={}),i[d]=f[d])}else i||(e||(e=[]),e.push(c,i)),i=f;else c==="dangerouslySetInnerHTML"?(f=f?f.__html:void 0,l=l?l.__html:void 0,f!=null&&l!==f&&(e=e||[]).push(c,f)):c==="children"?l===f||typeof f!="string"&&typeof f!="number"||(e=e||[]).push(c,""+f):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Vs.hasOwnProperty(c)?(f!=null&&xn(s,c),e||l===f||(e=[])):(e=e||[]).push(c,f))}i&&(e=e||[]).push("style",i),s=e,(t.updateQueue=s)&&(t.effectTag|=4)}};SS=function(e,t,i,n){i!==n&&(t.effectTag|=4)};function $l(e,t){switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var n=null;i!==null;)i.alternate!==null&&(n=i),i=i.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Tz(e,t,i){var n=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return Xt(t.type)&&Cu(),null;case 3:return Fs(),Ge(Gt),Ge(Nt),i=t.stateNode,i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),e!==null&&e.child!==null||!Vl(t)||(t.effectTag|=4),rf(t),null;case 5:yp(t),i=Dr(ao.current);var s=t.type;if(e!==null&&t.stateNode!=null)xS(e,t,s,n,i),e.ref!==t.ref&&(t.effectTag|=128);else{if(!n){if(t.stateNode===null)throw Error(j(166));return null}if(e=Dr(sn.current),Vl(t)){n=t.stateNode,s=t.type;var o=t.memoizedProps;switch(n[Yn]=t,n[Mu]=o,s){case"iframe":case"object":case"embed":Ke("load",n);break;case"video":case"audio":for(e=0;e<ka.length;e++)Ke(ka[e],n);break;case"source":Ke("error",n);break;case"img":case"image":case"link":Ke("error",n),Ke("load",n);break;case"form":Ke("reset",n),Ke("submit",n);break;case"details":Ke("toggle",n);break;case"input":gw(n,o),Ke("invalid",n),xn(i,"onChange");break;case"select":n._wrapperState={wasMultiple:!!o.multiple},Ke("invalid",n),xn(i,"onChange");break;case"textarea":vw(n,o),Ke("invalid",n),xn(i,"onChange")}Vd(s,o),e=null;for(var l in o)if(o.hasOwnProperty(l)){var c=o[l];l==="children"?typeof c=="string"?n.textContent!==c&&(e=["children",c]):typeof c=="number"&&n.textContent!==""+c&&(e=["children",""+c]):Vs.hasOwnProperty(l)&&c!=null&&xn(i,l)}switch(s){case"input":kl(n),mw(n,o,!0);break;case"textarea":kl(n),ww(n);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(n.onclick=Su)}i=e,t.updateQueue=i,i!==null&&(t.effectTag|=4)}else{switch(l=i.nodeType===9?i:i.ownerDocument,e===Cw&&(e=px(s)),e===Cw?s==="script"?(e=l.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=l.createElement(s,{is:n.is}):(e=l.createElement(s),s==="select"&&(l=e,n.multiple?l.multiple=!0:n.size&&(l.size=n.size))):e=l.createElementNS(e,s),e[Yn]=t,e[Mu]=n,yS(e,t,!1,!1),t.stateNode=e,l=$d(s,n),s){case"iframe":case"object":case"embed":Ke("load",e),c=n;break;case"video":case"audio":for(c=0;c<ka.length;c++)Ke(ka[c],e);c=n;break;case"source":Ke("error",e),c=n;break;case"img":case"image":case"link":Ke("error",e),Ke("load",e),c=n;break;case"form":Ke("reset",e),Ke("submit",e),c=n;break;case"details":Ke("toggle",e),c=n;break;case"input":gw(e,n),c=_d(e,n),Ke("invalid",e),xn(i,"onChange");break;case"option":c=kd(e,n);break;case"select":e._wrapperState={wasMultiple:!!n.multiple},c=Vt({},n,{value:void 0}),Ke("invalid",e),xn(i,"onChange");break;case"textarea":vw(e,n),c=Bd(e,n),Ke("invalid",e),xn(i,"onChange");break;default:c=n}Vd(s,c);var d=c;for(o in d)if(d.hasOwnProperty(o)){var f=d[o];o==="style"?Bx(e,f):o==="dangerouslySetInnerHTML"?(f=f?f.__html:void 0,f!=null&&gx(e,f)):o==="children"?typeof f=="string"?(s!=="textarea"||f!=="")&&qa(e,f):typeof f=="number"&&qa(e,""+f):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Vs.hasOwnProperty(o)?f!=null&&xn(i,o):f!=null&&Gf(e,o,f,l))}switch(s){case"input":kl(e),mw(e,n,!1);break;case"textarea":kl(e),ww(e);break;case"option":n.value!=null&&e.setAttribute("value",""+ur(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?Bs(e,!!n.multiple,i,!1):n.defaultValue!=null&&Bs(e,!!n.multiple,n.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=Su)}Rx(s,n)&&(t.effectTag|=4)}t.ref!==null&&(t.effectTag|=128)}return null;case 6:if(e&&t.stateNode!=null)SS(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(j(166));i=Dr(ao.current),Dr(sn.current),Vl(t)?(i=t.stateNode,n=t.memoizedProps,i[Yn]=t,i.nodeValue!==n&&(t.effectTag|=4)):(i=(i.nodeType===9?i:i.ownerDocument).createTextNode(n),i[Yn]=t,t.stateNode=i)}return null;case 13:return Ge(it),n=t.memoizedState,(t.effectTag&64)!==0?(t.expirationTime=i,t):(i=n!==null,n=!1,e===null?t.memoizedProps.fallback!==void 0&&Vl(t):(s=e.memoizedState,n=s!==null,i||s===null||(s=e.child.sibling,s!==null&&(o=t.firstEffect,o!==null?(t.firstEffect=s,s.nextEffect=o):(t.firstEffect=t.lastEffect=s,s.nextEffect=null),s.effectTag=8))),i&&!n&&(t.mode&2)!==0&&(e===null&&t.memoizedProps.unstable_avoidThisFallback!==!0||(it.current&1)!==0?yt===jr&&(yt=Lu):((yt===jr||yt===Lu)&&(yt=nc),lo!==0&&fi!==null&&(Or(fi,qt),jS(fi,lo)))),(i||n)&&(t.effectTag|=4),null);case 4:return Fs(),rf(t),null;case 10:return gp(t),null;case 17:return Xt(t.type)&&Cu(),null;case 19:if(Ge(it),n=t.memoizedState,n===null)return null;if(s=(t.effectTag&64)!==0,o=n.rendering,o===null){if(s)$l(n,!1);else if(yt!==jr||e!==null&&(e.effectTag&64)!==0)for(o=t.child;o!==null;){if(e=_u(o),e!==null){for(t.effectTag|=64,$l(n,!1),s=e.updateQueue,s!==null&&(t.updateQueue=s,t.effectTag|=4),n.lastEffect===null&&(t.firstEffect=null),t.lastEffect=n.lastEffect,n=t.child;n!==null;)s=n,o=i,s.effectTag&=2,s.nextEffect=null,s.firstEffect=null,s.lastEffect=null,e=s.alternate,e===null?(s.childExpirationTime=0,s.expirationTime=o,s.child=null,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null):(s.childExpirationTime=e.childExpirationTime,s.expirationTime=e.expirationTime,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,o=e.dependencies,s.dependencies=o===null?null:{expirationTime:o.expirationTime,firstContext:o.firstContext,responders:o.responders}),n=n.sibling;return at(it,it.current&1|2),t.child}o=o.sibling}}else{if(!s)if(e=_u(o),e!==null){if(t.effectTag|=64,s=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.effectTag|=4),$l(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate)return t=t.lastEffect=n.lastEffect,t!==null&&(t.nextEffect=null),null}else 2*Ei()-n.renderingStartTime>n.tailExpiration&&1<i&&(t.effectTag|=64,s=!0,$l(n,!1),t.expirationTime=t.childExpirationTime=i-1);n.isBackwards?(o.sibling=t.child,t.child=o):(i=n.last,i!==null?i.sibling=o:t.child=o,n.last=o)}return n.tail!==null?(n.tailExpiration===0&&(n.tailExpiration=Ei()+500),i=n.tail,n.rendering=i,n.tail=i.sibling,n.lastEffect=t.lastEffect,n.renderingStartTime=Ei(),i.sibling=null,t=it.current,at(it,s?t&1|2:t&1),i):null}throw Error(j(156,t.tag))}function Ez(e){switch(e.tag){case 1:Xt(e.type)&&Cu();var t=e.effectTag;return t&4096?(e.effectTag=t&-4097|64,e):null;case 3:if(Fs(),Ge(Gt),Ge(Nt),t=e.effectTag,(t&64)!==0)throw Error(j(285));return e.effectTag=t&-4097|64,e;case 5:return yp(e),null;case 13:return Ge(it),t=e.effectTag,t&4096?(e.effectTag=t&-4097|64,e):null;case 19:return Ge(it),null;case 4:return Fs(),null;case 10:return gp(e),null;default:return null}}function Ap(e,t){return{value:e,source:t,stack:Kf(t)}}var _z=typeof WeakSet=="function"?WeakSet:Set;function sf(e,t){var i=t.source,n=t.stack;n===null&&i!==null&&(n=Kf(i)),i!==null&&_n(i.type),t=t.value,e!==null&&e.tag===1&&_n(e.type);try{console.error(t)}catch(s){setTimeout(function(){throw s})}}function Pz(e,t){try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(i){Wr(e,i)}}function s0(e){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Wr(e,i)}else t.current=null}function Nz(e,t){switch(t.tag){case 0:case 11:case 15:case 22:return;case 1:if(t.effectTag&256&&e!==null){var i=e.memoizedProps,n=e.memoizedState;e=t.stateNode,t=e.getSnapshotBeforeUpdate(t.elementType===t.type?i:Ri(t.type,i),n),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:case 5:case 6:case 4:case 17:return}throw Error(j(163))}function MS(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var n=i.destroy;i.destroy=void 0,n!==void 0&&n()}i=i.next}while(i!==t)}}function bS(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var n=i.create;i.destroy=n()}i=i.next}while(i!==t)}}function kz(e,t,i){switch(i.tag){case 0:case 11:case 15:case 22:bS(3,i);return;case 1:if(e=i.stateNode,i.effectTag&4)if(t===null)e.componentDidMount();else{var n=i.elementType===i.type?t.memoizedProps:Ri(i.type,t.memoizedProps);e.componentDidUpdate(n,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate)}t=i.updateQueue,t!==null&&Fw(i,t,e);return;case 3:if(t=i.updateQueue,t!==null){if(e=null,i.child!==null)switch(i.child.tag){case 5:e=i.child.stateNode;break;case 1:e=i.child.stateNode}Fw(i,t,e)}return;case 5:e=i.stateNode,t===null&&i.effectTag&4&&Rx(i.type,i.memoizedProps)&&e.focus();return;case 6:return;case 4:return;case 12:return;case 13:i.memoizedState===null&&(i=i.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&_x(i))));return;case 19:case 17:case 20:case 21:return}throw Error(j(163))}function a0(e,t,i){switch(typeof ff=="function"&&ff(t),t.tag){case 0:case 11:case 14:case 15:case 22:if(e=t.updateQueue,e!==null&&(e=e.lastEffect,e!==null)){var n=e.next;hr(97<i?97:i,function(){var s=n;do{var o=s.destroy;if(o!==void 0){var l=t;try{o()}catch(c){Wr(l,c)}}s=s.next}while(s!==n)})}break;case 1:s0(t),i=t.stateNode,typeof i.componentWillUnmount=="function"&&Pz(t,i);break;case 5:s0(t);break;case 4:IS(e,t,i)}}function CS(e){var t=e.alternate;e.return=null,e.child=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.alternate=null,e.firstEffect=null,e.lastEffect=null,e.pendingProps=null,e.memoizedProps=null,e.stateNode=null,t!==null&&CS(t)}function o0(e){return e.tag===5||e.tag===3||e.tag===4}function l0(e){e:{for(var t=e.return;t!==null;){if(o0(t)){var i=t;break e}t=t.return}throw Error(j(160))}switch(t=i.stateNode,i.tag){case 5:var n=!1;break;case 3:t=t.containerInfo,n=!0;break;case 4:t=t.containerInfo,n=!0;break;default:throw Error(j(161))}i.effectTag&16&&(qa(t,""),i.effectTag&=-17);e:t:for(i=e;;){for(;i.sibling===null;){if(i.return===null||o0(i.return)){i=null;break e}i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.effectTag&2||i.child===null||i.tag===4)continue t;i.child.return=i,i=i.child}if(!(i.effectTag&2)){i=i.stateNode;break e}}n?af(e,i,t):of(e,i,t)}function af(e,t,i){var n=e.tag,s=n===5||n===6;if(s)e=s?e.stateNode:e.stateNode.instance,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Su));else if(n!==4&&(e=e.child,e!==null))for(af(e,t,i),e=e.sibling;e!==null;)af(e,t,i),e=e.sibling}function of(e,t,i){var n=e.tag,s=n===5||n===6;if(s)e=s?e.stateNode:e.stateNode.instance,t?i.insertBefore(e,t):i.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(of(e,t,i),e=e.sibling;e!==null;)of(e,t,i),e=e.sibling}function IS(e,t,i){for(var n=t,s=!1,o,l;;){if(!s){s=n.return;e:for(;;){if(s===null)throw Error(j(160));switch(o=s.stateNode,s.tag){case 5:l=!1;break e;case 3:o=o.containerInfo,l=!0;break e;case 4:o=o.containerInfo,l=!0;break e}s=s.return}s=!0}if(n.tag===5||n.tag===6){e:for(var c=e,d=n,f=i,g=d;;)if(a0(c,g,f),g.child!==null&&g.tag!==4)g.child.return=g,g=g.child;else{if(g===d)break e;for(;g.sibling===null;){if(g.return===null||g.return===d)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}l?(c=o,d=n.stateNode,c.nodeType===8?c.parentNode.removeChild(d):c.removeChild(d)):o.removeChild(n.stateNode)}else if(n.tag===4){if(n.child!==null){o=n.stateNode.containerInfo,l=!0,n.child.return=n,n=n.child;continue}}else if(a0(e,n,i),n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return,n.tag===4&&(s=!1)}n.sibling.return=n.return,n=n.sibling}}function ed(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:MS(3,t);return;case 1:return;case 5:var i=t.stateNode;if(i!=null){var n=t.memoizedProps,s=e!==null?e.memoizedProps:n;e=t.type;var o=t.updateQueue;if(t.updateQueue=null,o!==null){for(i[Mu]=n,e==="input"&&n.type==="radio"&&n.name!=null&&hx(i,n),$d(e,s),t=$d(e,n),s=0;s<o.length;s+=2){var l=o[s],c=o[s+1];l==="style"?Bx(i,c):l==="dangerouslySetInnerHTML"?gx(i,c):l==="children"?qa(i,c):Gf(i,l,c,t)}switch(e){case"input":Pd(i,n);break;case"textarea":dx(i,n);break;case"select":t=i._wrapperState.wasMultiple,i._wrapperState.wasMultiple=!!n.multiple,e=n.value,e!=null?Bs(i,!!n.multiple,e,!1):t!==!!n.multiple&&(n.defaultValue!=null?Bs(i,!!n.multiple,n.defaultValue,!0):Bs(i,!!n.multiple,n.multiple?[]:"",!1))}}}return;case 6:if(t.stateNode===null)throw Error(j(162));t.stateNode.nodeValue=t.memoizedProps;return;case 3:t=t.stateNode,t.hydrate&&(t.hydrate=!1,_x(t.containerInfo));return;case 12:return;case 13:if(i=t,t.memoizedState===null?n=!1:(n=!0,i=t.child,_p=Ei()),i!==null)e:for(e=i;;){if(e.tag===5)o=e.stateNode,n?(o=o.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(o=e.stateNode,s=e.memoizedProps.style,s=s!=null&&s.hasOwnProperty("display")?s.display:null,o.style.display=kx("display",s));else if(e.tag===6)e.stateNode.nodeValue=n?"":e.memoizedProps;else if(e.tag===13&&e.memoizedState!==null&&e.memoizedState.dehydrated===null){o=e.child.sibling,o.return=e,e=o;continue}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break;for(;e.sibling===null;){if(e.return===null||e.return===i)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}u0(t);return;case 19:u0(t);return;case 17:return}throw Error(j(163))}function u0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new _z),t.forEach(function(n){var s=Uz.bind(null,e,n);i.has(n)||(i.add(n),n.then(s,s))})}}var Bz=typeof WeakMap=="function"?WeakMap:Map;function AS(e,t,i){i=nr(i,null),i.tag=3,i.payload={element:null};var n=t.value;return i.callback=function(){Vu||(Vu=!0,lf=n),sf(e,t)},i}function TS(e,t,i){i=nr(i,null),i.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var s=t.value;i.payload=function(){return sf(e,t),n(s)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(i.callback=function(){typeof n!="function"&&(sr===null?sr=new Set([this]):sr.add(this),sf(e,t));var l=t.stack;this.componentDidCatch(t.value,{componentStack:l!==null?l:""})}),i}var zz=Math.ceil,zu=Vi.ReactCurrentDispatcher,ES=Vi.ReactCurrentOwner,xt=0,Tp=8,$i=16,on=32,jr=0,Du=1,_S=2,Lu=3,nc=4,Ep=5,me=xt,fi=null,Me=null,qt=0,yt=jr,rc=null,In=1073741823,oo=1073741823,Ru=null,lo=0,Ou=!1,_p=0,PS=500,ae=null,Vu=!1,lf=null,sr=null,$u=!1,Qa=null,za=90,Lr=null,Ya=0,uf=null,uu=0;function an(){return(me&($i|on))!==xt?1073741821-(Ei()/10|0):uu!==0?uu:uu=1073741821-(Ei()/10|0)}function Ur(e,t,i){if(t=t.mode,(t&2)===0)return 1073741823;var n=tc();if((t&4)===0)return n===99?1073741823:1073741822;if((me&$i)!==xt)return qt;if(i!==null)e=ou(e,i.timeoutMs|0||5e3,250);else switch(n){case 99:e=1073741823;break;case 98:e=ou(e,150,100);break;case 97:case 96:e=ou(e,5e3,250);break;case 95:e=2;break;default:throw Error(j(326))}return fi!==null&&e===qt&&--e,e}function ar(e,t){if(50<Ya)throw Ya=0,uf=null,Error(j(185));if(e=sc(e,t),e!==null){var i=tc();t===1073741823?(me&Tp)!==xt&&(me&($i|on))===xt?cf(e):(pi(e),me===xt&&ln()):pi(e),(me&4)===xt||i!==98&&i!==99||(Lr===null?Lr=new Map([[e,t]]):(i=Lr.get(e),(i===void 0||i>t)&&Lr.set(e,t)))}}function sc(e,t){e.expirationTime<t&&(e.expirationTime=t);var i=e.alternate;i!==null&&i.expirationTime<t&&(i.expirationTime=t);var n=e.return,s=null;if(n===null&&e.tag===3)s=e.stateNode;else for(;n!==null;){if(i=n.alternate,n.childExpirationTime<t&&(n.childExpirationTime=t),i!==null&&i.childExpirationTime<t&&(i.childExpirationTime=t),n.return===null&&n.tag===3){s=n.stateNode;break}n=n.return}return s!==null&&(fi===s&&(ac(t),yt===nc&&Or(s,qt)),jS(s,t)),s}function cu(e){var t=e.lastExpiredTime;if(t!==0||(t=e.firstPendingTime,!$S(e,t)))return t;var i=e.lastPingedTime;return e=e.nextKnownPendingLevel,e=i>e?i:e,2>=e&&t!==e?0:e}function pi(e){if(e.lastExpiredTime!==0)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=Uw(cf.bind(null,e));else{var t=cu(e),i=e.callbackNode;if(t===0)i!==null&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var n=an();if(t===1073741823?n=99:t===1||t===2?n=95:(n=10*(1073741821-t)-10*(1073741821-n),n=0>=n?99:250>=n?98:5250>=n?97:95),i!==null){var s=e.callbackPriority;if(e.callbackExpirationTime===t&&s>=n)return;i!==iS&&Jx(i)}e.callbackExpirationTime=t,e.callbackPriority=n,t=t===1073741823?Uw(cf.bind(null,e)):rS(n,NS.bind(null,e),{timeout:10*(1073741821-t)-Ei()}),e.callbackNode=t}}}function NS(e,t){if(uu=0,t)return t=an(),pf(e,t),pi(e),null;var i=cu(e);if(i!==0){if(t=e.callbackNode,(me&($i|on))!==xt)throw Error(j(327));if(Ks(),e===fi&&i===qt||Rr(e,i),Me!==null){var n=me;me|=$i;var s=DS();do try{Rz();break}catch(c){zS(e,c)}while(1);if(pp(),me=n,zu.current=s,yt===Du)throw t=rc,Rr(e,i),Or(e,i),pi(e),t;if(Me===null)switch(s=e.finishedWork=e.current.alternate,e.finishedExpirationTime=i,n=yt,fi=null,n){case jr:case Du:throw Error(j(345));case _S:pf(e,2<i?2:i);break;case Lu:if(Or(e,i),n=e.lastSuspendedTime,i===n&&(e.nextKnownPendingLevel=hf(s)),In===1073741823&&(s=_p+PS-Ei(),10<s)){if(Ou){var o=e.lastPingedTime;if(o===0||o>=i){e.lastPingedTime=i,Rr(e,i);break}}if(o=cu(e),o!==0&&o!==i)break;if(n!==0&&n!==i){e.lastPingedTime=n;break}e.timeoutHandle=Yh(Nr.bind(null,e),s);break}Nr(e);break;case nc:if(Or(e,i),n=e.lastSuspendedTime,i===n&&(e.nextKnownPendingLevel=hf(s)),Ou&&(s=e.lastPingedTime,s===0||s>=i)){e.lastPingedTime=i,Rr(e,i);break}if(s=cu(e),s!==0&&s!==i)break;if(n!==0&&n!==i){e.lastPingedTime=n;break}if(oo!==1073741823?n=10*(1073741821-oo)-Ei():In===1073741823?n=0:(n=10*(1073741821-In)-5e3,s=Ei(),i=10*(1073741821-i)-s,n=s-n,0>n&&(n=0),n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*zz(n/1960))-n,i<n&&(n=i)),10<n){e.timeoutHandle=Yh(Nr.bind(null,e),n);break}Nr(e);break;case Ep:if(In!==1073741823&&Ru!==null){o=In;var l=Ru;if(n=l.busyMinDurationMs|0,0>=n?n=0:(s=l.busyDelayMs|0,o=Ei()-(10*(1073741821-o)-(l.timeoutMs|0||5e3)),n=o<=s?0:s+n-o),10<n){Or(e,i),e.timeoutHandle=Yh(Nr.bind(null,e),n);break}}Nr(e);break;default:throw Error(j(329))}if(pi(e),e.callbackNode===t)return NS.bind(null,e)}}return null}function cf(e){var t=e.lastExpiredTime;if(t=t!==0?t:1073741823,(me&($i|on))!==xt)throw Error(j(327));if(Ks(),e===fi&&t===qt||Rr(e,t),Me!==null){var i=me;me|=$i;var n=DS();do try{Lz();break}catch(s){zS(e,s)}while(1);if(pp(),me=i,zu.current=n,yt===Du)throw i=rc,Rr(e,t),Or(e,t),pi(e),i;if(Me!==null)throw Error(j(261));e.finishedWork=e.current.alternate,e.finishedExpirationTime=t,fi=null,Nr(e),pi(e)}return null}function Dz(){if(Lr!==null){var e=Lr;Lr=null,e.forEach(function(t,i){pf(i,t),pi(i)}),ln()}}function kS(e,t){var i=me;me|=1;try{return e(t)}finally{me=i,me===xt&&ln()}}function BS(e,t){var i=me;me&=-2,me|=Tp;try{return e(t)}finally{me=i,me===xt&&ln()}}function Rr(e,t){e.finishedWork=null,e.finishedExpirationTime=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,zB(i)),Me!==null)for(i=Me.return;i!==null;){var n=i;switch(n.tag){case 1:n=n.type.childContextTypes,n!=null&&Cu();break;case 3:Fs(),Ge(Gt),Ge(Nt);break;case 5:yp(n);break;case 4:Fs();break;case 13:Ge(it);break;case 19:Ge(it);break;case 10:gp(n)}i=i.return}fi=e,Me=Xr(e.current,null),qt=t,yt=jr,rc=null,oo=In=1073741823,Ru=null,lo=0,Ou=!1}function zS(e,t){do{try{if(pp(),lu.current=Bu,Pu)for(var i=ft.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}if(Xn=0,Pt=_t=ft=null,Pu=!1,Me===null||Me.return===null)return yt=Du,rc=t,Me=null;e:{var s=e,o=Me.return,l=Me,c=t;if(t=qt,l.effectTag|=2048,l.firstEffect=l.lastEffect=null,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c;if((l.mode&2)===0){var f=l.alternate;f?(l.updateQueue=f.updateQueue,l.memoizedState=f.memoizedState,l.expirationTime=f.expirationTime):(l.updateQueue=null,l.memoizedState=null)}var g=(it.current&1)!==0,v=o;do{var M;if(M=v.tag===13){var E=v.memoizedState;if(E!==null)M=E.dehydrated!==null;else{var _=v.memoizedProps;M=_.fallback===void 0?!1:_.unstable_avoidThisFallback!==!0?!0:!g}}if(M){var P=v.updateQueue;if(P===null){var y=new Set;y.add(d),v.updateQueue=y}else P.add(d);if((v.mode&2)===0){if(v.effectTag|=64,l.effectTag&=-2981,l.tag===1)if(l.alternate===null)l.tag=17;else{var x=nr(1073741823,null);x.tag=2,rr(l,x)}l.expirationTime=1073741823;break e}c=void 0,l=t;var I=s.pingCache;if(I===null?(I=s.pingCache=new Bz,c=new Set,I.set(d,c)):(c=I.get(d),c===void 0&&(c=new Set,I.set(d,c))),!c.has(l)){c.add(l);var C=jz.bind(null,s,d,l);d.then(C,C)}v.effectTag|=4096,v.expirationTime=t;break e}v=v.return}while(v!==null);c=Error((_n(l.type)||"A React component")+` suspended while rendering, but no fallback UI was specified.
|
|
44
|
-
|
|
45
|
-
Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`+Kf(l))}yt!==Ep&&(yt=_S),c=Ap(c,l),v=o;do{switch(v.tag){case 3:d=c,v.effectTag|=4096,v.expirationTime=t;var k=AS(v,d,t);Ww(v,k);break e;case 1:d=c;var L=v.type,W=v.stateNode;if((v.effectTag&64)===0&&(typeof L.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(sr===null||!sr.has(W)))){v.effectTag|=4096,v.expirationTime=t;var Q=TS(v,d,t);Ww(v,Q);break e}}v=v.return}while(v!==null)}Me=OS(Me)}catch(J){t=J;continue}break}while(1)}function DS(){var e=zu.current;return zu.current=Bu,e===null?Bu:e}function LS(e,t){e<In&&2<e&&(In=e),t!==null&&e<oo&&2<e&&(oo=e,Ru=t)}function ac(e){e>lo&&(lo=e)}function Lz(){for(;Me!==null;)Me=RS(Me)}function Rz(){for(;Me!==null&&!Sz();)Me=RS(Me)}function RS(e){var t=VS(e.alternate,e,qt);return e.memoizedProps=e.pendingProps,t===null&&(t=OS(e)),ES.current=null,t}function OS(e){Me=e;do{var t=Me.alternate;if(e=Me.return,(Me.effectTag&2048)===0){if(t=Tz(t,Me,qt),qt===1||Me.childExpirationTime!==1){for(var i=0,n=Me.child;n!==null;){var s=n.expirationTime,o=n.childExpirationTime;s>i&&(i=s),o>i&&(i=o),n=n.sibling}Me.childExpirationTime=i}if(t!==null)return t;e!==null&&(e.effectTag&2048)===0&&(e.firstEffect===null&&(e.firstEffect=Me.firstEffect),Me.lastEffect!==null&&(e.lastEffect!==null&&(e.lastEffect.nextEffect=Me.firstEffect),e.lastEffect=Me.lastEffect),1<Me.effectTag&&(e.lastEffect!==null?e.lastEffect.nextEffect=Me:e.firstEffect=Me,e.lastEffect=Me))}else{if(t=Ez(Me),t!==null)return t.effectTag&=2047,t;e!==null&&(e.firstEffect=e.lastEffect=null,e.effectTag|=2048)}if(t=Me.sibling,t!==null)return t;Me=e}while(Me!==null);return yt===jr&&(yt=Ep),null}function hf(e){var t=e.expirationTime;return e=e.childExpirationTime,t>e?t:e}function Nr(e){var t=tc();return hr(99,Oz.bind(null,e,t)),null}function Oz(e,t){do Ks();while(Qa!==null);if((me&($i|on))!==xt)throw Error(j(327));var i=e.finishedWork,n=e.finishedExpirationTime;if(i===null)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,i===e.current)throw Error(j(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var s=hf(i);if(e.firstPendingTime=s,n<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:n<=e.firstSuspendedTime&&(e.firstSuspendedTime=n-1),n<=e.lastPingedTime&&(e.lastPingedTime=0),n<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===fi&&(Me=fi=null,qt=0),1<i.effectTag?i.lastEffect!==null?(i.lastEffect.nextEffect=i,s=i.firstEffect):s=i:s=i.firstEffect,s!==null){var o=me;me|=on,ES.current=null,Zh=tu;var l=Tw();if(Ud(l)){if("selectionStart"in l)var c={start:l.selectionStart,end:l.selectionEnd};else e:{c=(c=l.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var f=d.anchorOffset,g=d.focusNode;d=d.focusOffset;try{c.nodeType,g.nodeType}catch{c=null;break e}var v=0,M=-1,E=-1,_=0,P=0,y=l,x=null;t:for(;;){for(var I;y!==c||f!==0&&y.nodeType!==3||(M=v+f),y!==g||d!==0&&y.nodeType!==3||(E=v+d),y.nodeType===3&&(v+=y.nodeValue.length),(I=y.firstChild)!==null;)x=y,y=I;for(;;){if(y===l)break t;if(x===c&&++_===f&&(M=v),x===g&&++P===d&&(E=v),(I=y.nextSibling)!==null)break;y=x,x=y.parentNode}y=I}c=M===-1||E===-1?null:{start:M,end:E}}else c=null}c=c||{start:0,end:0}}else c=null;Qh={activeElementDetached:null,focusedElem:l,selectionRange:c},tu=!1,ae=s;do try{Vz()}catch(K){if(ae===null)throw Error(j(330));Wr(ae,K),ae=ae.nextEffect}while(ae!==null);ae=s;do try{for(l=e,c=t;ae!==null;){var C=ae.effectTag;if(C&16&&qa(ae.stateNode,""),C&128){var k=ae.alternate;if(k!==null){var L=k.ref;L!==null&&(typeof L=="function"?L(null):L.current=null)}}switch(C&1038){case 2:l0(ae),ae.effectTag&=-3;break;case 6:l0(ae),ae.effectTag&=-3,ed(ae.alternate,ae);break;case 1024:ae.effectTag&=-1025;break;case 1028:ae.effectTag&=-1025,ed(ae.alternate,ae);break;case 4:ed(ae.alternate,ae);break;case 8:f=ae,IS(l,f,c),CS(f)}ae=ae.nextEffect}}catch(K){if(ae===null)throw Error(j(330));Wr(ae,K),ae=ae.nextEffect}while(ae!==null);if(L=Qh,k=Tw(),C=L.focusedElem,c=L.selectionRange,k!==C&&C&&C.ownerDocument&&zx(C.ownerDocument.documentElement,C)){for(c!==null&&Ud(C)&&(k=c.start,L=c.end,L===void 0&&(L=k),"selectionStart"in C?(C.selectionStart=k,C.selectionEnd=Math.min(L,C.value.length)):(L=(k=C.ownerDocument||document)&&k.defaultView||window,L.getSelection&&(L=L.getSelection(),f=C.textContent.length,l=Math.min(c.start,f),c=c.end===void 0?l:Math.min(c.end,f),!L.extend&&l>c&&(f=c,c=l,l=f),f=Aw(C,l),g=Aw(C,c),f&&g&&(L.rangeCount!==1||L.anchorNode!==f.node||L.anchorOffset!==f.offset||L.focusNode!==g.node||L.focusOffset!==g.offset)&&(k=k.createRange(),k.setStart(f.node,f.offset),L.removeAllRanges(),l>c?(L.addRange(k),L.extend(g.node,g.offset)):(k.setEnd(g.node,g.offset),L.addRange(k)))))),k=[],L=C;L=L.parentNode;)L.nodeType===1&&k.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<k.length;C++)L=k[C],L.element.scrollLeft=L.left,L.element.scrollTop=L.top}tu=!!Zh,Qh=Zh=null,e.current=i,ae=s;do try{for(C=e;ae!==null;){var W=ae.effectTag;if(W&36&&kz(C,ae.alternate,ae),W&128){k=void 0;var Q=ae.ref;if(Q!==null){var J=ae.stateNode;switch(ae.tag){case 5:k=J;break;default:k=J}typeof Q=="function"?Q(k):Q.current=k}}ae=ae.nextEffect}}catch(K){if(ae===null)throw Error(j(330));Wr(ae,K),ae=ae.nextEffect}while(ae!==null);ae=null,Mz(),me=o}else e.current=i;if($u)$u=!1,Qa=e,za=t;else for(ae=s;ae!==null;)t=ae.nextEffect,ae.nextEffect=null,ae=t;if(t=e.firstPendingTime,t===0&&(sr=null),t===1073741823?e===uf?Ya++:(Ya=0,uf=e):Ya=0,typeof df=="function"&&df(i.stateNode,n),pi(e),Vu)throw Vu=!1,e=lf,lf=null,e;return(me&Tp)!==xt||ln(),null}function Vz(){for(;ae!==null;){var e=ae.effectTag;(e&256)!==0&&Nz(ae.alternate,ae),(e&512)===0||$u||($u=!0,rS(97,function(){return Ks(),null})),ae=ae.nextEffect}}function Ks(){if(za!==90){var e=97<za?97:za;return za=90,hr(e,$z)}}function $z(){if(Qa===null)return!1;var e=Qa;if(Qa=null,(me&($i|on))!==xt)throw Error(j(331));var t=me;for(me|=on,e=e.current.firstEffect;e!==null;){try{var i=e;if((i.effectTag&512)!==0)switch(i.tag){case 0:case 11:case 15:case 22:MS(5,i),bS(5,i)}}catch(n){if(e===null)throw Error(j(330));Wr(e,n)}i=e.nextEffect,e.nextEffect=null,e=i}return me=t,ln(),!0}function c0(e,t,i){t=Ap(i,t),t=AS(e,t,1073741823),rr(e,t),e=sc(e,1073741823),e!==null&&pi(e)}function Wr(e,t){if(e.tag===3)c0(e,e,t);else for(var i=e.return;i!==null;){if(i.tag===3){c0(i,e,t);break}else if(i.tag===1){var n=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(sr===null||!sr.has(n))){e=Ap(t,e),e=TS(i,e,1073741823),rr(i,e),i=sc(i,1073741823),i!==null&&pi(i);break}}i=i.return}}function jz(e,t,i){var n=e.pingCache;n!==null&&n.delete(t),fi===e&&qt===i?yt===nc||yt===Lu&&In===1073741823&&Ei()-_p<PS?Rr(e,qt):Ou=!0:$S(e,i)&&(t=e.lastPingedTime,t!==0&&t<i||(e.lastPingedTime=i,pi(e)))}function Uz(e,t){var i=e.stateNode;i!==null&&i.delete(t),t=0,t===0&&(t=an(),t=Ur(t,e,null)),e=sc(e,t),e!==null&&pi(e)}var VS;VS=function(e,t,i){var n=t.expirationTime;if(e!==null){var s=t.pendingProps;if(e.memoizedProps!==s||Gt.current)nn=!0;else{if(n<i){switch(nn=!1,t.tag){case 3:t0(t),Jh();break;case 5:if(Qw(t),t.mode&4&&i!==1&&s.hidden)return t.expirationTime=t.childExpirationTime=1,null;break;case 1:Xt(t.type)&&su(t);break;case 4:Jd(t,t.stateNode.containerInfo);break;case 10:n=t.memoizedProps.value,s=t.type._context,at(Iu,s._currentValue),s._currentValue=n;break;case 13:if(t.memoizedState!==null)return n=t.child.childExpirationTime,n!==0&&n>=i?i0(e,t,i):(at(it,it.current&1),t=En(e,t,i),t!==null?t.sibling:null);at(it,it.current&1);break;case 19:if(n=t.childExpirationTime>=i,(e.effectTag&64)!==0){if(n)return r0(e,t,i);t.effectTag|=64}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null),at(it,it.current),!n)return null}return En(e,t,i)}nn=!1}}else nn=!1;switch(t.expirationTime=0,t.tag){case 2:if(n=t.type,e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,s=Us(t,Nt.current),Ds(t,i),s=Mp(null,t,n,e,s,i),t.effectTag|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,Xt(n)){var o=!0;su(t)}else o=!1;t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,mp(t);var l=n.getDerivedStateFromProps;typeof l=="function"&&Eu(t,n,l,e),s.updater=ic,t.stateNode=s,s._reactInternalFiber=t,Xd(t,n,e,i),t=nf(null,t,n,!0,o,i)}else t.tag=0,hi(null,t,s,i),t=t.child;return t;case 16:e:{if(s=t.elementType,e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,vB(s),s._status!==1)throw s._result;switch(s=s._result,t.type=s,o=t.tag=Hz(s),e=Ri(s,e),o){case 0:t=tf(null,t,s,e,i);break e;case 1:t=e0(null,t,s,e,i);break e;case 11:t=Kw(null,t,s,e,i);break e;case 14:t=qw(null,t,s,Ri(s.type,e),n,i);break e}throw Error(j(306,s,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Ri(n,s),tf(e,t,n,s,i);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Ri(n,s),e0(e,t,n,s,i);case 3:if(t0(t),n=t.updateQueue,e===null||n===null)throw Error(j(282));if(n=t.pendingProps,s=t.memoizedState,s=s!==null?s.element:null,vp(e,t),ro(t,n,null,i),n=t.memoizedState.element,n===s)Jh(),t=En(e,t,i);else{if((s=t.stateNode.hydrate)&&(Jn=zs(t.stateNode.containerInfo.firstChild),Tn=t,s=$r=!0),s)for(i=wp(t,null,n,i),t.child=i;i;)i.effectTag=i.effectTag&-3|1024,i=i.sibling;else hi(e,t,n,i),Jh();t=t.child}return t;case 5:return Qw(t),e===null&&ef(t),n=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,l=s.children,Wd(n,s)?l=null:o!==null&&Wd(n,o)&&(t.effectTag|=16),wS(e,t),t.mode&4&&i!==1&&s.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(hi(e,t,l,i),t=t.child),t;case 6:return e===null&&ef(t),null;case 13:return i0(e,t,i);case 4:return Jd(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ws(t,null,n,i):hi(e,t,n,i),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Ri(n,s),Kw(e,t,n,s,i);case 7:return hi(e,t,t.pendingProps,i),t.child;case 8:return hi(e,t,t.pendingProps.children,i),t.child;case 12:return hi(e,t,t.pendingProps.children,i),t.child;case 10:e:{n=t.type._context,s=t.pendingProps,l=t.memoizedProps,o=s.value;var c=t.type._context;if(at(Iu,c._currentValue),c._currentValue=o,l!==null)if(c=l.value,o=Yr(c,o)?0:(typeof n._calculateChangedBits=="function"?n._calculateChangedBits(c,o):1073741823)|0,o===0){if(l.children===s.children&&!Gt.current){t=En(e,t,i);break e}}else for(c=t.child,c!==null&&(c.return=t);c!==null;){var d=c.dependencies;if(d!==null){l=c.child;for(var f=d.firstContext;f!==null;){if(f.context===n&&(f.observedBits&o)!==0){c.tag===1&&(f=nr(i,null),f.tag=2,rr(c,f)),c.expirationTime<i&&(c.expirationTime=i),f=c.alternate,f!==null&&f.expirationTime<i&&(f.expirationTime=i),aS(c.return,i),d.expirationTime<i&&(d.expirationTime=i);break}f=f.next}}else l=c.tag===10&&c.type===t.type?null:c.child;if(l!==null)l.return=c;else for(l=c;l!==null;){if(l===t){l=null;break}if(c=l.sibling,c!==null){c.return=l.return,l=c;break}l=l.return}c=l}hi(e,t,s.children,i),t=t.child}return t;case 9:return s=t.type,o=t.pendingProps,n=o.children,Ds(t,i),s=Pi(s,o.unstable_observedBits),n=n(s),t.effectTag|=1,hi(e,t,n,i),t.child;case 14:return s=t.type,o=Ri(s,t.pendingProps),o=Ri(s.type,o),qw(e,t,s,o,n,i);case 15:return vS(e,t,t.type,t.pendingProps,n,i);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Ri(n,s),e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),t.tag=1,Xt(n)?(e=!0,su(t)):e=!1,Ds(t,i),lS(t,n,s),Xd(t,n,s,i),nf(null,t,n,!0,e,i);case 19:return r0(e,t,i)}throw Error(j(156,t.tag))};var df=null,ff=null;function Wz(e){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined")return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var i=t.inject(e);df=function(n){try{t.onCommitFiberRoot(i,n,void 0,(n.current.effectTag&64)===64)}catch{}},ff=function(n){try{t.onCommitFiberUnmount(i,n)}catch{}}}catch{}return!0}function Fz(e,t,i,n){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function rn(e,t,i,n){return new Fz(e,t,i,n)}function Pp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hz(e){if(typeof e=="function")return Pp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Xf)return 11;if(e===Jf)return 14}return 2}function Xr(e,t){var i=e.alternate;return i===null?(i=rn(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.effectTag=0,i.nextEffect=null,i.firstEffect=null,i.lastEffect=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,t=e.dependencies,i.dependencies=t===null?null:{expirationTime:t.expirationTime,firstContext:t.firstContext,responders:t.responders},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function hu(e,t,i,n,s,o){var l=2;if(n=e,typeof e=="function")Pp(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case Br:return Kn(i.children,s,o,t);case mB:l=8,s|=7;break;case rx:l=8,s|=1;break;case Kl:return e=rn(12,i,t,s|8),e.elementType=Kl,e.type=Kl,e.expirationTime=o,e;case ql:return e=rn(13,i,t,s),e.type=ql,e.elementType=ql,e.expirationTime=o,e;case Ed:return e=rn(19,i,t,s),e.elementType=Ed,e.expirationTime=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case sx:l=10;break e;case ax:l=9;break e;case Xf:l=11;break e;case Jf:l=14;break e;case ox:l=16,n=null;break e;case lx:l=22;break e}throw Error(j(130,e==null?e:typeof e,""))}return t=rn(l,i,t,s),t.elementType=e,t.type=n,t.expirationTime=o,t}function Kn(e,t,i,n){return e=rn(7,e,n,t),e.expirationTime=i,e}function td(e,t,i){return e=rn(6,e,null,t),e.expirationTime=i,e}function id(e,t,i){return t=rn(4,e.children!==null?e.children:[],e.key,t),t.expirationTime=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Zz(e,t,i){this.tag=t,this.current=null,this.containerInfo=e,this.pingCache=this.pendingChildren=null,this.finishedExpirationTime=0,this.finishedWork=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=i,this.callbackNode=null,this.callbackPriority=90,this.lastExpiredTime=this.lastPingedTime=this.nextKnownPendingLevel=this.lastSuspendedTime=this.firstSuspendedTime=this.firstPendingTime=0}function $S(e,t){var i=e.firstSuspendedTime;return e=e.lastSuspendedTime,i!==0&&i>=t&&e<=t}function Or(e,t){var i=e.firstSuspendedTime,n=e.lastSuspendedTime;i<t&&(e.firstSuspendedTime=t),(n>t||i===0)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function jS(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var i=e.firstSuspendedTime;i!==0&&(t>=i?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function pf(e,t){var i=e.lastExpiredTime;(i===0||i>t)&&(e.lastExpiredTime=t)}function ju(e,t,i,n){var s=t.current,o=an(),l=Za.suspense;o=Ur(o,s,l);e:if(i){i=i._reactInternalFiber;t:{if(ts(i)!==i||i.tag!==1)throw Error(j(170));var c=i;do{switch(c.tag){case 3:c=c.stateNode.context;break t;case 1:if(Xt(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break t}}c=c.return}while(c!==null);throw Error(j(171))}if(i.tag===1){var d=i.type;if(Xt(d)){i=Xx(i,d,c);break e}}i=c}else i=cr;return t.context===null?t.context=i:t.pendingContext=i,t=nr(o,l),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),rr(s,t),ar(s,o),o}function nd(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function h0(e,t){e=e.memoizedState,e!==null&&e.dehydrated!==null&&e.retryTime<t&&(e.retryTime=t)}function Np(e,t){h0(e,t),(e=e.alternate)&&h0(e,t)}function kp(e,t,i){i=i!=null&&i.hydrate===!0;var n=new Zz(e,t,i),s=rn(3,null,null,t===2?7:t===1?3:0);n.current=s,s.stateNode=n,mp(s),e[Ao]=n.current,i&&t!==0&&bB(e,e.nodeType===9?e:e.ownerDocument),this._internalRoot=n}kp.prototype.render=function(e){ju(e,this._internalRoot,null,null)};kp.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;ju(null,e,null,function(){t[Ao]=null})};function ko(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Qz(e,t){if(t||(t=e?e.nodeType===9?e.documentElement:e.firstChild:null,t=!(!t||t.nodeType!==1||!t.hasAttribute("data-reactroot"))),!t)for(var i;i=e.lastChild;)e.removeChild(i);return new kp(e,0,t?{hydrate:!0}:void 0)}function oc(e,t,i,n,s){var o=i._reactRootContainer;if(o){var l=o._internalRoot;if(typeof s=="function"){var c=s;s=function(){var f=nd(l);c.call(f)}}ju(t,l,e,s)}else{if(o=i._reactRootContainer=Qz(i,n),l=o._internalRoot,typeof s=="function"){var d=s;s=function(){var f=nd(l);d.call(f)}}BS(function(){ju(t,l,e,s)})}return nd(l)}function Yz(e,t,i){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:bs,key:n==null?null:""+n,children:e,containerInfo:t,implementation:i}}Tx=function(e){if(e.tag===13){var t=ou(an(),150,100);ar(e,t),Np(e,t)}};ip=function(e){e.tag===13&&(ar(e,3),Np(e,3))};Ex=function(e){if(e.tag===13){var t=an();t=Ur(t,e,null),ar(e,t),Np(e,t)}};Td=function(e,t,i){switch(t){case"input":if(Pd(e,i),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var n=i[t];if(n!==e&&n.form===e.form){var s=up(n);if(!s)throw Error(j(90));cx(n),Pd(n,s)}}}break;case"textarea":dx(e,i);break;case"select":t=i.value,t!=null&&Bs(e,!!i.multiple,t,!1)}};Ff=kS;tx=function(e,t,i,n,s){var o=me;me|=4;try{return hr(98,e.bind(null,t,i,n,s))}finally{me=o,me===xt&&ln()}};Hf=function(){(me&(1|$i|on))===xt&&(Dz(),Ks())};ix=function(e,t){var i=me;me|=2;try{return e(t)}finally{me=i,me===xt&&ln()}};function US(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ko(t))throw Error(j(200));return Yz(e,t,null,i)}var Gz={Events:[Eo,Qr,up,Ky,Ad,js,function(e){ep(e,LB)},qy,ex,Ku,Ju,Ks,{current:!1}]};(function(e){var t=e.findFiberByHostInstance;return Wz(Vt({},e,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Vi.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Mx(i),i===null?null:i.stateNode},findFiberByHostInstance:function(i){return t?t(i):null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null}))})({findFiberByHostInstance:To,bundleType:0,version:"16.14.0",rendererPackageName:"react-dom"});Ni.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Gz;Ni.createPortal=US;Ni.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternalFiber;if(t===void 0)throw typeof e.render=="function"?Error(j(188)):Error(j(268,Object.keys(e)));return e=Mx(t),e=e===null?null:e.stateNode,e};Ni.flushSync=function(e,t){if((me&($i|on))!==xt)throw Error(j(187));var i=me;me|=1;try{return hr(99,e.bind(null,t))}finally{me=i,ln()}};Ni.hydrate=function(e,t,i){if(!ko(t))throw Error(j(200));return oc(null,e,t,!0,i)};Ni.render=function(e,t,i){if(!ko(t))throw Error(j(200));return oc(null,e,t,!1,i)};Ni.unmountComponentAtNode=function(e){if(!ko(e))throw Error(j(40));return e._reactRootContainer?(BS(function(){oc(null,null,e,!1,function(){e._reactRootContainer=null,e[Ao]=null})}),!0):!1};Ni.unstable_batchedUpdates=kS;Ni.unstable_createPortal=function(e,t){return US(e,t,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)};Ni.unstable_renderSubtreeIntoContainer=function(e,t,i,n){if(!ko(i))throw Error(j(200));if(e==null||e._reactInternalFiber===void 0)throw Error(j(38));return oc(e,t,i,!1,n)};Ni.version="16.14.0";function WS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(WS)}catch(e){console.error(e)}}WS(),Zy.exports=Ni;var jl=Zy.exports,Xz=Object.defineProperty,Jz=Object.defineProperties,Kz=Object.getOwnPropertyDescriptors,d0=Object.getOwnPropertySymbols,qz=Object.prototype.hasOwnProperty,eD=Object.prototype.propertyIsEnumerable,f0=(e,t,i)=>t in e?Xz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,di=(e,t)=>{for(var i in t||(t={}))qz.call(t,i)&&f0(e,i,t[i]);if(d0)for(var i of d0(t))eD.call(t,i)&&f0(e,i,t[i]);return e};const tD="0.1.0-alpha.5",FS={src:"",currentTime:0,hostTime:0,muted:!1,paused:!0,volume:1},HS={currentTimeMaxError:1,syncInterval:1e3,retryInterval:15e3,verbose:!1,log:console.log.bind(console)};let Mn=HS;function iD(e){Mn=di(di({},HS),e)}function Ul(e,t){if(e.paused)return e.currentTime;const i=function(n){if(n.player)return n.player.beginTimestamp+n.player.progressTime;if(n.room)return n.room.calibrationTimestamp}(t);return i?e.currentTime+(i-e.hostTime)/1e3:e.currentTime}const nD=navigator.userAgent.includes("Safari"),rD=navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPad"),ZS=[".aac",".mid",".midi",".mp3",".ogg",".oga",".wav",".weba"];var sD=typeof global=="object"&&global&&global.Object===Object&&global,aD=typeof self=="object"&&self&&self.Object===Object&&self,QS=sD||aD||Function("return this")(),Uu=QS.Symbol,YS=Object.prototype,oD=YS.hasOwnProperty,lD=YS.toString,Ia=Uu?Uu.toStringTag:void 0,uD=Object.prototype.toString,p0=Uu?Uu.toStringTag:void 0;function cD(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":p0&&p0 in Object(e)?function(t){var i=oD.call(t,Ia),n=t[Ia];try{t[Ia]=void 0;var s=!0}catch{}var o=lD.call(t);return s&&(i?t[Ia]=n:delete t[Ia]),o}(e):function(t){return uD.call(t)}(e)}var hD=/\s/,dD=/^\s+/;function fD(e){return e&&e.slice(0,function(t){for(var i=t.length;i--&&hD.test(t.charAt(i)););return i}(e)+1).replace(dD,"")}function gf(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var pD=/^[-+]0x[0-9a-f]+$/i,gD=/^0b[01]+$/i,mD=/^0o[0-7]+$/i,vD=parseInt;function g0(e){if(typeof e=="number")return e;if(function(n){return typeof n=="symbol"||function(s){return s!=null&&typeof s=="object"}(n)&&cD(n)=="[object Symbol]"}(e))return NaN;if(gf(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=gf(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=fD(e);var i=gD.test(e);return i||mD.test(e)?vD(e.slice(2),i?2:8):pD.test(e)?NaN:+e}var rd=function(){return QS.Date.now()},wD=Math.max,yD=Math.min;function Wl(e,t,i){var n,s,o,l,c,d,f=0,g=!1,v=!1,M=!0;if(typeof e!="function")throw new TypeError("Expected a function");function E(C){var k=n,L=s;return n=s=void 0,f=C,l=e.apply(L,k)}function _(C){return f=C,c=setTimeout(y,t),g?E(C):l}function P(C){var k=C-d;return d===void 0||k>=t||k<0||v&&C-f>=o}function y(){var C=rd();if(P(C))return x(C);c=setTimeout(y,function(k){var L=t-(k-d);return v?yD(L,o-(k-f)):L}(C))}function x(C){return c=void 0,M&&n?E(C):(n=s=void 0,l)}function I(){var C=rd(),k=P(C);if(n=arguments,s=this,d=C,k){if(c===void 0)return _(d);if(v)return clearTimeout(c),c=setTimeout(y,t),E(d)}return c===void 0&&(c=setTimeout(y,t)),l}return t=g0(t)||0,gf(i)&&(g=!!i.leading,o=(v="maxWait"in i)?wD(g0(i.maxWait)||0,t):o,M="trailing"in i?!!i.trailing:M),I.cancel=function(){c!==void 0&&clearTimeout(c),f=0,n=d=s=c=void 0},I.flush=function(){return c===void 0?l:x(rd())},I}class m0 extends es.exports.Component{constructor(t){super(t),this.seeking=!1,this.mobileSeeking=!1,this.track=null,this.hoverTime=null,this.offset=0,this.secondsPrefix="00:00:",this.minutesPrefix="00:",this.seekPause=!1,this.handleTouchSeeking=i=>{let n=0;for(let s=0;s<i.changedTouches.length;s++)n=i.changedTouches[s].pageX;n=n<0?0:n,this.mobileSeeking&&this.changeCurrentTimePosition(n)},this.handleSeeking=i=>{this.seeking&&this.changeCurrentTimePosition(i.pageX)},this.setTrackWidthState=()=>{this.track&&this.setState({trackWidth:this.track.offsetWidth})},this.handleTrackHover=(i,n)=>{if(this.track){const s=this.props.scale||1;let o;o=i?0:(n.pageX-this.track.getBoundingClientRect().left)/s,this.setState({seekHoverPosition:o,trackWidth:this.track.offsetWidth})}},this.mouseSeekingHandler=i=>{this.setSeeking(!1,i),this.onMouseUp()},this.setSeeking=(i,n)=>{n.preventDefault(),this.handleSeeking(n),this.seeking=i,this.setState({seekHoverPosition:i?this.state.seekHoverPosition:0})},this.mobileTouchSeekingHandler=()=>{this.setMobileSeeking(!1)},this.setMobileSeeking=i=>{this.mobileSeeking=i,this.setState({seekHoverPosition:i?this.state.seekHoverPosition:0})},this.renderBufferProgress=()=>{if(this.props.buffered){const i=di(di({},this.getPositionStyle(this.props.buffered)),this.props.bufferColor&&{backgroundColor:this.props.bufferColor});return _e.createElement("div",{className:"buffered",style:i})}return null},this.renderProgress=()=>{const i=di(di({},this.getPositionStyle(this.props.current)),this.props.sliderColor&&{backgroundColor:this.props.sliderColor});return _e.createElement("div",{className:"connect",style:i})},this.renderHoverProgress=()=>{const i=di(di({},this.getSeekHoverPosition()),this.props.sliderHoverColor&&{backgroundColor:this.props.sliderHoverColor});return _e.createElement("div",{className:"seek-hover",style:i})},this.renderThumb=()=>_e.createElement("div",{className:this.isThumbActive()?"thumb active":"thumb",style:this.getThumbHandlerPosition()},_e.createElement("div",{style:{backgroundColor:this.props.thumbColor},className:"handler"})),this.onMouseDown=i=>{var n,s;this.props.pause&&!this.props.paused&&(this.props.pause(),this.seekPause=!0),this.setSeeking(!0,i),(s=(n=this.props).onSeekStart)==null||s.call(n)},this.onMouseUp=()=>{var i,n;this.props.play&&this.seekPause&&(this.props.play(),this.seekPause=!1),(n=(i=this.props).onSeekEnd)==null||n.call(i)},this.props.secondsPrefix&&(this.secondsPrefix=this.props.secondsPrefix),this.props.minutesPrefix&&(this.minutesPrefix=this.props.minutesPrefix),this.state={ready:!1,trackWidth:0,seekHoverPosition:0}}componentDidMount(){this.setTrackWidthState(),window.addEventListener("resize",this.setTrackWidthState),window.addEventListener("mousemove",this.handleSeeking),window.addEventListener("mouseup",this.mouseSeekingHandler),window.addEventListener("touchmove",this.handleTouchSeeking),window.addEventListener("touchend",this.mobileTouchSeekingHandler)}componentWillUnmount(){window.removeEventListener("resize",this.setTrackWidthState),window.removeEventListener("mousemove",this.handleSeeking),window.removeEventListener("mouseup",this.mouseSeekingHandler),window.removeEventListener("touchmove",this.handleTouchSeeking),window.removeEventListener("touchend",this.mobileTouchSeekingHandler)}changeCurrentTimePosition(t){if(this.track){const i=this.props.scale||1;let n=(t-this.track.getBoundingClientRect().left)/i;n=Math.min(this.state.trackWidth,Math.max(0,n)),this.setState({seekHoverPosition:n});const s=+(n/this.state.trackWidth*this.props.total).toFixed(0);this.props.onChange(s)}}getPositionStyle(t){return{transform:`scaleX(${100*t/this.props.total/100})`}}getThumbHandlerPosition(){return{transform:`translateX(${this.state.trackWidth/(this.props.total/this.props.current)}px)`}}getSeekHoverPosition(){return{transform:`scaleX(${100*this.state.seekHoverPosition/this.state.trackWidth/100})`}}getHoverTimePosition(){let t=0;return this.hoverTime&&(t=this.state.seekHoverPosition-this.hoverTime.offsetWidth/2,this.props.limitTimeTooltipBySides&&(t<0?t=0:t+this.hoverTime.offsetWidth>this.state.trackWidth&&(t=this.state.trackWidth-this.hoverTime.offsetWidth))),{transform:`translateX(${t}px)`}}secondsToTime(t){t=Math.round(t+this.offset);const i=Math.floor(t/3600),n=t%3600,s=Math.floor(n/60),o=Math.ceil(n%60);return{hh:i.toString(),mm:s<10?"0"+s:s.toString(),ss:o<10?"0"+o:o.toString()}}getHoverTime(){const t=100*this.state.seekHoverPosition/this.state.trackWidth,i=Math.floor(+t*(this.props.total/100)),n=this.secondsToTime(i);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}isThumbActive(){return this.state.seekHoverPosition>0||this.seeking}drawHoverTime(){return this.props.hideHoverTime?null:_e.createElement("div",{className:this.isThumbActive()?"hover-time active":"hover-time",style:this.getHoverTimePosition(),ref:t=>this.hoverTime=t},this.getHoverTime())}render(){return _e.createElement("div",{className:"seek-slider"},_e.createElement("div",{className:"track",ref:t=>this.track=t,onMouseMove:t=>this.handleTrackHover(!1,t),onMouseLeave:t=>this.handleTrackHover(!0,t),onMouseDown:this.onMouseDown,onTouchStart:t=>{this.setMobileSeeking(!0),this.onMouseDown(t)},onMouseUp:this.onMouseUp,onTouchEnd:this.onMouseUp},_e.createElement("div",{className:"main"},this.renderBufferProgress(),this.renderHoverProgress(),this.renderProgress())),this.drawHoverTime(),this.renderThumb())}}class xD extends es.exports.Component{constructor(t){super(t),this.stageVolume=0,this.updateVolumeTimer=0,this.onVolumeSeeking=!1,this.onClickOperationButton=()=>{const{paused:i}=this.props;i?this.props.play():this.props.pause()},this.operationButton=()=>{const{paused:i}=this.props;return i?_e.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1LjE0djE0bDExLTdsLTExLTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):_e.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMTloNFY1aC00TTYgMTloNFY1SDZ2MTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="})},this.operationVolumeButton=()=>this.props.volume>.9?_e.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg0LTUgNi43djIuMDdjNC0uOTEgNy00LjQ5IDctOC43N2MwLTQuMjgtMy03Ljg2LTctOC43N00xNi41IDEyYzAtMS43Ny0xLTMuMjktMi41LTQuMDNWMTZjMS41LS43MSAyLjUtMi4yNCAyLjUtNE0zIDl2Nmg0bDUgNVY0TDcgOUgzeiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}):this.props.volume===0?_e.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNyA5djZoNGw1IDVWNGwtNSA1SDd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):_e.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNSA5djZoNGw1IDVWNEw5IDltOS41IDNjMC0xLjc3LTEtMy4yOS0yLjUtNC4wM1YxNmMxLjUtLjcxIDIuNS0yLjI0IDIuNS00eiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}),this.handleClickVolume=()=>{this.props.volume===0?this.stageVolume!==0?this.props.setVolume(this.stageVolume):this.props.setVolume(1):(this.stageVolume=this.props.volume,this.props.setVolume(0))},this.onChange=i=>{this.setState({currentTime:i}),i&&this.changeTime(i)},this.changeTime=Wl(i=>{this.props.setCurrentTime(i)},50),this.onVolumeChange=i=>{this.changeVolume(i),this.setState({seekVolume:i/100})},this.changeVolume=Wl(i=>{this.props.setVolume(i/100)},50),this.onVolumeSeekStart=()=>{this.onVolumeSeeking=!0},this.onVolumeSeekEnd=Wl(()=>{this.onVolumeSeeking=!1},500),this.onProgressSeekStart=()=>this.setState({isPlayerSeeking:!0}),this.onProgressSeekEnd=Wl(()=>{this.setState({isPlayerSeeking:!1})},500),this.state={isPlayerSeeking:!1,isVolumeHover:!1,seekVolume:1,visible:!0,currentTime:0},this.stageVolume=t.volume}componentDidMount(){this.updateVolumeTimer=setInterval(()=>{this.onVolumeSeeking||this.setState({seekVolume:this.props.volume}),this.state.isPlayerSeeking||this.setState({currentTime:this.props.currentTime})},100)}componentWillUnmount(){this.updateVolumeTimer&&clearInterval(this.updateVolumeTimer)}render(){const{duration:t,currentTime:i}=this.props;return _e.createElement("div",{className:"player-controller",style:{opacity:this.props.visible?"1":"0"}},_e.createElement("div",{className:"player-controller-progress"},_e.createElement(m0,{total:t,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})),_e.createElement("div",{className:"player-controller-actions"},_e.createElement("div",{className:"player-controller-actions-left"},_e.createElement("div",{onClick:this.onClickOperationButton,className:"player-controller-play"},this.operationButton()),_e.createElement("div",{className:"player-volume-box",onMouseEnter:()=>this.setState({isVolumeHover:!0}),onMouseLeave:()=>this.setState({isVolumeHover:!1})},_e.createElement("div",{onClick:this.handleClickVolume,className:"player-volume"},this.operationVolumeButton()),_e.createElement("div",{className:"player-volume-slider"},_e.createElement(m0,{total:100,current:100*this.state.seekVolume,onChange:this.onVolumeChange,onSeekStart:this.onVolumeSeekStart,onSeekEnd:this.onVolumeSeekEnd,scale:this.props.scale,limitTimeTooltipBySides:!0,hideHoverTime:!0})))),_e.createElement("div",{className:"player-mid-box-time"},v0(Math.floor(i/1e3))," /"," ",v0(Math.floor(t/1e3)))))}}function v0(e){const t=e%60,i=(e-t)/60;if(i>=60){const n=i%60;return`${Aa((i-n)/60)}:${Aa(n)}:${Aa(t)}`}return`${Aa(i)}:${Aa(t)}`}function Aa(e){return e<=9?`0${e}`:`${e}`}let SD=99999;var mf,ws;(ws=mf||(mf={}))[ws.Idle=0]="Idle",ws[ws.Playing=1]="Playing",ws[ws.Paused=2]="Paused";let Dt={};function wt(e,...t){Mn.verbose&&console.log(`[RTCEffect] ${e}`,...t)}function MD(e,t,i){function n(o){Dt[o].playState===0?(e.playEffect(o,i,0,1,0,100,!1,0).then(()=>{wt(">>> Play Success",{playingId:o})}),Dt[o].playState=1):wt(">>> Skip Play",{playingId:o,state:Dt[o].playState})}function s(o){Dt[o].playState=0,Dt[o].previousVideoJSAdvance=0,Dt[o].previousSeekTargetTime=0,Dt[o].previousBeginSeekTime=0}t.one("ready",()=>{var o;const l=((o=t==null?void 0:t.tagAttributes)==null?void 0:o.src)||"";ZS.includes("."+l.split(".").pop()||"")||(wt(">>> Mute js player",{src:l}),t.muted(!0),t.muted=d=>!1);const c=function(){const d=SD--,f={playState:mf.Idle,previousVideoJSAdvance:0,previousSeekTargetTime:0,previousBeginSeekTime:0};return Dt[d]=f,d}();wt(">>> Setup",{playingId:c,src:l}),e.addListener("error",d=>{wt(">>> Error",{soundId:d}),s(d)}),e.addListener("effectFinished",d=>{wt(">>> Finished",{soundId:d}),s(d)}),t.on("play",()=>{switch(Dt[c].playState){case 0:wt(">>> Start play",{playingId:c}),n(c);break;case 2:wt(">>> Resume play",{playingId:c}),e.resumeEffect(c),Dt[c].playState=1}}),t.on("pause",()=>{const d=Dt[c].playState;switch(d){case 1:wt(">>> Pause play",{playingId:c}),e.pauseEffect(c),Dt[c].playState=2;break;default:wt(">>> Skip Pause",{playingId:c,currenState:d})}}),t.on("timeupdate",()=>{e.getEffectCurrentPosition(c).then(d=>{const f=Dt[c],g=d/1e3,v=t.currentTime(),M=f.previousSeekTargetTime!==0&&f.previousBeginSeekTime!==0;if(wt(`>>> EffectSecond rtc: ${g} js: ${v} seeking: ${M}`,{playingId:c}),f.playState==0)return void(t.paused()||(wt(">>> Play effect due to time update.",{playingId:c}),n(c)));if(M&&g<f.previousSeekTargetTime)return;if(f.playState!==1)return void wt(">>> Skip timupdate",{playingId:c,state:f.playState,jsTime:t.currentTime(),rtcEffectTime:g});function E(P,y){e.setEffectPosition(y,1e3*P),f.previousBeginSeekTime=Date.now()/1e3,f.previousSeekTargetTime=P}const _=f.previousBeginSeekTime;if(d>0){const P=v-g,y=Math.abs(P),x=.5;if(y>x)if(M){const I=f.previousSeekTargetTime-g,C=Date.now()/1e3-_,k=C+(P>0?P:0),L=v+k;E(L,c),wt(">>> Start seeking after seeking lag",{jsPlayerTime:v,rtcEffectTime:g,jsPlayerTimerAdvance:P,lastSeekingCost:C,estimatedRTCLag:k,targetRTCSeekTime:L,previousBeginSeekTime:_,timeElapse:I})}else if(y>10)E(v,c),wt(">>> DirectSeek",{time:v,rtcEffectTime:g,jsPlayerTimerAdvance:P});else{const I=f.previousVideoJSAdvance,C=0,k=v+C;f.previousVideoJSAdvance=C,E(k,c),wt(">>> Start seeking with lag",{jsPlayerTime:v,rtcEffectTime:g,jsPlayerTimerAdvance:P,previousAdvance:I,estimatedRTCLag:C,targetRTCSeekTime:k})}else M&&(wt(">>> SeekingFinish no lag",{jsPlayerTime:v,rtcEffectTime:g,jsPlayerTimerAdvance:P,previousBeginSeekTime:_,rtcLagTolerance:x}),f.previousBeginSeekTime=0,f.previousSeekTargetTime=0)}})}),t.on("dispose",()=>{Dt[c].playState&&(e.stopEffect(c),delete Dt[c],wt(">>> Dispose",{playingId:c}))})})}class w0 extends es.exports.Component{constructor(){super(...arguments),this.putAttributes=t=>{const{context:i}=this.props,n=i.getAttributes()||{};for(const s in t)n[s]!==t[s]&&i.updateAttributes([s],t[s])}}render(){const{context:t}=this.props,i=t.getRoom(),n=i?void 0:t.getDisplayer(),s=this.putAttributes;return _e.createElement(bD,{room:i,player:n,context:t,plugin:{putAttributes:s}})}}class bD extends es.exports.Component{constructor(t){super(t),this.alertMask=null,this.container=_e.createRef(),this.controllerHiddenTimer=0,this.syncPlayerTimer=0,this.retryCount=0,this.decreaseRetryTimer=0,this.noSoundSyncCount=0,this.everPlayed=!1,this.showController=()=>{this.setState({controllerVisible:!0}),this.debounceHidingController()},this.play=()=>{var i;const n=(i=this.props.room)==null?void 0:i.calibrationTimestamp;this.debug(">>> play",{paused:!1,hostTime:n}),this.isEnabled()&&this.props.plugin.putAttributes({paused:!1,hostTime:n})},this.pause=()=>{const i=Ul(this.getAttributes(),this.props);this.debug(">>> pause",{paused:!0,currentTime:i}),this.isEnabled()&&this.props.plugin.putAttributes({paused:!0,currentTime:i})},this.setVolume=i=>{this.debug(">>> volume",{volume:i}),this.isEnabled()&&this.props.plugin.putAttributes({volume:i}),this.isEnabled()&&this.props.plugin.putAttributes({volume:i,muted:i===0})},this.setCurrentTime=i=>{var n;const s=(n=this.props.room)==null?void 0:n.calibrationTimestamp;this.debug(">>> seek",{currentTime:i/1e3,hostTime:s}),this.isEnabled()&&this.props.plugin.putAttributes({currentTime:i/1e3,hostTime:s})},this.resetPlayer=()=>{var i;(i=this.player)==null||i.autoplay(!1),this.state.NoSound||(this.debug(">>> ended",{paused:!0,currentTime:0}),this.isEnabled()&&this.props.plugin.putAttributes({paused:!0,currentTime:0}))},this.syncPlayerWithAttributes=()=>{var i;const n=this.getAttributes();if(!n)return;const s=this.player;if(!s||this.state.NoSound&&(this.noSoundSyncCount+=1)%8!=0)return;s.paused()!==n.paused&&(this.debug("<<< paused -> %o",n.paused),n.paused?s.pause():((i=s.play())==null||i.catch(this.catchPlayFail),this.everPlayed=!0)),s.muted()!==n.muted&&(this.debug("<<< muted -> %o",n.muted),s.muted(n.muted)),s.volume()!==n.volume&&(this.debug("<<< volume -> %o",n.volume),s.volume(n.volume));const o=Ul(n,this.props);let l=Mn.currentTimeMaxError;if(this.state.NoSound&&(l*=3),o>s.duration())this.resetPlayer();else if(Math.abs(s.currentTime()-o)>l){if(this.debug("<<< currentTime -> %o",o),rD)return void(this.everPlayed?s.currentTime(o):this.debug("<<< ignore iOS idle time update. -> %o (ignored)",o));s.currentTime(o)}},this.debounceHidingController=()=>{this.controllerHiddenTimer&&(clearTimeout(this.controllerHiddenTimer),this.controllerHiddenTimer=0),this.controllerHiddenTimer=setTimeout(()=>{this.setState({controllerVisible:!1}),this.controllerHiddenTimer=0},3e3)},this.decreaseRetryCount=()=>{this.player&&this.retryCount>0&&(this.retryCount=this.retryCount-1)},this.catchPlayFail=i=>{var n,s;const o=String(i);if(nD&&o.includes("NotAllowedError")||o.includes("interact"))(n=this.player)==null||n.autoplay("any"),this.setState({NoSound:!0});else{const l=(s=this.player)==null?void 0:s.error();l&&(this.retryCount<=3?(this.initPlayer(),this.retryCount=this.retryCount+1):(this.debug("catch videojs media error",l),this.setState({MediaError:!0}))),this.debug("catch error",i)}},this.fixPlayFail=()=>{this.debug("try to fix play state"),this.setState({NoSound:!1});const{muted:i,volume:n}=this.getAttributes();this.player&&(this.player.muted(i),this.player.volume(n))},this.initPlayer=async()=>{var i;(i=this.player)==null||i.dispose(),this.player=void 0,this.debug("creating elements ...");const{type:n,src:s,poster:o}=this.getAttributes(),l=document.createElement("div");l.setAttribute("data-vjs-player","");const c=document.createElement("video");c.className="video-js",c.crossOrigin="anonymous",o&&(c.poster=o),c.setAttribute("playsInline",""),c.setAttribute("webkit-playsinline","");const d=document.createElement("source");new URL(s).pathname.endsWith(".m3u8")?d.type="application/x-mpegURL":c.src=s,d.src=s,n&&(d.type=n),c.appendChild(d),l.appendChild(c),this.container.current.appendChild(l),await new Promise(M=>(window.requestAnimationFrame||window.setTimeout)(M)),this.debug("initializing videojs() ...");const f=kv.default(c);this.player=f,window.player=f,f.one("loadedmetadata",this.gracefullyUpdate);const g=window.__mediaPlayerAudioEffectClient;g!==void 0&&MD(g,f,s);const v=window.__pcmProxy;v!==void 0&&(f.one("play",()=>{const M=v.connect(c);this.audioSource=M,this.debug("Connect to PCMProxy ",s)}),f.one("dispose",()=>{this.audioSource&&(this.audioSource.disconnect(),this.audioSource=void 0,this.debug("Disconnect from PCMProxy",s))})),f.on("ready",()=>{var M;(M=Mn.onPlayer)==null||M.call(Mn,f),f.on("timeupdate",this.gracefullyUpdate),f.on("volumechange",this.gracefullyUpdate),f.on("seeked",this.gracefullyUpdate),f.on("play",this.gracefullyUpdate),f.on("pause",this.gracefullyUpdate),f.on("ended",this.resetPlayer)}),f.on("error",this.catchPlayFail),this.setState({MediaError:!1})},this.gracefullyUpdate=()=>this.setState({updater:!this.state.updater}),this.setupAlert=i=>{i&&(i.addEventListener("touchstart",this.fixPlayFail),i.addEventListener("click",this.fixPlayFail)),this.alertMask=i},this.setupReload=i=>{i&&(i.addEventListener("touchstart",this.initPlayer),i.addEventListener("click",this.initPlayer))},this.state={NoSound:!1,MediaError:!1,updater:!1,controllerVisible:!1},t.room&&function(i){if(!i.calibrationTimestamp)throw new Error("@netless/app-media-player@0.1.0-alpha.5 requires white-web-sdk@^2.13.8 to work properly.")}(t.room)}getAttributes(){const{context:t}=this.props;let i=t.getAttributes();if(i){if(i=di(di({},FS),i),this.player){let s=Ul(i,this.props),o=this.player.duration();!i.paused&&s>o&&(n=di({},i),i=Jz(n,Kz({currentTime:0,paused:!0})),this.resetPlayer())}var n;return i}}isShowingPoster(){const t=this.getAttributes();return!(t!=null&&t.src)||ZS.some(i=>t.src.endsWith(i))}render(){var t,i;if(!this.props.room&&!this.props.player)return null;const n=this.getAttributes();if(!n)return null;const s=1e3*(((t=this.player)==null?void 0:t.duration())||1e3),o=((i=this.player)==null?void 0:i.bufferedPercent())||0;return _e.createElement("div",{className:this.isEnabled()?"vjs-p":"vjs-p disabled",onMouseEnter:this.showController,onMouseMove:this.showController},_e.createElement("div",{className:"video-js-plugin-player",ref:this.container}),this.isShowingPoster()&&_e.createElement("div",{className:"video-js-plugin-poster"},n.poster&&_e.createElement("img",{src:n.poster,alt:"",draggable:!1})),_e.createElement(xD,{duration:s,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*Ul(n,this.props),setCurrentTime:this.setCurrentTime,buffered:s*o,visible:!0}),this.state.NoSound&&_e.createElement("div",{ref:this.setupAlert,className:"videojs-plugin-muted-alert"}),this.state.MediaError&&_e.createElement("div",{className:"videojs-plugin-recovery-mode"},_e.createElement("button",{ref:this.setupReload},"Reload Player")))}debug(t,...i){Mn.verbose&&Mn.log(`[MediaPlayer] ${t}`,...i)}componentDidMount(){this.debug("app version =","0.1.0-alpha.5"),this.debug("video.js version =",kv.default.VERSION),this.initPlayer(),this.props.context.emitter.on("attributesUpdate",this.syncPlayerWithAttributes),this.syncPlayerTimer=setInterval(this.syncPlayerWithAttributes,Mn.syncInterval),this.decreaseRetryTimer=setInterval(this.decreaseRetryCount,Mn.retryInterval)}componentWillUnmount(){var t;this.debug("unmount"),this.props.context.emitter.off("attributesUpdate",this.syncPlayerWithAttributes),(t=this.player)==null||t.dispose(),clearInterval(this.syncPlayerTimer),clearInterval(this.decreaseRetryTimer)}isEnabled(){return this.props.context.getIsWritable()}}const CD={kind:"MediaPlayer",setup(e){let t=e.getAttributes();if(!t||!t.src)return e.emitter.emit("destroy",{error:new Error("[MediaPlayer]: Missing 'attributes'.'src'.")});t=di(di({},FS),t);const i=e.getBox();i.mountStyles(`.vjs-p{display:flex;flex-grow:1}.vjs-p *{pointer-events:auto}.vjs-p.disabled *{pointer-events:none}.vjs-p .video-js-plugin-poster{position:absolute;top:0;left:0;right:0;bottom:0;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgQAAACACAYAAAB0vHFxAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACBKADAAQAAAABAAAAgAAAAACE3oPTAAAKXUlEQVR4Ae3dYW4ktxEG0LW9FwkC2McycokAOUGAXMLwtQwYvomdP4akHUnNnm6SVUU+/xqpe8ji+yiDWz3a/e7L5v/98se//3pL8K9//O+7t19Hv85eX7RP9vnllz2h4/rkd+wz+ir/0cLfjv/9t1/6igABAgQIENhRwIFgx9StmQABAgQIPAg4EDyA+JIAAQIECOwo8HXHRVvzPIHRzwBHjz9PKudMo31Hj59TdZ2qsueXvb5sO0GHIFsi6iFAgAABAgECOgQB6KbsJ5Dtt0L6rWyPkeRXO+fs+WWvL1v6OgTZElEPAQIECBAIENAhCEA3ZT8Bzwj7WUaMJL8I9X5zZs8ve339kugzkg5BH0ejECBAgACB0gIOBKXjUzwBAgQIEOgj4EDQx9EoBAgQIECgtIADQen4FE+AAAECBPoIOBD0cTQKAQIECBAoLeC3DErHp/iWgE8Zt4RyX5df7nxa1Y3Ob/T4rfWtdl2HYLVErYcAAQIECFwQWL5DsPoJcvX1XdjTpd4iv1JxvStWfu9IfCORwLP7U4cgUXhKIUCAAAECUQIOBFHy5iVAgAABAokEHAgShaEUAgQIECAQJXD7MwTPPqOIWujVeUevb/T4V9ftfecE5HfOKetd8suajLoiBHQIItTNSYAAAQIEkgnc7hAkW0/3ckb/e9qjx+8OYsBvBOT3DUe5L+RXLjIFDxTQIRiIa2gCBAgQIFBFoNkh2P0Z2+j1jx4/+0asvv7q9d/dH9XXX73+3fO7u/7W+3fbHzoErR3hOgECBAgQ2ECg2SHwjG2DXRC4xOj9tdufAHpHLb/eonPHk9+xd7TPcXX9r+oQ9Dc1IgECBAgQKCfgQFAuMgUTIECAAIH+Ag4E/U2NSIAAAQIEygk0P0MQvaLsz3hb9bWu840WOJ5ffsc+2a/KL3tC6jsSmL1/dQiO0nCNAAECBAhsItDsEMw+oTzrHl1f61OorevPrvfZ+6N9WvVmr09+xwnKr7ZP9vyOdcdfze7Tuz4dgvF7ygwECBAgQCC9QLNDkH0F0X+C45NdoHZ99rf8aguofqRA7/8/6BCMTMvYBAgQIECgiED5DkHvZyhFcjtdJp/TVClvlF/KWE4XJb/TVG68INB7f+kQXAjBWwgQIECAwGoCDgSrJWo9BAgQIEDggoADwQU0byFAgAABAqsJfO39DGI1IOuJFbA/Y/3vzi6/u4Kx7189v7vru/v+2HTfz65D8N7EdwgQIECAwHYCw3/LYLUT1HY7pLFg+TaAkl+WX/KAGuXJrwEUfLlaPjoEwRvG9AQIECBAIIPA8A5B779JKQOaGl4F5PtqUfGV/Cqm9lqz/F4tMr6qlo8OQcZdpCYCBAgQIDBZYHiHoNozlMn+5aeTb+0I5Se/2gK5q6/286VDkHs/qY4AAQIECEwRcCCYwmwSAgQIECCQW8CBIHc+qiNAgAABAlMEhn+GYMoqTEKAAAEC7wSqPcN+twDfmCqgQzCV22QECBAgQCCnQHiHoPoJtlV/63rObfFaVfX6X1dy7VX19Vev/1pqr++qvv7q9b8m4dVHAtny1SH4KCXfI0CAAAECmwmEdwiq/U1Om+2PL/Kpnbj85FdbYO3qs/186hCsvd+sjgABAgQInBJwIDjF5CYCBAgQILC2gAPB2vlaHQECBAgQOCUQ/hmCbJ+yPKW20U3yqR22/ORXW2Dt6qN/Ph/n1yFYe79ZHQECBAgQOCXgQHCKyU0ECBAgQGBtAQeCtfO1OgIECBAgcErAgeAUk5sIECBAgMDaAg4Ea+drdQQIECBA4JTA1+///OGnoztd52N/fC7g58PPx+e748sX+8P+qLQ/dAiO0nKNAAECBAhsIuBAsEnQlkmAAAECBI4EHAiOdFwjQIAAAQKbCDgQbBK0ZRIgQIAAgSMBB4IjHdcIECBAgMAmAuH/lsHP//zvb5tYl1ymfErG9lK0/F4oSr6QX8nYThcdne/j/DoEp6NzIwECBAgQWFfAgWDdbK2MAAECBAicFnAgOE3lRgIECBAgsK5A+GcIfv39Pz++5X18pvH2mtfzBeQz37znjPLrqTl/LPnNN585Y7Z8dQhmpm8uAgQIECCQVCC8Q1C9I9Cqv3U96b54Kat6/S8Lufii+vqr138xtpe3VV9/9fpfgvDiQ4Fs+eoQfBiTbxIgQIAAgb0EwjsEe3FbLQECBOYJZPsT6LyVm+mKgA7BFTXvIUCAAAECiwk4ECwWqOUQIECAAIErAg4EV9S8hwABAgQILCYw/DMEnmEttmMeliPfB5BiX8qvWGAP5crvASTZl9Xy0SFItoGUQ4AAAQIEIgSGdwiy/U1MEcgrzynf2unKT361BXJXX+3nS4cg935SHQECBAgQmCIwvENQ7RnKFPWFJpFv7TDlJ7/aArmrr/bzpUOQez+pjgABAgQITBH4Wu0EM0XFJGkE7M80UVwqRH6X2NK8afX87q7v7vvTBP13IToE2RJRDwECBAgQCBBwIAhANyUBAgQIEMgm4ECQLRH1ECBAgACBAIHhv2Uwek2rPcPp7cWnt+jc8eQ317v3bPLrLWq8twK995cOwVtdrwkQIECAwKYC5TsE1f4mqNn7jM9s8b7zya+v5+zR5DdbfK/5eu8vHYK99o/VEiBAgACBDwWaHYLezyg+rOLGN6Pra53QWtdvLP3UW6N9WkVmr09+xwnKr7ZP9vyOdcdfze7Tuz4dgvF7ygwECBAgQCC9QLNDEL2C3ieg3utp1de63rueZ8fLXt+z6+l9f3af7PX1zuPZ8bL7ZK/vWW/39xWYvT90CPrmZzQCBAgQIFBSwIGgZGyKJkCAAAECfQUcCPp6Go0AAQIECJQUaH6GIPpT1iVVFX1aIHp/zX5GdxqmyI3yKxLUJ2XK7xOYv78d7XNcXf+rOgT9TY1IgAABAgTKCTQ7BLv/CWr0+kePn31HVl9/9frv7o/q669e/+753V1/6/277Q8dgtaOcJ0AAQIECGwg0OwQbGBwuMTRz5BGj3+4OBdvC8jvNmHoAPIL5Td5MgEdgmSBKIcAAQIECEQI3O4QrP6MZfT6Ro8fsal2mlN+tdOWX+38VN9XQIegr6fRCBAgQIBASQEHgpKxKZoAAQIECPQVcCDo62k0AgQIECBQUuD2Zwiyr3r1Z4Srry/7/rpbn/zuCsa+X36x/mY/Fnh2f+oQHHu6SoAAAQIEthBYvkOwRYoW+anAsyfkTwdyIURAfiHs3SYdnd/o8btBFBlIh6BIUMokQIAAAQIjBRwIRuoamwABAgQIFBFwICgSlDIJECBAgMBIAQeCkbrGJkCAAAECRQQcCIoEpUwCBAgQIDBSwG8ZjNQ19nABnzIeTjx0AvkN5R0+ePb8stc3PKAnJ9AheBLM7QQIECBAYEUBHYIVU91oTf49+9phy09+IwXsr+d0dQie83I3AQIECBBYUkCHYMlY8yxq9DO80ePnkYypZLTv6PFj1PaZNXt+2evLtlN0CLIloh4CBAgQIBAg4EAQgG5KAgQIECCQTcCBIFsi6iFAgAABAgEC/wdVfx9UuC8B6AAAAABJRU5ErkJggg==);background-repeat:repeat-x;background-position:0 50%;display:flex;align-items:center;justify-content:center}.vjs-p .video-js-plugin-poster img{box-shadow:0 0 5px 10px #0006}.vjs-p .player-controller,.vjs-p .videojs-plugin-muted-alert{pointer-events:auto}.vjs-p.disabled .videojs-plugin-close-icon,.vjs-p.disabled .player-controller{pointer-events:none}.vjs-p .video-js-plugin-player{position:absolute;top:0;left:0;right:0;bottom:0}.video-js,[data-vjs-player]{width:100%;height:100%}.vjs-p .videojs-plugin-muted-alert{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:43}.vjs-p .videojs-plugin-muted-alert:before{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:43;content:"\\f104";background:rgba(0,0,0,.3);font-family:VideoJS;font-size:2em;display:flex;align-items:center;justify-content:center;color:#fff}.vjs-p .videojs-plugin-recovery-mode{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:44}.vjs-p .videojs-plugin-recovery-mode button{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.vjs-p .seek-slider{position:relative;width:100%}.vjs-p .seek-slider:focus{outline:none}.vjs-p .seek-slider .track{padding:10px 0;cursor:pointer;outline:none}.vjs-p .seek-slider .track:focus{border:0;outline:none}.vjs-p .seek-slider .track .main{width:100%;height:3px;background-color:#ffffff4d;border-radius:30px;position:absolute;left:0;top:8.5px;transition:transform .4s;outline:none}.vjs-p .seek-slider .track .main:focus{border:0;outline:none}.vjs-p .seek-slider .track .main .buffered{position:absolute;background-color:#ffffff4d;width:100%;height:100%;transform:scaleX(.8);z-index:2;transform-origin:0 0}.vjs-p .seek-slider .track .main .seek-hover{position:absolute;background-color:#ffffff80;width:100%;height:100%;z-index:1;transform:scaleX(.6);transform-origin:0 0;opacity:0;transition:opacity .4s}.vjs-p .seek-slider .track .main .connect{position:absolute;background-color:#fff;width:100%;height:100%;z-index:3;left:0;transform:scaleX(.13);transform-origin:0 0}.vjs-p .seek-slider .track.active .main{transform:scaleY(2)}.vjs-p .seek-slider .thumb{pointer-events:none;position:absolute;width:12px;height:12px;left:-6px;top:4px;z-index:4;transform:translate(100px)}.vjs-p .seek-slider .thumb .handler{border-radius:100%;width:100%;height:100%;background-color:#fff;opacity:0;transform:scale(.4);cursor:pointer;transition:transform .2s;pointer-events:none}.vjs-p .seek-slider .thumb.active .handler{opacity:1;transform:scale(1)}.vjs-p .seek-slider .hover-time{position:absolute;background-color:#0000004d;line-height:18px;font-size:16px;color:#ddd;top:-25px;left:0;padding:5px 10px;border-radius:5px;box-shadow:0 0 5px #0000004d;opacity:0;transform:translate(150px);pointer-events:none}.vjs-p .seek-slider .hover-time.active{opacity:1}.vjs-p .seek-slider:hover .track .main .seek-hover{opacity:1}.vjs-p .player-controller{position:absolute;z-index:100;bottom:0px;left:0;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:stretch;height:64px;background-image:linear-gradient(0deg,#000,transparent);transition:opacity .2s;color:#fff}.vjs-p .player-menu-box{display:flex;align-items:center;justify-content:center;flex-direction:column;margin-bottom:40px}.vjs-p .player-menu-cell{width:100%;text-align:center;font-size:12px;color:#7a7b7c}.vjs-p .player-multiple-play{width:64px;height:120px}.vjs-p .player-controller-actions-left{display:flex;justify-content:center;align-items:center;flex-shrink:0}.vjs-p .player-right-box{font-size:14px;color:#7a7b7c;cursor:pointer;margin-right:12px}.vjs-p .player-controller-actions{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-left:8px;padding-right:8px;margin-top:2px}.vjs-p .player-mid-box-time{font-size:9px;display:flex;justify-content:center;align-items:center;color:#fff;flex-shrink:0;margin-right:8px;font-family:monospace}.vjs-p .player-controller-play{display:flex;align-items:center;justify-content:center;cursor:pointer;padding-right:4px}.vjs-p .player-controller-progress{width:calc(100% - 28px);margin-left:14px;display:flex;align-items:center;justify-content:center;margin-top:8px}.vjs-p .player-volume{display:flex;align-items:center;justify-content:center;cursor:pointer;margin-right:16px;margin-left:8px}.vjs-p .player-volume-slider{width:60px;margin-right:12px;display:flex;align-items:center}.vjs-p .player-volume-box{display:flex;flex-direction:row}.netless-app-media-player-container{display:flex;position:relative;height:100%}
|
|
46
|
-
`);const n=document.createElement("div");if(n.classList.add("netless-app-media-player-container"),jl.render(_e.createElement(w0,{context:e}),n),i.mountContent(n),e.emitter.on("destroy",()=>{console.log("[MediaPlayer]: destroy"),jl.unmountComponentAtNode(n)}),window.__pcmProxy){const s=()=>{document.visibilityState==="hidden"?(console.log("[MediaPlayer]: visibilitychange -> hidden. unmount for pcmproxy"),jl.unmountComponentAtNode(n)):(console.log("[MediaPlayer]: visibilitychange -> visible. mount for pcmproxy"),jl.render(_e.createElement(w0,{context:e}),n))};document.addEventListener("visibilitychange",s),e.emitter.on("destroy",()=>{document.removeEventListener("visibilitychange",s)})}}};var ID=Object.freeze(Object.defineProperty({__proto__:null,Version:tD,default:CD,setOptions:iD},Symbol.toStringTag,{value:"Module"})),AD=`.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}
|
|
47
|
-
`;const TD=(e,t,i,n)=>{if(i==="length"||i==="prototype"||i==="arguments"||i==="caller")return;const s=Object.getOwnPropertyDescriptor(e,i),o=Object.getOwnPropertyDescriptor(t,i);!ED(s,o)&&n||Object.defineProperty(e,i,o)},ED=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},_D=(e,t)=>{const i=Object.getPrototypeOf(t);i!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,i)},PD=(e,t)=>`/* Wrapped ${e}*/
|
|
48
|
-
${t}`,ND=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),kD=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),BD=(e,t,i)=>{const n=i===""?"":`with ${i.trim()}() `,s=PD.bind(null,n,t.toString());Object.defineProperty(s,"name",kD),Object.defineProperty(e,"toString",{...ND,value:s})};function zD(e,t,{ignoreNonConfigurable:i=!1}={}){const{name:n}=e;for(const s of Reflect.ownKeys(t))TD(e,t,s,i);return _D(e,t),BD(e,t,n),e}const DD=(e,t={})=>{if(typeof e!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);const{wait:i=0,maxWait:n=Number.POSITIVE_INFINITY,before:s=!1,after:o=!0}=t;if(!s&&!o)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let l,c,d;const f=function(...g){const v=this,M=()=>{l=void 0,c&&(clearTimeout(c),c=void 0),o&&(d=e.apply(v,g))},E=()=>{c=void 0,l&&(clearTimeout(l),l=void 0),o&&(d=e.apply(v,g))},_=s&&!l;return clearTimeout(l),l=setTimeout(M,i),n>0&&n!==Number.POSITIVE_INFINITY&&!c&&(c=setTimeout(E,n)),_&&(d=e.apply(v,g)),d};return zD(f,e),f.cancel=()=>{l&&(clearTimeout(l),l=void 0),c&&(clearTimeout(c),c=void 0)},f};var LD="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",RD=87,OD=20,y0=[],VD=()=>{for(let e=0;e<OD;e++)y0[e]=LD.charAt(Math.random()*RD);return y0.join("")};function GS(e){try{return e()}catch(t){console.error(t)}}var lc=class{constructor(){this.push=this.addDisposer,this.disposers=new Map}addDisposer(e,t=this.genUID()){return this.flush(t),this.disposers.set(t,Array.isArray(e)?$D(e):e),t}add(e,t=this.genUID()){const i=e();return i?this.addDisposer(i,t):t}addEventListener(e,t,i,n,s=this.genUID()){return e.addEventListener(t,i,n),this.addDisposer(()=>e.removeEventListener(t,i,n),s),s}setTimeout(e,t,i=this.genUID()){const n=window.setTimeout(()=>{this.remove(i),e()},t);return this.addDisposer(()=>window.clearTimeout(n),i)}setInterval(e,t,i=this.genUID()){const n=window.setInterval(e,t);return this.addDisposer(()=>window.clearInterval(n),i)}remove(e){const t=this.disposers.get(e);return this.disposers.delete(e),t}flush(e){const t=this.remove(e);t&&t()}flushAll(){this.disposers.forEach(GS),this.disposers.clear()}genUID(){let e;do e=VD();while(this.disposers.has(e));return e}};function $D(e){return()=>e.forEach(GS)}var Fr=[],jD=function(){return Fr.some(function(e){return e.activeTargets.length>0})},UD=function(){return Fr.some(function(e){return e.skippedTargets.length>0})},x0="ResizeObserver loop completed with undelivered notifications.",WD=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:x0}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=x0),window.dispatchEvent(e)},uo;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(uo||(uo={}));var Hr=function(e){return Object.freeze(e)},FD=function(){function e(t,i){this.inlineSize=t,this.blockSize=i,Hr(this)}return e}(),XS=function(){function e(t,i,n,s){return this.x=t,this.y=i,this.width=n,this.height=s,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Hr(this)}return e.prototype.toJSON=function(){var t=this,i=t.x,n=t.y,s=t.top,o=t.right,l=t.bottom,c=t.left,d=t.width,f=t.height;return{x:i,y:n,top:s,right:o,bottom:l,left:c,width:d,height:f}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Bp=function(e){return e instanceof SVGElement&&"getBBox"in e},JS=function(e){if(Bp(e)){var t=e.getBBox(),i=t.width,n=t.height;return!i&&!n}var s=e,o=s.offsetWidth,l=s.offsetHeight;return!(o||l||e.getClientRects().length)},S0=function(e){var t;if(e instanceof Element)return!0;var i=(t=e==null?void 0:e.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(i&&e instanceof i.Element)},HD=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Ga=typeof window!="undefined"?window:{},Fl=new WeakMap,M0=/auto|scroll/,ZD=/^tb|vertical/,QD=/msie|trident/i.test(Ga.navigator&&Ga.navigator.userAgent),Yi=function(e){return parseFloat(e||"0")},Rs=function(e,t,i){return e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=!1),new FD((i?t:e)||0,(i?e:t)||0)},b0=Hr({devicePixelContentBoxSize:Rs(),borderBoxSize:Rs(),contentBoxSize:Rs(),contentRect:new XS(0,0,0,0)}),KS=function(e,t){if(t===void 0&&(t=!1),Fl.has(e)&&!t)return Fl.get(e);if(JS(e))return Fl.set(e,b0),b0;var i=getComputedStyle(e),n=Bp(e)&&e.ownerSVGElement&&e.getBBox(),s=!QD&&i.boxSizing==="border-box",o=ZD.test(i.writingMode||""),l=!n&&M0.test(i.overflowY||""),c=!n&&M0.test(i.overflowX||""),d=n?0:Yi(i.paddingTop),f=n?0:Yi(i.paddingRight),g=n?0:Yi(i.paddingBottom),v=n?0:Yi(i.paddingLeft),M=n?0:Yi(i.borderTopWidth),E=n?0:Yi(i.borderRightWidth),_=n?0:Yi(i.borderBottomWidth),P=n?0:Yi(i.borderLeftWidth),y=v+f,x=d+g,I=P+E,C=M+_,k=c?e.offsetHeight-C-e.clientHeight:0,L=l?e.offsetWidth-I-e.clientWidth:0,W=s?y+I:0,Q=s?x+C:0,J=n?n.width:Yi(i.width)-W-L,K=n?n.height:Yi(i.height)-Q-k,De=J+y+L+I,U=K+x+k+C,z=Hr({devicePixelContentBoxSize:Rs(Math.round(J*devicePixelRatio),Math.round(K*devicePixelRatio),o),borderBoxSize:Rs(De,U,o),contentBoxSize:Rs(J,K,o),contentRect:new XS(v,d,J,K)});return Fl.set(e,z),z},qS=function(e,t,i){var n=KS(e,i),s=n.borderBoxSize,o=n.contentBoxSize,l=n.devicePixelContentBoxSize;switch(t){case uo.DEVICE_PIXEL_CONTENT_BOX:return l;case uo.BORDER_BOX:return s;default:return o}},YD=function(){function e(t){var i=KS(t);this.target=t,this.contentRect=i.contentRect,this.borderBoxSize=Hr([i.borderBoxSize]),this.contentBoxSize=Hr([i.contentBoxSize]),this.devicePixelContentBoxSize=Hr([i.devicePixelContentBoxSize])}return e}(),e1=function(e){if(JS(e))return 1/0;for(var t=0,i=e.parentNode;i;)t+=1,i=i.parentNode;return t},GD=function(){var e=1/0,t=[];Fr.forEach(function(l){if(l.activeTargets.length!==0){var c=[];l.activeTargets.forEach(function(f){var g=new YD(f.target),v=e1(f.target);c.push(g),f.lastReportedSize=qS(f.target,f.observedBox),v<e&&(e=v)}),t.push(function(){l.callback.call(l.observer,c,l.observer)}),l.activeTargets.splice(0,l.activeTargets.length)}});for(var i=0,n=t;i<n.length;i++){var s=n[i];s()}return e},C0=function(e){Fr.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(s){s.isActive()&&(e1(s.target)>e?i.activeTargets.push(s):i.skippedTargets.push(s))})})},XD=function(){var e=0;for(C0(e);jD();)e=GD(),C0(e);return UD()&&WD(),e>0},sd,t1=[],JD=function(){return t1.splice(0).forEach(function(e){return e()})},KD=function(e){if(!sd){var t=0,i=document.createTextNode(""),n={characterData:!0};new MutationObserver(function(){return JD()}).observe(i,n),sd=function(){i.textContent="".concat(t?t--:t++)}}t1.push(e),sd()},qD=function(e){KD(function(){requestAnimationFrame(e)})},du=0,eL=function(){return!!du},tL=250,iL={attributes:!0,characterData:!0,childList:!0,subtree:!0},I0=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],A0=function(e){return e===void 0&&(e=0),Date.now()+e},ad=!1,nL=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var i=this;if(t===void 0&&(t=tL),!ad){ad=!0;var n=A0(t);qD(function(){var s=!1;try{s=XD()}finally{if(ad=!1,t=n-A0(),!eL())return;s?i.run(1e3):t>0?i.run(t):i.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,i=function(){return t.observer&&t.observer.observe(document.body,iL)};document.body?i():Ga.addEventListener("DOMContentLoaded",i)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),I0.forEach(function(i){return Ga.addEventListener(i,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),I0.forEach(function(i){return Ga.removeEventListener(i,t.listener,!0)}),this.stopped=!0)},e}(),vf=new nL,T0=function(e){!du&&e>0&&vf.start(),du+=e,!du&&vf.stop()},rL=function(e){return!Bp(e)&&!HD(e)&&getComputedStyle(e).display==="inline"},sL=function(){function e(t,i){this.target=t,this.observedBox=i||uo.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=qS(this.target,this.observedBox,!0);return rL(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),aL=function(){function e(t,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=i}return e}(),Hl=new WeakMap,E0=function(e,t){for(var i=0;i<e.length;i+=1)if(e[i].target===t)return i;return-1},Zl=function(){function e(){}return e.connect=function(t,i){var n=new aL(t,i);Hl.set(t,n)},e.observe=function(t,i,n){var s=Hl.get(t),o=s.observationTargets.length===0;E0(s.observationTargets,i)<0&&(o&&Fr.push(s),s.observationTargets.push(new sL(i,n&&n.box)),T0(1),vf.schedule())},e.unobserve=function(t,i){var n=Hl.get(t),s=E0(n.observationTargets,i),o=n.observationTargets.length===1;s>=0&&(o&&Fr.splice(Fr.indexOf(n),1),n.observationTargets.splice(s,1),T0(-1))},e.disconnect=function(t){var i=this,n=Hl.get(t);n.observationTargets.slice().forEach(function(s){return i.unobserve(t,s.target)}),n.activeTargets.splice(0,n.activeTargets.length)},e}(),oL=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Zl.connect(this,t)}return e.prototype.observe=function(t,i){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!S0(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Zl.observe(this,t,i)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!S0(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Zl.unobserve(this,t)},e.prototype.disconnect=function(){Zl.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function lL(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-sidebar`),i.setAttribute("viewBox","0 0 64 64");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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"),i.appendChild(n),i}function uL(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-arrow-left`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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"),i.appendChild(n),i}function cL(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-arrow-right`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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"),i.appendChild(n),i}function hL(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-play`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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"),i.appendChild(n),i}function dL(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-pause`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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"),i.appendChild(n),i}const fr=typeof window!="undefined",i1=fr&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),n1=fr&&"IntersectionObserver"in window,r1=fr&&"classList"in document.createElement("p"),s1=fr&&window.devicePixelRatio>1,fL={elements_selector:".lazy",container:i1||fr?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},a1=e=>Object.assign({},fL,e),_0=function(e,t){let i;const n="LazyLoad::Initialized",s=new e(t);try{i=new CustomEvent(n,{detail:{instance:s}})}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent(n,!1,!1,{instance:s})}window.dispatchEvent(i)},pL=(e,t)=>{if(!!t)if(!t.length)_0(e,t);else for(let i=0,n;n=t[i];i+=1)_0(e,n)},Nn="src",zp="srcset",Dp="sizes",o1="poster",Bo="llOriginalAttrs",l1="data",Lp="loading",u1="loaded",c1="applied",gL="entered",Rp="error",h1="native",d1="data-",f1="ll-status",Jt=(e,t)=>e.getAttribute(d1+t),mL=(e,t,i)=>{const n=d1+t;if(i===null){e.removeAttribute(n);return}e.setAttribute(n,i)},zo=e=>Jt(e,f1),is=(e,t)=>mL(e,f1,t),uc=e=>is(e,null),Op=e=>zo(e)===null,vL=e=>zo(e)===Lp,wL=e=>zo(e)===Rp,Vp=e=>zo(e)===h1,yL=[Lp,u1,c1,Rp],xL=e=>yL.indexOf(zo(e))>=0,pr=(e,t,i,n)=>{if(!(!e||typeof e!="function")){if(n!==void 0){e(t,i,n);return}if(i!==void 0){e(t,i);return}e(t)}},qs=(e,t)=>{if(t!==""){if(r1){e.classList.add(t);return}e.className+=(e.className?" ":"")+t}},qi=(e,t)=>{if(t!==""){if(r1){e.classList.remove(t);return}e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")}},SL=e=>{e.llTempImage=document.createElement("IMG")},ML=e=>{delete e.llTempImage},p1=e=>e.llTempImage,cc=(e,t)=>{if(!t)return;const i=t._observer;!i||i.unobserve(e)},bL=e=>{e.disconnect()},CL=(e,t,i)=>{t.unobserve_entered&&cc(e,i)},$p=(e,t)=>{!e||(e.loadingCount+=t)},IL=e=>{!e||(e.toLoadCount-=1)},g1=(e,t)=>{!e||(e.toLoadCount=t)},AL=e=>e.loadingCount>0,TL=e=>e.toLoadCount>0,m1=e=>{let t=[];for(let i=0,n;n=e.children[i];i+=1)n.tagName==="SOURCE"&&t.push(n);return t},jp=(e,t)=>{const i=e.parentNode;if(!i||i.tagName!=="PICTURE")return;m1(i).forEach(t)},v1=(e,t)=>{m1(e).forEach(t)},hc=[Nn],w1=[Nn,o1],co=[Nn,zp,Dp],y1=[l1],dc=e=>!!e[Bo],x1=e=>e[Bo],S1=e=>delete e[Bo],Hs=(e,t)=>{if(dc(e))return;const i={};t.forEach(n=>{i[n]=e.getAttribute(n)}),e[Bo]=i},EL=e=>{dc(e)||(e[Bo]={backgroundImage:e.style.backgroundImage})},_L=(e,t,i)=>{if(!i){e.removeAttribute(t);return}e.setAttribute(t,i)},Jr=(e,t)=>{if(!dc(e))return;const i=x1(e);t.forEach(n=>{_L(e,n,i[n])})},PL=e=>{if(!dc(e))return;const t=x1(e);e.style.backgroundImage=t.backgroundImage},M1=(e,t,i)=>{qs(e,t.class_applied),is(e,c1),i&&(t.unobserve_completed&&cc(e,t),pr(t.callback_applied,e,i))},b1=(e,t,i)=>{qs(e,t.class_loading),is(e,Lp),i&&($p(i,1),pr(t.callback_loading,e,i))},or=(e,t,i)=>{!i||e.setAttribute(t,i)},P0=(e,t)=>{or(e,Dp,Jt(e,t.data_sizes)),or(e,zp,Jt(e,t.data_srcset)),or(e,Nn,Jt(e,t.data_src))},NL=(e,t)=>{jp(e,i=>{Hs(i,co),P0(i,t)}),Hs(e,co),P0(e,t)},kL=(e,t)=>{Hs(e,hc),or(e,Nn,Jt(e,t.data_src))},BL=(e,t)=>{v1(e,i=>{Hs(i,hc),or(i,Nn,Jt(i,t.data_src))}),Hs(e,w1),or(e,o1,Jt(e,t.data_poster)),or(e,Nn,Jt(e,t.data_src)),e.load()},zL=(e,t)=>{Hs(e,y1),or(e,l1,Jt(e,t.data_src))},DL=(e,t,i)=>{const n=Jt(e,t.data_bg),s=Jt(e,t.data_bg_hidpi),o=s1&&s?s:n;!o||(e.style.backgroundImage=`url("${o}")`,p1(e).setAttribute(Nn,o),b1(e,t,i))},LL=(e,t,i)=>{const n=Jt(e,t.data_bg_multi),s=Jt(e,t.data_bg_multi_hidpi),o=s1&&s?s:n;!o||(e.style.backgroundImage=o,M1(e,t,i))},RL=(e,t,i)=>{const n=Jt(e,t.data_bg_set);if(!n)return;const s=n.split("|");let o=s.map(l=>`image-set(${l})`);e.style.backgroundImage=o.join(),e.style.backgroundImage===""&&(o=s.map(l=>`-webkit-image-set(${l})`),e.style.backgroundImage=o.join()),M1(e,t,i)},C1={IMG:NL,IFRAME:kL,VIDEO:BL,OBJECT:zL},OL=(e,t)=>{const i=C1[e.tagName];!i||i(e,t)},VL=(e,t,i)=>{const n=C1[e.tagName];!n||(n(e,t),b1(e,t,i))},$L=["IMG","IFRAME","VIDEO","OBJECT"],jL=e=>$L.indexOf(e.tagName)>-1,I1=(e,t)=>{t&&!AL(t)&&!TL(t)&&pr(e.callback_finish,t)},N0=(e,t,i)=>{e.addEventListener(t,i),e.llEvLisnrs[t]=i},UL=(e,t,i)=>{e.removeEventListener(t,i)},Up=e=>!!e.llEvLisnrs,WL=(e,t,i)=>{Up(e)||(e.llEvLisnrs={});const n=e.tagName==="VIDEO"?"loadeddata":"load";N0(e,n,t),N0(e,"error",i)},wf=e=>{if(!Up(e))return;const t=e.llEvLisnrs;for(let i in t){const n=t[i];UL(e,i,n)}delete e.llEvLisnrs},A1=(e,t,i)=>{ML(e),$p(i,-1),IL(i),qi(e,t.class_loading),t.unobserve_completed&&cc(e,i)},FL=(e,t,i,n)=>{const s=Vp(t);A1(t,i,n),qs(t,i.class_loaded),is(t,u1),pr(i.callback_loaded,t,n),s||I1(i,n)},HL=(e,t,i,n)=>{const s=Vp(t);A1(t,i,n),qs(t,i.class_error),is(t,Rp),pr(i.callback_error,t,n),i.restore_on_error&&Jr(t,co),s||I1(i,n)},Wp=(e,t,i)=>{const n=p1(e)||e;if(Up(n))return;WL(n,l=>{FL(l,e,t,i),wf(n)},l=>{HL(l,e,t,i),wf(n)})},ZL=(e,t,i)=>{SL(e),Wp(e,t,i),EL(e),DL(e,t,i),LL(e,t,i),RL(e,t,i)},QL=(e,t,i)=>{Wp(e,t,i),VL(e,t,i)},Fp=(e,t,i)=>{jL(e)?QL(e,t,i):ZL(e,t,i)},YL=(e,t,i)=>{e.setAttribute("loading","lazy"),Wp(e,t,i),OL(e,t),is(e,h1)},k0=e=>{e.removeAttribute(Nn),e.removeAttribute(zp),e.removeAttribute(Dp)},GL=e=>{jp(e,t=>{k0(t)}),k0(e)},T1=e=>{jp(e,t=>{Jr(t,co)}),Jr(e,co)},XL=e=>{v1(e,t=>{Jr(t,hc)}),Jr(e,w1),e.load()},JL=e=>{Jr(e,hc)},KL=e=>{Jr(e,y1)},qL={IMG:T1,IFRAME:JL,VIDEO:XL,OBJECT:KL},eR=e=>{const t=qL[e.tagName];if(!t){PL(e);return}t(e)},tR=(e,t)=>{Op(e)||Vp(e)||(qi(e,t.class_entered),qi(e,t.class_exited),qi(e,t.class_applied),qi(e,t.class_loading),qi(e,t.class_loaded),qi(e,t.class_error))},iR=(e,t)=>{eR(e),tR(e,t),uc(e),S1(e)},nR=(e,t,i,n)=>{!i.cancel_on_exit||!vL(e)||e.tagName==="IMG"&&(wf(e),GL(e),T1(e),qi(e,i.class_loading),$p(n,-1),uc(e),pr(i.callback_cancel,e,t,n))},rR=(e,t,i,n)=>{const s=xL(e);is(e,gL),qs(e,i.class_entered),qi(e,i.class_exited),CL(e,i,n),pr(i.callback_enter,e,t,n),!s&&Fp(e,i,n)},sR=(e,t,i,n)=>{Op(e)||(qs(e,i.class_exited),nR(e,t,i,n),pr(i.callback_exit,e,t,n))},aR=["IMG","IFRAME","VIDEO"],E1=e=>e.use_native&&"loading"in HTMLImageElement.prototype,oR=(e,t,i)=>{e.forEach(n=>{aR.indexOf(n.tagName)!==-1&&YL(n,t,i)}),g1(i,0)},lR=e=>e.isIntersecting||e.intersectionRatio>0,uR=e=>({root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),cR=(e,t,i)=>{e.forEach(n=>lR(n)?rR(n.target,n,t,i):sR(n.target,n,t,i))},hR=(e,t)=>{t.forEach(i=>{e.observe(i)})},dR=(e,t)=>{bL(e),hR(e,t)},fR=(e,t)=>{!n1||E1(e)||(t._observer=new IntersectionObserver(i=>{cR(i,e,t)},uR(e)))},_1=e=>Array.prototype.slice.call(e),Wu=e=>e.container.querySelectorAll(e.elements_selector),pR=e=>_1(e).filter(Op),gR=e=>wL(e),mR=e=>_1(e).filter(gR),B0=(e,t)=>pR(e||Wu(t)),vR=(e,t)=>{mR(Wu(e)).forEach(n=>{qi(n,e.class_error),uc(n)}),t.update()},wR=(e,t)=>{!fr||(t._onlineHandler=()=>{vR(e,t)},window.addEventListener("online",t._onlineHandler))},yR=e=>{!fr||window.removeEventListener("online",e._onlineHandler)},Do=function(e,t){const i=a1(e);this._settings=i,this.loadingCount=0,fR(i,this),wR(i,this),this.update(t)};Do.prototype={update:function(e){const t=this._settings,i=B0(e,t);if(g1(this,i.length),i1||!n1){this.loadAll(i);return}if(E1(t)){oR(i,t,this);return}dR(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),yR(this),Wu(this._settings).forEach(e=>{S1(e)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){const t=this._settings;B0(e,t).forEach(n=>{cc(n,this),Fp(n,t,this)})},restoreAll:function(){const e=this._settings;Wu(e).forEach(t=>{iR(t,e)})}};Do.load=(e,t)=>{const i=a1(t);Fp(e,i)};Do.resetStatus=e=>{uc(e)};fr&&pL(Do,window.lazyLoadOptions);class P1{constructor({readonly:t,box:i,pages:n,onNewPageIndex:s,onPlay:o}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new lc,n.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=t,this.box=i,this.pages=n,this.onNewPageIndex=s,this.onPlay=o,this.onPageIndexChanged=()=>{},this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const t=new Do({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>t.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.$content.classList.toggle(this.wrapClassName("readonly"),t),this.$footer.classList.toggle(this.wrapClassName("readonly"),t),this.$pageNumberInput.disabled=t)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(t){Number.isNaN(t)||(this.pageIndex=t,this.$pageNumberInput.value=String(t+1),this.onPageIndexChanged(t))}setSmallBox(t){this.isSmallBox!==t&&(this.isSmallBox=t,this.$footer.classList.toggle(this.wrapClassName("float-footer"),t))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const t=document.createElement("div");t.className=this.wrapClassName("content"),this.$content=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),t.appendChild(this.renderPreviewMask()),t.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const t=document.createElement("div");t.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=t;const i=this.wrapClassName("preview-page"),n=this.wrapClassName("preview-page-name");this.pages.forEach((s,o)=>{var l;const c=(l=s.thumbnail)!=null?l:s.src.startsWith("ppt")?void 0:s.src;if(!c)return;const d=String(o),f=document.createElement("a");f.className=i+" "+this.wrapClassName(`preview-page-${o}`),f.setAttribute("href","#"),f.dataset.pageIndex=d;const g=document.createElement("span");g.className=n,g.textContent=String(o+1),g.dataset.pageIndex=d;const v=document.createElement("img");v.width=s.width,v.height=s.height,v.dataset.src=c,v.dataset.pageIndex=d,f.appendChild(v),f.appendChild(g),t.appendChild(f)}),this.sideEffect.addEventListener(t,"click",s=>{var o;if(this.readonly)return;const l=(o=s.target.dataset)==null?void 0:o.pageIndex;l&&(s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation(),this.onNewPageIndex(Number(l)),this.togglePreview(!1))})}return this.$preview}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",t=>{this.readonly||t.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const 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(d=>d.thumbnail||!d.src.startsWith("ppt"))){const d=this.renderFooterBtn("btn-sidebar",lL(this.namespace));this.sideEffect.addEventListener(d,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(d)}const i=document.createElement("div");i.className=this.wrapClassName("page-jumps");const n=this.renderFooterBtn("btn-page-back",uL(this.namespace));if(this.sideEffect.addEventListener(n,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),i.appendChild(n),this.onPlay){const d=this.renderFooterBtn("btn-page-play",hL(this.namespace),dL(this.namespace)),f=()=>{this.sideEffect.setTimeout(()=>{d.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(d,"click",()=>{this.readonly||(d.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),f())}),i.appendChild(d)}const s=this.renderFooterBtn("btn-page-next",cL(this.namespace));this.sideEffect.addEventListener(s,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),i.appendChild(s);const o=document.createElement("div");o.className=this.wrapClassName("page-number");const l=document.createElement("input");l.className=this.wrapClassName("page-number-input"),l.value=String(this.pageIndex+1),this.readonly&&(l.disabled=!0),this.$pageNumberInput=l,this.sideEffect.addEventListener(l,"focus",()=>{l.select()}),this.sideEffect.addEventListener(l,"change",()=>{this.readonly||l.value&&this.onNewPageIndex(Number(l.value)-1)});const c=document.createElement("span");c.textContent=" / "+this.pages.length,o.appendChild(l),o.appendChild(c),this.$footer.appendChild(i),this.$footer.appendChild(o)}return this.$footer}renderFooterBtn(t,i,n){const s=document.createElement("button");return s.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(t),s.appendChild(i),n&&s.appendChild(n),s}togglePreview(t){if(this.isShowPreview=t!=null?t:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const i=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));i&&this.$preview.scrollTo({top:i.offsetTop-16})}}wrapClassName(t){return`${this.namespace}-${t}`}}function Zs(e,t,i){return Math.min(Math.max(e,t),i)}function z0(e){return e.touches?e.touches[0]:e}function N1(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function k1(e){if(!e)return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"}class xR{constructor(t){var i,n,s;this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=o=>{if(this.paused)return;let l=Math.floor((o-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=o;l-- >0;)this.stepper();this.onStep(this.current,this),!this.paused&&this.current!==this.target&&window.requestAnimationFrame(this.looper)},this.current=(i=t.start)!=null?i:0,this.target=this.current,this.stiffness=(n=t.stiffness)!=null?n:170,this.damping=(s=t.damping)!=null?s:26,this.onStep=t.onStep}stepTo(t,i){this.paused&&i!=null&&(this.current=i),this.paused=!1,this.target=t,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}pause(){this.paused=!0}destroy(){this.pause()}stepper(){const t=-this.stiffness*(this.current-this.target),i=-this.damping*this.velocity,n=this.velocity+(t+i)/60,s=this.current+n/60;Math.abs(n-0)<.01&&Math.abs(s-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=s,this.velocity=n)}}class SR{constructor(t,i,n,s){this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=t,this.page=i,this.scale=n,this.pageOffsetX=(s-i.width)/2;const o=document.createElement("div");o.className="page-renderer-page",o.dataset.index=`${t}`,o.style.width=`${i.width*n}px`,o.style.height=`${i.height*n}px`,i.thumbnail&&(o.style.backgroundImage=`url("${i.thumbnail}")`);const l=document.createElement("img");l.className="page-renderer-page-img",l.width=i.width,l.height=i.height,l.src=i.src,o.appendChild(l),this.$page=o}translateY(t){Math.abs(t-this.pageOffsetY)>=.001&&(this.pageOffsetY=t,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setScale(t){Math.abs(t-this.scale)>=.001&&(this.scale=t,this.$page.style.width=`${this.page.width*this.scale}px`,this.$page.style.height=`${this.page.height*this.scale}px`,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setVisible(t){t!==this.visible&&(this.visible=t,this.$page.style.opacity=t?"1":"0")}}const MR=window.requestIdleCallback||(e=>window.setTimeout(e,5e3)),bR=window.cancelIdleCallback||window.clearTimeout;class CR{constructor(t,i,n){this.pages=t,this.pagesIntrinsicWidth=i,this.scale=n,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{if(this.gcTimer=null,this.els.size>this.maxElCount){const s=[...this.els.values()].sort((o,l)=>l.lastVisit-o.lastVisit);for(let o=Math.floor(this.maxElCount/4);o<s.length;o++)this.els.delete(s[o].index)}}}getEl(t){let i=this.els.get(t);return i||(i=new SR(t,this.pages[t],this.scale,this.pagesIntrinsicWidth),this.els.set(t,i)),i.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=MR(this.gc)),i}setScale(t){t!==this.scale&&(this.scale=t,this.els.forEach(i=>i.setScale(t)))}destroy(){this.els.clear(),this.gcTimer!==null&&(bR(this.gcTimer),this.gcTimer=null)}}class IR{constructor(t){this._hwaTimeout=NaN,this._turnOffHWA=()=>{window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN,this.$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(o=>{if(o.thumbnail)return o;try{const l=new URL(o.src);return l.searchParams.set("x-oss-process","image/resize,l_50"),{...o,thumbnail:l.toString()}}catch(l){return console.error(l),o}});const i=Array(this.pages.length);let n=1/0,s=0;this.pagesIntrinsicHeight=this.pages.reduce((o,l,c)=>(i[c]=o,l.width>s&&(s=l.width),l.height<=n&&(n=l.height),o+l.height),0),this.pagesIntrinsicWidth=s,this.pagesMinHeight=n,this.pagesIntrinsicYs=i,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=t.onPageIndexChanged,this.pageScrollIndex=0,this.pagesScrollTop!==0&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new CR(this.pages,s,this.scale),this.$pages=this.renderPages()}setContainerSize(t,i){t>0&&i>0&&(t!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=t,this.containerHeight=i,this.$pages.style.width=`${this.containerWidth}px`,this.$pages.style.height=`${this.containerHeight}px`,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.pageElManager.setScale(this.scale),this.$pages.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}renderPages(){const t=document.createElement("div");return t.className="page-renderer-pages-container",t.style.width=`${this.containerWidth}px`,t.style.height=`${this.containerHeight}px`,t}pagesScrollTo(t,i){if(t=Zs(t,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),i||Math.abs(t-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=t;const n=this.findScrollPageIndex(),s=Math.max(n-this.threshold,0),o=Math.min(n+this.threshold,this.pages.length-1);for(let l=0;l<this.$pages.children.length;l++){const c=this.$pages.children[l],d=Number(c.dataset.index);d>=s&&d<=o||(c.remove(),l--)}for(let l=s;l<=o;l++){const c=this.pageElManager.getEl(l);c.$page.parentElement!==this.$pages&&this.$pages.appendChild(c.$page),c.translateY(this.pagesIntrinsicYs[l]-this.pagesScrollTop)}n!==this.pageScrollIndex&&(this.pageScrollIndex=n,this.onPageIndexChanged&&this.onPageIndexChanged(n))}}findScrollPageIndex(){for(let t=0;t<this.pagesIntrinsicYs.length;t++)if(this.pagesIntrinsicYs[t]+this.pages[t].height-this.pagesScrollTop>=.001)return t;return this.pagesIntrinsicYs.length-1}mount(t){t.appendChild(this.$pages),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$pages.remove()}destroy(){this.unmount(),this.onPageIndexChanged=void 0,this.pageElManager.destroy(),this._hwaTimeout&&(window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN)}_calcScale(){return this.containerWidth/this.pagesIntrinsicWidth||1}_calcThreshold(){return Zs(Math.ceil(this.containerHeight/this.scale/this.pagesMinHeight/2),1,this.pages.length)}_turnOnHWA(){this._hwaTimeout?window.clearTimeout(this._hwaTimeout):this.$pages.classList.toggle("is-hwa",!0),this._hwaTimeout=window.setTimeout(this._turnOffHWA,1e3)}}const AR=30;class TR{constructor(t){this.sideEffect=new lc,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||AR,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=t.readonly,this.wrapClassName=t.wrapClassName,this.onDragScroll=t.onDragScroll,this.$scrollbar=this.renderScrollbar()}mount(t){t.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$scrollbar.remove()}setReadonly(t){this.readonly=t}setContainerSize(t,i){t>0&&i>0&&(t!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=t,this.containerHeight=i,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}pagesScrollTo(t,i){if(t=Zs(t,0,this.pagesHeight-this.containerHeight/this.scale),i||Math.abs(t-this.pagesScrollTop)>=.001){this.pagesScrollTop=t;const n=this.pagesScrollTop*this.scale,s=this.pagesHeight*this.scale,o=n/(s-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame(()=>{this.$scrollbar.style.transform=`translateY(${o}px)`}):this.$scrollbar.style.transform=`translateY(${o}px)`}}destroy(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const t=document.createElement("button");t.className=this.wrapClassName("scrollbar"),t.style.minHeight=`${this.scrollbarMinHeight}px`,t.style.height=`${this.scrollbarHeight}px`;const i=n=>{if(this.readonly||n.button!=null&&n.button!==0)return;N1(n);const s=this.wrapClassName("scrollbar-dragging");t.classList.toggle(s,!0);const o=this.pagesScrollTop,{clientY:l}=z0(n),c=f=>{if(this.readonly)return;const{clientY:g}=z0(f),v=(g-l)/this.scale;Math.abs(v)>0&&this.onDragScroll&&this.onDragScroll(o+v*(this.pagesHeight*this.scale/this.containerHeight))},d=()=>{t.classList.toggle(s,!1),window.removeEventListener("mousemove",c,!0),window.removeEventListener("touchmove",c,!0),window.removeEventListener("mouseup",d,!0),window.removeEventListener("touchend",d,!0),window.removeEventListener("touchcancel",d,!0)};window.addEventListener("mousemove",c,!0),window.addEventListener("touchmove",c,!0),window.addEventListener("mouseup",d,!0),window.addEventListener("touchend",d,!0),window.addEventListener("touchcancel",d,!0)};return this.sideEffect.addEventListener(t,"mousedown",i),this.sideEffect.addEventListener(t,"touchstart",i),t}_calcScale(){return this.containerWidth/this.pagesWidth||1}_calcScrollbarHeight(){return Zs(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}_updateScrollbarHeight(){const t=this._calcScrollbarHeight();Math.abs(t-this.scrollbarHeight)>.001&&(this.scrollbarHeight=t,this.$scrollbar.style.height=`${t}px`)}}const ER=window.ResizeObserver||oL,Ta=640;class _R{constructor({context:t,whiteboardView:i,readonly:n,box:s,pages:o,pageScrollTop:l=0,mountWhiteboard:c,onUserScroll:d,baseScenePath:f,appId:g}){this.sideEffect=new lc,this.userScrolling=!1,this.docsViewReadonly=!1,this.onNewPageIndex=_=>{this.scrollToPage(_)},this.toPdf=async()=>{const _=document.createElement("canvas"),P=_.getContext("2d");if(!P||!this.baseScenePath){this.reportProgress(100,null);return}const y=this.whiteboardView.focusScenePath||`${this.baseScenePath}/1`,x=this.pages[0],{jsPDF:I}=await Promise.resolve().then(function(){return F0(require("jspdf"))}),C=new I({format:[x.width,x.height],orientation:x.width>x.height?"l":"p",compress:!0});for(const[L,W]of this.pages.entries()){const{width:Q,height:J,src:K}=W;_.width=Q,_.height=J;const De=Q>J?"l":"p";L>0&&C.addPage([Q,J],De);const U=await this.getBase64FromUrl(K),z=document.createElement("img");z.src=U,await new Promise(le=>z.onload=le),P.drawImage(z,0,0);const oe=_.toDataURL("image/png");P.clearRect(0,0,Q,J);const ie={centerX:Q/2,centerY:J/2+L*J,scale:1},be=this.context.manager.windowManger;be._appliancePlugin?await be._appliancePlugin.screenshotToCanvasAsync(P,y,Q,J,ie):this.whiteboardView.screenshotToCanvas(P,y,Q,J,ie);const Ve=_.toDataURL("image/png");C.addImage(oe,"PNG",0,0,Q,J,"","FAST"),C.addImage(Ve,"PNG",0,0,Q,J,"","FAST"),P.clearRect(0,0,Q,J),Math.ceil((L+1)/this.pages.length*100)<100&&this.reportProgress(Math.ceil((L+1)/this.pages.length*100),null)}const k=C.output("arraybuffer");this.reportProgress(100,{pdf:k,title:this.box.title})},this.context=t,this.whiteboardView=i,this.readonly=n,this.box=s,this.pages=o,this.baseScenePath=f,this.appId=g,this.mountWhiteboard=c,this._onUserScroll=d;const v=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,v()},this.viewer=new P1({readonly:n,box:s,pages:o,onNewPageIndex:this.onNewPageIndex});const{width:M,height:E}=this.whiteboardView.size;this.pageRenderer=new IR({pagesScrollTop:l,pages:this.pages,containerWidth:M,containerHeight:E,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new TR({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:M,containerHeight:E,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:_=>{this.pageScrollTo(_),this.updateUserScroll()}}),this.pageScrollStepper=new xR({start:this.pageRenderer.pagesScrollTop,onStep:_=>{this.pageScrollTo(_)}}),this.render()}setDocsViewReadonly(t){this.docsViewReadonly=t}mount(){this.viewer.mount(),this.setupScrollListener();const t=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const i=new ER(t);return i.observe(this.viewer.$content),()=>i.disconnect()}),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100),this.sideEffect.add(()=>{const i=n=>{n.data.type==="@netless/_request_save_pdf_"&&n.data.appId===this.appId&&this.toPdf().catch(()=>this.reportProgress(100,null))};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i)}}),this}unmount(){return this.viewer.unmount(),this}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t),this.scrollbar.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(t){!this.userScrolling&&t>=0&&Math.abs(this.pageRenderer.pagesScrollTop-t)>.01&&this.pageScrollStepper.stepTo(t,this.pageRenderer.pagesScrollTop)}render(){this.pageRenderer.mount(this.viewer.$content),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.scrollbar.mount(this.viewer.$content),this.renderRatioHeight()}renderRatioHeight(){const t=this.box.absoluteHeight,i=t<=Ta;if(this.viewer.setSmallBox(i),i){const n=26/Ta,s=26/t,o=26/Ta,l=0,c=Math.max((n+o-(s+l))/2,0);if(this.box.$titleBar){const d=s+c;this.box.$titleBar.style.height=`${d*100}%`}if(this.box.$footer){const d=l+c;this.box.$footer.style.height=`${d*100}%`}}else{if(this.box.$titleBar){const n=Math.max(26/Ta,26/t);this.box.$titleBar.style.height=`${n*100}%`}if(this.box.$footer){const n=Math.max(26/Ta,26/t);this.box.$footer.style.height=`${n*100}%`}}}renderWhiteboardView(){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",t=>{N1(t),this.readonly||(this.pageScrollTo(this.pageRenderer.pagesScrollTop+t.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",t=>{this.readonly||t.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}scrollTopPageToEl(t){return t*this.pageRenderer.scale}scrollTopElToPage(t){return t/this.pageRenderer.scale}elScrollTo(t){this.pageScrollTo(this.scrollTopElToPage(t))}pageScrollTo(t){const i=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:Zs(t+i,i,this.pageRenderer.pagesIntrinsicHeight-i),animationMode:"immediately"})}scrollToPage(t){if(!this.readonly&&!Number.isNaN(t)){const i=this.pageRenderer.pagesIntrinsicYs[t];i>=0&&(this.pageScrollTo(i+5/this.pageRenderer.scale),this.updateUserScroll())}}setupScrollListener(){this.sideEffect.add(()=>{const t=i=>{const{width:n,height:s}=this.whiteboardView.size;if(n<=0||s<=0)return;const o=i.centerY-this.pageRenderer.containerHeight/this.pageRenderer.scale/2;this.pageRenderer.pagesScrollTo(o),this.scrollbar.pagesScrollTo(o)};return this.whiteboardView.callbacks.on("onCameraUpdated",t),()=>this.whiteboardView.callbacks.off("onCameraUpdated",t)}),this.sideEffect.add(()=>{const{updateUserScroll:t}=this;return this.whiteboardView.callbacks.on("onCameraUpdatedByDevice",t),()=>this.whiteboardView.callbacks.off("onCameraUpdatedByDevice",t)}),this.sideEffect.add(()=>{const t=({width:i,height:n})=>{if(i<=0||n<=0)return;this.pageRenderer.setContainerSize(i,n),this.scrollbar.setContainerSize(i,n);const{pagesIntrinsicWidth:s,pagesIntrinsicHeight:o}=this.pageRenderer;this.whiteboardView.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:s,height:n/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:s/2,centerY:o/2,width:s,height:o})};return this.whiteboardView.callbacks.on("onSizeUpdated",t),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",t)}},"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",t=>{if(this.readonly||!this.box.focus||this.box.minimized||k1(t.target)||this.docsViewReadonly)return;let i=null;switch(t.key){case"PageDown":{i=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"PageUp":{i=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"ArrowDown":{i=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}case"ArrowUp":{i=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}}i!==null&&(this._onUserScroll?this._onUserScroll(i):(this.pageScrollTo(i),this.updateUserScroll()))},{capture:!0})}debounce(t,i,n){const s=DD(t,i);return this.sideEffect.addDisposer(()=>s.cancel(),n),s}wrapClassName(t){return"netless-app-docs-viewer-static-"+t}async getBase64FromUrl(t){const n=await(await fetch(this._invalidate(t))).blob();return new Promise(s=>{const o=new FileReader;o.readAsDataURL(n),o.onloadend=()=>{const l=o.result;s(l)}})}_invalidate(t){try{const i=new URL(t);return i.searchParams.set("t",Date.now().toString()),i.toString()}catch{return t}}reportProgress(t,i){window.postMessage({type:"@netless/_result_save_pdf_",appId:this.appId,progress:t,result:i})}}class PR{constructor({context:t,whiteboardView:i,box:n,pages:s}){this.sideEffect=new lc,this.docsViewReadonly=!1,this.onPlayPPT=()=>{const o=this.context.getRoom();o&&o.pptNextStep()},this._scaleDocsToFitImpl=()=>{const o=this.pages[this.getPageIndex()];o&&(this.whiteboardView.moveCameraToContain({originX:-o.width/2,originY:-o.height/2,width:o.width,height:o.height,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.whiteboardView.camera.scale,minContentMode:()=>this.whiteboardView.camera.scale,centerX:0,centerY:0,width:o.width,height:o.height}))},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=o=>{this.jumpToPage(o,!0)},this.context=t,this.whiteboardView=i,this.box=n,this.pages=s,this.displayer=t.getDisplayer(),this.viewer=new P1({readonly:!t.getIsWritable(),box:n,pages:s,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add(()=>{const o=l=>{this.viewer.setReadonly(!l)};return this.context.emitter.on("writableChange",o),()=>this.context.emitter.off("writableChange",o)}),this.sideEffect.add(()=>{const o=l=>{this.jumpToPage(l.index)};return this.context.emitter.on("sceneStateChange",o),()=>this.context.emitter.off("sceneStateChange",o)})}setDocsViewReadonly(t){this.docsViewReadonly=t}mount(){this.viewer.mount();const t=this.getPageIndex();return t!==0&&this.jumpToPage(t),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit)})),this}unmount(){return this.viewer.unmount(),this}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(t,i){var n,s;if(t=Zs(t,0,this.pages.length-1),t!==this.getPageIndex()&&this.context.getIsWritable()){const o=this.context.getInitScenePath(),l=(s=(n=this.context.getScenes())==null?void 0:n[t])==null?void 0:s.name;o&&l&&this.context.setScenePath(`${o}/${l}`),this.scaleDocsToFit()}if(t!==this.viewer.pageIndex&&this.viewer.setPageIndex(t),i){const o=this.context.getRoom();if(o){const l=o.state.globalState.__pptState;o.setGlobalState({__pptState:l&&{uuid:l.uuid,pageIndex:t,disableAutoPlay:l.disableAutoPlay}})}}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",t=>{var i;if(!this.docsViewReadonly&&this.box.focus&&!k1(t.target))switch(t.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(i=this.context.getRoom())==null||i.pptNextStep();break}}})}renderMask(){if(!this.$mask){const t=document.createElement("div");t.className=this.wrapClassName("mask"),this.$mask=t;const i=document.createElement("button");i.className=this.wrapClassName("back");const n=document.createElement("button");n.className=this.wrapClassName("next")}return this.$mask}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.sideEffect.addEventListener(this.$whiteboardView,"click",t=>{var i;const n=this.context.getRoom();if(n&&n.state.memberState.currentApplianceName==="clicker"){for(let s=t.target;s;s=s.parentElement)if((i=s.classList)!=null&&i.contains("ppt-event-source"))return;n.pptNextStep()}}),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}wrapClassName(t){return"netless-app-docs-viewer-dynamic-"+t}}const NR="DocsViewer",kR={kind:NR,setup(e){const t=e.getBox(),i=e.getScenes();if(!i)throw new Error("[Docs Viewer]: scenes not found.");const n=e.getView();if(!n)throw new Error("[Docs Viewer]: no whiteboard view.");const s=i.map(({ppt:c})=>c?{width:c.width,height:c.height,src:c.src,thumbnail:c.previewURL}:null).filter(c=>Boolean(c));if(s.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(AD);let o=null;return s[0].src.startsWith("ppt")?o=zR(e,n,t,s):o=BR(e,n,t,s),(e.getAppOptions()||{}).justDocsViewReadonly&&o.setDocsViewReadonly(!0),{setDocsViewReadonly:c=>{o==null||o.setDocsViewReadonly(c)}}}};function BR(e,t,i,n){var s;t.disableCameraTransform=!e.getIsWritable();const o=new _R({context:e,whiteboardView:t,readonly:!e.getIsWritable(),box:i,pages:n,pageScrollTop:(s=e.getAttributes())==null?void 0:s.pageScrollTop,mountWhiteboard:e.mountView.bind(e),onUserScroll:l=>{var c;((c=e.getAttributes())==null?void 0:c.pageScrollTop)!==l&&!i.readonly&&e.updateAttributes(["pageScrollTop"],l)},baseScenePath:e.getInitScenePath(),appId:e.appId}).mount();return o.viewer.onPageIndexChanged=l=>{e.dispatchAppEvent("pageStateChange",{index:l,length:n.length})},e.dispatchAppEvent("pageStateChange",{index:o.viewer.pageIndex,length:n.length}),e.emitter.on("attributesUpdate",l=>{l&&l.pageScrollTop!=null&&o.syncPageScrollTop(l.pageScrollTop)}),e.emitter.on("writableChange",l=>{o.setReadonly(!l),t.disableCameraTransform=!l}),o}function zR(e,t,i,n){t.disableCameraTransform=!0;const s=new PR({context:e,whiteboardView:t,box:i,pages:n}).mount();return s.viewer.onPageIndexChanged=o=>{e.dispatchAppEvent("pageStateChange",{index:o,length:n.length})},e.dispatchAppEvent("pageStateChange",{index:s.getPageIndex(),length:n.length}),e.mountView(s.$whiteboardView),e.isAddApp&&t.callbacks.once("onSizeUpdated",({width:o,height:l})=>{if(n.length>0&&i.state!=="maximized"){const{width:c,height:d}=n[0],g=d/c*o-l;g!==0&&e.getIsWritable()&&e.emitter.emit("setBoxSize",{width:i.width,height:i.height+g/i.containerRect.height})}}),s}var DR=Object.freeze(Object.defineProperty({__proto__:null,default:kR},Symbol.toStringTag,{value:"Module"})),LR=Object.create,Hp=Object.defineProperty,RR=Object.defineProperties,OR=Object.getOwnPropertyDescriptor,VR=Object.getOwnPropertyDescriptors,B1=Object.getOwnPropertyNames,D0=Object.getOwnPropertySymbols,$R=Object.getPrototypeOf,z1=Object.prototype.hasOwnProperty,jR=Object.prototype.propertyIsEnumerable,L0=(e,t,i)=>t in e?Hp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,UR=(e,t)=>{for(var i in t||(t={}))z1.call(t,i)&&L0(e,i,t[i]);if(D0)for(var i of D0(t))jR.call(t,i)&&L0(e,i,t[i]);return e},WR=(e,t)=>RR(e,VR(t)),FR=(e,t)=>function(){return t||(0,e[B1(e)[0]])((t={exports:{}}).exports,t),t.exports},HR=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of B1(t))!z1.call(e,s)&&s!==i&&Hp(e,s,{get:()=>t[s],enumerable:!(n=OR(t,s))||n.enumerable});return e},D1=(e,t,i)=>(i=e!=null?LR($R(e)):{},HR(!e||!e.__esModule?Hp(i,"default",{value:e,enumerable:!0}):i,e)),L1=FR({"node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var i,n="4.17.21",s=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",l="Expected a function",c="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",f=500,g="__lodash_placeholder__",v=1,M=2,E=4,_=1,P=2,y=1,x=2,I=4,C=8,k=16,L=32,W=64,Q=128,J=256,K=512,De=30,U="...",z=800,oe=16,ie=1,be=2,Ve=3,Le=1/0,le=9007199254740991,pt=17976931348623157e292,Ct=0/0,ot=4294967295,ti=ot-1,zn=ot>>>1,F=[["ary",Q],["bind",y],["bindKey",x],["curry",C],["curryRight",k],["flip",K],["partial",L],["partialRight",W],["rearg",J]],q="[object Arguments]",B="[object Array]",$="[object AsyncFunction]",Z="[object Boolean]",ne="[object Date]",pe="[object DOMException]",ve="[object Error]",ge="[object Function]",Xe="[object GeneratorFunction]",Ze="[object Map]",Ue="[object Number]",ut="[object Null]",Qe="[object Object]",jt="[object Promise]",Dn="[object Proxy]",mi="[object RegExp]",ct="[object Set]",gt="[object String]",Ui="[object Symbol]",vr="[object Undefined]",vi="[object WeakMap]",ta="[object WeakSet]",un="[object ArrayBuffer]",wi="[object DataView]",wr="[object Float32Array]",ee="[object Float64Array]",Ce="[object Int8Array]",re="[object Int16Array]",We="[object Int32Array]",ii="[object Uint8Array]",yi="[object Uint8ClampedArray]",Wi="[object Uint16Array]",yr="[object Uint32Array]",pM=/\b__p \+= '';/g,gM=/\b(__p \+=) '' \+/g,mM=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ng=/&(?:amp|lt|gt|quot|#39);/g,rg=/[&<>"']/g,vM=RegExp(ng.source),wM=RegExp(rg.source),yM=/<%-([\s\S]+?)%>/g,xM=/<%([\s\S]+?)%>/g,sg=/<%=([\s\S]+?)%>/g,SM=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,MM=/^\w*$/,bM=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vc=/[\\^$.*+?()[\]{}|]/g,CM=RegExp(vc.source),wc=/^\s+/,IM=/\s/,AM=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,TM=/\{\n\/\* \[wrapped with (.+)\] \*/,EM=/,? & /,_M=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,PM=/[()=,{}\[\]\/\s]/,NM=/\\(\\)?/g,kM=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ag=/\w*$/,BM=/^[-+]0x[0-9a-f]+$/i,zM=/^0b[01]+$/i,DM=/^\[object .+?Constructor\]$/,LM=/^0o[0-7]+$/i,RM=/^(?:0|[1-9]\d*)$/,OM=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vo=/($^)/,VM=/['\n\r\u2028\u2029\\]/g,$o="\\ud800-\\udfff",$M="\\u0300-\\u036f",jM="\\ufe20-\\ufe2f",UM="\\u20d0-\\u20ff",og=$M+jM+UM,lg="\\u2700-\\u27bf",ug="a-z\\xdf-\\xf6\\xf8-\\xff",WM="\\xac\\xb1\\xd7\\xf7",FM="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",HM="\\u2000-\\u206f",ZM=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",cg="A-Z\\xc0-\\xd6\\xd8-\\xde",hg="\\ufe0e\\ufe0f",dg=WM+FM+HM+ZM,yc="['\u2019]",QM="["+$o+"]",fg="["+dg+"]",jo="["+og+"]",pg="\\d+",YM="["+lg+"]",gg="["+ug+"]",mg="[^"+$o+dg+pg+lg+ug+cg+"]",xc="\\ud83c[\\udffb-\\udfff]",GM="(?:"+jo+"|"+xc+")",vg="[^"+$o+"]",Sc="(?:\\ud83c[\\udde6-\\uddff]){2}",Mc="[\\ud800-\\udbff][\\udc00-\\udfff]",rs="["+cg+"]",wg="\\u200d",yg="(?:"+gg+"|"+mg+")",XM="(?:"+rs+"|"+mg+")",xg="(?:"+yc+"(?:d|ll|m|re|s|t|ve))?",Sg="(?:"+yc+"(?:D|LL|M|RE|S|T|VE))?",Mg=GM+"?",bg="["+hg+"]?",JM="(?:"+wg+"(?:"+[vg,Sc,Mc].join("|")+")"+bg+Mg+")*",KM="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",qM="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Cg=bg+Mg+JM,eb="(?:"+[YM,Sc,Mc].join("|")+")"+Cg,tb="(?:"+[vg+jo+"?",jo,Sc,Mc,QM].join("|")+")",ib=RegExp(yc,"g"),nb=RegExp(jo,"g"),bc=RegExp(xc+"(?="+xc+")|"+tb+Cg,"g"),rb=RegExp([rs+"?"+gg+"+"+xg+"(?="+[fg,rs,"$"].join("|")+")",XM+"+"+Sg+"(?="+[fg,rs+yg,"$"].join("|")+")",rs+"?"+yg+"+"+xg,rs+"+"+Sg,qM,KM,pg,eb].join("|"),"g"),sb=RegExp("["+wg+$o+og+hg+"]"),ab=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ob=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],lb=-1,Fe={};Fe[wr]=Fe[ee]=Fe[Ce]=Fe[re]=Fe[We]=Fe[ii]=Fe[yi]=Fe[Wi]=Fe[yr]=!0,Fe[q]=Fe[B]=Fe[un]=Fe[Z]=Fe[wi]=Fe[ne]=Fe[ve]=Fe[ge]=Fe[Ze]=Fe[Ue]=Fe[Qe]=Fe[mi]=Fe[ct]=Fe[gt]=Fe[vi]=!1;var je={};je[q]=je[B]=je[un]=je[wi]=je[Z]=je[ne]=je[wr]=je[ee]=je[Ce]=je[re]=je[We]=je[Ze]=je[Ue]=je[Qe]=je[mi]=je[ct]=je[gt]=je[Ui]=je[ii]=je[yi]=je[Wi]=je[yr]=!0,je[ve]=je[ge]=je[vi]=!1;var ub={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},cb={"&":"&","<":"<",">":">",'"':""","'":"'"},hb={"&":"&","<":"<",">":">",""":'"',"'":"'"},db={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},fb=parseFloat,pb=parseInt,Ig=typeof global=="object"&&global&&global.Object===Object&&global,gb=typeof self=="object"&&self&&self.Object===Object&&self,mt=Ig||gb||Function("return this")(),Cc=typeof e=="object"&&e&&!e.nodeType&&e,xr=Cc&&typeof t=="object"&&t&&!t.nodeType&&t,Ag=xr&&xr.exports===Cc,Ic=Ag&&Ig.process,xi=function(){try{var A=xr&&xr.require&&xr.require("util").types;return A||Ic&&Ic.binding&&Ic.binding("util")}catch{}}(),Tg=xi&&xi.isArrayBuffer,Eg=xi&&xi.isDate,_g=xi&&xi.isMap,Pg=xi&&xi.isRegExp,Ng=xi&&xi.isSet,kg=xi&&xi.isTypedArray;function ni(A,D,N){switch(N.length){case 0:return A.call(D);case 1:return A.call(D,N[0]);case 2:return A.call(D,N[0],N[1]);case 3:return A.call(D,N[0],N[1],N[2])}return A.apply(D,N)}function mb(A,D,N,te){for(var we=-1,Be=A==null?0:A.length;++we<Be;){var ht=A[we];D(te,ht,N(ht),A)}return te}function Si(A,D){for(var N=-1,te=A==null?0:A.length;++N<te&&D(A[N],N,A)!==!1;);return A}function vb(A,D){for(var N=A==null?0:A.length;N--&&D(A[N],N,A)!==!1;);return A}function Bg(A,D){for(var N=-1,te=A==null?0:A.length;++N<te;)if(!D(A[N],N,A))return!1;return!0}function Ln(A,D){for(var N=-1,te=A==null?0:A.length,we=0,Be=[];++N<te;){var ht=A[N];D(ht,N,A)&&(Be[we++]=ht)}return Be}function Uo(A,D){var N=A==null?0:A.length;return!!N&&ss(A,D,0)>-1}function Ac(A,D,N){for(var te=-1,we=A==null?0:A.length;++te<we;)if(N(D,A[te]))return!0;return!1}function Ye(A,D){for(var N=-1,te=A==null?0:A.length,we=Array(te);++N<te;)we[N]=D(A[N],N,A);return we}function Rn(A,D){for(var N=-1,te=D.length,we=A.length;++N<te;)A[we+N]=D[N];return A}function Tc(A,D,N,te){var we=-1,Be=A==null?0:A.length;for(te&&Be&&(N=A[++we]);++we<Be;)N=D(N,A[we],we,A);return N}function wb(A,D,N,te){var we=A==null?0:A.length;for(te&&we&&(N=A[--we]);we--;)N=D(N,A[we],we,A);return N}function Ec(A,D){for(var N=-1,te=A==null?0:A.length;++N<te;)if(D(A[N],N,A))return!0;return!1}var yb=_c("length");function xb(A){return A.split("")}function Sb(A){return A.match(_M)||[]}function zg(A,D,N){var te;return N(A,function(we,Be,ht){if(D(we,Be,ht))return te=Be,!1}),te}function Wo(A,D,N,te){for(var we=A.length,Be=N+(te?1:-1);te?Be--:++Be<we;)if(D(A[Be],Be,A))return Be;return-1}function ss(A,D,N){return D===D?Bb(A,D,N):Wo(A,Dg,N)}function Mb(A,D,N,te){for(var we=N-1,Be=A.length;++we<Be;)if(te(A[we],D))return we;return-1}function Dg(A){return A!==A}function Lg(A,D){var N=A==null?0:A.length;return N?Nc(A,D)/N:Ct}function _c(A){return function(D){return D==null?i:D[A]}}function Pc(A){return function(D){return A==null?i:A[D]}}function Rg(A,D,N,te,we){return we(A,function(Be,ht,$e){N=te?(te=!1,Be):D(N,Be,ht,$e)}),N}function bb(A,D){var N=A.length;for(A.sort(D);N--;)A[N]=A[N].value;return A}function Nc(A,D){for(var N,te=-1,we=A.length;++te<we;){var Be=D(A[te]);Be!==i&&(N=N===i?Be:N+Be)}return N}function kc(A,D){for(var N=-1,te=Array(A);++N<A;)te[N]=D(N);return te}function Cb(A,D){return Ye(D,function(N){return[N,A[N]]})}function Og(A){return A&&A.slice(0,Ug(A)+1).replace(wc,"")}function ri(A){return function(D){return A(D)}}function Bc(A,D){return Ye(D,function(N){return A[N]})}function ia(A,D){return A.has(D)}function Vg(A,D){for(var N=-1,te=A.length;++N<te&&ss(D,A[N],0)>-1;);return N}function $g(A,D){for(var N=A.length;N--&&ss(D,A[N],0)>-1;);return N}function Ib(A,D){for(var N=A.length,te=0;N--;)A[N]===D&&++te;return te}var Ab=Pc(ub),Tb=Pc(cb);function Eb(A){return"\\"+db[A]}function _b(A,D){return A==null?i:A[D]}function as(A){return sb.test(A)}function Pb(A){return ab.test(A)}function Nb(A){for(var D,N=[];!(D=A.next()).done;)N.push(D.value);return N}function zc(A){var D=-1,N=Array(A.size);return A.forEach(function(te,we){N[++D]=[we,te]}),N}function jg(A,D){return function(N){return A(D(N))}}function On(A,D){for(var N=-1,te=A.length,we=0,Be=[];++N<te;){var ht=A[N];(ht===D||ht===g)&&(A[N]=g,Be[we++]=N)}return Be}function Fo(A){var D=-1,N=Array(A.size);return A.forEach(function(te){N[++D]=te}),N}function kb(A){var D=-1,N=Array(A.size);return A.forEach(function(te){N[++D]=[te,te]}),N}function Bb(A,D,N){for(var te=N-1,we=A.length;++te<we;)if(A[te]===D)return te;return-1}function zb(A,D,N){for(var te=N+1;te--;)if(A[te]===D)return te;return te}function os(A){return as(A)?Lb(A):yb(A)}function ki(A){return as(A)?Rb(A):xb(A)}function Ug(A){for(var D=A.length;D--&&IM.test(A.charAt(D)););return D}var Db=Pc(hb);function Lb(A){for(var D=bc.lastIndex=0;bc.test(A);)++D;return D}function Rb(A){return A.match(bc)||[]}function Ob(A){return A.match(rb)||[]}var Vb=function A(D){D=D==null?mt:Vn.defaults(mt.Object(),D,Vn.pick(mt,ob));var N=D.Array,te=D.Date,we=D.Error,Be=D.Function,ht=D.Math,$e=D.Object,Dc=D.RegExp,$b=D.String,Mi=D.TypeError,Ho=N.prototype,jb=Be.prototype,ls=$e.prototype,Zo=D["__core-js_shared__"],Qo=jb.toString,Re=ls.hasOwnProperty,Ub=0,Wg=function(){var r=/[^.]+$/.exec(Zo&&Zo.keys&&Zo.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Yo=ls.toString,Wb=Qo.call($e),Fb=mt._,Hb=Dc("^"+Qo.call(Re).replace(vc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Go=Ag?D.Buffer:i,$n=D.Symbol,Xo=D.Uint8Array,Fg=Go?Go.allocUnsafe:i,Jo=jg($e.getPrototypeOf,$e),Hg=$e.create,Zg=ls.propertyIsEnumerable,Ko=Ho.splice,Qg=$n?$n.isConcatSpreadable:i,na=$n?$n.iterator:i,Sr=$n?$n.toStringTag:i,qo=function(){try{var r=Ar($e,"defineProperty");return r({},"",{}),r}catch{}}(),Zb=D.clearTimeout!==mt.clearTimeout&&D.clearTimeout,Qb=te&&te.now!==mt.Date.now&&te.now,Yb=D.setTimeout!==mt.setTimeout&&D.setTimeout,el=ht.ceil,tl=ht.floor,Lc=$e.getOwnPropertySymbols,Gb=Go?Go.isBuffer:i,Yg=D.isFinite,Xb=Ho.join,Jb=jg($e.keys,$e),dt=ht.max,It=ht.min,Kb=te.now,qb=D.parseInt,Gg=ht.random,eC=Ho.reverse,Rc=Ar(D,"DataView"),ra=Ar(D,"Map"),Oc=Ar(D,"Promise"),us=Ar(D,"Set"),sa=Ar(D,"WeakMap"),aa=Ar($e,"create"),il=sa&&new sa,cs={},tC=Tr(Rc),iC=Tr(ra),nC=Tr(Oc),rC=Tr(us),sC=Tr(sa),nl=$n?$n.prototype:i,oa=nl?nl.valueOf:i,Xg=nl?nl.toString:i;function m(r){if(et(r)&&!ye(r)&&!(r instanceof Pe)){if(r instanceof bi)return r;if(Re.call(r,"__wrapped__"))return Jm(r)}return new bi(r)}var hs=function(){function r(){}return function(a){if(!Je(a))return{};if(Hg)return Hg(a);r.prototype=a;var u=new r;return r.prototype=i,u}}();function rl(){}function bi(r,a){this.__wrapped__=r,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=i}m.templateSettings={escape:yM,evaluate:xM,interpolate:sg,variable:"",imports:{_:m}},m.prototype=rl.prototype,m.prototype.constructor=m,bi.prototype=hs(rl.prototype),bi.prototype.constructor=bi;function Pe(r){this.__wrapped__=r,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ot,this.__views__=[]}function aC(){var r=new Pe(this.__wrapped__);return r.__actions__=Ut(this.__actions__),r.__dir__=this.__dir__,r.__filtered__=this.__filtered__,r.__iteratees__=Ut(this.__iteratees__),r.__takeCount__=this.__takeCount__,r.__views__=Ut(this.__views__),r}function oC(){if(this.__filtered__){var r=new Pe(this);r.__dir__=-1,r.__filtered__=!0}else r=this.clone(),r.__dir__*=-1;return r}function lC(){var r=this.__wrapped__.value(),a=this.__dir__,u=ye(r),h=a<0,p=u?r.length:0,w=xI(0,p,this.__views__),S=w.start,b=w.end,T=b-S,R=h?b:S-1,O=this.__iteratees__,V=O.length,G=0,se=It(T,this.__takeCount__);if(!u||!h&&p==T&&se==T)return xm(r,this.__actions__);var ce=[];e:for(;T--&&G<se;){R+=a;for(var Ie=-1,he=r[R];++Ie<V;){var Ee=O[Ie],Ne=Ee.iteratee,oi=Ee.type,zt=Ne(he);if(oi==be)he=zt;else if(!zt){if(oi==ie)continue e;break e}}ce[G++]=he}return ce}Pe.prototype=hs(rl.prototype),Pe.prototype.constructor=Pe;function Mr(r){var a=-1,u=r==null?0:r.length;for(this.clear();++a<u;){var h=r[a];this.set(h[0],h[1])}}function uC(){this.__data__=aa?aa(null):{},this.size=0}function cC(r){var a=this.has(r)&&delete this.__data__[r];return this.size-=a?1:0,a}function hC(r){var a=this.__data__;if(aa){var u=a[r];return u===d?i:u}return Re.call(a,r)?a[r]:i}function dC(r){var a=this.__data__;return aa?a[r]!==i:Re.call(a,r)}function fC(r,a){var u=this.__data__;return this.size+=this.has(r)?0:1,u[r]=aa&&a===i?d:a,this}Mr.prototype.clear=uC,Mr.prototype.delete=cC,Mr.prototype.get=hC,Mr.prototype.has=dC,Mr.prototype.set=fC;function cn(r){var a=-1,u=r==null?0:r.length;for(this.clear();++a<u;){var h=r[a];this.set(h[0],h[1])}}function pC(){this.__data__=[],this.size=0}function gC(r){var a=this.__data__,u=sl(a,r);if(u<0)return!1;var h=a.length-1;return u==h?a.pop():Ko.call(a,u,1),--this.size,!0}function mC(r){var a=this.__data__,u=sl(a,r);return u<0?i:a[u][1]}function vC(r){return sl(this.__data__,r)>-1}function wC(r,a){var u=this.__data__,h=sl(u,r);return h<0?(++this.size,u.push([r,a])):u[h][1]=a,this}cn.prototype.clear=pC,cn.prototype.delete=gC,cn.prototype.get=mC,cn.prototype.has=vC,cn.prototype.set=wC;function hn(r){var a=-1,u=r==null?0:r.length;for(this.clear();++a<u;){var h=r[a];this.set(h[0],h[1])}}function yC(){this.size=0,this.__data__={hash:new Mr,map:new(ra||cn),string:new Mr}}function xC(r){var a=vl(this,r).delete(r);return this.size-=a?1:0,a}function SC(r){return vl(this,r).get(r)}function MC(r){return vl(this,r).has(r)}function bC(r,a){var u=vl(this,r),h=u.size;return u.set(r,a),this.size+=u.size==h?0:1,this}hn.prototype.clear=yC,hn.prototype.delete=xC,hn.prototype.get=SC,hn.prototype.has=MC,hn.prototype.set=bC;function br(r){var a=-1,u=r==null?0:r.length;for(this.__data__=new hn;++a<u;)this.add(r[a])}function CC(r){return this.__data__.set(r,d),this}function IC(r){return this.__data__.has(r)}br.prototype.add=br.prototype.push=CC,br.prototype.has=IC;function Bi(r){var a=this.__data__=new cn(r);this.size=a.size}function AC(){this.__data__=new cn,this.size=0}function TC(r){var a=this.__data__,u=a.delete(r);return this.size=a.size,u}function EC(r){return this.__data__.get(r)}function _C(r){return this.__data__.has(r)}function PC(r,a){var u=this.__data__;if(u instanceof cn){var h=u.__data__;if(!ra||h.length<s-1)return h.push([r,a]),this.size=++u.size,this;u=this.__data__=new hn(h)}return u.set(r,a),this.size=u.size,this}Bi.prototype.clear=AC,Bi.prototype.delete=TC,Bi.prototype.get=EC,Bi.prototype.has=_C,Bi.prototype.set=PC;function Jg(r,a){var u=ye(r),h=!u&&Er(r),p=!u&&!h&&Hn(r),w=!u&&!h&&!p&&gs(r),S=u||h||p||w,b=S?kc(r.length,$b):[],T=b.length;for(var R in r)(a||Re.call(r,R))&&!(S&&(R=="length"||p&&(R=="offset"||R=="parent")||w&&(R=="buffer"||R=="byteLength"||R=="byteOffset")||gn(R,T)))&&b.push(R);return b}function Kg(r){var a=r.length;return a?r[Gc(0,a-1)]:i}function NC(r,a){return wl(Ut(r),Cr(a,0,r.length))}function kC(r){return wl(Ut(r))}function Vc(r,a,u){(u!==i&&!zi(r[a],u)||u===i&&!(a in r))&&dn(r,a,u)}function la(r,a,u){var h=r[a];(!(Re.call(r,a)&&zi(h,u))||u===i&&!(a in r))&&dn(r,a,u)}function sl(r,a){for(var u=r.length;u--;)if(zi(r[u][0],a))return u;return-1}function BC(r,a,u,h){return jn(r,function(p,w,S){a(h,p,u(p),S)}),h}function qg(r,a){return r&&Hi(a,vt(a),r)}function zC(r,a){return r&&Hi(a,Ft(a),r)}function dn(r,a,u){a=="__proto__"&&qo?qo(r,a,{configurable:!0,enumerable:!0,value:u,writable:!0}):r[a]=u}function $c(r,a){for(var u=-1,h=a.length,p=N(h),w=r==null;++u<h;)p[u]=w?i:xh(r,a[u]);return p}function Cr(r,a,u){return r===r&&(u!==i&&(r=r<=u?r:u),a!==i&&(r=r>=a?r:a)),r}function Ci(r,a,u,h,p,w){var S,b=a&v,T=a&M,R=a&E;if(u&&(S=p?u(r,h,p,w):u(r)),S!==i)return S;if(!Je(r))return r;var O=ye(r);if(O){if(S=MI(r),!b)return Ut(r,S)}else{var V=At(r),G=V==ge||V==Xe;if(Hn(r))return bm(r,b);if(V==Qe||V==q||G&&!p){if(S=T||G?{}:Um(r),!b)return T?hI(r,zC(S,r)):cI(r,qg(S,r))}else{if(!je[V])return p?r:{};S=bI(r,V,b)}}w||(w=new Bi);var se=w.get(r);if(se)return se;w.set(r,S),vv(r)?r.forEach(function(he){S.add(Ci(he,a,u,he,r,w))}):gv(r)&&r.forEach(function(he,Ee){S.set(Ee,Ci(he,a,u,Ee,r,w))});var ce=R?T?ah:sh:T?Ft:vt,Ie=O?i:ce(r);return Si(Ie||r,function(he,Ee){Ie&&(Ee=he,he=r[Ee]),la(S,Ee,Ci(he,a,u,Ee,r,w))}),S}function DC(r){var a=vt(r);return function(u){return em(u,r,a)}}function em(r,a,u){var h=u.length;if(r==null)return!h;for(r=$e(r);h--;){var p=u[h],w=a[p],S=r[p];if(S===i&&!(p in r)||!w(S))return!1}return!0}function tm(r,a,u){if(typeof r!="function")throw new Mi(l);return ga(function(){r.apply(i,u)},a)}function ua(r,a,u,h){var p=-1,w=Uo,S=!0,b=r.length,T=[],R=a.length;if(!b)return T;u&&(a=Ye(a,ri(u))),h?(w=Ac,S=!1):a.length>=s&&(w=ia,S=!1,a=new br(a));e:for(;++p<b;){var O=r[p],V=u==null?O:u(O);if(O=h||O!==0?O:0,S&&V===V){for(var G=R;G--;)if(a[G]===V)continue e;T.push(O)}else w(a,V,h)||T.push(O)}return T}var jn=Em(Fi),im=Em(Uc,!0);function LC(r,a){var u=!0;return jn(r,function(h,p,w){return u=!!a(h,p,w),u}),u}function al(r,a,u){for(var h=-1,p=r.length;++h<p;){var w=r[h],S=a(w);if(S!=null&&(b===i?S===S&&!ai(S):u(S,b)))var b=S,T=w}return T}function RC(r,a,u,h){var p=r.length;for(u=xe(u),u<0&&(u=-u>p?0:p+u),h=h===i||h>p?p:xe(h),h<0&&(h+=p),h=u>h?0:yv(h);u<h;)r[u++]=a;return r}function nm(r,a){var u=[];return jn(r,function(h,p,w){a(h,p,w)&&u.push(h)}),u}function St(r,a,u,h,p){var w=-1,S=r.length;for(u||(u=II),p||(p=[]);++w<S;){var b=r[w];a>0&&u(b)?a>1?St(b,a-1,u,h,p):Rn(p,b):h||(p[p.length]=b)}return p}var jc=_m(),rm=_m(!0);function Fi(r,a){return r&&jc(r,a,vt)}function Uc(r,a){return r&&rm(r,a,vt)}function ol(r,a){return Ln(a,function(u){return mn(r[u])})}function Ir(r,a){a=Wn(a,r);for(var u=0,h=a.length;r!=null&&u<h;)r=r[Zi(a[u++])];return u&&u==h?r:i}function sm(r,a,u){var h=a(r);return ye(r)?h:Rn(h,u(r))}function kt(r){return r==null?r===i?vr:ut:Sr&&Sr in $e(r)?yI(r):kI(r)}function Wc(r,a){return r>a}function OC(r,a){return r!=null&&Re.call(r,a)}function VC(r,a){return r!=null&&a in $e(r)}function $C(r,a,u){return r>=It(a,u)&&r<dt(a,u)}function Fc(r,a,u){for(var h=u?Ac:Uo,p=r[0].length,w=r.length,S=w,b=N(w),T=1/0,R=[];S--;){var O=r[S];S&&a&&(O=Ye(O,ri(a))),T=It(O.length,T),b[S]=!u&&(a||p>=120&&O.length>=120)?new br(S&&O):i}O=r[0];var V=-1,G=b[0];e:for(;++V<p&&R.length<T;){var se=O[V],ce=a?a(se):se;if(se=u||se!==0?se:0,!(G?ia(G,ce):h(R,ce,u))){for(S=w;--S;){var Ie=b[S];if(!(Ie?ia(Ie,ce):h(r[S],ce,u)))continue e}G&&G.push(ce),R.push(se)}}return R}function jC(r,a,u,h){return Fi(r,function(p,w,S){a(h,u(p),w,S)}),h}function ca(r,a,u){a=Wn(a,r),r=Zm(r,a);var h=r==null?r:r[Zi(Ai(a))];return h==null?i:ni(h,r,u)}function am(r){return et(r)&&kt(r)==q}function UC(r){return et(r)&&kt(r)==un}function WC(r){return et(r)&&kt(r)==ne}function ha(r,a,u,h,p){return r===a?!0:r==null||a==null||!et(r)&&!et(a)?r!==r&&a!==a:FC(r,a,u,h,ha,p)}function FC(r,a,u,h,p,w){var S=ye(r),b=ye(a),T=S?B:At(r),R=b?B:At(a);T=T==q?Qe:T,R=R==q?Qe:R;var O=T==Qe,V=R==Qe,G=T==R;if(G&&Hn(r)){if(!Hn(a))return!1;S=!0,O=!1}if(G&&!O)return w||(w=new Bi),S||gs(r)?Vm(r,a,u,h,p,w):vI(r,a,T,u,h,p,w);if(!(u&_)){var se=O&&Re.call(r,"__wrapped__"),ce=V&&Re.call(a,"__wrapped__");if(se||ce){var Ie=se?r.value():r,he=ce?a.value():a;return w||(w=new Bi),p(Ie,he,u,h,w)}}return G?(w||(w=new Bi),wI(r,a,u,h,p,w)):!1}function HC(r){return et(r)&&At(r)==Ze}function Hc(r,a,u,h){var p=u.length,w=p,S=!h;if(r==null)return!w;for(r=$e(r);p--;){var b=u[p];if(S&&b[2]?b[1]!==r[b[0]]:!(b[0]in r))return!1}for(;++p<w;){b=u[p];var T=b[0],R=r[T],O=b[1];if(S&&b[2]){if(R===i&&!(T in r))return!1}else{var V=new Bi;if(h)var G=h(R,O,T,r,a,V);if(!(G===i?ha(O,R,_|P,h,V):G))return!1}}return!0}function om(r){if(!Je(r)||TI(r))return!1;var a=mn(r)?Hb:DM;return a.test(Tr(r))}function ZC(r){return et(r)&&kt(r)==mi}function QC(r){return et(r)&&At(r)==ct}function YC(r){return et(r)&&Cl(r.length)&&!!Fe[kt(r)]}function lm(r){return typeof r=="function"?r:r==null?Ht:typeof r=="object"?ye(r)?hm(r[0],r[1]):cm(r):Pv(r)}function Zc(r){if(!pa(r))return Jb(r);var a=[];for(var u in $e(r))Re.call(r,u)&&u!="constructor"&&a.push(u);return a}function GC(r){if(!Je(r))return NI(r);var a=pa(r),u=[];for(var h in r)h=="constructor"&&(a||!Re.call(r,h))||u.push(h);return u}function Qc(r,a){return r<a}function um(r,a){var u=-1,h=Wt(r)?N(r.length):[];return jn(r,function(p,w,S){h[++u]=a(p,w,S)}),h}function cm(r){var a=lh(r);return a.length==1&&a[0][2]?Fm(a[0][0],a[0][1]):function(u){return u===r||Hc(u,r,a)}}function hm(r,a){return ch(r)&&Wm(a)?Fm(Zi(r),a):function(u){var h=xh(u,r);return h===i&&h===a?Sh(u,r):ha(a,h,_|P)}}function ll(r,a,u,h,p){r!==a&&jc(a,function(w,S){if(p||(p=new Bi),Je(w))XC(r,a,S,u,ll,h,p);else{var b=h?h(dh(r,S),w,S+"",r,a,p):i;b===i&&(b=w),Vc(r,S,b)}},Ft)}function XC(r,a,u,h,p,w,S){var b=dh(r,u),T=dh(a,u),R=S.get(T);if(R){Vc(r,u,R);return}var O=w?w(b,T,u+"",r,a,S):i,V=O===i;if(V){var G=ye(T),se=!G&&Hn(T),ce=!G&&!se&&gs(T);O=T,G||se||ce?ye(b)?O=b:nt(b)?O=Ut(b):se?(V=!1,O=bm(T,!0)):ce?(V=!1,O=Cm(T,!0)):O=[]:ma(T)||Er(T)?(O=b,Er(b)?O=xv(b):(!Je(b)||mn(b))&&(O=Um(T))):V=!1}V&&(S.set(T,O),p(O,T,h,w,S),S.delete(T)),Vc(r,u,O)}function dm(r,a){var u=r.length;if(!!u)return a+=a<0?u:0,gn(a,u)?r[a]:i}function fm(r,a,u){a.length?a=Ye(a,function(w){return ye(w)?function(S){return Ir(S,w.length===1?w[0]:w)}:w}):a=[Ht];var h=-1;a=Ye(a,ri(ue()));var p=um(r,function(w,S,b){var T=Ye(a,function(R){return R(w)});return{criteria:T,index:++h,value:w}});return bb(p,function(w,S){return uI(w,S,u)})}function JC(r,a){return pm(r,a,function(u,h){return Sh(r,h)})}function pm(r,a,u){for(var h=-1,p=a.length,w={};++h<p;){var S=a[h],b=Ir(r,S);u(b,S)&&da(w,Wn(S,r),b)}return w}function KC(r){return function(a){return Ir(a,r)}}function Yc(r,a,u,h){var p=h?Mb:ss,w=-1,S=a.length,b=r;for(r===a&&(a=Ut(a)),u&&(b=Ye(r,ri(u)));++w<S;)for(var T=0,R=a[w],O=u?u(R):R;(T=p(b,O,T,h))>-1;)b!==r&&Ko.call(b,T,1),Ko.call(r,T,1);return r}function gm(r,a){for(var u=r?a.length:0,h=u-1;u--;){var p=a[u];if(u==h||p!==w){var w=p;gn(p)?Ko.call(r,p,1):Kc(r,p)}}return r}function Gc(r,a){return r+tl(Gg()*(a-r+1))}function qC(r,a,u,h){for(var p=-1,w=dt(el((a-r)/(u||1)),0),S=N(w);w--;)S[h?w:++p]=r,r+=u;return S}function Xc(r,a){var u="";if(!r||a<1||a>le)return u;do a%2&&(u+=r),a=tl(a/2),a&&(r+=r);while(a);return u}function Ae(r,a){return fh(Hm(r,a,Ht),r+"")}function eI(r){return Kg(ms(r))}function tI(r,a){var u=ms(r);return wl(u,Cr(a,0,u.length))}function da(r,a,u,h){if(!Je(r))return r;a=Wn(a,r);for(var p=-1,w=a.length,S=w-1,b=r;b!=null&&++p<w;){var T=Zi(a[p]),R=u;if(T==="__proto__"||T==="constructor"||T==="prototype")return r;if(p!=S){var O=b[T];R=h?h(O,T,b):i,R===i&&(R=Je(O)?O:gn(a[p+1])?[]:{})}la(b,T,R),b=b[T]}return r}var mm=il?function(r,a){return il.set(r,a),r}:Ht,iI=qo?function(r,a){return qo(r,"toString",{configurable:!0,enumerable:!1,value:bh(a),writable:!0})}:Ht;function nI(r){return wl(ms(r))}function Ii(r,a,u){var h=-1,p=r.length;a<0&&(a=-a>p?0:p+a),u=u>p?p:u,u<0&&(u+=p),p=a>u?0:u-a>>>0,a>>>=0;for(var w=N(p);++h<p;)w[h]=r[h+a];return w}function rI(r,a){var u;return jn(r,function(h,p,w){return u=a(h,p,w),!u}),!!u}function ul(r,a,u){var h=0,p=r==null?h:r.length;if(typeof a=="number"&&a===a&&p<=zn){for(;h<p;){var w=h+p>>>1,S=r[w];S!==null&&!ai(S)&&(u?S<=a:S<a)?h=w+1:p=w}return p}return Jc(r,a,Ht,u)}function Jc(r,a,u,h){var p=0,w=r==null?0:r.length;if(w===0)return 0;a=u(a);for(var S=a!==a,b=a===null,T=ai(a),R=a===i;p<w;){var O=tl((p+w)/2),V=u(r[O]),G=V!==i,se=V===null,ce=V===V,Ie=ai(V);if(S)var he=h||ce;else R?he=ce&&(h||G):b?he=ce&&G&&(h||!se):T?he=ce&&G&&!se&&(h||!Ie):se||Ie?he=!1:he=h?V<=a:V<a;he?p=O+1:w=O}return It(w,ti)}function vm(r,a){for(var u=-1,h=r.length,p=0,w=[];++u<h;){var S=r[u],b=a?a(S):S;if(!u||!zi(b,T)){var T=b;w[p++]=S===0?0:S}}return w}function wm(r){return typeof r=="number"?r:ai(r)?Ct:+r}function si(r){if(typeof r=="string")return r;if(ye(r))return Ye(r,si)+"";if(ai(r))return Xg?Xg.call(r):"";var a=r+"";return a=="0"&&1/r==-Le?"-0":a}function Un(r,a,u){var h=-1,p=Uo,w=r.length,S=!0,b=[],T=b;if(u)S=!1,p=Ac;else if(w>=s){var R=a?null:gI(r);if(R)return Fo(R);S=!1,p=ia,T=new br}else T=a?[]:b;e:for(;++h<w;){var O=r[h],V=a?a(O):O;if(O=u||O!==0?O:0,S&&V===V){for(var G=T.length;G--;)if(T[G]===V)continue e;a&&T.push(V),b.push(O)}else p(T,V,u)||(T!==b&&T.push(V),b.push(O))}return b}function Kc(r,a){return a=Wn(a,r),r=Zm(r,a),r==null||delete r[Zi(Ai(a))]}function ym(r,a,u,h){return da(r,a,u(Ir(r,a)),h)}function cl(r,a,u,h){for(var p=r.length,w=h?p:-1;(h?w--:++w<p)&&a(r[w],w,r););return u?Ii(r,h?0:w,h?w+1:p):Ii(r,h?w+1:0,h?p:w)}function xm(r,a){var u=r;return u instanceof Pe&&(u=u.value()),Tc(a,function(h,p){return p.func.apply(p.thisArg,Rn([h],p.args))},u)}function qc(r,a,u){var h=r.length;if(h<2)return h?Un(r[0]):[];for(var p=-1,w=N(h);++p<h;)for(var S=r[p],b=-1;++b<h;)b!=p&&(w[p]=ua(w[p]||S,r[b],a,u));return Un(St(w,1),a,u)}function Sm(r,a,u){for(var h=-1,p=r.length,w=a.length,S={};++h<p;){var b=h<w?a[h]:i;u(S,r[h],b)}return S}function eh(r){return nt(r)?r:[]}function th(r){return typeof r=="function"?r:Ht}function Wn(r,a){return ye(r)?r:ch(r,a)?[r]:Xm(ze(r))}var sI=Ae;function Fn(r,a,u){var h=r.length;return u=u===i?h:u,!a&&u>=h?r:Ii(r,a,u)}var Mm=Zb||function(r){return mt.clearTimeout(r)};function bm(r,a){if(a)return r.slice();var u=r.length,h=Fg?Fg(u):new r.constructor(u);return r.copy(h),h}function ih(r){var a=new r.constructor(r.byteLength);return new Xo(a).set(new Xo(r)),a}function aI(r,a){var u=a?ih(r.buffer):r.buffer;return new r.constructor(u,r.byteOffset,r.byteLength)}function oI(r){var a=new r.constructor(r.source,ag.exec(r));return a.lastIndex=r.lastIndex,a}function lI(r){return oa?$e(oa.call(r)):{}}function Cm(r,a){var u=a?ih(r.buffer):r.buffer;return new r.constructor(u,r.byteOffset,r.length)}function Im(r,a){if(r!==a){var u=r!==i,h=r===null,p=r===r,w=ai(r),S=a!==i,b=a===null,T=a===a,R=ai(a);if(!b&&!R&&!w&&r>a||w&&S&&T&&!b&&!R||h&&S&&T||!u&&T||!p)return 1;if(!h&&!w&&!R&&r<a||R&&u&&p&&!h&&!w||b&&u&&p||!S&&p||!T)return-1}return 0}function uI(r,a,u){for(var h=-1,p=r.criteria,w=a.criteria,S=p.length,b=u.length;++h<S;){var T=Im(p[h],w[h]);if(T){if(h>=b)return T;var R=u[h];return T*(R=="desc"?-1:1)}}return r.index-a.index}function Am(r,a,u,h){for(var p=-1,w=r.length,S=u.length,b=-1,T=a.length,R=dt(w-S,0),O=N(T+R),V=!h;++b<T;)O[b]=a[b];for(;++p<S;)(V||p<w)&&(O[u[p]]=r[p]);for(;R--;)O[b++]=r[p++];return O}function Tm(r,a,u,h){for(var p=-1,w=r.length,S=-1,b=u.length,T=-1,R=a.length,O=dt(w-b,0),V=N(O+R),G=!h;++p<O;)V[p]=r[p];for(var se=p;++T<R;)V[se+T]=a[T];for(;++S<b;)(G||p<w)&&(V[se+u[S]]=r[p++]);return V}function Ut(r,a){var u=-1,h=r.length;for(a||(a=N(h));++u<h;)a[u]=r[u];return a}function Hi(r,a,u,h){var p=!u;u||(u={});for(var w=-1,S=a.length;++w<S;){var b=a[w],T=h?h(u[b],r[b],b,u,r):i;T===i&&(T=r[b]),p?dn(u,b,T):la(u,b,T)}return u}function cI(r,a){return Hi(r,uh(r),a)}function hI(r,a){return Hi(r,$m(r),a)}function hl(r,a){return function(u,h){var p=ye(u)?mb:BC,w=a?a():{};return p(u,r,ue(h,2),w)}}function ds(r){return Ae(function(a,u){var h=-1,p=u.length,w=p>1?u[p-1]:i,S=p>2?u[2]:i;for(w=r.length>3&&typeof w=="function"?(p--,w):i,S&&Bt(u[0],u[1],S)&&(w=p<3?i:w,p=1),a=$e(a);++h<p;){var b=u[h];b&&r(a,b,h,w)}return a})}function Em(r,a){return function(u,h){if(u==null)return u;if(!Wt(u))return r(u,h);for(var p=u.length,w=a?p:-1,S=$e(u);(a?w--:++w<p)&&h(S[w],w,S)!==!1;);return u}}function _m(r){return function(a,u,h){for(var p=-1,w=$e(a),S=h(a),b=S.length;b--;){var T=S[r?b:++p];if(u(w[T],T,w)===!1)break}return a}}function dI(r,a,u){var h=a&y,p=fa(r);function w(){var S=this&&this!==mt&&this instanceof w?p:r;return S.apply(h?u:this,arguments)}return w}function Pm(r){return function(a){a=ze(a);var u=as(a)?ki(a):i,h=u?u[0]:a.charAt(0),p=u?Fn(u,1).join(""):a.slice(1);return h[r]()+p}}function fs(r){return function(a){return Tc(Ev(Tv(a).replace(ib,"")),r,"")}}function fa(r){return function(){var a=arguments;switch(a.length){case 0:return new r;case 1:return new r(a[0]);case 2:return new r(a[0],a[1]);case 3:return new r(a[0],a[1],a[2]);case 4:return new r(a[0],a[1],a[2],a[3]);case 5:return new r(a[0],a[1],a[2],a[3],a[4]);case 6:return new r(a[0],a[1],a[2],a[3],a[4],a[5]);case 7:return new r(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}var u=hs(r.prototype),h=r.apply(u,a);return Je(h)?h:u}}function fI(r,a,u){var h=fa(r);function p(){for(var w=arguments.length,S=N(w),b=w,T=ps(p);b--;)S[b]=arguments[b];var R=w<3&&S[0]!==T&&S[w-1]!==T?[]:On(S,T);if(w-=R.length,w<u)return Dm(r,a,dl,p.placeholder,i,S,R,i,i,u-w);var O=this&&this!==mt&&this instanceof p?h:r;return ni(O,this,S)}return p}function Nm(r){return function(a,u,h){var p=$e(a);if(!Wt(a)){var w=ue(u,3);a=vt(a),u=function(b){return w(p[b],b,p)}}var S=r(a,u,h);return S>-1?p[w?a[S]:S]:i}}function km(r){return pn(function(a){var u=a.length,h=u,p=bi.prototype.thru;for(r&&a.reverse();h--;){var w=a[h];if(typeof w!="function")throw new Mi(l);if(p&&!S&&ml(w)=="wrapper")var S=new bi([],!0)}for(h=S?h:u;++h<u;){w=a[h];var b=ml(w),T=b=="wrapper"?oh(w):i;T&&hh(T[0])&&T[1]==(Q|C|L|J)&&!T[4].length&&T[9]==1?S=S[ml(T[0])].apply(S,T[3]):S=w.length==1&&hh(w)?S[b]():S.thru(w)}return function(){var R=arguments,O=R[0];if(S&&R.length==1&&ye(O))return S.plant(O).value();for(var V=0,G=u?a[V].apply(this,R):O;++V<u;)G=a[V].call(this,G);return G}})}function dl(r,a,u,h,p,w,S,b,T,R){var O=a&Q,V=a&y,G=a&x,se=a&(C|k),ce=a&K,Ie=G?i:fa(r);function he(){for(var Ee=arguments.length,Ne=N(Ee),oi=Ee;oi--;)Ne[oi]=arguments[oi];if(se)var zt=ps(he),li=Ib(Ne,zt);if(h&&(Ne=Am(Ne,h,p,se)),w&&(Ne=Tm(Ne,w,S,se)),Ee-=li,se&&Ee<R){var rt=On(Ne,zt);return Dm(r,a,dl,he.placeholder,u,Ne,rt,b,T,R-Ee)}var Di=V?u:this,wn=G?Di[r]:r;return Ee=Ne.length,b?Ne=BI(Ne,b):ce&&Ee>1&&Ne.reverse(),O&&T<Ee&&(Ne.length=T),this&&this!==mt&&this instanceof he&&(wn=Ie||fa(wn)),wn.apply(Di,Ne)}return he}function Bm(r,a){return function(u,h){return jC(u,r,a(h),{})}}function fl(r,a){return function(u,h){var p;if(u===i&&h===i)return a;if(u!==i&&(p=u),h!==i){if(p===i)return h;typeof u=="string"||typeof h=="string"?(u=si(u),h=si(h)):(u=wm(u),h=wm(h)),p=r(u,h)}return p}}function nh(r){return pn(function(a){return a=Ye(a,ri(ue())),Ae(function(u){var h=this;return r(a,function(p){return ni(p,h,u)})})})}function pl(r,a){a=a===i?" ":si(a);var u=a.length;if(u<2)return u?Xc(a,r):a;var h=Xc(a,el(r/os(a)));return as(a)?Fn(ki(h),0,r).join(""):h.slice(0,r)}function pI(r,a,u,h){var p=a&y,w=fa(r);function S(){for(var b=-1,T=arguments.length,R=-1,O=h.length,V=N(O+T),G=this&&this!==mt&&this instanceof S?w:r;++R<O;)V[R]=h[R];for(;T--;)V[R++]=arguments[++b];return ni(G,p?u:this,V)}return S}function zm(r){return function(a,u,h){return h&&typeof h!="number"&&Bt(a,u,h)&&(u=h=i),a=vn(a),u===i?(u=a,a=0):u=vn(u),h=h===i?a<u?1:-1:vn(h),qC(a,u,h,r)}}function gl(r){return function(a,u){return typeof a=="string"&&typeof u=="string"||(a=Ti(a),u=Ti(u)),r(a,u)}}function Dm(r,a,u,h,p,w,S,b,T,R){var O=a&C,V=O?S:i,G=O?i:S,se=O?w:i,ce=O?i:w;a|=O?L:W,a&=~(O?W:L),a&I||(a&=-4);var Ie=[r,a,p,se,V,ce,G,b,T,R],he=u.apply(i,Ie);return hh(r)&&Qm(he,Ie),he.placeholder=h,Ym(he,r,a)}function rh(r){var a=ht[r];return function(u,h){if(u=Ti(u),h=h==null?0:It(xe(h),292),h&&Yg(u)){var p=(ze(u)+"e").split("e"),w=a(p[0]+"e"+(+p[1]+h));return p=(ze(w)+"e").split("e"),+(p[0]+"e"+(+p[1]-h))}return a(u)}}var gI=us&&1/Fo(new us([,-0]))[1]==Le?function(r){return new us(r)}:Ah;function Lm(r){return function(a){var u=At(a);return u==Ze?zc(a):u==ct?kb(a):Cb(a,r(a))}}function fn(r,a,u,h,p,w,S,b){var T=a&x;if(!T&&typeof r!="function")throw new Mi(l);var R=h?h.length:0;if(R||(a&=-97,h=p=i),S=S===i?S:dt(xe(S),0),b=b===i?b:xe(b),R-=p?p.length:0,a&W){var O=h,V=p;h=p=i}var G=T?i:oh(r),se=[r,a,u,h,p,O,V,w,S,b];if(G&&PI(se,G),r=se[0],a=se[1],u=se[2],h=se[3],p=se[4],b=se[9]=se[9]===i?T?0:r.length:dt(se[9]-R,0),!b&&a&(C|k)&&(a&=-25),!a||a==y)var ce=dI(r,a,u);else a==C||a==k?ce=fI(r,a,b):(a==L||a==(y|L))&&!p.length?ce=pI(r,a,u,h):ce=dl.apply(i,se);var Ie=G?mm:Qm;return Ym(Ie(ce,se),r,a)}function Rm(r,a,u,h){return r===i||zi(r,ls[u])&&!Re.call(h,u)?a:r}function Om(r,a,u,h,p,w){return Je(r)&&Je(a)&&(w.set(a,r),ll(r,a,i,Om,w),w.delete(a)),r}function mI(r){return ma(r)?i:r}function Vm(r,a,u,h,p,w){var S=u&_,b=r.length,T=a.length;if(b!=T&&!(S&&T>b))return!1;var R=w.get(r),O=w.get(a);if(R&&O)return R==a&&O==r;var V=-1,G=!0,se=u&P?new br:i;for(w.set(r,a),w.set(a,r);++V<b;){var ce=r[V],Ie=a[V];if(h)var he=S?h(Ie,ce,V,a,r,w):h(ce,Ie,V,r,a,w);if(he!==i){if(he)continue;G=!1;break}if(se){if(!Ec(a,function(Ee,Ne){if(!ia(se,Ne)&&(ce===Ee||p(ce,Ee,u,h,w)))return se.push(Ne)})){G=!1;break}}else if(!(ce===Ie||p(ce,Ie,u,h,w))){G=!1;break}}return w.delete(r),w.delete(a),G}function vI(r,a,u,h,p,w,S){switch(u){case wi:if(r.byteLength!=a.byteLength||r.byteOffset!=a.byteOffset)return!1;r=r.buffer,a=a.buffer;case un:return!(r.byteLength!=a.byteLength||!w(new Xo(r),new Xo(a)));case Z:case ne:case Ue:return zi(+r,+a);case ve:return r.name==a.name&&r.message==a.message;case mi:case gt:return r==a+"";case Ze:var b=zc;case ct:var T=h&_;if(b||(b=Fo),r.size!=a.size&&!T)return!1;var R=S.get(r);if(R)return R==a;h|=P,S.set(r,a);var O=Vm(b(r),b(a),h,p,w,S);return S.delete(r),O;case Ui:if(oa)return oa.call(r)==oa.call(a)}return!1}function wI(r,a,u,h,p,w){var S=u&_,b=sh(r),T=b.length,R=sh(a),O=R.length;if(T!=O&&!S)return!1;for(var V=T;V--;){var G=b[V];if(!(S?G in a:Re.call(a,G)))return!1}var se=w.get(r),ce=w.get(a);if(se&&ce)return se==a&&ce==r;var Ie=!0;w.set(r,a),w.set(a,r);for(var he=S;++V<T;){G=b[V];var Ee=r[G],Ne=a[G];if(h)var oi=S?h(Ne,Ee,G,a,r,w):h(Ee,Ne,G,r,a,w);if(!(oi===i?Ee===Ne||p(Ee,Ne,u,h,w):oi)){Ie=!1;break}he||(he=G=="constructor")}if(Ie&&!he){var zt=r.constructor,li=a.constructor;zt!=li&&"constructor"in r&&"constructor"in a&&!(typeof zt=="function"&&zt instanceof zt&&typeof li=="function"&&li instanceof li)&&(Ie=!1)}return w.delete(r),w.delete(a),Ie}function pn(r){return fh(Hm(r,i,ev),r+"")}function sh(r){return sm(r,vt,uh)}function ah(r){return sm(r,Ft,$m)}var oh=il?function(r){return il.get(r)}:Ah;function ml(r){for(var a=r.name+"",u=cs[a],h=Re.call(cs,a)?u.length:0;h--;){var p=u[h],w=p.func;if(w==null||w==r)return p.name}return a}function ps(r){var a=Re.call(m,"placeholder")?m:r;return a.placeholder}function ue(){var r=m.iteratee||Ch;return r=r===Ch?lm:r,arguments.length?r(arguments[0],arguments[1]):r}function vl(r,a){var u=r.__data__;return AI(a)?u[typeof a=="string"?"string":"hash"]:u.map}function lh(r){for(var a=vt(r),u=a.length;u--;){var h=a[u],p=r[h];a[u]=[h,p,Wm(p)]}return a}function Ar(r,a){var u=_b(r,a);return om(u)?u:i}function yI(r){var a=Re.call(r,Sr),u=r[Sr];try{r[Sr]=i;var h=!0}catch{}var p=Yo.call(r);return h&&(a?r[Sr]=u:delete r[Sr]),p}var uh=Lc?function(r){return r==null?[]:(r=$e(r),Ln(Lc(r),function(a){return Zg.call(r,a)}))}:Th,$m=Lc?function(r){for(var a=[];r;)Rn(a,uh(r)),r=Jo(r);return a}:Th,At=kt;(Rc&&At(new Rc(new ArrayBuffer(1)))!=wi||ra&&At(new ra)!=Ze||Oc&&At(Oc.resolve())!=jt||us&&At(new us)!=ct||sa&&At(new sa)!=vi)&&(At=function(r){var a=kt(r),u=a==Qe?r.constructor:i,h=u?Tr(u):"";if(h)switch(h){case tC:return wi;case iC:return Ze;case nC:return jt;case rC:return ct;case sC:return vi}return a});function xI(r,a,u){for(var h=-1,p=u.length;++h<p;){var w=u[h],S=w.size;switch(w.type){case"drop":r+=S;break;case"dropRight":a-=S;break;case"take":a=It(a,r+S);break;case"takeRight":r=dt(r,a-S);break}}return{start:r,end:a}}function SI(r){var a=r.match(TM);return a?a[1].split(EM):[]}function jm(r,a,u){a=Wn(a,r);for(var h=-1,p=a.length,w=!1;++h<p;){var S=Zi(a[h]);if(!(w=r!=null&&u(r,S)))break;r=r[S]}return w||++h!=p?w:(p=r==null?0:r.length,!!p&&Cl(p)&&gn(S,p)&&(ye(r)||Er(r)))}function MI(r){var a=r.length,u=new r.constructor(a);return a&&typeof r[0]=="string"&&Re.call(r,"index")&&(u.index=r.index,u.input=r.input),u}function Um(r){return typeof r.constructor=="function"&&!pa(r)?hs(Jo(r)):{}}function bI(r,a,u){var h=r.constructor;switch(a){case un:return ih(r);case Z:case ne:return new h(+r);case wi:return aI(r,u);case wr:case ee:case Ce:case re:case We:case ii:case yi:case Wi:case yr:return Cm(r,u);case Ze:return new h;case Ue:case gt:return new h(r);case mi:return oI(r);case ct:return new h;case Ui:return lI(r)}}function CI(r,a){var u=a.length;if(!u)return r;var h=u-1;return a[h]=(u>1?"& ":"")+a[h],a=a.join(u>2?", ":" "),r.replace(AM,`{
|
|
49
|
-
/* [wrapped with `+a+`] */
|
|
50
|
-
`)}function II(r){return ye(r)||Er(r)||!!(Qg&&r&&r[Qg])}function gn(r,a){var u=typeof r;return a=a==null?le:a,!!a&&(u=="number"||u!="symbol"&&RM.test(r))&&r>-1&&r%1==0&&r<a}function Bt(r,a,u){if(!Je(u))return!1;var h=typeof a;return(h=="number"?Wt(u)&&gn(a,u.length):h=="string"&&a in u)?zi(u[a],r):!1}function ch(r,a){if(ye(r))return!1;var u=typeof r;return u=="number"||u=="symbol"||u=="boolean"||r==null||ai(r)?!0:MM.test(r)||!SM.test(r)||a!=null&&r in $e(a)}function AI(r){var a=typeof r;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?r!=="__proto__":r===null}function hh(r){var a=ml(r),u=m[a];if(typeof u!="function"||!(a in Pe.prototype))return!1;if(r===u)return!0;var h=oh(u);return!!h&&r===h[0]}function TI(r){return!!Wg&&Wg in r}var EI=Zo?mn:Eh;function pa(r){var a=r&&r.constructor,u=typeof a=="function"&&a.prototype||ls;return r===u}function Wm(r){return r===r&&!Je(r)}function Fm(r,a){return function(u){return u==null?!1:u[r]===a&&(a!==i||r in $e(u))}}function _I(r){var a=Ml(r,function(h){return u.size===f&&u.clear(),h}),u=a.cache;return a}function PI(r,a){var u=r[1],h=a[1],p=u|h,w=p<(y|x|Q),S=h==Q&&u==C||h==Q&&u==J&&r[7].length<=a[8]||h==(Q|J)&&a[7].length<=a[8]&&u==C;if(!(w||S))return r;h&y&&(r[2]=a[2],p|=u&y?0:I);var b=a[3];if(b){var T=r[3];r[3]=T?Am(T,b,a[4]):b,r[4]=T?On(r[3],g):a[4]}return b=a[5],b&&(T=r[5],r[5]=T?Tm(T,b,a[6]):b,r[6]=T?On(r[5],g):a[6]),b=a[7],b&&(r[7]=b),h&Q&&(r[8]=r[8]==null?a[8]:It(r[8],a[8])),r[9]==null&&(r[9]=a[9]),r[0]=a[0],r[1]=p,r}function NI(r){var a=[];if(r!=null)for(var u in $e(r))a.push(u);return a}function kI(r){return Yo.call(r)}function Hm(r,a,u){return a=dt(a===i?r.length-1:a,0),function(){for(var h=arguments,p=-1,w=dt(h.length-a,0),S=N(w);++p<w;)S[p]=h[a+p];p=-1;for(var b=N(a+1);++p<a;)b[p]=h[p];return b[a]=u(S),ni(r,this,b)}}function Zm(r,a){return a.length<2?r:Ir(r,Ii(a,0,-1))}function BI(r,a){for(var u=r.length,h=It(a.length,u),p=Ut(r);h--;){var w=a[h];r[h]=gn(w,u)?p[w]:i}return r}function dh(r,a){if(!(a==="constructor"&&typeof r[a]=="function")&&a!="__proto__")return r[a]}var Qm=Gm(mm),ga=Yb||function(r,a){return mt.setTimeout(r,a)},fh=Gm(iI);function Ym(r,a,u){var h=a+"";return fh(r,CI(h,zI(SI(h),u)))}function Gm(r){var a=0,u=0;return function(){var h=Kb(),p=oe-(h-u);if(u=h,p>0){if(++a>=z)return arguments[0]}else a=0;return r.apply(i,arguments)}}function wl(r,a){var u=-1,h=r.length,p=h-1;for(a=a===i?h:a;++u<a;){var w=Gc(u,p),S=r[w];r[w]=r[u],r[u]=S}return r.length=a,r}var Xm=_I(function(r){var a=[];return r.charCodeAt(0)===46&&a.push(""),r.replace(bM,function(u,h,p,w){a.push(p?w.replace(NM,"$1"):h||u)}),a});function Zi(r){if(typeof r=="string"||ai(r))return r;var a=r+"";return a=="0"&&1/r==-Le?"-0":a}function Tr(r){if(r!=null){try{return Qo.call(r)}catch{}try{return r+""}catch{}}return""}function zI(r,a){return Si(F,function(u){var h="_."+u[0];a&u[1]&&!Uo(r,h)&&r.push(h)}),r.sort()}function Jm(r){if(r instanceof Pe)return r.clone();var a=new bi(r.__wrapped__,r.__chain__);return a.__actions__=Ut(r.__actions__),a.__index__=r.__index__,a.__values__=r.__values__,a}function DI(r,a,u){(u?Bt(r,a,u):a===i)?a=1:a=dt(xe(a),0);var h=r==null?0:r.length;if(!h||a<1)return[];for(var p=0,w=0,S=N(el(h/a));p<h;)S[w++]=Ii(r,p,p+=a);return S}function LI(r){for(var a=-1,u=r==null?0:r.length,h=0,p=[];++a<u;){var w=r[a];w&&(p[h++]=w)}return p}function RI(){var r=arguments.length;if(!r)return[];for(var a=N(r-1),u=arguments[0],h=r;h--;)a[h-1]=arguments[h];return Rn(ye(u)?Ut(u):[u],St(a,1))}var OI=Ae(function(r,a){return nt(r)?ua(r,St(a,1,nt,!0)):[]}),VI=Ae(function(r,a){var u=Ai(a);return nt(u)&&(u=i),nt(r)?ua(r,St(a,1,nt,!0),ue(u,2)):[]}),$I=Ae(function(r,a){var u=Ai(a);return nt(u)&&(u=i),nt(r)?ua(r,St(a,1,nt,!0),i,u):[]});function jI(r,a,u){var h=r==null?0:r.length;return h?(a=u||a===i?1:xe(a),Ii(r,a<0?0:a,h)):[]}function UI(r,a,u){var h=r==null?0:r.length;return h?(a=u||a===i?1:xe(a),a=h-a,Ii(r,0,a<0?0:a)):[]}function WI(r,a){return r&&r.length?cl(r,ue(a,3),!0,!0):[]}function FI(r,a){return r&&r.length?cl(r,ue(a,3),!0):[]}function HI(r,a,u,h){var p=r==null?0:r.length;return p?(u&&typeof u!="number"&&Bt(r,a,u)&&(u=0,h=p),RC(r,a,u,h)):[]}function Km(r,a,u){var h=r==null?0:r.length;if(!h)return-1;var p=u==null?0:xe(u);return p<0&&(p=dt(h+p,0)),Wo(r,ue(a,3),p)}function qm(r,a,u){var h=r==null?0:r.length;if(!h)return-1;var p=h-1;return u!==i&&(p=xe(u),p=u<0?dt(h+p,0):It(p,h-1)),Wo(r,ue(a,3),p,!0)}function ev(r){var a=r==null?0:r.length;return a?St(r,1):[]}function ZI(r){var a=r==null?0:r.length;return a?St(r,Le):[]}function QI(r,a){var u=r==null?0:r.length;return u?(a=a===i?1:xe(a),St(r,a)):[]}function YI(r){for(var a=-1,u=r==null?0:r.length,h={};++a<u;){var p=r[a];h[p[0]]=p[1]}return h}function tv(r){return r&&r.length?r[0]:i}function GI(r,a,u){var h=r==null?0:r.length;if(!h)return-1;var p=u==null?0:xe(u);return p<0&&(p=dt(h+p,0)),ss(r,a,p)}function XI(r){var a=r==null?0:r.length;return a?Ii(r,0,-1):[]}var JI=Ae(function(r){var a=Ye(r,eh);return a.length&&a[0]===r[0]?Fc(a):[]}),KI=Ae(function(r){var a=Ai(r),u=Ye(r,eh);return a===Ai(u)?a=i:u.pop(),u.length&&u[0]===r[0]?Fc(u,ue(a,2)):[]}),qI=Ae(function(r){var a=Ai(r),u=Ye(r,eh);return a=typeof a=="function"?a:i,a&&u.pop(),u.length&&u[0]===r[0]?Fc(u,i,a):[]});function eA(r,a){return r==null?"":Xb.call(r,a)}function Ai(r){var a=r==null?0:r.length;return a?r[a-1]:i}function tA(r,a,u){var h=r==null?0:r.length;if(!h)return-1;var p=h;return u!==i&&(p=xe(u),p=p<0?dt(h+p,0):It(p,h-1)),a===a?zb(r,a,p):Wo(r,Dg,p,!0)}function iA(r,a){return r&&r.length?dm(r,xe(a)):i}var nA=Ae(iv);function iv(r,a){return r&&r.length&&a&&a.length?Yc(r,a):r}function rA(r,a,u){return r&&r.length&&a&&a.length?Yc(r,a,ue(u,2)):r}function sA(r,a,u){return r&&r.length&&a&&a.length?Yc(r,a,i,u):r}var aA=pn(function(r,a){var u=r==null?0:r.length,h=$c(r,a);return gm(r,Ye(a,function(p){return gn(p,u)?+p:p}).sort(Im)),h});function oA(r,a){var u=[];if(!(r&&r.length))return u;var h=-1,p=[],w=r.length;for(a=ue(a,3);++h<w;){var S=r[h];a(S,h,r)&&(u.push(S),p.push(h))}return gm(r,p),u}function ph(r){return r==null?r:eC.call(r)}function lA(r,a,u){var h=r==null?0:r.length;return h?(u&&typeof u!="number"&&Bt(r,a,u)?(a=0,u=h):(a=a==null?0:xe(a),u=u===i?h:xe(u)),Ii(r,a,u)):[]}function uA(r,a){return ul(r,a)}function cA(r,a,u){return Jc(r,a,ue(u,2))}function hA(r,a){var u=r==null?0:r.length;if(u){var h=ul(r,a);if(h<u&&zi(r[h],a))return h}return-1}function dA(r,a){return ul(r,a,!0)}function fA(r,a,u){return Jc(r,a,ue(u,2),!0)}function pA(r,a){var u=r==null?0:r.length;if(u){var h=ul(r,a,!0)-1;if(zi(r[h],a))return h}return-1}function gA(r){return r&&r.length?vm(r):[]}function mA(r,a){return r&&r.length?vm(r,ue(a,2)):[]}function vA(r){var a=r==null?0:r.length;return a?Ii(r,1,a):[]}function wA(r,a,u){return r&&r.length?(a=u||a===i?1:xe(a),Ii(r,0,a<0?0:a)):[]}function yA(r,a,u){var h=r==null?0:r.length;return h?(a=u||a===i?1:xe(a),a=h-a,Ii(r,a<0?0:a,h)):[]}function xA(r,a){return r&&r.length?cl(r,ue(a,3),!1,!0):[]}function SA(r,a){return r&&r.length?cl(r,ue(a,3)):[]}var MA=Ae(function(r){return Un(St(r,1,nt,!0))}),bA=Ae(function(r){var a=Ai(r);return nt(a)&&(a=i),Un(St(r,1,nt,!0),ue(a,2))}),CA=Ae(function(r){var a=Ai(r);return a=typeof a=="function"?a:i,Un(St(r,1,nt,!0),i,a)});function IA(r){return r&&r.length?Un(r):[]}function AA(r,a){return r&&r.length?Un(r,ue(a,2)):[]}function TA(r,a){return a=typeof a=="function"?a:i,r&&r.length?Un(r,i,a):[]}function gh(r){if(!(r&&r.length))return[];var a=0;return r=Ln(r,function(u){if(nt(u))return a=dt(u.length,a),!0}),kc(a,function(u){return Ye(r,_c(u))})}function nv(r,a){if(!(r&&r.length))return[];var u=gh(r);return a==null?u:Ye(u,function(h){return ni(a,i,h)})}var EA=Ae(function(r,a){return nt(r)?ua(r,a):[]}),_A=Ae(function(r){return qc(Ln(r,nt))}),PA=Ae(function(r){var a=Ai(r);return nt(a)&&(a=i),qc(Ln(r,nt),ue(a,2))}),NA=Ae(function(r){var a=Ai(r);return a=typeof a=="function"?a:i,qc(Ln(r,nt),i,a)}),kA=Ae(gh);function BA(r,a){return Sm(r||[],a||[],la)}function zA(r,a){return Sm(r||[],a||[],da)}var DA=Ae(function(r){var a=r.length,u=a>1?r[a-1]:i;return u=typeof u=="function"?(r.pop(),u):i,nv(r,u)});function rv(r){var a=m(r);return a.__chain__=!0,a}function LA(r,a){return a(r),r}function yl(r,a){return a(r)}var RA=pn(function(r){var a=r.length,u=a?r[0]:0,h=this.__wrapped__,p=function(w){return $c(w,r)};return a>1||this.__actions__.length||!(h instanceof Pe)||!gn(u)?this.thru(p):(h=h.slice(u,+u+(a?1:0)),h.__actions__.push({func:yl,args:[p],thisArg:i}),new bi(h,this.__chain__).thru(function(w){return a&&!w.length&&w.push(i),w}))});function OA(){return rv(this)}function VA(){return new bi(this.value(),this.__chain__)}function $A(){this.__values__===i&&(this.__values__=wv(this.value()));var r=this.__index__>=this.__values__.length,a=r?i:this.__values__[this.__index__++];return{done:r,value:a}}function jA(){return this}function UA(r){for(var a,u=this;u instanceof rl;){var h=Jm(u);h.__index__=0,h.__values__=i,a?p.__wrapped__=h:a=h;var p=h;u=u.__wrapped__}return p.__wrapped__=r,a}function WA(){var r=this.__wrapped__;if(r instanceof Pe){var a=r;return this.__actions__.length&&(a=new Pe(this)),a=a.reverse(),a.__actions__.push({func:yl,args:[ph],thisArg:i}),new bi(a,this.__chain__)}return this.thru(ph)}function FA(){return xm(this.__wrapped__,this.__actions__)}var HA=hl(function(r,a,u){Re.call(r,u)?++r[u]:dn(r,u,1)});function ZA(r,a,u){var h=ye(r)?Bg:LC;return u&&Bt(r,a,u)&&(a=i),h(r,ue(a,3))}function QA(r,a){var u=ye(r)?Ln:nm;return u(r,ue(a,3))}var YA=Nm(Km),GA=Nm(qm);function XA(r,a){return St(xl(r,a),1)}function JA(r,a){return St(xl(r,a),Le)}function KA(r,a,u){return u=u===i?1:xe(u),St(xl(r,a),u)}function sv(r,a){var u=ye(r)?Si:jn;return u(r,ue(a,3))}function av(r,a){var u=ye(r)?vb:im;return u(r,ue(a,3))}var qA=hl(function(r,a,u){Re.call(r,u)?r[u].push(a):dn(r,u,[a])});function eT(r,a,u,h){r=Wt(r)?r:ms(r),u=u&&!h?xe(u):0;var p=r.length;return u<0&&(u=dt(p+u,0)),Il(r)?u<=p&&r.indexOf(a,u)>-1:!!p&&ss(r,a,u)>-1}var tT=Ae(function(r,a,u){var h=-1,p=typeof a=="function",w=Wt(r)?N(r.length):[];return jn(r,function(S){w[++h]=p?ni(a,S,u):ca(S,a,u)}),w}),iT=hl(function(r,a,u){dn(r,u,a)});function xl(r,a){var u=ye(r)?Ye:um;return u(r,ue(a,3))}function nT(r,a,u,h){return r==null?[]:(ye(a)||(a=a==null?[]:[a]),u=h?i:u,ye(u)||(u=u==null?[]:[u]),fm(r,a,u))}var rT=hl(function(r,a,u){r[u?0:1].push(a)},function(){return[[],[]]});function sT(r,a,u){var h=ye(r)?Tc:Rg,p=arguments.length<3;return h(r,ue(a,4),u,p,jn)}function aT(r,a,u){var h=ye(r)?wb:Rg,p=arguments.length<3;return h(r,ue(a,4),u,p,im)}function oT(r,a){var u=ye(r)?Ln:nm;return u(r,bl(ue(a,3)))}function lT(r){var a=ye(r)?Kg:eI;return a(r)}function uT(r,a,u){(u?Bt(r,a,u):a===i)?a=1:a=xe(a);var h=ye(r)?NC:tI;return h(r,a)}function cT(r){var a=ye(r)?kC:nI;return a(r)}function hT(r){if(r==null)return 0;if(Wt(r))return Il(r)?os(r):r.length;var a=At(r);return a==Ze||a==ct?r.size:Zc(r).length}function dT(r,a,u){var h=ye(r)?Ec:rI;return u&&Bt(r,a,u)&&(a=i),h(r,ue(a,3))}var fT=Ae(function(r,a){if(r==null)return[];var u=a.length;return u>1&&Bt(r,a[0],a[1])?a=[]:u>2&&Bt(a[0],a[1],a[2])&&(a=[a[0]]),fm(r,St(a,1),[])}),Sl=Qb||function(){return mt.Date.now()};function pT(r,a){if(typeof a!="function")throw new Mi(l);return r=xe(r),function(){if(--r<1)return a.apply(this,arguments)}}function ov(r,a,u){return a=u?i:a,a=r&&a==null?r.length:a,fn(r,Q,i,i,i,i,a)}function lv(r,a){var u;if(typeof a!="function")throw new Mi(l);return r=xe(r),function(){return--r>0&&(u=a.apply(this,arguments)),r<=1&&(a=i),u}}var mh=Ae(function(r,a,u){var h=y;if(u.length){var p=On(u,ps(mh));h|=L}return fn(r,h,a,u,p)}),uv=Ae(function(r,a,u){var h=y|x;if(u.length){var p=On(u,ps(uv));h|=L}return fn(a,h,r,u,p)});function cv(r,a,u){a=u?i:a;var h=fn(r,C,i,i,i,i,i,a);return h.placeholder=cv.placeholder,h}function hv(r,a,u){a=u?i:a;var h=fn(r,k,i,i,i,i,i,a);return h.placeholder=hv.placeholder,h}function dv(r,a,u){var h,p,w,S,b,T,R=0,O=!1,V=!1,G=!0;if(typeof r!="function")throw new Mi(l);a=Ti(a)||0,Je(u)&&(O=!!u.leading,V="maxWait"in u,w=V?dt(Ti(u.maxWait)||0,a):w,G="trailing"in u?!!u.trailing:G);function se(rt){var Di=h,wn=p;return h=p=i,R=rt,S=r.apply(wn,Di),S}function ce(rt){return R=rt,b=ga(Ee,a),O?se(rt):S}function Ie(rt){var Di=rt-T,wn=rt-R,Nv=a-Di;return V?It(Nv,w-wn):Nv}function he(rt){var Di=rt-T,wn=rt-R;return T===i||Di>=a||Di<0||V&&wn>=w}function Ee(){var rt=Sl();if(he(rt))return Ne(rt);b=ga(Ee,Ie(rt))}function Ne(rt){return b=i,G&&h?se(rt):(h=p=i,S)}function oi(){b!==i&&Mm(b),R=0,h=T=p=b=i}function zt(){return b===i?S:Ne(Sl())}function li(){var rt=Sl(),Di=he(rt);if(h=arguments,p=this,T=rt,Di){if(b===i)return ce(T);if(V)return Mm(b),b=ga(Ee,a),se(T)}return b===i&&(b=ga(Ee,a)),S}return li.cancel=oi,li.flush=zt,li}var gT=Ae(function(r,a){return tm(r,1,a)}),mT=Ae(function(r,a,u){return tm(r,Ti(a)||0,u)});function vT(r){return fn(r,K)}function Ml(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new Mi(l);var u=function(){var h=arguments,p=a?a.apply(this,h):h[0],w=u.cache;if(w.has(p))return w.get(p);var S=r.apply(this,h);return u.cache=w.set(p,S)||w,S};return u.cache=new(Ml.Cache||hn),u}Ml.Cache=hn;function bl(r){if(typeof r!="function")throw new Mi(l);return function(){var a=arguments;switch(a.length){case 0:return!r.call(this);case 1:return!r.call(this,a[0]);case 2:return!r.call(this,a[0],a[1]);case 3:return!r.call(this,a[0],a[1],a[2])}return!r.apply(this,a)}}function wT(r){return lv(2,r)}var yT=sI(function(r,a){a=a.length==1&&ye(a[0])?Ye(a[0],ri(ue())):Ye(St(a,1),ri(ue()));var u=a.length;return Ae(function(h){for(var p=-1,w=It(h.length,u);++p<w;)h[p]=a[p].call(this,h[p]);return ni(r,this,h)})}),vh=Ae(function(r,a){var u=On(a,ps(vh));return fn(r,L,i,a,u)}),fv=Ae(function(r,a){var u=On(a,ps(fv));return fn(r,W,i,a,u)}),xT=pn(function(r,a){return fn(r,J,i,i,i,a)});function ST(r,a){if(typeof r!="function")throw new Mi(l);return a=a===i?a:xe(a),Ae(r,a)}function MT(r,a){if(typeof r!="function")throw new Mi(l);return a=a==null?0:dt(xe(a),0),Ae(function(u){var h=u[a],p=Fn(u,0,a);return h&&Rn(p,h),ni(r,this,p)})}function bT(r,a,u){var h=!0,p=!0;if(typeof r!="function")throw new Mi(l);return Je(u)&&(h="leading"in u?!!u.leading:h,p="trailing"in u?!!u.trailing:p),dv(r,a,{leading:h,maxWait:a,trailing:p})}function CT(r){return ov(r,1)}function IT(r,a){return vh(th(a),r)}function AT(){if(!arguments.length)return[];var r=arguments[0];return ye(r)?r:[r]}function TT(r){return Ci(r,E)}function ET(r,a){return a=typeof a=="function"?a:i,Ci(r,E,a)}function _T(r){return Ci(r,v|E)}function PT(r,a){return a=typeof a=="function"?a:i,Ci(r,v|E,a)}function NT(r,a){return a==null||em(r,a,vt(a))}function zi(r,a){return r===a||r!==r&&a!==a}var kT=gl(Wc),BT=gl(function(r,a){return r>=a}),Er=am(function(){return arguments}())?am:function(r){return et(r)&&Re.call(r,"callee")&&!Zg.call(r,"callee")},ye=N.isArray,zT=Tg?ri(Tg):UC;function Wt(r){return r!=null&&Cl(r.length)&&!mn(r)}function nt(r){return et(r)&&Wt(r)}function DT(r){return r===!0||r===!1||et(r)&&kt(r)==Z}var Hn=Gb||Eh,LT=Eg?ri(Eg):WC;function RT(r){return et(r)&&r.nodeType===1&&!ma(r)}function OT(r){if(r==null)return!0;if(Wt(r)&&(ye(r)||typeof r=="string"||typeof r.splice=="function"||Hn(r)||gs(r)||Er(r)))return!r.length;var a=At(r);if(a==Ze||a==ct)return!r.size;if(pa(r))return!Zc(r).length;for(var u in r)if(Re.call(r,u))return!1;return!0}function VT(r,a){return ha(r,a)}function $T(r,a,u){u=typeof u=="function"?u:i;var h=u?u(r,a):i;return h===i?ha(r,a,i,u):!!h}function wh(r){if(!et(r))return!1;var a=kt(r);return a==ve||a==pe||typeof r.message=="string"&&typeof r.name=="string"&&!ma(r)}function jT(r){return typeof r=="number"&&Yg(r)}function mn(r){if(!Je(r))return!1;var a=kt(r);return a==ge||a==Xe||a==$||a==Dn}function pv(r){return typeof r=="number"&&r==xe(r)}function Cl(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=le}function Je(r){var a=typeof r;return r!=null&&(a=="object"||a=="function")}function et(r){return r!=null&&typeof r=="object"}var gv=_g?ri(_g):HC;function UT(r,a){return r===a||Hc(r,a,lh(a))}function WT(r,a,u){return u=typeof u=="function"?u:i,Hc(r,a,lh(a),u)}function FT(r){return mv(r)&&r!=+r}function HT(r){if(EI(r))throw new we(o);return om(r)}function ZT(r){return r===null}function QT(r){return r==null}function mv(r){return typeof r=="number"||et(r)&&kt(r)==Ue}function ma(r){if(!et(r)||kt(r)!=Qe)return!1;var a=Jo(r);if(a===null)return!0;var u=Re.call(a,"constructor")&&a.constructor;return typeof u=="function"&&u instanceof u&&Qo.call(u)==Wb}var yh=Pg?ri(Pg):ZC;function YT(r){return pv(r)&&r>=-le&&r<=le}var vv=Ng?ri(Ng):QC;function Il(r){return typeof r=="string"||!ye(r)&&et(r)&&kt(r)==gt}function ai(r){return typeof r=="symbol"||et(r)&&kt(r)==Ui}var gs=kg?ri(kg):YC;function GT(r){return r===i}function XT(r){return et(r)&&At(r)==vi}function JT(r){return et(r)&&kt(r)==ta}var KT=gl(Qc),qT=gl(function(r,a){return r<=a});function wv(r){if(!r)return[];if(Wt(r))return Il(r)?ki(r):Ut(r);if(na&&r[na])return Nb(r[na]());var a=At(r),u=a==Ze?zc:a==ct?Fo:ms;return u(r)}function vn(r){if(!r)return r===0?r:0;if(r=Ti(r),r===Le||r===-Le){var a=r<0?-1:1;return a*pt}return r===r?r:0}function xe(r){var a=vn(r),u=a%1;return a===a?u?a-u:a:0}function yv(r){return r?Cr(xe(r),0,ot):0}function Ti(r){if(typeof r=="number")return r;if(ai(r))return Ct;if(Je(r)){var a=typeof r.valueOf=="function"?r.valueOf():r;r=Je(a)?a+"":a}if(typeof r!="string")return r===0?r:+r;r=Og(r);var u=zM.test(r);return u||LM.test(r)?pb(r.slice(2),u?2:8):BM.test(r)?Ct:+r}function xv(r){return Hi(r,Ft(r))}function eE(r){return r?Cr(xe(r),-le,le):r===0?r:0}function ze(r){return r==null?"":si(r)}var tE=ds(function(r,a){if(pa(a)||Wt(a)){Hi(a,vt(a),r);return}for(var u in a)Re.call(a,u)&&la(r,u,a[u])}),Sv=ds(function(r,a){Hi(a,Ft(a),r)}),Al=ds(function(r,a,u,h){Hi(a,Ft(a),r,h)}),iE=ds(function(r,a,u,h){Hi(a,vt(a),r,h)}),nE=pn($c);function rE(r,a){var u=hs(r);return a==null?u:qg(u,a)}var sE=Ae(function(r,a){r=$e(r);var u=-1,h=a.length,p=h>2?a[2]:i;for(p&&Bt(a[0],a[1],p)&&(h=1);++u<h;)for(var w=a[u],S=Ft(w),b=-1,T=S.length;++b<T;){var R=S[b],O=r[R];(O===i||zi(O,ls[R])&&!Re.call(r,R))&&(r[R]=w[R])}return r}),aE=Ae(function(r){return r.push(i,Om),ni(Mv,i,r)});function oE(r,a){return zg(r,ue(a,3),Fi)}function lE(r,a){return zg(r,ue(a,3),Uc)}function uE(r,a){return r==null?r:jc(r,ue(a,3),Ft)}function cE(r,a){return r==null?r:rm(r,ue(a,3),Ft)}function hE(r,a){return r&&Fi(r,ue(a,3))}function dE(r,a){return r&&Uc(r,ue(a,3))}function fE(r){return r==null?[]:ol(r,vt(r))}function pE(r){return r==null?[]:ol(r,Ft(r))}function xh(r,a,u){var h=r==null?i:Ir(r,a);return h===i?u:h}function gE(r,a){return r!=null&&jm(r,a,OC)}function Sh(r,a){return r!=null&&jm(r,a,VC)}var mE=Bm(function(r,a,u){a!=null&&typeof a.toString!="function"&&(a=Yo.call(a)),r[a]=u},bh(Ht)),vE=Bm(function(r,a,u){a!=null&&typeof a.toString!="function"&&(a=Yo.call(a)),Re.call(r,a)?r[a].push(u):r[a]=[u]},ue),wE=Ae(ca);function vt(r){return Wt(r)?Jg(r):Zc(r)}function Ft(r){return Wt(r)?Jg(r,!0):GC(r)}function yE(r,a){var u={};return a=ue(a,3),Fi(r,function(h,p,w){dn(u,a(h,p,w),h)}),u}function xE(r,a){var u={};return a=ue(a,3),Fi(r,function(h,p,w){dn(u,p,a(h,p,w))}),u}var SE=ds(function(r,a,u){ll(r,a,u)}),Mv=ds(function(r,a,u,h){ll(r,a,u,h)}),ME=pn(function(r,a){var u={};if(r==null)return u;var h=!1;a=Ye(a,function(w){return w=Wn(w,r),h||(h=w.length>1),w}),Hi(r,ah(r),u),h&&(u=Ci(u,v|M|E,mI));for(var p=a.length;p--;)Kc(u,a[p]);return u});function bE(r,a){return bv(r,bl(ue(a)))}var CE=pn(function(r,a){return r==null?{}:JC(r,a)});function bv(r,a){if(r==null)return{};var u=Ye(ah(r),function(h){return[h]});return a=ue(a),pm(r,u,function(h,p){return a(h,p[0])})}function IE(r,a,u){a=Wn(a,r);var h=-1,p=a.length;for(p||(p=1,r=i);++h<p;){var w=r==null?i:r[Zi(a[h])];w===i&&(h=p,w=u),r=mn(w)?w.call(r):w}return r}function AE(r,a,u){return r==null?r:da(r,a,u)}function TE(r,a,u,h){return h=typeof h=="function"?h:i,r==null?r:da(r,a,u,h)}var Cv=Lm(vt),Iv=Lm(Ft);function EE(r,a,u){var h=ye(r),p=h||Hn(r)||gs(r);if(a=ue(a,4),u==null){var w=r&&r.constructor;p?u=h?new w:[]:Je(r)?u=mn(w)?hs(Jo(r)):{}:u={}}return(p?Si:Fi)(r,function(S,b,T){return a(u,S,b,T)}),u}function _E(r,a){return r==null?!0:Kc(r,a)}function PE(r,a,u){return r==null?r:ym(r,a,th(u))}function NE(r,a,u,h){return h=typeof h=="function"?h:i,r==null?r:ym(r,a,th(u),h)}function ms(r){return r==null?[]:Bc(r,vt(r))}function kE(r){return r==null?[]:Bc(r,Ft(r))}function BE(r,a,u){return u===i&&(u=a,a=i),u!==i&&(u=Ti(u),u=u===u?u:0),a!==i&&(a=Ti(a),a=a===a?a:0),Cr(Ti(r),a,u)}function zE(r,a,u){return a=vn(a),u===i?(u=a,a=0):u=vn(u),r=Ti(r),$C(r,a,u)}function DE(r,a,u){if(u&&typeof u!="boolean"&&Bt(r,a,u)&&(a=u=i),u===i&&(typeof a=="boolean"?(u=a,a=i):typeof r=="boolean"&&(u=r,r=i)),r===i&&a===i?(r=0,a=1):(r=vn(r),a===i?(a=r,r=0):a=vn(a)),r>a){var h=r;r=a,a=h}if(u||r%1||a%1){var p=Gg();return It(r+p*(a-r+fb("1e-"+((p+"").length-1))),a)}return Gc(r,a)}var LE=fs(function(r,a,u){return a=a.toLowerCase(),r+(u?Av(a):a)});function Av(r){return Mh(ze(r).toLowerCase())}function Tv(r){return r=ze(r),r&&r.replace(OM,Ab).replace(nb,"")}function RE(r,a,u){r=ze(r),a=si(a);var h=r.length;u=u===i?h:Cr(xe(u),0,h);var p=u;return u-=a.length,u>=0&&r.slice(u,p)==a}function OE(r){return r=ze(r),r&&wM.test(r)?r.replace(rg,Tb):r}function VE(r){return r=ze(r),r&&CM.test(r)?r.replace(vc,"\\$&"):r}var $E=fs(function(r,a,u){return r+(u?"-":"")+a.toLowerCase()}),jE=fs(function(r,a,u){return r+(u?" ":"")+a.toLowerCase()}),UE=Pm("toLowerCase");function WE(r,a,u){r=ze(r),a=xe(a);var h=a?os(r):0;if(!a||h>=a)return r;var p=(a-h)/2;return pl(tl(p),u)+r+pl(el(p),u)}function FE(r,a,u){r=ze(r),a=xe(a);var h=a?os(r):0;return a&&h<a?r+pl(a-h,u):r}function HE(r,a,u){r=ze(r),a=xe(a);var h=a?os(r):0;return a&&h<a?pl(a-h,u)+r:r}function ZE(r,a,u){return u||a==null?a=0:a&&(a=+a),qb(ze(r).replace(wc,""),a||0)}function QE(r,a,u){return(u?Bt(r,a,u):a===i)?a=1:a=xe(a),Xc(ze(r),a)}function YE(){var r=arguments,a=ze(r[0]);return r.length<3?a:a.replace(r[1],r[2])}var GE=fs(function(r,a,u){return r+(u?"_":"")+a.toLowerCase()});function XE(r,a,u){return u&&typeof u!="number"&&Bt(r,a,u)&&(a=u=i),u=u===i?ot:u>>>0,u?(r=ze(r),r&&(typeof a=="string"||a!=null&&!yh(a))&&(a=si(a),!a&&as(r))?Fn(ki(r),0,u):r.split(a,u)):[]}var JE=fs(function(r,a,u){return r+(u?" ":"")+Mh(a)});function KE(r,a,u){return r=ze(r),u=u==null?0:Cr(xe(u),0,r.length),a=si(a),r.slice(u,u+a.length)==a}function qE(r,a,u){var h=m.templateSettings;u&&Bt(r,a,u)&&(a=i),r=ze(r),a=Al({},a,h,Rm);var p=Al({},a.imports,h.imports,Rm),w=vt(p),S=Bc(p,w),b,T,R=0,O=a.interpolate||Vo,V="__p += '",G=Dc((a.escape||Vo).source+"|"+O.source+"|"+(O===sg?kM:Vo).source+"|"+(a.evaluate||Vo).source+"|$","g"),se="//# sourceURL="+(Re.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++lb+"]")+`
|
|
51
|
-
`;r.replace(G,function(he,Ee,Ne,oi,zt,li){return Ne||(Ne=oi),V+=r.slice(R,li).replace(VM,Eb),Ee&&(b=!0,V+=`' +
|
|
52
|
-
__e(`+Ee+`) +
|
|
53
|
-
'`),zt&&(T=!0,V+=`';
|
|
54
|
-
`+zt+`;
|
|
55
|
-
__p += '`),Ne&&(V+=`' +
|
|
56
|
-
((__t = (`+Ne+`)) == null ? '' : __t) +
|
|
57
|
-
'`),R=li+he.length,he}),V+=`';
|
|
58
|
-
`;var ce=Re.call(a,"variable")&&a.variable;if(!ce)V=`with (obj) {
|
|
59
|
-
`+V+`
|
|
60
|
-
}
|
|
61
|
-
`;else if(PM.test(ce))throw new we(c);V=(T?V.replace(pM,""):V).replace(gM,"$1").replace(mM,"$1;"),V="function("+(ce||"obj")+`) {
|
|
62
|
-
`+(ce?"":`obj || (obj = {});
|
|
63
|
-
`)+"var __t, __p = ''"+(b?", __e = _.escape":"")+(T?`, __j = Array.prototype.join;
|
|
64
|
-
function print() { __p += __j.call(arguments, '') }
|
|
65
|
-
`:`;
|
|
66
|
-
`)+V+`return __p
|
|
67
|
-
}`;var Ie=_v(function(){return Be(w,se+"return "+V).apply(i,S)});if(Ie.source=V,wh(Ie))throw Ie;return Ie}function e_(r){return ze(r).toLowerCase()}function t_(r){return ze(r).toUpperCase()}function i_(r,a,u){if(r=ze(r),r&&(u||a===i))return Og(r);if(!r||!(a=si(a)))return r;var h=ki(r),p=ki(a),w=Vg(h,p),S=$g(h,p)+1;return Fn(h,w,S).join("")}function n_(r,a,u){if(r=ze(r),r&&(u||a===i))return r.slice(0,Ug(r)+1);if(!r||!(a=si(a)))return r;var h=ki(r),p=$g(h,ki(a))+1;return Fn(h,0,p).join("")}function r_(r,a,u){if(r=ze(r),r&&(u||a===i))return r.replace(wc,"");if(!r||!(a=si(a)))return r;var h=ki(r),p=Vg(h,ki(a));return Fn(h,p).join("")}function s_(r,a){var u=De,h=U;if(Je(a)){var p="separator"in a?a.separator:p;u="length"in a?xe(a.length):u,h="omission"in a?si(a.omission):h}r=ze(r);var w=r.length;if(as(r)){var S=ki(r);w=S.length}if(u>=w)return r;var b=u-os(h);if(b<1)return h;var T=S?Fn(S,0,b).join(""):r.slice(0,b);if(p===i)return T+h;if(S&&(b+=T.length-b),yh(p)){if(r.slice(b).search(p)){var R,O=T;for(p.global||(p=Dc(p.source,ze(ag.exec(p))+"g")),p.lastIndex=0;R=p.exec(O);)var V=R.index;T=T.slice(0,V===i?b:V)}}else if(r.indexOf(si(p),b)!=b){var G=T.lastIndexOf(p);G>-1&&(T=T.slice(0,G))}return T+h}function a_(r){return r=ze(r),r&&vM.test(r)?r.replace(ng,Db):r}var o_=fs(function(r,a,u){return r+(u?" ":"")+a.toUpperCase()}),Mh=Pm("toUpperCase");function Ev(r,a,u){return r=ze(r),a=u?i:a,a===i?Pb(r)?Ob(r):Sb(r):r.match(a)||[]}var _v=Ae(function(r,a){try{return ni(r,i,a)}catch(u){return wh(u)?u:new we(u)}}),l_=pn(function(r,a){return Si(a,function(u){u=Zi(u),dn(r,u,mh(r[u],r))}),r});function u_(r){var a=r==null?0:r.length,u=ue();return r=a?Ye(r,function(h){if(typeof h[1]!="function")throw new Mi(l);return[u(h[0]),h[1]]}):[],Ae(function(h){for(var p=-1;++p<a;){var w=r[p];if(ni(w[0],this,h))return ni(w[1],this,h)}})}function c_(r){return DC(Ci(r,v))}function bh(r){return function(){return r}}function h_(r,a){return r==null||r!==r?a:r}var d_=km(),f_=km(!0);function Ht(r){return r}function Ch(r){return lm(typeof r=="function"?r:Ci(r,v))}function p_(r){return cm(Ci(r,v))}function g_(r,a){return hm(r,Ci(a,v))}var m_=Ae(function(r,a){return function(u){return ca(u,r,a)}}),v_=Ae(function(r,a){return function(u){return ca(r,u,a)}});function Ih(r,a,u){var h=vt(a),p=ol(a,h);u==null&&!(Je(a)&&(p.length||!h.length))&&(u=a,a=r,r=this,p=ol(a,vt(a)));var w=!(Je(u)&&"chain"in u)||!!u.chain,S=mn(r);return Si(p,function(b){var T=a[b];r[b]=T,S&&(r.prototype[b]=function(){var R=this.__chain__;if(w||R){var O=r(this.__wrapped__),V=O.__actions__=Ut(this.__actions__);return V.push({func:T,args:arguments,thisArg:r}),O.__chain__=R,O}return T.apply(r,Rn([this.value()],arguments))})}),r}function w_(){return mt._===this&&(mt._=Fb),this}function Ah(){}function y_(r){return r=xe(r),Ae(function(a){return dm(a,r)})}var x_=nh(Ye),S_=nh(Bg),M_=nh(Ec);function Pv(r){return ch(r)?_c(Zi(r)):KC(r)}function b_(r){return function(a){return r==null?i:Ir(r,a)}}var C_=zm(),I_=zm(!0);function Th(){return[]}function Eh(){return!1}function A_(){return{}}function T_(){return""}function E_(){return!0}function __(r,a){if(r=xe(r),r<1||r>le)return[];var u=ot,h=It(r,ot);a=ue(a),r-=ot;for(var p=kc(h,a);++u<r;)a(u);return p}function P_(r){return ye(r)?Ye(r,Zi):ai(r)?[r]:Ut(Xm(ze(r)))}function N_(r){var a=++Ub;return ze(r)+a}var k_=fl(function(r,a){return r+a},0),B_=rh("ceil"),z_=fl(function(r,a){return r/a},1),D_=rh("floor");function L_(r){return r&&r.length?al(r,Ht,Wc):i}function R_(r,a){return r&&r.length?al(r,ue(a,2),Wc):i}function O_(r){return Lg(r,Ht)}function V_(r,a){return Lg(r,ue(a,2))}function $_(r){return r&&r.length?al(r,Ht,Qc):i}function j_(r,a){return r&&r.length?al(r,ue(a,2),Qc):i}var U_=fl(function(r,a){return r*a},1),W_=rh("round"),F_=fl(function(r,a){return r-a},0);function H_(r){return r&&r.length?Nc(r,Ht):0}function Z_(r,a){return r&&r.length?Nc(r,ue(a,2)):0}return m.after=pT,m.ary=ov,m.assign=tE,m.assignIn=Sv,m.assignInWith=Al,m.assignWith=iE,m.at=nE,m.before=lv,m.bind=mh,m.bindAll=l_,m.bindKey=uv,m.castArray=AT,m.chain=rv,m.chunk=DI,m.compact=LI,m.concat=RI,m.cond=u_,m.conforms=c_,m.constant=bh,m.countBy=HA,m.create=rE,m.curry=cv,m.curryRight=hv,m.debounce=dv,m.defaults=sE,m.defaultsDeep=aE,m.defer=gT,m.delay=mT,m.difference=OI,m.differenceBy=VI,m.differenceWith=$I,m.drop=jI,m.dropRight=UI,m.dropRightWhile=WI,m.dropWhile=FI,m.fill=HI,m.filter=QA,m.flatMap=XA,m.flatMapDeep=JA,m.flatMapDepth=KA,m.flatten=ev,m.flattenDeep=ZI,m.flattenDepth=QI,m.flip=vT,m.flow=d_,m.flowRight=f_,m.fromPairs=YI,m.functions=fE,m.functionsIn=pE,m.groupBy=qA,m.initial=XI,m.intersection=JI,m.intersectionBy=KI,m.intersectionWith=qI,m.invert=mE,m.invertBy=vE,m.invokeMap=tT,m.iteratee=Ch,m.keyBy=iT,m.keys=vt,m.keysIn=Ft,m.map=xl,m.mapKeys=yE,m.mapValues=xE,m.matches=p_,m.matchesProperty=g_,m.memoize=Ml,m.merge=SE,m.mergeWith=Mv,m.method=m_,m.methodOf=v_,m.mixin=Ih,m.negate=bl,m.nthArg=y_,m.omit=ME,m.omitBy=bE,m.once=wT,m.orderBy=nT,m.over=x_,m.overArgs=yT,m.overEvery=S_,m.overSome=M_,m.partial=vh,m.partialRight=fv,m.partition=rT,m.pick=CE,m.pickBy=bv,m.property=Pv,m.propertyOf=b_,m.pull=nA,m.pullAll=iv,m.pullAllBy=rA,m.pullAllWith=sA,m.pullAt=aA,m.range=C_,m.rangeRight=I_,m.rearg=xT,m.reject=oT,m.remove=oA,m.rest=ST,m.reverse=ph,m.sampleSize=uT,m.set=AE,m.setWith=TE,m.shuffle=cT,m.slice=lA,m.sortBy=fT,m.sortedUniq=gA,m.sortedUniqBy=mA,m.split=XE,m.spread=MT,m.tail=vA,m.take=wA,m.takeRight=yA,m.takeRightWhile=xA,m.takeWhile=SA,m.tap=LA,m.throttle=bT,m.thru=yl,m.toArray=wv,m.toPairs=Cv,m.toPairsIn=Iv,m.toPath=P_,m.toPlainObject=xv,m.transform=EE,m.unary=CT,m.union=MA,m.unionBy=bA,m.unionWith=CA,m.uniq=IA,m.uniqBy=AA,m.uniqWith=TA,m.unset=_E,m.unzip=gh,m.unzipWith=nv,m.update=PE,m.updateWith=NE,m.values=ms,m.valuesIn=kE,m.without=EA,m.words=Ev,m.wrap=IT,m.xor=_A,m.xorBy=PA,m.xorWith=NA,m.zip=kA,m.zipObject=BA,m.zipObjectDeep=zA,m.zipWith=DA,m.entries=Cv,m.entriesIn=Iv,m.extend=Sv,m.extendWith=Al,Ih(m,m),m.add=k_,m.attempt=_v,m.camelCase=LE,m.capitalize=Av,m.ceil=B_,m.clamp=BE,m.clone=TT,m.cloneDeep=_T,m.cloneDeepWith=PT,m.cloneWith=ET,m.conformsTo=NT,m.deburr=Tv,m.defaultTo=h_,m.divide=z_,m.endsWith=RE,m.eq=zi,m.escape=OE,m.escapeRegExp=VE,m.every=ZA,m.find=YA,m.findIndex=Km,m.findKey=oE,m.findLast=GA,m.findLastIndex=qm,m.findLastKey=lE,m.floor=D_,m.forEach=sv,m.forEachRight=av,m.forIn=uE,m.forInRight=cE,m.forOwn=hE,m.forOwnRight=dE,m.get=xh,m.gt=kT,m.gte=BT,m.has=gE,m.hasIn=Sh,m.head=tv,m.identity=Ht,m.includes=eT,m.indexOf=GI,m.inRange=zE,m.invoke=wE,m.isArguments=Er,m.isArray=ye,m.isArrayBuffer=zT,m.isArrayLike=Wt,m.isArrayLikeObject=nt,m.isBoolean=DT,m.isBuffer=Hn,m.isDate=LT,m.isElement=RT,m.isEmpty=OT,m.isEqual=VT,m.isEqualWith=$T,m.isError=wh,m.isFinite=jT,m.isFunction=mn,m.isInteger=pv,m.isLength=Cl,m.isMap=gv,m.isMatch=UT,m.isMatchWith=WT,m.isNaN=FT,m.isNative=HT,m.isNil=QT,m.isNull=ZT,m.isNumber=mv,m.isObject=Je,m.isObjectLike=et,m.isPlainObject=ma,m.isRegExp=yh,m.isSafeInteger=YT,m.isSet=vv,m.isString=Il,m.isSymbol=ai,m.isTypedArray=gs,m.isUndefined=GT,m.isWeakMap=XT,m.isWeakSet=JT,m.join=eA,m.kebabCase=$E,m.last=Ai,m.lastIndexOf=tA,m.lowerCase=jE,m.lowerFirst=UE,m.lt=KT,m.lte=qT,m.max=L_,m.maxBy=R_,m.mean=O_,m.meanBy=V_,m.min=$_,m.minBy=j_,m.stubArray=Th,m.stubFalse=Eh,m.stubObject=A_,m.stubString=T_,m.stubTrue=E_,m.multiply=U_,m.nth=iA,m.noConflict=w_,m.noop=Ah,m.now=Sl,m.pad=WE,m.padEnd=FE,m.padStart=HE,m.parseInt=ZE,m.random=DE,m.reduce=sT,m.reduceRight=aT,m.repeat=QE,m.replace=YE,m.result=IE,m.round=W_,m.runInContext=A,m.sample=lT,m.size=hT,m.snakeCase=GE,m.some=dT,m.sortedIndex=uA,m.sortedIndexBy=cA,m.sortedIndexOf=hA,m.sortedLastIndex=dA,m.sortedLastIndexBy=fA,m.sortedLastIndexOf=pA,m.startCase=JE,m.startsWith=KE,m.subtract=F_,m.sum=H_,m.sumBy=Z_,m.template=qE,m.times=__,m.toFinite=vn,m.toInteger=xe,m.toLength=yv,m.toLower=e_,m.toNumber=Ti,m.toSafeInteger=eE,m.toString=ze,m.toUpper=t_,m.trim=i_,m.trimEnd=n_,m.trimStart=r_,m.truncate=s_,m.unescape=a_,m.uniqueId=N_,m.upperCase=o_,m.upperFirst=Mh,m.each=sv,m.eachRight=av,m.first=tv,Ih(m,function(){var r={};return Fi(m,function(a,u){Re.call(m.prototype,u)||(r[u]=a)}),r}(),{chain:!1}),m.VERSION=n,Si(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){m[r].placeholder=m}),Si(["drop","take"],function(r,a){Pe.prototype[r]=function(u){u=u===i?1:dt(xe(u),0);var h=this.__filtered__&&!a?new Pe(this):this.clone();return h.__filtered__?h.__takeCount__=It(u,h.__takeCount__):h.__views__.push({size:It(u,ot),type:r+(h.__dir__<0?"Right":"")}),h},Pe.prototype[r+"Right"]=function(u){return this.reverse()[r](u).reverse()}}),Si(["filter","map","takeWhile"],function(r,a){var u=a+1,h=u==ie||u==Ve;Pe.prototype[r]=function(p){var w=this.clone();return w.__iteratees__.push({iteratee:ue(p,3),type:u}),w.__filtered__=w.__filtered__||h,w}}),Si(["head","last"],function(r,a){var u="take"+(a?"Right":"");Pe.prototype[r]=function(){return this[u](1).value()[0]}}),Si(["initial","tail"],function(r,a){var u="drop"+(a?"":"Right");Pe.prototype[r]=function(){return this.__filtered__?new Pe(this):this[u](1)}}),Pe.prototype.compact=function(){return this.filter(Ht)},Pe.prototype.find=function(r){return this.filter(r).head()},Pe.prototype.findLast=function(r){return this.reverse().find(r)},Pe.prototype.invokeMap=Ae(function(r,a){return typeof r=="function"?new Pe(this):this.map(function(u){return ca(u,r,a)})}),Pe.prototype.reject=function(r){return this.filter(bl(ue(r)))},Pe.prototype.slice=function(r,a){r=xe(r);var u=this;return u.__filtered__&&(r>0||a<0)?new Pe(u):(r<0?u=u.takeRight(-r):r&&(u=u.drop(r)),a!==i&&(a=xe(a),u=a<0?u.dropRight(-a):u.take(a-r)),u)},Pe.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},Pe.prototype.toArray=function(){return this.take(ot)},Fi(Pe.prototype,function(r,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),h=/^(?:head|last)$/.test(a),p=m[h?"take"+(a=="last"?"Right":""):a],w=h||/^find/.test(a);!p||(m.prototype[a]=function(){var S=this.__wrapped__,b=h?[1]:arguments,T=S instanceof Pe,R=b[0],O=T||ye(S),V=function(Ee){var Ne=p.apply(m,Rn([Ee],b));return h&&G?Ne[0]:Ne};O&&u&&typeof R=="function"&&R.length!=1&&(T=O=!1);var G=this.__chain__,se=!!this.__actions__.length,ce=w&&!G,Ie=T&&!se;if(!w&&O){S=Ie?S:new Pe(this);var he=r.apply(S,b);return he.__actions__.push({func:yl,args:[V],thisArg:i}),new bi(he,G)}return ce&&Ie?r.apply(this,b):(he=this.thru(V),ce?h?he.value()[0]:he.value():he)})}),Si(["pop","push","shift","sort","splice","unshift"],function(r){var a=Ho[r],u=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",h=/^(?:pop|shift)$/.test(r);m.prototype[r]=function(){var p=arguments;if(h&&!this.__chain__){var w=this.value();return a.apply(ye(w)?w:[],p)}return this[u](function(S){return a.apply(ye(S)?S:[],p)})}}),Fi(Pe.prototype,function(r,a){var u=m[a];if(u){var h=u.name+"";Re.call(cs,h)||(cs[h]=[]),cs[h].push({name:a,func:u})}}),cs[dl(i,x).name]=[{name:"wrapper",func:i}],Pe.prototype.clone=aC,Pe.prototype.reverse=oC,Pe.prototype.value=lC,m.prototype.at=RA,m.prototype.chain=OA,m.prototype.commit=VA,m.prototype.next=$A,m.prototype.plant=UA,m.prototype.reverse=WA,m.prototype.toJSON=m.prototype.valueOf=m.prototype.value=FA,m.prototype.first=m.prototype.head,na&&(m.prototype[na]=jA),m},Vn=Vb();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(mt._=Vn,define(function(){return Vn})):xr?((xr.exports=Vn)._=Vn,Cc._=Vn):mt._=Vn}).call(e)}}),ho=e=>!!(e&&e.constructor&&e.call&&e.apply),ZR=e=>ho(e)||ho(e==null?void 0:e.dispose);function R1(e){try{e&&(ho(e.dispose)?e.dispose():ho(e)&&e())}catch(t){console.error(t)}}var QR=e=>ZR(e)&&ho(e.abortable);function O1(e){function t(){var i,n;t._i||(t._i=1,(i=t._d)==null||i.forEach(R1),(n=t._d)==null||n.clear(),t._i=0)}return t._i=0,t.dispose=t,t.size=qR,t.has=XR,t.add=YR,t.make=JR,t.remove=KR,t.flush=GR,t}function R0(e){var t,i;(t=this._d)!=null&&t.has(e)||(((i=this._d)!=null?i:this._d=new Set).add(e),QR(e)&&e.abortable(()=>this.remove(e)))}function YR(e){return Array.isArray(e)?e.forEach(R0,this):R0.call(this,e),e}function GR(e){e?this.remove(e)&&R1(e):this.dispose()}function XR(e){var t;return((t=this._d)==null?void 0:t.has(e))||!1}function JR(e){const t=e();return t&&this.add(t)}function KR(e){var t;return((t=this._d)==null?void 0:t.delete(e))||!1}function qR(){var e;return((e=this._d)==null?void 0:e.size)||0}function eO(e,t,i,n){return e.addEventListener(t,i,n),()=>e.removeEventListener(t,i,n)}var Ki=eO,gr=typeof window!="undefined",V1=gr&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),$1=gr&&window.devicePixelRatio>1,tO={elements_selector:".lazy",container:V1||gr?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},j1=e=>Object.assign({},tO,e),O0=function(e,t){let i;const n="LazyLoad::Initialized",s=new e(t);try{i=new CustomEvent(n,{detail:{instance:s}})}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent(n,!1,!1,{instance:s})}window.dispatchEvent(i)},iO=(e,t)=>{if(!!t)if(!t.length)O0(e,t);else for(let i=0,n;n=t[i];i+=1)O0(e,n)},kn="src",Zp="srcset",Qp="sizes",U1="poster",Lo="llOriginalAttrs",W1="data",Yp="loading",F1="loaded",H1="applied",nO="entered",Gp="error",Z1="native",Q1="data-",Y1="ll-status",Kt=(e,t)=>e.getAttribute(Q1+t),rO=(e,t,i)=>{const n=Q1+t;if(i===null){e.removeAttribute(n);return}e.setAttribute(n,i)},Ro=e=>Kt(e,Y1),ns=(e,t)=>rO(e,Y1,t),fc=e=>ns(e,null),Xp=e=>Ro(e)===null,sO=e=>Ro(e)===Yp,aO=e=>Ro(e)===Gp,Jp=e=>Ro(e)===Z1,oO=[Yp,F1,H1,Gp],lO=e=>oO.indexOf(Ro(e))>=0,mr=(e,t,i,n)=>{if(!(!e||typeof e!="function")){if(n!==void 0){e(t,i,n);return}if(i!==void 0){e(t,i);return}e(t)}},ea=(e,t)=>{!gr||t!==""&&e.classList.add(t)},en=(e,t)=>{!gr||t!==""&&e.classList.remove(t)},uO=e=>{e.llTempImage=document.createElement("IMG")},cO=e=>{delete e.llTempImage},G1=e=>e.llTempImage,pc=(e,t)=>{if(!t)return;const i=t._observer;!i||i.unobserve(e)},hO=e=>{e.disconnect()},dO=(e,t,i)=>{t.unobserve_entered&&pc(e,i)},Kp=(e,t)=>{!e||(e.loadingCount+=t)},fO=e=>{!e||(e.toLoadCount-=1)},X1=(e,t)=>{!e||(e.toLoadCount=t)},pO=e=>e.loadingCount>0,gO=e=>e.toLoadCount>0,J1=e=>{let t=[];for(let i=0,n;n=e.children[i];i+=1)n.tagName==="SOURCE"&&t.push(n);return t},qp=(e,t)=>{const i=e.parentNode;if(!i||i.tagName!=="PICTURE")return;J1(i).forEach(t)},K1=(e,t)=>{J1(e).forEach(t)},gc=[kn],q1=[kn,U1],fo=[kn,Zp,Qp],eM=[W1],mc=e=>!!e[Lo],tM=e=>e[Lo],iM=e=>delete e[Lo],Qs=(e,t)=>{if(mc(e))return;const i={};t.forEach(n=>{i[n]=e.getAttribute(n)}),e[Lo]=i},mO=e=>{mc(e)||(e[Lo]={backgroundImage:e.style.backgroundImage})},vO=(e,t,i)=>{if(!i){e.removeAttribute(t);return}e.setAttribute(t,i)},Kr=(e,t)=>{if(!mc(e))return;const i=tM(e);t.forEach(n=>{vO(e,n,i[n])})},wO=e=>{if(!mc(e))return;const t=tM(e);e.style.backgroundImage=t.backgroundImage},nM=(e,t,i)=>{ea(e,t.class_applied),ns(e,H1),i&&(t.unobserve_completed&&pc(e,t),mr(t.callback_applied,e,i))},rM=(e,t,i)=>{ea(e,t.class_loading),ns(e,Yp),i&&(Kp(i,1),mr(t.callback_loading,e,i))},lr=(e,t,i)=>{!i||e.setAttribute(t,i)},V0=(e,t)=>{lr(e,Qp,Kt(e,t.data_sizes)),lr(e,Zp,Kt(e,t.data_srcset)),lr(e,kn,Kt(e,t.data_src))},yO=(e,t)=>{qp(e,i=>{Qs(i,fo),V0(i,t)}),Qs(e,fo),V0(e,t)},xO=(e,t)=>{Qs(e,gc),lr(e,kn,Kt(e,t.data_src))},SO=(e,t)=>{K1(e,i=>{Qs(i,gc),lr(i,kn,Kt(i,t.data_src))}),Qs(e,q1),lr(e,U1,Kt(e,t.data_poster)),lr(e,kn,Kt(e,t.data_src)),e.load()},MO=(e,t)=>{Qs(e,eM),lr(e,W1,Kt(e,t.data_src))},bO=(e,t,i)=>{const n=Kt(e,t.data_bg),s=Kt(e,t.data_bg_hidpi),o=$1&&s?s:n;!o||(e.style.backgroundImage=`url("${o}")`,G1(e).setAttribute(kn,o),rM(e,t,i))},CO=(e,t,i)=>{const n=Kt(e,t.data_bg_multi),s=Kt(e,t.data_bg_multi_hidpi),o=$1&&s?s:n;!o||(e.style.backgroundImage=o,nM(e,t,i))},IO=(e,t,i)=>{const n=Kt(e,t.data_bg_set);if(!n)return;const s=n.split("|");let o=s.map(l=>`image-set(${l})`);e.style.backgroundImage=o.join(),e.style.backgroundImage===""&&(o=s.map(l=>`-webkit-image-set(${l})`),e.style.backgroundImage=o.join()),nM(e,t,i)},sM={IMG:yO,IFRAME:xO,VIDEO:SO,OBJECT:MO},AO=(e,t)=>{const i=sM[e.tagName];!i||i(e,t)},TO=(e,t,i)=>{const n=sM[e.tagName];!n||(n(e,t),rM(e,t,i))},EO=["IMG","IFRAME","VIDEO","OBJECT"],_O=e=>EO.indexOf(e.tagName)>-1,aM=(e,t)=>{t&&!pO(t)&&!gO(t)&&mr(e.callback_finish,t)},$0=(e,t,i)=>{e.addEventListener(t,i),e.llEvLisnrs[t]=i},PO=(e,t,i)=>{e.removeEventListener(t,i)},eg=e=>!!e.llEvLisnrs,NO=(e,t,i)=>{eg(e)||(e.llEvLisnrs={});const n=e.tagName==="VIDEO"?"loadeddata":"load";$0(e,n,t),$0(e,"error",i)},yf=e=>{if(!eg(e))return;const t=e.llEvLisnrs;for(let i in t){const n=t[i];PO(e,i,n)}delete e.llEvLisnrs},oM=(e,t,i)=>{cO(e),Kp(i,-1),fO(i),en(e,t.class_loading),t.unobserve_completed&&pc(e,i)},kO=(e,t,i,n)=>{const s=Jp(t);oM(t,i,n),ea(t,i.class_loaded),ns(t,F1),mr(i.callback_loaded,t,n),s||aM(i,n)},BO=(e,t,i,n)=>{const s=Jp(t);oM(t,i,n),ea(t,i.class_error),ns(t,Gp),mr(i.callback_error,t,n),i.restore_on_error&&Kr(t,fo),s||aM(i,n)},tg=(e,t,i)=>{const n=G1(e)||e;if(eg(n))return;NO(n,l=>{kO(l,e,t,i),yf(n)},l=>{BO(l,e,t,i),yf(n)})},zO=(e,t,i)=>{uO(e),tg(e,t,i),mO(e),bO(e,t,i),CO(e,t,i),IO(e,t,i)},DO=(e,t,i)=>{tg(e,t,i),TO(e,t,i)},ig=(e,t,i)=>{_O(e)?DO(e,t,i):zO(e,t,i)},LO=(e,t,i)=>{e.setAttribute("loading","lazy"),tg(e,t,i),AO(e,t),ns(e,Z1)},j0=e=>{e.removeAttribute(kn),e.removeAttribute(Zp),e.removeAttribute(Qp)},RO=e=>{qp(e,t=>{j0(t)}),j0(e)},lM=e=>{qp(e,t=>{Kr(t,fo)}),Kr(e,fo)},OO=e=>{K1(e,t=>{Kr(t,gc)}),Kr(e,q1),e.load()},VO=e=>{Kr(e,gc)},$O=e=>{Kr(e,eM)},jO={IMG:lM,IFRAME:VO,VIDEO:OO,OBJECT:$O},UO=e=>{const t=jO[e.tagName];if(!t){wO(e);return}t(e)},WO=(e,t)=>{Xp(e)||Jp(e)||(en(e,t.class_entered),en(e,t.class_exited),en(e,t.class_applied),en(e,t.class_loading),en(e,t.class_loaded),en(e,t.class_error))},FO=(e,t)=>{UO(e),WO(e,t),fc(e),iM(e)},HO=(e,t,i,n)=>{!i.cancel_on_exit||!sO(e)||e.tagName==="IMG"&&(yf(e),RO(e),lM(e),en(e,i.class_loading),Kp(n,-1),fc(e),mr(i.callback_cancel,e,t,n))},ZO=(e,t,i,n)=>{const s=lO(e);ns(e,nO),ea(e,i.class_entered),en(e,i.class_exited),dO(e,i,n),mr(i.callback_enter,e,t,n),!s&&ig(e,i,n)},QO=(e,t,i,n)=>{Xp(e)||(ea(e,i.class_exited),HO(e,t,i,n),mr(i.callback_exit,e,t,n))},YO=["IMG","IFRAME","VIDEO"],uM=e=>e.use_native&&"loading"in HTMLImageElement.prototype,GO=(e,t,i)=>{e.forEach(n=>{YO.indexOf(n.tagName)!==-1&&LO(n,t,i)}),X1(i,0)},XO=e=>e.isIntersecting||e.intersectionRatio>0,JO=e=>({root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),KO=(e,t,i)=>{e.forEach(n=>XO(n)?ZO(n.target,n,t,i):QO(n.target,n,t,i))},qO=(e,t)=>{t.forEach(i=>{e.observe(i)})},e2=(e,t)=>{hO(e),qO(e,t)},t2=(e,t)=>{uM(e)||(t._observer=new IntersectionObserver(i=>{KO(i,e,t)},JO(e)))},cM=e=>Array.prototype.slice.call(e),Fu=e=>e.container.querySelectorAll(e.elements_selector),i2=e=>cM(e).filter(Xp),n2=e=>aO(e),r2=e=>cM(e).filter(n2),U0=(e,t)=>i2(e||Fu(t)),s2=(e,t)=>{r2(Fu(e)).forEach(n=>{en(n,e.class_error),fc(n)}),t.update()},a2=(e,t)=>{!gr||(t._onlineHandler=()=>{s2(e,t)},window.addEventListener("online",t._onlineHandler))},o2=e=>{!gr||window.removeEventListener("online",e._onlineHandler)},Oo=function(e,t){const i=j1(e);this._settings=i,this.loadingCount=0,t2(i,this),a2(i,this),this.update(t)};Oo.prototype={update:function(e){const t=this._settings,i=U0(e,t);if(X1(this,i.length),V1){this.loadAll(i);return}if(uM(t)){GO(i,t,this);return}e2(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),o2(this),Fu(this._settings).forEach(e=>{iM(e)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){const t=this._settings;U0(e,t).forEach(n=>{pc(n,this),ig(n,t,this)})},restoreAll:function(){const e=this._settings;Fu(e).forEach(t=>{FO(t,e)})}};Oo.load=(e,t)=>{const i=j1(t);ig(e,i)};Oo.resetStatus=e=>{fc(e)};gr&&iO(Oo,window.lazyLoadOptions);function l2(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-sidebar`),i.setAttribute("viewBox","0 0 64 64");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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"),i.appendChild(n),i}function u2(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-arrow-left`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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"),i.appendChild(n),i}function c2(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-arrow-right`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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"),i.appendChild(n),i}var hM=class xf{constructor(t){this.pages=t,this.loadingLinks=new Map,this.preloadMap=new Map,this.touchIndex=0,this.preloadSize=0,this.preloadMap=new Map(t.map((i,n)=>[n,{src:i.src,state:0}])),this.preloadSize=this.preloadMap.size,this.touch(0,!0)}touch(t,i=!1){t>=this.preloadSize?this.touchIndex=0:this.touchIndex=t;const n=this.preloadMap.get(this.touchIndex);if(n&&n.state===0&&this.createLink(this.touchIndex,i),this.loadingLinks.size<xf.maxLinks){const s=[...this.preloadMap.entries()].find(([o,l])=>o>this.touchIndex&&l.state!==1);s&&this.requestAsyncCallBack(()=>{this.touch(s[0],!1)},100)}}createLink(t,i=!1){const n=this.preloadMap.get(t);if(i&&this.destroySomeLink(t),n){if(n.state===1)return 1;const s=this.loadingLinks.get(t);if(s)return s.isForce!==i&&(s.isForce=i,this.loadingLinks.set(t,s)),0;if(this.loadingLinks.size>xf.maxLinks)return 0;const o=document.createElement("link");return o.rel="preload",o.as="image",o.href=n.src,o.dataset.order=t+"",document.head.appendChild(o),o.onload=()=>{const l=this.preloadMap.get(t);l&&(l.state=1,this.preloadMap.set(t,l),document.head.contains(o)&&document.head.removeChild(o),this.loadingLinks.delete(t),this.touch(this.touchIndex+1,!1))},o.onerror=()=>{const l=this.preloadMap.get(t);l!=null&&l.src&&(o.href=l.src)},this.loadingLinks.set(t,{link:o,isForce:i}),n.state=0,this.preloadMap.set(t,n),0}return 2}destroySomeLink(t){for(const[i,{link:n}]of this.loadingLinks)t!==void 0&&i===t||(document.head.contains(n)&&document.head.removeChild(n),this.loadingLinks.delete(i))}async requestAsyncCallBack(t,i){await new Promise(function(n){window.requestIdleCallback?requestIdleCallback(()=>{n(1)},{timeout:i}):setTimeout(()=>{n(2)},i)}),t()}dispose(){this.destroySomeLink(),this.preloadMap.clear()}};hM.maxLinks=5;var h2=hM,dM=class{constructor(e){this.namespace="netless-app-presentation",this.dispose=O1(),this.initialized=!1,this.showPreview=!1,this.pageIndex=0,this.previewLazyload=null,this.timer=null,this.justDocsViewReadonly=!1;var t;this.pages=e.pages,this.preload=new h2(this.pages),e.thumbnail&&(this.thumbnail=e.thumbnail),this.dispose.add(this.preload),this.readonly=(t=e.readonly)!=null?t:!1,this.dom=document.createElement("div"),this.dom.className=this.namespace,this.contentDOM=document.createElement("div"),this.contentDOM.className=this.c("content"),this.previewDOM=document.createElement("div"),this.previewDOM.className=this.c("preview"),this.whiteboardDOM=document.createElement("div"),this.whiteboardDOM.className=this.c("wb-view"),this.footerDOM=document.createElement("div"),this.footerDOM.className=this.c("footer"),this.pageNumberInputDOM=document.createElement("input"),this.pageNumberInputDOM.className=this.c("page-number-input"),this.initialize()}setDocsViewReadonly(e){this.justDocsViewReadonly=e}initialize(){var e;if(this.initialized)return;this.initialized=!0,this.dispose.add(()=>{var g;return(g=this.previewLazyload)==null?void 0:g.destroy()}),this.contentDOM.classList.toggle(this.c("readonly"),this.readonly),this.dom.appendChild(this.contentDOM);const t=this.contentDOM.appendChild(document.createElement("div"));t.className=this.c("preview-mask"),this.dispose.add(Ki(t,"click",g=>{this.readonly||g.target==t&&this.togglePreview(!1)})),this.contentDOM.appendChild(this.previewDOM),this.previewDOM.classList.add("tele-fancy-scrollbar");const i=this.c("preview-page"),n=this.c("preview-page-name");for(let g=0;g<this.pages.length;++g){const v=this.pages[g],M=v.thumbnail||this.thumbnail(v.src),E=document.createElement("a");E.className=`${i} ${this.c(`preview-page-${g}`)}`,E.setAttribute("href","#"),E.dataset.pageIndex=String(g);const _=document.createElement("img");_.width=v.width,_.height=v.height,_.dataset.src=M,_.dataset.pageIndex=String(g);const P=document.createElement("span");P.className=n,P.textContent=String(g+1),P.dataset.pageIndex=String(g),E.appendChild(_),E.appendChild(P),this.previewDOM.appendChild(E)}(e=this.previewLazyload)==null||e.update(),this.dispose.add(Ki(this.previewDOM,"click",g=>{var v;if(this.readonly)return;const M=(v=g.target.dataset)==null?void 0:v.pageIndex;M&&(g.preventDefault(),g.stopPropagation(),g.stopImmediatePropagation(),this.onNewPageIndex(Number(M),"preview"),this.togglePreview(!1))})),this.updateImage(),this.contentDOM.appendChild(this.whiteboardDOM),this.footerDOM.classList.toggle(this.c("readonly"),this.readonly),this.dom.appendChild(this.footerDOM);const s=document.createElement("button");s.className=`${this.c("footer-btn")} ${this.c("btn-sidebar")}`,s.appendChild(l2(this.namespace)),this.footerDOM.appendChild(s),this.dispose.add(Ki(s,"click",()=>{this.readonly||this.togglePreview()}));const o=document.createElement("div");o.className=this.c("page-jumps"),this.footerDOM.appendChild(o);const l=document.createElement("button");l.className=`${this.c("footer-btn")} ${this.c("btn-page-back")}`,l.appendChild(u2(this.namespace)),o.appendChild(l),this.dispose.add(Ki(l,"click",()=>{this.readonly||this.pageIndex>0&&this.onNewPageIndex(this.pageIndex-1,"navigation")}));const c=document.createElement("button");c.className=`${this.c("footer-btn")} ${this.c("btn-page-next")}`,c.appendChild(c2(this.namespace)),o.appendChild(c),this.dispose.add(Ki(c,"click",()=>{this.readonly||this.pageIndex<this.pages.length-1&&this.onNewPageIndex(this.pageIndex+1,"navigation")}));const d=document.createElement("div");d.className=this.c("page-number"),this.footerDOM.appendChild(d),d.appendChild(this.pageNumberInputDOM),this.pageNumberInputDOM.value=String(this.pageIndex+1),this.pageNumberInputDOM.disabled=this.readonly,this.dispose.add(Ki(this.pageNumberInputDOM,"focus",()=>{this.readonly||this.pageNumberInputDOM.select()})),this.dispose.add(Ki(this.pageNumberInputDOM,"change",()=>{this.readonly||this.pageNumberInputDOM.value&&this.onNewPageIndex(Number(this.pageNumberInputDOM.value)-1,"input")}));const f=document.createElement("span");f.textContent=` / ${this.pages.length}`,d.appendChild(f),this.dispose.add(Ki(window,"keydown",g=>{this.readonly||this.isEditable(g.target)||this.justDocsViewReadonly||((g.key=="ArrowUp"||g.key=="ArrowLeft")&&this.pageIndex>0?this.onNewPageIndex(this.pageIndex-1,"keydown"):(g.key=="ArrowDown"||g.key=="ArrowRight")&&this.pageIndex<this.pages.length-1&&this.onNewPageIndex(this.pageIndex+1,"keydown"))}))}setDOM(e){this.dom!=e&&(e.appendChild(this.contentDOM),e.appendChild(this.footerDOM),this.dom=e)}setReadonly(e){this.readonly!=e&&(this.contentDOM.classList.toggle(this.c("readonly"),e),this.footerDOM.classList.toggle(this.c("readonly"),e),this.pageNumberInputDOM.disabled=e,this.togglePreview(!1),this.readonly=e)}setPageIndex(e){Number.isSafeInteger(e)&&(this.pageIndex=e,this.pageNumberInputDOM.value=String(e+1),this.updateImage())}togglePreview(e){if(this.showPreview=e!=null?e:!this.showPreview,this.contentDOM.classList.toggle(this.c("preview-active"),this.showPreview),this.showPreview){const t=this.previewDOM.querySelector("."+this.c(`preview-page-${this.pageIndex}`));t&&(this.previewLazyload||(this.previewLazyload=new Oo({container:this.previewDOM,elements_selector:`.${this.c("preview-page>img")}`})),this.previewDOM.scrollTo({top:t.offsetTop-16}))}}onNewPageIndex(e,t){0<=e&&e<this.pages.length&&this.setPageIndex(e)}page(){return this.pages[this.pageIndex]}updateImage(){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null,this.preload.touch(this.pageIndex,!0)},200)}thumbnail(e){try{const t=new URL(e);return t.searchParams.set("x-oss-process","image/resize,l_50"),t.toString()}catch(t){return console.error(t),e}}c(e){return`${this.namespace}-${e}`}isEditable(e){if(!e)return!1;const{tagName:t}=e;return t=="INPUT"||t=="TEXTAREA"||t=="SELECT"}},d2=".netless-app-presentation{height:100%;display:flex;flex-flow:column nowrap}.netless-app-presentation-content{position:relative;height:100%;overflow:hidden}.netless-app-presentation-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-presentation-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:#ededf0e6;box-shadow:inset -1px 0 #0000001c;transition:transform .4s;overflow:auto;overflow-y:scroll}.netless-app-presentation-preview-active .netless-app-presentation-preview-mask{display:block}.netless-app-presentation-preview-active .netless-app-presentation-preview{transform:translate(0)}.netless-app-presentation-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:#0000;outline:none;border:7px solid rgba(0,0,0,0);border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-presentation-preview-page:hover,.netless-app-presentation-preview-page.netless-app-presentation-preview-page-active{border-color:#444e601a}.netless-app-presentation-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-presentation-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-presentation-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-presentation-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:#f9f9fce6;transition:opacity .4s}.netless-app-presentation-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:#0000;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-presentation-footer-btn:hover{background:#ededf0e6}@media (hover: none){.netless-app-presentation-footer-btn:hover{background:#0000!important}}.netless-app-presentation-footer-btn>svg{width:100%;height:100%}.netless-app-presentation-footer-btn>svg:nth-of-type(2){display:none}.netless-app-presentation-footer-btn.netless-app-presentation-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-presentation-footer-btn.netless-app-presentation-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-presentation-footer-btn~.netless-app-presentation-footer-btn{margin-left:15px}.netless-app-presentation-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-presentation-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-presentation-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:#0000;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-presentation-page-number-input:hover,.netless-app-presentation-page-number-input:focus,.netless-app-presentation-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-presentation-readonly.netless-app-presentation-footer{display:none}.netless-app-presentation-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden;transition:opacity .2s}.netless-app-presentation-image{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-presentation-image>img{max-width:100%;max-height:100%;object-fit:contain}.telebox-color-scheme-dark .netless-app-presentation-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-presentation-page-number-input:active,.telebox-color-scheme-dark .netless-app-presentation-page-number-input:focus,.telebox-color-scheme-dark .netless-app-presentation-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-presentation-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-presentation-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-presentation-preview{background:#323232e6}.netless-app-presentation-scrollbar-container{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:101}.netless-app-presentation-scrollbar-container-x,.netless-app-presentation-scrollbar-container-y{position:absolute;pointer-events:none;display:flex;justify-content:center;box-sizing:border-box;padding:0}.netless-app-presentation-scrollbar-container-x{bottom:0;left:0;height:6px;width:100%;padding-right:6px}.netless-app-presentation-scrollbar-container-y{top:0;right:0;width:6px;height:100%;flex-direction:column;padding-bottom:6px}.netless-app-presentation-scrollbar-x,.netless-app-presentation-scrollbar-y{border-radius:2px;background-color:#1b1f4d4d;pointer-events:auto;cursor:default}.netless-app-presentation-scrollbar-x{height:6px}.netless-app-presentation-scrollbar-y{width:6px}";function Ql(){}function f2(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function p2(e,t=Ql){let i;const n=new Set;function s(d){if(f2(e,d)&&(e=d,i))for(const f of n)f(e)}function o(d){return n.add(d),n.size===1&&(i=t(s)||Ql),d(e),()=>{n.delete(d),n.size===0&&(i&&i(),i=void 0)}}function l(d){return n.add(d),n.size===1&&(i=t(s)||Ql),()=>{n.delete(d),n.size===0&&(i&&i(),i=void 0)}}function c(d){d!==void 0&&s(d),n.clear(),i&&i(),i=void 0}return{get value(){return n.size===0&&(i=t(s)||Ql,i(),i=void 0),e},subscribe:o,reaction:l,dispose:c}}function W0(e,t){let i=null,n=0,s=0;const{onDragEnd:o,onDrag:l,onDragStart:c,direction:d="xy"}=t,f=(P,y)=>{if(P.stopPropagation(),!i)return;let x=0,I=0;d==="x"?x=Math.round(P.pageX-n):(d==="y"||(x=Math.round(P.pageX-n)),I=Math.round(P.pageY-s)),y===3?o==null||o({x,y:I}):l==null||l({x,y:I})};e.addEventListener("pointerdown",g);function g(P){i=P.target,P.stopPropagation(),i===e&&(n=P.pageX,s=P.pageY,e.addEventListener("pointermove",f),document.body.addEventListener("pointerup",M),document.body.addEventListener("pointercancel",M),e.setPointerCapture(P.pointerId),c==null||c())}function v(){i=null,e.removeEventListener("pointermove",f),document.body.removeEventListener("pointerup",M),document.body.removeEventListener("pointercancel",M)}function M(P){!i||(P.stopPropagation(),f(P,3),v())}function E(){_(),e.removeEventListener("pointerdown",g)}function _(){v()}return{destroy:E}}var Yl=D1(L1()),fM=class{constructor(e,t,i){this.namespace="netless-app-presentation",this.scrollContainer=document.createElement("div"),this.option={appId:"",getPageSize:()=>({width:0,height:0}),getWritable:()=>!1,getOriginScale:()=>1,syncView:()=>{}},this.onCameraUpdated=(0,Yl.debounce)(()=>{var n,s;if(this.readonly)return;const{scale:o,centerX:l,centerY:c}=this.view.camera,d=this.option.getOriginScale(),{width:f,height:g}=this.option.getPageSize(),{width:v,height:M}=this.view.size,E=v/f,_=M/g,P=Math.min(Math.round(E/o*100)/100,1),y=Math.min(Math.round(_/o*100)/100,1),x=Math.round(l*E),I=Math.round(c*_);this.scrollbarX&&(this.scrollbarX.style.width=`${P*100}%`,this.scrollbarX.style.display=P===1?"none":"block",this.scrollbarX.style.transform=`translateX(${x}px)`),this.scrollbarY&&(this.scrollbarY.style.height=`${y*100}%`,this.scrollbarY.style.display=y===1?"none":"block",this.scrollbarY.style.transform=`translateY(${I}px)`),(s=(n=this.option.scrollbarEventCallback)==null?void 0:n.onScrollCameraUpdated)==null||s.call(n,this.appId,d,o)},50),this.onDragStart=()=>{var n,s;const o=this.view.camera;this.cameraCache={centerX:o.centerX,centerY:o.centerY,scale:o.scale},(s=(n=this.option.scrollbarEventCallback)==null?void 0:n.onScrollbarDragStart)==null||s.call(n)},this.onDragX=n=>{var s,o;if(this.cameraCache){const{x:l}=n,{width:c}=this.option.getPageSize(),{width:d}=this.view.size,f=d/c,{minX:g,maxX:v}=this.getScrollXRange(this.cameraCache);let E=Math.round(l/f)+this.cameraCache.centerX;E<g?E=g:E>v&&(E=v),this.view.moveCamera({centerX:E,animationMode:"immediately"}),(o=(s=this.option.scrollbarEventCallback)==null?void 0:s.onScrollbarDragY)==null||o.call(s,E)}},this.onDragY=n=>{var s,o;if(this.cameraCache){const{y:l}=n,{height:c}=this.option.getPageSize(),{height:d}=this.view.size,f=d/c,{minY:g,maxY:v}=this.getScrollYRange(this.cameraCache);let E=Math.round(l/f)+this.cameraCache.centerY;E<g?E=g:E>v&&(E=v),this.view.moveCamera({centerY:E,animationMode:"immediately"}),(o=(s=this.option.scrollbarEventCallback)==null?void 0:s.onScrollbarDragY)==null||o.call(s,E)}},this.onDragEnd=()=>{var n,s;this.cameraCache=void 0,this.option.syncView(),(s=(n=this.option.scrollbarEventCallback)==null?void 0:n.onScrollbarDragEnd)==null||s.call(n)},this.moveCamera=n=>{const{centerX:s,centerY:o,scale:l}=n,c=this.view.camera,d={};if((0,Yl.isNumber)(s)){const{minX:f,maxX:g}=this.getScrollXRange(c);let v=s;s<f?v=f:s>g&&(v=g),d.centerX=v}if((0,Yl.isNumber)(o)){const{minY:f,maxY:g}=this.getScrollYRange(c);let v=o;o<f?v=f:o>g&&(v=g),d.centerY=v}if((0,Yl.isNumber)(l)){let f=l;const g=this.option.getOriginScale();l<g&&(f=g),d.scale=f}this.view.moveCamera(WR(UR({},d),{animationMode:"immediately"})),this.option.syncView()},this.scrollContainer.className=this.c("scrollbar-container"),this.container=e,this.option=t,this.appId=t.appId,this.readonly=t.readonly||!1,this.view=i,this.init()}c(e){return`${this.namespace}-${e}`}setReadonly(e){this.readonly=e,this.destroy(),this.readonly||this.init()}getScrollXRange(e){const{width:t}=this.option.getPageSize(),{width:i}=this.view.size,n=i/t,s=e.scale,o=Math.min(Math.round(n/s*100)/100,1),l=t*(1-o),c=-l/2,d=l/2;return{minX:c,maxX:d}}getScrollYRange(e){const{height:t}=this.option.getPageSize(),{height:i}=this.view.size,n=i/t,s=e.scale,o=Math.min(Math.round(n/s*100)/100,1),l=t*(1-o),c=-l/2,d=l/2;return{minY:c,maxY:d}}init(){this.scrollbarX=document.createElement("div"),this.scrollbarX.classList.add(this.c("scrollbar-x")),this.option.getWritable()&&(this.draggableX=W0(this.scrollbarX,{direction:"x",onDrag:this.onDragX,onDragEnd:this.onDragEnd,onDragStart:this.onDragStart})),Object.assign(this.scrollbarX.style,{width:"100%",display:"none"}),this.scrollbarContainerX=document.createElement("div"),this.scrollbarContainerX.classList.add(this.c("scrollbar-container-x")),this.scrollbarContainerX.appendChild(this.scrollbarX),this.scrollbarY=document.createElement("div"),this.scrollbarY.classList.add(this.c("scrollbar-y")),this.option.getWritable()&&(this.draggableY=W0(this.scrollbarY,{direction:"y",onDrag:this.onDragY,onDragEnd:this.onDragEnd,onDragStart:this.onDragStart})),Object.assign(this.scrollbarY.style,{height:"100%",display:"none"}),this.scrollbarContainerY=document.createElement("div"),this.scrollbarContainerY.classList.add(this.c("scrollbar-container-y")),this.scrollbarContainerY.appendChild(this.scrollbarY),this.scrollContainer.append(this.scrollbarContainerX,this.scrollbarContainerY),this.container.appendChild(this.scrollContainer),this.view.callbacks.on("onCameraUpdated",this.onCameraUpdated),this.onCameraUpdated()}destroy(){this.view.callbacks.off("onCameraUpdated",this.onCameraUpdated),this.scrollbarX&&this.scrollbarContainerX&&(this.scrollbarContainerX.removeChild(this.scrollbarX),this.scrollbarX.remove(),this.scrollbarContainerX.remove(),this.scrollbarX=void 0),this.scrollbarY&&this.scrollbarContainerY&&(this.scrollbarContainerY.removeChild(this.scrollbarY),this.scrollbarY.remove(),this.scrollbarContainerY.remove(),this.scrollbarY=void 0),this.draggableX&&(this.draggableX.destroy(),this.draggableX=void 0),this.draggableY&&(this.draggableY.destroy(),this.draggableY=void 0)}},g2=D1(L1()),Ea="$$empty$$",m2=(e,t)=>e?{width:e.width,height:e.height,src:e.src,thumbnail:e.previewURL,name:t}:null,v2=e=>e&&e.logger?(...t)=>e.logger.info(...t):(...t)=>console.log(...t),w2=(e,t)=>!e||!t||e.length!==t.length?!1:e.every((i,n)=>{var s,o,l,c,d,f;const g=t[n];return i.name===g.name&&((s=i.ppt)==null?void 0:s.width)===((o=g.ppt)==null?void 0:o.width)&&((l=i.ppt)==null?void 0:l.height)===((c=g.ppt)==null?void 0:c.height)&&((d=i.ppt)==null?void 0:d.src)===((f=g.ppt)==null?void 0:f.src)}),Sf={kind:"Presentation",setup(e){var t,i,n;const s=e.getView();if(!s)throw new Error("[Presentation]: no whiteboard view, make sure you have added options.scenePath in addApp()");const o=(t=e.getScenes())==null?void 0:t.map(({ppt:B,name:$})=>m2(B,$)).filter(Boolean);if(!o||o.length===0)throw new Error("[Presentation]: empty scenes, make sure you have added options.scenes in addApp()");if(o[0].src.startsWith("ppt"))throw new Error("[Presentation]: legacy dynamic PPT is unsupported, please use the projector converter and @netless/slide to render it");const l=e.getInitScenePath(),c=e.getAppOptions()||{};let d=(i=c.maxCameraScale)!=null?i:3;Number.isFinite(d)&&d>0||(console.warn(`[Presentation] maxCameraScale should be a positive number, got ${c.maxCameraScale}`),d=3);const f=c.log||v2(e.getRoom());f(`[Presentation] new ${e.appId}`);const g=O1();g.add(()=>f(`[Presentation] dispose ${e.appId}`));const v=e.createStorage("view",{uid:"",originX:0,originY:0,width:0,height:0}),M=(B,$)=>{const Z=e.manager.windowManger;return Z.emitter.on(B,$),()=>Z==null?void 0:Z.emitter.off(B,$)},E=B=>{const $=B.focusScenePath,Z=$==null?void 0:$.split("/").pop();let ne=o.findIndex((pe,ve)=>{var ge;return((ge=pe.name)!=null?ge:String(ve+1))===Z});return ne===-1&&(ne=0),ne};let _=E(s);const P=p2(_,B=>(B(_),M("onAppScenePathChange",$=>{const{appId:Z}=$;if(Z===e.appId){const ne=E($.view);B(ne)}})));if(g.add(()=>{P.dispose()}),e.isAddApp){o.length>100&&console.warn(`[Presentation]: too many pages (${o.length}), may cause performance issues`);let B;const $=e.getRoom();if($&&$.isWritable){const Z=$.entireScenes()[l];if(P.value<0||P.value>=o.length)throw new Error(`[Presentation] Invalid page index: ${P.value}, scenes length: ${o.length}`);new Promise(ne=>{const{name:pe,ppt:ve}=Z[P.value];B=ne;const ge=o.map((Xe,Ze)=>{var Ue;return{name:(Ue=Xe.name)!=null?Ue:String(Ze+1),ppt:{width:Xe.width,height:Xe.height,src:Xe.src}}});w2(Z,ge)||($.removeScenes(l),$.putScenes(l,ge)),pe===ge[P.value].name&&!ve?e.addPage({scene:{name:Ea}}).then(()=>{f(`[Presentation] setup setScenePath ${l}/${Ea}`),e.setScenePath(`${l}/${Ea}`).then(()=>{B&&B(!0)})}):B&&B(!1)}).then(async ne=>{await I(P.value,$.logger),ne&&(f(`[Presentation] setup removeScenes ${l}/${Ea}`),$.removeScenes(`${l}/${Ea}`))})}}const y=((n=e.getRoom())==null?void 0:n.uid)||e.getDisplayer().observerId+"";let x=0;const I=async(B,$)=>{var Z;if(!e.getIsWritable())return;const ne=e.getDisplayer().entireScenes()[l];if(!ne)return;const pe=o[B],ve=(Z=pe.name)!=null?Z:String(B+1);ne.some(ge=>ge.name===ve)||await e.addPage({scene:{name:ve,ppt:{width:pe.width,height:pe.height,src:pe.src}}}),$&&$.info(`[Presentation] syncPage ${l}/${ve}`),await e.setScenePath(`${l}/${ve}`)},C=B=>{var $;if(!e.getIsWritable())return console.warn("[Presentation]: no permission, make sure you have test room.isWritable"),!1;if(!(0<=B&&B<o.length))return console.warn(`[Presentation]: page ${B+1} out of bounds [1, ${o.length}]`),!1;const Z=e.getDisplayer().entireScenes()[l];if(!Z)return console.warn(`[Presentation]: no scenes found at ${l}, make sure you have added options.scenePath in addApp()`),!1;const ne=o[B],pe=($=ne.name)!=null?$:String(B+1);return Z.some(ve=>ve.name===pe)||e.addPage({scene:{name:pe,ppt:{width:ne.width,height:ne.height,src:ne.src}}}),I(B),!0},k=()=>C(P.value-1),L=()=>C(P.value+1),W=()=>({index:P.value,length:o.length}),Q=()=>{const{width:B,height:$}=z.page()||{};if(B&&$){s.moveCameraToContain({originX:-B/2,originY:-$/2,width:B,height:$,animationMode:"immediately"});const Z=s.camera.scale*(c.disableCameraTransform?1:d),ne=s.camera.scale;s.setCameraBound({damping:1,maxContentMode:()=>Z,minContentMode:()=>ne,centerX:0,centerY:0,width:B,height:$}),K(!0)}},J=()=>{if(e.getIsWritable()){if(c.debounceSync&&(clearTimeout(x),x=0),x>0)return;const{width:B,height:$}=z.page()||{};B&&$&&(x=setTimeout(()=>{x=0;const{camera:Z,size:ne}=s,pe=Math.min(ne.width,ne.height*B/$),ve=Math.min(ne.height,ne.width*$/B),ge=pe/Z.scale,Xe=ve/Z.scale,Ze=Z.centerX-ge/2,Ue=Z.centerY-Xe/2;v.setState({uid:y,originX:Ze,originY:Ue,width:ge,height:Xe})},50))}};g.add(()=>{clearTimeout(x),x=0});const K=(B=!1,$=!1)=>{const{uid:Z,originX:ne,originY:pe,width:ve,height:ge}=v.state;(B||Z!==y)&&ve>0&&ge>0&&s.moveCameraToContain({originX:ne,originY:pe,width:ve,height:ge,animationMode:$?"continuous":"immediately"})};g.add(v.addStateChangedListener(()=>K(!1,!0)));const De=()=>{const{width:B,height:$}=z.page()||{};return{width:B||0,height:$||0}},U=e.getBox(),z=g.add(x2(U,o,C,P,s,c.thumbnail,c.useClipView));z.contentDOM.dataset.appPresentationVersion="0.1.9",z.scaleDocsToFit=Q,z.log=f,c.justDocsViewReadonly&&z.setDocsViewReadonly(!0);const oe=e.getRoom(),ie=()=>{var B,$,Z,ne;const pe=(ne=(Z=($=(B=e.getRoom())==null?void 0:B.state)==null?void 0:$.memberState)==null?void 0:Z.currentApplianceName)!=null?ne:"";!z.readonly&&pe==="clicker"&&L()};if(oe&&c.goToPageByClick&&z.whiteboardDOM&&g.make(()=>(z.whiteboardDOM.addEventListener("click",ie),()=>z.whiteboardDOM.removeEventListener("click",ie))),e.mountView(z.whiteboardDOM),c.disableCameraTransform&&(s.disableCameraTransform=!0),Q(),g.make(()=>(s.callbacks.on("onSizeUpdated",Q),()=>s.callbacks.off("onSizeUpdated",Q))),c.viewport&&e.isAddApp&&z.page()){const B=z.page(),$=typeof c.viewport=="function"?c.viewport(B):c.viewport,Z=(ne,pe)=>ne==0?ne:ne<=1?ne*pe:ne;v.setState({uid:y,originX:Z($.x,B.width)-B.width/2,originY:Z($.y,B.height)-B.height/2,width:Z($.width,B.width),height:Z($.height,B.height)})}g.make(()=>(s.callbacks.on("onCameraUpdatedByDevice",J),()=>s.callbacks.off("onCameraUpdatedByDevice",J))),K(!0),g.add(e.emitter.on("writableChange",B=>{z.setReadonly(!B)}));const be=()=>{const{size:B}=s,{width:$,height:Z}=De();return Math.min(B.height/Z,B.width/$)},Ve=()=>s.camera.scale,Le=async(B,$,Z)=>{var ne,pe;(pe=(ne=oe==null?void 0:oe.calibrationTimestamp)==null?void 0:ne.toString())!=null||Date.now().toString();const ve=o[P.value];if(!ve)throw new Error("[Presentation]: current page not found");const{width:ge,height:Xe,src:Ze}=ve,Ue=document.createElement("img");Ue.width=ge,Ue.height=Xe,Ue.crossOrigin="Anonymous",await new Promise(jt=>{Ue.onload=jt,Ue.src=Ze}),B.drawImage(Ue,0,0,ge,Xe,0,0,$||ge,Z||Xe);const ut=s.focusScenePath;if(!ut)throw new Error("[Presentation]: current scene path not found");const Qe=e.getWindowManager();Qe._appliancePlugin?await Qe._appliancePlugin.screenshotToCanvasAsync(B,ut,$||ge,Z||Xe,{centerX:0,centerY:0,scale:$&&Z?Math.min($/ge,Z/Xe):1}):await s.screenshotToCanvasAsync(B,ut,$||ge,Z||Xe,{centerX:0,centerY:0,scale:$&&Z?Math.min($/ge,Z/Xe):1})};let le;c.useScrollbar&&g.make(()=>(le=new fM(z.contentDOM,{appId:e.appId,getPageSize:De,getOriginScale:be,syncView:J,getWritable:()=>e.getIsWritable(),scrollbarEventCallback:c.scrollbarEventCallback},s),()=>le==null?void 0:le.destroy()));const pt=B=>{if(e.getIsWritable()&&le){if(!le)throw new Error("[Presentation]: moveCamera must be called when appOptions: useScrollbar is true");le.moveCamera(B);return}throw new Error("[Presentation]: moveCamera must be called in writable room")};e.emitter.on("destroy",()=>g());const Ct=(B,$)=>(window.postMessage({type:"@netless/_result_save_pdf_",appId:e.appId,progress:B,result:$},"*"),$),ot=async B=>{try{const pe=new URL(B);pe.searchParams.set("t",Date.now().toString()),B=pe.toString()}catch{}const $=await fetch(B);if(!$.ok)throw new Error(`[Presentation]: failed to fetch ${B} - ${await $.text()}`);const Z=await $.blob(),ne=new FileReader;return new Promise((pe,ve)=>{ne.onload=()=>pe(ne.result),ne.onerror=()=>ve(ne.error),ne.readAsDataURL(Z)})},ti=async()=>{var B;const Z=o[0],{width:ne,height:pe}=Z;let ve=Math.floor(ne),ge=Math.floor(pe);ve>1920&&(ve=1920,ge=Math.floor(pe*ve/ne)),ge>1920&&(ge=1920,ve=Math.floor(ne*ge/pe));const Xe=e.getDisplayer().entireScenes()[l],Ze=document.createElement("canvas");Ze.width=ve,Ze.height=ge;const Ue=Ze.getContext("2d"),ut=document.createElement("canvas");ut.width=ve,ut.height=ge;const Qe=ut.getContext("2d");if(!Qe||!Ue)return Ct(100,null);const{jsPDF:jt}=await Promise.resolve().then(function(){return F0(require("jspdf"))}),Dn=new jt({format:[Z.width,Z.height],orientation:Z.width>Z.height?"l":"p",compress:!0});for(let gt=0;gt<o.length;++gt){const Ui=o[gt],{width:vr,height:vi,src:ta}=Ui,un=await ot(ta),wi=document.createElement("img");await new Promise(re=>{wi.onload=re,wi.src=un}),Ue.drawImage(wi,0,0),Qe.clearRect(0,0,ve,ge);const wr=(B=Ui.name)!=null?B:String(gt+1);if(Xe.some(re=>re.name==wr)){const re={centerX:0,centerY:0,scale:Math.min(ut.width/vr,ut.height/vi)},We=`${l}/${wr}`,ii=e.getWindowManager();ii._appliancePlugin?await ii._appliancePlugin.screenshotToCanvasAsync(Qe,We,ut.width,ut.height,re):await s.screenshotToCanvasAsync(Qe,We,ut.width,ut.height,re);try{const yi=ut.toDataURL("image/png"),Wi=document.createElement("img");await new Promise(yr=>{Wi.onload=yr,Wi.src=yi}),Ue.drawImage(Wi,0,0,ve,ge)}catch(yi){console.warn(yi)}}const ee=Ze.toDataURL("image/jpeg",.6);gt>0&&Dn.addPage(),Dn.addImage(ee,"JPEG",0,0,ve,ge,"","FAST"),Ue.clearRect(0,0,ve,ge);const Ce=Math.ceil((gt+1)/o.length*100);Ce<100&&Ct(Ce,null)}const mi=Dn.output("arraybuffer"),ct=U.title;return Ct(100,{pdf:mi,title:ct})};g.add(Ki(window,"message",B=>{B.data&&B.data.type=="@netless/_request_save_pdf_"&&B.data.appId==e.appId&&ti().catch($=>{console.warn($),Ct(100,null)})}));const q={app:z,view:s,context:e,jumpPage:C,prevPage:k,nextPage:L,pageState:W,toPdf:ti,log:f,setDocsViewReadonly:B=>{z.setDocsViewReadonly(B)},setReadonly:B=>{z.setReadonly(B),c.goToPageByClick,le&&le.setReadonly(B)},moveCamera:pt,getOriginScale:be,getScale:Ve,getPageSize:De,screenshotCurrentPageAsync:Le};return g.add(Ki(window,"message",B=>{B.data==="@netless/_presentation_"&&(typeof window!="undefined"&&g.make(()=>{const $=window._presentation_||(window._presentation_=new Set);return $.add(q),()=>$.delete(q)}),console.log(q))})),q}},y2=class extends dM{constructor(e){super(e),this.jumpPage=e.jumpPage}updateImage(){super.updateImage()}onNewPageIndex(e,t){t==="keydown"&&this.box&&!this.box.focus||(this.log&&this.log("[Presentation] user navigate to",e+1,`(${t})`),0<=e&&e<this.pages.length?this.jumpPage(e):console.warn(`[Presentation]: page index ${e} out of bounds [0, ${this.pages.length-1}]`))}};function x2(e,t,i,n,s,o,l){e.mountStyles(d2);const c=new y2({pages:t,readonly:e.readonly,jumpPage:i,thumbnail:o});if(c.box=e,e.mountContent(c.contentDOM),e.mountFooter(c.footerDOM),c.dispose.add(n.subscribe(d=>{c.setPageIndex(d)})),l&&s){const d=(0,g2.debounce)(()=>{const{width:g,height:v}=c.page()||{};if(!g||!v)return;const{scale:M}=s.camera,{width:E,height:_}=s.size,P=Math.round((1-g*M/E)/2*100),y=Math.round((1-v*M/_)/2*100);c.whiteboardDOM.style.clipPath=`inset(${y}% ${P}%)`},50);d();const f=()=>(s.callbacks.on("onSizeUpdated",d),s.callbacks.on("onCameraUpdated",d),()=>{s.callbacks.off("onCameraUpdated",d),s.callbacks.off("onSizeUpdated",d)});c.dispose.make(f)}return c}var S2=(e,t={})=>{let i=Sf;return t.as&&(i=Object.assign({},i,{kind:t.as})),e({kind:i.kind,src:i,appOptions:t.appOptions})},M2="0.1.9",b2=Object.freeze(Object.defineProperty({__proto__:null,NetlessAppPresentation:Sf,Presentation:dM,Scrollbar:fM,default:Sf,install:S2,version:M2},Symbol.toStringTag,{value:"Module"}));exports.AppContext=go;exports.AppCreateError=X0;exports.AppManager=bo;exports.AppManagerNotInitError=ci;exports.AppNotRegisterError=CP;exports.AppProxy=Mo;exports.AttributesDelegate=So;exports.BindContainerRoomPhaseInvalidError=iy;exports.BoxManager=wo;exports.BoxManagerNotFoundError=ty;exports.BoxNotCreatedError=q0;exports.BuiltinApps=An;exports.CursorManager=xo;exports.ExtendPlugin=Rk;exports.ExtendPluginManager=By;exports.InvalidScenePath=ey;exports.ParamsInvalidError=K0;exports.TeleBoxCollector=Ys;exports.TeleBoxManager=vo;exports.WhiteWebSDKInvalidError=J0;exports.WindowManager=Te;exports.calculateNextIndex=Df;exports.getExtendClass=Vk;exports.reconnectRefresher=zy;
|
|
15
|
+
***************************************************************************** */var X=function(){return X=Object.assign||function(e){for(var t,s=1,r=arguments.length;s<r;s++){t=arguments[s];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},X.apply(this,arguments)};function oi(i,e){var t={};for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&e.indexOf(s)<0&&(t[s]=i[s]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(i);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(i,s[r])&&(t[s[r]]=i[s[r]]);return t}var jt=0,fs=typeof window!="undefined"&&window.requestAnimationFrame!==void 0?function(i){return window.requestAnimationFrame(i)}:function(i){var e=Date.now(),t=Math.max(0,16.7-(e-jt));jt=e+t,setTimeout(function(){return i(jt)},t)},Vr=function(i){var e=[],t=[],s=0,r=!1,n=0,a=new WeakSet,o=new WeakSet,h={cancel:function(c){var l=t.indexOf(c);a.add(c),l!==-1&&t.splice(l,1)},process:function(c){var l;if(r=!0,l=[t,e],e=l[0],t=l[1],t.length=0,s=e.length,s){var u;for(n=0;n<s;n++)u=e[n],u(c),o.has(u)===!0&&!a.has(u)&&(h.schedule(u),i(!0))}r=!1},schedule:function(c,l,u){l===void 0&&(l=!1),u===void 0&&(u=!1);var d=u&&r,m=d?e:t;a.delete(c),l&&o.add(c),m.indexOf(c)===-1&&(m.push(c),d&&(s=e.length))}};return h},jr=40,Ei=1/60*1e3,ft=!0,Je=!1,Kt=!1,Oe={delta:0,timestamp:0},hi=["read","update","preRender","render","postRender"],Rr=function(i){return Je=i},Ms=hi.reduce(function(i,e){return i[e]=Vr(Rr),i},{}),kr=hi.reduce(function(i,e){var t=Ms[e];return i[e]=function(s,r,n){return r===void 0&&(r=!1),n===void 0&&(n=!1),Je||_r(),t.schedule(s,r,n),s},i},{}),Ur=function(i){return Ms[i].process(Oe)},ws=function(i){Je=!1,Oe.delta=ft?Ei:Math.max(Math.min(i-Oe.timestamp,jr),1),ft||(Ei=Oe.delta),Oe.timestamp=i,Kt=!0,hi.forEach(Ur),Kt=!1,Je&&(ft=!1,fs(ws))},_r=function(){Je=!0,ft=!0,Kt||fs(ws)},xs=function(i,e){return function(t){return Math.max(Math.min(t,e),i)}},Mt=function(i){return i%1?Number(i.toFixed(5)):i},Ss=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,bt={test:function(i){return typeof i=="number"},parse:parseFloat,transform:function(i){return i}},Ze=X(X({},bt),{transform:xs(0,1)}),dt=X(X({},bt),{default:1}),ci=function(i){return{test:function(e){return typeof e=="string"&&e.endsWith(i)&&e.split(" ").length===1},parse:parseFloat,transform:function(e){return""+e+i}}},we=ci("deg"),Fe=ci("%"),T=ci("px"),Vi=X(X({},Fe),{parse:function(i){return Fe.parse(i)/100},transform:function(i){return Fe.transform(i*100)}}),Or=function(i){return i.substring(i.indexOf("(")+1,i.lastIndexOf(")"))},Wr=xs(0,255),qt=function(i){return i.red!==void 0},ei=function(i){return i.hue!==void 0};function $r(i){return Or(i).replace(/(,|\/)/g," ").split(/ \s*/)}var bs=function(i){return function(e){if(typeof e!="string")return e;for(var t={},s=$r(e),r=0;r<4;r++)t[i[r]]=s[r]!==void 0?parseFloat(s[r]):1;return t}},Zr=function(i){var e=i.red,t=i.green,s=i.blue,r=i.alpha,n=r===void 0?1:r;return"rgba("+e+", "+t+", "+s+", "+n+")"},Fr=function(i){var e=i.hue,t=i.saturation,s=i.lightness,r=i.alpha,n=r===void 0?1:r;return"hsla("+e+", "+t+", "+s+", "+n+")"},Rt=X(X({},bt),{transform:function(i){return Math.round(Wr(i))}});function li(i,e){return i.startsWith(e)&&Ss.test(i)}var wt={test:function(i){return typeof i=="string"?li(i,"rgb"):qt(i)},parse:bs(["red","green","blue","alpha"]),transform:function(i){var e=i.red,t=i.green,s=i.blue,r=i.alpha,n=r===void 0?1:r;return Zr({red:Rt.transform(e),green:Rt.transform(t),blue:Rt.transform(s),alpha:Mt(Ze.transform(n))})}},kt={test:function(i){return typeof i=="string"?li(i,"hsl"):ei(i)},parse:bs(["hue","saturation","lightness","alpha"]),transform:function(i){var e=i.hue,t=i.saturation,s=i.lightness,r=i.alpha,n=r===void 0?1:r;return Fr({hue:Math.round(e),saturation:Fe.transform(Mt(t)),lightness:Fe.transform(Mt(s)),alpha:Mt(Ze.transform(n))})}},ji=X(X({},wt),{test:function(i){return typeof i=="string"&&li(i,"#")},parse:function(i){var e="",t="",s="";return i.length>4?(e=i.substr(1,2),t=i.substr(3,2),s=i.substr(5,2)):(e=i.substr(1,1),t=i.substr(2,1),s=i.substr(3,1),e+=e,t+=t,s+=s),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(s,16),alpha:1}}}),ne={test:function(i){return typeof i=="string"&&Ss.test(i)||qt(i)||ei(i)},parse:function(i){return wt.test(i)?wt.parse(i):kt.test(i)?kt.parse(i):ji.test(i)?ji.parse(i):i},transform:function(i){return qt(i)?wt.transform(i):ei(i)?kt.transform(i):i}},ui=function(i){var e=i.onRead,t=i.onRender,s=i.uncachedValues,r=s===void 0?new Set:s,n=i.useCache,a=n===void 0?!0:n;return function(o){o===void 0&&(o={});var h=oi(o,[]),c={},l=[],u=!1;function d(g,b){g.startsWith("--")&&(h.hasCSSVariable=!0);var M=c[g];c[g]=b,c[g]!==M&&(l.indexOf(g)===-1&&l.push(g),u||(u=!0,kr.render(m.render)))}var m={get:function(g,b){b===void 0&&(b=!1);var M=!b&&a&&!r.has(g)&&c[g]!==void 0;return M?c[g]:e(g,h)},set:function(g,b){if(typeof g=="string")d(g,b);else for(var M in g)d(M,g[M]);return this},render:function(g){return g===void 0&&(g=!1),(u||g===!0)&&(t(c,h,l),u=!1,l.length=0),this}};return m}},Gr=/([a-z])([A-Z])/g,Qr="$1-$2",vt=function(i){return i.replace(Gr,Qr).toLowerCase()},vs=new Map,di=new Map,Is=["Webkit","Moz","O","ms",""],Yr=Is.length,Hr=typeof document!="undefined",Ut,ys=function(i,e){return di.set(i,vt(e))},Jr=function(i){Ut=Ut||document.createElement("div");for(var e=0;e<Yr;e++){var t=Is[e],s=t==="",r=s?i:t+i.charAt(0).toUpperCase()+i.slice(1);if(r in Ut.style||s){if(s&&i==="clipPath"&&di.has(i))return;vs.set(i,r),ys(i,(s?"":"-")+vt(r))}}},Xr=function(i){return ys(i,i)},Cs=function(i,e){e===void 0&&(e=!1);var t=e?di:vs;return t.has(i)||(Hr?Jr(i):Xr(i)),t.get(i)||i},Kr=["","X","Y","Z"],qr=["translate","scale","rotate","skew","transformPerspective"],ti=qr.reduce(function(i,e){return Kr.reduce(function(t,s){return t.push(e+s),t},i)},["x","y","z"]),ea=ti.reduce(function(i,e){return i[e]=!0,i},{});function gi(i){return ea[i]===!0}function ta(i,e){return ti.indexOf(i)-ti.indexOf(e)}var ia=new Set(["originX","originY","originZ"]);function sa(i){return ia.has(i)}var Ri=X(X({},bt),{transform:Math.round}),ra={color:ne,backgroundColor:ne,outlineColor:ne,fill:ne,stroke:ne,borderColor:ne,borderTopColor:ne,borderRightColor:ne,borderBottomColor:ne,borderLeftColor:ne,borderWidth:T,borderTopWidth:T,borderRightWidth:T,borderBottomWidth:T,borderLeftWidth:T,borderRadius:T,radius:T,borderTopLeftRadius:T,borderTopRightRadius:T,borderBottomRightRadius:T,borderBottomLeftRadius:T,width:T,maxWidth:T,height:T,maxHeight:T,size:T,top:T,right:T,bottom:T,left:T,padding:T,paddingTop:T,paddingRight:T,paddingBottom:T,paddingLeft:T,margin:T,marginTop:T,marginRight:T,marginBottom:T,marginLeft:T,rotate:we,rotateX:we,rotateY:we,rotateZ:we,scale:dt,scaleX:dt,scaleY:dt,scaleZ:dt,skew:we,skewX:we,skewY:we,distance:T,translateX:T,translateY:T,translateZ:T,x:T,y:T,z:T,perspective:T,opacity:Ze,originX:Vi,originY:Vi,originZ:T,zIndex:Ri,fillOpacity:Ze,strokeOpacity:Ze,numOctaves:Ri},pi=function(i){return ra[i]},aa=function(i,e){return e&&typeof i=="number"?e.transform(i):i},Ge="scrollLeft",Qe="scrollTop",As=new Set([Ge,Qe]),na=new Set([Ge,Qe,"transform"]),oa={x:"translateX",y:"translateY",z:"translateZ"};function Bs(i){return typeof i=="function"}function ha(i,e,t,s,r,n){n===void 0&&(n=!0);var a="",o=!1;t.sort(ta);for(var h=t.length,c=0;c<h;c++){var l=t[c];a+=(oa[l]||l)+"("+e[l]+") ",o=l==="z"?!0:o}return!o&&r?a+="translateZ(0)":a=a.trim(),Bs(i.transform)?a=i.transform(e,s?"":a):n&&s&&(a="none"),a}function ca(i,e,t,s,r,n,a,o){e===void 0&&(e=!0),t===void 0&&(t={}),s===void 0&&(s={}),r===void 0&&(r={}),n===void 0&&(n=[]),a===void 0&&(a=!1),o===void 0&&(o=!0);var h=!0,c=!1,l=!1;for(var u in i){var d=i[u],m=pi(u),g=aa(d,m);gi(u)?(c=!0,s[u]=g,n.push(u),h&&(m.default&&d!==m.default||!m.default&&d!==0)&&(h=!1)):sa(u)?(r[u]=g,l=!0):(!na.has(u)||!Bs(g))&&(t[Cs(u,a)]=g)}return(c||typeof i.transform=="function")&&(t.transform=ha(i,s,n,h,e,o)),l&&(t.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),t}function mi(i){var e=i===void 0?{}:i,t=e.enableHardwareAcceleration,s=t===void 0?!0:t,r=e.isDashCase,n=r===void 0?!0:r,a=e.allowTransformNone,o=a===void 0?!0:a,h={},c={},l={},u=[];return function(d){return u.length=0,ca(d,s,h,c,l,u,n,o),h}}function la(i,e){var t=e.element,s=e.preparseOutput,r=pi(i);if(gi(i))return r&&r.default||0;if(As.has(i))return t[i];var n=window.getComputedStyle(t,null).getPropertyValue(Cs(i,!0))||0;return s&&r&&r.test(n)&&r.parse?r.parse(n):n}function ua(i,e,t){var s=e.element,r=e.buildStyles,n=e.hasCSSVariable;if(Object.assign(s.style,r(i)),n)for(var a=t.length,o=0;o<a;o++){var h=t[o];h.startsWith("--")&&s.style.setProperty(h,i[h])}t.indexOf(Ge)!==-1&&(s[Ge]=i[Ge]),t.indexOf(Qe)!==-1&&(s[Qe]=i[Qe])}var da=ui({onRead:la,onRender:ua,uncachedValues:As});function ga(i,e){e===void 0&&(e={});var t=e.enableHardwareAcceleration,s=e.allowTransformNone,r=oi(e,["enableHardwareAcceleration","allowTransformNone"]);return da(X({element:i,buildStyles:mi({enableHardwareAcceleration:t,allowTransformNone:s}),preparseOutput:!0},r))}var Ns=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),ki=.5,zs=function(){return{style:{}}},_t=function(i,e){return T.transform(i*e)},pa={x:0,y:0,width:0,height:0};function Ui(i,e,t){return typeof i=="string"?i:T.transform(e+t*i)}function ma(i,e,t){return Ui(e,i.x,i.width)+" "+Ui(t,i.y,i.height)}var Ds={enableHardwareAcceleration:!1,isDashCase:!1};function fa(i,e,t,s,r,n){e===void 0&&(e=pa),s===void 0&&(s=mi(Ds)),r===void 0&&(r=zs()),n===void 0&&(n=!0);var a=i.attrX,o=i.attrY,h=i.originX,c=i.originY,l=i.pathLength,u=i.pathSpacing,d=u===void 0?1:u,m=i.pathOffset,g=m===void 0?0:m,b=oi(i,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),M=s(b);for(var N in M)if(N==="transform")r.style.transform=M[N];else{var z=n&&!Ns.has(N)?vt(N):N;r[z]=M[N]}return(h!==void 0||c!==void 0||M.transform)&&(r.style.transformOrigin=ma(e,h!==void 0?h:ki,c!==void 0?c:ki)),a!==void 0&&(r.x=a),o!==void 0&&(r.y=o),t!==void 0&&l!==void 0&&(r[n?"stroke-dashoffset":"strokeDashoffset"]=_t(-g,t),r[n?"stroke-dasharray":"strokeDasharray"]=_t(l,t)+" "+_t(d,t)),r}function Ma(i,e,t){t===void 0&&(t=!0);var s=zs(),r=mi(Ds);return function(n){return fa(n,i,e,r,s,t)}}var wa=function(i){return typeof i.getBBox=="function"?i.getBBox():i.getBoundingClientRect()},xa=function(i){try{return wa(i)}catch{return{x:0,y:0,width:0,height:0}}},Sa=function(i){return i.tagName==="path"},ba=ui({onRead:function(i,e){var t=e.element;if(i=Ns.has(i)?i:vt(i),gi(i)){var s=pi(i);return s&&s.default||0}else return t.getAttribute(i)},onRender:function(i,e){var t=e.element,s=e.buildAttrs,r=s(i);for(var n in r)n==="style"?Object.assign(t.style,r.style):t.setAttribute(n,r[n])}}),va=function(i){var e=xa(i),t=Sa(i)&&i.getTotalLength?i.getTotalLength():void 0;return ba({element:i,buildAttrs:Ma(e,t)})},Ia=ui({useCache:!1,onRead:function(i){return i==="scrollTop"?window.pageYOffset:window.pageXOffset},onRender:function(i){var e=i.scrollTop,t=e===void 0?0:e,s=i.scrollLeft,r=s===void 0?0:s;return window.scrollTo(r,t)}}),ii=new WeakMap,ya=function(i){return i instanceof HTMLElement||typeof i.click=="function"},Ca=function(i){return i instanceof SVGElement||"ownerSVGElement"in i},Aa=function(i,e){var t;return i===window?t=Ia(i):ya(i)?t=ga(i,e):Ca(i)&&(t=va(i)),ii.set(i,t),t},Ba=function(i,e){return ii.has(i)?ii.get(i):Aa(i,e)};function Na(i,e){var t=typeof i=="string"?document.querySelector(i):i;return Ba(t,e)}var oe=function(e,t,s,r){var n=s?s.call(r,e,t):void 0;if(n!==void 0)return!!n;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;for(var h=Object.prototype.hasOwnProperty.bind(t),c=0;c<a.length;c++){var l=a[c];if(!h(l))return!1;var u=e[l],d=t[l];if(n=s?s.call(r,u,d,l):void 0,n===!1||n===void 0&&u!==d)return!1}return!0};const Ts="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",za=Ts.length,_i=Array(20),Ue=()=>{for(let i=0;i<20;i++)_i[i]=Ts.charAt(Math.random()*za);return _i.join("")};class xt{constructor(){this.disposers=new Map}add(e,t=Ue()){return this.flush(t),this.disposers.set(t,e()),t}addDisposer(e,t=Ue()){return this.flush(t),this.disposers.set(t,e),t}addEventListener(e,t,s,r,n=Ue()){return this.add(()=>(e.addEventListener(t,s,r),()=>e.removeEventListener(t,s,r)),n),n}setTimeout(e,t,s=Ue()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(s),e()},t);return()=>window.clearTimeout(r)},s)}setInterval(e,t,s=Ue()){return this.add(()=>{const r=window.setInterval(e,t);return()=>window.clearInterval(r)},s)}remove(e){const t=this.disposers.get(e);return this.disposers.delete(e),t}flush(e){const t=this.remove(e);if(t)try{t()}catch(s){console.error(s)}}flushAll(){this.disposers.forEach(e=>{try{e()}catch(t){console.error(t)}}),this.disposers.clear()}}var Da=Object.defineProperty,Ot=(typeof require!="undefined"&&require,(i,e,t)=>(((s,r,n)=>{r in s?Da(s,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[r]=n})(i,typeof e!="symbol"?e+"":e,t),t));class et{constructor(e,t){Ot(this,"_value"),Ot(this,"_beforeDestroys"),Ot(this,"_subscribers"),this._value=e,t&&(this.compare=t)}get value(){return this._value}setValue(e,t){if(!this.compare(e,this._value)){const s=this._value;this._value=e,this._subscribers&&this._subscribers.forEach(r=>r(e,s,t))}}reaction(e){return this._subscribers||(this._subscribers=new Set),this._subscribers.add(e),()=>{this._subscribers&&this._subscribers.delete(e)}}subscribe(e,t){const s=this.reaction(e);return e(this._value,void 0,t),s}derive(e,t,s){const r=new et(e(this.value,void 0,s),t),n=this.reaction((a,o,h)=>{r.setValue(e(a,o,h))});return r.addBeforeDestroy(n),r}destroy(){this._beforeDestroys&&(this._beforeDestroys.forEach(e=>e()),this._beforeDestroys.clear()),this._subscribers&&this._subscribers.clear()}addBeforeDestroy(e){return this._beforeDestroys||(this._beforeDestroys=new Set),this._beforeDestroys.add(e),()=>{this._beforeDestroys&&this._beforeDestroys.delete(e)}}compare(e,t){return e===t}}function Ta(i,e,t,s){let r=i.map(a=>a.value);const n=new et(e(r,void 0,s),t);return i.forEach((a,o)=>{const h=a.reaction((c,l,u)=>{const d=r.slice();d[o]=c;const m=r;r=d,n.setValue(e(d,m,u),u)});n.addBeforeDestroy(h)}),n}function Ps(i,e){Object.keys(e).forEach(t=>{Pa(i,t,e[t])})}function Pa(i,e,t){var s;return Object.defineProperties(i,{[e]:{get:()=>t.value},[`_${e}$`]:{value:t},[`set${s=e,s[0].toUpperCase()+s.slice(1)}`]:{value:(r,n)=>t.setValue(r,n)}}),i}function Ls(i){const e=t=>{const s=i.addDisposer(()=>{t.destroy()});return t.addBeforeDestroy(()=>{i.remove(s)}),t};return{bindSideEffect:e,combine:(t,s,r,n)=>e(Ta(t,s,r,n)),createVal:(t,s)=>e(new et(t,s))}}var fi=(i=>(i.Light="light",i.Dark="dark",i.Auto="auto",i))(fi||{}),x=(i=>(i.Normal="normal",i.Minimized="minimized",i.Maximized="maximized",i))(x||{}),k=(i=>(i.DarkMode="dark_mode",i.PrefersColorScheme="prefers_color_scheme",i.Close="close",i.Focus="focus",i.Blur="blur",i.Move="move",i.Resize="resize",i.IntrinsicMove="intrinsic_move",i.IntrinsicResize="intrinsic_resize",i.VisualResize="visual_resize",i.ZIndex="z_index",i.State="state",i.Minimized="minimized",i.Maximized="maximized",i.Readonly="readonly",i.Destroyed="destroyed",i.BoxStatus="box_status",i.LastNotMinimizedBoxStatus="last_not_minimized_box_status",i.ForceTop="force_top",i.ForceNormal="force_normal",i))(k||{}),H=(i=>(i.Close="close",i.Maximize="maximize",i.Minimize="minimize",i))(H||{}),he=(i=>(i.North="n",i.South="s",i.West="w",i.East="e",i.NorthWest="nw",i.NorthEast="ne",i.SouthEast="se",i.SouthWest="sw",i))(he||{});const Wt="dh";function K(i,e,t){return Math.min(Math.max(i,e),t)}function De(i){i.stopPropagation(),i.cancelable&&i.preventDefault()}function Oi(i){return i.touches?i.touches[0]:i}function La(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}let Ea=1;function Va(){return`New Box ${Ea++}`}function ja(i){return Boolean(i)}function gt(i){return!i}class Es{constructor({readonly:e=!1,title:t,buttons:s,onEvent:r,onDragStart:n,namespace:a="telebox",state:o=x.Normal,boxStatus:h,forceTop:c=!1,forceNormal:l=!1}={}){this.$btns=[],this.sideEffect=new xt,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=u=>{var d;if(this.readonly||u.button!==0||(d=u.target.dataset)!=null&&d.teleTitleBarNoDblClick)return;De(u);const m=Date.now();m-this.lastTitleBarClick.timestamp<=500?Math.abs(u.clientX-this.lastTitleBarClick.clientX)<=5&&Math.abs(u.clientY-this.lastTitleBarClick.clientY)<=5&&this.onEvent&&this.onEvent({type:H.Maximize}):this.onDragStart&&this.onDragStart(u),this.lastTitleBarClick.timestamp=m,this.lastTitleBarClick.clientX=u.clientX,this.lastTitleBarClick.clientY=u.clientY},this.lastTitleBarTouch={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarTouch=u=>{var d;if(this.readonly||(d=u.target.dataset)!=null&&d.teleTitleBarNoDblClick)return;De(u);const m=Date.now(),{clientX:g=this.lastTitleBarTouch.clientX+100,clientY:b=this.lastTitleBarTouch.clientY+100}=u.touches[0]||{};m-this.lastTitleBarTouch.timestamp<=500?Math.abs(g-this.lastTitleBarTouch.clientX)<=10&&Math.abs(b-this.lastTitleBarTouch.clientY)<=10&&this.onEvent&&this.onEvent({type:H.Maximize}):this.onDragStart&&this.onDragStart(u),this.lastTitleBarTouch.timestamp=m,this.lastTitleBarTouch.clientX=g,this.lastTitleBarTouch.clientY=b},this.readonly=e,this.onEvent=r,this.onDragStart=n,this.namespace=a,this.title=t,this.state=o,this.boxStatus=h,this.forceTop=c,this.forceNormal=l,this.buttons=s||(l?[{type:H.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}]:[{type:H.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:H.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:u=>u===x.Maximized},{type:H.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}]),this.$dragArea=this.renderDragArea()}setTitle(e){this.title=e,this.$title&&(this.$title.textContent=e,this.$title.title=e)}setState(e){this.state!==e&&(this.state=e,this.buttons.forEach((t,s)=>{t.isActive&&this.$btns[s].classList.toggle("is-active",t.isActive(e))}))}setBoxStatus(e){this.boxStatus!==e&&(this.boxStatus=e,e&&this.buttons.forEach((t,s)=>{t.isActive&&this.$btns[s].classList.toggle("is-active",t.isActive(e))}))}setReadonly(e){this.readonly!==e&&(this.readonly=e)}render(){if(!this.$titleBar){this.$titleBar=document.createElement("div"),this.$titleBar.className=this.wrapClassName("titlebar");const e=document.createElement("div");e.className=this.wrapClassName("title-area"),e.dataset.teleBoxHandle=Wt,this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle=Wt,this.title&&(this.$title.textContent=this.title,this.$title.title=this.title),e.appendChild(this.$title),e.appendChild(this.$dragArea);const t=document.createElement("div");t.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:s,isActive:r},n)=>{const a=String(n),o=document.createElement("button");o.className=`${this.wrapClassName("titlebar-btn")} ${s}`,o.dataset.teleTitleBarBtnIndex=a,o.dataset.teleTitleBarNoDblClick="true",r&&o.classList.toggle("is-active",r(this.boxStatus||this.state)),this.$btns.push(o),t.appendChild(o)}),this.sideEffect.addEventListener(t,"click",s=>{var r;if(this.readonly)return;const n=s.target,a=Number((r=n.dataset)==null?void 0:r.teleTitleBarBtnIndex);if(!Number.isNaN(a)&&a<this.buttons.length){De(s);const o=this.buttons[a];this.onEvent&&this.onEvent({type:o.type,value:o.value})}}),this.$titleBar.appendChild(e),this.$titleBar.appendChild(t)}return this.$titleBar}renderDragArea(){const e=document.createElement("div");return e.className=this.wrapClassName("drag-area"),e.dataset.teleBoxHandle=Wt,this.sideEffect.addEventListener(e,"mousedown",this.handleTitleBarClick),this.sideEffect.addEventListener(e,"touchstart",this.handleTitleBarTouch,{passive:!0}),e}dragHandle(){return this.$titleBar}wrapClassName(e){return`${this.namespace}-${e}`}destroy(){this.sideEffect.flushAll(),this.$titleBar&&(this.$titleBar=void 0,this.$title=void 0,this.$btns.length=0,this.onDragStart=void 0,this.onEvent=void 0)}}class Ra{constructor({id:e=La(),title:t=Va(),prefersColorScheme:s=fi.Light,darkMode:r,visible:n=!0,width:a=.5,height:o=.5,minWidth:h=0,minHeight:c=0,x:l=.1,y:u=.1,minimized:d=!1,maximized:m=!1,readonly:g=!1,resizable:b=!0,draggable:M=!0,fence:N=!0,fixRatio:z=!1,focus:v=!1,zIndex:Z=100,namespace:_="telebox",titleBar:W,content:ie,footer:Ie,styles:pe,containerRect:Ve={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collectorRect:S,boxStatus:p,lastNotMinimizedBoxStatus:B,forceTop:D=!1,forceNormal:Y=!1,isDragContent:F=!1}={}){this._renderSideEffect=new xt,this.handleTrackStart=I=>{var E;return(E=this._handleTrackStart)==null?void 0:E.call(this,I)},this._sideEffect=new xt,this._valSideEffectBinder=Ls(this._sideEffect);const{combine:ae,createVal:V}=this._valSideEffectBinder;this.id=e,this.namespace=_,this.events=new Xt,this._delegateEvents=new Xt;const le=V(p),bi=V(B),Ct=V(s);Ct.reaction((I,E,y)=>{y||this.events.emit(k.PrefersColorScheme,I)});const je=V(Boolean(r));r==null&&Ct.subscribe((I,E,y)=>{this._sideEffect.add(()=>{if(I==="auto"){const $=window.matchMedia("(prefers-color-scheme: dark)");if($){je.setValue($.matches,y);const Ce=ut=>{je.setValue(ut.matches,y)};return $.addListener(Ce),()=>$.removeListener(Ce)}else return Wi}else return je.setValue(I==="dark",y),Wi},"prefers-color-scheme")}),je.reaction((I,E,y)=>{y||this.events.emit(k.DarkMode,I)});const At=V(Ve,oe),Bt=V(S,oe),Nt=V(D);Nt.reaction((I,E,y)=>{y||this.events.emit(k.ForceTop,I||!1)});const zt=V(Y);zt.reaction((I,E,y)=>{y||this.events.emit(k.ForceNormal,I||!1)});const Fs=V(F),Dt=V(t);Dt.reaction((I,E,y)=>{y||this.titleBar.setTitle(I)});const Tt=V(n);Tt.reaction((I,E,y)=>{!y&&!I&&this.events.emit(k.Close)});const ht=V(g);ht.reaction((I,E,y)=>{y||this.events.emit(k.Readonly,I)});const Gs=V(b),Qs=V(M),Ys=V(N),Hs=V(z),vi=V(Z);vi.reaction((I,E,y)=>{y||this.events.emit(k.ZIndex,I)});const Ii=V(v);Ii.reaction((I,E,y)=>{y||this.events.emit(I?k.Focus:k.Blur)});const ye=V(d);ye.reaction((I,E,y)=>{y||this.events.emit(k.Minimized,I)});const Me=V(m);Me.reaction((I,E,y)=>{y||this.events.emit(k.Maximized,I)});const yi=ae([ye,Me,le],([I,E,y])=>I?x.Minimized:E?x.Maximized:y||x.Normal);yi.reaction((I,E,y)=>{y||this.events.emit(k.State,I)});const ct=V({width:K(h,0,1),height:K(c,0,1)},oe),Re=V({width:K(a,ct.value.width,1),height:K(o,ct.value.height,1)},oe);ct.reaction((I,E,y)=>{Re.setValue({width:K(a,I.width,1),height:K(o,I.height,1)},y)}),Re.reaction((I,E,y)=>{y||this.events.emit(k.IntrinsicResize,I)});const ke=ae([Re,Me,le],([I,E,y])=>E||y===x.Maximized?{width:1,height:1}:I,oe);ke.reaction((I,E,y)=>{y||this.events.emit(k.Resize,I)});const Ci=ae([ke,ye,At,Bt,le],([I,E,y,$,Ce])=>(E||Ce===x.Minimized)&&$?{width:$.width/I.width/y.width,height:$.height/I.height/y.height}:I,oe);Ci.reaction((I,E,y)=>{y||this.events.emit(k.VisualResize,I)});const Pt=V({x:K(l,0,1),y:K(u,0,1)},oe);Pt.reaction((I,E,y)=>{y||this.events.emit(k.IntrinsicMove,I)});const lt=ae([Pt,Re,At,Bt,ye,Me,le,bi],([I,E,y,$,Ce,ut,Ai,qs])=>(Ce||Ai===x.Minimized)&&$?ut||qs===x.Maximized?{x:($.x+$.width/2)/y.width-1/2,y:($.y+$.height/2)/y.height-1/2}:{x:($.x+$.width/2)/y.width-E.width/2,y:($.y+$.height/2)/y.height-E.height/2}:ut||Ai===x.Maximized?{x:0,y:0}:I,oe);lt.reaction((I,E,y)=>{y||this.events.emit(k.Move,I)}),this.titleBar=W||new Es({readonly:ht.value,title:Dt.value,namespace:this.namespace,boxStatus:le.value,forceTop:Nt.value,forceNormal:zt.value,onDragStart:I=>{var E;return(E=this._handleTrackStart)==null?void 0:E.call(this,I)},onEvent:I=>{if(this._delegateEvents.listeners.length>0)this._delegateEvents.emit(I.type);else switch(I.type){case H.Maximize:{le.value||Me.setValue(!Me.value);break}case H.Minimize:{le.value||ye.setValue(!0);break}case H.Close:{Tt.setValue(!1);break}default:{console.error("Unsupported titleBar event:",I);break}}}}),ht.reaction(I=>{this.titleBar.setReadonly(I)}),le.reaction(I=>{this.titleBar.setBoxStatus(I)});const Js=V(ie),Xs=V(Ie),Ks=V(pe);Ps(this,{prefersColorScheme:Ct,darkMode:je,containerRect:At,collectorRect:Bt,title:Dt,visible:Tt,readonly:ht,resizable:Gs,draggable:Qs,fence:Ys,fixRatio:Hs,focus:Ii,zIndex:vi,minimized:ye,maximized:Me,$userContent:Js,$userFooter:Xs,$userStyles:Ks,forceTop:Nt,forceNormal:zt,isDragContent:Fs}),this._state$=yi,this._minSize$=ct,this._size$=ke,this._intrinsicSize$=Re,this._visualSize$=Ci,this._coord$=lt,this._intrinsicCoord$=Pt,this._boxStatus$=le,this._lastNotMinimizedBoxStatus$=bi,this.fixRatio&&this.transform(lt.value.x,lt.value.y,ke.value.width,ke.value.height,!0),this.$box=this.render()}get boxStatus(){return this._boxStatus$.value}set boxStatus(e){this._boxStatus$.setValue(e)}get lastNotMinimizedBoxStatus(){return this._lastNotMinimizedBoxStatus$.value}get darkMode(){return this._darkMode$.value}get state(){return this._state$.value}setState(e,t=!1){switch(e){case x.Maximized:{this.setMinimized(!1,t),this.setMaximized(!0,t);break}case x.Minimized:{this.setMinimized(!0,t),this.setMaximized(!1,t);break}default:{this.setMinimized(!1,t),this.setMaximized(!1,t);break}}return this}setBoxStatus(e,t=!1){return e===x.Minimized?this._boxStatus$.value&&this._boxStatus$.value!==x.Minimized&&this.setLastNotMinimizedBoxStatus(this._boxStatus$.value,t):this.setLastNotMinimizedBoxStatus(void 0,t),this._boxStatus$.setValue(e,t),t||this.events.emit(k.BoxStatus,{id:this.id,boxStatus:e}),this}setLastNotMinimizedBoxStatus(e,t=!1){return this._lastNotMinimizedBoxStatus$.setValue(e,t),t||this.events.emit(k.LastNotMinimizedBoxStatus,{id:this.id,lastNotMinimizedBoxStatus:e}),this}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(e,t=!1){return this._minSize$.setValue({width:e,height:this.minHeight},t),this}setMinHeight(e,t=!1){return this._minSize$.setValue({width:this.minWidth,height:e},t),this}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}resize(e,t,s=!1){return this._intrinsicSize$.setValue({width:e,height:t},s),this}get width(){return this._size$.value.width}get height(){return this._size$.value.height}get absoluteWidth(){return this.width*this.containerRect.width}get absoluteHeight(){return this.height*this.containerRect.height}get visualWidth(){return this._visualSize$.value.width}get visualHeight(){return this._visualSize$.value.height}get intrinsicX(){return this._intrinsicCoord$.value.x}get intrinsicY(){return this._intrinsicCoord$.value.y}move(e,t,s=!1){return this._intrinsicCoord$.setValue({x:e,y:t},s),this}get x(){return this._coord$.value.x}get y(){return this._coord$.value.y}transform(e,t,s,r,n=!1){if(this.fixRatio){const a=this.intrinsicHeight/this.intrinsicWidth*s;t!==this.intrinsicY&&(t-=a-r),r=a}return t<0&&(t=0,r>this.intrinsicHeight&&(r=this.intrinsicHeight)),this._intrinsicCoord$.setValue({x:s>=this.minWidth?e:this.intrinsicX,y:r>=this.minHeight?t:this.intrinsicY},n),this._intrinsicSize$.setValue({width:K(s,this.minWidth,1),height:K(r,this.minHeight,1)},n),this}mount(e){return e.appendChild(this.render()),this}unmount(){return this.$box&&this.$box.remove(),this}mountContent(e){return this.set$userContent(e),this}unmountContent(){return this.set$userContent(void 0),this}mountFooter(e){return this.set$userFooter(e),this}unmountFooter(){return this.set$userFooter(void 0),this}getUserStyles(){return this.$userStyles}mountStyles(e){let t;return typeof e=="string"?(t=document.createElement("style"),t.textContent=e):t=e,this.set$userStyles(t),this}unmountStyles(){return this.set$userStyles(void 0),this}render(e){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"));const t=(u,d,m,g=ja)=>this._renderSideEffect.add(()=>{const b=this.wrapClassName(m);return d.subscribe(M=>{u.classList.toggle(b,g(M))})});t(this.$box,this._readonly$,"readonly"),t(this.$box,this._draggable$,"no-drag",gt),t(this.$box,this._resizable$,"no-resize",gt),t(this.$box,this._focus$,"blur",gt),t(this.$box,this._darkMode$,"color-scheme-dark"),t(this.$box,this._darkMode$,"color-scheme-light",gt),this._renderSideEffect.add(()=>{const u=this.wrapClassName("minimized"),d=this.wrapClassName("maximized"),m="box-maximized-timer";return this._state$.subscribe(g=>{this.$box.classList.toggle(u,g===x.Minimized),g===x.Maximized?(this._renderSideEffect.flush(m),this.$box.classList.toggle(d,!0)):this._renderSideEffect.setTimeout(()=>{this.$box.classList.toggle(d,!1)},0,m)})}),this._renderSideEffect.add(()=>this._visible$.subscribe(u=>{u?this.$box.style.removeProperty("display"):this.$box.style.display="none"})),this._renderSideEffect.add(()=>this._zIndex$.subscribe(u=>{this.$box.style.zIndex=String(u)}));const s=Na(this.$box);this.$box.dataset.teleBoxID=this.id,this.$box.style.width=this.absoluteWidth+"px",this.$box.style.height=this.absoluteHeight+"px";const r=this.x*this.containerRect.width+this.containerRect.x,n=this.y*this.containerRect.height+this.containerRect.y;this.$box.style.transform=`translate(${r-10}px,${n-10}px)`,this._valSideEffectBinder.combine([this._coord$,this._size$,this._minimized$,this._containerRect$,this._collectorRect$,this._boxStatus$],([u,d,m,g,b,M])=>{const N=d.width*g.width,z=d.height*g.height;return{width:N+((m||M===x.Minimized)&&b?1:0),height:z+((m||M===x.Minimized)&&b?1:0),x:u.x*g.width,y:u.y*g.height,scaleX:(m||M===x.Minimized)&&b?b.width/N:1,scaleY:(m||M===x.Minimized)&&b?b.height/z:1}},oe).subscribe(u=>{s.set(u)}),s.set({x:r,y:n});const a=document.createElement("div");a.className=this.wrapClassName("box-main"),this.$box.appendChild(a);const o=document.createElement("div");o.className=this.wrapClassName("titlebar-wrap"),o.appendChild(this.titleBar.render()),this.$titleBar=o;const h=document.createElement("div");h.className=this.wrapClassName("content-wrap");const c=document.createElement("div");c.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=c,this.isDragContent&&this.$content.appendChild(this.titleBar.$dragArea),this._renderSideEffect.add(()=>{let u;return this._$userStyles$.subscribe(d=>{u&&u.remove(),u=d,d&&h.appendChild(d)})}),this._renderSideEffect.add(()=>{let u;return this._$userContent$.subscribe(d=>{u&&u.remove(),u=d,d&&c.appendChild(d)})}),h.appendChild(c);const l=document.createElement("div");return l.className=this.wrapClassName("footer-wrap"),this.$footer=l,this._renderSideEffect.add(()=>{let u;return this._$userFooter$.subscribe(d=>{u&&u.remove(),u=d,d&&l.appendChild(d)})}),a.appendChild(o),a.appendChild(h),a.appendChild(l),this._renderResizeHandlers(),this.$box}_renderResizeHandlers(){const e=document.createElement("div");e.className=this.wrapClassName("resize-handles"),Object.values(he).forEach(b=>{const M=document.createElement("div");M.className=this.wrapClassName(b)+" "+this.wrapClassName("resize-handle"),M.dataset.teleBoxHandle=b,e.appendChild(M)}),this.$box.appendChild(e);const t="handle-tracking-listener",s=this.wrapClassName("transforming");let r,n=0,a=0,o=0,h=0,c=0,l=0,u;const d=b=>{if(this.state!==x.Normal)return;De(b);let{pageX:M,pageY:N}=Oi(b);N<0&&(N=0);const z=(M-c)/this.containerRect.width,v=(N-l)/this.containerRect.height;switch(u){case he.North:{this.transform(this.x,a+v,this.width,h-v);break}case he.South:{this.transform(this.x,this.y,this.width,h+v);break}case he.West:{this.transform(n+z,this.y,o-z,this.height);break}case he.East:{this.transform(this.x,this.y,o+z,this.height);break}case he.NorthWest:{this.transform(n+z,a+v,o-z,h-v);break}case he.NorthEast:{this.transform(this.x,a+v,o+z,h-v);break}case he.SouthEast:{this.transform(this.x,this.y,o+z,h+v);break}case he.SouthWest:{this.transform(n+z,this.y,o-z,h+v);break}default:{if(this.fence)this.move(K(n+z,0,1-this.width),K(a+v,0,1-this.height));else{const Z=20/this.containerRect.width,_=20/this.containerRect.height;this.move(K(n+z,Z-this.width,1-Z),K(a+v,0,1-_))}break}}},m=b=>{u=void 0,r&&(De(b),this.$box.classList.toggle(s,!1),this._sideEffect.flush(t),r.remove())},g=b=>{var M;if(this.readonly||b.button!=null&&b.button!==0||!this.draggable||u||this.state!==x.Normal)return;const N=b.target;if((M=N.dataset)!=null&&M.teleBoxHandle){De(b),n=this.x,a=this.y,o=this.width,h=this.height,{pageX:c,pageY:l}=Oi(b),u=N.dataset.teleBoxHandle,r||(r=document.createElement("div"));const z=u?this.wrapClassName(`cursor-${u}`):"";r.className=this.wrapClassName(`track-mask${z?` ${z}`:""}`),this.$box.appendChild(r),this.$box.classList.add(s),this._sideEffect.add(()=>(window.addEventListener("mousemove",d),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("mouseup",m),window.addEventListener("touchend",m,{passive:!1}),window.addEventListener("touchcancel",m,{passive:!1}),()=>{window.removeEventListener("mousemove",d),window.removeEventListener("touchmove",d),window.removeEventListener("mouseup",m),window.removeEventListener("touchend",m),window.removeEventListener("touchcancel",m)}),t)}};this._handleTrackStart=g,this._sideEffect.addEventListener(e,"mousedown",g,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(e,"touchstart",g,{passive:!1},"box-resizeHandles-touchstart")}destroy(){this.$box.remove(),this.events.emit(k.Destroyed),this._sideEffect.flushAll(),this._renderSideEffect.flushAll(),this.events.removeAllListeners(),this._delegateEvents.removeAllListeners()}wrapClassName(e){return`${this.namespace}-${e}`}}function Wi(){}var ka="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class Le{constructor({visible:e=!0,readonly:t=!1,darkMode:s=!1,namespace:r="telebox",styles:n={},onClick:a,getBoxesStatus:o}){this.$appMenuContainer=document.createElement("div"),this.handleCollectorClick=()=>{!this._readonly&&this.onClick&&this.onClick()},this._visible=e,this._readonly=t,this._darkMode=s,this.namespace=r,this.styles=n,this.onClick=a,this.getBoxesStatus=o}get boxesStatus(){var e;return(e=this.getBoxesStatus)==null?void 0:e.call(this)}get visible(){return this._visible}get readonly(){return this._readonly}get darkMode(){return this._darkMode}mount(e){return e.appendChild(this.render()),this}unmount(){return this.$collector&&this.$collector.remove(),this}hasMinimizedBox(){const e=this.boxesStatus;if(e){for(const t of e.values())if(t===x.Minimized)return!0}return!1}updateBoxesStatus(){const e=this.hasMinimizedBox();this.setVisible(e)}setVisible(e){return this._visible!==e&&(this._visible=e,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-visible"),e)),this}setReadonly(e){return this._readonly!==e&&(this._readonly=e,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-readonly"),e)),this}setDarkMode(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}setStyles(e){if(Object.assign(this.styles,e),this.$collector){const t=this.$collector;Object.keys(e).forEach(s=>{const r=e[s];r!=null&&(t.style[s]=r)})}return this}render(){return this.$collector||(this.$collector=document.createElement("button"),this.$collector.className=this.wrapClassName("collector"),this.$collector.style.backgroundImage=`url('${ka}')`,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.$appMenuContainer.classList.add(this.wrapClassName("collector-shadow")),this.$collector.append(this.$appMenuContainer),this.setStyles(this.styles)),this.$collector}destroy(){this.$collector&&(this.$collector.removeEventListener("click",this.handleCollectorClick),this.$collector.remove(),this.$collector=void 0),this.onClick=void 0}wrapClassName(e){return`${this.namespace}-${e}`}}Le.kind="TeleBoxCollector";var O=(i=>(i.Focused="focused",i.Blurred="blurred",i.Created="created",i.Removed="removed",i.State="state",i.Maximized="maximized",i.Minimized="minimized",i.Move="move",i.Resize="resize",i.IntrinsicMove="intrinsic_move",i.IntrinsicResize="intrinsic_resize",i.VisualResize="visual_resize",i.ZIndex="z_index",i.PrefersColorScheme="prefers_color_scheme",i.DarkMode="dark_mode",i.BoxStatus="box_status",i.LastNotMinimizedBoxStatus="last_not_minimized_box_status",i))(O||{});class Ua extends Es{constructor(e){super(e),this.boxes=e.boxes,this.focusedBox=e.focusedBox,this.containerRect=e.containerRect,this.darkMode=e.darkMode,this.getBoxesStatus=e.getBoxesStatus}get boxesStatus(){var e;return(e=this.getBoxesStatus)==null?void 0:e.call(this)}hasMaximizedBoxInStatus(){if(this.getBoxesStatus){const e=this.getBoxesStatus();if(e.size)return!![...e.values()].find(s=>s===x.Maximized)}return!1}get MaximizedBoxes(){if(this.getBoxesStatus){const e=this.getBoxesStatus();if(e)return this.boxes.filter(t=>e&&e.get(t.id)===x.Maximized&&!t.forceTop)}return[]}focusBox(e){var t,s;if(!(this.focusedBox&&this.focusedBox===e)){if(this.$titles){const{children:r}=this.$titles.firstElementChild;if(this.state===x.Maximized&&!this.hasMaximizedBoxInStatus())for(let n=r.length-1;n>=0;n-=1){const a=r[n],o=(t=a.dataset)==null?void 0:t.teleBoxID;o&&(e&&o===e.id?a.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&o===this.focusedBox.id&&a.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}else if(this.hasMaximizedBoxInStatus())for(let n=r.length-1;n>=0;n-=1){const a=r[n],o=(s=a.dataset)==null?void 0:s.teleBoxID;o&&(e&&o===e.id?a.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&o===this.focusedBox.id&&a.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}}this.focusedBox=e}}setContainerRect(e){if(this.containerRect=e,this.$titleBar){const{x:t,y:s,width:r}=e;this.$titleBar.style.transform=`translate(${t}px, ${s}px)`,this.$titleBar.style.width=r+"px"}}updateBoxesStatus(){this.hasMaximizedBoxInStatus()&&this.setBoxStatus(x.Maximized),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===x.Maximized&&this.boxes.length>0||this.hasMaximizedBoxInStatus()),this.updateTitles()}setBoxes(e){this.boxes=e,this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===x.Maximized&&e.length>0||this.hasMaximizedBoxInStatus()),this.updateTitles()}setState(e){super.setState(e),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),e===x.Maximized&&this.boxes.length>0||this.hasMaximizedBoxInStatus()),this.updateTitles()}setReadonly(e){super.setReadonly(e),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("readonly"),this.readonly)}setDarkMode(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)))}render(){const e=super.render(),{x:t,y:s,width:r}=this.containerRect;e.style.transform=`translate(${t}px, ${s}px)`,e.style.width=r+"px",e.classList.add(this.wrapClassName("max-titlebar")),e.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===x.Maximized&&this.boxes.length>0),e.classList.toggle(this.wrapClassName("readonly"),this.readonly),e.classList.add(this.wrapClassName(this.darkMode?"color-scheme-dark":"color-scheme-light"));const n=document.createElement("div");return n.classList.add(this.wrapClassName("titles-area")),e.insertBefore(n,e.firstElementChild),this.updateTitles(),e}destroy(){super.destroy(),this.$titles=void 0,this.boxes.length=0,this.focusedBox=void 0}updateTitles(){this.$titleBar&&(this.state===x.Maximized||this.hasMaximizedBoxInStatus())&&(this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-single-title"),this.boxes.length===1||this.hasMaximizedBoxInStatus()&&this.MaximizedBoxes.length===1),this.boxes.length===1||this.hasMaximizedBoxInStatus()&&this.MaximizedBoxes.length===1?this.setTitle(this.boxes[0].title):this.$titleBar.replaceChild(this.renderTitles(),this.$titleBar.firstElementChild))}renderTitles(){this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.$titles.addEventListener("wheel",t=>{t.currentTarget.scrollBy({left:t.deltaY>0?250:-250,behavior:"smooth"})},{passive:!1});const e=document.createElement("div");return e.className=this.wrapClassName("titles-content"),this.$titles.appendChild(e),(this.hasMaximizedBoxInStatus()?this.MaximizedBoxes:this.boxes).forEach(t=>{const s=document.createElement("button");s.className=this.wrapClassName("titles-tab"),s.textContent=t.title,s.dataset.teleBoxID=t.id,s.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&t.id===this.focusedBox.id&&s.classList.add(this.wrapClassName("titles-tab-focus")),e.appendChild(s)}),this.$titles}}class _a{constructor(e){this.namespace="telebox-app-menu",this.badge=document.createElement("div"),this.menuView=document.createElement("div"),this.containerClickHandler=()=>{if(this.manager.readonly)return;getComputedStyle(this.menuView).display==="flex"?this.menuView.style.display="none":this.menuView.style.display="flex"},this.menuViewClickHandler=t=>{t.stopPropagation(),t.stopImmediatePropagation();const r=t.target.getAttribute(`data-${this.c("app-id")}`);if(r){const n=this.manager.getLastNotMinimizedBoxStatus(r)||x.Normal,a=(n===x.Maximized?this.manager.getMaxMaximizedBoxZIndex():this.manager.getMaxNormalBoxZIndex())+1;this.manager.setBox(r,{status:n,zIndex:a},!1,()=>{this.manager.focusBox(r)});return}},this.updatePrefersColorSchemeHandler=()=>{this.container.classList.remove(this.theme),this.theme=this.manager.prefersColorScheme,this.container.classList.add(this.theme)},this.appMenuChange=()=>{const t=this.manager.getMinimizedBoxesStatus();this.render(t)},this.container=e.container,this.manager=e.manager,this.theme=e.theme,this.getBoxesStatus=e.getBoxesStatus,this.init()}get boxesStatus(){var e;return((e=this.getBoxesStatus)==null?void 0:e.call(this))||new Map}get minimizedBoxesStatus(){const e=[];return this.boxesStatus.forEach(t=>{t===x.Minimized&&e.push(t)}),e}c(e){return`${this.namespace}-${e}`}setContainer(e){this.container&&this.container.remove(),this.container=e,this.init()}createDefaultAppMenu(){this.badge.classList.add(this.c("app-menu-badge")),this.menuView.classList.add(this.c("app-menu-tooltip")),this.container.classList.add(this.c("app-menu-container"),this.theme),this.menuView.addEventListener("click",this.menuViewClickHandler),this.container.append(this.badge,this.menuView)}async init(){this.createDefaultAppMenu(),this.appMenuChange()}createMinimizedItem(e){const t=document.createElement("div");t.classList.add(this.c("app-menu-item")),t.setAttribute(`data-${this.c("app-id")}`,e);const s=document.createElement("div");s.classList.add(this.c("app-menu-item-title"));const r=this.manager.getBox(e);return s.innerText=(r==null?void 0:r.title)||e,t.appendChild(s),t}renderMenuView(e){const t=[];e.forEach((s,r)=>{t.push(this.createMinimizedItem(r))}),this.menuView.append(...t)}render(e){this.menuView.style.display="none",this.badge.innerText="",this.menuView.innerHTML="",e.size===0?this.container.style.display="none":(this.badge.innerText=e.size.toString(),this.renderMenuView(e),this.container.style.display="block")}destroy(){this.badge.remove(),this.menuView.removeEventListener("click",this.menuViewClickHandler),this.menuView.remove(),this.container.remove()}}class tt{constructor({root:e=document.body,prefersColorScheme:t=fi.Light,minimized:s=!1,maximized:r=!1,fence:n=!0,containerRect:a={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collector:o,namespace:h="telebox",readonly:c=!1,useBoxesStatus:l=!1}={}){this.events=new Xt,this._sideEffect=new xt,this.useBoxesStatus=l;const{combine:u,createVal:d}=Ls(this._sideEffect);this.root=e,this.namespace=h,this.boxes$=d([]),this.topBox$=this.boxes$.derive(S=>{if(S.length>0){let p;return S.reduce((D,Y)=>Y.forceTop||Y.boxStatus&&Y.boxStatus===x.Minimized?D:D?D.zIndex>Y.zIndex?D:Y:(D=Y,D),p)}}),this.boxesStatus$=new Map,this.lastNotMinimizedBoxesStatus$=new Map;const m=window.matchMedia("(prefers-color-scheme: dark)"),g=d(!1);m&&(g.setValue(m.matches),this._sideEffect.add(()=>{const S=p=>{g.setValue(p.matches)};return m.addListener(S),()=>m.removeListener(S)}));const b=d(t);b.reaction((S,p,B)=>{this.boxes.forEach(D=>D.setPrefersColorScheme(S,B)),B||this.events.emit(O.PrefersColorScheme,S)}),this._darkMode$=u([g,b],([S,p])=>p==="auto"?S:p==="dark"),this._darkMode$.reaction((S,p,B)=>{this.boxes.forEach(D=>D.setDarkMode(S,B)),B||this.events.emit(O.DarkMode,S)});const M=d(c);M.reaction((S,p,B)=>{this.boxes.forEach(D=>D.setReadonly(S,B))});const N=d(s),z=d(r);z.reaction((S,p,B)=>{this.boxes.forEach(D=>D.setMaximized(S,B)),B||this.events.emit(O.Maximized,S)});const v=u([N,z],([S,p])=>S?x.Minimized:p?x.Maximized:x.Normal);v.reaction((S,p,B)=>{this.maxTitleBar.setState(S),B||this.events.emit(O.State,S)});const Z=d(n);Z.subscribe((S,p,B)=>{this.boxes.forEach(D=>D.setFence(S,B))});const _=d(a,oe);_.reaction((S,p,B)=>{this.boxes.forEach(D=>D.setContainerRect(S,B)),this.maxTitleBar.setContainerRect(S)});const W=d(o===null?null:o||new Le({visible:s,readonly:c,namespace:h}).mount(e));W.subscribe(S=>{S&&(S.setVisible(N.value),S.setReadonly(M.value),S.setDarkMode(this._darkMode$.value),this.useBoxesStatus&&this.appMenu&&this.appMenu.setContainer(S.$appMenuContainer),this._sideEffect.add(()=>(S.getBoxesStatus=()=>this.boxesStatus$,S.onClick=()=>{M.value||(this.useBoxesStatus?this.useBoxesStatus&&this.appMenu&&this.appMenu.containerClickHandler():N.setValue(!1))},()=>S.destroy()),"collect-onClick"))}),M.subscribe(S=>{var p;return(p=W.value)==null?void 0:p.setReadonly(S)}),this._darkMode$.subscribe(S=>{var p;(p=W.value)==null||p.setDarkMode(S)}),this._calcCollectorRect=()=>{var S;if((S=W.value)!=null&&S.$collector){const{x:p,y:B,width:D,height:Y}=W.value.$collector.getBoundingClientRect(),F=this.root.getBoundingClientRect();return{x:p-F.x,y:B-F.y,width:D,height:Y}}},this._setCollectorRect=S=>{var p;(p=W.value)!=null&&p.$collector&&ie.setValue(S)};const ie=d(N.value?this._calcCollectorRect():void 0);ie.subscribe((S,p,B)=>{this.boxes.forEach(D=>{D.setCollectorRect(S,B)})}),N.subscribe((S,p,B)=>{var D;(D=W.value)==null||D.setVisible(S),S&&this._setCollectorRect(this._calcCollectorRect()),this.boxes.forEach(Y=>Y.setMinimized(S,B)),B||this.events.emit(O.Minimized,S)});const Ie=this.wrapClassName("titlebar-icon-close"),pe=S=>{var p;if(M.value)return;const B=S.target;if(!!B.tagName)for(let D=B;D;D=D.parentElement){if(D.classList&&D.classList.contains(Ie))return;const Y=(p=D.dataset)==null?void 0:p.teleBoxID;if(Y){const F=this.getBox(Y);if(F){if(!this.useBoxesStatus)this.makeBoxTop(F);else if(F.boxStatus&&F.boxStatus===x.Normal){const ae=this.getMaxNormalBoxZIndex();ae>F.zIndex&&this.setBox(F,{zIndex:ae+1},!1)}else if(F.boxStatus&&F.boxStatus===x.Maximized){const ae=this.getMaxMaximizedBoxZIndex();ae>F.zIndex&&this.setBox(F,{zIndex:ae+1},!1),this.makeMaximizedTopBoxFocus()}this.focusBox(F);return}}}};this._sideEffect.addEventListener(window,"mousedown",pe,!0),this._sideEffect.addEventListener(window,"touchstart",pe,!0),this.maxTitleBar=new Ua({darkMode:this.darkMode,readonly:M.value,namespace:this.namespace,state:v.value,boxes:this.boxes$.value,containerRect:_.value,getBoxesStatus:()=>this.boxesStatus$,onEvent:S=>{switch(S.type){case H.Maximize:{if(this.hasBoxesStatus()){let p=this.maxTitleBar.focusedBox;if(p||(p=this.getMaximizedTopBox()),p!=null&&p.id){const B=this.getBox(p.id);B&&this.setBox(B,{status:x.Normal,zIndex:this.getMaxNormalBoxZIndex()+1},!1,()=>{this.makeMaximizedTopBoxFocus()})}}else z.setValue(!z.value);break}case H.Minimize:{if(this.hasBoxesStatus()){let p=this.maxTitleBar.focusedBox;if(p||(p=this.getMaximizedTopBox()),p!=null&&p.id){const B=this.getBox(p.id);if(B){let D=!1;B.focus&&(this.blurBox(B),D=!0),this.setBox(B,{status:x.Minimized,zIndex:-1},!1),D?this.focusTopBox():this.makeMaximizedTopBoxFocus()}}}else N.setValue(!0);break}case k.Close:{if(this.hasBoxesStatus()){let p=this.maxTitleBar.focusedBox;if(p||(p=this.getMaximizedTopBox()),p!=null&&p.id){const B=this.getBox(p.id);if(B){let D=!1;B.focus&&(this.blurBox(B),D=!0),this.remove(B,!1),D?this.focusTopBox():this.makeMaximizedTopBoxFocus()}}}else this.removeTopBox(),this.focusTopBox();break}}}}),M.subscribe(S=>this.maxTitleBar.setReadonly(S)),this._darkMode$.subscribe(S=>{this.maxTitleBar.setDarkMode(S)}),this.boxes$.reaction(S=>{this.maxTitleBar.setBoxes(S)}),Ps(this,{prefersColorScheme:b,containerRect:_,collector:W,collectorRect:ie,readonly:M,fence:Z,minimized:N,maximized:z}),this._state$=v,this.root.appendChild(this.maxTitleBar.render()),l&&(this.appMenu=this.createMinimizedAppMenu())}get boxes(){return this.boxes$.value}get topBox(){return this.topBox$.value}get forceTopBoxes(){return this.boxes.find(e=>e.forceTop)}get maxForceTopBox(){return this.boxes.reduce((e,t)=>{var s;return t.forceTop&&t.zIndex>((s=e==null?void 0:e.zIndex)!=null?s:0)?t:e},void 0)}get forceNormalBoxes(){return this.boxes.find(e=>e.forceNormal)}get darkMode(){return this._darkMode$.value}get state(){return this._state$.value}setState(e,t=!1){switch(e){case x.Maximized:{this.setMinimized(!1,t),this.setMaximized(!0,t);break}case x.Minimized:{this.setMinimized(!0,t),this.setMaximized(!1,t);break}default:{this.setMinimized(!1,t),this.setMaximized(!1,t);break}}return this}setBoxStatus(e,t,s=!1){if(t){const r=this.boxesStatus$.get(e);this.boxesStatus$.set(e,t),t===x.Minimized&&r!==x.Minimized?this.setLastNotMinimizedBoxStatus(e,r,s):r===x.Minimized&&t!==x.Minimized&&this.setLastNotMinimizedBoxStatus(e,void 0,s)}else this.boxesStatus$.delete(e),this.setLastNotMinimizedBoxStatus(e,void 0,s);s||this.events.emit(O.BoxStatus,{id:e,boxStatus:t})}getBoxStatus(e){return this.boxesStatus$.get(e)}get boxesStatus(){return this.boxesStatus$}get lastNotMinimizedBoxesStatus(){return this.lastNotMinimizedBoxesStatus$}setBoxesStatus(e,t=!1){this.boxesStatus$=e,this.effectBoxesStatusChange(t)}getBoxesStatus(){return this.boxesStatus$}effectBoxStatusChange(){!this.useBoxesStatus||(this.collector&&(this.collector.updateBoxesStatus(),this.hasMinimizedBox()&&this._setCollectorRect(this._calcCollectorRect())),this.appMenu&&this.appMenu.appMenuChange(),this.maxTitleBar&&this.maxTitleBar.updateBoxesStatus())}effectBoxesStatusTimerFunc(e){if(!this.useBoxesStatus)return;let t;const s=this.topBox;this.boxes.forEach(r=>{var n;const a=this.boxesStatus$.get(r.id);a&&(a!==x.Minimized&&!this.isForceTop(r)&&r.zIndex>((n=t==null?void 0:t.zIndex)!=null?n:0)&&(t=r),r.setBoxStatus(a,e))}),this.effectBoxStatusChange(),t&&s!==t&&this.topBox$.setValue(t),!t&&s&&this.topBox$.setValue(void 0)}async effectBoxesStatusChange(e=!1){var t,s;if(!this.useBoxesStatus){this.effectBoxesStatusTimer&&this.effectBoxesStatusTimer.timer&&(clearTimeout(this.effectBoxesStatusTimer.timer),this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(!!((t=this.effectBoxesStatusTimer)!=null&&t.skipUpdate))),this.effectBoxesStatusTimer=void 0;return}if(this.effectBoxesStatusTimer&&this.effectBoxesStatusTimer.timer)if(this.effectBoxesStatusTimer.skipUpdate!==e)clearTimeout(this.effectBoxesStatusTimer.timer),this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(!!((s=this.effectBoxesStatusTimer)!=null&&s.skipUpdate)),this.effectBoxesStatusTimer.skipUpdate=e;else return;if(this.effectBoxesStatusTimer||(this.effectBoxesStatusTimer={skipUpdate:e,timer:void 0,resolve:void 0}),this.effectBoxesStatusTimer){const r=await new Promise(n=>{this.effectBoxesStatusTimer.resolve=n,this.effectBoxesStatusTimer.timer=setTimeout(()=>{this.effectBoxesStatusTimer&&this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(this.effectBoxesStatusTimer.skipUpdate)},100)});this.effectBoxesStatusTimerFunc(r),this.effectBoxesStatusTimer=void 0}}hasBoxesStatus(){return this.useBoxesStatus?this.boxesStatus$.size>0:!1}hasMinimizedBox(){return this.useBoxesStatus?this.boxes.some(e=>e.boxStatus&&e.boxStatus===x.Minimized):!1}getMinimizedBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((t,s)=>{t===x.Minimized&&e.set(s,t)}),e}getNotMinimizedBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((t,s)=>{t!==x.Minimized&&e.set(s,t)}),e}getAllMaximizedBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((t,s)=>{t===x.Maximized&&e.set(s,t)}),e}getAllNormalBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((t,s)=>{t===x.Normal&&e.set(s,t)}),e}getLastNotMinimizedBoxStatus(e){return this.lastNotMinimizedBoxesStatus$.get(e)}setLastNotMinimizedBoxStatus(e,t,s=!1){t?this.lastNotMinimizedBoxesStatus$.set(e,t):this.lastNotMinimizedBoxesStatus$.delete(e),s||this.events.emit(O.LastNotMinimizedBoxStatus,{id:e,boxStatus:t})}setLastNotMinimizedBoxesStatus(e,t=!1){this.lastNotMinimizedBoxesStatus$=e,this.effectLastNotMinimizedBoxStatusChange(t)}async effectLastNotMinimizedBoxStatusChange(e=!1){var t,s;if(!this.useBoxesStatus){this.effectLastNotMinimizedBoxStatusTimer&&this.effectLastNotMinimizedBoxStatusTimer.timer&&(clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer),this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((t=this.effectLastNotMinimizedBoxStatusTimer)!=null&&t.skipUpdate))),this.effectLastNotMinimizedBoxStatusTimer=void 0;return}if(this.effectLastNotMinimizedBoxStatusTimer&&this.effectLastNotMinimizedBoxStatusTimer.timer)if(clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer),this.effectLastNotMinimizedBoxStatusTimer.skipUpdate!==e)this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((s=this.effectLastNotMinimizedBoxStatusTimer)!=null&&s.skipUpdate)),this.effectLastNotMinimizedBoxStatusTimer.skipUpdate=e;else return;if(this.effectLastNotMinimizedBoxStatusTimer||(this.effectLastNotMinimizedBoxStatusTimer={skipUpdate:e,timer:void 0,resolve:void 0}),this.effectLastNotMinimizedBoxStatusTimer){const r=await new Promise(n=>{this.effectLastNotMinimizedBoxStatusTimer.resolve=n,this.effectLastNotMinimizedBoxStatusTimer.timer=setTimeout(()=>{this.effectLastNotMinimizedBoxStatusTimer&&this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(this.effectLastNotMinimizedBoxStatusTimer.skipUpdate)},100)});this.effectLastNotMinimizedBoxStatusFunc(r),this.effectLastNotMinimizedBoxStatusTimer=void 0}}effectLastNotMinimizedBoxStatusFunc(e=!1){!this.useBoxesStatus||this.boxes.forEach(t=>{const s=this.lastNotMinimizedBoxesStatus$.get(t.id);s&&t.setLastNotMinimizedBoxStatus(s,e)})}getUnabledBoxesStatusZIndex(){return this.topBox?this.topBox.zIndex:99}getMaxMaximizedBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((e,t)=>t.boxStatus&&t.boxStatus===x.Maximized&&!this.isForceTop(t)?Math.max(e,t.zIndex):e,99):this.getUnabledBoxesStatusZIndex()}getMaxNormalBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((e,t)=>t.boxStatus&&t.boxStatus===x.Normal&&!this.isForceTop(t)?Math.max(e,t.zIndex):e,299):this.getUnabledBoxesStatusZIndex()}getMaxForceTopBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((e,t)=>t.boxStatus&&this.isForceTop(t)?Math.max(e,t.zIndex):e,699):this.getUnabledBoxesStatusZIndex()}isForceNormal(e){return e._forceNormal$.value}isForceTop(e){return e._forceTop$.value}create(e={},t=!0){const s=new Ra({zIndex:e.forceTop?this.getMaxForceTopBoxZIndex()+1:this.getMaxNormalBoxZIndex()+1,...t?this.smartPosition(e):e,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 s.mount(this.root),this.boxes$.setValue([...this.boxes,s]),s.boxStatus&&this.useBoxesStatus&&this.setBox(s,{status:s.boxStatus,lastNotMinimizedBoxStatus:s._lastNotMinimizedBoxStatus$.value},!0),s.focus&&(this.focusBox(s),t&&this.makeBoxTop(s)),s._delegateEvents.on(H.Maximize,()=>{if(this.useBoxesStatus&&s.boxStatus){if(s._forceNormal$.value)return;s.boxStatus===x.Maximized?this.setBox(s.id,{status:x.Normal,zIndex:this.getMaxNormalBoxZIndex()+1},!1):([...this.boxes].filter(r=>r.boxStatus===x.Normal&&!this.isForceNormal(r)).sort((r,n)=>r.zIndex-n.zIndex).forEach(r=>{r.boxStatus===x.Normal&&this.setBox(r.id,{status:x.Maximized,zIndex:this.getMaxMaximizedBoxZIndex()+1},!1)}),this.makeMaximizedTopBoxFocus())}else this.setMaximized(!this.maximized)}),s._delegateEvents.on(H.Minimize,()=>{if(s.boxStatus&&this.useBoxesStatus){if(s._forceNormal$.value)return;s.focus&&this.blurBox(s),this.setBox(s,{status:x.Minimized,zIndex:-1},!1,()=>{this.focusTopBox()})}else this.setMinimized(!0)}),s._delegateEvents.on(H.Close,()=>{this.useBoxesStatus&&s.focus&&this.blurBox(s),this.remove(s),this.focusTopBox()}),s._coord$.reaction((r,n,a)=>{a||this.events.emit(O.Move,s)}),s._size$.reaction((r,n,a)=>{a||this.events.emit(O.Resize,s)}),s._intrinsicCoord$.reaction((r,n,a)=>{a||this.events.emit(O.IntrinsicMove,s)}),s._intrinsicSize$.reaction((r,n,a)=>{a||this.events.emit(O.IntrinsicResize,s)}),s._visualSize$.reaction((r,n,a)=>{a||this.events.emit(O.VisualResize,s)}),s._zIndex$.reaction((r,n,a)=>{if(this.boxes.length>0){let o;const h=this.boxes.reduce((c,l)=>this.isForceTop(l)||l.boxStatus&&l.boxStatus===x.Minimized?c:c?c.zIndex>l.zIndex?c:l:(c=l,c),o);this.topBox$.setValue(h)}a||this.events.emit(O.ZIndex,s)}),this.events.emit(O.Created,s),s}query(e){return e?this.boxes.filter(this.teleBoxMatcher(e)):[...this.boxes]}queryOne(e){return e?this.boxes.find(this.teleBoxMatcher(e)):this.boxes[0]}update(e,t,s=!1){const r=this.boxes.find(n=>n.id===e);if(r)return this.updateBox(r,t,s)}updateAll(e,t=!1){this.boxes.forEach(s=>{this.updateBox(s,e,t)})}setBox(e,t,s=!1,r){const n=this.getBox(e);if(n){const{status:a,zIndex:o,lastNotMinimizedBoxStatus:h}=t;a&&(this.setBoxStatus(n.id,a,s),n.setBoxStatus(a,s),this.effectBoxStatusChange()),o&&n.setZIndex(o,s),h&&(this.setLastNotMinimizedBoxStatus(n.id,h,s),n.setLastNotMinimizedBoxStatus(h,s)),r&&r()}}remove(e,t=!1,s){const r=this.getBox(e),n=this.getBoxIndex(e);if(n>=0){const a=this.boxes.slice(),o=a.splice(n,1);return this.boxes$.setValue(a),o.forEach(h=>h.destroy()),r&&this.useBoxesStatus&&(this.setBoxStatus(r.id,void 0,t),this.setLastNotMinimizedBoxStatus(r.id,void 0,t),this.effectBoxStatusChange(),s&&s()),t||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(O.Removed,o)),o[0]}}removeTopBox(){if(this.topBox)return this.remove(this.topBox)}removeAll(e=!1){const t=this.boxes$.value;return this.boxes$.setValue([]),t.forEach(s=>s.destroy()),this.boxesStatus$.clear(),this.lastNotMinimizedBoxesStatus$.clear(),e||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(O.Removed,t)),t}destroy(e=!1){this.events.removeAllListeners(),this._sideEffect.flushAll(),this.removeAll(e),Object.keys(this).forEach(t=>{const s=this[t];s instanceof et&&s.destroy()})}wrapClassName(e){return`${this.namespace}-${e}`}focusBox(e,t=!1){const s=this.getBox(e);s&&(this.boxes.forEach(r=>{if(s===r){let n=!1;s.focus||(n=!0,s.setFocus(!0,t)),n&&!t&&this.events.emit(O.Focused,s)}else r.focus&&this.blurBox(r,t)}),this.useBoxesStatus?this.useBoxesStatus&&this.maxTitleBar.hasMaximizedBoxInStatus()&&this.makeMaximizedTopBoxFocus():this.maxTitleBar.focusBox(s))}focusTopBox(){if(this.topBox&&!this.topBox.focus)return this.focusBox(this.topBox)}blurBox(e,t=!1){const s=this.getBox(e);s&&(s.focus&&(s.setFocus(!1,t),t||this.events.emit(O.Blurred,s)),this.maxTitleBar.focusedBox===s&&this.maxTitleBar.focusBox())}blurAll(e=!1){this.boxes.forEach(t=>{t.focus&&(t.setFocus(!1,e),e||this.events.emit(O.Blurred,t))}),this.maxTitleBar.focusedBox&&this.maxTitleBar.focusBox()}teleBoxMatcher(e){const t=Object.keys(e);return s=>t.every(r=>e[r]===s[r])}updateBox(e,t,s=!1){(t.x!=null||t.y!=null)&&e.move(t.x==null?e.intrinsicX:t.x,t.y==null?e.intrinsicY:t.y,s),(t.width!=null||t.height!=null)&&e.resize(t.width==null?e.intrinsicWidth:t.width,t.height==null?e.intrinsicHeight:t.height,s),t.title!=null&&(e.setTitle(t.title),this.maxTitleBar.updateTitles()),t.visible!=null&&e.setVisible(t.visible,s),t.minHeight!=null&&e.setMinHeight(t.minHeight,s),t.minWidth!=null&&e.setMinWidth(t.minWidth,s),t.resizable!=null&&e.setResizable(t.resizable,s),t.draggable!=null&&e.setDraggable(t.draggable,s),t.fixRatio!=null&&e.setFixRatio(t.fixRatio,s),t.zIndex!=null&&e.setZIndex(t.zIndex,s),t.content!=null&&e.mountContent(t.content),t.footer!=null&&e.mountFooter(t.footer),this.useBoxesStatus&&(t.boxStatus||t.lastNotMinimizedBoxStatus)&&this.setBox(e,{status:t.boxStatus,lastNotMinimizedBoxStatus:t.lastNotMinimizedBoxStatus},s),t.forceTop!=null&&e.setForceTop(t.forceTop,s),t.forceNormal!=null&&e.setForceNormal(t.forceNormal,s)}smartPosition(e={}){let{x:t,y:s}=e;const{width:r=.5,height:n=.5}=e;if(t==null){let a=20;if(e.forceTop){const o=this.maxForceTopBox||this.topBox;o&&(a=o.intrinsicX*this.containerRect.width+20,a>this.containerRect.width-r*this.containerRect.width&&(a=20))}else this.topBox?(a=this.topBox.intrinsicX*this.containerRect.width+20,a>this.containerRect.width-r*this.containerRect.width&&(a=20)):this.hasMinimizedBox()&&(a=[...this.boxes].filter(o=>o.boxStatus&&o.boxStatus===x.Minimized&&o.lastNotMinimizedBoxStatus&&o.lastNotMinimizedBoxStatus===x.Normal).reduce((o,h)=>Math.max(o,h.intrinsicX*this.containerRect.width+20),a));t=a/this.containerRect.width}if(s==null){let a=20;if(e.forceTop){const o=this.maxForceTopBox||this.topBox;o&&(a=o.intrinsicY*this.containerRect.height+20,a>this.containerRect.height-n*this.containerRect.height&&(a=20))}else this.topBox?(a=this.topBox.intrinsicY*this.containerRect.height+20,a>this.containerRect.height-n*this.containerRect.height&&(a=20)):this.hasMinimizedBox()&&(a=[...this.boxes].filter(o=>o.boxStatus&&o.boxStatus===x.Minimized&&o.lastNotMinimizedBoxStatus&&o.lastNotMinimizedBoxStatus===x.Normal).reduce((o,h)=>Math.max(o,h.intrinsicY*this.containerRect.height+20),a));s=a/this.containerRect.height}return{...e,x:t,y:s,width:r,height:n}}makeBoxTop(e,t=!1){!this.useBoxesStatus&&this.topBox?e!==this.topBox&&e.setZIndex(this.topBox.zIndex+1,t):this.useBoxesStatus}getMaximizedTopBox(){if(!this.useBoxesStatus)return;let e;return this.maxTitleBar.hasMaximizedBoxInStatus()&&(e=this.maxTitleBar.MaximizedBoxes.reduce((t,s)=>t&&t.zIndex>s.zIndex?t:s)),e}makeMaximizedTopBoxFocus(){if(!this.useBoxesStatus)return;const e=this.getMaximizedTopBox();this.maxTitleBar.focusBox(e)}getBoxIndex(e){return typeof e=="string"?this.boxes.findIndex(t=>t.id===e):this.boxes.findIndex(t=>t===e)}getBox(e){return typeof e=="string"?this.boxes.find(t=>t.id===e):e}createMinimizedAppMenu(){var e,t;if((e=this.collector)!=null&&e.$appMenuContainer)return new _a({manager:this,container:(t=this.collector)==null?void 0:t.$appMenuContainer,theme:this.prefersColorScheme?"dark":"light",getBoxesStatus:()=>this.boxesStatus$})}}tt.kind="TeleBoxManager";const Oa=(i,e,t,s,r)=>{const n=ge(it,P.extendClass);return new n({safeSetAttributes:a=>i.safeSetAttributes(a),getMainView:()=>i.mainView,updateAppState:(...a)=>{var o;return(o=i.appManager)==null?void 0:o.store.updateAppState(...a)},setBoxStatus:(a,o)=>{var h;return(h=i.appManager)==null?void 0:h.store.setBoxStatus(a,o)},setLastNotMinimizedBoxStatus:(a,o)=>{var h;return(h=i.appManager)==null?void 0:h.store.setLastNotMinimizedBoxStatus(a,o)},canOperate:()=>i.canOperate,notifyContainerRectUpdate:a=>{var o;return(o=i.appManager)==null?void 0:o.notifyContainerRectUpdate(a)},cleanFocus:()=>{var a;return(a=i.appManager)==null?void 0:a.store.cleanFocus()},setAppFocus:a=>{var o;return(o=i.appManager)==null?void 0:o.store.setAppFocus(a,!0)},callbacks:e,emitter:t,boxEmitter:s},r)};class it{constructor(e,t){this.context=e,this.createTeleBoxManagerConfig=t;const{emitter:s,callbacks:r,boxEmitter:n}=e;this.teleBoxManager=this.setupBoxManager(t),this.teleBoxManager._state$.reaction(a=>{r.emit("boxStateChange",a),s.emit("boxStateChange",a)}),this.teleBoxManager._darkMode$.reaction(a=>{r.emit("darkModeChange",a)}),this.teleBoxManager._prefersColorScheme$.reaction(a=>{r.emit("prefersColorSchemeChange",a)}),this.teleBoxManager._minimized$.reaction(a=>{a||setTimeout(()=>{const o=.001*(Math.random()>.5?1:-1);this.teleBoxManager.boxes.forEach(h=>{h.resize(h.intrinsicWidth+o,h.intrinsicHeight+o,!0)})},400)}),this.teleBoxManager.events.on("minimized",a=>{if(this.context.safeSetAttributes({minimized:a}),a)this.context.cleanFocus(),this.blurAllBox();else{const o=this.getTopBox();o&&(this.context.setAppFocus(o.id),this.focusBox({appId:o.id},!1))}}),this.teleBoxManager.events.on("maximized",a=>{this.context.safeSetAttributes({maximized:a})}),this.teleBoxManager.events.on("removed",a=>{a.forEach(o=>{n.emit("close",{appId:o.id})})}),this.teleBoxManager.events.on("intrinsic_move",w.debounce(a=>{n.emit("move",{appId:a.id,x:a.intrinsicX,y:a.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",w.debounce(a=>{n.emit("resize",{appId:a.id,width:a.intrinsicWidth,height:a.intrinsicHeight})},200)),this.teleBoxManager.events.on("focused",a=>{a&&(this.canOperate?n.emit("focus",{appId:a.id}):this.teleBoxManager.blurBox(a.id))}),this.teleBoxManager.events.on("blurred",a=>{a&&this.canOperate&&n.emit("blurred",{appId:a.id})}),this.teleBoxManager.events.on("z_index",a=>{this.context.updateAppState(a.id,ee.ZIndex,a.zIndex)}),this.teleBoxManager.events.on("box_status",a=>{this.canOperate&&this.context.setBoxStatus(a.id,a.boxStatus)}),this.teleBoxManager.events.on("last_not_minimized_box_status",a=>{this.canOperate&&this.context.setLastNotMinimizedBoxStatus(a.id,a.boxStatus)}),s.on("playgroundSizeChange",()=>this.updateManagerRect()),s.on("updateManagerRect",()=>this.updateManagerRect())}get mainView(){return this.context.getMainView()}get canOperate(){return this.context.canOperate()}get boxState(){return this.teleBoxManager.state}get maximized(){return this.teleBoxManager.maximized}get minimized(){return this.teleBoxManager.minimized}get darkMode(){return this.teleBoxManager.darkMode}get prefersColorScheme(){return this.teleBoxManager.prefersColorScheme}get boxSize(){return this.teleBoxManager.boxes.length}createBox(e){var c,l,u;if(!this.teleBoxManager)return;let{minwidth:t=rr,minheight:s=ar}=(c=e.app.config)!=null?c:{};const{width:r,height:n}=(l=e.app.config)!=null?l:{},a=((u=e.options)==null?void 0:u.title)||e.appId,o=this.teleBoxManager.containerRect;t>1&&(t=t/o.width),s>1&&(s=s/o.height);const h={title:a,minWidth:t,minHeight:s,width:r,height:n,id:e.appId,boxStatus:e.boxStatus,forceTop:e.forceTop,forceNormal:e.forceNormal,isDragContent:e.isDragContent};this.teleBoxManager.create(h,e.smartPosition),this.context.emitter.emit(`${e.appId}${R.WindowCreated}`)}setBoxInitState(e){const t=this.teleBoxManager.queryOne({id:e});t&&t.state===x.Maximized&&this.context.boxEmitter.emit("resize",{appId:e,x:t.x,y:t.y,width:t.intrinsicWidth,height:t.intrinsicHeight})}setBoxesStatus(e){const t=new Map(Object.entries(e!=null?e:{}));this.teleBoxManager.setBoxesStatus(t,!0),this.context.callbacks.emit("onBoxesStatusChange",t),this.context.emitter.emit("boxesStatusChange",t)}setLastNotMinimizedBoxesStatus(e){const t=new Map(Object.entries(e!=null?e:{}));this.teleBoxManager.setLastNotMinimizedBoxesStatus(t,!0),this.context.callbacks.emit("onLastNotMinimizedBoxesStatusChange",t),this.context.emitter.emit("lastNotMinimizedBoxesStatusChange",t)}setupBoxManager(e){const t=P.wrapper?P.wrapper:document.body,s=t.getBoundingClientRect(),r={root:t,containerRect:{x:0,y:0,width:s.width,height:s.height},fence:!1,prefersColorScheme:e==null?void 0:e.prefersColorScheme,useBoxesStatus:(e==null?void 0:e.useBoxesStatus)||!1},n=ge(tt,P.extendClass),a=new n(r);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=a;const o=(e==null?void 0:e.collectorContainer)||P.wrapper;return o&&this.setCollectorContainer(o),a}setCollectorContainer(e){var r;const t=ge(Le,P.extendClass),s=new t({styles:(r=this.createTeleBoxManagerConfig)==null?void 0:r.collectorStyles}).mount(e);this.teleBoxManager.setCollector(s)}getBox(e){return this.teleBoxManager.queryOne({id:e})}closeBox(e,t=!1){return this.teleBoxManager.remove(e,t)}boxIsFocus(e){const t=this.getBox(e);return t==null?void 0:t.focus}getFocusBox(){return this.teleBoxManager.query({focus:!0})[0]}getTopBox(){return this.teleBoxManager.topBox}updateBoxState(e){if(!e)return;const t=this.getBox(e.id);t&&(this.teleBoxManager.update(t.id,{x:e.x,y:e.y,width:e.width||.5,height:e.height||.5,zIndex:e.zIndex,boxStatus:e.boxStatus,lastNotMinimizedBoxStatus:e.lastNotMinimizedBoxStatus,forceTop:e.forceTop,forceNormal:e.forceNormal,isDragContent:e.isDragContent},!0),setTimeout(()=>{e.focus&&this.teleBoxManager.focusBox(t.id,!0),e.maximized!=null&&this.teleBoxManager.setMaximized(Boolean(e.maximized),!0),e.minimized!=null&&this.teleBoxManager.setMinimized(Boolean(e.minimized),!0)},50),e.boxStatus||this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}updateManagerRect(){var t;const e=(t=this.mainView.divElement)==null?void 0:t.getBoundingClientRect();if(e&&e.width>0&&e.height>0){const s={x:0,y:0,width:e.width,height:e.height};this.teleBoxManager.setContainerRect(s),this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect)}}moveBox({appId:e,x:t,y:s}){this.teleBoxManager.update(e,{x:t,y:s},!0)}focusBox({appId:e},t=!0){this.teleBoxManager.focusBox(e,t)}resizeBox({appId:e,width:t,height:s,skipUpdate:r}){this.teleBoxManager.update(e,{width:t,height:s},r)}setBoxMinSize(e){this.teleBoxManager.update(e.appId,{minWidth:e.minWidth,minHeight:e.minHeight},!0)}setBoxTitle(e){this.teleBoxManager.update(e.appId,{title:e.title},!0)}blurAllBox(){this.teleBoxManager.blurAll()}updateAll(e){this.teleBoxManager.updateAll(e)}setMaximized(e,t=!0){e!==this.maximized&&this.teleBoxManager.setMaximized(e,t)}setMinimized(e,t=!0){this.teleBoxManager.setMinimized(e,t)}focusTopBox(){if(this.teleBoxManager.query().length>=1){const t=this.getTopBox();t&&this.focusBox({appId:t.id},!1)}}updateBox(e,t,s=!0){this.teleBoxManager.update(e,t,s)}setReadonly(e){this.teleBoxManager.setReadonly(e)}setPrefersColorScheme(e){this.teleBoxManager.setPrefersColorScheme(e)}setZIndex(e,t,s=!0){this.teleBoxManager.update(e,{zIndex:t},s)}destroy(){this.teleBoxManager.destroy()}}it.kind="BoxManager";function $i(i){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i)?i:JSON.stringify(i)}function Se(i,e){if(i===void 0)return"undefined";if(i===null)return"null";const t=typeof i;if(t==="bigint")return`${i}n`;if(t==="symbol")return String(i);if(t==="function")return`[Function ${i.name||"anonymous"}]`;if(t!=="object")return t==="string"?JSON.stringify(i):String(i);const s=i;if(e!=null&&e.has(s))return"[Circular]";const r=e!=null?e:new WeakSet;r.add(s);try{return Array.isArray(i)?`[${Array.from(i,o=>Se(o,r)).join(",")}]`:i instanceof Date?JSON.stringify(i.toISOString()):i instanceof RegExp?String(i):`{${Object.keys(s).map(o=>{let h;try{h=s[o]}catch{return`${$i(o)}:[Threw]`}return`${$i(o)}:${Se(h,r)}`}).join(",")}}`}catch{return"[Unserializable]"}finally{r.delete(s)}}function Wa(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp)}const Zi=1500;function $a(i){if(i.length<=Zi)return i;const e="\u2026";return i.slice(0,Zi-e.length)+e}function Za(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==e[t])return!1;return!0}const re=(...i)=>{P.debug&&console.log("[WindowManager]:",...i)};class We{constructor(e,t){this.name=e,this.debounceTime=t,this.pendingArgs=null,this.flushTimer=null}flush(){this.flushTimer=null;const e=this.pendingArgs;this.pendingArgs=null,e!==null&&console.log(`[window-manager][${this.name}]: ${e.join(", ")}`)}log(...e){const t=this.debounceTime;if(t!=null&&t>0){this.pendingArgs=e,this.flushTimer!=null&&clearTimeout(this.flushTimer),this.flushTimer=setTimeout(()=>this.flush(),t);return}console.log(`[window-manager][${this.name}]: ${e.join(", ")}`)}destroy(){this.flushTimer!=null&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.pendingArgs=null}}class Fa{constructor(e,t,s){this.logger=e,this.name=t,this.debounceTime=s,this.pendingArgs=null,this.flushTimer=null,this.pendingShallowMerge=null,this.shallowMergeTimer=null,this.pendingUpdateSegments=null,this.updateMergeTimer=null}emitInfo(e){this.logger.info($a(e))}flush(){this.flushTimer=null;const e=this.pendingArgs;this.pendingArgs=null,e!==null&&this.emitInfo(`[WindowManager][${this.name}]: ${e.join(", ")}`)}flushShallowMerge(){this.shallowMergeTimer=null;const e=this.pendingShallowMerge;if(this.pendingShallowMerge=null,e===null)return;const t=e.kind==="record"?Se(e.data):Se(e.value);if(this.emitInfo(`[WindowManager][${this.name}]: ${e.label} ${t}`),e.kind==="record")for(const s of Object.keys(e.data))delete e.data[s]}log(...e){const t=this.debounceTime;if(t!=null&&t>0){this.pendingArgs=e,this.flushTimer!=null&&clearTimeout(this.flushTimer),this.flushTimer=setTimeout(()=>this.flush(),t);return}this.emitInfo(`[WindowManager][${this.name}]: ${e.join(", ")}`)}logDebouncedShallowMerge(e,t){var a;const s=this.debounceTime,r=s!=null&&s>0,n=o=>{this.emitInfo(`[WindowManager][${this.name}]: ${e} ${o}`)};if(!r){n(Se(t));return}this.shallowMergeTimer!=null&&(clearTimeout(this.shallowMergeTimer),this.shallowMergeTimer=null),Wa(t)?((a=this.pendingShallowMerge)==null?void 0:a.kind)==="record"?this.pendingShallowMerge={kind:"record",label:e,data:{...this.pendingShallowMerge.data,...t}}:this.pendingShallowMerge={kind:"record",label:e,data:{...t}}:this.pendingShallowMerge={kind:"atom",label:e,value:t},this.shallowMergeTimer=setTimeout(()=>this.flushShallowMerge(),s)}flushUpdateAttributesMerge(){this.updateMergeTimer=null;const e=this.pendingUpdateSegments;if(this.pendingUpdateSegments=null,e===null||e.length===0)return;const t=e.map(s=>`${s.keys.join(", ")} ${Se(s.value)}`);this.emitInfo(`[WindowManager][${this.name}]: safeUpdateAttributes ${t.join(" | ")}`);for(const s of e)s.keys.length=0,s.value=void 0;e.length=0}logDebouncedUpdateAttributes(e,t){const s=this.debounceTime,r=s!=null&&s>0,n=[...e];if(!r){this.emitInfo(`[WindowManager][${this.name}]: safeUpdateAttributes ${n.join(", ")} ${Se(t)}`);return}if(this.updateMergeTimer!=null&&(clearTimeout(this.updateMergeTimer),this.updateMergeTimer=null),this.pendingUpdateSegments===null||this.pendingUpdateSegments.length===0)this.pendingUpdateSegments=[{keys:n,value:t}];else{const a=this.pendingUpdateSegments[this.pendingUpdateSegments.length-1];Za(a.keys,n)?a.value=t:this.pendingUpdateSegments.push({keys:n,value:t})}this.updateMergeTimer=setTimeout(()=>this.flushUpdateAttributesMerge(),s)}destroy(){this.flushTimer!=null&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.shallowMergeTimer!=null&&(clearTimeout(this.shallowMergeTimer),this.shallowMergeTimer=null),this.updateMergeTimer!=null&&(clearTimeout(this.updateMergeTimer),this.updateMergeTimer=null),this.pendingArgs=null,this.pendingShallowMerge=null,this.pendingUpdateSegments=null}dispose(){this.destroy()}}const Ga=i=>{const e=document.createElement("div");e.className="netless-window-manager-playground";const t=document.createElement("div");t.className="netless-window-manager-sizer";const s=document.createElement("div");s.className="netless-window-manager-wrapper";const r=document.createElement("div");return r.className="netless-window-manager-main-view",e.appendChild(t),t.appendChild(s),s.appendChild(r),i.appendChild(e),P.wrapper=s,{playground:e,wrapper:s,sizer:t,mainViewElement:r}},Qa=()=>{if(Di(f.WhiteVersion)<Di(Bi))throw new os(Bi)},si=(i,e)=>{var n;const t=(i==null?void 0:i.state.roomMembers)||[];let s=-1,r;for(const a of t)((n=a.payload)==null?void 0:n.uid)===e&&s<a.memberId&&(s=a.memberId,r=a);return r},Ya=async i=>{let e=i.getInvisiblePlugin(P.kind);if(e)return e;let t;const s=new Promise(c=>{P._resolve=t=c});let r=!1;const n=Ha(i);!i.isWritable&&n&&(r=!0,await ts.default(async c=>{re(`switching to writable (x${c})`),await i.setWritable(!0)},{retries:10,maxTimeout:5e3})),i.isWritable?(re("creating InvisiblePlugin..."),i.createInvisiblePlugin(P,{}).catch(console.warn)):(n&&console.warn("[WindowManager]: failed to switch to writable"),console.warn("[WindowManager]: waiting for others to create the plugin..."));const a=setTimeout(()=>{console.warn("[WindowManager]: no one called createInvisiblePlugin() after 20 seconds")},2e4),o=setTimeout(()=>{throw new Error("[WindowManager]: no one called createInvisiblePlugin() after 60 seconds")},6e4),h=setInterval(()=>{e=i.getInvisiblePlugin(P.kind),e&&(clearTimeout(o),clearTimeout(a),clearInterval(h),t(e),r&&i.isWritable&&setTimeout(()=>i.setWritable(!1).catch(console.warn),500))},200);return s},Ha=i=>{try{const e=atob(i.roomToken.slice(12)),t=e.indexOf("&role=");return+e[t+6]<2}catch(e){return console.error(e),!1}};function Xe(){}function Vs(i){return i()}function Fi(){return Object.create(null)}function It(i){i.forEach(Vs)}function js(i){return typeof i=="function"}function Ja(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}let pt;function St(i,e){return pt||(pt=document.createElement("a")),pt.href=e,i===pt.href}function Xa(i){return Object.keys(i).length===0}function ue(i,e){i.appendChild(e)}function yt(i,e,t){i.insertBefore(e,t||null)}function st(i){i.parentNode&&i.parentNode.removeChild(i)}function fe(i){return document.createElement(i)}function Mi(i){return document.createTextNode(i)}function ri(){return Mi(" ")}function U(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function Ka(i){return Array.from(i.childNodes)}function Rs(i,e){e=""+e,i.data!==e&&(i.data=e)}function G(i,e,t,s){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,s?"important":"")}let wi;function Ye(i){wi=i}const Ne=[],Gi=[];let Te=[];const Qi=[],qa=Promise.resolve();let ai=!1;function en(){ai||(ai=!0,qa.then(ks))}function ni(i){Te.push(i)}const $t=new Set;let Ae=0;function ks(){if(Ae!==0)return;const i=wi;do{try{for(;Ae<Ne.length;){const e=Ne[Ae];Ae++,Ye(e),tn(e.$$)}}catch(e){throw Ne.length=0,Ae=0,e}for(Ye(null),Ne.length=0,Ae=0;Gi.length;)Gi.pop()();for(let e=0;e<Te.length;e+=1){const t=Te[e];$t.has(t)||($t.add(t),t())}Te.length=0}while(Ne.length);for(;Qi.length;)Qi.pop()();ai=!1,$t.clear(),Ye(i)}function tn(i){if(i.fragment!==null){i.update(),It(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(ni)}}function sn(i){const e=[],t=[];Te.forEach(s=>i.indexOf(s)===-1?e.push(s):t.push(s)),t.forEach(s=>s()),Te=e}const rn=new Set;function an(i,e){i&&i.i&&(rn.delete(i),i.i(e))}function nn(i,e,t,s){const{fragment:r,after_update:n}=i.$$;r&&r.m(e,t),s||ni(()=>{const a=i.$$.on_mount.map(Vs).filter(js);i.$$.on_destroy?i.$$.on_destroy.push(...a):It(a),i.$$.on_mount=[]}),n.forEach(ni)}function on(i,e){const t=i.$$;t.fragment!==null&&(sn(t.after_update),It(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function hn(i,e){i.$$.dirty[0]===-1&&(Ne.push(i),en(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function cn(i,e,t,s,r,n,a,o=[-1]){const h=wi;Ye(i);const c=i.$$={fragment:null,ctx:[],props:n,update:Xe,not_equal:r,bound:Fi(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(h?h.$$.context:[])),callbacks:Fi(),dirty:o,skip_bound:!1,root:e.target||h.$$.root};a&&a(c.root);let l=!1;if(c.ctx=t?t(i,e.props||{},(u,d,...m)=>{const g=m.length?m[0]:d;return c.ctx&&r(c.ctx[u],c.ctx[u]=g)&&(!c.skip_bound&&c.bound[u]&&c.bound[u](g),l&&hn(i,u)),d}):[],c.update(),l=!0,It(c.before_update),c.fragment=s?s(c.ctx):!1,e.target){if(e.hydrate){const u=Ka(e.target);c.fragment&&c.fragment.l(u),u.forEach(st)}else c.fragment&&c.fragment.c();e.intro&&an(i.$$.fragment),nn(i,e.target,e.anchor,e.customElement),ks()}Ye(h)}class ln{$destroy(){on(this,1),this.$destroy=Xe}$on(e,t){if(!js(t))return Xe;const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(t),()=>{const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Xa(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function Yi(i){let e,t,s,r,n,a,o,h=i[18]&&Hi(i),c=i[19]&&Ji(i);return{c(){e=fe("div"),t=fe("div"),h&&h.c(),s=ri(),r=fe("span"),n=Mi(i[1]),a=ri(),c&&c.c(),G(r,"overflow","hidden"),G(r,"white-space","nowrap"),G(r,"text-overflow","ellipsis"),G(r,"max-width","80px"),U(t,"class",i[9]),G(t,"background-color",i[3]),G(t,"color",i[10]),G(t,"opacity",i[12]),U(e,"class",o="netless-window-manager-cursor-name "+i[16]+" "+i[15])},m(l,u){yt(l,e,u),ue(e,t),h&&h.m(t,null),ue(t,s),ue(t,r),ue(r,n),ue(t,a),c&&c.m(t,null)},p(l,u){l[18]?h?h.p(l,u):(h=Hi(l),h.c(),h.m(t,s)):h&&(h.d(1),h=null),u&2&&Rs(n,l[1]),l[19]?c?c.p(l,u):(c=Ji(l),c.c(),c.m(t,null)):c&&(c.d(1),c=null),u&512&&U(t,"class",l[9]),u&8&&G(t,"background-color",l[3]),u&1024&&G(t,"color",l[10]),u&4096&&G(t,"opacity",l[12]),u&98304&&o!==(o="netless-window-manager-cursor-name "+l[16]+" "+l[15])&&U(e,"class",o)},d(l){l&&st(e),h&&h.d(),c&&c.d()}}}function Hi(i){let e,t;return{c(){e=fe("img"),U(e,"class","netless-window-manager-cursor-selector-avatar"),U(e,"style",i[20]()),St(e.src,t=i[8])||U(e,"src",t),U(e,"alt","avatar")},m(s,r){yt(s,e,r)},p(s,r){r&256&&!St(e.src,t=s[8])&&U(e,"src",t)},d(s){s&&st(e)}}}function Ji(i){let e,t;return{c(){e=fe("span"),t=Mi(i[2]),U(e,"class","netless-window-manager-cursor-tag-name"),G(e,"background-color",i[11])},m(s,r){yt(s,e,r),ue(e,t)},p(s,r){r&4&&Rs(t,s[2]),r&2048&&G(e,"background-color",s[11])},d(s){s&&st(e)}}}function un(i){let e,t,s,r,n,a,o,h=!i[14]&&Yi(i);return{c(){e=fe("div"),h&&h.c(),t=ri(),s=fe("div"),r=fe("img"),U(r,"class",n="netless-window-manager-cursor-"+i[4]+"-image "+i[15]),St(r.src,a=i[7])||U(r,"src",a),U(r,"alt",i[4]),U(s,"class","cursor-image-wrapper"),U(e,"class",o="netless-window-manager-cursor-mid"+(i[13]?" netless-window-manager-cursor-custom":"")),G(e,"transform","translateX("+i[5]+"px) translateY("+i[6]+"px)"),G(e,"display",i[17]),U(e,"data-cursor-uid",i[0])},m(c,l){yt(c,e,l),h&&h.m(e,null),ue(e,t),ue(e,s),ue(s,r)},p(c,[l]){c[14]?h&&(h.d(1),h=null):h?h.p(c,l):(h=Yi(c),h.c(),h.m(e,t)),l&32784&&n!==(n="netless-window-manager-cursor-"+c[4]+"-image "+c[15])&&U(r,"class",n),l&128&&!St(r.src,a=c[7])&&U(r,"src",a),l&16&&U(r,"alt",c[4]),l&8192&&o!==(o="netless-window-manager-cursor-mid"+(c[13]?" netless-window-manager-cursor-custom":""))&&U(e,"class",o),l&96&&G(e,"transform","translateX("+c[5]+"px) translateY("+c[6]+"px)"),l&131072&&G(e,"display",c[17]),l&1&&U(e,"data-cursor-uid",c[0])},i:Xe,o:Xe,d(c){c&&st(e),h&&h.d()}}}function dn(i,e,t){let s,r,n,a,o,h,c,l,{uid:u}=e,{cursorName:d}=e,{tagName:m}=e,{backgroundColor:g}=e,{appliance:b}=e,{x:M}=e,{y:N}=e,{src:z}=e,{visible:v}=e,{avatar:Z}=e,{theme:_}=e,{color:W}=e,{cursorTagBackgroundColor:ie}=e,{opacity:Ie}=e,{pencilEraserSize:pe}=e,{custom:Ve}=e;const S=()=>Object.entries({width:(s?19:28)+"px",height:(s?19:28)+"px",position:s?"initial":"absolute","border-color":s?"white":g,"margin-right":(s?4:0)+"px"}).map(([p,B])=>`${p}: ${B}`).join(";");return i.$$set=p=>{"uid"in p&&t(0,u=p.uid),"cursorName"in p&&t(1,d=p.cursorName),"tagName"in p&&t(2,m=p.tagName),"backgroundColor"in p&&t(3,g=p.backgroundColor),"appliance"in p&&t(4,b=p.appliance),"x"in p&&t(5,M=p.x),"y"in p&&t(6,N=p.y),"src"in p&&t(7,z=p.src),"visible"in p&&t(21,v=p.visible),"avatar"in p&&t(8,Z=p.avatar),"theme"in p&&t(9,_=p.theme),"color"in p&&t(10,W=p.color),"cursorTagBackgroundColor"in p&&t(11,ie=p.cursorTagBackgroundColor),"opacity"in p&&t(12,Ie=p.opacity),"pencilEraserSize"in p&&t(22,pe=p.pencilEraserSize),"custom"in p&&t(13,Ve=p.custom)},i.$$.update=()=>{i.$$.dirty&2&&(s=!w.isEmpty(d)),i.$$.dirty&4&&t(19,r=!w.isEmpty(m)),i.$$.dirty&256&&t(18,n=!w.isEmpty(Z)),i.$$.dirty&2097152&&t(17,a=v?"":"none"),i.$$.dirty&16&&t(14,o=b===f.ApplianceNames.laserPointer),i.$$.dirty&16400&&t(23,h=o||b===f.ApplianceNames.pencilEraser),i.$$.dirty&8388608&&t(16,c=h?"netless-window-manager-laserPointer-pencilEraser-offset":""),i.$$.dirty&4194304&&t(15,l=pe===3?"netless-window-manager-pencilEraser-3-offset":"")},[u,d,m,g,b,M,N,z,Z,_,W,ie,Ie,Ve,o,l,c,a,n,r,S,v,pe,h]}class gn extends ln{constructor(e){super(),cn(this,e,dn,un,Ja,{uid:0,cursorName:1,tagName:2,backgroundColor:3,appliance:4,x:5,y:6,src:7,visible:21,avatar:8,theme:9,color:10,cursorTagBackgroundColor:11,opacity:12,pencilEraserSize:22,custom:13})}}const Us="data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='12' cy='12' r='2.5' stroke='%23000' stroke-linejoin='square'/%3E%3Ccircle cx='12' cy='12' r='3.5' stroke='%23FFF'/%3E%3C/g%3E%3C/svg%3E";function _s(i){return`data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='12' cy='12' r='2.5' stroke='%23${i}' stroke-linejoin='square'/%3E%3Ccircle cx='12' cy='12' r='3.5' stroke='%23${i}'/%3E%3C/g%3E%3C/svg%3E`}function ze(i){return`data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg' fill='none'%3E%3Cpath d='M5 12H19' stroke='%23${i}' stroke-linejoin='round'/%3E%3Cpath d='M12 5V19' stroke='%23${i}' stroke-linejoin='round'/%3E%3C/svg%3E`}function xe(i){return`url("${i}") 12 12, auto`}function pn(i){let e="";for(const t in i)e+=`.netless-whiteboard.${t} {cursor: ${i[t]}}
|
|
16
|
+
`;return e}const mt=document.createElement("style");function mn(i){const[e,t,s]=i.strokeColor,r=((1<<24)+(e<<16)+(t<<8)+s).toString(16).slice(1);return mt.textContent=pn({"cursor-pencil":xe(_s(r)),"cursor-eraser":xe(Us),"cursor-rectangle":xe(ze(r)),"cursor-ellipse":xe(ze(r)),"cursor-straight":xe(ze(r)),"cursor-arrow":xe(ze(r)),"cursor-shape":xe(ze(r))}),document.head.appendChild(mt),()=>{mt.parentNode!=null&&document.head.removeChild(mt)}}const fn=new Set([f.ApplianceNames.rectangle,f.ApplianceNames.ellipse,f.ApplianceNames.straight,f.ApplianceNames.arrow,f.ApplianceNames.shape]);function Xi(i,e){if(i===f.ApplianceNames.pencil)return _s(e);if(i===f.ApplianceNames.eraser)return Us;if(fn.has(i))return ze(e)}class Mn{constructor(e,t,s,r){this.manager=e,this.memberId=t,this.cursorManager=s,this.wrapper=r,this.style="default",this.move=n=>{var a;if(n.type==="main"){const o=this.cursorManager.wrapperRect;this.component&&o&&(this.autoHidden(),this.moveCursor(n,o,this.manager.mainView))}else{const o=this.cursorManager.focusView,h=(a=o==null?void 0:o.divElement)==null?void 0:a.getBoundingClientRect(),c=o==null?void 0:o.camera;o&&h&&c&&this.component&&(this.autoHidden(),this.moveCursor(n,h,o))}},this.setStyle=n=>{this.style=n,this.component&&this.component.$set({src:this.getIcon(),custom:this.isCustomIcon()})},this.leave=()=>{this.hide()},this.updateMember(),this.createCursor(),this.autoHidden(),this.setStyle(s.style)}moveCursor(e,t,s){var h,c;const{x:r,y:n,type:a}=e,o=s==null?void 0:s.screen.convertPointToScreen(r,n);if(o){let l=o.x-2,u=o.y-18;if(this.isCustomIcon()&&(l-=11,u+=4),a==="app"){const d=this.cursorManager.wrapperRect;d&&(l=l+t.x-d.x,u=u+t.y-d.y)}o.x<0||o.x>t.width||o.y<0||o.y>t.height?(h=this.component)==null||h.$set({visible:!1,x:l,y:u}):(c=this.component)==null||c.$set({visible:!0,x:l,y:u})}}get memberApplianceName(){var e,t;return(t=(e=this.member)==null?void 0:e.memberState)==null?void 0:t.currentApplianceName}get memberColor(){var t,s;return`rgb(${(s=(t=this.member)==null?void 0:t.memberState)==null?void 0:s.strokeColor.join(",")})`}get memberColorHex(){var r,n;const[e,t,s]=((n=(r=this.member)==null?void 0:r.memberState)==null?void 0:n.strokeColor)||[236,52,85];return((1<<24)+(e<<16)+(t<<8)+s).toString(16).slice(1)}get payload(){var e;return(e=this.member)==null?void 0:e.payload}get memberCursorName(){var e,t;return((e=this.payload)==null?void 0:e.nickName)||((t=this.payload)==null?void 0:t.cursorName)||this.memberId}get memberTheme(){var e;return(e=this.payload)!=null&&e.theme?"netless-window-manager-cursor-inner-mellow":"netless-window-manager-cursor-inner"}get memberCursorTextColor(){var e;return((e=this.payload)==null?void 0:e.cursorTextColor)||"#FFFFFF"}get memberCursorTagBackgroundColor(){var e;return((e=this.payload)==null?void 0:e.cursorTagBackgroundColor)||this.memberColor}get memberAvatar(){var e;return(e=this.payload)==null?void 0:e.avatar}get memberOpacity(){return!this.memberCursorName&&!this.memberAvatar?0:1}get memberTagName(){var e;return(e=this.payload)==null?void 0:e.cursorTagName}autoHidden(){this.timer&&clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.hide()},1e3*10)}async createCursor(){this.member&&this.wrapper&&(this.component=new gn({target:this.wrapper,props:this.initProps()}))}initProps(){var e;return{uid:this.memberId,x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),custom:this.isCustomIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName,pencilEraserSize:(e=this.member)==null?void 0:e.memberState.pencilEraserSize}}getIcon(){var h;if(!this.member)return;const{memberApplianceName:e,memberColorHex:t}=this,{userApplianceIcons:s,applianceIcons:r}=this.cursorManager;let n=this.memberApplianceName;n===f.ApplianceNames.pencilEraser&&(n=`${n}${((h=this.member)==null?void 0:h.memberState.pencilEraserSize)||1}`);const a=n&&s[n];if(a)return a;if(this.style==="custom"&&e){const c=Xi(e,t);if(c)return c}return r[n||f.ApplianceNames.shape]||r[f.ApplianceNames.shape]}isCustomIcon(){var a;if(!this.member)return!1;const{memberApplianceName:e,memberColorHex:t}=this,{userApplianceIcons:s}=this.cursorManager;let r=this.memberApplianceName;return r===f.ApplianceNames.pencilEraser&&(r=`${r}${((a=this.member)==null?void 0:a.memberState.pencilEraserSize)||1}`),r&&s[r]?!1:!!(this.style==="custom"&&e&&Xi(e,t))}updateMember(){return this.member=si(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var e;(e=this.component)==null||e.$set(w.omit(this.initProps(),["x","y"]))}destroy(){this.component&&this.component.$destroy(),this.cursorManager.cursorInstances.delete(this.memberId),this.timer&&clearTimeout(this.timer)}hide(){this.component&&(this.component.$set({visible:!1}),this.destroy())}}var wn="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==",xn="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==",Sn="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=",bn="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",vn="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",In="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",yn="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMjYiIHZpZXdCb3g9IjAgMCAxOCAyNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIxNyIgaGVpZ2h0PSIyNSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",Cn="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMzQiIHZpZXdCb3g9IjAgMCAyNiAzNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIyNSIgaGVpZ2h0PSIzMyIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",An="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iNTAiIHZpZXdCb3g9IjAgMCAzNCA1MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIzMyIgaGVpZ2h0PSI0OSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K";const Bn={[f.ApplianceNames.pencil]:wn,[f.ApplianceNames.selector]:xn,[f.ApplianceNames.eraser]:Sn,[f.ApplianceNames.shape]:bn,[f.ApplianceNames.text]:vn,[f.ApplianceNames.laserPointer]:In,pencilEraser1:yn,pencilEraser2:Cn,pencilEraser3:An},Ki="local-cursor";class rt{constructor(e,t,s,r){var o;this.manager=e,this.enableCursor=t,this.cursorInstances=new Map,this.userApplianceIcons={},this.sideEffectManager=new Ke,this.store=this.manager.store,this.leaveFlag=!0,this._style="default",this.onCursorMove=h=>{const c=this.initCursorInstance(h.uid);if(h.state===Yt.Leave)c.leave();else{const l=c.updateMember();this.canMoveCursor(l)&&c.move(h.position)}},this.initCursorInstance=h=>{let c=this.cursorInstances.get(h);return c||(c=new Mn(this.manager,h,this,P.wrapper),this.cursorInstances.set(h,c)),c},this.mouseMoveListener_=(h,c)=>{const l=this.getType(h);this.updateCursor(l,h.clientX,h.clientY),c&&this.showPencilEraserIfNeeded(l,h.clientX,h.clientY)},this.mouseMoveTimer=0,this.mouseMoveListener=h=>{const c=h.pointerType==="touch";if(c&&!h.isPrimary)return;const l=Date.now();if(l-this.mouseMoveTimer>48){if(this.mouseMoveTimer=l,P.supportAppliancePlugin&&f.isRoom(P.displayer)&&P.displayer.disableDeviceInputs){this.leaveFlag&&(this.manager.dispatchInternalEvent(R.CursorMove,{uid:this.manager.uid,state:Yt.Leave}),this.leaveFlag=!1);return}this.mouseMoveListener_(h,c),this.leaveFlag=!0}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.getPoint=(h,c,l)=>{var d;const u=(d=h==null?void 0:h.divElement)==null?void 0:d.getBoundingClientRect();if(u)return h==null?void 0:h.convertToPointInWorld({x:c-u.x,y:l-u.y})},this.getType=h=>{var u;const c=h.target,l=this.manager.focusApp;switch(c.parentElement){case this.mainViewElement:return{type:"main"};case((u=l==null?void 0:l.view)==null?void 0:u.divElement):return{type:"app"};default:return{type:"main"}}},this.roomMembers=(o=this.manager.room)==null?void 0:o.state.roomMembers;const n=P.wrapper;n&&this.setupWrapper(n),this.sideEffectManager.add(()=>A.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>A.on("playgroundSizeChange",()=>this.updateContainerRect()));const a=this.manager.room;a&&this.sideEffectManager.add(()=>{const h=c=>{this.style==="custom"&&c.memberState&&this.enableCustomCursor()};return a.callbacks.on("onRoomStateChanged",h),()=>a.callbacks.off("onRoomStateChanged",h)}),r&&(this.userApplianceIcons=r),this.style=(s==null?void 0:s.style)||"default"}get applianceIcons(){return{...Bn,...this.userApplianceIcons}}get style(){return this._style}set style(e){this._style!==e&&(this._style=e,this.cursorInstances.forEach(t=>{t.setStyle(e)}),e==="custom"?this.enableCustomCursor():this.sideEffectManager.flush(Ki))}enableCustomCursor(){this.sideEffectManager.add(()=>mn(this.manager.getMemberState()),Ki)}canMoveCursor(e){const t=(e==null?void 0:e.memberState.currentApplianceName)===f.ApplianceNames.laserPointer;return this.enableCursor||t}setupWrapper(e){this.sideEffectManager.add(()=>(e.addEventListener("pointerenter",this.mouseMoveListener),e.addEventListener("pointermove",this.mouseMoveListener),e.addEventListener("pointerleave",this.mouseLeaveListener),()=>{e.removeEventListener("pointerenter",this.mouseMoveListener),e.removeEventListener("pointermove",this.mouseMoveListener),e.removeEventListener("pointerleave",this.mouseLeaveListener)})),this.wrapperRect=e.getBoundingClientRect()}setMainViewDivElement(e){this.mainViewElement=e}get boxState(){return this.store.getBoxState()}get focusView(){var e;return(e=this.manager.focusApp)==null?void 0:e.view}showPencilEraserIfNeeded(e,t,s){const r=si(this.manager.room,this.manager.uid),n=(r==null?void 0:r.memberState.currentApplianceName)===f.ApplianceNames.pencilEraser;if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)&&n){const a=e.type==="main"?this.manager.mainView:this.focusView,o=this.getPoint(a,t,s);o&&this.onCursorMove({uid:this.manager.uid,position:{x:o.x,y:o.y,type:e.type}})}}updateCursor(e,t,s){const r=si(this.manager.room,this.manager.uid);if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)){const n=e.type==="main"?this.manager.mainView:this.focusView,a=this.getPoint(n,t,s);a&&this.manager.dispatchInternalEvent(R.CursorMove,{uid:this.manager.uid,position:{x:a.x,y:a.y,type:e.type}})}}updateContainerRect(){var e,t;this.containerRect=(e=P.container)==null?void 0:e.getBoundingClientRect(),this.wrapperRect=(t=P.wrapper)==null?void 0:t.getBoundingClientRect()}deleteCursor(e){this.store.cleanCursor(e);const t=this.cursorInstances.get(e);t&&t.destroy()}hideCursor(e){const t=this.cursorInstances.get(e);t&&t.hide()}destroy(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach(e=>{e.destroy()}),this.cursorInstances.clear())}}rt.kind="CursorManager";function ge(i,e){if(i.kind&&e&&Object.keys(e).includes(i.kind))switch(i.kind){case"AppManager":return(e==null?void 0:e.AppManager)||ot;case"BoxManager":return(e==null?void 0:e.BoxManager)||it;case"AttributesDelegate":return(e==null?void 0:e.AttributesDelegate)||at;case"CursorManager":return(e==null?void 0:e.CursorManager)||rt;case"AppProxy":return(e==null?void 0:e.AppProxy)||nt;case"AppContext":return(e==null?void 0:e.AppContext)||qe;case"TeleBoxManager":return(e==null?void 0:e.TeleBoxManager)||tt;case"TeleBoxCollector":return(e==null?void 0:e.TeleBoxCollector)||Le;default:return i}return i}var Q=(i=>(i.Apps="apps",i.Focus="focus",i.State="state",i.BoxState="boxState",i.MainViewCamera="mainViewCamera",i.MainViewSize="mainViewSize",i.Broadcaster="broadcaster",i.Cursors="cursors",i.Position="position",i.CursorState="cursorState",i.FullPath="fullPath",i.Registered="registered",i.IframeBridge="iframeBridge",i.BoxesStatus="boxesStatus",i.LastNotMinimizedBoxesStatus="lastNotMinimizedBoxesStatus",i))(Q||{});class at{constructor(e){this.context=e,this.setAppFocus=(t,s)=>{s?this.context.safeSetAttributes({focus:t}):this.context.safeSetAttributes({focus:void 0})}}setContext(e){this.context=e}get attributes(){return this.context.getAttributes()}apps(){return w.get(this.attributes,["apps"])}get focus(){return w.get(this.attributes,["focus"])}getAppAttributes(e){return w.get(this.apps(),[e])}getAppState(e){return w.get(this.apps(),[e,"state"])}getMaximized(){return w.get(this.attributes,["maximized"])}getMinimized(){return w.get(this.attributes,["minimized"])}getBoxesStatus(){return w.get(this.attributes,["boxesStatus"])}getBoxStatus(e){return w.get(this.attributes,["boxesStatus",e])}setBoxStatus(e,t){this.attributes.boxesStatus||this.context.safeSetAttributes({boxesStatus:{}}),this.getBoxStatus(e)!==t&&this.context.safeUpdateAttributes(["boxesStatus",e],t)}getLastNotMinimizedBoxesStatus(){return w.get(this.attributes,["lastNotMinimizedBoxesStatus"])}getLastNotMinimizedBoxStatus(e){return w.get(this.attributes,["lastNotMinimizedBoxesStatus",e])}setLastNotMinimizedBoxStatus(e,t){this.attributes.lastNotMinimizedBoxesStatus||this.context.safeSetAttributes({lastNotMinimizedBoxesStatus:{}}),this.getLastNotMinimizedBoxStatus(e)!==t&&this.context.safeUpdateAttributes(["lastNotMinimizedBoxesStatus",e],t)}setupAppAttributes(e,t,s){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const n=["scenePath","title"];s||n.push("scenes");const a=w.pick(e.options,n),o={kind:e.kind,options:a,isDynamicPPT:s,forceTop:e.forceTop,forceNormal:e.forceNormal,isDragContent:e.isDragContent};typeof e.src=="string"&&(o.src=e.src),o.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",t],o),this.context.safeUpdateAttributes(["apps",t,"state"],{[ee.Size]:{},[ee.Position]:{},[ee.SceneIndex]:0})}updateAppState(e,t,s){w.get(this.attributes,["apps",e,"state"])&&this.context.safeUpdateAttributes(["apps",e,"state",t],s)}cleanAppAttributes(e){this.context.safeUpdateAttributes(["apps",e],void 0),this.context.safeSetAttributes({[e]:void 0}),this.attributes.focus===e&&this.cleanFocus()}cleanFocus(){this.context.safeSetAttributes({focus:void 0})}getAppSceneIndex(e){var t;return(t=this.getAppState(e))==null?void 0:t[ee.SceneIndex]}getAppScenePath(e){var t,s;return(s=(t=this.getAppAttributes(e))==null?void 0:t.options)==null?void 0:s.scenePath}getMainViewScenePath(){return this.attributes._mainScenePath}getMainViewSceneIndex(){return this.attributes._mainSceneIndex}getBoxState(){return this.attributes.boxState}setMainViewScenePath(e){this.context.safeSetAttributes({_mainScenePath:e})}setMainViewSceneIndex(e){this.context.safeSetAttributes({_mainSceneIndex:e})}getMainViewCamera(){return w.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return w.get(this.attributes,["mainViewSize"])}setMainViewCamera(e){this.context.safeSetAttributes({mainViewCamera:{...e}})}setMainViewSize(e){e.width===0||e.height===0||this.context.safeSetAttributes({mainViewSize:{...e}})}setMainViewCameraAndSize(e,t){t.width===0||t.height===0||this.context.safeSetAttributes({mainViewCamera:{...e},mainViewSize:{...t}})}updateCursor(e,t){w.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),w.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],t)}updateCursorState(e,t){w.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],t)}getCursorState(e){return w.get(this.attributes,["cursors",e,"cursorState"])}cleanCursor(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}setMainViewFocusPath(e){const t=this.getMainViewScenePath();t&&be(e,t)}getIframeBridge(){return w.get(this.attributes,["iframeBridge"])}setIframeBridge(e){if(w.isObject(e)){const t=this.getIframeBridge();for(const s in e){const r=e[s];t[s]!==r&&this.context.safeUpdateAttributes(["iframeBridge",s],r)}}}}at.kind="AttributesDelegate";const Nn=(i,e={getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}})=>{const t=ge(at,i);return new t(e)},xi=(i,e)=>{let t=0;const s=e.length-1;return i===e.index?i===s?t=i-1:t=e.index+1:t=e.index,t},ce=new ve.default,Os=class{constructor(i,e,t,s){var r;this.params=i,this.manager=e,this.boxManager=this.manager.boxManager,this.appProxies=this.manager.appProxies,this.viewManager=this.manager.viewManager,this.store=this.manager.store,this.status="normal",this.getAppInitState=n=>{var Z,_,W,ie;const a=this.store.getAppState(n);if(!a)return;const o=a==null?void 0:a[ee.Position],h=this.store.focus,c=a==null?void 0:a[ee.Size],l=a==null?void 0:a[ee.SceneIndex],u=(Z=this.attributes)==null?void 0:Z.maximized,d=(_=this.attributes)==null?void 0:_.minimized,m=(W=this.store.getBoxStatus(n))!=null?W:void 0,g=(ie=this.store.getLastNotMinimizedBoxStatus(n))!=null?ie:void 0,{forceTop:b,forceNormal:M,isDragContent:N}=this.store.getAppAttributes(n),z=a==null?void 0:a.zIndex;let v={maximized:u,minimized:d,zIndex:z};return o&&(v={...v,id:n,x:o.x,y:o.y}),h===n&&(v={...v,focus:!0}),c&&(v={...v,width:c.width,height:c.height}),l&&(v={...v,sceneIndex:l}),m&&(v={...v,boxStatus:m}),g&&(v={...v,lastNotMinimizedBoxStatus:g}),b&&(v={...v,forceTop:b}),M&&(v={...v,forceNormal:M}),N&&(v={...v,isDragContent:N}),v},this.appAttributesUpdateListener=n=>{this.manager.refresher.add(n,()=>f.autorun(()=>{const a=this.manager.attributes[n];a&&this.appEmitter.emit("attributesUpdate",a)})),this.manager.refresher.add(this.stateKey,()=>f.autorun(()=>{var o,h,c,l;const a=(o=this.appAttributes)==null?void 0:o.state;(a==null?void 0:a.zIndex)>0&&a.zIndex!==((h=this.box)==null?void 0:h.zIndex)&&((c=this.boxManager)==null||c.setZIndex(n,a.zIndex),(l=this.boxManager)==null||l.focusBox({appId:n}))})),this.manager.refresher.add(`${n}-fullPath`,()=>f.autorun(()=>{var o;const a=(o=this.appAttributes)==null?void 0:o.fullPath;this.setFocusScenePathHandler(a),this._prevFullPath!==a&&(this.notifyPageStateChange(),this._prevFullPath=a)}))},this.setFocusScenePathHandler=w.debounce(n=>{var a;this.view&&n&&n!==((a=this.view)==null?void 0:a.focusScenePath)&&(be(this.view,n),L.emit("onAppScenePathChange",{appId:this.id,view:this.view}))},50),this.notifyPageStateChange=w.debounce(()=>{this.appEmitter.emit("pageStateChange",this.pageState)},50),this.notifyBoxStatusChange=n=>{this.appEmitter.emit("boxStatusChange",{appId:this.id,status:n})},this.kind=i.kind,this.id=t,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new ve.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=s,this.initScenes(),(r=this.params.options)!=null&&r.scenePath&&this.createView(),this._pageState=new Er({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}initScenes(){var e;const i=this.params.options;i&&(this.scenePath=i.scenePath,((e=this.appAttributes)==null?void 0:e.isDynamicPPT)&&this.scenePath?this.scenes=Pe(this.manager.displayer)[this.scenePath]:this.scenes=i.scenes)}get view(){return this.manager.viewManager.getView(this.id)}get viewIndex(){var i;return(i=this.view)==null?void 0:i.focusSceneIndex}get isWritable(){var i;return this.manager.canOperate&&!((i=this.box)!=null&&i.readonly)}get attributes(){return this.manager.attributes[this.id]}get appAttributes(){return this.store.getAppAttributes(this.id)}get Logger(){return this.manager.windowManger.Logger}getFullScenePath(){if(this.scenePath)return w.get(this.appAttributes,[Q.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const i=w.get(this.appAttributes,["state","SceneIndex"],0),e=Ir(this.manager.room,this.scenePath,i);return e&&this.setFullPath(e),e}setFullPath(i){this.manager.safeUpdateAttributes(["apps",this.id,Q.FullPath],i)}async baseInsertApp(i=!1,e=x.Normal){var a;const t=this.params;if(!t.kind)throw this.Logger&&this.Logger.error("[WindowManager]: kind require"),new Error("[WindowManager]: kind require");const s=await((a=J.appClasses.get(t.kind))==null?void 0:a()),r=J.registered.get(t.kind),n=this.manager.windowManger.resolveAppOptions(t.kind,r==null?void 0:r.appOptions);if(s)await this.setupApp(this.id,i,s,t.options,n,this.manager.useBoxesStatus?e:void 0,t.forceTop,t.forceNormal,t.isDragContent);else throw this.Logger&&this.Logger.error(`[WindowManager]: app load failed ${t.kind} ${t.src}`),new Error(`[WindowManager]: app load failed ${t.kind} ${t.src}`);return A.emit("updateManagerRect"),{appId:this.id,app:s}}get box(){var i;return(i=this.boxManager)==null?void 0:i.getBox(this.id)}async setupApp(i,e,t,s,r,n,a,o,h){var u;if(re("setupApp",i,t,s,n,a,o,h),!this.boxManager)throw new us;const c=ge(qe,P.extendClass),l=new c(this.manager,this.boxManager,i,this,r);this.appContext=l;try{A.once(`${i}${R.WindowCreated}`).then(async()=>{var g;let d;e||(d=this.getAppInitState(i),(g=this.boxManager)==null||g.updateBoxState(d)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(i),this.setViewFocusScenePath();let m;this.manager.isReplay&&(m=this.manager.mainView.scenePath),setTimeout(async()=>{this.Logger&&this.Logger.info(`[WindowManager]: setup app ${this.kind}, appId: ${i}`);const b=await t.setup(l);this.appResult=b,J.notifyApp(this.kind,"created",{appId:i,result:b}),this.afterSetupApp(d),this.fixMobileSize(),m&&this.manager.mainViewProxy.setFocusScenePath(m),L.emit("onAppSetup",i)},rs)}),(u=this.boxManager)==null||u.createBox({appId:i,app:t,options:s,canOperate:this.manager.canOperate,smartPosition:this.isAddApp,boxStatus:n,forceTop:a,forceNormal:o,isDragContent:h}),this.isAddApp&&this.box&&(n&&this.store.setBoxStatus(i,n),this.store.updateAppState(i,ee.ZIndex,this.box.zIndex),this.store.updateAppState(i,ee.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:i},!1))}catch(d){throw this.Logger&&this.Logger.error(`[WindowManager]: app setup error: ${d.message}`),new Error(`[WindowManager]: app setup error: ${d.message}`)}}fixMobileSize(){var e,t;const i=(e=this.boxManager)==null?void 0:e.getBox(this.id);i&&((t=this.boxManager)==null||t.resizeBox({appId:this.id,width:i.intrinsicWidth+.001,height:i.intrinsicHeight+.001,skipUpdate:!0}))}afterSetupApp(i){var e;i&&(!(i!=null&&i.x)||!i.y)&&((e=this.boxManager)==null||e.setBoxInitState(this.id))}async onSeek(i){var t;this.appEmitter.emit("seek",i).catch(s=>{console.log(`[WindowManager]: emit seek error: ${s.message}`)});const e=this.getAppInitState(this.id);(t=this.boxManager)==null||t.updateBoxState(e)}async onReconnected(){var n;if(!Boolean(this.manager.attributes.apps[this.id])){await this.destroy(!0,!1,!0);return}this.appEmitter.emit("reconnected",void 0);const e=this.getAppInitState(this.id);await this.destroy(!0,!1,!0);const t=this.params,s=ge(Os,P.extendClass);await new s(t,this.manager,this.id,this.isAddApp).baseInsertApp(!0,e==null?void 0:e.boxStatus),(n=this.boxManager)==null||n.updateBoxState(e)}async onRemoveScene(i){if(this.scenePath&&i.startsWith(this.scenePath+"/")){let e=this.pageState.index,t=this._pageState.getFullPath(e);t||(e=0,t=this._pageState.getFullPath(e)),t&&this.setFullPath(t),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=e)}}emitAppSceneStateChange(i){this.appEmitter.emit("sceneStateChange",i)}emitAppIsWritableChange(){this.appEmitter.emit("writableChange",this.isWritable)}makeAppEventListener(i){return(e,t)=>{var s,r,n,a;if(!!this.manager.canOperate)switch(e){case"setBoxSize":{(s=this.boxManager)==null||s.resizeBox({appId:i,width:t.width,height:t.height,skipUpdate:!1});break}case"setBoxMinSize":{(r=this.boxManager)==null||r.setBoxMinSize({appId:i,minWidth:t.minwidth,minHeight:t.minheight});break}case"setBoxTitle":{(n=this.boxManager)==null||n.setBoxTitle({appId:i,title:t.title});break}case is.destroy:{if(this.status==="destroyed")return;this.destroy(!0,!1,!0,t==null?void 0:t.error),t!=null&&t.error&&console.error(t==null?void 0:t.error);break}case"focus":{(a=this.boxManager)==null||a.focusBox({appId:this.id}),ce.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const i=this.getFullScenePath();this.manager.room&&i&&this.view&&Ht(this.manager.room,i)}setViewFocusScenePath(){const i=this.getFullScenePath();return i&&this.view&&be(this.view,i),i}async createView(){const i=await this.viewManager.createView(this.id);return this.setViewFocusScenePath(),i}get pageState(){return this._pageState.toObject()}async removeSceneByIndex(i){const e=this._pageState.getFullPath(i);if(e){const t=xi(i,this.pageState);return this.setSceneIndexWithoutSync(t),this.manager.dispatchInternalEvent(R.SetAppFocusIndex,{type:"app",appID:this.id,index:t}),setTimeout(()=>{Jt(this.manager.room,e,i)},100),!0}else return!1}setSceneIndexWithoutSync(i){this.view&&(this.view.focusSceneIndex=i)}setSceneIndex(i){if(this.view){this.view.focusSceneIndex=i;const e=this._pageState.getFullPath(i);e&&this.setFullPath(e)}}async destroy(i,e,t,s){var r;if(this.status!=="destroyed"){this.status="destroyed";try{await J.notifyApp(this.kind,"destroy",{appId:this.id}),await this.appEmitter.emit("destroy",{error:s})}catch(n){this.Logger&&this.Logger.error(`[WindowManager]: notifyApp error: ${n.message}`),console.error("[WindowManager]: notifyApp error",n.message,n.stack)}this.appEmitter.clearListeners(),A.emit(`destroy-${this.id}`,{error:s}),i&&((r=this.boxManager)==null||r.closeBox(this.id,t)),e&&(this.store.cleanAppAttributes(this.id),this.scenePath&&Jt(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this._pageState.destroy(),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),this.manager.refresher.remove(this.id),this.manager.refresher.remove(this.stateKey),this.manager.refresher.remove(`${this.id}-fullPath`),this._prevFullPath=void 0,this.Logger&&this.Logger.info(`[WindowManager]: destroy app ${this.kind} appId: ${this.id}`)}}close(){return this.destroy(!0,!0,!1)}};let nt=Os;nt.kind="AppProxy";class zn{constructor(e){this.displayer=e,this.views=new Map}createView(e){const t=Ws(this.displayer);return this.views.set(e,t),t}getView(e){return this.views.get(e)}destroyView(e){const t=this.views.get(e);if(t){try{t.release()}catch{}this.views.delete(e)}}setViewScenePath(e,t){const s=this.views.get(e);s&&(s.focusScenePath=t)}destroy(){this.views.forEach(e=>{try{e.release()}catch{}}),this.views.clear()}}const Ws=i=>{const e=i.views.createView();return Dn(e),e},Dn=i=>{i.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class Tn{constructor(e){this.manager=e,this.polling=!1,this.started=!1,this.mainViewIsAddListener=!1,this.isForcingMainViewDivElement=!1,this.wrapperRectWorkaroundFrame=0,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new Ke,this.playgroundSizeChangeListenerLocalConsole=new We("playgroundSizeChangeListener",100),this.sizeUpdatedLocalConsole=new We("sizeUpdated",100),this.cameraUpdatedLocalConsole=new We("cameraUpdated",100),this.cameraReactionLocalConsole=new We("cameraReaction",100),this.syncCamera=()=>{if(!this.polling||this.viewMode!==f.ViewMode.Broadcaster)return;const{mainViewCamera:s}=this;s&&s.id!==this.manager.uid&&this.moveCameraSizeByAttributes()},this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>A.on("writableChange",s=>{s&&this.ensureCameraAndSize(),this.manager.room&&this.syncMainView(this.manager.room)}))},this.onWrapperRectChange=s=>{this.pendingWrapperRectChange=s,this.wrapperRectWorkaroundFrame&&cancelAnimationFrame(this.wrapperRectWorkaroundFrame),this.wrapperRectWorkaroundFrame=requestAnimationFrame(this.runWrapperRectWorkaround)},this.runWrapperRectWorkaround=()=>{this.wrapperRectWorkaroundFrame=0;const s=this.pendingWrapperRectChange,r=this.mainView.divElement;if(this.pendingWrapperRectChange=void 0,!s||!r)return;const n=r.getBoundingClientRect(),a={width:n.width,height:n.height},o=Math.abs(s.width-a.width)<=.5&&Math.abs(s.height-a.height)<=.5,h=Math.abs(this.mainView.size.width-a.width)>.5||Math.abs(this.mainView.size.height-a.height)>.5;o&&h&&this.forceSyncMainViewDivElement(`wrapperRectChange:${s.origin||"unknown"}`,a,r)},this.addCameraReaction=()=>{this.manager.refresher.add(Q.MainViewCamera,this.cameraReaction)},this.cameraReaction=()=>f.reaction(()=>this.mainViewCamera,s=>{s&&s.id!==this.manager.uid&&(this.moveCameraToContian(this.mainViewSize),this.moveCamera(s),this.cameraReactionLocalConsole.log(`camera: ${JSON.stringify(s)}, current size: ${JSON.stringify(this.mainViewSize)}`))},{fireImmediately:!0}),this.sizeChangeHandler=w.debounce(s=>{s&&(this.moveCameraToContian(s),this.moveCamera(this.mainViewCamera),console.log("[window-manager] sizeChangeHandler current size and camera"+JSON.stringify(s)+JSON.stringify(this.mainViewCamera)+JSON.stringify(this.mainView.camera)+JSON.stringify(this.mainView.size))),this.ensureMainViewSize()},30),this.onUpdateContainerSizeRatio=()=>{const s=this.store.getMainViewSize();console.log("[window-manager] onUpdateContainerSizeRatio "+JSON.stringify(s)),this.sizeChangeHandler(s)},this.onCameraUpdatedByDevice=s=>{this.viewMode!==f.ViewMode.Follower&&(this.store.setMainViewCamera({...s,id:this.manager.uid}),w.isEqual(this.mainViewSize,{...this.mainView.size,id:this.manager.uid})||this.setMainViewSize(this.view.size))},this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=w.debounce(s=>{this.store.setMainViewSize({...s,id:this.manager.uid})},50),this._syncMainViewTimer=0,this.handleCameraOrSizeUpdated=()=>{L.emit("cameraStateChange",this.cameraState),this.manager.room&&this.manager.room.syncMainView&&(clearTimeout(this._syncMainViewTimer),this._syncMainViewTimer=setTimeout(this.syncMainView,100,this.manager.room)),this.ensureMainViewSize()},this.onCameraUpdated=s=>{this.cameraUpdatedLocalConsole.log(JSON.stringify(s)),this.handleCameraOrSizeUpdated()},this.onSizeUpdated=s=>{this.sizeUpdatedLocalConsole.log(JSON.stringify(s)),this.handleCameraOrSizeUpdated()},this.syncMainView=s=>{s.isWritable&&s.syncMainView(this.mainView)},this.setViewMode=s=>{this.viewMode=s},this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),A.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()});const t=()=>{var s,r,n,a,o,h,c,l;this.playgroundSizeChangeListenerLocalConsole.log(JSON.stringify(this.mainView.camera),JSON.stringify(this.mainView.size),JSON.stringify(this.mainViewSize),JSON.stringify(this.mainViewCamera),window.outerHeight,window.outerWidth,(r=(s=window.visualViewport)==null?void 0:s.width)!=null?r:"null",(a=(n=window.visualViewport)==null?void 0:n.height)!=null?a:"null",(h=(o=window.visualViewport)==null?void 0:o.offsetLeft)!=null?h:"null",(l=(c=window.visualViewport)==null?void 0:c.offsetTop)!=null?l:"null"),this.sizeChangeHandler(this.mainViewSize)};this.sideEffectManager.add(()=>A.on("playgroundSizeChange",t)),this.sideEffectManager.add(()=>A.on("containerSizeRatioUpdate",this.onUpdateContainerSizeRatio)),this.sideEffectManager.add(()=>A.on("wrapperRectChange",this.onWrapperRectChange)),this.sideEffectManager.add(()=>A.on("startReconnect",()=>{this.didRelease||this.mainView.release()})),this.sideEffectManager.setInterval(this.syncCamera,1500)}ensureCameraAndSize(){this.viewMode===f.ViewMode.Broadcaster&&(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(R.InitMainViewCamera),this.setCameraAndSize())}get mainViewCamera(){return this.store.getMainViewCamera()}get mainViewSize(){return this.store.getMainViewSize()}get didRelease(){return w.get(this.view,["didRelease"])}moveCameraSizeByAttributes(){this.moveCameraToContian(this.mainViewSize),this.moveCamera(this.mainViewCamera)}forceSyncMainViewDivElement(e,t,s){var o,h;const{width:r,height:n}=this.mainView.size,a=s;if(!(Math.abs(r-t.width)<=.5&&Math.abs(n-t.height)<=.5)){if(this.isForcingMainViewDivElement){console.log("[window-manager] skipForceSyncMainViewDivElement "+JSON.stringify({reason:e,observedSize:t,viewSize:this.mainView.size}));return}this.isForcingMainViewDivElement=!0;try{const l=this.mainView.screen,u=l==null?void 0:l.resizeObserver;typeof(l==null?void 0:l.refreshSize)=="function"&&(console.log("[window-manager] forceSyncMainViewDivElement observerReset "+JSON.stringify({reason:e,viewSize:this.mainView.size,observedSize:t})),(o=u==null?void 0:u.disconnect)==null||o.call(u),l.refreshSize(t.width,t.height),(h=u==null?void 0:u.observe)==null||h.call(u,s))}finally{queueMicrotask(()=>{const c=a.getBoundingClientRect();console.log("[window-manager] forceSyncMainViewDivElementResult "+JSON.stringify({reason:e,viewSize:this.mainView.size,rect:{width:c.width,height:c.height}})),this.isForcingMainViewDivElement=!1})}}}start(){console.log("[window-manager] start attributes size:"+JSON.stringify(this.mainViewSize)),this.sizeChangeHandler(this.mainViewSize),!this.started&&(this.addCameraListener(),this.addCameraReaction(),this.manager.room&&this.syncMainView(this.manager.room),this.started=!0,this.mainView.focusScenePath&&this.manager.windowManger.onMainViewScenePathChangeHandler(this.mainView.focusScenePath),console.log("[window-manager] start end mainView size:"+JSON.stringify(this.mainView.size)))}setCameraAndSize(){const e={...this.mainView.camera,id:this.manager.uid},t={...this.mainView.size,id:this.manager.uid};this.store.setMainViewCameraAndSize(e,t)}get view(){return this.mainView}get cameraState(){return{...this.view.camera,...this.view.size}}createMainView(){const e=Ws(this.manager.displayer),t=this.store.getMainViewScenePath();return t&&be(e,t),e}onReconnect(){if(this.didRelease)this.rebind();else{const e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}setFocusScenePath(e){if(e)return be(this.view,e)}rebind(){const 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(),L.emit("onMainViewRebind",this.mainView)}addMainViewListener(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}removeMainViewListener(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}async mainViewClickHandler(){var e;!this.manager.canOperate||(this.store.cleanFocus(),(e=this.manager.boxManager)==null||e.blurAllBox())}addCameraListener(){this.view.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.on("onCameraUpdated",this.onCameraUpdated),this.view.callbacks.on("onSizeUpdated",this.onSizeUpdated)}removeCameraListener(){this.view.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.off("onCameraUpdated",this.onCameraUpdated),this.view.callbacks.off("onSizeUpdated",this.onSizeUpdated)}ensureMainViewSize(){(!this.mainViewSize||this.mainViewSize.width===0||this.mainViewSize.height===0)&&this.mainView.size.width>0&&this.mainView.size.height>0&&this.setMainViewSize(this.mainView.size)}moveCameraToContian(e){w.isEmpty(e)||(this.view.moveCameraToContain({width:e.width,height:e.height,originX:-e.width/2,originY:-e.height/2,animationMode:f.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}moveCamera(e){if(!w.isEmpty(e)){if(w.isEqual(e,this.view.camera))return;const{centerX:t,centerY:s,scale:r}=e,n=r*(this.scale||1);this.view.moveCamera({centerX:t,centerY:s,scale:n,animationMode:f.AnimationMode.Immediately})}}stop(){this.removeCameraListener(),this.manager.refresher.remove(Q.MainViewCamera),this.manager.refresher.remove(Q.MainViewSize),this.started=!1}destroy(){console.log("[window-manager] destroy "),this.wrapperRectWorkaroundFrame&&(cancelAnimationFrame(this.wrapperRectWorkaroundFrame),this.wrapperRectWorkaroundFrame=0),this.playgroundSizeChangeListenerLocalConsole.destroy(),this.sizeUpdatedLocalConsole.destroy(),this.cameraUpdatedLocalConsole.destroy(),this.cameraReactionLocalConsole.destroy(),this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class Pn{constructor(e){this.context=e,this.addRedoUndoListeners=t=>{if(t===void 0)this.addViewCallbacks(this.context.mainView(),this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate);else{const s=this.context.getAppProxy(t);s&&s.view&&this.addViewCallbacks(s.view,this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate)}},this.addViewCallbacks=(t,s,r)=>{s(t.canRedoSteps),r(t.canUndoSteps),t.callbacks.on("onCanRedoStepsUpdate",s),t.callbacks.on("onCanUndoStepsUpdate",r)},this.disposeViewCallbacks=t=>{t.callbacks.off("onCanRedoStepsUpdate",this.onCanRedoStepsUpdate),t.callbacks.off("onCanUndoStepsUpdate",this.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=t=>{L.emit("canRedoStepsChange",t)},this.onCanUndoStepsUpdate=t=>{L.emit("canUndoStepsChange",t)},this.disposePrevFocusViewRedoUndoListeners=t=>{let s;if(t===void 0)s=this.context.mainView();else{const r=this.context.getAppProxy(t);r&&r.view&&(s=r.view)}s&&this.disposeViewCallbacks(s)},A.on("focusedChange",t=>{this.disposePrevFocusViewRedoUndoListeners(t.prev),setTimeout(()=>{this.addRedoUndoListeners(t.focused)},0)}),A.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(e.focus()),this.addRedoUndoListeners(e.focus())}),this.addRedoUndoListeners(e.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class ot{constructor(e){this.windowManger=e,this.appProxies=new Map,this.appStatus=new Map,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new or,this.sideEffectManager=new Ke,this.sceneState=null,this.rootDirRemoving=!1,this._useBoxesStatus=!1,this.onRemoveScenes=async t=>{var r,n;const{scenePath:s}=t;if(s===q){console.log("[window-manager] onRemoveScenes ROOT_DIR"),await this.onRootDirRemoved(),this.dispatchInternalEvent(R.RootDirRemoved);return}if(Nr(s)){let a=this.mainView.focusSceneIndex||0,o=(r=this.callbacksNode)==null?void 0:r.scenes[a];o||(a=0,o=(n=this.callbacksNode)==null?void 0:n.scenes[a]),o&&(console.log(`[window-manager] onRemoveScenes setMainViewScenePath ${q}${o}`),this.setMainViewScenePath(`${q}${o}`)),await this.setMainViewSceneIndex(a)}else this.appProxies.forEach(a=>{a.onRemoveScene(s)})},this.onReadonlyChanged=()=>{this.appProxies.forEach(t=>{t.emitAppIsWritableChange()})},this.onPlayerSeekStart=async()=>{await this.closeAll()},this.onPlayerSeekDone=async t=>{await this._attributesUpdateCallback(this.attributes.apps),this.appProxies.forEach(s=>{s.onSeek(t)})},this.createRootDirScenesCallback=()=>{let t=!1;this.callbacksNode&&(this.callbacksNode.dispose(),t=!0),this.callbacksNode=this.displayer.createScenesCallback(q,{onAddScene:this.onSceneChange,onRemoveScene:async(s,r)=>{await this.onSceneChange(s),A.emit("rootDirSceneRemoved",r)}}),this.callbacksNode&&(this.updateSceneState(this.callbacksNode),this.mainViewScenesLength=this.callbacksNode.scenes.length,t&&this.emitMainViewScenesChange(this.callbacksNode.scenes.length))},this.removeSceneByIndex=async t=>{var n;const s=xi(t,this.windowManger.pageState);this.setSceneIndexWithoutSync(s),this.dispatchInternalEvent(R.SetAppFocusIndex,{type:"main",index:s});const r=(n=this.callbacksNode)==null?void 0:n.scenes[t];return setTimeout(()=>{r&&Jt(this.room,`${q}${r}`,t)},100),new Promise((a,o)=>{A.once("rootDirSceneRemoved").then(h=>{h===r&&a(!0)}).catch(h=>{console.log(`[WindowManager]: removePage error: ${h}`),o(!1)})})},this.setSceneIndexWithoutSync=t=>{var r;const s=(r=this.callbacksNode)==null?void 0:r.scenes[t];s&&this.mainViewProxy.setFocusScenePath(`${q}${s}`)},this.onSceneChange=t=>(this.mainViewScenesLength=t.scenes.length,this.updateSceneState(t),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=t=>Promise.all([L.emit("mainViewScenesLengthChange",t),A.emit("changePageState")]),this.updateSceneState=t=>{const s=this.store.getMainViewSceneIndex()||0;let r=t.scenes[s];r||(r=t.scenes[this.mainView.focusSceneIndex||0]),this.sceneState={scenePath:`${q}${r}`,contextPath:t.path,index:s,scenes:t.scenes.map(n=>({name:n})),sceneName:r},L.emit("sceneStateChange",this.sceneState)},this.onBoxMove=t=>{this.dispatchInternalEvent(R.AppMove,t),this.store.updateAppState(t.appId,ee.Position,{x:t.x,y:t.y}),L.emit("onBoxMove",t)},this.onBoxResize=t=>{t.width&&t.height&&(this.dispatchInternalEvent(R.AppResize,t),this.store.updateAppState(t.appId,ee.Size,{width:t.width,height:t.height}),L.emit("onBoxResize",t))},this.onBoxFocus=t=>{this.windowManger.safeSetAttributes({focus:t.appId}),L.emit("onBoxFocus",t)},this.onBoxBlurred=t=>{this.attributes.focus===t.appId&&(this.windowManger.safeSetAttributes({focus:void 0}),L.emit("onBoxBlurred",t))},this.onBoxClose=t=>{const s=this.appProxies.get(t.appId);s&&s.destroy(!1,!0,!0,t.error),L.emit("onBoxClose",t)},this.onBoxStateChange=t=>{this.dispatchInternalEvent(R.AppBoxStateChange,t),L.emit("onBoxStateChange",t)},this.notifyBoxesStatusChange=w.debounce(()=>{var s;(s=this.boxManager)==null||s.setBoxesStatus(this.attributes.boxesStatus);const t=Object.entries(this.attributes.boxesStatus);t.length>0&&t.forEach(([r,n])=>{const a=this.appProxies.get(r);a&&a.notifyBoxStatusChange(n)})},100),this.addBoxesStatusChangeListener=()=>{this.refresher.add("boxesStatus",()=>_e(()=>this.attributes.boxesStatus,()=>{this.notifyBoxesStatusChange()})),this.refresher.add("lastNotMinimizedBoxesStatus",()=>_e(()=>this.attributes.lastNotMinimizedBoxesStatus,()=>{var t;(t=this.boxManager)==null||t.setLastNotMinimizedBoxesStatus(this.attributes.lastNotMinimizedBoxesStatus)}))},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>_e(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{this.refresher.add("appsClose",()=>_e(()=>this.attributes.apps,t=>{t.some(s=>s.kind===f.UpdateEventKind.Removed)&&this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=t=>{t!==void 0&&this._prevSceneIndex!==t&&(L.emit("mainViewSceneIndexChange",t),A.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this._prevSceneIndex=t)},this.onFocusChange=t=>{var s;this._prevFocused!==t&&(L.emit("focusedChange",t),A.emit("focusedChange",{focused:t,prev:this._prevFocused}),this._prevFocused=t,t!==void 0&&((s=this.boxManager)==null||s.focusBox({appId:t}),setTimeout(()=>{const r=this.appProxies.get(t);r&&J.notifyApp(r.kind,"focus",{appId:t})},0)))},this.attributesUpdateCallback=w.debounce(t=>this._attributesUpdateCallback(t),100),this._appIds=[],this.onRegisteredChange=t=>{!t||Object.entries(t).forEach(([s,r])=>{J.appClasses.has(s)||J.register({kind:s,src:r.src,name:r.name})})},this.onMinimized=t=>{var s,r;((s=this.boxManager)==null?void 0:s.minimized)!==t&&(t===!0&&((r=this.boxManager)==null||r.blurAllBox()),setTimeout(()=>{var n;(n=this.boxManager)==null||n.setMinimized(Boolean(t))},0))},this.onAppDelete=async t=>{const s=Object.keys(t);for(const[r,n]of this.appProxies.entries())s.includes(r)||await n.destroy(!0,!1,!0)},this.closeAll=async()=>{for(const[t,s]of this.appProxies.entries())await s.destroy(!0,!1,!0)},this.displayerStateListener=t=>{this.appProxies.forEach(s=>{s.appEmitter.emit("roomStateChange",t)}),A.emit("observerIdChange",this.displayer.observerId)},this.displayerWritableListener=t=>{var n,a;const s=!t,r=this.windowManger.readonly===void 0||this.windowManger.readonly===!1;this.windowManger.readonly===void 0?(n=this.boxManager)==null||n.setReadonly(t):(a=this.boxManager)==null||a.setReadonly(!(s&&r)),this.appProxies.forEach(o=>{o.emitAppIsWritableChange()}),A.emit("writableChange",s)},this.updateSceneIndex=()=>{const t=this.store.getMainViewScenePath(),s=Et(t),r=Pe(this.displayer)[s];if(r.length){const n=t.replace(s,"").replace("/",""),a=r.findIndex(o=>o.name===n);w.isInteger(a)&&a>=0&&this.safeSetAttributes({_mainSceneIndex:a})}},this.updateRootDirRemoving=t=>{this.rootDirRemoving=t},this.displayer=e.displayer,this.store=Nn(P.extendClass,{getAttributes:()=>this.attributes,safeSetAttributes:t=>this.safeSetAttributes(t),safeUpdateAttributes:(t,s)=>this.safeUpdateAttributes(t,s)}),this.mainViewProxy=new Tn(this),this.viewManager=new zn(this.displayer),this.appListeners=new zr(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=Zs,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:A}),this.sideEffectManager.addDisposer(()=>{var t,s;this.appCreateQueue.destroy(),this.mainViewProxy.destroy(),this.refresher.destroy(),this.viewManager.destroy(),(t=this.boxManager)==null||t.destroy(),(s=this.callbacksNode)==null||s.dispose()}),A.once("onCreated").then(()=>this.onCreated()),A.on("onReconnected",()=>this.onReconnected()),f.isPlayer(this.displayer)&&(A.on("seekStart",this.onPlayerSeekStart),A.on("seek",this.onPlayerSeekDone)),A.on("removeScenes",this.onRemoveScenes),A.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),J.setSyncRegisterApp(t=>{this.safeUpdateAttributes([Q.Registered,t.kind],t)})}get useBoxesStatus(){return this._useBoxesStatus}set useBoxesStatus(e){this._useBoxesStatus=e}getMemberState(){var e;return((e=this.room)==null?void 0:e.state.memberState)||{strokeColor:[0,0,0]}}async onRootDirRemoved(e=!0){this.setMainViewScenePath(ss),this.createRootDirScenesCallback();for(const[t,s]of this.appProxies.entries())s.view&&await this.closeApp(t,e);this.mainViewProxy.rebind(),A.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return f.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return f.isRoom(this.displayer)?this.displayer:void 0}get mainView(){return this.mainViewProxy.view}get polling(){return this.mainViewProxy.polling}set polling(e){this.mainViewProxy.polling=e}get focusApp(){if(this.store.focus)return this.appProxies.get(this.store.focus)}get uid(){var e;return((e=this.room)==null?void 0:e.uid)||""}get Logger(){return this.windowManger.Logger}getMainViewSceneDir(){const e=this.store.getMainViewScenePath();if(e)return Et(e);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var e;if(Object.keys(this.attributes.apps).length&&this.store.focus&&(this._focusAppId=this.store.focus,await new Promise(t=>{this._focusAppCreatedResolve=t,this._resolveTimer=setTimeout(()=>{t(this.appProxies.get(this._focusAppId||""))},500)}).then(()=>{this._resolveTimer=void 0,this._focusAppCreatedResolve=void 0,this.focusByAttributes(this.attributes.apps)})),await this._attributesUpdateCallback(this.attributes.apps),A.emit("updateManagerRect"),ce.on("move",this.onBoxMove),ce.on("resize",this.onBoxResize),ce.on("focus",this.onBoxFocus),ce.on("close",this.onBoxClose),ce.on("boxStateChange",this.onBoxStateChange),ce.on("blurred",this.onBoxBlurred),this.addAppsChangeListener(),this.addAppCloseListener(),this.addBoxesStatusChangeListener(),this.refresher.add("maximized",()=>f.autorun(()=>{var s;const t=this.attributes.maximized;(s=this.boxManager)==null||s.setMaximized(Boolean(t))})),this.refresher.add("minimized",()=>f.autorun(()=>{const t=this.attributes.minimized;this.onMinimized(t)})),this.refresher.add("mainViewIndex",()=>f.autorun(()=>{const t=w.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(t)})),this.refresher.add("focusedChange",()=>f.autorun(()=>{const t=w.get(this.attributes,"focus");this.onFocusChange(t)})),this.refresher.add("registeredChange",()=>f.autorun(()=>{const t=w.get(this.attributes,Q.Registered);this.onRegisteredChange(t)})),!this.attributes.apps||Object.keys(this.attributes.apps).length===0){const t=this.store.getMainViewScenePath();if(!t)return;this.resetScenePath(t)}this.displayerWritableListener(!((e=this.room)!=null&&e.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this.focusByAttributes(this.attributes.apps),this._prevFocused=this.attributes.focus,P.supportAppliancePlugin||this.sideEffectManager.add(()=>{const t=new Pn({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:s=>this.appProxies.get(s)});return()=>t.destroy()})}notifyAppsChange(e){(this._appIds.length!==e.length||!this._appIds.every(t=>e.includes(t)))&&(this._appIds=e,L.emit("appsChange",e))}async _attributesUpdateCallback(e){if(e&&P.container){const t=Object.keys(e);t.length===0&&this.appCreateQueue.emitReady();const r=w.orderBy(t.map(n=>({id:n,createdAt:e[n].createdAt})),"createdAt","asc").map(({id:n})=>n);this.notifyAppsChange(r);for(const n of r)if(!this.appProxies.has(n)&&!this.appStatus.has(n)){const a=e[n];try{if(!this.attributes[n])throw this.Logger&&this.Logger.error(`[WindowManager]: appAttributes is undefined, appId: ${n}`),new Error("appAttributes is undefined");this.appCreateQueue.push(async()=>{this.appStatus.set(n,Qt.StartCreate);const h=await this.baseInsertApp({kind:a.kind,options:a.options,isDynamicPPT:a.isDynamicPPT,forceNormal:a.forceNormal,forceTop:a.forceTop,isDragContent:a.isDragContent},n,!1);return h&&this._focusAppId===n&&this._focusAppCreatedResolve&&(this._resolveTimer&&clearTimeout(this._resolveTimer),this._focusAppCreatedResolve(h)),h}),this.focusByAttributes(e)}catch(o){console.warn("[WindowManager]: Insert App Error",o)}}}}refresh(){this.attributesUpdateCallback(this.attributes.apps)}setBoxManager(e){this.boxManager=e}resetMaximized(){var e;(e=this.boxManager)==null||e.setMaximized(Boolean(this.store.getMaximized()))}resetMinimized(){var e;(e=this.boxManager)==null||e.setMinimized(Boolean(this.store.getMinimized()))}bindMainView(e,t){const s=this.mainViewProxy.view;s.disableCameraTransform=t,s.divElement=e,s.focusScenePath||this.setMainViewFocusPath(),A.emit("mainViewMounted"),L.emit("onMainViewMounted",s);const r=this.hasRoot(s.divElement),n=this.getRectByDivElement(s.divElement);let a=`[window-manager] bindMainView hasRoot:${r}, rect:${JSON.stringify(n)}, outerHeight:${window.outerHeight}, outerWidth:${window.outerWidth}`;const o=window.visualViewport;o&&(a+=`, visualViewportWidth:${o.width}, visualViewportHeight:${o.height}, visualViewportOffsetLeft:${o.offsetLeft}, visualViewportOffsetTop:${o.offsetTop}`),console.log(a)}hasRoot(e){let t=e;for(;t;){if(t.parentElement===document.body)return!0;t=t.parentElement}return!1}getRectByDivElement(e){return e.getBoundingClientRect()}setMainViewFocusPath(e){var s;const t=e||this.store.getMainViewScenePath();if(t)return be(this.mainView,t),((s=this.mainView)==null?void 0:s.focusScenePath)===t}resetScenePath(e){this.displayer.state.sceneState.scenePath!==e&&Ht(this.room,e)}async addApp(e,t){var a;re("addApp",e),(a=this.windowManger.Logger)==null||a.info(`[WindowManager]: addApp ${e.kind}, isDynamicPPT: ${t}`);const{appId:s,needFocus:r}=await this.beforeAddApp(e,t),n=await this.baseInsertApp(e,s,!0,r);return this.afterAddApp(n),n==null?void 0:n.id}async beforeAddApp(e,t){var a,o;const s=await vr(e.kind);this.appStatus.set(s,Qt.StartCreate);const r=(a=e.attributes)!=null?a:{};this.safeUpdateAttributes([s],r),this.store.setupAppAttributes(e,s,t);const n=!((o=this.boxManager)!=null&&o.minimized);return n&&this.store.setAppFocus(s,!0),{appId:s,needFocus:n}}afterAddApp(e){var t,s;if(e&&e.box){const r=e.box;ce.emit("move",{appId:e.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(e.id,ee.ZIndex,r.zIndex)}(t=this.boxManager)!=null&&t.minimized&&((s=this.boxManager)==null||s.setMinimized(!1,!1))}async closeApp(e,t=!0){const s=this.appProxies.get(e);s&&await s.destroy(!0,t,!1)}async baseInsertApp(e,t,s,r){var o;if(this.appProxies.has(t)){(o=this.windowManger.Logger)==null||o.warn(`[WindowManager]: app duplicate exists and cannot be created again, appId: ${t}`);return}const n=ge(nt,P.extendClass),a=new n(e,this,t,s);if(a)return await a.baseInsertApp(r),this.appStatus.delete(t),a;throw this.appStatus.delete(t),this.Logger&&this.Logger.error(`[WindowManager]: initialize AppProxy failed, appId: ${t}`),new Error("[WindowManger]: initialize AppProxy failed")}safeSetAttributes(e){this.windowManger.safeSetAttributes(e)}safeUpdateAttributes(e,t){this.windowManger.safeUpdateAttributes(e,t)}async setMainViewScenePath(e){if(this.room){const t=this.displayer.scenePathType(e);if(Et(e)!==q)throw this.Logger&&this.Logger.error('[WindowManager]: main view scenePath must in root dir "/"'),new Error('[WindowManager]: main view scenePath must in root dir "/"');if(t===f.ScenePathType.None)throw this.Logger&&this.Logger.error(`[WindowManager]: ${e} not valid scene`),new Error(`[WindowManager]: ${e} not valid scene`);if(t===f.ScenePathType.Page)await this._setMainViewScenePath(e);else if(t===f.ScenePathType.Dir){const r=Cr(this.displayer,e);r&&await this._setMainViewScenePath(r)}}}async _setMainViewScenePath(e){this.setMainViewFocusPath(e)&&(this.safeSetAttributes({_mainScenePath:e}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(e))}async setMainViewSceneIndex(e){var t;if(this.room){if(this.store.getMainViewSceneIndex()===e)return;const s=(t=this.callbacksNode)==null?void 0:t.scenes[e],r=`${q}${s}`;if(s)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.store.setMainViewSceneIndex(e),this.dispatchSetMainViewScenePath(r));else throw this.Logger&&this.Logger.error(`[WindowManager]: ${e} not valid index`),new Error(`[WindowManager]: ${e} not valid index`)}}dispatchSetMainViewScenePath(e){this.dispatchInternalEvent(R.SetMainViewScenePath,{nextScenePath:e}),L.emit("mainViewScenePathChange",e),Ht(this.room,e)}getAppInitPath(e){var s;const t=this.store.getAppAttributes(e);if(t)return(s=t==null?void 0:t.options)==null?void 0:s.scenePath}safeDispatchMagixEvent(e,t){this.canOperate&&this.displayer.dispatchMagixEvent(e,t)}focusByAttributes(e){var t;if(e&&Object.keys(e).length===((t=this.boxManager)==null?void 0:t.boxSize)){const s=this.store.focus;s&&this.boxManager.focusBox({appId:s})}}async onReconnected(){await this._attributesUpdateCallback(this.attributes.apps);const t=Array.from(this.appProxies.values()).map(s=>s.onReconnected());this.mainViewProxy.onReconnect(),await Promise.all(t),this.callbacksNode&&this.onSceneChange(this.callbacksNode)}notifyContainerRectUpdate(e){this.appProxies.forEach(t=>{t.appEmitter.emit("containerRectUpdate",e)})}dispatchInternalEvent(e,t){this.safeDispatchMagixEvent(Gt,{eventName:e,payload:t})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),ce.clearListeners(),A.clearListeners(),this.appProxies.size&&this.appProxies.forEach(e=>{e.destroy(!0,!1,!0)}),L.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0,this._resolveTimer&&clearTimeout(this._resolveTimer),this._focusAppCreatedResolve=void 0,this._resolveTimer=void 0}}ot.kind="AppManager";const Ln=window.ResizeObserver||sr.ResizeObserver;class Si{constructor(e){this.emitter=e,this.updateSizerLocalConsole=new We("updateSizer",100)}static create(e,t,s,r){const n=new Si(r);return n.observePlaygroundSize(e,t,s),n}observePlaygroundSize(e,t,s){this.updateSizer(e.getBoundingClientRect(),t,s,"observePlaygroundSize"),this.containerResizeObserver=new Ln(r=>{var a;const n=(a=r[0])==null?void 0:a.contentRect;n&&(this.updateSizer(n,t,s,"containerResizeObserver"),this.emitter.emit("playgroundSizeChange",n))}),this.disposer=this.emitter.on("containerSizeRatioUpdate",()=>{const r=e.getBoundingClientRect();this.updateSizer(r,t,s,"containerSizeRatioUpdate"),this.emitter.emit("playgroundSizeChange",r)}),this.containerResizeObserver.observe(e)}updateSizer({width:e,height:t},s,r,n){if(e&&t){t/e>P.containerSizeRatio?(t=e*P.containerSizeRatio,s.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(e=t/P.containerSizeRatio,s.classList.toggle("netless-window-manager-sizer-horizontal",!1)),r.style.width=`${e}px`,r.style.height=`${t}px`;const a=r.getBoundingClientRect();this.updateSizerLocalConsole.log(`from ${n}, traget size: ${JSON.stringify({width:e,height:t})}, wrapperRect: ${a.width} ${a.height}`),this.emitter.emit("wrapperRectChange",{width:a.width,height:a.height,origin:n})}}disconnect(){var e,t;this.updateSizerLocalConsole.destroy(),(e=this.containerResizeObserver)==null||e.disconnect(),(t=this.disposer)==null||t.call(this),this.disposer=void 0}}class En{constructor(e){this.manager=e,A.on("changePageState",()=>{L.emit("pageStateChange",this.toObject())})}get index(){return this.manager.store.getMainViewSceneIndex()||0}get length(){return this.manager.mainViewScenesLength||0}toObject(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}}class Vn{constructor(e){this.ctx=e,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=async t=>{var s,r;t===f.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),t===f.RoomPhase.Connected&&this.phase===f.RoomPhase.Reconnecting&&((s=this.room)!=null&&s.isWritable?(r=this.room)==null||r.dispatchMagixEvent(Lt,{}):(await as(500),this.onReconnected())),this.phase=t},this.onReconnected=w.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{re("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((t,s)=>{w.isFunction(t)&&this.disposers.set(s,t())}),this.ctx.emitter.emit("onReconnected")}}setRoom(e){this.room=e,this.phase=e==null?void 0:e.phase,e&&(e.callbacks.off("onPhaseChanged",this.onPhaseChanged),e.callbacks.on("onPhaseChanged",this.onPhaseChanged),e.addMagixEventListener(Lt,t=>{t.authorId===e.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(e){this.ctx=e}releaseDisposers(){this.disposers.forEach(e=>{w.isFunction(e)&&e()}),this.disposers.clear()}refresh(){this._onReconnected()}add(e,t){const s=this.disposers.get(e);s&&w.isFunction(s)&&s(),w.isFunction(t)&&(this.reactors.set(e,t),this.disposers.set(e,t()))}remove(e){this.reactors.has(e)&&this.reactors.delete(e);const t=this.disposers.get(e);t&&(w.isFunction(t)&&t(),this.disposers.delete(e))}hasReactor(e){return this.reactors.has(e)}destroy(){var e,t;(e=this.room)==null||e.callbacks.off("onPhaseChanged",this.onPhaseChanged),(t=this.room)==null||t.removeMagixEventListener(Lt,this.onReconnected),this.releaseDisposers()}}const jn=(i,e)=>{if(f.isPlayer(i))kn(i);else{if(i=i,Object.getOwnPropertyDescriptor(i,"disableCameraTransform"))return;Object.defineProperty(i,"disableCameraTransform",{get(){return e.mainView.disableCameraTransform},set(n){e.mainView.disableCameraTransform=n}}),Object.defineProperty(i,"canUndoSteps",{get(){return e.canUndoSteps}}),Object.defineProperty(i,"canRedoSteps",{get(){return e.canRedoSteps}});const s=i.scalePptToFit;i.scalePptToFit=(...n)=>{var a;s.call(i,...n),(a=e.appManager)!=null&&a.mainViewProxy&&e.appManager.mainViewProxy.setCameraAndSize()};const r=i.putScenes;i.putScenes=(...n)=>{const[a,o]=n,h=e.mainView.focusScenePath;if(h&&a&&o){console.log("[window-manager] putScenes "+JSON.stringify(n));for(const c of o)if(`${a}${c.name}`===h){console.error(`[window-manager] putScenes: scene name can not be the same as the current scene path: ${h}`);return}}return r.call(i,...n)},i.moveCamera=n=>e.moveCamera(n),i.moveCameraToContain=(...n)=>e.moveCameraToContain(...n),i.convertToPointInWorld=(...n)=>e.mainView.convertToPointInWorld(...n),i.setCameraBound=(...n)=>e.mainView.setCameraBound(...n),i.scenePreview=(...n)=>e.mainView.scenePreview(...n),i.fillSceneSnapshot=(...n)=>e.mainView.fillSceneSnapshot(...n),i.generateScreenshot=(...n)=>e.mainView.generateScreenshot(...n),i.setMemberState=(...n)=>e.mainView.setMemberState(...n),i.redo=()=>e.redo(),i.undo=()=>e.undo(),i.cleanCurrentScene=()=>e.cleanCurrentScene(),i.delete=()=>e.delete(),i.copy=()=>e.copy(),i.paste=()=>e.paste(),i.duplicate=()=>e.duplicate(),i.insertImage=(...n)=>e.insertImage(...n),i.completeImageUpload=(...n)=>e.completeImageUpload(...n),i.insertText=(...n)=>e.insertText(...n),i.lockImage=(...n)=>e.lockImage(...n),i.lockImages=(...n)=>e.lockImages(...n),Rn(i,e)}},Rn=(i,e)=>{const t=i.removeScenes;i.removeScenes=(s,r)=>{var a;s===q&&((a=e.appManager)==null||a.updateRootDirRemoving(!0));const n=t.call(i,s);return A.emit("removeScenes",{scenePath:s,index:r}),n}},kn=i=>{const e=i.seekToProgressTime;async function t(s){await A.emit("seekStart");const r=await e.call(i,s);return A.emit("seek",s),r}i.seekToProgressTime=t},Un=async()=>{const i=await Promise.resolve().then(function(){return require("./app-media-player.js")});return P.debug&&i.setOptions({verbose:!0}),i.default||i},_n=async()=>{const i=await Promise.resolve().then(function(){return require("./app-docs-viewer.js")});return i.default||i},On=async()=>{const i=await Promise.resolve().then(function(){return require("./app-presentation.js")}),e=i.default||i;return e.default||e.NetlessAppPresentation||e},Wn=()=>{P.register({kind:de.DocsViewer,src:_n}),P.register({kind:de.MediaPlayer,src:Un}),P.register({kind:de.Presentation,src:On,appOptions:{debounceSync:!0,useScrollbar:!0}})},de={DocsViewer:"DocsViewer",MediaPlayer:"MediaPlayer",Presentation:"Presentation"};const me={Ready:"Ready",RootRect:"ReplayRootRect",Message:"message",ComputeStyle:"computeStyle",Load:"load",DisplayerState:"displayerState",Show:"show",Hide:"hide"},$n=(i,e)=>new Array(i).fill(0).map((t,s)=>e(s)),j=class{constructor(i,e){this.manager=i,this.appManager=e,this.magixEventMap=new Map,this.cssList=[],this.allowAppliances=["clicker"],this.bridgeDisposer=w.noop,this.rootRect=null,this.sideEffectManager=new Ke,this.execListenIframe=w.debounce(t=>{this.listenIframe(t)},50),this.onPhaseChangedListener=t=>{t===f.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay()},this.stateChangeListener=t=>{t={...t},t.cameraState=this.manager.cameraState,this.postMessage({kind:"RoomStateChanged",payload:t}),t.cameraState&&(j.emitter.emit("GetRootRect"),this.computedStyle(t)),t.memberState&&(this.computedZindex(),this.updateStyle()),t.sceneState&&this.computedIframeDisplay(t,this.attributes)},this.displayer=j.displayer=e.displayer,this.iframe=this._createIframe(),this.sideEffectManager.addDisposer(j.emitter.on("ReplayRootRect",t=>{this.rootRect=t}),me.RootRect),this.sideEffectManager.addDisposer(j.emitter.on("HideIframe",()=>{this.iframe.className=j.hiddenClass}),me.Hide),this.sideEffectManager.addDisposer(j.emitter.on("DispayIframe",()=>{this.iframe.className=""}),me.Show),this.sideEffectManager.addDisposer(j.emitter.on("created",()=>{this.bridgeDisposer(),this.bridgeDisposer=f.autorun(()=>{var s;const t=this.attributes;if(t.url){const r=(s=this.iframe)==null?void 0:s.src;r&&r!==t.url&&this.execListenIframe(t)}t.displaySceneDir&&this.computedIframeDisplay(this.displayer.state,t),(t.width||t.height)&&this.iframe&&(this.iframe.width=`${t.width}px`,this.iframe.height=`${t.height}px`),this.postMessage({kind:"AttributesUpdate",payload:t})})})),this.sideEffectManager.addDisposer(i.emitter.on("cameraStateChange",()=>{this.computedStyle(this.displayer.state)})),j.onCreate(this)}static onCreate(i){j.emitter.emit("StartCreate"),j.emitter.emit("OnCreate",i),j.emitter.emit("created")}insert(i){const e={url:i.url,width:i.width,height:i.height,displaySceneDir:i.displaySceneDir,useClicker:i.useClicker||!1,useSelector:i.useSelector};this.setAttributes(e);const t=()=>{this.getIframe(),this.listenIframe(this.attributes),this.listenDisplayerState(),j.emitter.emit("GetRootRect")};if(this.getIframe())t();else{const s=this.sideEffectManager.addDisposer(j.emitter.on("WrapperDidMount",()=>{t(),this.sideEffectManager.flush(s)})),r=this.sideEffectManager.addDisposer(j.emitter.on("WrapperDidUpdate",()=>{t(),this.sideEffectManager.flush(r)}))}return this.attributes.useSelector&&this.allowAppliances.push("selector"),this.computedStyle(this.displayer.state),this.listenDisplayerCallbacks(),this.getComputedIframeStyle(),this.sideEffectManager.addEventListener(window,"message",this.messageListener.bind(this),void 0,me.Message),j.alreadyCreate=!0,this}getComputedIframeStyle(){this.sideEffectManager.setTimeout(()=>{this.iframe&&getComputedStyle(this.iframe)},200,me.ComputeStyle)}destroy(){this.sideEffectManager.flushAll(),j.emitter.emit("Destory"),j.alreadyCreate=!1,j.emitter.clearListeners()}getIframe(){return this.iframe||(this.iframe=this._createIframe()),this.iframe}setIframeSize(i){this.iframe&&(this.iframe.width=`${i.width}px`,this.iframe.height=`${i.height}px`,this.setAttributes({width:i.width,height:i.height}))}get attributes(){return this.appManager.store.getIframeBridge()}setAttributes(i){this.appManager.store.setIframeBridge(i)}_createIframe(){const i=document.createElement("iframe");return i.id="IframeBridge",i.className=j.hiddenClass,this.appManager.mainView.divElement&&this.appManager.mainView.divElement.appendChild(i),i}scaleIframeToFit(i=f.AnimationMode.Immediately){if(!this.inDisplaySceneDir)return;const{width:e=1280,height:t=720}=this.attributes,s=e?-e/2:0,r=t?-t/2:0;this.manager.moveCameraToContain({originX:s,originY:r,width:e,height:t,animationMode:i})}get isReplay(){return this.manager.isReplay}handleSetPage(i){if(this.isReplay||!this.attributes.displaySceneDir)return;const e=i.payload,t=this.displayer,s=t.entireScenes()[this.attributes.displaySceneDir];if(!s||s.length!==e){const r=$n(e,n=>({name:String(n+1)}));t.putScenes(this.attributes.displaySceneDir,r),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}listenIframe(i){const e=t=>{var s;this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:(s=j.displayer)==null?void 0:s.state,currentPage:this.currentPage,observerId:this.displayer.observerId}}),j.emitter.emit("IframeLoad",t),this.sideEffectManager.addDisposer(j.emitter.on("Ready",()=>{var r;this.postMessage((r=this.attributes.lastEvent)==null?void 0:r.payload)}),me.Ready),this.computedStyleAndIframeDisplay()};i.url&&this.iframe.src!==i.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=i.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=i.url)),this.iframe.width=`${i.width}px`,this.iframe.height=`${i.height}px`,this.sideEffectManager.addEventListener(this.iframe,"load",e,void 0,me.Load)}listenDisplayerState(){this.isReplay&&(this.displayer._phase===f.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add(()=>(this.displayer.callbacks.on("onPhaseChanged",this.onPhaseChangedListener),()=>this.displayer.callbacks.off("onPhaseChanged",this.onPhaseChangedListener)),me.DisplayerState)),this.computedStyleAndIframeDisplay()}computedStyleAndIframeDisplay(){this.computedStyle(this.displayer.state),this.computedIframeDisplay(this.displayer.state,this.attributes)}listenDisplayerCallbacks(){this.displayer.callbacks.on(this.callbackName,this.stateChangeListener)}get callbackName(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}computedStyle(i){const e=this.manager.cameraState,t=this.attributes.width||1280,s=this.attributes.height||720;if(this.iframe){const{width:r,height:n,scale:a,centerX:o,centerY:h}=e,c=this.rootRect||{x:0,y:0},l=`${r/2+c.x}px`,u=`${n/2+c.y}px`,d=`transform-origin: ${l} ${u};`,m=(r-t)/2*a,g=(n-s)/2*a,b=-(o*a)+m,M=-(h*a)+g,N=`transform: translate(${b}px,${M}px) scale(${a}, ${a});`,W=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;",d,N];this.cssList=W,this.computedZindex(),this.updateStyle()}}computedIframeDisplay(i,e){this.inDisplaySceneDir?j.emitter.emit("DispayIframe"):j.emitter.emit("HideIframe")}computedZindex(){const i="z-index: -1;",e=this.cssList.findIndex(t=>t===i);e!==-1&&this.cssList.splice(e,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(i)}updateStyle(){this.iframe.style.cssText=this.cssList.join(" ")}get iframeOrigin(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(i){console.warn(i)}}messageListener(i){if(re("<<<",JSON.stringify(i.data)),i.origin!==this.iframeOrigin)return;const e=i.data;switch(e.kind){case"SetAttributes":{this.handleSetAttributes(e);break}case"RegisterMagixEvent":{this.handleRegisterMagixEvent(e);break}case"RemoveMagixEvent":{this.handleRemoveMagixEvent(e);break}case"DispatchMagixEvent":{this.handleDispatchMagixEvent(e);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(e);break}case"GetAttributes":{this.handleGetAttributes();break}case"PageTo":{this.handlePageTo(e);break}default:{re(`${e.kind} not allow event.`);break}}}handleSDKCreate(){this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:this.displayer.state,currentPage:this.currentPage,observerId:this.displayer.observerId}})}handleDispatchMagixEvent(i){const e=i.payload;this.appManager.safeDispatchMagixEvent(e.event,e.payload)}handleSetAttributes(i){this.setAttributes(i.payload)}handleRegisterMagixEvent(i){const e=i.payload,t=s=>{s.authorId!==this.displayer.observerId&&this.postMessage({kind:"ReciveMagixEvent",payload:s})};this.magixEventMap.set(e,t),this.displayer.addMagixEventListener(e,t)}handleRemoveMagixEvent(i){const e=i.payload,t=this.magixEventMap.get(e);this.displayer.removeMagixEventListener(e,t)}handleNextPage(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}handlePrevPage(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}handlePageTo(i){if(this.manager.canOperate){const e=i.payload;if(!Number.isSafeInteger(e)||e<=0)return;this.manager.setMainViewSceneIndex(e-1),this.dispatchMagixEvent("PageTo",e-1)}}handleRemoveAllMagixEvent(){this.magixEventMap.forEach((i,e)=>{this.displayer.removeMagixEventListener(e,i)}),this.magixEventMap.clear()}handleGetAttributes(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}postMessage(i){var e;this.iframe&&((e=this.iframe.contentWindow)==null||e.postMessage(JSON.parse(JSON.stringify(i)),"*"))}dispatchMagixEvent(i,e){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:i,payload:e}}),this.displayer.dispatchMagixEvent(i,e))}get currentIndex(){return this.manager.mainViewSceneIndex}get currentPage(){return this.currentIndex+1}get totalPage(){return this.manager.mainViewScenesLength}get readonly(){return!this.displayer.isWritable}get inDisplaySceneDir(){return this.manager.mainViewSceneDir===this.attributes.displaySceneDir}isClicker(){if(this.readonly)return!1;const i=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(i)}get isDisableInput(){return"disableDeviceInputs"in this.displayer?this.displayer.disableDeviceInputs:!0}};let Ee=j;Ee.kind="IframeBridge";Ee.hiddenClass="netless-iframe-brdige-hidden";Ee.emitter=new ve.default;Ee.displayer=null;Ee.alreadyCreate=!1;class Zn extends ve.default{_inject(e){this.context=e}}class $s{constructor(e){this.extends=new Map,this.context={manager:this,windowManager:e.windowManager,internalEmitter:e.internalEmitter},e.container&&this.refreshContainer(e.container)}refreshContainer(e){this.context.windowManagerContainer=e,this.extends.forEach(t=>{t._inject(this.context)})}hasRegister(e){return J.appClasses.has(e)}use(e){this.extends.set(e.kind,e),e._inject(this.context),e.onCreate()}destroy(){this.extends.forEach(e=>{this.extends.delete(e.kind),e.onDestroy()})}}function Fn(i,e){return e===void 0?i:()=>({...typeof i=="function"?i():i,...e})}function Gn(i,e){if(i.kind&&e&&Object.keys(e).includes(i.kind))switch(i.kind){case"AppManager":return(e==null?void 0:e.AppManager)||ot;case"BoxManager":return(e==null?void 0:e.BoxManager)||it;case"AttributesDelegate":return(e==null?void 0:e.AttributesDelegate)||at;case"CursorManager":return(e==null?void 0:e.CursorManager)||rt;case"AppProxy":return(e==null?void 0:e.AppProxy)||nt;case"AppContext":return(e==null?void 0:e.AppContext)||qe;case"TeleBoxManager":return(e==null?void 0:e.TeleBoxManager)||tt;case"TeleBoxCollector":return(e==null?void 0:e.TeleBoxCollector)||Le;default:return i}return i}const Zt="Slide",Ft=de.Presentation,Qn=1,Yn=4;function qi(i){return typeof i=="number"&&Number.isFinite(i)&&i>=Qn&&i<=Yn}const Zs=new Vn({emitter:A}),C=class extends f.InvisiblePlugin{constructor(i){super(i),this.version="1.0.17-beta.1",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.55"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@netless/app-presentation":"^0.1.9","@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.30","@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","side-effect-manager":"0.1.5",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.9.9",vitest:"^0.14.1","white-web-sdk":"^2.16.55"}},this.emitter=L,this.viewMode=f.ViewMode.Broadcaster,this.isReplay=f.isPlayer(this.displayer),this._cursorUIDs=[],this.containerSizeRatio=C.containerSizeRatio,this.onMainViewScenePathChangeHandler=e=>{const t=this.mainView.divElement;if(t){const s=t.querySelector(".background img");if(s){const r=s==null?void 0:s.getBoundingClientRect(),n=window.getComputedStyle(s),a=(r==null?void 0:r.width)>0&&(r==null?void 0:r.height)>0&&n.display!=="none",o=this.mainView.camera;console.log("[window-manager] backgroundImageVisible:"+a+" camera:"+JSON.stringify(o));return}console.log("[window-manager] onMainViewScenePathChange scenePath:"+e+" backgroundImageVisible is not found");return}console.log("[window-manager] onMainViewScenePathChange scenePath:"+e+" mainViewElement is not found")},C.displayer=i.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1",uuid:"^7.0.3","video.js":">=7"},peerDependencies:{jspdf:"2.5.1","white-web-sdk":"^2.16.55"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@netless/app-presentation":"^0.1.9","@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.30","@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","side-effect-manager":"0.1.5",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.9.9",vitest:"^0.14.1","white-web-sdk":"^2.16.55"}},this.emitter.on("mainViewScenePathChange",this.onMainViewScenePathChangeHandler)}get Logger(){return this._roomLogger}static onCreate(i){C._resolve(i)}static async mount(i,e){var c;const t=i.room;C.container=i.container,C.supportAppliancePlugin=i.supportAppliancePlugin;const s=i.containerSizeRatio,r=i.debug,n=i.cursor;C.params=i,C.extendClass=e,C.displayer=i.room,Qa();let a;if(f.isRoom(t)){if(t.phase!==f.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");t.phase===f.RoomPhase.Connected&&t.isWritable&&(t.disableSerialization=!1),a=await this.initManager(t),a&&(a._roomLogger=t.logger,a.attributesDeboundceLog=new Fa(a._roomLogger,"attributes",300),C.registered.size>0&&a._roomLogger.info(`[WindowManager] registered apps: ${JSON.stringify(Array.from(C.registered.keys()))}`))}if(C.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(r),a!=null&&a._roomLogger?a._roomLogger.info(`[WindowManager] Already insert room version: ${a.version}`):re("Already insert room",a),f.isRoom(this.displayer)){if(!a)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await ts.default(async l=>{if(a=t.getInvisiblePlugin(C.kind),!a)throw re(`manager is empty. retrying ${l}`),new Error},{retries:10,maxTimeout:5e3});if(!a)throw new Error("[WindowManager]: create manager failed");a.builtinAppOptions=i.builtinAppOptions,s&&(C.containerSizeRatio=s),await a.ensureAttributes();const o=ge(ot,C.extendClass),h=ge(rt,C.extendClass);a._fullscreen=i.fullscreen,a.appManager=new o(a),a.appManager.polling=i.polling||!1,a._pageState=new En(a.appManager),a.cursorManager=new h(a.appManager,Boolean(n),i.cursorOptions,i.applianceIcons),a.extendPluginManager=new $s({internalEmitter:A,windowManager:a}),s&&(a.containerSizeRatio=s),i.container&&a.bindContainer(i.container),jn(t,a),A.emit("onCreated"),C.isCreated=!0,a._roomLogger&&a.attributes.registered&&Object.keys(a.attributes.registered).length>0&&a._roomLogger.info(`[WindowManager] attributes registered apps: ${JSON.stringify(Array.from(Object.keys(a.attributes.registered)))}`);try{await cr()}catch(l){(c=a._roomLogger)==null||c.warn(`[WindowManager] indexedDB open failed: ${l.message}`),console.warn("[WindowManager]: indexedDB open failed"),console.log(l)}return a.emitter.on("mainViewScenePathChange",a.onMainViewScenePathChangeHandler),a}static initManager(i){return Ya(i)}static initContainer(i,e,t){const{chessboard:s,overwriteStyles:r,fullscreen:n}=t;C.container||(C.container=e);const{playground:a,wrapper:o,sizer:h,mainViewElement:c}=Ga(e);if(C.playground=a,s&&h.classList.add("netless-window-manager-chess-sizer"),n&&h.classList.add("netless-window-manager-fullscreen"),r){const l=document.createElement("style");l.textContent=r,a.appendChild(l)}return i.containerResizeObserver=Si.create(a,h,o,A),C.wrapper=o,C.sizer=h,c}static get registered(){return J.registered}bindContainer(i){var e,t,s,r,n,a;if(f.isRoom(this.displayer)&&this.room.phase!==f.RoomPhase.Connected)throw new ds;if(C.isCreated&&C.container)C.container.firstChild&&i.appendChild(C.container.firstChild);else if(C.params){const o=C.params,h=C.initContainer(this,i,o);this.boxManager&&this.boxManager.destroy();const c=Oa(this,L,A,ce,{collectorContainer:o.collectorContainer,collectorStyles:o.collectorStyles,prefersColorScheme:o.prefersColorScheme,useBoxesStatus:o.useBoxesStatus});this.boxManager=c,this.appManager&&(this.appManager.useBoxesStatus=o.useBoxesStatus||!1,this.appManager.setBoxManager(c)),this.bindMainView(h,o.disableCameraTransform),C.wrapper&&((e=this.cursorManager)==null||e.setupWrapper(C.wrapper))}A.emit("updateManagerRect"),(t=this.appManager)==null||t.refresh(),(s=this.appManager)==null||s.resetMaximized(),(r=this.appManager)==null||r.resetMinimized(),(n=this.appManager)==null||n.displayerWritableListener(!this.room.isWritable),C.container=i,(a=this.extendPluginManager)==null||a.refreshContainer(i)}bindCollectorContainer(i){C.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(i):C.params&&(C.params.collectorContainer=i)}static register(i){return J.register(i)}static unregister(i){return J.unregister(i)}resolveAppOptions(i,e){var s;const t=i===de.Presentation?(s=this.builtinAppOptions)==null?void 0:s.Presentation:void 0;return Fn(e,t)}async addApp(i){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((e,t)=>{A.once("rootDirRemoved").then(async()=>{try{const s=await this._addApp(i);e(s)}catch(s){t(s.message)}})}):this._addApp(i);throw new te}async _addApp(i){var e,t,s;if(this.appManager){if(!i.kind||typeof i.kind!="string")throw new hs;i.src&&typeof i.src=="string"&&J.register({kind:i.kind,src:i.src});const r=await((e=J.appClasses.get(i.kind))==null?void 0:e());if(r&&((t=r.config)==null?void 0:t.singleton)&&this.appManager.appProxies.has(i.kind))throw new ns;const n=this.setupScenePath(i,this.appManager);return n===void 0?void 0:((s=i==null?void 0:i.options)!=null&&s.scenePath&&(i.options.scenePath=Br(i.options.scenePath)),await this.appManager.addApp(i,Boolean(n)))}else throw new te}setupScenePath(i,e){let t=!1;if(i.options){const{scenePath:s,scenes:r}=i.options;if(s){if(!Ar(s))throw new ls;const n=Object.keys(this.apps||{});for(const a of n){const o=e.store.getAppScenePath(a);if(o&&o===s){if(console.warn(`[WindowManager]: ScenePath "${s}" already opened`),this.boxManager){const h=this.boxManager.getTopBox();h&&(this.boxManager.setZIndex(a,h.zIndex+1,!1),this.boxManager.focusBox({appId:a},!1))}return}}}s&&r&&r.length>0&&(this.isDynamicPPT(r)?(t=!0,Pe(this.displayer)[s]||$e(this.room,s,r)):Pe(this.displayer)[s]||$e(this.room,s,[{name:r[0].name}])),s&&r===void 0&&$e(this.room,s,[{}])}return t}async setMainViewScenePath(i){this.appManager&&await this.appManager.setMainViewScenePath(i)}async setMainViewSceneIndex(i){this.appManager&&await this.appManager.setMainViewSceneIndex(i)}async nextPage(){if(this.appManager){const i=this.mainViewSceneIndex+1;return i>=this.mainViewScenesLength?(console.warn("[WindowManager]: current page is the last page"),!1):(await this.appManager.setMainViewSceneIndex(i),!0)}else return!1}async prevPage(){if(this.appManager){const i=this.mainViewSceneIndex-1;return i<0?(console.warn("[WindowManager]: current page is the first page"),!1):(await this.appManager.setMainViewSceneIndex(i),!0)}else return!1}async jumpPage(i){return this.appManager?i<0||i>=this.pageState.length?(console.warn(`[WindowManager]: index ${i} out of range`),!1):(await this.appManager.setMainViewSceneIndex(i),!0):!1}async addPage(i){if(this.appManager){const e=i==null?void 0:i.after,t=i==null?void 0:i.scene;if(e){const s=this.mainViewSceneIndex+1;this.room.putScenes(q,[t||{}],s)}else this.room.putScenes(q,[t||{}])}}async removePage(i){if(this.appManager){const e=i===void 0?this.pageState.index:i;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):e<0||e>=this.pageState.length?(console.warn(`[WindowManager]: index ${i} out of range`),!1):this.appManager.removeSceneByIndex(e)}else return!1}getMainViewScenePath(){var i;return(i=this.appManager)==null?void 0:i.store.getMainViewScenePath()}getMainViewSceneIndex(){var i;return(i=this.appManager)==null?void 0:i.store.getMainViewSceneIndex()}setReadonly(i){var e;this.readonly=i,(e=this.boxManager)==null||e.setReadonly(i),A.emit("setReadonly",i)}switchMainViewToWriter(){var i;return(i=this.appManager)==null?void 0:i.mainViewProxy.mainViewClickHandler()}onAppDestroy(i,e){yr(`destroy-${i}`,e)}onAppEvent(i,e){return A.on(`custom-${i}`,e)}setViewMode(i){var e,t,s,r;(i===f.ViewMode.Broadcaster||i===f.ViewMode.Follower)&&(this.canOperate&&i===f.ViewMode.Broadcaster&&((e=this.appManager)==null||e.mainViewProxy.setCameraAndSize()),(t=this.appManager)==null||t.mainViewProxy.start()),i===f.ViewMode.Freedom&&((s=this.appManager)==null||s.mainViewProxy.stop()),this.viewMode=i,(r=this.appManager)==null||r.mainViewProxy.setViewMode(i)}setBoxState(i){if(!!this.canOperate)switch(i){case"normal":this.setMaximized(!1),this.setMinimized(!1);break;case"maximized":this.setMaximized(!0),this.setMinimized(!1);break;case"minimized":this.setMinimized(!0);break}}setMaximized(i){var e;!this.canOperate||(e=this.boxManager)==null||e.setMaximized(i,!1)}setMinimized(i){var e;!this.canOperate||(e=this.boxManager)==null||e.setMinimized(i,!1)}setBoxStatus(i,e){var t;!this.canOperate||(t=this.appManager)==null||t.store.setBoxStatus(i,e)}setLastNotMinimizedBoxStatus(i,e){var t;!this.canOperate||(t=this.appManager)==null||t.store.setLastNotMinimizedBoxStatus(i,e)}setFullscreen(i){var e;this._fullscreen!==i&&(this._fullscreen=i,(e=C.sizer)==null||e.classList.toggle("netless-window-manager-fullscreen",i),L.emit("fullscreenChange",i))}get cursorUIDs(){return this._cursorUIDs}setCursorUIDs(i){var e,t;if(this._cursorUIDs=i||[],this._cursorUIDs.length===0)(e=this._cursorUIDsStyleDOM)==null||e.remove();else{this._cursorUIDsStyleDOM||(this._cursorUIDsStyleDOM=document.createElement("style")),(t=C.playground)==null||t.appendChild(this._cursorUIDsStyleDOM);let s="[data-cursor-uid] { display: none }";for(const r of this._cursorUIDs)s+=`
|
|
17
|
+
[data-cursor-uid="${r}"] { display: flex }`;this._cursorUIDsStyleDOM.textContent=s}}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new te}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new te}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new te}get apps(){var i;return(i=this.appManager)==null?void 0:i.store.apps()}get boxState(){var i;if(this.appManager)return(i=this.appManager.boxManager)==null?void 0:i.boxState;throw new te}get boxStatus(){if(this.appManager)return this.appManager.store.getBoxesStatus();throw new te}get lastNotMinimizedBoxStatus(){if(this.appManager)return this.appManager.store.getLastNotMinimizedBoxesStatus();throw new te}get darkMode(){var i,e;return Boolean((e=(i=this.appManager)==null?void 0:i.boxManager)==null?void 0:e.darkMode)}get prefersColorScheme(){var i;if(this.appManager)return(i=this.appManager.boxManager)==null?void 0:i.prefersColorScheme;throw new te}get focused(){return this.attributes.focus}get focusedView(){var i,e;return((e=(i=this.appManager)==null?void 0:i.focusApp)==null?void 0:e.view)||this.mainView}get polling(){var i;return((i=this.appManager)==null?void 0:i.polling)||!1}set polling(i){this.appManager&&(this.appManager.polling=i)}get cursorStyle(){var i;return((i=this.cursorManager)==null?void 0:i.style)||"default"}set cursorStyle(i){if(!this.cursorManager)throw new Error("[WindowManager]: cursor is not enabled, please set { cursor: true }.");this.cursorManager.style=i}get mainViewSceneIndex(){var i;return((i=this._pageState)==null?void 0:i.index)||0}get mainViewSceneDir(){var i;if(this.appManager)return(i=this.appManager)==null?void 0:i.getMainViewSceneDir();throw new te}get topApp(){var i,e;return(e=(i=this.boxManager)==null?void 0:i.getTopBox())==null?void 0:e.id}get mainViewScenesLength(){var i;return((i=this._pageState)==null?void 0:i.length)||0}get canRedoSteps(){var i;return((i=this.focusedView)==null?void 0:i.canRedoSteps)||0}get canUndoSteps(){var i;return((i=this.focusedView)==null?void 0:i.canUndoSteps)||0}get sceneState(){if(this.appManager)return this.appManager.sceneState;throw new te}get pageState(){if(this._pageState)return this._pageState.toObject();throw new te}get fullscreen(){return Boolean(this._fullscreen)}queryAll(){var i;return Array.from(((i=this.appManager)==null?void 0:i.appProxies.values())||[])}queryOne(i){var e;return(e=this.appManager)==null?void 0:e.appProxies.get(i)}dispatchDocsEvent(i,e={}){var u;const t=e.appId||this.focused;if(!t)return console.warn("not found "+(e.appId||"focused app")),!1;const s=this.queryOne(t);if(!s)return console.warn("not found app with id "+t),!1;const r=t.startsWith(`${de.DocsViewer}-`)||s.kind===de.DocsViewer,n=t.startsWith(`${Ft}-`)||s.kind===Ft,a=t.startsWith(`${Zt}-`)||s.kind===Zt;let o=s.kind;if(r?o=de.DocsViewer:n?o=Ft:a&&(o=Zt),!C.registered.has(o))return console.warn("not registered app kind "+o),!1;let h,c,l;if(r){const d=(u=s.box)==null?void 0:u.$footer;if(!d)return console.warn("not found app with id "+t),!1;const m=g=>{g&&g.dispatchEvent(new MouseEvent("click"))};switch(i){case"prevPage":case"prevStep":m(d.querySelector('button[class$="btn-page-back"]'));break;case"nextPage":case"nextStep":m(d.querySelector('button[class$="btn-page-next"]'));break;case"jumpToPage":if(h=e.page,c=d.querySelector('input[class$="page-number-input"]'),!c||typeof h!="number")return console.warn("failed to jump"+(h?" to page "+h:"")),!1;c.value=""+h,c.dispatchEvent(new InputEvent("change"));break;case"scalePage":return console.warn("not supported event "+i+" for app kind "+o),!1;default:return console.warn("unknown event "+i),!1}return!0}if(n){const d=s.appResult;if(!d)return console.warn("not found app with id "+t),!1;switch(i){case"prevPage":case"prevStep":return d.prevPage();case"nextPage":case"nextStep":return d.nextPage();case"jumpToPage":return h=e.page,typeof h!="number"?(console.warn("failed to jump"+(h?" to page "+h:"")),!1):d.jumpPage(h-1);case"scalePage":if(l=e.scale,!qi(l))return console.warn("failed to scale, scale should be a number from 1 to 4"),!1;try{return d.moveCamera({centerX:0,centerY:0,scale:d.getOriginScale()*l}),!0}catch(m){return console.warn(m),!1}default:return console.warn("unknown event "+i),!1}}if(a){const d=s.appResult;if(!d)return console.warn("not found app with id "+t),!1;switch(i){case"prevPage":return d.prevPage();case"nextPage":return d.nextPage();case"prevStep":return d.prevStep();case"nextStep":return d.nextStep();case"jumpToPage":return h=e.page,typeof h!="number"?(console.warn("failed to jump"+(h?" to page "+h:"")),!1):d.jumpToPage(h);case"scalePage":return l=e.scale,qi(l)?(d.scaleView(l),!0):(console.warn("failed to scale, scale should be a number from 1 to 4"),!1);default:return console.warn("unknown event "+i),!1}}return console.warn("not supported app kind "+s.kind),!1}async closeApp(i){var e;return(e=this.appManager)==null?void 0:e.closeApp(i)}focusApp(i){var t,s,r;const e=(t=this.boxManager)==null?void 0:t.getBox(i);e&&((s=this.boxManager)==null||s.focusBox({appId:i},!1),((r=this.boxManager)==null?void 0:r.teleBoxManager).makeBoxTop(e,!1))}moveCamera(i){const e=w.omit(i,["animationMode"]),t={...this.mainView.camera};w.isEqual({...t,...e},t)||(this.mainView.moveCamera(i),setTimeout(()=>{var s;(s=this.appManager)==null||s.mainViewProxy.setCameraAndSize()},500))}moveCameraToContain(i){this.mainView.moveCameraToContain(i),setTimeout(()=>{var e;(e=this.appManager)==null||e.mainViewProxy.setCameraAndSize()},500)}convertToPointInWorld(i){return this.mainView.convertToPointInWorld(i)}setCameraBound(i){this.mainView.setCameraBound(i)}onDestroy(){this._destroy()}destroy(){this._destroy()}_destroy(){var i,e,t,s,r,n,a;(i=this.attributesDeboundceLog)==null||i.destroy(),this.attributesDeboundceLog=void 0,(e=this.containerResizeObserver)==null||e.disconnect(),(t=this.appManager)==null||t.destroy(),(s=this.cursorManager)==null||s.destroy(),(r=this.extendPluginManager)==null||r.destroy(),C.container=void 0,C.wrapper=void 0,C.sizer=void 0,C.isCreated=!1,C.playground&&((n=C.playground.parentNode)==null||n.removeChild(C.playground)),C.params=void 0,this.emitter.off("mainViewScenePathChange",this.onMainViewScenePathChangeHandler),(a=this._iframeBridge)==null||a.destroy(),this._iframeBridge=void 0,re("Destroyed")}bindMainView(i,e){var t;this.appManager&&(this.appManager.bindMainView(i,Boolean(e)),(t=this.cursorManager)==null||t.setMainViewDivElement(i))}get canOperate(){return f.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===f.RoomPhase.Connected:!1}get room(){return this.displayer}safeSetAttributes(i){this.canOperate&&(this.setAttributes(i),this.attributesDeboundceLog&&this.attributesDeboundceLog.logDebouncedShallowMerge("safeSetAttributes",i))}safeUpdateAttributes(i,e){this.canOperate&&(this.updateAttributes(i,e),this.attributesDeboundceLog&&this.attributesDeboundceLog.logDebouncedUpdateAttributes(i,e))}setPrefersColorScheme(i){var e,t;(t=(e=this.appManager)==null?void 0:e.boxManager)==null||t.setPrefersColorScheme(i)}cleanCurrentScene(){var i,e;re("clean current scene"),(i=this.focusedView)==null||i.cleanCurrentScene(),this.Logger&&this.Logger.info(`[WindowManager]: cleanCurrentScene ${(e=this.focusedView)==null?void 0:e.focusScenePath}`)}redo(){var i;return((i=this.focusedView)==null?void 0:i.redo())||0}undo(){var i;return((i=this.focusedView)==null?void 0:i.undo())||0}delete(){var i,e;(i=this.focusedView)==null||i.delete(),this.Logger&&this.Logger.info(`[WindowManager]: delete ${(e=this.focusedView)==null?void 0:e.focusScenePath}`)}copy(){var i;(i=this.focusedView)==null||i.copy()}paste(){var i;(i=this.focusedView)==null||i.paste()}duplicate(){var i;(i=this.focusedView)==null||i.duplicate()}insertText(i,e,t){var s;return((s=this.focusedView)==null?void 0:s.insertText(i,e,t))||""}insertImage(i){var e;return(e=this.focusedView)==null?void 0:e.insertImage(i)}completeImageUpload(i,e){var t;return(t=this.focusedView)==null?void 0:t.completeImageUpload(i,e)}lockImage(i,e){var t;return(t=this.focusedView)==null?void 0:t.lockImage(i,e)}lockImages(i){var e;return(e=this.focusedView)==null?void 0:e.lockImages(i)}refresh(){var i;this._refresh(),(i=this.appManager)==null||i.dispatchInternalEvent(R.Refresh)}_refresh(){var i,e;(i=this.appManager)==null||i.mainViewProxy.rebind(),C.container&&this.bindContainer(C.container),(e=this.appManager)==null||e.refresher.refresh()}setContainerSizeRatio(i){if(!w.isNumber(i)||!(i>0))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a positive number. but got ${i}`);C.containerSizeRatio=i,this.containerSizeRatio=i,A.emit("containerSizeRatioUpdate",i)}isDynamicPPT(i){var t,s;const e=(s=(t=i[0])==null?void 0:t.ppt)==null?void 0:s.src;return e==null?void 0:e.startsWith("pptx://")}async ensureAttributes(){w.isNull(this.attributes)&&await as(50),w.isObject(this.attributes)&&(this.attributes[Q.Apps]||this.safeSetAttributes({[Q.Apps]:{}}),this.attributes[Q.Cursors]||this.safeSetAttributes({[Q.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:ss}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[Q.Registered]||this.safeSetAttributes({[Q.Registered]:{}}),this.attributes[Q.IframeBridge]||this.safeSetAttributes({[Q.IframeBridge]:{}}))}getIframeBridge(){if(!this.appManager)throw new Error("[WindowManager]: should call getIframeBridge() after await mount()");return this._iframeBridge||(this._iframeBridge=new Ee(this,this.appManager)),this._iframeBridge}useExtendPlugin(i){var e;(e=this.extendPluginManager)==null||e.use(i)}};let P=C;P.kind="WindowManager";P.debug=!1;P.containerSizeRatio=nr;P.isCreated=!1;P._resolve=i=>{};Wn();exports.AppContext=qe;exports.AppCreateError=ns;exports.AppManager=ot;exports.AppManagerNotInitError=te;exports.AppNotRegisterError=Dr;exports.AppProxy=nt;exports.AttributesDelegate=at;exports.BindContainerRoomPhaseInvalidError=ds;exports.BoxManager=it;exports.BoxManagerNotFoundError=us;exports.BoxNotCreatedError=cs;exports.BuiltinApps=de;exports.CursorManager=rt;exports.ExtendPlugin=Zn;exports.ExtendPluginManager=$s;exports.InvalidScenePath=ls;exports.ParamsInvalidError=hs;exports.TeleBoxCollector=Le;exports.TeleBoxManager=tt;exports.WhiteWebSDKInvalidError=os;exports.WindowManager=P;exports.calculateNextIndex=xi;exports.getExtendClass=Gn;exports.reconnectRefresher=Zs;
|
|
68
18
|
//# sourceMappingURL=index.js.map
|