@netless/window-manager 1.0.7-beta.6 → 1.0.7-beta.7

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Ag=require("p-retry"),Tg=require("emittery"),T=require("lodash"),b=require("white-web-sdk"),Eg=require("uuid"),Ng=require("@juggle/resize-observer"),kg=require("video.js");function ol(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function Pg(t){if(t&&t.__esModule)return t;var e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});return t&&Object.keys(t).forEach(function(i){if(i!=="default"){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}var zh=ol(Ag),Ci=ol(Tg),zu=ol(kg),K=(t=>(t.AppMove="AppMove",t.AppFocus="AppFocus",t.AppResize="AppResize",t.AppBoxStateChange="AppBoxStateChange",t.GetAttributes="GetAttributes",t.UpdateWindowManagerWrapper="UpdateWindowManagerWrapper",t.InitReplay="InitReplay",t.WindowCreated="WindowCreated",t.SetMainViewScenePath="SetMainViewScenePath",t.SetMainViewSceneIndex="SetMainViewSceneIndex",t.SetAppFocusIndex="SetAppFocusIndex",t.SwitchViewsToFreedom="SwitchViewsToFreedom",t.MoveCamera="MoveCamera",t.MoveCameraToContain="MoveCameraToContain",t.CursorMove="CursorMove",t.RootDirRemoved="RootDirRemoved",t.Refresh="Refresh",t.InitMainViewCamera="InitMainViewCamera",t))(K||{});const Za="__WindowManger",va="__WindowMangerEnsureReconnected__";var ke=(t=>(t.Size="size",t.Position="position",t.SceneIndex="SceneIndex",t.ZIndex="zIndex",t))(ke||{}),Dh=(t=>(t.setBoxSize="setBoxSize",t.setBoxMinSize="setBoxMinSize",t.destroy="destroy",t))(Dh||{}),Ya=(t=>(t.StartCreate="StartCreate",t))(Ya||{}),Ga=(t=>(t.Leave="leave",t.Normal="normal",t))(Ga||{});const Du="2.16.1",Bg=340/720,zg=340/720,Dg=9/16,Oe="/",Lh="/init",Rh=50,Y=new Ci.default;class Lg{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(i=>{console.error(`[WindowManager]: create app error: ${i.message}`),this.invoked()}))}emitReady(){this.isEmit||setTimeout(()=>{Y.emit("ready")},Rh),this.isEmit=!0}empty(){this.list=[],this.clear()}destroy(){this.timer&&this.clear()}}const O=new Ci.default,Rg="__WindowManagerAppCache";let Zn,Lu;const jg=async()=>{Zn=await Og()},_g=(t,e)=>{if(!!Zn)return $g(Zn,{kind:t,sourceCode:e})},Vg=async t=>Zn?await Ug(Zn,t):null;function Og(){return new Promise((t,e)=>{const i=indexedDB.open(Rg,2);i.onerror=n=>{e(n)},i.onupgradeneeded=n=>{const r=n.target.result;r.objectStoreNames.contains("apps")||(Lu=r.createObjectStore("apps",{keyPath:"kind"}),Lu.createIndex("kind","kind",{unique:!0}))},i.onsuccess=()=>{const n=i.result;t(n)}})}function Ug(t,e){return new Promise((i,n)=>{const s=t.transaction(["apps"]).objectStore("apps").index("kind").get(e);s.onerror=a=>n(a),s.onsuccess=()=>{s.result?i(s.result):i(null)}})}function $g(t,e){return new Promise((i,n)=>{const r=t.transaction(["apps"],"readwrite").objectStore("apps").add(e);r.onsuccess=()=>i(),r.onerror=()=>n()})}const Wg="NetlessApp",Hg=1e4,Fg=async t=>{const e=await Vg(t);if(e)return e.sourceCode;{const n=await(await Yg(t,{timeout:Hg})).text();return await _g(t,n),n}},Ru=(t,e)=>{let i=Function(t+`
2
- ;return ${e}`)();return typeof i=="undefined"&&(i=window[e]),i},Qg=async(t,e,i)=>{const n=i||Wg+e;Y.emit("loadApp",{kind:e,status:"start"});let r;try{if(r=await Fg(t),!r||r.length===0)throw Y.emit("loadApp",{kind:e,status:"failed",reason:"script is empty."}),new Error("[WindowManager]: script is empty.")}catch(s){throw Y.emit("loadApp",{kind:e,status:"failed",reason:s.message}),s}return Zg(r,n,e)},Zg=(t,e,i)=>{try{const n=Ru(t,e);return Y.emit("loadApp",{kind:i,status:"success"}),n}catch(n){if(n.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 s=Ru(t,e);return Y.emit("loadApp",{kind:i,status:"success"}),s}throw Y.emit("loadApp",{kind:i,status:"failed",reason:n.message}),n}};async function Yg(t,e){const{timeout:i=1e4}=e,n=new AbortController,r=setTimeout(()=>n.abort(),i),s=await fetch(t,{...e,signal:n.signal,headers:{"content-type":"text/plain"}});return clearTimeout(r),s}class Gg{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 i=e.src;let n;if(typeof i=="string"&&(n=async()=>{const r=await Qg(i,e.kind,e.name);return r.__esModule?r.default:r},this.syncRegisterApp&&this.syncRegisterApp({kind:e.kind,src:i,name:e.name})),typeof i=="function"&&(n=async()=>{let r=await i();if(r)return(r.__esModule||r.default)&&(r=r.default),r;throw new Error(`[WindowManager]: load remote script failed, ${i}`)}),typeof i=="object"&&(n=async()=>i),this.appClasses.set(e.kind,async()=>{let r=this.appClassesCache.get(e.kind);return r||(r=n(),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 i=this.kindEmitters.get(e);i&&(i.clearListeners(),this.kindEmitters.delete(e))}async notifyApp(e,i,n){const r=this.kindEmitters.get(e);await(r==null?void 0:r.emit(i,n))}createKindEmitter(e){if(!this.kindEmitters.has(e)){const i=new Ci.default;this.kindEmitters.set(e,i)}return this.kindEmitters.get(e)}}const Ce=new Gg,Xg=async t=>{var i,n;const e=await((i=Ce.appClasses.get(t))==null?void 0:i());return e&&((n=e.config)==null?void 0:n.singleton)?t:`${t}-${Eg.v4().replace("-","").slice(0,8)}`},wi=(t,e)=>{if(t.focusScenePath!==e)return t.focusScenePath=e,t},Xa=(t,e)=>{if(t&&t.isWritable&&t.state.sceneState.scenePath!==e){const i=e==="/"?"":e;t.setScenePath(i)}},Jg=(t,e,i)=>{var n;if(t&&e){const s=(n=Ji(t)[e])==null?void 0:n[i];if(s)return`${e}/${s.name}`}},Ja=(t,e,i)=>{t&&t.scenePathType(e)!==b.ScenePathType.None&&t.removeScenes(e,i)},Kg=(t,e)=>{O.once(t).then(e)};T.debounce((t,e)=>{t.emit("mainViewModeChange",e)},200);const qg=(t,e,i=0)=>{const n=Ji(t)[e];if(!n)return;const r=n[i];if(!r)return;const s=r.name;return e===Oe?`/${s}`:`${e}/${s}`},Ji=t=>t.entireScenes(),Bn=(t,e,i,n)=>{var r;for(let s=0;s<i.length;++s)if((r=i[s].name)!=null&&r.includes("/"))throw new Error("scenes name can not have '/'");return t==null?void 0:t.putScenes(e,i,n)},em=t=>t.startsWith("/"),wa=t=>{const e=t.split("/");e.pop();let i=e.join("/");return i===""&&(i="/"),i},tm=t=>t.endsWith("/")?t.slice(0,-1):t,ju=t=>{const e=t.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(e)},jh=t=>new Promise(e=>setTimeout(e,t)),im=t=>t.split("").reduce((i,n)=>(n===Oe&&(i+=1),i),0)===1;class nm{constructor(e){this.manager=e,this.displayer=this.manager.displayer,this.mainMagixEventListener=i=>{if(i.authorId!==this.displayer.observerId){const n=i.payload;switch(n.eventName){case K.AppMove:{this.appMoveHandler(n.payload);break}case K.AppResize:{this.appResizeHandler(n.payload);break}case K.AppBoxStateChange:{this.boxStateChangeHandler(n.payload);break}case K.SetMainViewScenePath:{this.setMainViewScenePathHandler(n.payload);break}case K.MoveCamera:{this.moveCameraHandler(n.payload);break}case K.MoveCameraToContain:{this.moveCameraToContainHandler(n.payload);break}case K.CursorMove:{this.cursorMoveHandler(n.payload);break}case K.RootDirRemoved:{this.rootDirRemovedHandler();break}case K.Refresh:{this.refreshHandler();break}case K.InitMainViewCamera:{this.initMainViewCameraHandler();break}case K.SetAppFocusIndex:{this.setAppFocusViewIndexHandler(n.payload);break}}}},this.appMoveHandler=i=>{var n;(n=this.boxManager)==null||n.moveBox(i)},this.appResizeHandler=i=>{var n,r;(n=this.boxManager)==null||n.resizeBox(Object.assign(i,{skipUpdate:!0})),(r=this.manager.room)==null||r.refreshViewSize()},this.boxStateChangeHandler=i=>{Y.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{wi(this.manager.mainView,i),Y.emit("mainViewScenePathChange",i)},this.moveCameraHandler=i=>{T.isEqual(T.omit(i,["animationMode"]),{...this.manager.mainView.camera})||this.manager.mainView.moveCamera(i)},this.moveCameraToContainHandler=i=>{this.manager.mainView.moveCameraToContain(i)},this.cursorMoveHandler=i=>{O.emit("cursorMove",i)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),O.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(Za,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(Za,this.mainMagixEventListener)}}class _h extends Error{constructor(){super(...arguments),this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class rm extends Error{constructor(e){super(`[WindowManager]: app ${e} need register or provide src`)}}class _e extends Error{constructor(){super(...arguments),this.message="[WindowManager]: AppManager must be initialized"}}class Vh extends Error{constructor(e){super(`[WindowManager]: white-web-sdk version must large than ${e}`)}}class Oh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: kind must be a valid string"}}class Uh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: box need created"}}class $h extends Error{constructor(){super(...arguments),this.message='[WindowManager]: ScenePath should start with "/"'}}class Wh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: boxManager not found"}}class Hh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const Fh="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",sm=Fh.length,_u=Array(20),Bi=()=>{for(let t=0;t<20;t++)_u[t]=Fh.charAt(Math.random()*sm);return _u.join("")};class lr{constructor(){this.disposers=new Map}add(e,i=Bi()){return this.flush(i),this.disposers.set(i,e()),i}addDisposer(e,i=Bi()){return this.flush(i),this.disposers.set(i,e),i}addEventListener(e,i,n,r,s=Bi()){return this.add(()=>(e.addEventListener(i,n,r),()=>e.removeEventListener(i,n,r)),s),s}setTimeout(e,i,n=Bi()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(n),e()},i);return()=>window.clearTimeout(r)},n)}setInterval(e,i,n=Bi()){return this.add(()=>{const r=window.setInterval(e,i);return()=>window.clearInterval(r)},n)}remove(e){const i=this.disposers.get(e);return this.disposers.delete(e),i}flush(e){const i=this.remove(e);if(i)try{i()}catch(n){console.error(n)}}flushAll(){this.disposers.forEach(e=>{try{e()}catch(i){console.error(i)}}),this.disposers.clear()}}const Qh=t=>(e,i)=>{if(e!==void 0)if(b.listenUpdated){const n=r=>{r.map(a=>a.kind).includes(t)&&i()};return b.listenUpdated(e,n),i(),()=>b.unlistenUpdated(e,n)}else return b.reaction(()=>e,()=>{i()},{fireImmediately:!0})},Tn=(t,e,i)=>{let n=null;const r=b.reaction(t,()=>{n&&(n(),n=null);const s=t();T.isObject(s)?(n=()=>b.unlistenUpdated(s,e),b.listenUpdated(s,e)):i==null||i(s)},{fireImmediately:!0});return()=>{n==null||n(),r()}};Qh(b.UpdateEventKind.Removed);Qh(b.UpdateEventKind.Inserted);class am{constructor(){this.listeners=new Set}get length(){return this.listeners.size}dispatch(e){this.listeners.forEach(i=>i(e))}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}}const ya=Object.keys;function Vu(t){return Boolean(T.has(t,"__isRef"))}function om(t){return{k:Bi(),v:t,__isRef:!0}}const Je="_WM-STORAGE_";class Ou{constructor(e,i,n){if(this.maxIllusionQueueSize=500,this._sideEffect=new lr,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new am,n&&!T.isObject(n))throw new Error(`Default state for Storage ${i} is not an object.`);this._context=e,this.id=i||null,this._state={};const r=this._getRawState(this._state);this._context.getIsWritable()&&(this.id===null?e.isAddApp&&n&&this.setState(n):(r===this._state||!T.isObject(r))&&(T.get(this._context.getAttributes(),[Je])||this._context.updateAttributes([Je],{}),this._context.updateAttributes([Je,this.id],this._state),n&&this.setState(n))),ya(r).forEach(s=>{if(!(this.id===null&&s===Je))try{const a=T.isObject(r[s])?JSON.parse(JSON.stringify(r[s])):r[s];Vu(a)?(this._state[s]=a.v,T.isObject(a.v)&&this._refMap.set(a.v,a)):this._state[s]=a}catch(a){console.error(a)}}),this._sideEffect.addDisposer(Tn(()=>this.id===null?e.getAttributes():T.get(e.getAttributes(),[Je,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(ya(e).reduce((i,n)=>(T.has(this._state,n)||(i[n]=e[n]),i),{}))}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 i=ya(e);i.length>0&&i.forEach(n=>{const r=e[n];if(r!==this._state[n])if(r===void 0)this._lastValue.set(n,this._state[n]),delete this._state[n],this._setRawState(n,r);else{this._lastValue.set(n,this._state[n]),this._state[n]=r;let s=r;if(T.isObject(r)){let a=this._refMap.get(r);a||(a=om(r),this._refMap.set(r,a)),s=a}this._setRawState(n,s)}})}emptyStorage(){if(!(T.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(T.mapValues(this._state,T.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([Je,this.id],void 0)}get destroyed(){return this._destroyed}destroy(){this._destroyed=!0,this._sideEffect.flushAll()}_getRawState(e){var i;return this.id===null?(i=this._context.getAttributes())!=null?i:e:T.get(this._context.getAttributes(),[Je,this.id],e)}_setRawState(e,i){if(this.id===null){if(e===Je)throw new Error(`Cannot set attribute internal filed "${Je}"`);return this._context.updateAttributes([e],i)}else return this._context.updateAttributes([Je,this.id,e],i)}_updateProperties(e){var i;if(this._destroyed){console.error(new Error(`Cannot call _updateProperties on destroyed Storage "${this.id}".`));return}if(e.length>0){const n={};for(let r=0;r<e.length;r++)try{const s=e[r],a=s.key;if(this.id===null&&a===Je)continue;const o=T.isObject(s.value)?JSON.parse(JSON.stringify(s.value)):s.value;let l;switch(this._lastValue.has(a)&&(l=this._lastValue.get(a),this._lastValue.delete(a)),s.kind){case 2:{T.has(this._state,a)&&(l=this._state[a],delete this._state[a]),n[a]={oldValue:l};break}default:{let u=o;if(Vu(o)){const{k:c,v:h}=o,m=this._state[a];T.isObject(m)&&((i=this._refMap.get(m))==null?void 0:i.k)===c?u=m:(u=h,T.isObject(h)&&this._refMap.set(h,o))}u!==this._state[a]&&(l=this._state[a],this._state[a]=u),n[a]={newValue:u,oldValue:l};break}}}catch(s){console.error(s)}this.onStateChanged.dispatch(n)}}}class $s{constructor(e,i,n,r,s){this.manager=e,this.boxManager=i,this.appId=n,this.appProxy=r,this.appOptions=s,this.mobxUtils={autorun:b.autorun,reaction:b.reaction,toJS:b.toJS},this.objectUtils={listenUpdated:b.listenUpdated,unlistenUpdated:b.unlistenUpdated,listenDisposed:b.listenDisposed,unlistenDisposed:b.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 l;(l=this.getRoom())==null||l.refreshViewSize(),Y.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 Uh},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 l=new Ou(this,a,o);return this.emitter.on("destroy",()=>{l.destroy()}),l},this.dispatchMagixEvent=(...a)=>{var l;const o=`${this.appId}:${a[0]}`;return(l=this.manager.room)==null?void 0:l.dispatchMagixEvent(o,a[1])},this.addMagixEventListener=(a,o,l)=>{const u=`${this.appId}:${a}`;return this.manager.displayer.addMagixEventListener(u,o,l),()=>this.manager.displayer.removeMagixEventListener(u,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,l=a==null?void 0:a.scene,u=this.appProxy.scenePath;if(!!u)if(o){const c=this.pageState.index+1;Bn(this.manager.room,u,[l||{}],c)}else Bn(this.manager.room,u,[l||{}])},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 Ou(this)),this._storage}get pageState(){return this.appProxy.pageState}get kind(){return this.appProxy.kind}dispatchAppEvent(e,i){O.emit(`custom-${this.kind}`,{kind:this.kind,appId:this.appId,type:e,value:i})}}class lm{constructor(e){this.params=e,this.sceneNode=null,this.onSceneChange=r=>{this.sceneNode=r,this.params.notifyPageStateChange()};const{displayer:i,scenePath:n}=this.params;n&&(this.sceneNode=i.createScenesCallback(n,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}getFullPath(e){var n;const i=(n=this.sceneNode)==null?void 0:n.scenes;if(this.params.scenePath&&i){const r=i[e];if(r)return`${this.params.scenePath}/${r}`}}toObject(){var e,i;return{index:((e=this.params.view)==null?void 0:e.focusSceneIndex)||0,length:((i=this.sceneNode)==null?void 0:i.scenes.length)||0}}destroy(){var e;(e=this.sceneNode)==null||e.dispose()}}var Zh={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(i=!1));function r(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function s(l,u,c,h,m){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new r(c,h||l,m),w=i?i+u:u;return l._events[w]?l._events[w].fn?l._events[w]=[l._events[w],v]:l._events[w].push(v):(l._events[w]=v,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)e.call(c,h)&&u.push(i?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},o.prototype.listeners=function(u){var c=i?i+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,v=h.length,w=new Array(v);m<v;m++)w[m]=h[m].fn;return w},o.prototype.listenerCount=function(u){var c=i?i+u:u,h=this._events[c];return h?h.fn?1:h.length:0},o.prototype.emit=function(u,c,h,m,v,w){var M=i?i+u:u;if(!this._events[M])return!1;var d=this._events[M],f=arguments.length,p,g;if(d.fn){switch(d.once&&this.removeListener(u,d.fn,void 0,!0),f){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,c),!0;case 3:return d.fn.call(d.context,c,h),!0;case 4:return d.fn.call(d.context,c,h,m),!0;case 5:return d.fn.call(d.context,c,h,m,v),!0;case 6:return d.fn.call(d.context,c,h,m,v,w),!0}for(g=1,p=new Array(f-1);g<f;g++)p[g-1]=arguments[g];d.fn.apply(d.context,p)}else{var y=d.length,x;for(g=0;g<y;g++)switch(d[g].once&&this.removeListener(u,d[g].fn,void 0,!0),f){case 1:d[g].fn.call(d[g].context);break;case 2:d[g].fn.call(d[g].context,c);break;case 3:d[g].fn.call(d[g].context,c,h);break;case 4:d[g].fn.call(d[g].context,c,h,m);break;default:if(!p)for(x=1,p=new Array(f-1);x<f;x++)p[x-1]=arguments[x];d[g].fn.apply(d[g].context,p)}}return!0},o.prototype.on=function(u,c,h){return s(this,u,c,h,!1)},o.prototype.once=function(u,c,h){return s(this,u,c,h,!0)},o.prototype.removeListener=function(u,c,h,m){var v=i?i+u:u;if(!this._events[v])return this;if(!c)return a(this,v),this;var w=this._events[v];if(w.fn)w.fn===c&&(!m||w.once)&&(!h||w.context===h)&&a(this,v);else{for(var M=0,d=[],f=w.length;M<f;M++)(w[M].fn!==c||m&&!w[M].once||h&&w[M].context!==h)&&d.push(w[M]);d.length?this._events[v]=d.length===1?d[0]:d:a(this,v)}return this},o.prototype.removeAllListeners=function(u){var c;return u?(c=i?i+u:u,this._events[c]&&a(this,c)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,t.exports=o})(Zh);var Ka=Zh.exports;/*! *****************************************************************************
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Bg=require("p-retry"),zg=require("emittery"),T=require("lodash"),b=require("white-web-sdk"),Dg=require("uuid"),Lg=require("@juggle/resize-observer"),Rg=require("video.js");function ul(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function jg(t){if(t&&t.__esModule)return t;var e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});return t&&Object.keys(t).forEach(function(i){if(i!=="default"){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}var jh=ul(Bg),bi=ul(zg),ju=ul(Rg),K=(t=>(t.AppMove="AppMove",t.AppFocus="AppFocus",t.AppResize="AppResize",t.AppBoxStateChange="AppBoxStateChange",t.GetAttributes="GetAttributes",t.UpdateWindowManagerWrapper="UpdateWindowManagerWrapper",t.InitReplay="InitReplay",t.WindowCreated="WindowCreated",t.SetMainViewScenePath="SetMainViewScenePath",t.SetMainViewSceneIndex="SetMainViewSceneIndex",t.SetAppFocusIndex="SetAppFocusIndex",t.SwitchViewsToFreedom="SwitchViewsToFreedom",t.MoveCamera="MoveCamera",t.MoveCameraToContain="MoveCameraToContain",t.CursorMove="CursorMove",t.RootDirRemoved="RootDirRemoved",t.Refresh="Refresh",t.InitMainViewCamera="InitMainViewCamera",t))(K||{});const Ga="__WindowManger",ya="__WindowMangerEnsureReconnected__";var Be=(t=>(t.Size="size",t.Position="position",t.SceneIndex="SceneIndex",t.ZIndex="zIndex",t))(Be||{}),_h=(t=>(t.setBoxSize="setBoxSize",t.setBoxMinSize="setBoxMinSize",t.destroy="destroy",t))(_h||{}),Xa=(t=>(t.StartCreate="StartCreate",t))(Xa||{}),Ja=(t=>(t.Leave="leave",t.Normal="normal",t))(Ja||{});const _u="2.16.1",_g=340/720,Vg=340/720,Og=9/16,Ue="/",Vh="/init",Oh=50,G=new bi.default;class Ug{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(i=>{console.error(`[WindowManager]: create app error: ${i.message}`),this.invoked()}))}emitReady(){this.isEmit||setTimeout(()=>{G.emit("ready")},Oh),this.isEmit=!0}empty(){this.list=[],this.clear()}destroy(){this.timer&&this.clear()}}const V=new bi.default,$g="__WindowManagerAppCache";let Gn,Vu;const Wg=async()=>{Gn=await Qg()},Hg=(t,e)=>{if(!!Gn)return Yg(Gn,{kind:t,sourceCode:e})},Fg=async t=>Gn?await Zg(Gn,t):null;function Qg(){return new Promise((t,e)=>{const i=indexedDB.open($g,2);i.onerror=n=>{e(n)},i.onupgradeneeded=n=>{const r=n.target.result;r.objectStoreNames.contains("apps")||(Vu=r.createObjectStore("apps",{keyPath:"kind"}),Vu.createIndex("kind","kind",{unique:!0}))},i.onsuccess=()=>{const n=i.result;t(n)}})}function Zg(t,e){return new Promise((i,n)=>{const s=t.transaction(["apps"]).objectStore("apps").index("kind").get(e);s.onerror=a=>n(a),s.onsuccess=()=>{s.result?i(s.result):i(null)}})}function Yg(t,e){return new Promise((i,n)=>{const r=t.transaction(["apps"],"readwrite").objectStore("apps").add(e);r.onsuccess=()=>i(),r.onerror=()=>n()})}const Gg="NetlessApp",Xg=1e4,Jg=async t=>{const e=await Fg(t);if(e)return e.sourceCode;{const n=await(await em(t,{timeout:Xg})).text();return await Hg(t,n),n}},Ou=(t,e)=>{let i=Function(t+`
2
+ ;return ${e}`)();return typeof i=="undefined"&&(i=window[e]),i},Kg=async(t,e,i)=>{const n=i||Gg+e;G.emit("loadApp",{kind:e,status:"start"});let r;try{if(r=await Jg(t),!r||r.length===0)throw G.emit("loadApp",{kind:e,status:"failed",reason:"script is empty."}),new Error("[WindowManager]: script is empty.")}catch(s){throw G.emit("loadApp",{kind:e,status:"failed",reason:s.message}),s}return qg(r,n,e)},qg=(t,e,i)=>{try{const n=Ou(t,e);return G.emit("loadApp",{kind:i,status:"success"}),n}catch(n){if(n.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 s=Ou(t,e);return G.emit("loadApp",{kind:i,status:"success"}),s}throw G.emit("loadApp",{kind:i,status:"failed",reason:n.message}),n}};async function em(t,e){const{timeout:i=1e4}=e,n=new AbortController,r=setTimeout(()=>n.abort(),i),s=await fetch(t,{...e,signal:n.signal,headers:{"content-type":"text/plain"}});return clearTimeout(r),s}class tm{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 i=e.src;let n;if(typeof i=="string"&&(n=async()=>{const r=await Kg(i,e.kind,e.name);return r.__esModule?r.default:r},this.syncRegisterApp&&this.syncRegisterApp({kind:e.kind,src:i,name:e.name})),typeof i=="function"&&(n=async()=>{let r=await i();if(r)return(r.__esModule||r.default)&&(r=r.default),r;throw new Error(`[WindowManager]: load remote script failed, ${i}`)}),typeof i=="object"&&(n=async()=>i),this.appClasses.set(e.kind,async()=>{let r=this.appClassesCache.get(e.kind);return r||(r=n(),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 i=this.kindEmitters.get(e);i&&(i.clearListeners(),this.kindEmitters.delete(e))}async notifyApp(e,i,n){const r=this.kindEmitters.get(e);await(r==null?void 0:r.emit(i,n))}createKindEmitter(e){if(!this.kindEmitters.has(e)){const i=new bi.default;this.kindEmitters.set(e,i)}return this.kindEmitters.get(e)}}const Ae=new tm,im=async t=>{var i,n;const e=await((i=Ae.appClasses.get(t))==null?void 0:i());return e&&((n=e.config)==null?void 0:n.singleton)?t:`${t}-${Dg.v4().replace("-","").slice(0,8)}`},yi=(t,e)=>{if(t.focusScenePath!==e)return t.focusScenePath=e,t},Ka=(t,e)=>{if(t&&t.isWritable&&t.state.sceneState.scenePath!==e){const i=e==="/"?"":e;t.setScenePath(i)}},nm=(t,e,i)=>{var n;if(t&&e){const s=(n=qi(t)[e])==null?void 0:n[i];if(s)return`${e}/${s.name}`}},qa=(t,e,i)=>{t&&t.scenePathType(e)!==b.ScenePathType.None&&t.removeScenes(e,i)},rm=(t,e)=>{V.once(t).then(e)};T.debounce((t,e)=>{t.emit("mainViewModeChange",e)},200);const sm=(t,e,i=0)=>{const n=qi(t)[e];if(!n)return;const r=n[i];if(!r)return;const s=r.name;return e===Ue?`/${s}`:`${e}/${s}`},qi=t=>t.entireScenes(),Dn=(t,e,i,n)=>{var r;for(let s=0;s<i.length;++s)if((r=i[s].name)!=null&&r.includes("/"))throw new Error("scenes name can not have '/'");return t==null?void 0:t.putScenes(e,i,n)},am=t=>t.startsWith("/"),xa=t=>{const e=t.split("/");e.pop();let i=e.join("/");return i===""&&(i="/"),i},om=t=>t.endsWith("/")?t.slice(0,-1):t,Uu=t=>{const e=t.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(e)},Uh=t=>new Promise(e=>setTimeout(e,t)),lm=t=>t.split("").reduce((i,n)=>(n===Ue&&(i+=1),i),0)===1;class um{constructor(e){this.manager=e,this.displayer=this.manager.displayer,this.mainMagixEventListener=i=>{if(i.authorId!==this.displayer.observerId){const n=i.payload;switch(n.eventName){case K.AppMove:{this.appMoveHandler(n.payload);break}case K.AppResize:{this.appResizeHandler(n.payload);break}case K.AppBoxStateChange:{this.boxStateChangeHandler(n.payload);break}case K.SetMainViewScenePath:{this.setMainViewScenePathHandler(n.payload);break}case K.MoveCamera:{this.moveCameraHandler(n.payload);break}case K.MoveCameraToContain:{this.moveCameraToContainHandler(n.payload);break}case K.CursorMove:{this.cursorMoveHandler(n.payload);break}case K.RootDirRemoved:{this.rootDirRemovedHandler();break}case K.Refresh:{this.refreshHandler();break}case K.InitMainViewCamera:{this.initMainViewCameraHandler();break}case K.SetAppFocusIndex:{this.setAppFocusViewIndexHandler(n.payload);break}}}},this.appMoveHandler=i=>{var n;(n=this.boxManager)==null||n.moveBox(i)},this.appResizeHandler=i=>{var n,r;(n=this.boxManager)==null||n.resizeBox(Object.assign(i,{skipUpdate:!0})),(r=this.manager.room)==null||r.refreshViewSize()},this.boxStateChangeHandler=i=>{G.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{yi(this.manager.mainView,i),G.emit("mainViewScenePathChange",i)},this.moveCameraHandler=i=>{T.isEqual(T.omit(i,["animationMode"]),{...this.manager.mainView.camera})||this.manager.mainView.moveCamera(i)},this.moveCameraToContainHandler=i=>{this.manager.mainView.moveCameraToContain(i)},this.cursorMoveHandler=i=>{V.emit("cursorMove",i)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),V.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(Ga,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(Ga,this.mainMagixEventListener)}}class $h extends Error{constructor(){super(...arguments),this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class cm extends Error{constructor(e){super(`[WindowManager]: app ${e} need register or provide src`)}}class Ve extends Error{constructor(){super(...arguments),this.message="[WindowManager]: AppManager must be initialized"}}class Wh extends Error{constructor(e){super(`[WindowManager]: white-web-sdk version must large than ${e}`)}}class Hh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: kind must be a valid string"}}class Fh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: box need created"}}class Qh extends Error{constructor(){super(...arguments),this.message='[WindowManager]: ScenePath should start with "/"'}}class Zh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: boxManager not found"}}class Yh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const Gh="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",hm=Gh.length,$u=Array(20),Di=()=>{for(let t=0;t<20;t++)$u[t]=Gh.charAt(Math.random()*hm);return $u.join("")};class cr{constructor(){this.disposers=new Map}add(e,i=Di()){return this.flush(i),this.disposers.set(i,e()),i}addDisposer(e,i=Di()){return this.flush(i),this.disposers.set(i,e),i}addEventListener(e,i,n,r,s=Di()){return this.add(()=>(e.addEventListener(i,n,r),()=>e.removeEventListener(i,n,r)),s),s}setTimeout(e,i,n=Di()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(n),e()},i);return()=>window.clearTimeout(r)},n)}setInterval(e,i,n=Di()){return this.add(()=>{const r=window.setInterval(e,i);return()=>window.clearInterval(r)},n)}remove(e){const i=this.disposers.get(e);return this.disposers.delete(e),i}flush(e){const i=this.remove(e);if(i)try{i()}catch(n){console.error(n)}}flushAll(){this.disposers.forEach(e=>{try{e()}catch(i){console.error(i)}}),this.disposers.clear()}}const Xh=t=>(e,i)=>{if(e!==void 0)if(b.listenUpdated){const n=r=>{r.map(a=>a.kind).includes(t)&&i()};return b.listenUpdated(e,n),i(),()=>b.unlistenUpdated(e,n)}else return b.reaction(()=>e,()=>{i()},{fireImmediately:!0})},Nn=(t,e,i)=>{let n=null;const r=b.reaction(t,()=>{n&&(n(),n=null);const s=t();T.isObject(s)?(n=()=>b.unlistenUpdated(s,e),b.listenUpdated(s,e)):i==null||i(s)},{fireImmediately:!0});return()=>{n==null||n(),r()}};Xh(b.UpdateEventKind.Removed);Xh(b.UpdateEventKind.Inserted);class dm{constructor(){this.listeners=new Set}get length(){return this.listeners.size}dispatch(e){this.listeners.forEach(i=>i(e))}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}}const Sa=Object.keys;function Wu(t){return Boolean(T.has(t,"__isRef"))}function fm(t){return{k:Di(),v:t,__isRef:!0}}const Ke="_WM-STORAGE_";class Hu{constructor(e,i,n){if(this.maxIllusionQueueSize=500,this._sideEffect=new cr,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new dm,n&&!T.isObject(n))throw new Error(`Default state for Storage ${i} is not an object.`);this._context=e,this.id=i||null,this._state={};const r=this._getRawState(this._state);this._context.getIsWritable()&&(this.id===null?e.isAddApp&&n&&this.setState(n):(r===this._state||!T.isObject(r))&&(T.get(this._context.getAttributes(),[Ke])||this._context.updateAttributes([Ke],{}),this._context.updateAttributes([Ke,this.id],this._state),n&&this.setState(n))),Sa(r).forEach(s=>{if(!(this.id===null&&s===Ke))try{const a=T.isObject(r[s])?JSON.parse(JSON.stringify(r[s])):r[s];Wu(a)?(this._state[s]=a.v,T.isObject(a.v)&&this._refMap.set(a.v,a)):this._state[s]=a}catch(a){console.error(a)}}),this._sideEffect.addDisposer(Nn(()=>this.id===null?e.getAttributes():T.get(e.getAttributes(),[Ke,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(Sa(e).reduce((i,n)=>(T.has(this._state,n)||(i[n]=e[n]),i),{}))}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 i=Sa(e);i.length>0&&i.forEach(n=>{const r=e[n];if(r!==this._state[n])if(r===void 0)this._lastValue.set(n,this._state[n]),delete this._state[n],this._setRawState(n,r);else{this._lastValue.set(n,this._state[n]),this._state[n]=r;let s=r;if(T.isObject(r)){let a=this._refMap.get(r);a||(a=fm(r),this._refMap.set(r,a)),s=a}this._setRawState(n,s)}})}emptyStorage(){if(!(T.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(T.mapValues(this._state,T.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([Ke,this.id],void 0)}get destroyed(){return this._destroyed}destroy(){this._destroyed=!0,this._sideEffect.flushAll()}_getRawState(e){var i;return this.id===null?(i=this._context.getAttributes())!=null?i:e:T.get(this._context.getAttributes(),[Ke,this.id],e)}_setRawState(e,i){if(this.id===null){if(e===Ke)throw new Error(`Cannot set attribute internal filed "${Ke}"`);return this._context.updateAttributes([e],i)}else return this._context.updateAttributes([Ke,this.id,e],i)}_updateProperties(e){var i;if(this._destroyed){console.error(new Error(`Cannot call _updateProperties on destroyed Storage "${this.id}".`));return}if(e.length>0){const n={};for(let r=0;r<e.length;r++)try{const s=e[r],a=s.key;if(this.id===null&&a===Ke)continue;const o=T.isObject(s.value)?JSON.parse(JSON.stringify(s.value)):s.value;let l;switch(this._lastValue.has(a)&&(l=this._lastValue.get(a),this._lastValue.delete(a)),s.kind){case 2:{T.has(this._state,a)&&(l=this._state[a],delete this._state[a]),n[a]={oldValue:l};break}default:{let u=o;if(Wu(o)){const{k:h,v:c}=o,m=this._state[a];T.isObject(m)&&((i=this._refMap.get(m))==null?void 0:i.k)===h?u=m:(u=c,T.isObject(c)&&this._refMap.set(c,o))}u!==this._state[a]&&(l=this._state[a],this._state[a]=u),n[a]={newValue:u,oldValue:l};break}}}catch(s){console.error(s)}this.onStateChanged.dispatch(n)}}}class Hs{constructor(e,i,n,r,s){this.manager=e,this.boxManager=i,this.appId=n,this.appProxy=r,this.appOptions=s,this.mobxUtils={autorun:b.autorun,reaction:b.reaction,toJS:b.toJS},this.objectUtils={listenUpdated:b.listenUpdated,unlistenUpdated:b.unlistenUpdated,listenDisposed:b.listenDisposed,unlistenDisposed:b.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 l;(l=this.getRoom())==null||l.refreshViewSize(),G.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 Fh},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 l=new Hu(this,a,o);return this.emitter.on("destroy",()=>{l.destroy()}),l},this.dispatchMagixEvent=(...a)=>{var l;const o=`${this.appId}:${a[0]}`;return(l=this.manager.room)==null?void 0:l.dispatchMagixEvent(o,a[1])},this.addMagixEventListener=(a,o,l)=>{const u=`${this.appId}:${a}`;return this.manager.displayer.addMagixEventListener(u,o,l),()=>this.manager.displayer.removeMagixEventListener(u,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,l=a==null?void 0:a.scene,u=this.appProxy.scenePath;if(!!u)if(o){const h=this.pageState.index+1;Dn(this.manager.room,u,[l||{}],h)}else Dn(this.manager.room,u,[l||{}])},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 Hu(this)),this._storage}get pageState(){return this.appProxy.pageState}get kind(){return this.appProxy.kind}dispatchAppEvent(e,i){V.emit(`custom-${this.kind}`,{kind:this.kind,appId:this.appId,type:e,value:i})}}class pm{constructor(e){this.params=e,this.sceneNode=null,this.onSceneChange=r=>{this.sceneNode=r,this.params.notifyPageStateChange()};const{displayer:i,scenePath:n}=this.params;n&&(this.sceneNode=i.createScenesCallback(n,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}getFullPath(e){var n;const i=(n=this.sceneNode)==null?void 0:n.scenes;if(this.params.scenePath&&i){const r=i[e];if(r)return`${this.params.scenePath}/${r}`}}toObject(){var e,i;return{index:((e=this.params.view)==null?void 0:e.focusSceneIndex)||0,length:((i=this.sceneNode)==null?void 0:i.scenes.length)||0}}destroy(){var e;(e=this.sceneNode)==null||e.dispose()}}var Jh={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(i=!1));function r(l,u,h){this.fn=l,this.context=u,this.once=h||!1}function s(l,u,h,c,m){if(typeof h!="function")throw new TypeError("The listener must be a function");var w=new r(h,c||l,m),y=i?i+u:u;return l._events[y]?l._events[y].fn?l._events[y]=[l._events[y],w]:l._events[y].push(w):(l._events[y]=w,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],h,c;if(this._eventsCount===0)return u;for(c in h=this._events)e.call(h,c)&&u.push(i?c.slice(1):c);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},o.prototype.listeners=function(u){var h=i?i+u:u,c=this._events[h];if(!c)return[];if(c.fn)return[c.fn];for(var m=0,w=c.length,y=new Array(w);m<w;m++)y[m]=c[m].fn;return y},o.prototype.listenerCount=function(u){var h=i?i+u:u,c=this._events[h];return c?c.fn?1:c.length:0},o.prototype.emit=function(u,h,c,m,w,y){var x=i?i+u:u;if(!this._events[x])return!1;var d=this._events[x],f=arguments.length,p,g;if(d.fn){switch(d.once&&this.removeListener(u,d.fn,void 0,!0),f){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,h),!0;case 3:return d.fn.call(d.context,h,c),!0;case 4:return d.fn.call(d.context,h,c,m),!0;case 5:return d.fn.call(d.context,h,c,m,w),!0;case 6:return d.fn.call(d.context,h,c,m,w,y),!0}for(g=1,p=new Array(f-1);g<f;g++)p[g-1]=arguments[g];d.fn.apply(d.context,p)}else{var v=d.length,S;for(g=0;g<v;g++)switch(d[g].once&&this.removeListener(u,d[g].fn,void 0,!0),f){case 1:d[g].fn.call(d[g].context);break;case 2:d[g].fn.call(d[g].context,h);break;case 3:d[g].fn.call(d[g].context,h,c);break;case 4:d[g].fn.call(d[g].context,h,c,m);break;default:if(!p)for(S=1,p=new Array(f-1);S<f;S++)p[S-1]=arguments[S];d[g].fn.apply(d[g].context,p)}}return!0},o.prototype.on=function(u,h,c){return s(this,u,h,c,!1)},o.prototype.once=function(u,h,c){return s(this,u,h,c,!0)},o.prototype.removeListener=function(u,h,c,m){var w=i?i+u:u;if(!this._events[w])return this;if(!h)return a(this,w),this;var y=this._events[w];if(y.fn)y.fn===h&&(!m||y.once)&&(!c||y.context===c)&&a(this,w);else{for(var x=0,d=[],f=y.length;x<f;x++)(y[x].fn!==h||m&&!y[x].once||c&&y[x].context!==c)&&d.push(y[x]);d.length?this._events[w]=d.length===1?d[0]:d:a(this,w)}return this},o.prototype.removeAllListeners=function(u){var h;return u?(h=i?i+u:u,this._events[h]&&a(this,h)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,t.exports=o})(Jh);var eo=Jh.exports;/*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
@@ -12,38 +12,38 @@ 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 be=function(){return be=Object.assign||function(e){for(var i,n=1,r=arguments.length;n<r;n++){i=arguments[n];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},be.apply(this,arguments)};function ll(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]]);return i}var xa=0,Yh=typeof window!="undefined"&&window.requestAnimationFrame!==void 0?function(t){return window.requestAnimationFrame(t)}:function(t){var e=Date.now(),i=Math.max(0,16.7-(e-xa));xa=e+i,setTimeout(function(){return t(xa)},i)},um=function(t){var e=[],i=[],n=0,r=!1,s=0,a=new WeakSet,o=new WeakSet,l={cancel:function(u){var c=i.indexOf(u);a.add(u),c!==-1&&i.splice(c,1)},process:function(u){var c;if(r=!0,c=[i,e],e=c[0],i=c[1],i.length=0,n=e.length,n){var h;for(s=0;s<n;s++)h=e[s],h(u),o.has(h)===!0&&!a.has(h)&&(l.schedule(h),t(!0))}r=!1},schedule:function(u,c,h){c===void 0&&(c=!1),h===void 0&&(h=!1);var m=h&&r,v=m?e:i;a.delete(u),c&&o.add(u),v.indexOf(u)===-1&&(v.push(u),m&&(n=e.length))}};return l},cm=40,Uu=1/60*1e3,Zr=!0,Yn=!1,qa=!1,En={delta:0,timestamp:0},ul=["read","update","preRender","render","postRender"],hm=function(t){return Yn=t},Gh=ul.reduce(function(t,e){return t[e]=um(hm),t},{}),dm=ul.reduce(function(t,e){var i=Gh[e];return t[e]=function(n,r,s){return r===void 0&&(r=!1),s===void 0&&(s=!1),Yn||pm(),i.schedule(n,r,s),n},t},{}),fm=function(t){return Gh[t].process(En)},Xh=function(t){Yn=!1,En.delta=Zr?Uu:Math.max(Math.min(t-En.timestamp,cm),1),Zr||(Uu=En.delta),En.timestamp=t,qa=!0,ul.forEach(fm),qa=!1,Yn&&(Zr=!1,Yh(Xh))},pm=function(){Yn=!0,Zr=!0,qa||Yh(Xh)},Jh=function(t,e){return function(i){return Math.max(Math.min(i,e),t)}},Yr=function(t){return t%1?Number(t.toFixed(5)):t},Kh=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,Ws={test:function(t){return typeof t=="number"},parse:parseFloat,transform:function(t){return t}},zn=be(be({},Ws),{transform:Jh(0,1)}),Tr=be(be({},Ws),{default:1}),cl=function(t){return{test:function(e){return typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1},parse:parseFloat,transform:function(e){return""+e+t}}},ii=cl("deg"),Dn=cl("%"),W=cl("px"),$u=be(be({},Dn),{parse:function(t){return Dn.parse(t)/100},transform:function(t){return Dn.transform(t*100)}}),gm=function(t){return t.substring(t.indexOf("(")+1,t.lastIndexOf(")"))},mm=Jh(0,255),eo=function(t){return t.red!==void 0},to=function(t){return t.hue!==void 0};function vm(t){return gm(t).replace(/(,|\/)/g," ").split(/ \s*/)}var qh=function(t){return function(e){if(typeof e!="string")return e;for(var i={},n=vm(e),r=0;r<4;r++)i[t[r]]=n[r]!==void 0?parseFloat(n[r]):1;return i}},wm=function(t){var e=t.red,i=t.green,n=t.blue,r=t.alpha,s=r===void 0?1:r;return"rgba("+e+", "+i+", "+n+", "+s+")"},ym=function(t){var e=t.hue,i=t.saturation,n=t.lightness,r=t.alpha,s=r===void 0?1:r;return"hsla("+e+", "+i+", "+n+", "+s+")"},Sa=be(be({},Ws),{transform:function(t){return Math.round(mm(t))}});function hl(t,e){return t.startsWith(e)&&Kh.test(t)}var Gr={test:function(t){return typeof t=="string"?hl(t,"rgb"):eo(t)},parse:qh(["red","green","blue","alpha"]),transform:function(t){var e=t.red,i=t.green,n=t.blue,r=t.alpha,s=r===void 0?1:r;return wm({red:Sa.transform(e),green:Sa.transform(i),blue:Sa.transform(n),alpha:Yr(zn.transform(s))})}},Ma={test:function(t){return typeof t=="string"?hl(t,"hsl"):to(t)},parse:qh(["hue","saturation","lightness","alpha"]),transform:function(t){var e=t.hue,i=t.saturation,n=t.lightness,r=t.alpha,s=r===void 0?1:r;return ym({hue:Math.round(e),saturation:Dn.transform(Yr(i)),lightness:Dn.transform(Yr(n)),alpha:Yr(zn.transform(s))})}},Wu=be(be({},Gr),{test:function(t){return typeof t=="string"&&hl(t,"#")},parse:function(t){var e="",i="",n="";return t.length>4?(e=t.substr(1,2),i=t.substr(3,2),n=t.substr(5,2)):(e=t.substr(1,1),i=t.substr(2,1),n=t.substr(3,1),e+=e,i+=i,n+=n),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:1}}}),at={test:function(t){return typeof t=="string"&&Kh.test(t)||eo(t)||to(t)},parse:function(t){return Gr.test(t)?Gr.parse(t):Ma.test(t)?Ma.parse(t):Wu.test(t)?Wu.parse(t):t},transform:function(t){return eo(t)?Gr.transform(t):to(t)?Ma.transform(t):t}},dl=function(t){var e=t.onRead,i=t.onRender,n=t.uncachedValues,r=n===void 0?new Set:n,s=t.useCache,a=s===void 0?!0:s;return function(o){o===void 0&&(o={});var l=ll(o,[]),u={},c=[],h=!1;function m(w,M){w.startsWith("--")&&(l.hasCSSVariable=!0);var d=u[w];u[w]=M,u[w]!==d&&(c.indexOf(w)===-1&&c.push(w),h||(h=!0,dm.render(v.render)))}var v={get:function(w,M){M===void 0&&(M=!1);var d=!M&&a&&!r.has(w)&&u[w]!==void 0;return d?u[w]:e(w,l)},set:function(w,M){if(typeof w=="string")m(w,M);else for(var d in w)m(d,w[d]);return this},render:function(w){return w===void 0&&(w=!1),(h||w===!0)&&(i(u,l,c),h=!1,c.length=0),this}};return v}},xm=/([a-z])([A-Z])/g,Sm="$1-$2",Hs=function(t){return t.replace(xm,Sm).toLowerCase()},ed=new Map,fl=new Map,td=["Webkit","Moz","O","ms",""],Mm=td.length,Im=typeof document!="undefined",Ia,id=function(t,e){return fl.set(t,Hs(e))},Cm=function(t){Ia=Ia||document.createElement("div");for(var e=0;e<Mm;e++){var i=td[e],n=i==="",r=n?t:i+t.charAt(0).toUpperCase()+t.slice(1);if(r in Ia.style||n){if(n&&t==="clipPath"&&fl.has(t))return;ed.set(t,r),id(t,(n?"":"-")+Hs(r))}}},bm=function(t){return id(t,t)},nd=function(t,e){e===void 0&&(e=!1);var i=e?fl:ed;return i.has(t)||(Im?Cm(t):bm(t)),i.get(t)||t},Am=["","X","Y","Z"],Tm=["translate","scale","rotate","skew","transformPerspective"],io=Tm.reduce(function(t,e){return Am.reduce(function(i,n){return i.push(e+n),i},t)},["x","y","z"]),Em=io.reduce(function(t,e){return t[e]=!0,t},{});function pl(t){return Em[t]===!0}function Nm(t,e){return io.indexOf(t)-io.indexOf(e)}var km=new Set(["originX","originY","originZ"]);function Pm(t){return km.has(t)}var Hu=be(be({},Ws),{transform:Math.round}),Bm={color:at,backgroundColor:at,outlineColor:at,fill:at,stroke:at,borderColor:at,borderTopColor:at,borderRightColor:at,borderBottomColor:at,borderLeftColor:at,borderWidth:W,borderTopWidth:W,borderRightWidth:W,borderBottomWidth:W,borderLeftWidth:W,borderRadius:W,radius:W,borderTopLeftRadius:W,borderTopRightRadius:W,borderBottomRightRadius:W,borderBottomLeftRadius:W,width:W,maxWidth:W,height:W,maxHeight:W,size:W,top:W,right:W,bottom:W,left:W,padding:W,paddingTop:W,paddingRight:W,paddingBottom:W,paddingLeft:W,margin:W,marginTop:W,marginRight:W,marginBottom:W,marginLeft:W,rotate:ii,rotateX:ii,rotateY:ii,rotateZ:ii,scale:Tr,scaleX:Tr,scaleY:Tr,scaleZ:Tr,skew:ii,skewX:ii,skewY:ii,distance:W,translateX:W,translateY:W,translateZ:W,x:W,y:W,z:W,perspective:W,opacity:zn,originX:$u,originY:$u,originZ:W,zIndex:Hu,fillOpacity:zn,strokeOpacity:zn,numOctaves:Hu},gl=function(t){return Bm[t]},zm=function(t,e){return e&&typeof t=="number"?e.transform(t):t},Ln="scrollLeft",Rn="scrollTop",rd=new Set([Ln,Rn]),Dm=new Set([Ln,Rn,"transform"]),Lm={x:"translateX",y:"translateY",z:"translateZ"};function sd(t){return typeof t=="function"}function Rm(t,e,i,n,r,s){s===void 0&&(s=!0);var a="",o=!1;i.sort(Nm);for(var l=i.length,u=0;u<l;u++){var c=i[u];a+=(Lm[c]||c)+"("+e[c]+") ",o=c==="z"?!0:o}return!o&&r?a+="translateZ(0)":a=a.trim(),sd(t.transform)?a=t.transform(e,n?"":a):s&&n&&(a="none"),a}function jm(t,e,i,n,r,s,a,o){e===void 0&&(e=!0),i===void 0&&(i={}),n===void 0&&(n={}),r===void 0&&(r={}),s===void 0&&(s=[]),a===void 0&&(a=!1),o===void 0&&(o=!0);var l=!0,u=!1,c=!1;for(var h in t){var m=t[h],v=gl(h),w=zm(m,v);pl(h)?(u=!0,n[h]=w,s.push(h),l&&(v.default&&m!==v.default||!v.default&&m!==0)&&(l=!1)):Pm(h)?(r[h]=w,c=!0):(!Dm.has(h)||!sd(w))&&(i[nd(h,a)]=w)}return(u||typeof t.transform=="function")&&(i.transform=Rm(t,n,s,l,e,o)),c&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function ml(t){var e=t===void 0?{}:t,i=e.enableHardwareAcceleration,n=i===void 0?!0:i,r=e.isDashCase,s=r===void 0?!0:r,a=e.allowTransformNone,o=a===void 0?!0:a,l={},u={},c={},h=[];return function(m){return h.length=0,jm(m,n,l,u,c,h,s,o),l}}function _m(t,e){var i=e.element,n=e.preparseOutput,r=gl(t);if(pl(t))return r&&r.default||0;if(rd.has(t))return i[t];var s=window.getComputedStyle(i,null).getPropertyValue(nd(t,!0))||0;return n&&r&&r.test(s)&&r.parse?r.parse(s):s}function Vm(t,e,i){var n=e.element,r=e.buildStyles,s=e.hasCSSVariable;if(Object.assign(n.style,r(t)),s)for(var a=i.length,o=0;o<a;o++){var l=i[o];l.startsWith("--")&&n.style.setProperty(l,t[l])}i.indexOf(Ln)!==-1&&(n[Ln]=t[Ln]),i.indexOf(Rn)!==-1&&(n[Rn]=t[Rn])}var Om=dl({onRead:_m,onRender:Vm,uncachedValues:rd});function Um(t,e){e===void 0&&(e={});var i=e.enableHardwareAcceleration,n=e.allowTransformNone,r=ll(e,["enableHardwareAcceleration","allowTransformNone"]);return Om(be({element:t,buildStyles:ml({enableHardwareAcceleration:i,allowTransformNone:n}),preparseOutput:!0},r))}var ad=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Fu=.5,od=function(){return{style:{}}},Ca=function(t,e){return W.transform(t*e)},$m={x:0,y:0,width:0,height:0};function Qu(t,e,i){return typeof t=="string"?t:W.transform(e+i*t)}function Wm(t,e,i){return Qu(e,t.x,t.width)+" "+Qu(i,t.y,t.height)}var ld={enableHardwareAcceleration:!1,isDashCase:!1};function Hm(t,e,i,n,r,s){e===void 0&&(e=$m),n===void 0&&(n=ml(ld)),r===void 0&&(r=od()),s===void 0&&(s=!0);var a=t.attrX,o=t.attrY,l=t.originX,u=t.originY,c=t.pathLength,h=t.pathSpacing,m=h===void 0?1:h,v=t.pathOffset,w=v===void 0?0:v,M=ll(t,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),d=n(M);for(var f in d)if(f==="transform")r.style.transform=d[f];else{var p=s&&!ad.has(f)?Hs(f):f;r[p]=d[f]}return(l!==void 0||u!==void 0||d.transform)&&(r.style.transformOrigin=Wm(e,l!==void 0?l:Fu,u!==void 0?u:Fu)),a!==void 0&&(r.x=a),o!==void 0&&(r.y=o),i!==void 0&&c!==void 0&&(r[s?"stroke-dashoffset":"strokeDashoffset"]=Ca(-w,i),r[s?"stroke-dasharray":"strokeDasharray"]=Ca(c,i)+" "+Ca(m,i)),r}function Fm(t,e,i){i===void 0&&(i=!0);var n=od(),r=ml(ld);return function(s){return Hm(s,t,e,r,n,i)}}var Qm=function(t){return typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()},Zm=function(t){try{return Qm(t)}catch{return{x:0,y:0,width:0,height:0}}},Ym=function(t){return t.tagName==="path"},Gm=dl({onRead:function(t,e){var i=e.element;if(t=ad.has(t)?t:Hs(t),pl(t)){var n=gl(t);return n&&n.default||0}else return i.getAttribute(t)},onRender:function(t,e){var i=e.element,n=e.buildAttrs,r=n(t);for(var s in r)s==="style"?Object.assign(i.style,r.style):i.setAttribute(s,r[s])}}),Xm=function(t){var e=Zm(t),i=Ym(t)&&t.getTotalLength?t.getTotalLength():void 0;return Gm({element:t,buildAttrs:Fm(e,i)})},Jm=dl({useCache:!1,onRead:function(t){return t==="scrollTop"?window.pageYOffset:window.pageXOffset},onRender:function(t){var e=t.scrollTop,i=e===void 0?0:e,n=t.scrollLeft,r=n===void 0?0:n;return window.scrollTo(r,i)}}),no=new WeakMap,Km=function(t){return t instanceof HTMLElement||typeof t.click=="function"},qm=function(t){return t instanceof SVGElement||"ownerSVGElement"in t},ev=function(t,e){var i;return t===window?i=Jm(t):Km(t)?i=Um(t,e):qm(t)&&(i=Xm(t)),no.set(t,i),i},tv=function(t,e){return no.has(t)?no.get(t):ev(t,e)};function iv(t,e){var i=typeof t=="string"?document.querySelector(t):t;return tv(i,e)}var lt=function(e,i,n,r){var s=n?n.call(r,e,i):void 0;if(s!==void 0)return!!s;if(e===i)return!0;if(typeof e!="object"||!e||typeof i!="object"||!i)return!1;var a=Object.keys(e),o=Object.keys(i);if(a.length!==o.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(i),u=0;u<a.length;u++){var c=a[u];if(!l(c))return!1;var h=e[c],m=i[c];if(s=n?n.call(r,h,m,c):void 0,s===!1||s===void 0&&h!==m)return!1}return!0};const ud="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",nv=ud.length,Zu=Array(20),mn=()=>{for(let t=0;t<20;t++)Zu[t]=ud.charAt(Math.random()*nv);return Zu.join("")};class hs{constructor(){this.disposers=new Map}add(e,i=mn()){return this.flush(i),this.disposers.set(i,e()),i}addDisposer(e,i=mn()){return this.flush(i),this.disposers.set(i,e),i}addEventListener(e,i,n,r,s=mn()){return this.add(()=>(e.addEventListener(i,n,r),()=>e.removeEventListener(i,n,r)),s),s}setTimeout(e,i,n=mn()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(n),e()},i);return()=>window.clearTimeout(r)},n)}setInterval(e,i,n=mn()){return this.add(()=>{const r=window.setInterval(e,i);return()=>window.clearInterval(r)},n)}remove(e){const i=this.disposers.get(e);return this.disposers.delete(e),i}flush(e){const i=this.remove(e);if(i)try{i()}catch(n){console.error(n)}}flushAll(){this.disposers.forEach(e=>{try{e()}catch(i){console.error(i)}}),this.disposers.clear()}}var rv=Object.defineProperty,ba=(typeof require!="undefined"&&require,(t,e,i)=>(((n,r,s)=>{r in n?rv(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s})(t,typeof e!="symbol"?e+"":e,i),i));class ur{constructor(e,i){ba(this,"_value"),ba(this,"_beforeDestroys"),ba(this,"_subscribers"),this._value=e,i&&(this.compare=i)}get value(){return this._value}setValue(e,i){if(!this.compare(e,this._value)){const n=this._value;this._value=e,this._subscribers&&this._subscribers.forEach(r=>r(e,n,i))}}reaction(e){return this._subscribers||(this._subscribers=new Set),this._subscribers.add(e),()=>{this._subscribers&&this._subscribers.delete(e)}}subscribe(e,i){const n=this.reaction(e);return e(this._value,void 0,i),n}derive(e,i,n){const r=new ur(e(this.value,void 0,n),i),s=this.reaction((a,o,l)=>{r.setValue(e(a,o,l))});return r.addBeforeDestroy(s),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,i){return e===i}}function sv(t,e,i,n){let r=t.map(a=>a.value);const s=new ur(e(r,void 0,n),i);return t.forEach((a,o)=>{const l=a.reaction((u,c,h)=>{const m=r.slice();m[o]=u;const v=r;r=m,s.setValue(e(m,v,h),h)});s.addBeforeDestroy(l)}),s}function cd(t,e){Object.keys(e).forEach(i=>{av(t,i,e[i])})}function av(t,e,i){var n;return Object.defineProperties(t,{[e]:{get:()=>i.value},[`_${e}$`]:{value:i},[`set${n=e,n[0].toUpperCase()+n.slice(1)}`]:{value:(r,s)=>i.setValue(r,s)}}),t}function hd(t){const e=i=>{const n=t.addDisposer(()=>{i.destroy()});return i.addBeforeDestroy(()=>{t.remove(n)}),i};return{bindSideEffect:e,combine:(i,n,r,s)=>e(sv(i,n,r,s)),createVal:(i,n)=>e(new ur(i,n))}}var vl=(t=>(t.Light="light",t.Dark="dark",t.Auto="auto",t))(vl||{}),N=(t=>(t.Normal="normal",t.Minimized="minimized",t.Maximized="maximized",t))(N||{}),ue=(t=>(t.DarkMode="dark_mode",t.PrefersColorScheme="prefers_color_scheme",t.Close="close",t.Focus="focus",t.Blur="blur",t.Move="move",t.Resize="resize",t.IntrinsicMove="intrinsic_move",t.IntrinsicResize="intrinsic_resize",t.VisualResize="visual_resize",t.ZIndex="z_index",t.State="state",t.Minimized="minimized",t.Maximized="maximized",t.Readonly="readonly",t.Destroyed="destroyed",t.BoxStatus="box_status",t.LastNotMinimizedBoxStatus="last_not_minimized_box_status",t))(ue||{}),Pe=(t=>(t.Close="close",t.Maximize="maximize",t.Minimize="minimize",t))(Pe||{}),ut=(t=>(t.North="n",t.South="s",t.West="w",t.East="e",t.NorthWest="nw",t.NorthEast="ne",t.SouthEast="se",t.SouthWest="sw",t))(ut||{});const Aa="dh";function Ne(t,e,i){return Math.min(Math.max(t,e),i)}function $i(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function Yu(t){return t.touches?t.touches[0]:t}function ov(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}let lv=1;function uv(){return`New Box ${lv++}`}function cv(t){return Boolean(t)}function Er(t){return!t}class dd{constructor({readonly:e=!1,title:i,buttons:n,onEvent:r,onDragStart:s,namespace:a="telebox",state:o=N.Normal,boxStatus:l}={}){this.$btns=[],this.sideEffect=new hs,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=u=>{var c;if(this.readonly||u.button!==0||(c=u.target.dataset)!=null&&c.teleTitleBarNoDblClick)return;$i(u);const h=Date.now();h-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:Pe.Maximize}):this.onDragStart&&this.onDragStart(u),this.lastTitleBarClick.timestamp=h,this.lastTitleBarClick.clientX=u.clientX,this.lastTitleBarClick.clientY=u.clientY},this.lastTitleBarTouch={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarTouch=u=>{var c;if(this.readonly||(c=u.target.dataset)!=null&&c.teleTitleBarNoDblClick)return;$i(u);const h=Date.now(),{clientX:m=this.lastTitleBarTouch.clientX+100,clientY:v=this.lastTitleBarTouch.clientY+100}=u.touches[0]||{};h-this.lastTitleBarTouch.timestamp<=500?Math.abs(m-this.lastTitleBarTouch.clientX)<=10&&Math.abs(v-this.lastTitleBarTouch.clientY)<=10&&this.onEvent&&this.onEvent({type:Pe.Maximize}):this.onDragStart&&this.onDragStart(u),this.lastTitleBarTouch.timestamp=h,this.lastTitleBarTouch.clientX=m,this.lastTitleBarTouch.clientY=v},this.readonly=e,this.onEvent=r,this.onDragStart=s,this.namespace=a,this.title=i,this.state=o,this.boxStatus=l,this.buttons=n||[{type:Pe.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:Pe.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:u=>u===N.Maximized},{type:Pe.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((i,n)=>{i.isActive&&this.$btns[n].classList.toggle("is-active",i.isActive(e))}))}setBoxStatus(e){this.boxStatus!==e&&(this.boxStatus=e,e&&this.buttons.forEach((i,n)=>{i.isActive&&this.$btns[n].classList.toggle("is-active",i.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=Aa,this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle=Aa,this.title&&(this.$title.textContent=this.title,this.$title.title=this.title),e.appendChild(this.$title),e.appendChild(this.$dragArea);const i=document.createElement("div");i.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:n,isActive:r},s)=>{const a=String(s),o=document.createElement("button");o.className=`${this.wrapClassName("titlebar-btn")} ${n}`,o.dataset.teleTitleBarBtnIndex=a,o.dataset.teleTitleBarNoDblClick="true",r&&o.classList.toggle("is-active",r(this.boxStatus||this.state)),this.$btns.push(o),i.appendChild(o)}),this.sideEffect.addEventListener(i,"click",n=>{var r;if(this.readonly)return;const s=n.target,a=Number((r=s.dataset)==null?void 0:r.teleTitleBarBtnIndex);if(!Number.isNaN(a)&&a<this.buttons.length){$i(n);const o=this.buttons[a];this.onEvent&&this.onEvent({type:o.type,value:o.value})}}),this.$titleBar.appendChild(e),this.$titleBar.appendChild(i)}return this.$titleBar}renderDragArea(){const e=document.createElement("div");return e.className=this.wrapClassName("drag-area"),e.dataset.teleBoxHandle=Aa,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 hv{constructor({id:e=ov(),title:i=uv(),prefersColorScheme:n=vl.Light,darkMode:r,visible:s=!0,width:a=.5,height:o=.5,minWidth:l=0,minHeight:u=0,x:c=.1,y:h=.1,minimized:m=!1,maximized:v=!1,readonly:w=!1,resizable:M=!0,draggable:d=!0,fence:f=!0,fixRatio:p=!1,focus:g=!1,zIndex:y=100,namespace:x="telebox",titleBar:E,content:z,footer:P,styles:B,containerRect:te={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collectorRect:C,boxStatus:S,lastNotMinimizedBoxStatus:_}={}){this._renderSideEffect=new hs,this.handleTrackStart=L=>{var X;return(X=this._handleTrackStart)==null?void 0:X.call(this,L)},this._sideEffect=new hs,this._valSideEffectBinder=hd(this._sideEffect);const{combine:k,createVal:R}=this._valSideEffectBinder;this.id=e,this.namespace=x,this.events=new Ka,this._delegateEvents=new Ka;const G=R(S),ge=R(_),Xe=R(n);Xe.reaction((L,X,V)=>{V||this.events.emit(ue.PrefersColorScheme,L)});const nt=R(Boolean(r));r==null&&Xe.subscribe((L,X,V)=>{this._sideEffect.add(()=>{if(L==="auto"){const he=window.matchMedia("(prefers-color-scheme: dark)");if(he){nt.setValue(he.matches,V);const Ni=Ar=>{nt.setValue(Ar.matches,V)};return he.addListener(Ni),()=>he.removeListener(Ni)}else return Gu}else return nt.setValue(L==="dark",V),Gu},"prefers-color-scheme")}),nt.reaction((L,X,V)=>{V||this.events.emit(ue.DarkMode,L)});const ei=R(te,lt),ti=R(C,lt),Ei=R(i);Ei.reaction((L,X,V)=>{V||this.titleBar.setTitle(L)});const fn=R(s);fn.reaction((L,X,V)=>{!V&&!L&&this.events.emit(ue.Close)});const A=R(w);A.reaction((L,X,V)=>{V||this.events.emit(ue.Readonly,L)});const j=R(M),Q=R(d),ie=R(f),se=R(p),rt=R(y);rt.reaction((L,X,V)=>{V||this.events.emit(ue.ZIndex,L)});const st=R(g);st.reaction((L,X,V)=>{V||this.events.emit(L?ue.Focus:ue.Blur)});const Fe=R(m);Fe.reaction((L,X,V)=>{V||this.events.emit(ue.Minimized,L)});const Ee=R(v);Ee.reaction((L,X,V)=>{V||this.events.emit(ue.Maximized,L)});const ku=k([Fe,Ee,G],([L,X,V])=>L?N.Minimized:X?N.Maximized:V||N.Normal);ku.reaction((L,X,V)=>{V||this.events.emit(ue.State,L)});const Cr=R({width:Ne(l,0,1),height:Ne(u,0,1)},lt),pn=R({width:Ne(a,Cr.value.width,1),height:Ne(o,Cr.value.height,1)},lt);Cr.reaction((L,X,V)=>{pn.setValue({width:Ne(a,L.width,1),height:Ne(o,L.height,1)},V)}),pn.reaction((L,X,V)=>{V||this.events.emit(ue.IntrinsicResize,L)});const gn=k([pn,Ee,G],([L,X,V])=>X||V===N.Maximized?{width:1,height:1}:L,lt);gn.reaction((L,X,V)=>{V||this.events.emit(ue.Resize,L)});const Pu=k([gn,Fe,ei,ti,G],([L,X,V,he,Ni])=>(X||Ni===N.Minimized)&&he?{width:he.width/L.width/V.width,height:he.height/L.height/V.height}:L,lt);Pu.reaction((L,X,V)=>{V||this.events.emit(ue.VisualResize,L)});const ma=R({x:Ne(c,0,1),y:Ne(h,0,1)},lt);ma.reaction((L,X,V)=>{V||this.events.emit(ue.IntrinsicMove,L)});const br=k([ma,pn,ei,ti,Fe,Ee,G,ge],([L,X,V,he,Ni,Ar,Bu,bg])=>(Ni||Bu===N.Minimized)&&he?Ar||bg===N.Maximized?{x:(he.x+he.width/2)/V.width-1/2,y:(he.y+he.height/2)/V.height-1/2}:{x:(he.x+he.width/2)/V.width-X.width/2,y:(he.y+he.height/2)/V.height-X.height/2}:Ar||Bu===N.Maximized?{x:0,y:0}:L,lt);br.reaction((L,X,V)=>{V||this.events.emit(ue.Move,L)}),this.titleBar=E||new dd({readonly:A.value,title:Ei.value,namespace:this.namespace,boxStatus:G.value,onDragStart:L=>{var X;return(X=this._handleTrackStart)==null?void 0:X.call(this,L)},onEvent:L=>{if(this._delegateEvents.listeners.length>0)this._delegateEvents.emit(L.type);else switch(L.type){case Pe.Maximize:{G.value||Ee.setValue(!Ee.value);break}case Pe.Minimize:{G.value||Fe.setValue(!0);break}case Pe.Close:{fn.setValue(!1);break}default:{console.error("Unsupported titleBar event:",L);break}}}}),A.reaction(L=>{this.titleBar.setReadonly(L)}),G.reaction(L=>{this.titleBar.setBoxStatus(L)});const Mg=R(z),Ig=R(P),Cg=R(B);cd(this,{prefersColorScheme:Xe,darkMode:nt,containerRect:ei,collectorRect:ti,title:Ei,visible:fn,readonly:A,resizable:j,draggable:Q,fence:ie,fixRatio:se,focus:st,zIndex:rt,minimized:Fe,maximized:Ee,$userContent:Mg,$userFooter:Ig,$userStyles:Cg}),this._state$=ku,this._minSize$=Cr,this._size$=gn,this._intrinsicSize$=pn,this._visualSize$=Pu,this._coord$=br,this._intrinsicCoord$=ma,this._boxStatus$=G,this._lastNotMinimizedBoxStatus$=ge,this.fixRatio&&this.transform(br.value.x,br.value.y,gn.value.width,gn.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,i=!1){switch(e){case N.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case N.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}setBoxStatus(e,i=!1){return e===N.Minimized?this._boxStatus$.value&&this._boxStatus$.value!==N.Minimized&&this.setLastNotMinimizedBoxStatus(this._boxStatus$.value,i):this.setLastNotMinimizedBoxStatus(void 0,i),this._boxStatus$.setValue(e,i),i||this.events.emit(ue.BoxStatus,{id:this.id,boxStatus:e}),this}setLastNotMinimizedBoxStatus(e,i=!1){return this._lastNotMinimizedBoxStatus$.setValue(e,i),i||this.events.emit(ue.LastNotMinimizedBoxStatus,{id:this.id,lastNotMinimizedBoxStatus:e}),this}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(e,i=!1){return this._minSize$.setValue({width:e,height:this.minHeight},i),this}setMinHeight(e,i=!1){return this._minSize$.setValue({width:this.minWidth,height:e},i),this}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}resize(e,i,n=!1){return this._intrinsicSize$.setValue({width:e,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(e,i,n=!1){return this._intrinsicCoord$.setValue({x:e,y:i},n),this}get x(){return this._coord$.value.x}get y(){return this._coord$.value.y}transform(e,i,n,r,s=!1){if(this.fixRatio){const a=this.intrinsicHeight/this.intrinsicWidth*n;i!==this.intrinsicY&&(i-=a-r),r=a}return i<0&&(i=0,r>this.intrinsicHeight&&(r=this.intrinsicHeight)),this._intrinsicCoord$.setValue({x:n>=this.minWidth?e:this.intrinsicX,y:r>=this.minHeight?i:this.intrinsicY},s),this._intrinsicSize$.setValue({width:Ne(n,this.minWidth,1),height:Ne(r,this.minHeight,1)},s),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 i;return typeof e=="string"?(i=document.createElement("style"),i.textContent=e):i=e,this.set$userStyles(i),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 i=(h,m,v,w=cv)=>this._renderSideEffect.add(()=>{const M=this.wrapClassName(v);return m.subscribe(d=>{h.classList.toggle(M,w(d))})});i(this.$box,this._readonly$,"readonly"),i(this.$box,this._draggable$,"no-drag",Er),i(this.$box,this._resizable$,"no-resize",Er),i(this.$box,this._focus$,"blur",Er),i(this.$box,this._darkMode$,"color-scheme-dark"),i(this.$box,this._darkMode$,"color-scheme-light",Er),this._renderSideEffect.add(()=>{const h=this.wrapClassName("minimized"),m=this.wrapClassName("maximized"),v="box-maximized-timer";return this._state$.subscribe(w=>{this.$box.classList.toggle(h,w===N.Minimized),w===N.Maximized?(this._renderSideEffect.flush(v),this.$box.classList.toggle(m,!0)):this._renderSideEffect.setTimeout(()=>{this.$box.classList.toggle(m,!1)},0,v)})}),this._renderSideEffect.add(()=>this._visible$.subscribe(h=>{h?this.$box.style.removeProperty("display"):this.$box.style.display="none"})),this._renderSideEffect.add(()=>this._zIndex$.subscribe(h=>{this.$box.style.zIndex=String(h)}));const n=iv(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,s=this.y*this.containerRect.height+this.containerRect.y;this.$box.style.transform=`translate(${r-10}px,${s-10}px)`,this._valSideEffectBinder.combine([this._coord$,this._size$,this._minimized$,this._containerRect$,this._collectorRect$,this._boxStatus$],([h,m,v,w,M,d])=>{const f=m.width*w.width,p=m.height*w.height;return{width:f+((v||d===N.Minimized)&&M?1:0),height:p+((v||d===N.Minimized)&&M?1:0),x:h.x*w.width,y:h.y*w.height,scaleX:(v||d===N.Minimized)&&M?M.width/f:1,scaleY:(v||d===N.Minimized)&&M?M.height/p:1}},lt).subscribe(h=>{n.set(h)}),n.set({x:r,y:s});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 l=document.createElement("div");l.className=this.wrapClassName("content-wrap");const u=document.createElement("div");u.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=u,this._renderSideEffect.add(()=>{let h;return this._$userStyles$.subscribe(m=>{h&&h.remove(),h=m,m&&l.appendChild(m)})}),this._renderSideEffect.add(()=>{let h;return this._$userContent$.subscribe(m=>{h&&h.remove(),h=m,m&&u.appendChild(m)})}),l.appendChild(u);const c=document.createElement("div");return c.className=this.wrapClassName("footer-wrap"),this.$footer=c,this._renderSideEffect.add(()=>{let h;return this._$userFooter$.subscribe(m=>{h&&h.remove(),h=m,m&&c.appendChild(m)})}),a.appendChild(o),a.appendChild(l),a.appendChild(c),this._renderResizeHandlers(),this.$box}_renderResizeHandlers(){const e=document.createElement("div");e.className=this.wrapClassName("resize-handles"),Object.values(ut).forEach(M=>{const d=document.createElement("div");d.className=this.wrapClassName(M)+" "+this.wrapClassName("resize-handle"),d.dataset.teleBoxHandle=M,e.appendChild(d)}),this.$box.appendChild(e);const i="handle-tracking-listener",n=this.wrapClassName("transforming");let r,s=0,a=0,o=0,l=0,u=0,c=0,h;const m=M=>{if(this.state!==N.Normal)return;$i(M);let{pageX:d,pageY:f}=Yu(M);f<0&&(f=0);const p=(d-u)/this.containerRect.width,g=(f-c)/this.containerRect.height;switch(h){case ut.North:{this.transform(this.x,a+g,this.width,l-g);break}case ut.South:{this.transform(this.x,this.y,this.width,l+g);break}case ut.West:{this.transform(s+p,this.y,o-p,this.height);break}case ut.East:{this.transform(this.x,this.y,o+p,this.height);break}case ut.NorthWest:{this.transform(s+p,a+g,o-p,l-g);break}case ut.NorthEast:{this.transform(this.x,a+g,o+p,l-g);break}case ut.SouthEast:{this.transform(this.x,this.y,o+p,l+g);break}case ut.SouthWest:{this.transform(s+p,this.y,o-p,l+g);break}default:{if(this.fence)this.move(Ne(s+p,0,1-this.width),Ne(a+g,0,1-this.height));else{const y=20/this.containerRect.width,x=20/this.containerRect.height;this.move(Ne(s+p,y-this.width,1-y),Ne(a+g,0,1-x))}break}}},v=M=>{h=void 0,r&&($i(M),this.$box.classList.toggle(n,!1),this._sideEffect.flush(i),r.remove())},w=M=>{var d;if(this.readonly||M.button!=null&&M.button!==0||!this.draggable||h||this.state!==N.Normal)return;const f=M.target;if((d=f.dataset)!=null&&d.teleBoxHandle){$i(M),s=this.x,a=this.y,o=this.width,l=this.height,{pageX:u,pageY:c}=Yu(M),h=f.dataset.teleBoxHandle,r||(r=document.createElement("div"));const p=h?this.wrapClassName(`cursor-${h}`):"";r.className=this.wrapClassName(`track-mask${p?` ${p}`:""}`),this.$box.appendChild(r),this.$box.classList.add(n),this._sideEffect.add(()=>(window.addEventListener("mousemove",m),window.addEventListener("touchmove",m,{passive:!1}),window.addEventListener("mouseup",v),window.addEventListener("touchend",v,{passive:!1}),window.addEventListener("touchcancel",v,{passive:!1}),()=>{window.removeEventListener("mousemove",m),window.removeEventListener("touchmove",m),window.removeEventListener("mouseup",v),window.removeEventListener("touchend",v),window.removeEventListener("touchcancel",v)}),i)}};this._handleTrackStart=w,this._sideEffect.addEventListener(e,"mousedown",w,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(e,"touchstart",w,{passive:!1},"box-resizeHandles-touchstart")}destroy(){this.$box.remove(),this.events.emit(ue.Destroyed),this._sideEffect.flushAll(),this._renderSideEffect.flushAll(),this.events.removeAllListeners(),this._delegateEvents.removeAllListeners()}wrapClassName(e){return`${this.namespace}-${e}`}}function Gu(){}var dv="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class cr{constructor({visible:e=!0,readonly:i=!1,darkMode:n=!1,namespace:r="telebox",styles:s={},onClick:a,getBoxesStatus:o}){this.$appMenuContainer=document.createElement("div"),this.handleCollectorClick=()=>{!this._readonly&&this.onClick&&this.onClick()},this._visible=e,this._readonly=i,this._darkMode=n,this.namespace=r,this.styles=s,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 i of e.values())if(i===N.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 i=this.$collector;Object.keys(e).forEach(n=>{const r=e[n];r!=null&&(i.style[n]=r)})}return this}render(){return this.$collector||(this.$collector=document.createElement("button"),this.$collector.className=this.wrapClassName("collector"),this.$collector.style.backgroundImage=`url('${dv}')`,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}`}}var le=(t=>(t.Focused="focused",t.Blurred="blurred",t.Created="created",t.Removed="removed",t.State="state",t.Maximized="maximized",t.Minimized="minimized",t.Move="move",t.Resize="resize",t.IntrinsicMove="intrinsic_move",t.IntrinsicResize="intrinsic_resize",t.VisualResize="visual_resize",t.ZIndex="z_index",t.PrefersColorScheme="prefers_color_scheme",t.DarkMode="dark_mode",t.BoxStatus="box_status",t.LastNotMinimizedBoxStatus="last_not_minimized_box_status",t))(le||{});class fv extends dd{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(n=>n===N.Maximized)}return!1}get MaximizedBoxes(){if(this.getBoxesStatus){const e=this.getBoxesStatus();if(e)return this.boxes.filter(i=>e&&e.get(i.id)===N.Maximized)}return[]}focusBox(e){var i,n;if(!(this.focusedBox&&this.focusedBox===e)){if(this.$titles){const{children:r}=this.$titles.firstElementChild;if(this.state===N.Maximized&&!this.hasMaximizedBoxInStatus())for(let s=r.length-1;s>=0;s-=1){const a=r[s],o=(i=a.dataset)==null?void 0:i.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 s=r.length-1;s>=0;s-=1){const a=r[s],o=(n=a.dataset)==null?void 0:n.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:i,y:n,width:r}=e;this.$titleBar.style.transform=`translate(${i}px, ${n}px)`,this.$titleBar.style.width=r+"px"}}updateBoxesStatus(){this.hasMaximizedBoxInStatus()&&this.setBoxStatus(N.Maximized),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===N.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===N.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===N.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:i,y:n,width:r}=this.containerRect;e.style.transform=`translate(${i}px, ${n}px)`,e.style.width=r+"px",e.classList.add(this.wrapClassName("max-titlebar")),e.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===N.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 s=document.createElement("div");return s.classList.add(this.wrapClassName("titles-area")),e.insertBefore(s,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===N.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 e=document.createElement("div");return e.className=this.wrapClassName("titles-content"),this.$titles.appendChild(e),(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")),e.appendChild(n)}),this.$titles}}class pv{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=i=>{i.stopPropagation(),i.stopImmediatePropagation();const r=i.target.getAttribute(`data-${this.c("app-id")}`);if(r){const s=this.manager.getLastNotMinimizedBoxStatus(r)||N.Normal,a=(s===N.Maximized?this.manager.getMaxMaximizedBoxZIndex():this.manager.getMaxNormalBoxZIndex())+1;this.manager.setBox(r,{status:s,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 i=this.manager.getMinimizedBoxesStatus();this.render(i)},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(i=>{i===N.Minimized&&e.push(i)}),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 i=document.createElement("div");i.classList.add(this.c("app-menu-item")),i.setAttribute(`data-${this.c("app-id")}`,e);const n=document.createElement("div");n.classList.add(this.c("app-menu-item-title"));const r=this.manager.getBox(e);return n.innerText=(r==null?void 0:r.title)||e,i.appendChild(n),i}renderMenuView(e){const i=[];e.forEach((n,r)=>{i.push(this.createMinimizedItem(r))}),this.menuView.append(...i)}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 Fs{constructor({root:e=document.body,prefersColorScheme:i=vl.Light,minimized:n=!1,maximized:r=!1,fence:s=!0,containerRect:a={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collector:o,namespace:l="telebox",readonly:u=!1,useBoxesStatus:c=!1}={}){this.events=new Ka,this._sideEffect=new hs,this.useBoxesStatus=c;const{combine:h,createVal:m}=hd(this._sideEffect);this.root=e,this.namespace=l,this.boxes$=m([]),this.topBox$=this.boxes$.derive(C=>{if(C.length>0){let S;return C.reduce((k,R)=>R.boxStatus&&R.boxStatus===N.Minimized?k:k?k.zIndex>R.zIndex?k:R:(k=R,k),S)}}),this.boxesStatus$=new Map,this.lastNotMinimizedBoxesStatus$=new Map;const v=window.matchMedia("(prefers-color-scheme: dark)"),w=m(!1);v&&(w.setValue(v.matches),this._sideEffect.add(()=>{const C=S=>{w.setValue(S.matches)};return v.addListener(C),()=>v.removeListener(C)}));const M=m(i);M.reaction((C,S,_)=>{this.boxes.forEach(k=>k.setPrefersColorScheme(C,_)),_||this.events.emit(le.PrefersColorScheme,C)}),this._darkMode$=h([w,M],([C,S])=>S==="auto"?C:S==="dark"),this._darkMode$.reaction((C,S,_)=>{this.boxes.forEach(k=>k.setDarkMode(C,_)),_||this.events.emit(le.DarkMode,C)});const d=m(u);d.reaction((C,S,_)=>{this.boxes.forEach(k=>k.setReadonly(C,_))});const f=m(n),p=m(r);p.reaction((C,S,_)=>{this.boxes.forEach(k=>k.setMaximized(C,_)),_||this.events.emit(le.Maximized,C)});const g=h([f,p],([C,S])=>C?N.Minimized:S?N.Maximized:N.Normal);g.reaction((C,S,_)=>{this.maxTitleBar.setState(C),_||this.events.emit(le.State,C)});const y=m(s);y.subscribe((C,S,_)=>{this.boxes.forEach(k=>k.setFence(C,_))});const x=m(a,lt);x.reaction((C,S,_)=>{this.boxes.forEach(k=>k.setContainerRect(C,_)),this.maxTitleBar.setContainerRect(C)});const E=m(o===null?null:o||new cr({visible:n,readonly:u,namespace:l}).mount(e));E.subscribe(C=>{C&&(C.setVisible(f.value),C.setReadonly(d.value),C.setDarkMode(this._darkMode$.value),this.useBoxesStatus&&this.appMenu&&this.appMenu.setContainer(C.$appMenuContainer),this._sideEffect.add(()=>(C.getBoxesStatus=()=>this.boxesStatus$,C.onClick=()=>{d.value||(this.useBoxesStatus?this.useBoxesStatus&&this.appMenu&&this.appMenu.containerClickHandler():f.setValue(!1))},()=>C.destroy()),"collect-onClick"))}),d.subscribe(C=>{var S;return(S=E.value)==null?void 0:S.setReadonly(C)}),this._darkMode$.subscribe(C=>{var S;(S=E.value)==null||S.setDarkMode(C)}),this._calcCollectorRect=()=>{var C;if((C=E.value)!=null&&C.$collector){const{x:S,y:_,width:k,height:R}=E.value.$collector.getBoundingClientRect(),G=this.root.getBoundingClientRect();return{x:S-G.x,y:_-G.y,width:k,height:R}}},this._setCollectorRect=C=>{var S;(S=E.value)!=null&&S.$collector&&z.setValue(C)};const z=m(f.value?this._calcCollectorRect():void 0);z.subscribe((C,S,_)=>{this.boxes.forEach(k=>{k.setCollectorRect(C,_)})}),f.subscribe((C,S,_)=>{var k;(k=E.value)==null||k.setVisible(C),C&&this._setCollectorRect(this._calcCollectorRect()),this.boxes.forEach(R=>R.setMinimized(C,_)),_||this.events.emit(le.Minimized,C)});const P=this.wrapClassName("titlebar-icon-close"),B=C=>{var S;if(d.value)return;const _=C.target;if(!!_.tagName)for(let k=_;k;k=k.parentElement){if(k.classList&&k.classList.contains(P))return;const R=(S=k.dataset)==null?void 0:S.teleBoxID;if(R){const G=this.getBox(R);if(G){if(!this.useBoxesStatus)this.makeBoxTop(G);else if(G.boxStatus&&G.boxStatus===N.Normal){const ge=this.getMaxNormalBoxZIndex();ge>G.zIndex&&this.setBox(G,{zIndex:ge+1},!1)}else if(G.boxStatus&&G.boxStatus===N.Maximized){const ge=this.getMaxMaximizedBoxZIndex();ge>G.zIndex&&this.setBox(G,{zIndex:ge+1},!1),this.makeMaximizedTopBoxFocus()}this.focusBox(G);return}}}};this._sideEffect.addEventListener(window,"mousedown",B,!0),this._sideEffect.addEventListener(window,"touchstart",B,!0),this.maxTitleBar=new fv({darkMode:this.darkMode,readonly:d.value,namespace:this.namespace,state:g.value,boxes:this.boxes$.value,containerRect:x.value,getBoxesStatus:()=>this.boxesStatus$,onEvent:C=>{switch(C.type){case Pe.Maximize:{if(this.hasBoxesStatus()){let S=this.maxTitleBar.focusedBox;if(S||(S=this.getMaximizedTopBox()),S!=null&&S.id){const _=this.getBox(S.id);_&&this.setBox(_,{status:N.Normal,zIndex:this.getMaxNormalBoxZIndex()+1},!1,()=>{this.makeMaximizedTopBoxFocus()})}}else p.setValue(!p.value);break}case Pe.Minimize:{if(this.hasBoxesStatus()){let S=this.maxTitleBar.focusedBox;if(S||(S=this.getMaximizedTopBox()),S!=null&&S.id){const _=this.getBox(S.id);if(_){let k=!1;_.focus&&(this.blurBox(_),k=!0),this.setBox(_,{status:N.Minimized,zIndex:-1},!1),k?this.focusTopBox():this.makeMaximizedTopBoxFocus()}}}else f.setValue(!0);break}case ue.Close:{if(this.hasBoxesStatus()){let S=this.maxTitleBar.focusedBox;if(S||(S=this.getMaximizedTopBox()),S!=null&&S.id){const _=this.getBox(S.id);if(_){let k=!1;_.focus&&(this.blurBox(_),k=!0),this.remove(_,!1),k?this.focusTopBox():this.makeMaximizedTopBoxFocus()}}}else this.removeTopBox(),this.focusTopBox();break}}}}),d.subscribe(C=>this.maxTitleBar.setReadonly(C)),this._darkMode$.subscribe(C=>{this.maxTitleBar.setDarkMode(C)}),this.boxes$.reaction(C=>{this.maxTitleBar.setBoxes(C)}),cd(this,{prefersColorScheme:M,containerRect:x,collector:E,collectorRect:z,readonly:d,fence:y,minimized:f,maximized:p}),this._state$=g,this.root.appendChild(this.maxTitleBar.render()),c&&(this.appMenu=this.createMinimizedAppMenu())}get boxes(){return this.boxes$.value}get topBox(){return this.topBox$.value}get darkMode(){return this._darkMode$.value}get state(){return this._state$.value}setState(e,i=!1){switch(e){case N.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case N.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}setBoxStatus(e,i,n=!1){if(i){const r=this.boxesStatus$.get(e);this.boxesStatus$.set(e,i),i===N.Minimized&&r!==N.Minimized?this.setLastNotMinimizedBoxStatus(e,r,n):r===N.Minimized&&i!==N.Minimized&&this.setLastNotMinimizedBoxStatus(e,void 0,n)}else this.boxesStatus$.delete(e),this.setLastNotMinimizedBoxStatus(e,void 0,n);n||this.events.emit(le.BoxStatus,{id:e,boxStatus:i})}getBoxStatus(e){return this.boxesStatus$.get(e)}get boxesStatus(){return this.boxesStatus$}get lastNotMinimizedBoxesStatus(){return this.lastNotMinimizedBoxesStatus$}setBoxesStatus(e,i=!1){this.boxesStatus$=e,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(e){if(!this.useBoxesStatus)return;let i;const n=this.topBox;this.boxes.forEach(r=>{var s;const a=this.boxesStatus$.get(r.id);a&&(a!==N.Minimized&&r.zIndex>((s=i==null?void 0:i.zIndex)!=null?s:0)&&(i=r),r.setBoxStatus(a,e))}),this.effectBoxStatusChange(),i&&n!==i&&this.topBox$.setValue(i),!i&&n&&this.topBox$.setValue(void 0)}async effectBoxesStatusChange(e=!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!==e)clearTimeout(this.effectBoxesStatusTimer.timer),this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(!!((n=this.effectBoxesStatusTimer)!=null&&n.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(s=>{this.effectBoxesStatusTimer.resolve=s,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===N.Minimized):!1}getMinimizedBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((i,n)=>{i===N.Minimized&&e.set(n,i)}),e}getNotMinimizedBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((i,n)=>{i!==N.Minimized&&e.set(n,i)}),e}getAllMaximizedBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((i,n)=>{i===N.Maximized&&e.set(n,i)}),e}getAllNormalBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((i,n)=>{i===N.Normal&&e.set(n,i)}),e}getLastNotMinimizedBoxStatus(e){return this.lastNotMinimizedBoxesStatus$.get(e)}setLastNotMinimizedBoxStatus(e,i,n=!1){i?this.lastNotMinimizedBoxesStatus$.set(e,i):this.lastNotMinimizedBoxesStatus$.delete(e),n||this.events.emit(le.LastNotMinimizedBoxStatus,{id:e,boxStatus:i})}setLastNotMinimizedBoxesStatus(e,i=!1){this.lastNotMinimizedBoxesStatus$=e,this.effectLastNotMinimizedBoxStatusChange(i)}async effectLastNotMinimizedBoxStatusChange(e=!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!==e)this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((n=this.effectLastNotMinimizedBoxStatusTimer)!=null&&n.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(s=>{this.effectLastNotMinimizedBoxStatusTimer.resolve=s,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(i=>{const n=this.lastNotMinimizedBoxesStatus$.get(i.id);n&&i.setLastNotMinimizedBoxStatus(n,e)})}getUnabledBoxesStatusZIndex(){return this.topBox?this.topBox.zIndex:99}getMaxMaximizedBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((e,i)=>i.boxStatus&&i.boxStatus===N.Maximized?Math.max(e,i.zIndex):e,99):this.getUnabledBoxesStatusZIndex()}getMaxNormalBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((e,i)=>i.boxStatus&&i.boxStatus===N.Normal?Math.max(e,i.zIndex):e,299):this.getUnabledBoxesStatusZIndex()}create(e={},i=!0){const n=new hv({zIndex:this.getMaxNormalBoxZIndex()+1,...i?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 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(Pe.Maximize,()=>{this.useBoxesStatus&&n.boxStatus?n.boxStatus===N.Maximized?this.setBox(n.id,{status:N.Normal,zIndex:this.getMaxNormalBoxZIndex()+1},!1):([...this.boxes].filter(r=>r.boxStatus===N.Normal).sort((r,s)=>r.zIndex-s.zIndex).forEach(r=>{r.boxStatus===N.Normal&&this.setBox(r.id,{status:N.Maximized,zIndex:this.getMaxMaximizedBoxZIndex()+1},!1)}),this.makeMaximizedTopBoxFocus()):this.setMaximized(!this.maximized)}),n._delegateEvents.on(Pe.Minimize,()=>{n.boxStatus&&this.useBoxesStatus?(n.focus&&this.blurBox(n),this.setBox(n,{status:N.Minimized,zIndex:-1},!1,()=>{this.focusTopBox()})):this.setMinimized(!0)}),n._delegateEvents.on(Pe.Close,()=>{this.useBoxesStatus&&n.focus&&this.blurBox(n),this.remove(n),this.focusTopBox()}),n._coord$.reaction((r,s,a)=>{a||this.events.emit(le.Move,n)}),n._size$.reaction((r,s,a)=>{a||this.events.emit(le.Resize,n)}),n._intrinsicCoord$.reaction((r,s,a)=>{a||this.events.emit(le.IntrinsicMove,n)}),n._intrinsicSize$.reaction((r,s,a)=>{a||this.events.emit(le.IntrinsicResize,n)}),n._visualSize$.reaction((r,s,a)=>{a||this.events.emit(le.VisualResize,n)}),n._zIndex$.reaction((r,s,a)=>{if(this.boxes.length>0){let o;const l=this.boxes.reduce((u,c)=>c.boxStatus&&c.boxStatus===N.Minimized?u:u?u.zIndex>c.zIndex?u:c:(u=c,u),o);this.topBox$.setValue(l)}a||this.events.emit(le.ZIndex,n)}),this.events.emit(le.Created,n),n}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,i,n=!1){const r=this.boxes.find(s=>s.id===e);if(r)return this.updateBox(r,i,n)}updateAll(e,i=!1){this.boxes.forEach(n=>{this.updateBox(n,e,i)})}setBox(e,i,n=!1,r){const s=this.getBox(e);if(s){const{status:a,zIndex:o,lastNotMinimizedBoxStatus:l}=i;a&&(this.setBoxStatus(s.id,a,n),s.setBoxStatus(a,n),this.effectBoxStatusChange()),o&&s.setZIndex(o,n),l&&(this.setLastNotMinimizedBoxStatus(s.id,l,n),s.setLastNotMinimizedBoxStatus(l,n)),r&&r()}}remove(e,i=!1,n){const r=this.getBox(e),s=this.getBoxIndex(e);if(s>=0){const a=this.boxes.slice(),o=a.splice(s,1);return this.boxes$.setValue(a),o.forEach(l=>l.destroy()),r&&this.useBoxesStatus&&(this.setBoxStatus(r.id,void 0,i),this.setLastNotMinimizedBoxStatus(r.id,void 0,i),this.effectBoxStatusChange(),n&&n()),i||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(le.Removed,o)),o[0]}}removeTopBox(){if(this.topBox)return this.remove(this.topBox)}removeAll(e=!1){const i=this.boxes$.value;return this.boxes$.setValue([]),i.forEach(n=>n.destroy()),this.boxesStatus$.clear(),this.lastNotMinimizedBoxesStatus$.clear(),e||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(le.Removed,i)),i}destroy(e=!1){this.events.removeAllListeners(),this._sideEffect.flushAll(),this.removeAll(e),Object.keys(this).forEach(i=>{const n=this[i];n instanceof ur&&n.destroy()})}wrapClassName(e){return`${this.namespace}-${e}`}focusBox(e,i=!1){const n=this.getBox(e);n&&(this.boxes.forEach(r=>{if(n===r){let s=!1;n.focus||(s=!0,n.setFocus(!0,i)),s&&!i&&this.events.emit(le.Focused,n)}else r.focus&&this.blurBox(r,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(e,i=!1){const n=this.getBox(e);n&&(n.focus&&(n.setFocus(!1,i),i||this.events.emit(le.Blurred,n)),this.maxTitleBar.focusedBox===n&&this.maxTitleBar.focusBox())}blurAll(e=!1){this.boxes.forEach(i=>{i.focus&&(i.setFocus(!1,e),e||this.events.emit(le.Blurred,i))}),this.maxTitleBar.focusedBox&&this.maxTitleBar.focusBox()}teleBoxMatcher(e){const i=Object.keys(e);return n=>i.every(r=>e[r]===n[r])}updateBox(e,i,n=!1){(i.x!=null||i.y!=null)&&e.move(i.x==null?e.intrinsicX:i.x,i.y==null?e.intrinsicY:i.y,n),(i.width!=null||i.height!=null)&&e.resize(i.width==null?e.intrinsicWidth:i.width,i.height==null?e.intrinsicHeight:i.height,n),i.title!=null&&(e.setTitle(i.title),this.maxTitleBar.updateTitles()),i.visible!=null&&e.setVisible(i.visible,n),i.minHeight!=null&&e.setMinHeight(i.minHeight,n),i.minWidth!=null&&e.setMinWidth(i.minWidth,n),i.resizable!=null&&e.setResizable(i.resizable,n),i.draggable!=null&&e.setDraggable(i.draggable,n),i.fixRatio!=null&&e.setFixRatio(i.fixRatio,n),i.zIndex!=null&&e.setZIndex(i.zIndex,n),i.content!=null&&e.mountContent(i.content),i.footer!=null&&e.mountFooter(i.footer),this.useBoxesStatus&&(i.boxStatus||i.lastNotMinimizedBoxStatus)&&this.setBox(e,{status:i.boxStatus,lastNotMinimizedBoxStatus:i.lastNotMinimizedBoxStatus},n)}smartPosition(e={}){let{x:i,y:n}=e;const{width:r=.5,height:s=.5}=e;if(i==null){let a=20;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===N.Minimized&&o.lastNotMinimizedBoxStatus&&o.lastNotMinimizedBoxStatus===N.Normal).reduce((o,l)=>Math.max(o,l.intrinsicX*this.containerRect.width+20),a)),i=a/this.containerRect.width}if(n==null){let a=20;this.topBox?(a=this.topBox.intrinsicY*this.containerRect.height+20,a>this.containerRect.height-s*this.containerRect.height&&(a=20)):this.hasMinimizedBox()&&(a=[...this.boxes].filter(o=>o.boxStatus&&o.boxStatus===N.Minimized&&o.lastNotMinimizedBoxStatus&&o.lastNotMinimizedBoxStatus===N.Normal).reduce((o,l)=>Math.max(o,l.intrinsicY*this.containerRect.height+20),a)),n=a/this.containerRect.height}return{...e,x:i,y:n,width:r,height:s}}makeBoxTop(e,i=!1){!this.useBoxesStatus&&this.topBox?e!==this.topBox&&e.setZIndex(this.topBox.zIndex+1,i):this.useBoxesStatus}getMaximizedTopBox(){if(!this.useBoxesStatus)return;let e;return this.maxTitleBar.hasMaximizedBoxInStatus()&&(e=this.maxTitleBar.MaximizedBoxes.reduce((i,n)=>i&&i.zIndex>n.zIndex?i:n)),e}makeMaximizedTopBoxFocus(){if(!this.useBoxesStatus)return;const e=this.getMaximizedTopBox();this.maxTitleBar.focusBox(e)}getBoxIndex(e){return typeof e=="string"?this.boxes.findIndex(i=>i.id===e):this.boxes.findIndex(i=>i===e)}getBox(e){return typeof e=="string"?this.boxes.find(i=>i.id===e):e}createMinimizedAppMenu(){var e,i;if((e=this.collector)!=null&&e.$appMenuContainer)return new pv({manager:this,container:(i=this.collector)==null?void 0:i.$appMenuContainer,theme:this.prefersColorScheme?"dark":"light",getBoxesStatus:()=>this.boxesStatus$})}}const gv=(t,e,i,n,r)=>{const s=Nt(Qs,Z.extendClass);return new s({safeSetAttributes:a=>t.safeSetAttributes(a),getMainView:()=>t.mainView,updateAppState:(...a)=>{var o;return(o=t.appManager)==null?void 0:o.store.updateAppState(...a)},setBoxStatus:(a,o)=>{var l;return(l=t.appManager)==null?void 0:l.store.setBoxStatus(a,o)},setLastNotMinimizedBoxStatus:(a,o)=>{var l;return(l=t.appManager)==null?void 0:l.store.setLastNotMinimizedBoxStatus(a,o)},canOperate:()=>t.canOperate,notifyContainerRectUpdate:a=>{var o;return(o=t.appManager)==null?void 0:o.notifyContainerRectUpdate(a)},cleanFocus:()=>{var a;return(a=t.appManager)==null?void 0:a.store.cleanFocus()},setAppFocus:a=>{var o;return(o=t.appManager)==null?void 0:o.store.setAppFocus(a,!0)},callbacks:e,emitter:i,boxEmitter:n},r)};class Qs{constructor(e,i){this.context=e,this.createTeleBoxManagerConfig=i;const{emitter:n,callbacks:r,boxEmitter:s}=e;this.teleBoxManager=this.setupBoxManager(i),this.teleBoxManager._state$.reaction(a=>{r.emit("boxStateChange",a),n.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(l=>{l.resize(l.intrinsicWidth+o,l.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=>{s.emit("close",{appId:o.id})})}),this.teleBoxManager.events.on("intrinsic_move",T.debounce(a=>{s.emit("move",{appId:a.id,x:a.intrinsicX,y:a.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",T.debounce(a=>{s.emit("resize",{appId:a.id,width:a.intrinsicWidth,height:a.intrinsicHeight})},200)),this.teleBoxManager.events.on("focused",a=>{a&&(this.canOperate?s.emit("focus",{appId:a.id}):this.teleBoxManager.blurBox(a.id))}),this.teleBoxManager.events.on("blurred",a=>{a&&this.canOperate&&s.emit("blurred",{appId:a.id})}),this.teleBoxManager.events.on("z_index",a=>{this.context.updateAppState(a.id,ke.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)}),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(e){var u,c,h;if(!this.teleBoxManager)return;let{minwidth:i=Bg,minheight:n=zg}=(u=e.app.config)!=null?u:{};const{width:r,height:s}=(c=e.app.config)!=null?c:{},a=((h=e.options)==null?void 0:h.title)||e.appId,o=this.teleBoxManager.containerRect;i>1&&(i=i/o.width),n>1&&(n=n/o.height);const l={title:a,minWidth:i,minHeight:n,width:r,height:s,id:e.appId,boxStatus:e.boxStatus};this.teleBoxManager.create(l,e.smartPosition),this.context.emitter.emit(`${e.appId}${K.WindowCreated}`)}setBoxInitState(e){const i=this.teleBoxManager.queryOne({id:e});i&&i.state===N.Maximized&&this.context.boxEmitter.emit("resize",{appId:e,x:i.x,y:i.y,width:i.intrinsicWidth,height:i.intrinsicHeight})}setBoxesStatus(e){const i=new Map(Object.entries(e!=null?e:{}));this.teleBoxManager.setBoxesStatus(i,!0),this.context.callbacks.emit("onBoxesStatusChange",i),this.context.emitter.emit("boxesStatusChange",i)}setLastNotMinimizedBoxesStatus(e){const i=new Map(Object.entries(e!=null?e:{}));this.teleBoxManager.setLastNotMinimizedBoxesStatus(i,!0),this.context.callbacks.emit("onLastNotMinimizedBoxesStatusChange",i),this.context.emitter.emit("lastNotMinimizedBoxesStatusChange",i)}setupBoxManager(e){const i=Z.wrapper?Z.wrapper:document.body,n=i.getBoundingClientRect(),r={root:i,containerRect:{x:0,y:0,width:n.width,height:n.height},fence:!1,prefersColorScheme:e==null?void 0:e.prefersColorScheme,useBoxesStatus:(e==null?void 0:e.useBoxesStatus)||!1},s=Nt(Fs,Z.extendClass),a=new s(r);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=a;const o=(e==null?void 0:e.collectorContainer)||Z.wrapper;return o&&this.setCollectorContainer(o),a}setCollectorContainer(e){var r;const i=Nt(cr,Z.extendClass),n=new i({styles:(r=this.createTeleBoxManagerConfig)==null?void 0:r.collectorStyles}).mount(e);this.teleBoxManager.setCollector(n)}getBox(e){return this.teleBoxManager.queryOne({id:e})}closeBox(e,i=!1){return this.teleBoxManager.remove(e,i)}boxIsFocus(e){const i=this.getBox(e);return i==null?void 0:i.focus}getFocusBox(){return this.teleBoxManager.query({focus:!0})[0]}getTopBox(){return this.teleBoxManager.topBox}updateBoxState(e){if(!e)return;const i=this.getBox(e.id);i&&(this.teleBoxManager.update(i.id,{x:e.x,y:e.y,width:e.width||.5,height:e.height||.5,zIndex:e.zIndex,boxStatus:e.boxStatus,lastNotMinimizedBoxStatus:e.lastNotMinimizedBoxStatus},!0),setTimeout(()=>{e.focus&&this.teleBoxManager.focusBox(i.id,!0),e.maximized!=null&&this.teleBoxManager.setMaximized(Boolean(e.maximized),!0),e.minimized!=null&&this.teleBoxManager.setMinimized(Boolean(e.minimized),!0)},50),this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}updateManagerRect(){var i;const e=(i=this.mainView.divElement)==null?void 0:i.getBoundingClientRect();if(e&&e.width>0&&e.height>0){const n={x:0,y:0,width:e.width,height:e.height};this.teleBoxManager.setContainerRect(n),this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect)}}moveBox({appId:e,x:i,y:n}){this.teleBoxManager.update(e,{x:i,y:n},!0)}focusBox({appId:e},i=!0){this.teleBoxManager.focusBox(e,i)}resizeBox({appId:e,width:i,height:n,skipUpdate:r}){this.teleBoxManager.update(e,{width:i,height:n},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,i=!0){e!==this.maximized&&this.teleBoxManager.setMaximized(e,i)}setMinimized(e,i=!0){this.teleBoxManager.setMinimized(e,i)}focusTopBox(){if(this.teleBoxManager.query().length>=1){const i=this.getTopBox();i&&this.focusBox({appId:i.id},!1)}}updateBox(e,i,n=!0){this.teleBoxManager.update(e,i,n)}setReadonly(e){this.teleBoxManager.setReadonly(e)}setPrefersColorScheme(e){this.teleBoxManager.setPrefersColorScheme(e)}setZIndex(e,i,n=!0){this.teleBoxManager.update(e,{zIndex:i},n)}destroy(){this.teleBoxManager.destroy()}}const qe=(...t)=>{Z.debug&&console.log("[WindowManager]:",...t)},mv=t=>{const e=document.createElement("div");e.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 r=document.createElement("div");return r.className="netless-window-manager-main-view",e.appendChild(i),i.appendChild(n),n.appendChild(r),t.appendChild(e),Z.wrapper=n,{playground:e,wrapper:n,sizer:i,mainViewElement:r}},vv=()=>{if(ju(b.WhiteVersion)<ju(Du))throw new Vh(Du)},ro=(t,e)=>{var s;const i=(t==null?void 0:t.state.roomMembers)||[];let n=-1,r;for(const a of i)((s=a.payload)==null?void 0:s.uid)===e&&n<a.memberId&&(n=a.memberId,r=a);return r},wv=async t=>{let e=t.getInvisiblePlugin(Z.kind);if(e)return e;let i;const n=new Promise(u=>{Z._resolve=i=u});let r=!1;const s=yv(t);!t.isWritable&&s&&(r=!0,await zh.default(async u=>{qe(`switching to writable (x${u})`),await t.setWritable(!0)},{retries:10,maxTimeout:5e3})),t.isWritable?(qe("creating InvisiblePlugin..."),t.createInvisiblePlugin(Z,{}).catch(console.warn)):(s&&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),l=setInterval(()=>{e=t.getInvisiblePlugin(Z.kind),e&&(clearTimeout(o),clearTimeout(a),clearInterval(l),i(e),r&&t.isWritable&&setTimeout(()=>t.setWritable(!1).catch(console.warn),500))},200);return n},yv=t=>{try{const e=atob(t.roomToken.slice(12)),i=e.indexOf("&role=");return+e[i+6]<2}catch(e){return console.error(e),!1}};function Gn(){}function fd(t){return t()}function Xu(){return Object.create(null)}function Zs(t){t.forEach(fd)}function pd(t){return typeof t=="function"}function xv(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Nr;function ds(t,e){return Nr||(Nr=document.createElement("a")),Nr.href=e,t===Nr.href}function Sv(t){return Object.keys(t).length===0}function Ct(t,e){t.appendChild(e)}function Ys(t,e,i){t.insertBefore(e,i||null)}function hr(t){t.parentNode&&t.parentNode.removeChild(t)}function Vt(t){return document.createElement(t)}function wl(t){return document.createTextNode(t)}function so(){return wl(" ")}function ae(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function Mv(t){return Array.from(t.childNodes)}function gd(t,e){e=""+e,t.data!==e&&(t.data=e)}function we(t,e,i,n){i==null?t.style.removeProperty(e):t.style.setProperty(e,i,n?"important":"")}let yl;function jn(t){yl=t}const zi=[],Ju=[];let Wi=[];const Ku=[],Iv=Promise.resolve();let ao=!1;function Cv(){ao||(ao=!0,Iv.then(md))}function oo(t){Wi.push(t)}const Ta=new Set;let ki=0;function md(){if(ki!==0)return;const t=yl;do{try{for(;ki<zi.length;){const e=zi[ki];ki++,jn(e),bv(e.$$)}}catch(e){throw zi.length=0,ki=0,e}for(jn(null),zi.length=0,ki=0;Ju.length;)Ju.pop()();for(let e=0;e<Wi.length;e+=1){const i=Wi[e];Ta.has(i)||(Ta.add(i),i())}Wi.length=0}while(zi.length);for(;Ku.length;)Ku.pop()();ao=!1,Ta.clear(),jn(t)}function bv(t){if(t.fragment!==null){t.update(),Zs(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(oo)}}function Av(t){const e=[],i=[];Wi.forEach(n=>t.indexOf(n)===-1?e.push(n):i.push(n)),i.forEach(n=>n()),Wi=e}const Tv=new Set;function Ev(t,e){t&&t.i&&(Tv.delete(t),t.i(e))}function Nv(t,e,i,n){const{fragment:r,after_update:s}=t.$$;r&&r.m(e,i),n||oo(()=>{const a=t.$$.on_mount.map(fd).filter(pd);t.$$.on_destroy?t.$$.on_destroy.push(...a):Zs(a),t.$$.on_mount=[]}),s.forEach(oo)}function kv(t,e){const i=t.$$;i.fragment!==null&&(Av(i.after_update),Zs(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function Pv(t,e){t.$$.dirty[0]===-1&&(zi.push(t),Cv(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Bv(t,e,i,n,r,s,a,o=[-1]){const l=yl;jn(t);const u=t.$$={fragment:null,ctx:[],props:s,update:Gn,not_equal:r,bound:Xu(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:Xu(),dirty:o,skip_bound:!1,root:e.target||l.$$.root};a&&a(u.root);let c=!1;if(u.ctx=i?i(t,e.props||{},(h,m,...v)=>{const w=v.length?v[0]:m;return u.ctx&&r(u.ctx[h],u.ctx[h]=w)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](w),c&&Pv(t,h)),m}):[],u.update(),c=!0,Zs(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const h=Mv(e.target);u.fragment&&u.fragment.l(h),h.forEach(hr)}else u.fragment&&u.fragment.c();e.intro&&Ev(t.$$.fragment),Nv(t,e.target,e.anchor,e.customElement),md()}jn(l)}class zv{$destroy(){kv(this,1),this.$destroy=Gn}$on(e,i){if(!pd(i))return Gn;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(i),()=>{const r=n.indexOf(i);r!==-1&&n.splice(r,1)}}$set(e){this.$$set&&!Sv(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function qu(t){let e,i,n,r,s,a,o,l=t[18]&&ec(t),u=t[19]&&tc(t);return{c(){e=Vt("div"),i=Vt("div"),l&&l.c(),n=so(),r=Vt("span"),s=wl(t[1]),a=so(),u&&u.c(),we(r,"overflow","hidden"),we(r,"white-space","nowrap"),we(r,"text-overflow","ellipsis"),we(r,"max-width","80px"),ae(i,"class",t[9]),we(i,"background-color",t[3]),we(i,"color",t[10]),we(i,"opacity",t[12]),ae(e,"class",o="netless-window-manager-cursor-name "+t[16]+" "+t[15])},m(c,h){Ys(c,e,h),Ct(e,i),l&&l.m(i,null),Ct(i,n),Ct(i,r),Ct(r,s),Ct(i,a),u&&u.m(i,null)},p(c,h){c[18]?l?l.p(c,h):(l=ec(c),l.c(),l.m(i,n)):l&&(l.d(1),l=null),h&2&&gd(s,c[1]),c[19]?u?u.p(c,h):(u=tc(c),u.c(),u.m(i,null)):u&&(u.d(1),u=null),h&512&&ae(i,"class",c[9]),h&8&&we(i,"background-color",c[3]),h&1024&&we(i,"color",c[10]),h&4096&&we(i,"opacity",c[12]),h&98304&&o!==(o="netless-window-manager-cursor-name "+c[16]+" "+c[15])&&ae(e,"class",o)},d(c){c&&hr(e),l&&l.d(),u&&u.d()}}}function ec(t){let e,i;return{c(){e=Vt("img"),ae(e,"class","netless-window-manager-cursor-selector-avatar"),ae(e,"style",t[20]()),ds(e.src,i=t[8])||ae(e,"src",i),ae(e,"alt","avatar")},m(n,r){Ys(n,e,r)},p(n,r){r&256&&!ds(e.src,i=n[8])&&ae(e,"src",i)},d(n){n&&hr(e)}}}function tc(t){let e,i;return{c(){e=Vt("span"),i=wl(t[2]),ae(e,"class","netless-window-manager-cursor-tag-name"),we(e,"background-color",t[11])},m(n,r){Ys(n,e,r),Ct(e,i)},p(n,r){r&4&&gd(i,n[2]),r&2048&&we(e,"background-color",n[11])},d(n){n&&hr(e)}}}function Dv(t){let e,i,n,r,s,a,o,l=!t[14]&&qu(t);return{c(){e=Vt("div"),l&&l.c(),i=so(),n=Vt("div"),r=Vt("img"),ae(r,"class",s="netless-window-manager-cursor-"+t[4]+"-image "+t[15]),ds(r.src,a=t[7])||ae(r,"src",a),ae(r,"alt",t[4]),ae(n,"class","cursor-image-wrapper"),ae(e,"class",o="netless-window-manager-cursor-mid"+(t[13]?" netless-window-manager-cursor-custom":"")),we(e,"transform","translateX("+t[5]+"px) translateY("+t[6]+"px)"),we(e,"display",t[17]),ae(e,"data-cursor-uid",t[0])},m(u,c){Ys(u,e,c),l&&l.m(e,null),Ct(e,i),Ct(e,n),Ct(n,r)},p(u,[c]){u[14]?l&&(l.d(1),l=null):l?l.p(u,c):(l=qu(u),l.c(),l.m(e,i)),c&32784&&s!==(s="netless-window-manager-cursor-"+u[4]+"-image "+u[15])&&ae(r,"class",s),c&128&&!ds(r.src,a=u[7])&&ae(r,"src",a),c&16&&ae(r,"alt",u[4]),c&8192&&o!==(o="netless-window-manager-cursor-mid"+(u[13]?" netless-window-manager-cursor-custom":""))&&ae(e,"class",o),c&96&&we(e,"transform","translateX("+u[5]+"px) translateY("+u[6]+"px)"),c&131072&&we(e,"display",u[17]),c&1&&ae(e,"data-cursor-uid",u[0])},i:Gn,o:Gn,d(u){u&&hr(e),l&&l.d()}}}function Lv(t,e,i){let n,r,s,a,o,l,u,c,{uid:h}=e,{cursorName:m}=e,{tagName:v}=e,{backgroundColor:w}=e,{appliance:M}=e,{x:d}=e,{y:f}=e,{src:p}=e,{visible:g}=e,{avatar:y}=e,{theme:x}=e,{color:E}=e,{cursorTagBackgroundColor:z}=e,{opacity:P}=e,{pencilEraserSize:B}=e,{custom:te}=e;const C=()=>Object.entries({width:(n?19:28)+"px",height:(n?19:28)+"px",position:n?"initial":"absolute","border-color":n?"white":w,"margin-right":(n?4:0)+"px"}).map(([S,_])=>`${S}: ${_}`).join(";");return t.$$set=S=>{"uid"in S&&i(0,h=S.uid),"cursorName"in S&&i(1,m=S.cursorName),"tagName"in S&&i(2,v=S.tagName),"backgroundColor"in S&&i(3,w=S.backgroundColor),"appliance"in S&&i(4,M=S.appliance),"x"in S&&i(5,d=S.x),"y"in S&&i(6,f=S.y),"src"in S&&i(7,p=S.src),"visible"in S&&i(21,g=S.visible),"avatar"in S&&i(8,y=S.avatar),"theme"in S&&i(9,x=S.theme),"color"in S&&i(10,E=S.color),"cursorTagBackgroundColor"in S&&i(11,z=S.cursorTagBackgroundColor),"opacity"in S&&i(12,P=S.opacity),"pencilEraserSize"in S&&i(22,B=S.pencilEraserSize),"custom"in S&&i(13,te=S.custom)},t.$$.update=()=>{t.$$.dirty&2&&(n=!T.isEmpty(m)),t.$$.dirty&4&&i(19,r=!T.isEmpty(v)),t.$$.dirty&256&&i(18,s=!T.isEmpty(y)),t.$$.dirty&2097152&&i(17,a=g?"":"none"),t.$$.dirty&16&&i(14,o=M===b.ApplianceNames.laserPointer),t.$$.dirty&16400&&i(23,l=o||M===b.ApplianceNames.pencilEraser),t.$$.dirty&8388608&&i(16,u=l?"netless-window-manager-laserPointer-pencilEraser-offset":""),t.$$.dirty&4194304&&i(15,c=B===3?"netless-window-manager-pencilEraser-3-offset":"")},[h,m,v,w,M,d,f,p,y,x,E,z,P,te,o,c,u,a,s,r,C,g,B,l]}class Rv extends zv{constructor(e){super(),Bv(this,e,Lv,Dv,xv,{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 vd="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 wd(t){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${t}' stroke-linejoin='square'/%3E%3Ccircle cx='12' cy='12' r='3.5' stroke='%23${t}'/%3E%3C/g%3E%3C/svg%3E`}function Di(t){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${t}' stroke-linejoin='round'/%3E%3Cpath d='M12 5V19' stroke='%23${t}' stroke-linejoin='round'/%3E%3C/svg%3E`}function ni(t){return`url("${t}") 12 12, auto`}function jv(t){let e="";for(const i in t)e+=`.netless-whiteboard.${i} {cursor: ${t[i]}}
16
- `;return e}const kr=document.createElement("style");function _v(t){const[e,i,n]=t.strokeColor,r=((1<<24)+(e<<16)+(i<<8)+n).toString(16).slice(1);return kr.textContent=jv({"cursor-pencil":ni(wd(r)),"cursor-eraser":ni(vd),"cursor-rectangle":ni(Di(r)),"cursor-ellipse":ni(Di(r)),"cursor-straight":ni(Di(r)),"cursor-arrow":ni(Di(r)),"cursor-shape":ni(Di(r))}),document.head.appendChild(kr),()=>{kr.parentNode!=null&&document.head.removeChild(kr)}}const Vv=new Set([b.ApplianceNames.rectangle,b.ApplianceNames.ellipse,b.ApplianceNames.straight,b.ApplianceNames.arrow,b.ApplianceNames.shape]);function ic(t,e){if(t===b.ApplianceNames.pencil)return wd(e);if(t===b.ApplianceNames.eraser)return vd;if(Vv.has(t))return Di(e)}class Ov{constructor(e,i,n,r){this.manager=e,this.memberId=i,this.cursorManager=n,this.wrapper=r,this.style="default",this.move=s=>{var a;if(s.type==="main"){const o=this.cursorManager.wrapperRect;this.component&&o&&(this.autoHidden(),this.moveCursor(s,o,this.manager.mainView))}else{const o=this.cursorManager.focusView,l=(a=o==null?void 0:o.divElement)==null?void 0:a.getBoundingClientRect(),u=o==null?void 0:o.camera;o&&l&&u&&this.component&&(this.autoHidden(),this.moveCursor(s,l,o))}},this.setStyle=s=>{this.style=s,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(e,i,n){var l,u;const{x:r,y:s,type:a}=e,o=n==null?void 0:n.screen.convertPointToScreen(r,s);if(o){let c=o.x-2,h=o.y-18;if(this.isCustomIcon()&&(c-=11,h+=4),a==="app"){const m=this.cursorManager.wrapperRect;m&&(c=c+i.x-m.x,h=h+i.y-m.y)}o.x<0||o.x>i.width||o.y<0||o.y>i.height?(l=this.component)==null||l.$set({visible:!1,x:c,y:h}):(u=this.component)==null||u.$set({visible:!0,x:c,y:h})}}get memberApplianceName(){var e,i;return(i=(e=this.member)==null?void 0:e.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 r,s;const[e,i,n]=((s=(r=this.member)==null?void 0:r.memberState)==null?void 0:s.strokeColor)||[236,52,85];return((1<<24)+(e<<16)+(i<<8)+n).toString(16).slice(1)}get payload(){var e;return(e=this.member)==null?void 0:e.payload}get memberCursorName(){var e,i;return((e=this.payload)==null?void 0:e.nickName)||((i=this.payload)==null?void 0:i.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 Rv({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 l;if(!this.member)return;const{memberApplianceName:e,memberColorHex:i}=this,{userApplianceIcons:n,applianceIcons:r}=this.cursorManager;let s=this.memberApplianceName;s===b.ApplianceNames.pencilEraser&&(s=`${s}${((l=this.member)==null?void 0:l.memberState.pencilEraserSize)||1}`);const a=s&&n[s];if(a)return a;if(this.style==="custom"&&e){const u=ic(e,i);if(u)return u}return r[s||b.ApplianceNames.shape]||r[b.ApplianceNames.shape]}isCustomIcon(){var a;if(!this.member)return!1;const{memberApplianceName:e,memberColorHex:i}=this,{userApplianceIcons:n}=this.cursorManager;let r=this.memberApplianceName;return r===b.ApplianceNames.pencilEraser&&(r=`${r}${((a=this.member)==null?void 0:a.memberState.pencilEraserSize)||1}`),r&&n[r]?!1:!!(this.style==="custom"&&e&&ic(e,i))}updateMember(){return this.member=ro(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var e;(e=this.component)==null||e.$set(T.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 Uv="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==",$v="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==",Wv="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=",Hv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",Fv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",Qv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",Zv="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMjYiIHZpZXdCb3g9IjAgMCAxOCAyNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIxNyIgaGVpZ2h0PSIyNSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",Yv="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMzQiIHZpZXdCb3g9IjAgMCAyNiAzNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIyNSIgaGVpZ2h0PSIzMyIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",Gv="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iNTAiIHZpZXdCb3g9IjAgMCAzNCA1MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIzMyIgaGVpZ2h0PSI0OSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K";const Xv={[b.ApplianceNames.pencil]:Uv,[b.ApplianceNames.selector]:$v,[b.ApplianceNames.eraser]:Wv,[b.ApplianceNames.shape]:Hv,[b.ApplianceNames.text]:Fv,[b.ApplianceNames.laserPointer]:Qv,pencilEraser1:Zv,pencilEraser2:Yv,pencilEraser3:Gv},nc="local-cursor";class Gs{constructor(e,i,n,r){var o;this.manager=e,this.enableCursor=i,this.cursorInstances=new Map,this.userApplianceIcons={},this.sideEffectManager=new lr,this.store=this.manager.store,this.leaveFlag=!0,this._style="default",this.onCursorMove=l=>{const u=this.initCursorInstance(l.uid);if(l.state===Ga.Leave)u.leave();else{const c=u.updateMember();this.canMoveCursor(c)&&u.move(l.position)}},this.initCursorInstance=l=>{let u=this.cursorInstances.get(l);return u||(u=new Ov(this.manager,l,this,Z.wrapper),this.cursorInstances.set(l,u)),u},this.mouseMoveListener_=(l,u)=>{const c=this.getType(l);this.updateCursor(c,l.clientX,l.clientY),u&&this.showPencilEraserIfNeeded(c,l.clientX,l.clientY)},this.mouseMoveTimer=0,this.mouseMoveListener=l=>{const u=l.pointerType==="touch";if(u&&!l.isPrimary)return;const c=Date.now();if(c-this.mouseMoveTimer>48){if(this.mouseMoveTimer=c,Z.supportAppliancePlugin&&b.isRoom(Z.displayer)&&Z.displayer.disableDeviceInputs){this.leaveFlag&&(this.manager.dispatchInternalEvent(K.CursorMove,{uid:this.manager.uid,state:Ga.Leave}),this.leaveFlag=!1);return}this.mouseMoveListener_(l,u),this.leaveFlag=!0}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.getPoint=(l,u,c)=>{var m;const h=(m=l==null?void 0:l.divElement)==null?void 0:m.getBoundingClientRect();if(h)return l==null?void 0:l.convertToPointInWorld({x:u-h.x,y:c-h.y})},this.getType=l=>{var h;const u=l.target,c=this.manager.focusApp;switch(u.parentElement){case this.mainViewElement:return{type:"main"};case((h=c==null?void 0:c.view)==null?void 0:h.divElement):return{type:"app"};default:return{type:"main"}}},this.roomMembers=(o=this.manager.room)==null?void 0:o.state.roomMembers;const s=Z.wrapper;s&&this.setupWrapper(s),this.sideEffectManager.add(()=>O.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>O.on("playgroundSizeChange",()=>this.updateContainerRect()));const a=this.manager.room;a&&this.sideEffectManager.add(()=>{const l=u=>{this.style==="custom"&&u.memberState&&this.enableCustomCursor()};return a.callbacks.on("onRoomStateChanged",l),()=>a.callbacks.off("onRoomStateChanged",l)}),r&&(this.userApplianceIcons=r),this.style=(n==null?void 0:n.style)||"default"}get applianceIcons(){return{...Xv,...this.userApplianceIcons}}get style(){return this._style}set style(e){this._style!==e&&(this._style=e,this.cursorInstances.forEach(i=>{i.setStyle(e)}),e==="custom"?this.enableCustomCursor():this.sideEffectManager.flush(nc))}enableCustomCursor(){this.sideEffectManager.add(()=>_v(this.manager.getMemberState()),nc)}canMoveCursor(e){const i=(e==null?void 0:e.memberState.currentApplianceName)===b.ApplianceNames.laserPointer;return this.enableCursor||i}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,i,n){const r=ro(this.manager.room,this.manager.uid),s=(r==null?void 0:r.memberState.currentApplianceName)===b.ApplianceNames.pencilEraser;if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)&&s){const a=e.type==="main"?this.manager.mainView:this.focusView,o=this.getPoint(a,i,n);o&&this.onCursorMove({uid:this.manager.uid,position:{x:o.x,y:o.y,type:e.type}})}}updateCursor(e,i,n){const r=ro(this.manager.room,this.manager.uid);if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)){const s=e.type==="main"?this.manager.mainView:this.focusView,a=this.getPoint(s,i,n);a&&this.manager.dispatchInternalEvent(K.CursorMove,{uid:this.manager.uid,position:{x:a.x,y:a.y,type:e.type}})}}updateContainerRect(){var e,i;this.containerRect=(e=Z.container)==null?void 0:e.getBoundingClientRect(),this.wrapperRect=(i=Z.wrapper)==null?void 0:i.getBoundingClientRect()}deleteCursor(e){this.store.cleanCursor(e);const i=this.cursorInstances.get(e);i&&i.destroy()}hideCursor(e){const i=this.cursorInstances.get(e);i&&i.hide()}destroy(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach(e=>{e.destroy()}),this.cursorInstances.clear())}}function Nt(t,e){switch(t.name){case"AppManager":return(e==null?void 0:e.AppManager)||Js;case"BoxManager":return(e==null?void 0:e.BoxManager)||Qs;case"AttributesDelegate":return(e==null?void 0:e.AttributesDelegate)||Xs;case"CursorManager":return(e==null?void 0:e.CursorManager)||Gs;case"AppProxy":return(e==null?void 0:e.AppProxy)||on;case"AppContext":return(e==null?void 0:e.AppContext)||$s;case"TeleBoxManager":return(e==null?void 0:e.TeleBoxManager)||Fs;case"TeleBoxCollector":return(e==null?void 0:e.TeleBoxCollector)||cr;default:return t}}var ye=(t=>(t.Apps="apps",t.Focus="focus",t.State="state",t.BoxState="boxState",t.MainViewCamera="mainViewCamera",t.MainViewSize="mainViewSize",t.Broadcaster="broadcaster",t.Cursors="cursors",t.Position="position",t.CursorState="cursorState",t.FullPath="fullPath",t.Registered="registered",t.IframeBridge="iframeBridge",t.BoxesStatus="boxesStatus",t.LastNotMinimizedBoxesStatus="lastNotMinimizedBoxesStatus",t))(ye||{});class Xs{constructor(e){this.context=e,this.setAppFocus=(i,n)=>{n?this.context.safeSetAttributes({focus:i}):this.context.safeSetAttributes({focus:void 0})}}setContext(e){this.context=e}get attributes(){return this.context.getAttributes()}apps(){return T.get(this.attributes,["apps"])}get focus(){return T.get(this.attributes,["focus"])}getAppAttributes(e){return T.get(this.apps(),[e])}getAppState(e){return T.get(this.apps(),[e,"state"])}getMaximized(){return T.get(this.attributes,["maximized"])}getMinimized(){return T.get(this.attributes,["minimized"])}getBoxesStatus(){return T.get(this.attributes,["boxesStatus"])}getBoxStatus(e){return T.get(this.attributes,["boxesStatus",e])}setBoxStatus(e,i){this.attributes.boxesStatus||this.context.safeSetAttributes({boxesStatus:{}}),this.getBoxStatus(e)!==i&&this.context.safeUpdateAttributes(["boxesStatus",e],i)}getLastNotMinimizedBoxesStatus(){return T.get(this.attributes,["lastNotMinimizedBoxesStatus"])}getLastNotMinimizedBoxStatus(e){return T.get(this.attributes,["lastNotMinimizedBoxesStatus",e])}setLastNotMinimizedBoxStatus(e,i){this.attributes.lastNotMinimizedBoxesStatus||this.context.safeSetAttributes({lastNotMinimizedBoxesStatus:{}}),this.getLastNotMinimizedBoxStatus(e)!==i&&this.context.safeUpdateAttributes(["lastNotMinimizedBoxesStatus",e],i)}setupAppAttributes(e,i,n){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const s=["scenePath","title"];n||s.push("scenes");const a=T.pick(e.options,s),o={kind:e.kind,options:a,isDynamicPPT:n};typeof e.src=="string"&&(o.src=e.src),o.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",i],o),this.context.safeUpdateAttributes(["apps",i,"state"],{[ke.Size]:{},[ke.Position]:{},[ke.SceneIndex]:0})}updateAppState(e,i,n){T.get(this.attributes,["apps",e,"state"])&&this.context.safeUpdateAttributes(["apps",e,"state",i],n)}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 i;return(i=this.getAppState(e))==null?void 0:i[ke.SceneIndex]}getAppScenePath(e){var i,n;return(n=(i=this.getAppAttributes(e))==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(e){this.context.safeSetAttributes({_mainScenePath:e})}setMainViewSceneIndex(e){this.context.safeSetAttributes({_mainSceneIndex:e})}getMainViewCamera(){return T.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return T.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,i){i.width===0||i.height===0||this.context.safeSetAttributes({mainViewCamera:{...e},mainViewSize:{...i}})}updateCursor(e,i){T.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),T.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],i)}updateCursorState(e,i){T.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],i)}getCursorState(e){return T.get(this.attributes,["cursors",e,"cursorState"])}cleanCursor(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}setMainViewFocusPath(e){const i=this.getMainViewScenePath();i&&wi(e,i)}getIframeBridge(){return T.get(this.attributes,["iframeBridge"])}setIframeBridge(e){if(T.isObject(e)){const i=this.getIframeBridge();for(const n in e){const r=e[n];i[n]!==r&&this.context.safeUpdateAttributes(["iframeBridge",n],r)}}}}const Jv=(t,e={getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}})=>{const i=Nt(Xs,t);return new i(e)},xl=(t,e)=>{let i=0;const n=e.length-1;return t===e.index?t===n?i=t-1:i=e.index+1:i=e.index,i},ct=new Ci.default;class on{constructor(e,i,n,r){var s;this.params=e,this.manager=i,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=a=>{var p,g,y,x;const o=this.store.getAppState(a);if(!o)return;const l=o==null?void 0:o[ke.Position],u=this.store.focus,c=o==null?void 0:o[ke.Size],h=o==null?void 0:o[ke.SceneIndex],m=(p=this.attributes)==null?void 0:p.maximized,v=(g=this.attributes)==null?void 0:g.minimized,w=(y=this.store.getBoxStatus(a))!=null?y:void 0,M=(x=this.store.getLastNotMinimizedBoxStatus(a))!=null?x:void 0,d=o==null?void 0:o.zIndex;let f={maximized:m,minimized:v,zIndex:d};return l&&(f={...f,id:a,x:l.x,y:l.y}),u===a&&(f={...f,focus:!0}),c&&(f={...f,width:c.width,height:c.height}),h&&(f={...f,sceneIndex:h}),w&&(f={...f,boxStatus:w}),M&&(f={...f,lastNotMinimizedBoxStatus:M}),f},this.appAttributesUpdateListener=a=>{this.manager.refresher.add(a,()=>b.autorun(()=>{const o=this.manager.attributes[a];o&&this.appEmitter.emit("attributesUpdate",o)})),this.manager.refresher.add(this.stateKey,()=>b.autorun(()=>{var l,u,c,h;const o=(l=this.appAttributes)==null?void 0:l.state;(o==null?void 0:o.zIndex)>0&&o.zIndex!==((u=this.box)==null?void 0:u.zIndex)&&((c=this.boxManager)==null||c.setZIndex(a,o.zIndex),(h=this.boxManager)==null||h.focusBox({appId:a}))})),this.manager.refresher.add(`${a}-fullPath`,()=>b.autorun(()=>{var l;const o=(l=this.appAttributes)==null?void 0:l.fullPath;this.setFocusScenePathHandler(o),this._prevFullPath!==o&&(this.notifyPageStateChange(),this._prevFullPath=o)}))},this.setFocusScenePathHandler=T.debounce(a=>{var o;this.view&&a&&a!==((o=this.view)==null?void 0:o.focusScenePath)&&(wi(this.view,a),Y.emit("onAppScenePathChange",{appId:this.id,view:this.view}))},50),this.notifyPageStateChange=T.debounce(()=>{this.appEmitter.emit("pageStateChange",this.pageState)},50),this.notifyBoxStatusChange=a=>{this.appEmitter.emit("boxStatusChange",{appId:this.id,status:a})},this.kind=e.kind,this.id=n,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new Ci.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=r,this.initScenes(),(s=this.params.options)!=null&&s.scenePath&&this.createView(),this._pageState=new lm({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}initScenes(){var i;const e=this.params.options;e&&(this.scenePath=e.scenePath,((i=this.appAttributes)==null?void 0:i.isDynamicPPT)&&this.scenePath?this.scenes=Ji(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)}getFullScenePath(){if(this.scenePath)return T.get(this.appAttributes,[ye.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const e=T.get(this.appAttributes,["state","SceneIndex"],0),i=Jg(this.manager.room,this.scenePath,e);return i&&this.setFullPath(i),i}setFullPath(e){this.manager.safeUpdateAttributes(["apps",this.id,ye.FullPath],e)}async baseInsertApp(e=!1){var s;const i=this.params;if(!i.kind)throw new Error("[WindowManager]: kind require");const n=await((s=Ce.appClasses.get(i.kind))==null?void 0:s()),r=Ce.registered.get(i.kind);if(n)await this.setupApp(this.id,e,n,i.options,r==null?void 0:r.appOptions,this.manager.useBoxesStatus?N.Normal:void 0);else throw new Error(`[WindowManager]: app load failed ${i.kind} ${i.src}`);return O.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,i,n,r,s,a){var u;if(qe("setupApp",e,n,r,a),!this.boxManager)throw new Wh;const o=Nt($s,Z.extendClass),l=new o(this.manager,this.boxManager,e,this,s);this.appContext=l;try{O.once(`${e}${K.WindowCreated}`).then(async()=>{var m;let c;i||(c=this.getAppInitState(e),(m=this.boxManager)==null||m.updateBoxState(c)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(e),this.setViewFocusScenePath();let h;this.manager.isReplay&&(h=this.manager.mainView.scenePath),setTimeout(async()=>{console.log("setup app",n);const v=await n.setup(l);this.appResult=v,Ce.notifyApp(this.kind,"created",{appId:e,result:v}),this.afterSetupApp(c),this.fixMobileSize(),h&&this.manager.mainViewProxy.setFocusScenePath(h),Y.emit("onAppSetup",e)},Rh)}),(u=this.boxManager)==null||u.createBox({appId:e,app:n,options:r,canOperate:this.manager.canOperate,smartPosition:this.isAddApp,boxStatus:a}),this.isAddApp&&this.box&&(a&&this.store.setBoxStatus(e,a),this.store.updateAppState(e,ke.ZIndex,this.box.zIndex),this.store.updateAppState(e,ke.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:e},!1))}catch(c){throw console.error(c),new Error(`[WindowManager]: app setup error: ${c.message}`)}}fixMobileSize(){var i,n;const e=(i=this.boxManager)==null?void 0:i.getBox(this.id);e&&((n=this.boxManager)==null||n.resizeBox({appId:this.id,width:e.intrinsicWidth+.001,height:e.intrinsicHeight+.001,skipUpdate:!0}))}afterSetupApp(e){var i;e&&(!(e!=null&&e.x)||!e.y)&&((i=this.boxManager)==null||i.setBoxInitState(this.id))}async onSeek(e){var n;this.appEmitter.emit("seek",e).catch(r=>{console.log(`[WindowManager]: emit seek error: ${r.message}`)});const i=this.getAppInitState(this.id);(n=this.boxManager)==null||n.updateBoxState(i)}async onReconnected(){var a;if(!Boolean(this.manager.attributes.apps[this.id])){await this.destroy(!0,!1,!0);return}this.appEmitter.emit("reconnected",void 0);const i=this.getAppInitState(this.id);await this.destroy(!0,!1,!0);const n=this.params,r=Nt(on,Z.extendClass);await new r(n,this.manager,this.id,this.isAddApp).baseInsertApp(!0),(a=this.boxManager)==null||a.updateBoxState(i)}async onRemoveScene(e){if(this.scenePath&&e.startsWith(this.scenePath+"/")){let i=this.pageState.index,n=this._pageState.getFullPath(i);n||(i=0,n=this._pageState.getFullPath(i)),n&&this.setFullPath(n),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=i)}}emitAppSceneStateChange(e){this.appEmitter.emit("sceneStateChange",e)}emitAppIsWritableChange(){this.appEmitter.emit("writableChange",this.isWritable)}makeAppEventListener(e){return(i,n)=>{var r,s,a,o;if(!!this.manager.canOperate)switch(i){case"setBoxSize":{(r=this.boxManager)==null||r.resizeBox({appId:e,width:n.width,height:n.height,skipUpdate:!1});break}case"setBoxMinSize":{(s=this.boxManager)==null||s.setBoxMinSize({appId:e,minWidth:n.minwidth,minHeight:n.minheight});break}case"setBoxTitle":{(a=this.boxManager)==null||a.setBoxTitle({appId:e,title:n.title});break}case Dh.destroy:{if(this.status==="destroyed")return;this.destroy(!0,!1,!0,n==null?void 0:n.error),n!=null&&n.error&&console.error(n==null?void 0:n.error);break}case"focus":{(o=this.boxManager)==null||o.focusBox({appId:this.id}),ct.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const e=this.getFullScenePath();this.manager.room&&e&&this.view&&Xa(this.manager.room,e)}setViewFocusScenePath(){const e=this.getFullScenePath();return e&&this.view&&wi(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 i=this._pageState.getFullPath(e);if(i){const n=xl(e,this.pageState);return this.setSceneIndexWithoutSync(n),this.manager.dispatchInternalEvent(K.SetAppFocusIndex,{type:"app",appID:this.id,index:n}),setTimeout(()=>{Ja(this.manager.room,i,e)},100),!0}else return!1}setSceneIndexWithoutSync(e){this.view&&(this.view.focusSceneIndex=e)}setSceneIndex(e){if(this.view){this.view.focusSceneIndex=e;const i=this._pageState.getFullPath(e);i&&this.setFullPath(i)}}async destroy(e,i,n,r){var s;if(this.status!=="destroyed"){this.status="destroyed";try{await Ce.notifyApp(this.kind,"destroy",{appId:this.id}),await this.appEmitter.emit("destroy",{error:r})}catch(a){console.error("[WindowManager]: notifyApp error",a.message,a.stack)}this.appEmitter.clearListeners(),O.emit(`destroy-${this.id}`,{error:r}),e&&((s=this.boxManager)==null||s.closeBox(this.id,n)),i&&(this.store.cleanAppAttributes(this.id),this.scenePath&&Ja(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}}close(){return this.destroy(!0,!0,!1)}}class Kv{constructor(e){this.displayer=e,this.views=new Map}createView(e){const i=yd(this.displayer);return this.views.set(e,i),i}getView(e){return this.views.get(e)}destroyView(e){const i=this.views.get(e);if(i){try{i.release()}catch{}this.views.delete(e)}}setViewScenePath(e,i){const n=this.views.get(e);n&&(n.focusScenePath=i)}destroy(){this.views.forEach(e=>{try{e.release()}catch{}}),this.views.clear()}}const yd=t=>{const e=t.views.createView();return qv(e),e},qv=t=>{t.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class ew{constructor(e){this.manager=e,this.polling=!1,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new lr,this.syncCamera=()=>{if(!this.polling||this.viewMode!==b.ViewMode.Broadcaster)return;const{mainViewCamera:n}=this;n&&n.id!==this.manager.uid&&this.moveCameraSizeByAttributes()},this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>O.on("writableChange",n=>{n&&this.ensureCameraAndSize(),this.manager.room&&this.syncMainView(this.manager.room)}))},this.addCameraReaction=()=>{this.manager.refresher.add(ye.MainViewCamera,this.cameraReaction)},this.cameraReaction=()=>b.reaction(()=>this.mainViewCamera,n=>{n&&n.id!==this.manager.uid&&(this.moveCameraToContian(this.mainViewSize),this.moveCamera(n))},{fireImmediately:!0}),this.sizeChangeHandler=T.debounce(n=>{n&&(this.moveCameraToContian(n),this.moveCamera(this.mainViewCamera)),this.ensureMainViewSize()},30),this.onUpdateContainerSizeRatio=()=>{const n=this.store.getMainViewSize();this.sizeChangeHandler(n)},this.onCameraUpdatedByDevice=n=>{this.viewMode!==b.ViewMode.Follower&&(this.store.setMainViewCamera({...n,id:this.manager.uid}),T.isEqual(this.mainViewSize,{...this.mainView.size,id:this.manager.uid})||this.setMainViewSize(this.view.size))},this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=T.debounce(n=>{this.store.setMainViewSize({...n,id:this.manager.uid})},50),this._syncMainViewTimer=0,this.onCameraOrSizeUpdated=()=>{Y.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.syncMainView=n=>{n.isWritable&&n.syncMainView(this.mainView)},this.setViewMode=n=>{this.viewMode=n},this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),O.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()});const i=()=>{this.sizeChangeHandler(this.mainViewSize)};this.sideEffectManager.add(()=>O.on("playgroundSizeChange",i)),this.sideEffectManager.add(()=>O.on("containerSizeRatioUpdate",this.onUpdateContainerSizeRatio)),this.sideEffectManager.add(()=>O.on("startReconnect",()=>{this.didRelease||this.mainView.release()})),this.sideEffectManager.setInterval(this.syncCamera,1500)}ensureCameraAndSize(){this.viewMode===b.ViewMode.Broadcaster&&(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(K.InitMainViewCamera),this.setCameraAndSize())}get mainViewCamera(){return this.store.getMainViewCamera()}get mainViewSize(){return this.store.getMainViewSize()}get didRelease(){return T.get(this.view,["didRelease"])}moveCameraSizeByAttributes(){this.moveCameraToContian(this.mainViewSize),this.moveCamera(this.mainViewCamera)}start(){this.sizeChangeHandler(this.mainViewSize),!this.started&&(this.addCameraListener(),this.addCameraReaction(),this.manager.room&&this.syncMainView(this.manager.room),this.started=!0)}setCameraAndSize(){const e={...this.mainView.camera,id:this.manager.uid},i={...this.mainView.size,id:this.manager.uid};this.store.setMainViewCameraAndSize(e,i)}get view(){return this.mainView}get cameraState(){return{...this.view.camera,...this.view.size}}createMainView(){const e=yd(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&wi(e,i),e}onReconnect(){if(this.didRelease)this.rebind();else{const e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}setFocusScenePath(e){if(e)return wi(this.view,e)}rebind(){const e=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=e,this.addMainViewListener(),this.start(),Y.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.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}removeCameraListener(){this.view.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}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){T.isEmpty(e)||(this.view.moveCameraToContain({width:e.width,height:e.height,originX:-e.width/2,originY:-e.height/2,animationMode:b.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}moveCamera(e){if(!T.isEmpty(e)){if(T.isEqual(e,this.view.camera))return;const{centerX:i,centerY:n,scale:r}=e,s=r*(this.scale||1);this.view.moveCamera({centerX:i,centerY:n,scale:s,animationMode:b.AnimationMode.Immediately})}}stop(){this.removeCameraListener(),this.manager.refresher.remove(ye.MainViewCamera),this.manager.refresher.remove(ye.MainViewSize),this.started=!1}destroy(){this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class tw{constructor(e){this.context=e,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,r)=>{n(i.canRedoSteps),r(i.canUndoSteps),i.callbacks.on("onCanRedoStepsUpdate",n),i.callbacks.on("onCanUndoStepsUpdate",r)},this.disposeViewCallbacks=i=>{i.callbacks.off("onCanRedoStepsUpdate",this.onCanRedoStepsUpdate),i.callbacks.off("onCanUndoStepsUpdate",this.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=i=>{Y.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{Y.emit("canUndoStepsChange",i)},this.disposePrevFocusViewRedoUndoListeners=i=>{let n;if(i===void 0)n=this.context.mainView();else{const r=this.context.getAppProxy(i);r&&r.view&&(n=r.view)}n&&this.disposeViewCallbacks(n)},O.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),O.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(e.focus()),this.addRedoUndoListeners(e.focus())}),this.addRedoUndoListeners(e.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class Js{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 Lg,this.sideEffectManager=new lr,this.sceneState=null,this.rootDirRemoving=!1,this._useBoxesStatus=!1,this.onRemoveScenes=async i=>{var r,s;const{scenePath:n}=i;if(n===Oe){await this.onRootDirRemoved(),this.dispatchInternalEvent(K.RootDirRemoved);return}if(im(n)){let a=this.mainView.focusSceneIndex||0,o=(r=this.callbacksNode)==null?void 0:r.scenes[a];o||(a=0,o=(s=this.callbacksNode)==null?void 0:s.scenes[a]),o&&this.setMainViewScenePath(`${Oe}${o}`),await this.setMainViewSceneIndex(a)}else this.appProxies.forEach(a=>{a.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(Oe,{onAddScene:this.onSceneChange,onRemoveScene:async(n,r)=>{await this.onSceneChange(n),O.emit("rootDirSceneRemoved",r)}}),this.callbacksNode&&(this.updateSceneState(this.callbacksNode),this.mainViewScenesLength=this.callbacksNode.scenes.length,i&&this.emitMainViewScenesChange(this.callbacksNode.scenes.length))},this.removeSceneByIndex=async i=>{var s;const n=xl(i,this.windowManger.pageState);this.setSceneIndexWithoutSync(n),this.dispatchInternalEvent(K.SetAppFocusIndex,{type:"main",index:n});const r=(s=this.callbacksNode)==null?void 0:s.scenes[i];return setTimeout(()=>{r&&Ja(this.room,`${Oe}${r}`,i)},100),new Promise((a,o)=>{O.once("rootDirSceneRemoved").then(l=>{l===r&&a(!0)}).catch(l=>{console.log(`[WindowManager]: removePage error: ${l}`),o(!1)})})},this.setSceneIndexWithoutSync=i=>{var r;const n=(r=this.callbacksNode)==null?void 0:r.scenes[i];n&&this.mainViewProxy.setFocusScenePath(`${Oe}${n}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([Y.emit("mainViewScenesLengthChange",i),O.emit("changePageState")]),this.updateSceneState=i=>{const n=this.store.getMainViewSceneIndex()||0;let r=i.scenes[n];r||(r=i.scenes[this.mainView.focusSceneIndex||0]),this.sceneState={scenePath:`${Oe}${r}`,contextPath:i.path,index:n,scenes:i.scenes.map(s=>({name:s})),sceneName:r},Y.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(K.AppMove,i),this.store.updateAppState(i.appId,ke.Position,{x:i.x,y:i.y}),Y.emit("onBoxMove",i)},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(K.AppResize,i),this.store.updateAppState(i.appId,ke.Size,{width:i.width,height:i.height}),Y.emit("onBoxResize",i))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId}),Y.emit("onBoxFocus",i)},this.onBoxBlurred=i=>{this.attributes.focus===i.appId&&(this.windowManger.safeSetAttributes({focus:void 0}),Y.emit("onBoxBlurred",i))},this.onBoxClose=i=>{const n=this.appProxies.get(i.appId);n&&n.destroy(!1,!0,!0,i.error),Y.emit("onBoxClose",i)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(K.AppBoxStateChange,i),Y.emit("onBoxStateChange",i)},this.notifyBoxesStatusChange=T.debounce(()=>{const i=Object.entries(this.attributes.boxesStatus);i.length>0&&i.forEach(([n,r])=>{const s=this.appProxies.get(n);s&&s.notifyBoxStatusChange(r)})},50),this.addBoxesStatusChangeListener=()=>{this.refresher.add("boxesStatus",()=>Tn(()=>this.attributes.boxesStatus,()=>{var i;(i=this.boxManager)==null||i.setBoxesStatus(this.attributes.boxesStatus),this.notifyBoxesStatusChange()})),this.refresher.add("lastNotMinimizedBoxesStatus",()=>Tn(()=>this.attributes.lastNotMinimizedBoxesStatus,()=>{var i;(i=this.boxManager)==null||i.setLastNotMinimizedBoxesStatus(this.attributes.lastNotMinimizedBoxesStatus)}))},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>Tn(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{this.refresher.add("appsClose",()=>Tn(()=>this.attributes.apps,i=>{i.some(n=>n.kind===b.UpdateEventKind.Removed)&&this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this._prevSceneIndex!==i&&(Y.emit("mainViewSceneIndexChange",i),O.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this._prevSceneIndex=i)},this.onFocusChange=i=>{var n;this._prevFocused!==i&&(Y.emit("focusedChange",i),O.emit("focusedChange",{focused:i,prev:this._prevFocused}),this._prevFocused=i,i!==void 0&&((n=this.boxManager)==null||n.focusBox({appId:i}),setTimeout(()=>{const r=this.appProxies.get(i);r&&Ce.notifyApp(r.kind,"focus",{appId:i})},0)))},this.attributesUpdateCallback=T.debounce(i=>this._attributesUpdateCallback(i),100),this._appIds=[],this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([n,r])=>{Ce.appClasses.has(n)||Ce.register({kind:n,src:r.src,name:r.name})})},this.onMinimized=i=>{var n,r;((n=this.boxManager)==null?void 0:n.minimized)!==i&&(i===!0&&((r=this.boxManager)==null||r.blurAllBox()),setTimeout(()=>{var s;(s=this.boxManager)==null||s.setMinimized(Boolean(i))},0))},this.onAppDelete=async i=>{const n=Object.keys(i);for(const[r,s]of this.appProxies.entries())n.includes(r)||await s.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)}),O.emit("observerIdChange",this.displayer.observerId)},this.displayerWritableListener=i=>{var s,a;const n=!i,r=this.windowManger.readonly===void 0||this.windowManger.readonly===!1;this.windowManger.readonly===void 0?(s=this.boxManager)==null||s.setReadonly(i):(a=this.boxManager)==null||a.setReadonly(!(n&&r)),this.appProxies.forEach(o=>{o.emitAppIsWritableChange()}),O.emit("writableChange",n)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),n=wa(i),r=Ji(this.displayer)[n];if(r.length){const s=i.replace(n,"").replace("/",""),a=r.findIndex(o=>o.name===s);T.isInteger(a)&&a>=0&&this.safeSetAttributes({_mainSceneIndex:a})}},this.updateRootDirRemoving=i=>{this.rootDirRemoving=i},this.displayer=e.displayer,this.store=Jv(Z.extendClass,{getAttributes:()=>this.attributes,safeSetAttributes:i=>this.safeSetAttributes(i),safeUpdateAttributes:(i,n)=>this.safeUpdateAttributes(i,n)}),this.mainViewProxy=new ew(this),this.viewManager=new Kv(this.displayer),this.appListeners=new nm(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=Sg,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:O}),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()}),O.once("onCreated").then(()=>this.onCreated()),O.on("onReconnected",()=>this.onReconnected()),b.isPlayer(this.displayer)&&(O.on("seekStart",this.onPlayerSeekStart),O.on("seek",this.onPlayerSeekDone)),O.on("removeScenes",this.onRemoveScenes),O.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),Ce.setSyncRegisterApp(i=>{this.safeUpdateAttributes([ye.Registered,i.kind],i)})}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(Lh),this.createRootDirScenesCallback();for(const[i,n]of this.appProxies.entries())n.view&&await this.closeApp(i,e);this.mainViewProxy.rebind(),O.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return b.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return b.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)||""}getMainViewSceneDir(){const e=this.store.getMainViewScenePath();if(e)return wa(e);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var e;if(Object.keys(this.attributes.apps).length&&this.store.focus&&await new Promise(i=>{this._focusAppCreatedResolve=i}).then(()=>{this.focusByAttributes(this.attributes.apps)}),await this.attributesUpdateCallback(this.attributes.apps),this.focusByAttributes(this.attributes.apps),O.emit("updateManagerRect"),ct.on("move",this.onBoxMove),ct.on("resize",this.onBoxResize),ct.on("focus",this.onBoxFocus),ct.on("close",this.onBoxClose),ct.on("boxStateChange",this.onBoxStateChange),ct.on("blurred",this.onBoxBlurred),this.addAppsChangeListener(),this.addAppCloseListener(),this.addBoxesStatusChangeListener(),this.refresher.add("maximized",()=>b.autorun(()=>{var n;const i=this.attributes.maximized;(n=this.boxManager)==null||n.setMaximized(Boolean(i))})),this.refresher.add("minimized",()=>b.autorun(()=>{const i=this.attributes.minimized;this.onMinimized(i)})),this.refresher.add("mainViewIndex",()=>b.autorun(()=>{const i=T.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>b.autorun(()=>{const i=T.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>b.autorun(()=>{const i=T.get(this.attributes,ye.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(!((e=this.room)!=null&&e.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this._prevFocused=this.attributes.focus,this.sideEffectManager.add(()=>{const i=new tw({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:n=>this.appProxies.get(n)});return()=>i.destroy()})}notifyAppsChange(e){(this._appIds.length!==e.length||!this._appIds.every(i=>e.includes(i)))&&(this._appIds=e,Y.emit("appsChange",e))}async _attributesUpdateCallback(e){if(e&&Z.container){const i=Object.keys(e);i.length===0&&this.appCreateQueue.emitReady();const r=T.orderBy(i.map(s=>({id:s,createdAt:e[s].createdAt})),"createdAt","asc").map(({id:s})=>s);this.notifyAppsChange(r);for(const s of r)if(!this.appProxies.has(s)&&!this.appStatus.has(s)){const a=e[s];try{if(!this.attributes[s])throw new Error("appAttributes is undefined");this.appCreateQueue.push(async()=>{this.appStatus.set(s,Ya.StartCreate);const l=await this.baseInsertApp({kind:a.kind,options:a.options,isDynamicPPT:a.isDynamicPPT},s,!1);return l&&this.store.focus===s&&this._focusAppCreatedResolve&&this._focusAppCreatedResolve(l),l}),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,i){const n=this.mainViewProxy.view;n.disableCameraTransform=i,n.divElement=e,n.focusScenePath||this.setMainViewFocusPath(),O.emit("mainViewMounted"),Y.emit("onMainViewMounted",n)}setMainViewFocusPath(e){var n;const i=e||this.store.getMainViewScenePath();if(i)return wi(this.mainView,i),((n=this.mainView)==null?void 0:n.focusScenePath)===i}resetScenePath(e){this.displayer.state.sceneState.scenePath!==e&&Xa(this.room,e)}async addApp(e,i){qe("addApp",e);const{appId:n,needFocus:r}=await this.beforeAddApp(e,i),s=await this.baseInsertApp(e,n,!0,r);return this.afterAddApp(s),s==null?void 0:s.id}async beforeAddApp(e,i){var a,o;const n=await Xg(e.kind);this.appStatus.set(n,Ya.StartCreate);const r=(a=e.attributes)!=null?a:{};this.safeUpdateAttributes([n],r),this.store.setupAppAttributes(e,n,i);const s=!((o=this.boxManager)!=null&&o.minimized);return s&&this.store.setAppFocus(n,!0),{appId:n,needFocus:s}}afterAddApp(e){var i,n;if(e&&e.box){const r=e.box;ct.emit("move",{appId:e.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(e.id,ke.ZIndex,r.zIndex)}(i=this.boxManager)!=null&&i.minimized&&((n=this.boxManager)==null||n.setMinimized(!1,!1))}async closeApp(e,i=!0){const n=this.appProxies.get(e);n&&n.destroy(!0,i,!1)}async baseInsertApp(e,i,n,r){if(this.appProxies.has(i)){console.warn("[WindowManager]: app duplicate exists and cannot be created again");return}const s=Nt(on,Z.extendClass),a=new s(e,this,i,n);if(a)return await a.baseInsertApp(r),this.appStatus.delete(i),a;throw this.appStatus.delete(i),new Error("[WindowManger]: initialize AppProxy failed")}safeSetAttributes(e){this.windowManger.safeSetAttributes(e)}safeUpdateAttributes(e,i){this.windowManger.safeUpdateAttributes(e,i)}async setMainViewScenePath(e){if(this.room){const i=this.displayer.scenePathType(e);if(wa(e)!==Oe)throw new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===b.ScenePathType.None)throw new Error(`[WindowManager]: ${e} not valid scene`);if(i===b.ScenePathType.Page)await this._setMainViewScenePath(e);else if(i===b.ScenePathType.Dir){const r=qg(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 i;if(this.room){if(this.store.getMainViewSceneIndex()===e)return;const n=(i=this.callbacksNode)==null?void 0:i.scenes[e],r=`${Oe}${n}`;if(n)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.store.setMainViewSceneIndex(e),this.dispatchSetMainViewScenePath(r));else throw new Error(`[WindowManager]: ${e} not valid index`)}}dispatchSetMainViewScenePath(e){this.dispatchInternalEvent(K.SetMainViewScenePath,{nextScenePath:e}),Y.emit("mainViewScenePathChange",e),Xa(this.room,e)}getAppInitPath(e){var n;const i=this.store.getAppAttributes(e);if(i)return(n=i==null?void 0:i.options)==null?void 0:n.scenePath}safeDispatchMagixEvent(e,i){this.canOperate&&this.displayer.dispatchMagixEvent(e,i)}focusByAttributes(e){var i;if(e&&Object.keys(e).length===((i=this.boxManager)==null?void 0:i.boxSize)){const n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}async onReconnected(){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(e){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",e)})}dispatchInternalEvent(e,i){this.safeDispatchMagixEvent(Za,{eventName:e,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),ct.clearListeners(),O.clearListeners(),this.appProxies.size&&this.appProxies.forEach(e=>{e.destroy(!0,!1,!0)}),Y.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0,this._focusAppCreatedResolve=void 0}}const iw=window.ResizeObserver||Ng.ResizeObserver;class Sl{constructor(e){this.emitter=e}static create(e,i,n,r){const s=new Sl(r);return s.observePlaygroundSize(e,i,n),s}observePlaygroundSize(e,i,n){this.updateSizer(e.getBoundingClientRect(),i,n),this.containerResizeObserver=new iw(r=>{var a;const s=(a=r[0])==null?void 0:a.contentRect;s&&(this.updateSizer(s,i,n),this.emitter.emit("playgroundSizeChange",s))}),this.disposer=this.emitter.on("containerSizeRatioUpdate",()=>{const r=e.getBoundingClientRect();this.updateSizer(r,i,n),this.emitter.emit("playgroundSizeChange",r)}),this.containerResizeObserver.observe(e)}updateSizer({width:e,height:i},n,r){e&&i&&(i/e>Z.containerSizeRatio?(i=e*Z.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(e=i/Z.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!1)),r.style.width=`${e}px`,r.style.height=`${i}px`)}disconnect(){var e;(e=this.containerResizeObserver)==null||e.disconnect(),T.isFunction(this.disposer)&&(this.disposer(),this.disposer=void 0)}}class nw{constructor(e){this.manager=e,O.on("changePageState",()=>{Y.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 rw{constructor(e){this.ctx=e,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=async i=>{var n,r;i===b.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===b.RoomPhase.Connected&&this.phase===b.RoomPhase.Reconnecting&&((n=this.room)!=null&&n.isWritable?(r=this.room)==null||r.dispatchMagixEvent(va,{}):(await jh(500),this.onReconnected())),this.phase=i},this.onReconnected=T.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{qe("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,n)=>{T.isFunction(i)&&this.disposers.set(n,i())}),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(va,i=>{i.authorId===e.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(e){this.ctx=e}releaseDisposers(){this.disposers.forEach(e=>{T.isFunction(e)&&e()}),this.disposers.clear()}refresh(){this._onReconnected()}add(e,i){const n=this.disposers.get(e);n&&T.isFunction(n)&&n(),T.isFunction(i)&&(this.reactors.set(e,i),this.disposers.set(e,i()))}remove(e){this.reactors.has(e)&&this.reactors.delete(e);const i=this.disposers.get(e);i&&(T.isFunction(i)&&i(),this.disposers.delete(e))}hasReactor(e){return this.reactors.has(e)}destroy(){var e,i;(e=this.room)==null||e.callbacks.off("onPhaseChanged",this.onPhaseChanged),(i=this.room)==null||i.removeMagixEventListener(va,this.onReconnected),this.releaseDisposers()}}const sw=(t,e)=>{if(b.isPlayer(t))ow(t);else{if(t=t,Object.getOwnPropertyDescriptor(t,"disableCameraTransform"))return;Object.defineProperty(t,"disableCameraTransform",{get(){return e.mainView.disableCameraTransform},set(n){e.mainView.disableCameraTransform=n}}),Object.defineProperty(t,"canUndoSteps",{get(){return e.canUndoSteps}}),Object.defineProperty(t,"canRedoSteps",{get(){return e.canRedoSteps}}),t.moveCamera=n=>e.moveCamera(n),t.moveCameraToContain=(...n)=>e.moveCameraToContain(...n),t.convertToPointInWorld=(...n)=>e.mainView.convertToPointInWorld(...n),t.setCameraBound=(...n)=>e.mainView.setCameraBound(...n),t.scenePreview=(...n)=>e.mainView.scenePreview(...n),t.fillSceneSnapshot=(...n)=>e.mainView.fillSceneSnapshot(...n),t.generateScreenshot=(...n)=>e.mainView.generateScreenshot(...n),t.setMemberState=(...n)=>e.mainView.setMemberState(...n),t.redo=()=>e.redo(),t.undo=()=>e.undo(),t.cleanCurrentScene=()=>e.cleanCurrentScene(),t.delete=()=>e.delete(),t.copy=()=>e.copy(),t.paste=()=>e.paste(),t.duplicate=()=>e.duplicate(),t.insertImage=(...n)=>e.insertImage(...n),t.completeImageUpload=(...n)=>e.completeImageUpload(...n),t.insertText=(...n)=>e.insertText(...n),t.lockImage=(...n)=>e.lockImage(...n),t.lockImages=(...n)=>e.lockImages(...n),aw(t,e)}},aw=(t,e)=>{const i=t.removeScenes;t.removeScenes=(n,r)=>{var a;n===Oe&&((a=e.appManager)==null||a.updateRootDirRemoving(!0));const s=i.call(t,n);return O.emit("removeScenes",{scenePath:n,index:r}),s}},ow=t=>{const e=t.seekToProgressTime;async function i(n){await O.emit("seekStart");const r=await e.call(t,n);return O.emit("seek",n),r}t.seekToProgressTime=i};var lw=`.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}
17
- `;const uw=(t,e,i,n)=>{if(i==="length"||i==="prototype"||i==="arguments"||i==="caller")return;const r=Object.getOwnPropertyDescriptor(t,i),s=Object.getOwnPropertyDescriptor(e,i);!cw(r,s)&&n||Object.defineProperty(t,i,s)},cw=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},hw=(t,e)=>{const i=Object.getPrototypeOf(e);i!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,i)},dw=(t,e)=>`/* Wrapped ${t}*/
18
- ${e}`,fw=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),pw=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),gw=(t,e,i)=>{const n=i===""?"":`with ${i.trim()}() `,r=dw.bind(null,n,e.toString());Object.defineProperty(r,"name",pw),Object.defineProperty(t,"toString",{...fw,value:r})};function mw(t,e,{ignoreNonConfigurable:i=!1}={}){const{name:n}=t;for(const r of Reflect.ownKeys(e))uw(t,e,r,i);return hw(t,e),gw(t,e,n),t}const vw=(t,e={})=>{if(typeof t!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``);const{wait:i=0,maxWait:n=Number.POSITIVE_INFINITY,before:r=!1,after:s=!0}=e;if(!r&&!s)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let a,o,l;const u=function(...c){const h=this,m=()=>{a=void 0,o&&(clearTimeout(o),o=void 0),s&&(l=t.apply(h,c))},v=()=>{o=void 0,a&&(clearTimeout(a),a=void 0),s&&(l=t.apply(h,c))},w=r&&!a;return clearTimeout(a),a=setTimeout(m,i),n>0&&n!==Number.POSITIVE_INFINITY&&!o&&(o=setTimeout(v,n)),w&&(l=t.apply(h,c)),l};return mw(u,t),u.cancel=()=>{a&&(clearTimeout(a),a=void 0),o&&(clearTimeout(o),o=void 0)},u};var ww="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",yw=87,xw=20,rc=[],Sw=()=>{for(let t=0;t<xw;t++)rc[t]=ww.charAt(Math.random()*yw);return rc.join("")};function xd(t){try{return t()}catch(e){console.error(e)}}var Ks=class{constructor(){this.push=this.addDisposer,this.disposers=new Map}addDisposer(t,e=this.genUID()){return this.flush(e),this.disposers.set(e,Array.isArray(t)?Mw(t):t),e}add(t,e=this.genUID()){const i=t();return i?this.addDisposer(i,e):e}addEventListener(t,e,i,n,r=this.genUID()){return t.addEventListener(e,i,n),this.addDisposer(()=>t.removeEventListener(e,i,n),r),r}setTimeout(t,e,i=this.genUID()){const n=window.setTimeout(()=>{this.remove(i),t()},e);return this.addDisposer(()=>window.clearTimeout(n),i)}setInterval(t,e,i=this.genUID()){const n=window.setInterval(t,e);return this.addDisposer(()=>window.clearInterval(n),i)}remove(t){const e=this.disposers.get(t);return this.disposers.delete(t),e}flush(t){const e=this.remove(t);e&&e()}flushAll(){this.disposers.forEach(xd),this.disposers.clear()}genUID(){let t;do t=Sw();while(this.disposers.has(t));return t}};function Mw(t){return()=>t.forEach(xd)}var hi=[],Iw=function(){return hi.some(function(t){return t.activeTargets.length>0})},Cw=function(){return hi.some(function(t){return t.skippedTargets.length>0})},sc="ResizeObserver loop completed with undelivered notifications.",bw=function(){var t;typeof ErrorEvent=="function"?t=new ErrorEvent("error",{message:sc}):(t=document.createEvent("Event"),t.initEvent("error",!1,!1),t.message=sc),window.dispatchEvent(t)},Xn;(function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Xn||(Xn={}));var di=function(t){return Object.freeze(t)},Aw=function(){function t(e,i){this.inlineSize=e,this.blockSize=i,di(this)}return t}(),Sd=function(){function t(e,i,n,r){return this.x=e,this.y=i,this.width=n,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,di(this)}return t.prototype.toJSON=function(){var e=this,i=e.x,n=e.y,r=e.top,s=e.right,a=e.bottom,o=e.left,l=e.width,u=e.height;return{x:i,y:n,top:r,right:s,bottom:a,left:o,width:l,height:u}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),Ml=function(t){return t instanceof SVGElement&&"getBBox"in t},Md=function(t){if(Ml(t)){var e=t.getBBox(),i=e.width,n=e.height;return!i&&!n}var r=t,s=r.offsetWidth,a=r.offsetHeight;return!(s||a||t.getClientRects().length)},ac=function(t){var e;if(t instanceof Element)return!0;var i=(e=t==null?void 0:t.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(i&&t instanceof i.Element)},Tw=function(t){switch(t.tagName){case"INPUT":if(t.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},_n=typeof window!="undefined"?window:{},Pr=new WeakMap,oc=/auto|scroll/,Ew=/^tb|vertical/,Nw=/msie|trident/i.test(_n.navigator&&_n.navigator.userAgent),ot=function(t){return parseFloat(t||"0")},Hi=function(t,e,i){return t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=!1),new Aw((i?e:t)||0,(i?t:e)||0)},lc=di({devicePixelContentBoxSize:Hi(),borderBoxSize:Hi(),contentBoxSize:Hi(),contentRect:new Sd(0,0,0,0)}),Id=function(t,e){if(e===void 0&&(e=!1),Pr.has(t)&&!e)return Pr.get(t);if(Md(t))return Pr.set(t,lc),lc;var i=getComputedStyle(t),n=Ml(t)&&t.ownerSVGElement&&t.getBBox(),r=!Nw&&i.boxSizing==="border-box",s=Ew.test(i.writingMode||""),a=!n&&oc.test(i.overflowY||""),o=!n&&oc.test(i.overflowX||""),l=n?0:ot(i.paddingTop),u=n?0:ot(i.paddingRight),c=n?0:ot(i.paddingBottom),h=n?0:ot(i.paddingLeft),m=n?0:ot(i.borderTopWidth),v=n?0:ot(i.borderRightWidth),w=n?0:ot(i.borderBottomWidth),M=n?0:ot(i.borderLeftWidth),d=h+u,f=l+c,p=M+v,g=m+w,y=o?t.offsetHeight-g-t.clientHeight:0,x=a?t.offsetWidth-p-t.clientWidth:0,E=r?d+p:0,z=r?f+g:0,P=n?n.width:ot(i.width)-E-x,B=n?n.height:ot(i.height)-z-y,te=P+d+x+p,C=B+f+y+g,S=di({devicePixelContentBoxSize:Hi(Math.round(P*devicePixelRatio),Math.round(B*devicePixelRatio),s),borderBoxSize:Hi(te,C,s),contentBoxSize:Hi(P,B,s),contentRect:new Sd(h,l,P,B)});return Pr.set(t,S),S},Cd=function(t,e,i){var n=Id(t,i),r=n.borderBoxSize,s=n.contentBoxSize,a=n.devicePixelContentBoxSize;switch(e){case Xn.DEVICE_PIXEL_CONTENT_BOX:return a;case Xn.BORDER_BOX:return r;default:return s}},kw=function(){function t(e){var i=Id(e);this.target=e,this.contentRect=i.contentRect,this.borderBoxSize=di([i.borderBoxSize]),this.contentBoxSize=di([i.contentBoxSize]),this.devicePixelContentBoxSize=di([i.devicePixelContentBoxSize])}return t}(),bd=function(t){if(Md(t))return 1/0;for(var e=0,i=t.parentNode;i;)e+=1,i=i.parentNode;return e},Pw=function(){var t=1/0,e=[];hi.forEach(function(a){if(a.activeTargets.length!==0){var o=[];a.activeTargets.forEach(function(u){var c=new kw(u.target),h=bd(u.target);o.push(c),u.lastReportedSize=Cd(u.target,u.observedBox),h<t&&(t=h)}),e.push(function(){a.callback.call(a.observer,o,a.observer)}),a.activeTargets.splice(0,a.activeTargets.length)}});for(var i=0,n=e;i<n.length;i++){var r=n[i];r()}return t},uc=function(t){hi.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(r){r.isActive()&&(bd(r.target)>t?i.activeTargets.push(r):i.skippedTargets.push(r))})})},Bw=function(){var t=0;for(uc(t);Iw();)t=Pw(),uc(t);return Cw()&&bw(),t>0},Ea,Ad=[],zw=function(){return Ad.splice(0).forEach(function(t){return t()})},Dw=function(t){if(!Ea){var e=0,i=document.createTextNode(""),n={characterData:!0};new MutationObserver(function(){return zw()}).observe(i,n),Ea=function(){i.textContent="".concat(e?e--:e++)}}Ad.push(t),Ea()},Lw=function(t){Dw(function(){requestAnimationFrame(t)})},Xr=0,Rw=function(){return!!Xr},jw=250,_w={attributes:!0,characterData:!0,childList:!0,subtree:!0},cc=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],hc=function(t){return t===void 0&&(t=0),Date.now()+t},Na=!1,Vw=function(){function t(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return t.prototype.run=function(e){var i=this;if(e===void 0&&(e=jw),!Na){Na=!0;var n=hc(e);Lw(function(){var r=!1;try{r=Bw()}finally{if(Na=!1,e=n-hc(),!Rw())return;r?i.run(1e3):e>0?i.run(e):i.start()}})}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var e=this,i=function(){return e.observer&&e.observer.observe(document.body,_w)};document.body?i():_n.addEventListener("DOMContentLoaded",i)},t.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),cc.forEach(function(i){return _n.addEventListener(i,e.listener,!0)}))},t.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),cc.forEach(function(i){return _n.removeEventListener(i,e.listener,!0)}),this.stopped=!0)},t}(),lo=new Vw,dc=function(t){!Xr&&t>0&&lo.start(),Xr+=t,!Xr&&lo.stop()},Ow=function(t){return!Ml(t)&&!Tw(t)&&getComputedStyle(t).display==="inline"},Uw=function(){function t(e,i){this.target=e,this.observedBox=i||Xn.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var e=Cd(this.target,this.observedBox,!0);return Ow(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),$w=function(){function t(e,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=i}return t}(),Br=new WeakMap,fc=function(t,e){for(var i=0;i<t.length;i+=1)if(t[i].target===e)return i;return-1},zr=function(){function t(){}return t.connect=function(e,i){var n=new $w(e,i);Br.set(e,n)},t.observe=function(e,i,n){var r=Br.get(e),s=r.observationTargets.length===0;fc(r.observationTargets,i)<0&&(s&&hi.push(r),r.observationTargets.push(new Uw(i,n&&n.box)),dc(1),lo.schedule())},t.unobserve=function(e,i){var n=Br.get(e),r=fc(n.observationTargets,i),s=n.observationTargets.length===1;r>=0&&(s&&hi.splice(hi.indexOf(n),1),n.observationTargets.splice(r,1),dc(-1))},t.disconnect=function(e){var i=this,n=Br.get(e);n.observationTargets.slice().forEach(function(r){return i.unobserve(e,r.target)}),n.activeTargets.splice(0,n.activeTargets.length)},t}(),Ww=function(){function t(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");zr.connect(this,e)}return t.prototype.observe=function(e,i){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ac(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");zr.observe(this,e,i)},t.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ac(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");zr.unobserve(this,e)},t.prototype.disconnect=function(){zr.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}();function Hw(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-sidebar`),i.setAttribute("viewBox","0 0 64 64");const n=document.createElementNS(e,"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 Fw(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-arrow-left`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(e,"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 Qw(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-arrow-right`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(e,"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 Zw(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-play`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(e,"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 Yw(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-pause`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(e,"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 Jt=typeof window!="undefined",Td=Jt&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Ed=Jt&&"IntersectionObserver"in window,Nd=Jt&&"classList"in document.createElement("p"),kd=Jt&&window.devicePixelRatio>1,Gw={elements_selector:".lazy",container:Td||Jt?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},Pd=t=>Object.assign({},Gw,t),pc=function(t,e){let i;const n="LazyLoad::Initialized",r=new t(e);try{i=new CustomEvent(n,{detail:{instance:r}})}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent(n,!1,!1,{instance:r})}window.dispatchEvent(i)},Xw=(t,e)=>{if(!!e)if(!e.length)pc(t,e);else for(let i=0,n;n=e[i];i+=1)pc(t,n)},kt="src",Il="srcset",Cl="sizes",Bd="poster",dr="llOriginalAttrs",zd="data",bl="loading",Dd="loaded",Ld="applied",Jw="entered",Al="error",Rd="native",jd="data-",_d="ll-status",Be=(t,e)=>t.getAttribute(jd+e),Kw=(t,e,i)=>{const n=jd+e;if(i===null){t.removeAttribute(n);return}t.setAttribute(n,i)},fr=t=>Be(t,_d),bi=(t,e)=>Kw(t,_d,e),qs=t=>bi(t,null),Tl=t=>fr(t)===null,qw=t=>fr(t)===bl,ey=t=>fr(t)===Al,El=t=>fr(t)===Rd,ty=[bl,Dd,Ld,Al],iy=t=>ty.indexOf(fr(t))>=0,Kt=(t,e,i,n)=>{if(!(!t||typeof t!="function")){if(n!==void 0){t(e,i,n);return}if(i!==void 0){t(e,i);return}t(e)}},ln=(t,e)=>{if(e!==""){if(Nd){t.classList.add(e);return}t.className+=(t.className?" ":"")+e}},ht=(t,e)=>{if(e!==""){if(Nd){t.classList.remove(e);return}t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")}},ny=t=>{t.llTempImage=document.createElement("IMG")},ry=t=>{delete t.llTempImage},Vd=t=>t.llTempImage,ea=(t,e)=>{if(!e)return;const i=e._observer;!i||i.unobserve(t)},sy=t=>{t.disconnect()},ay=(t,e,i)=>{e.unobserve_entered&&ea(t,i)},Nl=(t,e)=>{!t||(t.loadingCount+=e)},oy=t=>{!t||(t.toLoadCount-=1)},Od=(t,e)=>{!t||(t.toLoadCount=e)},ly=t=>t.loadingCount>0,uy=t=>t.toLoadCount>0,Ud=t=>{let e=[];for(let i=0,n;n=t.children[i];i+=1)n.tagName==="SOURCE"&&e.push(n);return e},kl=(t,e)=>{const i=t.parentNode;if(!i||i.tagName!=="PICTURE")return;Ud(i).forEach(e)},$d=(t,e)=>{Ud(t).forEach(e)},ta=[kt],Wd=[kt,Bd],Jn=[kt,Il,Cl],Hd=[zd],ia=t=>!!t[dr],Fd=t=>t[dr],Qd=t=>delete t[dr],Ki=(t,e)=>{if(ia(t))return;const i={};e.forEach(n=>{i[n]=t.getAttribute(n)}),t[dr]=i},cy=t=>{ia(t)||(t[dr]={backgroundImage:t.style.backgroundImage})},hy=(t,e,i)=>{if(!i){t.removeAttribute(e);return}t.setAttribute(e,i)},yi=(t,e)=>{if(!ia(t))return;const i=Fd(t);e.forEach(n=>{hy(t,n,i[n])})},dy=t=>{if(!ia(t))return;const e=Fd(t);t.style.backgroundImage=e.backgroundImage},Zd=(t,e,i)=>{ln(t,e.class_applied),bi(t,Ld),i&&(e.unobserve_completed&&ea(t,e),Kt(e.callback_applied,t,i))},Yd=(t,e,i)=>{ln(t,e.class_loading),bi(t,bl),i&&(Nl(i,1),Kt(e.callback_loading,t,i))},Ot=(t,e,i)=>{!i||t.setAttribute(e,i)},gc=(t,e)=>{Ot(t,Cl,Be(t,e.data_sizes)),Ot(t,Il,Be(t,e.data_srcset)),Ot(t,kt,Be(t,e.data_src))},fy=(t,e)=>{kl(t,i=>{Ki(i,Jn),gc(i,e)}),Ki(t,Jn),gc(t,e)},py=(t,e)=>{Ki(t,ta),Ot(t,kt,Be(t,e.data_src))},gy=(t,e)=>{$d(t,i=>{Ki(i,ta),Ot(i,kt,Be(i,e.data_src))}),Ki(t,Wd),Ot(t,Bd,Be(t,e.data_poster)),Ot(t,kt,Be(t,e.data_src)),t.load()},my=(t,e)=>{Ki(t,Hd),Ot(t,zd,Be(t,e.data_src))},vy=(t,e,i)=>{const n=Be(t,e.data_bg),r=Be(t,e.data_bg_hidpi),s=kd&&r?r:n;!s||(t.style.backgroundImage=`url("${s}")`,Vd(t).setAttribute(kt,s),Yd(t,e,i))},wy=(t,e,i)=>{const n=Be(t,e.data_bg_multi),r=Be(t,e.data_bg_multi_hidpi),s=kd&&r?r:n;!s||(t.style.backgroundImage=s,Zd(t,e,i))},yy=(t,e,i)=>{const n=Be(t,e.data_bg_set);if(!n)return;const r=n.split("|");let s=r.map(a=>`image-set(${a})`);t.style.backgroundImage=s.join(),t.style.backgroundImage===""&&(s=r.map(a=>`-webkit-image-set(${a})`),t.style.backgroundImage=s.join()),Zd(t,e,i)},Gd={IMG:fy,IFRAME:py,VIDEO:gy,OBJECT:my},xy=(t,e)=>{const i=Gd[t.tagName];!i||i(t,e)},Sy=(t,e,i)=>{const n=Gd[t.tagName];!n||(n(t,e),Yd(t,e,i))},My=["IMG","IFRAME","VIDEO","OBJECT"],Iy=t=>My.indexOf(t.tagName)>-1,Xd=(t,e)=>{e&&!ly(e)&&!uy(e)&&Kt(t.callback_finish,e)},mc=(t,e,i)=>{t.addEventListener(e,i),t.llEvLisnrs[e]=i},Cy=(t,e,i)=>{t.removeEventListener(e,i)},Pl=t=>!!t.llEvLisnrs,by=(t,e,i)=>{Pl(t)||(t.llEvLisnrs={});const n=t.tagName==="VIDEO"?"loadeddata":"load";mc(t,n,e),mc(t,"error",i)},uo=t=>{if(!Pl(t))return;const e=t.llEvLisnrs;for(let i in e){const n=e[i];Cy(t,i,n)}delete t.llEvLisnrs},Jd=(t,e,i)=>{ry(t),Nl(i,-1),oy(i),ht(t,e.class_loading),e.unobserve_completed&&ea(t,i)},Ay=(t,e,i,n)=>{const r=El(e);Jd(e,i,n),ln(e,i.class_loaded),bi(e,Dd),Kt(i.callback_loaded,e,n),r||Xd(i,n)},Ty=(t,e,i,n)=>{const r=El(e);Jd(e,i,n),ln(e,i.class_error),bi(e,Al),Kt(i.callback_error,e,n),i.restore_on_error&&yi(e,Jn),r||Xd(i,n)},Bl=(t,e,i)=>{const n=Vd(t)||t;if(Pl(n))return;by(n,a=>{Ay(a,t,e,i),uo(n)},a=>{Ty(a,t,e,i),uo(n)})},Ey=(t,e,i)=>{ny(t),Bl(t,e,i),cy(t),vy(t,e,i),wy(t,e,i),yy(t,e,i)},Ny=(t,e,i)=>{Bl(t,e,i),Sy(t,e,i)},zl=(t,e,i)=>{Iy(t)?Ny(t,e,i):Ey(t,e,i)},ky=(t,e,i)=>{t.setAttribute("loading","lazy"),Bl(t,e,i),xy(t,e),bi(t,Rd)},vc=t=>{t.removeAttribute(kt),t.removeAttribute(Il),t.removeAttribute(Cl)},Py=t=>{kl(t,e=>{vc(e)}),vc(t)},Kd=t=>{kl(t,e=>{yi(e,Jn)}),yi(t,Jn)},By=t=>{$d(t,e=>{yi(e,ta)}),yi(t,Wd),t.load()},zy=t=>{yi(t,ta)},Dy=t=>{yi(t,Hd)},Ly={IMG:Kd,IFRAME:zy,VIDEO:By,OBJECT:Dy},Ry=t=>{const e=Ly[t.tagName];if(!e){dy(t);return}e(t)},jy=(t,e)=>{Tl(t)||El(t)||(ht(t,e.class_entered),ht(t,e.class_exited),ht(t,e.class_applied),ht(t,e.class_loading),ht(t,e.class_loaded),ht(t,e.class_error))},_y=(t,e)=>{Ry(t),jy(t,e),qs(t),Qd(t)},Vy=(t,e,i,n)=>{!i.cancel_on_exit||!qw(t)||t.tagName==="IMG"&&(uo(t),Py(t),Kd(t),ht(t,i.class_loading),Nl(n,-1),qs(t),Kt(i.callback_cancel,t,e,n))},Oy=(t,e,i,n)=>{const r=iy(t);bi(t,Jw),ln(t,i.class_entered),ht(t,i.class_exited),ay(t,i,n),Kt(i.callback_enter,t,e,n),!r&&zl(t,i,n)},Uy=(t,e,i,n)=>{Tl(t)||(ln(t,i.class_exited),Vy(t,e,i,n),Kt(i.callback_exit,t,e,n))},$y=["IMG","IFRAME","VIDEO"],qd=t=>t.use_native&&"loading"in HTMLImageElement.prototype,Wy=(t,e,i)=>{t.forEach(n=>{$y.indexOf(n.tagName)!==-1&&ky(n,e,i)}),Od(i,0)},Hy=t=>t.isIntersecting||t.intersectionRatio>0,Fy=t=>({root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}),Qy=(t,e,i)=>{t.forEach(n=>Hy(n)?Oy(n.target,n,e,i):Uy(n.target,n,e,i))},Zy=(t,e)=>{e.forEach(i=>{t.observe(i)})},Yy=(t,e)=>{sy(t),Zy(t,e)},Gy=(t,e)=>{!Ed||qd(t)||(e._observer=new IntersectionObserver(i=>{Qy(i,t,e)},Fy(t)))},ef=t=>Array.prototype.slice.call(t),fs=t=>t.container.querySelectorAll(t.elements_selector),Xy=t=>ef(t).filter(Tl),Jy=t=>ey(t),Ky=t=>ef(t).filter(Jy),wc=(t,e)=>Xy(t||fs(e)),qy=(t,e)=>{Ky(fs(t)).forEach(n=>{ht(n,t.class_error),qs(n)}),e.update()},ex=(t,e)=>{!Jt||(e._onlineHandler=()=>{qy(t,e)},window.addEventListener("online",e._onlineHandler))},tx=t=>{!Jt||window.removeEventListener("online",t._onlineHandler)},pr=function(t,e){const i=Pd(t);this._settings=i,this.loadingCount=0,Gy(i,this),ex(i,this),this.update(e)};pr.prototype={update:function(t){const e=this._settings,i=wc(t,e);if(Od(this,i.length),Td||!Ed){this.loadAll(i);return}if(qd(e)){Wy(i,e,this);return}Yy(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),tx(this),fs(this._settings).forEach(t=>{Qd(t)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){const e=this._settings;wc(t,e).forEach(n=>{ea(n,this),zl(n,e,this)})},restoreAll:function(){const t=this._settings;fs(t).forEach(e=>{_y(e,t)})}};pr.load=(t,e)=>{const i=Pd(e);zl(t,i)};pr.resetStatus=t=>{qs(t)};Jt&&Xw(pr,window.lazyLoadOptions);class tf{constructor({readonly:e,box:i,pages:n,onNewPageIndex:r,onPlay:s}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new Ks,n.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=e,this.box=i,this.pages=n,this.onNewPageIndex=r,this.onPlay=s,this.onPageIndexChanged=()=>{},this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const e=new pr({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>e.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.$content.classList.toggle(this.wrapClassName("readonly"),e),this.$footer.classList.toggle(this.wrapClassName("readonly"),e),this.$pageNumberInput.disabled=e)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(e){Number.isNaN(e)||(this.pageIndex=e,this.$pageNumberInput.value=String(e+1),this.onPageIndexChanged(e))}setSmallBox(e){this.isSmallBox!==e&&(this.isSmallBox=e,this.$footer.classList.toggle(this.wrapClassName("float-footer"),e))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const e=document.createElement("div");e.className=this.wrapClassName("content"),this.$content=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),e.appendChild(this.renderPreviewMask()),e.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const e=document.createElement("div");e.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=e;const i=this.wrapClassName("preview-page"),n=this.wrapClassName("preview-page-name");this.pages.forEach((r,s)=>{var a;const o=(a=r.thumbnail)!=null?a:r.src.startsWith("ppt")?void 0:r.src;if(!o)return;const l=String(s),u=document.createElement("a");u.className=i+" "+this.wrapClassName(`preview-page-${s}`),u.setAttribute("href","#"),u.dataset.pageIndex=l;const c=document.createElement("span");c.className=n,c.textContent=String(s+1),c.dataset.pageIndex=l;const h=document.createElement("img");h.width=r.width,h.height=r.height,h.dataset.src=o,h.dataset.pageIndex=l,u.appendChild(h),u.appendChild(c),e.appendChild(u)}),this.sideEffect.addEventListener(e,"click",r=>{var s;if(this.readonly)return;const a=(s=r.target.dataset)==null?void 0:s.pageIndex;a&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(a)),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",e=>{this.readonly||e.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const e=document.createElement("div");if(e.className=this.wrapClassName("footer"),this.$footer=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&e.classList.add(this.wrapClassName("float-footer")),this.pages.some(l=>l.thumbnail||!l.src.startsWith("ppt"))){const l=this.renderFooterBtn("btn-sidebar",Hw(this.namespace));this.sideEffect.addEventListener(l,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(l)}const i=document.createElement("div");i.className=this.wrapClassName("page-jumps");const n=this.renderFooterBtn("btn-page-back",Fw(this.namespace));if(this.sideEffect.addEventListener(n,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),i.appendChild(n),this.onPlay){const l=this.renderFooterBtn("btn-page-play",Zw(this.namespace),Yw(this.namespace)),u=()=>{this.sideEffect.setTimeout(()=>{l.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(l,"click",()=>{this.readonly||(l.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),u())}),i.appendChild(l)}const r=this.renderFooterBtn("btn-page-next",Qw(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),i.appendChild(r);const s=document.createElement("div");s.className=this.wrapClassName("page-number");const a=document.createElement("input");a.className=this.wrapClassName("page-number-input"),a.value=String(this.pageIndex+1),this.readonly&&(a.disabled=!0),this.$pageNumberInput=a,this.sideEffect.addEventListener(a,"focus",()=>{a.select()}),this.sideEffect.addEventListener(a,"change",()=>{this.readonly||a.value&&this.onNewPageIndex(Number(a.value)-1)});const o=document.createElement("span");o.textContent=" / "+this.pages.length,s.appendChild(a),s.appendChild(o),this.$footer.appendChild(i),this.$footer.appendChild(s)}return this.$footer}renderFooterBtn(e,i,n){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(i),n&&r.appendChild(n),r}togglePreview(e){if(this.isShowPreview=e!=null?e:!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(e){return`${this.namespace}-${e}`}}function qi(t,e,i){return Math.min(Math.max(t,e),i)}function yc(t){return t.touches?t.touches[0]:t}function nf(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function rf(t){if(!t)return!1;const e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||e==="SELECT"}class ix{constructor(e){var i,n,r;this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=s=>{if(this.paused)return;let a=Math.floor((s-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=s;a-- >0;)this.stepper();this.onStep(this.current,this),!this.paused&&this.current!==this.target&&window.requestAnimationFrame(this.looper)},this.current=(i=e.start)!=null?i:0,this.target=this.current,this.stiffness=(n=e.stiffness)!=null?n:170,this.damping=(r=e.damping)!=null?r:26,this.onStep=e.onStep}stepTo(e,i){this.paused&&i!=null&&(this.current=i),this.paused=!1,this.target=e,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}pause(){this.paused=!0}destroy(){this.pause()}stepper(){const e=-this.stiffness*(this.current-this.target),i=-this.damping*this.velocity,n=this.velocity+(e+i)/60,r=this.current+n/60;Math.abs(n-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=r,this.velocity=n)}}class nx{constructor(e,i,n,r){this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=e,this.page=i,this.scale=n,this.pageOffsetX=(r-i.width)/2;const s=document.createElement("div");s.className="page-renderer-page",s.dataset.index=`${e}`,s.style.width=`${i.width*n}px`,s.style.height=`${i.height*n}px`,i.thumbnail&&(s.style.backgroundImage=`url("${i.thumbnail}")`);const a=document.createElement("img");a.className="page-renderer-page-img",a.width=i.width,a.height=i.height,a.src=i.src,s.appendChild(a),this.$page=s}translateY(e){Math.abs(e-this.pageOffsetY)>=.001&&(this.pageOffsetY=e,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setScale(e){Math.abs(e-this.scale)>=.001&&(this.scale=e,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(e){e!==this.visible&&(this.visible=e,this.$page.style.opacity=e?"1":"0")}}const rx=window.requestIdleCallback||(t=>window.setTimeout(t,5e3)),sx=window.cancelIdleCallback||window.clearTimeout;class ax{constructor(e,i,n){this.pages=e,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 r=[...this.els.values()].sort((s,a)=>a.lastVisit-s.lastVisit);for(let s=Math.floor(this.maxElCount/4);s<r.length;s++)this.els.delete(r[s].index)}}}getEl(e){let i=this.els.get(e);return i||(i=new nx(e,this.pages[e],this.scale,this.pagesIntrinsicWidth),this.els.set(e,i)),i.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=rx(this.gc)),i}setScale(e){e!==this.scale&&(this.scale=e,this.els.forEach(i=>i.setScale(e)))}destroy(){this.els.clear(),this.gcTimer!==null&&(sx(this.gcTimer),this.gcTimer=null)}}class ox{constructor(e){this._hwaTimeout=NaN,this._turnOffHWA=()=>{window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN,this.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pages=e.pages.map(s=>{if(s.thumbnail)return s;try{const a=new URL(s.src);return a.searchParams.set("x-oss-process","image/resize,l_50"),{...s,thumbnail:a.toString()}}catch(a){return console.error(a),s}});const i=Array(this.pages.length);let n=1/0,r=0;this.pagesIntrinsicHeight=this.pages.reduce((s,a,o)=>(i[o]=s,a.width>r&&(r=a.width),a.height<=n&&(n=a.height),s+a.height),0),this.pagesIntrinsicWidth=r,this.pagesMinHeight=n,this.pagesIntrinsicYs=i,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=e.onPageIndexChanged,this.pageScrollIndex=0,this.pagesScrollTop!==0&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new ax(this.pages,r,this.scale),this.$pages=this.renderPages()}setContainerSize(e,i){e>0&&i>0&&(e!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=e,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 e=document.createElement("div");return e.className="page-renderer-pages-container",e.style.width=`${this.containerWidth}px`,e.style.height=`${this.containerHeight}px`,e}pagesScrollTo(e,i){if(e=qi(e,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),i||Math.abs(e-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=e;const n=this.findScrollPageIndex(),r=Math.max(n-this.threshold,0),s=Math.min(n+this.threshold,this.pages.length-1);for(let a=0;a<this.$pages.children.length;a++){const o=this.$pages.children[a],l=Number(o.dataset.index);l>=r&&l<=s||(o.remove(),a--)}for(let a=r;a<=s;a++){const o=this.pageElManager.getEl(a);o.$page.parentElement!==this.$pages&&this.$pages.appendChild(o.$page),o.translateY(this.pagesIntrinsicYs[a]-this.pagesScrollTop)}n!==this.pageScrollIndex&&(this.pageScrollIndex=n,this.onPageIndexChanged&&this.onPageIndexChanged(n))}}findScrollPageIndex(){for(let e=0;e<this.pagesIntrinsicYs.length;e++)if(this.pagesIntrinsicYs[e]+this.pages[e].height-this.pagesScrollTop>=.001)return e;return this.pagesIntrinsicYs.length-1}mount(e){e.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 qi(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 lx=30;class ux{constructor(e){this.sideEffect=new Ks,this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pagesWidth=e.pagesWidth||1,this.pagesHeight=e.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=e.scrollbarMinHeight||lx,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=e.readonly,this.wrapClassName=e.wrapClassName,this.onDragScroll=e.onDragScroll,this.$scrollbar=this.renderScrollbar()}mount(e){e.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$scrollbar.remove()}setReadonly(e){this.readonly=e}setContainerSize(e,i){e>0&&i>0&&(e!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=i,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}pagesScrollTo(e,i){if(e=qi(e,0,this.pagesHeight-this.containerHeight/this.scale),i||Math.abs(e-this.pagesScrollTop)>=.001){this.pagesScrollTop=e;const n=this.pagesScrollTop*this.scale,r=this.pagesHeight*this.scale,s=n/(r-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame(()=>{this.$scrollbar.style.transform=`translateY(${s}px)`}):this.$scrollbar.style.transform=`translateY(${s}px)`}}destroy(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const e=document.createElement("button");e.className=this.wrapClassName("scrollbar"),e.style.minHeight=`${this.scrollbarMinHeight}px`,e.style.height=`${this.scrollbarHeight}px`;const i=n=>{if(this.readonly||n.button!=null&&n.button!==0)return;nf(n);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const s=this.pagesScrollTop,{clientY:a}=yc(n),o=u=>{if(this.readonly)return;const{clientY:c}=yc(u),h=(c-a)/this.scale;Math.abs(h)>0&&this.onDragScroll&&this.onDragScroll(s+h*(this.pagesHeight*this.scale/this.containerHeight))},l=()=>{e.classList.toggle(r,!1),window.removeEventListener("mousemove",o,!0),window.removeEventListener("touchmove",o,!0),window.removeEventListener("mouseup",l,!0),window.removeEventListener("touchend",l,!0),window.removeEventListener("touchcancel",l,!0)};window.addEventListener("mousemove",o,!0),window.addEventListener("touchmove",o,!0),window.addEventListener("mouseup",l,!0),window.addEventListener("touchend",l,!0),window.addEventListener("touchcancel",l,!0)};return this.sideEffect.addEventListener(e,"mousedown",i),this.sideEffect.addEventListener(e,"touchstart",i),e}_calcScale(){return this.containerWidth/this.pagesWidth||1}_calcScrollbarHeight(){return qi(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}_updateScrollbarHeight(){const e=this._calcScrollbarHeight();Math.abs(e-this.scrollbarHeight)>.001&&(this.scrollbarHeight=e,this.$scrollbar.style.height=`${e}px`)}}const cx=window.ResizeObserver||Ww,vn=640;class hx{constructor({context:e,whiteboardView:i,readonly:n,box:r,pages:s,pageScrollTop:a=0,mountWhiteboard:o,onUserScroll:l,baseScenePath:u,appId:c}){this.sideEffect=new Ks,this.userScrolling=!1,this.docsViewReadonly=!1,this.onNewPageIndex=w=>{this.scrollToPage(w)},this.toPdf=async()=>{const w=document.createElement("canvas"),M=w.getContext("2d");if(!M||!this.baseScenePath){this.reportProgress(100,null);return}const d=this.whiteboardView.focusScenePath||`${this.baseScenePath}/1`,f=this.pages[0],{jsPDF:p}=await Promise.resolve().then(function(){return Pg(require("jspdf"))}),g=new p({format:[f.width,f.height],orientation:f.width>f.height?"l":"p",compress:!0});for(const[x,E]of this.pages.entries()){const{width:z,height:P,src:B}=E;w.width=z,w.height=P;const te=z>P?"l":"p";x>0&&g.addPage([z,P],te);const C=await this.getBase64FromUrl(B),S=document.createElement("img");S.src=C,await new Promise(Xe=>S.onload=Xe),M.drawImage(S,0,0);const _=w.toDataURL("image/jpeg",.6);M.clearRect(0,0,z,P);const k={centerX:z/2,centerY:P/2+x*P,scale:1},R=this.context.manager.windowManger;R._appliancePlugin?await R._appliancePlugin.screenshotToCanvasAsync(M,d,z,P,k):this.whiteboardView.screenshotToCanvas(M,d,z,P,k);const G=w.toDataURL("image/png");g.addImage(_,"JPEG",0,0,z,P,"","FAST"),g.addImage(G,"PNG",0,0,z,P,"","FAST"),M.clearRect(0,0,z,P),Math.ceil((x+1)/this.pages.length*100)<100&&this.reportProgress(Math.ceil((x+1)/this.pages.length*100),null)}const y=g.output("arraybuffer");this.reportProgress(100,{pdf:y,title:this.box.title})},this.context=e,this.whiteboardView=i,this.readonly=n,this.box=r,this.pages=s,this.baseScenePath=u,this.appId=c,this.mountWhiteboard=o,this._onUserScroll=l;const h=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,h()},this.viewer=new tf({readonly:n,box:r,pages:s,onNewPageIndex:this.onNewPageIndex});const{width:m,height:v}=this.whiteboardView.size;this.pageRenderer=new ox({pagesScrollTop:a,pages:this.pages,containerWidth:m,containerHeight:v,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new ux({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:m,containerHeight:v,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:w=>{this.pageScrollTo(w),this.updateUserScroll()}}),this.pageScrollStepper=new ix({start:this.pageRenderer.pagesScrollTop,onStep:w=>{this.pageScrollTo(w)}}),this.render()}setDocsViewReadonly(e){this.docsViewReadonly=e}mount(){this.viewer.mount(),this.setupScrollListener();const e=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const i=new cx(e);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(e){this.readonly!==e&&(this.readonly=e,this.viewer.setReadonly(e),this.scrollbar.setReadonly(e))}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(e){!this.userScrolling&&e>=0&&Math.abs(this.pageRenderer.pagesScrollTop-e)>.01&&this.pageScrollStepper.stepTo(e,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 e=this.box.absoluteHeight,i=e<=vn;if(this.viewer.setSmallBox(i),i){const n=26/vn,r=26/e,s=26/vn,a=0,o=Math.max((n+s-(r+a))/2,0);if(this.box.$titleBar){const l=r+o;this.box.$titleBar.style.height=`${l*100}%`}if(this.box.$footer){const l=a+o;this.box.$footer.style.height=`${l*100}%`}}else{if(this.box.$titleBar){const n=Math.max(26/vn,26/e);this.box.$titleBar.style.height=`${n*100}%`}if(this.box.$footer){const n=Math.max(26/vn,26/e);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",e=>{nf(e),this.readonly||(this.pageScrollTo(this.pageRenderer.pagesScrollTop+e.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",e=>{this.readonly||e.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}scrollTopPageToEl(e){return e*this.pageRenderer.scale}scrollTopElToPage(e){return e/this.pageRenderer.scale}elScrollTo(e){this.pageScrollTo(this.scrollTopElToPage(e))}pageScrollTo(e){const i=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:qi(e+i,i,this.pageRenderer.pagesIntrinsicHeight-i),animationMode:"immediately"})}scrollToPage(e){if(!this.readonly&&!Number.isNaN(e)){const i=this.pageRenderer.pagesIntrinsicYs[e];i>=0&&(this.pageScrollTo(i+5/this.pageRenderer.scale),this.updateUserScroll())}}setupScrollListener(){this.sideEffect.add(()=>{const e=i=>{const{width:n,height:r}=this.whiteboardView.size;if(n<=0||r<=0)return;const s=i.centerY-this.pageRenderer.containerHeight/this.pageRenderer.scale/2;this.pageRenderer.pagesScrollTo(s),this.scrollbar.pagesScrollTo(s)};return this.whiteboardView.callbacks.on("onCameraUpdated",e),()=>this.whiteboardView.callbacks.off("onCameraUpdated",e)}),this.sideEffect.add(()=>{const{updateUserScroll:e}=this;return this.whiteboardView.callbacks.on("onCameraUpdatedByDevice",e),()=>this.whiteboardView.callbacks.off("onCameraUpdatedByDevice",e)}),this.sideEffect.add(()=>{const e=({width:i,height:n})=>{if(i<=0||n<=0)return;this.pageRenderer.setContainerSize(i,n),this.scrollbar.setContainerSize(i,n);const{pagesIntrinsicWidth:r,pagesIntrinsicHeight:s}=this.pageRenderer;this.whiteboardView.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:r,height:n/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:r/2,centerY:s/2,width:r,height:s})};return this.whiteboardView.callbacks.on("onSizeUpdated",e),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",e)}},"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",e=>{if(this.readonly||!this.box.focus||this.box.minimized||rf(e.target)||this.docsViewReadonly)return;let i=null;switch(e.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(e,i,n){const r=vw(e,i);return this.sideEffect.addDisposer(()=>r.cancel(),n),r}wrapClassName(e){return"netless-app-docs-viewer-static-"+e}async getBase64FromUrl(e){const n=await(await fetch(this._invalidate(e))).blob();return new Promise(r=>{const s=new FileReader;s.readAsDataURL(n),s.onloadend=()=>{const a=s.result;r(a)}})}_invalidate(e){try{const i=new URL(e);return i.searchParams.set("t",Date.now().toString()),i.toString()}catch{return e}}reportProgress(e,i){window.postMessage({type:"@netless/_result_save_pdf_",appId:this.appId,progress:e,result:i})}}class dx{constructor({context:e,whiteboardView:i,box:n,pages:r}){this.sideEffect=new Ks,this.docsViewReadonly=!1,this.onPlayPPT=()=>{const s=this.context.getRoom();s&&s.pptNextStep()},this._scaleDocsToFitImpl=()=>{const s=this.pages[this.getPageIndex()];s&&(this.whiteboardView.moveCameraToContain({originX:-s.width/2,originY:-s.height/2,width:s.width,height:s.height,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.whiteboardView.camera.scale,minContentMode:()=>this.whiteboardView.camera.scale,centerX:0,centerY:0,width:s.width,height:s.height}))},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=s=>{this.jumpToPage(s,!0)},this.context=e,this.whiteboardView=i,this.box=n,this.pages=r,this.displayer=e.getDisplayer(),this.viewer=new tf({readonly:!e.getIsWritable(),box:n,pages:r,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add(()=>{const s=a=>{this.viewer.setReadonly(!a)};return this.context.emitter.on("writableChange",s),()=>this.context.emitter.off("writableChange",s)}),this.sideEffect.add(()=>{const s=a=>{this.jumpToPage(a.index)};return this.context.emitter.on("sceneStateChange",s),()=>this.context.emitter.off("sceneStateChange",s)})}setDocsViewReadonly(e){this.docsViewReadonly=e}mount(){this.viewer.mount();const e=this.getPageIndex();return e!==0&&this.jumpToPage(e),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(e,i){var n,r;if(e=qi(e,0,this.pages.length-1),e!==this.getPageIndex()&&this.context.getIsWritable()){const s=this.context.getInitScenePath(),a=(r=(n=this.context.getScenes())==null?void 0:n[e])==null?void 0:r.name;s&&a&&this.context.setScenePath(`${s}/${a}`),this.scaleDocsToFit()}if(e!==this.viewer.pageIndex&&this.viewer.setPageIndex(e),i){const s=this.context.getRoom();if(s){const a=s.state.globalState.__pptState;s.setGlobalState({__pptState:a&&{uuid:a.uuid,pageIndex:e,disableAutoPlay:a.disableAutoPlay}})}}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",e=>{var i;if(!this.docsViewReadonly&&this.box.focus&&!rf(e.target))switch(e.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 e=document.createElement("div");e.className=this.wrapClassName("mask"),this.$mask=e;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",e=>{var i;const n=this.context.getRoom();if(n&&n.state.memberState.currentApplianceName==="clicker"){for(let r=e.target;r;r=r.parentElement)if((i=r.classList)!=null&&i.contains("ppt-event-source"))return;n.pptNextStep()}}),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}wrapClassName(e){return"netless-app-docs-viewer-dynamic-"+e}}const fx="DocsViewer",co={kind:fx,setup(t){const e=t.getBox(),i=t.getScenes();if(!i)throw new Error("[Docs Viewer]: scenes not found.");const n=t.getView();if(!n)throw new Error("[Docs Viewer]: no whiteboard view.");const r=i.map(({ppt:o})=>o?{width:o.width,height:o.height,src:o.src,thumbnail:o.previewURL}:null).filter(o=>Boolean(o));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");e.mountStyles(lw);let s=null;return r[0].src.startsWith("ppt")?s=gx(t,n,e,r):s=px(t,n,e,r),(t.getAppOptions()||{}).justDocsViewReadonly&&s.setDocsViewReadonly(!0),{setDocsViewReadonly:o=>{s==null||s.setDocsViewReadonly(o)}}}};function px(t,e,i,n){var r;e.disableCameraTransform=!t.getIsWritable();const s=new hx({context:t,whiteboardView:e,readonly:!t.getIsWritable(),box:i,pages:n,pageScrollTop:(r=t.getAttributes())==null?void 0:r.pageScrollTop,mountWhiteboard:t.mountView.bind(t),onUserScroll:a=>{var o;((o=t.getAttributes())==null?void 0:o.pageScrollTop)!==a&&!i.readonly&&t.updateAttributes(["pageScrollTop"],a)},baseScenePath:t.getInitScenePath(),appId:t.appId}).mount();return s.viewer.onPageIndexChanged=a=>{t.dispatchAppEvent("pageStateChange",{index:a,length:n.length})},t.dispatchAppEvent("pageStateChange",{index:s.viewer.pageIndex,length:n.length}),t.emitter.on("attributesUpdate",a=>{a&&a.pageScrollTop!=null&&s.syncPageScrollTop(a.pageScrollTop)}),t.emitter.on("writableChange",a=>{s.setReadonly(!a),e.disableCameraTransform=!a}),s}function gx(t,e,i,n){e.disableCameraTransform=!0;const r=new dx({context:t,whiteboardView:e,box:i,pages:n}).mount();return r.viewer.onPageIndexChanged=s=>{t.dispatchAppEvent("pageStateChange",{index:s,length:n.length})},t.dispatchAppEvent("pageStateChange",{index:r.getPageIndex(),length:n.length}),t.mountView(r.$whiteboardView),t.isAddApp&&e.callbacks.once("onSizeUpdated",({width:s,height:a})=>{if(n.length>0&&i.state!=="maximized"){const{width:o,height:l}=n[0],c=l/o*s-a;c!==0&&t.getIsWritable()&&t.emitter.emit("setBoxSize",{width:i.width,height:i.height+c/i.containerRect.height})}}),r}var Ai={exports:{}},J={};/*
15
+ ***************************************************************************** */var Te=function(){return Te=Object.assign||function(e){for(var i,n=1,r=arguments.length;n<r;n++){i=arguments[n];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},Te.apply(this,arguments)};function cl(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]]);return i}var Ma=0,Kh=typeof window!="undefined"&&window.requestAnimationFrame!==void 0?function(t){return window.requestAnimationFrame(t)}:function(t){var e=Date.now(),i=Math.max(0,16.7-(e-Ma));Ma=e+i,setTimeout(function(){return t(Ma)},i)},gm=function(t){var e=[],i=[],n=0,r=!1,s=0,a=new WeakSet,o=new WeakSet,l={cancel:function(u){var h=i.indexOf(u);a.add(u),h!==-1&&i.splice(h,1)},process:function(u){var h;if(r=!0,h=[i,e],e=h[0],i=h[1],i.length=0,n=e.length,n){var c;for(s=0;s<n;s++)c=e[s],c(u),o.has(c)===!0&&!a.has(c)&&(l.schedule(c),t(!0))}r=!1},schedule:function(u,h,c){h===void 0&&(h=!1),c===void 0&&(c=!1);var m=c&&r,w=m?e:i;a.delete(u),h&&o.add(u),w.indexOf(u)===-1&&(w.push(u),m&&(n=e.length))}};return l},mm=40,Fu=1/60*1e3,Gr=!0,Xn=!1,to=!1,kn={delta:0,timestamp:0},hl=["read","update","preRender","render","postRender"],vm=function(t){return Xn=t},qh=hl.reduce(function(t,e){return t[e]=gm(vm),t},{}),wm=hl.reduce(function(t,e){var i=qh[e];return t[e]=function(n,r,s){return r===void 0&&(r=!1),s===void 0&&(s=!1),Xn||xm(),i.schedule(n,r,s),n},t},{}),ym=function(t){return qh[t].process(kn)},ed=function(t){Xn=!1,kn.delta=Gr?Fu:Math.max(Math.min(t-kn.timestamp,mm),1),Gr||(Fu=kn.delta),kn.timestamp=t,to=!0,hl.forEach(ym),to=!1,Xn&&(Gr=!1,Kh(ed))},xm=function(){Xn=!0,Gr=!0,to||Kh(ed)},td=function(t,e){return function(i){return Math.max(Math.min(i,e),t)}},Xr=function(t){return t%1?Number(t.toFixed(5)):t},id=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,Fs={test:function(t){return typeof t=="number"},parse:parseFloat,transform:function(t){return t}},Ln=Te(Te({},Fs),{transform:td(0,1)}),Nr=Te(Te({},Fs),{default:1}),dl=function(t){return{test:function(e){return typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1},parse:parseFloat,transform:function(e){return""+e+t}}},ni=dl("deg"),Rn=dl("%"),$=dl("px"),Qu=Te(Te({},Rn),{parse:function(t){return Rn.parse(t)/100},transform:function(t){return Rn.transform(t*100)}}),Sm=function(t){return t.substring(t.indexOf("(")+1,t.lastIndexOf(")"))},Mm=td(0,255),io=function(t){return t.red!==void 0},no=function(t){return t.hue!==void 0};function Cm(t){return Sm(t).replace(/(,|\/)/g," ").split(/ \s*/)}var nd=function(t){return function(e){if(typeof e!="string")return e;for(var i={},n=Cm(e),r=0;r<4;r++)i[t[r]]=n[r]!==void 0?parseFloat(n[r]):1;return i}},Im=function(t){var e=t.red,i=t.green,n=t.blue,r=t.alpha,s=r===void 0?1:r;return"rgba("+e+", "+i+", "+n+", "+s+")"},bm=function(t){var e=t.hue,i=t.saturation,n=t.lightness,r=t.alpha,s=r===void 0?1:r;return"hsla("+e+", "+i+", "+n+", "+s+")"},Ca=Te(Te({},Fs),{transform:function(t){return Math.round(Mm(t))}});function fl(t,e){return t.startsWith(e)&&id.test(t)}var Jr={test:function(t){return typeof t=="string"?fl(t,"rgb"):io(t)},parse:nd(["red","green","blue","alpha"]),transform:function(t){var e=t.red,i=t.green,n=t.blue,r=t.alpha,s=r===void 0?1:r;return Im({red:Ca.transform(e),green:Ca.transform(i),blue:Ca.transform(n),alpha:Xr(Ln.transform(s))})}},Ia={test:function(t){return typeof t=="string"?fl(t,"hsl"):no(t)},parse:nd(["hue","saturation","lightness","alpha"]),transform:function(t){var e=t.hue,i=t.saturation,n=t.lightness,r=t.alpha,s=r===void 0?1:r;return bm({hue:Math.round(e),saturation:Rn.transform(Xr(i)),lightness:Rn.transform(Xr(n)),alpha:Xr(Ln.transform(s))})}},Zu=Te(Te({},Jr),{test:function(t){return typeof t=="string"&&fl(t,"#")},parse:function(t){var e="",i="",n="";return t.length>4?(e=t.substr(1,2),i=t.substr(3,2),n=t.substr(5,2)):(e=t.substr(1,1),i=t.substr(2,1),n=t.substr(3,1),e+=e,i+=i,n+=n),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:1}}}),rt={test:function(t){return typeof t=="string"&&id.test(t)||io(t)||no(t)},parse:function(t){return Jr.test(t)?Jr.parse(t):Ia.test(t)?Ia.parse(t):Zu.test(t)?Zu.parse(t):t},transform:function(t){return io(t)?Jr.transform(t):no(t)?Ia.transform(t):t}},pl=function(t){var e=t.onRead,i=t.onRender,n=t.uncachedValues,r=n===void 0?new Set:n,s=t.useCache,a=s===void 0?!0:s;return function(o){o===void 0&&(o={});var l=cl(o,[]),u={},h=[],c=!1;function m(y,x){y.startsWith("--")&&(l.hasCSSVariable=!0);var d=u[y];u[y]=x,u[y]!==d&&(h.indexOf(y)===-1&&h.push(y),c||(c=!0,wm.render(w.render)))}var w={get:function(y,x){x===void 0&&(x=!1);var d=!x&&a&&!r.has(y)&&u[y]!==void 0;return d?u[y]:e(y,l)},set:function(y,x){if(typeof y=="string")m(y,x);else for(var d in y)m(d,y[d]);return this},render:function(y){return y===void 0&&(y=!1),(c||y===!0)&&(i(u,l,h),c=!1,h.length=0),this}};return w}},Am=/([a-z])([A-Z])/g,Tm="$1-$2",Qs=function(t){return t.replace(Am,Tm).toLowerCase()},rd=new Map,gl=new Map,sd=["Webkit","Moz","O","ms",""],Em=sd.length,Nm=typeof document!="undefined",ba,ad=function(t,e){return gl.set(t,Qs(e))},km=function(t){ba=ba||document.createElement("div");for(var e=0;e<Em;e++){var i=sd[e],n=i==="",r=n?t:i+t.charAt(0).toUpperCase()+t.slice(1);if(r in ba.style||n){if(n&&t==="clipPath"&&gl.has(t))return;rd.set(t,r),ad(t,(n?"":"-")+Qs(r))}}},Pm=function(t){return ad(t,t)},od=function(t,e){e===void 0&&(e=!1);var i=e?gl:rd;return i.has(t)||(Nm?km(t):Pm(t)),i.get(t)||t},Bm=["","X","Y","Z"],zm=["translate","scale","rotate","skew","transformPerspective"],ro=zm.reduce(function(t,e){return Bm.reduce(function(i,n){return i.push(e+n),i},t)},["x","y","z"]),Dm=ro.reduce(function(t,e){return t[e]=!0,t},{});function ml(t){return Dm[t]===!0}function Lm(t,e){return ro.indexOf(t)-ro.indexOf(e)}var Rm=new Set(["originX","originY","originZ"]);function jm(t){return Rm.has(t)}var Yu=Te(Te({},Fs),{transform:Math.round}),_m={color:rt,backgroundColor:rt,outlineColor:rt,fill:rt,stroke:rt,borderColor:rt,borderTopColor:rt,borderRightColor:rt,borderBottomColor:rt,borderLeftColor:rt,borderWidth:$,borderTopWidth:$,borderRightWidth:$,borderBottomWidth:$,borderLeftWidth:$,borderRadius:$,radius:$,borderTopLeftRadius:$,borderTopRightRadius:$,borderBottomRightRadius:$,borderBottomLeftRadius:$,width:$,maxWidth:$,height:$,maxHeight:$,size:$,top:$,right:$,bottom:$,left:$,padding:$,paddingTop:$,paddingRight:$,paddingBottom:$,paddingLeft:$,margin:$,marginTop:$,marginRight:$,marginBottom:$,marginLeft:$,rotate:ni,rotateX:ni,rotateY:ni,rotateZ:ni,scale:Nr,scaleX:Nr,scaleY:Nr,scaleZ:Nr,skew:ni,skewX:ni,skewY:ni,distance:$,translateX:$,translateY:$,translateZ:$,x:$,y:$,z:$,perspective:$,opacity:Ln,originX:Qu,originY:Qu,originZ:$,zIndex:Yu,fillOpacity:Ln,strokeOpacity:Ln,numOctaves:Yu},vl=function(t){return _m[t]},Vm=function(t,e){return e&&typeof t=="number"?e.transform(t):t},jn="scrollLeft",_n="scrollTop",ld=new Set([jn,_n]),Om=new Set([jn,_n,"transform"]),Um={x:"translateX",y:"translateY",z:"translateZ"};function ud(t){return typeof t=="function"}function $m(t,e,i,n,r,s){s===void 0&&(s=!0);var a="",o=!1;i.sort(Lm);for(var l=i.length,u=0;u<l;u++){var h=i[u];a+=(Um[h]||h)+"("+e[h]+") ",o=h==="z"?!0:o}return!o&&r?a+="translateZ(0)":a=a.trim(),ud(t.transform)?a=t.transform(e,n?"":a):s&&n&&(a="none"),a}function Wm(t,e,i,n,r,s,a,o){e===void 0&&(e=!0),i===void 0&&(i={}),n===void 0&&(n={}),r===void 0&&(r={}),s===void 0&&(s=[]),a===void 0&&(a=!1),o===void 0&&(o=!0);var l=!0,u=!1,h=!1;for(var c in t){var m=t[c],w=vl(c),y=Vm(m,w);ml(c)?(u=!0,n[c]=y,s.push(c),l&&(w.default&&m!==w.default||!w.default&&m!==0)&&(l=!1)):jm(c)?(r[c]=y,h=!0):(!Om.has(c)||!ud(y))&&(i[od(c,a)]=y)}return(u||typeof t.transform=="function")&&(i.transform=$m(t,n,s,l,e,o)),h&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function wl(t){var e=t===void 0?{}:t,i=e.enableHardwareAcceleration,n=i===void 0?!0:i,r=e.isDashCase,s=r===void 0?!0:r,a=e.allowTransformNone,o=a===void 0?!0:a,l={},u={},h={},c=[];return function(m){return c.length=0,Wm(m,n,l,u,h,c,s,o),l}}function Hm(t,e){var i=e.element,n=e.preparseOutput,r=vl(t);if(ml(t))return r&&r.default||0;if(ld.has(t))return i[t];var s=window.getComputedStyle(i,null).getPropertyValue(od(t,!0))||0;return n&&r&&r.test(s)&&r.parse?r.parse(s):s}function Fm(t,e,i){var n=e.element,r=e.buildStyles,s=e.hasCSSVariable;if(Object.assign(n.style,r(t)),s)for(var a=i.length,o=0;o<a;o++){var l=i[o];l.startsWith("--")&&n.style.setProperty(l,t[l])}i.indexOf(jn)!==-1&&(n[jn]=t[jn]),i.indexOf(_n)!==-1&&(n[_n]=t[_n])}var Qm=pl({onRead:Hm,onRender:Fm,uncachedValues:ld});function Zm(t,e){e===void 0&&(e={});var i=e.enableHardwareAcceleration,n=e.allowTransformNone,r=cl(e,["enableHardwareAcceleration","allowTransformNone"]);return Qm(Te({element:t,buildStyles:wl({enableHardwareAcceleration:i,allowTransformNone:n}),preparseOutput:!0},r))}var cd=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Gu=.5,hd=function(){return{style:{}}},Aa=function(t,e){return $.transform(t*e)},Ym={x:0,y:0,width:0,height:0};function Xu(t,e,i){return typeof t=="string"?t:$.transform(e+i*t)}function Gm(t,e,i){return Xu(e,t.x,t.width)+" "+Xu(i,t.y,t.height)}var dd={enableHardwareAcceleration:!1,isDashCase:!1};function Xm(t,e,i,n,r,s){e===void 0&&(e=Ym),n===void 0&&(n=wl(dd)),r===void 0&&(r=hd()),s===void 0&&(s=!0);var a=t.attrX,o=t.attrY,l=t.originX,u=t.originY,h=t.pathLength,c=t.pathSpacing,m=c===void 0?1:c,w=t.pathOffset,y=w===void 0?0:w,x=cl(t,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),d=n(x);for(var f in d)if(f==="transform")r.style.transform=d[f];else{var p=s&&!cd.has(f)?Qs(f):f;r[p]=d[f]}return(l!==void 0||u!==void 0||d.transform)&&(r.style.transformOrigin=Gm(e,l!==void 0?l:Gu,u!==void 0?u:Gu)),a!==void 0&&(r.x=a),o!==void 0&&(r.y=o),i!==void 0&&h!==void 0&&(r[s?"stroke-dashoffset":"strokeDashoffset"]=Aa(-y,i),r[s?"stroke-dasharray":"strokeDasharray"]=Aa(h,i)+" "+Aa(m,i)),r}function Jm(t,e,i){i===void 0&&(i=!0);var n=hd(),r=wl(dd);return function(s){return Xm(s,t,e,r,n,i)}}var Km=function(t){return typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()},qm=function(t){try{return Km(t)}catch{return{x:0,y:0,width:0,height:0}}},ev=function(t){return t.tagName==="path"},tv=pl({onRead:function(t,e){var i=e.element;if(t=cd.has(t)?t:Qs(t),ml(t)){var n=vl(t);return n&&n.default||0}else return i.getAttribute(t)},onRender:function(t,e){var i=e.element,n=e.buildAttrs,r=n(t);for(var s in r)s==="style"?Object.assign(i.style,r.style):i.setAttribute(s,r[s])}}),iv=function(t){var e=qm(t),i=ev(t)&&t.getTotalLength?t.getTotalLength():void 0;return tv({element:t,buildAttrs:Jm(e,i)})},nv=pl({useCache:!1,onRead:function(t){return t==="scrollTop"?window.pageYOffset:window.pageXOffset},onRender:function(t){var e=t.scrollTop,i=e===void 0?0:e,n=t.scrollLeft,r=n===void 0?0:n;return window.scrollTo(r,i)}}),so=new WeakMap,rv=function(t){return t instanceof HTMLElement||typeof t.click=="function"},sv=function(t){return t instanceof SVGElement||"ownerSVGElement"in t},av=function(t,e){var i;return t===window?i=nv(t):rv(t)?i=Zm(t,e):sv(t)&&(i=iv(t)),so.set(t,i),i},ov=function(t,e){return so.has(t)?so.get(t):av(t,e)};function lv(t,e){var i=typeof t=="string"?document.querySelector(t):t;return ov(i,e)}var at=function(e,i,n,r){var s=n?n.call(r,e,i):void 0;if(s!==void 0)return!!s;if(e===i)return!0;if(typeof e!="object"||!e||typeof i!="object"||!i)return!1;var a=Object.keys(e),o=Object.keys(i);if(a.length!==o.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(i),u=0;u<a.length;u++){var h=a[u];if(!l(h))return!1;var c=e[h],m=i[h];if(s=n?n.call(r,c,m,h):void 0,s===!1||s===void 0&&c!==m)return!1}return!0};const fd="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",uv=fd.length,Ju=Array(20),wn=()=>{for(let t=0;t<20;t++)Ju[t]=fd.charAt(Math.random()*uv);return Ju.join("")};class fs{constructor(){this.disposers=new Map}add(e,i=wn()){return this.flush(i),this.disposers.set(i,e()),i}addDisposer(e,i=wn()){return this.flush(i),this.disposers.set(i,e),i}addEventListener(e,i,n,r,s=wn()){return this.add(()=>(e.addEventListener(i,n,r),()=>e.removeEventListener(i,n,r)),s),s}setTimeout(e,i,n=wn()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(n),e()},i);return()=>window.clearTimeout(r)},n)}setInterval(e,i,n=wn()){return this.add(()=>{const r=window.setInterval(e,i);return()=>window.clearInterval(r)},n)}remove(e){const i=this.disposers.get(e);return this.disposers.delete(e),i}flush(e){const i=this.remove(e);if(i)try{i()}catch(n){console.error(n)}}flushAll(){this.disposers.forEach(e=>{try{e()}catch(i){console.error(i)}}),this.disposers.clear()}}var cv=Object.defineProperty,Ta=(typeof require!="undefined"&&require,(t,e,i)=>(((n,r,s)=>{r in n?cv(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s})(t,typeof e!="symbol"?e+"":e,i),i));class hr{constructor(e,i){Ta(this,"_value"),Ta(this,"_beforeDestroys"),Ta(this,"_subscribers"),this._value=e,i&&(this.compare=i)}get value(){return this._value}setValue(e,i){if(!this.compare(e,this._value)){const n=this._value;this._value=e,this._subscribers&&this._subscribers.forEach(r=>r(e,n,i))}}reaction(e){return this._subscribers||(this._subscribers=new Set),this._subscribers.add(e),()=>{this._subscribers&&this._subscribers.delete(e)}}subscribe(e,i){const n=this.reaction(e);return e(this._value,void 0,i),n}derive(e,i,n){const r=new hr(e(this.value,void 0,n),i),s=this.reaction((a,o,l)=>{r.setValue(e(a,o,l))});return r.addBeforeDestroy(s),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,i){return e===i}}function hv(t,e,i,n){let r=t.map(a=>a.value);const s=new hr(e(r,void 0,n),i);return t.forEach((a,o)=>{const l=a.reaction((u,h,c)=>{const m=r.slice();m[o]=u;const w=r;r=m,s.setValue(e(m,w,c),c)});s.addBeforeDestroy(l)}),s}function pd(t,e){Object.keys(e).forEach(i=>{dv(t,i,e[i])})}function dv(t,e,i){var n;return Object.defineProperties(t,{[e]:{get:()=>i.value},[`_${e}$`]:{value:i},[`set${n=e,n[0].toUpperCase()+n.slice(1)}`]:{value:(r,s)=>i.setValue(r,s)}}),t}function gd(t){const e=i=>{const n=t.addDisposer(()=>{i.destroy()});return i.addBeforeDestroy(()=>{t.remove(n)}),i};return{bindSideEffect:e,combine:(i,n,r,s)=>e(hv(i,n,r,s)),createVal:(i,n)=>e(new hr(i,n))}}var yl=(t=>(t.Light="light",t.Dark="dark",t.Auto="auto",t))(yl||{}),N=(t=>(t.Normal="normal",t.Minimized="minimized",t.Maximized="maximized",t))(N||{}),ae=(t=>(t.DarkMode="dark_mode",t.PrefersColorScheme="prefers_color_scheme",t.Close="close",t.Focus="focus",t.Blur="blur",t.Move="move",t.Resize="resize",t.IntrinsicMove="intrinsic_move",t.IntrinsicResize="intrinsic_resize",t.VisualResize="visual_resize",t.ZIndex="z_index",t.State="state",t.Minimized="minimized",t.Maximized="maximized",t.Readonly="readonly",t.Destroyed="destroyed",t.BoxStatus="box_status",t.LastNotMinimizedBoxStatus="last_not_minimized_box_status",t.ForceTop="force_top",t.ForceNormal="force_normal",t))(ae||{}),be=(t=>(t.Close="close",t.Maximize="maximize",t.Minimize="minimize",t))(be||{}),ot=(t=>(t.North="n",t.South="s",t.West="w",t.East="e",t.NorthWest="nw",t.NorthEast="ne",t.SouthEast="se",t.SouthWest="sw",t))(ot||{});const Ea="dh";function Pe(t,e,i){return Math.min(Math.max(t,e),i)}function Hi(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function Ku(t){return t.touches?t.touches[0]:t}function fv(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}let pv=1;function gv(){return`New Box ${pv++}`}function mv(t){return Boolean(t)}function kr(t){return!t}class md{constructor({readonly:e=!1,title:i,buttons:n,onEvent:r,onDragStart:s,namespace:a="telebox",state:o=N.Normal,boxStatus:l,forceTop:u=!1,forceNormal:h=!1}={}){this.$btns=[],this.sideEffect=new fs,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=c=>{var m;if(this.readonly||c.button!==0||(m=c.target.dataset)!=null&&m.teleTitleBarNoDblClick)return;Hi(c);const w=Date.now();w-this.lastTitleBarClick.timestamp<=500?Math.abs(c.clientX-this.lastTitleBarClick.clientX)<=5&&Math.abs(c.clientY-this.lastTitleBarClick.clientY)<=5&&this.onEvent&&this.onEvent({type:be.Maximize}):this.onDragStart&&this.onDragStart(c),this.lastTitleBarClick.timestamp=w,this.lastTitleBarClick.clientX=c.clientX,this.lastTitleBarClick.clientY=c.clientY},this.lastTitleBarTouch={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarTouch=c=>{var m;if(this.readonly||(m=c.target.dataset)!=null&&m.teleTitleBarNoDblClick)return;Hi(c);const w=Date.now(),{clientX:y=this.lastTitleBarTouch.clientX+100,clientY:x=this.lastTitleBarTouch.clientY+100}=c.touches[0]||{};w-this.lastTitleBarTouch.timestamp<=500?Math.abs(y-this.lastTitleBarTouch.clientX)<=10&&Math.abs(x-this.lastTitleBarTouch.clientY)<=10&&this.onEvent&&this.onEvent({type:be.Maximize}):this.onDragStart&&this.onDragStart(c),this.lastTitleBarTouch.timestamp=w,this.lastTitleBarTouch.clientX=y,this.lastTitleBarTouch.clientY=x},this.readonly=e,this.onEvent=r,this.onDragStart=s,this.namespace=a,this.title=i,this.state=o,this.boxStatus=l,this.forceTop=u,this.forceNormal=h,this.buttons=n||(h?[{type:be.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}]:[{type:be.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:be.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:c=>c===N.Maximized},{type:be.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((i,n)=>{i.isActive&&this.$btns[n].classList.toggle("is-active",i.isActive(e))}))}setBoxStatus(e){this.boxStatus!==e&&(this.boxStatus=e,e&&this.buttons.forEach((i,n)=>{i.isActive&&this.$btns[n].classList.toggle("is-active",i.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=Ea,this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle=Ea,this.title&&(this.$title.textContent=this.title,this.$title.title=this.title),e.appendChild(this.$title),e.appendChild(this.$dragArea);const i=document.createElement("div");i.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:n,isActive:r},s)=>{const a=String(s),o=document.createElement("button");o.className=`${this.wrapClassName("titlebar-btn")} ${n}`,o.dataset.teleTitleBarBtnIndex=a,o.dataset.teleTitleBarNoDblClick="true",r&&o.classList.toggle("is-active",r(this.boxStatus||this.state)),this.$btns.push(o),i.appendChild(o)}),this.sideEffect.addEventListener(i,"click",n=>{var r;if(this.readonly)return;const s=n.target,a=Number((r=s.dataset)==null?void 0:r.teleTitleBarBtnIndex);if(!Number.isNaN(a)&&a<this.buttons.length){Hi(n);const o=this.buttons[a];this.onEvent&&this.onEvent({type:o.type,value:o.value})}}),this.$titleBar.appendChild(e),this.$titleBar.appendChild(i)}return this.$titleBar}renderDragArea(){const e=document.createElement("div");return e.className=this.wrapClassName("drag-area"),e.dataset.teleBoxHandle=Ea,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 vv{constructor({id:e=fv(),title:i=gv(),prefersColorScheme:n=yl.Light,darkMode:r,visible:s=!0,width:a=.5,height:o=.5,minWidth:l=0,minHeight:u=0,x:h=.1,y:c=.1,minimized:m=!1,maximized:w=!1,readonly:y=!1,resizable:x=!0,draggable:d=!0,fence:f=!0,fixRatio:p=!1,focus:g=!1,zIndex:v=100,namespace:S="telebox",titleBar:E,content:P,footer:k,styles:z,containerRect:te={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collectorRect:I,boxStatus:M,lastNotMinimizedBoxStatus:_,forceTop:D=!1,forceNormal:Z=!1,isDragContent:ie=!1}={}){this._renderSideEffect=new fs,this.handleTrackStart=B=>{var X;return(X=this._handleTrackStart)==null?void 0:X.call(this,B)},this._sideEffect=new fs,this._valSideEffectBinder=gd(this._sideEffect);const{combine:he,createVal:Y}=this._valSideEffectBinder;this.id=e,this.namespace=S,this.events=new eo,this._delegateEvents=new eo;const ke=Y(M),Ni=Y(_),ei=Y(n);ei.reaction((B,X,j)=>{j||this.events.emit(ae.PrefersColorScheme,B)});const kt=Y(Boolean(r));r==null&&ei.subscribe((B,X,j)=>{this._sideEffect.add(()=>{if(B==="auto"){const fe=window.matchMedia("(prefers-color-scheme: dark)");if(fe){kt.setValue(fe.matches,j);const Pi=Er=>{kt.setValue(Er.matches,j)};return fe.addListener(Pi),()=>fe.removeListener(Pi)}else return qu}else return kt.setValue(B==="dark",j),qu},"prefers-color-scheme")}),kt.reaction((B,X,j)=>{j||this.events.emit(ae.DarkMode,B)});const gn=Y(te,at),A=Y(I,at),R=Y(D);R.reaction((B,X,j)=>{j||this.events.emit(ae.ForceTop,B||!1)});const H=Y(Z);H.reaction((B,X,j)=>{j||this.events.emit(ae.ForceNormal,B||!1)});const ne=Y(ie),re=Y(i);re.reaction((B,X,j)=>{j||this.titleBar.setTitle(B)});const Je=Y(s);Je.reaction((B,X,j)=>{!j&&!B&&this.events.emit(ae.Close)});const Qe=Y(y);Qe.reaction((B,X,j)=>{j||this.events.emit(ae.Readonly,B)});const ti=Y(x),Pt=Y(d),Ag=Y(f),Tg=Y(p),Bu=Y(v);Bu.reaction((B,X,j)=>{j||this.events.emit(ae.ZIndex,B)});const zu=Y(g);zu.reaction((B,X,j)=>{j||this.events.emit(B?ae.Focus:ae.Blur)});const ki=Y(m);ki.reaction((B,X,j)=>{j||this.events.emit(ae.Minimized,B)});const ii=Y(w);ii.reaction((B,X,j)=>{j||this.events.emit(ae.Maximized,B)});const Du=he([ki,ii,ke],([B,X,j])=>B?N.Minimized:X?N.Maximized:j||N.Normal);Du.reaction((B,X,j)=>{j||this.events.emit(ae.State,B)});const Ar=Y({width:Pe(l,0,1),height:Pe(u,0,1)},at),mn=Y({width:Pe(a,Ar.value.width,1),height:Pe(o,Ar.value.height,1)},at);Ar.reaction((B,X,j)=>{mn.setValue({width:Pe(a,B.width,1),height:Pe(o,B.height,1)},j)}),mn.reaction((B,X,j)=>{j||this.events.emit(ae.IntrinsicResize,B)});const vn=he([mn,ii,ke],([B,X,j])=>X||j===N.Maximized?{width:1,height:1}:B,at);vn.reaction((B,X,j)=>{j||this.events.emit(ae.Resize,B)});const Lu=he([vn,ki,gn,A,ke],([B,X,j,fe,Pi])=>(X||Pi===N.Minimized)&&fe?{width:fe.width/B.width/j.width,height:fe.height/B.height/j.height}:B,at);Lu.reaction((B,X,j)=>{j||this.events.emit(ae.VisualResize,B)});const wa=Y({x:Pe(h,0,1),y:Pe(c,0,1)},at);wa.reaction((B,X,j)=>{j||this.events.emit(ae.IntrinsicMove,B)});const Tr=he([wa,mn,gn,A,ki,ii,ke,Ni],([B,X,j,fe,Pi,Er,Ru,Pg])=>(Pi||Ru===N.Minimized)&&fe?Er||Pg===N.Maximized?{x:(fe.x+fe.width/2)/j.width-1/2,y:(fe.y+fe.height/2)/j.height-1/2}:{x:(fe.x+fe.width/2)/j.width-X.width/2,y:(fe.y+fe.height/2)/j.height-X.height/2}:Er||Ru===N.Maximized?{x:0,y:0}:B,at);Tr.reaction((B,X,j)=>{j||this.events.emit(ae.Move,B)}),this.titleBar=E||new md({readonly:Qe.value,title:re.value,namespace:this.namespace,boxStatus:ke.value,forceTop:R.value,forceNormal:H.value,onDragStart:B=>{var X;return(X=this._handleTrackStart)==null?void 0:X.call(this,B)},onEvent:B=>{if(this._delegateEvents.listeners.length>0)this._delegateEvents.emit(B.type);else switch(B.type){case be.Maximize:{ke.value||ii.setValue(!ii.value);break}case be.Minimize:{ke.value||ki.setValue(!0);break}case be.Close:{Je.setValue(!1);break}default:{console.error("Unsupported titleBar event:",B);break}}}}),Qe.reaction(B=>{this.titleBar.setReadonly(B)}),ke.reaction(B=>{this.titleBar.setBoxStatus(B)});const Eg=Y(P),Ng=Y(k),kg=Y(z);pd(this,{prefersColorScheme:ei,darkMode:kt,containerRect:gn,collectorRect:A,title:re,visible:Je,readonly:Qe,resizable:ti,draggable:Pt,fence:Ag,fixRatio:Tg,focus:zu,zIndex:Bu,minimized:ki,maximized:ii,$userContent:Eg,$userFooter:Ng,$userStyles:kg,forceTop:R,forceNormal:H,isDragContent:ne}),this._state$=Du,this._minSize$=Ar,this._size$=vn,this._intrinsicSize$=mn,this._visualSize$=Lu,this._coord$=Tr,this._intrinsicCoord$=wa,this._boxStatus$=ke,this._lastNotMinimizedBoxStatus$=Ni,this.fixRatio&&this.transform(Tr.value.x,Tr.value.y,vn.value.width,vn.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,i=!1){switch(e){case N.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case N.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}setBoxStatus(e,i=!1){return e===N.Minimized?this._boxStatus$.value&&this._boxStatus$.value!==N.Minimized&&this.setLastNotMinimizedBoxStatus(this._boxStatus$.value,i):this.setLastNotMinimizedBoxStatus(void 0,i),this._boxStatus$.setValue(e,i),i||this.events.emit(ae.BoxStatus,{id:this.id,boxStatus:e}),this}setLastNotMinimizedBoxStatus(e,i=!1){return this._lastNotMinimizedBoxStatus$.setValue(e,i),i||this.events.emit(ae.LastNotMinimizedBoxStatus,{id:this.id,lastNotMinimizedBoxStatus:e}),this}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(e,i=!1){return this._minSize$.setValue({width:e,height:this.minHeight},i),this}setMinHeight(e,i=!1){return this._minSize$.setValue({width:this.minWidth,height:e},i),this}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}resize(e,i,n=!1){return this._intrinsicSize$.setValue({width:e,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(e,i,n=!1){return this._intrinsicCoord$.setValue({x:e,y:i},n),this}get x(){return this._coord$.value.x}get y(){return this._coord$.value.y}transform(e,i,n,r,s=!1){if(this.fixRatio){const a=this.intrinsicHeight/this.intrinsicWidth*n;i!==this.intrinsicY&&(i-=a-r),r=a}return i<0&&(i=0,r>this.intrinsicHeight&&(r=this.intrinsicHeight)),this._intrinsicCoord$.setValue({x:n>=this.minWidth?e:this.intrinsicX,y:r>=this.minHeight?i:this.intrinsicY},s),this._intrinsicSize$.setValue({width:Pe(n,this.minWidth,1),height:Pe(r,this.minHeight,1)},s),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 i;return typeof e=="string"?(i=document.createElement("style"),i.textContent=e):i=e,this.set$userStyles(i),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 i=(c,m,w,y=mv)=>this._renderSideEffect.add(()=>{const x=this.wrapClassName(w);return m.subscribe(d=>{c.classList.toggle(x,y(d))})});i(this.$box,this._readonly$,"readonly"),i(this.$box,this._draggable$,"no-drag",kr),i(this.$box,this._resizable$,"no-resize",kr),i(this.$box,this._focus$,"blur",kr),i(this.$box,this._darkMode$,"color-scheme-dark"),i(this.$box,this._darkMode$,"color-scheme-light",kr),this._renderSideEffect.add(()=>{const c=this.wrapClassName("minimized"),m=this.wrapClassName("maximized"),w="box-maximized-timer";return this._state$.subscribe(y=>{this.$box.classList.toggle(c,y===N.Minimized),y===N.Maximized?(this._renderSideEffect.flush(w),this.$box.classList.toggle(m,!0)):this._renderSideEffect.setTimeout(()=>{this.$box.classList.toggle(m,!1)},0,w)})}),this._renderSideEffect.add(()=>this._visible$.subscribe(c=>{c?this.$box.style.removeProperty("display"):this.$box.style.display="none"})),this._renderSideEffect.add(()=>this._zIndex$.subscribe(c=>{this.$box.style.zIndex=String(c)}));const n=lv(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,s=this.y*this.containerRect.height+this.containerRect.y;this.$box.style.transform=`translate(${r-10}px,${s-10}px)`,this._valSideEffectBinder.combine([this._coord$,this._size$,this._minimized$,this._containerRect$,this._collectorRect$,this._boxStatus$],([c,m,w,y,x,d])=>{const f=m.width*y.width,p=m.height*y.height;return{width:f+((w||d===N.Minimized)&&x?1:0),height:p+((w||d===N.Minimized)&&x?1:0),x:c.x*y.width,y:c.y*y.height,scaleX:(w||d===N.Minimized)&&x?x.width/f:1,scaleY:(w||d===N.Minimized)&&x?x.height/p:1}},at).subscribe(c=>{n.set(c)}),n.set({x:r,y:s});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 l=document.createElement("div");l.className=this.wrapClassName("content-wrap");const u=document.createElement("div");u.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=u,this.isDragContent&&this.$content.appendChild(this.titleBar.$dragArea),this._renderSideEffect.add(()=>{let c;return this._$userStyles$.subscribe(m=>{c&&c.remove(),c=m,m&&l.appendChild(m)})}),this._renderSideEffect.add(()=>{let c;return this._$userContent$.subscribe(m=>{c&&c.remove(),c=m,m&&u.appendChild(m)})}),l.appendChild(u);const h=document.createElement("div");return h.className=this.wrapClassName("footer-wrap"),this.$footer=h,this._renderSideEffect.add(()=>{let c;return this._$userFooter$.subscribe(m=>{c&&c.remove(),c=m,m&&h.appendChild(m)})}),a.appendChild(o),a.appendChild(l),a.appendChild(h),this._renderResizeHandlers(),this.$box}_renderResizeHandlers(){const e=document.createElement("div");e.className=this.wrapClassName("resize-handles"),Object.values(ot).forEach(x=>{const d=document.createElement("div");d.className=this.wrapClassName(x)+" "+this.wrapClassName("resize-handle"),d.dataset.teleBoxHandle=x,e.appendChild(d)}),this.$box.appendChild(e);const i="handle-tracking-listener",n=this.wrapClassName("transforming");let r,s=0,a=0,o=0,l=0,u=0,h=0,c;const m=x=>{if(this.state!==N.Normal)return;Hi(x);let{pageX:d,pageY:f}=Ku(x);f<0&&(f=0);const p=(d-u)/this.containerRect.width,g=(f-h)/this.containerRect.height;switch(c){case ot.North:{this.transform(this.x,a+g,this.width,l-g);break}case ot.South:{this.transform(this.x,this.y,this.width,l+g);break}case ot.West:{this.transform(s+p,this.y,o-p,this.height);break}case ot.East:{this.transform(this.x,this.y,o+p,this.height);break}case ot.NorthWest:{this.transform(s+p,a+g,o-p,l-g);break}case ot.NorthEast:{this.transform(this.x,a+g,o+p,l-g);break}case ot.SouthEast:{this.transform(this.x,this.y,o+p,l+g);break}case ot.SouthWest:{this.transform(s+p,this.y,o-p,l+g);break}default:{if(this.fence)this.move(Pe(s+p,0,1-this.width),Pe(a+g,0,1-this.height));else{const v=20/this.containerRect.width,S=20/this.containerRect.height;this.move(Pe(s+p,v-this.width,1-v),Pe(a+g,0,1-S))}break}}},w=x=>{c=void 0,r&&(Hi(x),this.$box.classList.toggle(n,!1),this._sideEffect.flush(i),r.remove())},y=x=>{var d;if(this.readonly||x.button!=null&&x.button!==0||!this.draggable||c||this.state!==N.Normal)return;const f=x.target;if((d=f.dataset)!=null&&d.teleBoxHandle){Hi(x),s=this.x,a=this.y,o=this.width,l=this.height,{pageX:u,pageY:h}=Ku(x),c=f.dataset.teleBoxHandle,r||(r=document.createElement("div"));const p=c?this.wrapClassName(`cursor-${c}`):"";r.className=this.wrapClassName(`track-mask${p?` ${p}`:""}`),this.$box.appendChild(r),this.$box.classList.add(n),this._sideEffect.add(()=>(window.addEventListener("mousemove",m),window.addEventListener("touchmove",m,{passive:!1}),window.addEventListener("mouseup",w),window.addEventListener("touchend",w,{passive:!1}),window.addEventListener("touchcancel",w,{passive:!1}),()=>{window.removeEventListener("mousemove",m),window.removeEventListener("touchmove",m),window.removeEventListener("mouseup",w),window.removeEventListener("touchend",w),window.removeEventListener("touchcancel",w)}),i)}};this._handleTrackStart=y,this._sideEffect.addEventListener(e,"mousedown",y,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(e,"touchstart",y,{passive:!1},"box-resizeHandles-touchstart")}destroy(){this.$box.remove(),this.events.emit(ae.Destroyed),this._sideEffect.flushAll(),this._renderSideEffect.flushAll(),this.events.removeAllListeners(),this._delegateEvents.removeAllListeners()}wrapClassName(e){return`${this.namespace}-${e}`}}function qu(){}var wv="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class dr{constructor({visible:e=!0,readonly:i=!1,darkMode:n=!1,namespace:r="telebox",styles:s={},onClick:a,getBoxesStatus:o}){this.$appMenuContainer=document.createElement("div"),this.handleCollectorClick=()=>{!this._readonly&&this.onClick&&this.onClick()},this._visible=e,this._readonly=i,this._darkMode=n,this.namespace=r,this.styles=s,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 i of e.values())if(i===N.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 i=this.$collector;Object.keys(e).forEach(n=>{const r=e[n];r!=null&&(i.style[n]=r)})}return this}render(){return this.$collector||(this.$collector=document.createElement("button"),this.$collector.className=this.wrapClassName("collector"),this.$collector.style.backgroundImage=`url('${wv}')`,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}`}}var ce=(t=>(t.Focused="focused",t.Blurred="blurred",t.Created="created",t.Removed="removed",t.State="state",t.Maximized="maximized",t.Minimized="minimized",t.Move="move",t.Resize="resize",t.IntrinsicMove="intrinsic_move",t.IntrinsicResize="intrinsic_resize",t.VisualResize="visual_resize",t.ZIndex="z_index",t.PrefersColorScheme="prefers_color_scheme",t.DarkMode="dark_mode",t.BoxStatus="box_status",t.LastNotMinimizedBoxStatus="last_not_minimized_box_status",t))(ce||{});class yv extends md{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(n=>n===N.Maximized)}return!1}get MaximizedBoxes(){if(this.getBoxesStatus){const e=this.getBoxesStatus();if(e)return this.boxes.filter(i=>e&&e.get(i.id)===N.Maximized&&!i.forceTop)}return[]}focusBox(e){var i,n;if(!(this.focusedBox&&this.focusedBox===e)){if(this.$titles){const{children:r}=this.$titles.firstElementChild;if(this.state===N.Maximized&&!this.hasMaximizedBoxInStatus())for(let s=r.length-1;s>=0;s-=1){const a=r[s],o=(i=a.dataset)==null?void 0:i.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 s=r.length-1;s>=0;s-=1){const a=r[s],o=(n=a.dataset)==null?void 0:n.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:i,y:n,width:r}=e;this.$titleBar.style.transform=`translate(${i}px, ${n}px)`,this.$titleBar.style.width=r+"px"}}updateBoxesStatus(){this.hasMaximizedBoxInStatus()&&this.setBoxStatus(N.Maximized),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===N.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===N.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===N.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:i,y:n,width:r}=this.containerRect;e.style.transform=`translate(${i}px, ${n}px)`,e.style.width=r+"px",e.classList.add(this.wrapClassName("max-titlebar")),e.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===N.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 s=document.createElement("div");return s.classList.add(this.wrapClassName("titles-area")),e.insertBefore(s,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===N.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 e=document.createElement("div");return e.className=this.wrapClassName("titles-content"),this.$titles.appendChild(e),(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")),e.appendChild(n)}),this.$titles}}class xv{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=i=>{i.stopPropagation(),i.stopImmediatePropagation();const r=i.target.getAttribute(`data-${this.c("app-id")}`);if(r){const s=this.manager.getLastNotMinimizedBoxStatus(r)||N.Normal,a=(s===N.Maximized?this.manager.getMaxMaximizedBoxZIndex():this.manager.getMaxNormalBoxZIndex())+1;this.manager.setBox(r,{status:s,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 i=this.manager.getMinimizedBoxesStatus();this.render(i)},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(i=>{i===N.Minimized&&e.push(i)}),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 i=document.createElement("div");i.classList.add(this.c("app-menu-item")),i.setAttribute(`data-${this.c("app-id")}`,e);const n=document.createElement("div");n.classList.add(this.c("app-menu-item-title"));const r=this.manager.getBox(e);return n.innerText=(r==null?void 0:r.title)||e,i.appendChild(n),i}renderMenuView(e){const i=[];e.forEach((n,r)=>{i.push(this.createMinimizedItem(r))}),this.menuView.append(...i)}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 Zs{constructor({root:e=document.body,prefersColorScheme:i=yl.Light,minimized:n=!1,maximized:r=!1,fence:s=!0,containerRect:a={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collector:o,namespace:l="telebox",readonly:u=!1,useBoxesStatus:h=!1}={}){this.events=new eo,this._sideEffect=new fs,this.useBoxesStatus=h;const{combine:c,createVal:m}=gd(this._sideEffect);this.root=e,this.namespace=l,this.boxes$=m([]),this.topBox$=this.boxes$.derive(I=>{if(I.length>0){let M;return I.reduce((D,Z)=>Z.forceTop||Z.boxStatus&&Z.boxStatus===N.Minimized?D:D?D.zIndex>Z.zIndex?D:Z:(D=Z,D),M)}}),this.boxesStatus$=new Map,this.lastNotMinimizedBoxesStatus$=new Map;const w=window.matchMedia("(prefers-color-scheme: dark)"),y=m(!1);w&&(y.setValue(w.matches),this._sideEffect.add(()=>{const I=M=>{y.setValue(M.matches)};return w.addListener(I),()=>w.removeListener(I)}));const x=m(i);x.reaction((I,M,_)=>{this.boxes.forEach(D=>D.setPrefersColorScheme(I,_)),_||this.events.emit(ce.PrefersColorScheme,I)}),this._darkMode$=c([y,x],([I,M])=>M==="auto"?I:M==="dark"),this._darkMode$.reaction((I,M,_)=>{this.boxes.forEach(D=>D.setDarkMode(I,_)),_||this.events.emit(ce.DarkMode,I)});const d=m(u);d.reaction((I,M,_)=>{this.boxes.forEach(D=>D.setReadonly(I,_))});const f=m(n),p=m(r);p.reaction((I,M,_)=>{this.boxes.forEach(D=>D.setMaximized(I,_)),_||this.events.emit(ce.Maximized,I)});const g=c([f,p],([I,M])=>I?N.Minimized:M?N.Maximized:N.Normal);g.reaction((I,M,_)=>{this.maxTitleBar.setState(I),_||this.events.emit(ce.State,I)});const v=m(s);v.subscribe((I,M,_)=>{this.boxes.forEach(D=>D.setFence(I,_))});const S=m(a,at);S.reaction((I,M,_)=>{this.boxes.forEach(D=>D.setContainerRect(I,_)),this.maxTitleBar.setContainerRect(I)});const E=m(o===null?null:o||new dr({visible:n,readonly:u,namespace:l}).mount(e));E.subscribe(I=>{I&&(I.setVisible(f.value),I.setReadonly(d.value),I.setDarkMode(this._darkMode$.value),this.useBoxesStatus&&this.appMenu&&this.appMenu.setContainer(I.$appMenuContainer),this._sideEffect.add(()=>(I.getBoxesStatus=()=>this.boxesStatus$,I.onClick=()=>{d.value||(this.useBoxesStatus?this.useBoxesStatus&&this.appMenu&&this.appMenu.containerClickHandler():f.setValue(!1))},()=>I.destroy()),"collect-onClick"))}),d.subscribe(I=>{var M;return(M=E.value)==null?void 0:M.setReadonly(I)}),this._darkMode$.subscribe(I=>{var M;(M=E.value)==null||M.setDarkMode(I)}),this._calcCollectorRect=()=>{var I;if((I=E.value)!=null&&I.$collector){const{x:M,y:_,width:D,height:Z}=E.value.$collector.getBoundingClientRect(),ie=this.root.getBoundingClientRect();return{x:M-ie.x,y:_-ie.y,width:D,height:Z}}},this._setCollectorRect=I=>{var M;(M=E.value)!=null&&M.$collector&&P.setValue(I)};const P=m(f.value?this._calcCollectorRect():void 0);P.subscribe((I,M,_)=>{this.boxes.forEach(D=>{D.setCollectorRect(I,_)})}),f.subscribe((I,M,_)=>{var D;(D=E.value)==null||D.setVisible(I),I&&this._setCollectorRect(this._calcCollectorRect()),this.boxes.forEach(Z=>Z.setMinimized(I,_)),_||this.events.emit(ce.Minimized,I)});const k=this.wrapClassName("titlebar-icon-close"),z=I=>{var M;if(d.value)return;const _=I.target;if(!!_.tagName)for(let D=_;D;D=D.parentElement){if(D.classList&&D.classList.contains(k))return;const Z=(M=D.dataset)==null?void 0:M.teleBoxID;if(Z){const ie=this.getBox(Z);if(ie){if(!this.useBoxesStatus)this.makeBoxTop(ie);else if(ie.boxStatus&&ie.boxStatus===N.Normal){const he=this.getMaxNormalBoxZIndex();he>ie.zIndex&&this.setBox(ie,{zIndex:he+1},!1)}else if(ie.boxStatus&&ie.boxStatus===N.Maximized){const he=this.getMaxMaximizedBoxZIndex();he>ie.zIndex&&this.setBox(ie,{zIndex:he+1},!1),this.makeMaximizedTopBoxFocus()}this.focusBox(ie);return}}}};this._sideEffect.addEventListener(window,"mousedown",z,!0),this._sideEffect.addEventListener(window,"touchstart",z,!0),this.maxTitleBar=new yv({darkMode:this.darkMode,readonly:d.value,namespace:this.namespace,state:g.value,boxes:this.boxes$.value,containerRect:S.value,getBoxesStatus:()=>this.boxesStatus$,onEvent:I=>{switch(I.type){case be.Maximize:{if(this.hasBoxesStatus()){let M=this.maxTitleBar.focusedBox;if(M||(M=this.getMaximizedTopBox()),M!=null&&M.id){const _=this.getBox(M.id);_&&this.setBox(_,{status:N.Normal,zIndex:this.getMaxNormalBoxZIndex()+1},!1,()=>{this.makeMaximizedTopBoxFocus()})}}else p.setValue(!p.value);break}case be.Minimize:{if(this.hasBoxesStatus()){let M=this.maxTitleBar.focusedBox;if(M||(M=this.getMaximizedTopBox()),M!=null&&M.id){const _=this.getBox(M.id);if(_){let D=!1;_.focus&&(this.blurBox(_),D=!0),this.setBox(_,{status:N.Minimized,zIndex:-1},!1),D?this.focusTopBox():this.makeMaximizedTopBoxFocus()}}}else f.setValue(!0);break}case ae.Close:{if(this.hasBoxesStatus()){let M=this.maxTitleBar.focusedBox;if(M||(M=this.getMaximizedTopBox()),M!=null&&M.id){const _=this.getBox(M.id);if(_){let D=!1;_.focus&&(this.blurBox(_),D=!0),this.remove(_,!1),D?this.focusTopBox():this.makeMaximizedTopBoxFocus()}}}else this.removeTopBox(),this.focusTopBox();break}}}}),d.subscribe(I=>this.maxTitleBar.setReadonly(I)),this._darkMode$.subscribe(I=>{this.maxTitleBar.setDarkMode(I)}),this.boxes$.reaction(I=>{this.maxTitleBar.setBoxes(I)}),pd(this,{prefersColorScheme:x,containerRect:S,collector:E,collectorRect:P,readonly:d,fence:v,minimized:f,maximized:p}),this._state$=g,this.root.appendChild(this.maxTitleBar.render()),h&&(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,i)=>{var n;return i.forceTop&&i.zIndex>((n=e==null?void 0:e.zIndex)!=null?n:0)?i: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,i=!1){switch(e){case N.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case N.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}setBoxStatus(e,i,n=!1){if(i){const r=this.boxesStatus$.get(e);this.boxesStatus$.set(e,i),i===N.Minimized&&r!==N.Minimized?this.setLastNotMinimizedBoxStatus(e,r,n):r===N.Minimized&&i!==N.Minimized&&this.setLastNotMinimizedBoxStatus(e,void 0,n)}else this.boxesStatus$.delete(e),this.setLastNotMinimizedBoxStatus(e,void 0,n);n||this.events.emit(ce.BoxStatus,{id:e,boxStatus:i})}getBoxStatus(e){return this.boxesStatus$.get(e)}get boxesStatus(){return this.boxesStatus$}get lastNotMinimizedBoxesStatus(){return this.lastNotMinimizedBoxesStatus$}setBoxesStatus(e,i=!1){this.boxesStatus$=e,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(e){if(!this.useBoxesStatus)return;let i;const n=this.topBox;this.boxes.forEach(r=>{var s;const a=this.boxesStatus$.get(r.id);a&&(a!==N.Minimized&&!this.isForceTop(r)&&r.zIndex>((s=i==null?void 0:i.zIndex)!=null?s:0)&&(i=r),r.setBoxStatus(a,e))}),this.effectBoxStatusChange(),i&&n!==i&&this.topBox$.setValue(i),!i&&n&&this.topBox$.setValue(void 0)}async effectBoxesStatusChange(e=!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!==e)clearTimeout(this.effectBoxesStatusTimer.timer),this.effectBoxesStatusTimer.resolve&&this.effectBoxesStatusTimer.resolve(!!((n=this.effectBoxesStatusTimer)!=null&&n.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(s=>{this.effectBoxesStatusTimer.resolve=s,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===N.Minimized):!1}getMinimizedBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((i,n)=>{i===N.Minimized&&e.set(n,i)}),e}getNotMinimizedBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((i,n)=>{i!==N.Minimized&&e.set(n,i)}),e}getAllMaximizedBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((i,n)=>{i===N.Maximized&&e.set(n,i)}),e}getAllNormalBoxesStatus(){const e=new Map;return this.boxesStatus$.forEach((i,n)=>{i===N.Normal&&e.set(n,i)}),e}getLastNotMinimizedBoxStatus(e){return this.lastNotMinimizedBoxesStatus$.get(e)}setLastNotMinimizedBoxStatus(e,i,n=!1){i?this.lastNotMinimizedBoxesStatus$.set(e,i):this.lastNotMinimizedBoxesStatus$.delete(e),n||this.events.emit(ce.LastNotMinimizedBoxStatus,{id:e,boxStatus:i})}setLastNotMinimizedBoxesStatus(e,i=!1){this.lastNotMinimizedBoxesStatus$=e,this.effectLastNotMinimizedBoxStatusChange(i)}async effectLastNotMinimizedBoxStatusChange(e=!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!==e)this.effectLastNotMinimizedBoxStatusTimer.resolve&&this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((n=this.effectLastNotMinimizedBoxStatusTimer)!=null&&n.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(s=>{this.effectLastNotMinimizedBoxStatusTimer.resolve=s,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(i=>{const n=this.lastNotMinimizedBoxesStatus$.get(i.id);n&&i.setLastNotMinimizedBoxStatus(n,e)})}getUnabledBoxesStatusZIndex(){return this.topBox?this.topBox.zIndex:99}getMaxMaximizedBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((e,i)=>i.boxStatus&&i.boxStatus===N.Maximized&&!this.isForceTop(i)?Math.max(e,i.zIndex):e,99):this.getUnabledBoxesStatusZIndex()}getMaxNormalBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((e,i)=>i.boxStatus&&i.boxStatus===N.Normal&&!this.isForceTop(i)?Math.max(e,i.zIndex):e,299):this.getUnabledBoxesStatusZIndex()}getMaxForceTopBoxZIndex(){return this.useBoxesStatus?this.boxes.reduce((e,i)=>i.boxStatus&&this.isForceTop(i)?Math.max(e,i.zIndex):e,699):this.getUnabledBoxesStatusZIndex()}isForceNormal(e){return e._forceNormal$.value}isForceTop(e){return e._forceTop$.value}create(e={},i=!0){const n=new vv({zIndex:e.forceTop?this.getMaxForceTopBoxZIndex()+1:this.getMaxNormalBoxZIndex()+1,...i?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 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(be.Maximize,()=>{if(this.useBoxesStatus&&n.boxStatus){if(n._forceNormal$.value)return;n.boxStatus===N.Maximized?this.setBox(n.id,{status:N.Normal,zIndex:this.getMaxNormalBoxZIndex()+1},!1):([...this.boxes].filter(r=>r.boxStatus===N.Normal&&!this.isForceNormal(r)).sort((r,s)=>r.zIndex-s.zIndex).forEach(r=>{r.boxStatus===N.Normal&&this.setBox(r.id,{status:N.Maximized,zIndex:this.getMaxMaximizedBoxZIndex()+1},!1)}),this.makeMaximizedTopBoxFocus())}else this.setMaximized(!this.maximized)}),n._delegateEvents.on(be.Minimize,()=>{if(n.boxStatus&&this.useBoxesStatus){if(n._forceNormal$.value)return;n.focus&&this.blurBox(n),this.setBox(n,{status:N.Minimized,zIndex:-1},!1,()=>{this.focusTopBox()})}else this.setMinimized(!0)}),n._delegateEvents.on(be.Close,()=>{this.useBoxesStatus&&n.focus&&this.blurBox(n),this.remove(n),this.focusTopBox()}),n._coord$.reaction((r,s,a)=>{a||this.events.emit(ce.Move,n)}),n._size$.reaction((r,s,a)=>{a||this.events.emit(ce.Resize,n)}),n._intrinsicCoord$.reaction((r,s,a)=>{a||this.events.emit(ce.IntrinsicMove,n)}),n._intrinsicSize$.reaction((r,s,a)=>{a||this.events.emit(ce.IntrinsicResize,n)}),n._visualSize$.reaction((r,s,a)=>{a||this.events.emit(ce.VisualResize,n)}),n._zIndex$.reaction((r,s,a)=>{if(this.boxes.length>0){let o;const l=this.boxes.reduce((u,h)=>this.isForceTop(h)||h.boxStatus&&h.boxStatus===N.Minimized?u:u?u.zIndex>h.zIndex?u:h:(u=h,u),o);this.topBox$.setValue(l)}a||this.events.emit(ce.ZIndex,n)}),this.events.emit(ce.Created,n),n}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,i,n=!1){const r=this.boxes.find(s=>s.id===e);if(r)return this.updateBox(r,i,n)}updateAll(e,i=!1){this.boxes.forEach(n=>{this.updateBox(n,e,i)})}setBox(e,i,n=!1,r){const s=this.getBox(e);if(s){const{status:a,zIndex:o,lastNotMinimizedBoxStatus:l}=i;a&&(this.setBoxStatus(s.id,a,n),s.setBoxStatus(a,n),this.effectBoxStatusChange()),o&&s.setZIndex(o,n),l&&(this.setLastNotMinimizedBoxStatus(s.id,l,n),s.setLastNotMinimizedBoxStatus(l,n)),r&&r()}}remove(e,i=!1,n){const r=this.getBox(e),s=this.getBoxIndex(e);if(s>=0){const a=this.boxes.slice(),o=a.splice(s,1);return this.boxes$.setValue(a),o.forEach(l=>l.destroy()),r&&this.useBoxesStatus&&(this.setBoxStatus(r.id,void 0,i),this.setLastNotMinimizedBoxStatus(r.id,void 0,i),this.effectBoxStatusChange(),n&&n()),i||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(ce.Removed,o)),o[0]}}removeTopBox(){if(this.topBox)return this.remove(this.topBox)}removeAll(e=!1){const i=this.boxes$.value;return this.boxes$.setValue([]),i.forEach(n=>n.destroy()),this.boxesStatus$.clear(),this.lastNotMinimizedBoxesStatus$.clear(),e||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(ce.Removed,i)),i}destroy(e=!1){this.events.removeAllListeners(),this._sideEffect.flushAll(),this.removeAll(e),Object.keys(this).forEach(i=>{const n=this[i];n instanceof hr&&n.destroy()})}wrapClassName(e){return`${this.namespace}-${e}`}focusBox(e,i=!1){const n=this.getBox(e);n&&(this.boxes.forEach(r=>{if(n===r){let s=!1;n.focus||(s=!0,n.setFocus(!0,i)),s&&!i&&this.events.emit(ce.Focused,n)}else r.focus&&this.blurBox(r,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(e,i=!1){const n=this.getBox(e);n&&(n.focus&&(n.setFocus(!1,i),i||this.events.emit(ce.Blurred,n)),this.maxTitleBar.focusedBox===n&&this.maxTitleBar.focusBox())}blurAll(e=!1){this.boxes.forEach(i=>{i.focus&&(i.setFocus(!1,e),e||this.events.emit(ce.Blurred,i))}),this.maxTitleBar.focusedBox&&this.maxTitleBar.focusBox()}teleBoxMatcher(e){const i=Object.keys(e);return n=>i.every(r=>e[r]===n[r])}updateBox(e,i,n=!1){(i.x!=null||i.y!=null)&&e.move(i.x==null?e.intrinsicX:i.x,i.y==null?e.intrinsicY:i.y,n),(i.width!=null||i.height!=null)&&e.resize(i.width==null?e.intrinsicWidth:i.width,i.height==null?e.intrinsicHeight:i.height,n),i.title!=null&&(e.setTitle(i.title),this.maxTitleBar.updateTitles()),i.visible!=null&&e.setVisible(i.visible,n),i.minHeight!=null&&e.setMinHeight(i.minHeight,n),i.minWidth!=null&&e.setMinWidth(i.minWidth,n),i.resizable!=null&&e.setResizable(i.resizable,n),i.draggable!=null&&e.setDraggable(i.draggable,n),i.fixRatio!=null&&e.setFixRatio(i.fixRatio,n),i.zIndex!=null&&e.setZIndex(i.zIndex,n),i.content!=null&&e.mountContent(i.content),i.footer!=null&&e.mountFooter(i.footer),this.useBoxesStatus&&(i.boxStatus||i.lastNotMinimizedBoxStatus)&&this.setBox(e,{status:i.boxStatus,lastNotMinimizedBoxStatus:i.lastNotMinimizedBoxStatus},n),i.forceTop!=null&&e.setForceTop(i.forceTop,n),i.forceNormal!=null&&e.setForceNormal(i.forceNormal,n)}smartPosition(e={}){let{x:i,y:n}=e;const{width:r=.5,height:s=.5}=e;if(i==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===N.Minimized&&o.lastNotMinimizedBoxStatus&&o.lastNotMinimizedBoxStatus===N.Normal).reduce((o,l)=>Math.max(o,l.intrinsicX*this.containerRect.width+20),a));i=a/this.containerRect.width}if(n==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-s*this.containerRect.height&&(a=20))}else this.topBox?(a=this.topBox.intrinsicY*this.containerRect.height+20,a>this.containerRect.height-s*this.containerRect.height&&(a=20)):this.hasMinimizedBox()&&(a=[...this.boxes].filter(o=>o.boxStatus&&o.boxStatus===N.Minimized&&o.lastNotMinimizedBoxStatus&&o.lastNotMinimizedBoxStatus===N.Normal).reduce((o,l)=>Math.max(o,l.intrinsicY*this.containerRect.height+20),a));n=a/this.containerRect.height}return{...e,x:i,y:n,width:r,height:s}}makeBoxTop(e,i=!1){!this.useBoxesStatus&&this.topBox?e!==this.topBox&&e.setZIndex(this.topBox.zIndex+1,i):this.useBoxesStatus}getMaximizedTopBox(){if(!this.useBoxesStatus)return;let e;return this.maxTitleBar.hasMaximizedBoxInStatus()&&(e=this.maxTitleBar.MaximizedBoxes.reduce((i,n)=>i&&i.zIndex>n.zIndex?i:n)),e}makeMaximizedTopBoxFocus(){if(!this.useBoxesStatus)return;const e=this.getMaximizedTopBox();this.maxTitleBar.focusBox(e)}getBoxIndex(e){return typeof e=="string"?this.boxes.findIndex(i=>i.id===e):this.boxes.findIndex(i=>i===e)}getBox(e){return typeof e=="string"?this.boxes.find(i=>i.id===e):e}createMinimizedAppMenu(){var e,i;if((e=this.collector)!=null&&e.$appMenuContainer)return new xv({manager:this,container:(i=this.collector)==null?void 0:i.$appMenuContainer,theme:this.prefersColorScheme?"dark":"light",getBoxesStatus:()=>this.boxesStatus$})}}const Sv=(t,e,i,n,r)=>{const s=Tt(Ys,Q.extendClass);return new s({safeSetAttributes:a=>t.safeSetAttributes(a),getMainView:()=>t.mainView,updateAppState:(...a)=>{var o;return(o=t.appManager)==null?void 0:o.store.updateAppState(...a)},setBoxStatus:(a,o)=>{var l;return(l=t.appManager)==null?void 0:l.store.setBoxStatus(a,o)},setLastNotMinimizedBoxStatus:(a,o)=>{var l;return(l=t.appManager)==null?void 0:l.store.setLastNotMinimizedBoxStatus(a,o)},canOperate:()=>t.canOperate,notifyContainerRectUpdate:a=>{var o;return(o=t.appManager)==null?void 0:o.notifyContainerRectUpdate(a)},cleanFocus:()=>{var a;return(a=t.appManager)==null?void 0:a.store.cleanFocus()},setAppFocus:a=>{var o;return(o=t.appManager)==null?void 0:o.store.setAppFocus(a,!0)},callbacks:e,emitter:i,boxEmitter:n},r)};class Ys{constructor(e,i){this.context=e,this.createTeleBoxManagerConfig=i;const{emitter:n,callbacks:r,boxEmitter:s}=e;this.teleBoxManager=this.setupBoxManager(i),this.teleBoxManager._state$.reaction(a=>{r.emit("boxStateChange",a),n.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(l=>{l.resize(l.intrinsicWidth+o,l.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=>{s.emit("close",{appId:o.id})})}),this.teleBoxManager.events.on("intrinsic_move",T.debounce(a=>{s.emit("move",{appId:a.id,x:a.intrinsicX,y:a.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",T.debounce(a=>{s.emit("resize",{appId:a.id,width:a.intrinsicWidth,height:a.intrinsicHeight})},200)),this.teleBoxManager.events.on("focused",a=>{a&&(this.canOperate?s.emit("focus",{appId:a.id}):this.teleBoxManager.blurBox(a.id))}),this.teleBoxManager.events.on("blurred",a=>{a&&this.canOperate&&s.emit("blurred",{appId:a.id})}),this.teleBoxManager.events.on("z_index",a=>{this.context.updateAppState(a.id,Be.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)}),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(e){var u,h,c;if(!this.teleBoxManager)return;let{minwidth:i=_g,minheight:n=Vg}=(u=e.app.config)!=null?u:{};const{width:r,height:s}=(h=e.app.config)!=null?h:{},a=((c=e.options)==null?void 0:c.title)||e.appId,o=this.teleBoxManager.containerRect;i>1&&(i=i/o.width),n>1&&(n=n/o.height);const l={title:a,minWidth:i,minHeight:n,width:r,height:s,id:e.appId,boxStatus:e.boxStatus,forceTop:e.forceTop,forceNormal:e.forceNormal,isDragContent:e.isDragContent};this.teleBoxManager.create(l,e.smartPosition),this.context.emitter.emit(`${e.appId}${K.WindowCreated}`)}setBoxInitState(e){const i=this.teleBoxManager.queryOne({id:e});i&&i.state===N.Maximized&&this.context.boxEmitter.emit("resize",{appId:e,x:i.x,y:i.y,width:i.intrinsicWidth,height:i.intrinsicHeight})}setBoxesStatus(e){const i=new Map(Object.entries(e!=null?e:{}));this.teleBoxManager.setBoxesStatus(i,!0),this.context.callbacks.emit("onBoxesStatusChange",i),this.context.emitter.emit("boxesStatusChange",i)}setLastNotMinimizedBoxesStatus(e){const i=new Map(Object.entries(e!=null?e:{}));this.teleBoxManager.setLastNotMinimizedBoxesStatus(i,!0),this.context.callbacks.emit("onLastNotMinimizedBoxesStatusChange",i),this.context.emitter.emit("lastNotMinimizedBoxesStatusChange",i)}setupBoxManager(e){const i=Q.wrapper?Q.wrapper:document.body,n=i.getBoundingClientRect(),r={root:i,containerRect:{x:0,y:0,width:n.width,height:n.height},fence:!1,prefersColorScheme:e==null?void 0:e.prefersColorScheme,useBoxesStatus:(e==null?void 0:e.useBoxesStatus)||!1},s=Tt(Zs,Q.extendClass),a=new s(r);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=a;const o=(e==null?void 0:e.collectorContainer)||Q.wrapper;return o&&this.setCollectorContainer(o),a}setCollectorContainer(e){var r;const i=Tt(dr,Q.extendClass),n=new i({styles:(r=this.createTeleBoxManagerConfig)==null?void 0:r.collectorStyles}).mount(e);this.teleBoxManager.setCollector(n)}getBox(e){return this.teleBoxManager.queryOne({id:e})}closeBox(e,i=!1){return this.teleBoxManager.remove(e,i)}boxIsFocus(e){const i=this.getBox(e);return i==null?void 0:i.focus}getFocusBox(){return this.teleBoxManager.query({focus:!0})[0]}getTopBox(){return this.teleBoxManager.topBox}updateBoxState(e){if(!e)return;const i=this.getBox(e.id);i&&(this.teleBoxManager.update(i.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(i.id,!0),e.maximized!=null&&this.teleBoxManager.setMaximized(Boolean(e.maximized),!0),e.minimized!=null&&this.teleBoxManager.setMinimized(Boolean(e.minimized),!0)},50),this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}updateManagerRect(){var i;const e=(i=this.mainView.divElement)==null?void 0:i.getBoundingClientRect();if(e&&e.width>0&&e.height>0){const n={x:0,y:0,width:e.width,height:e.height};this.teleBoxManager.setContainerRect(n),this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect)}}moveBox({appId:e,x:i,y:n}){this.teleBoxManager.update(e,{x:i,y:n},!0)}focusBox({appId:e},i=!0){this.teleBoxManager.focusBox(e,i)}resizeBox({appId:e,width:i,height:n,skipUpdate:r}){this.teleBoxManager.update(e,{width:i,height:n},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,i=!0){e!==this.maximized&&this.teleBoxManager.setMaximized(e,i)}setMinimized(e,i=!0){this.teleBoxManager.setMinimized(e,i)}focusTopBox(){if(this.teleBoxManager.query().length>=1){const i=this.getTopBox();i&&this.focusBox({appId:i.id},!1)}}updateBox(e,i,n=!0){this.teleBoxManager.update(e,i,n)}setReadonly(e){this.teleBoxManager.setReadonly(e)}setPrefersColorScheme(e){this.teleBoxManager.setPrefersColorScheme(e)}setZIndex(e,i,n=!0){this.teleBoxManager.update(e,{zIndex:i},n)}destroy(){this.teleBoxManager.destroy()}}const et=(...t)=>{Q.debug&&console.log("[WindowManager]:",...t)},Mv=t=>{const e=document.createElement("div");e.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 r=document.createElement("div");return r.className="netless-window-manager-main-view",e.appendChild(i),i.appendChild(n),n.appendChild(r),t.appendChild(e),Q.wrapper=n,{playground:e,wrapper:n,sizer:i,mainViewElement:r}},Cv=()=>{if(Uu(b.WhiteVersion)<Uu(_u))throw new Wh(_u)},ao=(t,e)=>{var s;const i=(t==null?void 0:t.state.roomMembers)||[];let n=-1,r;for(const a of i)((s=a.payload)==null?void 0:s.uid)===e&&n<a.memberId&&(n=a.memberId,r=a);return r},Iv=async t=>{let e=t.getInvisiblePlugin(Q.kind);if(e)return e;let i;const n=new Promise(u=>{Q._resolve=i=u});let r=!1;const s=bv(t);!t.isWritable&&s&&(r=!0,await jh.default(async u=>{et(`switching to writable (x${u})`),await t.setWritable(!0)},{retries:10,maxTimeout:5e3})),t.isWritable?(et("creating InvisiblePlugin..."),t.createInvisiblePlugin(Q,{}).catch(console.warn)):(s&&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),l=setInterval(()=>{e=t.getInvisiblePlugin(Q.kind),e&&(clearTimeout(o),clearTimeout(a),clearInterval(l),i(e),r&&t.isWritable&&setTimeout(()=>t.setWritable(!1).catch(console.warn),500))},200);return n},bv=t=>{try{const e=atob(t.roomToken.slice(12)),i=e.indexOf("&role=");return+e[i+6]<2}catch(e){return console.error(e),!1}};function Jn(){}function vd(t){return t()}function ec(){return Object.create(null)}function Gs(t){t.forEach(vd)}function wd(t){return typeof t=="function"}function Av(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Pr;function ps(t,e){return Pr||(Pr=document.createElement("a")),Pr.href=e,t===Pr.href}function Tv(t){return Object.keys(t).length===0}function Mt(t,e){t.appendChild(e)}function Xs(t,e,i){t.insertBefore(e,i||null)}function fr(t){t.parentNode&&t.parentNode.removeChild(t)}function Vt(t){return document.createElement(t)}function xl(t){return document.createTextNode(t)}function oo(){return xl(" ")}function le(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function Ev(t){return Array.from(t.childNodes)}function yd(t,e){e=""+e,t.data!==e&&(t.data=e)}function ye(t,e,i,n){i==null?t.style.removeProperty(e):t.style.setProperty(e,i,n?"important":"")}let Sl;function Vn(t){Sl=t}const Li=[],tc=[];let Fi=[];const ic=[],Nv=Promise.resolve();let lo=!1;function kv(){lo||(lo=!0,Nv.then(xd))}function uo(t){Fi.push(t)}const Na=new Set;let Bi=0;function xd(){if(Bi!==0)return;const t=Sl;do{try{for(;Bi<Li.length;){const e=Li[Bi];Bi++,Vn(e),Pv(e.$$)}}catch(e){throw Li.length=0,Bi=0,e}for(Vn(null),Li.length=0,Bi=0;tc.length;)tc.pop()();for(let e=0;e<Fi.length;e+=1){const i=Fi[e];Na.has(i)||(Na.add(i),i())}Fi.length=0}while(Li.length);for(;ic.length;)ic.pop()();lo=!1,Na.clear(),Vn(t)}function Pv(t){if(t.fragment!==null){t.update(),Gs(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(uo)}}function Bv(t){const e=[],i=[];Fi.forEach(n=>t.indexOf(n)===-1?e.push(n):i.push(n)),i.forEach(n=>n()),Fi=e}const zv=new Set;function Dv(t,e){t&&t.i&&(zv.delete(t),t.i(e))}function Lv(t,e,i,n){const{fragment:r,after_update:s}=t.$$;r&&r.m(e,i),n||uo(()=>{const a=t.$$.on_mount.map(vd).filter(wd);t.$$.on_destroy?t.$$.on_destroy.push(...a):Gs(a),t.$$.on_mount=[]}),s.forEach(uo)}function Rv(t,e){const i=t.$$;i.fragment!==null&&(Bv(i.after_update),Gs(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function jv(t,e){t.$$.dirty[0]===-1&&(Li.push(t),kv(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function _v(t,e,i,n,r,s,a,o=[-1]){const l=Sl;Vn(t);const u=t.$$={fragment:null,ctx:[],props:s,update:Jn,not_equal:r,bound:ec(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:ec(),dirty:o,skip_bound:!1,root:e.target||l.$$.root};a&&a(u.root);let h=!1;if(u.ctx=i?i(t,e.props||{},(c,m,...w)=>{const y=w.length?w[0]:m;return u.ctx&&r(u.ctx[c],u.ctx[c]=y)&&(!u.skip_bound&&u.bound[c]&&u.bound[c](y),h&&jv(t,c)),m}):[],u.update(),h=!0,Gs(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const c=Ev(e.target);u.fragment&&u.fragment.l(c),c.forEach(fr)}else u.fragment&&u.fragment.c();e.intro&&Dv(t.$$.fragment),Lv(t,e.target,e.anchor,e.customElement),xd()}Vn(l)}class Vv{$destroy(){Rv(this,1),this.$destroy=Jn}$on(e,i){if(!wd(i))return Jn;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(i),()=>{const r=n.indexOf(i);r!==-1&&n.splice(r,1)}}$set(e){this.$$set&&!Tv(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function nc(t){let e,i,n,r,s,a,o,l=t[18]&&rc(t),u=t[19]&&sc(t);return{c(){e=Vt("div"),i=Vt("div"),l&&l.c(),n=oo(),r=Vt("span"),s=xl(t[1]),a=oo(),u&&u.c(),ye(r,"overflow","hidden"),ye(r,"white-space","nowrap"),ye(r,"text-overflow","ellipsis"),ye(r,"max-width","80px"),le(i,"class",t[9]),ye(i,"background-color",t[3]),ye(i,"color",t[10]),ye(i,"opacity",t[12]),le(e,"class",o="netless-window-manager-cursor-name "+t[16]+" "+t[15])},m(h,c){Xs(h,e,c),Mt(e,i),l&&l.m(i,null),Mt(i,n),Mt(i,r),Mt(r,s),Mt(i,a),u&&u.m(i,null)},p(h,c){h[18]?l?l.p(h,c):(l=rc(h),l.c(),l.m(i,n)):l&&(l.d(1),l=null),c&2&&yd(s,h[1]),h[19]?u?u.p(h,c):(u=sc(h),u.c(),u.m(i,null)):u&&(u.d(1),u=null),c&512&&le(i,"class",h[9]),c&8&&ye(i,"background-color",h[3]),c&1024&&ye(i,"color",h[10]),c&4096&&ye(i,"opacity",h[12]),c&98304&&o!==(o="netless-window-manager-cursor-name "+h[16]+" "+h[15])&&le(e,"class",o)},d(h){h&&fr(e),l&&l.d(),u&&u.d()}}}function rc(t){let e,i;return{c(){e=Vt("img"),le(e,"class","netless-window-manager-cursor-selector-avatar"),le(e,"style",t[20]()),ps(e.src,i=t[8])||le(e,"src",i),le(e,"alt","avatar")},m(n,r){Xs(n,e,r)},p(n,r){r&256&&!ps(e.src,i=n[8])&&le(e,"src",i)},d(n){n&&fr(e)}}}function sc(t){let e,i;return{c(){e=Vt("span"),i=xl(t[2]),le(e,"class","netless-window-manager-cursor-tag-name"),ye(e,"background-color",t[11])},m(n,r){Xs(n,e,r),Mt(e,i)},p(n,r){r&4&&yd(i,n[2]),r&2048&&ye(e,"background-color",n[11])},d(n){n&&fr(e)}}}function Ov(t){let e,i,n,r,s,a,o,l=!t[14]&&nc(t);return{c(){e=Vt("div"),l&&l.c(),i=oo(),n=Vt("div"),r=Vt("img"),le(r,"class",s="netless-window-manager-cursor-"+t[4]+"-image "+t[15]),ps(r.src,a=t[7])||le(r,"src",a),le(r,"alt",t[4]),le(n,"class","cursor-image-wrapper"),le(e,"class",o="netless-window-manager-cursor-mid"+(t[13]?" netless-window-manager-cursor-custom":"")),ye(e,"transform","translateX("+t[5]+"px) translateY("+t[6]+"px)"),ye(e,"display",t[17]),le(e,"data-cursor-uid",t[0])},m(u,h){Xs(u,e,h),l&&l.m(e,null),Mt(e,i),Mt(e,n),Mt(n,r)},p(u,[h]){u[14]?l&&(l.d(1),l=null):l?l.p(u,h):(l=nc(u),l.c(),l.m(e,i)),h&32784&&s!==(s="netless-window-manager-cursor-"+u[4]+"-image "+u[15])&&le(r,"class",s),h&128&&!ps(r.src,a=u[7])&&le(r,"src",a),h&16&&le(r,"alt",u[4]),h&8192&&o!==(o="netless-window-manager-cursor-mid"+(u[13]?" netless-window-manager-cursor-custom":""))&&le(e,"class",o),h&96&&ye(e,"transform","translateX("+u[5]+"px) translateY("+u[6]+"px)"),h&131072&&ye(e,"display",u[17]),h&1&&le(e,"data-cursor-uid",u[0])},i:Jn,o:Jn,d(u){u&&fr(e),l&&l.d()}}}function Uv(t,e,i){let n,r,s,a,o,l,u,h,{uid:c}=e,{cursorName:m}=e,{tagName:w}=e,{backgroundColor:y}=e,{appliance:x}=e,{x:d}=e,{y:f}=e,{src:p}=e,{visible:g}=e,{avatar:v}=e,{theme:S}=e,{color:E}=e,{cursorTagBackgroundColor:P}=e,{opacity:k}=e,{pencilEraserSize:z}=e,{custom:te}=e;const I=()=>Object.entries({width:(n?19:28)+"px",height:(n?19:28)+"px",position:n?"initial":"absolute","border-color":n?"white":y,"margin-right":(n?4:0)+"px"}).map(([M,_])=>`${M}: ${_}`).join(";");return t.$$set=M=>{"uid"in M&&i(0,c=M.uid),"cursorName"in M&&i(1,m=M.cursorName),"tagName"in M&&i(2,w=M.tagName),"backgroundColor"in M&&i(3,y=M.backgroundColor),"appliance"in M&&i(4,x=M.appliance),"x"in M&&i(5,d=M.x),"y"in M&&i(6,f=M.y),"src"in M&&i(7,p=M.src),"visible"in M&&i(21,g=M.visible),"avatar"in M&&i(8,v=M.avatar),"theme"in M&&i(9,S=M.theme),"color"in M&&i(10,E=M.color),"cursorTagBackgroundColor"in M&&i(11,P=M.cursorTagBackgroundColor),"opacity"in M&&i(12,k=M.opacity),"pencilEraserSize"in M&&i(22,z=M.pencilEraserSize),"custom"in M&&i(13,te=M.custom)},t.$$.update=()=>{t.$$.dirty&2&&(n=!T.isEmpty(m)),t.$$.dirty&4&&i(19,r=!T.isEmpty(w)),t.$$.dirty&256&&i(18,s=!T.isEmpty(v)),t.$$.dirty&2097152&&i(17,a=g?"":"none"),t.$$.dirty&16&&i(14,o=x===b.ApplianceNames.laserPointer),t.$$.dirty&16400&&i(23,l=o||x===b.ApplianceNames.pencilEraser),t.$$.dirty&8388608&&i(16,u=l?"netless-window-manager-laserPointer-pencilEraser-offset":""),t.$$.dirty&4194304&&i(15,h=z===3?"netless-window-manager-pencilEraser-3-offset":"")},[c,m,w,y,x,d,f,p,v,S,E,P,k,te,o,h,u,a,s,r,I,g,z,l]}class $v extends Vv{constructor(e){super(),_v(this,e,Uv,Ov,Av,{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 Sd="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 Md(t){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${t}' stroke-linejoin='square'/%3E%3Ccircle cx='12' cy='12' r='3.5' stroke='%23${t}'/%3E%3C/g%3E%3C/svg%3E`}function Ri(t){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${t}' stroke-linejoin='round'/%3E%3Cpath d='M12 5V19' stroke='%23${t}' stroke-linejoin='round'/%3E%3C/svg%3E`}function ri(t){return`url("${t}") 12 12, auto`}function Wv(t){let e="";for(const i in t)e+=`.netless-whiteboard.${i} {cursor: ${t[i]}}
16
+ `;return e}const Br=document.createElement("style");function Hv(t){const[e,i,n]=t.strokeColor,r=((1<<24)+(e<<16)+(i<<8)+n).toString(16).slice(1);return Br.textContent=Wv({"cursor-pencil":ri(Md(r)),"cursor-eraser":ri(Sd),"cursor-rectangle":ri(Ri(r)),"cursor-ellipse":ri(Ri(r)),"cursor-straight":ri(Ri(r)),"cursor-arrow":ri(Ri(r)),"cursor-shape":ri(Ri(r))}),document.head.appendChild(Br),()=>{Br.parentNode!=null&&document.head.removeChild(Br)}}const Fv=new Set([b.ApplianceNames.rectangle,b.ApplianceNames.ellipse,b.ApplianceNames.straight,b.ApplianceNames.arrow,b.ApplianceNames.shape]);function ac(t,e){if(t===b.ApplianceNames.pencil)return Md(e);if(t===b.ApplianceNames.eraser)return Sd;if(Fv.has(t))return Ri(e)}class Qv{constructor(e,i,n,r){this.manager=e,this.memberId=i,this.cursorManager=n,this.wrapper=r,this.style="default",this.move=s=>{var a;if(s.type==="main"){const o=this.cursorManager.wrapperRect;this.component&&o&&(this.autoHidden(),this.moveCursor(s,o,this.manager.mainView))}else{const o=this.cursorManager.focusView,l=(a=o==null?void 0:o.divElement)==null?void 0:a.getBoundingClientRect(),u=o==null?void 0:o.camera;o&&l&&u&&this.component&&(this.autoHidden(),this.moveCursor(s,l,o))}},this.setStyle=s=>{this.style=s,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(e,i,n){var l,u;const{x:r,y:s,type:a}=e,o=n==null?void 0:n.screen.convertPointToScreen(r,s);if(o){let h=o.x-2,c=o.y-18;if(this.isCustomIcon()&&(h-=11,c+=4),a==="app"){const m=this.cursorManager.wrapperRect;m&&(h=h+i.x-m.x,c=c+i.y-m.y)}o.x<0||o.x>i.width||o.y<0||o.y>i.height?(l=this.component)==null||l.$set({visible:!1,x:h,y:c}):(u=this.component)==null||u.$set({visible:!0,x:h,y:c})}}get memberApplianceName(){var e,i;return(i=(e=this.member)==null?void 0:e.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 r,s;const[e,i,n]=((s=(r=this.member)==null?void 0:r.memberState)==null?void 0:s.strokeColor)||[236,52,85];return((1<<24)+(e<<16)+(i<<8)+n).toString(16).slice(1)}get payload(){var e;return(e=this.member)==null?void 0:e.payload}get memberCursorName(){var e,i;return((e=this.payload)==null?void 0:e.nickName)||((i=this.payload)==null?void 0:i.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 $v({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 l;if(!this.member)return;const{memberApplianceName:e,memberColorHex:i}=this,{userApplianceIcons:n,applianceIcons:r}=this.cursorManager;let s=this.memberApplianceName;s===b.ApplianceNames.pencilEraser&&(s=`${s}${((l=this.member)==null?void 0:l.memberState.pencilEraserSize)||1}`);const a=s&&n[s];if(a)return a;if(this.style==="custom"&&e){const u=ac(e,i);if(u)return u}return r[s||b.ApplianceNames.shape]||r[b.ApplianceNames.shape]}isCustomIcon(){var a;if(!this.member)return!1;const{memberApplianceName:e,memberColorHex:i}=this,{userApplianceIcons:n}=this.cursorManager;let r=this.memberApplianceName;return r===b.ApplianceNames.pencilEraser&&(r=`${r}${((a=this.member)==null?void 0:a.memberState.pencilEraserSize)||1}`),r&&n[r]?!1:!!(this.style==="custom"&&e&&ac(e,i))}updateMember(){return this.member=ao(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var e;(e=this.component)==null||e.$set(T.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 Zv="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==",Yv="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==",Gv="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=",Xv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",Jv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",Kv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",qv="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMjYiIHZpZXdCb3g9IjAgMCAxOCAyNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIxNyIgaGVpZ2h0PSIyNSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",ew="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMzQiIHZpZXdCb3g9IjAgMCAyNiAzNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIyNSIgaGVpZ2h0PSIzMyIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",tw="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iNTAiIHZpZXdCb3g9IjAgMCAzNCA1MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIzMyIgaGVpZ2h0PSI0OSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K";const iw={[b.ApplianceNames.pencil]:Zv,[b.ApplianceNames.selector]:Yv,[b.ApplianceNames.eraser]:Gv,[b.ApplianceNames.shape]:Xv,[b.ApplianceNames.text]:Jv,[b.ApplianceNames.laserPointer]:Kv,pencilEraser1:qv,pencilEraser2:ew,pencilEraser3:tw},oc="local-cursor";class Js{constructor(e,i,n,r){var o;this.manager=e,this.enableCursor=i,this.cursorInstances=new Map,this.userApplianceIcons={},this.sideEffectManager=new cr,this.store=this.manager.store,this.leaveFlag=!0,this._style="default",this.onCursorMove=l=>{const u=this.initCursorInstance(l.uid);if(l.state===Ja.Leave)u.leave();else{const h=u.updateMember();this.canMoveCursor(h)&&u.move(l.position)}},this.initCursorInstance=l=>{let u=this.cursorInstances.get(l);return u||(u=new Qv(this.manager,l,this,Q.wrapper),this.cursorInstances.set(l,u)),u},this.mouseMoveListener_=(l,u)=>{const h=this.getType(l);this.updateCursor(h,l.clientX,l.clientY),u&&this.showPencilEraserIfNeeded(h,l.clientX,l.clientY)},this.mouseMoveTimer=0,this.mouseMoveListener=l=>{const u=l.pointerType==="touch";if(u&&!l.isPrimary)return;const h=Date.now();if(h-this.mouseMoveTimer>48){if(this.mouseMoveTimer=h,Q.supportAppliancePlugin&&b.isRoom(Q.displayer)&&Q.displayer.disableDeviceInputs){this.leaveFlag&&(this.manager.dispatchInternalEvent(K.CursorMove,{uid:this.manager.uid,state:Ja.Leave}),this.leaveFlag=!1);return}this.mouseMoveListener_(l,u),this.leaveFlag=!0}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.getPoint=(l,u,h)=>{var m;const c=(m=l==null?void 0:l.divElement)==null?void 0:m.getBoundingClientRect();if(c)return l==null?void 0:l.convertToPointInWorld({x:u-c.x,y:h-c.y})},this.getType=l=>{var c;const u=l.target,h=this.manager.focusApp;switch(u.parentElement){case this.mainViewElement:return{type:"main"};case((c=h==null?void 0:h.view)==null?void 0:c.divElement):return{type:"app"};default:return{type:"main"}}},this.roomMembers=(o=this.manager.room)==null?void 0:o.state.roomMembers;const s=Q.wrapper;s&&this.setupWrapper(s),this.sideEffectManager.add(()=>V.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>V.on("playgroundSizeChange",()=>this.updateContainerRect()));const a=this.manager.room;a&&this.sideEffectManager.add(()=>{const l=u=>{this.style==="custom"&&u.memberState&&this.enableCustomCursor()};return a.callbacks.on("onRoomStateChanged",l),()=>a.callbacks.off("onRoomStateChanged",l)}),r&&(this.userApplianceIcons=r),this.style=(n==null?void 0:n.style)||"default"}get applianceIcons(){return{...iw,...this.userApplianceIcons}}get style(){return this._style}set style(e){this._style!==e&&(this._style=e,this.cursorInstances.forEach(i=>{i.setStyle(e)}),e==="custom"?this.enableCustomCursor():this.sideEffectManager.flush(oc))}enableCustomCursor(){this.sideEffectManager.add(()=>Hv(this.manager.getMemberState()),oc)}canMoveCursor(e){const i=(e==null?void 0:e.memberState.currentApplianceName)===b.ApplianceNames.laserPointer;return this.enableCursor||i}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,i,n){const r=ao(this.manager.room,this.manager.uid),s=(r==null?void 0:r.memberState.currentApplianceName)===b.ApplianceNames.pencilEraser;if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)&&s){const a=e.type==="main"?this.manager.mainView:this.focusView,o=this.getPoint(a,i,n);o&&this.onCursorMove({uid:this.manager.uid,position:{x:o.x,y:o.y,type:e.type}})}}updateCursor(e,i,n){const r=ao(this.manager.room,this.manager.uid);if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)){const s=e.type==="main"?this.manager.mainView:this.focusView,a=this.getPoint(s,i,n);a&&this.manager.dispatchInternalEvent(K.CursorMove,{uid:this.manager.uid,position:{x:a.x,y:a.y,type:e.type}})}}updateContainerRect(){var e,i;this.containerRect=(e=Q.container)==null?void 0:e.getBoundingClientRect(),this.wrapperRect=(i=Q.wrapper)==null?void 0:i.getBoundingClientRect()}deleteCursor(e){this.store.cleanCursor(e);const i=this.cursorInstances.get(e);i&&i.destroy()}hideCursor(e){const i=this.cursorInstances.get(e);i&&i.hide()}destroy(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach(e=>{e.destroy()}),this.cursorInstances.clear())}}function Tt(t,e){switch(t.name){case"AppManager":return(e==null?void 0:e.AppManager)||qs;case"BoxManager":return(e==null?void 0:e.BoxManager)||Ys;case"AttributesDelegate":return(e==null?void 0:e.AttributesDelegate)||Ks;case"CursorManager":return(e==null?void 0:e.CursorManager)||Js;case"AppProxy":return(e==null?void 0:e.AppProxy)||un;case"AppContext":return(e==null?void 0:e.AppContext)||Hs;case"TeleBoxManager":return(e==null?void 0:e.TeleBoxManager)||Zs;case"TeleBoxCollector":return(e==null?void 0:e.TeleBoxCollector)||dr;default:return t}}var xe=(t=>(t.Apps="apps",t.Focus="focus",t.State="state",t.BoxState="boxState",t.MainViewCamera="mainViewCamera",t.MainViewSize="mainViewSize",t.Broadcaster="broadcaster",t.Cursors="cursors",t.Position="position",t.CursorState="cursorState",t.FullPath="fullPath",t.Registered="registered",t.IframeBridge="iframeBridge",t.BoxesStatus="boxesStatus",t.LastNotMinimizedBoxesStatus="lastNotMinimizedBoxesStatus",t))(xe||{});class Ks{constructor(e){this.context=e,this.setAppFocus=(i,n)=>{n?this.context.safeSetAttributes({focus:i}):this.context.safeSetAttributes({focus:void 0})}}setContext(e){this.context=e}get attributes(){return this.context.getAttributes()}apps(){return T.get(this.attributes,["apps"])}get focus(){return T.get(this.attributes,["focus"])}getAppAttributes(e){return T.get(this.apps(),[e])}getAppState(e){return T.get(this.apps(),[e,"state"])}getMaximized(){return T.get(this.attributes,["maximized"])}getMinimized(){return T.get(this.attributes,["minimized"])}getBoxesStatus(){return T.get(this.attributes,["boxesStatus"])}getBoxStatus(e){return T.get(this.attributes,["boxesStatus",e])}setBoxStatus(e,i){this.attributes.boxesStatus||this.context.safeSetAttributes({boxesStatus:{}}),this.getBoxStatus(e)!==i&&this.context.safeUpdateAttributes(["boxesStatus",e],i)}getLastNotMinimizedBoxesStatus(){return T.get(this.attributes,["lastNotMinimizedBoxesStatus"])}getLastNotMinimizedBoxStatus(e){return T.get(this.attributes,["lastNotMinimizedBoxesStatus",e])}setLastNotMinimizedBoxStatus(e,i){this.attributes.lastNotMinimizedBoxesStatus||this.context.safeSetAttributes({lastNotMinimizedBoxesStatus:{}}),this.getLastNotMinimizedBoxStatus(e)!==i&&this.context.safeUpdateAttributes(["lastNotMinimizedBoxesStatus",e],i)}setupAppAttributes(e,i,n){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const s=["scenePath","title"];n||s.push("scenes");const a=T.pick(e.options,s),o={kind:e.kind,options:a,isDynamicPPT:n,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",i],o),this.context.safeUpdateAttributes(["apps",i,"state"],{[Be.Size]:{},[Be.Position]:{},[Be.SceneIndex]:0})}updateAppState(e,i,n){T.get(this.attributes,["apps",e,"state"])&&this.context.safeUpdateAttributes(["apps",e,"state",i],n)}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 i;return(i=this.getAppState(e))==null?void 0:i[Be.SceneIndex]}getAppScenePath(e){var i,n;return(n=(i=this.getAppAttributes(e))==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(e){this.context.safeSetAttributes({_mainScenePath:e})}setMainViewSceneIndex(e){this.context.safeSetAttributes({_mainSceneIndex:e})}getMainViewCamera(){return T.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return T.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,i){i.width===0||i.height===0||this.context.safeSetAttributes({mainViewCamera:{...e},mainViewSize:{...i}})}updateCursor(e,i){T.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),T.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],i)}updateCursorState(e,i){T.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],i)}getCursorState(e){return T.get(this.attributes,["cursors",e,"cursorState"])}cleanCursor(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}setMainViewFocusPath(e){const i=this.getMainViewScenePath();i&&yi(e,i)}getIframeBridge(){return T.get(this.attributes,["iframeBridge"])}setIframeBridge(e){if(T.isObject(e)){const i=this.getIframeBridge();for(const n in e){const r=e[n];i[n]!==r&&this.context.safeUpdateAttributes(["iframeBridge",n],r)}}}}const nw=(t,e={getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}})=>{const i=Tt(Ks,t);return new i(e)},Ml=(t,e)=>{let i=0;const n=e.length-1;return t===e.index?t===n?i=t-1:i=e.index+1:i=e.index,i},lt=new bi.default;class un{constructor(e,i,n,r){var s;this.params=e,this.manager=i,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=a=>{var S,E,P,k;const o=this.store.getAppState(a);if(!o)return;const l=o==null?void 0:o[Be.Position],u=this.store.focus,h=o==null?void 0:o[Be.Size],c=o==null?void 0:o[Be.SceneIndex],m=(S=this.attributes)==null?void 0:S.maximized,w=(E=this.attributes)==null?void 0:E.minimized,y=(P=this.store.getBoxStatus(a))!=null?P:void 0,x=(k=this.store.getLastNotMinimizedBoxStatus(a))!=null?k:void 0,{forceTop:d,forceNormal:f,isDragContent:p}=this.store.getAppAttributes(a),g=o==null?void 0:o.zIndex;let v={maximized:m,minimized:w,zIndex:g};return l&&(v={...v,id:a,x:l.x,y:l.y}),u===a&&(v={...v,focus:!0}),h&&(v={...v,width:h.width,height:h.height}),c&&(v={...v,sceneIndex:c}),y&&(v={...v,boxStatus:y}),x&&(v={...v,lastNotMinimizedBoxStatus:x}),d&&(v={...v,forceTop:d}),f&&(v={...v,forceNormal:f}),p&&(v={...v,isDragContent:p}),v},this.appAttributesUpdateListener=a=>{this.manager.refresher.add(a,()=>b.autorun(()=>{const o=this.manager.attributes[a];o&&this.appEmitter.emit("attributesUpdate",o)})),this.manager.refresher.add(this.stateKey,()=>b.autorun(()=>{var l,u,h,c;const o=(l=this.appAttributes)==null?void 0:l.state;(o==null?void 0:o.zIndex)>0&&o.zIndex!==((u=this.box)==null?void 0:u.zIndex)&&((h=this.boxManager)==null||h.setZIndex(a,o.zIndex),(c=this.boxManager)==null||c.focusBox({appId:a}))})),this.manager.refresher.add(`${a}-fullPath`,()=>b.autorun(()=>{var l;const o=(l=this.appAttributes)==null?void 0:l.fullPath;this.setFocusScenePathHandler(o),this._prevFullPath!==o&&(this.notifyPageStateChange(),this._prevFullPath=o)}))},this.setFocusScenePathHandler=T.debounce(a=>{var o;this.view&&a&&a!==((o=this.view)==null?void 0:o.focusScenePath)&&(yi(this.view,a),G.emit("onAppScenePathChange",{appId:this.id,view:this.view}))},50),this.notifyPageStateChange=T.debounce(()=>{this.appEmitter.emit("pageStateChange",this.pageState)},50),this.notifyBoxStatusChange=a=>{this.appEmitter.emit("boxStatusChange",{appId:this.id,status:a})},this.kind=e.kind,this.id=n,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new bi.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=r,this.initScenes(),(s=this.params.options)!=null&&s.scenePath&&this.createView(),this._pageState=new pm({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}initScenes(){var i;const e=this.params.options;e&&(this.scenePath=e.scenePath,((i=this.appAttributes)==null?void 0:i.isDynamicPPT)&&this.scenePath?this.scenes=qi(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)}getFullScenePath(){if(this.scenePath)return T.get(this.appAttributes,[xe.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const e=T.get(this.appAttributes,["state","SceneIndex"],0),i=nm(this.manager.room,this.scenePath,e);return i&&this.setFullPath(i),i}setFullPath(e){this.manager.safeUpdateAttributes(["apps",this.id,xe.FullPath],e)}async baseInsertApp(e=!1){var s;const i=this.params;if(!i.kind)throw new Error("[WindowManager]: kind require");const n=await((s=Ae.appClasses.get(i.kind))==null?void 0:s()),r=Ae.registered.get(i.kind);if(n)await this.setupApp(this.id,e,n,i.options,r==null?void 0:r.appOptions,this.manager.useBoxesStatus?N.Normal:void 0,i.forceTop,i.forceNormal,i.isDragContent);else throw new Error(`[WindowManager]: app load failed ${i.kind} ${i.src}`);return V.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,i,n,r,s,a,o,l,u){var m;if(et("setupApp",e,n,r,a,o,l,u),!this.boxManager)throw new Zh;const h=Tt(Hs,Q.extendClass),c=new h(this.manager,this.boxManager,e,this,s);this.appContext=c;try{V.once(`${e}${K.WindowCreated}`).then(async()=>{var x;let w;i||(w=this.getAppInitState(e),(x=this.boxManager)==null||x.updateBoxState(w)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(e),this.setViewFocusScenePath();let y;this.manager.isReplay&&(y=this.manager.mainView.scenePath),setTimeout(async()=>{console.log("setup app",n);const d=await n.setup(c);this.appResult=d,Ae.notifyApp(this.kind,"created",{appId:e,result:d}),this.afterSetupApp(w),this.fixMobileSize(),y&&this.manager.mainViewProxy.setFocusScenePath(y),G.emit("onAppSetup",e)},Oh)}),(m=this.boxManager)==null||m.createBox({appId:e,app:n,options:r,canOperate:this.manager.canOperate,smartPosition:this.isAddApp,boxStatus:a,forceTop:o,forceNormal:l,isDragContent:u}),this.isAddApp&&this.box&&(a&&this.store.setBoxStatus(e,a),this.store.updateAppState(e,Be.ZIndex,this.box.zIndex),this.store.updateAppState(e,Be.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:e},!1))}catch(w){throw console.error(w),new Error(`[WindowManager]: app setup error: ${w.message}`)}}fixMobileSize(){var i,n;const e=(i=this.boxManager)==null?void 0:i.getBox(this.id);e&&((n=this.boxManager)==null||n.resizeBox({appId:this.id,width:e.intrinsicWidth+.001,height:e.intrinsicHeight+.001,skipUpdate:!0}))}afterSetupApp(e){var i;e&&(!(e!=null&&e.x)||!e.y)&&((i=this.boxManager)==null||i.setBoxInitState(this.id))}async onSeek(e){var n;this.appEmitter.emit("seek",e).catch(r=>{console.log(`[WindowManager]: emit seek error: ${r.message}`)});const i=this.getAppInitState(this.id);(n=this.boxManager)==null||n.updateBoxState(i)}async onReconnected(){var a;if(!Boolean(this.manager.attributes.apps[this.id])){await this.destroy(!0,!1,!0);return}this.appEmitter.emit("reconnected",void 0);const i=this.getAppInitState(this.id);await this.destroy(!0,!1,!0);const n=this.params,r=Tt(un,Q.extendClass);await new r(n,this.manager,this.id,this.isAddApp).baseInsertApp(!0),(a=this.boxManager)==null||a.updateBoxState(i)}async onRemoveScene(e){if(this.scenePath&&e.startsWith(this.scenePath+"/")){let i=this.pageState.index,n=this._pageState.getFullPath(i);n||(i=0,n=this._pageState.getFullPath(i)),n&&this.setFullPath(n),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=i)}}emitAppSceneStateChange(e){this.appEmitter.emit("sceneStateChange",e)}emitAppIsWritableChange(){this.appEmitter.emit("writableChange",this.isWritable)}makeAppEventListener(e){return(i,n)=>{var r,s,a,o;if(!!this.manager.canOperate)switch(i){case"setBoxSize":{(r=this.boxManager)==null||r.resizeBox({appId:e,width:n.width,height:n.height,skipUpdate:!1});break}case"setBoxMinSize":{(s=this.boxManager)==null||s.setBoxMinSize({appId:e,minWidth:n.minwidth,minHeight:n.minheight});break}case"setBoxTitle":{(a=this.boxManager)==null||a.setBoxTitle({appId:e,title:n.title});break}case _h.destroy:{if(this.status==="destroyed")return;this.destroy(!0,!1,!0,n==null?void 0:n.error),n!=null&&n.error&&console.error(n==null?void 0:n.error);break}case"focus":{(o=this.boxManager)==null||o.focusBox({appId:this.id}),lt.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const e=this.getFullScenePath();this.manager.room&&e&&this.view&&Ka(this.manager.room,e)}setViewFocusScenePath(){const e=this.getFullScenePath();return e&&this.view&&yi(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 i=this._pageState.getFullPath(e);if(i){const n=Ml(e,this.pageState);return this.setSceneIndexWithoutSync(n),this.manager.dispatchInternalEvent(K.SetAppFocusIndex,{type:"app",appID:this.id,index:n}),setTimeout(()=>{qa(this.manager.room,i,e)},100),!0}else return!1}setSceneIndexWithoutSync(e){this.view&&(this.view.focusSceneIndex=e)}setSceneIndex(e){if(this.view){this.view.focusSceneIndex=e;const i=this._pageState.getFullPath(e);i&&this.setFullPath(i)}}async destroy(e,i,n,r){var s;if(this.status!=="destroyed"){this.status="destroyed";try{await Ae.notifyApp(this.kind,"destroy",{appId:this.id}),await this.appEmitter.emit("destroy",{error:r})}catch(a){console.error("[WindowManager]: notifyApp error",a.message,a.stack)}this.appEmitter.clearListeners(),V.emit(`destroy-${this.id}`,{error:r}),e&&((s=this.boxManager)==null||s.closeBox(this.id,n)),i&&(this.store.cleanAppAttributes(this.id),this.scenePath&&qa(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}}close(){return this.destroy(!0,!0,!1)}}class rw{constructor(e){this.displayer=e,this.views=new Map}createView(e){const i=Cd(this.displayer);return this.views.set(e,i),i}getView(e){return this.views.get(e)}destroyView(e){const i=this.views.get(e);if(i){try{i.release()}catch{}this.views.delete(e)}}setViewScenePath(e,i){const n=this.views.get(e);n&&(n.focusScenePath=i)}destroy(){this.views.forEach(e=>{try{e.release()}catch{}}),this.views.clear()}}const Cd=t=>{const e=t.views.createView();return sw(e),e},sw=t=>{t.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class aw{constructor(e){this.manager=e,this.polling=!1,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new cr,this.syncCamera=()=>{if(!this.polling||this.viewMode!==b.ViewMode.Broadcaster)return;const{mainViewCamera:n}=this;n&&n.id!==this.manager.uid&&this.moveCameraSizeByAttributes()},this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>V.on("writableChange",n=>{n&&this.ensureCameraAndSize(),this.manager.room&&this.syncMainView(this.manager.room)}))},this.addCameraReaction=()=>{this.manager.refresher.add(xe.MainViewCamera,this.cameraReaction)},this.cameraReaction=()=>b.reaction(()=>this.mainViewCamera,n=>{n&&n.id!==this.manager.uid&&(this.moveCameraToContian(this.mainViewSize),this.moveCamera(n))},{fireImmediately:!0}),this.sizeChangeHandler=T.debounce(n=>{n&&(this.moveCameraToContian(n),this.moveCamera(this.mainViewCamera)),this.ensureMainViewSize()},30),this.onUpdateContainerSizeRatio=()=>{const n=this.store.getMainViewSize();this.sizeChangeHandler(n)},this.onCameraUpdatedByDevice=n=>{this.viewMode!==b.ViewMode.Follower&&(this.store.setMainViewCamera({...n,id:this.manager.uid}),T.isEqual(this.mainViewSize,{...this.mainView.size,id:this.manager.uid})||this.setMainViewSize(this.view.size))},this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=T.debounce(n=>{this.store.setMainViewSize({...n,id:this.manager.uid})},50),this._syncMainViewTimer=0,this.onCameraOrSizeUpdated=()=>{G.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.syncMainView=n=>{n.isWritable&&n.syncMainView(this.mainView)},this.setViewMode=n=>{this.viewMode=n},this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),V.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()});const i=()=>{this.sizeChangeHandler(this.mainViewSize)};this.sideEffectManager.add(()=>V.on("playgroundSizeChange",i)),this.sideEffectManager.add(()=>V.on("containerSizeRatioUpdate",this.onUpdateContainerSizeRatio)),this.sideEffectManager.add(()=>V.on("startReconnect",()=>{this.didRelease||this.mainView.release()})),this.sideEffectManager.setInterval(this.syncCamera,1500)}ensureCameraAndSize(){this.viewMode===b.ViewMode.Broadcaster&&(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(K.InitMainViewCamera),this.setCameraAndSize())}get mainViewCamera(){return this.store.getMainViewCamera()}get mainViewSize(){return this.store.getMainViewSize()}get didRelease(){return T.get(this.view,["didRelease"])}moveCameraSizeByAttributes(){this.moveCameraToContian(this.mainViewSize),this.moveCamera(this.mainViewCamera)}start(){this.sizeChangeHandler(this.mainViewSize),!this.started&&(this.addCameraListener(),this.addCameraReaction(),this.manager.room&&this.syncMainView(this.manager.room),this.started=!0)}setCameraAndSize(){const e={...this.mainView.camera,id:this.manager.uid},i={...this.mainView.size,id:this.manager.uid};this.store.setMainViewCameraAndSize(e,i)}get view(){return this.mainView}get cameraState(){return{...this.view.camera,...this.view.size}}createMainView(){const e=Cd(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&yi(e,i),e}onReconnect(){if(this.didRelease)this.rebind();else{const e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}setFocusScenePath(e){if(e)return yi(this.view,e)}rebind(){const e=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=e,this.addMainViewListener(),this.start(),G.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.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}removeCameraListener(){this.view.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}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){T.isEmpty(e)||(this.view.moveCameraToContain({width:e.width,height:e.height,originX:-e.width/2,originY:-e.height/2,animationMode:b.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}moveCamera(e){if(!T.isEmpty(e)){if(T.isEqual(e,this.view.camera))return;const{centerX:i,centerY:n,scale:r}=e,s=r*(this.scale||1);this.view.moveCamera({centerX:i,centerY:n,scale:s,animationMode:b.AnimationMode.Immediately})}}stop(){this.removeCameraListener(),this.manager.refresher.remove(xe.MainViewCamera),this.manager.refresher.remove(xe.MainViewSize),this.started=!1}destroy(){this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class ow{constructor(e){this.context=e,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,r)=>{n(i.canRedoSteps),r(i.canUndoSteps),i.callbacks.on("onCanRedoStepsUpdate",n),i.callbacks.on("onCanUndoStepsUpdate",r)},this.disposeViewCallbacks=i=>{i.callbacks.off("onCanRedoStepsUpdate",this.onCanRedoStepsUpdate),i.callbacks.off("onCanUndoStepsUpdate",this.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=i=>{G.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{G.emit("canUndoStepsChange",i)},this.disposePrevFocusViewRedoUndoListeners=i=>{let n;if(i===void 0)n=this.context.mainView();else{const r=this.context.getAppProxy(i);r&&r.view&&(n=r.view)}n&&this.disposeViewCallbacks(n)},V.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),V.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(e.focus()),this.addRedoUndoListeners(e.focus())}),this.addRedoUndoListeners(e.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class qs{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 Ug,this.sideEffectManager=new cr,this.sceneState=null,this.rootDirRemoving=!1,this._useBoxesStatus=!1,this.onRemoveScenes=async i=>{var r,s;const{scenePath:n}=i;if(n===Ue){await this.onRootDirRemoved(),this.dispatchInternalEvent(K.RootDirRemoved);return}if(lm(n)){let a=this.mainView.focusSceneIndex||0,o=(r=this.callbacksNode)==null?void 0:r.scenes[a];o||(a=0,o=(s=this.callbacksNode)==null?void 0:s.scenes[a]),o&&this.setMainViewScenePath(`${Ue}${o}`),await this.setMainViewSceneIndex(a)}else this.appProxies.forEach(a=>{a.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(Ue,{onAddScene:this.onSceneChange,onRemoveScene:async(n,r)=>{await this.onSceneChange(n),V.emit("rootDirSceneRemoved",r)}}),this.callbacksNode&&(this.updateSceneState(this.callbacksNode),this.mainViewScenesLength=this.callbacksNode.scenes.length,i&&this.emitMainViewScenesChange(this.callbacksNode.scenes.length))},this.removeSceneByIndex=async i=>{var s;const n=Ml(i,this.windowManger.pageState);this.setSceneIndexWithoutSync(n),this.dispatchInternalEvent(K.SetAppFocusIndex,{type:"main",index:n});const r=(s=this.callbacksNode)==null?void 0:s.scenes[i];return setTimeout(()=>{r&&qa(this.room,`${Ue}${r}`,i)},100),new Promise((a,o)=>{V.once("rootDirSceneRemoved").then(l=>{l===r&&a(!0)}).catch(l=>{console.log(`[WindowManager]: removePage error: ${l}`),o(!1)})})},this.setSceneIndexWithoutSync=i=>{var r;const n=(r=this.callbacksNode)==null?void 0:r.scenes[i];n&&this.mainViewProxy.setFocusScenePath(`${Ue}${n}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([G.emit("mainViewScenesLengthChange",i),V.emit("changePageState")]),this.updateSceneState=i=>{const n=this.store.getMainViewSceneIndex()||0;let r=i.scenes[n];r||(r=i.scenes[this.mainView.focusSceneIndex||0]),this.sceneState={scenePath:`${Ue}${r}`,contextPath:i.path,index:n,scenes:i.scenes.map(s=>({name:s})),sceneName:r},G.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(K.AppMove,i),this.store.updateAppState(i.appId,Be.Position,{x:i.x,y:i.y}),G.emit("onBoxMove",i)},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(K.AppResize,i),this.store.updateAppState(i.appId,Be.Size,{width:i.width,height:i.height}),G.emit("onBoxResize",i))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId}),G.emit("onBoxFocus",i)},this.onBoxBlurred=i=>{this.attributes.focus===i.appId&&(this.windowManger.safeSetAttributes({focus:void 0}),G.emit("onBoxBlurred",i))},this.onBoxClose=i=>{const n=this.appProxies.get(i.appId);n&&n.destroy(!1,!0,!0,i.error),G.emit("onBoxClose",i)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(K.AppBoxStateChange,i),G.emit("onBoxStateChange",i)},this.notifyBoxesStatusChange=T.debounce(()=>{const i=Object.entries(this.attributes.boxesStatus);i.length>0&&i.forEach(([n,r])=>{const s=this.appProxies.get(n);s&&s.notifyBoxStatusChange(r)})},50),this.addBoxesStatusChangeListener=()=>{this.refresher.add("boxesStatus",()=>Nn(()=>this.attributes.boxesStatus,()=>{var i;(i=this.boxManager)==null||i.setBoxesStatus(this.attributes.boxesStatus),this.notifyBoxesStatusChange()})),this.refresher.add("lastNotMinimizedBoxesStatus",()=>Nn(()=>this.attributes.lastNotMinimizedBoxesStatus,()=>{var i;(i=this.boxManager)==null||i.setLastNotMinimizedBoxesStatus(this.attributes.lastNotMinimizedBoxesStatus)}))},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>Nn(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{this.refresher.add("appsClose",()=>Nn(()=>this.attributes.apps,i=>{i.some(n=>n.kind===b.UpdateEventKind.Removed)&&this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this._prevSceneIndex!==i&&(G.emit("mainViewSceneIndexChange",i),V.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this._prevSceneIndex=i)},this.onFocusChange=i=>{var n;this._prevFocused!==i&&(G.emit("focusedChange",i),V.emit("focusedChange",{focused:i,prev:this._prevFocused}),this._prevFocused=i,i!==void 0&&((n=this.boxManager)==null||n.focusBox({appId:i}),setTimeout(()=>{const r=this.appProxies.get(i);r&&Ae.notifyApp(r.kind,"focus",{appId:i})},0)))},this.attributesUpdateCallback=T.debounce(i=>this._attributesUpdateCallback(i),100),this._appIds=[],this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([n,r])=>{Ae.appClasses.has(n)||Ae.register({kind:n,src:r.src,name:r.name})})},this.onMinimized=i=>{var n,r;((n=this.boxManager)==null?void 0:n.minimized)!==i&&(i===!0&&((r=this.boxManager)==null||r.blurAllBox()),setTimeout(()=>{var s;(s=this.boxManager)==null||s.setMinimized(Boolean(i))},0))},this.onAppDelete=async i=>{const n=Object.keys(i);for(const[r,s]of this.appProxies.entries())n.includes(r)||await s.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)}),V.emit("observerIdChange",this.displayer.observerId)},this.displayerWritableListener=i=>{var s,a;const n=!i,r=this.windowManger.readonly===void 0||this.windowManger.readonly===!1;this.windowManger.readonly===void 0?(s=this.boxManager)==null||s.setReadonly(i):(a=this.boxManager)==null||a.setReadonly(!(n&&r)),this.appProxies.forEach(o=>{o.emitAppIsWritableChange()}),V.emit("writableChange",n)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),n=xa(i),r=qi(this.displayer)[n];if(r.length){const s=i.replace(n,"").replace("/",""),a=r.findIndex(o=>o.name===s);T.isInteger(a)&&a>=0&&this.safeSetAttributes({_mainSceneIndex:a})}},this.updateRootDirRemoving=i=>{this.rootDirRemoving=i},this.displayer=e.displayer,this.store=nw(Q.extendClass,{getAttributes:()=>this.attributes,safeSetAttributes:i=>this.safeSetAttributes(i),safeUpdateAttributes:(i,n)=>this.safeUpdateAttributes(i,n)}),this.mainViewProxy=new aw(this),this.viewManager=new rw(this.displayer),this.appListeners=new um(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=bg,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:V}),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()}),V.once("onCreated").then(()=>this.onCreated()),V.on("onReconnected",()=>this.onReconnected()),b.isPlayer(this.displayer)&&(V.on("seekStart",this.onPlayerSeekStart),V.on("seek",this.onPlayerSeekDone)),V.on("removeScenes",this.onRemoveScenes),V.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),Ae.setSyncRegisterApp(i=>{this.safeUpdateAttributes([xe.Registered,i.kind],i)})}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(Vh),this.createRootDirScenesCallback();for(const[i,n]of this.appProxies.entries())n.view&&await this.closeApp(i,e);this.mainViewProxy.rebind(),V.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return b.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return b.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)||""}getMainViewSceneDir(){const e=this.store.getMainViewScenePath();if(e)return xa(e);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var e;if(Object.keys(this.attributes.apps).length&&this.store.focus&&await new Promise(i=>{this._focusAppCreatedResolve=i}).then(()=>{this.focusByAttributes(this.attributes.apps)}),await this.attributesUpdateCallback(this.attributes.apps),this.focusByAttributes(this.attributes.apps),V.emit("updateManagerRect"),lt.on("move",this.onBoxMove),lt.on("resize",this.onBoxResize),lt.on("focus",this.onBoxFocus),lt.on("close",this.onBoxClose),lt.on("boxStateChange",this.onBoxStateChange),lt.on("blurred",this.onBoxBlurred),this.addAppsChangeListener(),this.addAppCloseListener(),this.addBoxesStatusChangeListener(),this.refresher.add("maximized",()=>b.autorun(()=>{var n;const i=this.attributes.maximized;(n=this.boxManager)==null||n.setMaximized(Boolean(i))})),this.refresher.add("minimized",()=>b.autorun(()=>{const i=this.attributes.minimized;this.onMinimized(i)})),this.refresher.add("mainViewIndex",()=>b.autorun(()=>{const i=T.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>b.autorun(()=>{const i=T.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>b.autorun(()=>{const i=T.get(this.attributes,xe.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(!((e=this.room)!=null&&e.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this._prevFocused=this.attributes.focus,this.sideEffectManager.add(()=>{const i=new ow({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:n=>this.appProxies.get(n)});return()=>i.destroy()})}notifyAppsChange(e){(this._appIds.length!==e.length||!this._appIds.every(i=>e.includes(i)))&&(this._appIds=e,G.emit("appsChange",e))}async _attributesUpdateCallback(e){if(e&&Q.container){const i=Object.keys(e);i.length===0&&this.appCreateQueue.emitReady();const r=T.orderBy(i.map(s=>({id:s,createdAt:e[s].createdAt})),"createdAt","asc").map(({id:s})=>s);this.notifyAppsChange(r);for(const s of r)if(!this.appProxies.has(s)&&!this.appStatus.has(s)){const a=e[s];try{if(!this.attributes[s])throw new Error("appAttributes is undefined");this.appCreateQueue.push(async()=>{this.appStatus.set(s,Xa.StartCreate);const l=await this.baseInsertApp({kind:a.kind,options:a.options,isDynamicPPT:a.isDynamicPPT,forceNormal:a.forceNormal,forceTop:a.forceTop,isDragContent:a.isDragContent},s,!1);return l&&this.store.focus===s&&this._focusAppCreatedResolve&&this._focusAppCreatedResolve(l),l}),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,i){const n=this.mainViewProxy.view;n.disableCameraTransform=i,n.divElement=e,n.focusScenePath||this.setMainViewFocusPath(),V.emit("mainViewMounted"),G.emit("onMainViewMounted",n)}setMainViewFocusPath(e){var n;const i=e||this.store.getMainViewScenePath();if(i)return yi(this.mainView,i),((n=this.mainView)==null?void 0:n.focusScenePath)===i}resetScenePath(e){this.displayer.state.sceneState.scenePath!==e&&Ka(this.room,e)}async addApp(e,i){et("addApp",e);const{appId:n,needFocus:r}=await this.beforeAddApp(e,i),s=await this.baseInsertApp(e,n,!0,r);return this.afterAddApp(s),s==null?void 0:s.id}async beforeAddApp(e,i){var a,o;const n=await im(e.kind);this.appStatus.set(n,Xa.StartCreate);const r=(a=e.attributes)!=null?a:{};this.safeUpdateAttributes([n],r),this.store.setupAppAttributes(e,n,i);const s=!((o=this.boxManager)!=null&&o.minimized);return s&&this.store.setAppFocus(n,!0),{appId:n,needFocus:s}}afterAddApp(e){var i,n;if(e&&e.box){const r=e.box;lt.emit("move",{appId:e.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(e.id,Be.ZIndex,r.zIndex)}(i=this.boxManager)!=null&&i.minimized&&((n=this.boxManager)==null||n.setMinimized(!1,!1))}async closeApp(e,i=!0){const n=this.appProxies.get(e);n&&n.destroy(!0,i,!1)}async baseInsertApp(e,i,n,r){if(this.appProxies.has(i)){console.warn("[WindowManager]: app duplicate exists and cannot be created again");return}const s=Tt(un,Q.extendClass),a=new s(e,this,i,n);if(a)return await a.baseInsertApp(r),this.appStatus.delete(i),a;throw this.appStatus.delete(i),new Error("[WindowManger]: initialize AppProxy failed")}safeSetAttributes(e){this.windowManger.safeSetAttributes(e)}safeUpdateAttributes(e,i){this.windowManger.safeUpdateAttributes(e,i)}async setMainViewScenePath(e){if(this.room){const i=this.displayer.scenePathType(e);if(xa(e)!==Ue)throw new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===b.ScenePathType.None)throw new Error(`[WindowManager]: ${e} not valid scene`);if(i===b.ScenePathType.Page)await this._setMainViewScenePath(e);else if(i===b.ScenePathType.Dir){const r=sm(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 i;if(this.room){if(this.store.getMainViewSceneIndex()===e)return;const n=(i=this.callbacksNode)==null?void 0:i.scenes[e],r=`${Ue}${n}`;if(n)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.store.setMainViewSceneIndex(e),this.dispatchSetMainViewScenePath(r));else throw new Error(`[WindowManager]: ${e} not valid index`)}}dispatchSetMainViewScenePath(e){this.dispatchInternalEvent(K.SetMainViewScenePath,{nextScenePath:e}),G.emit("mainViewScenePathChange",e),Ka(this.room,e)}getAppInitPath(e){var n;const i=this.store.getAppAttributes(e);if(i)return(n=i==null?void 0:i.options)==null?void 0:n.scenePath}safeDispatchMagixEvent(e,i){this.canOperate&&this.displayer.dispatchMagixEvent(e,i)}focusByAttributes(e){var i;if(e&&Object.keys(e).length===((i=this.boxManager)==null?void 0:i.boxSize)){const n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}async onReconnected(){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(e){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",e)})}dispatchInternalEvent(e,i){this.safeDispatchMagixEvent(Ga,{eventName:e,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),lt.clearListeners(),V.clearListeners(),this.appProxies.size&&this.appProxies.forEach(e=>{e.destroy(!0,!1,!0)}),G.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0,this._focusAppCreatedResolve=void 0}}const lw=window.ResizeObserver||Lg.ResizeObserver;class Cl{constructor(e){this.emitter=e}static create(e,i,n,r){const s=new Cl(r);return s.observePlaygroundSize(e,i,n),s}observePlaygroundSize(e,i,n){this.updateSizer(e.getBoundingClientRect(),i,n),this.containerResizeObserver=new lw(r=>{var a;const s=(a=r[0])==null?void 0:a.contentRect;s&&(this.updateSizer(s,i,n),this.emitter.emit("playgroundSizeChange",s))}),this.disposer=this.emitter.on("containerSizeRatioUpdate",()=>{const r=e.getBoundingClientRect();this.updateSizer(r,i,n),this.emitter.emit("playgroundSizeChange",r)}),this.containerResizeObserver.observe(e)}updateSizer({width:e,height:i},n,r){e&&i&&(i/e>Q.containerSizeRatio?(i=e*Q.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(e=i/Q.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!1)),r.style.width=`${e}px`,r.style.height=`${i}px`)}disconnect(){var e;(e=this.containerResizeObserver)==null||e.disconnect(),T.isFunction(this.disposer)&&(this.disposer(),this.disposer=void 0)}}class uw{constructor(e){this.manager=e,V.on("changePageState",()=>{G.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 cw{constructor(e){this.ctx=e,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=async i=>{var n,r;i===b.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===b.RoomPhase.Connected&&this.phase===b.RoomPhase.Reconnecting&&((n=this.room)!=null&&n.isWritable?(r=this.room)==null||r.dispatchMagixEvent(ya,{}):(await Uh(500),this.onReconnected())),this.phase=i},this.onReconnected=T.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{et("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,n)=>{T.isFunction(i)&&this.disposers.set(n,i())}),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(ya,i=>{i.authorId===e.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(e){this.ctx=e}releaseDisposers(){this.disposers.forEach(e=>{T.isFunction(e)&&e()}),this.disposers.clear()}refresh(){this._onReconnected()}add(e,i){const n=this.disposers.get(e);n&&T.isFunction(n)&&n(),T.isFunction(i)&&(this.reactors.set(e,i),this.disposers.set(e,i()))}remove(e){this.reactors.has(e)&&this.reactors.delete(e);const i=this.disposers.get(e);i&&(T.isFunction(i)&&i(),this.disposers.delete(e))}hasReactor(e){return this.reactors.has(e)}destroy(){var e,i;(e=this.room)==null||e.callbacks.off("onPhaseChanged",this.onPhaseChanged),(i=this.room)==null||i.removeMagixEventListener(ya,this.onReconnected),this.releaseDisposers()}}const hw=(t,e)=>{if(b.isPlayer(t))fw(t);else{if(t=t,Object.getOwnPropertyDescriptor(t,"disableCameraTransform"))return;Object.defineProperty(t,"disableCameraTransform",{get(){return e.mainView.disableCameraTransform},set(n){e.mainView.disableCameraTransform=n}}),Object.defineProperty(t,"canUndoSteps",{get(){return e.canUndoSteps}}),Object.defineProperty(t,"canRedoSteps",{get(){return e.canRedoSteps}}),t.moveCamera=n=>e.moveCamera(n),t.moveCameraToContain=(...n)=>e.moveCameraToContain(...n),t.convertToPointInWorld=(...n)=>e.mainView.convertToPointInWorld(...n),t.setCameraBound=(...n)=>e.mainView.setCameraBound(...n),t.scenePreview=(...n)=>e.mainView.scenePreview(...n),t.fillSceneSnapshot=(...n)=>e.mainView.fillSceneSnapshot(...n),t.generateScreenshot=(...n)=>e.mainView.generateScreenshot(...n),t.setMemberState=(...n)=>e.mainView.setMemberState(...n),t.redo=()=>e.redo(),t.undo=()=>e.undo(),t.cleanCurrentScene=()=>e.cleanCurrentScene(),t.delete=()=>e.delete(),t.copy=()=>e.copy(),t.paste=()=>e.paste(),t.duplicate=()=>e.duplicate(),t.insertImage=(...n)=>e.insertImage(...n),t.completeImageUpload=(...n)=>e.completeImageUpload(...n),t.insertText=(...n)=>e.insertText(...n),t.lockImage=(...n)=>e.lockImage(...n),t.lockImages=(...n)=>e.lockImages(...n),dw(t,e)}},dw=(t,e)=>{const i=t.removeScenes;t.removeScenes=(n,r)=>{var a;n===Ue&&((a=e.appManager)==null||a.updateRootDirRemoving(!0));const s=i.call(t,n);return V.emit("removeScenes",{scenePath:n,index:r}),s}},fw=t=>{const e=t.seekToProgressTime;async function i(n){await V.emit("seekStart");const r=await e.call(t,n);return V.emit("seek",n),r}t.seekToProgressTime=i};var pw=`.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}
17
+ `;const gw=(t,e,i,n)=>{if(i==="length"||i==="prototype"||i==="arguments"||i==="caller")return;const r=Object.getOwnPropertyDescriptor(t,i),s=Object.getOwnPropertyDescriptor(e,i);!mw(r,s)&&n||Object.defineProperty(t,i,s)},mw=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},vw=(t,e)=>{const i=Object.getPrototypeOf(e);i!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,i)},ww=(t,e)=>`/* Wrapped ${t}*/
18
+ ${e}`,yw=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xw=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Sw=(t,e,i)=>{const n=i===""?"":`with ${i.trim()}() `,r=ww.bind(null,n,e.toString());Object.defineProperty(r,"name",xw),Object.defineProperty(t,"toString",{...yw,value:r})};function Mw(t,e,{ignoreNonConfigurable:i=!1}={}){const{name:n}=t;for(const r of Reflect.ownKeys(e))gw(t,e,r,i);return vw(t,e),Sw(t,e,n),t}const Cw=(t,e={})=>{if(typeof t!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``);const{wait:i=0,maxWait:n=Number.POSITIVE_INFINITY,before:r=!1,after:s=!0}=e;if(!r&&!s)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let a,o,l;const u=function(...h){const c=this,m=()=>{a=void 0,o&&(clearTimeout(o),o=void 0),s&&(l=t.apply(c,h))},w=()=>{o=void 0,a&&(clearTimeout(a),a=void 0),s&&(l=t.apply(c,h))},y=r&&!a;return clearTimeout(a),a=setTimeout(m,i),n>0&&n!==Number.POSITIVE_INFINITY&&!o&&(o=setTimeout(w,n)),y&&(l=t.apply(c,h)),l};return Mw(u,t),u.cancel=()=>{a&&(clearTimeout(a),a=void 0),o&&(clearTimeout(o),o=void 0)},u};var Iw="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",bw=87,Aw=20,lc=[],Tw=()=>{for(let t=0;t<Aw;t++)lc[t]=Iw.charAt(Math.random()*bw);return lc.join("")};function Id(t){try{return t()}catch(e){console.error(e)}}var ea=class{constructor(){this.push=this.addDisposer,this.disposers=new Map}addDisposer(t,e=this.genUID()){return this.flush(e),this.disposers.set(e,Array.isArray(t)?Ew(t):t),e}add(t,e=this.genUID()){const i=t();return i?this.addDisposer(i,e):e}addEventListener(t,e,i,n,r=this.genUID()){return t.addEventListener(e,i,n),this.addDisposer(()=>t.removeEventListener(e,i,n),r),r}setTimeout(t,e,i=this.genUID()){const n=window.setTimeout(()=>{this.remove(i),t()},e);return this.addDisposer(()=>window.clearTimeout(n),i)}setInterval(t,e,i=this.genUID()){const n=window.setInterval(t,e);return this.addDisposer(()=>window.clearInterval(n),i)}remove(t){const e=this.disposers.get(t);return this.disposers.delete(t),e}flush(t){const e=this.remove(t);e&&e()}flushAll(){this.disposers.forEach(Id),this.disposers.clear()}genUID(){let t;do t=Tw();while(this.disposers.has(t));return t}};function Ew(t){return()=>t.forEach(Id)}var di=[],Nw=function(){return di.some(function(t){return t.activeTargets.length>0})},kw=function(){return di.some(function(t){return t.skippedTargets.length>0})},uc="ResizeObserver loop completed with undelivered notifications.",Pw=function(){var t;typeof ErrorEvent=="function"?t=new ErrorEvent("error",{message:uc}):(t=document.createEvent("Event"),t.initEvent("error",!1,!1),t.message=uc),window.dispatchEvent(t)},Kn;(function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Kn||(Kn={}));var fi=function(t){return Object.freeze(t)},Bw=function(){function t(e,i){this.inlineSize=e,this.blockSize=i,fi(this)}return t}(),bd=function(){function t(e,i,n,r){return this.x=e,this.y=i,this.width=n,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,fi(this)}return t.prototype.toJSON=function(){var e=this,i=e.x,n=e.y,r=e.top,s=e.right,a=e.bottom,o=e.left,l=e.width,u=e.height;return{x:i,y:n,top:r,right:s,bottom:a,left:o,width:l,height:u}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),Il=function(t){return t instanceof SVGElement&&"getBBox"in t},Ad=function(t){if(Il(t)){var e=t.getBBox(),i=e.width,n=e.height;return!i&&!n}var r=t,s=r.offsetWidth,a=r.offsetHeight;return!(s||a||t.getClientRects().length)},cc=function(t){var e;if(t instanceof Element)return!0;var i=(e=t==null?void 0:t.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(i&&t instanceof i.Element)},zw=function(t){switch(t.tagName){case"INPUT":if(t.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},On=typeof window!="undefined"?window:{},zr=new WeakMap,hc=/auto|scroll/,Dw=/^tb|vertical/,Lw=/msie|trident/i.test(On.navigator&&On.navigator.userAgent),st=function(t){return parseFloat(t||"0")},Qi=function(t,e,i){return t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=!1),new Bw((i?e:t)||0,(i?t:e)||0)},dc=fi({devicePixelContentBoxSize:Qi(),borderBoxSize:Qi(),contentBoxSize:Qi(),contentRect:new bd(0,0,0,0)}),Td=function(t,e){if(e===void 0&&(e=!1),zr.has(t)&&!e)return zr.get(t);if(Ad(t))return zr.set(t,dc),dc;var i=getComputedStyle(t),n=Il(t)&&t.ownerSVGElement&&t.getBBox(),r=!Lw&&i.boxSizing==="border-box",s=Dw.test(i.writingMode||""),a=!n&&hc.test(i.overflowY||""),o=!n&&hc.test(i.overflowX||""),l=n?0:st(i.paddingTop),u=n?0:st(i.paddingRight),h=n?0:st(i.paddingBottom),c=n?0:st(i.paddingLeft),m=n?0:st(i.borderTopWidth),w=n?0:st(i.borderRightWidth),y=n?0:st(i.borderBottomWidth),x=n?0:st(i.borderLeftWidth),d=c+u,f=l+h,p=x+w,g=m+y,v=o?t.offsetHeight-g-t.clientHeight:0,S=a?t.offsetWidth-p-t.clientWidth:0,E=r?d+p:0,P=r?f+g:0,k=n?n.width:st(i.width)-E-S,z=n?n.height:st(i.height)-P-v,te=k+d+S+p,I=z+f+v+g,M=fi({devicePixelContentBoxSize:Qi(Math.round(k*devicePixelRatio),Math.round(z*devicePixelRatio),s),borderBoxSize:Qi(te,I,s),contentBoxSize:Qi(k,z,s),contentRect:new bd(c,l,k,z)});return zr.set(t,M),M},Ed=function(t,e,i){var n=Td(t,i),r=n.borderBoxSize,s=n.contentBoxSize,a=n.devicePixelContentBoxSize;switch(e){case Kn.DEVICE_PIXEL_CONTENT_BOX:return a;case Kn.BORDER_BOX:return r;default:return s}},Rw=function(){function t(e){var i=Td(e);this.target=e,this.contentRect=i.contentRect,this.borderBoxSize=fi([i.borderBoxSize]),this.contentBoxSize=fi([i.contentBoxSize]),this.devicePixelContentBoxSize=fi([i.devicePixelContentBoxSize])}return t}(),Nd=function(t){if(Ad(t))return 1/0;for(var e=0,i=t.parentNode;i;)e+=1,i=i.parentNode;return e},jw=function(){var t=1/0,e=[];di.forEach(function(a){if(a.activeTargets.length!==0){var o=[];a.activeTargets.forEach(function(u){var h=new Rw(u.target),c=Nd(u.target);o.push(h),u.lastReportedSize=Ed(u.target,u.observedBox),c<t&&(t=c)}),e.push(function(){a.callback.call(a.observer,o,a.observer)}),a.activeTargets.splice(0,a.activeTargets.length)}});for(var i=0,n=e;i<n.length;i++){var r=n[i];r()}return t},fc=function(t){di.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(r){r.isActive()&&(Nd(r.target)>t?i.activeTargets.push(r):i.skippedTargets.push(r))})})},_w=function(){var t=0;for(fc(t);Nw();)t=jw(),fc(t);return kw()&&Pw(),t>0},ka,kd=[],Vw=function(){return kd.splice(0).forEach(function(t){return t()})},Ow=function(t){if(!ka){var e=0,i=document.createTextNode(""),n={characterData:!0};new MutationObserver(function(){return Vw()}).observe(i,n),ka=function(){i.textContent="".concat(e?e--:e++)}}kd.push(t),ka()},Uw=function(t){Ow(function(){requestAnimationFrame(t)})},Kr=0,$w=function(){return!!Kr},Ww=250,Hw={attributes:!0,characterData:!0,childList:!0,subtree:!0},pc=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],gc=function(t){return t===void 0&&(t=0),Date.now()+t},Pa=!1,Fw=function(){function t(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return t.prototype.run=function(e){var i=this;if(e===void 0&&(e=Ww),!Pa){Pa=!0;var n=gc(e);Uw(function(){var r=!1;try{r=_w()}finally{if(Pa=!1,e=n-gc(),!$w())return;r?i.run(1e3):e>0?i.run(e):i.start()}})}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var e=this,i=function(){return e.observer&&e.observer.observe(document.body,Hw)};document.body?i():On.addEventListener("DOMContentLoaded",i)},t.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),pc.forEach(function(i){return On.addEventListener(i,e.listener,!0)}))},t.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),pc.forEach(function(i){return On.removeEventListener(i,e.listener,!0)}),this.stopped=!0)},t}(),co=new Fw,mc=function(t){!Kr&&t>0&&co.start(),Kr+=t,!Kr&&co.stop()},Qw=function(t){return!Il(t)&&!zw(t)&&getComputedStyle(t).display==="inline"},Zw=function(){function t(e,i){this.target=e,this.observedBox=i||Kn.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var e=Ed(this.target,this.observedBox,!0);return Qw(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),Yw=function(){function t(e,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=i}return t}(),Dr=new WeakMap,vc=function(t,e){for(var i=0;i<t.length;i+=1)if(t[i].target===e)return i;return-1},Lr=function(){function t(){}return t.connect=function(e,i){var n=new Yw(e,i);Dr.set(e,n)},t.observe=function(e,i,n){var r=Dr.get(e),s=r.observationTargets.length===0;vc(r.observationTargets,i)<0&&(s&&di.push(r),r.observationTargets.push(new Zw(i,n&&n.box)),mc(1),co.schedule())},t.unobserve=function(e,i){var n=Dr.get(e),r=vc(n.observationTargets,i),s=n.observationTargets.length===1;r>=0&&(s&&di.splice(di.indexOf(n),1),n.observationTargets.splice(r,1),mc(-1))},t.disconnect=function(e){var i=this,n=Dr.get(e);n.observationTargets.slice().forEach(function(r){return i.unobserve(e,r.target)}),n.activeTargets.splice(0,n.activeTargets.length)},t}(),Gw=function(){function t(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Lr.connect(this,e)}return t.prototype.observe=function(e,i){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!cc(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Lr.observe(this,e,i)},t.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!cc(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Lr.unobserve(this,e)},t.prototype.disconnect=function(){Lr.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}();function Xw(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-sidebar`),i.setAttribute("viewBox","0 0 64 64");const n=document.createElementNS(e,"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 Jw(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-arrow-left`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(e,"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 Kw(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-arrow-right`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(e,"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 qw(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-play`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(e,"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 ey(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-pause`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(e,"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 Jt=typeof window!="undefined",Pd=Jt&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Bd=Jt&&"IntersectionObserver"in window,zd=Jt&&"classList"in document.createElement("p"),Dd=Jt&&window.devicePixelRatio>1,ty={elements_selector:".lazy",container:Pd||Jt?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},Ld=t=>Object.assign({},ty,t),wc=function(t,e){let i;const n="LazyLoad::Initialized",r=new t(e);try{i=new CustomEvent(n,{detail:{instance:r}})}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent(n,!1,!1,{instance:r})}window.dispatchEvent(i)},iy=(t,e)=>{if(!!e)if(!e.length)wc(t,e);else for(let i=0,n;n=e[i];i+=1)wc(t,n)},Et="src",bl="srcset",Al="sizes",Rd="poster",pr="llOriginalAttrs",jd="data",Tl="loading",_d="loaded",Vd="applied",ny="entered",El="error",Od="native",Ud="data-",$d="ll-status",ze=(t,e)=>t.getAttribute(Ud+e),ry=(t,e,i)=>{const n=Ud+e;if(i===null){t.removeAttribute(n);return}t.setAttribute(n,i)},gr=t=>ze(t,$d),Ai=(t,e)=>ry(t,$d,e),ta=t=>Ai(t,null),Nl=t=>gr(t)===null,sy=t=>gr(t)===Tl,ay=t=>gr(t)===El,kl=t=>gr(t)===Od,oy=[Tl,_d,Vd,El],ly=t=>oy.indexOf(gr(t))>=0,Kt=(t,e,i,n)=>{if(!(!t||typeof t!="function")){if(n!==void 0){t(e,i,n);return}if(i!==void 0){t(e,i);return}t(e)}},cn=(t,e)=>{if(e!==""){if(zd){t.classList.add(e);return}t.className+=(t.className?" ":"")+e}},ut=(t,e)=>{if(e!==""){if(zd){t.classList.remove(e);return}t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")}},uy=t=>{t.llTempImage=document.createElement("IMG")},cy=t=>{delete t.llTempImage},Wd=t=>t.llTempImage,ia=(t,e)=>{if(!e)return;const i=e._observer;!i||i.unobserve(t)},hy=t=>{t.disconnect()},dy=(t,e,i)=>{e.unobserve_entered&&ia(t,i)},Pl=(t,e)=>{!t||(t.loadingCount+=e)},fy=t=>{!t||(t.toLoadCount-=1)},Hd=(t,e)=>{!t||(t.toLoadCount=e)},py=t=>t.loadingCount>0,gy=t=>t.toLoadCount>0,Fd=t=>{let e=[];for(let i=0,n;n=t.children[i];i+=1)n.tagName==="SOURCE"&&e.push(n);return e},Bl=(t,e)=>{const i=t.parentNode;if(!i||i.tagName!=="PICTURE")return;Fd(i).forEach(e)},Qd=(t,e)=>{Fd(t).forEach(e)},na=[Et],Zd=[Et,Rd],qn=[Et,bl,Al],Yd=[jd],ra=t=>!!t[pr],Gd=t=>t[pr],Xd=t=>delete t[pr],en=(t,e)=>{if(ra(t))return;const i={};e.forEach(n=>{i[n]=t.getAttribute(n)}),t[pr]=i},my=t=>{ra(t)||(t[pr]={backgroundImage:t.style.backgroundImage})},vy=(t,e,i)=>{if(!i){t.removeAttribute(e);return}t.setAttribute(e,i)},xi=(t,e)=>{if(!ra(t))return;const i=Gd(t);e.forEach(n=>{vy(t,n,i[n])})},wy=t=>{if(!ra(t))return;const e=Gd(t);t.style.backgroundImage=e.backgroundImage},Jd=(t,e,i)=>{cn(t,e.class_applied),Ai(t,Vd),i&&(e.unobserve_completed&&ia(t,e),Kt(e.callback_applied,t,i))},Kd=(t,e,i)=>{cn(t,e.class_loading),Ai(t,Tl),i&&(Pl(i,1),Kt(e.callback_loading,t,i))},Ot=(t,e,i)=>{!i||t.setAttribute(e,i)},yc=(t,e)=>{Ot(t,Al,ze(t,e.data_sizes)),Ot(t,bl,ze(t,e.data_srcset)),Ot(t,Et,ze(t,e.data_src))},yy=(t,e)=>{Bl(t,i=>{en(i,qn),yc(i,e)}),en(t,qn),yc(t,e)},xy=(t,e)=>{en(t,na),Ot(t,Et,ze(t,e.data_src))},Sy=(t,e)=>{Qd(t,i=>{en(i,na),Ot(i,Et,ze(i,e.data_src))}),en(t,Zd),Ot(t,Rd,ze(t,e.data_poster)),Ot(t,Et,ze(t,e.data_src)),t.load()},My=(t,e)=>{en(t,Yd),Ot(t,jd,ze(t,e.data_src))},Cy=(t,e,i)=>{const n=ze(t,e.data_bg),r=ze(t,e.data_bg_hidpi),s=Dd&&r?r:n;!s||(t.style.backgroundImage=`url("${s}")`,Wd(t).setAttribute(Et,s),Kd(t,e,i))},Iy=(t,e,i)=>{const n=ze(t,e.data_bg_multi),r=ze(t,e.data_bg_multi_hidpi),s=Dd&&r?r:n;!s||(t.style.backgroundImage=s,Jd(t,e,i))},by=(t,e,i)=>{const n=ze(t,e.data_bg_set);if(!n)return;const r=n.split("|");let s=r.map(a=>`image-set(${a})`);t.style.backgroundImage=s.join(),t.style.backgroundImage===""&&(s=r.map(a=>`-webkit-image-set(${a})`),t.style.backgroundImage=s.join()),Jd(t,e,i)},qd={IMG:yy,IFRAME:xy,VIDEO:Sy,OBJECT:My},Ay=(t,e)=>{const i=qd[t.tagName];!i||i(t,e)},Ty=(t,e,i)=>{const n=qd[t.tagName];!n||(n(t,e),Kd(t,e,i))},Ey=["IMG","IFRAME","VIDEO","OBJECT"],Ny=t=>Ey.indexOf(t.tagName)>-1,ef=(t,e)=>{e&&!py(e)&&!gy(e)&&Kt(t.callback_finish,e)},xc=(t,e,i)=>{t.addEventListener(e,i),t.llEvLisnrs[e]=i},ky=(t,e,i)=>{t.removeEventListener(e,i)},zl=t=>!!t.llEvLisnrs,Py=(t,e,i)=>{zl(t)||(t.llEvLisnrs={});const n=t.tagName==="VIDEO"?"loadeddata":"load";xc(t,n,e),xc(t,"error",i)},ho=t=>{if(!zl(t))return;const e=t.llEvLisnrs;for(let i in e){const n=e[i];ky(t,i,n)}delete t.llEvLisnrs},tf=(t,e,i)=>{cy(t),Pl(i,-1),fy(i),ut(t,e.class_loading),e.unobserve_completed&&ia(t,i)},By=(t,e,i,n)=>{const r=kl(e);tf(e,i,n),cn(e,i.class_loaded),Ai(e,_d),Kt(i.callback_loaded,e,n),r||ef(i,n)},zy=(t,e,i,n)=>{const r=kl(e);tf(e,i,n),cn(e,i.class_error),Ai(e,El),Kt(i.callback_error,e,n),i.restore_on_error&&xi(e,qn),r||ef(i,n)},Dl=(t,e,i)=>{const n=Wd(t)||t;if(zl(n))return;Py(n,a=>{By(a,t,e,i),ho(n)},a=>{zy(a,t,e,i),ho(n)})},Dy=(t,e,i)=>{uy(t),Dl(t,e,i),my(t),Cy(t,e,i),Iy(t,e,i),by(t,e,i)},Ly=(t,e,i)=>{Dl(t,e,i),Ty(t,e,i)},Ll=(t,e,i)=>{Ny(t)?Ly(t,e,i):Dy(t,e,i)},Ry=(t,e,i)=>{t.setAttribute("loading","lazy"),Dl(t,e,i),Ay(t,e),Ai(t,Od)},Sc=t=>{t.removeAttribute(Et),t.removeAttribute(bl),t.removeAttribute(Al)},jy=t=>{Bl(t,e=>{Sc(e)}),Sc(t)},nf=t=>{Bl(t,e=>{xi(e,qn)}),xi(t,qn)},_y=t=>{Qd(t,e=>{xi(e,na)}),xi(t,Zd),t.load()},Vy=t=>{xi(t,na)},Oy=t=>{xi(t,Yd)},Uy={IMG:nf,IFRAME:Vy,VIDEO:_y,OBJECT:Oy},$y=t=>{const e=Uy[t.tagName];if(!e){wy(t);return}e(t)},Wy=(t,e)=>{Nl(t)||kl(t)||(ut(t,e.class_entered),ut(t,e.class_exited),ut(t,e.class_applied),ut(t,e.class_loading),ut(t,e.class_loaded),ut(t,e.class_error))},Hy=(t,e)=>{$y(t),Wy(t,e),ta(t),Xd(t)},Fy=(t,e,i,n)=>{!i.cancel_on_exit||!sy(t)||t.tagName==="IMG"&&(ho(t),jy(t),nf(t),ut(t,i.class_loading),Pl(n,-1),ta(t),Kt(i.callback_cancel,t,e,n))},Qy=(t,e,i,n)=>{const r=ly(t);Ai(t,ny),cn(t,i.class_entered),ut(t,i.class_exited),dy(t,i,n),Kt(i.callback_enter,t,e,n),!r&&Ll(t,i,n)},Zy=(t,e,i,n)=>{Nl(t)||(cn(t,i.class_exited),Fy(t,e,i,n),Kt(i.callback_exit,t,e,n))},Yy=["IMG","IFRAME","VIDEO"],rf=t=>t.use_native&&"loading"in HTMLImageElement.prototype,Gy=(t,e,i)=>{t.forEach(n=>{Yy.indexOf(n.tagName)!==-1&&Ry(n,e,i)}),Hd(i,0)},Xy=t=>t.isIntersecting||t.intersectionRatio>0,Jy=t=>({root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}),Ky=(t,e,i)=>{t.forEach(n=>Xy(n)?Qy(n.target,n,e,i):Zy(n.target,n,e,i))},qy=(t,e)=>{e.forEach(i=>{t.observe(i)})},ex=(t,e)=>{hy(t),qy(t,e)},tx=(t,e)=>{!Bd||rf(t)||(e._observer=new IntersectionObserver(i=>{Ky(i,t,e)},Jy(t)))},sf=t=>Array.prototype.slice.call(t),gs=t=>t.container.querySelectorAll(t.elements_selector),ix=t=>sf(t).filter(Nl),nx=t=>ay(t),rx=t=>sf(t).filter(nx),Mc=(t,e)=>ix(t||gs(e)),sx=(t,e)=>{rx(gs(t)).forEach(n=>{ut(n,t.class_error),ta(n)}),e.update()},ax=(t,e)=>{!Jt||(e._onlineHandler=()=>{sx(t,e)},window.addEventListener("online",e._onlineHandler))},ox=t=>{!Jt||window.removeEventListener("online",t._onlineHandler)},mr=function(t,e){const i=Ld(t);this._settings=i,this.loadingCount=0,tx(i,this),ax(i,this),this.update(e)};mr.prototype={update:function(t){const e=this._settings,i=Mc(t,e);if(Hd(this,i.length),Pd||!Bd){this.loadAll(i);return}if(rf(e)){Gy(i,e,this);return}ex(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),ox(this),gs(this._settings).forEach(t=>{Xd(t)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){const e=this._settings;Mc(t,e).forEach(n=>{ia(n,this),Ll(n,e,this)})},restoreAll:function(){const t=this._settings;gs(t).forEach(e=>{Hy(e,t)})}};mr.load=(t,e)=>{const i=Ld(e);Ll(t,i)};mr.resetStatus=t=>{ta(t)};Jt&&iy(mr,window.lazyLoadOptions);class af{constructor({readonly:e,box:i,pages:n,onNewPageIndex:r,onPlay:s}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new ea,n.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=e,this.box=i,this.pages=n,this.onNewPageIndex=r,this.onPlay=s,this.onPageIndexChanged=()=>{},this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const e=new mr({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>e.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.$content.classList.toggle(this.wrapClassName("readonly"),e),this.$footer.classList.toggle(this.wrapClassName("readonly"),e),this.$pageNumberInput.disabled=e)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(e){Number.isNaN(e)||(this.pageIndex=e,this.$pageNumberInput.value=String(e+1),this.onPageIndexChanged(e))}setSmallBox(e){this.isSmallBox!==e&&(this.isSmallBox=e,this.$footer.classList.toggle(this.wrapClassName("float-footer"),e))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const e=document.createElement("div");e.className=this.wrapClassName("content"),this.$content=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),e.appendChild(this.renderPreviewMask()),e.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const e=document.createElement("div");e.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=e;const i=this.wrapClassName("preview-page"),n=this.wrapClassName("preview-page-name");this.pages.forEach((r,s)=>{var a;const o=(a=r.thumbnail)!=null?a:r.src.startsWith("ppt")?void 0:r.src;if(!o)return;const l=String(s),u=document.createElement("a");u.className=i+" "+this.wrapClassName(`preview-page-${s}`),u.setAttribute("href","#"),u.dataset.pageIndex=l;const h=document.createElement("span");h.className=n,h.textContent=String(s+1),h.dataset.pageIndex=l;const c=document.createElement("img");c.width=r.width,c.height=r.height,c.dataset.src=o,c.dataset.pageIndex=l,u.appendChild(c),u.appendChild(h),e.appendChild(u)}),this.sideEffect.addEventListener(e,"click",r=>{var s;if(this.readonly)return;const a=(s=r.target.dataset)==null?void 0:s.pageIndex;a&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(a)),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",e=>{this.readonly||e.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const e=document.createElement("div");if(e.className=this.wrapClassName("footer"),this.$footer=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&e.classList.add(this.wrapClassName("float-footer")),this.pages.some(l=>l.thumbnail||!l.src.startsWith("ppt"))){const l=this.renderFooterBtn("btn-sidebar",Xw(this.namespace));this.sideEffect.addEventListener(l,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(l)}const i=document.createElement("div");i.className=this.wrapClassName("page-jumps");const n=this.renderFooterBtn("btn-page-back",Jw(this.namespace));if(this.sideEffect.addEventListener(n,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),i.appendChild(n),this.onPlay){const l=this.renderFooterBtn("btn-page-play",qw(this.namespace),ey(this.namespace)),u=()=>{this.sideEffect.setTimeout(()=>{l.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(l,"click",()=>{this.readonly||(l.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),u())}),i.appendChild(l)}const r=this.renderFooterBtn("btn-page-next",Kw(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),i.appendChild(r);const s=document.createElement("div");s.className=this.wrapClassName("page-number");const a=document.createElement("input");a.className=this.wrapClassName("page-number-input"),a.value=String(this.pageIndex+1),this.readonly&&(a.disabled=!0),this.$pageNumberInput=a,this.sideEffect.addEventListener(a,"focus",()=>{a.select()}),this.sideEffect.addEventListener(a,"change",()=>{this.readonly||a.value&&this.onNewPageIndex(Number(a.value)-1)});const o=document.createElement("span");o.textContent=" / "+this.pages.length,s.appendChild(a),s.appendChild(o),this.$footer.appendChild(i),this.$footer.appendChild(s)}return this.$footer}renderFooterBtn(e,i,n){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(i),n&&r.appendChild(n),r}togglePreview(e){if(this.isShowPreview=e!=null?e:!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(e){return`${this.namespace}-${e}`}}function tn(t,e,i){return Math.min(Math.max(t,e),i)}function Cc(t){return t.touches?t.touches[0]:t}function of(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function lf(t){if(!t)return!1;const e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||e==="SELECT"}class lx{constructor(e){var i,n,r;this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=s=>{if(this.paused)return;let a=Math.floor((s-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=s;a-- >0;)this.stepper();this.onStep(this.current,this),!this.paused&&this.current!==this.target&&window.requestAnimationFrame(this.looper)},this.current=(i=e.start)!=null?i:0,this.target=this.current,this.stiffness=(n=e.stiffness)!=null?n:170,this.damping=(r=e.damping)!=null?r:26,this.onStep=e.onStep}stepTo(e,i){this.paused&&i!=null&&(this.current=i),this.paused=!1,this.target=e,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}pause(){this.paused=!0}destroy(){this.pause()}stepper(){const e=-this.stiffness*(this.current-this.target),i=-this.damping*this.velocity,n=this.velocity+(e+i)/60,r=this.current+n/60;Math.abs(n-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=r,this.velocity=n)}}class ux{constructor(e,i,n,r){this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=e,this.page=i,this.scale=n,this.pageOffsetX=(r-i.width)/2;const s=document.createElement("div");s.className="page-renderer-page",s.dataset.index=`${e}`,s.style.width=`${i.width*n}px`,s.style.height=`${i.height*n}px`,i.thumbnail&&(s.style.backgroundImage=`url("${i.thumbnail}")`);const a=document.createElement("img");a.className="page-renderer-page-img",a.width=i.width,a.height=i.height,a.src=i.src,s.appendChild(a),this.$page=s}translateY(e){Math.abs(e-this.pageOffsetY)>=.001&&(this.pageOffsetY=e,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setScale(e){Math.abs(e-this.scale)>=.001&&(this.scale=e,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(e){e!==this.visible&&(this.visible=e,this.$page.style.opacity=e?"1":"0")}}const cx=window.requestIdleCallback||(t=>window.setTimeout(t,5e3)),hx=window.cancelIdleCallback||window.clearTimeout;class dx{constructor(e,i,n){this.pages=e,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 r=[...this.els.values()].sort((s,a)=>a.lastVisit-s.lastVisit);for(let s=Math.floor(this.maxElCount/4);s<r.length;s++)this.els.delete(r[s].index)}}}getEl(e){let i=this.els.get(e);return i||(i=new ux(e,this.pages[e],this.scale,this.pagesIntrinsicWidth),this.els.set(e,i)),i.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=cx(this.gc)),i}setScale(e){e!==this.scale&&(this.scale=e,this.els.forEach(i=>i.setScale(e)))}destroy(){this.els.clear(),this.gcTimer!==null&&(hx(this.gcTimer),this.gcTimer=null)}}class fx{constructor(e){this._hwaTimeout=NaN,this._turnOffHWA=()=>{window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN,this.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pages=e.pages.map(s=>{if(s.thumbnail)return s;try{const a=new URL(s.src);return a.searchParams.set("x-oss-process","image/resize,l_50"),{...s,thumbnail:a.toString()}}catch(a){return console.error(a),s}});const i=Array(this.pages.length);let n=1/0,r=0;this.pagesIntrinsicHeight=this.pages.reduce((s,a,o)=>(i[o]=s,a.width>r&&(r=a.width),a.height<=n&&(n=a.height),s+a.height),0),this.pagesIntrinsicWidth=r,this.pagesMinHeight=n,this.pagesIntrinsicYs=i,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=e.onPageIndexChanged,this.pageScrollIndex=0,this.pagesScrollTop!==0&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new dx(this.pages,r,this.scale),this.$pages=this.renderPages()}setContainerSize(e,i){e>0&&i>0&&(e!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=e,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 e=document.createElement("div");return e.className="page-renderer-pages-container",e.style.width=`${this.containerWidth}px`,e.style.height=`${this.containerHeight}px`,e}pagesScrollTo(e,i){if(e=tn(e,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),i||Math.abs(e-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=e;const n=this.findScrollPageIndex(),r=Math.max(n-this.threshold,0),s=Math.min(n+this.threshold,this.pages.length-1);for(let a=0;a<this.$pages.children.length;a++){const o=this.$pages.children[a],l=Number(o.dataset.index);l>=r&&l<=s||(o.remove(),a--)}for(let a=r;a<=s;a++){const o=this.pageElManager.getEl(a);o.$page.parentElement!==this.$pages&&this.$pages.appendChild(o.$page),o.translateY(this.pagesIntrinsicYs[a]-this.pagesScrollTop)}n!==this.pageScrollIndex&&(this.pageScrollIndex=n,this.onPageIndexChanged&&this.onPageIndexChanged(n))}}findScrollPageIndex(){for(let e=0;e<this.pagesIntrinsicYs.length;e++)if(this.pagesIntrinsicYs[e]+this.pages[e].height-this.pagesScrollTop>=.001)return e;return this.pagesIntrinsicYs.length-1}mount(e){e.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 tn(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 px=30;class gx{constructor(e){this.sideEffect=new ea,this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pagesWidth=e.pagesWidth||1,this.pagesHeight=e.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=e.scrollbarMinHeight||px,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=e.readonly,this.wrapClassName=e.wrapClassName,this.onDragScroll=e.onDragScroll,this.$scrollbar=this.renderScrollbar()}mount(e){e.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$scrollbar.remove()}setReadonly(e){this.readonly=e}setContainerSize(e,i){e>0&&i>0&&(e!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=i,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}pagesScrollTo(e,i){if(e=tn(e,0,this.pagesHeight-this.containerHeight/this.scale),i||Math.abs(e-this.pagesScrollTop)>=.001){this.pagesScrollTop=e;const n=this.pagesScrollTop*this.scale,r=this.pagesHeight*this.scale,s=n/(r-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame(()=>{this.$scrollbar.style.transform=`translateY(${s}px)`}):this.$scrollbar.style.transform=`translateY(${s}px)`}}destroy(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const e=document.createElement("button");e.className=this.wrapClassName("scrollbar"),e.style.minHeight=`${this.scrollbarMinHeight}px`,e.style.height=`${this.scrollbarHeight}px`;const i=n=>{if(this.readonly||n.button!=null&&n.button!==0)return;of(n);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const s=this.pagesScrollTop,{clientY:a}=Cc(n),o=u=>{if(this.readonly)return;const{clientY:h}=Cc(u),c=(h-a)/this.scale;Math.abs(c)>0&&this.onDragScroll&&this.onDragScroll(s+c*(this.pagesHeight*this.scale/this.containerHeight))},l=()=>{e.classList.toggle(r,!1),window.removeEventListener("mousemove",o,!0),window.removeEventListener("touchmove",o,!0),window.removeEventListener("mouseup",l,!0),window.removeEventListener("touchend",l,!0),window.removeEventListener("touchcancel",l,!0)};window.addEventListener("mousemove",o,!0),window.addEventListener("touchmove",o,!0),window.addEventListener("mouseup",l,!0),window.addEventListener("touchend",l,!0),window.addEventListener("touchcancel",l,!0)};return this.sideEffect.addEventListener(e,"mousedown",i),this.sideEffect.addEventListener(e,"touchstart",i),e}_calcScale(){return this.containerWidth/this.pagesWidth||1}_calcScrollbarHeight(){return tn(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}_updateScrollbarHeight(){const e=this._calcScrollbarHeight();Math.abs(e-this.scrollbarHeight)>.001&&(this.scrollbarHeight=e,this.$scrollbar.style.height=`${e}px`)}}const mx=window.ResizeObserver||Gw,yn=640;class vx{constructor({context:e,whiteboardView:i,readonly:n,box:r,pages:s,pageScrollTop:a=0,mountWhiteboard:o,onUserScroll:l,baseScenePath:u,appId:h}){this.sideEffect=new ea,this.userScrolling=!1,this.docsViewReadonly=!1,this.onNewPageIndex=y=>{this.scrollToPage(y)},this.toPdf=async()=>{const y=document.createElement("canvas"),x=y.getContext("2d");if(!x||!this.baseScenePath){this.reportProgress(100,null);return}const d=this.whiteboardView.focusScenePath||`${this.baseScenePath}/1`,f=this.pages[0],{jsPDF:p}=await Promise.resolve().then(function(){return jg(require("jspdf"))}),g=new p({format:[f.width,f.height],orientation:f.width>f.height?"l":"p",compress:!0});for(const[S,E]of this.pages.entries()){const{width:P,height:k,src:z}=E;y.width=P,y.height=k;const te=P>k?"l":"p";S>0&&g.addPage([P,k],te);const I=await this.getBase64FromUrl(z),M=document.createElement("img");M.src=I,await new Promise(Y=>M.onload=Y),x.drawImage(M,0,0);const _=y.toDataURL("image/jpeg",.6);x.clearRect(0,0,P,k);const D={centerX:P/2,centerY:k/2+S*k,scale:1},Z=this.context.manager.windowManger;Z._appliancePlugin?await Z._appliancePlugin.screenshotToCanvasAsync(x,d,P,k,D):this.whiteboardView.screenshotToCanvas(x,d,P,k,D);const ie=y.toDataURL("image/png");g.addImage(_,"JPEG",0,0,P,k,"","FAST"),g.addImage(ie,"PNG",0,0,P,k,"","FAST"),x.clearRect(0,0,P,k),Math.ceil((S+1)/this.pages.length*100)<100&&this.reportProgress(Math.ceil((S+1)/this.pages.length*100),null)}const v=g.output("arraybuffer");this.reportProgress(100,{pdf:v,title:this.box.title})},this.context=e,this.whiteboardView=i,this.readonly=n,this.box=r,this.pages=s,this.baseScenePath=u,this.appId=h,this.mountWhiteboard=o,this._onUserScroll=l;const c=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,c()},this.viewer=new af({readonly:n,box:r,pages:s,onNewPageIndex:this.onNewPageIndex});const{width:m,height:w}=this.whiteboardView.size;this.pageRenderer=new fx({pagesScrollTop:a,pages:this.pages,containerWidth:m,containerHeight:w,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new gx({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:m,containerHeight:w,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:y=>{this.pageScrollTo(y),this.updateUserScroll()}}),this.pageScrollStepper=new lx({start:this.pageRenderer.pagesScrollTop,onStep:y=>{this.pageScrollTo(y)}}),this.render()}setDocsViewReadonly(e){this.docsViewReadonly=e}mount(){this.viewer.mount(),this.setupScrollListener();const e=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const i=new mx(e);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(e){this.readonly!==e&&(this.readonly=e,this.viewer.setReadonly(e),this.scrollbar.setReadonly(e))}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(e){!this.userScrolling&&e>=0&&Math.abs(this.pageRenderer.pagesScrollTop-e)>.01&&this.pageScrollStepper.stepTo(e,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 e=this.box.absoluteHeight,i=e<=yn;if(this.viewer.setSmallBox(i),i){const n=26/yn,r=26/e,s=26/yn,a=0,o=Math.max((n+s-(r+a))/2,0);if(this.box.$titleBar){const l=r+o;this.box.$titleBar.style.height=`${l*100}%`}if(this.box.$footer){const l=a+o;this.box.$footer.style.height=`${l*100}%`}}else{if(this.box.$titleBar){const n=Math.max(26/yn,26/e);this.box.$titleBar.style.height=`${n*100}%`}if(this.box.$footer){const n=Math.max(26/yn,26/e);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",e=>{of(e),this.readonly||(this.pageScrollTo(this.pageRenderer.pagesScrollTop+e.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",e=>{this.readonly||e.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}scrollTopPageToEl(e){return e*this.pageRenderer.scale}scrollTopElToPage(e){return e/this.pageRenderer.scale}elScrollTo(e){this.pageScrollTo(this.scrollTopElToPage(e))}pageScrollTo(e){const i=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:tn(e+i,i,this.pageRenderer.pagesIntrinsicHeight-i),animationMode:"immediately"})}scrollToPage(e){if(!this.readonly&&!Number.isNaN(e)){const i=this.pageRenderer.pagesIntrinsicYs[e];i>=0&&(this.pageScrollTo(i+5/this.pageRenderer.scale),this.updateUserScroll())}}setupScrollListener(){this.sideEffect.add(()=>{const e=i=>{const{width:n,height:r}=this.whiteboardView.size;if(n<=0||r<=0)return;const s=i.centerY-this.pageRenderer.containerHeight/this.pageRenderer.scale/2;this.pageRenderer.pagesScrollTo(s),this.scrollbar.pagesScrollTo(s)};return this.whiteboardView.callbacks.on("onCameraUpdated",e),()=>this.whiteboardView.callbacks.off("onCameraUpdated",e)}),this.sideEffect.add(()=>{const{updateUserScroll:e}=this;return this.whiteboardView.callbacks.on("onCameraUpdatedByDevice",e),()=>this.whiteboardView.callbacks.off("onCameraUpdatedByDevice",e)}),this.sideEffect.add(()=>{const e=({width:i,height:n})=>{if(i<=0||n<=0)return;this.pageRenderer.setContainerSize(i,n),this.scrollbar.setContainerSize(i,n);const{pagesIntrinsicWidth:r,pagesIntrinsicHeight:s}=this.pageRenderer;this.whiteboardView.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:r,height:n/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:r/2,centerY:s/2,width:r,height:s})};return this.whiteboardView.callbacks.on("onSizeUpdated",e),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",e)}},"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",e=>{if(this.readonly||!this.box.focus||this.box.minimized||lf(e.target)||this.docsViewReadonly)return;let i=null;switch(e.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(e,i,n){const r=Cw(e,i);return this.sideEffect.addDisposer(()=>r.cancel(),n),r}wrapClassName(e){return"netless-app-docs-viewer-static-"+e}async getBase64FromUrl(e){const n=await(await fetch(this._invalidate(e))).blob();return new Promise(r=>{const s=new FileReader;s.readAsDataURL(n),s.onloadend=()=>{const a=s.result;r(a)}})}_invalidate(e){try{const i=new URL(e);return i.searchParams.set("t",Date.now().toString()),i.toString()}catch{return e}}reportProgress(e,i){window.postMessage({type:"@netless/_result_save_pdf_",appId:this.appId,progress:e,result:i})}}class wx{constructor({context:e,whiteboardView:i,box:n,pages:r}){this.sideEffect=new ea,this.docsViewReadonly=!1,this.onPlayPPT=()=>{const s=this.context.getRoom();s&&s.pptNextStep()},this._scaleDocsToFitImpl=()=>{const s=this.pages[this.getPageIndex()];s&&(this.whiteboardView.moveCameraToContain({originX:-s.width/2,originY:-s.height/2,width:s.width,height:s.height,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.whiteboardView.camera.scale,minContentMode:()=>this.whiteboardView.camera.scale,centerX:0,centerY:0,width:s.width,height:s.height}))},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=s=>{this.jumpToPage(s,!0)},this.context=e,this.whiteboardView=i,this.box=n,this.pages=r,this.displayer=e.getDisplayer(),this.viewer=new af({readonly:!e.getIsWritable(),box:n,pages:r,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add(()=>{const s=a=>{this.viewer.setReadonly(!a)};return this.context.emitter.on("writableChange",s),()=>this.context.emitter.off("writableChange",s)}),this.sideEffect.add(()=>{const s=a=>{this.jumpToPage(a.index)};return this.context.emitter.on("sceneStateChange",s),()=>this.context.emitter.off("sceneStateChange",s)})}setDocsViewReadonly(e){this.docsViewReadonly=e}mount(){this.viewer.mount();const e=this.getPageIndex();return e!==0&&this.jumpToPage(e),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(e,i){var n,r;if(e=tn(e,0,this.pages.length-1),e!==this.getPageIndex()&&this.context.getIsWritable()){const s=this.context.getInitScenePath(),a=(r=(n=this.context.getScenes())==null?void 0:n[e])==null?void 0:r.name;s&&a&&this.context.setScenePath(`${s}/${a}`),this.scaleDocsToFit()}if(e!==this.viewer.pageIndex&&this.viewer.setPageIndex(e),i){const s=this.context.getRoom();if(s){const a=s.state.globalState.__pptState;s.setGlobalState({__pptState:a&&{uuid:a.uuid,pageIndex:e,disableAutoPlay:a.disableAutoPlay}})}}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",e=>{var i;if(!this.docsViewReadonly&&this.box.focus&&!lf(e.target))switch(e.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 e=document.createElement("div");e.className=this.wrapClassName("mask"),this.$mask=e;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",e=>{var i;const n=this.context.getRoom();if(n&&n.state.memberState.currentApplianceName==="clicker"){for(let r=e.target;r;r=r.parentElement)if((i=r.classList)!=null&&i.contains("ppt-event-source"))return;n.pptNextStep()}}),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}wrapClassName(e){return"netless-app-docs-viewer-dynamic-"+e}}const yx="DocsViewer",fo={kind:yx,setup(t){const e=t.getBox(),i=t.getScenes();if(!i)throw new Error("[Docs Viewer]: scenes not found.");const n=t.getView();if(!n)throw new Error("[Docs Viewer]: no whiteboard view.");const r=i.map(({ppt:o})=>o?{width:o.width,height:o.height,src:o.src,thumbnail:o.previewURL}:null).filter(o=>Boolean(o));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");e.mountStyles(pw);let s=null;return r[0].src.startsWith("ppt")?s=Sx(t,n,e,r):s=xx(t,n,e,r),(t.getAppOptions()||{}).justDocsViewReadonly&&s.setDocsViewReadonly(!0),{setDocsViewReadonly:o=>{s==null||s.setDocsViewReadonly(o)}}}};function xx(t,e,i,n){var r;e.disableCameraTransform=!t.getIsWritable();const s=new vx({context:t,whiteboardView:e,readonly:!t.getIsWritable(),box:i,pages:n,pageScrollTop:(r=t.getAttributes())==null?void 0:r.pageScrollTop,mountWhiteboard:t.mountView.bind(t),onUserScroll:a=>{var o;((o=t.getAttributes())==null?void 0:o.pageScrollTop)!==a&&!i.readonly&&t.updateAttributes(["pageScrollTop"],a)},baseScenePath:t.getInitScenePath(),appId:t.appId}).mount();return s.viewer.onPageIndexChanged=a=>{t.dispatchAppEvent("pageStateChange",{index:a,length:n.length})},t.dispatchAppEvent("pageStateChange",{index:s.viewer.pageIndex,length:n.length}),t.emitter.on("attributesUpdate",a=>{a&&a.pageScrollTop!=null&&s.syncPageScrollTop(a.pageScrollTop)}),t.emitter.on("writableChange",a=>{s.setReadonly(!a),e.disableCameraTransform=!a}),s}function Sx(t,e,i,n){e.disableCameraTransform=!0;const r=new wx({context:t,whiteboardView:e,box:i,pages:n}).mount();return r.viewer.onPageIndexChanged=s=>{t.dispatchAppEvent("pageStateChange",{index:s,length:n.length})},t.dispatchAppEvent("pageStateChange",{index:r.getPageIndex(),length:n.length}),t.mountView(r.$whiteboardView),t.isAddApp&&e.callbacks.once("onSizeUpdated",({width:s,height:a})=>{if(n.length>0&&i.state!=="maximized"){const{width:o,height:l}=n[0],h=l/o*s-a;h!==0&&t.getIsWritable()&&t.emitter.emit("setBoxSize",{width:i.width,height:i.height+h/i.containerRect.height})}}),r}var Ti={exports:{}},J={};/*
19
19
  object-assign
20
20
  (c) Sindre Sorhus
21
21
  @license MIT
22
- */var xc=Object.getOwnPropertySymbols,mx=Object.prototype.hasOwnProperty,vx=Object.prototype.propertyIsEnumerable;function wx(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function yx(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var e={},i=0;i<10;i++)e["_"+String.fromCharCode(i)]=i;var n=Object.getOwnPropertyNames(e).map(function(s){return e[s]});if(n.join("")!=="0123456789")return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(s){r[s]=s}),Object.keys(Object.assign({},r)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var sf=yx()?Object.assign:function(t,e){for(var i,n=wx(t),r,s=1;s<arguments.length;s++){i=Object(arguments[s]);for(var a in i)mx.call(i,a)&&(n[a]=i[a]);if(xc){r=xc(i);for(var o=0;o<r.length;o++)vx.call(i,r[o])&&(n[r[o]]=i[r[o]])}}return n};/** @license React v16.14.0
22
+ */var Ic=Object.getOwnPropertySymbols,Mx=Object.prototype.hasOwnProperty,Cx=Object.prototype.propertyIsEnumerable;function Ix(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function bx(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var e={},i=0;i<10;i++)e["_"+String.fromCharCode(i)]=i;var n=Object.getOwnPropertyNames(e).map(function(s){return e[s]});if(n.join("")!=="0123456789")return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(s){r[s]=s}),Object.keys(Object.assign({},r)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var uf=bx()?Object.assign:function(t,e){for(var i,n=Ix(t),r,s=1;s<arguments.length;s++){i=Object(arguments[s]);for(var a in i)Mx.call(i,a)&&(n[a]=i[a]);if(Ic){r=Ic(i);for(var o=0;o<r.length;o++)Cx.call(i,r[o])&&(n[r[o]]=i[r[o]])}}return n};/** @license React v16.14.0
23
23
  * react.production.min.js
24
24
  *
25
25
  * Copyright (c) Facebook, Inc. and its affiliates.
26
26
  *
27
27
  * This source code is licensed under the MIT license found in the
28
28
  * LICENSE file in the root directory of this source tree.
29
- */var Dl=sf,it=typeof Symbol=="function"&&Symbol.for,gr=it?Symbol.for("react.element"):60103,xx=it?Symbol.for("react.portal"):60106,Sx=it?Symbol.for("react.fragment"):60107,Mx=it?Symbol.for("react.strict_mode"):60108,Ix=it?Symbol.for("react.profiler"):60114,Cx=it?Symbol.for("react.provider"):60109,bx=it?Symbol.for("react.context"):60110,Ax=it?Symbol.for("react.forward_ref"):60112,Tx=it?Symbol.for("react.suspense"):60113,Ex=it?Symbol.for("react.memo"):60115,Nx=it?Symbol.for("react.lazy"):60116,Sc=typeof Symbol=="function"&&Symbol.iterator;function mr(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)e+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var af={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},of={};function un(t,e,i){this.props=t,this.context=e,this.refs=of,this.updater=i||af}un.prototype.isReactComponent={};un.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error(mr(85));this.updater.enqueueSetState(this,t,e,"setState")};un.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function lf(){}lf.prototype=un.prototype;function Ll(t,e,i){this.props=t,this.context=e,this.refs=of,this.updater=i||af}var Rl=Ll.prototype=new lf;Rl.constructor=Ll;Dl(Rl,un.prototype);Rl.isPureReactComponent=!0;var jl={current:null},uf=Object.prototype.hasOwnProperty,cf={key:!0,ref:!0,__self:!0,__source:!0};function hf(t,e,i){var n,r={},s=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)uf.call(e,n)&&!cf.hasOwnProperty(n)&&(r[n]=e[n]);var o=arguments.length-2;if(o===1)r.children=i;else if(1<o){for(var l=Array(o),u=0;u<o;u++)l[u]=arguments[u+2];r.children=l}if(t&&t.defaultProps)for(n in o=t.defaultProps,o)r[n]===void 0&&(r[n]=o[n]);return{$$typeof:gr,type:t,key:s,ref:a,props:r,_owner:jl.current}}function kx(t,e){return{$$typeof:gr,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function _l(t){return typeof t=="object"&&t!==null&&t.$$typeof===gr}function Px(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(i){return e[i]})}var df=/\/+/g,ps=[];function ff(t,e,i,n){if(ps.length){var r=ps.pop();return r.result=t,r.keyPrefix=e,r.func=i,r.context=n,r.count=0,r}return{result:t,keyPrefix:e,func:i,context:n,count:0}}function pf(t){t.result=null,t.keyPrefix=null,t.func=null,t.context=null,t.count=0,10>ps.length&&ps.push(t)}function ho(t,e,i,n){var r=typeof t;(r==="undefined"||r==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(r){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case gr:case xx:s=!0}}if(s)return i(n,t,e===""?"."+ka(t,0):e),1;if(s=0,e=e===""?".":e+":",Array.isArray(t))for(var a=0;a<t.length;a++){r=t[a];var o=e+ka(r,a);s+=ho(r,o,i,n)}else if(t===null||typeof t!="object"?o=null:(o=Sc&&t[Sc]||t["@@iterator"],o=typeof o=="function"?o:null),typeof o=="function")for(t=o.call(t),a=0;!(r=t.next()).done;)r=r.value,o=e+ka(r,a++),s+=ho(r,o,i,n);else if(r==="object")throw i=""+t,Error(mr(31,i==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":i,""));return s}function fo(t,e,i){return t==null?0:ho(t,"",e,i)}function ka(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Px(t.key):e.toString(36)}function Bx(t,e){t.func.call(t.context,e,t.count++)}function zx(t,e,i){var n=t.result,r=t.keyPrefix;t=t.func.call(t.context,e,t.count++),Array.isArray(t)?po(t,n,i,function(s){return s}):t!=null&&(_l(t)&&(t=kx(t,r+(!t.key||e&&e.key===t.key?"":(""+t.key).replace(df,"$&/")+"/")+i)),n.push(t))}function po(t,e,i,n,r){var s="";i!=null&&(s=(""+i).replace(df,"$&/")+"/"),e=ff(e,s,n,r),fo(t,zx,e),pf(e)}var gf={current:null};function Pt(){var t=gf.current;if(t===null)throw Error(mr(321));return t}var Dx={ReactCurrentDispatcher:gf,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:jl,IsSomeRendererActing:{current:!1},assign:Dl};J.Children={map:function(t,e,i){if(t==null)return t;var n=[];return po(t,n,null,e,i),n},forEach:function(t,e,i){if(t==null)return t;e=ff(null,null,e,i),fo(t,Bx,e),pf(e)},count:function(t){return fo(t,function(){return null},null)},toArray:function(t){var e=[];return po(t,e,null,function(i){return i}),e},only:function(t){if(!_l(t))throw Error(mr(143));return t}};J.Component=un;J.Fragment=Sx;J.Profiler=Ix;J.PureComponent=Ll;J.StrictMode=Mx;J.Suspense=Tx;J.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Dx;J.cloneElement=function(t,e,i){if(t==null)throw Error(mr(267,t));var n=Dl({},t.props),r=t.key,s=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=jl.current),e.key!==void 0&&(r=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(l in e)uf.call(e,l)&&!cf.hasOwnProperty(l)&&(n[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)n.children=i;else if(1<l){o=Array(l);for(var u=0;u<l;u++)o[u]=arguments[u+2];n.children=o}return{$$typeof:gr,type:t.type,key:r,ref:s,props:n,_owner:a}};J.createContext=function(t,e){return e===void 0&&(e=null),t={$$typeof:bx,_calculateChangedBits:e,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider={$$typeof:Cx,_context:t},t.Consumer=t};J.createElement=hf;J.createFactory=function(t){var e=hf.bind(null,t);return e.type=t,e};J.createRef=function(){return{current:null}};J.forwardRef=function(t){return{$$typeof:Ax,render:t}};J.isValidElement=_l;J.lazy=function(t){return{$$typeof:Nx,_ctor:t,_status:-1,_result:null}};J.memo=function(t,e){return{$$typeof:Ex,type:t,compare:e===void 0?null:e}};J.useCallback=function(t,e){return Pt().useCallback(t,e)};J.useContext=function(t,e){return Pt().useContext(t,e)};J.useDebugValue=function(){};J.useEffect=function(t,e){return Pt().useEffect(t,e)};J.useImperativeHandle=function(t,e,i){return Pt().useImperativeHandle(t,e,i)};J.useLayoutEffect=function(t,e){return Pt().useLayoutEffect(t,e)};J.useMemo=function(t,e){return Pt().useMemo(t,e)};J.useReducer=function(t,e,i){return Pt().useReducer(t,e,i)};J.useRef=function(t){return Pt().useRef(t)};J.useState=function(t){return Pt().useState(t)};J.version="16.14.0";Ai.exports=J;var F=Ai.exports,mf={exports:{}},Ge={},vf={exports:{}},wf={};/** @license React v0.19.1
29
+ */var Rl=uf,nt=typeof Symbol=="function"&&Symbol.for,vr=nt?Symbol.for("react.element"):60103,Ax=nt?Symbol.for("react.portal"):60106,Tx=nt?Symbol.for("react.fragment"):60107,Ex=nt?Symbol.for("react.strict_mode"):60108,Nx=nt?Symbol.for("react.profiler"):60114,kx=nt?Symbol.for("react.provider"):60109,Px=nt?Symbol.for("react.context"):60110,Bx=nt?Symbol.for("react.forward_ref"):60112,zx=nt?Symbol.for("react.suspense"):60113,Dx=nt?Symbol.for("react.memo"):60115,Lx=nt?Symbol.for("react.lazy"):60116,bc=typeof Symbol=="function"&&Symbol.iterator;function wr(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)e+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var cf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},hf={};function hn(t,e,i){this.props=t,this.context=e,this.refs=hf,this.updater=i||cf}hn.prototype.isReactComponent={};hn.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error(wr(85));this.updater.enqueueSetState(this,t,e,"setState")};hn.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function df(){}df.prototype=hn.prototype;function jl(t,e,i){this.props=t,this.context=e,this.refs=hf,this.updater=i||cf}var _l=jl.prototype=new df;_l.constructor=jl;Rl(_l,hn.prototype);_l.isPureReactComponent=!0;var Vl={current:null},ff=Object.prototype.hasOwnProperty,pf={key:!0,ref:!0,__self:!0,__source:!0};function gf(t,e,i){var n,r={},s=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)ff.call(e,n)&&!pf.hasOwnProperty(n)&&(r[n]=e[n]);var o=arguments.length-2;if(o===1)r.children=i;else if(1<o){for(var l=Array(o),u=0;u<o;u++)l[u]=arguments[u+2];r.children=l}if(t&&t.defaultProps)for(n in o=t.defaultProps,o)r[n]===void 0&&(r[n]=o[n]);return{$$typeof:vr,type:t,key:s,ref:a,props:r,_owner:Vl.current}}function Rx(t,e){return{$$typeof:vr,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Ol(t){return typeof t=="object"&&t!==null&&t.$$typeof===vr}function jx(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(i){return e[i]})}var mf=/\/+/g,ms=[];function vf(t,e,i,n){if(ms.length){var r=ms.pop();return r.result=t,r.keyPrefix=e,r.func=i,r.context=n,r.count=0,r}return{result:t,keyPrefix:e,func:i,context:n,count:0}}function wf(t){t.result=null,t.keyPrefix=null,t.func=null,t.context=null,t.count=0,10>ms.length&&ms.push(t)}function po(t,e,i,n){var r=typeof t;(r==="undefined"||r==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(r){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case vr:case Ax:s=!0}}if(s)return i(n,t,e===""?"."+Ba(t,0):e),1;if(s=0,e=e===""?".":e+":",Array.isArray(t))for(var a=0;a<t.length;a++){r=t[a];var o=e+Ba(r,a);s+=po(r,o,i,n)}else if(t===null||typeof t!="object"?o=null:(o=bc&&t[bc]||t["@@iterator"],o=typeof o=="function"?o:null),typeof o=="function")for(t=o.call(t),a=0;!(r=t.next()).done;)r=r.value,o=e+Ba(r,a++),s+=po(r,o,i,n);else if(r==="object")throw i=""+t,Error(wr(31,i==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":i,""));return s}function go(t,e,i){return t==null?0:po(t,"",e,i)}function Ba(t,e){return typeof t=="object"&&t!==null&&t.key!=null?jx(t.key):e.toString(36)}function _x(t,e){t.func.call(t.context,e,t.count++)}function Vx(t,e,i){var n=t.result,r=t.keyPrefix;t=t.func.call(t.context,e,t.count++),Array.isArray(t)?mo(t,n,i,function(s){return s}):t!=null&&(Ol(t)&&(t=Rx(t,r+(!t.key||e&&e.key===t.key?"":(""+t.key).replace(mf,"$&/")+"/")+i)),n.push(t))}function mo(t,e,i,n,r){var s="";i!=null&&(s=(""+i).replace(mf,"$&/")+"/"),e=vf(e,s,n,r),go(t,Vx,e),wf(e)}var yf={current:null};function Nt(){var t=yf.current;if(t===null)throw Error(wr(321));return t}var Ox={ReactCurrentDispatcher:yf,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:Vl,IsSomeRendererActing:{current:!1},assign:Rl};J.Children={map:function(t,e,i){if(t==null)return t;var n=[];return mo(t,n,null,e,i),n},forEach:function(t,e,i){if(t==null)return t;e=vf(null,null,e,i),go(t,_x,e),wf(e)},count:function(t){return go(t,function(){return null},null)},toArray:function(t){var e=[];return mo(t,e,null,function(i){return i}),e},only:function(t){if(!Ol(t))throw Error(wr(143));return t}};J.Component=hn;J.Fragment=Tx;J.Profiler=Nx;J.PureComponent=jl;J.StrictMode=Ex;J.Suspense=zx;J.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ox;J.cloneElement=function(t,e,i){if(t==null)throw Error(wr(267,t));var n=Rl({},t.props),r=t.key,s=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=Vl.current),e.key!==void 0&&(r=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(l in e)ff.call(e,l)&&!pf.hasOwnProperty(l)&&(n[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)n.children=i;else if(1<l){o=Array(l);for(var u=0;u<l;u++)o[u]=arguments[u+2];n.children=o}return{$$typeof:vr,type:t.type,key:r,ref:s,props:n,_owner:a}};J.createContext=function(t,e){return e===void 0&&(e=null),t={$$typeof:Px,_calculateChangedBits:e,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider={$$typeof:kx,_context:t},t.Consumer=t};J.createElement=gf;J.createFactory=function(t){var e=gf.bind(null,t);return e.type=t,e};J.createRef=function(){return{current:null}};J.forwardRef=function(t){return{$$typeof:Bx,render:t}};J.isValidElement=Ol;J.lazy=function(t){return{$$typeof:Lx,_ctor:t,_status:-1,_result:null}};J.memo=function(t,e){return{$$typeof:Dx,type:t,compare:e===void 0?null:e}};J.useCallback=function(t,e){return Nt().useCallback(t,e)};J.useContext=function(t,e){return Nt().useContext(t,e)};J.useDebugValue=function(){};J.useEffect=function(t,e){return Nt().useEffect(t,e)};J.useImperativeHandle=function(t,e,i){return Nt().useImperativeHandle(t,e,i)};J.useLayoutEffect=function(t,e){return Nt().useLayoutEffect(t,e)};J.useMemo=function(t,e){return Nt().useMemo(t,e)};J.useReducer=function(t,e,i){return Nt().useReducer(t,e,i)};J.useRef=function(t){return Nt().useRef(t)};J.useState=function(t){return Nt().useState(t)};J.version="16.14.0";Ti.exports=J;var F=Ti.exports,xf={exports:{}},Xe={},Sf={exports:{}},Mf={};/** @license React v0.19.1
30
30
  * scheduler.production.min.js
31
31
  *
32
32
  * Copyright (c) Facebook, Inc. and its affiliates.
33
33
  *
34
34
  * This source code is licensed under the MIT license found in the
35
35
  * LICENSE file in the root directory of this source tree.
36
- */(function(t){var e,i,n,r,s;if(typeof window=="undefined"||typeof MessageChannel!="function"){var a=null,o=null,l=function(){if(a!==null)try{var A=t.unstable_now();a(!0,A),a=null}catch(j){throw setTimeout(l,0),j}},u=Date.now();t.unstable_now=function(){return Date.now()-u},e=function(A){a!==null?setTimeout(e,0,A):(a=A,setTimeout(l,0))},i=function(A,j){o=setTimeout(A,j)},n=function(){clearTimeout(o)},r=function(){return!1},s=t.unstable_forceFrameRate=function(){}}else{var c=window.performance,h=window.Date,m=window.setTimeout,v=window.clearTimeout;if(typeof console!="undefined"){var w=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 w!="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 c=="object"&&typeof c.now=="function")t.unstable_now=function(){return c.now()};else{var M=h.now();t.unstable_now=function(){return h.now()-M}}var d=!1,f=null,p=-1,g=5,y=0;r=function(){return t.unstable_now()>=y},s=function(){},t.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):g=0<A?Math.floor(1e3/A):5};var x=new MessageChannel,E=x.port2;x.port1.onmessage=function(){if(f!==null){var A=t.unstable_now();y=A+g;try{f(!0,A)?E.postMessage(null):(d=!1,f=null)}catch(j){throw E.postMessage(null),j}}else d=!1},e=function(A){f=A,d||(d=!0,E.postMessage(null))},i=function(A,j){p=m(function(){A(t.unstable_now())},j)},n=function(){v(p),p=-1}}function z(A,j){var Q=A.length;A.push(j);e:for(;;){var ie=Q-1>>>1,se=A[ie];if(se!==void 0&&0<te(se,j))A[ie]=j,A[Q]=se,Q=ie;else break e}}function P(A){return A=A[0],A===void 0?null:A}function B(A){var j=A[0];if(j!==void 0){var Q=A.pop();if(Q!==j){A[0]=Q;e:for(var ie=0,se=A.length;ie<se;){var rt=2*(ie+1)-1,st=A[rt],Fe=rt+1,Ee=A[Fe];if(st!==void 0&&0>te(st,Q))Ee!==void 0&&0>te(Ee,st)?(A[ie]=Ee,A[Fe]=Q,ie=Fe):(A[ie]=st,A[rt]=Q,ie=rt);else if(Ee!==void 0&&0>te(Ee,Q))A[ie]=Ee,A[Fe]=Q,ie=Fe;else break e}}return j}return null}function te(A,j){var Q=A.sortIndex-j.sortIndex;return Q!==0?Q:A.id-j.id}var C=[],S=[],_=1,k=null,R=3,G=!1,ge=!1,Xe=!1;function nt(A){for(var j=P(S);j!==null;){if(j.callback===null)B(S);else if(j.startTime<=A)B(S),j.sortIndex=j.expirationTime,z(C,j);else break;j=P(S)}}function ei(A){if(Xe=!1,nt(A),!ge)if(P(C)!==null)ge=!0,e(ti);else{var j=P(S);j!==null&&i(ei,j.startTime-A)}}function ti(A,j){ge=!1,Xe&&(Xe=!1,n()),G=!0;var Q=R;try{for(nt(j),k=P(C);k!==null&&(!(k.expirationTime>j)||A&&!r());){var ie=k.callback;if(ie!==null){k.callback=null,R=k.priorityLevel;var se=ie(k.expirationTime<=j);j=t.unstable_now(),typeof se=="function"?k.callback=se:k===P(C)&&B(C),nt(j)}else B(C);k=P(C)}if(k!==null)var rt=!0;else{var st=P(S);st!==null&&i(ei,st.startTime-j),rt=!1}return rt}finally{k=null,R=Q,G=!1}}function Ei(A){switch(A){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var fn=s;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(A){A.callback=null},t.unstable_continueExecution=function(){ge||G||(ge=!0,e(ti))},t.unstable_getCurrentPriorityLevel=function(){return R},t.unstable_getFirstCallbackNode=function(){return P(C)},t.unstable_next=function(A){switch(R){case 1:case 2:case 3:var j=3;break;default:j=R}var Q=R;R=j;try{return A()}finally{R=Q}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=fn,t.unstable_runWithPriority=function(A,j){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var Q=R;R=A;try{return j()}finally{R=Q}},t.unstable_scheduleCallback=function(A,j,Q){var ie=t.unstable_now();if(typeof Q=="object"&&Q!==null){var se=Q.delay;se=typeof se=="number"&&0<se?ie+se:ie,Q=typeof Q.timeout=="number"?Q.timeout:Ei(A)}else Q=Ei(A),se=ie;return Q=se+Q,A={id:_++,callback:j,priorityLevel:A,startTime:se,expirationTime:Q,sortIndex:-1},se>ie?(A.sortIndex=se,z(S,A),P(C)===null&&A===P(S)&&(Xe?n():Xe=!0,i(ei,se-ie))):(A.sortIndex=Q,z(C,A),ge||G||(ge=!0,e(ti))),A},t.unstable_shouldYield=function(){var A=t.unstable_now();nt(A);var j=P(C);return j!==k&&k!==null&&j!==null&&j.callback!==null&&j.startTime<=A&&j.expirationTime<k.expirationTime||r()},t.unstable_wrapCallback=function(A){var j=R;return function(){var Q=R;R=j;try{return A.apply(this,arguments)}finally{R=Q}}}})(wf);vf.exports=wf;/** @license React v16.14.0
36
+ */(function(t){var e,i,n,r,s;if(typeof window=="undefined"||typeof MessageChannel!="function"){var a=null,o=null,l=function(){if(a!==null)try{var A=t.unstable_now();a(!0,A),a=null}catch(R){throw setTimeout(l,0),R}},u=Date.now();t.unstable_now=function(){return Date.now()-u},e=function(A){a!==null?setTimeout(e,0,A):(a=A,setTimeout(l,0))},i=function(A,R){o=setTimeout(A,R)},n=function(){clearTimeout(o)},r=function(){return!1},s=t.unstable_forceFrameRate=function(){}}else{var h=window.performance,c=window.Date,m=window.setTimeout,w=window.clearTimeout;if(typeof console!="undefined"){var y=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 y!="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 h=="object"&&typeof h.now=="function")t.unstable_now=function(){return h.now()};else{var x=c.now();t.unstable_now=function(){return c.now()-x}}var d=!1,f=null,p=-1,g=5,v=0;r=function(){return t.unstable_now()>=v},s=function(){},t.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):g=0<A?Math.floor(1e3/A):5};var S=new MessageChannel,E=S.port2;S.port1.onmessage=function(){if(f!==null){var A=t.unstable_now();v=A+g;try{f(!0,A)?E.postMessage(null):(d=!1,f=null)}catch(R){throw E.postMessage(null),R}}else d=!1},e=function(A){f=A,d||(d=!0,E.postMessage(null))},i=function(A,R){p=m(function(){A(t.unstable_now())},R)},n=function(){w(p),p=-1}}function P(A,R){var H=A.length;A.push(R);e:for(;;){var ne=H-1>>>1,re=A[ne];if(re!==void 0&&0<te(re,R))A[ne]=R,A[H]=re,H=ne;else break e}}function k(A){return A=A[0],A===void 0?null:A}function z(A){var R=A[0];if(R!==void 0){var H=A.pop();if(H!==R){A[0]=H;e:for(var ne=0,re=A.length;ne<re;){var Je=2*(ne+1)-1,Qe=A[Je],ti=Je+1,Pt=A[ti];if(Qe!==void 0&&0>te(Qe,H))Pt!==void 0&&0>te(Pt,Qe)?(A[ne]=Pt,A[ti]=H,ne=ti):(A[ne]=Qe,A[Je]=H,ne=Je);else if(Pt!==void 0&&0>te(Pt,H))A[ne]=Pt,A[ti]=H,ne=ti;else break e}}return R}return null}function te(A,R){var H=A.sortIndex-R.sortIndex;return H!==0?H:A.id-R.id}var I=[],M=[],_=1,D=null,Z=3,ie=!1,he=!1,Y=!1;function ke(A){for(var R=k(M);R!==null;){if(R.callback===null)z(M);else if(R.startTime<=A)z(M),R.sortIndex=R.expirationTime,P(I,R);else break;R=k(M)}}function Ni(A){if(Y=!1,ke(A),!he)if(k(I)!==null)he=!0,e(ei);else{var R=k(M);R!==null&&i(Ni,R.startTime-A)}}function ei(A,R){he=!1,Y&&(Y=!1,n()),ie=!0;var H=Z;try{for(ke(R),D=k(I);D!==null&&(!(D.expirationTime>R)||A&&!r());){var ne=D.callback;if(ne!==null){D.callback=null,Z=D.priorityLevel;var re=ne(D.expirationTime<=R);R=t.unstable_now(),typeof re=="function"?D.callback=re:D===k(I)&&z(I),ke(R)}else z(I);D=k(I)}if(D!==null)var Je=!0;else{var Qe=k(M);Qe!==null&&i(Ni,Qe.startTime-R),Je=!1}return Je}finally{D=null,Z=H,ie=!1}}function kt(A){switch(A){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var gn=s;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(A){A.callback=null},t.unstable_continueExecution=function(){he||ie||(he=!0,e(ei))},t.unstable_getCurrentPriorityLevel=function(){return Z},t.unstable_getFirstCallbackNode=function(){return k(I)},t.unstable_next=function(A){switch(Z){case 1:case 2:case 3:var R=3;break;default:R=Z}var H=Z;Z=R;try{return A()}finally{Z=H}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=gn,t.unstable_runWithPriority=function(A,R){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var H=Z;Z=A;try{return R()}finally{Z=H}},t.unstable_scheduleCallback=function(A,R,H){var ne=t.unstable_now();if(typeof H=="object"&&H!==null){var re=H.delay;re=typeof re=="number"&&0<re?ne+re:ne,H=typeof H.timeout=="number"?H.timeout:kt(A)}else H=kt(A),re=ne;return H=re+H,A={id:_++,callback:R,priorityLevel:A,startTime:re,expirationTime:H,sortIndex:-1},re>ne?(A.sortIndex=re,P(M,A),k(I)===null&&A===k(M)&&(Y?n():Y=!0,i(Ni,re-ne))):(A.sortIndex=H,P(I,A),he||ie||(he=!0,e(ei))),A},t.unstable_shouldYield=function(){var A=t.unstable_now();ke(A);var R=k(I);return R!==D&&D!==null&&R!==null&&R.callback!==null&&R.startTime<=A&&R.expirationTime<D.expirationTime||r()},t.unstable_wrapCallback=function(A){var R=Z;return function(){var H=Z;Z=R;try{return A.apply(this,arguments)}finally{Z=H}}}})(Mf);Sf.exports=Mf;/** @license React v16.14.0
37
37
  * react-dom.production.min.js
38
38
  *
39
39
  * Copyright (c) Facebook, Inc. and its affiliates.
40
40
  *
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
- */var na=Ai.exports,Ae=sf,me=vf.exports;function I(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)e+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!na)throw Error(I(227));function Lx(t,e,i,n,r,s,a,o,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(i,u)}catch(c){this.onError(c)}}var Vn=!1,gs=null,ms=!1,go=null,Rx={onError:function(t){Vn=!0,gs=t}};function jx(t,e,i,n,r,s,a,o,l){Vn=!1,gs=null,Lx.apply(Rx,arguments)}function _x(t,e,i,n,r,s,a,o,l){if(jx.apply(this,arguments),Vn){if(Vn){var u=gs;Vn=!1,gs=null}else throw Error(I(198));ms||(ms=!0,go=u)}}var Vl=null,yf=null,xf=null;function Mc(t,e,i){var n=t.type||"unknown-event";t.currentTarget=xf(i),_x(n,e,void 0,t),t.currentTarget=null}var vs=null,Li={};function Sf(){if(vs)for(var t in Li){var e=Li[t],i=vs.indexOf(t);if(!(-1<i))throw Error(I(96,t));if(!ws[i]){if(!e.extractEvents)throw Error(I(97,t));ws[i]=e,i=e.eventTypes;for(var n in i){var r=void 0,s=i[n],a=e,o=n;if(mo.hasOwnProperty(o))throw Error(I(99,o));mo[o]=s;var l=s.phasedRegistrationNames;if(l){for(r in l)l.hasOwnProperty(r)&&Ic(l[r],a,o);r=!0}else s.registrationName?(Ic(s.registrationName,a,o),r=!0):r=!1;if(!r)throw Error(I(98,n,t))}}}}function Ic(t,e,i){if(en[t])throw Error(I(100,t));en[t]=e,Ol[t]=e.eventTypes[i].dependencies}var ws=[],mo={},en={},Ol={};function Mf(t){var e=!1,i;for(i in t)if(t.hasOwnProperty(i)){var n=t[i];if(!Li.hasOwnProperty(i)||Li[i]!==n){if(Li[i])throw Error(I(102,i));Li[i]=n,e=!0}}e&&Sf()}var qt=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),vo=null,Fi=null,Qi=null;function Cc(t){if(t=yf(t)){if(typeof vo!="function")throw Error(I(280));var e=t.stateNode;e&&(e=Vl(e),vo(t.stateNode,t.type,e))}}function If(t){Fi?Qi?Qi.push(t):Qi=[t]:Fi=t}function Cf(){if(Fi){var t=Fi,e=Qi;if(Qi=Fi=null,Cc(t),e)for(t=0;t<e.length;t++)Cc(e[t])}}function Ul(t,e){return t(e)}function bf(t,e,i,n,r){return t(e,i,n,r)}function $l(){}var Af=Ul,ai=!1,Pa=!1;function Wl(){(Fi!==null||Qi!==null)&&($l(),Cf())}function Tf(t,e,i){if(Pa)return t(e,i);Pa=!0;try{return Af(t,e,i)}finally{Pa=!1,Wl()}}var Vx=/^[: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]*$/,bc=Object.prototype.hasOwnProperty,Ac={},Tc={};function Ox(t){return bc.call(Tc,t)?!0:bc.call(Ac,t)?!1:Vx.test(t)?Tc[t]=!0:(Ac[t]=!0,!1)}function Ux(t,e,i,n){if(i!==null&&i.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function $x(t,e,i,n){if(e===null||typeof e=="undefined"||Ux(t,e,i,n))return!0;if(n)return!1;if(i!==null)switch(i.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Te(t,e,i,n,r,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=r,this.mustUseProperty=i,this.propertyName=t,this.type=e,this.sanitizeURL=s}var ve={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){ve[t]=new Te(t,0,!1,t,null,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];ve[e]=new Te(e,1,!1,t[1],null,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){ve[t]=new Te(t,2,!1,t.toLowerCase(),null,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){ve[t]=new Te(t,2,!1,t,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(t){ve[t]=new Te(t,3,!1,t.toLowerCase(),null,!1)});["checked","multiple","muted","selected"].forEach(function(t){ve[t]=new Te(t,3,!0,t,null,!1)});["capture","download"].forEach(function(t){ve[t]=new Te(t,4,!1,t,null,!1)});["cols","rows","size","span"].forEach(function(t){ve[t]=new Te(t,6,!1,t,null,!1)});["rowSpan","start"].forEach(function(t){ve[t]=new Te(t,5,!1,t.toLowerCase(),null,!1)});var Hl=/[\-:]([a-z])/g;function Fl(t){return t[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(t){var e=t.replace(Hl,Fl);ve[e]=new Te(e,1,!1,t,null,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Hl,Fl);ve[e]=new Te(e,1,!1,t,"http://www.w3.org/1999/xlink",!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Hl,Fl);ve[e]=new Te(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1)});["tabIndex","crossOrigin"].forEach(function(t){ve[t]=new Te(t,1,!1,t.toLowerCase(),null,!1)});ve.xlinkHref=new Te("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0);["src","href","action","formAction"].forEach(function(t){ve[t]=new Te(t,1,!1,t.toLowerCase(),null,!0)});var et=na.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;et.hasOwnProperty("ReactCurrentDispatcher")||(et.ReactCurrentDispatcher={current:null});et.hasOwnProperty("ReactCurrentBatchConfig")||(et.ReactCurrentBatchConfig={suspense:null});function Ql(t,e,i,n){var r=ve.hasOwnProperty(e)?ve[e]:null,s=r!==null?r.type===0:n?!1:!(!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N");s||($x(e,i,r,n)&&(i=null),n||r===null?Ox(e)&&(i===null?t.removeAttribute(e):t.setAttribute(e,""+i)):r.mustUseProperty?t[r.propertyName]=i===null?r.type===3?!1:"":i:(e=r.attributeName,n=r.attributeNamespace,i===null?t.removeAttribute(e):(r=r.type,i=r===3||r===4&&i===!0?"":""+i,n?t.setAttributeNS(n,e,i):t.setAttribute(e,i))))}var Wx=/^(.*)[\\\/]/,Re=typeof Symbol=="function"&&Symbol.for,Dr=Re?Symbol.for("react.element"):60103,Ri=Re?Symbol.for("react.portal"):60106,si=Re?Symbol.for("react.fragment"):60107,Ef=Re?Symbol.for("react.strict_mode"):60108,Jr=Re?Symbol.for("react.profiler"):60114,Nf=Re?Symbol.for("react.provider"):60109,kf=Re?Symbol.for("react.context"):60110,Hx=Re?Symbol.for("react.concurrent_mode"):60111,Zl=Re?Symbol.for("react.forward_ref"):60112,Kr=Re?Symbol.for("react.suspense"):60113,wo=Re?Symbol.for("react.suspense_list"):60120,Yl=Re?Symbol.for("react.memo"):60115,Pf=Re?Symbol.for("react.lazy"):60116,Bf=Re?Symbol.for("react.block"):60121,Ec=typeof Symbol=="function"&&Symbol.iterator;function wn(t){return t===null||typeof t!="object"?null:(t=Ec&&t[Ec]||t["@@iterator"],typeof t=="function"?t:null)}function Fx(t){if(t._status===-1){t._status=0;var e=t._ctor;e=e(),t._result=e,e.then(function(i){t._status===0&&(i=i.default,t._status=1,t._result=i)},function(i){t._status===0&&(t._status=2,t._result=i)})}}function Et(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case si:return"Fragment";case Ri:return"Portal";case Jr:return"Profiler";case Ef:return"StrictMode";case Kr:return"Suspense";case wo:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case kf:return"Context.Consumer";case Nf:return"Context.Provider";case Zl:var e=t.render;return e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case Yl:return Et(t.type);case Bf:return Et(t.render);case Pf:if(t=t._status===1?t._result:null)return Et(t)}return null}function Gl(t){var e="";do{e:switch(t.tag){case 3:case 4:case 6:case 7:case 10:case 9:var i="";break e;default:var n=t._debugOwner,r=t._debugSource,s=Et(t.type);i=null,n&&(i=Et(n.type)),n=s,s="",r?s=" (at "+r.fileName.replace(Wx,"")+":"+r.lineNumber+")":i&&(s=" (created by "+i+")"),i=`
44
- in `+(n||"Unknown")+s}e+=i,t=t.return}while(t);return e}function Yt(t){switch(typeof t){case"boolean":case"number":case"object":case"string":case"undefined":return t;default:return""}}function zf(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Qx(t){var e=zf(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof i!="undefined"&&typeof i.get=="function"&&typeof i.set=="function"){var r=i.get,s=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(a){n=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Lr(t){t._valueTracker||(t._valueTracker=Qx(t))}function Df(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var i=e.getValue(),n="";return t&&(n=zf(t)?t.checked?"true":"false":t.value),t=n,t!==i?(e.setValue(t),!0):!1}function yo(t,e){var i=e.checked;return Ae({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i!=null?i:t._wrapperState.initialChecked})}function Nc(t,e){var i=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;i=Yt(e.value!=null?e.value:i),t._wrapperState={initialChecked:n,initialValue:i,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Lf(t,e){e=e.checked,e!=null&&Ql(t,"checked",e,!1)}function xo(t,e){Lf(t,e);var i=Yt(e.value),n=e.type;if(i!=null)n==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?So(t,e.type,i):e.hasOwnProperty("defaultValue")&&So(t,e.type,Yt(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function kc(t,e,i){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,i||e===t.value||(t.value=e),t.defaultValue=e}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function So(t,e,i){(e!=="number"||t.ownerDocument.activeElement!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}function Zx(t){var e="";return na.Children.forEach(t,function(i){i!=null&&(e+=i)}),e}function Mo(t,e){return t=Ae({children:void 0},e),(e=Zx(e.children))&&(t.children=e),t}function Zi(t,e,i,n){if(t=t.options,e){e={};for(var r=0;r<i.length;r++)e["$"+i[r]]=!0;for(i=0;i<t.length;i++)r=e.hasOwnProperty("$"+t[i].value),t[i].selected!==r&&(t[i].selected=r),r&&n&&(t[i].defaultSelected=!0)}else{for(i=""+Yt(i),e=null,r=0;r<t.length;r++){if(t[r].value===i){t[r].selected=!0,n&&(t[r].defaultSelected=!0);return}e!==null||t[r].disabled||(e=t[r])}e!==null&&(e.selected=!0)}}function Io(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(I(91));return Ae({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Pc(t,e){var i=e.value;if(i==null){if(i=e.children,e=e.defaultValue,i!=null){if(e!=null)throw Error(I(92));if(Array.isArray(i)){if(!(1>=i.length))throw Error(I(93));i=i[0]}e=i}e==null&&(e=""),i=e}t._wrapperState={initialValue:Yt(i)}}function Rf(t,e){var i=Yt(e.value),n=Yt(e.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),e.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),n!=null&&(t.defaultValue=""+n)}function Bc(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}var jf={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function _f(t){switch(t){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 Co(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?_f(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Rr,Vf=function(t){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(e,i,n,r){MSApp.execUnsafeLocalFunction(function(){return t(e,i,n,r)})}:t}(function(t,e){if(t.namespaceURI!==jf.svg||"innerHTML"in t)t.innerHTML=e;else{for(Rr=Rr||document.createElement("div"),Rr.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Rr.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Kn(t,e){if(e){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=e;return}}t.textContent=e}function jr(t,e){var i={};return i[t.toLowerCase()]=e.toLowerCase(),i["Webkit"+t]="webkit"+e,i["Moz"+t]="moz"+e,i}var ji={animationend:jr("Animation","AnimationEnd"),animationiteration:jr("Animation","AnimationIteration"),animationstart:jr("Animation","AnimationStart"),transitionend:jr("Transition","TransitionEnd")},Ba={},Of={};qt&&(Of=document.createElement("div").style,"AnimationEvent"in window||(delete ji.animationend.animation,delete ji.animationiteration.animation,delete ji.animationstart.animation),"TransitionEvent"in window||delete ji.transitionend.transition);function ra(t){if(Ba[t])return Ba[t];if(!ji[t])return t;var e=ji[t],i;for(i in e)if(e.hasOwnProperty(i)&&i in Of)return Ba[t]=e[i];return t}var Uf=ra("animationend"),$f=ra("animationiteration"),Wf=ra("animationstart"),Hf=ra("transitionend"),Nn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),zc=new(typeof WeakMap=="function"?WeakMap:Map);function Xl(t){var e=zc.get(t);return e===void 0&&(e=new Map,zc.set(t,e)),e}function Ti(t){var e=t,i=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.effectTag&1026)!==0&&(i=e.return),t=e.return;while(t)}return e.tag===3?i:null}function Ff(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Dc(t){if(Ti(t)!==t)throw Error(I(188))}function Yx(t){var e=t.alternate;if(!e){if(e=Ti(t),e===null)throw Error(I(188));return e!==t?null:t}for(var i=t,n=e;;){var r=i.return;if(r===null)break;var s=r.alternate;if(s===null){if(n=r.return,n!==null){i=n;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===i)return Dc(r),t;if(s===n)return Dc(r),e;s=s.sibling}throw Error(I(188))}if(i.return!==n.return)i=r,n=s;else{for(var a=!1,o=r.child;o;){if(o===i){a=!0,i=r,n=s;break}if(o===n){a=!0,n=r,i=s;break}o=o.sibling}if(!a){for(o=s.child;o;){if(o===i){a=!0,i=s,n=r;break}if(o===n){a=!0,n=s,i=r;break}o=o.sibling}if(!a)throw Error(I(189))}}if(i.alternate!==n)throw Error(I(190))}if(i.tag!==3)throw Error(I(188));return i.stateNode.current===i?t:e}function Qf(t){if(t=Yx(t),!t)return null;for(var e=t;;){if(e.tag===5||e.tag===6)return e;if(e.child)e.child.return=e,e=e.child;else{if(e===t)break;for(;!e.sibling;){if(!e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}}return null}function tn(t,e){if(e==null)throw Error(I(30));return t==null?e:Array.isArray(t)?Array.isArray(e)?(t.push.apply(t,e),t):(t.push(e),t):Array.isArray(e)?[t].concat(e):[t,e]}function Jl(t,e,i){Array.isArray(t)?t.forEach(e,i):t&&e.call(i,t)}var yn=null;function Gx(t){if(t){var e=t._dispatchListeners,i=t._dispatchInstances;if(Array.isArray(e))for(var n=0;n<e.length&&!t.isPropagationStopped();n++)Mc(t,e[n],i[n]);else e&&Mc(t,e,i);t._dispatchListeners=null,t._dispatchInstances=null,t.isPersistent()||t.constructor.release(t)}}function sa(t){if(t!==null&&(yn=tn(yn,t)),t=yn,yn=null,t){if(Jl(t,Gx),yn)throw Error(I(95));if(ms)throw t=go,ms=!1,go=null,t}}function Kl(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}function Zf(t){if(!qt)return!1;t="on"+t;var e=t in document;return e||(e=document.createElement("div"),e.setAttribute(t,"return;"),e=typeof e[t]=="function"),e}var ys=[];function Yf(t){t.topLevelType=null,t.nativeEvent=null,t.targetInst=null,t.ancestors.length=0,10>ys.length&&ys.push(t)}function Gf(t,e,i,n){if(ys.length){var r=ys.pop();return r.topLevelType=t,r.eventSystemFlags=n,r.nativeEvent=e,r.targetInst=i,r}return{topLevelType:t,eventSystemFlags:n,nativeEvent:e,targetInst:i,ancestors:[]}}function Xf(t){var e=t.targetInst,i=e;do{if(!i){t.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;e=i.tag,e!==5&&e!==6||t.ancestors.push(i),i=wr(n)}while(i);for(i=0;i<t.ancestors.length;i++){e=t.ancestors[i];var r=Kl(t.nativeEvent);n=t.topLevelType;var s=t.nativeEvent,a=t.eventSystemFlags;i===0&&(a|=64);for(var o=null,l=0;l<ws.length;l++){var u=ws[l];u&&(u=u.extractEvents(n,e,s,r,a))&&(o=tn(o,u))}sa(o)}}function bo(t,e,i){if(!i.has(t)){switch(t){case"scroll":kn(e,"scroll",!0);break;case"focus":case"blur":kn(e,"focus",!0),kn(e,"blur",!0),i.set("blur",null),i.set("focus",null);break;case"cancel":case"close":Zf(t)&&kn(e,t,!0);break;case"invalid":case"submit":case"reset":break;default:Nn.indexOf(t)===-1&&ne(t,e)}i.set(t,null)}}var Jf,ql,Kf,Ao=!1,dt=[],Ut=null,$t=null,Wt=null,qn=new Map,er=new Map,xn=[],To="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(" "),Xx="focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture".split(" ");function Jx(t,e){var i=Xl(e);To.forEach(function(n){bo(n,e,i)}),Xx.forEach(function(n){bo(n,e,i)})}function Eo(t,e,i,n,r){return{blockedOn:t,topLevelType:e,eventSystemFlags:i|32,nativeEvent:r,container:n}}function Lc(t,e){switch(t){case"focus":case"blur":Ut=null;break;case"dragenter":case"dragleave":$t=null;break;case"mouseover":case"mouseout":Wt=null;break;case"pointerover":case"pointerout":qn.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":er.delete(e.pointerId)}}function Sn(t,e,i,n,r,s){return t===null||t.nativeEvent!==s?(t=Eo(e,i,n,r,s),e!==null&&(e=yr(e),e!==null&&ql(e)),t):(t.eventSystemFlags|=n,t)}function Kx(t,e,i,n,r){switch(e){case"focus":return Ut=Sn(Ut,t,e,i,n,r),!0;case"dragenter":return $t=Sn($t,t,e,i,n,r),!0;case"mouseover":return Wt=Sn(Wt,t,e,i,n,r),!0;case"pointerover":var s=r.pointerId;return qn.set(s,Sn(qn.get(s)||null,t,e,i,n,r)),!0;case"gotpointercapture":return s=r.pointerId,er.set(s,Sn(er.get(s)||null,t,e,i,n,r)),!0}return!1}function qx(t){var e=wr(t.target);if(e!==null){var i=Ti(e);if(i!==null){if(e=i.tag,e===13){if(e=Ff(i),e!==null){t.blockedOn=e,me.unstable_runWithPriority(t.priority,function(){Kf(i)});return}}else if(e===3&&i.stateNode.hydrate){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function qr(t){if(t.blockedOn!==null)return!1;var e=iu(t.topLevelType,t.eventSystemFlags,t.container,t.nativeEvent);if(e!==null){var i=yr(e);return i!==null&&ql(i),t.blockedOn=e,!1}return!0}function Rc(t,e,i){qr(t)&&i.delete(e)}function e0(){for(Ao=!1;0<dt.length;){var t=dt[0];if(t.blockedOn!==null){t=yr(t.blockedOn),t!==null&&Jf(t);break}var e=iu(t.topLevelType,t.eventSystemFlags,t.container,t.nativeEvent);e!==null?t.blockedOn=e:dt.shift()}Ut!==null&&qr(Ut)&&(Ut=null),$t!==null&&qr($t)&&($t=null),Wt!==null&&qr(Wt)&&(Wt=null),qn.forEach(Rc),er.forEach(Rc)}function Mn(t,e){t.blockedOn===e&&(t.blockedOn=null,Ao||(Ao=!0,me.unstable_scheduleCallback(me.unstable_NormalPriority,e0)))}function qf(t){function e(r){return Mn(r,t)}if(0<dt.length){Mn(dt[0],t);for(var i=1;i<dt.length;i++){var n=dt[i];n.blockedOn===t&&(n.blockedOn=null)}}for(Ut!==null&&Mn(Ut,t),$t!==null&&Mn($t,t),Wt!==null&&Mn(Wt,t),qn.forEach(e),er.forEach(e),i=0;i<xn.length;i++)n=xn[i],n.blockedOn===t&&(n.blockedOn=null);for(;0<xn.length&&(i=xn[0],i.blockedOn===null);)qx(i),i.blockedOn===null&&xn.shift()}var ep={},tp=new Map,eu=new Map,t0=["abort","abort",Uf,"animationEnd",$f,"animationIteration",Wf,"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",Hf,"transitionEnd","waiting","waiting"];function tu(t,e){for(var i=0;i<t.length;i+=2){var n=t[i],r=t[i+1],s="on"+(r[0].toUpperCase()+r.slice(1));s={phasedRegistrationNames:{bubbled:s,captured:s+"Capture"},dependencies:[n],eventPriority:e},eu.set(n,e),tp.set(n,s),ep[r]=s}}tu("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);tu("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);tu(t0,2);for(var jc="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),za=0;za<jc.length;za++)eu.set(jc[za],0);var i0=me.unstable_UserBlockingPriority,n0=me.unstable_runWithPriority,es=!0;function ne(t,e){kn(e,t,!1)}function kn(t,e,i){var n=eu.get(e);switch(n===void 0?2:n){case 0:n=r0.bind(null,e,1,t);break;case 1:n=s0.bind(null,e,1,t);break;default:n=aa.bind(null,e,1,t)}i?t.addEventListener(e,n,!0):t.addEventListener(e,n,!1)}function r0(t,e,i,n){ai||$l();var r=aa,s=ai;ai=!0;try{bf(r,t,e,i,n)}finally{(ai=s)||Wl()}}function s0(t,e,i,n){n0(i0,aa.bind(null,t,e,i,n))}function aa(t,e,i,n){if(es)if(0<dt.length&&-1<To.indexOf(t))t=Eo(null,t,e,i,n),dt.push(t);else{var r=iu(t,e,i,n);if(r===null)Lc(t,n);else if(-1<To.indexOf(t))t=Eo(r,t,e,i,n),dt.push(t);else if(!Kx(r,t,e,i,n)){Lc(t,n),t=Gf(t,n,null,e);try{Tf(Xf,t)}finally{Yf(t)}}}}function iu(t,e,i,n){if(i=Kl(n),i=wr(i),i!==null){var r=Ti(i);if(r===null)i=null;else{var s=r.tag;if(s===13){if(i=Ff(r),i!==null)return i;i=null}else if(s===3){if(r.stateNode.hydrate)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}t=Gf(t,n,i,e);try{Tf(Xf,t)}finally{Yf(t)}return null}var On={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},a0=["Webkit","ms","Moz","O"];Object.keys(On).forEach(function(t){a0.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),On[e]=On[t]})});function ip(t,e,i){return e==null||typeof e=="boolean"||e===""?"":i||typeof e!="number"||e===0||On.hasOwnProperty(t)&&On[t]?(""+e).trim():e+"px"}function np(t,e){t=t.style;for(var i in e)if(e.hasOwnProperty(i)){var n=i.indexOf("--")===0,r=ip(i,e[i],n);i==="float"&&(i="cssFloat"),n?t.setProperty(i,r):t[i]=r}}var o0=Ae({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 No(t,e){if(e){if(o0[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(I(137,t,""));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(I(60));if(!(typeof e.dangerouslySetInnerHTML=="object"&&"__html"in e.dangerouslySetInnerHTML))throw Error(I(61))}if(e.style!=null&&typeof e.style!="object")throw Error(I(62,""))}}function ko(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 _c=jf.html;function xt(t,e){t=t.nodeType===9||t.nodeType===11?t:t.ownerDocument;var i=Xl(t);e=Ol[e];for(var n=0;n<e.length;n++)bo(e[n],t,i)}function xs(){}function Po(t){if(t=t||(typeof document!="undefined"?document:void 0),typeof t=="undefined")return null;try{return t.activeElement||t.body}catch{return t.body}}function Vc(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Oc(t,e){var i=Vc(t);t=0;for(var n;i;){if(i.nodeType===3){if(n=t+i.textContent.length,t<=e&&n>=e)return{node:i,offset:e-t};t=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Vc(i)}}function rp(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?rp(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Uc(){for(var t=window,e=Po();e instanceof t.HTMLIFrameElement;){try{var i=typeof e.contentWindow.location.href=="string"}catch{i=!1}if(i)t=e.contentWindow;else break;e=Po(t.document)}return e}function Bo(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var sp="$",ap="/$",nu="$?",ru="$!",Da=null,La=null;function op(t,e){switch(t){case"button":case"input":case"select":case"textarea":return!!e.autoFocus}return!1}function zo(t,e){return t==="textarea"||t==="option"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Ra=typeof setTimeout=="function"?setTimeout:void 0,l0=typeof clearTimeout=="function"?clearTimeout:void 0;function Yi(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break}return t}function $c(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var i=t.data;if(i===sp||i===ru||i===nu){if(e===0)return t;e--}else i===ap&&e++}t=t.previousSibling}return null}var su=Math.random().toString(36).slice(2),Dt="__reactInternalInstance$"+su,Ss="__reactEventHandlers$"+su,vr="__reactContainere$"+su;function wr(t){var e=t[Dt];if(e)return e;for(var i=t.parentNode;i;){if(e=i[vr]||i[Dt]){if(i=e.alternate,e.child!==null||i!==null&&i.child!==null)for(t=$c(t);t!==null;){if(i=t[Dt])return i;t=$c(t)}return e}t=i,i=t.parentNode}return null}function yr(t){return t=t[Dt]||t[vr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function xi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(I(33))}function au(t){return t[Ss]||null}function St(t){do t=t.return;while(t&&t.tag!==5);return t||null}function lp(t,e){var i=t.stateNode;if(!i)return null;var n=Vl(i);if(!n)return null;i=n[e];e:switch(e){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)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(I(231,e,typeof i));return i}function Wc(t,e,i){(e=lp(t,i.dispatchConfig.phasedRegistrationNames[e]))&&(i._dispatchListeners=tn(i._dispatchListeners,e),i._dispatchInstances=tn(i._dispatchInstances,t))}function u0(t){if(t&&t.dispatchConfig.phasedRegistrationNames){for(var e=t._targetInst,i=[];e;)i.push(e),e=St(e);for(e=i.length;0<e--;)Wc(i[e],"captured",t);for(e=0;e<i.length;e++)Wc(i[e],"bubbled",t)}}function Do(t,e,i){t&&i&&i.dispatchConfig.registrationName&&(e=lp(t,i.dispatchConfig.registrationName))&&(i._dispatchListeners=tn(i._dispatchListeners,e),i._dispatchInstances=tn(i._dispatchInstances,t))}function c0(t){t&&t.dispatchConfig.registrationName&&Do(t._targetInst,null,t)}function nn(t){Jl(t,u0)}var Lt=null,ou=null,ts=null;function up(){if(ts)return ts;var t,e=ou,i=e.length,n,r="value"in Lt?Lt.value:Lt.textContent,s=r.length;for(t=0;t<i&&e[t]===r[t];t++);var a=i-t;for(n=1;n<=a&&e[i-n]===r[s-n];n++);return ts=r.slice(t,1<n?1-n:void 0)}function is(){return!0}function Ms(){return!1}function He(t,e,i,n){this.dispatchConfig=t,this._targetInst=e,this.nativeEvent=i,t=this.constructor.Interface;for(var r in t)t.hasOwnProperty(r)&&((e=t[r])?this[r]=e(i):r==="target"?this.target=n:this[r]=i[r]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?is:Ms,this.isPropagationStopped=Ms,this}Ae(He.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=is)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=is)},persist:function(){this.isPersistent=is},isPersistent:Ms,destructor:function(){var t=this.constructor.Interface,e;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=Ms,this._dispatchInstances=this._dispatchListeners=null}});He.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};He.extend=function(t){function e(){}function i(){return n.apply(this,arguments)}var n=this;e.prototype=n.prototype;var r=new e;return Ae(r,i.prototype),i.prototype=r,i.prototype.constructor=i,i.Interface=Ae({},n.Interface,t),i.extend=n.extend,cp(i),i};cp(He);function h0(t,e,i,n){if(this.eventPool.length){var r=this.eventPool.pop();return this.call(r,t,e,i,n),r}return new this(t,e,i,n)}function d0(t){if(!(t instanceof this))throw Error(I(279));t.destructor(),10>this.eventPool.length&&this.eventPool.push(t)}function cp(t){t.eventPool=[],t.getPooled=h0,t.release=d0}var f0=He.extend({data:null}),p0=He.extend({data:null}),g0=[9,13,27,32],lu=qt&&"CompositionEvent"in window,Un=null;qt&&"documentMode"in document&&(Un=document.documentMode);var m0=qt&&"TextEvent"in window&&!Un,hp=qt&&(!lu||Un&&8<Un&&11>=Un),Hc=String.fromCharCode(32),yt={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(" ")}},Fc=!1;function dp(t,e){switch(t){case"keyup":return g0.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function fp(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var _i=!1;function v0(t,e){switch(t){case"compositionend":return fp(e);case"keypress":return e.which!==32?null:(Fc=!0,Hc);case"textInput":return t=e.data,t===Hc&&Fc?null:t;default:return null}}function w0(t,e){if(_i)return t==="compositionend"||!lu&&dp(t,e)?(t=up(),ts=ou=Lt=null,_i=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return hp&&e.locale!=="ko"?null:e.data;default:return null}}var y0={eventTypes:yt,extractEvents:function(t,e,i,n){var r;if(lu)e:{switch(t){case"compositionstart":var s=yt.compositionStart;break e;case"compositionend":s=yt.compositionEnd;break e;case"compositionupdate":s=yt.compositionUpdate;break e}s=void 0}else _i?dp(t,i)&&(s=yt.compositionEnd):t==="keydown"&&i.keyCode===229&&(s=yt.compositionStart);return s?(hp&&i.locale!=="ko"&&(_i||s!==yt.compositionStart?s===yt.compositionEnd&&_i&&(r=up()):(Lt=n,ou="value"in Lt?Lt.value:Lt.textContent,_i=!0)),s=f0.getPooled(s,e,i,n),r?s.data=r:(r=fp(i),r!==null&&(s.data=r)),nn(s),r=s):r=null,(t=m0?v0(t,i):w0(t,i))?(e=p0.getPooled(yt.beforeInput,e,i,n),e.data=t,nn(e)):e=null,r===null?e:e===null?r:[r,e]}},x0={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 pp(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!x0[t.type]:e==="textarea"}var gp={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function mp(t,e,i){return t=He.getPooled(gp.change,t,e,i),t.type="change",If(i),nn(t),t}var $n=null,tr=null;function S0(t){sa(t)}function oa(t){var e=xi(t);if(Df(e))return t}function M0(t,e){if(t==="change")return e}var Lo=!1;qt&&(Lo=Zf("input")&&(!document.documentMode||9<document.documentMode));function Qc(){$n&&($n.detachEvent("onpropertychange",vp),tr=$n=null)}function vp(t){if(t.propertyName==="value"&&oa(tr))if(t=mp(tr,t,Kl(t)),ai)sa(t);else{ai=!0;try{Ul(S0,t)}finally{ai=!1,Wl()}}}function I0(t,e,i){t==="focus"?(Qc(),$n=e,tr=i,$n.attachEvent("onpropertychange",vp)):t==="blur"&&Qc()}function C0(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return oa(tr)}function b0(t,e){if(t==="click")return oa(e)}function A0(t,e){if(t==="input"||t==="change")return oa(e)}var T0={eventTypes:gp,_isInputEventSupported:Lo,extractEvents:function(t,e,i,n){var r=e?xi(e):window,s=r.nodeName&&r.nodeName.toLowerCase();if(s==="select"||s==="input"&&r.type==="file")var a=M0;else if(pp(r))if(Lo)a=A0;else{a=C0;var o=I0}else(s=r.nodeName)&&s.toLowerCase()==="input"&&(r.type==="checkbox"||r.type==="radio")&&(a=b0);if(a&&(a=a(t,e)))return mp(a,i,n);o&&o(t,r,e),t==="blur"&&(t=r._wrapperState)&&t.controlled&&r.type==="number"&&So(r,"number",r.value)}},xr=He.extend({view:null,detail:null}),E0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function N0(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=E0[t])?!!e[t]:!1}function uu(){return N0}var Zc=0,Yc=0,Gc=!1,Xc=!1,Sr=xr.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:uu,button:null,buttons:null,relatedTarget:function(t){return t.relatedTarget||(t.fromElement===t.srcElement?t.toElement:t.fromElement)},movementX:function(t){if("movementX"in t)return t.movementX;var e=Zc;return Zc=t.screenX,Gc?t.type==="mousemove"?t.screenX-e:0:(Gc=!0,0)},movementY:function(t){if("movementY"in t)return t.movementY;var e=Yc;return Yc=t.screenY,Xc?t.type==="mousemove"?t.screenY-e:0:(Xc=!0,0)}}),wp=Sr.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),In={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},k0={eventTypes:In,extractEvents:function(t,e,i,n,r){var s=t==="mouseover"||t==="pointerover",a=t==="mouseout"||t==="pointerout";if(s&&(r&32)===0&&(i.relatedTarget||i.fromElement)||!a&&!s)return null;if(s=n.window===n?n:(s=n.ownerDocument)?s.defaultView||s.parentWindow:window,a){if(a=e,e=(e=i.relatedTarget||i.toElement)?wr(e):null,e!==null){var o=Ti(e);(e!==o||e.tag!==5&&e.tag!==6)&&(e=null)}}else a=null;if(a===e)return null;if(t==="mouseout"||t==="mouseover")var l=Sr,u=In.mouseLeave,c=In.mouseEnter,h="mouse";else(t==="pointerout"||t==="pointerover")&&(l=wp,u=In.pointerLeave,c=In.pointerEnter,h="pointer");if(t=a==null?s:xi(a),s=e==null?s:xi(e),u=l.getPooled(u,a,i,n),u.type=h+"leave",u.target=t,u.relatedTarget=s,i=l.getPooled(c,e,i,n),i.type=h+"enter",i.target=s,i.relatedTarget=t,n=a,h=e,n&&h)e:{for(l=n,c=h,a=0,t=l;t;t=St(t))a++;for(t=0,e=c;e;e=St(e))t++;for(;0<a-t;)l=St(l),a--;for(;0<t-a;)c=St(c),t--;for(;a--;){if(l===c||l===c.alternate)break e;l=St(l),c=St(c)}l=null}else l=null;for(c=l,l=[];n&&n!==c&&(a=n.alternate,!(a!==null&&a===c));)l.push(n),n=St(n);for(n=[];h&&h!==c&&(a=h.alternate,!(a!==null&&a===c));)n.push(h),h=St(h);for(h=0;h<l.length;h++)Do(l[h],"bubbled",u);for(h=n.length;0<h--;)Do(n[h],"captured",i);return(r&64)===0?[u]:[u,i]}};function P0(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Si=typeof Object.is=="function"?Object.is:P0,B0=Object.prototype.hasOwnProperty;function ir(t,e){if(Si(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(n=0;n<i.length;n++)if(!B0.call(e,i[n])||!Si(t[i[n]],e[i[n]]))return!1;return!0}var z0=qt&&"documentMode"in document&&11>=document.documentMode,yp={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Vi=null,Ro=null,Wn=null,jo=!1;function Jc(t,e){var i=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;return jo||Vi==null||Vi!==Po(i)?null:(i=Vi,"selectionStart"in i&&Bo(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}),Wn&&ir(Wn,i)?null:(Wn=i,t=He.getPooled(yp.select,Ro,t,e),t.type="select",t.target=Vi,nn(t),t))}var D0={eventTypes:yp,extractEvents:function(t,e,i,n,r,s){if(r=s||(n.window===n?n.document:n.nodeType===9?n:n.ownerDocument),!(s=!r)){e:{r=Xl(r),s=Ol.onSelect;for(var a=0;a<s.length;a++)if(!r.has(s[a])){r=!1;break e}r=!0}s=!r}if(s)return null;switch(r=e?xi(e):window,t){case"focus":(pp(r)||r.contentEditable==="true")&&(Vi=r,Ro=e,Wn=null);break;case"blur":Wn=Ro=Vi=null;break;case"mousedown":jo=!0;break;case"contextmenu":case"mouseup":case"dragend":return jo=!1,Jc(i,n);case"selectionchange":if(z0)break;case"keydown":case"keyup":return Jc(i,n)}return null}},L0=He.extend({animationName:null,elapsedTime:null,pseudoElement:null}),R0=He.extend({clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),j0=xr.extend({relatedTarget:null});function ns(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}var _0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},V0={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"},O0=xr.extend({key:function(t){if(t.key){var e=_0[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=ns(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?V0[t.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:uu,charCode:function(t){return t.type==="keypress"?ns(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ns(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),U0=Sr.extend({dataTransfer:null}),$0=xr.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:uu}),W0=He.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),H0=Sr.extend({deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:null,deltaMode:null}),F0={eventTypes:ep,extractEvents:function(t,e,i,n){var r=tp.get(t);if(!r)return null;switch(t){case"keypress":if(ns(i)===0)return null;case"keydown":case"keyup":t=O0;break;case"blur":case"focus":t=j0;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":t=Sr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":t=U0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":t=$0;break;case Uf:case $f:case Wf:t=L0;break;case Hf:t=W0;break;case"scroll":t=xr;break;case"wheel":t=H0;break;case"copy":case"cut":case"paste":t=R0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":t=wp;break;default:t=He}return e=t.getPooled(r,e,i,n),nn(e),e}};if(vs)throw Error(I(101));vs=Array.prototype.slice.call("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));Sf();var Q0=yr;Vl=au;yf=Q0;xf=xi;Mf({SimpleEventPlugin:F0,EnterLeaveEventPlugin:k0,ChangeEventPlugin:T0,SelectEventPlugin:D0,BeforeInputEventPlugin:y0});var _o=[],Oi=-1;function ee(t){0>Oi||(t.current=_o[Oi],_o[Oi]=null,Oi--)}function oe(t,e){Oi++,_o[Oi]=t.current,t.current=e}var Gt={},Me={current:Gt},ze={current:!1},Mi=Gt;function rn(t,e){var i=t.type.contextTypes;if(!i)return Gt;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in i)r[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function De(t){return t=t.childContextTypes,t!=null}function Is(){ee(ze),ee(Me)}function Kc(t,e,i){if(Me.current!==Gt)throw Error(I(168));oe(Me,e),oe(ze,i)}function xp(t,e,i){var n=t.stateNode;if(t=e.childContextTypes,typeof n.getChildContext!="function")return i;n=n.getChildContext();for(var r in n)if(!(r in t))throw Error(I(108,Et(e)||"Unknown",r));return Ae({},i,{},n)}function rs(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Gt,Mi=Me.current,oe(Me,t),oe(ze,ze.current),!0}function qc(t,e,i){var n=t.stateNode;if(!n)throw Error(I(169));i?(t=xp(t,e,Mi),n.__reactInternalMemoizedMergedChildContext=t,ee(ze),ee(Me),oe(Me,t)):ee(ze),oe(ze,i)}var Z0=me.unstable_runWithPriority,cu=me.unstable_scheduleCallback,Sp=me.unstable_cancelCallback,eh=me.unstable_requestPaint,Vo=me.unstable_now,Y0=me.unstable_getCurrentPriorityLevel,la=me.unstable_ImmediatePriority,Mp=me.unstable_UserBlockingPriority,Ip=me.unstable_NormalPriority,Cp=me.unstable_LowPriority,bp=me.unstable_IdlePriority,Ap={},G0=me.unstable_shouldYield,X0=eh!==void 0?eh:function(){},It=null,ss=null,ja=!1,th=Vo(),Qe=1e4>th?Vo:function(){return Vo()-th};function ua(){switch(Y0()){case la:return 99;case Mp:return 98;case Ip:return 97;case Cp:return 96;case bp:return 95;default:throw Error(I(332))}}function Tp(t){switch(t){case 99:return la;case 98:return Mp;case 97:return Ip;case 96:return Cp;case 95:return bp;default:throw Error(I(332))}}function Xt(t,e){return t=Tp(t),Z0(t,e)}function Ep(t,e,i){return t=Tp(t),cu(t,e,i)}function ih(t){return It===null?(It=[t],ss=cu(la,Np)):It.push(t),Ap}function wt(){if(ss!==null){var t=ss;ss=null,Sp(t)}Np()}function Np(){if(!ja&&It!==null){ja=!0;var t=0;try{var e=It;Xt(99,function(){for(;t<e.length;t++){var i=e[t];do i=i(!0);while(i!==null)}}),It=null}catch(i){throw It!==null&&(It=It.slice(t+1)),cu(la,wt),i}finally{ja=!1}}}function as(t,e,i){return i/=10,1073741821-(((1073741821-t+e/10)/i|0)+1)*i}function Ke(t,e){if(t&&t.defaultProps){e=Ae({},e),t=t.defaultProps;for(var i in t)e[i]===void 0&&(e[i]=t[i])}return e}var Cs={current:null},bs=null,Ui=null,As=null;function hu(){As=Ui=bs=null}function du(t){var e=Cs.current;ee(Cs),t.type._context._currentValue=e}function kp(t,e){for(;t!==null;){var i=t.alternate;if(t.childExpirationTime<e)t.childExpirationTime=e,i!==null&&i.childExpirationTime<e&&(i.childExpirationTime=e);else if(i!==null&&i.childExpirationTime<e)i.childExpirationTime=e;else break;t=t.return}}function Gi(t,e){bs=t,As=Ui=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.expirationTime>=e&&(ft=!0),t.firstContext=null)}function Ye(t,e){if(As!==t&&e!==!1&&e!==0)if((typeof e!="number"||e===1073741823)&&(As=t,e=1073741823),e={context:t,observedBits:e,next:null},Ui===null){if(bs===null)throw Error(I(308));Ui=e,bs.dependencies={expirationTime:0,firstContext:e,responders:null}}else Ui=Ui.next=e;return t._currentValue}var zt=!1;function fu(t){t.updateQueue={baseState:t.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function pu(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,baseQueue:t.baseQueue,shared:t.shared,effects:t.effects})}function Ht(t,e){return t={expirationTime:t,suspenseConfig:e,tag:0,payload:null,callback:null,next:null},t.next=t}function Ft(t,e){if(t=t.updateQueue,t!==null){t=t.shared;var i=t.pending;i===null?e.next=e:(e.next=i.next,i.next=e),t.pending=e}}function nh(t,e){var i=t.alternate;i!==null&&pu(i,t),t=t.updateQueue,i=t.baseQueue,i===null?(t.baseQueue=e.next=e,e.next=e):(e.next=i.next,i.next=e)}function nr(t,e,i,n){var r=t.updateQueue;zt=!1;var s=r.baseQueue,a=r.shared.pending;if(a!==null){if(s!==null){var o=s.next;s.next=a.next,a.next=o}s=a,r.shared.pending=null,o=t.alternate,o!==null&&(o=o.updateQueue,o!==null&&(o.baseQueue=a))}if(s!==null){o=s.next;var l=r.baseState,u=0,c=null,h=null,m=null;if(o!==null){var v=o;do{if(a=v.expirationTime,a<n){var w={expirationTime:v.expirationTime,suspenseConfig:v.suspenseConfig,tag:v.tag,payload:v.payload,callback:v.callback,next:null};m===null?(h=m=w,c=l):m=m.next=w,a>u&&(u=a)}else{m!==null&&(m=m.next={expirationTime:1073741823,suspenseConfig:v.suspenseConfig,tag:v.tag,payload:v.payload,callback:v.callback,next:null}),ag(a,v.suspenseConfig);e:{var M=t,d=v;switch(a=e,w=i,d.tag){case 1:if(M=d.payload,typeof M=="function"){l=M.call(w,l,a);break e}l=M;break e;case 3:M.effectTag=M.effectTag&-4097|64;case 0:if(M=d.payload,a=typeof M=="function"?M.call(w,l,a):M,a==null)break e;l=Ae({},l,a);break e;case 2:zt=!0}}v.callback!==null&&(t.effectTag|=32,a=r.effects,a===null?r.effects=[v]:a.push(v))}if(v=v.next,v===null||v===o){if(a=r.shared.pending,a===null)break;v=s.next=a.next,a.next=o,r.baseQueue=s=a,r.shared.pending=null}}while(1)}m===null?c=l:m.next=h,r.baseState=c,r.baseQueue=m,pa(u),t.expirationTime=u,t.memoizedState=l}}function rh(t,e,i){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],r=n.callback;if(r!==null){if(n.callback=null,n=r,r=i,typeof n!="function")throw Error(I(191,n));n.call(r)}}}var Hn=et.ReactCurrentBatchConfig,Pp=new na.Component().refs;function Ts(t,e,i,n){e=t.memoizedState,i=i(n,e),i=i==null?e:Ae({},e,i),t.memoizedState=i,t.expirationTime===0&&(t.updateQueue.baseState=i)}var ca={isMounted:function(t){return(t=t._reactInternalFiber)?Ti(t)===t:!1},enqueueSetState:function(t,e,i){t=t._reactInternalFiber;var n=mt(),r=Hn.suspense;n=mi(n,t,r),r=Ht(n,r),r.payload=e,i!=null&&(r.callback=i),Ft(t,r),Zt(t,n)},enqueueReplaceState:function(t,e,i){t=t._reactInternalFiber;var n=mt(),r=Hn.suspense;n=mi(n,t,r),r=Ht(n,r),r.tag=1,r.payload=e,i!=null&&(r.callback=i),Ft(t,r),Zt(t,n)},enqueueForceUpdate:function(t,e){t=t._reactInternalFiber;var i=mt(),n=Hn.suspense;i=mi(i,t,n),n=Ht(i,n),n.tag=2,e!=null&&(n.callback=e),Ft(t,n),Zt(t,i)}};function sh(t,e,i,n,r,s,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,s,a):e.prototype&&e.prototype.isPureReactComponent?!ir(i,n)||!ir(r,s):!0}function Bp(t,e,i){var n=!1,r=Gt,s=e.contextType;return typeof s=="object"&&s!==null?s=Ye(s):(r=De(e)?Mi:Me.current,n=e.contextTypes,s=(n=n!=null)?rn(t,r):Gt),e=new e(i,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=ca,t.stateNode=e,e._reactInternalFiber=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=s),e}function ah(t,e,i,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(i,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(i,n),e.state!==t&&ca.enqueueReplaceState(e,e.state,null)}function Oo(t,e,i,n){var r=t.stateNode;r.props=i,r.state=t.memoizedState,r.refs=Pp,fu(t);var s=e.contextType;typeof s=="object"&&s!==null?r.context=Ye(s):(s=De(e)?Mi:Me.current,r.context=rn(t,s)),nr(t,i,r,n),r.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(Ts(t,e,s,i),r.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&ca.enqueueReplaceState(r,r.state,null),nr(t,i,r,n),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.effectTag|=4)}var _r=Array.isArray;function Cn(t,e,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(I(309));var n=i.stateNode}if(!n)throw Error(I(147,t));var r=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===r?e.ref:(e=function(s){var a=n.refs;a===Pp&&(a=n.refs={}),s===null?delete a[r]:a[r]=s},e._stringRef=r,e)}if(typeof t!="string")throw Error(I(284));if(!i._owner)throw Error(I(290,t))}return t}function Vr(t,e){if(t.type!=="textarea")throw Error(I(31,Object.prototype.toString.call(e)==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":e,""))}function zp(t){function e(d,f){if(t){var p=d.lastEffect;p!==null?(p.nextEffect=f,d.lastEffect=f):d.firstEffect=d.lastEffect=f,f.nextEffect=null,f.effectTag=8}}function i(d,f){if(!t)return null;for(;f!==null;)e(d,f),f=f.sibling;return null}function n(d,f){for(d=new Map;f!==null;)f.key!==null?d.set(f.key,f):d.set(f.index,f),f=f.sibling;return d}function r(d,f){return d=Ii(d,f),d.index=0,d.sibling=null,d}function s(d,f,p){return d.index=p,t?(p=d.alternate,p!==null?(p=p.index,p<f?(d.effectTag=2,f):p):(d.effectTag=2,f)):f}function a(d){return t&&d.alternate===null&&(d.effectTag=2),d}function o(d,f,p,g){return f===null||f.tag!==6?(f=Wa(p,d.mode,g),f.return=d,f):(f=r(f,p),f.return=d,f)}function l(d,f,p,g){return f!==null&&f.elementType===p.type?(g=r(f,p.props),g.ref=Cn(d,f,p),g.return=d,g):(g=cs(p.type,p.key,p.props,null,d.mode,g),g.ref=Cn(d,f,p),g.return=d,g)}function u(d,f,p,g){return f===null||f.tag!==4||f.stateNode.containerInfo!==p.containerInfo||f.stateNode.implementation!==p.implementation?(f=Ha(p,d.mode,g),f.return=d,f):(f=r(f,p.children||[]),f.return=d,f)}function c(d,f,p,g,y){return f===null||f.tag!==7?(f=_t(p,d.mode,g,y),f.return=d,f):(f=r(f,p),f.return=d,f)}function h(d,f,p){if(typeof f=="string"||typeof f=="number")return f=Wa(""+f,d.mode,p),f.return=d,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case Dr:return p=cs(f.type,f.key,f.props,null,d.mode,p),p.ref=Cn(d,null,f),p.return=d,p;case Ri:return f=Ha(f,d.mode,p),f.return=d,f}if(_r(f)||wn(f))return f=_t(f,d.mode,p,null),f.return=d,f;Vr(d,f)}return null}function m(d,f,p,g){var y=f!==null?f.key:null;if(typeof p=="string"||typeof p=="number")return y!==null?null:o(d,f,""+p,g);if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Dr:return p.key===y?p.type===si?c(d,f,p.props.children,g,y):l(d,f,p,g):null;case Ri:return p.key===y?u(d,f,p,g):null}if(_r(p)||wn(p))return y!==null?null:c(d,f,p,g,null);Vr(d,p)}return null}function v(d,f,p,g,y){if(typeof g=="string"||typeof g=="number")return d=d.get(p)||null,o(f,d,""+g,y);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Dr:return d=d.get(g.key===null?p:g.key)||null,g.type===si?c(f,d,g.props.children,y,g.key):l(f,d,g,y);case Ri:return d=d.get(g.key===null?p:g.key)||null,u(f,d,g,y)}if(_r(g)||wn(g))return d=d.get(p)||null,c(f,d,g,y,null);Vr(f,g)}return null}function w(d,f,p,g){for(var y=null,x=null,E=f,z=f=0,P=null;E!==null&&z<p.length;z++){E.index>z?(P=E,E=null):P=E.sibling;var B=m(d,E,p[z],g);if(B===null){E===null&&(E=P);break}t&&E&&B.alternate===null&&e(d,E),f=s(B,f,z),x===null?y=B:x.sibling=B,x=B,E=P}if(z===p.length)return i(d,E),y;if(E===null){for(;z<p.length;z++)E=h(d,p[z],g),E!==null&&(f=s(E,f,z),x===null?y=E:x.sibling=E,x=E);return y}for(E=n(d,E);z<p.length;z++)P=v(E,d,z,p[z],g),P!==null&&(t&&P.alternate!==null&&E.delete(P.key===null?z:P.key),f=s(P,f,z),x===null?y=P:x.sibling=P,x=P);return t&&E.forEach(function(te){return e(d,te)}),y}function M(d,f,p,g){var y=wn(p);if(typeof y!="function")throw Error(I(150));if(p=y.call(p),p==null)throw Error(I(151));for(var x=y=null,E=f,z=f=0,P=null,B=p.next();E!==null&&!B.done;z++,B=p.next()){E.index>z?(P=E,E=null):P=E.sibling;var te=m(d,E,B.value,g);if(te===null){E===null&&(E=P);break}t&&E&&te.alternate===null&&e(d,E),f=s(te,f,z),x===null?y=te:x.sibling=te,x=te,E=P}if(B.done)return i(d,E),y;if(E===null){for(;!B.done;z++,B=p.next())B=h(d,B.value,g),B!==null&&(f=s(B,f,z),x===null?y=B:x.sibling=B,x=B);return y}for(E=n(d,E);!B.done;z++,B=p.next())B=v(E,d,z,B.value,g),B!==null&&(t&&B.alternate!==null&&E.delete(B.key===null?z:B.key),f=s(B,f,z),x===null?y=B:x.sibling=B,x=B);return t&&E.forEach(function(C){return e(d,C)}),y}return function(d,f,p,g){var y=typeof p=="object"&&p!==null&&p.type===si&&p.key===null;y&&(p=p.props.children);var x=typeof p=="object"&&p!==null;if(x)switch(p.$$typeof){case Dr:e:{for(x=p.key,y=f;y!==null;){if(y.key===x){switch(y.tag){case 7:if(p.type===si){i(d,y.sibling),f=r(y,p.props.children),f.return=d,d=f;break e}break;default:if(y.elementType===p.type){i(d,y.sibling),f=r(y,p.props),f.ref=Cn(d,y,p),f.return=d,d=f;break e}}i(d,y);break}else e(d,y);y=y.sibling}p.type===si?(f=_t(p.props.children,d.mode,g,p.key),f.return=d,d=f):(g=cs(p.type,p.key,p.props,null,d.mode,g),g.ref=Cn(d,f,p),g.return=d,d=g)}return a(d);case Ri:e:{for(y=p.key;f!==null;){if(f.key===y)if(f.tag===4&&f.stateNode.containerInfo===p.containerInfo&&f.stateNode.implementation===p.implementation){i(d,f.sibling),f=r(f,p.children||[]),f.return=d,d=f;break e}else{i(d,f);break}else e(d,f);f=f.sibling}f=Ha(p,d.mode,g),f.return=d,d=f}return a(d)}if(typeof p=="string"||typeof p=="number")return p=""+p,f!==null&&f.tag===6?(i(d,f.sibling),f=r(f,p),f.return=d,d=f):(i(d,f),f=Wa(p,d.mode,g),f.return=d,d=f),a(d);if(_r(p))return w(d,f,p,g);if(wn(p))return M(d,f,p,g);if(x&&Vr(d,p),typeof p=="undefined"&&!y)switch(d.tag){case 1:case 0:throw d=d.type,Error(I(152,d.displayName||d.name||"Component"))}return i(d,f)}}var sn=zp(!0),gu=zp(!1),Mr={},gt={current:Mr},rr={current:Mr},sr={current:Mr};function oi(t){if(t===Mr)throw Error(I(174));return t}function Uo(t,e){switch(oe(sr,e),oe(rr,t),oe(gt,Mr),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Co(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Co(e,t)}ee(gt),oe(gt,e)}function an(){ee(gt),ee(rr),ee(sr)}function oh(t){oi(sr.current);var e=oi(gt.current),i=Co(e,t.type);e!==i&&(oe(rr,t),oe(gt,i))}function mu(t){rr.current===t&&(ee(gt),ee(rr))}var re={current:0};function Es(t){for(var e=t;e!==null;){if(e.tag===13){var i=e.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data===nu||i.data===ru))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if((e.effectTag&64)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}function vu(t,e){return{responder:t,props:e}}var os=et.ReactCurrentDispatcher,Ze=et.ReactCurrentBatchConfig,Rt=0,ce=null,xe=null,Se=null,Ns=!1;function je(){throw Error(I(321))}function wu(t,e){if(e===null)return!1;for(var i=0;i<e.length&&i<t.length;i++)if(!Si(t[i],e[i]))return!1;return!0}function yu(t,e,i,n,r,s){if(Rt=s,ce=e,e.memoizedState=null,e.updateQueue=null,e.expirationTime=0,os.current=t===null||t.memoizedState===null?J0:K0,t=i(n,r),e.expirationTime===Rt){s=0;do{if(e.expirationTime=0,!(25>s))throw Error(I(301));s+=1,Se=xe=null,e.updateQueue=null,os.current=q0,t=i(n,r)}while(e.expirationTime===Rt)}if(os.current=Bs,e=xe!==null&&xe.next!==null,Rt=0,Se=xe=ce=null,Ns=!1,e)throw Error(I(300));return t}function Xi(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Se===null?ce.memoizedState=Se=t:Se=Se.next=t,Se}function cn(){if(xe===null){var t=ce.alternate;t=t!==null?t.memoizedState:null}else t=xe.next;var e=Se===null?ce.memoizedState:Se.next;if(e!==null)Se=e,xe=t;else{if(t===null)throw Error(I(310));xe=t,t={memoizedState:xe.memoizedState,baseState:xe.baseState,baseQueue:xe.baseQueue,queue:xe.queue,next:null},Se===null?ce.memoizedState=Se=t:Se=Se.next=t}return Se}function fi(t,e){return typeof e=="function"?e(t):e}function Or(t){var e=cn(),i=e.queue;if(i===null)throw Error(I(311));i.lastRenderedReducer=t;var n=xe,r=n.baseQueue,s=i.pending;if(s!==null){if(r!==null){var a=r.next;r.next=s.next,s.next=a}n.baseQueue=r=s,i.pending=null}if(r!==null){r=r.next,n=n.baseState;var o=a=s=null,l=r;do{var u=l.expirationTime;if(u<Rt){var c={expirationTime:l.expirationTime,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null};o===null?(a=o=c,s=n):o=o.next=c,u>ce.expirationTime&&(ce.expirationTime=u,pa(u))}else o!==null&&(o=o.next={expirationTime:1073741823,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null}),ag(u,l.suspenseConfig),n=l.eagerReducer===t?l.eagerState:t(n,l.action);l=l.next}while(l!==null&&l!==r);o===null?s=n:o.next=a,Si(n,e.memoizedState)||(ft=!0),e.memoizedState=n,e.baseState=s,e.baseQueue=o,i.lastRenderedState=n}return[e.memoizedState,i.dispatch]}function Ur(t){var e=cn(),i=e.queue;if(i===null)throw Error(I(311));i.lastRenderedReducer=t;var n=i.dispatch,r=i.pending,s=e.memoizedState;if(r!==null){i.pending=null;var a=r=r.next;do s=t(s,a.action),a=a.next;while(a!==r);Si(s,e.memoizedState)||(ft=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),i.lastRenderedState=s}return[s,n]}function _a(t){var e=Xi();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t=e.queue={pending:null,dispatch:null,lastRenderedReducer:fi,lastRenderedState:t},t=t.dispatch=Vp.bind(null,ce,t),[e.memoizedState,t]}function $o(t,e,i,n){return t={tag:t,create:e,destroy:i,deps:n,next:null},e=ce.updateQueue,e===null?(e={lastEffect:null},ce.updateQueue=e,e.lastEffect=t.next=t):(i=e.lastEffect,i===null?e.lastEffect=t.next=t:(n=i.next,i.next=t,t.next=n,e.lastEffect=t)),t}function Dp(){return cn().memoizedState}function Wo(t,e,i,n){var r=Xi();ce.effectTag|=t,r.memoizedState=$o(1|e,i,void 0,n===void 0?null:n)}function xu(t,e,i,n){var r=cn();n=n===void 0?null:n;var s=void 0;if(xe!==null){var a=xe.memoizedState;if(s=a.destroy,n!==null&&wu(n,a.deps)){$o(e,i,s,n);return}}ce.effectTag|=t,r.memoizedState=$o(1|e,i,s,n)}function lh(t,e){return Wo(516,4,t,e)}function ks(t,e){return xu(516,4,t,e)}function Lp(t,e){return xu(4,2,t,e)}function Rp(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function jp(t,e,i){return i=i!=null?i.concat([t]):null,xu(4,2,Rp.bind(null,e,t),i)}function Su(){}function uh(t,e){return Xi().memoizedState=[t,e===void 0?null:e],t}function Ps(t,e){var i=cn();e=e===void 0?null:e;var n=i.memoizedState;return n!==null&&e!==null&&wu(e,n[1])?n[0]:(i.memoizedState=[t,e],t)}function _p(t,e){var i=cn();e=e===void 0?null:e;var n=i.memoizedState;return n!==null&&e!==null&&wu(e,n[1])?n[0]:(t=t(),i.memoizedState=[t,e],t)}function Mu(t,e,i){var n=ua();Xt(98>n?98:n,function(){t(!0)}),Xt(97<n?97:n,function(){var r=Ze.suspense;Ze.suspense=e===void 0?null:e;try{t(!1),i()}finally{Ze.suspense=r}})}function Vp(t,e,i){var n=mt(),r=Hn.suspense;n=mi(n,t,r),r={expirationTime:n,suspenseConfig:r,action:i,eagerReducer:null,eagerState:null,next:null};var s=e.pending;if(s===null?r.next=r:(r.next=s.next,s.next=r),e.pending=r,s=t.alternate,t===ce||s!==null&&s===ce)Ns=!0,r.expirationTime=Rt,ce.expirationTime=Rt;else{if(t.expirationTime===0&&(s===null||s.expirationTime===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,i);if(r.eagerReducer=s,r.eagerState=o,Si(o,a))return}catch{}finally{}Zt(t,n)}}var Bs={readContext:Ye,useCallback:je,useContext:je,useEffect:je,useImperativeHandle:je,useLayoutEffect:je,useMemo:je,useReducer:je,useRef:je,useState:je,useDebugValue:je,useResponder:je,useDeferredValue:je,useTransition:je},J0={readContext:Ye,useCallback:uh,useContext:Ye,useEffect:lh,useImperativeHandle:function(t,e,i){return i=i!=null?i.concat([t]):null,Wo(4,2,Rp.bind(null,e,t),i)},useLayoutEffect:function(t,e){return Wo(4,2,t,e)},useMemo:function(t,e){var i=Xi();return e=e===void 0?null:e,t=t(),i.memoizedState=[t,e],t},useReducer:function(t,e,i){var n=Xi();return e=i!==void 0?i(e):e,n.memoizedState=n.baseState=e,t=n.queue={pending:null,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},t=t.dispatch=Vp.bind(null,ce,t),[n.memoizedState,t]},useRef:function(t){var e=Xi();return t={current:t},e.memoizedState=t},useState:_a,useDebugValue:Su,useResponder:vu,useDeferredValue:function(t,e){var i=_a(t),n=i[0],r=i[1];return lh(function(){var s=Ze.suspense;Ze.suspense=e===void 0?null:e;try{r(t)}finally{Ze.suspense=s}},[t,e]),n},useTransition:function(t){var e=_a(!1),i=e[0];return e=e[1],[uh(Mu.bind(null,e,t),[e,t]),i]}},K0={readContext:Ye,useCallback:Ps,useContext:Ye,useEffect:ks,useImperativeHandle:jp,useLayoutEffect:Lp,useMemo:_p,useReducer:Or,useRef:Dp,useState:function(){return Or(fi)},useDebugValue:Su,useResponder:vu,useDeferredValue:function(t,e){var i=Or(fi),n=i[0],r=i[1];return ks(function(){var s=Ze.suspense;Ze.suspense=e===void 0?null:e;try{r(t)}finally{Ze.suspense=s}},[t,e]),n},useTransition:function(t){var e=Or(fi),i=e[0];return e=e[1],[Ps(Mu.bind(null,e,t),[e,t]),i]}},q0={readContext:Ye,useCallback:Ps,useContext:Ye,useEffect:ks,useImperativeHandle:jp,useLayoutEffect:Lp,useMemo:_p,useReducer:Ur,useRef:Dp,useState:function(){return Ur(fi)},useDebugValue:Su,useResponder:vu,useDeferredValue:function(t,e){var i=Ur(fi),n=i[0],r=i[1];return ks(function(){var s=Ze.suspense;Ze.suspense=e===void 0?null:e;try{r(t)}finally{Ze.suspense=s}},[t,e]),n},useTransition:function(t){var e=Ur(fi),i=e[0];return e=e[1],[Ps(Mu.bind(null,e,t),[e,t]),i]}},At=null,jt=null,pi=!1;function Op(t,e){var i=pt(5,null,null,0);i.elementType="DELETED",i.type="DELETED",i.stateNode=e,i.return=t,i.effectTag=8,t.lastEffect!==null?(t.lastEffect.nextEffect=i,t.lastEffect=i):t.firstEffect=t.lastEffect=i}function ch(t,e){switch(t.tag){case 5:var i=t.type;return e=e.nodeType!==1||i.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,!0):!1;case 13:return!1;default:return!1}}function Ho(t){if(pi){var e=jt;if(e){var i=e;if(!ch(t,e)){if(e=Yi(i.nextSibling),!e||!ch(t,e)){t.effectTag=t.effectTag&-1025|2,pi=!1,At=t;return}Op(At,i)}At=t,jt=Yi(e.firstChild)}else t.effectTag=t.effectTag&-1025|2,pi=!1,At=t}}function hh(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;At=t}function $r(t){if(t!==At)return!1;if(!pi)return hh(t),pi=!0,!1;var e=t.type;if(t.tag!==5||e!=="head"&&e!=="body"&&!zo(e,t.memoizedProps))for(e=jt;e;)Op(t,e),e=Yi(e.nextSibling);if(hh(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(I(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var i=t.data;if(i===ap){if(e===0){jt=Yi(t.nextSibling);break e}e--}else i!==sp&&i!==ru&&i!==nu||e++}t=t.nextSibling}jt=null}}else jt=At?Yi(t.stateNode.nextSibling):null;return!0}function Va(){jt=At=null,pi=!1}var eS=et.ReactCurrentOwner,ft=!1;function Ve(t,e,i,n){e.child=t===null?gu(e,null,i,n):sn(e,t.child,i,n)}function dh(t,e,i,n,r){i=i.render;var s=e.ref;return Gi(e,r),n=yu(t,e,i,n,s,r),t!==null&&!ft?(e.updateQueue=t.updateQueue,e.effectTag&=-517,t.expirationTime<=r&&(t.expirationTime=0),Tt(t,e,r)):(e.effectTag|=1,Ve(t,e,n,r),e.child)}function fh(t,e,i,n,r,s){if(t===null){var a=i.type;return typeof a=="function"&&!Tu(a)&&a.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(e.tag=15,e.type=a,Up(t,e,a,n,r,s)):(t=cs(i.type,null,n,null,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}return a=t.child,r<s&&(r=a.memoizedProps,i=i.compare,i=i!==null?i:ir,i(r,n)&&t.ref===e.ref)?Tt(t,e,s):(e.effectTag|=1,t=Ii(a,n),t.ref=e.ref,t.return=e,e.child=t)}function Up(t,e,i,n,r,s){return t!==null&&ir(t.memoizedProps,n)&&t.ref===e.ref&&(ft=!1,r<s)?(e.expirationTime=t.expirationTime,Tt(t,e,s)):Fo(t,e,i,n,s)}function $p(t,e){var i=e.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(e.effectTag|=128)}function Fo(t,e,i,n,r){var s=De(i)?Mi:Me.current;return s=rn(e,s),Gi(e,r),i=yu(t,e,i,n,s,r),t!==null&&!ft?(e.updateQueue=t.updateQueue,e.effectTag&=-517,t.expirationTime<=r&&(t.expirationTime=0),Tt(t,e,r)):(e.effectTag|=1,Ve(t,e,i,r),e.child)}function ph(t,e,i,n,r){if(De(i)){var s=!0;rs(e)}else s=!1;if(Gi(e,r),e.stateNode===null)t!==null&&(t.alternate=null,e.alternate=null,e.effectTag|=2),Bp(e,i,n),Oo(e,i,n,r),n=!0;else if(t===null){var a=e.stateNode,o=e.memoizedProps;a.props=o;var l=a.context,u=i.contextType;typeof u=="object"&&u!==null?u=Ye(u):(u=De(i)?Mi:Me.current,u=rn(e,u));var c=i.getDerivedStateFromProps,h=typeof c=="function"||typeof a.getSnapshotBeforeUpdate=="function";h||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==n||l!==u)&&ah(e,a,n,u),zt=!1;var m=e.memoizedState;a.state=m,nr(e,n,a,r),l=e.memoizedState,o!==n||m!==l||ze.current||zt?(typeof c=="function"&&(Ts(e,i,c,n),l=e.memoizedState),(o=zt||sh(e,i,o,n,m,l,u))?(h||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.effectTag|=4)):(typeof a.componentDidMount=="function"&&(e.effectTag|=4),e.memoizedProps=n,e.memoizedState=l),a.props=n,a.state=l,a.context=u,n=o):(typeof a.componentDidMount=="function"&&(e.effectTag|=4),n=!1)}else a=e.stateNode,pu(t,e),o=e.memoizedProps,a.props=e.type===e.elementType?o:Ke(e.type,o),l=a.context,u=i.contextType,typeof u=="object"&&u!==null?u=Ye(u):(u=De(i)?Mi:Me.current,u=rn(e,u)),c=i.getDerivedStateFromProps,(h=typeof c=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==n||l!==u)&&ah(e,a,n,u),zt=!1,l=e.memoizedState,a.state=l,nr(e,n,a,r),m=e.memoizedState,o!==n||l!==m||ze.current||zt?(typeof c=="function"&&(Ts(e,i,c,n),m=e.memoizedState),(c=zt||sh(e,i,o,n,l,m,u))?(h||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,m,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,m,u)),typeof a.componentDidUpdate=="function"&&(e.effectTag|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.effectTag|=256)):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=256),e.memoizedProps=n,e.memoizedState=m),a.props=n,a.state=m,a.context=u,n=c):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=256),n=!1);return Qo(t,e,i,n,s,r)}function Qo(t,e,i,n,r,s){$p(t,e);var a=(e.effectTag&64)!==0;if(!n&&!a)return r&&qc(e,i,!1),Tt(t,e,s);n=e.stateNode,eS.current=e;var o=a&&typeof i.getDerivedStateFromError!="function"?null:n.render();return e.effectTag|=1,t!==null&&a?(e.child=sn(e,t.child,null,s),e.child=sn(e,null,o,s)):Ve(t,e,o,s),e.memoizedState=n.state,r&&qc(e,i,!0),e.child}function gh(t){var e=t.stateNode;e.pendingContext?Kc(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Kc(t,e.context,!1),Uo(t,e.containerInfo)}var Oa={dehydrated:null,retryTime:0};function mh(t,e,i){var n=e.mode,r=e.pendingProps,s=re.current,a=!1,o;if((o=(e.effectTag&64)!==0)||(o=(s&2)!==0&&(t===null||t.memoizedState!==null)),o?(a=!0,e.effectTag&=-65):t!==null&&t.memoizedState===null||r.fallback===void 0||r.unstable_avoidThisFallback===!0||(s|=1),oe(re,s&1),t===null){if(r.fallback!==void 0&&Ho(e),a){if(a=r.fallback,r=_t(null,n,0,null),r.return=e,(e.mode&2)===0)for(t=e.memoizedState!==null?e.child.child:e.child,r.child=t;t!==null;)t.return=r,t=t.sibling;return i=_t(a,n,i,null),i.return=e,r.sibling=i,e.memoizedState=Oa,e.child=r,i}return n=r.children,e.memoizedState=null,e.child=gu(e,null,n,i)}if(t.memoizedState!==null){if(t=t.child,n=t.sibling,a){if(r=r.fallback,i=Ii(t,t.pendingProps),i.return=e,(e.mode&2)===0&&(a=e.memoizedState!==null?e.child.child:e.child,a!==t.child))for(i.child=a;a!==null;)a.return=i,a=a.sibling;return n=Ii(n,r),n.return=e,i.sibling=n,i.childExpirationTime=0,e.memoizedState=Oa,e.child=i,n}return i=sn(e,t.child,r.children,i),e.memoizedState=null,e.child=i}if(t=t.child,a){if(a=r.fallback,r=_t(null,n,0,null),r.return=e,r.child=t,t!==null&&(t.return=r),(e.mode&2)===0)for(t=e.memoizedState!==null?e.child.child:e.child,r.child=t;t!==null;)t.return=r,t=t.sibling;return i=_t(a,n,i,null),i.return=e,r.sibling=i,i.effectTag|=2,r.childExpirationTime=0,e.memoizedState=Oa,e.child=r,i}return e.memoizedState=null,e.child=sn(e,t,r.children,i)}function vh(t,e){t.expirationTime<e&&(t.expirationTime=e);var i=t.alternate;i!==null&&i.expirationTime<e&&(i.expirationTime=e),kp(t.return,e)}function Ua(t,e,i,n,r,s){var a=t.memoizedState;a===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:i,tailExpiration:0,tailMode:r,lastEffect:s}:(a.isBackwards=e,a.rendering=null,a.renderingStartTime=0,a.last=n,a.tail=i,a.tailExpiration=0,a.tailMode=r,a.lastEffect=s)}function wh(t,e,i){var n=e.pendingProps,r=n.revealOrder,s=n.tail;if(Ve(t,e,n.children,i),n=re.current,(n&2)!==0)n=n&1|2,e.effectTag|=64;else{if(t!==null&&(t.effectTag&64)!==0)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&vh(t,i);else if(t.tag===19)vh(t,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(oe(re,n),(e.mode&2)===0)e.memoizedState=null;else switch(r){case"forwards":for(i=e.child,r=null;i!==null;)t=i.alternate,t!==null&&Es(t)===null&&(r=i),i=i.sibling;i=r,i===null?(r=e.child,e.child=null):(r=i.sibling,i.sibling=null),Ua(e,!1,r,i,s,e.lastEffect);break;case"backwards":for(i=null,r=e.child,e.child=null;r!==null;){if(t=r.alternate,t!==null&&Es(t)===null){e.child=r;break}t=r.sibling,r.sibling=i,i=r,r=t}Ua(e,!0,i,null,s,e.lastEffect);break;case"together":Ua(e,!1,null,null,void 0,e.lastEffect);break;default:e.memoizedState=null}return e.child}function Tt(t,e,i){t!==null&&(e.dependencies=t.dependencies);var n=e.expirationTime;if(n!==0&&pa(n),e.childExpirationTime<i)return null;if(t!==null&&e.child!==t.child)throw Error(I(153));if(e.child!==null){for(t=e.child,i=Ii(t,t.pendingProps),e.child=i,i.return=e;t.sibling!==null;)t=t.sibling,i=i.sibling=Ii(t,t.pendingProps),i.return=e;i.sibling=null}return e.child}var Wp,Zo,Hp,Fp;Wp=function(t,e){for(var i=e.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};Zo=function(){};Hp=function(t,e,i,n,r){var s=t.memoizedProps;if(s!==n){var a=e.stateNode;switch(oi(gt.current),t=null,i){case"input":s=yo(a,s),n=yo(a,n),t=[];break;case"option":s=Mo(a,s),n=Mo(a,n),t=[];break;case"select":s=Ae({},s,{value:void 0}),n=Ae({},n,{value:void 0}),t=[];break;case"textarea":s=Io(a,s),n=Io(a,n),t=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(a.onclick=xs)}No(i,n);var o,l;i=null;for(o in s)if(!n.hasOwnProperty(o)&&s.hasOwnProperty(o)&&s[o]!=null)if(o==="style")for(l in a=s[o],a)a.hasOwnProperty(l)&&(i||(i={}),i[l]="");else o!=="dangerouslySetInnerHTML"&&o!=="children"&&o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(en.hasOwnProperty(o)?t||(t=[]):(t=t||[]).push(o,null));for(o in n){var u=n[o];if(a=s!=null?s[o]:void 0,n.hasOwnProperty(o)&&u!==a&&(u!=null||a!=null))if(o==="style")if(a){for(l in a)!a.hasOwnProperty(l)||u&&u.hasOwnProperty(l)||(i||(i={}),i[l]="");for(l in u)u.hasOwnProperty(l)&&a[l]!==u[l]&&(i||(i={}),i[l]=u[l])}else i||(t||(t=[]),t.push(o,i)),i=u;else o==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(t=t||[]).push(o,u)):o==="children"?a===u||typeof u!="string"&&typeof u!="number"||(t=t||[]).push(o,""+u):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&(en.hasOwnProperty(o)?(u!=null&&xt(r,o),t||a===u||(t=[])):(t=t||[]).push(o,u))}i&&(t=t||[]).push("style",i),r=t,(e.updateQueue=r)&&(e.effectTag|=4)}};Fp=function(t,e,i,n){i!==n&&(e.effectTag|=4)};function Wr(t,e){switch(t.tailMode){case"hidden":e=t.tail;for(var i=null;e!==null;)e.alternate!==null&&(i=e),e=e.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var n=null;i!==null;)i.alternate!==null&&(n=i),i=i.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function tS(t,e,i){var n=e.pendingProps;switch(e.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 De(e.type)&&Is(),null;case 3:return an(),ee(ze),ee(Me),i=e.stateNode,i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),t!==null&&t.child!==null||!$r(e)||(e.effectTag|=4),Zo(e),null;case 5:mu(e),i=oi(sr.current);var r=e.type;if(t!==null&&e.stateNode!=null)Hp(t,e,r,n,i),t.ref!==e.ref&&(e.effectTag|=128);else{if(!n){if(e.stateNode===null)throw Error(I(166));return null}if(t=oi(gt.current),$r(e)){n=e.stateNode,r=e.type;var s=e.memoizedProps;switch(n[Dt]=e,n[Ss]=s,r){case"iframe":case"object":case"embed":ne("load",n);break;case"video":case"audio":for(t=0;t<Nn.length;t++)ne(Nn[t],n);break;case"source":ne("error",n);break;case"img":case"image":case"link":ne("error",n),ne("load",n);break;case"form":ne("reset",n),ne("submit",n);break;case"details":ne("toggle",n);break;case"input":Nc(n,s),ne("invalid",n),xt(i,"onChange");break;case"select":n._wrapperState={wasMultiple:!!s.multiple},ne("invalid",n),xt(i,"onChange");break;case"textarea":Pc(n,s),ne("invalid",n),xt(i,"onChange")}No(r,s),t=null;for(var a in s)if(s.hasOwnProperty(a)){var o=s[a];a==="children"?typeof o=="string"?n.textContent!==o&&(t=["children",o]):typeof o=="number"&&n.textContent!==""+o&&(t=["children",""+o]):en.hasOwnProperty(a)&&o!=null&&xt(i,a)}switch(r){case"input":Lr(n),kc(n,s,!0);break;case"textarea":Lr(n),Bc(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=xs)}i=t,e.updateQueue=i,i!==null&&(e.effectTag|=4)}else{switch(a=i.nodeType===9?i:i.ownerDocument,t===_c&&(t=_f(r)),t===_c?r==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(r,{is:n.is}):(t=a.createElement(r),r==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,r),t[Dt]=e,t[Ss]=n,Wp(t,e,!1,!1),e.stateNode=t,a=ko(r,n),r){case"iframe":case"object":case"embed":ne("load",t),o=n;break;case"video":case"audio":for(o=0;o<Nn.length;o++)ne(Nn[o],t);o=n;break;case"source":ne("error",t),o=n;break;case"img":case"image":case"link":ne("error",t),ne("load",t),o=n;break;case"form":ne("reset",t),ne("submit",t),o=n;break;case"details":ne("toggle",t),o=n;break;case"input":Nc(t,n),o=yo(t,n),ne("invalid",t),xt(i,"onChange");break;case"option":o=Mo(t,n);break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=Ae({},n,{value:void 0}),ne("invalid",t),xt(i,"onChange");break;case"textarea":Pc(t,n),o=Io(t,n),ne("invalid",t),xt(i,"onChange");break;default:o=n}No(r,o);var l=o;for(s in l)if(l.hasOwnProperty(s)){var u=l[s];s==="style"?np(t,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Vf(t,u)):s==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&Kn(t,u):typeof u=="number"&&Kn(t,""+u):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(en.hasOwnProperty(s)?u!=null&&xt(i,s):u!=null&&Ql(t,s,u,a))}switch(r){case"input":Lr(t),kc(t,n,!1);break;case"textarea":Lr(t),Bc(t);break;case"option":n.value!=null&&t.setAttribute("value",""+Yt(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?Zi(t,!!n.multiple,i,!1):n.defaultValue!=null&&Zi(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=xs)}op(r,n)&&(e.effectTag|=4)}e.ref!==null&&(e.effectTag|=128)}return null;case 6:if(t&&e.stateNode!=null)Fp(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(I(166));i=oi(sr.current),oi(gt.current),$r(e)?(i=e.stateNode,n=e.memoizedProps,i[Dt]=e,i.nodeValue!==n&&(e.effectTag|=4)):(i=(i.nodeType===9?i:i.ownerDocument).createTextNode(n),i[Dt]=e,e.stateNode=i)}return null;case 13:return ee(re),n=e.memoizedState,(e.effectTag&64)!==0?(e.expirationTime=i,e):(i=n!==null,n=!1,t===null?e.memoizedProps.fallback!==void 0&&$r(e):(r=t.memoizedState,n=r!==null,i||r===null||(r=t.child.sibling,r!==null&&(s=e.firstEffect,s!==null?(e.firstEffect=r,r.nextEffect=s):(e.firstEffect=e.lastEffect=r,r.nextEffect=null),r.effectTag=8))),i&&!n&&(e.mode&2)!==0&&(t===null&&e.memoizedProps.unstable_avoidThisFallback!==!0||(re.current&1)!==0?fe===gi&&(fe=Ls):((fe===gi||fe===Ls)&&(fe=ha),or!==0&&$e!==null&&(ci($e,Le),hg($e,or)))),(i||n)&&(e.effectTag|=4),null);case 4:return an(),Zo(e),null;case 10:return du(e),null;case 17:return De(e.type)&&Is(),null;case 19:if(ee(re),n=e.memoizedState,n===null)return null;if(r=(e.effectTag&64)!==0,s=n.rendering,s===null){if(r)Wr(n,!1);else if(fe!==gi||t!==null&&(t.effectTag&64)!==0)for(s=e.child;s!==null;){if(t=Es(s),t!==null){for(e.effectTag|=64,Wr(n,!1),r=t.updateQueue,r!==null&&(e.updateQueue=r,e.effectTag|=4),n.lastEffect===null&&(e.firstEffect=null),e.lastEffect=n.lastEffect,n=e.child;n!==null;)r=n,s=i,r.effectTag&=2,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null,t=r.alternate,t===null?(r.childExpirationTime=0,r.expirationTime=s,r.child=null,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null):(r.childExpirationTime=t.childExpirationTime,r.expirationTime=t.expirationTime,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,s=t.dependencies,r.dependencies=s===null?null:{expirationTime:s.expirationTime,firstContext:s.firstContext,responders:s.responders}),n=n.sibling;return oe(re,re.current&1|2),e.child}s=s.sibling}}else{if(!r)if(t=Es(s),t!==null){if(e.effectTag|=64,r=!0,i=t.updateQueue,i!==null&&(e.updateQueue=i,e.effectTag|=4),Wr(n,!0),n.tail===null&&n.tailMode==="hidden"&&!s.alternate)return e=e.lastEffect=n.lastEffect,e!==null&&(e.nextEffect=null),null}else 2*Qe()-n.renderingStartTime>n.tailExpiration&&1<i&&(e.effectTag|=64,r=!0,Wr(n,!1),e.expirationTime=e.childExpirationTime=i-1);n.isBackwards?(s.sibling=e.child,e.child=s):(i=n.last,i!==null?i.sibling=s:e.child=s,n.last=s)}return n.tail!==null?(n.tailExpiration===0&&(n.tailExpiration=Qe()+500),i=n.tail,n.rendering=i,n.tail=i.sibling,n.lastEffect=e.lastEffect,n.renderingStartTime=Qe(),i.sibling=null,e=re.current,oe(re,r?e&1|2:e&1),i):null}throw Error(I(156,e.tag))}function iS(t){switch(t.tag){case 1:De(t.type)&&Is();var e=t.effectTag;return e&4096?(t.effectTag=e&-4097|64,t):null;case 3:if(an(),ee(ze),ee(Me),e=t.effectTag,(e&64)!==0)throw Error(I(285));return t.effectTag=e&-4097|64,t;case 5:return mu(t),null;case 13:return ee(re),e=t.effectTag,e&4096?(t.effectTag=e&-4097|64,t):null;case 19:return ee(re),null;case 4:return an(),null;case 10:return du(t),null;default:return null}}function Iu(t,e){return{value:t,source:e,stack:Gl(e)}}var nS=typeof WeakSet=="function"?WeakSet:Set;function Yo(t,e){var i=e.source,n=e.stack;n===null&&i!==null&&(n=Gl(i)),i!==null&&Et(i.type),e=e.value,t!==null&&t.tag===1&&Et(t.type);try{console.error(e)}catch(r){setTimeout(function(){throw r})}}function rS(t,e){try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(i){vi(t,i)}}function yh(t){var e=t.ref;if(e!==null)if(typeof e=="function")try{e(null)}catch(i){vi(t,i)}else e.current=null}function sS(t,e){switch(e.tag){case 0:case 11:case 15:case 22:return;case 1:if(e.effectTag&256&&t!==null){var i=t.memoizedProps,n=t.memoizedState;t=e.stateNode,e=t.getSnapshotBeforeUpdate(e.elementType===e.type?i:Ke(e.type,i),n),t.__reactInternalSnapshotBeforeUpdate=e}return;case 3:case 5:case 6:case 4:case 17:return}throw Error(I(163))}function Qp(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var i=e=e.next;do{if((i.tag&t)===t){var n=i.destroy;i.destroy=void 0,n!==void 0&&n()}i=i.next}while(i!==e)}}function Zp(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var i=e=e.next;do{if((i.tag&t)===t){var n=i.create;i.destroy=n()}i=i.next}while(i!==e)}}function aS(t,e,i){switch(i.tag){case 0:case 11:case 15:case 22:Zp(3,i);return;case 1:if(t=i.stateNode,i.effectTag&4)if(e===null)t.componentDidMount();else{var n=i.elementType===i.type?e.memoizedProps:Ke(i.type,e.memoizedProps);t.componentDidUpdate(n,e.memoizedState,t.__reactInternalSnapshotBeforeUpdate)}e=i.updateQueue,e!==null&&rh(i,e,t);return;case 3:if(e=i.updateQueue,e!==null){if(t=null,i.child!==null)switch(i.child.tag){case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}rh(i,e,t)}return;case 5:t=i.stateNode,e===null&&i.effectTag&4&&op(i.type,i.memoizedProps)&&t.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&&qf(i))));return;case 19:case 17:case 20:case 21:return}throw Error(I(163))}function xh(t,e,i){switch(typeof il=="function"&&il(e),e.tag){case 0:case 11:case 14:case 15:case 22:if(t=e.updateQueue,t!==null&&(t=t.lastEffect,t!==null)){var n=t.next;Xt(97<i?97:i,function(){var r=n;do{var s=r.destroy;if(s!==void 0){var a=e;try{s()}catch(o){vi(a,o)}}r=r.next}while(r!==n)})}break;case 1:yh(e),i=e.stateNode,typeof i.componentWillUnmount=="function"&&rS(e,i);break;case 5:yh(e);break;case 4:Gp(t,e,i)}}function Yp(t){var e=t.alternate;t.return=null,t.child=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.alternate=null,t.firstEffect=null,t.lastEffect=null,t.pendingProps=null,t.memoizedProps=null,t.stateNode=null,e!==null&&Yp(e)}function Sh(t){return t.tag===5||t.tag===3||t.tag===4}function Mh(t){e:{for(var e=t.return;e!==null;){if(Sh(e)){var i=e;break e}e=e.return}throw Error(I(160))}switch(e=i.stateNode,i.tag){case 5:var n=!1;break;case 3:e=e.containerInfo,n=!0;break;case 4:e=e.containerInfo,n=!0;break;default:throw Error(I(161))}i.effectTag&16&&(Kn(e,""),i.effectTag&=-17);e:t:for(i=t;;){for(;i.sibling===null;){if(i.return===null||Sh(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?Go(t,i,e):Xo(t,i,e)}function Go(t,e,i){var n=t.tag,r=n===5||n===6;if(r)t=r?t.stateNode:t.stateNode.instance,e?i.nodeType===8?i.parentNode.insertBefore(t,e):i.insertBefore(t,e):(i.nodeType===8?(e=i.parentNode,e.insertBefore(t,i)):(e=i,e.appendChild(t)),i=i._reactRootContainer,i!=null||e.onclick!==null||(e.onclick=xs));else if(n!==4&&(t=t.child,t!==null))for(Go(t,e,i),t=t.sibling;t!==null;)Go(t,e,i),t=t.sibling}function Xo(t,e,i){var n=t.tag,r=n===5||n===6;if(r)t=r?t.stateNode:t.stateNode.instance,e?i.insertBefore(t,e):i.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Xo(t,e,i),t=t.sibling;t!==null;)Xo(t,e,i),t=t.sibling}function Gp(t,e,i){for(var n=e,r=!1,s,a;;){if(!r){r=n.return;e:for(;;){if(r===null)throw Error(I(160));switch(s=r.stateNode,r.tag){case 5:a=!1;break e;case 3:s=s.containerInfo,a=!0;break e;case 4:s=s.containerInfo,a=!0;break e}r=r.return}r=!0}if(n.tag===5||n.tag===6){e:for(var o=t,l=n,u=i,c=l;;)if(xh(o,c,u),c.child!==null&&c.tag!==4)c.child.return=c,c=c.child;else{if(c===l)break e;for(;c.sibling===null;){if(c.return===null||c.return===l)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}a?(o=s,l=n.stateNode,o.nodeType===8?o.parentNode.removeChild(l):o.removeChild(l)):s.removeChild(n.stateNode)}else if(n.tag===4){if(n.child!==null){s=n.stateNode.containerInfo,a=!0,n.child.return=n,n=n.child;continue}}else if(xh(t,n,i),n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return,n.tag===4&&(r=!1)}n.sibling.return=n.return,n=n.sibling}}function $a(t,e){switch(e.tag){case 0:case 11:case 14:case 15:case 22:Qp(3,e);return;case 1:return;case 5:var i=e.stateNode;if(i!=null){var n=e.memoizedProps,r=t!==null?t.memoizedProps:n;t=e.type;var s=e.updateQueue;if(e.updateQueue=null,s!==null){for(i[Ss]=n,t==="input"&&n.type==="radio"&&n.name!=null&&Lf(i,n),ko(t,r),e=ko(t,n),r=0;r<s.length;r+=2){var a=s[r],o=s[r+1];a==="style"?np(i,o):a==="dangerouslySetInnerHTML"?Vf(i,o):a==="children"?Kn(i,o):Ql(i,a,o,e)}switch(t){case"input":xo(i,n);break;case"textarea":Rf(i,n);break;case"select":e=i._wrapperState.wasMultiple,i._wrapperState.wasMultiple=!!n.multiple,t=n.value,t!=null?Zi(i,!!n.multiple,t,!1):e!==!!n.multiple&&(n.defaultValue!=null?Zi(i,!!n.multiple,n.defaultValue,!0):Zi(i,!!n.multiple,n.multiple?[]:"",!1))}}}return;case 6:if(e.stateNode===null)throw Error(I(162));e.stateNode.nodeValue=e.memoizedProps;return;case 3:e=e.stateNode,e.hydrate&&(e.hydrate=!1,qf(e.containerInfo));return;case 12:return;case 13:if(i=e,e.memoizedState===null?n=!1:(n=!0,i=e.child,Au=Qe()),i!==null)e:for(t=i;;){if(t.tag===5)s=t.stateNode,n?(s=s.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(s=t.stateNode,r=t.memoizedProps.style,r=r!=null&&r.hasOwnProperty("display")?r.display:null,s.style.display=ip("display",r));else if(t.tag===6)t.stateNode.nodeValue=n?"":t.memoizedProps;else if(t.tag===13&&t.memoizedState!==null&&t.memoizedState.dehydrated===null){s=t.child.sibling,s.return=t,t=s;continue}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break;for(;t.sibling===null;){if(t.return===null||t.return===i)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}Ih(e);return;case 19:Ih(e);return;case 17:return}throw Error(I(163))}function Ih(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new nS),e.forEach(function(n){var r=mS.bind(null,t,n);i.has(n)||(i.add(n),n.then(r,r))})}}var oS=typeof WeakMap=="function"?WeakMap:Map;function Xp(t,e,i){i=Ht(i,null),i.tag=3,i.payload={element:null};var n=e.value;return i.callback=function(){_s||(_s=!0,Jo=n),Yo(t,e)},i}function Jp(t,e,i){i=Ht(i,null),i.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var r=e.value;i.payload=function(){return Yo(t,e),n(r)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(i.callback=function(){typeof n!="function"&&(Qt===null?Qt=new Set([this]):Qt.add(this),Yo(t,e));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),i}var lS=Math.ceil,zs=et.ReactCurrentDispatcher,Kp=et.ReactCurrentOwner,pe=0,Cu=8,tt=16,vt=32,gi=0,Ds=1,qp=2,Ls=3,ha=4,bu=5,$=pe,$e=null,H=null,Le=0,fe=gi,da=null,bt=1073741823,ar=1073741823,Rs=null,or=0,js=!1,Au=0,eg=500,D=null,_s=!1,Jo=null,Qt=null,Vs=!1,Fn=null,Pn=90,li=null,Qn=0,Ko=null,ls=0;function mt(){return($&(tt|vt))!==pe?1073741821-(Qe()/10|0):ls!==0?ls:ls=1073741821-(Qe()/10|0)}function mi(t,e,i){if(e=e.mode,(e&2)===0)return 1073741823;var n=ua();if((e&4)===0)return n===99?1073741823:1073741822;if(($&tt)!==pe)return Le;if(i!==null)t=as(t,i.timeoutMs|0||5e3,250);else switch(n){case 99:t=1073741823;break;case 98:t=as(t,150,100);break;case 97:case 96:t=as(t,5e3,250);break;case 95:t=2;break;default:throw Error(I(326))}return $e!==null&&t===Le&&--t,t}function Zt(t,e){if(50<Qn)throw Qn=0,Ko=null,Error(I(185));if(t=fa(t,e),t!==null){var i=ua();e===1073741823?($&Cu)!==pe&&($&(tt|vt))===pe?qo(t):(We(t),$===pe&&wt()):We(t),($&4)===pe||i!==98&&i!==99||(li===null?li=new Map([[t,e]]):(i=li.get(t),(i===void 0||i>e)&&li.set(t,e)))}}function fa(t,e){t.expirationTime<e&&(t.expirationTime=e);var i=t.alternate;i!==null&&i.expirationTime<e&&(i.expirationTime=e);var n=t.return,r=null;if(n===null&&t.tag===3)r=t.stateNode;else for(;n!==null;){if(i=n.alternate,n.childExpirationTime<e&&(n.childExpirationTime=e),i!==null&&i.childExpirationTime<e&&(i.childExpirationTime=e),n.return===null&&n.tag===3){r=n.stateNode;break}n=n.return}return r!==null&&($e===r&&(pa(e),fe===ha&&ci(r,Le)),hg(r,e)),r}function us(t){var e=t.lastExpiredTime;if(e!==0||(e=t.firstPendingTime,!cg(t,e)))return e;var i=t.lastPingedTime;return t=t.nextKnownPendingLevel,t=i>t?i:t,2>=t&&e!==t?0:t}function We(t){if(t.lastExpiredTime!==0)t.callbackExpirationTime=1073741823,t.callbackPriority=99,t.callbackNode=ih(qo.bind(null,t));else{var e=us(t),i=t.callbackNode;if(e===0)i!==null&&(t.callbackNode=null,t.callbackExpirationTime=0,t.callbackPriority=90);else{var n=mt();if(e===1073741823?n=99:e===1||e===2?n=95:(n=10*(1073741821-e)-10*(1073741821-n),n=0>=n?99:250>=n?98:5250>=n?97:95),i!==null){var r=t.callbackPriority;if(t.callbackExpirationTime===e&&r>=n)return;i!==Ap&&Sp(i)}t.callbackExpirationTime=e,t.callbackPriority=n,e=e===1073741823?ih(qo.bind(null,t)):Ep(n,tg.bind(null,t),{timeout:10*(1073741821-e)-Qe()}),t.callbackNode=e}}}function tg(t,e){if(ls=0,e)return e=mt(),nl(t,e),We(t),null;var i=us(t);if(i!==0){if(e=t.callbackNode,($&(tt|vt))!==pe)throw Error(I(327));if(hn(),t===$e&&i===Le||ui(t,i),H!==null){var n=$;$|=tt;var r=sg();do try{hS();break}catch(o){rg(t,o)}while(1);if(hu(),$=n,zs.current=r,fe===Ds)throw e=da,ui(t,i),ci(t,i),We(t),e;if(H===null)switch(r=t.finishedWork=t.current.alternate,t.finishedExpirationTime=i,n=fe,$e=null,n){case gi:case Ds:throw Error(I(345));case qp:nl(t,2<i?2:i);break;case Ls:if(ci(t,i),n=t.lastSuspendedTime,i===n&&(t.nextKnownPendingLevel=el(r)),bt===1073741823&&(r=Au+eg-Qe(),10<r)){if(js){var s=t.lastPingedTime;if(s===0||s>=i){t.lastPingedTime=i,ui(t,i);break}}if(s=us(t),s!==0&&s!==i)break;if(n!==0&&n!==i){t.lastPingedTime=n;break}t.timeoutHandle=Ra(ri.bind(null,t),r);break}ri(t);break;case ha:if(ci(t,i),n=t.lastSuspendedTime,i===n&&(t.nextKnownPendingLevel=el(r)),js&&(r=t.lastPingedTime,r===0||r>=i)){t.lastPingedTime=i,ui(t,i);break}if(r=us(t),r!==0&&r!==i)break;if(n!==0&&n!==i){t.lastPingedTime=n;break}if(ar!==1073741823?n=10*(1073741821-ar)-Qe():bt===1073741823?n=0:(n=10*(1073741821-bt)-5e3,r=Qe(),i=10*(1073741821-i)-r,n=r-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*lS(n/1960))-n,i<n&&(n=i)),10<n){t.timeoutHandle=Ra(ri.bind(null,t),n);break}ri(t);break;case bu:if(bt!==1073741823&&Rs!==null){s=bt;var a=Rs;if(n=a.busyMinDurationMs|0,0>=n?n=0:(r=a.busyDelayMs|0,s=Qe()-(10*(1073741821-s)-(a.timeoutMs|0||5e3)),n=s<=r?0:r+n-s),10<n){ci(t,i),t.timeoutHandle=Ra(ri.bind(null,t),n);break}}ri(t);break;default:throw Error(I(329))}if(We(t),t.callbackNode===e)return tg.bind(null,t)}}return null}function qo(t){var e=t.lastExpiredTime;if(e=e!==0?e:1073741823,($&(tt|vt))!==pe)throw Error(I(327));if(hn(),t===$e&&e===Le||ui(t,e),H!==null){var i=$;$|=tt;var n=sg();do try{cS();break}catch(r){rg(t,r)}while(1);if(hu(),$=i,zs.current=n,fe===Ds)throw i=da,ui(t,e),ci(t,e),We(t),i;if(H!==null)throw Error(I(261));t.finishedWork=t.current.alternate,t.finishedExpirationTime=e,$e=null,ri(t),We(t)}return null}function uS(){if(li!==null){var t=li;li=null,t.forEach(function(e,i){nl(i,e),We(i)}),wt()}}function ig(t,e){var i=$;$|=1;try{return t(e)}finally{$=i,$===pe&&wt()}}function ng(t,e){var i=$;$&=-2,$|=Cu;try{return t(e)}finally{$=i,$===pe&&wt()}}function ui(t,e){t.finishedWork=null,t.finishedExpirationTime=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,l0(i)),H!==null)for(i=H.return;i!==null;){var n=i;switch(n.tag){case 1:n=n.type.childContextTypes,n!=null&&Is();break;case 3:an(),ee(ze),ee(Me);break;case 5:mu(n);break;case 4:an();break;case 13:ee(re);break;case 19:ee(re);break;case 10:du(n)}i=i.return}$e=t,H=Ii(t.current,null),Le=e,fe=gi,da=null,ar=bt=1073741823,Rs=null,or=0,js=!1}function rg(t,e){do{try{if(hu(),os.current=Bs,Ns)for(var i=ce.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}if(Rt=0,Se=xe=ce=null,Ns=!1,H===null||H.return===null)return fe=Ds,da=e,H=null;e:{var r=t,s=H.return,a=H,o=e;if(e=Le,a.effectTag|=2048,a.firstEffect=a.lastEffect=null,o!==null&&typeof o=="object"&&typeof o.then=="function"){var l=o;if((a.mode&2)===0){var u=a.alternate;u?(a.updateQueue=u.updateQueue,a.memoizedState=u.memoizedState,a.expirationTime=u.expirationTime):(a.updateQueue=null,a.memoizedState=null)}var c=(re.current&1)!==0,h=s;do{var m;if(m=h.tag===13){var v=h.memoizedState;if(v!==null)m=v.dehydrated!==null;else{var w=h.memoizedProps;m=w.fallback===void 0?!1:w.unstable_avoidThisFallback!==!0?!0:!c}}if(m){var M=h.updateQueue;if(M===null){var d=new Set;d.add(l),h.updateQueue=d}else M.add(l);if((h.mode&2)===0){if(h.effectTag|=64,a.effectTag&=-2981,a.tag===1)if(a.alternate===null)a.tag=17;else{var f=Ht(1073741823,null);f.tag=2,Ft(a,f)}a.expirationTime=1073741823;break e}o=void 0,a=e;var p=r.pingCache;if(p===null?(p=r.pingCache=new oS,o=new Set,p.set(l,o)):(o=p.get(l),o===void 0&&(o=new Set,p.set(l,o))),!o.has(a)){o.add(a);var g=gS.bind(null,r,l,a);l.then(g,g)}h.effectTag|=4096,h.expirationTime=e;break e}h=h.return}while(h!==null);o=Error((Et(a.type)||"A React component")+` suspended while rendering, but no fallback UI was specified.
43
+ */var sa=Ti.exports,Ee=uf,ve=Sf.exports;function C(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)e+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!sa)throw Error(C(227));function Ux(t,e,i,n,r,s,a,o,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(i,u)}catch(h){this.onError(h)}}var Un=!1,vs=null,ws=!1,vo=null,$x={onError:function(t){Un=!0,vs=t}};function Wx(t,e,i,n,r,s,a,o,l){Un=!1,vs=null,Ux.apply($x,arguments)}function Hx(t,e,i,n,r,s,a,o,l){if(Wx.apply(this,arguments),Un){if(Un){var u=vs;Un=!1,vs=null}else throw Error(C(198));ws||(ws=!0,vo=u)}}var Ul=null,Cf=null,If=null;function Ac(t,e,i){var n=t.type||"unknown-event";t.currentTarget=If(i),Hx(n,e,void 0,t),t.currentTarget=null}var ys=null,ji={};function bf(){if(ys)for(var t in ji){var e=ji[t],i=ys.indexOf(t);if(!(-1<i))throw Error(C(96,t));if(!xs[i]){if(!e.extractEvents)throw Error(C(97,t));xs[i]=e,i=e.eventTypes;for(var n in i){var r=void 0,s=i[n],a=e,o=n;if(wo.hasOwnProperty(o))throw Error(C(99,o));wo[o]=s;var l=s.phasedRegistrationNames;if(l){for(r in l)l.hasOwnProperty(r)&&Tc(l[r],a,o);r=!0}else s.registrationName?(Tc(s.registrationName,a,o),r=!0):r=!1;if(!r)throw Error(C(98,n,t))}}}}function Tc(t,e,i){if(nn[t])throw Error(C(100,t));nn[t]=e,$l[t]=e.eventTypes[i].dependencies}var xs=[],wo={},nn={},$l={};function Af(t){var e=!1,i;for(i in t)if(t.hasOwnProperty(i)){var n=t[i];if(!ji.hasOwnProperty(i)||ji[i]!==n){if(ji[i])throw Error(C(102,i));ji[i]=n,e=!0}}e&&bf()}var qt=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),yo=null,Zi=null,Yi=null;function Ec(t){if(t=Cf(t)){if(typeof yo!="function")throw Error(C(280));var e=t.stateNode;e&&(e=Ul(e),yo(t.stateNode,t.type,e))}}function Tf(t){Zi?Yi?Yi.push(t):Yi=[t]:Zi=t}function Ef(){if(Zi){var t=Zi,e=Yi;if(Yi=Zi=null,Ec(t),e)for(t=0;t<e.length;t++)Ec(e[t])}}function Wl(t,e){return t(e)}function Nf(t,e,i,n,r){return t(e,i,n,r)}function Hl(){}var kf=Wl,oi=!1,za=!1;function Fl(){(Zi!==null||Yi!==null)&&(Hl(),Ef())}function Pf(t,e,i){if(za)return t(e,i);za=!0;try{return kf(t,e,i)}finally{za=!1,Fl()}}var Fx=/^[: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]*$/,Nc=Object.prototype.hasOwnProperty,kc={},Pc={};function Qx(t){return Nc.call(Pc,t)?!0:Nc.call(kc,t)?!1:Fx.test(t)?Pc[t]=!0:(kc[t]=!0,!1)}function Zx(t,e,i,n){if(i!==null&&i.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Yx(t,e,i,n){if(e===null||typeof e=="undefined"||Zx(t,e,i,n))return!0;if(n)return!1;if(i!==null)switch(i.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ne(t,e,i,n,r,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=r,this.mustUseProperty=i,this.propertyName=t,this.type=e,this.sanitizeURL=s}var we={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){we[t]=new Ne(t,0,!1,t,null,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];we[e]=new Ne(e,1,!1,t[1],null,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){we[t]=new Ne(t,2,!1,t.toLowerCase(),null,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){we[t]=new Ne(t,2,!1,t,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(t){we[t]=new Ne(t,3,!1,t.toLowerCase(),null,!1)});["checked","multiple","muted","selected"].forEach(function(t){we[t]=new Ne(t,3,!0,t,null,!1)});["capture","download"].forEach(function(t){we[t]=new Ne(t,4,!1,t,null,!1)});["cols","rows","size","span"].forEach(function(t){we[t]=new Ne(t,6,!1,t,null,!1)});["rowSpan","start"].forEach(function(t){we[t]=new Ne(t,5,!1,t.toLowerCase(),null,!1)});var Ql=/[\-:]([a-z])/g;function Zl(t){return t[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(t){var e=t.replace(Ql,Zl);we[e]=new Ne(e,1,!1,t,null,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Ql,Zl);we[e]=new Ne(e,1,!1,t,"http://www.w3.org/1999/xlink",!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Ql,Zl);we[e]=new Ne(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1)});["tabIndex","crossOrigin"].forEach(function(t){we[t]=new Ne(t,1,!1,t.toLowerCase(),null,!1)});we.xlinkHref=new Ne("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0);["src","href","action","formAction"].forEach(function(t){we[t]=new Ne(t,1,!1,t.toLowerCase(),null,!0)});var tt=sa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;tt.hasOwnProperty("ReactCurrentDispatcher")||(tt.ReactCurrentDispatcher={current:null});tt.hasOwnProperty("ReactCurrentBatchConfig")||(tt.ReactCurrentBatchConfig={suspense:null});function Yl(t,e,i,n){var r=we.hasOwnProperty(e)?we[e]:null,s=r!==null?r.type===0:n?!1:!(!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N");s||(Yx(e,i,r,n)&&(i=null),n||r===null?Qx(e)&&(i===null?t.removeAttribute(e):t.setAttribute(e,""+i)):r.mustUseProperty?t[r.propertyName]=i===null?r.type===3?!1:"":i:(e=r.attributeName,n=r.attributeNamespace,i===null?t.removeAttribute(e):(r=r.type,i=r===3||r===4&&i===!0?"":""+i,n?t.setAttributeNS(n,e,i):t.setAttribute(e,i))))}var Gx=/^(.*)[\\\/]/,je=typeof Symbol=="function"&&Symbol.for,Rr=je?Symbol.for("react.element"):60103,_i=je?Symbol.for("react.portal"):60106,ai=je?Symbol.for("react.fragment"):60107,Bf=je?Symbol.for("react.strict_mode"):60108,qr=je?Symbol.for("react.profiler"):60114,zf=je?Symbol.for("react.provider"):60109,Df=je?Symbol.for("react.context"):60110,Xx=je?Symbol.for("react.concurrent_mode"):60111,Gl=je?Symbol.for("react.forward_ref"):60112,es=je?Symbol.for("react.suspense"):60113,xo=je?Symbol.for("react.suspense_list"):60120,Xl=je?Symbol.for("react.memo"):60115,Lf=je?Symbol.for("react.lazy"):60116,Rf=je?Symbol.for("react.block"):60121,Bc=typeof Symbol=="function"&&Symbol.iterator;function xn(t){return t===null||typeof t!="object"?null:(t=Bc&&t[Bc]||t["@@iterator"],typeof t=="function"?t:null)}function Jx(t){if(t._status===-1){t._status=0;var e=t._ctor;e=e(),t._result=e,e.then(function(i){t._status===0&&(i=i.default,t._status=1,t._result=i)},function(i){t._status===0&&(t._status=2,t._result=i)})}}function At(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ai:return"Fragment";case _i:return"Portal";case qr:return"Profiler";case Bf:return"StrictMode";case es:return"Suspense";case xo:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Df:return"Context.Consumer";case zf:return"Context.Provider";case Gl:var e=t.render;return e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case Xl:return At(t.type);case Rf:return At(t.render);case Lf:if(t=t._status===1?t._result:null)return At(t)}return null}function Jl(t){var e="";do{e:switch(t.tag){case 3:case 4:case 6:case 7:case 10:case 9:var i="";break e;default:var n=t._debugOwner,r=t._debugSource,s=At(t.type);i=null,n&&(i=At(n.type)),n=s,s="",r?s=" (at "+r.fileName.replace(Gx,"")+":"+r.lineNumber+")":i&&(s=" (created by "+i+")"),i=`
44
+ in `+(n||"Unknown")+s}e+=i,t=t.return}while(t);return e}function Yt(t){switch(typeof t){case"boolean":case"number":case"object":case"string":case"undefined":return t;default:return""}}function jf(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Kx(t){var e=jf(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof i!="undefined"&&typeof i.get=="function"&&typeof i.set=="function"){var r=i.get,s=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(a){n=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function jr(t){t._valueTracker||(t._valueTracker=Kx(t))}function _f(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var i=e.getValue(),n="";return t&&(n=jf(t)?t.checked?"true":"false":t.value),t=n,t!==i?(e.setValue(t),!0):!1}function So(t,e){var i=e.checked;return Ee({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i!=null?i:t._wrapperState.initialChecked})}function zc(t,e){var i=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;i=Yt(e.value!=null?e.value:i),t._wrapperState={initialChecked:n,initialValue:i,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Vf(t,e){e=e.checked,e!=null&&Yl(t,"checked",e,!1)}function Mo(t,e){Vf(t,e);var i=Yt(e.value),n=e.type;if(i!=null)n==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Co(t,e.type,i):e.hasOwnProperty("defaultValue")&&Co(t,e.type,Yt(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Dc(t,e,i){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,i||e===t.value||(t.value=e),t.defaultValue=e}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function Co(t,e,i){(e!=="number"||t.ownerDocument.activeElement!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}function qx(t){var e="";return sa.Children.forEach(t,function(i){i!=null&&(e+=i)}),e}function Io(t,e){return t=Ee({children:void 0},e),(e=qx(e.children))&&(t.children=e),t}function Gi(t,e,i,n){if(t=t.options,e){e={};for(var r=0;r<i.length;r++)e["$"+i[r]]=!0;for(i=0;i<t.length;i++)r=e.hasOwnProperty("$"+t[i].value),t[i].selected!==r&&(t[i].selected=r),r&&n&&(t[i].defaultSelected=!0)}else{for(i=""+Yt(i),e=null,r=0;r<t.length;r++){if(t[r].value===i){t[r].selected=!0,n&&(t[r].defaultSelected=!0);return}e!==null||t[r].disabled||(e=t[r])}e!==null&&(e.selected=!0)}}function bo(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(C(91));return Ee({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Lc(t,e){var i=e.value;if(i==null){if(i=e.children,e=e.defaultValue,i!=null){if(e!=null)throw Error(C(92));if(Array.isArray(i)){if(!(1>=i.length))throw Error(C(93));i=i[0]}e=i}e==null&&(e=""),i=e}t._wrapperState={initialValue:Yt(i)}}function Of(t,e){var i=Yt(e.value),n=Yt(e.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),e.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),n!=null&&(t.defaultValue=""+n)}function Rc(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}var Uf={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function $f(t){switch(t){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 Ao(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?$f(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var _r,Wf=function(t){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(e,i,n,r){MSApp.execUnsafeLocalFunction(function(){return t(e,i,n,r)})}:t}(function(t,e){if(t.namespaceURI!==Uf.svg||"innerHTML"in t)t.innerHTML=e;else{for(_r=_r||document.createElement("div"),_r.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=_r.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function er(t,e){if(e){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=e;return}}t.textContent=e}function Vr(t,e){var i={};return i[t.toLowerCase()]=e.toLowerCase(),i["Webkit"+t]="webkit"+e,i["Moz"+t]="moz"+e,i}var Vi={animationend:Vr("Animation","AnimationEnd"),animationiteration:Vr("Animation","AnimationIteration"),animationstart:Vr("Animation","AnimationStart"),transitionend:Vr("Transition","TransitionEnd")},Da={},Hf={};qt&&(Hf=document.createElement("div").style,"AnimationEvent"in window||(delete Vi.animationend.animation,delete Vi.animationiteration.animation,delete Vi.animationstart.animation),"TransitionEvent"in window||delete Vi.transitionend.transition);function aa(t){if(Da[t])return Da[t];if(!Vi[t])return t;var e=Vi[t],i;for(i in e)if(e.hasOwnProperty(i)&&i in Hf)return Da[t]=e[i];return t}var Ff=aa("animationend"),Qf=aa("animationiteration"),Zf=aa("animationstart"),Yf=aa("transitionend"),Pn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),jc=new(typeof WeakMap=="function"?WeakMap:Map);function Kl(t){var e=jc.get(t);return e===void 0&&(e=new Map,jc.set(t,e)),e}function Ei(t){var e=t,i=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.effectTag&1026)!==0&&(i=e.return),t=e.return;while(t)}return e.tag===3?i:null}function Gf(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function _c(t){if(Ei(t)!==t)throw Error(C(188))}function e0(t){var e=t.alternate;if(!e){if(e=Ei(t),e===null)throw Error(C(188));return e!==t?null:t}for(var i=t,n=e;;){var r=i.return;if(r===null)break;var s=r.alternate;if(s===null){if(n=r.return,n!==null){i=n;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===i)return _c(r),t;if(s===n)return _c(r),e;s=s.sibling}throw Error(C(188))}if(i.return!==n.return)i=r,n=s;else{for(var a=!1,o=r.child;o;){if(o===i){a=!0,i=r,n=s;break}if(o===n){a=!0,n=r,i=s;break}o=o.sibling}if(!a){for(o=s.child;o;){if(o===i){a=!0,i=s,n=r;break}if(o===n){a=!0,n=s,i=r;break}o=o.sibling}if(!a)throw Error(C(189))}}if(i.alternate!==n)throw Error(C(190))}if(i.tag!==3)throw Error(C(188));return i.stateNode.current===i?t:e}function Xf(t){if(t=e0(t),!t)return null;for(var e=t;;){if(e.tag===5||e.tag===6)return e;if(e.child)e.child.return=e,e=e.child;else{if(e===t)break;for(;!e.sibling;){if(!e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}}return null}function rn(t,e){if(e==null)throw Error(C(30));return t==null?e:Array.isArray(t)?Array.isArray(e)?(t.push.apply(t,e),t):(t.push(e),t):Array.isArray(e)?[t].concat(e):[t,e]}function ql(t,e,i){Array.isArray(t)?t.forEach(e,i):t&&e.call(i,t)}var Sn=null;function t0(t){if(t){var e=t._dispatchListeners,i=t._dispatchInstances;if(Array.isArray(e))for(var n=0;n<e.length&&!t.isPropagationStopped();n++)Ac(t,e[n],i[n]);else e&&Ac(t,e,i);t._dispatchListeners=null,t._dispatchInstances=null,t.isPersistent()||t.constructor.release(t)}}function oa(t){if(t!==null&&(Sn=rn(Sn,t)),t=Sn,Sn=null,t){if(ql(t,t0),Sn)throw Error(C(95));if(ws)throw t=vo,ws=!1,vo=null,t}}function eu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}function Jf(t){if(!qt)return!1;t="on"+t;var e=t in document;return e||(e=document.createElement("div"),e.setAttribute(t,"return;"),e=typeof e[t]=="function"),e}var Ss=[];function Kf(t){t.topLevelType=null,t.nativeEvent=null,t.targetInst=null,t.ancestors.length=0,10>Ss.length&&Ss.push(t)}function qf(t,e,i,n){if(Ss.length){var r=Ss.pop();return r.topLevelType=t,r.eventSystemFlags=n,r.nativeEvent=e,r.targetInst=i,r}return{topLevelType:t,eventSystemFlags:n,nativeEvent:e,targetInst:i,ancestors:[]}}function ep(t){var e=t.targetInst,i=e;do{if(!i){t.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;e=i.tag,e!==5&&e!==6||t.ancestors.push(i),i=xr(n)}while(i);for(i=0;i<t.ancestors.length;i++){e=t.ancestors[i];var r=eu(t.nativeEvent);n=t.topLevelType;var s=t.nativeEvent,a=t.eventSystemFlags;i===0&&(a|=64);for(var o=null,l=0;l<xs.length;l++){var u=xs[l];u&&(u=u.extractEvents(n,e,s,r,a))&&(o=rn(o,u))}oa(o)}}function To(t,e,i){if(!i.has(t)){switch(t){case"scroll":Bn(e,"scroll",!0);break;case"focus":case"blur":Bn(e,"focus",!0),Bn(e,"blur",!0),i.set("blur",null),i.set("focus",null);break;case"cancel":case"close":Jf(t)&&Bn(e,t,!0);break;case"invalid":case"submit":case"reset":break;default:Pn.indexOf(t)===-1&&se(t,e)}i.set(t,null)}}var tp,tu,ip,Eo=!1,ct=[],Ut=null,$t=null,Wt=null,tr=new Map,ir=new Map,Mn=[],No="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(" "),i0="focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture".split(" ");function n0(t,e){var i=Kl(e);No.forEach(function(n){To(n,e,i)}),i0.forEach(function(n){To(n,e,i)})}function ko(t,e,i,n,r){return{blockedOn:t,topLevelType:e,eventSystemFlags:i|32,nativeEvent:r,container:n}}function Vc(t,e){switch(t){case"focus":case"blur":Ut=null;break;case"dragenter":case"dragleave":$t=null;break;case"mouseover":case"mouseout":Wt=null;break;case"pointerover":case"pointerout":tr.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":ir.delete(e.pointerId)}}function Cn(t,e,i,n,r,s){return t===null||t.nativeEvent!==s?(t=ko(e,i,n,r,s),e!==null&&(e=Sr(e),e!==null&&tu(e)),t):(t.eventSystemFlags|=n,t)}function r0(t,e,i,n,r){switch(e){case"focus":return Ut=Cn(Ut,t,e,i,n,r),!0;case"dragenter":return $t=Cn($t,t,e,i,n,r),!0;case"mouseover":return Wt=Cn(Wt,t,e,i,n,r),!0;case"pointerover":var s=r.pointerId;return tr.set(s,Cn(tr.get(s)||null,t,e,i,n,r)),!0;case"gotpointercapture":return s=r.pointerId,ir.set(s,Cn(ir.get(s)||null,t,e,i,n,r)),!0}return!1}function s0(t){var e=xr(t.target);if(e!==null){var i=Ei(e);if(i!==null){if(e=i.tag,e===13){if(e=Gf(i),e!==null){t.blockedOn=e,ve.unstable_runWithPriority(t.priority,function(){ip(i)});return}}else if(e===3&&i.stateNode.hydrate){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ts(t){if(t.blockedOn!==null)return!1;var e=ru(t.topLevelType,t.eventSystemFlags,t.container,t.nativeEvent);if(e!==null){var i=Sr(e);return i!==null&&tu(i),t.blockedOn=e,!1}return!0}function Oc(t,e,i){ts(t)&&i.delete(e)}function a0(){for(Eo=!1;0<ct.length;){var t=ct[0];if(t.blockedOn!==null){t=Sr(t.blockedOn),t!==null&&tp(t);break}var e=ru(t.topLevelType,t.eventSystemFlags,t.container,t.nativeEvent);e!==null?t.blockedOn=e:ct.shift()}Ut!==null&&ts(Ut)&&(Ut=null),$t!==null&&ts($t)&&($t=null),Wt!==null&&ts(Wt)&&(Wt=null),tr.forEach(Oc),ir.forEach(Oc)}function In(t,e){t.blockedOn===e&&(t.blockedOn=null,Eo||(Eo=!0,ve.unstable_scheduleCallback(ve.unstable_NormalPriority,a0)))}function np(t){function e(r){return In(r,t)}if(0<ct.length){In(ct[0],t);for(var i=1;i<ct.length;i++){var n=ct[i];n.blockedOn===t&&(n.blockedOn=null)}}for(Ut!==null&&In(Ut,t),$t!==null&&In($t,t),Wt!==null&&In(Wt,t),tr.forEach(e),ir.forEach(e),i=0;i<Mn.length;i++)n=Mn[i],n.blockedOn===t&&(n.blockedOn=null);for(;0<Mn.length&&(i=Mn[0],i.blockedOn===null);)s0(i),i.blockedOn===null&&Mn.shift()}var rp={},sp=new Map,iu=new Map,o0=["abort","abort",Ff,"animationEnd",Qf,"animationIteration",Zf,"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",Yf,"transitionEnd","waiting","waiting"];function nu(t,e){for(var i=0;i<t.length;i+=2){var n=t[i],r=t[i+1],s="on"+(r[0].toUpperCase()+r.slice(1));s={phasedRegistrationNames:{bubbled:s,captured:s+"Capture"},dependencies:[n],eventPriority:e},iu.set(n,e),sp.set(n,s),rp[r]=s}}nu("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);nu("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);nu(o0,2);for(var Uc="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),La=0;La<Uc.length;La++)iu.set(Uc[La],0);var l0=ve.unstable_UserBlockingPriority,u0=ve.unstable_runWithPriority,is=!0;function se(t,e){Bn(e,t,!1)}function Bn(t,e,i){var n=iu.get(e);switch(n===void 0?2:n){case 0:n=c0.bind(null,e,1,t);break;case 1:n=h0.bind(null,e,1,t);break;default:n=la.bind(null,e,1,t)}i?t.addEventListener(e,n,!0):t.addEventListener(e,n,!1)}function c0(t,e,i,n){oi||Hl();var r=la,s=oi;oi=!0;try{Nf(r,t,e,i,n)}finally{(oi=s)||Fl()}}function h0(t,e,i,n){u0(l0,la.bind(null,t,e,i,n))}function la(t,e,i,n){if(is)if(0<ct.length&&-1<No.indexOf(t))t=ko(null,t,e,i,n),ct.push(t);else{var r=ru(t,e,i,n);if(r===null)Vc(t,n);else if(-1<No.indexOf(t))t=ko(r,t,e,i,n),ct.push(t);else if(!r0(r,t,e,i,n)){Vc(t,n),t=qf(t,n,null,e);try{Pf(ep,t)}finally{Kf(t)}}}}function ru(t,e,i,n){if(i=eu(n),i=xr(i),i!==null){var r=Ei(i);if(r===null)i=null;else{var s=r.tag;if(s===13){if(i=Gf(r),i!==null)return i;i=null}else if(s===3){if(r.stateNode.hydrate)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}t=qf(t,n,i,e);try{Pf(ep,t)}finally{Kf(t)}return null}var $n={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},d0=["Webkit","ms","Moz","O"];Object.keys($n).forEach(function(t){d0.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),$n[e]=$n[t]})});function ap(t,e,i){return e==null||typeof e=="boolean"||e===""?"":i||typeof e!="number"||e===0||$n.hasOwnProperty(t)&&$n[t]?(""+e).trim():e+"px"}function op(t,e){t=t.style;for(var i in e)if(e.hasOwnProperty(i)){var n=i.indexOf("--")===0,r=ap(i,e[i],n);i==="float"&&(i="cssFloat"),n?t.setProperty(i,r):t[i]=r}}var f0=Ee({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 Po(t,e){if(e){if(f0[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(C(137,t,""));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(C(60));if(!(typeof e.dangerouslySetInnerHTML=="object"&&"__html"in e.dangerouslySetInnerHTML))throw Error(C(61))}if(e.style!=null&&typeof e.style!="object")throw Error(C(62,""))}}function Bo(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 $c=Uf.html;function wt(t,e){t=t.nodeType===9||t.nodeType===11?t:t.ownerDocument;var i=Kl(t);e=$l[e];for(var n=0;n<e.length;n++)To(e[n],t,i)}function Ms(){}function zo(t){if(t=t||(typeof document!="undefined"?document:void 0),typeof t=="undefined")return null;try{return t.activeElement||t.body}catch{return t.body}}function Wc(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Hc(t,e){var i=Wc(t);t=0;for(var n;i;){if(i.nodeType===3){if(n=t+i.textContent.length,t<=e&&n>=e)return{node:i,offset:e-t};t=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Wc(i)}}function lp(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?lp(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Fc(){for(var t=window,e=zo();e instanceof t.HTMLIFrameElement;){try{var i=typeof e.contentWindow.location.href=="string"}catch{i=!1}if(i)t=e.contentWindow;else break;e=zo(t.document)}return e}function Do(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var up="$",cp="/$",su="$?",au="$!",Ra=null,ja=null;function hp(t,e){switch(t){case"button":case"input":case"select":case"textarea":return!!e.autoFocus}return!1}function Lo(t,e){return t==="textarea"||t==="option"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var _a=typeof setTimeout=="function"?setTimeout:void 0,p0=typeof clearTimeout=="function"?clearTimeout:void 0;function Xi(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break}return t}function Qc(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var i=t.data;if(i===up||i===au||i===su){if(e===0)return t;e--}else i===cp&&e++}t=t.previousSibling}return null}var ou=Math.random().toString(36).slice(2),Dt="__reactInternalInstance$"+ou,Cs="__reactEventHandlers$"+ou,yr="__reactContainere$"+ou;function xr(t){var e=t[Dt];if(e)return e;for(var i=t.parentNode;i;){if(e=i[yr]||i[Dt]){if(i=e.alternate,e.child!==null||i!==null&&i.child!==null)for(t=Qc(t);t!==null;){if(i=t[Dt])return i;t=Qc(t)}return e}t=i,i=t.parentNode}return null}function Sr(t){return t=t[Dt]||t[yr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Si(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(C(33))}function lu(t){return t[Cs]||null}function yt(t){do t=t.return;while(t&&t.tag!==5);return t||null}function dp(t,e){var i=t.stateNode;if(!i)return null;var n=Ul(i);if(!n)return null;i=n[e];e:switch(e){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)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(C(231,e,typeof i));return i}function Zc(t,e,i){(e=dp(t,i.dispatchConfig.phasedRegistrationNames[e]))&&(i._dispatchListeners=rn(i._dispatchListeners,e),i._dispatchInstances=rn(i._dispatchInstances,t))}function g0(t){if(t&&t.dispatchConfig.phasedRegistrationNames){for(var e=t._targetInst,i=[];e;)i.push(e),e=yt(e);for(e=i.length;0<e--;)Zc(i[e],"captured",t);for(e=0;e<i.length;e++)Zc(i[e],"bubbled",t)}}function Ro(t,e,i){t&&i&&i.dispatchConfig.registrationName&&(e=dp(t,i.dispatchConfig.registrationName))&&(i._dispatchListeners=rn(i._dispatchListeners,e),i._dispatchInstances=rn(i._dispatchInstances,t))}function m0(t){t&&t.dispatchConfig.registrationName&&Ro(t._targetInst,null,t)}function sn(t){ql(t,g0)}var Lt=null,uu=null,ns=null;function fp(){if(ns)return ns;var t,e=uu,i=e.length,n,r="value"in Lt?Lt.value:Lt.textContent,s=r.length;for(t=0;t<i&&e[t]===r[t];t++);var a=i-t;for(n=1;n<=a&&e[i-n]===r[s-n];n++);return ns=r.slice(t,1<n?1-n:void 0)}function rs(){return!0}function Is(){return!1}function Fe(t,e,i,n){this.dispatchConfig=t,this._targetInst=e,this.nativeEvent=i,t=this.constructor.Interface;for(var r in t)t.hasOwnProperty(r)&&((e=t[r])?this[r]=e(i):r==="target"?this.target=n:this[r]=i[r]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?rs:Is,this.isPropagationStopped=Is,this}Ee(Fe.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=rs)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=rs)},persist:function(){this.isPersistent=rs},isPersistent:Is,destructor:function(){var t=this.constructor.Interface,e;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=Is,this._dispatchInstances=this._dispatchListeners=null}});Fe.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};Fe.extend=function(t){function e(){}function i(){return n.apply(this,arguments)}var n=this;e.prototype=n.prototype;var r=new e;return Ee(r,i.prototype),i.prototype=r,i.prototype.constructor=i,i.Interface=Ee({},n.Interface,t),i.extend=n.extend,pp(i),i};pp(Fe);function v0(t,e,i,n){if(this.eventPool.length){var r=this.eventPool.pop();return this.call(r,t,e,i,n),r}return new this(t,e,i,n)}function w0(t){if(!(t instanceof this))throw Error(C(279));t.destructor(),10>this.eventPool.length&&this.eventPool.push(t)}function pp(t){t.eventPool=[],t.getPooled=v0,t.release=w0}var y0=Fe.extend({data:null}),x0=Fe.extend({data:null}),S0=[9,13,27,32],cu=qt&&"CompositionEvent"in window,Wn=null;qt&&"documentMode"in document&&(Wn=document.documentMode);var M0=qt&&"TextEvent"in window&&!Wn,gp=qt&&(!cu||Wn&&8<Wn&&11>=Wn),Yc=String.fromCharCode(32),vt={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(" ")}},Gc=!1;function mp(t,e){switch(t){case"keyup":return S0.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function vp(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Oi=!1;function C0(t,e){switch(t){case"compositionend":return vp(e);case"keypress":return e.which!==32?null:(Gc=!0,Yc);case"textInput":return t=e.data,t===Yc&&Gc?null:t;default:return null}}function I0(t,e){if(Oi)return t==="compositionend"||!cu&&mp(t,e)?(t=fp(),ns=uu=Lt=null,Oi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return gp&&e.locale!=="ko"?null:e.data;default:return null}}var b0={eventTypes:vt,extractEvents:function(t,e,i,n){var r;if(cu)e:{switch(t){case"compositionstart":var s=vt.compositionStart;break e;case"compositionend":s=vt.compositionEnd;break e;case"compositionupdate":s=vt.compositionUpdate;break e}s=void 0}else Oi?mp(t,i)&&(s=vt.compositionEnd):t==="keydown"&&i.keyCode===229&&(s=vt.compositionStart);return s?(gp&&i.locale!=="ko"&&(Oi||s!==vt.compositionStart?s===vt.compositionEnd&&Oi&&(r=fp()):(Lt=n,uu="value"in Lt?Lt.value:Lt.textContent,Oi=!0)),s=y0.getPooled(s,e,i,n),r?s.data=r:(r=vp(i),r!==null&&(s.data=r)),sn(s),r=s):r=null,(t=M0?C0(t,i):I0(t,i))?(e=x0.getPooled(vt.beforeInput,e,i,n),e.data=t,sn(e)):e=null,r===null?e:e===null?r:[r,e]}},A0={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 wp(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!A0[t.type]:e==="textarea"}var yp={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function xp(t,e,i){return t=Fe.getPooled(yp.change,t,e,i),t.type="change",Tf(i),sn(t),t}var Hn=null,nr=null;function T0(t){oa(t)}function ua(t){var e=Si(t);if(_f(e))return t}function E0(t,e){if(t==="change")return e}var jo=!1;qt&&(jo=Jf("input")&&(!document.documentMode||9<document.documentMode));function Xc(){Hn&&(Hn.detachEvent("onpropertychange",Sp),nr=Hn=null)}function Sp(t){if(t.propertyName==="value"&&ua(nr))if(t=xp(nr,t,eu(t)),oi)oa(t);else{oi=!0;try{Wl(T0,t)}finally{oi=!1,Fl()}}}function N0(t,e,i){t==="focus"?(Xc(),Hn=e,nr=i,Hn.attachEvent("onpropertychange",Sp)):t==="blur"&&Xc()}function k0(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ua(nr)}function P0(t,e){if(t==="click")return ua(e)}function B0(t,e){if(t==="input"||t==="change")return ua(e)}var z0={eventTypes:yp,_isInputEventSupported:jo,extractEvents:function(t,e,i,n){var r=e?Si(e):window,s=r.nodeName&&r.nodeName.toLowerCase();if(s==="select"||s==="input"&&r.type==="file")var a=E0;else if(wp(r))if(jo)a=B0;else{a=k0;var o=N0}else(s=r.nodeName)&&s.toLowerCase()==="input"&&(r.type==="checkbox"||r.type==="radio")&&(a=P0);if(a&&(a=a(t,e)))return xp(a,i,n);o&&o(t,r,e),t==="blur"&&(t=r._wrapperState)&&t.controlled&&r.type==="number"&&Co(r,"number",r.value)}},Mr=Fe.extend({view:null,detail:null}),D0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function L0(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=D0[t])?!!e[t]:!1}function hu(){return L0}var Jc=0,Kc=0,qc=!1,eh=!1,Cr=Mr.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:hu,button:null,buttons:null,relatedTarget:function(t){return t.relatedTarget||(t.fromElement===t.srcElement?t.toElement:t.fromElement)},movementX:function(t){if("movementX"in t)return t.movementX;var e=Jc;return Jc=t.screenX,qc?t.type==="mousemove"?t.screenX-e:0:(qc=!0,0)},movementY:function(t){if("movementY"in t)return t.movementY;var e=Kc;return Kc=t.screenY,eh?t.type==="mousemove"?t.screenY-e:0:(eh=!0,0)}}),Mp=Cr.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),bn={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},R0={eventTypes:bn,extractEvents:function(t,e,i,n,r){var s=t==="mouseover"||t==="pointerover",a=t==="mouseout"||t==="pointerout";if(s&&(r&32)===0&&(i.relatedTarget||i.fromElement)||!a&&!s)return null;if(s=n.window===n?n:(s=n.ownerDocument)?s.defaultView||s.parentWindow:window,a){if(a=e,e=(e=i.relatedTarget||i.toElement)?xr(e):null,e!==null){var o=Ei(e);(e!==o||e.tag!==5&&e.tag!==6)&&(e=null)}}else a=null;if(a===e)return null;if(t==="mouseout"||t==="mouseover")var l=Cr,u=bn.mouseLeave,h=bn.mouseEnter,c="mouse";else(t==="pointerout"||t==="pointerover")&&(l=Mp,u=bn.pointerLeave,h=bn.pointerEnter,c="pointer");if(t=a==null?s:Si(a),s=e==null?s:Si(e),u=l.getPooled(u,a,i,n),u.type=c+"leave",u.target=t,u.relatedTarget=s,i=l.getPooled(h,e,i,n),i.type=c+"enter",i.target=s,i.relatedTarget=t,n=a,c=e,n&&c)e:{for(l=n,h=c,a=0,t=l;t;t=yt(t))a++;for(t=0,e=h;e;e=yt(e))t++;for(;0<a-t;)l=yt(l),a--;for(;0<t-a;)h=yt(h),t--;for(;a--;){if(l===h||l===h.alternate)break e;l=yt(l),h=yt(h)}l=null}else l=null;for(h=l,l=[];n&&n!==h&&(a=n.alternate,!(a!==null&&a===h));)l.push(n),n=yt(n);for(n=[];c&&c!==h&&(a=c.alternate,!(a!==null&&a===h));)n.push(c),c=yt(c);for(c=0;c<l.length;c++)Ro(l[c],"bubbled",u);for(c=n.length;0<c--;)Ro(n[c],"captured",i);return(r&64)===0?[u]:[u,i]}};function j0(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Mi=typeof Object.is=="function"?Object.is:j0,_0=Object.prototype.hasOwnProperty;function rr(t,e){if(Mi(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(n=0;n<i.length;n++)if(!_0.call(e,i[n])||!Mi(t[i[n]],e[i[n]]))return!1;return!0}var V0=qt&&"documentMode"in document&&11>=document.documentMode,Cp={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Ui=null,_o=null,Fn=null,Vo=!1;function th(t,e){var i=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;return Vo||Ui==null||Ui!==zo(i)?null:(i=Ui,"selectionStart"in i&&Do(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}),Fn&&rr(Fn,i)?null:(Fn=i,t=Fe.getPooled(Cp.select,_o,t,e),t.type="select",t.target=Ui,sn(t),t))}var O0={eventTypes:Cp,extractEvents:function(t,e,i,n,r,s){if(r=s||(n.window===n?n.document:n.nodeType===9?n:n.ownerDocument),!(s=!r)){e:{r=Kl(r),s=$l.onSelect;for(var a=0;a<s.length;a++)if(!r.has(s[a])){r=!1;break e}r=!0}s=!r}if(s)return null;switch(r=e?Si(e):window,t){case"focus":(wp(r)||r.contentEditable==="true")&&(Ui=r,_o=e,Fn=null);break;case"blur":Fn=_o=Ui=null;break;case"mousedown":Vo=!0;break;case"contextmenu":case"mouseup":case"dragend":return Vo=!1,th(i,n);case"selectionchange":if(V0)break;case"keydown":case"keyup":return th(i,n)}return null}},U0=Fe.extend({animationName:null,elapsedTime:null,pseudoElement:null}),$0=Fe.extend({clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),W0=Mr.extend({relatedTarget:null});function ss(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}var H0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},F0={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"},Q0=Mr.extend({key:function(t){if(t.key){var e=H0[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=ss(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?F0[t.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:hu,charCode:function(t){return t.type==="keypress"?ss(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ss(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Z0=Cr.extend({dataTransfer:null}),Y0=Mr.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:hu}),G0=Fe.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),X0=Cr.extend({deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:null,deltaMode:null}),J0={eventTypes:rp,extractEvents:function(t,e,i,n){var r=sp.get(t);if(!r)return null;switch(t){case"keypress":if(ss(i)===0)return null;case"keydown":case"keyup":t=Q0;break;case"blur":case"focus":t=W0;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":t=Cr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":t=Z0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":t=Y0;break;case Ff:case Qf:case Zf:t=U0;break;case Yf:t=G0;break;case"scroll":t=Mr;break;case"wheel":t=X0;break;case"copy":case"cut":case"paste":t=$0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":t=Mp;break;default:t=Fe}return e=t.getPooled(r,e,i,n),sn(e),e}};if(ys)throw Error(C(101));ys=Array.prototype.slice.call("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));bf();var K0=Sr;Ul=lu;Cf=K0;If=Si;Af({SimpleEventPlugin:J0,EnterLeaveEventPlugin:R0,ChangeEventPlugin:z0,SelectEventPlugin:O0,BeforeInputEventPlugin:b0});var Oo=[],$i=-1;function ee(t){0>$i||(t.current=Oo[$i],Oo[$i]=null,$i--)}function ue(t,e){$i++,Oo[$i]=t.current,t.current=e}var Gt={},Ce={current:Gt},De={current:!1},Ci=Gt;function an(t,e){var i=t.type.contextTypes;if(!i)return Gt;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in i)r[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function Le(t){return t=t.childContextTypes,t!=null}function bs(){ee(De),ee(Ce)}function ih(t,e,i){if(Ce.current!==Gt)throw Error(C(168));ue(Ce,e),ue(De,i)}function Ip(t,e,i){var n=t.stateNode;if(t=e.childContextTypes,typeof n.getChildContext!="function")return i;n=n.getChildContext();for(var r in n)if(!(r in t))throw Error(C(108,At(e)||"Unknown",r));return Ee({},i,{},n)}function as(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Gt,Ci=Ce.current,ue(Ce,t),ue(De,De.current),!0}function nh(t,e,i){var n=t.stateNode;if(!n)throw Error(C(169));i?(t=Ip(t,e,Ci),n.__reactInternalMemoizedMergedChildContext=t,ee(De),ee(Ce),ue(Ce,t)):ee(De),ue(De,i)}var q0=ve.unstable_runWithPriority,du=ve.unstable_scheduleCallback,bp=ve.unstable_cancelCallback,rh=ve.unstable_requestPaint,Uo=ve.unstable_now,eS=ve.unstable_getCurrentPriorityLevel,ca=ve.unstable_ImmediatePriority,Ap=ve.unstable_UserBlockingPriority,Tp=ve.unstable_NormalPriority,Ep=ve.unstable_LowPriority,Np=ve.unstable_IdlePriority,kp={},tS=ve.unstable_shouldYield,iS=rh!==void 0?rh:function(){},St=null,os=null,Va=!1,sh=Uo(),Ze=1e4>sh?Uo:function(){return Uo()-sh};function ha(){switch(eS()){case ca:return 99;case Ap:return 98;case Tp:return 97;case Ep:return 96;case Np:return 95;default:throw Error(C(332))}}function Pp(t){switch(t){case 99:return ca;case 98:return Ap;case 97:return Tp;case 96:return Ep;case 95:return Np;default:throw Error(C(332))}}function Xt(t,e){return t=Pp(t),q0(t,e)}function Bp(t,e,i){return t=Pp(t),du(t,e,i)}function ah(t){return St===null?(St=[t],os=du(ca,zp)):St.push(t),kp}function mt(){if(os!==null){var t=os;os=null,bp(t)}zp()}function zp(){if(!Va&&St!==null){Va=!0;var t=0;try{var e=St;Xt(99,function(){for(;t<e.length;t++){var i=e[t];do i=i(!0);while(i!==null)}}),St=null}catch(i){throw St!==null&&(St=St.slice(t+1)),du(ca,mt),i}finally{Va=!1}}}function ls(t,e,i){return i/=10,1073741821-(((1073741821-t+e/10)/i|0)+1)*i}function qe(t,e){if(t&&t.defaultProps){e=Ee({},e),t=t.defaultProps;for(var i in t)e[i]===void 0&&(e[i]=t[i])}return e}var As={current:null},Ts=null,Wi=null,Es=null;function fu(){Es=Wi=Ts=null}function pu(t){var e=As.current;ee(As),t.type._context._currentValue=e}function Dp(t,e){for(;t!==null;){var i=t.alternate;if(t.childExpirationTime<e)t.childExpirationTime=e,i!==null&&i.childExpirationTime<e&&(i.childExpirationTime=e);else if(i!==null&&i.childExpirationTime<e)i.childExpirationTime=e;else break;t=t.return}}function Ji(t,e){Ts=t,Es=Wi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.expirationTime>=e&&(ht=!0),t.firstContext=null)}function Ge(t,e){if(Es!==t&&e!==!1&&e!==0)if((typeof e!="number"||e===1073741823)&&(Es=t,e=1073741823),e={context:t,observedBits:e,next:null},Wi===null){if(Ts===null)throw Error(C(308));Wi=e,Ts.dependencies={expirationTime:0,firstContext:e,responders:null}}else Wi=Wi.next=e;return t._currentValue}var zt=!1;function gu(t){t.updateQueue={baseState:t.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function mu(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,baseQueue:t.baseQueue,shared:t.shared,effects:t.effects})}function Ht(t,e){return t={expirationTime:t,suspenseConfig:e,tag:0,payload:null,callback:null,next:null},t.next=t}function Ft(t,e){if(t=t.updateQueue,t!==null){t=t.shared;var i=t.pending;i===null?e.next=e:(e.next=i.next,i.next=e),t.pending=e}}function oh(t,e){var i=t.alternate;i!==null&&mu(i,t),t=t.updateQueue,i=t.baseQueue,i===null?(t.baseQueue=e.next=e,e.next=e):(e.next=i.next,i.next=e)}function sr(t,e,i,n){var r=t.updateQueue;zt=!1;var s=r.baseQueue,a=r.shared.pending;if(a!==null){if(s!==null){var o=s.next;s.next=a.next,a.next=o}s=a,r.shared.pending=null,o=t.alternate,o!==null&&(o=o.updateQueue,o!==null&&(o.baseQueue=a))}if(s!==null){o=s.next;var l=r.baseState,u=0,h=null,c=null,m=null;if(o!==null){var w=o;do{if(a=w.expirationTime,a<n){var y={expirationTime:w.expirationTime,suspenseConfig:w.suspenseConfig,tag:w.tag,payload:w.payload,callback:w.callback,next:null};m===null?(c=m=y,h=l):m=m.next=y,a>u&&(u=a)}else{m!==null&&(m=m.next={expirationTime:1073741823,suspenseConfig:w.suspenseConfig,tag:w.tag,payload:w.payload,callback:w.callback,next:null}),cg(a,w.suspenseConfig);e:{var x=t,d=w;switch(a=e,y=i,d.tag){case 1:if(x=d.payload,typeof x=="function"){l=x.call(y,l,a);break e}l=x;break e;case 3:x.effectTag=x.effectTag&-4097|64;case 0:if(x=d.payload,a=typeof x=="function"?x.call(y,l,a):x,a==null)break e;l=Ee({},l,a);break e;case 2:zt=!0}}w.callback!==null&&(t.effectTag|=32,a=r.effects,a===null?r.effects=[w]:a.push(w))}if(w=w.next,w===null||w===o){if(a=r.shared.pending,a===null)break;w=s.next=a.next,a.next=o,r.baseQueue=s=a,r.shared.pending=null}}while(1)}m===null?h=l:m.next=c,r.baseState=h,r.baseQueue=m,ma(u),t.expirationTime=u,t.memoizedState=l}}function lh(t,e,i){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],r=n.callback;if(r!==null){if(n.callback=null,n=r,r=i,typeof n!="function")throw Error(C(191,n));n.call(r)}}}var Qn=tt.ReactCurrentBatchConfig,Lp=new sa.Component().refs;function Ns(t,e,i,n){e=t.memoizedState,i=i(n,e),i=i==null?e:Ee({},e,i),t.memoizedState=i,t.expirationTime===0&&(t.updateQueue.baseState=i)}var da={isMounted:function(t){return(t=t._reactInternalFiber)?Ei(t)===t:!1},enqueueSetState:function(t,e,i){t=t._reactInternalFiber;var n=pt(),r=Qn.suspense;n=vi(n,t,r),r=Ht(n,r),r.payload=e,i!=null&&(r.callback=i),Ft(t,r),Zt(t,n)},enqueueReplaceState:function(t,e,i){t=t._reactInternalFiber;var n=pt(),r=Qn.suspense;n=vi(n,t,r),r=Ht(n,r),r.tag=1,r.payload=e,i!=null&&(r.callback=i),Ft(t,r),Zt(t,n)},enqueueForceUpdate:function(t,e){t=t._reactInternalFiber;var i=pt(),n=Qn.suspense;i=vi(i,t,n),n=Ht(i,n),n.tag=2,e!=null&&(n.callback=e),Ft(t,n),Zt(t,i)}};function uh(t,e,i,n,r,s,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,s,a):e.prototype&&e.prototype.isPureReactComponent?!rr(i,n)||!rr(r,s):!0}function Rp(t,e,i){var n=!1,r=Gt,s=e.contextType;return typeof s=="object"&&s!==null?s=Ge(s):(r=Le(e)?Ci:Ce.current,n=e.contextTypes,s=(n=n!=null)?an(t,r):Gt),e=new e(i,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=da,t.stateNode=e,e._reactInternalFiber=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=s),e}function ch(t,e,i,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(i,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(i,n),e.state!==t&&da.enqueueReplaceState(e,e.state,null)}function $o(t,e,i,n){var r=t.stateNode;r.props=i,r.state=t.memoizedState,r.refs=Lp,gu(t);var s=e.contextType;typeof s=="object"&&s!==null?r.context=Ge(s):(s=Le(e)?Ci:Ce.current,r.context=an(t,s)),sr(t,i,r,n),r.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(Ns(t,e,s,i),r.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&da.enqueueReplaceState(r,r.state,null),sr(t,i,r,n),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.effectTag|=4)}var Or=Array.isArray;function An(t,e,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(C(309));var n=i.stateNode}if(!n)throw Error(C(147,t));var r=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===r?e.ref:(e=function(s){var a=n.refs;a===Lp&&(a=n.refs={}),s===null?delete a[r]:a[r]=s},e._stringRef=r,e)}if(typeof t!="string")throw Error(C(284));if(!i._owner)throw Error(C(290,t))}return t}function Ur(t,e){if(t.type!=="textarea")throw Error(C(31,Object.prototype.toString.call(e)==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":e,""))}function jp(t){function e(d,f){if(t){var p=d.lastEffect;p!==null?(p.nextEffect=f,d.lastEffect=f):d.firstEffect=d.lastEffect=f,f.nextEffect=null,f.effectTag=8}}function i(d,f){if(!t)return null;for(;f!==null;)e(d,f),f=f.sibling;return null}function n(d,f){for(d=new Map;f!==null;)f.key!==null?d.set(f.key,f):d.set(f.index,f),f=f.sibling;return d}function r(d,f){return d=Ii(d,f),d.index=0,d.sibling=null,d}function s(d,f,p){return d.index=p,t?(p=d.alternate,p!==null?(p=p.index,p<f?(d.effectTag=2,f):p):(d.effectTag=2,f)):f}function a(d){return t&&d.alternate===null&&(d.effectTag=2),d}function o(d,f,p,g){return f===null||f.tag!==6?(f=Fa(p,d.mode,g),f.return=d,f):(f=r(f,p),f.return=d,f)}function l(d,f,p,g){return f!==null&&f.elementType===p.type?(g=r(f,p.props),g.ref=An(d,f,p),g.return=d,g):(g=ds(p.type,p.key,p.props,null,d.mode,g),g.ref=An(d,f,p),g.return=d,g)}function u(d,f,p,g){return f===null||f.tag!==4||f.stateNode.containerInfo!==p.containerInfo||f.stateNode.implementation!==p.implementation?(f=Qa(p,d.mode,g),f.return=d,f):(f=r(f,p.children||[]),f.return=d,f)}function h(d,f,p,g,v){return f===null||f.tag!==7?(f=_t(p,d.mode,g,v),f.return=d,f):(f=r(f,p),f.return=d,f)}function c(d,f,p){if(typeof f=="string"||typeof f=="number")return f=Fa(""+f,d.mode,p),f.return=d,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case Rr:return p=ds(f.type,f.key,f.props,null,d.mode,p),p.ref=An(d,null,f),p.return=d,p;case _i:return f=Qa(f,d.mode,p),f.return=d,f}if(Or(f)||xn(f))return f=_t(f,d.mode,p,null),f.return=d,f;Ur(d,f)}return null}function m(d,f,p,g){var v=f!==null?f.key:null;if(typeof p=="string"||typeof p=="number")return v!==null?null:o(d,f,""+p,g);if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Rr:return p.key===v?p.type===ai?h(d,f,p.props.children,g,v):l(d,f,p,g):null;case _i:return p.key===v?u(d,f,p,g):null}if(Or(p)||xn(p))return v!==null?null:h(d,f,p,g,null);Ur(d,p)}return null}function w(d,f,p,g,v){if(typeof g=="string"||typeof g=="number")return d=d.get(p)||null,o(f,d,""+g,v);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Rr:return d=d.get(g.key===null?p:g.key)||null,g.type===ai?h(f,d,g.props.children,v,g.key):l(f,d,g,v);case _i:return d=d.get(g.key===null?p:g.key)||null,u(f,d,g,v)}if(Or(g)||xn(g))return d=d.get(p)||null,h(f,d,g,v,null);Ur(f,g)}return null}function y(d,f,p,g){for(var v=null,S=null,E=f,P=f=0,k=null;E!==null&&P<p.length;P++){E.index>P?(k=E,E=null):k=E.sibling;var z=m(d,E,p[P],g);if(z===null){E===null&&(E=k);break}t&&E&&z.alternate===null&&e(d,E),f=s(z,f,P),S===null?v=z:S.sibling=z,S=z,E=k}if(P===p.length)return i(d,E),v;if(E===null){for(;P<p.length;P++)E=c(d,p[P],g),E!==null&&(f=s(E,f,P),S===null?v=E:S.sibling=E,S=E);return v}for(E=n(d,E);P<p.length;P++)k=w(E,d,P,p[P],g),k!==null&&(t&&k.alternate!==null&&E.delete(k.key===null?P:k.key),f=s(k,f,P),S===null?v=k:S.sibling=k,S=k);return t&&E.forEach(function(te){return e(d,te)}),v}function x(d,f,p,g){var v=xn(p);if(typeof v!="function")throw Error(C(150));if(p=v.call(p),p==null)throw Error(C(151));for(var S=v=null,E=f,P=f=0,k=null,z=p.next();E!==null&&!z.done;P++,z=p.next()){E.index>P?(k=E,E=null):k=E.sibling;var te=m(d,E,z.value,g);if(te===null){E===null&&(E=k);break}t&&E&&te.alternate===null&&e(d,E),f=s(te,f,P),S===null?v=te:S.sibling=te,S=te,E=k}if(z.done)return i(d,E),v;if(E===null){for(;!z.done;P++,z=p.next())z=c(d,z.value,g),z!==null&&(f=s(z,f,P),S===null?v=z:S.sibling=z,S=z);return v}for(E=n(d,E);!z.done;P++,z=p.next())z=w(E,d,P,z.value,g),z!==null&&(t&&z.alternate!==null&&E.delete(z.key===null?P:z.key),f=s(z,f,P),S===null?v=z:S.sibling=z,S=z);return t&&E.forEach(function(I){return e(d,I)}),v}return function(d,f,p,g){var v=typeof p=="object"&&p!==null&&p.type===ai&&p.key===null;v&&(p=p.props.children);var S=typeof p=="object"&&p!==null;if(S)switch(p.$$typeof){case Rr:e:{for(S=p.key,v=f;v!==null;){if(v.key===S){switch(v.tag){case 7:if(p.type===ai){i(d,v.sibling),f=r(v,p.props.children),f.return=d,d=f;break e}break;default:if(v.elementType===p.type){i(d,v.sibling),f=r(v,p.props),f.ref=An(d,v,p),f.return=d,d=f;break e}}i(d,v);break}else e(d,v);v=v.sibling}p.type===ai?(f=_t(p.props.children,d.mode,g,p.key),f.return=d,d=f):(g=ds(p.type,p.key,p.props,null,d.mode,g),g.ref=An(d,f,p),g.return=d,d=g)}return a(d);case _i:e:{for(v=p.key;f!==null;){if(f.key===v)if(f.tag===4&&f.stateNode.containerInfo===p.containerInfo&&f.stateNode.implementation===p.implementation){i(d,f.sibling),f=r(f,p.children||[]),f.return=d,d=f;break e}else{i(d,f);break}else e(d,f);f=f.sibling}f=Qa(p,d.mode,g),f.return=d,d=f}return a(d)}if(typeof p=="string"||typeof p=="number")return p=""+p,f!==null&&f.tag===6?(i(d,f.sibling),f=r(f,p),f.return=d,d=f):(i(d,f),f=Fa(p,d.mode,g),f.return=d,d=f),a(d);if(Or(p))return y(d,f,p,g);if(xn(p))return x(d,f,p,g);if(S&&Ur(d,p),typeof p=="undefined"&&!v)switch(d.tag){case 1:case 0:throw d=d.type,Error(C(152,d.displayName||d.name||"Component"))}return i(d,f)}}var on=jp(!0),vu=jp(!1),Ir={},ft={current:Ir},ar={current:Ir},or={current:Ir};function li(t){if(t===Ir)throw Error(C(174));return t}function Wo(t,e){switch(ue(or,e),ue(ar,t),ue(ft,Ir),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ao(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ao(e,t)}ee(ft),ue(ft,e)}function ln(){ee(ft),ee(ar),ee(or)}function hh(t){li(or.current);var e=li(ft.current),i=Ao(e,t.type);e!==i&&(ue(ar,t),ue(ft,i))}function wu(t){ar.current===t&&(ee(ft),ee(ar))}var oe={current:0};function ks(t){for(var e=t;e!==null;){if(e.tag===13){var i=e.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data===su||i.data===au))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if((e.effectTag&64)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}function yu(t,e){return{responder:t,props:e}}var us=tt.ReactCurrentDispatcher,Ye=tt.ReactCurrentBatchConfig,Rt=0,de=null,Se=null,Me=null,Ps=!1;function _e(){throw Error(C(321))}function xu(t,e){if(e===null)return!1;for(var i=0;i<e.length&&i<t.length;i++)if(!Mi(t[i],e[i]))return!1;return!0}function Su(t,e,i,n,r,s){if(Rt=s,de=e,e.memoizedState=null,e.updateQueue=null,e.expirationTime=0,us.current=t===null||t.memoizedState===null?nS:rS,t=i(n,r),e.expirationTime===Rt){s=0;do{if(e.expirationTime=0,!(25>s))throw Error(C(301));s+=1,Me=Se=null,e.updateQueue=null,us.current=sS,t=i(n,r)}while(e.expirationTime===Rt)}if(us.current=Ds,e=Se!==null&&Se.next!==null,Rt=0,Me=Se=de=null,Ps=!1,e)throw Error(C(300));return t}function Ki(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Me===null?de.memoizedState=Me=t:Me=Me.next=t,Me}function dn(){if(Se===null){var t=de.alternate;t=t!==null?t.memoizedState:null}else t=Se.next;var e=Me===null?de.memoizedState:Me.next;if(e!==null)Me=e,Se=t;else{if(t===null)throw Error(C(310));Se=t,t={memoizedState:Se.memoizedState,baseState:Se.baseState,baseQueue:Se.baseQueue,queue:Se.queue,next:null},Me===null?de.memoizedState=Me=t:Me=Me.next=t}return Me}function pi(t,e){return typeof e=="function"?e(t):e}function $r(t){var e=dn(),i=e.queue;if(i===null)throw Error(C(311));i.lastRenderedReducer=t;var n=Se,r=n.baseQueue,s=i.pending;if(s!==null){if(r!==null){var a=r.next;r.next=s.next,s.next=a}n.baseQueue=r=s,i.pending=null}if(r!==null){r=r.next,n=n.baseState;var o=a=s=null,l=r;do{var u=l.expirationTime;if(u<Rt){var h={expirationTime:l.expirationTime,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null};o===null?(a=o=h,s=n):o=o.next=h,u>de.expirationTime&&(de.expirationTime=u,ma(u))}else o!==null&&(o=o.next={expirationTime:1073741823,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null}),cg(u,l.suspenseConfig),n=l.eagerReducer===t?l.eagerState:t(n,l.action);l=l.next}while(l!==null&&l!==r);o===null?s=n:o.next=a,Mi(n,e.memoizedState)||(ht=!0),e.memoizedState=n,e.baseState=s,e.baseQueue=o,i.lastRenderedState=n}return[e.memoizedState,i.dispatch]}function Wr(t){var e=dn(),i=e.queue;if(i===null)throw Error(C(311));i.lastRenderedReducer=t;var n=i.dispatch,r=i.pending,s=e.memoizedState;if(r!==null){i.pending=null;var a=r=r.next;do s=t(s,a.action),a=a.next;while(a!==r);Mi(s,e.memoizedState)||(ht=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),i.lastRenderedState=s}return[s,n]}function Oa(t){var e=Ki();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t=e.queue={pending:null,dispatch:null,lastRenderedReducer:pi,lastRenderedState:t},t=t.dispatch=Wp.bind(null,de,t),[e.memoizedState,t]}function Ho(t,e,i,n){return t={tag:t,create:e,destroy:i,deps:n,next:null},e=de.updateQueue,e===null?(e={lastEffect:null},de.updateQueue=e,e.lastEffect=t.next=t):(i=e.lastEffect,i===null?e.lastEffect=t.next=t:(n=i.next,i.next=t,t.next=n,e.lastEffect=t)),t}function _p(){return dn().memoizedState}function Fo(t,e,i,n){var r=Ki();de.effectTag|=t,r.memoizedState=Ho(1|e,i,void 0,n===void 0?null:n)}function Mu(t,e,i,n){var r=dn();n=n===void 0?null:n;var s=void 0;if(Se!==null){var a=Se.memoizedState;if(s=a.destroy,n!==null&&xu(n,a.deps)){Ho(e,i,s,n);return}}de.effectTag|=t,r.memoizedState=Ho(1|e,i,s,n)}function dh(t,e){return Fo(516,4,t,e)}function Bs(t,e){return Mu(516,4,t,e)}function Vp(t,e){return Mu(4,2,t,e)}function Op(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Up(t,e,i){return i=i!=null?i.concat([t]):null,Mu(4,2,Op.bind(null,e,t),i)}function Cu(){}function fh(t,e){return Ki().memoizedState=[t,e===void 0?null:e],t}function zs(t,e){var i=dn();e=e===void 0?null:e;var n=i.memoizedState;return n!==null&&e!==null&&xu(e,n[1])?n[0]:(i.memoizedState=[t,e],t)}function $p(t,e){var i=dn();e=e===void 0?null:e;var n=i.memoizedState;return n!==null&&e!==null&&xu(e,n[1])?n[0]:(t=t(),i.memoizedState=[t,e],t)}function Iu(t,e,i){var n=ha();Xt(98>n?98:n,function(){t(!0)}),Xt(97<n?97:n,function(){var r=Ye.suspense;Ye.suspense=e===void 0?null:e;try{t(!1),i()}finally{Ye.suspense=r}})}function Wp(t,e,i){var n=pt(),r=Qn.suspense;n=vi(n,t,r),r={expirationTime:n,suspenseConfig:r,action:i,eagerReducer:null,eagerState:null,next:null};var s=e.pending;if(s===null?r.next=r:(r.next=s.next,s.next=r),e.pending=r,s=t.alternate,t===de||s!==null&&s===de)Ps=!0,r.expirationTime=Rt,de.expirationTime=Rt;else{if(t.expirationTime===0&&(s===null||s.expirationTime===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,i);if(r.eagerReducer=s,r.eagerState=o,Mi(o,a))return}catch{}finally{}Zt(t,n)}}var Ds={readContext:Ge,useCallback:_e,useContext:_e,useEffect:_e,useImperativeHandle:_e,useLayoutEffect:_e,useMemo:_e,useReducer:_e,useRef:_e,useState:_e,useDebugValue:_e,useResponder:_e,useDeferredValue:_e,useTransition:_e},nS={readContext:Ge,useCallback:fh,useContext:Ge,useEffect:dh,useImperativeHandle:function(t,e,i){return i=i!=null?i.concat([t]):null,Fo(4,2,Op.bind(null,e,t),i)},useLayoutEffect:function(t,e){return Fo(4,2,t,e)},useMemo:function(t,e){var i=Ki();return e=e===void 0?null:e,t=t(),i.memoizedState=[t,e],t},useReducer:function(t,e,i){var n=Ki();return e=i!==void 0?i(e):e,n.memoizedState=n.baseState=e,t=n.queue={pending:null,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},t=t.dispatch=Wp.bind(null,de,t),[n.memoizedState,t]},useRef:function(t){var e=Ki();return t={current:t},e.memoizedState=t},useState:Oa,useDebugValue:Cu,useResponder:yu,useDeferredValue:function(t,e){var i=Oa(t),n=i[0],r=i[1];return dh(function(){var s=Ye.suspense;Ye.suspense=e===void 0?null:e;try{r(t)}finally{Ye.suspense=s}},[t,e]),n},useTransition:function(t){var e=Oa(!1),i=e[0];return e=e[1],[fh(Iu.bind(null,e,t),[e,t]),i]}},rS={readContext:Ge,useCallback:zs,useContext:Ge,useEffect:Bs,useImperativeHandle:Up,useLayoutEffect:Vp,useMemo:$p,useReducer:$r,useRef:_p,useState:function(){return $r(pi)},useDebugValue:Cu,useResponder:yu,useDeferredValue:function(t,e){var i=$r(pi),n=i[0],r=i[1];return Bs(function(){var s=Ye.suspense;Ye.suspense=e===void 0?null:e;try{r(t)}finally{Ye.suspense=s}},[t,e]),n},useTransition:function(t){var e=$r(pi),i=e[0];return e=e[1],[zs(Iu.bind(null,e,t),[e,t]),i]}},sS={readContext:Ge,useCallback:zs,useContext:Ge,useEffect:Bs,useImperativeHandle:Up,useLayoutEffect:Vp,useMemo:$p,useReducer:Wr,useRef:_p,useState:function(){return Wr(pi)},useDebugValue:Cu,useResponder:yu,useDeferredValue:function(t,e){var i=Wr(pi),n=i[0],r=i[1];return Bs(function(){var s=Ye.suspense;Ye.suspense=e===void 0?null:e;try{r(t)}finally{Ye.suspense=s}},[t,e]),n},useTransition:function(t){var e=Wr(pi),i=e[0];return e=e[1],[zs(Iu.bind(null,e,t),[e,t]),i]}},It=null,jt=null,gi=!1;function Hp(t,e){var i=dt(5,null,null,0);i.elementType="DELETED",i.type="DELETED",i.stateNode=e,i.return=t,i.effectTag=8,t.lastEffect!==null?(t.lastEffect.nextEffect=i,t.lastEffect=i):t.firstEffect=t.lastEffect=i}function ph(t,e){switch(t.tag){case 5:var i=t.type;return e=e.nodeType!==1||i.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,!0):!1;case 13:return!1;default:return!1}}function Qo(t){if(gi){var e=jt;if(e){var i=e;if(!ph(t,e)){if(e=Xi(i.nextSibling),!e||!ph(t,e)){t.effectTag=t.effectTag&-1025|2,gi=!1,It=t;return}Hp(It,i)}It=t,jt=Xi(e.firstChild)}else t.effectTag=t.effectTag&-1025|2,gi=!1,It=t}}function gh(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;It=t}function Hr(t){if(t!==It)return!1;if(!gi)return gh(t),gi=!0,!1;var e=t.type;if(t.tag!==5||e!=="head"&&e!=="body"&&!Lo(e,t.memoizedProps))for(e=jt;e;)Hp(t,e),e=Xi(e.nextSibling);if(gh(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(C(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var i=t.data;if(i===cp){if(e===0){jt=Xi(t.nextSibling);break e}e--}else i!==up&&i!==au&&i!==su||e++}t=t.nextSibling}jt=null}}else jt=It?Xi(t.stateNode.nextSibling):null;return!0}function Ua(){jt=It=null,gi=!1}var aS=tt.ReactCurrentOwner,ht=!1;function Oe(t,e,i,n){e.child=t===null?vu(e,null,i,n):on(e,t.child,i,n)}function mh(t,e,i,n,r){i=i.render;var s=e.ref;return Ji(e,r),n=Su(t,e,i,n,s,r),t!==null&&!ht?(e.updateQueue=t.updateQueue,e.effectTag&=-517,t.expirationTime<=r&&(t.expirationTime=0),bt(t,e,r)):(e.effectTag|=1,Oe(t,e,n,r),e.child)}function vh(t,e,i,n,r,s){if(t===null){var a=i.type;return typeof a=="function"&&!Nu(a)&&a.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(e.tag=15,e.type=a,Fp(t,e,a,n,r,s)):(t=ds(i.type,null,n,null,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}return a=t.child,r<s&&(r=a.memoizedProps,i=i.compare,i=i!==null?i:rr,i(r,n)&&t.ref===e.ref)?bt(t,e,s):(e.effectTag|=1,t=Ii(a,n),t.ref=e.ref,t.return=e,e.child=t)}function Fp(t,e,i,n,r,s){return t!==null&&rr(t.memoizedProps,n)&&t.ref===e.ref&&(ht=!1,r<s)?(e.expirationTime=t.expirationTime,bt(t,e,s)):Zo(t,e,i,n,s)}function Qp(t,e){var i=e.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(e.effectTag|=128)}function Zo(t,e,i,n,r){var s=Le(i)?Ci:Ce.current;return s=an(e,s),Ji(e,r),i=Su(t,e,i,n,s,r),t!==null&&!ht?(e.updateQueue=t.updateQueue,e.effectTag&=-517,t.expirationTime<=r&&(t.expirationTime=0),bt(t,e,r)):(e.effectTag|=1,Oe(t,e,i,r),e.child)}function wh(t,e,i,n,r){if(Le(i)){var s=!0;as(e)}else s=!1;if(Ji(e,r),e.stateNode===null)t!==null&&(t.alternate=null,e.alternate=null,e.effectTag|=2),Rp(e,i,n),$o(e,i,n,r),n=!0;else if(t===null){var a=e.stateNode,o=e.memoizedProps;a.props=o;var l=a.context,u=i.contextType;typeof u=="object"&&u!==null?u=Ge(u):(u=Le(i)?Ci:Ce.current,u=an(e,u));var h=i.getDerivedStateFromProps,c=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function";c||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==n||l!==u)&&ch(e,a,n,u),zt=!1;var m=e.memoizedState;a.state=m,sr(e,n,a,r),l=e.memoizedState,o!==n||m!==l||De.current||zt?(typeof h=="function"&&(Ns(e,i,h,n),l=e.memoizedState),(o=zt||uh(e,i,o,n,m,l,u))?(c||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.effectTag|=4)):(typeof a.componentDidMount=="function"&&(e.effectTag|=4),e.memoizedProps=n,e.memoizedState=l),a.props=n,a.state=l,a.context=u,n=o):(typeof a.componentDidMount=="function"&&(e.effectTag|=4),n=!1)}else a=e.stateNode,mu(t,e),o=e.memoizedProps,a.props=e.type===e.elementType?o:qe(e.type,o),l=a.context,u=i.contextType,typeof u=="object"&&u!==null?u=Ge(u):(u=Le(i)?Ci:Ce.current,u=an(e,u)),h=i.getDerivedStateFromProps,(c=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==n||l!==u)&&ch(e,a,n,u),zt=!1,l=e.memoizedState,a.state=l,sr(e,n,a,r),m=e.memoizedState,o!==n||l!==m||De.current||zt?(typeof h=="function"&&(Ns(e,i,h,n),m=e.memoizedState),(h=zt||uh(e,i,o,n,l,m,u))?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,m,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,m,u)),typeof a.componentDidUpdate=="function"&&(e.effectTag|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.effectTag|=256)):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=256),e.memoizedProps=n,e.memoizedState=m),a.props=n,a.state=m,a.context=u,n=h):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=256),n=!1);return Yo(t,e,i,n,s,r)}function Yo(t,e,i,n,r,s){Qp(t,e);var a=(e.effectTag&64)!==0;if(!n&&!a)return r&&nh(e,i,!1),bt(t,e,s);n=e.stateNode,aS.current=e;var o=a&&typeof i.getDerivedStateFromError!="function"?null:n.render();return e.effectTag|=1,t!==null&&a?(e.child=on(e,t.child,null,s),e.child=on(e,null,o,s)):Oe(t,e,o,s),e.memoizedState=n.state,r&&nh(e,i,!0),e.child}function yh(t){var e=t.stateNode;e.pendingContext?ih(t,e.pendingContext,e.pendingContext!==e.context):e.context&&ih(t,e.context,!1),Wo(t,e.containerInfo)}var $a={dehydrated:null,retryTime:0};function xh(t,e,i){var n=e.mode,r=e.pendingProps,s=oe.current,a=!1,o;if((o=(e.effectTag&64)!==0)||(o=(s&2)!==0&&(t===null||t.memoizedState!==null)),o?(a=!0,e.effectTag&=-65):t!==null&&t.memoizedState===null||r.fallback===void 0||r.unstable_avoidThisFallback===!0||(s|=1),ue(oe,s&1),t===null){if(r.fallback!==void 0&&Qo(e),a){if(a=r.fallback,r=_t(null,n,0,null),r.return=e,(e.mode&2)===0)for(t=e.memoizedState!==null?e.child.child:e.child,r.child=t;t!==null;)t.return=r,t=t.sibling;return i=_t(a,n,i,null),i.return=e,r.sibling=i,e.memoizedState=$a,e.child=r,i}return n=r.children,e.memoizedState=null,e.child=vu(e,null,n,i)}if(t.memoizedState!==null){if(t=t.child,n=t.sibling,a){if(r=r.fallback,i=Ii(t,t.pendingProps),i.return=e,(e.mode&2)===0&&(a=e.memoizedState!==null?e.child.child:e.child,a!==t.child))for(i.child=a;a!==null;)a.return=i,a=a.sibling;return n=Ii(n,r),n.return=e,i.sibling=n,i.childExpirationTime=0,e.memoizedState=$a,e.child=i,n}return i=on(e,t.child,r.children,i),e.memoizedState=null,e.child=i}if(t=t.child,a){if(a=r.fallback,r=_t(null,n,0,null),r.return=e,r.child=t,t!==null&&(t.return=r),(e.mode&2)===0)for(t=e.memoizedState!==null?e.child.child:e.child,r.child=t;t!==null;)t.return=r,t=t.sibling;return i=_t(a,n,i,null),i.return=e,r.sibling=i,i.effectTag|=2,r.childExpirationTime=0,e.memoizedState=$a,e.child=r,i}return e.memoizedState=null,e.child=on(e,t,r.children,i)}function Sh(t,e){t.expirationTime<e&&(t.expirationTime=e);var i=t.alternate;i!==null&&i.expirationTime<e&&(i.expirationTime=e),Dp(t.return,e)}function Wa(t,e,i,n,r,s){var a=t.memoizedState;a===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:i,tailExpiration:0,tailMode:r,lastEffect:s}:(a.isBackwards=e,a.rendering=null,a.renderingStartTime=0,a.last=n,a.tail=i,a.tailExpiration=0,a.tailMode=r,a.lastEffect=s)}function Mh(t,e,i){var n=e.pendingProps,r=n.revealOrder,s=n.tail;if(Oe(t,e,n.children,i),n=oe.current,(n&2)!==0)n=n&1|2,e.effectTag|=64;else{if(t!==null&&(t.effectTag&64)!==0)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Sh(t,i);else if(t.tag===19)Sh(t,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(ue(oe,n),(e.mode&2)===0)e.memoizedState=null;else switch(r){case"forwards":for(i=e.child,r=null;i!==null;)t=i.alternate,t!==null&&ks(t)===null&&(r=i),i=i.sibling;i=r,i===null?(r=e.child,e.child=null):(r=i.sibling,i.sibling=null),Wa(e,!1,r,i,s,e.lastEffect);break;case"backwards":for(i=null,r=e.child,e.child=null;r!==null;){if(t=r.alternate,t!==null&&ks(t)===null){e.child=r;break}t=r.sibling,r.sibling=i,i=r,r=t}Wa(e,!0,i,null,s,e.lastEffect);break;case"together":Wa(e,!1,null,null,void 0,e.lastEffect);break;default:e.memoizedState=null}return e.child}function bt(t,e,i){t!==null&&(e.dependencies=t.dependencies);var n=e.expirationTime;if(n!==0&&ma(n),e.childExpirationTime<i)return null;if(t!==null&&e.child!==t.child)throw Error(C(153));if(e.child!==null){for(t=e.child,i=Ii(t,t.pendingProps),e.child=i,i.return=e;t.sibling!==null;)t=t.sibling,i=i.sibling=Ii(t,t.pendingProps),i.return=e;i.sibling=null}return e.child}var Zp,Go,Yp,Gp;Zp=function(t,e){for(var i=e.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};Go=function(){};Yp=function(t,e,i,n,r){var s=t.memoizedProps;if(s!==n){var a=e.stateNode;switch(li(ft.current),t=null,i){case"input":s=So(a,s),n=So(a,n),t=[];break;case"option":s=Io(a,s),n=Io(a,n),t=[];break;case"select":s=Ee({},s,{value:void 0}),n=Ee({},n,{value:void 0}),t=[];break;case"textarea":s=bo(a,s),n=bo(a,n),t=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(a.onclick=Ms)}Po(i,n);var o,l;i=null;for(o in s)if(!n.hasOwnProperty(o)&&s.hasOwnProperty(o)&&s[o]!=null)if(o==="style")for(l in a=s[o],a)a.hasOwnProperty(l)&&(i||(i={}),i[l]="");else o!=="dangerouslySetInnerHTML"&&o!=="children"&&o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(nn.hasOwnProperty(o)?t||(t=[]):(t=t||[]).push(o,null));for(o in n){var u=n[o];if(a=s!=null?s[o]:void 0,n.hasOwnProperty(o)&&u!==a&&(u!=null||a!=null))if(o==="style")if(a){for(l in a)!a.hasOwnProperty(l)||u&&u.hasOwnProperty(l)||(i||(i={}),i[l]="");for(l in u)u.hasOwnProperty(l)&&a[l]!==u[l]&&(i||(i={}),i[l]=u[l])}else i||(t||(t=[]),t.push(o,i)),i=u;else o==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(t=t||[]).push(o,u)):o==="children"?a===u||typeof u!="string"&&typeof u!="number"||(t=t||[]).push(o,""+u):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&(nn.hasOwnProperty(o)?(u!=null&&wt(r,o),t||a===u||(t=[])):(t=t||[]).push(o,u))}i&&(t=t||[]).push("style",i),r=t,(e.updateQueue=r)&&(e.effectTag|=4)}};Gp=function(t,e,i,n){i!==n&&(e.effectTag|=4)};function Fr(t,e){switch(t.tailMode){case"hidden":e=t.tail;for(var i=null;e!==null;)e.alternate!==null&&(i=e),e=e.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var n=null;i!==null;)i.alternate!==null&&(n=i),i=i.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function oS(t,e,i){var n=e.pendingProps;switch(e.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 Le(e.type)&&bs(),null;case 3:return ln(),ee(De),ee(Ce),i=e.stateNode,i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),t!==null&&t.child!==null||!Hr(e)||(e.effectTag|=4),Go(e),null;case 5:wu(e),i=li(or.current);var r=e.type;if(t!==null&&e.stateNode!=null)Yp(t,e,r,n,i),t.ref!==e.ref&&(e.effectTag|=128);else{if(!n){if(e.stateNode===null)throw Error(C(166));return null}if(t=li(ft.current),Hr(e)){n=e.stateNode,r=e.type;var s=e.memoizedProps;switch(n[Dt]=e,n[Cs]=s,r){case"iframe":case"object":case"embed":se("load",n);break;case"video":case"audio":for(t=0;t<Pn.length;t++)se(Pn[t],n);break;case"source":se("error",n);break;case"img":case"image":case"link":se("error",n),se("load",n);break;case"form":se("reset",n),se("submit",n);break;case"details":se("toggle",n);break;case"input":zc(n,s),se("invalid",n),wt(i,"onChange");break;case"select":n._wrapperState={wasMultiple:!!s.multiple},se("invalid",n),wt(i,"onChange");break;case"textarea":Lc(n,s),se("invalid",n),wt(i,"onChange")}Po(r,s),t=null;for(var a in s)if(s.hasOwnProperty(a)){var o=s[a];a==="children"?typeof o=="string"?n.textContent!==o&&(t=["children",o]):typeof o=="number"&&n.textContent!==""+o&&(t=["children",""+o]):nn.hasOwnProperty(a)&&o!=null&&wt(i,a)}switch(r){case"input":jr(n),Dc(n,s,!0);break;case"textarea":jr(n),Rc(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=Ms)}i=t,e.updateQueue=i,i!==null&&(e.effectTag|=4)}else{switch(a=i.nodeType===9?i:i.ownerDocument,t===$c&&(t=$f(r)),t===$c?r==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(r,{is:n.is}):(t=a.createElement(r),r==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,r),t[Dt]=e,t[Cs]=n,Zp(t,e,!1,!1),e.stateNode=t,a=Bo(r,n),r){case"iframe":case"object":case"embed":se("load",t),o=n;break;case"video":case"audio":for(o=0;o<Pn.length;o++)se(Pn[o],t);o=n;break;case"source":se("error",t),o=n;break;case"img":case"image":case"link":se("error",t),se("load",t),o=n;break;case"form":se("reset",t),se("submit",t),o=n;break;case"details":se("toggle",t),o=n;break;case"input":zc(t,n),o=So(t,n),se("invalid",t),wt(i,"onChange");break;case"option":o=Io(t,n);break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=Ee({},n,{value:void 0}),se("invalid",t),wt(i,"onChange");break;case"textarea":Lc(t,n),o=bo(t,n),se("invalid",t),wt(i,"onChange");break;default:o=n}Po(r,o);var l=o;for(s in l)if(l.hasOwnProperty(s)){var u=l[s];s==="style"?op(t,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Wf(t,u)):s==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&er(t,u):typeof u=="number"&&er(t,""+u):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(nn.hasOwnProperty(s)?u!=null&&wt(i,s):u!=null&&Yl(t,s,u,a))}switch(r){case"input":jr(t),Dc(t,n,!1);break;case"textarea":jr(t),Rc(t);break;case"option":n.value!=null&&t.setAttribute("value",""+Yt(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?Gi(t,!!n.multiple,i,!1):n.defaultValue!=null&&Gi(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=Ms)}hp(r,n)&&(e.effectTag|=4)}e.ref!==null&&(e.effectTag|=128)}return null;case 6:if(t&&e.stateNode!=null)Gp(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(C(166));i=li(or.current),li(ft.current),Hr(e)?(i=e.stateNode,n=e.memoizedProps,i[Dt]=e,i.nodeValue!==n&&(e.effectTag|=4)):(i=(i.nodeType===9?i:i.ownerDocument).createTextNode(n),i[Dt]=e,e.stateNode=i)}return null;case 13:return ee(oe),n=e.memoizedState,(e.effectTag&64)!==0?(e.expirationTime=i,e):(i=n!==null,n=!1,t===null?e.memoizedProps.fallback!==void 0&&Hr(e):(r=t.memoizedState,n=r!==null,i||r===null||(r=t.child.sibling,r!==null&&(s=e.firstEffect,s!==null?(e.firstEffect=r,r.nextEffect=s):(e.firstEffect=e.lastEffect=r,r.nextEffect=null),r.effectTag=8))),i&&!n&&(e.mode&2)!==0&&(t===null&&e.memoizedProps.unstable_avoidThisFallback!==!0||(oe.current&1)!==0?ge===mi&&(ge=js):((ge===mi||ge===js)&&(ge=fa),ur!==0&&We!==null&&(hi(We,Re),gg(We,ur)))),(i||n)&&(e.effectTag|=4),null);case 4:return ln(),Go(e),null;case 10:return pu(e),null;case 17:return Le(e.type)&&bs(),null;case 19:if(ee(oe),n=e.memoizedState,n===null)return null;if(r=(e.effectTag&64)!==0,s=n.rendering,s===null){if(r)Fr(n,!1);else if(ge!==mi||t!==null&&(t.effectTag&64)!==0)for(s=e.child;s!==null;){if(t=ks(s),t!==null){for(e.effectTag|=64,Fr(n,!1),r=t.updateQueue,r!==null&&(e.updateQueue=r,e.effectTag|=4),n.lastEffect===null&&(e.firstEffect=null),e.lastEffect=n.lastEffect,n=e.child;n!==null;)r=n,s=i,r.effectTag&=2,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null,t=r.alternate,t===null?(r.childExpirationTime=0,r.expirationTime=s,r.child=null,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null):(r.childExpirationTime=t.childExpirationTime,r.expirationTime=t.expirationTime,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,s=t.dependencies,r.dependencies=s===null?null:{expirationTime:s.expirationTime,firstContext:s.firstContext,responders:s.responders}),n=n.sibling;return ue(oe,oe.current&1|2),e.child}s=s.sibling}}else{if(!r)if(t=ks(s),t!==null){if(e.effectTag|=64,r=!0,i=t.updateQueue,i!==null&&(e.updateQueue=i,e.effectTag|=4),Fr(n,!0),n.tail===null&&n.tailMode==="hidden"&&!s.alternate)return e=e.lastEffect=n.lastEffect,e!==null&&(e.nextEffect=null),null}else 2*Ze()-n.renderingStartTime>n.tailExpiration&&1<i&&(e.effectTag|=64,r=!0,Fr(n,!1),e.expirationTime=e.childExpirationTime=i-1);n.isBackwards?(s.sibling=e.child,e.child=s):(i=n.last,i!==null?i.sibling=s:e.child=s,n.last=s)}return n.tail!==null?(n.tailExpiration===0&&(n.tailExpiration=Ze()+500),i=n.tail,n.rendering=i,n.tail=i.sibling,n.lastEffect=e.lastEffect,n.renderingStartTime=Ze(),i.sibling=null,e=oe.current,ue(oe,r?e&1|2:e&1),i):null}throw Error(C(156,e.tag))}function lS(t){switch(t.tag){case 1:Le(t.type)&&bs();var e=t.effectTag;return e&4096?(t.effectTag=e&-4097|64,t):null;case 3:if(ln(),ee(De),ee(Ce),e=t.effectTag,(e&64)!==0)throw Error(C(285));return t.effectTag=e&-4097|64,t;case 5:return wu(t),null;case 13:return ee(oe),e=t.effectTag,e&4096?(t.effectTag=e&-4097|64,t):null;case 19:return ee(oe),null;case 4:return ln(),null;case 10:return pu(t),null;default:return null}}function bu(t,e){return{value:t,source:e,stack:Jl(e)}}var uS=typeof WeakSet=="function"?WeakSet:Set;function Xo(t,e){var i=e.source,n=e.stack;n===null&&i!==null&&(n=Jl(i)),i!==null&&At(i.type),e=e.value,t!==null&&t.tag===1&&At(t.type);try{console.error(e)}catch(r){setTimeout(function(){throw r})}}function cS(t,e){try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(i){wi(t,i)}}function Ch(t){var e=t.ref;if(e!==null)if(typeof e=="function")try{e(null)}catch(i){wi(t,i)}else e.current=null}function hS(t,e){switch(e.tag){case 0:case 11:case 15:case 22:return;case 1:if(e.effectTag&256&&t!==null){var i=t.memoizedProps,n=t.memoizedState;t=e.stateNode,e=t.getSnapshotBeforeUpdate(e.elementType===e.type?i:qe(e.type,i),n),t.__reactInternalSnapshotBeforeUpdate=e}return;case 3:case 5:case 6:case 4:case 17:return}throw Error(C(163))}function Xp(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var i=e=e.next;do{if((i.tag&t)===t){var n=i.destroy;i.destroy=void 0,n!==void 0&&n()}i=i.next}while(i!==e)}}function Jp(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var i=e=e.next;do{if((i.tag&t)===t){var n=i.create;i.destroy=n()}i=i.next}while(i!==e)}}function dS(t,e,i){switch(i.tag){case 0:case 11:case 15:case 22:Jp(3,i);return;case 1:if(t=i.stateNode,i.effectTag&4)if(e===null)t.componentDidMount();else{var n=i.elementType===i.type?e.memoizedProps:qe(i.type,e.memoizedProps);t.componentDidUpdate(n,e.memoizedState,t.__reactInternalSnapshotBeforeUpdate)}e=i.updateQueue,e!==null&&lh(i,e,t);return;case 3:if(e=i.updateQueue,e!==null){if(t=null,i.child!==null)switch(i.child.tag){case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}lh(i,e,t)}return;case 5:t=i.stateNode,e===null&&i.effectTag&4&&hp(i.type,i.memoizedProps)&&t.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&&np(i))));return;case 19:case 17:case 20:case 21:return}throw Error(C(163))}function Ih(t,e,i){switch(typeof rl=="function"&&rl(e),e.tag){case 0:case 11:case 14:case 15:case 22:if(t=e.updateQueue,t!==null&&(t=t.lastEffect,t!==null)){var n=t.next;Xt(97<i?97:i,function(){var r=n;do{var s=r.destroy;if(s!==void 0){var a=e;try{s()}catch(o){wi(a,o)}}r=r.next}while(r!==n)})}break;case 1:Ch(e),i=e.stateNode,typeof i.componentWillUnmount=="function"&&cS(e,i);break;case 5:Ch(e);break;case 4:qp(t,e,i)}}function Kp(t){var e=t.alternate;t.return=null,t.child=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.alternate=null,t.firstEffect=null,t.lastEffect=null,t.pendingProps=null,t.memoizedProps=null,t.stateNode=null,e!==null&&Kp(e)}function bh(t){return t.tag===5||t.tag===3||t.tag===4}function Ah(t){e:{for(var e=t.return;e!==null;){if(bh(e)){var i=e;break e}e=e.return}throw Error(C(160))}switch(e=i.stateNode,i.tag){case 5:var n=!1;break;case 3:e=e.containerInfo,n=!0;break;case 4:e=e.containerInfo,n=!0;break;default:throw Error(C(161))}i.effectTag&16&&(er(e,""),i.effectTag&=-17);e:t:for(i=t;;){for(;i.sibling===null;){if(i.return===null||bh(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?Jo(t,i,e):Ko(t,i,e)}function Jo(t,e,i){var n=t.tag,r=n===5||n===6;if(r)t=r?t.stateNode:t.stateNode.instance,e?i.nodeType===8?i.parentNode.insertBefore(t,e):i.insertBefore(t,e):(i.nodeType===8?(e=i.parentNode,e.insertBefore(t,i)):(e=i,e.appendChild(t)),i=i._reactRootContainer,i!=null||e.onclick!==null||(e.onclick=Ms));else if(n!==4&&(t=t.child,t!==null))for(Jo(t,e,i),t=t.sibling;t!==null;)Jo(t,e,i),t=t.sibling}function Ko(t,e,i){var n=t.tag,r=n===5||n===6;if(r)t=r?t.stateNode:t.stateNode.instance,e?i.insertBefore(t,e):i.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Ko(t,e,i),t=t.sibling;t!==null;)Ko(t,e,i),t=t.sibling}function qp(t,e,i){for(var n=e,r=!1,s,a;;){if(!r){r=n.return;e:for(;;){if(r===null)throw Error(C(160));switch(s=r.stateNode,r.tag){case 5:a=!1;break e;case 3:s=s.containerInfo,a=!0;break e;case 4:s=s.containerInfo,a=!0;break e}r=r.return}r=!0}if(n.tag===5||n.tag===6){e:for(var o=t,l=n,u=i,h=l;;)if(Ih(o,h,u),h.child!==null&&h.tag!==4)h.child.return=h,h=h.child;else{if(h===l)break e;for(;h.sibling===null;){if(h.return===null||h.return===l)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}a?(o=s,l=n.stateNode,o.nodeType===8?o.parentNode.removeChild(l):o.removeChild(l)):s.removeChild(n.stateNode)}else if(n.tag===4){if(n.child!==null){s=n.stateNode.containerInfo,a=!0,n.child.return=n,n=n.child;continue}}else if(Ih(t,n,i),n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return,n.tag===4&&(r=!1)}n.sibling.return=n.return,n=n.sibling}}function Ha(t,e){switch(e.tag){case 0:case 11:case 14:case 15:case 22:Xp(3,e);return;case 1:return;case 5:var i=e.stateNode;if(i!=null){var n=e.memoizedProps,r=t!==null?t.memoizedProps:n;t=e.type;var s=e.updateQueue;if(e.updateQueue=null,s!==null){for(i[Cs]=n,t==="input"&&n.type==="radio"&&n.name!=null&&Vf(i,n),Bo(t,r),e=Bo(t,n),r=0;r<s.length;r+=2){var a=s[r],o=s[r+1];a==="style"?op(i,o):a==="dangerouslySetInnerHTML"?Wf(i,o):a==="children"?er(i,o):Yl(i,a,o,e)}switch(t){case"input":Mo(i,n);break;case"textarea":Of(i,n);break;case"select":e=i._wrapperState.wasMultiple,i._wrapperState.wasMultiple=!!n.multiple,t=n.value,t!=null?Gi(i,!!n.multiple,t,!1):e!==!!n.multiple&&(n.defaultValue!=null?Gi(i,!!n.multiple,n.defaultValue,!0):Gi(i,!!n.multiple,n.multiple?[]:"",!1))}}}return;case 6:if(e.stateNode===null)throw Error(C(162));e.stateNode.nodeValue=e.memoizedProps;return;case 3:e=e.stateNode,e.hydrate&&(e.hydrate=!1,np(e.containerInfo));return;case 12:return;case 13:if(i=e,e.memoizedState===null?n=!1:(n=!0,i=e.child,Eu=Ze()),i!==null)e:for(t=i;;){if(t.tag===5)s=t.stateNode,n?(s=s.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(s=t.stateNode,r=t.memoizedProps.style,r=r!=null&&r.hasOwnProperty("display")?r.display:null,s.style.display=ap("display",r));else if(t.tag===6)t.stateNode.nodeValue=n?"":t.memoizedProps;else if(t.tag===13&&t.memoizedState!==null&&t.memoizedState.dehydrated===null){s=t.child.sibling,s.return=t,t=s;continue}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break;for(;t.sibling===null;){if(t.return===null||t.return===i)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}Th(e);return;case 19:Th(e);return;case 17:return}throw Error(C(163))}function Th(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new uS),e.forEach(function(n){var r=MS.bind(null,t,n);i.has(n)||(i.add(n),n.then(r,r))})}}var fS=typeof WeakMap=="function"?WeakMap:Map;function eg(t,e,i){i=Ht(i,null),i.tag=3,i.payload={element:null};var n=e.value;return i.callback=function(){Os||(Os=!0,qo=n),Xo(t,e)},i}function tg(t,e,i){i=Ht(i,null),i.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var r=e.value;i.payload=function(){return Xo(t,e),n(r)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(i.callback=function(){typeof n!="function"&&(Qt===null?Qt=new Set([this]):Qt.add(this),Xo(t,e));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),i}var pS=Math.ceil,Ls=tt.ReactCurrentDispatcher,ig=tt.ReactCurrentOwner,me=0,Au=8,it=16,gt=32,mi=0,Rs=1,ng=2,js=3,fa=4,Tu=5,U=me,We=null,W=null,Re=0,ge=mi,pa=null,Ct=1073741823,lr=1073741823,_s=null,ur=0,Vs=!1,Eu=0,rg=500,L=null,Os=!1,qo=null,Qt=null,Us=!1,Zn=null,zn=90,ui=null,Yn=0,el=null,cs=0;function pt(){return(U&(it|gt))!==me?1073741821-(Ze()/10|0):cs!==0?cs:cs=1073741821-(Ze()/10|0)}function vi(t,e,i){if(e=e.mode,(e&2)===0)return 1073741823;var n=ha();if((e&4)===0)return n===99?1073741823:1073741822;if((U&it)!==me)return Re;if(i!==null)t=ls(t,i.timeoutMs|0||5e3,250);else switch(n){case 99:t=1073741823;break;case 98:t=ls(t,150,100);break;case 97:case 96:t=ls(t,5e3,250);break;case 95:t=2;break;default:throw Error(C(326))}return We!==null&&t===Re&&--t,t}function Zt(t,e){if(50<Yn)throw Yn=0,el=null,Error(C(185));if(t=ga(t,e),t!==null){var i=ha();e===1073741823?(U&Au)!==me&&(U&(it|gt))===me?tl(t):(He(t),U===me&&mt()):He(t),(U&4)===me||i!==98&&i!==99||(ui===null?ui=new Map([[t,e]]):(i=ui.get(t),(i===void 0||i>e)&&ui.set(t,e)))}}function ga(t,e){t.expirationTime<e&&(t.expirationTime=e);var i=t.alternate;i!==null&&i.expirationTime<e&&(i.expirationTime=e);var n=t.return,r=null;if(n===null&&t.tag===3)r=t.stateNode;else for(;n!==null;){if(i=n.alternate,n.childExpirationTime<e&&(n.childExpirationTime=e),i!==null&&i.childExpirationTime<e&&(i.childExpirationTime=e),n.return===null&&n.tag===3){r=n.stateNode;break}n=n.return}return r!==null&&(We===r&&(ma(e),ge===fa&&hi(r,Re)),gg(r,e)),r}function hs(t){var e=t.lastExpiredTime;if(e!==0||(e=t.firstPendingTime,!pg(t,e)))return e;var i=t.lastPingedTime;return t=t.nextKnownPendingLevel,t=i>t?i:t,2>=t&&e!==t?0:t}function He(t){if(t.lastExpiredTime!==0)t.callbackExpirationTime=1073741823,t.callbackPriority=99,t.callbackNode=ah(tl.bind(null,t));else{var e=hs(t),i=t.callbackNode;if(e===0)i!==null&&(t.callbackNode=null,t.callbackExpirationTime=0,t.callbackPriority=90);else{var n=pt();if(e===1073741823?n=99:e===1||e===2?n=95:(n=10*(1073741821-e)-10*(1073741821-n),n=0>=n?99:250>=n?98:5250>=n?97:95),i!==null){var r=t.callbackPriority;if(t.callbackExpirationTime===e&&r>=n)return;i!==kp&&bp(i)}t.callbackExpirationTime=e,t.callbackPriority=n,e=e===1073741823?ah(tl.bind(null,t)):Bp(n,sg.bind(null,t),{timeout:10*(1073741821-e)-Ze()}),t.callbackNode=e}}}function sg(t,e){if(cs=0,e)return e=pt(),sl(t,e),He(t),null;var i=hs(t);if(i!==0){if(e=t.callbackNode,(U&(it|gt))!==me)throw Error(C(327));if(fn(),t===We&&i===Re||ci(t,i),W!==null){var n=U;U|=it;var r=ug();do try{vS();break}catch(o){lg(t,o)}while(1);if(fu(),U=n,Ls.current=r,ge===Rs)throw e=pa,ci(t,i),hi(t,i),He(t),e;if(W===null)switch(r=t.finishedWork=t.current.alternate,t.finishedExpirationTime=i,n=ge,We=null,n){case mi:case Rs:throw Error(C(345));case ng:sl(t,2<i?2:i);break;case js:if(hi(t,i),n=t.lastSuspendedTime,i===n&&(t.nextKnownPendingLevel=il(r)),Ct===1073741823&&(r=Eu+rg-Ze(),10<r)){if(Vs){var s=t.lastPingedTime;if(s===0||s>=i){t.lastPingedTime=i,ci(t,i);break}}if(s=hs(t),s!==0&&s!==i)break;if(n!==0&&n!==i){t.lastPingedTime=n;break}t.timeoutHandle=_a(si.bind(null,t),r);break}si(t);break;case fa:if(hi(t,i),n=t.lastSuspendedTime,i===n&&(t.nextKnownPendingLevel=il(r)),Vs&&(r=t.lastPingedTime,r===0||r>=i)){t.lastPingedTime=i,ci(t,i);break}if(r=hs(t),r!==0&&r!==i)break;if(n!==0&&n!==i){t.lastPingedTime=n;break}if(lr!==1073741823?n=10*(1073741821-lr)-Ze():Ct===1073741823?n=0:(n=10*(1073741821-Ct)-5e3,r=Ze(),i=10*(1073741821-i)-r,n=r-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*pS(n/1960))-n,i<n&&(n=i)),10<n){t.timeoutHandle=_a(si.bind(null,t),n);break}si(t);break;case Tu:if(Ct!==1073741823&&_s!==null){s=Ct;var a=_s;if(n=a.busyMinDurationMs|0,0>=n?n=0:(r=a.busyDelayMs|0,s=Ze()-(10*(1073741821-s)-(a.timeoutMs|0||5e3)),n=s<=r?0:r+n-s),10<n){hi(t,i),t.timeoutHandle=_a(si.bind(null,t),n);break}}si(t);break;default:throw Error(C(329))}if(He(t),t.callbackNode===e)return sg.bind(null,t)}}return null}function tl(t){var e=t.lastExpiredTime;if(e=e!==0?e:1073741823,(U&(it|gt))!==me)throw Error(C(327));if(fn(),t===We&&e===Re||ci(t,e),W!==null){var i=U;U|=it;var n=ug();do try{mS();break}catch(r){lg(t,r)}while(1);if(fu(),U=i,Ls.current=n,ge===Rs)throw i=pa,ci(t,e),hi(t,e),He(t),i;if(W!==null)throw Error(C(261));t.finishedWork=t.current.alternate,t.finishedExpirationTime=e,We=null,si(t),He(t)}return null}function gS(){if(ui!==null){var t=ui;ui=null,t.forEach(function(e,i){sl(i,e),He(i)}),mt()}}function ag(t,e){var i=U;U|=1;try{return t(e)}finally{U=i,U===me&&mt()}}function og(t,e){var i=U;U&=-2,U|=Au;try{return t(e)}finally{U=i,U===me&&mt()}}function ci(t,e){t.finishedWork=null,t.finishedExpirationTime=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,p0(i)),W!==null)for(i=W.return;i!==null;){var n=i;switch(n.tag){case 1:n=n.type.childContextTypes,n!=null&&bs();break;case 3:ln(),ee(De),ee(Ce);break;case 5:wu(n);break;case 4:ln();break;case 13:ee(oe);break;case 19:ee(oe);break;case 10:pu(n)}i=i.return}We=t,W=Ii(t.current,null),Re=e,ge=mi,pa=null,lr=Ct=1073741823,_s=null,ur=0,Vs=!1}function lg(t,e){do{try{if(fu(),us.current=Ds,Ps)for(var i=de.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}if(Rt=0,Me=Se=de=null,Ps=!1,W===null||W.return===null)return ge=Rs,pa=e,W=null;e:{var r=t,s=W.return,a=W,o=e;if(e=Re,a.effectTag|=2048,a.firstEffect=a.lastEffect=null,o!==null&&typeof o=="object"&&typeof o.then=="function"){var l=o;if((a.mode&2)===0){var u=a.alternate;u?(a.updateQueue=u.updateQueue,a.memoizedState=u.memoizedState,a.expirationTime=u.expirationTime):(a.updateQueue=null,a.memoizedState=null)}var h=(oe.current&1)!==0,c=s;do{var m;if(m=c.tag===13){var w=c.memoizedState;if(w!==null)m=w.dehydrated!==null;else{var y=c.memoizedProps;m=y.fallback===void 0?!1:y.unstable_avoidThisFallback!==!0?!0:!h}}if(m){var x=c.updateQueue;if(x===null){var d=new Set;d.add(l),c.updateQueue=d}else x.add(l);if((c.mode&2)===0){if(c.effectTag|=64,a.effectTag&=-2981,a.tag===1)if(a.alternate===null)a.tag=17;else{var f=Ht(1073741823,null);f.tag=2,Ft(a,f)}a.expirationTime=1073741823;break e}o=void 0,a=e;var p=r.pingCache;if(p===null?(p=r.pingCache=new fS,o=new Set,p.set(l,o)):(o=p.get(l),o===void 0&&(o=new Set,p.set(l,o))),!o.has(a)){o.add(a);var g=SS.bind(null,r,l,a);l.then(g,g)}c.effectTag|=4096,c.expirationTime=e;break e}c=c.return}while(c!==null);o=Error((At(a.type)||"A React component")+` suspended while rendering, but no fallback UI was specified.
45
45
 
46
- Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`+Gl(a))}fe!==bu&&(fe=qp),o=Iu(o,a),h=s;do{switch(h.tag){case 3:l=o,h.effectTag|=4096,h.expirationTime=e;var y=Xp(h,l,e);nh(h,y);break e;case 1:l=o;var x=h.type,E=h.stateNode;if((h.effectTag&64)===0&&(typeof x.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(Qt===null||!Qt.has(E)))){h.effectTag|=4096,h.expirationTime=e;var z=Jp(h,l,e);nh(h,z);break e}}h=h.return}while(h!==null)}H=lg(H)}catch(P){e=P;continue}break}while(1)}function sg(){var t=zs.current;return zs.current=Bs,t===null?Bs:t}function ag(t,e){t<bt&&2<t&&(bt=t),e!==null&&t<ar&&2<t&&(ar=t,Rs=e)}function pa(t){t>or&&(or=t)}function cS(){for(;H!==null;)H=og(H)}function hS(){for(;H!==null&&!G0();)H=og(H)}function og(t){var e=ug(t.alternate,t,Le);return t.memoizedProps=t.pendingProps,e===null&&(e=lg(t)),Kp.current=null,e}function lg(t){H=t;do{var e=H.alternate;if(t=H.return,(H.effectTag&2048)===0){if(e=tS(e,H,Le),Le===1||H.childExpirationTime!==1){for(var i=0,n=H.child;n!==null;){var r=n.expirationTime,s=n.childExpirationTime;r>i&&(i=r),s>i&&(i=s),n=n.sibling}H.childExpirationTime=i}if(e!==null)return e;t!==null&&(t.effectTag&2048)===0&&(t.firstEffect===null&&(t.firstEffect=H.firstEffect),H.lastEffect!==null&&(t.lastEffect!==null&&(t.lastEffect.nextEffect=H.firstEffect),t.lastEffect=H.lastEffect),1<H.effectTag&&(t.lastEffect!==null?t.lastEffect.nextEffect=H:t.firstEffect=H,t.lastEffect=H))}else{if(e=iS(H),e!==null)return e.effectTag&=2047,e;t!==null&&(t.firstEffect=t.lastEffect=null,t.effectTag|=2048)}if(e=H.sibling,e!==null)return e;H=t}while(H!==null);return fe===gi&&(fe=bu),null}function el(t){var e=t.expirationTime;return t=t.childExpirationTime,e>t?e:t}function ri(t){var e=ua();return Xt(99,dS.bind(null,t,e)),null}function dS(t,e){do hn();while(Fn!==null);if(($&(tt|vt))!==pe)throw Error(I(327));var i=t.finishedWork,n=t.finishedExpirationTime;if(i===null)return null;if(t.finishedWork=null,t.finishedExpirationTime=0,i===t.current)throw Error(I(177));t.callbackNode=null,t.callbackExpirationTime=0,t.callbackPriority=90,t.nextKnownPendingLevel=0;var r=el(i);if(t.firstPendingTime=r,n<=t.lastSuspendedTime?t.firstSuspendedTime=t.lastSuspendedTime=t.nextKnownPendingLevel=0:n<=t.firstSuspendedTime&&(t.firstSuspendedTime=n-1),n<=t.lastPingedTime&&(t.lastPingedTime=0),n<=t.lastExpiredTime&&(t.lastExpiredTime=0),t===$e&&(H=$e=null,Le=0),1<i.effectTag?i.lastEffect!==null?(i.lastEffect.nextEffect=i,r=i.firstEffect):r=i:r=i.firstEffect,r!==null){var s=$;$|=vt,Kp.current=null,Da=es;var a=Uc();if(Bo(a)){if("selectionStart"in a)var o={start:a.selectionStart,end:a.selectionEnd};else e:{o=(o=a.ownerDocument)&&o.defaultView||window;var l=o.getSelection&&o.getSelection();if(l&&l.rangeCount!==0){o=l.anchorNode;var u=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{o.nodeType,c.nodeType}catch{o=null;break e}var h=0,m=-1,v=-1,w=0,M=0,d=a,f=null;t:for(;;){for(var p;d!==o||u!==0&&d.nodeType!==3||(m=h+u),d!==c||l!==0&&d.nodeType!==3||(v=h+l),d.nodeType===3&&(h+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===a)break t;if(f===o&&++w===u&&(m=h),f===c&&++M===l&&(v=h),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}o=m===-1||v===-1?null:{start:m,end:v}}else o=null}o=o||{start:0,end:0}}else o=null;La={activeElementDetached:null,focusedElem:a,selectionRange:o},es=!1,D=r;do try{fS()}catch(B){if(D===null)throw Error(I(330));vi(D,B),D=D.nextEffect}while(D!==null);D=r;do try{for(a=t,o=e;D!==null;){var g=D.effectTag;if(g&16&&Kn(D.stateNode,""),g&128){var y=D.alternate;if(y!==null){var x=y.ref;x!==null&&(typeof x=="function"?x(null):x.current=null)}}switch(g&1038){case 2:Mh(D),D.effectTag&=-3;break;case 6:Mh(D),D.effectTag&=-3,$a(D.alternate,D);break;case 1024:D.effectTag&=-1025;break;case 1028:D.effectTag&=-1025,$a(D.alternate,D);break;case 4:$a(D.alternate,D);break;case 8:u=D,Gp(a,u,o),Yp(u)}D=D.nextEffect}}catch(B){if(D===null)throw Error(I(330));vi(D,B),D=D.nextEffect}while(D!==null);if(x=La,y=Uc(),g=x.focusedElem,o=x.selectionRange,y!==g&&g&&g.ownerDocument&&rp(g.ownerDocument.documentElement,g)){for(o!==null&&Bo(g)&&(y=o.start,x=o.end,x===void 0&&(x=y),"selectionStart"in g?(g.selectionStart=y,g.selectionEnd=Math.min(x,g.value.length)):(x=(y=g.ownerDocument||document)&&y.defaultView||window,x.getSelection&&(x=x.getSelection(),u=g.textContent.length,a=Math.min(o.start,u),o=o.end===void 0?a:Math.min(o.end,u),!x.extend&&a>o&&(u=o,o=a,a=u),u=Oc(g,a),c=Oc(g,o),u&&c&&(x.rangeCount!==1||x.anchorNode!==u.node||x.anchorOffset!==u.offset||x.focusNode!==c.node||x.focusOffset!==c.offset)&&(y=y.createRange(),y.setStart(u.node,u.offset),x.removeAllRanges(),a>o?(x.addRange(y),x.extend(c.node,c.offset)):(y.setEnd(c.node,c.offset),x.addRange(y)))))),y=[],x=g;x=x.parentNode;)x.nodeType===1&&y.push({element:x,left:x.scrollLeft,top:x.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<y.length;g++)x=y[g],x.element.scrollLeft=x.left,x.element.scrollTop=x.top}es=!!Da,La=Da=null,t.current=i,D=r;do try{for(g=t;D!==null;){var E=D.effectTag;if(E&36&&aS(g,D.alternate,D),E&128){y=void 0;var z=D.ref;if(z!==null){var P=D.stateNode;switch(D.tag){case 5:y=P;break;default:y=P}typeof z=="function"?z(y):z.current=y}}D=D.nextEffect}}catch(B){if(D===null)throw Error(I(330));vi(D,B),D=D.nextEffect}while(D!==null);D=null,X0(),$=s}else t.current=i;if(Vs)Vs=!1,Fn=t,Pn=e;else for(D=r;D!==null;)e=D.nextEffect,D.nextEffect=null,D=e;if(e=t.firstPendingTime,e===0&&(Qt=null),e===1073741823?t===Ko?Qn++:(Qn=0,Ko=t):Qn=0,typeof tl=="function"&&tl(i.stateNode,n),We(t),_s)throw _s=!1,t=Jo,Jo=null,t;return($&Cu)!==pe||wt(),null}function fS(){for(;D!==null;){var t=D.effectTag;(t&256)!==0&&sS(D.alternate,D),(t&512)===0||Vs||(Vs=!0,Ep(97,function(){return hn(),null})),D=D.nextEffect}}function hn(){if(Pn!==90){var t=97<Pn?97:Pn;return Pn=90,Xt(t,pS)}}function pS(){if(Fn===null)return!1;var t=Fn;if(Fn=null,($&(tt|vt))!==pe)throw Error(I(331));var e=$;for($|=vt,t=t.current.firstEffect;t!==null;){try{var i=t;if((i.effectTag&512)!==0)switch(i.tag){case 0:case 11:case 15:case 22:Qp(5,i),Zp(5,i)}}catch(n){if(t===null)throw Error(I(330));vi(t,n)}i=t.nextEffect,t.nextEffect=null,t=i}return $=e,wt(),!0}function Ch(t,e,i){e=Iu(i,e),e=Xp(t,e,1073741823),Ft(t,e),t=fa(t,1073741823),t!==null&&We(t)}function vi(t,e){if(t.tag===3)Ch(t,t,e);else for(var i=t.return;i!==null;){if(i.tag===3){Ch(i,t,e);break}else if(i.tag===1){var n=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Qt===null||!Qt.has(n))){t=Iu(e,t),t=Jp(i,t,1073741823),Ft(i,t),i=fa(i,1073741823),i!==null&&We(i);break}}i=i.return}}function gS(t,e,i){var n=t.pingCache;n!==null&&n.delete(e),$e===t&&Le===i?fe===ha||fe===Ls&&bt===1073741823&&Qe()-Au<eg?ui(t,Le):js=!0:cg(t,i)&&(e=t.lastPingedTime,e!==0&&e<i||(t.lastPingedTime=i,We(t)))}function mS(t,e){var i=t.stateNode;i!==null&&i.delete(e),e=0,e===0&&(e=mt(),e=mi(e,t,null)),t=fa(t,e),t!==null&&We(t)}var ug;ug=function(t,e,i){var n=e.expirationTime;if(t!==null){var r=e.pendingProps;if(t.memoizedProps!==r||ze.current)ft=!0;else{if(n<i){switch(ft=!1,e.tag){case 3:gh(e),Va();break;case 5:if(oh(e),e.mode&4&&i!==1&&r.hidden)return e.expirationTime=e.childExpirationTime=1,null;break;case 1:De(e.type)&&rs(e);break;case 4:Uo(e,e.stateNode.containerInfo);break;case 10:n=e.memoizedProps.value,r=e.type._context,oe(Cs,r._currentValue),r._currentValue=n;break;case 13:if(e.memoizedState!==null)return n=e.child.childExpirationTime,n!==0&&n>=i?mh(t,e,i):(oe(re,re.current&1),e=Tt(t,e,i),e!==null?e.sibling:null);oe(re,re.current&1);break;case 19:if(n=e.childExpirationTime>=i,(t.effectTag&64)!==0){if(n)return wh(t,e,i);e.effectTag|=64}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null),oe(re,re.current),!n)return null}return Tt(t,e,i)}ft=!1}}else ft=!1;switch(e.expirationTime=0,e.tag){case 2:if(n=e.type,t!==null&&(t.alternate=null,e.alternate=null,e.effectTag|=2),t=e.pendingProps,r=rn(e,Me.current),Gi(e,i),r=yu(null,e,n,t,r,i),e.effectTag|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0){if(e.tag=1,e.memoizedState=null,e.updateQueue=null,De(n)){var s=!0;rs(e)}else s=!1;e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,fu(e);var a=n.getDerivedStateFromProps;typeof a=="function"&&Ts(e,n,a,t),r.updater=ca,e.stateNode=r,r._reactInternalFiber=e,Oo(e,n,t,i),e=Qo(null,e,n,!0,s,i)}else e.tag=0,Ve(null,e,r,i),e=e.child;return e;case 16:e:{if(r=e.elementType,t!==null&&(t.alternate=null,e.alternate=null,e.effectTag|=2),t=e.pendingProps,Fx(r),r._status!==1)throw r._result;switch(r=r._result,e.type=r,s=e.tag=yS(r),t=Ke(r,t),s){case 0:e=Fo(null,e,r,t,i);break e;case 1:e=ph(null,e,r,t,i);break e;case 11:e=dh(null,e,r,t,i);break e;case 14:e=fh(null,e,r,Ke(r.type,t),n,i);break e}throw Error(I(306,r,""))}return e;case 0:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:Ke(n,r),Fo(t,e,n,r,i);case 1:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:Ke(n,r),ph(t,e,n,r,i);case 3:if(gh(e),n=e.updateQueue,t===null||n===null)throw Error(I(282));if(n=e.pendingProps,r=e.memoizedState,r=r!==null?r.element:null,pu(t,e),nr(e,n,null,i),n=e.memoizedState.element,n===r)Va(),e=Tt(t,e,i);else{if((r=e.stateNode.hydrate)&&(jt=Yi(e.stateNode.containerInfo.firstChild),At=e,r=pi=!0),r)for(i=gu(e,null,n,i),e.child=i;i;)i.effectTag=i.effectTag&-3|1024,i=i.sibling;else Ve(t,e,n,i),Va();e=e.child}return e;case 5:return oh(e),t===null&&Ho(e),n=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,a=r.children,zo(n,r)?a=null:s!==null&&zo(n,s)&&(e.effectTag|=16),$p(t,e),e.mode&4&&i!==1&&r.hidden?(e.expirationTime=e.childExpirationTime=1,e=null):(Ve(t,e,a,i),e=e.child),e;case 6:return t===null&&Ho(e),null;case 13:return mh(t,e,i);case 4:return Uo(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=sn(e,null,n,i):Ve(t,e,n,i),e.child;case 11:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:Ke(n,r),dh(t,e,n,r,i);case 7:return Ve(t,e,e.pendingProps,i),e.child;case 8:return Ve(t,e,e.pendingProps.children,i),e.child;case 12:return Ve(t,e,e.pendingProps.children,i),e.child;case 10:e:{n=e.type._context,r=e.pendingProps,a=e.memoizedProps,s=r.value;var o=e.type._context;if(oe(Cs,o._currentValue),o._currentValue=s,a!==null)if(o=a.value,s=Si(o,s)?0:(typeof n._calculateChangedBits=="function"?n._calculateChangedBits(o,s):1073741823)|0,s===0){if(a.children===r.children&&!ze.current){e=Tt(t,e,i);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){a=o.child;for(var u=l.firstContext;u!==null;){if(u.context===n&&(u.observedBits&s)!==0){o.tag===1&&(u=Ht(i,null),u.tag=2,Ft(o,u)),o.expirationTime<i&&(o.expirationTime=i),u=o.alternate,u!==null&&u.expirationTime<i&&(u.expirationTime=i),kp(o.return,i),l.expirationTime<i&&(l.expirationTime=i);break}u=u.next}}else a=o.tag===10&&o.type===e.type?null:o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===e){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Ve(t,e,r.children,i),e=e.child}return e;case 9:return r=e.type,s=e.pendingProps,n=s.children,Gi(e,i),r=Ye(r,s.unstable_observedBits),n=n(r),e.effectTag|=1,Ve(t,e,n,i),e.child;case 14:return r=e.type,s=Ke(r,e.pendingProps),s=Ke(r.type,s),fh(t,e,r,s,n,i);case 15:return Up(t,e,e.type,e.pendingProps,n,i);case 17:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:Ke(n,r),t!==null&&(t.alternate=null,e.alternate=null,e.effectTag|=2),e.tag=1,De(n)?(t=!0,rs(e)):t=!1,Gi(e,i),Bp(e,n,r),Oo(e,n,r,i),Qo(null,e,n,!0,t,i);case 19:return wh(t,e,i)}throw Error(I(156,e.tag))};var tl=null,il=null;function vS(t){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined")return!1;var e=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(e.isDisabled||!e.supportsFiber)return!0;try{var i=e.inject(t);tl=function(n){try{e.onCommitFiberRoot(i,n,void 0,(n.current.effectTag&64)===64)}catch{}},il=function(n){try{e.onCommitFiberUnmount(i,n)}catch{}}}catch{}return!0}function wS(t,e,i,n){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 pt(t,e,i,n){return new wS(t,e,i,n)}function Tu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function yS(t){if(typeof t=="function")return Tu(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Zl)return 11;if(t===Yl)return 14}return 2}function Ii(t,e){var i=t.alternate;return i===null?(i=pt(t.tag,e,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=e,i.effectTag=0,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null),i.childExpirationTime=t.childExpirationTime,i.expirationTime=t.expirationTime,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,e=t.dependencies,i.dependencies=e===null?null:{expirationTime:e.expirationTime,firstContext:e.firstContext,responders:e.responders},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function cs(t,e,i,n,r,s){var a=2;if(n=t,typeof t=="function")Tu(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case si:return _t(i.children,r,s,e);case Hx:a=8,r|=7;break;case Ef:a=8,r|=1;break;case Jr:return t=pt(12,i,e,r|8),t.elementType=Jr,t.type=Jr,t.expirationTime=s,t;case Kr:return t=pt(13,i,e,r),t.type=Kr,t.elementType=Kr,t.expirationTime=s,t;case wo:return t=pt(19,i,e,r),t.elementType=wo,t.expirationTime=s,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Nf:a=10;break e;case kf:a=9;break e;case Zl:a=11;break e;case Yl:a=14;break e;case Pf:a=16,n=null;break e;case Bf:a=22;break e}throw Error(I(130,t==null?t:typeof t,""))}return e=pt(a,i,e,r),e.elementType=t,e.type=n,e.expirationTime=s,e}function _t(t,e,i,n){return t=pt(7,t,n,e),t.expirationTime=i,t}function Wa(t,e,i){return t=pt(6,t,null,e),t.expirationTime=i,t}function Ha(t,e,i){return e=pt(4,t.children!==null?t.children:[],t.key,e),e.expirationTime=i,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function xS(t,e,i){this.tag=e,this.current=null,this.containerInfo=t,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 cg(t,e){var i=t.firstSuspendedTime;return t=t.lastSuspendedTime,i!==0&&i>=e&&t<=e}function ci(t,e){var i=t.firstSuspendedTime,n=t.lastSuspendedTime;i<e&&(t.firstSuspendedTime=e),(n>e||i===0)&&(t.lastSuspendedTime=e),e<=t.lastPingedTime&&(t.lastPingedTime=0),e<=t.lastExpiredTime&&(t.lastExpiredTime=0)}function hg(t,e){e>t.firstPendingTime&&(t.firstPendingTime=e);var i=t.firstSuspendedTime;i!==0&&(e>=i?t.firstSuspendedTime=t.lastSuspendedTime=t.nextKnownPendingLevel=0:e>=t.lastSuspendedTime&&(t.lastSuspendedTime=e+1),e>t.nextKnownPendingLevel&&(t.nextKnownPendingLevel=e))}function nl(t,e){var i=t.lastExpiredTime;(i===0||i>e)&&(t.lastExpiredTime=e)}function Os(t,e,i,n){var r=e.current,s=mt(),a=Hn.suspense;s=mi(s,r,a);e:if(i){i=i._reactInternalFiber;t:{if(Ti(i)!==i||i.tag!==1)throw Error(I(170));var o=i;do{switch(o.tag){case 3:o=o.stateNode.context;break t;case 1:if(De(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break t}}o=o.return}while(o!==null);throw Error(I(171))}if(i.tag===1){var l=i.type;if(De(l)){i=xp(i,l,o);break e}}i=o}else i=Gt;return e.context===null?e.context=i:e.pendingContext=i,e=Ht(s,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),Ft(r,e),Zt(r,s),s}function Fa(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function bh(t,e){t=t.memoizedState,t!==null&&t.dehydrated!==null&&t.retryTime<e&&(t.retryTime=e)}function Eu(t,e){bh(t,e),(t=t.alternate)&&bh(t,e)}function Nu(t,e,i){i=i!=null&&i.hydrate===!0;var n=new xS(t,e,i),r=pt(3,null,null,e===2?7:e===1?3:0);n.current=r,r.stateNode=n,fu(r),t[vr]=n.current,i&&e!==0&&Jx(t,t.nodeType===9?t:t.ownerDocument),this._internalRoot=n}Nu.prototype.render=function(t){Os(t,this._internalRoot,null,null)};Nu.prototype.unmount=function(){var t=this._internalRoot,e=t.containerInfo;Os(null,t,null,function(){e[vr]=null})};function Ir(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function SS(t,e){if(e||(e=t?t.nodeType===9?t.documentElement:t.firstChild:null,e=!(!e||e.nodeType!==1||!e.hasAttribute("data-reactroot"))),!e)for(var i;i=t.lastChild;)t.removeChild(i);return new Nu(t,0,e?{hydrate:!0}:void 0)}function ga(t,e,i,n,r){var s=i._reactRootContainer;if(s){var a=s._internalRoot;if(typeof r=="function"){var o=r;r=function(){var u=Fa(a);o.call(u)}}Os(e,a,t,r)}else{if(s=i._reactRootContainer=SS(i,n),a=s._internalRoot,typeof r=="function"){var l=r;r=function(){var u=Fa(a);l.call(u)}}ng(function(){Os(e,a,t,r)})}return Fa(a)}function MS(t,e,i){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ri,key:n==null?null:""+n,children:t,containerInfo:e,implementation:i}}Jf=function(t){if(t.tag===13){var e=as(mt(),150,100);Zt(t,e),Eu(t,e)}};ql=function(t){t.tag===13&&(Zt(t,3),Eu(t,3))};Kf=function(t){if(t.tag===13){var e=mt();e=mi(e,t,null),Zt(t,e),Eu(t,e)}};vo=function(t,e,i){switch(e){case"input":if(xo(t,i),e=i.name,i.type==="radio"&&e!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<i.length;e++){var n=i[e];if(n!==t&&n.form===t.form){var r=au(n);if(!r)throw Error(I(90));Df(n),xo(n,r)}}}break;case"textarea":Rf(t,i);break;case"select":e=i.value,e!=null&&Zi(t,!!i.multiple,e,!1)}};Ul=ig;bf=function(t,e,i,n,r){var s=$;$|=4;try{return Xt(98,t.bind(null,e,i,n,r))}finally{$=s,$===pe&&wt()}};$l=function(){($&(1|tt|vt))===pe&&(uS(),hn())};Af=function(t,e){var i=$;$|=2;try{return t(e)}finally{$=i,$===pe&&wt()}};function dg(t,e){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ir(e))throw Error(I(200));return MS(t,e,null,i)}var IS={Events:[yr,xi,au,Mf,mo,nn,function(t){Jl(t,c0)},If,Cf,aa,sa,hn,{current:!1}]};(function(t){var e=t.findFiberByHostInstance;return vS(Ae({},t,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:et.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Qf(i),i===null?null:i.stateNode},findFiberByHostInstance:function(i){return e?e(i):null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null}))})({findFiberByHostInstance:wr,bundleType:0,version:"16.14.0",rendererPackageName:"react-dom"});Ge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=IS;Ge.createPortal=dg;Ge.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternalFiber;if(e===void 0)throw typeof t.render=="function"?Error(I(188)):Error(I(268,Object.keys(t)));return t=Qf(e),t=t===null?null:t.stateNode,t};Ge.flushSync=function(t,e){if(($&(tt|vt))!==pe)throw Error(I(187));var i=$;$|=1;try{return Xt(99,t.bind(null,e))}finally{$=i,wt()}};Ge.hydrate=function(t,e,i){if(!Ir(e))throw Error(I(200));return ga(null,t,e,!0,i)};Ge.render=function(t,e,i){if(!Ir(e))throw Error(I(200));return ga(null,t,e,!1,i)};Ge.unmountComponentAtNode=function(t){if(!Ir(t))throw Error(I(40));return t._reactRootContainer?(ng(function(){ga(null,null,t,!1,function(){t._reactRootContainer=null,t[vr]=null})}),!0):!1};Ge.unstable_batchedUpdates=ig;Ge.unstable_createPortal=function(t,e){return dg(t,e,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)};Ge.unstable_renderSubtreeIntoContainer=function(t,e,i,n){if(!Ir(i))throw Error(I(200));if(t==null||t._reactInternalFiber===void 0)throw Error(I(38));return ga(t,e,i,!1,n)};Ge.version="16.14.0";function fg(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(fg)}catch(t){console.error(t)}}fg(),mf.exports=Ge;var Hr=mf.exports,CS=Object.defineProperty,bS=Object.defineProperties,AS=Object.getOwnPropertyDescriptors,Ah=Object.getOwnPropertySymbols,TS=Object.prototype.hasOwnProperty,ES=Object.prototype.propertyIsEnumerable,Th=(t,e,i)=>e in t?CS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ue=(t,e)=>{for(var i in e||(e={}))TS.call(e,i)&&Th(t,i,e[i]);if(Ah)for(var i of Ah(e))ES.call(e,i)&&Th(t,i,e[i]);return t};const pg={src:"",currentTime:0,hostTime:0,muted:!1,paused:!0,volume:1},gg={currentTimeMaxError:1,syncInterval:1e3,retryInterval:15e3,verbose:!1,log:console.log.bind(console)};let Mt=gg;function mg(t){Mt=Ue(Ue({},gg),t)}function Fr(t,e){if(t.paused)return t.currentTime;const i=function(n){if(n.player)return n.player.beginTimestamp+n.player.progressTime;if(n.room)return n.room.calibrationTimestamp}(e);return i?t.currentTime+(i-t.hostTime)/1e3:t.currentTime}const NS=navigator.userAgent.includes("Safari"),kS=navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPad"),vg=[".aac",".mid",".midi",".mp3",".ogg",".oga",".wav",".weba"];var PS=typeof global=="object"&&global&&global.Object===Object&&global,BS=typeof self=="object"&&self&&self.Object===Object&&self,wg=PS||BS||Function("return this")(),Us=wg.Symbol,yg=Object.prototype,zS=yg.hasOwnProperty,DS=yg.toString,bn=Us?Us.toStringTag:void 0,LS=Object.prototype.toString,Eh=Us?Us.toStringTag:void 0;function RS(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Eh&&Eh in Object(t)?function(e){var i=zS.call(e,bn),n=e[bn];try{e[bn]=void 0;var r=!0}catch{}var s=DS.call(e);return r&&(i?e[bn]=n:delete e[bn]),s}(t):function(e){return LS.call(e)}(t)}var jS=/\s/,_S=/^\s+/;function VS(t){return t&&t.slice(0,function(e){for(var i=e.length;i--&&jS.test(e.charAt(i)););return i}(t)+1).replace(_S,"")}function rl(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var OS=/^[-+]0x[0-9a-f]+$/i,US=/^0b[01]+$/i,$S=/^0o[0-7]+$/i,WS=parseInt;function Nh(t){if(typeof t=="number")return t;if(function(n){return typeof n=="symbol"||function(r){return r!=null&&typeof r=="object"}(n)&&RS(n)=="[object Symbol]"}(t))return NaN;if(rl(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=rl(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=VS(t);var i=US.test(t);return i||$S.test(t)?WS(t.slice(2),i?2:8):OS.test(t)?NaN:+t}var Qa=function(){return wg.Date.now()},HS=Math.max,FS=Math.min;function Qr(t,e,i){var n,r,s,a,o,l,u=0,c=!1,h=!1,m=!0;if(typeof t!="function")throw new TypeError("Expected a function");function v(g){var y=n,x=r;return n=r=void 0,u=g,a=t.apply(x,y)}function w(g){return u=g,o=setTimeout(d,e),c?v(g):a}function M(g){var y=g-l;return l===void 0||y>=e||y<0||h&&g-u>=s}function d(){var g=Qa();if(M(g))return f(g);o=setTimeout(d,function(y){var x=e-(y-l);return h?FS(x,s-(y-u)):x}(g))}function f(g){return o=void 0,m&&n?v(g):(n=r=void 0,a)}function p(){var g=Qa(),y=M(g);if(n=arguments,r=this,l=g,y){if(o===void 0)return w(l);if(h)return clearTimeout(o),o=setTimeout(d,e),v(l)}return o===void 0&&(o=setTimeout(d,e)),a}return e=Nh(e)||0,rl(i)&&(c=!!i.leading,s=(h="maxWait"in i)?HS(Nh(i.maxWait)||0,e):s,m="trailing"in i?!!i.trailing:m),p.cancel=function(){o!==void 0&&clearTimeout(o),u=0,n=l=r=o=void 0},p.flush=function(){return o===void 0?a:f(Qa())},p}class kh extends Ai.exports.Component{constructor(e){super(e),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 r=0;r<i.changedTouches.length;r++)n=i.changedTouches[r].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 r=this.props.scale||1;let s;s=i?0:(n.pageX-this.track.getBoundingClientRect().left)/r,this.setState({seekHoverPosition:s,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=Ue(Ue({},this.getPositionStyle(this.props.buffered)),this.props.bufferColor&&{backgroundColor:this.props.bufferColor});return F.createElement("div",{className:"buffered",style:i})}return null},this.renderProgress=()=>{const i=Ue(Ue({},this.getPositionStyle(this.props.current)),this.props.sliderColor&&{backgroundColor:this.props.sliderColor});return F.createElement("div",{className:"connect",style:i})},this.renderHoverProgress=()=>{const i=Ue(Ue({},this.getSeekHoverPosition()),this.props.sliderHoverColor&&{backgroundColor:this.props.sliderHoverColor});return F.createElement("div",{className:"seek-hover",style:i})},this.renderThumb=()=>F.createElement("div",{className:this.isThumbActive()?"thumb active":"thumb",style:this.getThumbHandlerPosition()},F.createElement("div",{style:{backgroundColor:this.props.thumbColor},className:"handler"})),this.onMouseDown=i=>{var n,r;this.props.pause&&!this.props.paused&&(this.props.pause(),this.seekPause=!0),this.setSeeking(!0,i),(r=(n=this.props).onSeekStart)==null||r.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(e){if(this.track){const i=this.props.scale||1;let n=(e-this.track.getBoundingClientRect().left)/i;n=Math.min(this.state.trackWidth,Math.max(0,n)),this.setState({seekHoverPosition:n});const r=+(n/this.state.trackWidth*this.props.total).toFixed(0);this.props.onChange(r)}}getPositionStyle(e){return{transform:`scaleX(${100*e/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 e=0;return this.hoverTime&&(e=this.state.seekHoverPosition-this.hoverTime.offsetWidth/2,this.props.limitTimeTooltipBySides&&(e<0?e=0:e+this.hoverTime.offsetWidth>this.state.trackWidth&&(e=this.state.trackWidth-this.hoverTime.offsetWidth))),{transform:`translateX(${e}px)`}}secondsToTime(e){e=Math.round(e+this.offset);const i=Math.floor(e/3600),n=e%3600,r=Math.floor(n/60),s=Math.ceil(n%60);return{hh:i.toString(),mm:r<10?"0"+r:r.toString(),ss:s<10?"0"+s:s.toString()}}getHoverTime(){const e=100*this.state.seekHoverPosition/this.state.trackWidth,i=Math.floor(+e*(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:F.createElement("div",{className:this.isThumbActive()?"hover-time active":"hover-time",style:this.getHoverTimePosition(),ref:e=>this.hoverTime=e},this.getHoverTime())}render(){return F.createElement("div",{className:"seek-slider"},F.createElement("div",{className:"track",ref:e=>this.track=e,onMouseMove:e=>this.handleTrackHover(!1,e),onMouseLeave:e=>this.handleTrackHover(!0,e),onMouseDown:this.onMouseDown,onTouchStart:e=>{this.setMobileSeeking(!0),this.onMouseDown(e)},onMouseUp:this.onMouseUp,onTouchEnd:this.onMouseUp},F.createElement("div",{className:"main"},this.renderBufferProgress(),this.renderHoverProgress(),this.renderProgress())),this.drawHoverTime(),this.renderThumb())}}class QS extends Ai.exports.Component{constructor(e){super(e),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?F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1LjE0djE0bDExLTdsLTExLTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMTloNFY1aC00TTYgMTloNFY1SDZ2MTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="})},this.operationVolumeButton=()=>this.props.volume>.9?F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg0LTUgNi43djIuMDdjNC0uOTEgNy00LjQ5IDctOC43N2MwLTQuMjgtMy03Ljg2LTctOC43N00xNi41IDEyYzAtMS43Ny0xLTMuMjktMi41LTQuMDNWMTZjMS41LS43MSAyLjUtMi4yNCAyLjUtNE0zIDl2Nmg0bDUgNVY0TDcgOUgzeiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}):this.props.volume===0?F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNyA5djZoNGw1IDVWNGwtNSA1SDd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):F.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=Qr(i=>{this.props.setCurrentTime(i)},50),this.onVolumeChange=i=>{this.changeVolume(i),this.setState({seekVolume:i/100})},this.changeVolume=Qr(i=>{this.props.setVolume(i/100)},50),this.onVolumeSeekStart=()=>{this.onVolumeSeeking=!0},this.onVolumeSeekEnd=Qr(()=>{this.onVolumeSeeking=!1},500),this.onProgressSeekStart=()=>this.setState({isPlayerSeeking:!0}),this.onProgressSeekEnd=Qr(()=>{this.setState({isPlayerSeeking:!1})},500),this.state={isPlayerSeeking:!1,isVolumeHover:!1,seekVolume:1,visible:!0,currentTime:0},this.stageVolume=e.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:e,currentTime:i}=this.props;return F.createElement("div",{className:"player-controller",style:{opacity:this.props.visible?"1":"0"}},F.createElement("div",{className:"player-controller-progress"},F.createElement(kh,{total:e,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})),F.createElement("div",{className:"player-controller-actions"},F.createElement("div",{className:"player-controller-actions-left"},F.createElement("div",{onClick:this.onClickOperationButton,className:"player-controller-play"},this.operationButton()),F.createElement("div",{className:"player-volume-box",onMouseEnter:()=>this.setState({isVolumeHover:!0}),onMouseLeave:()=>this.setState({isVolumeHover:!1})},F.createElement("div",{onClick:this.handleClickVolume,className:"player-volume"},this.operationVolumeButton()),F.createElement("div",{className:"player-volume-slider"},F.createElement(kh,{total:100,current:100*this.state.seekVolume,onChange:this.onVolumeChange,onSeekStart:this.onVolumeSeekStart,onSeekEnd:this.onVolumeSeekEnd,scale:this.props.scale,limitTimeTooltipBySides:!0,hideHoverTime:!0})))),F.createElement("div",{className:"player-mid-box-time"},Ph(Math.floor(i/1e3))," /"," ",Ph(Math.floor(e/1e3)))))}}function Ph(t){const e=t%60,i=(t-e)/60;if(i>=60){const n=i%60;return`${An((i-n)/60)}:${An(n)}:${An(e)}`}return`${An(i)}:${An(e)}`}function An(t){return t<=9?`0${t}`:`${t}`}let ZS=99999;var sl,Pi;(Pi=sl||(sl={}))[Pi.Idle=0]="Idle",Pi[Pi.Playing=1]="Playing",Pi[Pi.Paused=2]="Paused";let Ie={};function de(t,...e){Mt.verbose&&console.log(`[RTCEffect] ${t}`,...e)}function YS(t,e,i){function n(s){Ie[s].playState===0?(t.playEffect(s,i,0,1,0,100,!1,0).then(()=>{de(">>> Play Success",{playingId:s})}),Ie[s].playState=1):de(">>> Skip Play",{playingId:s,state:Ie[s].playState})}function r(s){Ie[s].playState=0,Ie[s].previousVideoJSAdvance=0,Ie[s].previousSeekTargetTime=0,Ie[s].previousBeginSeekTime=0}e.one("ready",()=>{var s;const a=((s=e==null?void 0:e.tagAttributes)==null?void 0:s.src)||"";vg.includes("."+a.split(".").pop()||"")||(de(">>> Mute js player",{src:a}),e.muted(!0),e.muted=l=>!1);const o=function(){const l=ZS--,u={playState:sl.Idle,previousVideoJSAdvance:0,previousSeekTargetTime:0,previousBeginSeekTime:0};return Ie[l]=u,l}();de(">>> Setup",{playingId:o,src:a}),t.addListener("error",l=>{de(">>> Error",{soundId:l}),r(l)}),t.addListener("effectFinished",l=>{de(">>> Finished",{soundId:l}),r(l)}),e.on("play",()=>{switch(Ie[o].playState){case 0:de(">>> Start play",{playingId:o}),n(o);break;case 2:de(">>> Resume play",{playingId:o}),t.resumeEffect(o),Ie[o].playState=1}}),e.on("pause",()=>{const l=Ie[o].playState;switch(l){case 1:de(">>> Pause play",{playingId:o}),t.pauseEffect(o),Ie[o].playState=2;break;default:de(">>> Skip Pause",{playingId:o,currenState:l})}}),e.on("timeupdate",()=>{t.getEffectCurrentPosition(o).then(l=>{const u=Ie[o],c=l/1e3,h=e.currentTime(),m=u.previousSeekTargetTime!==0&&u.previousBeginSeekTime!==0;if(de(`>>> EffectSecond rtc: ${c} js: ${h} seeking: ${m}`,{playingId:o}),u.playState==0)return void(e.paused()||(de(">>> Play effect due to time update.",{playingId:o}),n(o)));if(m&&c<u.previousSeekTargetTime)return;if(u.playState!==1)return void de(">>> Skip timupdate",{playingId:o,state:u.playState,jsTime:e.currentTime(),rtcEffectTime:c});function v(M,d){t.setEffectPosition(d,1e3*M),u.previousBeginSeekTime=Date.now()/1e3,u.previousSeekTargetTime=M}const w=u.previousBeginSeekTime;if(l>0){const M=h-c,d=Math.abs(M),f=.5;if(d>f)if(m){const p=u.previousSeekTargetTime-c,g=Date.now()/1e3-w,y=g+(M>0?M:0),x=h+y;v(x,o),de(">>> Start seeking after seeking lag",{jsPlayerTime:h,rtcEffectTime:c,jsPlayerTimerAdvance:M,lastSeekingCost:g,estimatedRTCLag:y,targetRTCSeekTime:x,previousBeginSeekTime:w,timeElapse:p})}else if(d>10)v(h,o),de(">>> DirectSeek",{time:h,rtcEffectTime:c,jsPlayerTimerAdvance:M});else{const p=u.previousVideoJSAdvance,g=0,y=h+g;u.previousVideoJSAdvance=g,v(y,o),de(">>> Start seeking with lag",{jsPlayerTime:h,rtcEffectTime:c,jsPlayerTimerAdvance:M,previousAdvance:p,estimatedRTCLag:g,targetRTCSeekTime:y})}else m&&(de(">>> SeekingFinish no lag",{jsPlayerTime:h,rtcEffectTime:c,jsPlayerTimerAdvance:M,previousBeginSeekTime:w,rtcLagTolerance:f}),u.previousBeginSeekTime=0,u.previousSeekTargetTime=0)}})}),e.on("dispose",()=>{Ie[o].playState&&(t.stopEffect(o),delete Ie[o],de(">>> Dispose",{playingId:o}))})})}class Bh extends Ai.exports.Component{constructor(){super(...arguments),this.putAttributes=e=>{const{context:i}=this.props,n=i.getAttributes()||{};for(const r in e)n[r]!==e[r]&&i.updateAttributes([r],e[r])}}render(){const{context:e}=this.props,i=e.getRoom(),n=i?void 0:e.getDisplayer(),r=this.putAttributes;return F.createElement(GS,{room:i,player:n,context:e,plugin:{putAttributes:r}})}}class GS extends Ai.exports.Component{constructor(e){super(e),this.alertMask=null,this.container=F.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=Fr(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 r=(n=this.props.room)==null?void 0:n.calibrationTimestamp;this.debug(">>> seek",{currentTime:i/1e3,hostTime:r}),this.isEnabled()&&this.props.plugin.putAttributes({currentTime:i/1e3,hostTime:r})},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 r=this.player;if(!r||this.state.NoSound&&(this.noSoundSyncCount+=1)%8!=0)return;r.paused()!==n.paused&&(this.debug("<<< paused -> %o",n.paused),n.paused?r.pause():((i=r.play())==null||i.catch(this.catchPlayFail),this.everPlayed=!0)),r.muted()!==n.muted&&(this.debug("<<< muted -> %o",n.muted),r.muted(n.muted)),r.volume()!==n.volume&&(this.debug("<<< volume -> %o",n.volume),r.volume(n.volume));const s=Fr(n,this.props);let a=Mt.currentTimeMaxError;if(this.state.NoSound&&(a*=3),s>r.duration())this.resetPlayer();else if(Math.abs(r.currentTime()-s)>a){if(this.debug("<<< currentTime -> %o",s),kS)return void(this.everPlayed?r.currentTime(s):this.debug("<<< ignore iOS idle time update. -> %o (ignored)",s));r.currentTime(s)}},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,r;const s=String(i);if(NS&&s.includes("NotAllowedError")||s.includes("interact"))(n=this.player)==null||n.autoplay("any"),this.setState({NoSound:!0});else{const a=(r=this.player)==null?void 0:r.error();a&&(this.retryCount<=3?(this.initPlayer(),this.retryCount=this.retryCount+1):(this.debug("catch videojs media error",a),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:r,poster:s}=this.getAttributes(),a=document.createElement("div");a.setAttribute("data-vjs-player","");const o=document.createElement("video");o.className="video-js",o.crossOrigin="anonymous",s&&(o.poster=s),o.setAttribute("playsInline",""),o.setAttribute("webkit-playsinline","");const l=document.createElement("source");new URL(r).pathname.endsWith(".m3u8")?l.type="application/x-mpegURL":o.src=r,l.src=r,n&&(l.type=n),o.appendChild(l),a.appendChild(o),this.container.current.appendChild(a),await new Promise(m=>(window.requestAnimationFrame||window.setTimeout)(m)),this.debug("initializing videojs() ...");const u=zu.default(o);this.player=u,window.player=u,u.one("loadedmetadata",this.gracefullyUpdate);const c=window.__mediaPlayerAudioEffectClient;c!==void 0&&YS(c,u,r);const h=window.__pcmProxy;h!==void 0&&(u.one("play",()=>{const m=h.connect(o);this.audioSource=m,this.debug("Connect to PCMProxy ",r)}),u.one("dispose",()=>{this.audioSource&&(this.audioSource.disconnect(),this.audioSource=void 0,this.debug("Disconnect from PCMProxy",r))})),u.on("ready",()=>{var m;(m=Mt.onPlayer)==null||m.call(Mt,u),u.on("timeupdate",this.gracefullyUpdate),u.on("volumechange",this.gracefullyUpdate),u.on("seeked",this.gracefullyUpdate),u.on("play",this.gracefullyUpdate),u.on("pause",this.gracefullyUpdate),u.on("ended",this.resetPlayer)}),u.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},e.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.")}(e.room)}getAttributes(){const{context:e}=this.props;let i=e.getAttributes();if(i){if(i=Ue(Ue({},pg),i),this.player){let r=Fr(i,this.props),s=this.player.duration();!i.paused&&r>s&&(n=Ue({},i),i=bS(n,AS({currentTime:0,paused:!0})),this.resetPlayer())}var n;return i}}isShowingPoster(){const e=this.getAttributes();return!(e!=null&&e.src)||vg.some(i=>e.src.endsWith(i))}render(){var e,i;if(!this.props.room&&!this.props.player)return null;const n=this.getAttributes();if(!n)return null;const r=1e3*(((e=this.player)==null?void 0:e.duration())||1e3),s=((i=this.player)==null?void 0:i.bufferedPercent())||0;return F.createElement("div",{className:this.isEnabled()?"vjs-p":"vjs-p disabled",onMouseEnter:this.showController,onMouseMove:this.showController},F.createElement("div",{className:"video-js-plugin-player",ref:this.container}),this.isShowingPoster()&&F.createElement("div",{className:"video-js-plugin-poster"},n.poster&&F.createElement("img",{src:n.poster,alt:"",draggable:!1})),F.createElement(QS,{duration:r,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*Fr(n,this.props),setCurrentTime:this.setCurrentTime,buffered:r*s,visible:!0}),this.state.NoSound&&F.createElement("div",{ref:this.setupAlert,className:"videojs-plugin-muted-alert"}),this.state.MediaError&&F.createElement("div",{className:"videojs-plugin-recovery-mode"},F.createElement("button",{ref:this.setupReload},"Reload Player")))}debug(e,...i){Mt.verbose&&Mt.log(`[MediaPlayer] ${e}`,...i)}componentDidMount(){this.debug("app version =","0.1.0-alpha.5"),this.debug("video.js version =",zu.default.VERSION),this.initPlayer(),this.props.context.emitter.on("attributesUpdate",this.syncPlayerWithAttributes),this.syncPlayerTimer=setInterval(this.syncPlayerWithAttributes,Mt.syncInterval),this.decreaseRetryTimer=setInterval(this.decreaseRetryCount,Mt.retryInterval)}componentWillUnmount(){var e;this.debug("unmount"),this.props.context.emitter.off("attributesUpdate",this.syncPlayerWithAttributes),(e=this.player)==null||e.dispose(),clearInterval(this.syncPlayerTimer),clearInterval(this.decreaseRetryTimer)}isEnabled(){return this.props.context.getIsWritable()}}const al={kind:"MediaPlayer",setup(t){let e=t.getAttributes();if(!e||!e.src)return t.emitter.emit("destroy",{error:new Error("[MediaPlayer]: Missing 'attributes'.'src'.")});e=Ue(Ue({},pg),e);const i=t.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%}
47
- `);const n=document.createElement("div");if(n.classList.add("netless-app-media-player-container"),Hr.render(F.createElement(Bh,{context:t}),n),i.mountContent(n),t.emitter.on("destroy",()=>{console.log("[MediaPlayer]: destroy"),Hr.unmountComponentAtNode(n)}),window.__pcmProxy){const r=()=>{document.visibilityState==="hidden"?(console.log("[MediaPlayer]: visibilitychange -> hidden. unmount for pcmproxy"),Hr.unmountComponentAtNode(n)):(console.log("[MediaPlayer]: visibilitychange -> visible. mount for pcmproxy"),Hr.render(F.createElement(Bh,{context:t}),n))};document.addEventListener("visibilitychange",r),t.emitter.on("destroy",()=>{document.removeEventListener("visibilitychange",r)})}}},XS=()=>{Z.debug&&mg({verbose:!0}),Z.register({kind:co.kind,src:co}),Z.register({kind:al.kind,src:al})},JS={DocsViewer:co.kind,MediaPlayer:al.kind};const Bt={Ready:"Ready",RootRect:"ReplayRootRect",Message:"message",ComputeStyle:"computeStyle",Load:"load",DisplayerState:"displayerState",Show:"show",Hide:"hide"},KS=(t,e)=>new Array(t).fill(0).map((i,n)=>e(n)),q=class{constructor(t,e){this.manager=t,this.appManager=e,this.magixEventMap=new Map,this.cssList=[],this.allowAppliances=["clicker"],this.bridgeDisposer=T.noop,this.rootRect=null,this.sideEffectManager=new lr,this.execListenIframe=T.debounce(i=>{this.listenIframe(i)},50),this.onPhaseChangedListener=i=>{i===b.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay()},this.stateChangeListener=i=>{i={...i},i.cameraState=this.manager.cameraState,this.postMessage({kind:"RoomStateChanged",payload:i}),i.cameraState&&(q.emitter.emit("GetRootRect"),this.computedStyle(i)),i.memberState&&(this.computedZindex(),this.updateStyle()),i.sceneState&&this.computedIframeDisplay(i,this.attributes)},this.displayer=q.displayer=e.displayer,this.iframe=this._createIframe(),this.sideEffectManager.addDisposer(q.emitter.on("ReplayRootRect",i=>{this.rootRect=i}),Bt.RootRect),this.sideEffectManager.addDisposer(q.emitter.on("HideIframe",()=>{this.iframe.className=q.hiddenClass}),Bt.Hide),this.sideEffectManager.addDisposer(q.emitter.on("DispayIframe",()=>{this.iframe.className=""}),Bt.Show),this.sideEffectManager.addDisposer(q.emitter.on("created",()=>{this.bridgeDisposer(),this.bridgeDisposer=b.autorun(()=>{var n;const i=this.attributes;if(i.url){const r=(n=this.iframe)==null?void 0:n.src;r&&r!==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(t.emitter.on("cameraStateChange",()=>{this.computedStyle(this.displayer.state)})),q.onCreate(this)}static onCreate(t){q.emitter.emit("StartCreate"),q.emitter.emit("OnCreate",t),q.emitter.emit("created")}insert(t){const e={url:t.url,width:t.width,height:t.height,displaySceneDir:t.displaySceneDir,useClicker:t.useClicker||!1,useSelector:t.useSelector};this.setAttributes(e);const i=()=>{this.getIframe(),this.listenIframe(this.attributes),this.listenDisplayerState(),q.emitter.emit("GetRootRect")};if(this.getIframe())i();else{const n=this.sideEffectManager.addDisposer(q.emitter.on("WrapperDidMount",()=>{i(),this.sideEffectManager.flush(n)})),r=this.sideEffectManager.addDisposer(q.emitter.on("WrapperDidUpdate",()=>{i(),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,Bt.Message),q.alreadyCreate=!0,this}getComputedIframeStyle(){this.sideEffectManager.setTimeout(()=>{this.iframe&&getComputedStyle(this.iframe)},200,Bt.ComputeStyle)}destroy(){this.sideEffectManager.flushAll(),q.emitter.emit("Destory"),q.alreadyCreate=!1,q.emitter.clearListeners()}getIframe(){return this.iframe||(this.iframe=this._createIframe()),this.iframe}setIframeSize(t){this.iframe&&(this.iframe.width=`${t.width}px`,this.iframe.height=`${t.height}px`,this.setAttributes({width:t.width,height:t.height}))}get attributes(){return this.appManager.store.getIframeBridge()}setAttributes(t){this.appManager.store.setIframeBridge(t)}_createIframe(){const t=document.createElement("iframe");return t.id="IframeBridge",t.className=q.hiddenClass,this.appManager.mainView.divElement&&this.appManager.mainView.divElement.appendChild(t),t}scaleIframeToFit(t=b.AnimationMode.Immediately){if(!this.inDisplaySceneDir)return;const{width:e=1280,height:i=720}=this.attributes,n=e?-e/2:0,r=i?-i/2:0;this.manager.moveCameraToContain({originX:n,originY:r,width:e,height:i,animationMode:t})}get isReplay(){return this.manager.isReplay}handleSetPage(t){if(this.isReplay||!this.attributes.displaySceneDir)return;const e=t.payload,i=this.displayer,n=i.entireScenes()[this.attributes.displaySceneDir];if(!n||n.length!==e){const r=KS(e,s=>({name:String(s+1)}));i.putScenes(this.attributes.displaySceneDir,r),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}listenIframe(t){const e=i=>{var n;this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:(n=q.displayer)==null?void 0:n.state,currentPage:this.currentPage,observerId:this.displayer.observerId}}),q.emitter.emit("IframeLoad",i),this.sideEffectManager.addDisposer(q.emitter.on("Ready",()=>{var r;this.postMessage((r=this.attributes.lastEvent)==null?void 0:r.payload)}),Bt.Ready),this.computedStyleAndIframeDisplay()};t.url&&this.iframe.src!==t.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=t.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=t.url)),this.iframe.width=`${t.width}px`,this.iframe.height=`${t.height}px`,this.sideEffectManager.addEventListener(this.iframe,"load",e,void 0,Bt.Load)}listenDisplayerState(){this.isReplay&&(this.displayer._phase===b.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add(()=>(this.displayer.callbacks.on("onPhaseChanged",this.onPhaseChangedListener),()=>this.displayer.callbacks.off("onPhaseChanged",this.onPhaseChangedListener)),Bt.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(t){const e=this.manager.cameraState,i=this.attributes.width||1280,n=this.attributes.height||720;if(this.iframe){const{width:r,height:s,scale:a,centerX:o,centerY:l}=e,u=this.rootRect||{x:0,y:0},c=`${r/2+u.x}px`,h=`${s/2+u.y}px`,m=`transform-origin: ${c} ${h};`,v=(r-i)/2*a,w=(s-n)/2*a,M=-(o*a)+v,d=-(l*a)+w,f=`transform: translate(${M}px,${d}px) scale(${a}, ${a});`,E=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;",m,f];this.cssList=E,this.computedZindex(),this.updateStyle()}}computedIframeDisplay(t,e){this.inDisplaySceneDir?q.emitter.emit("DispayIframe"):q.emitter.emit("HideIframe")}computedZindex(){const t="z-index: -1;",e=this.cssList.findIndex(i=>i===t);e!==-1&&this.cssList.splice(e,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(t)}updateStyle(){this.iframe.style.cssText=this.cssList.join(" ")}get iframeOrigin(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(t){console.warn(t)}}messageListener(t){if(qe("<<<",JSON.stringify(t.data)),t.origin!==this.iframeOrigin)return;const e=t.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:{qe(`${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(t){const e=t.payload;this.appManager.safeDispatchMagixEvent(e.event,e.payload)}handleSetAttributes(t){this.setAttributes(t.payload)}handleRegisterMagixEvent(t){const e=t.payload,i=n=>{n.authorId!==this.displayer.observerId&&this.postMessage({kind:"ReciveMagixEvent",payload:n})};this.magixEventMap.set(e,i),this.displayer.addMagixEventListener(e,i)}handleRemoveMagixEvent(t){const e=t.payload,i=this.magixEventMap.get(e);this.displayer.removeMagixEventListener(e,i)}handleNextPage(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}handlePrevPage(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}handlePageTo(t){if(this.manager.canOperate){const e=t.payload;if(!Number.isSafeInteger(e)||e<=0)return;this.manager.setMainViewSceneIndex(e-1),this.dispatchMagixEvent("PageTo",e-1)}}handleRemoveAllMagixEvent(){this.magixEventMap.forEach((t,e)=>{this.displayer.removeMagixEventListener(e,t)}),this.magixEventMap.clear()}handleGetAttributes(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}postMessage(t){var e;this.iframe&&((e=this.iframe.contentWindow)==null||e.postMessage(JSON.parse(JSON.stringify(t)),"*"))}dispatchMagixEvent(t,e){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:t,payload:e}}),this.displayer.dispatchMagixEvent(t,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 t=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(t)}get isDisableInput(){return"disableDeviceInputs"in this.displayer?this.displayer.disableDeviceInputs:!0}};let dn=q;dn.kind="IframeBridge";dn.hiddenClass="netless-iframe-brdige-hidden";dn.emitter=new Ci.default;dn.displayer=null;dn.alreadyCreate=!1;class qS extends Ci.default{_inject(e){this.context=e}}class xg{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(i=>{i._inject(this.context)})}hasRegister(e){return Ce.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 eM(t,e){switch(t.name){case"AppManager":return(e==null?void 0:e.AppManager)||Js;case"BoxManager":return(e==null?void 0:e.BoxManager)||Qs;case"AttributesDelegate":return(e==null?void 0:e.AttributesDelegate)||Xs;case"CursorManager":return(e==null?void 0:e.CursorManager)||Gs;case"AppProxy":return(e==null?void 0:e.AppProxy)||on;case"AppContext":return(e==null?void 0:e.AppContext)||$s;case"TeleBoxManager":return(e==null?void 0:e.TeleBoxManager)||Fs;case"TeleBoxCollector":return(e==null?void 0:e.TeleBoxCollector)||cr;default:return t}}const Sg=new rw({emitter:O}),U=class extends b.InvisiblePlugin{constructor(t){super(t),this.version="1.0.7-beta.6",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0-beta.10",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.52"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@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.52"}},this.emitter=Y,this.viewMode=b.ViewMode.Broadcaster,this.isReplay=b.isPlayer(this.displayer),this._cursorUIDs=[],this.containerSizeRatio=U.containerSizeRatio,U.displayer=t.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0-beta.10",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.52"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@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.52"}}}static onCreate(t){U._resolve(t)}static async mount(t,e){const i=t.room;U.container=t.container,U.supportAppliancePlugin=t.supportAppliancePlugin;const n=t.containerSizeRatio,r=t.debug,s=t.cursor;U.params=t,U.extendClass=e,U.displayer=t.room,vv();let a;if(b.isRoom(i)){if(i.phase!==b.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");i.phase===b.RoomPhase.Connected&&i.isWritable&&(i.disableSerialization=!1),a=await this.initManager(i)}if(U.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(r),this.debug&&mg({verbose:!0}),qe("Already insert room",a),b.isRoom(this.displayer)){if(!a)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await zh.default(async u=>{if(a=i.getInvisiblePlugin(U.kind),!a)throw qe(`manager is empty. retrying ${u}`),new Error},{retries:10,maxTimeout:5e3});if(!a)throw new Error("[WindowManager]: create manager failed");n&&(U.containerSizeRatio=n),await a.ensureAttributes();const o=Nt(Js,U.extendClass),l=Nt(Gs,U.extendClass);a._fullscreen=t.fullscreen,a.appManager=new o(a),a.appManager.polling=t.polling||!1,a._pageState=new nw(a.appManager),a.cursorManager=new l(a.appManager,Boolean(s),t.cursorOptions,t.applianceIcons),a.extendPluginManager=new xg({internalEmitter:O,windowManager:a}),n&&(a.containerSizeRatio=n),t.container&&a.bindContainer(t.container),sw(i,a),O.emit("onCreated"),U.isCreated=!0;try{await jg()}catch(u){console.warn("[WindowManager]: indexedDB open failed"),console.log(u)}return a}static initManager(t){return wv(t)}static initContainer(t,e,i){const{chessboard:n,overwriteStyles:r,fullscreen:s}=i;U.container||(U.container=e);const{playground:a,wrapper:o,sizer:l,mainViewElement:u}=mv(e);if(U.playground=a,n&&l.classList.add("netless-window-manager-chess-sizer"),s&&l.classList.add("netless-window-manager-fullscreen"),r){const c=document.createElement("style");c.textContent=r,a.appendChild(c)}return t.containerResizeObserver=Sl.create(a,l,o,O),U.wrapper=o,U.sizer=l,u}static get registered(){return Ce.registered}bindContainer(t){var e,i,n,r,s,a;if(b.isRoom(this.displayer)&&this.room.phase!==b.RoomPhase.Connected)throw new Hh;if(U.isCreated&&U.container)U.container.firstChild&&t.appendChild(U.container.firstChild);else if(U.params){const o=U.params,l=U.initContainer(this,t,o);this.boxManager&&this.boxManager.destroy();const u=gv(this,Y,O,ct,{collectorContainer:o.collectorContainer,collectorStyles:o.collectorStyles,prefersColorScheme:o.prefersColorScheme,useBoxesStatus:o.useBoxesStatus});this.boxManager=u,this.appManager&&(this.appManager.useBoxesStatus=o.useBoxesStatus||!1,this.appManager.setBoxManager(u)),this.bindMainView(l,o.disableCameraTransform),U.wrapper&&((e=this.cursorManager)==null||e.setupWrapper(U.wrapper))}O.emit("updateManagerRect"),(i=this.appManager)==null||i.refresh(),(n=this.appManager)==null||n.resetMaximized(),(r=this.appManager)==null||r.resetMinimized(),(s=this.appManager)==null||s.displayerWritableListener(!this.room.isWritable),U.container=t,(a=this.extendPluginManager)==null||a.refreshContainer(t)}bindCollectorContainer(t){U.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(t):U.params&&(U.params.collectorContainer=t)}static register(t){return Ce.register(t)}static unregister(t){return Ce.unregister(t)}async addApp(t){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((e,i)=>{O.once("rootDirRemoved").then(async()=>{try{const n=await this._addApp(t);e(n)}catch(n){i(n.message)}})}):this._addApp(t);throw new _e}async _addApp(t){var e,i,n;if(this.appManager){if(!t.kind||typeof t.kind!="string")throw new Oh;t.src&&typeof t.src=="string"&&Ce.register({kind:t.kind,src:t.src});const r=await((e=Ce.appClasses.get(t.kind))==null?void 0:e());if(r&&((i=r.config)==null?void 0:i.singleton)&&this.appManager.appProxies.has(t.kind))throw new _h;const s=this.setupScenePath(t,this.appManager);return s===void 0?void 0:((n=t==null?void 0:t.options)!=null&&n.scenePath&&(t.options.scenePath=tm(t.options.scenePath)),await this.appManager.addApp(t,Boolean(s)))}else throw new _e}setupScenePath(t,e){let i=!1;if(t.options){const{scenePath:n,scenes:r}=t.options;if(n){if(!em(n))throw new $h;const s=Object.keys(this.apps||{});for(const a of s){const o=e.store.getAppScenePath(a);if(o&&o===n){if(console.warn(`[WindowManager]: ScenePath "${n}" already opened`),this.boxManager){const l=this.boxManager.getTopBox();l&&(this.boxManager.setZIndex(a,l.zIndex+1,!1),this.boxManager.focusBox({appId:a},!1))}return}}}n&&r&&r.length>0&&(this.isDynamicPPT(r)?(i=!0,Ji(this.displayer)[n]||Bn(this.room,n,r)):Ji(this.displayer)[n]||Bn(this.room,n,[{name:r[0].name}])),n&&r===void 0&&Bn(this.room,n,[{}])}return i}async setMainViewScenePath(t){this.appManager&&await this.appManager.setMainViewScenePath(t)}async setMainViewSceneIndex(t){this.appManager&&await this.appManager.setMainViewSceneIndex(t)}async nextPage(){if(this.appManager){const t=this.mainViewSceneIndex+1;return t>=this.mainViewScenesLength?(console.warn("[WindowManager]: current page is the last page"),!1):(await this.appManager.setMainViewSceneIndex(t),!0)}else return!1}async prevPage(){if(this.appManager){const t=this.mainViewSceneIndex-1;return t<0?(console.warn("[WindowManager]: current page is the first page"),!1):(await this.appManager.setMainViewSceneIndex(t),!0)}else return!1}async jumpPage(t){return this.appManager?t<0||t>=this.pageState.length?(console.warn(`[WindowManager]: index ${t} out of range`),!1):(await this.appManager.setMainViewSceneIndex(t),!0):!1}async addPage(t){if(this.appManager){const e=t==null?void 0:t.after,i=t==null?void 0:t.scene;if(e){const n=this.mainViewSceneIndex+1;this.room.putScenes(Oe,[i||{}],n)}else this.room.putScenes(Oe,[i||{}])}}async removePage(t){if(this.appManager){const e=t===void 0?this.pageState.index:t;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 ${t} out of range`),!1):this.appManager.removeSceneByIndex(e)}else return!1}getMainViewScenePath(){var t;return(t=this.appManager)==null?void 0:t.store.getMainViewScenePath()}getMainViewSceneIndex(){var t;return(t=this.appManager)==null?void 0:t.store.getMainViewSceneIndex()}setReadonly(t){var e;this.readonly=t,(e=this.boxManager)==null||e.setReadonly(t),O.emit("setReadonly",t)}switchMainViewToWriter(){var t;return(t=this.appManager)==null?void 0:t.mainViewProxy.mainViewClickHandler()}onAppDestroy(t,e){Kg(`destroy-${t}`,e)}onAppEvent(t,e){return O.on(`custom-${t}`,e)}setViewMode(t){var e,i,n,r;(t===b.ViewMode.Broadcaster||t===b.ViewMode.Follower)&&(this.canOperate&&t===b.ViewMode.Broadcaster&&((e=this.appManager)==null||e.mainViewProxy.setCameraAndSize()),(i=this.appManager)==null||i.mainViewProxy.start()),t===b.ViewMode.Freedom&&((n=this.appManager)==null||n.mainViewProxy.stop()),this.viewMode=t,(r=this.appManager)==null||r.mainViewProxy.setViewMode(t)}setBoxState(t){if(!!this.canOperate)switch(t){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(t){var e;!this.canOperate||(e=this.boxManager)==null||e.setMaximized(t,!1)}setMinimized(t){var e;!this.canOperate||(e=this.boxManager)==null||e.setMinimized(t,!1)}setBoxStatus(t,e){var i;!this.canOperate||(i=this.appManager)==null||i.store.setBoxStatus(t,e)}setLastNotMinimizedBoxStatus(t,e){var i;!this.canOperate||(i=this.appManager)==null||i.store.setLastNotMinimizedBoxStatus(t,e)}setFullscreen(t){var e;this._fullscreen!==t&&(this._fullscreen=t,(e=U.sizer)==null||e.classList.toggle("netless-window-manager-fullscreen",t),Y.emit("fullscreenChange",t))}get cursorUIDs(){return this._cursorUIDs}setCursorUIDs(t){var e,i;if(this._cursorUIDs=t||[],this._cursorUIDs.length===0)(e=this._cursorUIDsStyleDOM)==null||e.remove();else{this._cursorUIDsStyleDOM||(this._cursorUIDsStyleDOM=document.createElement("style")),(i=U.playground)==null||i.appendChild(this._cursorUIDsStyleDOM);let n="[data-cursor-uid] { display: none }";for(const r of this._cursorUIDs)n+=`
48
- [data-cursor-uid="${r}"] { display: flex }`;this._cursorUIDsStyleDOM.textContent=n}}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new _e}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new _e}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new _e}get apps(){var t;return(t=this.appManager)==null?void 0:t.store.apps()}get boxState(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.boxState;throw new _e}get boxStatus(){if(this.appManager)return this.appManager.store.getBoxesStatus();throw new _e}get lastNotMinimizedBoxStatus(){if(this.appManager)return this.appManager.store.getLastNotMinimizedBoxesStatus();throw new _e}get darkMode(){var t,e;return Boolean((e=(t=this.appManager)==null?void 0:t.boxManager)==null?void 0:e.darkMode)}get prefersColorScheme(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.prefersColorScheme;throw new _e}get focused(){return this.attributes.focus}get focusedView(){var t,e;return((e=(t=this.appManager)==null?void 0:t.focusApp)==null?void 0:e.view)||this.mainView}get polling(){var t;return((t=this.appManager)==null?void 0:t.polling)||!1}set polling(t){this.appManager&&(this.appManager.polling=t)}get cursorStyle(){var t;return((t=this.cursorManager)==null?void 0:t.style)||"default"}set cursorStyle(t){if(!this.cursorManager)throw new Error("[WindowManager]: cursor is not enabled, please set { cursor: true }.");this.cursorManager.style=t}get mainViewSceneIndex(){var t;return((t=this._pageState)==null?void 0:t.index)||0}get mainViewSceneDir(){var t;if(this.appManager)return(t=this.appManager)==null?void 0:t.getMainViewSceneDir();throw new _e}get topApp(){var t,e;return(e=(t=this.boxManager)==null?void 0:t.getTopBox())==null?void 0:e.id}get mainViewScenesLength(){var t;return((t=this._pageState)==null?void 0:t.length)||0}get canRedoSteps(){var t;return((t=this.focusedView)==null?void 0:t.canRedoSteps)||0}get canUndoSteps(){var t;return((t=this.focusedView)==null?void 0:t.canUndoSteps)||0}get sceneState(){if(this.appManager)return this.appManager.sceneState;throw new _e}get pageState(){if(this._pageState)return this._pageState.toObject();throw new _e}get fullscreen(){return Boolean(this._fullscreen)}queryAll(){var t;return Array.from(((t=this.appManager)==null?void 0:t.appProxies.values())||[])}queryOne(t){var e;return(e=this.appManager)==null?void 0:e.appProxies.get(t)}async closeApp(t){var e;return(e=this.appManager)==null?void 0:e.closeApp(t)}focusApp(t){var i,n,r;const e=(i=this.boxManager)==null?void 0:i.getBox(t);e&&((n=this.boxManager)==null||n.focusBox({appId:t},!1),((r=this.boxManager)==null?void 0:r.teleBoxManager).makeBoxTop(e,!1))}moveCamera(t){var n;const e=T.omit(t,["animationMode"]),i={...this.mainView.camera};T.isEqual({...i,...e},i)||(this.mainView.moveCamera(t),(n=this.appManager)==null||n.dispatchInternalEvent(K.MoveCamera,t),setTimeout(()=>{var r;(r=this.appManager)==null||r.mainViewProxy.setCameraAndSize()},500))}moveCameraToContain(t){var e;this.mainView.moveCameraToContain(t),(e=this.appManager)==null||e.dispatchInternalEvent(K.MoveCameraToContain,t),setTimeout(()=>{var i;(i=this.appManager)==null||i.mainViewProxy.setCameraAndSize()},500)}convertToPointInWorld(t){return this.mainView.convertToPointInWorld(t)}setCameraBound(t){this.mainView.setCameraBound(t)}onDestroy(){this._destroy()}destroy(){this._destroy()}_destroy(){var t,e,i,n,r,s;(t=this.containerResizeObserver)==null||t.disconnect(),(e=this.appManager)==null||e.destroy(),(i=this.cursorManager)==null||i.destroy(),(n=this.extendPluginManager)==null||n.destroy(),U.container=void 0,U.wrapper=void 0,U.sizer=void 0,U.isCreated=!1,U.playground&&((r=U.playground.parentNode)==null||r.removeChild(U.playground)),U.params=void 0,(s=this._iframeBridge)==null||s.destroy(),this._iframeBridge=void 0,qe("Destroyed")}bindMainView(t,e){var i;this.appManager&&(this.appManager.bindMainView(t,Boolean(e)),(i=this.cursorManager)==null||i.setMainViewDivElement(t))}get canOperate(){return b.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===b.RoomPhase.Connected:!1}get room(){return this.displayer}safeSetAttributes(t){this.canOperate&&this.setAttributes(t)}safeUpdateAttributes(t,e){this.canOperate&&this.updateAttributes(t,e)}setPrefersColorScheme(t){var e,i;(i=(e=this.appManager)==null?void 0:e.boxManager)==null||i.setPrefersColorScheme(t)}cleanCurrentScene(){var t;qe("clean current scene"),(t=this.focusedView)==null||t.cleanCurrentScene()}redo(){var t;return((t=this.focusedView)==null?void 0:t.redo())||0}undo(){var t;return((t=this.focusedView)==null?void 0:t.undo())||0}delete(){var t;(t=this.focusedView)==null||t.delete()}copy(){var t;(t=this.focusedView)==null||t.copy()}paste(){var t;(t=this.focusedView)==null||t.paste()}duplicate(){var t;(t=this.focusedView)==null||t.duplicate()}insertText(t,e,i){var n;return((n=this.focusedView)==null?void 0:n.insertText(t,e,i))||""}insertImage(t){var e;return(e=this.focusedView)==null?void 0:e.insertImage(t)}completeImageUpload(t,e){var i;return(i=this.focusedView)==null?void 0:i.completeImageUpload(t,e)}lockImage(t,e){var i;return(i=this.focusedView)==null?void 0:i.lockImage(t,e)}lockImages(t){var e;return(e=this.focusedView)==null?void 0:e.lockImages(t)}refresh(){var t;this._refresh(),(t=this.appManager)==null||t.dispatchInternalEvent(K.Refresh)}_refresh(){var t,e;(t=this.appManager)==null||t.mainViewProxy.rebind(),U.container&&this.bindContainer(U.container),(e=this.appManager)==null||e.refresher.refresh()}setContainerSizeRatio(t){if(!T.isNumber(t)||!(t>0))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a positive number. but got ${t}`);U.containerSizeRatio=t,this.containerSizeRatio=t,O.emit("containerSizeRatioUpdate",t)}isDynamicPPT(t){var i,n;const e=(n=(i=t[0])==null?void 0:i.ppt)==null?void 0:n.src;return e==null?void 0:e.startsWith("pptx://")}async ensureAttributes(){T.isNull(this.attributes)&&await jh(50),T.isObject(this.attributes)&&(this.attributes[ye.Apps]||this.safeSetAttributes({[ye.Apps]:{}}),this.attributes[ye.Cursors]||this.safeSetAttributes({[ye.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:Lh}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[ye.Registered]||this.safeSetAttributes({[ye.Registered]:{}}),this.attributes[ye.IframeBridge]||this.safeSetAttributes({[ye.IframeBridge]:{}}))}getIframeBridge(){if(!this.appManager)throw new Error("[WindowManager]: should call getIframeBridge() after await mount()");return this._iframeBridge||(this._iframeBridge=new dn(this,this.appManager)),this._iframeBridge}useExtendPlugin(t){var e;(e=this.extendPluginManager)==null||e.use(t)}};let Z=U;Z.kind="WindowManager";Z.debug=!1;Z.containerSizeRatio=Dg;Z.isCreated=!1;Z._resolve=t=>{};XS();exports.AppContext=$s;exports.AppCreateError=_h;exports.AppManager=Js;exports.AppManagerNotInitError=_e;exports.AppNotRegisterError=rm;exports.AppProxy=on;exports.AttributesDelegate=Xs;exports.BindContainerRoomPhaseInvalidError=Hh;exports.BoxManager=Qs;exports.BoxManagerNotFoundError=Wh;exports.BoxNotCreatedError=Uh;exports.BuiltinApps=JS;exports.CursorManager=Gs;exports.ExtendPlugin=qS;exports.ExtendPluginManager=xg;exports.InvalidScenePath=$h;exports.ParamsInvalidError=Oh;exports.TeleBoxCollector=cr;exports.TeleBoxManager=Fs;exports.WhiteWebSDKInvalidError=Vh;exports.WindowManager=Z;exports.calculateNextIndex=xl;exports.getExtendClass=eM;exports.reconnectRefresher=Sg;
46
+ Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`+Jl(a))}ge!==Tu&&(ge=ng),o=bu(o,a),c=s;do{switch(c.tag){case 3:l=o,c.effectTag|=4096,c.expirationTime=e;var v=eg(c,l,e);oh(c,v);break e;case 1:l=o;var S=c.type,E=c.stateNode;if((c.effectTag&64)===0&&(typeof S.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(Qt===null||!Qt.has(E)))){c.effectTag|=4096,c.expirationTime=e;var P=tg(c,l,e);oh(c,P);break e}}c=c.return}while(c!==null)}W=dg(W)}catch(k){e=k;continue}break}while(1)}function ug(){var t=Ls.current;return Ls.current=Ds,t===null?Ds:t}function cg(t,e){t<Ct&&2<t&&(Ct=t),e!==null&&t<lr&&2<t&&(lr=t,_s=e)}function ma(t){t>ur&&(ur=t)}function mS(){for(;W!==null;)W=hg(W)}function vS(){for(;W!==null&&!tS();)W=hg(W)}function hg(t){var e=fg(t.alternate,t,Re);return t.memoizedProps=t.pendingProps,e===null&&(e=dg(t)),ig.current=null,e}function dg(t){W=t;do{var e=W.alternate;if(t=W.return,(W.effectTag&2048)===0){if(e=oS(e,W,Re),Re===1||W.childExpirationTime!==1){for(var i=0,n=W.child;n!==null;){var r=n.expirationTime,s=n.childExpirationTime;r>i&&(i=r),s>i&&(i=s),n=n.sibling}W.childExpirationTime=i}if(e!==null)return e;t!==null&&(t.effectTag&2048)===0&&(t.firstEffect===null&&(t.firstEffect=W.firstEffect),W.lastEffect!==null&&(t.lastEffect!==null&&(t.lastEffect.nextEffect=W.firstEffect),t.lastEffect=W.lastEffect),1<W.effectTag&&(t.lastEffect!==null?t.lastEffect.nextEffect=W:t.firstEffect=W,t.lastEffect=W))}else{if(e=lS(W),e!==null)return e.effectTag&=2047,e;t!==null&&(t.firstEffect=t.lastEffect=null,t.effectTag|=2048)}if(e=W.sibling,e!==null)return e;W=t}while(W!==null);return ge===mi&&(ge=Tu),null}function il(t){var e=t.expirationTime;return t=t.childExpirationTime,e>t?e:t}function si(t){var e=ha();return Xt(99,wS.bind(null,t,e)),null}function wS(t,e){do fn();while(Zn!==null);if((U&(it|gt))!==me)throw Error(C(327));var i=t.finishedWork,n=t.finishedExpirationTime;if(i===null)return null;if(t.finishedWork=null,t.finishedExpirationTime=0,i===t.current)throw Error(C(177));t.callbackNode=null,t.callbackExpirationTime=0,t.callbackPriority=90,t.nextKnownPendingLevel=0;var r=il(i);if(t.firstPendingTime=r,n<=t.lastSuspendedTime?t.firstSuspendedTime=t.lastSuspendedTime=t.nextKnownPendingLevel=0:n<=t.firstSuspendedTime&&(t.firstSuspendedTime=n-1),n<=t.lastPingedTime&&(t.lastPingedTime=0),n<=t.lastExpiredTime&&(t.lastExpiredTime=0),t===We&&(W=We=null,Re=0),1<i.effectTag?i.lastEffect!==null?(i.lastEffect.nextEffect=i,r=i.firstEffect):r=i:r=i.firstEffect,r!==null){var s=U;U|=gt,ig.current=null,Ra=is;var a=Fc();if(Do(a)){if("selectionStart"in a)var o={start:a.selectionStart,end:a.selectionEnd};else e:{o=(o=a.ownerDocument)&&o.defaultView||window;var l=o.getSelection&&o.getSelection();if(l&&l.rangeCount!==0){o=l.anchorNode;var u=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{o.nodeType,h.nodeType}catch{o=null;break e}var c=0,m=-1,w=-1,y=0,x=0,d=a,f=null;t:for(;;){for(var p;d!==o||u!==0&&d.nodeType!==3||(m=c+u),d!==h||l!==0&&d.nodeType!==3||(w=c+l),d.nodeType===3&&(c+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===a)break t;if(f===o&&++y===u&&(m=c),f===h&&++x===l&&(w=c),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}o=m===-1||w===-1?null:{start:m,end:w}}else o=null}o=o||{start:0,end:0}}else o=null;ja={activeElementDetached:null,focusedElem:a,selectionRange:o},is=!1,L=r;do try{yS()}catch(z){if(L===null)throw Error(C(330));wi(L,z),L=L.nextEffect}while(L!==null);L=r;do try{for(a=t,o=e;L!==null;){var g=L.effectTag;if(g&16&&er(L.stateNode,""),g&128){var v=L.alternate;if(v!==null){var S=v.ref;S!==null&&(typeof S=="function"?S(null):S.current=null)}}switch(g&1038){case 2:Ah(L),L.effectTag&=-3;break;case 6:Ah(L),L.effectTag&=-3,Ha(L.alternate,L);break;case 1024:L.effectTag&=-1025;break;case 1028:L.effectTag&=-1025,Ha(L.alternate,L);break;case 4:Ha(L.alternate,L);break;case 8:u=L,qp(a,u,o),Kp(u)}L=L.nextEffect}}catch(z){if(L===null)throw Error(C(330));wi(L,z),L=L.nextEffect}while(L!==null);if(S=ja,v=Fc(),g=S.focusedElem,o=S.selectionRange,v!==g&&g&&g.ownerDocument&&lp(g.ownerDocument.documentElement,g)){for(o!==null&&Do(g)&&(v=o.start,S=o.end,S===void 0&&(S=v),"selectionStart"in g?(g.selectionStart=v,g.selectionEnd=Math.min(S,g.value.length)):(S=(v=g.ownerDocument||document)&&v.defaultView||window,S.getSelection&&(S=S.getSelection(),u=g.textContent.length,a=Math.min(o.start,u),o=o.end===void 0?a:Math.min(o.end,u),!S.extend&&a>o&&(u=o,o=a,a=u),u=Hc(g,a),h=Hc(g,o),u&&h&&(S.rangeCount!==1||S.anchorNode!==u.node||S.anchorOffset!==u.offset||S.focusNode!==h.node||S.focusOffset!==h.offset)&&(v=v.createRange(),v.setStart(u.node,u.offset),S.removeAllRanges(),a>o?(S.addRange(v),S.extend(h.node,h.offset)):(v.setEnd(h.node,h.offset),S.addRange(v)))))),v=[],S=g;S=S.parentNode;)S.nodeType===1&&v.push({element:S,left:S.scrollLeft,top:S.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<v.length;g++)S=v[g],S.element.scrollLeft=S.left,S.element.scrollTop=S.top}is=!!Ra,ja=Ra=null,t.current=i,L=r;do try{for(g=t;L!==null;){var E=L.effectTag;if(E&36&&dS(g,L.alternate,L),E&128){v=void 0;var P=L.ref;if(P!==null){var k=L.stateNode;switch(L.tag){case 5:v=k;break;default:v=k}typeof P=="function"?P(v):P.current=v}}L=L.nextEffect}}catch(z){if(L===null)throw Error(C(330));wi(L,z),L=L.nextEffect}while(L!==null);L=null,iS(),U=s}else t.current=i;if(Us)Us=!1,Zn=t,zn=e;else for(L=r;L!==null;)e=L.nextEffect,L.nextEffect=null,L=e;if(e=t.firstPendingTime,e===0&&(Qt=null),e===1073741823?t===el?Yn++:(Yn=0,el=t):Yn=0,typeof nl=="function"&&nl(i.stateNode,n),He(t),Os)throw Os=!1,t=qo,qo=null,t;return(U&Au)!==me||mt(),null}function yS(){for(;L!==null;){var t=L.effectTag;(t&256)!==0&&hS(L.alternate,L),(t&512)===0||Us||(Us=!0,Bp(97,function(){return fn(),null})),L=L.nextEffect}}function fn(){if(zn!==90){var t=97<zn?97:zn;return zn=90,Xt(t,xS)}}function xS(){if(Zn===null)return!1;var t=Zn;if(Zn=null,(U&(it|gt))!==me)throw Error(C(331));var e=U;for(U|=gt,t=t.current.firstEffect;t!==null;){try{var i=t;if((i.effectTag&512)!==0)switch(i.tag){case 0:case 11:case 15:case 22:Xp(5,i),Jp(5,i)}}catch(n){if(t===null)throw Error(C(330));wi(t,n)}i=t.nextEffect,t.nextEffect=null,t=i}return U=e,mt(),!0}function Eh(t,e,i){e=bu(i,e),e=eg(t,e,1073741823),Ft(t,e),t=ga(t,1073741823),t!==null&&He(t)}function wi(t,e){if(t.tag===3)Eh(t,t,e);else for(var i=t.return;i!==null;){if(i.tag===3){Eh(i,t,e);break}else if(i.tag===1){var n=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Qt===null||!Qt.has(n))){t=bu(e,t),t=tg(i,t,1073741823),Ft(i,t),i=ga(i,1073741823),i!==null&&He(i);break}}i=i.return}}function SS(t,e,i){var n=t.pingCache;n!==null&&n.delete(e),We===t&&Re===i?ge===fa||ge===js&&Ct===1073741823&&Ze()-Eu<rg?ci(t,Re):Vs=!0:pg(t,i)&&(e=t.lastPingedTime,e!==0&&e<i||(t.lastPingedTime=i,He(t)))}function MS(t,e){var i=t.stateNode;i!==null&&i.delete(e),e=0,e===0&&(e=pt(),e=vi(e,t,null)),t=ga(t,e),t!==null&&He(t)}var fg;fg=function(t,e,i){var n=e.expirationTime;if(t!==null){var r=e.pendingProps;if(t.memoizedProps!==r||De.current)ht=!0;else{if(n<i){switch(ht=!1,e.tag){case 3:yh(e),Ua();break;case 5:if(hh(e),e.mode&4&&i!==1&&r.hidden)return e.expirationTime=e.childExpirationTime=1,null;break;case 1:Le(e.type)&&as(e);break;case 4:Wo(e,e.stateNode.containerInfo);break;case 10:n=e.memoizedProps.value,r=e.type._context,ue(As,r._currentValue),r._currentValue=n;break;case 13:if(e.memoizedState!==null)return n=e.child.childExpirationTime,n!==0&&n>=i?xh(t,e,i):(ue(oe,oe.current&1),e=bt(t,e,i),e!==null?e.sibling:null);ue(oe,oe.current&1);break;case 19:if(n=e.childExpirationTime>=i,(t.effectTag&64)!==0){if(n)return Mh(t,e,i);e.effectTag|=64}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null),ue(oe,oe.current),!n)return null}return bt(t,e,i)}ht=!1}}else ht=!1;switch(e.expirationTime=0,e.tag){case 2:if(n=e.type,t!==null&&(t.alternate=null,e.alternate=null,e.effectTag|=2),t=e.pendingProps,r=an(e,Ce.current),Ji(e,i),r=Su(null,e,n,t,r,i),e.effectTag|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0){if(e.tag=1,e.memoizedState=null,e.updateQueue=null,Le(n)){var s=!0;as(e)}else s=!1;e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,gu(e);var a=n.getDerivedStateFromProps;typeof a=="function"&&Ns(e,n,a,t),r.updater=da,e.stateNode=r,r._reactInternalFiber=e,$o(e,n,t,i),e=Yo(null,e,n,!0,s,i)}else e.tag=0,Oe(null,e,r,i),e=e.child;return e;case 16:e:{if(r=e.elementType,t!==null&&(t.alternate=null,e.alternate=null,e.effectTag|=2),t=e.pendingProps,Jx(r),r._status!==1)throw r._result;switch(r=r._result,e.type=r,s=e.tag=bS(r),t=qe(r,t),s){case 0:e=Zo(null,e,r,t,i);break e;case 1:e=wh(null,e,r,t,i);break e;case 11:e=mh(null,e,r,t,i);break e;case 14:e=vh(null,e,r,qe(r.type,t),n,i);break e}throw Error(C(306,r,""))}return e;case 0:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:qe(n,r),Zo(t,e,n,r,i);case 1:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:qe(n,r),wh(t,e,n,r,i);case 3:if(yh(e),n=e.updateQueue,t===null||n===null)throw Error(C(282));if(n=e.pendingProps,r=e.memoizedState,r=r!==null?r.element:null,mu(t,e),sr(e,n,null,i),n=e.memoizedState.element,n===r)Ua(),e=bt(t,e,i);else{if((r=e.stateNode.hydrate)&&(jt=Xi(e.stateNode.containerInfo.firstChild),It=e,r=gi=!0),r)for(i=vu(e,null,n,i),e.child=i;i;)i.effectTag=i.effectTag&-3|1024,i=i.sibling;else Oe(t,e,n,i),Ua();e=e.child}return e;case 5:return hh(e),t===null&&Qo(e),n=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,a=r.children,Lo(n,r)?a=null:s!==null&&Lo(n,s)&&(e.effectTag|=16),Qp(t,e),e.mode&4&&i!==1&&r.hidden?(e.expirationTime=e.childExpirationTime=1,e=null):(Oe(t,e,a,i),e=e.child),e;case 6:return t===null&&Qo(e),null;case 13:return xh(t,e,i);case 4:return Wo(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=on(e,null,n,i):Oe(t,e,n,i),e.child;case 11:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:qe(n,r),mh(t,e,n,r,i);case 7:return Oe(t,e,e.pendingProps,i),e.child;case 8:return Oe(t,e,e.pendingProps.children,i),e.child;case 12:return Oe(t,e,e.pendingProps.children,i),e.child;case 10:e:{n=e.type._context,r=e.pendingProps,a=e.memoizedProps,s=r.value;var o=e.type._context;if(ue(As,o._currentValue),o._currentValue=s,a!==null)if(o=a.value,s=Mi(o,s)?0:(typeof n._calculateChangedBits=="function"?n._calculateChangedBits(o,s):1073741823)|0,s===0){if(a.children===r.children&&!De.current){e=bt(t,e,i);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){a=o.child;for(var u=l.firstContext;u!==null;){if(u.context===n&&(u.observedBits&s)!==0){o.tag===1&&(u=Ht(i,null),u.tag=2,Ft(o,u)),o.expirationTime<i&&(o.expirationTime=i),u=o.alternate,u!==null&&u.expirationTime<i&&(u.expirationTime=i),Dp(o.return,i),l.expirationTime<i&&(l.expirationTime=i);break}u=u.next}}else a=o.tag===10&&o.type===e.type?null:o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===e){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Oe(t,e,r.children,i),e=e.child}return e;case 9:return r=e.type,s=e.pendingProps,n=s.children,Ji(e,i),r=Ge(r,s.unstable_observedBits),n=n(r),e.effectTag|=1,Oe(t,e,n,i),e.child;case 14:return r=e.type,s=qe(r,e.pendingProps),s=qe(r.type,s),vh(t,e,r,s,n,i);case 15:return Fp(t,e,e.type,e.pendingProps,n,i);case 17:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:qe(n,r),t!==null&&(t.alternate=null,e.alternate=null,e.effectTag|=2),e.tag=1,Le(n)?(t=!0,as(e)):t=!1,Ji(e,i),Rp(e,n,r),$o(e,n,r,i),Yo(null,e,n,!0,t,i);case 19:return Mh(t,e,i)}throw Error(C(156,e.tag))};var nl=null,rl=null;function CS(t){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined")return!1;var e=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(e.isDisabled||!e.supportsFiber)return!0;try{var i=e.inject(t);nl=function(n){try{e.onCommitFiberRoot(i,n,void 0,(n.current.effectTag&64)===64)}catch{}},rl=function(n){try{e.onCommitFiberUnmount(i,n)}catch{}}}catch{}return!0}function IS(t,e,i,n){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 dt(t,e,i,n){return new IS(t,e,i,n)}function Nu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function bS(t){if(typeof t=="function")return Nu(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Gl)return 11;if(t===Xl)return 14}return 2}function Ii(t,e){var i=t.alternate;return i===null?(i=dt(t.tag,e,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=e,i.effectTag=0,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null),i.childExpirationTime=t.childExpirationTime,i.expirationTime=t.expirationTime,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,e=t.dependencies,i.dependencies=e===null?null:{expirationTime:e.expirationTime,firstContext:e.firstContext,responders:e.responders},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function ds(t,e,i,n,r,s){var a=2;if(n=t,typeof t=="function")Nu(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case ai:return _t(i.children,r,s,e);case Xx:a=8,r|=7;break;case Bf:a=8,r|=1;break;case qr:return t=dt(12,i,e,r|8),t.elementType=qr,t.type=qr,t.expirationTime=s,t;case es:return t=dt(13,i,e,r),t.type=es,t.elementType=es,t.expirationTime=s,t;case xo:return t=dt(19,i,e,r),t.elementType=xo,t.expirationTime=s,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case zf:a=10;break e;case Df:a=9;break e;case Gl:a=11;break e;case Xl:a=14;break e;case Lf:a=16,n=null;break e;case Rf:a=22;break e}throw Error(C(130,t==null?t:typeof t,""))}return e=dt(a,i,e,r),e.elementType=t,e.type=n,e.expirationTime=s,e}function _t(t,e,i,n){return t=dt(7,t,n,e),t.expirationTime=i,t}function Fa(t,e,i){return t=dt(6,t,null,e),t.expirationTime=i,t}function Qa(t,e,i){return e=dt(4,t.children!==null?t.children:[],t.key,e),e.expirationTime=i,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function AS(t,e,i){this.tag=e,this.current=null,this.containerInfo=t,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 pg(t,e){var i=t.firstSuspendedTime;return t=t.lastSuspendedTime,i!==0&&i>=e&&t<=e}function hi(t,e){var i=t.firstSuspendedTime,n=t.lastSuspendedTime;i<e&&(t.firstSuspendedTime=e),(n>e||i===0)&&(t.lastSuspendedTime=e),e<=t.lastPingedTime&&(t.lastPingedTime=0),e<=t.lastExpiredTime&&(t.lastExpiredTime=0)}function gg(t,e){e>t.firstPendingTime&&(t.firstPendingTime=e);var i=t.firstSuspendedTime;i!==0&&(e>=i?t.firstSuspendedTime=t.lastSuspendedTime=t.nextKnownPendingLevel=0:e>=t.lastSuspendedTime&&(t.lastSuspendedTime=e+1),e>t.nextKnownPendingLevel&&(t.nextKnownPendingLevel=e))}function sl(t,e){var i=t.lastExpiredTime;(i===0||i>e)&&(t.lastExpiredTime=e)}function $s(t,e,i,n){var r=e.current,s=pt(),a=Qn.suspense;s=vi(s,r,a);e:if(i){i=i._reactInternalFiber;t:{if(Ei(i)!==i||i.tag!==1)throw Error(C(170));var o=i;do{switch(o.tag){case 3:o=o.stateNode.context;break t;case 1:if(Le(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break t}}o=o.return}while(o!==null);throw Error(C(171))}if(i.tag===1){var l=i.type;if(Le(l)){i=Ip(i,l,o);break e}}i=o}else i=Gt;return e.context===null?e.context=i:e.pendingContext=i,e=Ht(s,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),Ft(r,e),Zt(r,s),s}function Za(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Nh(t,e){t=t.memoizedState,t!==null&&t.dehydrated!==null&&t.retryTime<e&&(t.retryTime=e)}function ku(t,e){Nh(t,e),(t=t.alternate)&&Nh(t,e)}function Pu(t,e,i){i=i!=null&&i.hydrate===!0;var n=new AS(t,e,i),r=dt(3,null,null,e===2?7:e===1?3:0);n.current=r,r.stateNode=n,gu(r),t[yr]=n.current,i&&e!==0&&n0(t,t.nodeType===9?t:t.ownerDocument),this._internalRoot=n}Pu.prototype.render=function(t){$s(t,this._internalRoot,null,null)};Pu.prototype.unmount=function(){var t=this._internalRoot,e=t.containerInfo;$s(null,t,null,function(){e[yr]=null})};function br(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function TS(t,e){if(e||(e=t?t.nodeType===9?t.documentElement:t.firstChild:null,e=!(!e||e.nodeType!==1||!e.hasAttribute("data-reactroot"))),!e)for(var i;i=t.lastChild;)t.removeChild(i);return new Pu(t,0,e?{hydrate:!0}:void 0)}function va(t,e,i,n,r){var s=i._reactRootContainer;if(s){var a=s._internalRoot;if(typeof r=="function"){var o=r;r=function(){var u=Za(a);o.call(u)}}$s(e,a,t,r)}else{if(s=i._reactRootContainer=TS(i,n),a=s._internalRoot,typeof r=="function"){var l=r;r=function(){var u=Za(a);l.call(u)}}og(function(){$s(e,a,t,r)})}return Za(a)}function ES(t,e,i){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_i,key:n==null?null:""+n,children:t,containerInfo:e,implementation:i}}tp=function(t){if(t.tag===13){var e=ls(pt(),150,100);Zt(t,e),ku(t,e)}};tu=function(t){t.tag===13&&(Zt(t,3),ku(t,3))};ip=function(t){if(t.tag===13){var e=pt();e=vi(e,t,null),Zt(t,e),ku(t,e)}};yo=function(t,e,i){switch(e){case"input":if(Mo(t,i),e=i.name,i.type==="radio"&&e!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<i.length;e++){var n=i[e];if(n!==t&&n.form===t.form){var r=lu(n);if(!r)throw Error(C(90));_f(n),Mo(n,r)}}}break;case"textarea":Of(t,i);break;case"select":e=i.value,e!=null&&Gi(t,!!i.multiple,e,!1)}};Wl=ag;Nf=function(t,e,i,n,r){var s=U;U|=4;try{return Xt(98,t.bind(null,e,i,n,r))}finally{U=s,U===me&&mt()}};Hl=function(){(U&(1|it|gt))===me&&(gS(),fn())};kf=function(t,e){var i=U;U|=2;try{return t(e)}finally{U=i,U===me&&mt()}};function mg(t,e){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!br(e))throw Error(C(200));return ES(t,e,null,i)}var NS={Events:[Sr,Si,lu,Af,wo,sn,function(t){ql(t,m0)},Tf,Ef,la,oa,fn,{current:!1}]};(function(t){var e=t.findFiberByHostInstance;return CS(Ee({},t,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:tt.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Xf(i),i===null?null:i.stateNode},findFiberByHostInstance:function(i){return e?e(i):null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null}))})({findFiberByHostInstance:xr,bundleType:0,version:"16.14.0",rendererPackageName:"react-dom"});Xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=NS;Xe.createPortal=mg;Xe.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternalFiber;if(e===void 0)throw typeof t.render=="function"?Error(C(188)):Error(C(268,Object.keys(t)));return t=Xf(e),t=t===null?null:t.stateNode,t};Xe.flushSync=function(t,e){if((U&(it|gt))!==me)throw Error(C(187));var i=U;U|=1;try{return Xt(99,t.bind(null,e))}finally{U=i,mt()}};Xe.hydrate=function(t,e,i){if(!br(e))throw Error(C(200));return va(null,t,e,!0,i)};Xe.render=function(t,e,i){if(!br(e))throw Error(C(200));return va(null,t,e,!1,i)};Xe.unmountComponentAtNode=function(t){if(!br(t))throw Error(C(40));return t._reactRootContainer?(og(function(){va(null,null,t,!1,function(){t._reactRootContainer=null,t[yr]=null})}),!0):!1};Xe.unstable_batchedUpdates=ag;Xe.unstable_createPortal=function(t,e){return mg(t,e,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)};Xe.unstable_renderSubtreeIntoContainer=function(t,e,i,n){if(!br(i))throw Error(C(200));if(t==null||t._reactInternalFiber===void 0)throw Error(C(38));return va(t,e,i,!1,n)};Xe.version="16.14.0";function vg(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vg)}catch(t){console.error(t)}}vg(),xf.exports=Xe;var Qr=xf.exports,kS=Object.defineProperty,PS=Object.defineProperties,BS=Object.getOwnPropertyDescriptors,kh=Object.getOwnPropertySymbols,zS=Object.prototype.hasOwnProperty,DS=Object.prototype.propertyIsEnumerable,Ph=(t,e,i)=>e in t?kS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,$e=(t,e)=>{for(var i in e||(e={}))zS.call(e,i)&&Ph(t,i,e[i]);if(kh)for(var i of kh(e))DS.call(e,i)&&Ph(t,i,e[i]);return t};const wg={src:"",currentTime:0,hostTime:0,muted:!1,paused:!0,volume:1},yg={currentTimeMaxError:1,syncInterval:1e3,retryInterval:15e3,verbose:!1,log:console.log.bind(console)};let xt=yg;function xg(t){xt=$e($e({},yg),t)}function Zr(t,e){if(t.paused)return t.currentTime;const i=function(n){if(n.player)return n.player.beginTimestamp+n.player.progressTime;if(n.room)return n.room.calibrationTimestamp}(e);return i?t.currentTime+(i-t.hostTime)/1e3:t.currentTime}const LS=navigator.userAgent.includes("Safari"),RS=navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPad"),Sg=[".aac",".mid",".midi",".mp3",".ogg",".oga",".wav",".weba"];var jS=typeof global=="object"&&global&&global.Object===Object&&global,_S=typeof self=="object"&&self&&self.Object===Object&&self,Mg=jS||_S||Function("return this")(),Ws=Mg.Symbol,Cg=Object.prototype,VS=Cg.hasOwnProperty,OS=Cg.toString,Tn=Ws?Ws.toStringTag:void 0,US=Object.prototype.toString,Bh=Ws?Ws.toStringTag:void 0;function $S(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Bh&&Bh in Object(t)?function(e){var i=VS.call(e,Tn),n=e[Tn];try{e[Tn]=void 0;var r=!0}catch{}var s=OS.call(e);return r&&(i?e[Tn]=n:delete e[Tn]),s}(t):function(e){return US.call(e)}(t)}var WS=/\s/,HS=/^\s+/;function FS(t){return t&&t.slice(0,function(e){for(var i=e.length;i--&&WS.test(e.charAt(i)););return i}(t)+1).replace(HS,"")}function al(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var QS=/^[-+]0x[0-9a-f]+$/i,ZS=/^0b[01]+$/i,YS=/^0o[0-7]+$/i,GS=parseInt;function zh(t){if(typeof t=="number")return t;if(function(n){return typeof n=="symbol"||function(r){return r!=null&&typeof r=="object"}(n)&&$S(n)=="[object Symbol]"}(t))return NaN;if(al(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=al(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=FS(t);var i=ZS.test(t);return i||YS.test(t)?GS(t.slice(2),i?2:8):QS.test(t)?NaN:+t}var Ya=function(){return Mg.Date.now()},XS=Math.max,JS=Math.min;function Yr(t,e,i){var n,r,s,a,o,l,u=0,h=!1,c=!1,m=!0;if(typeof t!="function")throw new TypeError("Expected a function");function w(g){var v=n,S=r;return n=r=void 0,u=g,a=t.apply(S,v)}function y(g){return u=g,o=setTimeout(d,e),h?w(g):a}function x(g){var v=g-l;return l===void 0||v>=e||v<0||c&&g-u>=s}function d(){var g=Ya();if(x(g))return f(g);o=setTimeout(d,function(v){var S=e-(v-l);return c?JS(S,s-(v-u)):S}(g))}function f(g){return o=void 0,m&&n?w(g):(n=r=void 0,a)}function p(){var g=Ya(),v=x(g);if(n=arguments,r=this,l=g,v){if(o===void 0)return y(l);if(c)return clearTimeout(o),o=setTimeout(d,e),w(l)}return o===void 0&&(o=setTimeout(d,e)),a}return e=zh(e)||0,al(i)&&(h=!!i.leading,s=(c="maxWait"in i)?XS(zh(i.maxWait)||0,e):s,m="trailing"in i?!!i.trailing:m),p.cancel=function(){o!==void 0&&clearTimeout(o),u=0,n=l=r=o=void 0},p.flush=function(){return o===void 0?a:f(Ya())},p}class Dh extends Ti.exports.Component{constructor(e){super(e),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 r=0;r<i.changedTouches.length;r++)n=i.changedTouches[r].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 r=this.props.scale||1;let s;s=i?0:(n.pageX-this.track.getBoundingClientRect().left)/r,this.setState({seekHoverPosition:s,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=$e($e({},this.getPositionStyle(this.props.buffered)),this.props.bufferColor&&{backgroundColor:this.props.bufferColor});return F.createElement("div",{className:"buffered",style:i})}return null},this.renderProgress=()=>{const i=$e($e({},this.getPositionStyle(this.props.current)),this.props.sliderColor&&{backgroundColor:this.props.sliderColor});return F.createElement("div",{className:"connect",style:i})},this.renderHoverProgress=()=>{const i=$e($e({},this.getSeekHoverPosition()),this.props.sliderHoverColor&&{backgroundColor:this.props.sliderHoverColor});return F.createElement("div",{className:"seek-hover",style:i})},this.renderThumb=()=>F.createElement("div",{className:this.isThumbActive()?"thumb active":"thumb",style:this.getThumbHandlerPosition()},F.createElement("div",{style:{backgroundColor:this.props.thumbColor},className:"handler"})),this.onMouseDown=i=>{var n,r;this.props.pause&&!this.props.paused&&(this.props.pause(),this.seekPause=!0),this.setSeeking(!0,i),(r=(n=this.props).onSeekStart)==null||r.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(e){if(this.track){const i=this.props.scale||1;let n=(e-this.track.getBoundingClientRect().left)/i;n=Math.min(this.state.trackWidth,Math.max(0,n)),this.setState({seekHoverPosition:n});const r=+(n/this.state.trackWidth*this.props.total).toFixed(0);this.props.onChange(r)}}getPositionStyle(e){return{transform:`scaleX(${100*e/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 e=0;return this.hoverTime&&(e=this.state.seekHoverPosition-this.hoverTime.offsetWidth/2,this.props.limitTimeTooltipBySides&&(e<0?e=0:e+this.hoverTime.offsetWidth>this.state.trackWidth&&(e=this.state.trackWidth-this.hoverTime.offsetWidth))),{transform:`translateX(${e}px)`}}secondsToTime(e){e=Math.round(e+this.offset);const i=Math.floor(e/3600),n=e%3600,r=Math.floor(n/60),s=Math.ceil(n%60);return{hh:i.toString(),mm:r<10?"0"+r:r.toString(),ss:s<10?"0"+s:s.toString()}}getHoverTime(){const e=100*this.state.seekHoverPosition/this.state.trackWidth,i=Math.floor(+e*(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:F.createElement("div",{className:this.isThumbActive()?"hover-time active":"hover-time",style:this.getHoverTimePosition(),ref:e=>this.hoverTime=e},this.getHoverTime())}render(){return F.createElement("div",{className:"seek-slider"},F.createElement("div",{className:"track",ref:e=>this.track=e,onMouseMove:e=>this.handleTrackHover(!1,e),onMouseLeave:e=>this.handleTrackHover(!0,e),onMouseDown:this.onMouseDown,onTouchStart:e=>{this.setMobileSeeking(!0),this.onMouseDown(e)},onMouseUp:this.onMouseUp,onTouchEnd:this.onMouseUp},F.createElement("div",{className:"main"},this.renderBufferProgress(),this.renderHoverProgress(),this.renderProgress())),this.drawHoverTime(),this.renderThumb())}}class KS extends Ti.exports.Component{constructor(e){super(e),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?F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1LjE0djE0bDExLTdsLTExLTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMTloNFY1aC00TTYgMTloNFY1SDZ2MTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="})},this.operationVolumeButton=()=>this.props.volume>.9?F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg0LTUgNi43djIuMDdjNC0uOTEgNy00LjQ5IDctOC43N2MwLTQuMjgtMy03Ljg2LTctOC43N00xNi41IDEyYzAtMS43Ny0xLTMuMjktMi41LTQuMDNWMTZjMS41LS43MSAyLjUtMi4yNCAyLjUtNE0zIDl2Nmg0bDUgNVY0TDcgOUgzeiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}):this.props.volume===0?F.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNyA5djZoNGw1IDVWNGwtNSA1SDd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):F.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=Yr(i=>{this.props.setCurrentTime(i)},50),this.onVolumeChange=i=>{this.changeVolume(i),this.setState({seekVolume:i/100})},this.changeVolume=Yr(i=>{this.props.setVolume(i/100)},50),this.onVolumeSeekStart=()=>{this.onVolumeSeeking=!0},this.onVolumeSeekEnd=Yr(()=>{this.onVolumeSeeking=!1},500),this.onProgressSeekStart=()=>this.setState({isPlayerSeeking:!0}),this.onProgressSeekEnd=Yr(()=>{this.setState({isPlayerSeeking:!1})},500),this.state={isPlayerSeeking:!1,isVolumeHover:!1,seekVolume:1,visible:!0,currentTime:0},this.stageVolume=e.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:e,currentTime:i}=this.props;return F.createElement("div",{className:"player-controller",style:{opacity:this.props.visible?"1":"0"}},F.createElement("div",{className:"player-controller-progress"},F.createElement(Dh,{total:e,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})),F.createElement("div",{className:"player-controller-actions"},F.createElement("div",{className:"player-controller-actions-left"},F.createElement("div",{onClick:this.onClickOperationButton,className:"player-controller-play"},this.operationButton()),F.createElement("div",{className:"player-volume-box",onMouseEnter:()=>this.setState({isVolumeHover:!0}),onMouseLeave:()=>this.setState({isVolumeHover:!1})},F.createElement("div",{onClick:this.handleClickVolume,className:"player-volume"},this.operationVolumeButton()),F.createElement("div",{className:"player-volume-slider"},F.createElement(Dh,{total:100,current:100*this.state.seekVolume,onChange:this.onVolumeChange,onSeekStart:this.onVolumeSeekStart,onSeekEnd:this.onVolumeSeekEnd,scale:this.props.scale,limitTimeTooltipBySides:!0,hideHoverTime:!0})))),F.createElement("div",{className:"player-mid-box-time"},Lh(Math.floor(i/1e3))," /"," ",Lh(Math.floor(e/1e3)))))}}function Lh(t){const e=t%60,i=(t-e)/60;if(i>=60){const n=i%60;return`${En((i-n)/60)}:${En(n)}:${En(e)}`}return`${En(i)}:${En(e)}`}function En(t){return t<=9?`0${t}`:`${t}`}let qS=99999;var ol,zi;(zi=ol||(ol={}))[zi.Idle=0]="Idle",zi[zi.Playing=1]="Playing",zi[zi.Paused=2]="Paused";let Ie={};function pe(t,...e){xt.verbose&&console.log(`[RTCEffect] ${t}`,...e)}function eM(t,e,i){function n(s){Ie[s].playState===0?(t.playEffect(s,i,0,1,0,100,!1,0).then(()=>{pe(">>> Play Success",{playingId:s})}),Ie[s].playState=1):pe(">>> Skip Play",{playingId:s,state:Ie[s].playState})}function r(s){Ie[s].playState=0,Ie[s].previousVideoJSAdvance=0,Ie[s].previousSeekTargetTime=0,Ie[s].previousBeginSeekTime=0}e.one("ready",()=>{var s;const a=((s=e==null?void 0:e.tagAttributes)==null?void 0:s.src)||"";Sg.includes("."+a.split(".").pop()||"")||(pe(">>> Mute js player",{src:a}),e.muted(!0),e.muted=l=>!1);const o=function(){const l=qS--,u={playState:ol.Idle,previousVideoJSAdvance:0,previousSeekTargetTime:0,previousBeginSeekTime:0};return Ie[l]=u,l}();pe(">>> Setup",{playingId:o,src:a}),t.addListener("error",l=>{pe(">>> Error",{soundId:l}),r(l)}),t.addListener("effectFinished",l=>{pe(">>> Finished",{soundId:l}),r(l)}),e.on("play",()=>{switch(Ie[o].playState){case 0:pe(">>> Start play",{playingId:o}),n(o);break;case 2:pe(">>> Resume play",{playingId:o}),t.resumeEffect(o),Ie[o].playState=1}}),e.on("pause",()=>{const l=Ie[o].playState;switch(l){case 1:pe(">>> Pause play",{playingId:o}),t.pauseEffect(o),Ie[o].playState=2;break;default:pe(">>> Skip Pause",{playingId:o,currenState:l})}}),e.on("timeupdate",()=>{t.getEffectCurrentPosition(o).then(l=>{const u=Ie[o],h=l/1e3,c=e.currentTime(),m=u.previousSeekTargetTime!==0&&u.previousBeginSeekTime!==0;if(pe(`>>> EffectSecond rtc: ${h} js: ${c} seeking: ${m}`,{playingId:o}),u.playState==0)return void(e.paused()||(pe(">>> Play effect due to time update.",{playingId:o}),n(o)));if(m&&h<u.previousSeekTargetTime)return;if(u.playState!==1)return void pe(">>> Skip timupdate",{playingId:o,state:u.playState,jsTime:e.currentTime(),rtcEffectTime:h});function w(x,d){t.setEffectPosition(d,1e3*x),u.previousBeginSeekTime=Date.now()/1e3,u.previousSeekTargetTime=x}const y=u.previousBeginSeekTime;if(l>0){const x=c-h,d=Math.abs(x),f=.5;if(d>f)if(m){const p=u.previousSeekTargetTime-h,g=Date.now()/1e3-y,v=g+(x>0?x:0),S=c+v;w(S,o),pe(">>> Start seeking after seeking lag",{jsPlayerTime:c,rtcEffectTime:h,jsPlayerTimerAdvance:x,lastSeekingCost:g,estimatedRTCLag:v,targetRTCSeekTime:S,previousBeginSeekTime:y,timeElapse:p})}else if(d>10)w(c,o),pe(">>> DirectSeek",{time:c,rtcEffectTime:h,jsPlayerTimerAdvance:x});else{const p=u.previousVideoJSAdvance,g=0,v=c+g;u.previousVideoJSAdvance=g,w(v,o),pe(">>> Start seeking with lag",{jsPlayerTime:c,rtcEffectTime:h,jsPlayerTimerAdvance:x,previousAdvance:p,estimatedRTCLag:g,targetRTCSeekTime:v})}else m&&(pe(">>> SeekingFinish no lag",{jsPlayerTime:c,rtcEffectTime:h,jsPlayerTimerAdvance:x,previousBeginSeekTime:y,rtcLagTolerance:f}),u.previousBeginSeekTime=0,u.previousSeekTargetTime=0)}})}),e.on("dispose",()=>{Ie[o].playState&&(t.stopEffect(o),delete Ie[o],pe(">>> Dispose",{playingId:o}))})})}class Rh extends Ti.exports.Component{constructor(){super(...arguments),this.putAttributes=e=>{const{context:i}=this.props,n=i.getAttributes()||{};for(const r in e)n[r]!==e[r]&&i.updateAttributes([r],e[r])}}render(){const{context:e}=this.props,i=e.getRoom(),n=i?void 0:e.getDisplayer(),r=this.putAttributes;return F.createElement(tM,{room:i,player:n,context:e,plugin:{putAttributes:r}})}}class tM extends Ti.exports.Component{constructor(e){super(e),this.alertMask=null,this.container=F.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=Zr(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 r=(n=this.props.room)==null?void 0:n.calibrationTimestamp;this.debug(">>> seek",{currentTime:i/1e3,hostTime:r}),this.isEnabled()&&this.props.plugin.putAttributes({currentTime:i/1e3,hostTime:r})},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 r=this.player;if(!r||this.state.NoSound&&(this.noSoundSyncCount+=1)%8!=0)return;r.paused()!==n.paused&&(this.debug("<<< paused -> %o",n.paused),n.paused?r.pause():((i=r.play())==null||i.catch(this.catchPlayFail),this.everPlayed=!0)),r.muted()!==n.muted&&(this.debug("<<< muted -> %o",n.muted),r.muted(n.muted)),r.volume()!==n.volume&&(this.debug("<<< volume -> %o",n.volume),r.volume(n.volume));const s=Zr(n,this.props);let a=xt.currentTimeMaxError;if(this.state.NoSound&&(a*=3),s>r.duration())this.resetPlayer();else if(Math.abs(r.currentTime()-s)>a){if(this.debug("<<< currentTime -> %o",s),RS)return void(this.everPlayed?r.currentTime(s):this.debug("<<< ignore iOS idle time update. -> %o (ignored)",s));r.currentTime(s)}},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,r;const s=String(i);if(LS&&s.includes("NotAllowedError")||s.includes("interact"))(n=this.player)==null||n.autoplay("any"),this.setState({NoSound:!0});else{const a=(r=this.player)==null?void 0:r.error();a&&(this.retryCount<=3?(this.initPlayer(),this.retryCount=this.retryCount+1):(this.debug("catch videojs media error",a),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:r,poster:s}=this.getAttributes(),a=document.createElement("div");a.setAttribute("data-vjs-player","");const o=document.createElement("video");o.className="video-js",o.crossOrigin="anonymous",s&&(o.poster=s),o.setAttribute("playsInline",""),o.setAttribute("webkit-playsinline","");const l=document.createElement("source");new URL(r).pathname.endsWith(".m3u8")?l.type="application/x-mpegURL":o.src=r,l.src=r,n&&(l.type=n),o.appendChild(l),a.appendChild(o),this.container.current.appendChild(a),await new Promise(m=>(window.requestAnimationFrame||window.setTimeout)(m)),this.debug("initializing videojs() ...");const u=ju.default(o);this.player=u,window.player=u,u.one("loadedmetadata",this.gracefullyUpdate);const h=window.__mediaPlayerAudioEffectClient;h!==void 0&&eM(h,u,r);const c=window.__pcmProxy;c!==void 0&&(u.one("play",()=>{const m=c.connect(o);this.audioSource=m,this.debug("Connect to PCMProxy ",r)}),u.one("dispose",()=>{this.audioSource&&(this.audioSource.disconnect(),this.audioSource=void 0,this.debug("Disconnect from PCMProxy",r))})),u.on("ready",()=>{var m;(m=xt.onPlayer)==null||m.call(xt,u),u.on("timeupdate",this.gracefullyUpdate),u.on("volumechange",this.gracefullyUpdate),u.on("seeked",this.gracefullyUpdate),u.on("play",this.gracefullyUpdate),u.on("pause",this.gracefullyUpdate),u.on("ended",this.resetPlayer)}),u.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},e.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.")}(e.room)}getAttributes(){const{context:e}=this.props;let i=e.getAttributes();if(i){if(i=$e($e({},wg),i),this.player){let r=Zr(i,this.props),s=this.player.duration();!i.paused&&r>s&&(n=$e({},i),i=PS(n,BS({currentTime:0,paused:!0})),this.resetPlayer())}var n;return i}}isShowingPoster(){const e=this.getAttributes();return!(e!=null&&e.src)||Sg.some(i=>e.src.endsWith(i))}render(){var e,i;if(!this.props.room&&!this.props.player)return null;const n=this.getAttributes();if(!n)return null;const r=1e3*(((e=this.player)==null?void 0:e.duration())||1e3),s=((i=this.player)==null?void 0:i.bufferedPercent())||0;return F.createElement("div",{className:this.isEnabled()?"vjs-p":"vjs-p disabled",onMouseEnter:this.showController,onMouseMove:this.showController},F.createElement("div",{className:"video-js-plugin-player",ref:this.container}),this.isShowingPoster()&&F.createElement("div",{className:"video-js-plugin-poster"},n.poster&&F.createElement("img",{src:n.poster,alt:"",draggable:!1})),F.createElement(KS,{duration:r,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*Zr(n,this.props),setCurrentTime:this.setCurrentTime,buffered:r*s,visible:!0}),this.state.NoSound&&F.createElement("div",{ref:this.setupAlert,className:"videojs-plugin-muted-alert"}),this.state.MediaError&&F.createElement("div",{className:"videojs-plugin-recovery-mode"},F.createElement("button",{ref:this.setupReload},"Reload Player")))}debug(e,...i){xt.verbose&&xt.log(`[MediaPlayer] ${e}`,...i)}componentDidMount(){this.debug("app version =","0.1.0-alpha.5"),this.debug("video.js version =",ju.default.VERSION),this.initPlayer(),this.props.context.emitter.on("attributesUpdate",this.syncPlayerWithAttributes),this.syncPlayerTimer=setInterval(this.syncPlayerWithAttributes,xt.syncInterval),this.decreaseRetryTimer=setInterval(this.decreaseRetryCount,xt.retryInterval)}componentWillUnmount(){var e;this.debug("unmount"),this.props.context.emitter.off("attributesUpdate",this.syncPlayerWithAttributes),(e=this.player)==null||e.dispose(),clearInterval(this.syncPlayerTimer),clearInterval(this.decreaseRetryTimer)}isEnabled(){return this.props.context.getIsWritable()}}const ll={kind:"MediaPlayer",setup(t){let e=t.getAttributes();if(!e||!e.src)return t.emitter.emit("destroy",{error:new Error("[MediaPlayer]: Missing 'attributes'.'src'.")});e=$e($e({},wg),e);const i=t.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%}
47
+ `);const n=document.createElement("div");if(n.classList.add("netless-app-media-player-container"),Qr.render(F.createElement(Rh,{context:t}),n),i.mountContent(n),t.emitter.on("destroy",()=>{console.log("[MediaPlayer]: destroy"),Qr.unmountComponentAtNode(n)}),window.__pcmProxy){const r=()=>{document.visibilityState==="hidden"?(console.log("[MediaPlayer]: visibilitychange -> hidden. unmount for pcmproxy"),Qr.unmountComponentAtNode(n)):(console.log("[MediaPlayer]: visibilitychange -> visible. mount for pcmproxy"),Qr.render(F.createElement(Rh,{context:t}),n))};document.addEventListener("visibilitychange",r),t.emitter.on("destroy",()=>{document.removeEventListener("visibilitychange",r)})}}},iM=()=>{Q.debug&&xg({verbose:!0}),Q.register({kind:fo.kind,src:fo}),Q.register({kind:ll.kind,src:ll})},nM={DocsViewer:fo.kind,MediaPlayer:ll.kind};const Bt={Ready:"Ready",RootRect:"ReplayRootRect",Message:"message",ComputeStyle:"computeStyle",Load:"load",DisplayerState:"displayerState",Show:"show",Hide:"hide"},rM=(t,e)=>new Array(t).fill(0).map((i,n)=>e(n)),q=class{constructor(t,e){this.manager=t,this.appManager=e,this.magixEventMap=new Map,this.cssList=[],this.allowAppliances=["clicker"],this.bridgeDisposer=T.noop,this.rootRect=null,this.sideEffectManager=new cr,this.execListenIframe=T.debounce(i=>{this.listenIframe(i)},50),this.onPhaseChangedListener=i=>{i===b.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay()},this.stateChangeListener=i=>{i={...i},i.cameraState=this.manager.cameraState,this.postMessage({kind:"RoomStateChanged",payload:i}),i.cameraState&&(q.emitter.emit("GetRootRect"),this.computedStyle(i)),i.memberState&&(this.computedZindex(),this.updateStyle()),i.sceneState&&this.computedIframeDisplay(i,this.attributes)},this.displayer=q.displayer=e.displayer,this.iframe=this._createIframe(),this.sideEffectManager.addDisposer(q.emitter.on("ReplayRootRect",i=>{this.rootRect=i}),Bt.RootRect),this.sideEffectManager.addDisposer(q.emitter.on("HideIframe",()=>{this.iframe.className=q.hiddenClass}),Bt.Hide),this.sideEffectManager.addDisposer(q.emitter.on("DispayIframe",()=>{this.iframe.className=""}),Bt.Show),this.sideEffectManager.addDisposer(q.emitter.on("created",()=>{this.bridgeDisposer(),this.bridgeDisposer=b.autorun(()=>{var n;const i=this.attributes;if(i.url){const r=(n=this.iframe)==null?void 0:n.src;r&&r!==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(t.emitter.on("cameraStateChange",()=>{this.computedStyle(this.displayer.state)})),q.onCreate(this)}static onCreate(t){q.emitter.emit("StartCreate"),q.emitter.emit("OnCreate",t),q.emitter.emit("created")}insert(t){const e={url:t.url,width:t.width,height:t.height,displaySceneDir:t.displaySceneDir,useClicker:t.useClicker||!1,useSelector:t.useSelector};this.setAttributes(e);const i=()=>{this.getIframe(),this.listenIframe(this.attributes),this.listenDisplayerState(),q.emitter.emit("GetRootRect")};if(this.getIframe())i();else{const n=this.sideEffectManager.addDisposer(q.emitter.on("WrapperDidMount",()=>{i(),this.sideEffectManager.flush(n)})),r=this.sideEffectManager.addDisposer(q.emitter.on("WrapperDidUpdate",()=>{i(),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,Bt.Message),q.alreadyCreate=!0,this}getComputedIframeStyle(){this.sideEffectManager.setTimeout(()=>{this.iframe&&getComputedStyle(this.iframe)},200,Bt.ComputeStyle)}destroy(){this.sideEffectManager.flushAll(),q.emitter.emit("Destory"),q.alreadyCreate=!1,q.emitter.clearListeners()}getIframe(){return this.iframe||(this.iframe=this._createIframe()),this.iframe}setIframeSize(t){this.iframe&&(this.iframe.width=`${t.width}px`,this.iframe.height=`${t.height}px`,this.setAttributes({width:t.width,height:t.height}))}get attributes(){return this.appManager.store.getIframeBridge()}setAttributes(t){this.appManager.store.setIframeBridge(t)}_createIframe(){const t=document.createElement("iframe");return t.id="IframeBridge",t.className=q.hiddenClass,this.appManager.mainView.divElement&&this.appManager.mainView.divElement.appendChild(t),t}scaleIframeToFit(t=b.AnimationMode.Immediately){if(!this.inDisplaySceneDir)return;const{width:e=1280,height:i=720}=this.attributes,n=e?-e/2:0,r=i?-i/2:0;this.manager.moveCameraToContain({originX:n,originY:r,width:e,height:i,animationMode:t})}get isReplay(){return this.manager.isReplay}handleSetPage(t){if(this.isReplay||!this.attributes.displaySceneDir)return;const e=t.payload,i=this.displayer,n=i.entireScenes()[this.attributes.displaySceneDir];if(!n||n.length!==e){const r=rM(e,s=>({name:String(s+1)}));i.putScenes(this.attributes.displaySceneDir,r),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}listenIframe(t){const e=i=>{var n;this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:(n=q.displayer)==null?void 0:n.state,currentPage:this.currentPage,observerId:this.displayer.observerId}}),q.emitter.emit("IframeLoad",i),this.sideEffectManager.addDisposer(q.emitter.on("Ready",()=>{var r;this.postMessage((r=this.attributes.lastEvent)==null?void 0:r.payload)}),Bt.Ready),this.computedStyleAndIframeDisplay()};t.url&&this.iframe.src!==t.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=t.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=t.url)),this.iframe.width=`${t.width}px`,this.iframe.height=`${t.height}px`,this.sideEffectManager.addEventListener(this.iframe,"load",e,void 0,Bt.Load)}listenDisplayerState(){this.isReplay&&(this.displayer._phase===b.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add(()=>(this.displayer.callbacks.on("onPhaseChanged",this.onPhaseChangedListener),()=>this.displayer.callbacks.off("onPhaseChanged",this.onPhaseChangedListener)),Bt.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(t){const e=this.manager.cameraState,i=this.attributes.width||1280,n=this.attributes.height||720;if(this.iframe){const{width:r,height:s,scale:a,centerX:o,centerY:l}=e,u=this.rootRect||{x:0,y:0},h=`${r/2+u.x}px`,c=`${s/2+u.y}px`,m=`transform-origin: ${h} ${c};`,w=(r-i)/2*a,y=(s-n)/2*a,x=-(o*a)+w,d=-(l*a)+y,f=`transform: translate(${x}px,${d}px) scale(${a}, ${a});`,E=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;",m,f];this.cssList=E,this.computedZindex(),this.updateStyle()}}computedIframeDisplay(t,e){this.inDisplaySceneDir?q.emitter.emit("DispayIframe"):q.emitter.emit("HideIframe")}computedZindex(){const t="z-index: -1;",e=this.cssList.findIndex(i=>i===t);e!==-1&&this.cssList.splice(e,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(t)}updateStyle(){this.iframe.style.cssText=this.cssList.join(" ")}get iframeOrigin(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(t){console.warn(t)}}messageListener(t){if(et("<<<",JSON.stringify(t.data)),t.origin!==this.iframeOrigin)return;const e=t.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:{et(`${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(t){const e=t.payload;this.appManager.safeDispatchMagixEvent(e.event,e.payload)}handleSetAttributes(t){this.setAttributes(t.payload)}handleRegisterMagixEvent(t){const e=t.payload,i=n=>{n.authorId!==this.displayer.observerId&&this.postMessage({kind:"ReciveMagixEvent",payload:n})};this.magixEventMap.set(e,i),this.displayer.addMagixEventListener(e,i)}handleRemoveMagixEvent(t){const e=t.payload,i=this.magixEventMap.get(e);this.displayer.removeMagixEventListener(e,i)}handleNextPage(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}handlePrevPage(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}handlePageTo(t){if(this.manager.canOperate){const e=t.payload;if(!Number.isSafeInteger(e)||e<=0)return;this.manager.setMainViewSceneIndex(e-1),this.dispatchMagixEvent("PageTo",e-1)}}handleRemoveAllMagixEvent(){this.magixEventMap.forEach((t,e)=>{this.displayer.removeMagixEventListener(e,t)}),this.magixEventMap.clear()}handleGetAttributes(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}postMessage(t){var e;this.iframe&&((e=this.iframe.contentWindow)==null||e.postMessage(JSON.parse(JSON.stringify(t)),"*"))}dispatchMagixEvent(t,e){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:t,payload:e}}),this.displayer.dispatchMagixEvent(t,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 t=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(t)}get isDisableInput(){return"disableDeviceInputs"in this.displayer?this.displayer.disableDeviceInputs:!0}};let pn=q;pn.kind="IframeBridge";pn.hiddenClass="netless-iframe-brdige-hidden";pn.emitter=new bi.default;pn.displayer=null;pn.alreadyCreate=!1;class sM extends bi.default{_inject(e){this.context=e}}class Ig{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(i=>{i._inject(this.context)})}hasRegister(e){return Ae.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 aM(t,e){switch(t.name){case"AppManager":return(e==null?void 0:e.AppManager)||qs;case"BoxManager":return(e==null?void 0:e.BoxManager)||Ys;case"AttributesDelegate":return(e==null?void 0:e.AttributesDelegate)||Ks;case"CursorManager":return(e==null?void 0:e.CursorManager)||Js;case"AppProxy":return(e==null?void 0:e.AppProxy)||un;case"AppContext":return(e==null?void 0:e.AppContext)||Hs;case"TeleBoxManager":return(e==null?void 0:e.TeleBoxManager)||Zs;case"TeleBoxCollector":return(e==null?void 0:e.TeleBoxCollector)||dr;default:return t}}const bg=new cw({emitter:V}),O=class extends b.InvisiblePlugin{constructor(t){super(t),this.version="1.0.7-beta.7",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0-beta.13",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.52"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@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.52"}},this.emitter=G,this.viewMode=b.ViewMode.Broadcaster,this.isReplay=b.isPlayer(this.displayer),this._cursorUIDs=[],this.containerSizeRatio=O.containerSizeRatio,O.displayer=t.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"0.3.0-beta.13",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.52"},devDependencies:{"@hyrious/dts":"^0.2.2","@netless/app-docs-viewer":"^0.2.19","@netless/app-media-player":"0.1.4","@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.52"}}}static onCreate(t){O._resolve(t)}static async mount(t,e){const i=t.room;O.container=t.container,O.supportAppliancePlugin=t.supportAppliancePlugin;const n=t.containerSizeRatio,r=t.debug,s=t.cursor;O.params=t,O.extendClass=e,O.displayer=t.room,Cv();let a;if(b.isRoom(i)){if(i.phase!==b.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");i.phase===b.RoomPhase.Connected&&i.isWritable&&(i.disableSerialization=!1),a=await this.initManager(i)}if(O.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(r),this.debug&&xg({verbose:!0}),et("Already insert room",a),b.isRoom(this.displayer)){if(!a)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await jh.default(async u=>{if(a=i.getInvisiblePlugin(O.kind),!a)throw et(`manager is empty. retrying ${u}`),new Error},{retries:10,maxTimeout:5e3});if(!a)throw new Error("[WindowManager]: create manager failed");n&&(O.containerSizeRatio=n),await a.ensureAttributes();const o=Tt(qs,O.extendClass),l=Tt(Js,O.extendClass);a._fullscreen=t.fullscreen,a.appManager=new o(a),a.appManager.polling=t.polling||!1,a._pageState=new uw(a.appManager),a.cursorManager=new l(a.appManager,Boolean(s),t.cursorOptions,t.applianceIcons),a.extendPluginManager=new Ig({internalEmitter:V,windowManager:a}),n&&(a.containerSizeRatio=n),t.container&&a.bindContainer(t.container),hw(i,a),V.emit("onCreated"),O.isCreated=!0;try{await Wg()}catch(u){console.warn("[WindowManager]: indexedDB open failed"),console.log(u)}return a}static initManager(t){return Iv(t)}static initContainer(t,e,i){const{chessboard:n,overwriteStyles:r,fullscreen:s}=i;O.container||(O.container=e);const{playground:a,wrapper:o,sizer:l,mainViewElement:u}=Mv(e);if(O.playground=a,n&&l.classList.add("netless-window-manager-chess-sizer"),s&&l.classList.add("netless-window-manager-fullscreen"),r){const h=document.createElement("style");h.textContent=r,a.appendChild(h)}return t.containerResizeObserver=Cl.create(a,l,o,V),O.wrapper=o,O.sizer=l,u}static get registered(){return Ae.registered}bindContainer(t){var e,i,n,r,s,a;if(b.isRoom(this.displayer)&&this.room.phase!==b.RoomPhase.Connected)throw new Yh;if(O.isCreated&&O.container)O.container.firstChild&&t.appendChild(O.container.firstChild);else if(O.params){const o=O.params,l=O.initContainer(this,t,o);this.boxManager&&this.boxManager.destroy();const u=Sv(this,G,V,lt,{collectorContainer:o.collectorContainer,collectorStyles:o.collectorStyles,prefersColorScheme:o.prefersColorScheme,useBoxesStatus:o.useBoxesStatus});this.boxManager=u,this.appManager&&(this.appManager.useBoxesStatus=o.useBoxesStatus||!1,this.appManager.setBoxManager(u)),this.bindMainView(l,o.disableCameraTransform),O.wrapper&&((e=this.cursorManager)==null||e.setupWrapper(O.wrapper))}V.emit("updateManagerRect"),(i=this.appManager)==null||i.refresh(),(n=this.appManager)==null||n.resetMaximized(),(r=this.appManager)==null||r.resetMinimized(),(s=this.appManager)==null||s.displayerWritableListener(!this.room.isWritable),O.container=t,(a=this.extendPluginManager)==null||a.refreshContainer(t)}bindCollectorContainer(t){O.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(t):O.params&&(O.params.collectorContainer=t)}static register(t){return Ae.register(t)}static unregister(t){return Ae.unregister(t)}async addApp(t){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((e,i)=>{V.once("rootDirRemoved").then(async()=>{try{const n=await this._addApp(t);e(n)}catch(n){i(n.message)}})}):this._addApp(t);throw new Ve}async _addApp(t){var e,i,n;if(this.appManager){if(!t.kind||typeof t.kind!="string")throw new Hh;t.src&&typeof t.src=="string"&&Ae.register({kind:t.kind,src:t.src});const r=await((e=Ae.appClasses.get(t.kind))==null?void 0:e());if(r&&((i=r.config)==null?void 0:i.singleton)&&this.appManager.appProxies.has(t.kind))throw new $h;const s=this.setupScenePath(t,this.appManager);return s===void 0?void 0:((n=t==null?void 0:t.options)!=null&&n.scenePath&&(t.options.scenePath=om(t.options.scenePath)),await this.appManager.addApp(t,Boolean(s)))}else throw new Ve}setupScenePath(t,e){let i=!1;if(t.options){const{scenePath:n,scenes:r}=t.options;if(n){if(!am(n))throw new Qh;const s=Object.keys(this.apps||{});for(const a of s){const o=e.store.getAppScenePath(a);if(o&&o===n){if(console.warn(`[WindowManager]: ScenePath "${n}" already opened`),this.boxManager){const l=this.boxManager.getTopBox();l&&(this.boxManager.setZIndex(a,l.zIndex+1,!1),this.boxManager.focusBox({appId:a},!1))}return}}}n&&r&&r.length>0&&(this.isDynamicPPT(r)?(i=!0,qi(this.displayer)[n]||Dn(this.room,n,r)):qi(this.displayer)[n]||Dn(this.room,n,[{name:r[0].name}])),n&&r===void 0&&Dn(this.room,n,[{}])}return i}async setMainViewScenePath(t){this.appManager&&await this.appManager.setMainViewScenePath(t)}async setMainViewSceneIndex(t){this.appManager&&await this.appManager.setMainViewSceneIndex(t)}async nextPage(){if(this.appManager){const t=this.mainViewSceneIndex+1;return t>=this.mainViewScenesLength?(console.warn("[WindowManager]: current page is the last page"),!1):(await this.appManager.setMainViewSceneIndex(t),!0)}else return!1}async prevPage(){if(this.appManager){const t=this.mainViewSceneIndex-1;return t<0?(console.warn("[WindowManager]: current page is the first page"),!1):(await this.appManager.setMainViewSceneIndex(t),!0)}else return!1}async jumpPage(t){return this.appManager?t<0||t>=this.pageState.length?(console.warn(`[WindowManager]: index ${t} out of range`),!1):(await this.appManager.setMainViewSceneIndex(t),!0):!1}async addPage(t){if(this.appManager){const e=t==null?void 0:t.after,i=t==null?void 0:t.scene;if(e){const n=this.mainViewSceneIndex+1;this.room.putScenes(Ue,[i||{}],n)}else this.room.putScenes(Ue,[i||{}])}}async removePage(t){if(this.appManager){const e=t===void 0?this.pageState.index:t;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 ${t} out of range`),!1):this.appManager.removeSceneByIndex(e)}else return!1}getMainViewScenePath(){var t;return(t=this.appManager)==null?void 0:t.store.getMainViewScenePath()}getMainViewSceneIndex(){var t;return(t=this.appManager)==null?void 0:t.store.getMainViewSceneIndex()}setReadonly(t){var e;this.readonly=t,(e=this.boxManager)==null||e.setReadonly(t),V.emit("setReadonly",t)}switchMainViewToWriter(){var t;return(t=this.appManager)==null?void 0:t.mainViewProxy.mainViewClickHandler()}onAppDestroy(t,e){rm(`destroy-${t}`,e)}onAppEvent(t,e){return V.on(`custom-${t}`,e)}setViewMode(t){var e,i,n,r;(t===b.ViewMode.Broadcaster||t===b.ViewMode.Follower)&&(this.canOperate&&t===b.ViewMode.Broadcaster&&((e=this.appManager)==null||e.mainViewProxy.setCameraAndSize()),(i=this.appManager)==null||i.mainViewProxy.start()),t===b.ViewMode.Freedom&&((n=this.appManager)==null||n.mainViewProxy.stop()),this.viewMode=t,(r=this.appManager)==null||r.mainViewProxy.setViewMode(t)}setBoxState(t){if(!!this.canOperate)switch(t){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(t){var e;!this.canOperate||(e=this.boxManager)==null||e.setMaximized(t,!1)}setMinimized(t){var e;!this.canOperate||(e=this.boxManager)==null||e.setMinimized(t,!1)}setBoxStatus(t,e){var i;!this.canOperate||(i=this.appManager)==null||i.store.setBoxStatus(t,e)}setLastNotMinimizedBoxStatus(t,e){var i;!this.canOperate||(i=this.appManager)==null||i.store.setLastNotMinimizedBoxStatus(t,e)}setFullscreen(t){var e;this._fullscreen!==t&&(this._fullscreen=t,(e=O.sizer)==null||e.classList.toggle("netless-window-manager-fullscreen",t),G.emit("fullscreenChange",t))}get cursorUIDs(){return this._cursorUIDs}setCursorUIDs(t){var e,i;if(this._cursorUIDs=t||[],this._cursorUIDs.length===0)(e=this._cursorUIDsStyleDOM)==null||e.remove();else{this._cursorUIDsStyleDOM||(this._cursorUIDsStyleDOM=document.createElement("style")),(i=O.playground)==null||i.appendChild(this._cursorUIDsStyleDOM);let n="[data-cursor-uid] { display: none }";for(const r of this._cursorUIDs)n+=`
48
+ [data-cursor-uid="${r}"] { display: flex }`;this._cursorUIDsStyleDOM.textContent=n}}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new Ve}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new Ve}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new Ve}get apps(){var t;return(t=this.appManager)==null?void 0:t.store.apps()}get boxState(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.boxState;throw new Ve}get boxStatus(){if(this.appManager)return this.appManager.store.getBoxesStatus();throw new Ve}get lastNotMinimizedBoxStatus(){if(this.appManager)return this.appManager.store.getLastNotMinimizedBoxesStatus();throw new Ve}get darkMode(){var t,e;return Boolean((e=(t=this.appManager)==null?void 0:t.boxManager)==null?void 0:e.darkMode)}get prefersColorScheme(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.prefersColorScheme;throw new Ve}get focused(){return this.attributes.focus}get focusedView(){var t,e;return((e=(t=this.appManager)==null?void 0:t.focusApp)==null?void 0:e.view)||this.mainView}get polling(){var t;return((t=this.appManager)==null?void 0:t.polling)||!1}set polling(t){this.appManager&&(this.appManager.polling=t)}get cursorStyle(){var t;return((t=this.cursorManager)==null?void 0:t.style)||"default"}set cursorStyle(t){if(!this.cursorManager)throw new Error("[WindowManager]: cursor is not enabled, please set { cursor: true }.");this.cursorManager.style=t}get mainViewSceneIndex(){var t;return((t=this._pageState)==null?void 0:t.index)||0}get mainViewSceneDir(){var t;if(this.appManager)return(t=this.appManager)==null?void 0:t.getMainViewSceneDir();throw new Ve}get topApp(){var t,e;return(e=(t=this.boxManager)==null?void 0:t.getTopBox())==null?void 0:e.id}get mainViewScenesLength(){var t;return((t=this._pageState)==null?void 0:t.length)||0}get canRedoSteps(){var t;return((t=this.focusedView)==null?void 0:t.canRedoSteps)||0}get canUndoSteps(){var t;return((t=this.focusedView)==null?void 0:t.canUndoSteps)||0}get sceneState(){if(this.appManager)return this.appManager.sceneState;throw new Ve}get pageState(){if(this._pageState)return this._pageState.toObject();throw new Ve}get fullscreen(){return Boolean(this._fullscreen)}queryAll(){var t;return Array.from(((t=this.appManager)==null?void 0:t.appProxies.values())||[])}queryOne(t){var e;return(e=this.appManager)==null?void 0:e.appProxies.get(t)}async closeApp(t){var e;return(e=this.appManager)==null?void 0:e.closeApp(t)}focusApp(t){var i,n,r;const e=(i=this.boxManager)==null?void 0:i.getBox(t);e&&((n=this.boxManager)==null||n.focusBox({appId:t},!1),((r=this.boxManager)==null?void 0:r.teleBoxManager).makeBoxTop(e,!1))}moveCamera(t){var n;const e=T.omit(t,["animationMode"]),i={...this.mainView.camera};T.isEqual({...i,...e},i)||(this.mainView.moveCamera(t),(n=this.appManager)==null||n.dispatchInternalEvent(K.MoveCamera,t),setTimeout(()=>{var r;(r=this.appManager)==null||r.mainViewProxy.setCameraAndSize()},500))}moveCameraToContain(t){var e;this.mainView.moveCameraToContain(t),(e=this.appManager)==null||e.dispatchInternalEvent(K.MoveCameraToContain,t),setTimeout(()=>{var i;(i=this.appManager)==null||i.mainViewProxy.setCameraAndSize()},500)}convertToPointInWorld(t){return this.mainView.convertToPointInWorld(t)}setCameraBound(t){this.mainView.setCameraBound(t)}onDestroy(){this._destroy()}destroy(){this._destroy()}_destroy(){var t,e,i,n,r,s;(t=this.containerResizeObserver)==null||t.disconnect(),(e=this.appManager)==null||e.destroy(),(i=this.cursorManager)==null||i.destroy(),(n=this.extendPluginManager)==null||n.destroy(),O.container=void 0,O.wrapper=void 0,O.sizer=void 0,O.isCreated=!1,O.playground&&((r=O.playground.parentNode)==null||r.removeChild(O.playground)),O.params=void 0,(s=this._iframeBridge)==null||s.destroy(),this._iframeBridge=void 0,et("Destroyed")}bindMainView(t,e){var i;this.appManager&&(this.appManager.bindMainView(t,Boolean(e)),(i=this.cursorManager)==null||i.setMainViewDivElement(t))}get canOperate(){return b.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===b.RoomPhase.Connected:!1}get room(){return this.displayer}safeSetAttributes(t){this.canOperate&&this.setAttributes(t)}safeUpdateAttributes(t,e){this.canOperate&&this.updateAttributes(t,e)}setPrefersColorScheme(t){var e,i;(i=(e=this.appManager)==null?void 0:e.boxManager)==null||i.setPrefersColorScheme(t)}cleanCurrentScene(){var t;et("clean current scene"),(t=this.focusedView)==null||t.cleanCurrentScene()}redo(){var t;return((t=this.focusedView)==null?void 0:t.redo())||0}undo(){var t;return((t=this.focusedView)==null?void 0:t.undo())||0}delete(){var t;(t=this.focusedView)==null||t.delete()}copy(){var t;(t=this.focusedView)==null||t.copy()}paste(){var t;(t=this.focusedView)==null||t.paste()}duplicate(){var t;(t=this.focusedView)==null||t.duplicate()}insertText(t,e,i){var n;return((n=this.focusedView)==null?void 0:n.insertText(t,e,i))||""}insertImage(t){var e;return(e=this.focusedView)==null?void 0:e.insertImage(t)}completeImageUpload(t,e){var i;return(i=this.focusedView)==null?void 0:i.completeImageUpload(t,e)}lockImage(t,e){var i;return(i=this.focusedView)==null?void 0:i.lockImage(t,e)}lockImages(t){var e;return(e=this.focusedView)==null?void 0:e.lockImages(t)}refresh(){var t;this._refresh(),(t=this.appManager)==null||t.dispatchInternalEvent(K.Refresh)}_refresh(){var t,e;(t=this.appManager)==null||t.mainViewProxy.rebind(),O.container&&this.bindContainer(O.container),(e=this.appManager)==null||e.refresher.refresh()}setContainerSizeRatio(t){if(!T.isNumber(t)||!(t>0))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a positive number. but got ${t}`);O.containerSizeRatio=t,this.containerSizeRatio=t,V.emit("containerSizeRatioUpdate",t)}isDynamicPPT(t){var i,n;const e=(n=(i=t[0])==null?void 0:i.ppt)==null?void 0:n.src;return e==null?void 0:e.startsWith("pptx://")}async ensureAttributes(){T.isNull(this.attributes)&&await Uh(50),T.isObject(this.attributes)&&(this.attributes[xe.Apps]||this.safeSetAttributes({[xe.Apps]:{}}),this.attributes[xe.Cursors]||this.safeSetAttributes({[xe.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:Vh}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[xe.Registered]||this.safeSetAttributes({[xe.Registered]:{}}),this.attributes[xe.IframeBridge]||this.safeSetAttributes({[xe.IframeBridge]:{}}))}getIframeBridge(){if(!this.appManager)throw new Error("[WindowManager]: should call getIframeBridge() after await mount()");return this._iframeBridge||(this._iframeBridge=new pn(this,this.appManager)),this._iframeBridge}useExtendPlugin(t){var e;(e=this.extendPluginManager)==null||e.use(t)}};let Q=O;Q.kind="WindowManager";Q.debug=!1;Q.containerSizeRatio=Og;Q.isCreated=!1;Q._resolve=t=>{};iM();exports.AppContext=Hs;exports.AppCreateError=$h;exports.AppManager=qs;exports.AppManagerNotInitError=Ve;exports.AppNotRegisterError=cm;exports.AppProxy=un;exports.AttributesDelegate=Ks;exports.BindContainerRoomPhaseInvalidError=Yh;exports.BoxManager=Ys;exports.BoxManagerNotFoundError=Zh;exports.BoxNotCreatedError=Fh;exports.BuiltinApps=nM;exports.CursorManager=Js;exports.ExtendPlugin=sM;exports.ExtendPluginManager=Ig;exports.InvalidScenePath=Qh;exports.ParamsInvalidError=Hh;exports.TeleBoxCollector=dr;exports.TeleBoxManager=Zs;exports.WhiteWebSDKInvalidError=Wh;exports.WindowManager=Q;exports.calculateNextIndex=Ml;exports.getExtendClass=aM;exports.reconnectRefresher=bg;
49
49
  //# sourceMappingURL=index.js.map