@netless/window-manager 1.0.7-beta.1 → 1.0.7-beta.3

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";var Cg=Object.defineProperty,Ig=Object.defineProperties;var bg=Object.getOwnPropertyDescriptors;var Cu=Object.getOwnPropertySymbols;var Ag=Object.prototype.hasOwnProperty,Eg=Object.prototype.propertyIsEnumerable;var Iu=(e,t,i)=>t in e?Cg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,q=(e,t)=>{for(var i in t||(t={}))Ag.call(t,i)&&Iu(e,i,t[i]);if(Cu)for(var i of Cu(t))Eg.call(t,i)&&Iu(e,i,t[i]);return e},Re=(e,t)=>Ig(e,bg(t));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Tg=require("p-retry"),kg=require("emittery"),E=require("lodash"),C=require("white-web-sdk"),Pg=require("uuid"),Ng=require("@juggle/resize-observer"),Dg=require("video.js");function qa(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}function zg(e){if(e&&e.__esModule)return e;var t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});return e&&Object.keys(e).forEach(function(i){if(i!=="default"){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var kd=qa(Tg),Ii=qa(kg),bu=qa(Dg),K=(e=>(e.AppMove="AppMove",e.AppFocus="AppFocus",e.AppResize="AppResize",e.AppBoxStateChange="AppBoxStateChange",e.GetAttributes="GetAttributes",e.UpdateWindowManagerWrapper="UpdateWindowManagerWrapper",e.InitReplay="InitReplay",e.WindowCreated="WindowCreated",e.SetMainViewScenePath="SetMainViewScenePath",e.SetMainViewSceneIndex="SetMainViewSceneIndex",e.SetAppFocusIndex="SetAppFocusIndex",e.SwitchViewsToFreedom="SwitchViewsToFreedom",e.MoveCamera="MoveCamera",e.MoveCameraToContain="MoveCameraToContain",e.CursorMove="CursorMove",e.RootDirRemoved="RootDirRemoved",e.Refresh="Refresh",e.InitMainViewCamera="InitMainViewCamera",e))(K||{});const Vo="__WindowManger",lo="__WindowMangerEnsureReconnected__";var ke=(e=>(e.Size="size",e.Position="position",e.SceneIndex="SceneIndex",e.ZIndex="zIndex",e))(ke||{}),Pd=(e=>(e.setBoxSize="setBoxSize",e.setBoxMinSize="setBoxMinSize",e.destroy="destroy",e))(Pd||{}),Oo=(e=>(e.StartCreate="StartCreate",e))(Oo||{}),Uo=(e=>(e.Leave="leave",e.Normal="normal",e))(Uo||{});const Au="2.16.1",Lg=340/720,Rg=340/720,jg=9/16,_e="/",Nd="/init",Dd=50,Q=new Ii.default;class Bg{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(t){this.list.push(t),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 t=this.list.shift();t&&(this.currentInvoker=t,t().then(()=>{this.invoked()}).catch(i=>{console.error(`[WindowManager]: create app error: ${i.message}`),this.invoked()}))}emitReady(){this.isEmit||setTimeout(()=>{Q.emit("ready")},Dd),this.isEmit=!0}empty(){this.list=[],this.clear()}destroy(){this.timer&&this.clear()}}const B=new Ii.default,_g="__WindowManagerAppCache";let Vn,Eu;const Vg=async()=>{Vn=await Wg()},Og=(e,t)=>{if(!!Vn)return $g(Vn,{kind:e,sourceCode:t})},Ug=async e=>Vn?await Hg(Vn,e):null;function Wg(){return new Promise((e,t)=>{const i=indexedDB.open(_g,2);i.onerror=n=>{t(n)},i.onupgradeneeded=n=>{const r=n.target.result;r.objectStoreNames.contains("apps")||(Eu=r.createObjectStore("apps",{keyPath:"kind"}),Eu.createIndex("kind","kind",{unique:!0}))},i.onsuccess=()=>{const n=i.result;e(n)}})}function Hg(e,t){return new Promise((i,n)=>{const s=e.transaction(["apps"]).objectStore("apps").index("kind").get(t);s.onerror=o=>n(o),s.onsuccess=()=>{s.result?i(s.result):i(null)}})}function $g(e,t){return new Promise((i,n)=>{const r=e.transaction(["apps"],"readwrite").objectStore("apps").add(t);r.onsuccess=()=>i(),r.onerror=()=>n()})}const Fg="NetlessApp",Qg=1e4,Zg=async e=>{const t=await Ug(e);if(t)return t.sourceCode;{const n=await(await Xg(e,{timeout:Qg})).text();return await Og(e,n),n}},Tu=(e,t)=>{let i=Function(e+`
2
- ;return ${t}`)();return typeof i=="undefined"&&(i=window[t]),i},Yg=async(e,t,i)=>{const n=i||Fg+t;Q.emit("loadApp",{kind:t,status:"start"});let r;try{if(r=await Zg(e),!r||r.length===0)throw Q.emit("loadApp",{kind:t,status:"failed",reason:"script is empty."}),new Error("[WindowManager]: script is empty.")}catch(s){throw Q.emit("loadApp",{kind:t,status:"failed",reason:s.message}),s}return Gg(r,n,t)},Gg=(e,t,i)=>{try{const n=Tu(e,t);return Q.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=Tu(e,t);return Q.emit("loadApp",{kind:i,status:"success"}),s}throw Q.emit("loadApp",{kind:i,status:"failed",reason:n.message}),n}};async function Xg(e,t){const{timeout:i=1e4}=t,n=new AbortController,r=setTimeout(()=>n.abort(),i),s=await fetch(e,Re(q({},t),{signal:n.signal,headers:{"content-type":"text/plain"}}));return clearTimeout(r),s}class Jg{constructor(){this.kindEmitters=new Map,this.registered=new Map,this.appClassesCache=new Map,this.appClasses=new Map,this.syncRegisterApp=null,this.onSyncRegisterAppChange=t=>{this.register({kind:t.kind,src:t.src})}}setSyncRegisterApp(t){this.syncRegisterApp=t}async register(t){this.appClassesCache.delete(t.kind),this.registered.set(t.kind,t);const i=t.src;let n;if(typeof i=="string"&&(n=async()=>{const r=await Yg(i,t.kind,t.name);return r.__esModule?r.default:r},this.syncRegisterApp&&this.syncRegisterApp({kind:t.kind,src:i,name:t.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(t.kind,async()=>{let r=this.appClassesCache.get(t.kind);return r||(r=n(),this.appClassesCache.set(t.kind,r)),r}),t.addHooks){const r=this.createKindEmitter(t.kind);r&&t.addHooks(r)}}unregister(t){this.appClasses.delete(t),this.appClassesCache.delete(t),this.registered.delete(t);const i=this.kindEmitters.get(t);i&&(i.clearListeners(),this.kindEmitters.delete(t))}async notifyApp(t,i,n){const r=this.kindEmitters.get(t);await(r==null?void 0:r.emit(i,n))}createKindEmitter(t){if(!this.kindEmitters.has(t)){const i=new Ii.default;this.kindEmitters.set(t,i)}return this.kindEmitters.get(t)}}const Ie=new Jg,Kg=async e=>{var i,n;const t=await((i=Ie.appClasses.get(e))==null?void 0:i());return t&&((n=t.config)==null?void 0:n.singleton)?e:`${e}-${Pg.v4().replace("-","").slice(0,8)}`},wi=(e,t)=>{if(e.focusScenePath!==t)return e.focusScenePath=t,e},Wo=(e,t)=>{if(e&&e.isWritable&&e.state.sceneState.scenePath!==t){const i=t==="/"?"":t;e.setScenePath(i)}},qg=(e,t,i)=>{var n;if(e&&t){const s=(n=Zi(e)[t])==null?void 0:n[i];if(s)return`${t}/${s.name}`}},Ho=(e,t,i)=>{e&&e.scenePathType(t)!==C.ScenePathType.None&&e.removeScenes(t,i)},em=(e,t)=>{B.once(e).then(t)};E.debounce((e,t)=>{e.emit("mainViewModeChange",t)},200);const tm=(e,t,i=0)=>{const n=Zi(e)[t];if(!n)return;const r=n[i];if(!r)return;const s=r.name;return t===_e?`/${s}`:`${t}/${s}`},Zi=e=>e.entireScenes(),In=(e,t,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 e==null?void 0:e.putScenes(t,i,n)},im=e=>e.startsWith("/"),uo=e=>{const t=e.split("/");t.pop();let i=t.join("/");return i===""&&(i="/"),i},nm=e=>e.endsWith("/")?e.slice(0,-1):e,ku=e=>{const t=e.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(t)},zd=e=>new Promise(t=>setTimeout(t,e)),rm=e=>e.split("").reduce((i,n)=>(n===_e&&(i+=1),i),0)===1;class sm{constructor(t){this.manager=t,this.displayer=this.manager.displayer,this.mainMagixEventListener=i=>{if(i.authorId!==this.displayer.observerId){const n=i.payload;switch(n.eventName){case 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=>{Q.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{wi(this.manager.mainView,i),Q.emit("mainViewScenePathChange",i)},this.moveCameraHandler=i=>{E.isEqual(E.omit(i,["animationMode"]),q({},this.manager.mainView.camera))||this.manager.mainView.moveCamera(i)},this.moveCameraToContainHandler=i=>{this.manager.mainView.moveCameraToContain(i)},this.cursorMoveHandler=i=>{B.emit("cursorMove",i)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),B.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(Vo,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(Vo,this.mainMagixEventListener)}}class Ld extends Error{constructor(){super(...arguments);this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class om extends Error{constructor(t){super(`[WindowManager]: app ${t} need register or provide src`)}}class et extends Error{constructor(){super(...arguments);this.message="[WindowManager]: AppManager must be initialized"}}class Rd extends Error{constructor(t){super(`[WindowManager]: white-web-sdk version must large than ${t}`)}}class jd extends Error{constructor(){super(...arguments);this.message="[WindowManager]: kind must be a valid string"}}class Bd extends Error{constructor(){super(...arguments);this.message="[WindowManager]: box need created"}}class _d extends Error{constructor(){super(...arguments);this.message='[WindowManager]: ScenePath should start with "/"'}}class Vd extends Error{constructor(){super(...arguments);this.message="[WindowManager]: boxManager not found"}}class Od extends Error{constructor(){super(...arguments);this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const Ud="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",am=Ud.length,Pu=Array(20),Pi=()=>{for(let e=0;e<20;e++)Pu[e]=Ud.charAt(Math.random()*am);return Pu.join("")};class er{constructor(){this.disposers=new Map}add(t,i=Pi()){return this.flush(i),this.disposers.set(i,t()),i}addDisposer(t,i=Pi()){return this.flush(i),this.disposers.set(i,t),i}addEventListener(t,i,n,r,s=Pi()){return this.add(()=>(t.addEventListener(i,n,r),()=>t.removeEventListener(i,n,r)),s),s}setTimeout(t,i,n=Pi()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(n),t()},i);return()=>window.clearTimeout(r)},n)}setInterval(t,i,n=Pi()){return this.add(()=>{const r=window.setInterval(t,i);return()=>window.clearInterval(r)},n)}remove(t){const i=this.disposers.get(t);return this.disposers.delete(t),i}flush(t){const i=this.remove(t);if(i)try{i()}catch(n){console.error(n)}}flushAll(){this.disposers.forEach(t=>{try{t()}catch(i){console.error(i)}}),this.disposers.clear()}}const Wd=e=>(t,i)=>{if(t!==void 0)if(C.listenUpdated){const n=r=>{r.map(o=>o.kind).includes(e)&&i()};return C.listenUpdated(t,n),i(),()=>C.unlistenUpdated(t,n)}else return C.reaction(()=>t,()=>{i()},{fireImmediately:!0})},$o=(e,t,i)=>{let n=null;const r=C.reaction(e,()=>{n&&(n(),n=null);const s=e();E.isObject(s)?(n=()=>C.unlistenUpdated(s,t),C.listenUpdated(s,t)):i==null||i(s)},{fireImmediately:!0});return()=>{n==null||n(),r()}};Wd(C.UpdateEventKind.Removed);Wd(C.UpdateEventKind.Inserted);class lm{constructor(){this.listeners=new Set}get length(){return this.listeners.size}dispatch(t){this.listeners.forEach(i=>i(t))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}}const co=Object.keys;function Nu(e){return Boolean(E.has(e,"__isRef"))}function um(e){return{k:Pi(),v:e,__isRef:!0}}const qe="_WM-STORAGE_";class Du{constructor(t,i,n){if(this._sideEffect=new er,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new lm,n&&!E.isObject(n))throw new Error(`Default state for Storage ${i} is not an object.`);this._context=t,this.id=i||null,this._state={};const r=this._getRawState(this._state);this._context.getIsWritable()&&(this.id===null?t.isAddApp&&n&&this.setState(n):(r===this._state||!E.isObject(r))&&(E.get(this._context.getAttributes(),[qe])||this._context.updateAttributes([qe],{}),this._context.updateAttributes([qe,this.id],this._state),n&&this.setState(n))),co(r).forEach(s=>{if(!(this.id===null&&s===qe))try{const o=E.isObject(r[s])?JSON.parse(JSON.stringify(r[s])):r[s];Nu(o)?(this._state[s]=o.v,E.isObject(o.v)&&this._refMap.set(o.v,o)):this._state[s]=o}catch(o){console.error(o)}}),this._sideEffect.addDisposer($o(()=>this.id===null?t.getAttributes():E.get(t.getAttributes(),[qe,this.id]),this._updateProperties.bind(this),this.destroy.bind(this)))}get state(){return this._destroyed&&console.warn(`Accessing state on destroyed Storage "${this.id}"`),this._state}addStateChangedListener(t){return this.onStateChanged.addListener(t),()=>this.onStateChanged.removeListener(t)}ensureState(t){return this.setState(co(t).reduce((i,n)=>(E.has(this._state,n)||(i[n]=t[n]),i),{}))}setState(t){if(this._destroyed){console.error(new Error(`Cannot call setState on destroyed Storage "${this.id}".`));return}if(!this._context.getIsWritable()){console.error(new Error(`Cannot setState on Storage "${this.id}" without writable access`),t);return}const i=co(t);i.length>0&&i.forEach(n=>{const r=t[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(E.isObject(r)){let o=this._refMap.get(r);o||(o=um(r),this._refMap.set(r,o)),s=o}this._setRawState(n,s)}})}emptyStorage(){if(!(E.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(E.mapValues(this._state,E.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([qe,this.id],void 0)}get destroyed(){return this._destroyed}destroy(){this._destroyed=!0,this._sideEffect.flushAll()}_getRawState(t){var i;return this.id===null?(i=this._context.getAttributes())!=null?i:t:E.get(this._context.getAttributes(),[qe,this.id],t)}_setRawState(t,i){if(this.id===null){if(t===qe)throw new Error(`Cannot set attribute internal filed "${qe}"`);return this._context.updateAttributes([t],i)}else return this._context.updateAttributes([qe,this.id,t],i)}_updateProperties(t){var i;if(this._destroyed){console.error(new Error(`Cannot call _updateProperties on destroyed Storage "${this.id}".`));return}if(t.length>0){const n={};for(let r=0;r<t.length;r++)try{const s=t[r],o=s.key;if(this.id===null&&o===qe)continue;const a=E.isObject(s.value)?JSON.parse(JSON.stringify(s.value)):s.value;let l;switch(this._lastValue.has(o)&&(l=this._lastValue.get(o),this._lastValue.delete(o)),s.kind){case 2:{E.has(this._state,o)&&(l=this._state[o],delete this._state[o]),n[o]={oldValue:l};break}default:{let u=a;if(Nu(a)){const{k:c,v:d}=a,m=this._state[o];E.isObject(m)&&((i=this._refMap.get(m))==null?void 0:i.k)===c?u=m:(u=d,E.isObject(d)&&this._refMap.set(d,a))}u!==this._state[o]&&(l=this._state[o],this._state[o]=u),n[o]={newValue:u,oldValue:l};break}}}catch(s){console.error(s)}this.onStateChanged.dispatch(n)}}}class cm{constructor(t,i,n,r,s){this.manager=t,this.boxManager=i,this.appId=n,this.appProxy=r,this.appOptions=s,this.mobxUtils={autorun:C.autorun,reaction:C.reaction,toJS:C.toJS},this.objectUtils={listenUpdated:C.listenUpdated,unlistenUpdated:C.unlistenUpdated,listenDisposed:C.listenDisposed,unlistenDisposed:C.unlistenDisposed},this.store=this.manager.store,this.isReplay=this.manager.isReplay,this.getDisplayer=()=>this.manager.displayer,this.getAttributes=()=>this.appProxy.attributes,this.getScenes=()=>{const o=this.store.getAppAttributes(this.appId);return o!=null&&o.isDynamicPPT?this.appProxy.scenes:o==null?void 0:o.options.scenes},this.getView=()=>this.appProxy.view,this.mountView=o=>{const a=this.getView();a&&(a.divElement=o,setTimeout(()=>{var l;(l=this.getRoom())==null||l.refreshViewSize(),Q.emit("onAppViewMounted",{appId:this.appId,view:a})},1e3))},this.getInitScenePath=()=>this.manager.getAppInitPath(this.appId),this.getIsWritable=()=>this.manager.canOperate,this.getBox=()=>{const o=this.boxManager.getBox(this.appId);if(o)return o;throw new Bd},this.getRoom=()=>this.manager.room,this.setAttributes=o=>{this.manager.safeSetAttributes({[this.appId]:o})},this.updateAttributes=(o,a)=>{this.manager.attributes[this.appId]&&this.manager.safeUpdateAttributes([this.appId,...o],a)},this.setScenePath=async o=>{var a;!this.appProxy.box||(this.appProxy.setFullPath(o),(a=this.getRoom())==null||a.setScenePath(o))},this.getAppOptions=()=>typeof this.appOptions=="function"?this.appOptions():this.appOptions,this.createStorage=(o,a)=>{const l=new Du(this,o,a);return this.emitter.on("destroy",()=>{l.destroy()}),l},this.dispatchMagixEvent=(...o)=>{var l;const a=`${this.appId}:${o[0]}`;return(l=this.manager.room)==null?void 0:l.dispatchMagixEvent(a,o[1])},this.addMagixEventListener=(o,a,l)=>{const u=`${this.appId}:${o}`;return this.manager.displayer.addMagixEventListener(u,a,l),()=>this.manager.displayer.removeMagixEventListener(u,a)},this.removeMagixEventListener=this.manager.displayer.removeMagixEventListener.bind(this.manager.displayer),this.nextPage=async()=>{const o=this.pageState.index+1;return o>this.pageState.length-1?(console.warn("[WindowManager] nextPage: index out of range"),!1):(this.appProxy.setSceneIndex(o),!0)},this.jumpPage=async o=>0<=o&&o<this.pageState.length?(this.appProxy.setSceneIndex(o),!0):(console.warn("[WindowManager] nextPage: index out of range"),!1),this.prevPage=async()=>{const o=this.pageState.index-1;return o<0?(console.warn("[WindowManager] prevPage: index out of range"),!1):(this.appProxy.setSceneIndex(o),!0)},this.addPage=async o=>{const a=o==null?void 0:o.after,l=o==null?void 0:o.scene,u=this.appProxy.scenePath;if(!!u)if(a){const c=this.pageState.index+1;In(this.manager.room,u,[l||{}],c)}else In(this.manager.room,u,[l||{}])},this.removePage=async o=>{const a=o===void 0?this.pageState.index:o;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):a<0||a>=this.pageState.length?(console.warn(`[WindowManager]: page index ${o} out of range`),!1):this.appProxy.removeSceneByIndex(a)},this.emitter=r.appEmitter,this.isAddApp=r.isAddApp}get storage(){return this._storage||(this._storage=new Du(this)),this._storage}get pageState(){return this.appProxy.pageState}get kind(){return this.appProxy.kind}dispatchAppEvent(t,i){B.emit(`custom-${this.kind}`,{kind:this.kind,appId:this.appId,type:t,value:i})}}class dm{constructor(t){this.params=t,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(t){var n;const i=(n=this.sceneNode)==null?void 0:n.scenes;if(this.params.scenePath&&i){const r=i[t];if(r)return`${this.params.scenePath}/${r}`}}toObject(){var t,i;return{index:((t=this.params.view)==null?void 0:t.focusSceneIndex)||0,length:((i=this.sceneNode)==null?void 0:i.scenes.length)||0}}destroy(){var t;(t=this.sceneNode)==null||t.dispose()}}var xe=(e=>(e.Apps="apps",e.Focus="focus",e.State="state",e.BoxState="boxState",e.MainViewCamera="mainViewCamera",e.MainViewSize="mainViewSize",e.Broadcaster="broadcaster",e.Cursors="cursors",e.Position="position",e.CursorState="cursorState",e.FullPath="fullPath",e.Registered="registered",e.IframeBridge="iframeBridge",e))(xe||{});class hm{constructor(t){this.context=t,this.setAppFocus=(i,n)=>{n?this.context.safeSetAttributes({focus:i}):this.context.safeSetAttributes({focus:void 0})}}setContext(t){this.context=t}get attributes(){return this.context.getAttributes()}apps(){return E.get(this.attributes,["apps"])}get focus(){return E.get(this.attributes,["focus"])}getAppAttributes(t){return E.get(this.apps(),[t])}getAppState(t){return E.get(this.apps(),[t,"state"])}getMaximized(){return E.get(this.attributes,["maximized"])}getMinimized(){return E.get(this.attributes,["minimized"])}setupAppAttributes(t,i,n){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const s=["scenePath","title"];n||s.push("scenes");const o=E.pick(t.options,s),a={kind:t.kind,options:o,isDynamicPPT:n};typeof t.src=="string"&&(a.src=t.src),a.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",i],a),this.context.safeUpdateAttributes(["apps",i,"state"],{[ke.Size]:{},[ke.Position]:{},[ke.SceneIndex]:0})}updateAppState(t,i,n){E.get(this.attributes,["apps",t,"state"])&&this.context.safeUpdateAttributes(["apps",t,"state",i],n)}cleanAppAttributes(t){this.context.safeUpdateAttributes(["apps",t],void 0),this.context.safeSetAttributes({[t]:void 0}),this.attributes.focus===t&&this.cleanFocus()}cleanFocus(){this.context.safeSetAttributes({focus:void 0})}getAppSceneIndex(t){var i;return(i=this.getAppState(t))==null?void 0:i[ke.SceneIndex]}getAppScenePath(t){var i,n;return(n=(i=this.getAppAttributes(t))==null?void 0:i.options)==null?void 0:n.scenePath}getMainViewScenePath(){return this.attributes._mainScenePath}getMainViewSceneIndex(){return this.attributes._mainSceneIndex}getBoxState(){return this.attributes.boxState}setMainViewScenePath(t){this.context.safeSetAttributes({_mainScenePath:t})}setMainViewSceneIndex(t){this.context.safeSetAttributes({_mainSceneIndex:t})}getMainViewCamera(){return E.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return E.get(this.attributes,["mainViewSize"])}setMainViewCamera(t){this.context.safeSetAttributes({mainViewCamera:q({},t)})}setMainViewSize(t){t.width===0||t.height===0||this.context.safeSetAttributes({mainViewSize:q({},t)})}setMainViewCameraAndSize(t,i){i.width===0||i.height===0||this.context.safeSetAttributes({mainViewCamera:q({},t),mainViewSize:q({},i)})}updateCursor(t,i){E.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),E.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"position"],i)}updateCursorState(t,i){E.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"cursorState"],i)}getCursorState(t){return E.get(this.attributes,["cursors",t,"cursorState"])}cleanCursor(t){this.context.safeUpdateAttributes(["cursors",t],void 0)}setMainViewFocusPath(t){const i=this.getMainViewScenePath();i&&wi(t,i)}getIframeBridge(){return E.get(this.attributes,["iframeBridge"])}setIframeBridge(t){if(E.isObject(t)){const i=this.getIframeBridge();for(const n in t){const r=t[n];i[n]!==r&&this.context.safeUpdateAttributes(["iframeBridge",n],r)}}}}const pm=new hm({getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}}),nt=(...e)=>{Y.debug&&console.log("[WindowManager]:",...e)},el=(e,t)=>{let i=0;const n=t.length-1;return e===t.index?e===n?i=e-1:i=t.index+1:i=t.index,i},Mt=new Ii.default;class tl{constructor(t,i,n,r){var s;this.params=t,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=o=>{var h,p;const a=this.store.getAppState(o);if(!a)return;const l=a==null?void 0:a[ke.Position],u=this.store.focus,c=a==null?void 0:a[ke.Size],d=a==null?void 0:a[ke.SceneIndex],m=(h=this.attributes)==null?void 0:h.maximized,w=(p=this.attributes)==null?void 0:p.minimized,v=a==null?void 0:a.zIndex;let x={maximized:m,minimized:w,zIndex:v};return l&&(x=Re(q({},x),{id:o,x:l.x,y:l.y})),u===o&&(x=Re(q({},x),{focus:!0})),c&&(x=Re(q({},x),{width:c.width,height:c.height})),d&&(x=Re(q({},x),{sceneIndex:d})),x},this.appAttributesUpdateListener=o=>{this.manager.refresher.add(o,()=>C.autorun(()=>{const a=this.manager.attributes[o];a&&this.appEmitter.emit("attributesUpdate",a)})),this.manager.refresher.add(this.stateKey,()=>C.autorun(()=>{var l,u,c,d;const a=(l=this.appAttributes)==null?void 0:l.state;(a==null?void 0:a.zIndex)>0&&a.zIndex!==((u=this.box)==null?void 0:u.zIndex)&&((c=this.boxManager)==null||c.setZIndex(o,a.zIndex),(d=this.boxManager)==null||d.focusBox({appId:o}))})),this.manager.refresher.add(`${o}-fullPath`,()=>C.autorun(()=>{var l;const a=(l=this.appAttributes)==null?void 0:l.fullPath;this.setFocusScenePathHandler(a),this._prevFullPath!==a&&(this.notifyPageStateChange(),this._prevFullPath=a)}))},this.setFocusScenePathHandler=E.debounce(o=>{var a;this.view&&o&&o!==((a=this.view)==null?void 0:a.focusScenePath)&&(wi(this.view,o),Q.emit("onAppScenePathChange",{appId:this.id,view:this.view}))},50),this.notifyPageStateChange=E.debounce(()=>{this.appEmitter.emit("pageStateChange",this.pageState)},50),this.kind=t.kind,this.id=n,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new Ii.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=r,this.initScenes(),(s=this.params.options)!=null&&s.scenePath&&this.createView(),this._pageState=new dm({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange})}initScenes(){var i;const t=this.params.options;t&&(this.scenePath=t.scenePath,((i=this.appAttributes)==null?void 0:i.isDynamicPPT)&&this.scenePath?this.scenes=Zi(this.manager.displayer)[this.scenePath]:this.scenes=t.scenes)}get view(){return this.manager.viewManager.getView(this.id)}get viewIndex(){var t;return(t=this.view)==null?void 0:t.focusSceneIndex}get isWritable(){var t;return this.manager.canOperate&&!((t=this.box)!=null&&t.readonly)}get attributes(){return this.manager.attributes[this.id]}get appAttributes(){return this.store.getAppAttributes(this.id)}getFullScenePath(){if(this.scenePath)return E.get(this.appAttributes,[xe.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const t=E.get(this.appAttributes,["state","SceneIndex"],0),i=qg(this.manager.room,this.scenePath,t);return i&&this.setFullPath(i),i}setFullPath(t){this.manager.safeUpdateAttributes(["apps",this.id,xe.FullPath],t)}async baseInsertApp(t=!1){var s;const i=this.params;if(!i.kind)throw new Error("[WindowManager]: kind require");const n=await((s=Ie.appClasses.get(i.kind))==null?void 0:s()),r=Ie.registered.get(i.kind);if(n)await this.setupApp(this.id,t,n,i.options,r==null?void 0:r.appOptions);else throw new Error(`[WindowManager]: app load failed ${i.kind} ${i.src}`);return B.emit("updateManagerRect"),{appId:this.id,app:n}}get box(){var t;return(t=this.boxManager)==null?void 0:t.getBox(this.id)}async setupApp(t,i,n,r,s){var a;if(nt("setupApp",t,n,r),!this.boxManager)throw new Vd;const o=new cm(this.manager,this.boxManager,t,this,s);this.appContext=o;try{B.once(`${t}${K.WindowCreated}`).then(async()=>{var c;let l;i||(l=this.getAppInitState(t),(c=this.boxManager)==null||c.updateBoxState(l)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(t),this.setViewFocusScenePath();let u;this.manager.isReplay&&(u=this.manager.mainView.scenePath),setTimeout(async()=>{console.log("setup app",n);const d=await n.setup(o);this.appResult=d,Ie.notifyApp(this.kind,"created",{appId:t,result:d}),this.afterSetupApp(l),this.fixMobileSize(),u&&this.manager.mainViewProxy.setFocusScenePath(u),Q.emit("onAppSetup",t)},Dd)}),(a=this.boxManager)==null||a.createBox({appId:t,app:n,options:r,canOperate:this.manager.canOperate,smartPosition:this.isAddApp}),this.isAddApp&&this.box&&(this.store.updateAppState(t,ke.ZIndex,this.box.zIndex),this.store.updateAppState(t,ke.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:t},!1))}catch(l){throw console.error(l),new Error(`[WindowManager]: app setup error: ${l.message}`)}}fixMobileSize(){var i,n;const t=(i=this.boxManager)==null?void 0:i.getBox(this.id);t&&((n=this.boxManager)==null||n.resizeBox({appId:this.id,width:t.intrinsicWidth+.001,height:t.intrinsicHeight+.001,skipUpdate:!0}))}afterSetupApp(t){var i;t&&(!(t!=null&&t.x)||!t.y)&&((i=this.boxManager)==null||i.setBoxInitState(this.id))}async onSeek(t){var n;this.appEmitter.emit("seek",t).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 s;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;await new tl(n,this.manager,this.id,this.isAddApp).baseInsertApp(!0),(s=this.boxManager)==null||s.updateBoxState(i)}async onRemoveScene(t){if(this.scenePath&&t.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(t){this.appEmitter.emit("sceneStateChange",t)}emitAppIsWritableChange(){this.appEmitter.emit("writableChange",this.isWritable)}makeAppEventListener(t){return(i,n)=>{var r,s,o,a;if(!!this.manager.canOperate)switch(i){case"setBoxSize":{(r=this.boxManager)==null||r.resizeBox({appId:t,width:n.width,height:n.height,skipUpdate:!1});break}case"setBoxMinSize":{(s=this.boxManager)==null||s.setBoxMinSize({appId:t,minWidth:n.minwidth,minHeight:n.minheight});break}case"setBoxTitle":{(o=this.boxManager)==null||o.setBoxTitle({appId:t,title:n.title});break}case Pd.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":{(a=this.boxManager)==null||a.focusBox({appId:this.id}),Mt.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const t=this.getFullScenePath();this.manager.room&&t&&this.view&&Wo(this.manager.room,t)}setViewFocusScenePath(){const t=this.getFullScenePath();return t&&this.view&&wi(this.view,t),t}async createView(){const t=await this.viewManager.createView(this.id);return this.setViewFocusScenePath(),t}get pageState(){return this._pageState.toObject()}async removeSceneByIndex(t){const i=this._pageState.getFullPath(t);if(i){const n=el(t,this.pageState);return this.setSceneIndexWithoutSync(n),this.manager.dispatchInternalEvent(K.SetAppFocusIndex,{type:"app",appID:this.id,index:n}),setTimeout(()=>{Ho(this.manager.room,i,t)},100),!0}else return!1}setSceneIndexWithoutSync(t){this.view&&(this.view.focusSceneIndex=t)}setSceneIndex(t){if(this.view){this.view.focusSceneIndex=t;const i=this._pageState.getFullPath(t);i&&this.setFullPath(i)}}async destroy(t,i,n,r){var s;if(this.status!=="destroyed"){this.status="destroyed";try{await Ie.notifyApp(this.kind,"destroy",{appId:this.id}),await this.appEmitter.emit("destroy",{error:r})}catch(o){console.error("[WindowManager]: notifyApp error",o.message,o.stack)}this.appEmitter.clearListeners(),B.emit(`destroy-${this.id}`,{error:r}),t&&((s=this.boxManager)==null||s.closeBox(this.id,n)),i&&(this.store.cleanAppAttributes(this.id),this.scenePath&&Ho(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 fm{constructor(t){this.displayer=t,this.views=new Map}createView(t){const i=Hd(this.displayer);return this.views.set(t,i),i}getView(t){return this.views.get(t)}destroyView(t){const i=this.views.get(t);if(i){try{i.release()}catch{}this.views.delete(t)}}setViewScenePath(t,i){const n=this.views.get(t);n&&(n.focusScenePath=i)}destroy(){this.views.forEach(t=>{try{t.release()}catch{}}),this.views.clear()}}const Hd=e=>{const t=e.views.createView();return gm(t),t},gm=e=>{e.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class mm{constructor(t){this.manager=t,this.polling=!1,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.viewMode=this.manager.windowManger.viewMode,this.sideEffectManager=new er,this.syncCamera=()=>{if(!this.polling||this.viewMode!==C.ViewMode.Broadcaster)return;const{mainViewCamera:n}=this;n&&n.id!==this.manager.uid&&this.moveCameraSizeByAttributes()},this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>B.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=()=>C.reaction(()=>this.mainViewCamera,n=>{n&&n.id!==this.manager.uid&&(this.moveCameraToContian(this.mainViewSize),this.moveCamera(n))},{fireImmediately:!0}),this.sizeChangeHandler=E.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!==C.ViewMode.Follower&&(this.store.setMainViewCamera(Re(q({},n),{id:this.manager.uid})),E.isEqual(this.mainViewSize,Re(q({},this.mainView.size),{id:this.manager.uid}))||this.setMainViewSize(this.view.size))},this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=E.debounce(n=>{this.store.setMainViewSize(Re(q({},n),{id:this.manager.uid}))},50),this._syncMainViewTimer=0,this.onCameraOrSizeUpdated=()=>{Q.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(),B.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()});const i=()=>{this.sizeChangeHandler(this.mainViewSize)};this.sideEffectManager.add(()=>B.on("playgroundSizeChange",i)),this.sideEffectManager.add(()=>B.on("containerSizeRatioUpdate",this.onUpdateContainerSizeRatio)),this.sideEffectManager.add(()=>B.on("startReconnect",()=>{this.didRelease||this.mainView.release()})),this.sideEffectManager.setInterval(this.syncCamera,1500)}ensureCameraAndSize(){this.viewMode===C.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 E.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 t=Re(q({},this.mainView.camera),{id:this.manager.uid}),i=Re(q({},this.mainView.size),{id:this.manager.uid});this.store.setMainViewCameraAndSize(t,i)}get view(){return this.mainView}get cameraState(){return q(q({},this.view.camera),this.view.size)}createMainView(){const t=Hd(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&wi(t,i),t}onReconnect(){if(this.didRelease)this.rebind();else{const t=this.store.getMainViewScenePath();this.setFocusScenePath(t)}}setFocusScenePath(t){if(t)return wi(this.view,t)}rebind(){const t=this.mainView.divElement,i=this.mainView.disableCameraTransform;this.stop(),this.didRelease||this.mainView.release(),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=i,this.mainView.divElement=t,this.addMainViewListener(),this.start(),Q.emit("onMainViewRebind",this.mainView)}addMainViewListener(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}removeMainViewListener(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}async mainViewClickHandler(){var t;!this.manager.canOperate||(this.store.cleanFocus(),(t=this.manager.boxManager)==null||t.blurAllBox())}addCameraListener(){this.view.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),this.view.callbacks.on("onCameraUpdated",this.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(t){E.isEmpty(t)||(this.view.moveCameraToContain({width:t.width,height:t.height,originX:-t.width/2,originY:-t.height/2,animationMode:C.AnimationMode.Immediately}),this.scale=this.view.camera.scale)}moveCamera(t){if(!E.isEmpty(t)){if(E.isEqual(t,this.view.camera))return;const{centerX:i,centerY:n,scale:r}=t,s=r*(this.scale||1);this.view.moveCamera({centerX:i,centerY:n,scale:s,animationMode:C.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 vm{constructor(t){this.context=t,this.addRedoUndoListeners=i=>{if(i===void 0)this.addViewCallbacks(this.context.mainView(),this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate);else{const n=this.context.getAppProxy(i);n&&n.view&&this.addViewCallbacks(n.view,this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate)}},this.addViewCallbacks=(i,n,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=>{Q.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{Q.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)},B.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),B.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(t.focus()),this.addRedoUndoListeners(t.focus())}),this.addRedoUndoListeners(t.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class wm{constructor(t){this.windowManger=t,this.appProxies=new Map,this.appStatus=new Map,this.store=pm,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new Bg,this.sideEffectManager=new er,this.sceneState=null,this.rootDirRemoving=!1,this.onRemoveScenes=async i=>{var r,s;const{scenePath:n}=i;if(n===_e){await this.onRootDirRemoved(),this.dispatchInternalEvent(K.RootDirRemoved);return}if(rm(n)){let o=this.mainView.focusSceneIndex||0,a=(r=this.callbacksNode)==null?void 0:r.scenes[o];a||(o=0,a=(s=this.callbacksNode)==null?void 0:s.scenes[o]),a&&this.setMainViewScenePath(`${_e}${a}`),await this.setMainViewSceneIndex(o)}else this.appProxies.forEach(o=>{o.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(_e,{onAddScene:this.onSceneChange,onRemoveScene:async(n,r)=>{await this.onSceneChange(n),B.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=el(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&&Ho(this.room,`${_e}${r}`,i)},100),new Promise((o,a)=>{B.once("rootDirSceneRemoved").then(l=>{l===r&&o(!0)}).catch(l=>{console.log(`[WindowManager]: removePage error: ${l}`),a(!1)})})},this.setSceneIndexWithoutSync=i=>{var r;const n=(r=this.callbacksNode)==null?void 0:r.scenes[i];n&&this.mainViewProxy.setFocusScenePath(`${_e}${n}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([Q.emit("mainViewScenesLengthChange",i),B.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:`${_e}${r}`,contextPath:i.path,index:n,scenes:i.scenes.map(s=>({name:s})),sceneName:r},Q.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}),Q.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}),Q.emit("onBoxResize",i))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId}),Q.emit("onBoxFocus",i)},this.onBoxClose=i=>{const n=this.appProxies.get(i.appId);n&&n.destroy(!1,!0,!0,i.error),Q.emit("onBoxClose",i)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(K.AppBoxStateChange,i),Q.emit("onBoxStateChange",i)},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>$o(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{this.refresher.add("appsClose",()=>$o(()=>this.attributes.apps,i=>{i.some(n=>n.kind===C.UpdateEventKind.Removed)&&this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this._prevSceneIndex!==i&&(Q.emit("mainViewSceneIndexChange",i),B.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this._prevSceneIndex=i)},this.onFocusChange=i=>{var n;this._prevFocused!==i&&(Q.emit("focusedChange",i),B.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&&Ie.notifyApp(r.kind,"focus",{appId:i})},0)))},this.attributesUpdateCallback=E.debounce(i=>this._attributesUpdateCallback(i),100),this._appIds=[],this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([n,r])=>{Ie.appClasses.has(n)||Ie.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)}),B.emit("observerIdChange",this.displayer.observerId)},this.displayerWritableListener=i=>{var s,o;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):(o=this.boxManager)==null||o.setReadonly(!(n&&r)),this.appProxies.forEach(a=>{a.emitAppIsWritableChange()}),B.emit("writableChange",n)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),n=uo(i),r=Zi(this.displayer)[n];if(r.length){const s=i.replace(n,"").replace("/",""),o=r.findIndex(a=>a.name===s);E.isInteger(o)&&o>=0&&this.safeSetAttributes({_mainSceneIndex:o})}},this.updateRootDirRemoving=i=>{this.rootDirRemoving=i},this.displayer=t.displayer,this.store.setContext({getAttributes:()=>this.attributes,safeSetAttributes:i=>this.safeSetAttributes(i),safeUpdateAttributes:(i,n)=>this.safeUpdateAttributes(i,n)}),this.mainViewProxy=new mm(this),this.viewManager=new fm(this.displayer),this.appListeners=new sm(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=yg,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:B}),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()}),B.once("onCreated").then(()=>this.onCreated()),B.on("onReconnected",()=>this.onReconnected()),C.isPlayer(this.displayer)&&(B.on("seekStart",this.onPlayerSeekStart),B.on("seek",this.onPlayerSeekDone)),B.on("removeScenes",this.onRemoveScenes),B.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),Ie.setSyncRegisterApp(i=>{this.safeUpdateAttributes([xe.Registered,i.kind],i)})}getMemberState(){var t;return((t=this.room)==null?void 0:t.state.memberState)||{strokeColor:[0,0,0]}}async onRootDirRemoved(t=!0){this.setMainViewScenePath(Nd),this.createRootDirScenesCallback();for(const[i,n]of this.appProxies.entries())n.view&&await this.closeApp(i,t);this.mainViewProxy.rebind(),B.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return C.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return C.isRoom(this.displayer)?this.displayer:void 0}get mainView(){return this.mainViewProxy.view}get polling(){return this.mainViewProxy.polling}set polling(t){this.mainViewProxy.polling=t}get focusApp(){if(this.store.focus)return this.appProxies.get(this.store.focus)}get uid(){var t;return((t=this.room)==null?void 0:t.uid)||""}getMainViewSceneDir(){const t=this.store.getMainViewScenePath();if(t)return uo(t);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var t;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),B.emit("updateManagerRect"),Mt.on("move",this.onBoxMove),Mt.on("resize",this.onBoxResize),Mt.on("focus",this.onBoxFocus),Mt.on("close",this.onBoxClose),Mt.on("boxStateChange",this.onBoxStateChange),this.addAppsChangeListener(),this.addAppCloseListener(),this.refresher.add("maximized",()=>C.autorun(()=>{var n;const i=this.attributes.maximized;(n=this.boxManager)==null||n.setMaximized(Boolean(i))})),this.refresher.add("minimized",()=>C.autorun(()=>{const i=this.attributes.minimized;this.onMinimized(i)})),this.refresher.add("mainViewIndex",()=>C.autorun(()=>{const i=E.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>C.autorun(()=>{const i=E.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>C.autorun(()=>{const i=E.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(!((t=this.room)!=null&&t.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this._prevFocused=this.attributes.focus,this.sideEffectManager.add(()=>{const i=new vm({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:n=>this.appProxies.get(n)});return()=>i.destroy()})}notifyAppsChange(t){(this._appIds.length!==t.length||!this._appIds.every(i=>t.includes(i)))&&(this._appIds=t,Q.emit("appsChange",t))}async _attributesUpdateCallback(t){if(t&&Y.container){const i=Object.keys(t);i.length===0&&this.appCreateQueue.emitReady();const r=E.orderBy(i.map(s=>({id:s,createdAt:t[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 o=t[s];try{if(!this.attributes[s])throw new Error("appAttributes is undefined");this.appCreateQueue.push(async()=>{this.appStatus.set(s,Oo.StartCreate);const l=await this.baseInsertApp({kind:o.kind,options:o.options,isDynamicPPT:o.isDynamicPPT},s,!1);return l&&this.store.focus===s&&this._focusAppCreatedResolve&&this._focusAppCreatedResolve(l),l}),this.focusByAttributes(t)}catch(a){console.warn("[WindowManager]: Insert App Error",a)}}}}refresh(){this.attributesUpdateCallback(this.attributes.apps)}setBoxManager(t){this.boxManager=t}resetMaximized(){var t;(t=this.boxManager)==null||t.setMaximized(Boolean(this.store.getMaximized()))}resetMinimized(){var t;(t=this.boxManager)==null||t.setMinimized(Boolean(this.store.getMinimized()))}bindMainView(t,i){const n=this.mainViewProxy.view;n.disableCameraTransform=i,n.divElement=t,n.focusScenePath||this.setMainViewFocusPath(),B.emit("mainViewMounted"),Q.emit("onMainViewMounted",n)}setMainViewFocusPath(t){var n;const i=t||this.store.getMainViewScenePath();if(i)return wi(this.mainView,i),((n=this.mainView)==null?void 0:n.focusScenePath)===i}resetScenePath(t){this.displayer.state.sceneState.scenePath!==t&&Wo(this.room,t)}async addApp(t,i){nt("addApp",t);const{appId:n,needFocus:r}=await this.beforeAddApp(t,i),s=await this.baseInsertApp(t,n,!0,r);return this.afterAddApp(s),s==null?void 0:s.id}async beforeAddApp(t,i){var o,a;const n=await Kg(t.kind);this.appStatus.set(n,Oo.StartCreate);const r=(o=t.attributes)!=null?o:{};this.safeUpdateAttributes([n],r),this.store.setupAppAttributes(t,n,i);const s=!((a=this.boxManager)!=null&&a.minimized);return s&&this.store.setAppFocus(n,!0),{appId:n,needFocus:s}}afterAddApp(t){var i,n;if(t&&t.box){const r=t.box;Mt.emit("move",{appId:t.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(t.id,ke.ZIndex,r.zIndex)}(i=this.boxManager)!=null&&i.minimized&&((n=this.boxManager)==null||n.setMinimized(!1,!1))}async closeApp(t,i=!0){const n=this.appProxies.get(t);n&&n.destroy(!0,i,!1)}async baseInsertApp(t,i,n,r){if(this.appProxies.has(i)){console.warn("[WindowManager]: app duplicate exists and cannot be created again");return}const s=new tl(t,this,i,n);if(s)return await s.baseInsertApp(r),this.appStatus.delete(i),s;throw this.appStatus.delete(i),new Error("[WindowManger]: initialize AppProxy failed")}safeSetAttributes(t){this.windowManger.safeSetAttributes(t)}safeUpdateAttributes(t,i){this.windowManger.safeUpdateAttributes(t,i)}async setMainViewScenePath(t){if(this.room){const i=this.displayer.scenePathType(t);if(uo(t)!==_e)throw new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===C.ScenePathType.None)throw new Error(`[WindowManager]: ${t} not valid scene`);if(i===C.ScenePathType.Page)await this._setMainViewScenePath(t);else if(i===C.ScenePathType.Dir){const r=tm(this.displayer,t);r&&await this._setMainViewScenePath(r)}}}async _setMainViewScenePath(t){this.setMainViewFocusPath(t)&&(this.safeSetAttributes({_mainScenePath:t}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(t))}async setMainViewSceneIndex(t){var i;if(this.room){if(this.store.getMainViewSceneIndex()===t)return;const n=(i=this.callbacksNode)==null?void 0:i.scenes[t],r=`${_e}${n}`;if(n)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.store.setMainViewSceneIndex(t),this.dispatchSetMainViewScenePath(r));else throw new Error(`[WindowManager]: ${t} not valid index`)}}dispatchSetMainViewScenePath(t){this.dispatchInternalEvent(K.SetMainViewScenePath,{nextScenePath:t}),Q.emit("mainViewScenePathChange",t),Wo(this.room,t)}getAppInitPath(t){var n;const i=this.store.getAppAttributes(t);if(i)return(n=i==null?void 0:i.options)==null?void 0:n.scenePath}safeDispatchMagixEvent(t,i){this.canOperate&&this.displayer.dispatchMagixEvent(t,i)}focusByAttributes(t){var i;if(t&&Object.keys(t).length===((i=this.boxManager)==null?void 0:i.boxSize)){const n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}async onReconnected(){this.attributesUpdateCallback(this.attributes.apps);const i=Array.from(this.appProxies.values()).map(n=>n.onReconnected());this.mainViewProxy.onReconnect(),await Promise.all(i),this.callbacksNode&&this.onSceneChange(this.callbacksNode)}notifyContainerRectUpdate(t){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",t)})}dispatchInternalEvent(t,i){this.safeDispatchMagixEvent(Vo,{eventName:t,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),Mt.clearListeners(),B.clearListeners(),this.appProxies.size&&this.appProxies.forEach(t=>{t.destroy(!0,!1,!0)}),Q.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0,this._focusAppCreatedResolve=void 0}}const ym=e=>{const t=document.createElement("div");t.className="netless-window-manager-playground";const i=document.createElement("div");i.className="netless-window-manager-sizer";const n=document.createElement("div");n.className="netless-window-manager-wrapper";const r=document.createElement("div");return r.className="netless-window-manager-main-view",t.appendChild(i),i.appendChild(n),n.appendChild(r),e.appendChild(t),Y.wrapper=n,{playground:t,wrapper:n,sizer:i,mainViewElement:r}},xm=()=>{if(ku(C.WhiteVersion)<ku(Au))throw new Rd(Au)},Fo=(e,t)=>{var s;const i=(e==null?void 0:e.state.roomMembers)||[];let n=-1,r;for(const o of i)((s=o.payload)==null?void 0:s.uid)===t&&n<o.memberId&&(n=o.memberId,r=o);return r},Sm=async e=>{let t=e.getInvisiblePlugin(Y.kind);if(t)return t;let i;const n=new Promise(u=>{Y._resolve=i=u});let r=!1;const s=Mm(e);!e.isWritable&&s&&(r=!0,await kd.default(async u=>{nt(`switching to writable (x${u})`),await e.setWritable(!0)},{retries:10,maxTimeout:5e3})),e.isWritable?(nt("creating InvisiblePlugin..."),e.createInvisiblePlugin(Y,{}).catch(console.warn)):(s&&console.warn("[WindowManager]: failed to switch to writable"),console.warn("[WindowManager]: waiting for others to create the plugin..."));const o=setTimeout(()=>{console.warn("[WindowManager]: no one called createInvisiblePlugin() after 20 seconds")},2e4),a=setTimeout(()=>{throw new Error("[WindowManager]: no one called createInvisiblePlugin() after 60 seconds")},6e4),l=setInterval(()=>{t=e.getInvisiblePlugin(Y.kind),t&&(clearTimeout(a),clearTimeout(o),clearInterval(l),i(t),r&&e.isWritable&&setTimeout(()=>e.setWritable(!1).catch(console.warn),500))},200);return n},Mm=e=>{try{const t=atob(e.roomToken.slice(12)),i=t.indexOf("&role=");return+t[i+6]<2}catch(t){return console.error(t),!1}},Cm=window.ResizeObserver||Ng.ResizeObserver;class il{constructor(t){this.emitter=t}static create(t,i,n,r){const s=new il(r);return s.observePlaygroundSize(t,i,n),s}observePlaygroundSize(t,i,n){this.updateSizer(t.getBoundingClientRect(),i,n),this.containerResizeObserver=new Cm(r=>{var o;const s=(o=r[0])==null?void 0:o.contentRect;s&&(this.updateSizer(s,i,n),this.emitter.emit("playgroundSizeChange",s))}),this.disposer=this.emitter.on("containerSizeRatioUpdate",()=>{const r=t.getBoundingClientRect();this.updateSizer(r,i,n),this.emitter.emit("playgroundSizeChange",r)}),this.containerResizeObserver.observe(t)}updateSizer({width:t,height:i},n,r){t&&i&&(i/t>Y.containerSizeRatio?(i=t*Y.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(t=i/Y.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!1)),r.style.width=`${t}px`,r.style.height=`${i}px`)}disconnect(){var t;(t=this.containerResizeObserver)==null||t.disconnect(),E.isFunction(this.disposer)&&(this.disposer(),this.disposer=void 0)}}var Im=Object.defineProperty,bm=Object.defineProperties,Am=Object.getOwnPropertyDescriptors,zu=Object.getOwnPropertySymbols,Em=Object.prototype.hasOwnProperty,Tm=Object.prototype.propertyIsEnumerable,Lu=(e,t,i)=>t in e?Im(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ru=(e,t)=>{for(var i in t||(t={}))Em.call(t,i)&&Lu(e,i,t[i]);if(zu)for(var i of zu(t))Tm.call(t,i)&&Lu(e,i,t[i]);return e},ju=(e,t)=>bm(e,Am(t)),$d={exports:{}};(function(e){var t=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,d,m){if(typeof c!="function")throw new TypeError("The listener must be a function");var w=new r(c,d||l,m),v=i?i+u:u;return l._events[v]?l._events[v].fn?l._events[v]=[l._events[v],w]:l._events[v].push(w):(l._events[v]=w,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)t.call(c,d)&&u.push(i?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},a.prototype.listeners=function(u){var c=i?i+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var m=0,w=d.length,v=new Array(w);m<w;m++)v[m]=d[m].fn;return v},a.prototype.listenerCount=function(u){var c=i?i+u:u,d=this._events[c];return d?d.fn?1:d.length:0},a.prototype.emit=function(u,c,d,m,w,v){var x=i?i+u:u;if(!this._events[x])return!1;var h=this._events[x],p=arguments.length,f,g;if(h.fn){switch(h.once&&this.removeListener(u,h.fn,void 0,!0),p){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,c),!0;case 3:return h.fn.call(h.context,c,d),!0;case 4:return h.fn.call(h.context,c,d,m),!0;case 5:return h.fn.call(h.context,c,d,m,w),!0;case 6:return h.fn.call(h.context,c,d,m,w,v),!0}for(g=1,f=new Array(p-1);g<p;g++)f[g-1]=arguments[g];h.fn.apply(h.context,f)}else{var y=h.length,S;for(g=0;g<y;g++)switch(h[g].once&&this.removeListener(u,h[g].fn,void 0,!0),p){case 1:h[g].fn.call(h[g].context);break;case 2:h[g].fn.call(h[g].context,c);break;case 3:h[g].fn.call(h[g].context,c,d);break;case 4:h[g].fn.call(h[g].context,c,d,m);break;default:if(!f)for(S=1,f=new Array(p-1);S<p;S++)f[S-1]=arguments[S];h[g].fn.apply(h[g].context,f)}}return!0},a.prototype.on=function(u,c,d){return s(this,u,c,d,!1)},a.prototype.once=function(u,c,d){return s(this,u,c,d,!0)},a.prototype.removeListener=function(u,c,d,m){var w=i?i+u:u;if(!this._events[w])return this;if(!c)return o(this,w),this;var v=this._events[w];if(v.fn)v.fn===c&&(!m||v.once)&&(!d||v.context===d)&&o(this,w);else{for(var x=0,h=[],p=v.length;x<p;x++)(v[x].fn!==c||m&&!v[x].once||d&&v[x].context!==d)&&h.push(v[x]);h.length?this._events[w]=h.length===1?h[0]:h:o(this,w)}return this},a.prototype.removeAllListeners=function(u){var c;return u?(c=i?i+u:u,this._events[c]&&o(this,c)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a})($d);var Qo=$d.exports;/*! *****************************************************************************
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var bg=require("p-retry"),Ag=require("emittery"),T=require("lodash"),b=require("white-web-sdk"),Tg=require("uuid"),Eg=require("@juggle/resize-observer"),Ng=require("video.js");function sl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function kg(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 Ph=sl(bg),Ci=sl(Ag),Pu=sl(Ng),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 Fa="__WindowManger",ga="__WindowMangerEnsureReconnected__";var ke=(t=>(t.Size="size",t.Position="position",t.SceneIndex="SceneIndex",t.ZIndex="zIndex",t))(ke||{}),zh=(t=>(t.setBoxSize="setBoxSize",t.setBoxMinSize="setBoxMinSize",t.destroy="destroy",t))(zh||{}),Qa=(t=>(t.StartCreate="StartCreate",t))(Qa||{}),Za=(t=>(t.Leave="leave",t.Normal="normal",t))(Za||{});const zu="2.16.1",Pg=340/720,zg=340/720,Bg=9/16,Oe="/",Bh="/init",Dh=50,Z=new Ci.default;class Dg{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(()=>{Z.emit("ready")},Dh),this.isEmit=!0}empty(){this.list=[],this.clear()}destroy(){this.timer&&this.clear()}}const O=new Ci.default,Lg="__WindowManagerAppCache";let Zn,Bu;const Rg=async()=>{Zn=await Vg()},jg=(t,e)=>{if(!!Zn)return Ug(Zn,{kind:t,sourceCode:e})},_g=async t=>Zn?await Og(Zn,t):null;function Vg(){return new Promise((t,e)=>{const i=indexedDB.open(Lg,2);i.onerror=n=>{e(n)},i.onupgradeneeded=n=>{const r=n.target.result;r.objectStoreNames.contains("apps")||(Bu=r.createObjectStore("apps",{keyPath:"kind"}),Bu.createIndex("kind","kind",{unique:!0}))},i.onsuccess=()=>{const n=i.result;t(n)}})}function Og(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 Ug(t,e){return new Promise((i,n)=>{const r=t.transaction(["apps"],"readwrite").objectStore("apps").add(e);r.onsuccess=()=>i(),r.onerror=()=>n()})}const $g="NetlessApp",Wg=1e4,Hg=async t=>{const e=await _g(t);if(e)return e.sourceCode;{const n=await(await Zg(t,{timeout:Wg})).text();return await jg(t,n),n}},Du=(t,e)=>{let i=Function(t+`
2
+ ;return ${e}`)();return typeof i=="undefined"&&(i=window[e]),i},Fg=async(t,e,i)=>{const n=i||$g+e;Z.emit("loadApp",{kind:e,status:"start"});let r;try{if(r=await Hg(t),!r||r.length===0)throw Z.emit("loadApp",{kind:e,status:"failed",reason:"script is empty."}),new Error("[WindowManager]: script is empty.")}catch(s){throw Z.emit("loadApp",{kind:e,status:"failed",reason:s.message}),s}return Qg(r,n,e)},Qg=(t,e,i)=>{try{const n=Du(t,e);return Z.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=Du(t,e);return Z.emit("loadApp",{kind:i,status:"success"}),s}throw Z.emit("loadApp",{kind:i,status:"failed",reason:n.message}),n}};async function Zg(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 Yg{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 Fg(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 Yg,Gg=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}-${Tg.v4().replace("-","").slice(0,8)}`},vi=(t,e)=>{if(t.focusScenePath!==e)return t.focusScenePath=e,t},Ya=(t,e)=>{if(t&&t.isWritable&&t.state.sceneState.scenePath!==e){const i=e==="/"?"":e;t.setScenePath(i)}},Xg=(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}`}},Ga=(t,e,i)=>{t&&t.scenePathType(e)!==b.ScenePathType.None&&t.removeScenes(e,i)},Jg=(t,e)=>{O.once(t).then(e)};T.debounce((t,e)=>{t.emit("mainViewModeChange",e)},200);const Kg=(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(),zn=(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)},qg=t=>t.startsWith("/"),ma=t=>{const e=t.split("/");e.pop();let i=e.join("/");return i===""&&(i="/"),i},em=t=>t.endsWith("/")?t.slice(0,-1):t,Lu=t=>{const e=t.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(e)},Lh=t=>new Promise(e=>setTimeout(e,t)),tm=t=>t.split("").reduce((i,n)=>(n===Oe&&(i+=1),i),0)===1;class im{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=>{Z.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{vi(this.manager.mainView,i),Z.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(Fa,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(Fa,this.mainMagixEventListener)}}class Rh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class nm 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 jh extends Error{constructor(e){super(`[WindowManager]: white-web-sdk version must large than ${e}`)}}class _h extends Error{constructor(){super(...arguments),this.message="[WindowManager]: kind must be a valid string"}}class Vh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: box need created"}}class Oh extends Error{constructor(){super(...arguments),this.message='[WindowManager]: ScenePath should start with "/"'}}class Uh extends Error{constructor(){super(...arguments),this.message="[WindowManager]: boxManager not found"}}class $h extends Error{constructor(){super(...arguments),this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const Wh="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",rm=Wh.length,Ru=Array(20),zi=()=>{for(let t=0;t<20;t++)Ru[t]=Wh.charAt(Math.random()*rm);return Ru.join("")};class lr{constructor(){this.disposers=new Map}add(e,i=zi()){return this.flush(i),this.disposers.set(i,e()),i}addDisposer(e,i=zi()){return this.flush(i),this.disposers.set(i,e),i}addEventListener(e,i,n,r,s=zi()){return this.add(()=>(e.addEventListener(i,n,r),()=>e.removeEventListener(i,n,r)),s),s}setTimeout(e,i,n=zi()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(n),e()},i);return()=>window.clearTimeout(r)},n)}setInterval(e,i,n=zi()){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 Hh=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()}};Hh(b.UpdateEventKind.Removed);Hh(b.UpdateEventKind.Inserted);class sm{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 va=Object.keys;function ju(t){return Boolean(T.has(t,"__isRef"))}function am(t){return{k:zi(),v:t,__isRef:!0}}const Je="_WM-STORAGE_";class _u{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 sm,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))),va(r).forEach(s=>{if(!(this.id===null&&s===Je))try{const a=T.isObject(r[s])?JSON.parse(JSON.stringify(r[s])):r[s];ju(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(va(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=va(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=am(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(ju(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 Us{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.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(),Z.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 Vh},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 _u(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;zn(this.manager.room,u,[l||{}],c)}else zn(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 _u(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 om{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 Fh={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})(Fh);var Xa=Fh.exports;/*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
@@ -12,51 +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 On=function(){return On=Object.assign||function(t){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)&&(t[s]=i[s])}return t},On.apply(this,arguments)};function nl(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]]);return i}var ho=0,Fd=typeof window!="undefined"&&window.requestAnimationFrame!==void 0?function(e){return window.requestAnimationFrame(e)}:function(e){var t=Date.now(),i=Math.max(0,16.7-(t-ho));ho=t+i,setTimeout(function(){return e(ho)},i)},km=function(e){var t=[],i=[],n=0,r=!1,s=0,o=new WeakSet,a=new WeakSet,l={cancel:function(u){var c=i.indexOf(u);o.add(u),c!==-1&&i.splice(c,1)},process:function(u){var c;if(r=!0,c=[i,t],t=c[0],i=c[1],i.length=0,n=t.length,n){var d;for(s=0;s<n;s++)d=t[s],d(u),a.has(d)===!0&&!o.has(d)&&(l.schedule(d),e(!0))}r=!1},schedule:function(u,c,d){c===void 0&&(c=!1),d===void 0&&(d=!1);var m=d&&r,w=m?t:i;o.delete(u),c&&a.add(u),w.indexOf(u)===-1&&(w.push(u),m&&(n=t.length))}};return l},Pm=40,Bu=1/60*1e3,Or=!0,Un=!1,Zo=!1,yn={delta:0,timestamp:0},rl=["read","update","preRender","render","postRender"],Nm=function(e){return Un=e},Qd=rl.reduce(function(e,t){return e[t]=km(Nm),e},{}),Dm=rl.reduce(function(e,t){var i=Qd[t];return e[t]=function(n,r,s){return r===void 0&&(r=!1),s===void 0&&(s=!1),Un||Lm(),i.schedule(n,r,s),n},e},{}),zm=function(e){return Qd[e].process(yn)},Zd=function(e){Un=!1,yn.delta=Or?Bu:Math.max(Math.min(e-yn.timestamp,Pm),1),Or||(Bu=yn.delta),yn.timestamp=e,Zo=!0,rl.forEach(zm),Zo=!1,Un&&(Or=!1,Fd(Zd))},Lm=function(){Un=!0,Or=!0,Zo||Fd(Zd)};/*! *****************************************************************************
16
- Copyright (c) Microsoft Corporation.
17
-
18
- Permission to use, copy, modify, and/or distribute this software for any
19
- purpose with or without fee is hereby granted.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
22
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
23
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
24
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
25
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
- PERFORMANCE OF THIS SOFTWARE.
28
- ***************************************************************************** */var Ye=function(){return Ye=Object.assign||function(t){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)&&(t[s]=i[s])}return t},Ye.apply(this,arguments)},Yd=function(e,t){return function(i){return Math.max(Math.min(i,t),e)}},Ur=function(e){return e%1?Number(e.toFixed(5)):e},Gd=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,_s={test:function(e){return typeof e=="number"},parse:parseFloat,transform:function(e){return e}},bn=Ye(Ye({},_s),{transform:Yd(0,1)}),yr=Ye(Ye({},_s),{default:1}),sl=function(e){return{test:function(t){return typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1},parse:parseFloat,transform:function(t){return""+t+e}}},ii=sl("deg"),An=sl("%"),U=sl("px"),_u=Ye(Ye({},An),{parse:function(e){return An.parse(e)/100},transform:function(e){return An.transform(e*100)}}),Rm=function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))},jm=Yd(0,255),Yo=function(e){return e.red!==void 0},Go=function(e){return e.hue!==void 0};function Bm(e){return Rm(e).replace(/(,|\/)/g," ").split(/ \s*/)}var Xd=function(e){return function(t){if(typeof t!="string")return t;for(var i={},n=Bm(t),r=0;r<4;r++)i[e[r]]=n[r]!==void 0?parseFloat(n[r]):1;return i}},_m=function(e){var t=e.red,i=e.green,n=e.blue,r=e.alpha,s=r===void 0?1:r;return"rgba("+t+", "+i+", "+n+", "+s+")"},Vm=function(e){var t=e.hue,i=e.saturation,n=e.lightness,r=e.alpha,s=r===void 0?1:r;return"hsla("+t+", "+i+", "+n+", "+s+")"},po=Ye(Ye({},_s),{transform:function(e){return Math.round(jm(e))}});function ol(e,t){return e.startsWith(t)&&Gd.test(e)}var Wr={test:function(e){return typeof e=="string"?ol(e,"rgb"):Yo(e)},parse:Xd(["red","green","blue","alpha"]),transform:function(e){var t=e.red,i=e.green,n=e.blue,r=e.alpha,s=r===void 0?1:r;return _m({red:po.transform(t),green:po.transform(i),blue:po.transform(n),alpha:Ur(bn.transform(s))})}},fo={test:function(e){return typeof e=="string"?ol(e,"hsl"):Go(e)},parse:Xd(["hue","saturation","lightness","alpha"]),transform:function(e){var t=e.hue,i=e.saturation,n=e.lightness,r=e.alpha,s=r===void 0?1:r;return Vm({hue:Math.round(t),saturation:An.transform(Ur(i)),lightness:An.transform(Ur(n)),alpha:Ur(bn.transform(s))})}},Vu=Ye(Ye({},Wr),{test:function(e){return typeof e=="string"&&ol(e,"#")},parse:function(e){var t="",i="",n="";return e.length>4?(t=e.substr(1,2),i=e.substr(3,2),n=e.substr(5,2)):(t=e.substr(1,1),i=e.substr(2,1),n=e.substr(3,1),t+=t,i+=i,n+=n),{red:parseInt(t,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:1}}}),lt={test:function(e){return typeof e=="string"&&Gd.test(e)||Yo(e)||Go(e)},parse:function(e){return Wr.test(e)?Wr.parse(e):fo.test(e)?fo.parse(e):Vu.test(e)?Vu.parse(e):e},transform:function(e){return Yo(e)?Wr.transform(e):Go(e)?fo.transform(e):e}},al=function(e){var t=e.onRead,i=e.onRender,n=e.uncachedValues,r=n===void 0?new Set:n,s=e.useCache,o=s===void 0?!0:s;return function(a){a===void 0&&(a={});var l=nl(a,[]),u={},c=[],d=!1;function m(v,x){v.startsWith("--")&&(l.hasCSSVariable=!0);var h=u[v];u[v]=x,u[v]!==h&&(c.indexOf(v)===-1&&c.push(v),d||(d=!0,Dm.render(w.render)))}var w={get:function(v,x){x===void 0&&(x=!1);var h=!x&&o&&!r.has(v)&&u[v]!==void 0;return h?u[v]:t(v,l)},set:function(v,x){if(typeof v=="string")m(v,x);else for(var h in v)m(h,v[h]);return this},render:function(v){return v===void 0&&(v=!1),(d||v===!0)&&(i(u,l,c),d=!1,c.length=0),this}};return w}},Om=/([a-z])([A-Z])/g,Um="$1-$2",Vs=function(e){return e.replace(Om,Um).toLowerCase()},Jd=new Map,ll=new Map,Kd=["Webkit","Moz","O","ms",""],Wm=Kd.length,Hm=typeof document!="undefined",go,qd=function(e,t){return ll.set(e,Vs(t))},$m=function(e){go=go||document.createElement("div");for(var t=0;t<Wm;t++){var i=Kd[t],n=i==="",r=n?e:i+e.charAt(0).toUpperCase()+e.slice(1);if(r in go.style||n){if(n&&e==="clipPath"&&ll.has(e))return;Jd.set(e,r),qd(e,(n?"":"-")+Vs(r))}}},Fm=function(e){return qd(e,e)},eh=function(e,t){t===void 0&&(t=!1);var i=t?ll:Jd;return i.has(e)||(Hm?$m(e):Fm(e)),i.get(e)||e},Qm=["","X","Y","Z"],Zm=["translate","scale","rotate","skew","transformPerspective"],Xo=Zm.reduce(function(e,t){return Qm.reduce(function(i,n){return i.push(t+n),i},e)},["x","y","z"]),Ym=Xo.reduce(function(e,t){return e[t]=!0,e},{});function ul(e){return Ym[e]===!0}function Gm(e,t){return Xo.indexOf(e)-Xo.indexOf(t)}var Xm=new Set(["originX","originY","originZ"]);function Jm(e){return Xm.has(e)}var Ou=On(On({},_s),{transform:Math.round}),Km={color:lt,backgroundColor:lt,outlineColor:lt,fill:lt,stroke:lt,borderColor:lt,borderTopColor:lt,borderRightColor:lt,borderBottomColor:lt,borderLeftColor:lt,borderWidth:U,borderTopWidth:U,borderRightWidth:U,borderBottomWidth:U,borderLeftWidth:U,borderRadius:U,radius:U,borderTopLeftRadius:U,borderTopRightRadius:U,borderBottomRightRadius:U,borderBottomLeftRadius:U,width:U,maxWidth:U,height:U,maxHeight:U,size:U,top:U,right:U,bottom:U,left:U,padding:U,paddingTop:U,paddingRight:U,paddingBottom:U,paddingLeft:U,margin:U,marginTop:U,marginRight:U,marginBottom:U,marginLeft:U,rotate:ii,rotateX:ii,rotateY:ii,rotateZ:ii,scale:yr,scaleX:yr,scaleY:yr,scaleZ:yr,skew:ii,skewX:ii,skewY:ii,distance:U,translateX:U,translateY:U,translateZ:U,x:U,y:U,z:U,perspective:U,opacity:bn,originX:_u,originY:_u,originZ:U,zIndex:Ou,fillOpacity:bn,strokeOpacity:bn,numOctaves:Ou},cl=function(e){return Km[e]},qm=function(e,t){return t&&typeof e=="number"?t.transform(e):e},En="scrollLeft",Tn="scrollTop",th=new Set([En,Tn]),ev=new Set([En,Tn,"transform"]),tv={x:"translateX",y:"translateY",z:"translateZ"};function ih(e){return typeof e=="function"}function iv(e,t,i,n,r,s){s===void 0&&(s=!0);var o="",a=!1;i.sort(Gm);for(var l=i.length,u=0;u<l;u++){var c=i[u];o+=(tv[c]||c)+"("+t[c]+") ",a=c==="z"?!0:a}return!a&&r?o+="translateZ(0)":o=o.trim(),ih(e.transform)?o=e.transform(t,n?"":o):s&&n&&(o="none"),o}function nv(e,t,i,n,r,s,o,a){t===void 0&&(t=!0),i===void 0&&(i={}),n===void 0&&(n={}),r===void 0&&(r={}),s===void 0&&(s=[]),o===void 0&&(o=!1),a===void 0&&(a=!0);var l=!0,u=!1,c=!1;for(var d in e){var m=e[d],w=cl(d),v=qm(m,w);ul(d)?(u=!0,n[d]=v,s.push(d),l&&(w.default&&m!==w.default||!w.default&&m!==0)&&(l=!1)):Jm(d)?(r[d]=v,c=!0):(!ev.has(d)||!ih(v))&&(i[eh(d,o)]=v)}return(u||typeof e.transform=="function")&&(i.transform=iv(e,n,s,l,t,a)),c&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function dl(e){var t=e===void 0?{}:e,i=t.enableHardwareAcceleration,n=i===void 0?!0:i,r=t.isDashCase,s=r===void 0?!0:r,o=t.allowTransformNone,a=o===void 0?!0:o,l={},u={},c={},d=[];return function(m){return d.length=0,nv(m,n,l,u,c,d,s,a),l}}function rv(e,t){var i=t.element,n=t.preparseOutput,r=cl(e);if(ul(e))return r&&r.default||0;if(th.has(e))return i[e];var s=window.getComputedStyle(i,null).getPropertyValue(eh(e,!0))||0;return n&&r&&r.test(s)&&r.parse?r.parse(s):s}function sv(e,t,i){var n=t.element,r=t.buildStyles,s=t.hasCSSVariable;if(Object.assign(n.style,r(e)),s)for(var o=i.length,a=0;a<o;a++){var l=i[a];l.startsWith("--")&&n.style.setProperty(l,e[l])}i.indexOf(En)!==-1&&(n[En]=e[En]),i.indexOf(Tn)!==-1&&(n[Tn]=e[Tn])}var ov=al({onRead:rv,onRender:sv,uncachedValues:th});function av(e,t){t===void 0&&(t={});var i=t.enableHardwareAcceleration,n=t.allowTransformNone,r=nl(t,["enableHardwareAcceleration","allowTransformNone"]);return ov(On({element:e,buildStyles:dl({enableHardwareAcceleration:i,allowTransformNone:n}),preparseOutput:!0},r))}var nh=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Uu=.5,rh=function(){return{style:{}}},mo=function(e,t){return U.transform(e*t)},lv={x:0,y:0,width:0,height:0};function Wu(e,t,i){return typeof e=="string"?e:U.transform(t+i*e)}function uv(e,t,i){return Wu(t,e.x,e.width)+" "+Wu(i,e.y,e.height)}var sh={enableHardwareAcceleration:!1,isDashCase:!1};function cv(e,t,i,n,r,s){t===void 0&&(t=lv),n===void 0&&(n=dl(sh)),r===void 0&&(r=rh()),s===void 0&&(s=!0);var o=e.attrX,a=e.attrY,l=e.originX,u=e.originY,c=e.pathLength,d=e.pathSpacing,m=d===void 0?1:d,w=e.pathOffset,v=w===void 0?0:w,x=nl(e,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),h=n(x);for(var p in h)if(p==="transform")r.style.transform=h[p];else{var f=s&&!nh.has(p)?Vs(p):p;r[f]=h[p]}return(l!==void 0||u!==void 0||h.transform)&&(r.style.transformOrigin=uv(t,l!==void 0?l:Uu,u!==void 0?u:Uu)),o!==void 0&&(r.x=o),a!==void 0&&(r.y=a),i!==void 0&&c!==void 0&&(r[s?"stroke-dashoffset":"strokeDashoffset"]=mo(-v,i),r[s?"stroke-dasharray":"strokeDasharray"]=mo(c,i)+" "+mo(m,i)),r}function dv(e,t,i){i===void 0&&(i=!0);var n=rh(),r=dl(sh);return function(s){return cv(s,e,t,r,n,i)}}var hv=function(e){return typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()},pv=function(e){try{return hv(e)}catch{return{x:0,y:0,width:0,height:0}}},fv=function(e){return e.tagName==="path"},gv=al({onRead:function(e,t){var i=t.element;if(e=nh.has(e)?e:Vs(e),ul(e)){var n=cl(e);return n&&n.default||0}else return i.getAttribute(e)},onRender:function(e,t){var i=t.element,n=t.buildAttrs,r=n(e);for(var s in r)s==="style"?Object.assign(i.style,r.style):i.setAttribute(s,r[s])}}),mv=function(e){var t=pv(e),i=fv(e)&&e.getTotalLength?e.getTotalLength():void 0;return gv({element:e,buildAttrs:dv(t,i)})},vv=al({useCache:!1,onRead:function(e){return e==="scrollTop"?window.pageYOffset:window.pageXOffset},onRender:function(e){var t=e.scrollTop,i=t===void 0?0:t,n=e.scrollLeft,r=n===void 0?0:n;return window.scrollTo(r,i)}}),Jo=new WeakMap,wv=function(e){return e instanceof HTMLElement||typeof e.click=="function"},yv=function(e){return e instanceof SVGElement||"ownerSVGElement"in e},xv=function(e,t){var i;return e===window?i=vv(e):wv(e)?i=av(e,t):yv(e)&&(i=mv(e)),Jo.set(e,i),i},Sv=function(e,t){return Jo.has(e)?Jo.get(e):xv(e,t)};function Mv(e,t){var i=typeof e=="string"?document.querySelector(e):e;return Sv(i,t)}var ct=function(t,i,n,r){var s=n?n.call(r,t,i):void 0;if(s!==void 0)return!!s;if(t===i)return!0;if(typeof t!="object"||!t||typeof i!="object"||!i)return!1;var o=Object.keys(t),a=Object.keys(i);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(i),u=0;u<o.length;u++){var c=o[u];if(!l(c))return!1;var d=t[c],m=i[c];if(s=n?n.call(r,d,m,c):void 0,s===!1||s===void 0&&d!==m)return!1}return!0};const oh="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Cv=oh.length,Hu=Array(20),ln=()=>{for(let e=0;e<20;e++)Hu[e]=oh.charAt(Math.random()*Cv);return Hu.join("")};class ss{constructor(){this.disposers=new Map}add(t,i=ln()){return this.flush(i),this.disposers.set(i,t()),i}addDisposer(t,i=ln()){return this.flush(i),this.disposers.set(i,t),i}addEventListener(t,i,n,r,s=ln()){return this.add(()=>(t.addEventListener(i,n,r),()=>t.removeEventListener(i,n,r)),s),s}setTimeout(t,i,n=ln()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(n),t()},i);return()=>window.clearTimeout(r)},n)}setInterval(t,i,n=ln()){return this.add(()=>{const r=window.setInterval(t,i);return()=>window.clearInterval(r)},n)}remove(t){const i=this.disposers.get(t);return this.disposers.delete(t),i}flush(t){const i=this.remove(t);if(i)try{i()}catch(n){console.error(n)}}flushAll(){this.disposers.forEach(t=>{try{t()}catch(i){console.error(i)}}),this.disposers.clear()}}var Iv=Object.defineProperty,vo=(typeof require!="undefined"&&require,(e,t,i)=>(((n,r,s)=>{r in n?Iv(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s})(e,typeof t!="symbol"?t+"":t,i),i));class tr{constructor(t,i){vo(this,"_value"),vo(this,"_beforeDestroys"),vo(this,"_subscribers"),this._value=t,i&&(this.compare=i)}get value(){return this._value}setValue(t,i){if(!this.compare(t,this._value)){const n=this._value;this._value=t,this._subscribers&&this._subscribers.forEach(r=>r(t,n,i))}}reaction(t){return this._subscribers||(this._subscribers=new Set),this._subscribers.add(t),()=>{this._subscribers&&this._subscribers.delete(t)}}subscribe(t,i){const n=this.reaction(t);return t(this._value,void 0,i),n}derive(t,i,n){const r=new tr(t(this.value,void 0,n),i),s=this.reaction((o,a,l)=>{r.setValue(t(o,a,l))});return r.addBeforeDestroy(s),r}destroy(){this._beforeDestroys&&(this._beforeDestroys.forEach(t=>t()),this._beforeDestroys.clear()),this._subscribers&&this._subscribers.clear()}addBeforeDestroy(t){return this._beforeDestroys||(this._beforeDestroys=new Set),this._beforeDestroys.add(t),()=>{this._beforeDestroys&&this._beforeDestroys.delete(t)}}compare(t,i){return t===i}}function bv(e,t,i,n){let r=e.map(o=>o.value);const s=new tr(t(r,void 0,n),i);return e.forEach((o,a)=>{const l=o.reaction((u,c,d)=>{const m=r.slice();m[a]=u;const w=r;r=m,s.setValue(t(m,w,d),d)});s.addBeforeDestroy(l)}),s}function ah(e,t){Object.keys(t).forEach(i=>{Av(e,i,t[i])})}function Av(e,t,i){var n;return Object.defineProperties(e,{[t]:{get:()=>i.value},[`_${t}$`]:{value:i},[`set${n=t,n[0].toUpperCase()+n.slice(1)}`]:{value:(r,s)=>i.setValue(r,s)}}),e}function lh(e){const t=i=>{const n=e.addDisposer(()=>{i.destroy()});return i.addBeforeDestroy(()=>{e.remove(n)}),i};return{bindSideEffect:t,combine:(i,n,r,s)=>t(bv(i,n,r,s)),createVal:(i,n)=>t(new tr(i,n))}}var os;(function(e){e.Light="light",e.Dark="dark",e.Auto="auto"})(os||(os={}));var te;(function(e){e.Normal="normal",e.Minimized="minimized",e.Maximized="maximized"})(te||(te={}));var ce;(function(e){e.DarkMode="dark_mode",e.PrefersColorScheme="prefers_color_scheme",e.Close="close",e.Focus="focus",e.Blur="blur",e.Move="move",e.Resize="resize",e.IntrinsicMove="intrinsic_move",e.IntrinsicResize="intrinsic_resize",e.VisualResize="visual_resize",e.ZIndex="z_index",e.State="state",e.Minimized="minimized",e.Maximized="maximized",e.Readonly="readonly",e.Destroyed="destroyed"})(ce||(ce={}));var be;(function(e){e.Close="close",e.Maximize="maximize",e.Minimize="minimize"})(be||(be={}));var tt;(function(e){e.North="n",e.South="s",e.West="w",e.East="e",e.NorthWest="nw",e.NorthEast="ne",e.SouthEast="se",e.SouthWest="sw"})(tt||(tt={}));const wo="dh";function Te(e,t,i){return Math.min(Math.max(e,t),i)}function Vi(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function $u(e){return e.touches?e.touches[0]:e}function Ev(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}let Tv=1;function kv(){return`New Box ${Tv++}`}function Pv(e){return Boolean(e)}function xr(e){return!e}class uh{constructor({readonly:t=!1,title:i,buttons:n,onEvent:r,onDragStart:s,namespace:o="telebox",state:a=te.Normal}={}){this.$btns=[],this.sideEffect=new ss,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=l=>{var u;if(this.readonly||l.button!==0||(u=l.target.dataset)!=null&&u.teleTitleBarNoDblClick)return;Vi(l);const c=Date.now();c-this.lastTitleBarClick.timestamp<=500?Math.abs(l.clientX-this.lastTitleBarClick.clientX)<=5&&Math.abs(l.clientY-this.lastTitleBarClick.clientY)<=5&&this.onEvent&&this.onEvent({type:be.Maximize}):this.onDragStart&&this.onDragStart(l),this.lastTitleBarClick.timestamp=c,this.lastTitleBarClick.clientX=l.clientX,this.lastTitleBarClick.clientY=l.clientY},this.lastTitleBarTouch={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarTouch=l=>{var u;if(this.readonly||(u=l.target.dataset)!=null&&u.teleTitleBarNoDblClick)return;Vi(l);const c=Date.now(),{clientX:d=this.lastTitleBarTouch.clientX+100,clientY:m=this.lastTitleBarTouch.clientY+100}=l.touches[0]||{};c-this.lastTitleBarTouch.timestamp<=500?Math.abs(d-this.lastTitleBarTouch.clientX)<=10&&Math.abs(m-this.lastTitleBarTouch.clientY)<=10&&this.onEvent&&this.onEvent({type:be.Maximize}):this.onDragStart&&this.onDragStart(l),this.lastTitleBarTouch.timestamp=c,this.lastTitleBarTouch.clientX=d,this.lastTitleBarTouch.clientY=m},this.readonly=t,this.onEvent=r,this.onDragStart=s,this.namespace=o,this.title=i,this.state=a,this.buttons=n||[{type:be.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:be.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:l=>l===te.Maximized},{type:be.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}],this.$dragArea=this.renderDragArea()}setTitle(t){this.title=t,this.$title&&(this.$title.textContent=t,this.$title.title=t)}setState(t){this.state!==t&&(this.state=t,this.buttons.forEach((i,n)=>{i.isActive&&this.$btns[n].classList.toggle("is-active",i.isActive(t))}))}setReadonly(t){this.readonly!==t&&(this.readonly=t)}render(){if(!this.$titleBar){this.$titleBar=document.createElement("div"),this.$titleBar.className=this.wrapClassName("titlebar");const t=document.createElement("div");t.className=this.wrapClassName("title-area"),t.dataset.teleBoxHandle=wo,this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle=wo,this.title&&(this.$title.textContent=this.title,this.$title.title=this.title),t.appendChild(this.$title),t.appendChild(this.$dragArea);const i=document.createElement("div");i.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:n,isActive:r},s)=>{const o=String(s),a=document.createElement("button");a.className=`${this.wrapClassName("titlebar-btn")} ${n}`,a.dataset.teleTitleBarBtnIndex=o,a.dataset.teleTitleBarNoDblClick="true",r&&a.classList.toggle("is-active",r(this.state)),this.$btns.push(a),i.appendChild(a)}),this.sideEffect.addEventListener(i,"click",n=>{var r;if(this.readonly)return;const s=n.target,o=Number((r=s.dataset)==null?void 0:r.teleTitleBarBtnIndex);if(!Number.isNaN(o)&&o<this.buttons.length){Vi(n);const a=this.buttons[o];this.onEvent&&this.onEvent({type:a.type,value:a.value})}}),this.$titleBar.appendChild(t),this.$titleBar.appendChild(i)}return this.$titleBar}renderDragArea(){const t=document.createElement("div");return t.className=this.wrapClassName("drag-area"),t.dataset.teleBoxHandle=wo,this.sideEffect.addEventListener(t,"mousedown",this.handleTitleBarClick),this.sideEffect.addEventListener(t,"touchstart",this.handleTitleBarTouch,{passive:!0}),t}dragHandle(){return this.$titleBar}wrapClassName(t){return`${this.namespace}-${t}`}destroy(){this.sideEffect.flushAll(),this.$titleBar&&(this.$titleBar=void 0,this.$title=void 0,this.$btns.length=0,this.onDragStart=void 0,this.onEvent=void 0)}}class Nv{constructor({id:t=Ev(),title:i=kv(),prefersColorScheme:n=os.Light,darkMode:r,visible:s=!0,width:o=.5,height:a=.5,minWidth:l=0,minHeight:u=0,x:c=.1,y:d=.1,minimized:m=!1,maximized:w=!1,readonly:v=!1,resizable:x=!0,draggable:h=!0,fence:p=!0,fixRatio:f=!1,focus:g=!1,zIndex:y=100,namespace:S="telebox",titleBar:T,content:N,footer:k,styles:P,containerRect:ne={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collectorRect:b}={}){this._renderSideEffect=new ss,this.handleTrackStart=L=>{var Z;return(Z=this._handleTrackStart)==null?void 0:Z.call(this,L)},this._sideEffect=new ss,this._valSideEffectBinder=lh(this._sideEffect);const{combine:I,createVal:z}=this._valSideEffectBinder;this.id=t,this.namespace=S,this.events=new Qo,this._delegateEvents=new Qo;const j=z(n);j.reaction((L,Z,V)=>{V||this.events.emit(ce.PrefersColorScheme,L)});const F=z(Boolean(r));r==null&&j.subscribe((L,Z,V)=>{this._sideEffect.add(()=>{if(L==="auto"){const he=window.matchMedia("(prefers-color-scheme: dark)");if(he){F.setValue(he.matches,V);const vr=wr=>{F.setValue(wr.matches,V)};return he.addListener(vr),()=>he.removeListener(vr)}else return Fu}else return F.setValue(L==="dark",V),Fu},"prefers-color-scheme")}),F.reaction((L,Z,V)=>{V||this.events.emit(ce.DarkMode,L)});const le=z(ne,ct),He=z(b,ct),Je=z(i);Je.reaction((L,Z,V)=>{V||this.titleBar.setTitle(L)});const Dt=z(s);Dt.reaction((L,Z,V)=>{!V&&!L&&this.events.emit(ce.Close)});const zt=z(v);zt.reaction((L,Z,V)=>{V||this.events.emit(ce.Readonly,L)});const an=z(x),gr=z(h),oo=z(p),A=z(f),R=z(y);R.reaction((L,Z,V)=>{V||this.events.emit(ce.ZIndex,L)});const H=z(g);H.reaction((L,Z,V)=>{V||this.events.emit(L?ce.Focus:ce.Blur)});const X=z(m);X.reaction((L,Z,V)=>{V||this.events.emit(ce.Minimized,L)});const J=z(w);J.reaction((L,Z,V)=>{V||this.events.emit(ce.Maximized,L)});const at=I([X,J],([L,Z])=>L?te.Minimized:Z?te.Maximized:te.Normal);at.reaction((L,Z,V)=>{V||this.events.emit(ce.State,L)});const $e=z({width:Te(l,0,1),height:Te(u,0,1)},ct),Ke=z({width:Te(o,$e.value.width,1),height:Te(a,$e.value.height,1)},ct);$e.reaction((L,Z,V)=>{Ke.setValue({width:Te(o,L.width,1),height:Te(a,L.height,1)},V)}),Ke.reaction((L,Z,V)=>{V||this.events.emit(ce.IntrinsicResize,L)});const Fe=I([Ke,J],([L,Z])=>Z?{width:1,height:1}:L,ct);Fe.reaction((L,Z,V)=>{V||this.events.emit(ce.Resize,L)});const Mu=I([Fe,X,le,He],([L,Z,V,he])=>Z&&he?{width:he.width/L.width/V.width,height:he.height/L.height/V.height}:L,ct);Mu.reaction((L,Z,V)=>{V||this.events.emit(ce.VisualResize,L)});const ao=z({x:Te(c,0,1),y:Te(d,0,1)},ct);ao.reaction((L,Z,V)=>{V||this.events.emit(ce.IntrinsicMove,L)});const mr=I([ao,Ke,le,He,X,J],([L,Z,V,he,vr,wr])=>vr&&he?wr?{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-Z.width/2,y:(he.y+he.height/2)/V.height-Z.height/2}:wr?{x:0,y:0}:L,ct);mr.reaction((L,Z,V)=>{V||this.events.emit(ce.Move,L)}),this.titleBar=T||new uh({readonly:zt.value,title:Je.value,namespace:this.namespace,onDragStart:L=>{var Z;return(Z=this._handleTrackStart)==null?void 0:Z.call(this,L)},onEvent:L=>{if(this._delegateEvents.listeners.length>0)this._delegateEvents.emit(L.type);else switch(L.type){case be.Maximize:{J.setValue(!J.value);break}case be.Minimize:{X.setValue(!0);break}case be.Close:{Dt.setValue(!1);break}default:{console.error("Unsupported titleBar event:",L);break}}}}),zt.reaction(L=>{this.titleBar.setReadonly(L)});const xg=z(N),Sg=z(k),Mg=z(P);ah(this,{prefersColorScheme:j,darkMode:F,containerRect:le,collectorRect:He,title:Je,visible:Dt,readonly:zt,resizable:an,draggable:gr,fence:oo,fixRatio:A,focus:H,zIndex:R,minimized:X,maximized:J,$userContent:xg,$userFooter:Sg,$userStyles:Mg}),this._state$=at,this._minSize$=$e,this._size$=Fe,this._intrinsicSize$=Ke,this._visualSize$=Mu,this._coord$=mr,this._intrinsicCoord$=ao,this.fixRatio&&this.transform(mr.value.x,mr.value.y,Fe.value.width,Fe.value.height,!0),this.$box=this.render()}get darkMode(){return this._darkMode$.value}get state(){return this._state$.value}setState(t,i=!1){switch(t){case te.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case te.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(t,i=!1){return this._minSize$.setValue({width:t,height:this.minHeight},i),this}setMinHeight(t,i=!1){return this._minSize$.setValue({width:this.minWidth,height:t},i),this}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}resize(t,i,n=!1){return this._intrinsicSize$.setValue({width:t,height:i},n),this}get width(){return this._size$.value.width}get height(){return this._size$.value.height}get absoluteWidth(){return this.width*this.containerRect.width}get absoluteHeight(){return this.height*this.containerRect.height}get visualWidth(){return this._visualSize$.value.width}get visualHeight(){return this._visualSize$.value.height}get intrinsicX(){return this._intrinsicCoord$.value.x}get intrinsicY(){return this._intrinsicCoord$.value.y}move(t,i,n=!1){return this._intrinsicCoord$.setValue({x:t,y:i},n),this}get x(){return this._coord$.value.x}get y(){return this._coord$.value.y}transform(t,i,n,r,s=!1){if(this.fixRatio){const o=this.intrinsicHeight/this.intrinsicWidth*n;i!==this.intrinsicY&&(i-=o-r),r=o}return i<0&&(i=0,r>this.intrinsicHeight&&(r=this.intrinsicHeight)),this._intrinsicCoord$.setValue({x:n>=this.minWidth?t:this.intrinsicX,y:r>=this.minHeight?i:this.intrinsicY},s),this._intrinsicSize$.setValue({width:Te(n,this.minWidth,1),height:Te(r,this.minHeight,1)},s),this}mount(t){return t.appendChild(this.render()),this}unmount(){return this.$box&&this.$box.remove(),this}mountContent(t){return this.set$userContent(t),this}unmountContent(){return this.set$userContent(void 0),this}mountFooter(t){return this.set$userFooter(t),this}unmountFooter(){return this.set$userFooter(void 0),this}getUserStyles(){return this.$userStyles}mountStyles(t){let i;return typeof t=="string"?(i=document.createElement("style"),i.textContent=t):i=t,this.set$userStyles(i),this}unmountStyles(){return this.set$userStyles(void 0),this}render(t){if(t){if(t===this.$box)return this.$box;this.$box=t}else{if(this.$box)return this.$box;this.$box=document.createElement("div")}this._renderSideEffect.flushAll(),this.$box.classList.add(this.wrapClassName("box"));const i=(d,m,w,v=Pv)=>this._renderSideEffect.add(()=>{const x=this.wrapClassName(w);return m.subscribe(h=>{d.classList.toggle(x,v(h))})});i(this.$box,this._readonly$,"readonly"),i(this.$box,this._draggable$,"no-drag",xr),i(this.$box,this._resizable$,"no-resize",xr),i(this.$box,this._focus$,"blur",xr),i(this.$box,this._darkMode$,"color-scheme-dark"),i(this.$box,this._darkMode$,"color-scheme-light",xr),this._renderSideEffect.add(()=>{const d=this.wrapClassName("minimized"),m=this.wrapClassName("maximized"),w="box-maximized-timer";return this._state$.subscribe(v=>{this.$box.classList.toggle(d,v===te.Minimized),v===te.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(d=>{d?this.$box.style.removeProperty("display"):this.$box.style.display="none"})),this._renderSideEffect.add(()=>this._zIndex$.subscribe(d=>{this.$box.style.zIndex=String(d)}));const n=Mv(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$],([d,m,w,v,x])=>{const h=m.width*v.width,p=m.height*v.height;return{width:h+(w&&x?1:0),height:p+(w&&x?1:0),x:d.x*v.width,y:d.y*v.height,scaleX:w&&x?x.width/h:1,scaleY:w&&x?x.height/p:1}},ct).subscribe(d=>{n.set(d)}),n.set({x:r,y:s});const o=document.createElement("div");o.className=this.wrapClassName("box-main"),this.$box.appendChild(o);const a=document.createElement("div");a.className=this.wrapClassName("titlebar-wrap"),a.appendChild(this.titleBar.render()),this.$titleBar=a;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 d;return this._$userStyles$.subscribe(m=>{d&&d.remove(),d=m,m&&l.appendChild(m)})}),this._renderSideEffect.add(()=>{let d;return this._$userContent$.subscribe(m=>{d&&d.remove(),d=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 d;return this._$userFooter$.subscribe(m=>{d&&d.remove(),d=m,m&&c.appendChild(m)})}),o.appendChild(a),o.appendChild(l),o.appendChild(c),this._renderResizeHandlers(),this.$box}_renderResizeHandlers(){const t=document.createElement("div");t.className=this.wrapClassName("resize-handles"),Object.values(tt).forEach(x=>{const h=document.createElement("div");h.className=this.wrapClassName(x)+" "+this.wrapClassName("resize-handle"),h.dataset.teleBoxHandle=x,t.appendChild(h)}),this.$box.appendChild(t);const i="handle-tracking-listener",n=this.wrapClassName("transforming");let r,s=0,o=0,a=0,l=0,u=0,c=0,d;const m=x=>{if(this.state!==te.Normal)return;Vi(x);let{pageX:h,pageY:p}=$u(x);p<0&&(p=0);const f=(h-u)/this.containerRect.width,g=(p-c)/this.containerRect.height;switch(d){case tt.North:{this.transform(this.x,o+g,this.width,l-g);break}case tt.South:{this.transform(this.x,this.y,this.width,l+g);break}case tt.West:{this.transform(s+f,this.y,a-f,this.height);break}case tt.East:{this.transform(this.x,this.y,a+f,this.height);break}case tt.NorthWest:{this.transform(s+f,o+g,a-f,l-g);break}case tt.NorthEast:{this.transform(this.x,o+g,a+f,l-g);break}case tt.SouthEast:{this.transform(this.x,this.y,a+f,l+g);break}case tt.SouthWest:{this.transform(s+f,this.y,a-f,l+g);break}default:{if(this.fence)this.move(Te(s+f,0,1-this.width),Te(o+g,0,1-this.height));else{const y=20/this.containerRect.width,S=20/this.containerRect.height;this.move(Te(s+f,y-this.width,1-y),Te(o+g,0,1-S))}break}}},w=x=>{d=void 0,r&&(Vi(x),this.$box.classList.toggle(n,!1),this._sideEffect.flush(i),r.remove())},v=x=>{var h;if(this.readonly||x.button!=null&&x.button!==0||!this.draggable||d||this.state!==te.Normal)return;const p=x.target;if((h=p.dataset)!=null&&h.teleBoxHandle){Vi(x),s=this.x,o=this.y,a=this.width,l=this.height,{pageX:u,pageY:c}=$u(x),d=p.dataset.teleBoxHandle,r||(r=document.createElement("div"));const f=d?this.wrapClassName(`cursor-${d}`):"";r.className=this.wrapClassName(`track-mask${f?` ${f}`:""}`),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=v,this._sideEffect.addEventListener(t,"mousedown",v,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(t,"touchstart",v,{passive:!1},"box-resizeHandles-touchstart")}destroy(){this.$box.remove(),this.events.emit(ce.Destroyed),this._sideEffect.flushAll(),this._renderSideEffect.flushAll(),this.events.removeAllListeners(),this._delegateEvents.removeAllListeners()}wrapClassName(t){return`${this.namespace}-${t}`}}function Fu(){}var Dv="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class ch{constructor({visible:t=!0,readonly:i=!1,darkMode:n=!1,namespace:r="telebox",styles:s={},onClick:o}={}){this.handleCollectorClick=()=>{!this._readonly&&this.onClick&&this.onClick()},this._visible=t,this._readonly=i,this._darkMode=n,this.namespace=r,this.styles=s,this.onClick=o}get visible(){return this._visible}get readonly(){return this._readonly}get darkMode(){return this._darkMode}mount(t){return t.appendChild(this.render()),this}unmount(){return this.$collector&&this.$collector.remove(),this}setVisible(t){return this._visible!==t&&(this._visible=t,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-visible"),t)),this}setReadonly(t){return this._readonly!==t&&(this._readonly=t,this.$collector&&this.$collector.classList.toggle(this.wrapClassName("collector-readonly"),t)),this}setDarkMode(t){return this._darkMode!==t&&(this._darkMode=t,this.$collector&&(this.$collector.classList.toggle(this.wrapClassName("color-scheme-dark"),t),this.$collector.classList.toggle(this.wrapClassName("color-scheme-light"),!t))),this}setStyles(t){if(Object.assign(this.styles,t),this.$collector){const i=this.$collector;Object.keys(t).forEach(n=>{const r=t[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.setStyles(this.styles)),this.$collector}destroy(){this.$collector&&(this.$collector.removeEventListener("click",this.handleCollectorClick),this.$collector.remove(),this.$collector=void 0),this.onClick=void 0}wrapClassName(t){return`${this.namespace}-${t}`}}var ue;(function(e){e.Focused="focused",e.Blurred="blurred",e.Created="created",e.Removed="removed",e.State="state",e.Maximized="maximized",e.Minimized="minimized",e.Move="move",e.Resize="resize",e.IntrinsicMove="intrinsic_move",e.IntrinsicResize="intrinsic_resize",e.VisualResize="visual_resize",e.ZIndex="z_index",e.PrefersColorScheme="prefers_color_scheme",e.DarkMode="dark_mode"})(ue||(ue={}));class zv extends uh{constructor(t){super(t);this.boxes=t.boxes,this.focusedBox=t.focusedBox,this.containerRect=t.containerRect,this.darkMode=t.darkMode}focusBox(t){var i;if(!(this.focusedBox&&this.focusedBox===t)){if(this.$titles&&this.state===te.Maximized){const{children:n}=this.$titles.firstElementChild;for(let r=n.length-1;r>=0;r-=1){const s=n[r],o=(i=s.dataset)==null?void 0:i.teleBoxID;o&&(t&&o===t.id?s.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&o===this.focusedBox.id&&s.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}}this.focusedBox=t}}setContainerRect(t){if(this.containerRect=t,this.$titleBar){const{x:i,y:n,width:r}=t;this.$titleBar.style.transform=`translate(${i}px, ${n}px)`,this.$titleBar.style.width=r+"px"}}setBoxes(t){this.boxes=t,this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===te.Maximized&&t.length>0),this.updateTitles()}setState(t){super.setState(t),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"),t===te.Maximized&&this.boxes.length>0),this.updateTitles()}setReadonly(t){super.setReadonly(t),this.$titleBar&&this.$titleBar.classList.toggle(this.wrapClassName("readonly"),this.readonly)}setDarkMode(t){t!==this.darkMode&&(this.darkMode=t,this.$titleBar&&(this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-dark"),t),this.$titleBar.classList.toggle(this.wrapClassName("color-scheme-light"),!t)))}render(){const t=super.render(),{x:i,y:n,width:r}=this.containerRect;t.style.transform=`translate(${i}px, ${n}px)`,t.style.width=r+"px",t.classList.add(this.wrapClassName("max-titlebar")),t.classList.toggle(this.wrapClassName("max-titlebar-maximized"),this.state===te.Maximized&&this.boxes.length>0),t.classList.toggle(this.wrapClassName("readonly"),this.readonly),t.classList.add(this.wrapClassName(this.darkMode?"color-scheme-dark":"color-scheme-light"));const s=document.createElement("div");return s.classList.add(this.wrapClassName("titles-area")),t.insertBefore(s,t.firstElementChild),this.updateTitles(),t}destroy(){super.destroy(),this.$titles=void 0,this.boxes.length=0,this.focusedBox=void 0}updateTitles(){this.$titleBar&&this.state===te.Maximized&&(this.$titleBar.classList.toggle(this.wrapClassName("max-titlebar-single-title"),this.boxes.length===1),this.boxes.length===1?this.setTitle(this.boxes[0].title):this.$titleBar.replaceChild(this.renderTitles(),this.$titleBar.firstElementChild))}renderTitles(){this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.$titles.addEventListener("wheel",i=>{i.currentTarget.scrollBy({left:i.deltaY>0?250:-250,behavior:"smooth"})},{passive:!1});const t=document.createElement("div");return t.className=this.wrapClassName("titles-content"),this.$titles.appendChild(t),this.boxes.forEach(i=>{const n=document.createElement("button");n.className=this.wrapClassName("titles-tab"),n.textContent=i.title,n.dataset.teleBoxID=i.id,n.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&i.id===this.focusedBox.id&&n.classList.add(this.wrapClassName("titles-tab-focus")),t.appendChild(n)}),this.$titles}}class Lv{constructor({root:t=document.body,prefersColorScheme:i=os.Light,minimized:n=!1,maximized:r=!1,fence:s=!0,containerRect:o={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collector:a,namespace:l="telebox",readonly:u=!1}={}){this.events=new Qo,this._sideEffect=new ss;const{combine:c,createVal:d}=lh(this._sideEffect);this.root=t,this.namespace=l,this.boxes$=d([]),this.topBox$=this.boxes$.derive(b=>{if(b.length>0)return b.reduce((z,j)=>z.zIndex>j.zIndex?z:j)});const m=window.matchMedia("(prefers-color-scheme: dark)"),w=d(!1);m&&(w.setValue(m.matches),this._sideEffect.add(()=>{const b=I=>{w.setValue(I.matches)};return m.addListener(b),()=>m.removeListener(b)}));const v=d(i);v.reaction((b,I,z)=>{this.boxes.forEach(j=>j.setPrefersColorScheme(b,z)),z||this.events.emit(ue.PrefersColorScheme,b)}),this._darkMode$=c([w,v],([b,I])=>I==="auto"?b:I==="dark"),this._darkMode$.reaction((b,I,z)=>{this.boxes.forEach(j=>j.setDarkMode(b,z)),z||this.events.emit(ue.DarkMode,b)});const x=d(u);x.reaction((b,I,z)=>{this.boxes.forEach(j=>j.setReadonly(b,z))});const h=d(n),p=d(r);p.reaction((b,I,z)=>{this.boxes.forEach(j=>j.setMaximized(b,z)),z||this.events.emit(ue.Maximized,b)});const f=c([h,p],([b,I])=>b?te.Minimized:I?te.Maximized:te.Normal);f.reaction((b,I,z)=>{this.maxTitleBar.setState(b),z||this.events.emit(ue.State,b)});const g=d(s);g.subscribe((b,I,z)=>{this.boxes.forEach(j=>j.setFence(b,z))});const y=d(o,ct);y.reaction((b,I,z)=>{this.boxes.forEach(j=>j.setContainerRect(b,z)),this.maxTitleBar.setContainerRect(b)});const S=d(a===null?null:a||new ch({visible:n,readonly:u,namespace:l}).mount(t));S.subscribe(b=>{b&&(b.setVisible(h.value),b.setReadonly(x.value),b.setDarkMode(this._darkMode$.value),this._sideEffect.add(()=>(b.onClick=()=>{x.value||h.setValue(!1)},()=>b.destroy()),"collect-onClick"))}),x.subscribe(b=>{var I;return(I=S.value)==null?void 0:I.setReadonly(b)}),this._darkMode$.subscribe(b=>{var I;(I=S.value)==null||I.setDarkMode(b)});const T=()=>{var b;if((b=S.value)!=null&&b.$collector){const{x:I,y:z,width:j,height:F}=S.value.$collector.getBoundingClientRect(),le=this.root.getBoundingClientRect();return{x:I-le.x,y:z-le.y,width:j,height:F}}},N=d(h.value?T():void 0);N.subscribe((b,I,z)=>{this.boxes.forEach(j=>{j.setCollectorRect(b,z)})}),h.subscribe((b,I,z)=>{var j,F;(j=S.value)==null||j.setVisible(b),b&&(F=S.value)!=null&&F.$collector&&N.setValue(T()),this.boxes.forEach(le=>le.setMinimized(b,z)),z||this.events.emit(ue.Minimized,b)});const k=this.wrapClassName("titlebar-icon-close"),P=b=>{var I;if(x.value)return;const z=b.target;if(!!z.tagName)for(let j=z;j;j=j.parentElement){if(j.classList&&j.classList.contains(k))return;const F=(I=j.dataset)==null?void 0:I.teleBoxID;if(F){const le=this.getBox(F);if(le){this.focusBox(le),this.makeBoxTop(le);return}}}};this._sideEffect.addEventListener(window,"mousedown",P,!0),this._sideEffect.addEventListener(window,"touchstart",P,!0),this.maxTitleBar=new zv({darkMode:this.darkMode,readonly:x.value,namespace:this.namespace,state:f.value,boxes:this.boxes$.value,containerRect:y.value,onEvent:b=>{switch(b.type){case be.Maximize:{p.setValue(!p.value);break}case be.Minimize:{h.setValue(!0);break}case ce.Close:{this.removeTopBox(),this.focusTopBox();break}}}}),x.subscribe(b=>this.maxTitleBar.setReadonly(b)),this._darkMode$.subscribe(b=>{this.maxTitleBar.setDarkMode(b)}),this.boxes$.reaction(b=>{this.maxTitleBar.setBoxes(b)}),ah(this,{prefersColorScheme:v,containerRect:y,collector:S,collectorRect:N,readonly:x,fence:g,minimized:h,maximized:p}),this._state$=f,this.root.appendChild(this.maxTitleBar.render())}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(t,i=!1){switch(t){case te.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case te.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}create(t={},i=!0){const n=new Nv(ju(Ru({zIndex:this.topBox?this.topBox.zIndex+1:100},i?this.smartPosition(t):t),{darkMode:this.darkMode,prefersColorScheme:this.prefersColorScheme,maximized:this.maximized,minimized:this.minimized,fence:this.fence,namespace:this.namespace,containerRect:this.containerRect,readonly:this.readonly,collectorRect:this.collectorRect}));return n.mount(this.root),n.focus&&(this.focusBox(n),i&&this.makeBoxTop(n)),this.boxes$.setValue([...this.boxes,n]),n._delegateEvents.on(be.Maximize,()=>{this.setMaximized(!this.maximized)}),n._delegateEvents.on(be.Minimize,()=>{this.setMinimized(!0)}),n._delegateEvents.on(be.Close,()=>{this.remove(n),this.focusTopBox()}),n._coord$.reaction((r,s,o)=>{o||this.events.emit(ue.Move,n)}),n._size$.reaction((r,s,o)=>{o||this.events.emit(ue.Resize,n)}),n._intrinsicCoord$.reaction((r,s,o)=>{o||this.events.emit(ue.IntrinsicMove,n)}),n._intrinsicSize$.reaction((r,s,o)=>{o||this.events.emit(ue.IntrinsicResize,n)}),n._visualSize$.reaction((r,s,o)=>{o||this.events.emit(ue.VisualResize,n)}),n._zIndex$.reaction((r,s,o)=>{if(this.boxes.length>0){const a=this.boxes.reduce((l,u)=>l.zIndex>u.zIndex?l:u);this.topBox$.setValue(a)}o||this.events.emit(ue.ZIndex,n)}),this.events.emit(ue.Created,n),n}query(t){return t?this.boxes.filter(this.teleBoxMatcher(t)):[...this.boxes]}queryOne(t){return t?this.boxes.find(this.teleBoxMatcher(t)):this.boxes[0]}update(t,i,n=!1){const r=this.boxes.find(s=>s.id===t);if(r)return this.updateBox(r,i,n)}updateAll(t,i=!1){this.boxes.forEach(n=>{this.updateBox(n,t,i)})}remove(t,i=!1){const n=this.getBoxIndex(t);if(n>=0){const r=this.boxes.slice(),s=r.splice(n,1);return this.boxes$.setValue(r),s.forEach(o=>o.destroy()),i||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(ue.Removed,s)),s[0]}}removeTopBox(){if(this.topBox)return this.remove(this.topBox)}removeAll(t=!1){const i=this.boxes$.value;return this.boxes$.setValue([]),i.forEach(n=>n.destroy()),t||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(ue.Removed,i)),i}destroy(t=!1){this.events.removeAllListeners(),this._sideEffect.flushAll(),this.removeAll(t),Object.keys(this).forEach(i=>{const n=this[i];n instanceof tr&&n.destroy()})}wrapClassName(t){return`${this.namespace}-${t}`}focusBox(t,i=!1){const n=this.getBox(t);n&&(this.boxes.forEach(r=>{if(n===r){let s=!1;n.focus||(s=!0,n.setFocus(!0,i)),s&&!i&&this.events.emit(ue.Focused,n)}else r.focus&&this.blurBox(r,i)}),this.maxTitleBar.focusBox(n))}focusTopBox(){if(this.topBox&&!this.topBox.focus)return this.focusBox(this.topBox)}blurBox(t,i=!1){const n=this.getBox(t);n&&(n.focus&&(n.setFocus(!1,i),i||this.events.emit(ue.Blurred,n)),this.maxTitleBar.focusedBox===n&&this.maxTitleBar.focusBox())}blurAll(t=!1){this.boxes.forEach(i=>{i.focus&&(i.setFocus(!1,t),t||this.events.emit(ue.Blurred,i))}),this.maxTitleBar.focusedBox&&this.maxTitleBar.focusBox()}teleBoxMatcher(t){const i=Object.keys(t);return n=>i.every(r=>t[r]===n[r])}updateBox(t,i,n=!1){(i.x!=null||i.y!=null)&&t.move(i.x==null?t.intrinsicX:i.x,i.y==null?t.intrinsicY:i.y,n),(i.width!=null||i.height!=null)&&t.resize(i.width==null?t.intrinsicWidth:i.width,i.height==null?t.intrinsicHeight:i.height,n),i.title!=null&&(t.setTitle(i.title),this.maxTitleBar.updateTitles()),i.visible!=null&&t.setVisible(i.visible,n),i.minHeight!=null&&t.setMinHeight(i.minHeight,n),i.minWidth!=null&&t.setMinWidth(i.minWidth,n),i.resizable!=null&&t.setResizable(i.resizable,n),i.draggable!=null&&t.setDraggable(i.draggable,n),i.fixRatio!=null&&t.setFixRatio(i.fixRatio,n),i.zIndex!=null&&t.setZIndex(i.zIndex,n),i.content!=null&&t.mountContent(i.content),i.footer!=null&&t.mountFooter(i.footer)}smartPosition(t={}){let{x:i,y:n}=t;const{width:r=.5,height:s=.5}=t;if(i==null){let o=20;this.topBox&&(o=this.topBox.intrinsicX*this.containerRect.width+20,o>this.containerRect.width-r*this.containerRect.width&&(o=20)),i=o/this.containerRect.width}if(n==null){let o=20;this.topBox&&(o=this.topBox.intrinsicY*this.containerRect.height+20,o>this.containerRect.height-s*this.containerRect.height&&(o=20)),n=o/this.containerRect.height}return ju(Ru({},t),{x:i,y:n,width:r,height:s})}makeBoxTop(t,i=!1){this.topBox&&t!==this.topBox&&t.setZIndex(this.topBox.zIndex+1,i)}getBoxIndex(t){return typeof t=="string"?this.boxes.findIndex(i=>i.id===t):this.boxes.findIndex(i=>i===t)}getBox(t){return typeof t=="string"?this.boxes.find(i=>i.id===t):t}}const Rv=(e,t,i,n,r)=>new jv({safeSetAttributes:s=>e.safeSetAttributes(s),getMainView:()=>e.mainView,updateAppState:(...s)=>{var o;return(o=e.appManager)==null?void 0:o.store.updateAppState(...s)},canOperate:()=>e.canOperate,notifyContainerRectUpdate:s=>{var o;return(o=e.appManager)==null?void 0:o.notifyContainerRectUpdate(s)},cleanFocus:()=>{var s;return(s=e.appManager)==null?void 0:s.store.cleanFocus()},setAppFocus:s=>{var o;return(o=e.appManager)==null?void 0:o.store.setAppFocus(s,!0)},callbacks:t,emitter:i,boxEmitter:n},r);class jv{constructor(t,i){this.context=t,this.createTeleBoxManagerConfig=i;const{emitter:n,callbacks:r,boxEmitter:s}=t;this.teleBoxManager=this.setupBoxManager(i),this.teleBoxManager._state$.reaction(o=>{r.emit("boxStateChange",o),n.emit("boxStateChange",o)}),this.teleBoxManager._darkMode$.reaction(o=>{r.emit("darkModeChange",o)}),this.teleBoxManager._prefersColorScheme$.reaction(o=>{r.emit("prefersColorSchemeChange",o)}),this.teleBoxManager._minimized$.reaction(o=>{o||setTimeout(()=>{const a=.001*(Math.random()>.5?1:-1);this.teleBoxManager.boxes.forEach(l=>{l.resize(l.intrinsicWidth+a,l.intrinsicHeight+a,!0)})},400)}),this.teleBoxManager.events.on("minimized",o=>{if(this.context.safeSetAttributes({minimized:o}),o)this.context.cleanFocus(),this.blurAllBox();else{const a=this.getTopBox();a&&(this.context.setAppFocus(a.id),this.focusBox({appId:a.id},!1))}}),this.teleBoxManager.events.on("maximized",o=>{this.context.safeSetAttributes({maximized:o})}),this.teleBoxManager.events.on("removed",o=>{o.forEach(a=>{s.emit("close",{appId:a.id})})}),this.teleBoxManager.events.on("intrinsic_move",E.debounce(o=>{s.emit("move",{appId:o.id,x:o.intrinsicX,y:o.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",E.debounce(o=>{s.emit("resize",{appId:o.id,width:o.intrinsicWidth,height:o.intrinsicHeight})},200)),this.teleBoxManager.events.on("focused",o=>{o&&(this.canOperate?s.emit("focus",{appId:o.id}):this.teleBoxManager.blurBox(o.id))}),this.teleBoxManager.events.on("z_index",o=>{this.context.updateAppState(o.id,ke.ZIndex,o.zIndex)}),n.on("playgroundSizeChange",()=>this.updateManagerRect()),n.on("updateManagerRect",()=>this.updateManagerRect())}get mainView(){return this.context.getMainView()}get canOperate(){return this.context.canOperate()}get boxState(){return this.teleBoxManager.state}get maximized(){return this.teleBoxManager.maximized}get minimized(){return this.teleBoxManager.minimized}get darkMode(){return this.teleBoxManager.darkMode}get prefersColorScheme(){return this.teleBoxManager.prefersColorScheme}get boxSize(){return this.teleBoxManager.boxes.length}createBox(t){var u,c,d;if(!this.teleBoxManager)return;let{minwidth:i=Lg,minheight:n=Rg}=(u=t.app.config)!=null?u:{};const{width:r,height:s}=(c=t.app.config)!=null?c:{},o=((d=t.options)==null?void 0:d.title)||t.appId,a=this.teleBoxManager.containerRect;i>1&&(i=i/a.width),n>1&&(n=n/a.height);const l={title:o,minWidth:i,minHeight:n,width:r,height:s,id:t.appId};this.teleBoxManager.create(l,t.smartPosition),this.context.emitter.emit(`${t.appId}${K.WindowCreated}`)}setBoxInitState(t){const i=this.teleBoxManager.queryOne({id:t});i&&i.state===te.Maximized&&this.context.boxEmitter.emit("resize",{appId:t,x:i.x,y:i.y,width:i.intrinsicWidth,height:i.intrinsicHeight})}setupBoxManager(t){const i=Y.wrapper?Y.wrapper:document.body,n=i.getBoundingClientRect(),r={root:i,containerRect:{x:0,y:0,width:n.width,height:n.height},fence:!1,prefersColorScheme:t==null?void 0:t.prefersColorScheme},s=new Lv(r);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=s;const o=(t==null?void 0:t.collectorContainer)||Y.wrapper;return o&&this.setCollectorContainer(o),s}setCollectorContainer(t){var n;const i=new ch({styles:(n=this.createTeleBoxManagerConfig)==null?void 0:n.collectorStyles}).mount(t);this.teleBoxManager.setCollector(i)}getBox(t){return this.teleBoxManager.queryOne({id:t})}closeBox(t,i=!1){return this.teleBoxManager.remove(t,i)}boxIsFocus(t){const i=this.getBox(t);return i==null?void 0:i.focus}getFocusBox(){return this.teleBoxManager.query({focus:!0})[0]}getTopBox(){return this.teleBoxManager.topBox}updateBoxState(t){if(!t)return;const i=this.getBox(t.id);i&&(this.teleBoxManager.update(i.id,{x:t.x,y:t.y,width:t.width||.5,height:t.height||.5,zIndex:t.zIndex},!0),setTimeout(()=>{t.focus&&this.teleBoxManager.focusBox(i.id,!0),t.maximized!=null&&this.teleBoxManager.setMaximized(Boolean(t.maximized),!0),t.minimized!=null&&this.teleBoxManager.setMinimized(Boolean(t.minimized),!0)},50),this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}updateManagerRect(){var i;const t=(i=this.mainView.divElement)==null?void 0:i.getBoundingClientRect();if(t&&t.width>0&&t.height>0){const n={x:0,y:0,width:t.width,height:t.height};this.teleBoxManager.setContainerRect(n),this.context.notifyContainerRectUpdate(this.teleBoxManager.containerRect)}}moveBox({appId:t,x:i,y:n}){this.teleBoxManager.update(t,{x:i,y:n},!0)}focusBox({appId:t},i=!0){this.teleBoxManager.focusBox(t,i)}resizeBox({appId:t,width:i,height:n,skipUpdate:r}){this.teleBoxManager.update(t,{width:i,height:n},r)}setBoxMinSize(t){this.teleBoxManager.update(t.appId,{minWidth:t.minWidth,minHeight:t.minHeight},!0)}setBoxTitle(t){this.teleBoxManager.update(t.appId,{title:t.title},!0)}blurAllBox(){this.teleBoxManager.blurAll()}updateAll(t){this.teleBoxManager.updateAll(t)}setMaximized(t,i=!0){t!==this.maximized&&this.teleBoxManager.setMaximized(t,i)}setMinimized(t,i=!0){this.teleBoxManager.setMinimized(t,i)}focusTopBox(){if(this.teleBoxManager.query().length>=1){const i=this.getTopBox();i&&this.focusBox({appId:i.id},!1)}}updateBox(t,i,n=!0){this.teleBoxManager.update(t,i,n)}setReadonly(t){this.teleBoxManager.setReadonly(t)}setPrefersColorScheme(t){this.teleBoxManager.setPrefersColorScheme(t)}setZIndex(t,i,n=!0){this.teleBoxManager.update(t,{zIndex:i},n)}destroy(){this.teleBoxManager.destroy()}}function as(){}function dh(e){return e()}function Qu(){return Object.create(null)}function Os(e){e.forEach(dh)}function Bv(e){return typeof e=="function"}function _v(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Sr;function ls(e,t){return Sr||(Sr=document.createElement("a")),Sr.href=t,e===Sr.href}function Vv(e){return Object.keys(e).length===0}function bt(e,t){e.appendChild(t)}function Us(e,t,i){e.insertBefore(t,i||null)}function ir(e){e.parentNode.removeChild(e)}function Ut(e){return document.createElement(e)}function hl(e){return document.createTextNode(e)}function Ko(){return hl(" ")}function oe(e,t,i){i==null?e.removeAttribute(t):e.getAttribute(t)!==i&&e.setAttribute(t,i)}function Ov(e){return Array.from(e.childNodes)}function hh(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function ye(e,t,i,n){i===null?e.style.removeProperty(t):e.style.setProperty(t,i,n?"important":"")}let pl;function kn(e){pl=e}const xn=[],Zu=[],Hr=[],Yu=[],Uv=Promise.resolve();let qo=!1;function Wv(){qo||(qo=!0,Uv.then(ph))}function ea(e){Hr.push(e)}const yo=new Set;let Mr=0;function ph(){const e=pl;do{for(;Mr<xn.length;){const t=xn[Mr];Mr++,kn(t),Hv(t.$$)}for(kn(null),xn.length=0,Mr=0;Zu.length;)Zu.pop()();for(let t=0;t<Hr.length;t+=1){const i=Hr[t];yo.has(i)||(yo.add(i),i())}Hr.length=0}while(xn.length);for(;Yu.length;)Yu.pop()();qo=!1,yo.clear(),kn(e)}function Hv(e){if(e.fragment!==null){e.update(),Os(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ea)}}const $v=new Set;function Fv(e,t){e&&e.i&&($v.delete(e),e.i(t))}function Qv(e,t,i,n){const{fragment:r,on_mount:s,on_destroy:o,after_update:a}=e.$$;r&&r.m(t,i),n||ea(()=>{const l=s.map(dh).filter(Bv);o?o.push(...l):Os(l),e.$$.on_mount=[]}),a.forEach(ea)}function Zv(e,t){const i=e.$$;i.fragment!==null&&(Os(i.on_destroy),i.fragment&&i.fragment.d(t),i.on_destroy=i.fragment=null,i.ctx=[])}function Yv(e,t){e.$$.dirty[0]===-1&&(xn.push(e),Wv(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Gv(e,t,i,n,r,s,o,a=[-1]){const l=pl;kn(e);const u=e.$$={fragment:null,ctx:null,props:s,update:as,not_equal:r,bound:Qu(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:Qu(),dirty:a,skip_bound:!1,root:t.target||l.$$.root};o&&o(u.root);let c=!1;if(u.ctx=i?i(e,t.props||{},(d,m,...w)=>{const v=w.length?w[0]:m;return u.ctx&&r(u.ctx[d],u.ctx[d]=v)&&(!u.skip_bound&&u.bound[d]&&u.bound[d](v),c&&Yv(e,d)),m}):[],u.update(),c=!0,Os(u.before_update),u.fragment=n?n(u.ctx):!1,t.target){if(t.hydrate){const d=Ov(t.target);u.fragment&&u.fragment.l(d),d.forEach(ir)}else u.fragment&&u.fragment.c();t.intro&&Fv(e.$$.fragment),Qv(e,t.target,t.anchor,t.customElement),ph()}kn(l)}class Xv{$destroy(){Zv(this,1),this.$destroy=as}$on(t,i){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(i),()=>{const r=n.indexOf(i);r!==-1&&n.splice(r,1)}}$set(t){this.$$set&&!Vv(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Gu(e){let t,i,n,r,s,o,a,l=e[18]&&Xu(e),u=e[19]&&Ju(e);return{c(){t=Ut("div"),i=Ut("div"),l&&l.c(),n=Ko(),r=Ut("span"),s=hl(e[1]),o=Ko(),u&&u.c(),ye(r,"overflow","hidden"),ye(r,"white-space","nowrap"),ye(r,"text-overflow","ellipsis"),ye(r,"max-width","80px"),oe(i,"class",e[9]),ye(i,"background-color",e[3]),ye(i,"color",e[10]),ye(i,"opacity",e[12]),oe(t,"class",a="netless-window-manager-cursor-name "+e[16]+" "+e[15])},m(c,d){Us(c,t,d),bt(t,i),l&&l.m(i,null),bt(i,n),bt(i,r),bt(r,s),bt(i,o),u&&u.m(i,null)},p(c,d){c[18]?l?l.p(c,d):(l=Xu(c),l.c(),l.m(i,n)):l&&(l.d(1),l=null),d&2&&hh(s,c[1]),c[19]?u?u.p(c,d):(u=Ju(c),u.c(),u.m(i,null)):u&&(u.d(1),u=null),d&512&&oe(i,"class",c[9]),d&8&&ye(i,"background-color",c[3]),d&1024&&ye(i,"color",c[10]),d&4096&&ye(i,"opacity",c[12]),d&98304&&a!==(a="netless-window-manager-cursor-name "+c[16]+" "+c[15])&&oe(t,"class",a)},d(c){c&&ir(t),l&&l.d(),u&&u.d()}}}function Xu(e){let t,i;return{c(){t=Ut("img"),oe(t,"class","netless-window-manager-cursor-selector-avatar"),oe(t,"style",e[20]()),ls(t.src,i=e[8])||oe(t,"src",i),oe(t,"alt","avatar")},m(n,r){Us(n,t,r)},p(n,r){r&256&&!ls(t.src,i=n[8])&&oe(t,"src",i)},d(n){n&&ir(t)}}}function Ju(e){let t,i;return{c(){t=Ut("span"),i=hl(e[2]),oe(t,"class","netless-window-manager-cursor-tag-name"),ye(t,"background-color",e[11])},m(n,r){Us(n,t,r),bt(t,i)},p(n,r){r&4&&hh(i,n[2]),r&2048&&ye(t,"background-color",n[11])},d(n){n&&ir(t)}}}function Jv(e){let t,i,n,r,s,o,a,l=!e[14]&&Gu(e);return{c(){t=Ut("div"),l&&l.c(),i=Ko(),n=Ut("div"),r=Ut("img"),oe(r,"class",s="netless-window-manager-cursor-"+e[4]+"-image "+e[15]),ls(r.src,o=e[7])||oe(r,"src",o),oe(r,"alt",e[4]),oe(n,"class","cursor-image-wrapper"),oe(t,"class",a="netless-window-manager-cursor-mid"+(e[13]?" netless-window-manager-cursor-custom":"")),ye(t,"transform","translateX("+e[5]+"px) translateY("+e[6]+"px)"),ye(t,"display",e[17]),oe(t,"data-cursor-uid",e[0])},m(u,c){Us(u,t,c),l&&l.m(t,null),bt(t,i),bt(t,n),bt(n,r)},p(u,[c]){u[14]?l&&(l.d(1),l=null):l?l.p(u,c):(l=Gu(u),l.c(),l.m(t,i)),c&32784&&s!==(s="netless-window-manager-cursor-"+u[4]+"-image "+u[15])&&oe(r,"class",s),c&128&&!ls(r.src,o=u[7])&&oe(r,"src",o),c&16&&oe(r,"alt",u[4]),c&8192&&a!==(a="netless-window-manager-cursor-mid"+(u[13]?" netless-window-manager-cursor-custom":""))&&oe(t,"class",a),c&96&&ye(t,"transform","translateX("+u[5]+"px) translateY("+u[6]+"px)"),c&131072&&ye(t,"display",u[17]),c&1&&oe(t,"data-cursor-uid",u[0])},i:as,o:as,d(u){u&&ir(t),l&&l.d()}}}function Kv(e,t,i){let n,r,s,o,a,l,u,c,{uid:d}=t,{cursorName:m}=t,{tagName:w}=t,{backgroundColor:v}=t,{appliance:x}=t,{x:h}=t,{y:p}=t,{src:f}=t,{visible:g}=t,{avatar:y}=t,{theme:S}=t,{color:T}=t,{cursorTagBackgroundColor:N}=t,{opacity:k}=t,{pencilEraserSize:P}=t,{custom:ne}=t;const b=()=>Object.entries({width:(n?19:28)+"px",height:(n?19:28)+"px",position:n?"initial":"absolute","border-color":n?"white":v,"margin-right":(n?4:0)+"px"}).map(([I,z])=>`${I}: ${z}`).join(";");return e.$$set=I=>{"uid"in I&&i(0,d=I.uid),"cursorName"in I&&i(1,m=I.cursorName),"tagName"in I&&i(2,w=I.tagName),"backgroundColor"in I&&i(3,v=I.backgroundColor),"appliance"in I&&i(4,x=I.appliance),"x"in I&&i(5,h=I.x),"y"in I&&i(6,p=I.y),"src"in I&&i(7,f=I.src),"visible"in I&&i(21,g=I.visible),"avatar"in I&&i(8,y=I.avatar),"theme"in I&&i(9,S=I.theme),"color"in I&&i(10,T=I.color),"cursorTagBackgroundColor"in I&&i(11,N=I.cursorTagBackgroundColor),"opacity"in I&&i(12,k=I.opacity),"pencilEraserSize"in I&&i(22,P=I.pencilEraserSize),"custom"in I&&i(13,ne=I.custom)},e.$$.update=()=>{e.$$.dirty&2&&(n=!E.isEmpty(m)),e.$$.dirty&4&&i(19,r=!E.isEmpty(w)),e.$$.dirty&256&&i(18,s=!E.isEmpty(y)),e.$$.dirty&2097152&&i(17,o=g?"":"none"),e.$$.dirty&16&&i(14,a=x===C.ApplianceNames.laserPointer),e.$$.dirty&16400&&i(23,l=a||x===C.ApplianceNames.pencilEraser),e.$$.dirty&8388608&&i(16,u=l?"netless-window-manager-laserPointer-pencilEraser-offset":""),e.$$.dirty&4194304&&i(15,c=P===3?"netless-window-manager-pencilEraser-3-offset":"")},[d,m,w,v,x,h,p,f,y,S,T,N,k,ne,a,c,u,o,s,r,b,g,P,l]}class qv extends Xv{constructor(t){super();Gv(this,t,Kv,Jv,_v,{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 fh="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 gh(e){return`data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='12' cy='12' r='2.5' stroke='%23${e}' stroke-linejoin='square'/%3E%3Ccircle cx='12' cy='12' r='3.5' stroke='%23${e}'/%3E%3C/g%3E%3C/svg%3E`}function Ni(e){return`data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg' fill='none'%3E%3Cpath d='M5 12H19' stroke='%23${e}' stroke-linejoin='round'/%3E%3Cpath d='M12 5V19' stroke='%23${e}' stroke-linejoin='round'/%3E%3C/svg%3E`}function ni(e){return`url("${e}") 12 12, auto`}function ew(e){let t="";for(const i in e)t+=`.netless-whiteboard.${i} {cursor: ${e[i]}}
29
- `;return t}const Cr=document.createElement("style");function tw(e){const[t,i,n]=e.strokeColor,r=((1<<24)+(t<<16)+(i<<8)+n).toString(16).slice(1);return Cr.textContent=ew({"cursor-pencil":ni(gh(r)),"cursor-eraser":ni(fh),"cursor-rectangle":ni(Ni(r)),"cursor-ellipse":ni(Ni(r)),"cursor-straight":ni(Ni(r)),"cursor-arrow":ni(Ni(r)),"cursor-shape":ni(Ni(r))}),document.head.appendChild(Cr),()=>{Cr.parentNode!=null&&document.head.removeChild(Cr)}}const iw=new Set([C.ApplianceNames.rectangle,C.ApplianceNames.ellipse,C.ApplianceNames.straight,C.ApplianceNames.arrow,C.ApplianceNames.shape]);function Ku(e,t){if(e===C.ApplianceNames.pencil)return gh(t);if(e===C.ApplianceNames.eraser)return fh;if(iw.has(e))return Ni(t)}class nw{constructor(t,i,n,r){this.manager=t,this.memberId=i,this.cursorManager=n,this.wrapper=r,this.style="default",this.move=s=>{var o;if(s.type==="main"){const a=this.cursorManager.wrapperRect;this.component&&a&&(this.autoHidden(),this.moveCursor(s,a,this.manager.mainView))}else{const a=this.cursorManager.focusView,l=(o=a==null?void 0:a.divElement)==null?void 0:o.getBoundingClientRect(),u=a==null?void 0:a.camera;a&&l&&u&&this.component&&(this.autoHidden(),this.moveCursor(s,l,a))}},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(t,i,n){var l,u;const{x:r,y:s,type:o}=t,a=n==null?void 0:n.screen.convertPointToScreen(r,s);if(a){let c=a.x-2,d=a.y-18;if(this.isCustomIcon()&&(c-=11,d+=4),o==="app"){const m=this.cursorManager.wrapperRect;m&&(c=c+i.x-m.x,d=d+i.y-m.y)}a.x<0||a.x>i.width||a.y<0||a.y>i.height?(l=this.component)==null||l.$set({visible:!1,x:c,y:d}):(u=this.component)==null||u.$set({visible:!0,x:c,y:d})}}get memberApplianceName(){var t,i;return(i=(t=this.member)==null?void 0:t.memberState)==null?void 0:i.currentApplianceName}get memberColor(){var i,n;return`rgb(${(n=(i=this.member)==null?void 0:i.memberState)==null?void 0:n.strokeColor.join(",")})`}get memberColorHex(){var r,s;const[t,i,n]=((s=(r=this.member)==null?void 0:r.memberState)==null?void 0:s.strokeColor)||[236,52,85];return((1<<24)+(t<<16)+(i<<8)+n).toString(16).slice(1)}get payload(){var t;return(t=this.member)==null?void 0:t.payload}get memberCursorName(){var t,i;return((t=this.payload)==null?void 0:t.nickName)||((i=this.payload)==null?void 0:i.cursorName)||this.memberId}get memberTheme(){var t;return(t=this.payload)!=null&&t.theme?"netless-window-manager-cursor-inner-mellow":"netless-window-manager-cursor-inner"}get memberCursorTextColor(){var t;return((t=this.payload)==null?void 0:t.cursorTextColor)||"#FFFFFF"}get memberCursorTagBackgroundColor(){var t;return((t=this.payload)==null?void 0:t.cursorTagBackgroundColor)||this.memberColor}get memberAvatar(){var t;return(t=this.payload)==null?void 0:t.avatar}get memberOpacity(){return!this.memberCursorName&&!this.memberAvatar?0:1}get memberTagName(){var t;return(t=this.payload)==null?void 0:t.cursorTagName}autoHidden(){this.timer&&clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.hide()},1e3*10)}async createCursor(){this.member&&this.wrapper&&(this.component=new qv({target:this.wrapper,props:this.initProps()}))}initProps(){var t;return{uid:this.memberId,x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),custom:this.isCustomIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName,pencilEraserSize:(t=this.member)==null?void 0:t.memberState.pencilEraserSize}}getIcon(){var l;if(!this.member)return;const{memberApplianceName:t,memberColorHex:i}=this,{userApplianceIcons:n,applianceIcons:r}=this.cursorManager;let s=this.memberApplianceName;s===C.ApplianceNames.pencilEraser&&(s=`${s}${((l=this.member)==null?void 0:l.memberState.pencilEraserSize)||1}`);const o=s&&n[s];if(o)return o;if(this.style==="custom"&&t){const u=Ku(t,i);if(u)return u}return r[s||C.ApplianceNames.shape]||r[C.ApplianceNames.shape]}isCustomIcon(){var o;if(!this.member)return!1;const{memberApplianceName:t,memberColorHex:i}=this,{userApplianceIcons:n}=this.cursorManager;let r=this.memberApplianceName;return r===C.ApplianceNames.pencilEraser&&(r=`${r}${((o=this.member)==null?void 0:o.memberState.pencilEraserSize)||1}`),r&&n[r]?!1:!!(this.style==="custom"&&t&&Ku(t,i))}updateMember(){return this.member=Fo(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var t;(t=this.component)==null||t.$set(E.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 rw="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==",sw="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==",ow="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=",aw="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",lw="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",uw="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",cw="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMjYiIHZpZXdCb3g9IjAgMCAxOCAyNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIxNyIgaGVpZ2h0PSIyNSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",dw="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMzQiIHZpZXdCb3g9IjAgMCAyNiAzNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIyNSIgaGVpZ2h0PSIzMyIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K",hw="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iNTAiIHZpZXdCb3g9IjAgMCAzNCA1MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIzMyIgaGVpZ2h0PSI0OSIgcng9IjMuNSIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC4zNSIgc3Ryb2tlPSJ3aGl0ZSIvPgo8L3N2Zz4K";const pw={[C.ApplianceNames.pencil]:rw,[C.ApplianceNames.selector]:sw,[C.ApplianceNames.eraser]:ow,[C.ApplianceNames.shape]:aw,[C.ApplianceNames.text]:lw,[C.ApplianceNames.laserPointer]:uw,pencilEraser1:cw,pencilEraser2:dw,pencilEraser3:hw},qu="local-cursor";class fw{constructor(t,i,n,r){var a;this.manager=t,this.enableCursor=i,this.cursorInstances=new Map,this.userApplianceIcons={},this.sideEffectManager=new er,this.store=this.manager.store,this.leaveFlag=!0,this._style="default",this.onCursorMove=l=>{const u=this.initCursorInstance(l.uid);if(l.state===Uo.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 nw(this.manager,l,this,Y.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,Y.supportAppliancePlugin&&C.isRoom(Y.displayer)&&Y.displayer.disableDeviceInputs){this.leaveFlag&&(this.manager.dispatchInternalEvent(K.CursorMove,{uid:this.manager.uid,state:Uo.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 d=(m=l==null?void 0:l.divElement)==null?void 0:m.getBoundingClientRect();if(d)return l==null?void 0:l.convertToPointInWorld({x:u-d.x,y:c-d.y})},this.getType=l=>{var d;const u=l.target,c=this.manager.focusApp;switch(u.parentElement){case this.mainViewElement:return{type:"main"};case((d=c==null?void 0:c.view)==null?void 0:d.divElement):return{type:"app"};default:return{type:"main"}}},this.roomMembers=(a=this.manager.room)==null?void 0:a.state.roomMembers;const s=Y.wrapper;s&&this.setupWrapper(s),this.sideEffectManager.add(()=>B.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>B.on("playgroundSizeChange",()=>this.updateContainerRect()));const o=this.manager.room;o&&this.sideEffectManager.add(()=>{const l=u=>{this.style==="custom"&&u.memberState&&this.enableCustomCursor()};return o.callbacks.on("onRoomStateChanged",l),()=>o.callbacks.off("onRoomStateChanged",l)}),r&&(this.userApplianceIcons=r),this.style=(n==null?void 0:n.style)||"default"}get applianceIcons(){return q(q({},pw),this.userApplianceIcons)}get style(){return this._style}set style(t){this._style!==t&&(this._style=t,this.cursorInstances.forEach(i=>{i.setStyle(t)}),t==="custom"?this.enableCustomCursor():this.sideEffectManager.flush(qu))}enableCustomCursor(){this.sideEffectManager.add(()=>tw(this.manager.getMemberState()),qu)}canMoveCursor(t){const i=(t==null?void 0:t.memberState.currentApplianceName)===C.ApplianceNames.laserPointer;return this.enableCursor||i}setupWrapper(t){this.sideEffectManager.add(()=>(t.addEventListener("pointerenter",this.mouseMoveListener),t.addEventListener("pointermove",this.mouseMoveListener),t.addEventListener("pointerleave",this.mouseLeaveListener),()=>{t.removeEventListener("pointerenter",this.mouseMoveListener),t.removeEventListener("pointermove",this.mouseMoveListener),t.removeEventListener("pointerleave",this.mouseLeaveListener)})),this.wrapperRect=t.getBoundingClientRect()}setMainViewDivElement(t){this.mainViewElement=t}get boxState(){return this.store.getBoxState()}get focusView(){var t;return(t=this.manager.focusApp)==null?void 0:t.view}showPencilEraserIfNeeded(t,i,n){const r=Fo(this.manager.room,this.manager.uid),s=(r==null?void 0:r.memberState.currentApplianceName)===C.ApplianceNames.pencilEraser;if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)&&s){const o=t.type==="main"?this.manager.mainView:this.focusView,a=this.getPoint(o,i,n);a&&this.onCursorMove({uid:this.manager.uid,position:{x:a.x,y:a.y,type:t.type}})}}updateCursor(t,i,n){const r=Fo(this.manager.room,this.manager.uid);if(this.wrapperRect&&this.manager.canOperate&&this.canMoveCursor(r)){const s=t.type==="main"?this.manager.mainView:this.focusView,o=this.getPoint(s,i,n);o&&this.manager.dispatchInternalEvent(K.CursorMove,{uid:this.manager.uid,position:{x:o.x,y:o.y,type:t.type}})}}updateContainerRect(){var t,i;this.containerRect=(t=Y.container)==null?void 0:t.getBoundingClientRect(),this.wrapperRect=(i=Y.wrapper)==null?void 0:i.getBoundingClientRect()}deleteCursor(t){this.store.cleanCursor(t);const i=this.cursorInstances.get(t);i&&i.destroy()}hideCursor(t){const i=this.cursorInstances.get(t);i&&i.hide()}destroy(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach(t=>{t.destroy()}),this.cursorInstances.clear())}}class gw{constructor(t){this.manager=t,B.on("changePageState",()=>{Q.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 mw{constructor(t){this.ctx=t,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=async i=>{var n,r;i===C.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===C.RoomPhase.Connected&&this.phase===C.RoomPhase.Reconnecting&&((n=this.room)!=null&&n.isWritable?(r=this.room)==null||r.dispatchMagixEvent(lo,{}):(await zd(500),this.onReconnected())),this.phase=i},this.onReconnected=E.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{nt("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,n)=>{E.isFunction(i)&&this.disposers.set(n,i())}),this.ctx.emitter.emit("onReconnected")}}setRoom(t){this.room=t,this.phase=t==null?void 0:t.phase,t&&(t.callbacks.off("onPhaseChanged",this.onPhaseChanged),t.callbacks.on("onPhaseChanged",this.onPhaseChanged),t.addMagixEventListener(lo,i=>{i.authorId===t.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(t){this.ctx=t}releaseDisposers(){this.disposers.forEach(t=>{E.isFunction(t)&&t()}),this.disposers.clear()}refresh(){this._onReconnected()}add(t,i){const n=this.disposers.get(t);n&&E.isFunction(n)&&n(),E.isFunction(i)&&(this.reactors.set(t,i),this.disposers.set(t,i()))}remove(t){this.reactors.has(t)&&this.reactors.delete(t);const i=this.disposers.get(t);i&&(E.isFunction(i)&&i(),this.disposers.delete(t))}hasReactor(t){return this.reactors.has(t)}destroy(){var t,i;(t=this.room)==null||t.callbacks.off("onPhaseChanged",this.onPhaseChanged),(i=this.room)==null||i.removeMagixEventListener(lo,this.onReconnected),this.releaseDisposers()}}const vw=(e,t)=>{if(C.isPlayer(e))yw(e);else{if(e=e,Object.getOwnPropertyDescriptor(e,"disableCameraTransform"))return;Object.defineProperty(e,"disableCameraTransform",{get(){return t.mainView.disableCameraTransform},set(n){t.mainView.disableCameraTransform=n}}),Object.defineProperty(e,"canUndoSteps",{get(){return t.canUndoSteps}}),Object.defineProperty(e,"canRedoSteps",{get(){return t.canRedoSteps}}),e.moveCamera=n=>t.moveCamera(n),e.moveCameraToContain=(...n)=>t.moveCameraToContain(...n),e.convertToPointInWorld=(...n)=>t.mainView.convertToPointInWorld(...n),e.setCameraBound=(...n)=>t.mainView.setCameraBound(...n),e.scenePreview=(...n)=>t.mainView.scenePreview(...n),e.fillSceneSnapshot=(...n)=>t.mainView.fillSceneSnapshot(...n),e.generateScreenshot=(...n)=>t.mainView.generateScreenshot(...n),e.setMemberState=(...n)=>t.mainView.setMemberState(...n),e.redo=()=>t.redo(),e.undo=()=>t.undo(),e.cleanCurrentScene=()=>t.cleanCurrentScene(),e.delete=()=>t.delete(),e.copy=()=>t.copy(),e.paste=()=>t.paste(),e.duplicate=()=>t.duplicate(),e.insertImage=(...n)=>t.insertImage(...n),e.completeImageUpload=(...n)=>t.completeImageUpload(...n),e.insertText=(...n)=>t.insertText(...n),e.lockImage=(...n)=>t.lockImage(...n),e.lockImages=(...n)=>t.lockImages(...n),ww(e,t)}},ww=(e,t)=>{const i=e.removeScenes;e.removeScenes=(n,r)=>{var o;n===_e&&((o=t.appManager)==null||o.updateRootDirRemoving(!0));const s=i.call(e,n);return B.emit("removeScenes",{scenePath:n,index:r}),s}},yw=e=>{const t=e.seekToProgressTime;async function i(n){await B.emit("seekStart");const r=await t.call(e,n);return B.emit("seek",n),r}e.seekToProgressTime=i};var xw=`.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}
30
- `;const Sw=(e,t,i,n)=>{if(i==="length"||i==="prototype"||i==="arguments"||i==="caller")return;const r=Object.getOwnPropertyDescriptor(e,i),s=Object.getOwnPropertyDescriptor(t,i);!Mw(r,s)&&n||Object.defineProperty(e,i,s)},Mw=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Cw=(e,t)=>{const i=Object.getPrototypeOf(t);i!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,i)},Iw=(e,t)=>`/* Wrapped ${e}*/
31
- ${t}`,bw=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Aw=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Ew=(e,t,i)=>{const n=i===""?"":`with ${i.trim()}() `,r=Iw.bind(null,n,t.toString());Object.defineProperty(r,"name",Aw),Object.defineProperty(e,"toString",Re(q({},bw),{value:r}))};function Tw(e,t,{ignoreNonConfigurable:i=!1}={}){const{name:n}=e;for(const r of Reflect.ownKeys(t))Sw(e,t,r,i);return Cw(e,t),Ew(e,t,n),e}const kw=(e,t={})=>{if(typeof e!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);const{wait:i=0,maxWait:n=Number.POSITIVE_INFINITY,before:r=!1,after:s=!0}=t;if(!r&&!s)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let o,a,l;const u=function(...c){const d=this,m=()=>{o=void 0,a&&(clearTimeout(a),a=void 0),s&&(l=e.apply(d,c))},w=()=>{a=void 0,o&&(clearTimeout(o),o=void 0),s&&(l=e.apply(d,c))},v=r&&!o;return clearTimeout(o),o=setTimeout(m,i),n>0&&n!==Number.POSITIVE_INFINITY&&!a&&(a=setTimeout(w,n)),v&&(l=e.apply(d,c)),l};return Tw(u,e),u.cancel=()=>{o&&(clearTimeout(o),o=void 0),a&&(clearTimeout(a),a=void 0)},u};var Pw="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Nw=87,Dw=20,ec=[],zw=()=>{for(let e=0;e<Dw;e++)ec[e]=Pw.charAt(Math.random()*Nw);return ec.join("")};function mh(e){try{return e()}catch(t){console.error(t)}}var Ws=class{constructor(){this.push=this.addDisposer,this.disposers=new Map}addDisposer(e,t=this.genUID()){return this.flush(t),this.disposers.set(t,Array.isArray(e)?Lw(e):e),t}add(e,t=this.genUID()){const i=e();return i?this.addDisposer(i,t):t}addEventListener(e,t,i,n,r=this.genUID()){return e.addEventListener(t,i,n),this.addDisposer(()=>e.removeEventListener(t,i,n),r),r}setTimeout(e,t,i=this.genUID()){const n=window.setTimeout(()=>{this.remove(i),e()},t);return this.addDisposer(()=>window.clearTimeout(n),i)}setInterval(e,t,i=this.genUID()){const n=window.setInterval(e,t);return this.addDisposer(()=>window.clearInterval(n),i)}remove(e){const t=this.disposers.get(e);return this.disposers.delete(e),t}flush(e){const t=this.remove(e);t&&t()}flushAll(){this.disposers.forEach(mh),this.disposers.clear()}genUID(){let e;do e=zw();while(this.disposers.has(e));return e}};function Lw(e){return()=>e.forEach(mh)}var di=[],Rw=function(){return di.some(function(e){return e.activeTargets.length>0})},jw=function(){return di.some(function(e){return e.skippedTargets.length>0})},tc="ResizeObserver loop completed with undelivered notifications.",Bw=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:tc}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=tc),window.dispatchEvent(e)},Wn;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Wn||(Wn={}));var hi=function(e){return Object.freeze(e)},_w=function(){function e(t,i){this.inlineSize=t,this.blockSize=i,hi(this)}return e}(),vh=function(){function e(t,i,n,r){return this.x=t,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,hi(this)}return e.prototype.toJSON=function(){var t=this,i=t.x,n=t.y,r=t.top,s=t.right,o=t.bottom,a=t.left,l=t.width,u=t.height;return{x:i,y:n,top:r,right:s,bottom:o,left:a,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),fl=function(e){return e instanceof SVGElement&&"getBBox"in e},wh=function(e){if(fl(e)){var t=e.getBBox(),i=t.width,n=t.height;return!i&&!n}var r=e,s=r.offsetWidth,o=r.offsetHeight;return!(s||o||e.getClientRects().length)},ic=function(e){var t;if(e instanceof Element)return!0;var i=(t=e==null?void 0:e.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(i&&e instanceof i.Element)},Vw=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Pn=typeof window!="undefined"?window:{},Ir=new WeakMap,nc=/auto|scroll/,Ow=/^tb|vertical/,Uw=/msie|trident/i.test(Pn.navigator&&Pn.navigator.userAgent),ut=function(e){return parseFloat(e||"0")},Oi=function(e,t,i){return e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=!1),new _w((i?t:e)||0,(i?e:t)||0)},rc=hi({devicePixelContentBoxSize:Oi(),borderBoxSize:Oi(),contentBoxSize:Oi(),contentRect:new vh(0,0,0,0)}),yh=function(e,t){if(t===void 0&&(t=!1),Ir.has(e)&&!t)return Ir.get(e);if(wh(e))return Ir.set(e,rc),rc;var i=getComputedStyle(e),n=fl(e)&&e.ownerSVGElement&&e.getBBox(),r=!Uw&&i.boxSizing==="border-box",s=Ow.test(i.writingMode||""),o=!n&&nc.test(i.overflowY||""),a=!n&&nc.test(i.overflowX||""),l=n?0:ut(i.paddingTop),u=n?0:ut(i.paddingRight),c=n?0:ut(i.paddingBottom),d=n?0:ut(i.paddingLeft),m=n?0:ut(i.borderTopWidth),w=n?0:ut(i.borderRightWidth),v=n?0:ut(i.borderBottomWidth),x=n?0:ut(i.borderLeftWidth),h=d+u,p=l+c,f=x+w,g=m+v,y=a?e.offsetHeight-g-e.clientHeight:0,S=o?e.offsetWidth-f-e.clientWidth:0,T=r?h+f:0,N=r?p+g:0,k=n?n.width:ut(i.width)-T-S,P=n?n.height:ut(i.height)-N-y,ne=k+h+S+f,b=P+p+y+g,I=hi({devicePixelContentBoxSize:Oi(Math.round(k*devicePixelRatio),Math.round(P*devicePixelRatio),s),borderBoxSize:Oi(ne,b,s),contentBoxSize:Oi(k,P,s),contentRect:new vh(d,l,k,P)});return Ir.set(e,I),I},xh=function(e,t,i){var n=yh(e,i),r=n.borderBoxSize,s=n.contentBoxSize,o=n.devicePixelContentBoxSize;switch(t){case Wn.DEVICE_PIXEL_CONTENT_BOX:return o;case Wn.BORDER_BOX:return r;default:return s}},Ww=function(){function e(t){var i=yh(t);this.target=t,this.contentRect=i.contentRect,this.borderBoxSize=hi([i.borderBoxSize]),this.contentBoxSize=hi([i.contentBoxSize]),this.devicePixelContentBoxSize=hi([i.devicePixelContentBoxSize])}return e}(),Sh=function(e){if(wh(e))return 1/0;for(var t=0,i=e.parentNode;i;)t+=1,i=i.parentNode;return t},Hw=function(){var e=1/0,t=[];di.forEach(function(o){if(o.activeTargets.length!==0){var a=[];o.activeTargets.forEach(function(u){var c=new Ww(u.target),d=Sh(u.target);a.push(c),u.lastReportedSize=xh(u.target,u.observedBox),d<e&&(e=d)}),t.push(function(){o.callback.call(o.observer,a,o.observer)}),o.activeTargets.splice(0,o.activeTargets.length)}});for(var i=0,n=t;i<n.length;i++){var r=n[i];r()}return e},sc=function(e){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()&&(Sh(r.target)>e?i.activeTargets.push(r):i.skippedTargets.push(r))})})},$w=function(){var e=0;for(sc(e);Rw();)e=Hw(),sc(e);return jw()&&Bw(),e>0},xo,Mh=[],Fw=function(){return Mh.splice(0).forEach(function(e){return e()})},Qw=function(e){if(!xo){var t=0,i=document.createTextNode(""),n={characterData:!0};new MutationObserver(function(){return Fw()}).observe(i,n),xo=function(){i.textContent="".concat(t?t--:t++)}}Mh.push(e),xo()},Zw=function(e){Qw(function(){requestAnimationFrame(e)})},$r=0,Yw=function(){return!!$r},Gw=250,Xw={attributes:!0,characterData:!0,childList:!0,subtree:!0},oc=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],ac=function(e){return e===void 0&&(e=0),Date.now()+e},So=!1,Jw=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var i=this;if(t===void 0&&(t=Gw),!So){So=!0;var n=ac(t);Zw(function(){var r=!1;try{r=$w()}finally{if(So=!1,t=n-ac(),!Yw())return;r?i.run(1e3):t>0?i.run(t):i.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,i=function(){return t.observer&&t.observer.observe(document.body,Xw)};document.body?i():Pn.addEventListener("DOMContentLoaded",i)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),oc.forEach(function(i){return Pn.addEventListener(i,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),oc.forEach(function(i){return Pn.removeEventListener(i,t.listener,!0)}),this.stopped=!0)},e}(),ta=new Jw,lc=function(e){!$r&&e>0&&ta.start(),$r+=e,!$r&&ta.stop()},Kw=function(e){return!fl(e)&&!Vw(e)&&getComputedStyle(e).display==="inline"},qw=function(){function e(t,i){this.target=t,this.observedBox=i||Wn.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=xh(this.target,this.observedBox,!0);return Kw(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),ey=function(){function e(t,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=i}return e}(),br=new WeakMap,uc=function(e,t){for(var i=0;i<e.length;i+=1)if(e[i].target===t)return i;return-1},Ar=function(){function e(){}return e.connect=function(t,i){var n=new ey(t,i);br.set(t,n)},e.observe=function(t,i,n){var r=br.get(t),s=r.observationTargets.length===0;uc(r.observationTargets,i)<0&&(s&&di.push(r),r.observationTargets.push(new qw(i,n&&n.box)),lc(1),ta.schedule())},e.unobserve=function(t,i){var n=br.get(t),r=uc(n.observationTargets,i),s=n.observationTargets.length===1;r>=0&&(s&&di.splice(di.indexOf(n),1),n.observationTargets.splice(r,1),lc(-1))},e.disconnect=function(t){var i=this,n=br.get(t);n.observationTargets.slice().forEach(function(r){return i.unobserve(t,r.target)}),n.activeTargets.splice(0,n.activeTargets.length)},e}(),ty=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Ar.connect(this,t)}return e.prototype.observe=function(t,i){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ic(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ar.observe(this,t,i)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ic(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ar.unobserve(this,t)},e.prototype.disconnect=function(){Ar.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function iy(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-sidebar`),i.setAttribute("viewBox","0 0 64 64");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),i.appendChild(n),i}function ny(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-arrow-left`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),i.appendChild(n),i}function ry(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-arrow-right`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),i.appendChild(n),i}function sy(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-play`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),i.appendChild(n),i}function oy(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-pause`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),i.appendChild(n),i}const qt=typeof window!="undefined",Ch=qt&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Ih=qt&&"IntersectionObserver"in window,bh=qt&&"classList"in document.createElement("p"),Ah=qt&&window.devicePixelRatio>1,ay={elements_selector:".lazy",container:Ch||qt?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},Eh=e=>Object.assign({},ay,e),cc=function(e,t){let i;const n="LazyLoad::Initialized",r=new e(t);try{i=new CustomEvent(n,{detail:{instance:r}})}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent(n,!1,!1,{instance:r})}window.dispatchEvent(i)},ly=(e,t)=>{if(!!t)if(!t.length)cc(e,t);else for(let i=0,n;n=t[i];i+=1)cc(e,n)},Pt="src",gl="srcset",ml="sizes",Th="poster",nr="llOriginalAttrs",kh="data",vl="loading",Ph="loaded",Nh="applied",uy="entered",wl="error",Dh="native",zh="data-",Lh="ll-status",Pe=(e,t)=>e.getAttribute(zh+t),cy=(e,t,i)=>{const n=zh+t;if(i===null){e.removeAttribute(n);return}e.setAttribute(n,i)},rr=e=>Pe(e,Lh),bi=(e,t)=>cy(e,Lh,t),Hs=e=>bi(e,null),yl=e=>rr(e)===null,dy=e=>rr(e)===vl,hy=e=>rr(e)===wl,xl=e=>rr(e)===Dh,py=[vl,Ph,Nh,wl],fy=e=>py.indexOf(rr(e))>=0,ei=(e,t,i,n)=>{if(!(!e||typeof e!="function")){if(n!==void 0){e(t,i,n);return}if(i!==void 0){e(t,i);return}e(t)}},nn=(e,t)=>{if(t!==""){if(bh){e.classList.add(t);return}e.className+=(e.className?" ":"")+t}},dt=(e,t)=>{if(t!==""){if(bh){e.classList.remove(t);return}e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")}},gy=e=>{e.llTempImage=document.createElement("IMG")},my=e=>{delete e.llTempImage},Rh=e=>e.llTempImage,$s=(e,t)=>{if(!t)return;const i=t._observer;!i||i.unobserve(e)},vy=e=>{e.disconnect()},wy=(e,t,i)=>{t.unobserve_entered&&$s(e,i)},Sl=(e,t)=>{!e||(e.loadingCount+=t)},yy=e=>{!e||(e.toLoadCount-=1)},jh=(e,t)=>{!e||(e.toLoadCount=t)},xy=e=>e.loadingCount>0,Sy=e=>e.toLoadCount>0,Bh=e=>{let t=[];for(let i=0,n;n=e.children[i];i+=1)n.tagName==="SOURCE"&&t.push(n);return t},Ml=(e,t)=>{const i=e.parentNode;if(!i||i.tagName!=="PICTURE")return;Bh(i).forEach(t)},_h=(e,t)=>{Bh(e).forEach(t)},Fs=[Pt],Vh=[Pt,Th],Hn=[Pt,gl,ml],Oh=[kh],Qs=e=>!!e[nr],Uh=e=>e[nr],Wh=e=>delete e[nr],Yi=(e,t)=>{if(Qs(e))return;const i={};t.forEach(n=>{i[n]=e.getAttribute(n)}),e[nr]=i},My=e=>{Qs(e)||(e[nr]={backgroundImage:e.style.backgroundImage})},Cy=(e,t,i)=>{if(!i){e.removeAttribute(t);return}e.setAttribute(t,i)},yi=(e,t)=>{if(!Qs(e))return;const i=Uh(e);t.forEach(n=>{Cy(e,n,i[n])})},Iy=e=>{if(!Qs(e))return;const t=Uh(e);e.style.backgroundImage=t.backgroundImage},Hh=(e,t,i)=>{nn(e,t.class_applied),bi(e,Nh),i&&(t.unobserve_completed&&$s(e,t),ei(t.callback_applied,e,i))},$h=(e,t,i)=>{nn(e,t.class_loading),bi(e,vl),i&&(Sl(i,1),ei(t.callback_loading,e,i))},Wt=(e,t,i)=>{!i||e.setAttribute(t,i)},dc=(e,t)=>{Wt(e,ml,Pe(e,t.data_sizes)),Wt(e,gl,Pe(e,t.data_srcset)),Wt(e,Pt,Pe(e,t.data_src))},by=(e,t)=>{Ml(e,i=>{Yi(i,Hn),dc(i,t)}),Yi(e,Hn),dc(e,t)},Ay=(e,t)=>{Yi(e,Fs),Wt(e,Pt,Pe(e,t.data_src))},Ey=(e,t)=>{_h(e,i=>{Yi(i,Fs),Wt(i,Pt,Pe(i,t.data_src))}),Yi(e,Vh),Wt(e,Th,Pe(e,t.data_poster)),Wt(e,Pt,Pe(e,t.data_src)),e.load()},Ty=(e,t)=>{Yi(e,Oh),Wt(e,kh,Pe(e,t.data_src))},ky=(e,t,i)=>{const n=Pe(e,t.data_bg),r=Pe(e,t.data_bg_hidpi),s=Ah&&r?r:n;!s||(e.style.backgroundImage=`url("${s}")`,Rh(e).setAttribute(Pt,s),$h(e,t,i))},Py=(e,t,i)=>{const n=Pe(e,t.data_bg_multi),r=Pe(e,t.data_bg_multi_hidpi),s=Ah&&r?r:n;!s||(e.style.backgroundImage=s,Hh(e,t,i))},Ny=(e,t,i)=>{const n=Pe(e,t.data_bg_set);if(!n)return;const r=n.split("|");let s=r.map(o=>`image-set(${o})`);e.style.backgroundImage=s.join(),e.style.backgroundImage===""&&(s=r.map(o=>`-webkit-image-set(${o})`),e.style.backgroundImage=s.join()),Hh(e,t,i)},Fh={IMG:by,IFRAME:Ay,VIDEO:Ey,OBJECT:Ty},Dy=(e,t)=>{const i=Fh[e.tagName];!i||i(e,t)},zy=(e,t,i)=>{const n=Fh[e.tagName];!n||(n(e,t),$h(e,t,i))},Ly=["IMG","IFRAME","VIDEO","OBJECT"],Ry=e=>Ly.indexOf(e.tagName)>-1,Qh=(e,t)=>{t&&!xy(t)&&!Sy(t)&&ei(e.callback_finish,t)},hc=(e,t,i)=>{e.addEventListener(t,i),e.llEvLisnrs[t]=i},jy=(e,t,i)=>{e.removeEventListener(t,i)},Cl=e=>!!e.llEvLisnrs,By=(e,t,i)=>{Cl(e)||(e.llEvLisnrs={});const n=e.tagName==="VIDEO"?"loadeddata":"load";hc(e,n,t),hc(e,"error",i)},ia=e=>{if(!Cl(e))return;const t=e.llEvLisnrs;for(let i in t){const n=t[i];jy(e,i,n)}delete e.llEvLisnrs},Zh=(e,t,i)=>{my(e),Sl(i,-1),yy(i),dt(e,t.class_loading),t.unobserve_completed&&$s(e,i)},_y=(e,t,i,n)=>{const r=xl(t);Zh(t,i,n),nn(t,i.class_loaded),bi(t,Ph),ei(i.callback_loaded,t,n),r||Qh(i,n)},Vy=(e,t,i,n)=>{const r=xl(t);Zh(t,i,n),nn(t,i.class_error),bi(t,wl),ei(i.callback_error,t,n),i.restore_on_error&&yi(t,Hn),r||Qh(i,n)},Il=(e,t,i)=>{const n=Rh(e)||e;if(Cl(n))return;By(n,o=>{_y(o,e,t,i),ia(n)},o=>{Vy(o,e,t,i),ia(n)})},Oy=(e,t,i)=>{gy(e),Il(e,t,i),My(e),ky(e,t,i),Py(e,t,i),Ny(e,t,i)},Uy=(e,t,i)=>{Il(e,t,i),zy(e,t,i)},bl=(e,t,i)=>{Ry(e)?Uy(e,t,i):Oy(e,t,i)},Wy=(e,t,i)=>{e.setAttribute("loading","lazy"),Il(e,t,i),Dy(e,t),bi(e,Dh)},pc=e=>{e.removeAttribute(Pt),e.removeAttribute(gl),e.removeAttribute(ml)},Hy=e=>{Ml(e,t=>{pc(t)}),pc(e)},Yh=e=>{Ml(e,t=>{yi(t,Hn)}),yi(e,Hn)},$y=e=>{_h(e,t=>{yi(t,Fs)}),yi(e,Vh),e.load()},Fy=e=>{yi(e,Fs)},Qy=e=>{yi(e,Oh)},Zy={IMG:Yh,IFRAME:Fy,VIDEO:$y,OBJECT:Qy},Yy=e=>{const t=Zy[e.tagName];if(!t){Iy(e);return}t(e)},Gy=(e,t)=>{yl(e)||xl(e)||(dt(e,t.class_entered),dt(e,t.class_exited),dt(e,t.class_applied),dt(e,t.class_loading),dt(e,t.class_loaded),dt(e,t.class_error))},Xy=(e,t)=>{Yy(e),Gy(e,t),Hs(e),Wh(e)},Jy=(e,t,i,n)=>{!i.cancel_on_exit||!dy(e)||e.tagName==="IMG"&&(ia(e),Hy(e),Yh(e),dt(e,i.class_loading),Sl(n,-1),Hs(e),ei(i.callback_cancel,e,t,n))},Ky=(e,t,i,n)=>{const r=fy(e);bi(e,uy),nn(e,i.class_entered),dt(e,i.class_exited),wy(e,i,n),ei(i.callback_enter,e,t,n),!r&&bl(e,i,n)},qy=(e,t,i,n)=>{yl(e)||(nn(e,i.class_exited),Jy(e,t,i,n),ei(i.callback_exit,e,t,n))},e0=["IMG","IFRAME","VIDEO"],Gh=e=>e.use_native&&"loading"in HTMLImageElement.prototype,t0=(e,t,i)=>{e.forEach(n=>{e0.indexOf(n.tagName)!==-1&&Wy(n,t,i)}),jh(i,0)},i0=e=>e.isIntersecting||e.intersectionRatio>0,n0=e=>({root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),r0=(e,t,i)=>{e.forEach(n=>i0(n)?Ky(n.target,n,t,i):qy(n.target,n,t,i))},s0=(e,t)=>{t.forEach(i=>{e.observe(i)})},o0=(e,t)=>{vy(e),s0(e,t)},a0=(e,t)=>{!Ih||Gh(e)||(t._observer=new IntersectionObserver(i=>{r0(i,e,t)},n0(e)))},Xh=e=>Array.prototype.slice.call(e),us=e=>e.container.querySelectorAll(e.elements_selector),l0=e=>Xh(e).filter(yl),u0=e=>hy(e),c0=e=>Xh(e).filter(u0),fc=(e,t)=>l0(e||us(t)),d0=(e,t)=>{c0(us(e)).forEach(n=>{dt(n,e.class_error),Hs(n)}),t.update()},h0=(e,t)=>{!qt||(t._onlineHandler=()=>{d0(e,t)},window.addEventListener("online",t._onlineHandler))},p0=e=>{!qt||window.removeEventListener("online",e._onlineHandler)},sr=function(e,t){const i=Eh(e);this._settings=i,this.loadingCount=0,a0(i,this),h0(i,this),this.update(t)};sr.prototype={update:function(e){const t=this._settings,i=fc(e,t);if(jh(this,i.length),Ch||!Ih){this.loadAll(i);return}if(Gh(t)){t0(i,t,this);return}o0(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),p0(this),us(this._settings).forEach(e=>{Wh(e)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){const t=this._settings;fc(e,t).forEach(n=>{$s(n,this),bl(n,t,this)})},restoreAll:function(){const e=this._settings;us(e).forEach(t=>{Xy(t,e)})}};sr.load=(e,t)=>{const i=Eh(t);bl(e,i)};sr.resetStatus=e=>{Hs(e)};qt&&ly(sr,window.lazyLoadOptions);class Jh{constructor({readonly:t,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 Ws,n.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=t,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 t=new sr({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>t.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.$content.classList.toggle(this.wrapClassName("readonly"),t),this.$footer.classList.toggle(this.wrapClassName("readonly"),t),this.$pageNumberInput.disabled=t)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(t){Number.isNaN(t)||(this.pageIndex=t,this.$pageNumberInput.value=String(t+1),this.onPageIndexChanged(t))}setSmallBox(t){this.isSmallBox!==t&&(this.isSmallBox=t,this.$footer.classList.toggle(this.wrapClassName("float-footer"),t))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const t=document.createElement("div");t.className=this.wrapClassName("content"),this.$content=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),t.appendChild(this.renderPreviewMask()),t.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const t=document.createElement("div");t.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=t;const i=this.wrapClassName("preview-page"),n=this.wrapClassName("preview-page-name");this.pages.forEach((r,s)=>{var o;const a=(o=r.thumbnail)!=null?o:r.src.startsWith("ppt")?void 0:r.src;if(!a)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 d=document.createElement("img");d.width=r.width,d.height=r.height,d.dataset.src=a,d.dataset.pageIndex=l,u.appendChild(d),u.appendChild(c),t.appendChild(u)}),this.sideEffect.addEventListener(t,"click",r=>{var s;if(this.readonly)return;const o=(s=r.target.dataset)==null?void 0:s.pageIndex;o&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(o)),this.togglePreview(!1))})}return this.$preview}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",t=>{this.readonly||t.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const t=document.createElement("div");if(t.className=this.wrapClassName("footer"),this.$footer=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&t.classList.add(this.wrapClassName("float-footer")),this.pages.some(l=>l.thumbnail||!l.src.startsWith("ppt"))){const l=this.renderFooterBtn("btn-sidebar",iy(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",ny(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",sy(this.namespace),oy(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",ry(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 o=document.createElement("input");o.className=this.wrapClassName("page-number-input"),o.value=String(this.pageIndex+1),this.readonly&&(o.disabled=!0),this.$pageNumberInput=o,this.sideEffect.addEventListener(o,"focus",()=>{o.select()}),this.sideEffect.addEventListener(o,"change",()=>{this.readonly||o.value&&this.onNewPageIndex(Number(o.value)-1)});const a=document.createElement("span");a.textContent=" / "+this.pages.length,s.appendChild(o),s.appendChild(a),this.$footer.appendChild(i),this.$footer.appendChild(s)}return this.$footer}renderFooterBtn(t,i,n){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(t),r.appendChild(i),n&&r.appendChild(n),r}togglePreview(t){if(this.isShowPreview=t!=null?t:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const i=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));i&&this.$preview.scrollTo({top:i.offsetTop-16})}}wrapClassName(t){return`${this.namespace}-${t}`}}function Gi(e,t,i){return Math.min(Math.max(e,t),i)}function gc(e){return e.touches?e.touches[0]:e}function Kh(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function qh(e){if(!e)return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"}class f0{constructor(t){var i,n,r;this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=s=>{if(this.paused)return;let o=Math.floor((s-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=s;o-- >0;)this.stepper();this.onStep(this.current,this),!this.paused&&this.current!==this.target&&window.requestAnimationFrame(this.looper)},this.current=(i=t.start)!=null?i:0,this.target=this.current,this.stiffness=(n=t.stiffness)!=null?n:170,this.damping=(r=t.damping)!=null?r:26,this.onStep=t.onStep}stepTo(t,i){this.paused&&i!=null&&(this.current=i),this.paused=!1,this.target=t,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}pause(){this.paused=!0}destroy(){this.pause()}stepper(){const t=-this.stiffness*(this.current-this.target),i=-this.damping*this.velocity,n=this.velocity+(t+i)/60,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 g0{constructor(t,i,n,r){this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=t,this.page=i,this.scale=n,this.pageOffsetX=(r-i.width)/2;const s=document.createElement("div");s.className="page-renderer-page",s.dataset.index=`${t}`,s.style.width=`${i.width*n}px`,s.style.height=`${i.height*n}px`,i.thumbnail&&(s.style.backgroundImage=`url("${i.thumbnail}")`);const o=document.createElement("img");o.className="page-renderer-page-img",o.width=i.width,o.height=i.height,o.src=i.src,s.appendChild(o),this.$page=s}translateY(t){Math.abs(t-this.pageOffsetY)>=.001&&(this.pageOffsetY=t,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setScale(t){Math.abs(t-this.scale)>=.001&&(this.scale=t,this.$page.style.width=`${this.page.width*this.scale}px`,this.$page.style.height=`${this.page.height*this.scale}px`,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setVisible(t){t!==this.visible&&(this.visible=t,this.$page.style.opacity=t?"1":"0")}}const m0=window.requestIdleCallback||(e=>window.setTimeout(e,5e3)),v0=window.cancelIdleCallback||window.clearTimeout;class w0{constructor(t,i,n){this.pages=t,this.pagesIntrinsicWidth=i,this.scale=n,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{if(this.gcTimer=null,this.els.size>this.maxElCount){const r=[...this.els.values()].sort((s,o)=>o.lastVisit-s.lastVisit);for(let s=Math.floor(this.maxElCount/4);s<r.length;s++)this.els.delete(r[s].index)}}}getEl(t){let i=this.els.get(t);return i||(i=new g0(t,this.pages[t],this.scale,this.pagesIntrinsicWidth),this.els.set(t,i)),i.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=m0(this.gc)),i}setScale(t){t!==this.scale&&(this.scale=t,this.els.forEach(i=>i.setScale(t)))}destroy(){this.els.clear(),this.gcTimer!==null&&(v0(this.gcTimer),this.gcTimer=null)}}class y0{constructor(t){this._hwaTimeout=NaN,this._turnOffHWA=()=>{window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN,this.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=t.pagesScrollTop||0,this.containerWidth=t.containerWidth||1,this.containerHeight=t.containerHeight||1,this.pages=t.pages.map(s=>{if(s.thumbnail)return s;try{const o=new URL(s.src);return o.searchParams.set("x-oss-process","image/resize,l_50"),Re(q({},s),{thumbnail:o.toString()})}catch(o){return console.error(o),s}});const i=Array(this.pages.length);let n=1/0,r=0;this.pagesIntrinsicHeight=this.pages.reduce((s,o,a)=>(i[a]=s,o.width>r&&(r=o.width),o.height<=n&&(n=o.height),s+o.height),0),this.pagesIntrinsicWidth=r,this.pagesMinHeight=n,this.pagesIntrinsicYs=i,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=t.onPageIndexChanged,this.pageScrollIndex=0,this.pagesScrollTop!==0&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new w0(this.pages,r,this.scale),this.$pages=this.renderPages()}setContainerSize(t,i){t>0&&i>0&&(t!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=t,this.containerHeight=i,this.$pages.style.width=`${this.containerWidth}px`,this.$pages.style.height=`${this.containerHeight}px`,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.pageElManager.setScale(this.scale),this.$pages.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}renderPages(){const t=document.createElement("div");return t.className="page-renderer-pages-container",t.style.width=`${this.containerWidth}px`,t.style.height=`${this.containerHeight}px`,t}pagesScrollTo(t,i){if(t=Gi(t,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),i||Math.abs(t-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=t;const n=this.findScrollPageIndex(),r=Math.max(n-this.threshold,0),s=Math.min(n+this.threshold,this.pages.length-1);for(let o=0;o<this.$pages.children.length;o++){const a=this.$pages.children[o],l=Number(a.dataset.index);l>=r&&l<=s||(a.remove(),o--)}for(let o=r;o<=s;o++){const a=this.pageElManager.getEl(o);a.$page.parentElement!==this.$pages&&this.$pages.appendChild(a.$page),a.translateY(this.pagesIntrinsicYs[o]-this.pagesScrollTop)}n!==this.pageScrollIndex&&(this.pageScrollIndex=n,this.onPageIndexChanged&&this.onPageIndexChanged(n))}}findScrollPageIndex(){for(let t=0;t<this.pagesIntrinsicYs.length;t++)if(this.pagesIntrinsicYs[t]+this.pages[t].height-this.pagesScrollTop>=.001)return t;return this.pagesIntrinsicYs.length-1}mount(t){t.appendChild(this.$pages),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$pages.remove()}destroy(){this.unmount(),this.onPageIndexChanged=void 0,this.pageElManager.destroy(),this._hwaTimeout&&(window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN)}_calcScale(){return this.containerWidth/this.pagesIntrinsicWidth||1}_calcThreshold(){return Gi(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 x0=30;class S0{constructor(t){this.sideEffect=new Ws,this.pagesScrollTop=t.pagesScrollTop||0,this.containerWidth=t.containerWidth||1,this.containerHeight=t.containerHeight||1,this.pagesWidth=t.pagesWidth||1,this.pagesHeight=t.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=t.scrollbarMinHeight||x0,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=t.readonly,this.wrapClassName=t.wrapClassName,this.onDragScroll=t.onDragScroll,this.$scrollbar=this.renderScrollbar()}mount(t){t.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$scrollbar.remove()}setReadonly(t){this.readonly=t}setContainerSize(t,i){t>0&&i>0&&(t!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=t,this.containerHeight=i,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}pagesScrollTo(t,i){if(t=Gi(t,0,this.pagesHeight-this.containerHeight/this.scale),i||Math.abs(t-this.pagesScrollTop)>=.001){this.pagesScrollTop=t;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 t=document.createElement("button");t.className=this.wrapClassName("scrollbar"),t.style.minHeight=`${this.scrollbarMinHeight}px`,t.style.height=`${this.scrollbarHeight}px`;const i=n=>{if(this.readonly||n.button!=null&&n.button!==0)return;Kh(n);const r=this.wrapClassName("scrollbar-dragging");t.classList.toggle(r,!0);const s=this.pagesScrollTop,{clientY:o}=gc(n),a=u=>{if(this.readonly)return;const{clientY:c}=gc(u),d=(c-o)/this.scale;Math.abs(d)>0&&this.onDragScroll&&this.onDragScroll(s+d*(this.pagesHeight*this.scale/this.containerHeight))},l=()=>{t.classList.toggle(r,!1),window.removeEventListener("mousemove",a,!0),window.removeEventListener("touchmove",a,!0),window.removeEventListener("mouseup",l,!0),window.removeEventListener("touchend",l,!0),window.removeEventListener("touchcancel",l,!0)};window.addEventListener("mousemove",a,!0),window.addEventListener("touchmove",a,!0),window.addEventListener("mouseup",l,!0),window.addEventListener("touchend",l,!0),window.addEventListener("touchcancel",l,!0)};return this.sideEffect.addEventListener(t,"mousedown",i),this.sideEffect.addEventListener(t,"touchstart",i),t}_calcScale(){return this.containerWidth/this.pagesWidth||1}_calcScrollbarHeight(){return Gi(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}_updateScrollbarHeight(){const t=this._calcScrollbarHeight();Math.abs(t-this.scrollbarHeight)>.001&&(this.scrollbarHeight=t,this.$scrollbar.style.height=`${t}px`)}}const M0=window.ResizeObserver||ty,un=640;class C0{constructor({context:t,whiteboardView:i,readonly:n,box:r,pages:s,pageScrollTop:o=0,mountWhiteboard:a,onUserScroll:l,baseScenePath:u,appId:c}){this.sideEffect=new Ws,this.userScrolling=!1,this.docsViewReadonly=!1,this.onNewPageIndex=v=>{this.scrollToPage(v)},this.toPdf=async()=>{const v=document.createElement("canvas"),x=v.getContext("2d");if(!x||!this.baseScenePath){this.reportProgress(100,null);return}const h=this.whiteboardView.focusScenePath||`${this.baseScenePath}/1`,p=this.pages[0],{jsPDF:f}=await Promise.resolve().then(function(){return zg(require("jspdf"))}),g=new f({format:[p.width,p.height],orientation:p.width>p.height?"l":"p",compress:!0});for(const[S,T]of this.pages.entries()){const{width:N,height:k,src:P}=T;v.width=N,v.height=k;const ne=N>k?"l":"p";S>0&&g.addPage([N,k],ne);const b=await this.getBase64FromUrl(P),I=document.createElement("img");I.src=b,await new Promise(Je=>I.onload=Je),x.drawImage(I,0,0);const z=v.toDataURL("image/jpeg",.6);x.clearRect(0,0,N,k);const j={centerX:N/2,centerY:k/2+S*k,scale:1},F=this.context.manager.windowManger;F._appliancePlugin?await F._appliancePlugin.screenshotToCanvasAsync(x,h,N,k,j):this.whiteboardView.screenshotToCanvas(x,h,N,k,j);const le=v.toDataURL("image/png");g.addImage(z,"JPEG",0,0,N,k,"","FAST"),g.addImage(le,"PNG",0,0,N,k,"","FAST"),x.clearRect(0,0,N,k),Math.ceil((S+1)/this.pages.length*100)<100&&this.reportProgress(Math.ceil((S+1)/this.pages.length*100),null)}const y=g.output("arraybuffer");this.reportProgress(100,{pdf:y,title:this.box.title})},this.context=t,this.whiteboardView=i,this.readonly=n,this.box=r,this.pages=s,this.baseScenePath=u,this.appId=c,this.mountWhiteboard=a,this._onUserScroll=l;const d=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,d()},this.viewer=new Jh({readonly:n,box:r,pages:s,onNewPageIndex:this.onNewPageIndex});const{width:m,height:w}=this.whiteboardView.size;this.pageRenderer=new y0({pagesScrollTop:o,pages:this.pages,containerWidth:m,containerHeight:w,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new S0({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:v=>{this.pageScrollTo(v),this.updateUserScroll()}}),this.pageScrollStepper=new f0({start:this.pageRenderer.pagesScrollTop,onStep:v=>{this.pageScrollTo(v)}}),this.render()}setDocsViewReadonly(t){this.docsViewReadonly=t}mount(){this.viewer.mount(),this.setupScrollListener();const t=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const i=new M0(t);return i.observe(this.viewer.$content),()=>i.disconnect()}),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100),this.sideEffect.add(()=>{const i=n=>{n.data.type==="@netless/_request_save_pdf_"&&n.data.appId===this.appId&&this.toPdf().catch(()=>this.reportProgress(100,null))};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i)}}),this}unmount(){return this.viewer.unmount(),this}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t),this.scrollbar.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(t){!this.userScrolling&&t>=0&&Math.abs(this.pageRenderer.pagesScrollTop-t)>.01&&this.pageScrollStepper.stepTo(t,this.pageRenderer.pagesScrollTop)}render(){this.pageRenderer.mount(this.viewer.$content),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.scrollbar.mount(this.viewer.$content),this.renderRatioHeight()}renderRatioHeight(){const t=this.box.absoluteHeight,i=t<=un;if(this.viewer.setSmallBox(i),i){const n=26/un,r=26/t,s=26/un,o=0,a=Math.max((n+s-(r+o))/2,0);if(this.box.$titleBar){const l=r+a;this.box.$titleBar.style.height=`${l*100}%`}if(this.box.$footer){const l=o+a;this.box.$footer.style.height=`${l*100}%`}}else{if(this.box.$titleBar){const n=Math.max(26/un,26/t);this.box.$titleBar.style.height=`${n*100}%`}if(this.box.$footer){const n=Math.max(26/un,26/t);this.box.$footer.style.height=`${n*100}%`}}}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.mountWhiteboard(this.$whiteboardView),this.sideEffect.addEventListener(this.$whiteboardView,"wheel",t=>{Kh(t),this.readonly||(this.pageScrollTo(this.pageRenderer.pagesScrollTop+t.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",t=>{this.readonly||t.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}scrollTopPageToEl(t){return t*this.pageRenderer.scale}scrollTopElToPage(t){return t/this.pageRenderer.scale}elScrollTo(t){this.pageScrollTo(this.scrollTopElToPage(t))}pageScrollTo(t){const i=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:Gi(t+i,i,this.pageRenderer.pagesIntrinsicHeight-i),animationMode:"immediately"})}scrollToPage(t){if(!this.readonly&&!Number.isNaN(t)){const i=this.pageRenderer.pagesIntrinsicYs[t];i>=0&&(this.pageScrollTo(i+5/this.pageRenderer.scale),this.updateUserScroll())}}setupScrollListener(){this.sideEffect.add(()=>{const t=i=>{const{width:n,height: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",t),()=>this.whiteboardView.callbacks.off("onCameraUpdated",t)}),this.sideEffect.add(()=>{const{updateUserScroll:t}=this;return this.whiteboardView.callbacks.on("onCameraUpdatedByDevice",t),()=>this.whiteboardView.callbacks.off("onCameraUpdatedByDevice",t)}),this.sideEffect.add(()=>{const t=({width:i,height:n})=>{if(i<=0||n<=0)return;this.pageRenderer.setContainerSize(i,n),this.scrollbar.setContainerSize(i,n);const{pagesIntrinsicWidth: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",t),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",t)}},"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",t=>{if(this.readonly||!this.box.focus||this.box.minimized||qh(t.target)||this.docsViewReadonly)return;let i=null;switch(t.key){case"PageDown":{i=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"PageUp":{i=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"ArrowDown":{i=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}case"ArrowUp":{i=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}}i!==null&&(this._onUserScroll?this._onUserScroll(i):(this.pageScrollTo(i),this.updateUserScroll()))},{capture:!0})}debounce(t,i,n){const r=kw(t,i);return this.sideEffect.addDisposer(()=>r.cancel(),n),r}wrapClassName(t){return"netless-app-docs-viewer-static-"+t}async getBase64FromUrl(t){const n=await(await fetch(this._invalidate(t))).blob();return new Promise(r=>{const s=new FileReader;s.readAsDataURL(n),s.onloadend=()=>{const o=s.result;r(o)}})}_invalidate(t){try{const i=new URL(t);return i.searchParams.set("t",Date.now().toString()),i.toString()}catch{return t}}reportProgress(t,i){window.postMessage({type:"@netless/_result_save_pdf_",appId:this.appId,progress:t,result:i})}}class I0{constructor({context:t,whiteboardView:i,box:n,pages:r}){this.sideEffect=new Ws,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=t,this.whiteboardView=i,this.box=n,this.pages=r,this.displayer=t.getDisplayer(),this.viewer=new Jh({readonly:!t.getIsWritable(),box:n,pages:r,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add(()=>{const s=o=>{this.viewer.setReadonly(!o)};return this.context.emitter.on("writableChange",s),()=>this.context.emitter.off("writableChange",s)}),this.sideEffect.add(()=>{const s=o=>{this.jumpToPage(o.index)};return this.context.emitter.on("sceneStateChange",s),()=>this.context.emitter.off("sceneStateChange",s)})}setDocsViewReadonly(t){this.docsViewReadonly=t}mount(){this.viewer.mount();const t=this.getPageIndex();return t!==0&&this.jumpToPage(t),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit)})),this}unmount(){return this.viewer.unmount(),this}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(t,i){var n,r;if(t=Gi(t,0,this.pages.length-1),t!==this.getPageIndex()&&this.context.getIsWritable()){const s=this.context.getInitScenePath(),o=(r=(n=this.context.getScenes())==null?void 0:n[t])==null?void 0:r.name;s&&o&&this.context.setScenePath(`${s}/${o}`),this.scaleDocsToFit()}if(t!==this.viewer.pageIndex&&this.viewer.setPageIndex(t),i){const s=this.context.getRoom();if(s){const o=s.state.globalState.__pptState;s.setGlobalState({__pptState:o&&{uuid:o.uuid,pageIndex:t,disableAutoPlay:o.disableAutoPlay}})}}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",t=>{var i;if(!this.docsViewReadonly&&this.box.focus&&!qh(t.target))switch(t.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(i=this.context.getRoom())==null||i.pptNextStep();break}}})}renderMask(){if(!this.$mask){const t=document.createElement("div");t.className=this.wrapClassName("mask"),this.$mask=t;const i=document.createElement("button");i.className=this.wrapClassName("back");const n=document.createElement("button");n.className=this.wrapClassName("next")}return this.$mask}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.sideEffect.addEventListener(this.$whiteboardView,"click",t=>{var i;const n=this.context.getRoom();if(n&&n.state.memberState.currentApplianceName==="clicker"){for(let r=t.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(t){return"netless-app-docs-viewer-dynamic-"+t}}const b0="DocsViewer",na={kind:b0,setup(e){const t=e.getBox(),i=e.getScenes();if(!i)throw new Error("[Docs Viewer]: scenes not found.");const n=e.getView();if(!n)throw new Error("[Docs Viewer]: no whiteboard view.");const r=i.map(({ppt:a})=>a?{width:a.width,height:a.height,src:a.src,thumbnail:a.previewURL}:null).filter(a=>Boolean(a));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(xw);let s=null;return r[0].src.startsWith("ppt")?s=E0(e,n,t,r):s=A0(e,n,t,r),(e.getAppOptions()||{}).justDocsViewReadonly&&s.setDocsViewReadonly(!0),{setDocsViewReadonly:a=>{s==null||s.setDocsViewReadonly(a)}}}};function A0(e,t,i,n){var r;t.disableCameraTransform=!e.getIsWritable();const s=new C0({context:e,whiteboardView:t,readonly:!e.getIsWritable(),box:i,pages:n,pageScrollTop:(r=e.getAttributes())==null?void 0:r.pageScrollTop,mountWhiteboard:e.mountView.bind(e),onUserScroll:o=>{var a;((a=e.getAttributes())==null?void 0:a.pageScrollTop)!==o&&!i.readonly&&e.updateAttributes(["pageScrollTop"],o)},baseScenePath:e.getInitScenePath(),appId:e.appId}).mount();return s.viewer.onPageIndexChanged=o=>{e.dispatchAppEvent("pageStateChange",{index:o,length:n.length})},e.dispatchAppEvent("pageStateChange",{index:s.viewer.pageIndex,length:n.length}),e.emitter.on("attributesUpdate",o=>{o&&o.pageScrollTop!=null&&s.syncPageScrollTop(o.pageScrollTop)}),e.emitter.on("writableChange",o=>{s.setReadonly(!o),t.disableCameraTransform=!o}),s}function E0(e,t,i,n){t.disableCameraTransform=!0;const r=new I0({context:e,whiteboardView:t,box:i,pages:n}).mount();return r.viewer.onPageIndexChanged=s=>{e.dispatchAppEvent("pageStateChange",{index:s,length:n.length})},e.dispatchAppEvent("pageStateChange",{index:r.getPageIndex(),length:n.length}),e.mountView(r.$whiteboardView),e.isAddApp&&t.callbacks.once("onSizeUpdated",({width:s,height:o})=>{if(n.length>0&&i.state!=="maximized"){const{width:a,height:l}=n[0],c=l/a*s-o;c!==0&&e.getIsWritable()&&e.emitter.emit("setBoxSize",{width:i.width,height:i.height+c/i.containerRect.height})}}),r}var Ai={exports:{}},G={};/*
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 al(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 wa=0,Qh=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-wa));wa=e+i,setTimeout(function(){return t(wa)},i)},lm=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},um=40,Vu=1/60*1e3,Qr=!0,Yn=!1,Ja=!1,En={delta:0,timestamp:0},ol=["read","update","preRender","render","postRender"],cm=function(t){return Yn=t},Zh=ol.reduce(function(t,e){return t[e]=lm(cm),t},{}),hm=ol.reduce(function(t,e){var i=Zh[e];return t[e]=function(n,r,s){return r===void 0&&(r=!1),s===void 0&&(s=!1),Yn||fm(),i.schedule(n,r,s),n},t},{}),dm=function(t){return Zh[t].process(En)},Yh=function(t){Yn=!1,En.delta=Qr?Vu:Math.max(Math.min(t-En.timestamp,um),1),Qr||(Vu=En.delta),En.timestamp=t,Ja=!0,ol.forEach(dm),Ja=!1,Yn&&(Qr=!1,Qh(Yh))},fm=function(){Yn=!0,Qr=!0,Ja||Qh(Yh)},Gh=function(t,e){return function(i){return Math.max(Math.min(i,e),t)}},Zr=function(t){return t%1?Number(t.toFixed(5)):t},Xh=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,$s={test:function(t){return typeof t=="number"},parse:parseFloat,transform:function(t){return t}},Bn=be(be({},$s),{transform:Gh(0,1)}),Ar=be(be({},$s),{default:1}),ll=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}}},ti=ll("deg"),Dn=ll("%"),W=ll("px"),Ou=be(be({},Dn),{parse:function(t){return Dn.parse(t)/100},transform:function(t){return Dn.transform(t*100)}}),pm=function(t){return t.substring(t.indexOf("(")+1,t.lastIndexOf(")"))},gm=Gh(0,255),Ka=function(t){return t.red!==void 0},qa=function(t){return t.hue!==void 0};function mm(t){return pm(t).replace(/(,|\/)/g," ").split(/ \s*/)}var Jh=function(t){return function(e){if(typeof e!="string")return e;for(var i={},n=mm(e),r=0;r<4;r++)i[t[r]]=n[r]!==void 0?parseFloat(n[r]):1;return i}},vm=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+")"},wm=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+")"},ya=be(be({},$s),{transform:function(t){return Math.round(gm(t))}});function ul(t,e){return t.startsWith(e)&&Xh.test(t)}var Yr={test:function(t){return typeof t=="string"?ul(t,"rgb"):Ka(t)},parse:Jh(["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 vm({red:ya.transform(e),green:ya.transform(i),blue:ya.transform(n),alpha:Zr(Bn.transform(s))})}},xa={test:function(t){return typeof t=="string"?ul(t,"hsl"):qa(t)},parse:Jh(["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 wm({hue:Math.round(e),saturation:Dn.transform(Zr(i)),lightness:Dn.transform(Zr(n)),alpha:Zr(Bn.transform(s))})}},Uu=be(be({},Yr),{test:function(t){return typeof t=="string"&&ul(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"&&Xh.test(t)||Ka(t)||qa(t)},parse:function(t){return Yr.test(t)?Yr.parse(t):xa.test(t)?xa.parse(t):Uu.test(t)?Uu.parse(t):t},transform:function(t){return Ka(t)?Yr.transform(t):qa(t)?xa.transform(t):t}},cl=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=al(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,hm.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}},ym=/([a-z])([A-Z])/g,xm="$1-$2",Ws=function(t){return t.replace(ym,xm).toLowerCase()},Kh=new Map,hl=new Map,qh=["Webkit","Moz","O","ms",""],Sm=qh.length,Mm=typeof document!="undefined",Sa,ed=function(t,e){return hl.set(t,Ws(e))},Im=function(t){Sa=Sa||document.createElement("div");for(var e=0;e<Sm;e++){var i=qh[e],n=i==="",r=n?t:i+t.charAt(0).toUpperCase()+t.slice(1);if(r in Sa.style||n){if(n&&t==="clipPath"&&hl.has(t))return;Kh.set(t,r),ed(t,(n?"":"-")+Ws(r))}}},Cm=function(t){return ed(t,t)},td=function(t,e){e===void 0&&(e=!1);var i=e?hl:Kh;return i.has(t)||(Mm?Im(t):Cm(t)),i.get(t)||t},bm=["","X","Y","Z"],Am=["translate","scale","rotate","skew","transformPerspective"],eo=Am.reduce(function(t,e){return bm.reduce(function(i,n){return i.push(e+n),i},t)},["x","y","z"]),Tm=eo.reduce(function(t,e){return t[e]=!0,t},{});function dl(t){return Tm[t]===!0}function Em(t,e){return eo.indexOf(t)-eo.indexOf(e)}var Nm=new Set(["originX","originY","originZ"]);function km(t){return Nm.has(t)}var $u=be(be({},$s),{transform:Math.round}),Pm={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:ti,rotateX:ti,rotateY:ti,rotateZ:ti,scale:Ar,scaleX:Ar,scaleY:Ar,scaleZ:Ar,skew:ti,skewX:ti,skewY:ti,distance:W,translateX:W,translateY:W,translateZ:W,x:W,y:W,z:W,perspective:W,opacity:Bn,originX:Ou,originY:Ou,originZ:W,zIndex:$u,fillOpacity:Bn,strokeOpacity:Bn,numOctaves:$u},fl=function(t){return Pm[t]},zm=function(t,e){return e&&typeof t=="number"?e.transform(t):t},Ln="scrollLeft",Rn="scrollTop",id=new Set([Ln,Rn]),Bm=new Set([Ln,Rn,"transform"]),Dm={x:"translateX",y:"translateY",z:"translateZ"};function nd(t){return typeof t=="function"}function Lm(t,e,i,n,r,s){s===void 0&&(s=!0);var a="",o=!1;i.sort(Em);for(var l=i.length,u=0;u<l;u++){var c=i[u];a+=(Dm[c]||c)+"("+e[c]+") ",o=c==="z"?!0:o}return!o&&r?a+="translateZ(0)":a=a.trim(),nd(t.transform)?a=t.transform(e,n?"":a):s&&n&&(a="none"),a}function Rm(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=fl(h),w=zm(m,v);dl(h)?(u=!0,n[h]=w,s.push(h),l&&(v.default&&m!==v.default||!v.default&&m!==0)&&(l=!1)):km(h)?(r[h]=w,c=!0):(!Bm.has(h)||!nd(w))&&(i[td(h,a)]=w)}return(u||typeof t.transform=="function")&&(i.transform=Lm(t,n,s,l,e,o)),c&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function pl(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,Rm(m,n,l,u,c,h,s,o),l}}function jm(t,e){var i=e.element,n=e.preparseOutput,r=fl(t);if(dl(t))return r&&r.default||0;if(id.has(t))return i[t];var s=window.getComputedStyle(i,null).getPropertyValue(td(t,!0))||0;return n&&r&&r.test(s)&&r.parse?r.parse(s):s}function _m(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 Vm=cl({onRead:jm,onRender:_m,uncachedValues:id});function Om(t,e){e===void 0&&(e={});var i=e.enableHardwareAcceleration,n=e.allowTransformNone,r=al(e,["enableHardwareAcceleration","allowTransformNone"]);return Vm(be({element:t,buildStyles:pl({enableHardwareAcceleration:i,allowTransformNone:n}),preparseOutput:!0},r))}var rd=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Wu=.5,sd=function(){return{style:{}}},Ma=function(t,e){return W.transform(t*e)},Um={x:0,y:0,width:0,height:0};function Hu(t,e,i){return typeof t=="string"?t:W.transform(e+i*t)}function $m(t,e,i){return Hu(e,t.x,t.width)+" "+Hu(i,t.y,t.height)}var ad={enableHardwareAcceleration:!1,isDashCase:!1};function Wm(t,e,i,n,r,s){e===void 0&&(e=Um),n===void 0&&(n=pl(ad)),r===void 0&&(r=sd()),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=al(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&&!rd.has(f)?Ws(f):f;r[p]=d[f]}return(l!==void 0||u!==void 0||d.transform)&&(r.style.transformOrigin=$m(e,l!==void 0?l:Wu,u!==void 0?u:Wu)),a!==void 0&&(r.x=a),o!==void 0&&(r.y=o),i!==void 0&&c!==void 0&&(r[s?"stroke-dashoffset":"strokeDashoffset"]=Ma(-w,i),r[s?"stroke-dasharray":"strokeDasharray"]=Ma(c,i)+" "+Ma(m,i)),r}function Hm(t,e,i){i===void 0&&(i=!0);var n=sd(),r=pl(ad);return function(s){return Wm(s,t,e,r,n,i)}}var Fm=function(t){return typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()},Qm=function(t){try{return Fm(t)}catch{return{x:0,y:0,width:0,height:0}}},Zm=function(t){return t.tagName==="path"},Ym=cl({onRead:function(t,e){var i=e.element;if(t=rd.has(t)?t:Ws(t),dl(t)){var n=fl(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])}}),Gm=function(t){var e=Qm(t),i=Zm(t)&&t.getTotalLength?t.getTotalLength():void 0;return Ym({element:t,buildAttrs:Hm(e,i)})},Xm=cl({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)}}),to=new WeakMap,Jm=function(t){return t instanceof HTMLElement||typeof t.click=="function"},Km=function(t){return t instanceof SVGElement||"ownerSVGElement"in t},qm=function(t,e){var i;return t===window?i=Xm(t):Jm(t)?i=Om(t,e):Km(t)&&(i=Gm(t)),to.set(t,i),i},ev=function(t,e){return to.has(t)?to.get(t):qm(t,e)};function tv(t,e){var i=typeof t=="string"?document.querySelector(t):t;return ev(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 od="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",iv=od.length,Fu=Array(20),mn=()=>{for(let t=0;t<20;t++)Fu[t]=od.charAt(Math.random()*iv);return Fu.join("")};class cs{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 nv=Object.defineProperty,Ia=(typeof require!="undefined"&&require,(t,e,i)=>(((n,r,s)=>{r in n?nv(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){Ia(this,"_value"),Ia(this,"_beforeDestroys"),Ia(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 rv(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 ld(t,e){Object.keys(e).forEach(i=>{sv(t,i,e[i])})}function sv(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 ud(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(rv(i,n,r,s)),createVal:(i,n)=>e(new ur(i,n))}}var gl=(t=>(t.Light="light",t.Dark="dark",t.Auto="auto",t))(gl||{}),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 Ca="dh";function Ne(t,e,i){return Math.min(Math.max(t,e),i)}function $i(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function Qu(t){return t.touches?t.touches[0]:t}function av(){return Date.now().toString().slice(6)+Math.random().toString().slice(2,8)}let ov=1;function lv(){return`New Box ${ov++}`}function uv(t){return Boolean(t)}function Tr(t){return!t}class cd{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 cs,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=Ca,this.$title=document.createElement("h1"),this.$title.className=this.wrapClassName("title"),this.$title.dataset.teleBoxHandle=Ca,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=Ca,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 cv{constructor({id:e=av(),title:i=lv(),prefersColorScheme:n=gl.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:B,footer:P,styles:z,containerRect:te={x:0,y:0,width:window.innerWidth,height:window.innerHeight},collectorRect:C,boxStatus:S,lastNotMinimizedBoxStatus:_}={}){this._renderSideEffect=new cs,this.handleTrackStart=L=>{var X;return(X=this._handleTrackStart)==null?void 0:X.call(this,L)},this._sideEffect=new cs,this._valSideEffectBinder=ud(this._sideEffect);const{combine:k,createVal:R}=this._valSideEffectBinder;this.id=e,this.namespace=x,this.events=new Xa,this._delegateEvents=new Xa;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=br=>{nt.setValue(br.matches,V)};return he.addListener(Ni),()=>he.removeListener(Ni)}else return Zu}else return nt.setValue(L==="dark",V),Zu},"prefers-color-scheme")}),nt.reaction((L,X,V)=>{V||this.events.emit(ue.DarkMode,L)});const qt=R(te,lt),ei=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 Eu=k([Fe,Ee,G],([L,X,V])=>L?N.Minimized:X?N.Maximized:V||N.Normal);Eu.reaction((L,X,V)=>{V||this.events.emit(ue.State,L)});const Ir=R({width:Ne(l,0,1),height:Ne(u,0,1)},lt),pn=R({width:Ne(a,Ir.value.width,1),height:Ne(o,Ir.value.height,1)},lt);Ir.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 Nu=k([gn,Fe,qt,ei,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);Nu.reaction((L,X,V)=>{V||this.events.emit(ue.VisualResize,L)});const pa=R({x:Ne(c,0,1),y:Ne(h,0,1)},lt);pa.reaction((L,X,V)=>{V||this.events.emit(ue.IntrinsicMove,L)});const Cr=k([pa,pn,qt,ei,Fe,Ee,G,ge],([L,X,V,he,Ni,br,ku,Cg])=>(Ni||ku===N.Minimized)&&he?br||Cg===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}:br||ku===N.Maximized?{x:0,y:0}:L,lt);Cr.reaction((L,X,V)=>{V||this.events.emit(ue.Move,L)}),this.titleBar=E||new cd({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 Sg=R(B),Mg=R(P),Ig=R(z);ld(this,{prefersColorScheme:Xe,darkMode:nt,containerRect:qt,collectorRect:ei,title:Ei,visible:fn,readonly:A,resizable:j,draggable:Q,fence:ie,fixRatio:se,focus:st,zIndex:rt,minimized:Fe,maximized:Ee,$userContent:Sg,$userFooter:Mg,$userStyles:Ig}),this._state$=Eu,this._minSize$=Ir,this._size$=gn,this._intrinsicSize$=pn,this._visualSize$=Nu,this._coord$=Cr,this._intrinsicCoord$=pa,this._boxStatus$=G,this._lastNotMinimizedBoxStatus$=ge,this.fixRatio&&this.transform(Cr.value.x,Cr.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=uv)=>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",Tr),i(this.$box,this._resizable$,"no-resize",Tr),i(this.$box,this._focus$,"blur",Tr),i(this.$box,this._darkMode$,"color-scheme-dark"),i(this.$box,this._darkMode$,"color-scheme-light",Tr),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=tv(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}=Qu(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}=Qu(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 Zu(){}var hv="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class hd{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('${hv}')`,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 dv extends cd{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 fv{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 pv{constructor({root:e=document.body,prefersColorScheme:i=gl.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 Xa,this._sideEffect=new cs,this.useBoxesStatus=c;const{combine:h,createVal:m}=ud(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 hd({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&&B.setValue(C)};const B=m(f.value?this._calcCollectorRect():void 0);B.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"),z=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",z,!0),this._sideEffect.addEventListener(window,"touchstart",z,!0),this.maxTitleBar=new dv({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)}),ld(this,{prefersColorScheme:M,containerRect:x,collector:E,collectorRect:B,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 cv({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 fv({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=wi(Hs,Y.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 Hs{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=Pg,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){this.teleBoxManager.setBoxesStatus(new Map(Object.entries(e!=null?e:{})),!0)}setBoxStatus(e,i){this.teleBoxManager.update(e,{boxStatus:i},!0)}setLastNotMinimizedBoxesStatus(e){this.teleBoxManager.setLastNotMinimizedBoxesStatus(new Map(Object.entries(e!=null?e:{})),!0)}setLastNotMinimizedBoxStatus(e,i){this.teleBoxManager.update(e,{lastNotMinimizedBoxStatus:i},!0)}setupBoxManager(e){const i=Y.wrapper?Y.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=new pv(r);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=s;const a=(e==null?void 0:e.collectorContainer)||Y.wrapper;return a&&this.setCollectorContainer(a),s}setCollectorContainer(e){var n;const i=new hd({styles:(n=this.createTeleBoxManagerConfig)==null?void 0:n.collectorStyles}).mount(e);this.teleBoxManager.setCollector(i)}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)=>{Y.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),Y.wrapper=n,{playground:e,wrapper:n,sizer:i,mainViewElement:r}},vv=()=>{if(Lu(b.WhiteVersion)<Lu(zu))throw new jh(zu)},io=(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(Y.kind);if(e)return e;let i;const n=new Promise(u=>{Y._resolve=i=u});let r=!1;const s=yv(t);!t.isWritable&&s&&(r=!0,await Ph.default(async u=>{qe(`switching to writable (x${u})`),await t.setWritable(!0)},{retries:10,maxTimeout:5e3})),t.isWritable?(qe("creating InvisiblePlugin..."),t.createInvisiblePlugin(Y,{}).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(Y.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 dd(t){return t()}function Yu(){return Object.create(null)}function Fs(t){t.forEach(dd)}function fd(t){return typeof t=="function"}function xv(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Er;function hs(t,e){return Er||(Er=document.createElement("a")),Er.href=e,t===Er.href}function Sv(t){return Object.keys(t).length===0}function Ct(t,e){t.appendChild(e)}function Qs(t,e,i){t.insertBefore(e,i||null)}function cr(t){t.parentNode&&t.parentNode.removeChild(t)}function _t(t){return document.createElement(t)}function ml(t){return document.createTextNode(t)}function no(){return ml(" ")}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 pd(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 vl;function jn(t){vl=t}const Bi=[],Gu=[];let Wi=[];const Xu=[],Iv=Promise.resolve();let ro=!1;function Cv(){ro||(ro=!0,Iv.then(gd))}function so(t){Wi.push(t)}const ba=new Set;let ki=0;function gd(){if(ki!==0)return;const t=vl;do{try{for(;ki<Bi.length;){const e=Bi[ki];ki++,jn(e),bv(e.$$)}}catch(e){throw Bi.length=0,ki=0,e}for(jn(null),Bi.length=0,ki=0;Gu.length;)Gu.pop()();for(let e=0;e<Wi.length;e+=1){const i=Wi[e];ba.has(i)||(ba.add(i),i())}Wi.length=0}while(Bi.length);for(;Xu.length;)Xu.pop()();ro=!1,ba.clear(),jn(t)}function bv(t){if(t.fragment!==null){t.update(),Fs(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(so)}}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||so(()=>{const a=t.$$.on_mount.map(dd).filter(fd);t.$$.on_destroy?t.$$.on_destroy.push(...a):Fs(a),t.$$.on_mount=[]}),s.forEach(so)}function kv(t,e){const i=t.$$;i.fragment!==null&&(Av(i.after_update),Fs(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&&(Bi.push(t),Cv(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function zv(t,e,i,n,r,s,a,o=[-1]){const l=vl;jn(t);const u=t.$$={fragment:null,ctx:[],props:s,update:Gn,not_equal:r,bound:Yu(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:Yu(),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,Fs(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(cr)}else u.fragment&&u.fragment.c();e.intro&&Ev(t.$$.fragment),Nv(t,e.target,e.anchor,e.customElement),gd()}jn(l)}class Bv{$destroy(){kv(this,1),this.$destroy=Gn}$on(e,i){if(!fd(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 Ju(t){let e,i,n,r,s,a,o,l=t[18]&&Ku(t),u=t[19]&&qu(t);return{c(){e=_t("div"),i=_t("div"),l&&l.c(),n=no(),r=_t("span"),s=ml(t[1]),a=no(),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){Qs(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=Ku(c),l.c(),l.m(i,n)):l&&(l.d(1),l=null),h&2&&pd(s,c[1]),c[19]?u?u.p(c,h):(u=qu(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&&cr(e),l&&l.d(),u&&u.d()}}}function Ku(t){let e,i;return{c(){e=_t("img"),ae(e,"class","netless-window-manager-cursor-selector-avatar"),ae(e,"style",t[20]()),hs(e.src,i=t[8])||ae(e,"src",i),ae(e,"alt","avatar")},m(n,r){Qs(n,e,r)},p(n,r){r&256&&!hs(e.src,i=n[8])&&ae(e,"src",i)},d(n){n&&cr(e)}}}function qu(t){let e,i;return{c(){e=_t("span"),i=ml(t[2]),ae(e,"class","netless-window-manager-cursor-tag-name"),we(e,"background-color",t[11])},m(n,r){Qs(n,e,r),Ct(e,i)},p(n,r){r&4&&pd(i,n[2]),r&2048&&we(e,"background-color",n[11])},d(n){n&&cr(e)}}}function Dv(t){let e,i,n,r,s,a,o,l=!t[14]&&Ju(t);return{c(){e=_t("div"),l&&l.c(),i=no(),n=_t("div"),r=_t("img"),ae(r,"class",s="netless-window-manager-cursor-"+t[4]+"-image "+t[15]),hs(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){Qs(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=Ju(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&&!hs(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&&cr(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:B}=e,{opacity:P}=e,{pencilEraserSize:z}=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,B=S.cursorTagBackgroundColor),"opacity"in S&&i(12,P=S.opacity),"pencilEraserSize"in S&&i(22,z=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=z===3?"netless-window-manager-pencilEraser-3-offset":"")},[h,m,v,w,M,d,f,p,y,x,E,B,P,te,o,c,u,a,s,r,C,g,z,l]}class Rv extends Bv{constructor(e){super(),zv(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 md="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 vd(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 ii(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 Nr=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 Nr.textContent=jv({"cursor-pencil":ii(vd(r)),"cursor-eraser":ii(md),"cursor-rectangle":ii(Di(r)),"cursor-ellipse":ii(Di(r)),"cursor-straight":ii(Di(r)),"cursor-arrow":ii(Di(r)),"cursor-shape":ii(Di(r))}),document.head.appendChild(Nr),()=>{Nr.parentNode!=null&&document.head.removeChild(Nr)}}const Vv=new Set([b.ApplianceNames.rectangle,b.ApplianceNames.ellipse,b.ApplianceNames.straight,b.ApplianceNames.arrow,b.ApplianceNames.shape]);function ec(t,e){if(t===b.ApplianceNames.pencil)return vd(e);if(t===b.ApplianceNames.eraser)return md;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=ec(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&&ec(e,i))}updateMember(){return this.member=io(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},tc="local-cursor";class Zs{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===Za.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,Y.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,Y.supportAppliancePlugin&&b.isRoom(Y.displayer)&&Y.displayer.disableDeviceInputs){this.leaveFlag&&(this.manager.dispatchInternalEvent(K.CursorMove,{uid:this.manager.uid,state:Za.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=Y.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(tc))}enableCustomCursor(){this.sideEffectManager.add(()=>_v(this.manager.getMemberState()),tc)}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=io(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=io(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=Y.container)==null?void 0:e.getBoundingClientRect(),this.wrapperRect=(i=Y.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 wi(t,e){switch(t.name){case"AppManager":return(e==null?void 0:e.AppManager)||Gs;case"BoxManager":return(e==null?void 0:e.BoxManager)||Hs;case"AttributesDelegate":return(e==null?void 0:e.AttributesDelegate)||Ys;case"CursorManager":return(e==null?void 0:e.CursorManager)||Zs;case"AppProxy":return(e==null?void 0:e.AppProxy)||on;case"AppContext":return(e==null?void 0:e.AppContext)||Us;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 Ys{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&&vi(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=wi(Ys,t);return new i(e)},wl=(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)&&(vi(this.view,a),Z.emit("onAppScenePathChange",{appId:this.id,view:this.view}))},50),this.notifyPageStateChange=T.debounce(()=>{this.appEmitter.emit("pageStateChange",this.pageState)},50),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 om({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=Xg(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 Uh;const o=wi(Us,Y.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),Z.emit("onAppSetup",e)},Dh)}),(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=wi(on,Y.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 zh.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&&Ya(this.manager.room,e)}setViewFocusScenePath(){const e=this.getFullScenePath();return e&&this.view&&vi(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=wl(e,this.pageState);return this.setSceneIndexWithoutSync(n),this.manager.dispatchInternalEvent(K.SetAppFocusIndex,{type:"app",appID:this.id,index:n}),setTimeout(()=>{Ga(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&&Ga(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=wd(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 wd=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=()=>{Z.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=wd(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&vi(e,i),e}onReconnect(){if(this.didRelease)this.rebind();else{const e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}setFocusScenePath(e){if(e)return vi(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(),Z.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=>{Z.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{Z.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 Gs{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 Dg,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(tm(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=wl(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&&Ga(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([Z.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},Z.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}),Z.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}),Z.emit("onBoxResize",i))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId}),Z.emit("onBoxFocus",i)},this.onBoxBlurred=i=>{this.attributes.focus===i.appId&&(this.windowManger.safeSetAttributes({focus:void 0}),Z.emit("onBoxBlurred",i))},this.onBoxClose=i=>{const n=this.appProxies.get(i.appId);n&&n.destroy(!1,!0,!0,i.error),Z.emit("onBoxClose",i)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(K.AppBoxStateChange,i),Z.emit("onBoxStateChange",i)},this.addBoxesStatusChangeListener=()=>{this.refresher.add("boxesStatus",()=>Tn(()=>this.attributes.boxesStatus,()=>{var i;(i=this.boxManager)==null||i.setBoxesStatus(this.attributes.boxesStatus)})),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&&(Z.emit("mainViewSceneIndexChange",i),O.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this._prevSceneIndex=i)},this.onFocusChange=i=>{var n;this._prevFocused!==i&&(Z.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=ma(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(Y.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 im(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=xg,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(Bh),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 ma(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,Z.emit("appsChange",e))}async _attributesUpdateCallback(e){if(e&&Y.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,Qa.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"),Z.emit("onMainViewMounted",n)}setMainViewFocusPath(e){var n;const i=e||this.store.getMainViewScenePath();if(i)return vi(this.mainView,i),((n=this.mainView)==null?void 0:n.focusScenePath)===i}resetScenePath(e){this.displayer.state.sceneState.scenePath!==e&&Ya(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 Gg(e.kind);this.appStatus.set(n,Qa.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=wi(on,Y.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(ma(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=Kg(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}),Z.emit("mainViewScenePathChange",e),Ya(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(Fa,{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)}),Z.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0,this._focusAppCreatedResolve=void 0}}const iw=window.ResizeObserver||Eg.ResizeObserver;class yl{constructor(e){this.emitter=e}static create(e,i,n,r){const s=new yl(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>Y.containerSizeRatio?(i=e*Y.containerSizeRatio,n.classList.toggle("netless-window-manager-sizer-horizontal",!0)):(e=i/Y.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",()=>{Z.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(ga,{}):(await Lh(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(ga,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(ga,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,ic=[],Sw=()=>{for(let t=0;t<xw;t++)ic[t]=ww.charAt(Math.random()*yw);return ic.join("")};function yd(t){try{return t()}catch(e){console.error(e)}}var Xs=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(yd),this.disposers.clear()}genUID(){let t;do t=Sw();while(this.disposers.has(t));return t}};function Mw(t){return()=>t.forEach(yd)}var ci=[],Iw=function(){return ci.some(function(t){return t.activeTargets.length>0})},Cw=function(){return ci.some(function(t){return t.skippedTargets.length>0})},nc="ResizeObserver loop completed with undelivered notifications.",bw=function(){var t;typeof ErrorEvent=="function"?t=new ErrorEvent("error",{message:nc}):(t=document.createEvent("Event"),t.initEvent("error",!1,!1),t.message=nc),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 hi=function(t){return Object.freeze(t)},Aw=function(){function t(e,i){this.inlineSize=e,this.blockSize=i,hi(this)}return t}(),xd=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,hi(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}(),xl=function(t){return t instanceof SVGElement&&"getBBox"in t},Sd=function(t){if(xl(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)},rc=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:{},kr=new WeakMap,sc=/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)},ac=hi({devicePixelContentBoxSize:Hi(),borderBoxSize:Hi(),contentBoxSize:Hi(),contentRect:new xd(0,0,0,0)}),Md=function(t,e){if(e===void 0&&(e=!1),kr.has(t)&&!e)return kr.get(t);if(Sd(t))return kr.set(t,ac),ac;var i=getComputedStyle(t),n=xl(t)&&t.ownerSVGElement&&t.getBBox(),r=!Nw&&i.boxSizing==="border-box",s=Ew.test(i.writingMode||""),a=!n&&sc.test(i.overflowY||""),o=!n&&sc.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,B=r?f+g:0,P=n?n.width:ot(i.width)-E-x,z=n?n.height:ot(i.height)-B-y,te=P+d+x+p,C=z+f+y+g,S=hi({devicePixelContentBoxSize:Hi(Math.round(P*devicePixelRatio),Math.round(z*devicePixelRatio),s),borderBoxSize:Hi(te,C,s),contentBoxSize:Hi(P,z,s),contentRect:new xd(h,l,P,z)});return kr.set(t,S),S},Id=function(t,e,i){var n=Md(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=Md(e);this.target=e,this.contentRect=i.contentRect,this.borderBoxSize=hi([i.borderBoxSize]),this.contentBoxSize=hi([i.contentBoxSize]),this.devicePixelContentBoxSize=hi([i.devicePixelContentBoxSize])}return t}(),Cd=function(t){if(Sd(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=[];ci.forEach(function(a){if(a.activeTargets.length!==0){var o=[];a.activeTargets.forEach(function(u){var c=new kw(u.target),h=Cd(u.target);o.push(c),u.lastReportedSize=Id(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},oc=function(t){ci.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(r){r.isActive()&&(Cd(r.target)>t?i.activeTargets.push(r):i.skippedTargets.push(r))})})},zw=function(){var t=0;for(oc(t);Iw();)t=Pw(),oc(t);return Cw()&&bw(),t>0},Aa,bd=[],Bw=function(){return bd.splice(0).forEach(function(t){return t()})},Dw=function(t){if(!Aa){var e=0,i=document.createTextNode(""),n={characterData:!0};new MutationObserver(function(){return Bw()}).observe(i,n),Aa=function(){i.textContent="".concat(e?e--:e++)}}bd.push(t),Aa()},Lw=function(t){Dw(function(){requestAnimationFrame(t)})},Gr=0,Rw=function(){return!!Gr},jw=250,_w={attributes:!0,characterData:!0,childList:!0,subtree:!0},lc=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],uc=function(t){return t===void 0&&(t=0),Date.now()+t},Ta=!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),!Ta){Ta=!0;var n=uc(e);Lw(function(){var r=!1;try{r=zw()}finally{if(Ta=!1,e=n-uc(),!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(),lc.forEach(function(i){return _n.addEventListener(i,e.listener,!0)}))},t.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),lc.forEach(function(i){return _n.removeEventListener(i,e.listener,!0)}),this.stopped=!0)},t}(),ao=new Vw,cc=function(t){!Gr&&t>0&&ao.start(),Gr+=t,!Gr&&ao.stop()},Ow=function(t){return!xl(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=Id(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}(),Pr=new WeakMap,hc=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);Pr.set(e,n)},t.observe=function(e,i,n){var r=Pr.get(e),s=r.observationTargets.length===0;hc(r.observationTargets,i)<0&&(s&&ci.push(r),r.observationTargets.push(new Uw(i,n&&n.box)),cc(1),ao.schedule())},t.unobserve=function(e,i){var n=Pr.get(e),r=hc(n.observationTargets,i),s=n.observationTargets.length===1;r>=0&&(s&&ci.splice(ci.indexOf(n),1),n.observationTargets.splice(r,1),cc(-1))},t.disconnect=function(e){var i=this,n=Pr.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(!rc(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(!rc(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 Xt=typeof window!="undefined",Ad=Xt&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Td=Xt&&"IntersectionObserver"in window,Ed=Xt&&"classList"in document.createElement("p"),Nd=Xt&&window.devicePixelRatio>1,Gw={elements_selector:".lazy",container:Ad||Xt?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},kd=t=>Object.assign({},Gw,t),dc=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)dc(t,e);else for(let i=0,n;n=e[i];i+=1)dc(t,n)},Nt="src",Sl="srcset",Ml="sizes",Pd="poster",hr="llOriginalAttrs",zd="data",Il="loading",Bd="loaded",Dd="applied",Jw="entered",Cl="error",Ld="native",Rd="data-",jd="ll-status",ze=(t,e)=>t.getAttribute(Rd+e),Kw=(t,e,i)=>{const n=Rd+e;if(i===null){t.removeAttribute(n);return}t.setAttribute(n,i)},dr=t=>ze(t,jd),bi=(t,e)=>Kw(t,jd,e),Js=t=>bi(t,null),bl=t=>dr(t)===null,qw=t=>dr(t)===Il,ey=t=>dr(t)===Cl,Al=t=>dr(t)===Ld,ty=[Il,Bd,Dd,Cl],iy=t=>ty.indexOf(dr(t))>=0,Jt=(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(Ed){t.classList.add(e);return}t.className+=(t.className?" ":"")+e}},ht=(t,e)=>{if(e!==""){if(Ed){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},_d=t=>t.llTempImage,Ks=(t,e)=>{if(!e)return;const i=e._observer;!i||i.unobserve(t)},sy=t=>{t.disconnect()},ay=(t,e,i)=>{e.unobserve_entered&&Ks(t,i)},Tl=(t,e)=>{!t||(t.loadingCount+=e)},oy=t=>{!t||(t.toLoadCount-=1)},Vd=(t,e)=>{!t||(t.toLoadCount=e)},ly=t=>t.loadingCount>0,uy=t=>t.toLoadCount>0,Od=t=>{let e=[];for(let i=0,n;n=t.children[i];i+=1)n.tagName==="SOURCE"&&e.push(n);return e},El=(t,e)=>{const i=t.parentNode;if(!i||i.tagName!=="PICTURE")return;Od(i).forEach(e)},Ud=(t,e)=>{Od(t).forEach(e)},qs=[Nt],$d=[Nt,Pd],Jn=[Nt,Sl,Ml],Wd=[zd],ea=t=>!!t[hr],Hd=t=>t[hr],Fd=t=>delete t[hr],Ki=(t,e)=>{if(ea(t))return;const i={};e.forEach(n=>{i[n]=t.getAttribute(n)}),t[hr]=i},cy=t=>{ea(t)||(t[hr]={backgroundImage:t.style.backgroundImage})},hy=(t,e,i)=>{if(!i){t.removeAttribute(e);return}t.setAttribute(e,i)},yi=(t,e)=>{if(!ea(t))return;const i=Hd(t);e.forEach(n=>{hy(t,n,i[n])})},dy=t=>{if(!ea(t))return;const e=Hd(t);t.style.backgroundImage=e.backgroundImage},Qd=(t,e,i)=>{ln(t,e.class_applied),bi(t,Dd),i&&(e.unobserve_completed&&Ks(t,e),Jt(e.callback_applied,t,i))},Zd=(t,e,i)=>{ln(t,e.class_loading),bi(t,Il),i&&(Tl(i,1),Jt(e.callback_loading,t,i))},Vt=(t,e,i)=>{!i||t.setAttribute(e,i)},fc=(t,e)=>{Vt(t,Ml,ze(t,e.data_sizes)),Vt(t,Sl,ze(t,e.data_srcset)),Vt(t,Nt,ze(t,e.data_src))},fy=(t,e)=>{El(t,i=>{Ki(i,Jn),fc(i,e)}),Ki(t,Jn),fc(t,e)},py=(t,e)=>{Ki(t,qs),Vt(t,Nt,ze(t,e.data_src))},gy=(t,e)=>{Ud(t,i=>{Ki(i,qs),Vt(i,Nt,ze(i,e.data_src))}),Ki(t,$d),Vt(t,Pd,ze(t,e.data_poster)),Vt(t,Nt,ze(t,e.data_src)),t.load()},my=(t,e)=>{Ki(t,Wd),Vt(t,zd,ze(t,e.data_src))},vy=(t,e,i)=>{const n=ze(t,e.data_bg),r=ze(t,e.data_bg_hidpi),s=Nd&&r?r:n;!s||(t.style.backgroundImage=`url("${s}")`,_d(t).setAttribute(Nt,s),Zd(t,e,i))},wy=(t,e,i)=>{const n=ze(t,e.data_bg_multi),r=ze(t,e.data_bg_multi_hidpi),s=Nd&&r?r:n;!s||(t.style.backgroundImage=s,Qd(t,e,i))},yy=(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()),Qd(t,e,i)},Yd={IMG:fy,IFRAME:py,VIDEO:gy,OBJECT:my},xy=(t,e)=>{const i=Yd[t.tagName];!i||i(t,e)},Sy=(t,e,i)=>{const n=Yd[t.tagName];!n||(n(t,e),Zd(t,e,i))},My=["IMG","IFRAME","VIDEO","OBJECT"],Iy=t=>My.indexOf(t.tagName)>-1,Gd=(t,e)=>{e&&!ly(e)&&!uy(e)&&Jt(t.callback_finish,e)},pc=(t,e,i)=>{t.addEventListener(e,i),t.llEvLisnrs[e]=i},Cy=(t,e,i)=>{t.removeEventListener(e,i)},Nl=t=>!!t.llEvLisnrs,by=(t,e,i)=>{Nl(t)||(t.llEvLisnrs={});const n=t.tagName==="VIDEO"?"loadeddata":"load";pc(t,n,e),pc(t,"error",i)},oo=t=>{if(!Nl(t))return;const e=t.llEvLisnrs;for(let i in e){const n=e[i];Cy(t,i,n)}delete t.llEvLisnrs},Xd=(t,e,i)=>{ry(t),Tl(i,-1),oy(i),ht(t,e.class_loading),e.unobserve_completed&&Ks(t,i)},Ay=(t,e,i,n)=>{const r=Al(e);Xd(e,i,n),ln(e,i.class_loaded),bi(e,Bd),Jt(i.callback_loaded,e,n),r||Gd(i,n)},Ty=(t,e,i,n)=>{const r=Al(e);Xd(e,i,n),ln(e,i.class_error),bi(e,Cl),Jt(i.callback_error,e,n),i.restore_on_error&&yi(e,Jn),r||Gd(i,n)},kl=(t,e,i)=>{const n=_d(t)||t;if(Nl(n))return;by(n,a=>{Ay(a,t,e,i),oo(n)},a=>{Ty(a,t,e,i),oo(n)})},Ey=(t,e,i)=>{ny(t),kl(t,e,i),cy(t),vy(t,e,i),wy(t,e,i),yy(t,e,i)},Ny=(t,e,i)=>{kl(t,e,i),Sy(t,e,i)},Pl=(t,e,i)=>{Iy(t)?Ny(t,e,i):Ey(t,e,i)},ky=(t,e,i)=>{t.setAttribute("loading","lazy"),kl(t,e,i),xy(t,e),bi(t,Ld)},gc=t=>{t.removeAttribute(Nt),t.removeAttribute(Sl),t.removeAttribute(Ml)},Py=t=>{El(t,e=>{gc(e)}),gc(t)},Jd=t=>{El(t,e=>{yi(e,Jn)}),yi(t,Jn)},zy=t=>{Ud(t,e=>{yi(e,qs)}),yi(t,$d),t.load()},By=t=>{yi(t,qs)},Dy=t=>{yi(t,Wd)},Ly={IMG:Jd,IFRAME:By,VIDEO:zy,OBJECT:Dy},Ry=t=>{const e=Ly[t.tagName];if(!e){dy(t);return}e(t)},jy=(t,e)=>{bl(t)||Al(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),Js(t),Fd(t)},Vy=(t,e,i,n)=>{!i.cancel_on_exit||!qw(t)||t.tagName==="IMG"&&(oo(t),Py(t),Jd(t),ht(t,i.class_loading),Tl(n,-1),Js(t),Jt(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),Jt(i.callback_enter,t,e,n),!r&&Pl(t,i,n)},Uy=(t,e,i,n)=>{bl(t)||(ln(t,i.class_exited),Vy(t,e,i,n),Jt(i.callback_exit,t,e,n))},$y=["IMG","IFRAME","VIDEO"],Kd=t=>t.use_native&&"loading"in HTMLImageElement.prototype,Wy=(t,e,i)=>{t.forEach(n=>{$y.indexOf(n.tagName)!==-1&&ky(n,e,i)}),Vd(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)=>{!Td||Kd(t)||(e._observer=new IntersectionObserver(i=>{Qy(i,t,e)},Fy(t)))},qd=t=>Array.prototype.slice.call(t),ds=t=>t.container.querySelectorAll(t.elements_selector),Xy=t=>qd(t).filter(bl),Jy=t=>ey(t),Ky=t=>qd(t).filter(Jy),mc=(t,e)=>Xy(t||ds(e)),qy=(t,e)=>{Ky(ds(t)).forEach(n=>{ht(n,t.class_error),Js(n)}),e.update()},ex=(t,e)=>{!Xt||(e._onlineHandler=()=>{qy(t,e)},window.addEventListener("online",e._onlineHandler))},tx=t=>{!Xt||window.removeEventListener("online",t._onlineHandler)},fr=function(t,e){const i=kd(t);this._settings=i,this.loadingCount=0,Gy(i,this),ex(i,this),this.update(e)};fr.prototype={update:function(t){const e=this._settings,i=mc(t,e);if(Vd(this,i.length),Ad||!Td){this.loadAll(i);return}if(Kd(e)){Wy(i,e,this);return}Yy(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),tx(this),ds(this._settings).forEach(t=>{Fd(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=>{Ks(n,this),Pl(n,e,this)})},restoreAll:function(){const t=this._settings;ds(t).forEach(e=>{_y(e,t)})}};fr.load=(t,e)=>{const i=kd(e);Pl(t,i)};fr.resetStatus=t=>{Js(t)};Xt&&Xw(fr,window.lazyLoadOptions);class ef{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 Xs,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 fr({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 vc(t){return t.touches?t.touches[0]:t}function tf(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function nf(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 Xs,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;tf(n);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const s=this.pagesScrollTop,{clientY:a}=vc(n),o=u=>{if(this.readonly)return;const{clientY:c}=vc(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 Xs,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 kg(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:B,height:P,src:z}=E;w.width=B,w.height=P;const te=B>P?"l":"p";x>0&&g.addPage([B,P],te);const C=await this.getBase64FromUrl(z),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,B,P);const k={centerX:B/2,centerY:P/2+x*P,scale:1},R=this.context.manager.windowManger;R._appliancePlugin?await R._appliancePlugin.screenshotToCanvasAsync(M,d,B,P,k):this.whiteboardView.screenshotToCanvas(M,d,B,P,k);const G=w.toDataURL("image/png");g.addImage(_,"JPEG",0,0,B,P,"","FAST"),g.addImage(G,"PNG",0,0,B,P,"","FAST"),M.clearRect(0,0,B,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 ef({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=>{tf(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||nf(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 Xs,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 ef({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&&!nf(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",lo={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={};/*
32
19
  object-assign
33
20
  (c) Sindre Sorhus
34
21
  @license MIT
35
- */var mc=Object.getOwnPropertySymbols,T0=Object.prototype.hasOwnProperty,k0=Object.prototype.propertyIsEnumerable;function P0(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function N0(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},i=0;i<10;i++)t["_"+String.fromCharCode(i)]=i;var n=Object.getOwnPropertyNames(t).map(function(s){return t[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 ep=N0()?Object.assign:function(e,t){for(var i,n=P0(e),r,s=1;s<arguments.length;s++){i=Object(arguments[s]);for(var o in i)T0.call(i,o)&&(n[o]=i[o]);if(mc){r=mc(i);for(var a=0;a<r.length;a++)k0.call(i,r[a])&&(n[r[a]]=i[r[a]])}}return n};/** @license React v16.14.0
22
+ */var wc=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 rf=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(wc){r=wc(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
36
23
  * react.production.min.js
37
24
  *
38
25
  * Copyright (c) Facebook, Inc. and its affiliates.
39
26
  *
40
27
  * This source code is licensed under the MIT license found in the
41
28
  * LICENSE file in the root directory of this source tree.
42
- */var Al=ep,ot=typeof Symbol=="function"&&Symbol.for,or=ot?Symbol.for("react.element"):60103,D0=ot?Symbol.for("react.portal"):60106,z0=ot?Symbol.for("react.fragment"):60107,L0=ot?Symbol.for("react.strict_mode"):60108,R0=ot?Symbol.for("react.profiler"):60114,j0=ot?Symbol.for("react.provider"):60109,B0=ot?Symbol.for("react.context"):60110,_0=ot?Symbol.for("react.forward_ref"):60112,V0=ot?Symbol.for("react.suspense"):60113,O0=ot?Symbol.for("react.memo"):60115,U0=ot?Symbol.for("react.lazy"):60116,vc=typeof Symbol=="function"&&Symbol.iterator;function ar(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var tp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ip={};function rn(e,t,i){this.props=e,this.context=t,this.refs=ip,this.updater=i||tp}rn.prototype.isReactComponent={};rn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error(ar(85));this.updater.enqueueSetState(this,e,t,"setState")};rn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function np(){}np.prototype=rn.prototype;function El(e,t,i){this.props=e,this.context=t,this.refs=ip,this.updater=i||tp}var Tl=El.prototype=new np;Tl.constructor=El;Al(Tl,rn.prototype);Tl.isPureReactComponent=!0;var kl={current:null},rp=Object.prototype.hasOwnProperty,sp={key:!0,ref:!0,__self:!0,__source:!0};function op(e,t,i){var n,r={},s=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)rp.call(t,n)&&!sp.hasOwnProperty(n)&&(r[n]=t[n]);var a=arguments.length-2;if(a===1)r.children=i;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];r.children=l}if(e&&e.defaultProps)for(n in a=e.defaultProps,a)r[n]===void 0&&(r[n]=a[n]);return{$$typeof:or,type:e,key:s,ref:o,props:r,_owner:kl.current}}function W0(e,t){return{$$typeof:or,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Pl(e){return typeof e=="object"&&e!==null&&e.$$typeof===or}function H0(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(i){return t[i]})}var ap=/\/+/g,cs=[];function lp(e,t,i,n){if(cs.length){var r=cs.pop();return r.result=e,r.keyPrefix=t,r.func=i,r.context=n,r.count=0,r}return{result:e,keyPrefix:t,func:i,context:n,count:0}}function up(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>cs.length&&cs.push(e)}function ra(e,t,i,n){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(r){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case or:case D0:s=!0}}if(s)return i(n,e,t===""?"."+Mo(e,0):t),1;if(s=0,t=t===""?".":t+":",Array.isArray(e))for(var o=0;o<e.length;o++){r=e[o];var a=t+Mo(r,o);s+=ra(r,a,i,n)}else if(e===null||typeof e!="object"?a=null:(a=vc&&e[vc]||e["@@iterator"],a=typeof a=="function"?a:null),typeof a=="function")for(e=a.call(e),o=0;!(r=e.next()).done;)r=r.value,a=t+Mo(r,o++),s+=ra(r,a,i,n);else if(r==="object")throw i=""+e,Error(ar(31,i==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":i,""));return s}function sa(e,t,i){return e==null?0:ra(e,"",t,i)}function Mo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?H0(e.key):t.toString(36)}function $0(e,t){e.func.call(e.context,t,e.count++)}function F0(e,t,i){var n=e.result,r=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?oa(e,n,i,function(s){return s}):e!=null&&(Pl(e)&&(e=W0(e,r+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(ap,"$&/")+"/")+i)),n.push(e))}function oa(e,t,i,n,r){var s="";i!=null&&(s=(""+i).replace(ap,"$&/")+"/"),t=lp(t,s,n,r),sa(e,F0,t),up(t)}var cp={current:null};function Nt(){var e=cp.current;if(e===null)throw Error(ar(321));return e}var Q0={ReactCurrentDispatcher:cp,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:kl,IsSomeRendererActing:{current:!1},assign:Al};G.Children={map:function(e,t,i){if(e==null)return e;var n=[];return oa(e,n,null,t,i),n},forEach:function(e,t,i){if(e==null)return e;t=lp(null,null,t,i),sa(e,$0,t),up(t)},count:function(e){return sa(e,function(){return null},null)},toArray:function(e){var t=[];return oa(e,t,null,function(i){return i}),t},only:function(e){if(!Pl(e))throw Error(ar(143));return e}};G.Component=rn;G.Fragment=z0;G.Profiler=R0;G.PureComponent=El;G.StrictMode=L0;G.Suspense=V0;G.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q0;G.cloneElement=function(e,t,i){if(e==null)throw Error(ar(267,e));var n=Al({},e.props),r=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=kl.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)rp.call(t,l)&&!sp.hasOwnProperty(l)&&(n[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)n.children=i;else if(1<l){a=Array(l);for(var u=0;u<l;u++)a[u]=arguments[u+2];n.children=a}return{$$typeof:or,type:e.type,key:r,ref:s,props:n,_owner:o}};G.createContext=function(e,t){return t===void 0&&(t=null),e={$$typeof:B0,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider={$$typeof:j0,_context:e},e.Consumer=e};G.createElement=op;G.createFactory=function(e){var t=op.bind(null,e);return t.type=e,t};G.createRef=function(){return{current:null}};G.forwardRef=function(e){return{$$typeof:_0,render:e}};G.isValidElement=Pl;G.lazy=function(e){return{$$typeof:U0,_ctor:e,_status:-1,_result:null}};G.memo=function(e,t){return{$$typeof:O0,type:e,compare:t===void 0?null:t}};G.useCallback=function(e,t){return Nt().useCallback(e,t)};G.useContext=function(e,t){return Nt().useContext(e,t)};G.useDebugValue=function(){};G.useEffect=function(e,t){return Nt().useEffect(e,t)};G.useImperativeHandle=function(e,t,i){return Nt().useImperativeHandle(e,t,i)};G.useLayoutEffect=function(e,t){return Nt().useLayoutEffect(e,t)};G.useMemo=function(e,t){return Nt().useMemo(e,t)};G.useReducer=function(e,t,i){return Nt().useReducer(e,t,i)};G.useRef=function(e){return Nt().useRef(e)};G.useState=function(e){return Nt().useState(e)};G.version="16.14.0";Ai.exports=G;var $=Ai.exports,dp={exports:{}},Xe={},hp={exports:{}},pp={};/** @license React v0.19.1
29
+ */var zl=rf,it=typeof Symbol=="function"&&Symbol.for,pr=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,yc=typeof Symbol=="function"&&Symbol.iterator;function gr(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 sf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},af={};function un(t,e,i){this.props=t,this.context=e,this.refs=af,this.updater=i||sf}un.prototype.isReactComponent={};un.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error(gr(85));this.updater.enqueueSetState(this,t,e,"setState")};un.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function of(){}of.prototype=un.prototype;function Bl(t,e,i){this.props=t,this.context=e,this.refs=af,this.updater=i||sf}var Dl=Bl.prototype=new of;Dl.constructor=Bl;zl(Dl,un.prototype);Dl.isPureReactComponent=!0;var Ll={current:null},lf=Object.prototype.hasOwnProperty,uf={key:!0,ref:!0,__self:!0,__source:!0};function cf(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)lf.call(e,n)&&!uf.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:pr,type:t,key:s,ref:a,props:r,_owner:Ll.current}}function kx(t,e){return{$$typeof:pr,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Rl(t){return typeof t=="object"&&t!==null&&t.$$typeof===pr}function Px(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(i){return e[i]})}var hf=/\/+/g,fs=[];function df(t,e,i,n){if(fs.length){var r=fs.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 ff(t){t.result=null,t.keyPrefix=null,t.func=null,t.context=null,t.count=0,10>fs.length&&fs.push(t)}function uo(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 pr:case xx:s=!0}}if(s)return i(n,t,e===""?"."+Ea(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+Ea(r,a);s+=uo(r,o,i,n)}else if(t===null||typeof t!="object"?o=null:(o=yc&&t[yc]||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+Ea(r,a++),s+=uo(r,o,i,n);else if(r==="object")throw i=""+t,Error(gr(31,i==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":i,""));return s}function co(t,e,i){return t==null?0:uo(t,"",e,i)}function Ea(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Px(t.key):e.toString(36)}function zx(t,e){t.func.call(t.context,e,t.count++)}function Bx(t,e,i){var n=t.result,r=t.keyPrefix;t=t.func.call(t.context,e,t.count++),Array.isArray(t)?ho(t,n,i,function(s){return s}):t!=null&&(Rl(t)&&(t=kx(t,r+(!t.key||e&&e.key===t.key?"":(""+t.key).replace(hf,"$&/")+"/")+i)),n.push(t))}function ho(t,e,i,n,r){var s="";i!=null&&(s=(""+i).replace(hf,"$&/")+"/"),e=df(e,s,n,r),co(t,Bx,e),ff(e)}var pf={current:null};function kt(){var t=pf.current;if(t===null)throw Error(gr(321));return t}var Dx={ReactCurrentDispatcher:pf,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:Ll,IsSomeRendererActing:{current:!1},assign:zl};J.Children={map:function(t,e,i){if(t==null)return t;var n=[];return ho(t,n,null,e,i),n},forEach:function(t,e,i){if(t==null)return t;e=df(null,null,e,i),co(t,zx,e),ff(e)},count:function(t){return co(t,function(){return null},null)},toArray:function(t){var e=[];return ho(t,e,null,function(i){return i}),e},only:function(t){if(!Rl(t))throw Error(gr(143));return t}};J.Component=un;J.Fragment=Sx;J.Profiler=Ix;J.PureComponent=Bl;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(gr(267,t));var n=zl({},t.props),r=t.key,s=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=Ll.current),e.key!==void 0&&(r=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(l in e)lf.call(e,l)&&!uf.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:pr,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=cf;J.createFactory=function(t){var e=cf.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=Rl;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 kt().useCallback(t,e)};J.useContext=function(t,e){return kt().useContext(t,e)};J.useDebugValue=function(){};J.useEffect=function(t,e){return kt().useEffect(t,e)};J.useImperativeHandle=function(t,e,i){return kt().useImperativeHandle(t,e,i)};J.useLayoutEffect=function(t,e){return kt().useLayoutEffect(t,e)};J.useMemo=function(t,e){return kt().useMemo(t,e)};J.useReducer=function(t,e,i){return kt().useReducer(t,e,i)};J.useRef=function(t){return kt().useRef(t)};J.useState=function(t){return kt().useState(t)};J.version="16.14.0";Ai.exports=J;var F=Ai.exports,gf={exports:{}},Ge={},mf={exports:{}},vf={};/** @license React v0.19.1
43
30
  * scheduler.production.min.js
44
31
  *
45
32
  * Copyright (c) Facebook, Inc. and its affiliates.
46
33
  *
47
34
  * This source code is licensed under the MIT license found in the
48
35
  * LICENSE file in the root directory of this source tree.
49
- */(function(e){var t,i,n,r,s;if(typeof window=="undefined"||typeof MessageChannel!="function"){var o=null,a=null,l=function(){if(o!==null)try{var A=e.unstable_now();o(!0,A),o=null}catch(R){throw setTimeout(l,0),R}},u=Date.now();e.unstable_now=function(){return Date.now()-u},t=function(A){o!==null?setTimeout(t,0,A):(o=A,setTimeout(l,0))},i=function(A,R){a=setTimeout(A,R)},n=function(){clearTimeout(a)},r=function(){return!1},s=e.unstable_forceFrameRate=function(){}}else{var c=window.performance,d=window.Date,m=window.setTimeout,w=window.clearTimeout;if(typeof console!="undefined"){var v=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 v!="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")e.unstable_now=function(){return c.now()};else{var x=d.now();e.unstable_now=function(){return d.now()-x}}var h=!1,p=null,f=-1,g=5,y=0;r=function(){return e.unstable_now()>=y},s=function(){},e.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,T=S.port2;S.port1.onmessage=function(){if(p!==null){var A=e.unstable_now();y=A+g;try{p(!0,A)?T.postMessage(null):(h=!1,p=null)}catch(R){throw T.postMessage(null),R}}else h=!1},t=function(A){p=A,h||(h=!0,T.postMessage(null))},i=function(A,R){f=m(function(){A(e.unstable_now())},R)},n=function(){w(f),f=-1}}function N(A,R){var H=A.length;A.push(R);e:for(;;){var X=H-1>>>1,J=A[X];if(J!==void 0&&0<ne(J,R))A[X]=R,A[H]=J,H=X;else break e}}function k(A){return A=A[0],A===void 0?null:A}function P(A){var R=A[0];if(R!==void 0){var H=A.pop();if(H!==R){A[0]=H;e:for(var X=0,J=A.length;X<J;){var at=2*(X+1)-1,$e=A[at],Ke=at+1,Fe=A[Ke];if($e!==void 0&&0>ne($e,H))Fe!==void 0&&0>ne(Fe,$e)?(A[X]=Fe,A[Ke]=H,X=Ke):(A[X]=$e,A[at]=H,X=at);else if(Fe!==void 0&&0>ne(Fe,H))A[X]=Fe,A[Ke]=H,X=Ke;else break e}}return R}return null}function ne(A,R){var H=A.sortIndex-R.sortIndex;return H!==0?H:A.id-R.id}var b=[],I=[],z=1,j=null,F=3,le=!1,He=!1,Je=!1;function Dt(A){for(var R=k(I);R!==null;){if(R.callback===null)P(I);else if(R.startTime<=A)P(I),R.sortIndex=R.expirationTime,N(b,R);else break;R=k(I)}}function zt(A){if(Je=!1,Dt(A),!He)if(k(b)!==null)He=!0,t(an);else{var R=k(I);R!==null&&i(zt,R.startTime-A)}}function an(A,R){He=!1,Je&&(Je=!1,n()),le=!0;var H=F;try{for(Dt(R),j=k(b);j!==null&&(!(j.expirationTime>R)||A&&!r());){var X=j.callback;if(X!==null){j.callback=null,F=j.priorityLevel;var J=X(j.expirationTime<=R);R=e.unstable_now(),typeof J=="function"?j.callback=J:j===k(b)&&P(b),Dt(R)}else P(b);j=k(b)}if(j!==null)var at=!0;else{var $e=k(I);$e!==null&&i(zt,$e.startTime-R),at=!1}return at}finally{j=null,F=H,le=!1}}function gr(A){switch(A){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var oo=s;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(A){A.callback=null},e.unstable_continueExecution=function(){He||le||(He=!0,t(an))},e.unstable_getCurrentPriorityLevel=function(){return F},e.unstable_getFirstCallbackNode=function(){return k(b)},e.unstable_next=function(A){switch(F){case 1:case 2:case 3:var R=3;break;default:R=F}var H=F;F=R;try{return A()}finally{F=H}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=oo,e.unstable_runWithPriority=function(A,R){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var H=F;F=A;try{return R()}finally{F=H}},e.unstable_scheduleCallback=function(A,R,H){var X=e.unstable_now();if(typeof H=="object"&&H!==null){var J=H.delay;J=typeof J=="number"&&0<J?X+J:X,H=typeof H.timeout=="number"?H.timeout:gr(A)}else H=gr(A),J=X;return H=J+H,A={id:z++,callback:R,priorityLevel:A,startTime:J,expirationTime:H,sortIndex:-1},J>X?(A.sortIndex=J,N(I,A),k(b)===null&&A===k(I)&&(Je?n():Je=!0,i(zt,J-X))):(A.sortIndex=H,N(b,A),He||le||(He=!0,t(an))),A},e.unstable_shouldYield=function(){var A=e.unstable_now();Dt(A);var R=k(b);return R!==j&&j!==null&&R!==null&&R.callback!==null&&R.startTime<=A&&R.expirationTime<j.expirationTime||r()},e.unstable_wrapCallback=function(A){var R=F;return function(){var H=F;F=R;try{return A.apply(this,arguments)}finally{F=H}}}})(pp);hp.exports=pp;/** @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(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 B(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 z(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)z(S);else if(j.startTime<=A)z(S),j.sortIndex=j.expirationTime,B(C,j);else break;j=P(S)}}function qt(A){if(Xe=!1,nt(A),!ge)if(P(C)!==null)ge=!0,e(ei);else{var j=P(S);j!==null&&i(qt,j.startTime-A)}}function ei(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)&&z(C),nt(j)}else z(C);k=P(C)}if(k!==null)var rt=!0;else{var st=P(S);st!==null&&i(qt,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(ei))},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,B(S,A),P(C)===null&&A===P(S)&&(Xe?n():Xe=!0,i(qt,se-ie))):(A.sortIndex=Q,B(C,A),ge||G||(ge=!0,e(ei))),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}}}})(vf);mf.exports=vf;/** @license React v16.14.0
50
37
  * react-dom.production.min.js
51
38
  *
52
39
  * Copyright (c) Facebook, Inc. and its affiliates.
53
40
  *
54
41
  * This source code is licensed under the MIT license found in the
55
42
  * LICENSE file in the root directory of this source tree.
56
- */var Zs=Ai.exports,Ae=ep,me=hp.exports;function M(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!Zs)throw Error(M(227));function Z0(e,t,i,n,r,s,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(i,u)}catch(c){this.onError(c)}}var Nn=!1,ds=null,hs=!1,aa=null,Y0={onError:function(e){Nn=!0,ds=e}};function G0(e,t,i,n,r,s,o,a,l){Nn=!1,ds=null,Z0.apply(Y0,arguments)}function X0(e,t,i,n,r,s,o,a,l){if(G0.apply(this,arguments),Nn){if(Nn){var u=ds;Nn=!1,ds=null}else throw Error(M(198));hs||(hs=!0,aa=u)}}var Nl=null,fp=null,gp=null;function wc(e,t,i){var n=e.type||"unknown-event";e.currentTarget=gp(i),X0(n,t,void 0,e),e.currentTarget=null}var ps=null,Di={};function mp(){if(ps)for(var e in Di){var t=Di[e],i=ps.indexOf(e);if(!(-1<i))throw Error(M(96,e));if(!fs[i]){if(!t.extractEvents)throw Error(M(97,e));fs[i]=t,i=t.eventTypes;for(var n in i){var r=void 0,s=i[n],o=t,a=n;if(la.hasOwnProperty(a))throw Error(M(99,a));la[a]=s;var l=s.phasedRegistrationNames;if(l){for(r in l)l.hasOwnProperty(r)&&yc(l[r],o,a);r=!0}else s.registrationName?(yc(s.registrationName,o,a),r=!0):r=!1;if(!r)throw Error(M(98,n,e))}}}}function yc(e,t,i){if(Xi[e])throw Error(M(100,e));Xi[e]=t,Dl[e]=t.eventTypes[i].dependencies}var fs=[],la={},Xi={},Dl={};function vp(e){var t=!1,i;for(i in e)if(e.hasOwnProperty(i)){var n=e[i];if(!Di.hasOwnProperty(i)||Di[i]!==n){if(Di[i])throw Error(M(102,i));Di[i]=n,t=!0}}t&&mp()}var ti=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),ua=null,Ui=null,Wi=null;function xc(e){if(e=fp(e)){if(typeof ua!="function")throw Error(M(280));var t=e.stateNode;t&&(t=Nl(t),ua(e.stateNode,e.type,t))}}function wp(e){Ui?Wi?Wi.push(e):Wi=[e]:Ui=e}function yp(){if(Ui){var e=Ui,t=Wi;if(Wi=Ui=null,xc(e),t)for(e=0;e<t.length;e++)xc(t[e])}}function zl(e,t){return e(t)}function xp(e,t,i,n,r){return e(t,i,n,r)}function Ll(){}var Sp=zl,oi=!1,Co=!1;function Rl(){(Ui!==null||Wi!==null)&&(Ll(),yp())}function Mp(e,t,i){if(Co)return e(t,i);Co=!0;try{return Sp(e,t,i)}finally{Co=!1,Rl()}}var J0=/^[: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]*$/,Sc=Object.prototype.hasOwnProperty,Mc={},Cc={};function K0(e){return Sc.call(Cc,e)?!0:Sc.call(Mc,e)?!1:J0.test(e)?Cc[e]=!0:(Mc[e]=!0,!1)}function q0(e,t,i,n){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ex(e,t,i,n){if(t===null||typeof t=="undefined"||q0(e,t,i,n))return!0;if(n)return!1;if(i!==null)switch(i.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ee(e,t,i,n,r,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=r,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=s}var ve={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ve[e]=new Ee(e,0,!1,e,null,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ve[t]=new Ee(t,1,!1,e[1],null,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ve[e]=new Ee(e,2,!1,e.toLowerCase(),null,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ve[e]=new Ee(e,2,!1,e,null,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ve[e]=new Ee(e,3,!1,e.toLowerCase(),null,!1)});["checked","multiple","muted","selected"].forEach(function(e){ve[e]=new Ee(e,3,!0,e,null,!1)});["capture","download"].forEach(function(e){ve[e]=new Ee(e,4,!1,e,null,!1)});["cols","rows","size","span"].forEach(function(e){ve[e]=new Ee(e,6,!1,e,null,!1)});["rowSpan","start"].forEach(function(e){ve[e]=new Ee(e,5,!1,e.toLowerCase(),null,!1)});var jl=/[\-:]([a-z])/g;function Bl(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(jl,Bl);ve[t]=new Ee(t,1,!1,e,null,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(jl,Bl);ve[t]=new Ee(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(jl,Bl);ve[t]=new Ee(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)});["tabIndex","crossOrigin"].forEach(function(e){ve[e]=new Ee(e,1,!1,e.toLowerCase(),null,!1)});ve.xlinkHref=new Ee("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0);["src","href","action","formAction"].forEach(function(e){ve[e]=new Ee(e,1,!1,e.toLowerCase(),null,!0)});var rt=Zs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;rt.hasOwnProperty("ReactCurrentDispatcher")||(rt.ReactCurrentDispatcher={current:null});rt.hasOwnProperty("ReactCurrentBatchConfig")||(rt.ReactCurrentBatchConfig={suspense:null});function _l(e,t,i,n){var r=ve.hasOwnProperty(t)?ve[t]:null,s=r!==null?r.type===0:n?!1:!(!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N");s||(ex(t,i,r,n)&&(i=null),n||r===null?K0(t)&&(i===null?e.removeAttribute(t):e.setAttribute(t,""+i)):r.mustUseProperty?e[r.propertyName]=i===null?r.type===3?!1:"":i:(t=r.attributeName,n=r.attributeNamespace,i===null?e.removeAttribute(t):(r=r.type,i=r===3||r===4&&i===!0?"":""+i,n?e.setAttributeNS(n,t,i):e.setAttribute(t,i))))}var tx=/^(.*)[\\\/]/,Le=typeof Symbol=="function"&&Symbol.for,Er=Le?Symbol.for("react.element"):60103,zi=Le?Symbol.for("react.portal"):60106,si=Le?Symbol.for("react.fragment"):60107,Cp=Le?Symbol.for("react.strict_mode"):60108,Fr=Le?Symbol.for("react.profiler"):60114,Ip=Le?Symbol.for("react.provider"):60109,bp=Le?Symbol.for("react.context"):60110,ix=Le?Symbol.for("react.concurrent_mode"):60111,Vl=Le?Symbol.for("react.forward_ref"):60112,Qr=Le?Symbol.for("react.suspense"):60113,ca=Le?Symbol.for("react.suspense_list"):60120,Ol=Le?Symbol.for("react.memo"):60115,Ap=Le?Symbol.for("react.lazy"):60116,Ep=Le?Symbol.for("react.block"):60121,Ic=typeof Symbol=="function"&&Symbol.iterator;function cn(e){return e===null||typeof e!="object"?null:(e=Ic&&e[Ic]||e["@@iterator"],typeof e=="function"?e:null)}function nx(e){if(e._status===-1){e._status=0;var t=e._ctor;t=t(),e._result=t,t.then(function(i){e._status===0&&(i=i.default,e._status=1,e._result=i)},function(i){e._status===0&&(e._status=2,e._result=i)})}}function kt(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case si:return"Fragment";case zi:return"Portal";case Fr:return"Profiler";case Cp:return"StrictMode";case Qr:return"Suspense";case ca:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case bp:return"Context.Consumer";case Ip:return"Context.Provider";case Vl:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case Ol:return kt(e.type);case Ep:return kt(e.render);case Ap:if(e=e._status===1?e._result:null)return kt(e)}return null}function Ul(e){var t="";do{e:switch(e.tag){case 3:case 4:case 6:case 7:case 10:case 9:var i="";break e;default:var n=e._debugOwner,r=e._debugSource,s=kt(e.type);i=null,n&&(i=kt(n.type)),n=s,s="",r?s=" (at "+r.fileName.replace(tx,"")+":"+r.lineNumber+")":i&&(s=" (created by "+i+")"),i=`
57
- in `+(n||"Unknown")+s}t+=i,e=e.return}while(e);return t}function Xt(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function Tp(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function rx(e){var t=Tp(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof i!="undefined"&&typeof i.get=="function"&&typeof i.set=="function"){var r=i.get,s=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Tr(e){e._valueTracker||(e._valueTracker=rx(e))}function kp(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),n="";return e&&(n=Tp(e)?e.checked?"true":"false":e.value),e=n,e!==i?(t.setValue(e),!0):!1}function da(e,t){var i=t.checked;return Ae({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i!=null?i:e._wrapperState.initialChecked})}function bc(e,t){var i=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;i=Xt(t.value!=null?t.value:i),e._wrapperState={initialChecked:n,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Pp(e,t){t=t.checked,t!=null&&_l(e,"checked",t,!1)}function ha(e,t){Pp(e,t);var i=Xt(t.value),n=t.type;if(i!=null)n==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?pa(e,t.type,i):t.hasOwnProperty("defaultValue")&&pa(e,t.type,Xt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ac(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function pa(e,t,i){(t!=="number"||e.ownerDocument.activeElement!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}function sx(e){var t="";return Zs.Children.forEach(e,function(i){i!=null&&(t+=i)}),t}function fa(e,t){return e=Ae({children:void 0},t),(t=sx(t.children))&&(e.children=t),e}function Hi(e,t,i,n){if(e=e.options,t){t={};for(var r=0;r<i.length;r++)t["$"+i[r]]=!0;for(i=0;i<e.length;i++)r=t.hasOwnProperty("$"+e[i].value),e[i].selected!==r&&(e[i].selected=r),r&&n&&(e[i].defaultSelected=!0)}else{for(i=""+Xt(i),t=null,r=0;r<e.length;r++){if(e[r].value===i){e[r].selected=!0,n&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function ga(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(M(91));return Ae({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ec(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(M(92));if(Array.isArray(i)){if(!(1>=i.length))throw Error(M(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:Xt(i)}}function Np(e,t){var i=Xt(t.value),n=Xt(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),n!=null&&(e.defaultValue=""+n)}function Tc(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}var Dp={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function zp(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ma(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?zp(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var kr,Lp=function(e){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(t,i,n,r){MSApp.execUnsafeLocalFunction(function(){return e(t,i,n,r)})}:e}(function(e,t){if(e.namespaceURI!==Dp.svg||"innerHTML"in e)e.innerHTML=t;else{for(kr=kr||document.createElement("div"),kr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=kr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function $n(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}function Pr(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Li={animationend:Pr("Animation","AnimationEnd"),animationiteration:Pr("Animation","AnimationIteration"),animationstart:Pr("Animation","AnimationStart"),transitionend:Pr("Transition","TransitionEnd")},Io={},Rp={};ti&&(Rp=document.createElement("div").style,"AnimationEvent"in window||(delete Li.animationend.animation,delete Li.animationiteration.animation,delete Li.animationstart.animation),"TransitionEvent"in window||delete Li.transitionend.transition);function Ys(e){if(Io[e])return Io[e];if(!Li[e])return e;var t=Li[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Rp)return Io[e]=t[i];return e}var jp=Ys("animationend"),Bp=Ys("animationiteration"),_p=Ys("animationstart"),Vp=Ys("transitionend"),Sn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),kc=new(typeof WeakMap=="function"?WeakMap:Map);function Wl(e){var t=kc.get(e);return t===void 0&&(t=new Map,kc.set(e,t)),t}function Ei(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.effectTag&1026)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function Op(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Pc(e){if(Ei(e)!==e)throw Error(M(188))}function ox(e){var t=e.alternate;if(!t){if(t=Ei(e),t===null)throw Error(M(188));return t!==e?null:e}for(var i=e,n=t;;){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 Pc(r),e;if(s===n)return Pc(r),t;s=s.sibling}throw Error(M(188))}if(i.return!==n.return)i=r,n=s;else{for(var o=!1,a=r.child;a;){if(a===i){o=!0,i=r,n=s;break}if(a===n){o=!0,n=r,i=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===i){o=!0,i=s,n=r;break}if(a===n){o=!0,n=s,i=r;break}a=a.sibling}if(!o)throw Error(M(189))}}if(i.alternate!==n)throw Error(M(190))}if(i.tag!==3)throw Error(M(188));return i.stateNode.current===i?e:t}function Up(e){if(e=ox(e),!e)return null;for(var t=e;;){if(t.tag===5||t.tag===6)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Ji(e,t){if(t==null)throw Error(M(30));return e==null?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function Hl(e,t,i){Array.isArray(e)?e.forEach(t,i):e&&t.call(i,e)}var dn=null;function ax(e){if(e){var t=e._dispatchListeners,i=e._dispatchInstances;if(Array.isArray(t))for(var n=0;n<t.length&&!e.isPropagationStopped();n++)wc(e,t[n],i[n]);else t&&wc(e,t,i);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function Gs(e){if(e!==null&&(dn=Ji(dn,e)),e=dn,dn=null,e){if(Hl(e,ax),dn)throw Error(M(95));if(hs)throw e=aa,hs=!1,aa=null,e}}function $l(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}function Wp(e){if(!ti)return!1;e="on"+e;var t=e in document;return t||(t=document.createElement("div"),t.setAttribute(e,"return;"),t=typeof t[e]=="function"),t}var gs=[];function Hp(e){e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>gs.length&&gs.push(e)}function $p(e,t,i,n){if(gs.length){var r=gs.pop();return r.topLevelType=e,r.eventSystemFlags=n,r.nativeEvent=t,r.targetInst=i,r}return{topLevelType:e,eventSystemFlags:n,nativeEvent:t,targetInst:i,ancestors:[]}}function Fp(e){var t=e.targetInst,i=t;do{if(!i){e.ancestors.push(i);break}var n=i;if(n.tag===3)n=n.stateNode.containerInfo;else{for(;n.return;)n=n.return;n=n.tag!==3?null:n.stateNode.containerInfo}if(!n)break;t=i.tag,t!==5&&t!==6||e.ancestors.push(i),i=ur(n)}while(i);for(i=0;i<e.ancestors.length;i++){t=e.ancestors[i];var r=$l(e.nativeEvent);n=e.topLevelType;var s=e.nativeEvent,o=e.eventSystemFlags;i===0&&(o|=64);for(var a=null,l=0;l<fs.length;l++){var u=fs[l];u&&(u=u.extractEvents(n,t,s,r,o))&&(a=Ji(a,u))}Gs(a)}}function va(e,t,i){if(!i.has(e)){switch(e){case"scroll":Mn(t,"scroll",!0);break;case"focus":case"blur":Mn(t,"focus",!0),Mn(t,"blur",!0),i.set("blur",null),i.set("focus",null);break;case"cancel":case"close":Wp(e)&&Mn(t,e,!0);break;case"invalid":case"submit":case"reset":break;default:Sn.indexOf(e)===-1&&re(e,t)}i.set(e,null)}}var Qp,Fl,Zp,wa=!1,ht=[],Ht=null,$t=null,Ft=null,Fn=new Map,Qn=new Map,hn=[],ya="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(" "),lx="focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture".split(" ");function ux(e,t){var i=Wl(t);ya.forEach(function(n){va(n,t,i)}),lx.forEach(function(n){va(n,t,i)})}function xa(e,t,i,n,r){return{blockedOn:e,topLevelType:t,eventSystemFlags:i|32,nativeEvent:r,container:n}}function Nc(e,t){switch(e){case"focus":case"blur":Ht=null;break;case"dragenter":case"dragleave":$t=null;break;case"mouseover":case"mouseout":Ft=null;break;case"pointerover":case"pointerout":Fn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qn.delete(t.pointerId)}}function pn(e,t,i,n,r,s){return e===null||e.nativeEvent!==s?(e=xa(t,i,n,r,s),t!==null&&(t=cr(t),t!==null&&Fl(t)),e):(e.eventSystemFlags|=n,e)}function cx(e,t,i,n,r){switch(t){case"focus":return Ht=pn(Ht,e,t,i,n,r),!0;case"dragenter":return $t=pn($t,e,t,i,n,r),!0;case"mouseover":return Ft=pn(Ft,e,t,i,n,r),!0;case"pointerover":var s=r.pointerId;return Fn.set(s,pn(Fn.get(s)||null,e,t,i,n,r)),!0;case"gotpointercapture":return s=r.pointerId,Qn.set(s,pn(Qn.get(s)||null,e,t,i,n,r)),!0}return!1}function dx(e){var t=ur(e.target);if(t!==null){var i=Ei(t);if(i!==null){if(t=i.tag,t===13){if(t=Op(i),t!==null){e.blockedOn=t,me.unstable_runWithPriority(e.priority,function(){Zp(i)});return}}else if(t===3&&i.stateNode.hydrate){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Zr(e){if(e.blockedOn!==null)return!1;var t=Yl(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);if(t!==null){var i=cr(t);return i!==null&&Fl(i),e.blockedOn=t,!1}return!0}function Dc(e,t,i){Zr(e)&&i.delete(t)}function hx(){for(wa=!1;0<ht.length;){var e=ht[0];if(e.blockedOn!==null){e=cr(e.blockedOn),e!==null&&Qp(e);break}var t=Yl(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);t!==null?e.blockedOn=t:ht.shift()}Ht!==null&&Zr(Ht)&&(Ht=null),$t!==null&&Zr($t)&&($t=null),Ft!==null&&Zr(Ft)&&(Ft=null),Fn.forEach(Dc),Qn.forEach(Dc)}function fn(e,t){e.blockedOn===t&&(e.blockedOn=null,wa||(wa=!0,me.unstable_scheduleCallback(me.unstable_NormalPriority,hx)))}function Yp(e){function t(r){return fn(r,e)}if(0<ht.length){fn(ht[0],e);for(var i=1;i<ht.length;i++){var n=ht[i];n.blockedOn===e&&(n.blockedOn=null)}}for(Ht!==null&&fn(Ht,e),$t!==null&&fn($t,e),Ft!==null&&fn(Ft,e),Fn.forEach(t),Qn.forEach(t),i=0;i<hn.length;i++)n=hn[i],n.blockedOn===e&&(n.blockedOn=null);for(;0<hn.length&&(i=hn[0],i.blockedOn===null);)dx(i),i.blockedOn===null&&hn.shift()}var Gp={},Xp=new Map,Ql=new Map,px=["abort","abort",jp,"animationEnd",Bp,"animationIteration",_p,"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",Vp,"transitionEnd","waiting","waiting"];function Zl(e,t){for(var i=0;i<e.length;i+=2){var n=e[i],r=e[i+1],s="on"+(r[0].toUpperCase()+r.slice(1));s={phasedRegistrationNames:{bubbled:s,captured:s+"Capture"},dependencies:[n],eventPriority:t},Ql.set(n,t),Xp.set(n,s),Gp[r]=s}}Zl("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);Zl("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);Zl(px,2);for(var zc="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),bo=0;bo<zc.length;bo++)Ql.set(zc[bo],0);var fx=me.unstable_UserBlockingPriority,gx=me.unstable_runWithPriority,Yr=!0;function re(e,t){Mn(t,e,!1)}function Mn(e,t,i){var n=Ql.get(t);switch(n===void 0?2:n){case 0:n=mx.bind(null,t,1,e);break;case 1:n=vx.bind(null,t,1,e);break;default:n=Xs.bind(null,t,1,e)}i?e.addEventListener(t,n,!0):e.addEventListener(t,n,!1)}function mx(e,t,i,n){oi||Ll();var r=Xs,s=oi;oi=!0;try{xp(r,e,t,i,n)}finally{(oi=s)||Rl()}}function vx(e,t,i,n){gx(fx,Xs.bind(null,e,t,i,n))}function Xs(e,t,i,n){if(Yr)if(0<ht.length&&-1<ya.indexOf(e))e=xa(null,e,t,i,n),ht.push(e);else{var r=Yl(e,t,i,n);if(r===null)Nc(e,n);else if(-1<ya.indexOf(e))e=xa(r,e,t,i,n),ht.push(e);else if(!cx(r,e,t,i,n)){Nc(e,n),e=$p(e,n,null,t);try{Mp(Fp,e)}finally{Hp(e)}}}}function Yl(e,t,i,n){if(i=$l(n),i=ur(i),i!==null){var r=Ei(i);if(r===null)i=null;else{var s=r.tag;if(s===13){if(i=Op(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)}}e=$p(e,n,i,t);try{Mp(Fp,e)}finally{Hp(e)}return null}var Dn={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},wx=["Webkit","ms","Moz","O"];Object.keys(Dn).forEach(function(e){wx.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Dn[t]=Dn[e]})});function Jp(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||Dn.hasOwnProperty(e)&&Dn[e]?(""+t).trim():t+"px"}function Kp(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var n=i.indexOf("--")===0,r=Jp(i,t[i],n);i==="float"&&(i="cssFloat"),n?e.setProperty(i,r):e[i]=r}}var yx=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 Sa(e,t){if(t){if(yx[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(M(137,e,""));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(M(60));if(!(typeof t.dangerouslySetInnerHTML=="object"&&"__html"in t.dangerouslySetInnerHTML))throw Error(M(61))}if(t.style!=null&&typeof t.style!="object")throw Error(M(62,""))}}function Ma(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Lc=Dp.html;function xt(e,t){e=e.nodeType===9||e.nodeType===11?e:e.ownerDocument;var i=Wl(e);t=Dl[t];for(var n=0;n<t.length;n++)va(t[n],e,i)}function ms(){}function Ca(e){if(e=e||(typeof document!="undefined"?document:void 0),typeof e=="undefined")return null;try{return e.activeElement||e.body}catch{return e.body}}function Rc(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jc(e,t){var i=Rc(e);e=0;for(var n;i;){if(i.nodeType===3){if(n=e+i.textContent.length,e<=t&&n>=t)return{node:i,offset:t-e};e=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Rc(i)}}function qp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?qp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Bc(){for(var e=window,t=Ca();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Ca(e.document)}return t}function Ia(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var ef="$",tf="/$",Gl="$?",Xl="$!",Ao=null,Eo=null;function nf(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function ba(e,t){return e==="textarea"||e==="option"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var To=typeof setTimeout=="function"?setTimeout:void 0,xx=typeof clearTimeout=="function"?clearTimeout:void 0;function $i(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break}return e}function _c(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i===ef||i===Xl||i===Gl){if(t===0)return e;t--}else i===tf&&t++}e=e.previousSibling}return null}var Jl=Math.random().toString(36).slice(2),jt="__reactInternalInstance$"+Jl,vs="__reactEventHandlers$"+Jl,lr="__reactContainere$"+Jl;function ur(e){var t=e[jt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[lr]||i[jt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=_c(e);e!==null;){if(i=e[jt])return i;e=_c(e)}return t}e=i,i=e.parentNode}return null}function cr(e){return e=e[jt]||e[lr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function xi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(M(33))}function Kl(e){return e[vs]||null}function St(e){do e=e.return;while(e&&e.tag!==5);return e||null}function rf(e,t){var i=e.stateNode;if(!i)return null;var n=Nl(i);if(!n)return null;i=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(M(231,t,typeof i));return i}function Vc(e,t,i){(t=rf(e,i.dispatchConfig.phasedRegistrationNames[t]))&&(i._dispatchListeners=Ji(i._dispatchListeners,t),i._dispatchInstances=Ji(i._dispatchInstances,e))}function Sx(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,i=[];t;)i.push(t),t=St(t);for(t=i.length;0<t--;)Vc(i[t],"captured",e);for(t=0;t<i.length;t++)Vc(i[t],"bubbled",e)}}function Aa(e,t,i){e&&i&&i.dispatchConfig.registrationName&&(t=rf(e,i.dispatchConfig.registrationName))&&(i._dispatchListeners=Ji(i._dispatchListeners,t),i._dispatchInstances=Ji(i._dispatchInstances,e))}function Mx(e){e&&e.dispatchConfig.registrationName&&Aa(e._targetInst,null,e)}function Ki(e){Hl(e,Sx)}var Bt=null,ql=null,Gr=null;function sf(){if(Gr)return Gr;var e,t=ql,i=t.length,n,r="value"in Bt?Bt.value:Bt.textContent,s=r.length;for(e=0;e<i&&t[e]===r[e];e++);var o=i-e;for(n=1;n<=o&&t[i-n]===r[s-n];n++);return Gr=r.slice(e,1<n?1-n:void 0)}function Xr(){return!0}function ws(){return!1}function We(e,t,i,n){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=i,e=this.constructor.Interface;for(var r in e)e.hasOwnProperty(r)&&((t=e[r])?this[r]=t(i):r==="target"?this.target=n:this[r]=i[r]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Xr:ws,this.isPropagationStopped=ws,this}Ae(We.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!="unknown"&&(e.returnValue=!1),this.isDefaultPrevented=Xr)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!="unknown"&&(e.cancelBubble=!0),this.isPropagationStopped=Xr)},persist:function(){this.isPersistent=Xr},isPersistent:ws,destructor:function(){var e=this.constructor.Interface,t;for(t in e)this[t]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=ws,this._dispatchInstances=this._dispatchListeners=null}});We.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};We.extend=function(e){function t(){}function i(){return n.apply(this,arguments)}var n=this;t.prototype=n.prototype;var r=new t;return Ae(r,i.prototype),i.prototype=r,i.prototype.constructor=i,i.Interface=Ae({},n.Interface,e),i.extend=n.extend,of(i),i};of(We);function Cx(e,t,i,n){if(this.eventPool.length){var r=this.eventPool.pop();return this.call(r,e,t,i,n),r}return new this(e,t,i,n)}function Ix(e){if(!(e instanceof this))throw Error(M(279));e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function of(e){e.eventPool=[],e.getPooled=Cx,e.release=Ix}var bx=We.extend({data:null}),Ax=We.extend({data:null}),Ex=[9,13,27,32],eu=ti&&"CompositionEvent"in window,zn=null;ti&&"documentMode"in document&&(zn=document.documentMode);var Tx=ti&&"TextEvent"in window&&!zn,af=ti&&(!eu||zn&&8<zn&&11>=zn),Oc=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(" ")}},Uc=!1;function lf(e,t){switch(e){case"keyup":return Ex.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function uf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ri=!1;function kx(e,t){switch(e){case"compositionend":return uf(t);case"keypress":return t.which!==32?null:(Uc=!0,Oc);case"textInput":return e=t.data,e===Oc&&Uc?null:e;default:return null}}function Px(e,t){if(Ri)return e==="compositionend"||!eu&&lf(e,t)?(e=sf(),Gr=ql=Bt=null,Ri=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return af&&t.locale!=="ko"?null:t.data;default:return null}}var Nx={eventTypes:yt,extractEvents:function(e,t,i,n){var r;if(eu)e:{switch(e){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 Ri?lf(e,i)&&(s=yt.compositionEnd):e==="keydown"&&i.keyCode===229&&(s=yt.compositionStart);return s?(af&&i.locale!=="ko"&&(Ri||s!==yt.compositionStart?s===yt.compositionEnd&&Ri&&(r=sf()):(Bt=n,ql="value"in Bt?Bt.value:Bt.textContent,Ri=!0)),s=bx.getPooled(s,t,i,n),r?s.data=r:(r=uf(i),r!==null&&(s.data=r)),Ki(s),r=s):r=null,(e=Tx?kx(e,i):Px(e,i))?(t=Ax.getPooled(yt.beforeInput,t,i,n),t.data=e,Ki(t)):t=null,r===null?t:t===null?r:[r,t]}},Dx={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 cf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Dx[e.type]:t==="textarea"}var df={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function hf(e,t,i){return e=We.getPooled(df.change,e,t,i),e.type="change",wp(i),Ki(e),e}var Ln=null,Zn=null;function zx(e){Gs(e)}function Js(e){var t=xi(e);if(kp(t))return e}function Lx(e,t){if(e==="change")return t}var Ea=!1;ti&&(Ea=Wp("input")&&(!document.documentMode||9<document.documentMode));function Wc(){Ln&&(Ln.detachEvent("onpropertychange",pf),Zn=Ln=null)}function pf(e){if(e.propertyName==="value"&&Js(Zn))if(e=hf(Zn,e,$l(e)),oi)Gs(e);else{oi=!0;try{zl(zx,e)}finally{oi=!1,Rl()}}}function Rx(e,t,i){e==="focus"?(Wc(),Ln=t,Zn=i,Ln.attachEvent("onpropertychange",pf)):e==="blur"&&Wc()}function jx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Js(Zn)}function Bx(e,t){if(e==="click")return Js(t)}function _x(e,t){if(e==="input"||e==="change")return Js(t)}var Vx={eventTypes:df,_isInputEventSupported:Ea,extractEvents:function(e,t,i,n){var r=t?xi(t):window,s=r.nodeName&&r.nodeName.toLowerCase();if(s==="select"||s==="input"&&r.type==="file")var o=Lx;else if(cf(r))if(Ea)o=_x;else{o=jx;var a=Rx}else(s=r.nodeName)&&s.toLowerCase()==="input"&&(r.type==="checkbox"||r.type==="radio")&&(o=Bx);if(o&&(o=o(e,t)))return hf(o,i,n);a&&a(e,r,t),e==="blur"&&(e=r._wrapperState)&&e.controlled&&r.type==="number"&&pa(r,"number",r.value)}},dr=We.extend({view:null,detail:null}),Ox={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ux(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ox[e])?!!t[e]:!1}function tu(){return Ux}var Hc=0,$c=0,Fc=!1,Qc=!1,hr=dr.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:tu,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},movementX:function(e){if("movementX"in e)return e.movementX;var t=Hc;return Hc=e.screenX,Fc?e.type==="mousemove"?e.screenX-t:0:(Fc=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=$c;return $c=e.screenY,Qc?e.type==="mousemove"?e.screenY-t:0:(Qc=!0,0)}}),ff=hr.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),gn={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},Wx={eventTypes:gn,extractEvents:function(e,t,i,n,r){var s=e==="mouseover"||e==="pointerover",o=e==="mouseout"||e==="pointerout";if(s&&(r&32)===0&&(i.relatedTarget||i.fromElement)||!o&&!s)return null;if(s=n.window===n?n:(s=n.ownerDocument)?s.defaultView||s.parentWindow:window,o){if(o=t,t=(t=i.relatedTarget||i.toElement)?ur(t):null,t!==null){var a=Ei(t);(t!==a||t.tag!==5&&t.tag!==6)&&(t=null)}}else o=null;if(o===t)return null;if(e==="mouseout"||e==="mouseover")var l=hr,u=gn.mouseLeave,c=gn.mouseEnter,d="mouse";else(e==="pointerout"||e==="pointerover")&&(l=ff,u=gn.pointerLeave,c=gn.pointerEnter,d="pointer");if(e=o==null?s:xi(o),s=t==null?s:xi(t),u=l.getPooled(u,o,i,n),u.type=d+"leave",u.target=e,u.relatedTarget=s,i=l.getPooled(c,t,i,n),i.type=d+"enter",i.target=s,i.relatedTarget=e,n=o,d=t,n&&d)e:{for(l=n,c=d,o=0,e=l;e;e=St(e))o++;for(e=0,t=c;t;t=St(t))e++;for(;0<o-e;)l=St(l),o--;for(;0<e-o;)c=St(c),e--;for(;o--;){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&&(o=n.alternate,!(o!==null&&o===c));)l.push(n),n=St(n);for(n=[];d&&d!==c&&(o=d.alternate,!(o!==null&&o===c));)n.push(d),d=St(d);for(d=0;d<l.length;d++)Aa(l[d],"bubbled",u);for(d=n.length;0<d--;)Aa(n[d],"captured",i);return(r&64)===0?[u]:[u,i]}};function Hx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Si=typeof Object.is=="function"?Object.is:Hx,$x=Object.prototype.hasOwnProperty;function Yn(e,t){if(Si(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(n=0;n<i.length;n++)if(!$x.call(t,i[n])||!Si(e[i[n]],t[i[n]]))return!1;return!0}var Fx=ti&&"documentMode"in document&&11>=document.documentMode,gf={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},ji=null,Ta=null,Rn=null,ka=!1;function Zc(e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;return ka||ji==null||ji!==Ca(i)?null:(i=ji,"selectionStart"in i&&Ia(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}),Rn&&Yn(Rn,i)?null:(Rn=i,e=We.getPooled(gf.select,Ta,e,t),e.type="select",e.target=ji,Ki(e),e))}var Qx={eventTypes:gf,extractEvents:function(e,t,i,n,r,s){if(r=s||(n.window===n?n.document:n.nodeType===9?n:n.ownerDocument),!(s=!r)){e:{r=Wl(r),s=Dl.onSelect;for(var o=0;o<s.length;o++)if(!r.has(s[o])){r=!1;break e}r=!0}s=!r}if(s)return null;switch(r=t?xi(t):window,e){case"focus":(cf(r)||r.contentEditable==="true")&&(ji=r,Ta=t,Rn=null);break;case"blur":Rn=Ta=ji=null;break;case"mousedown":ka=!0;break;case"contextmenu":case"mouseup":case"dragend":return ka=!1,Zc(i,n);case"selectionchange":if(Fx)break;case"keydown":case"keyup":return Zc(i,n)}return null}},Zx=We.extend({animationName:null,elapsedTime:null,pseudoElement:null}),Yx=We.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Gx=dr.extend({relatedTarget:null});function Jr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}var Xx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Jx={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"},Kx=dr.extend({key:function(e){if(e.key){var t=Xx[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Jr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Jx[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:tu,charCode:function(e){return e.type==="keypress"?Jr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Jr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qx=hr.extend({dataTransfer:null}),eS=dr.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:tu}),tS=We.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),iS=hr.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),nS={eventTypes:Gp,extractEvents:function(e,t,i,n){var r=Xp.get(e);if(!r)return null;switch(e){case"keypress":if(Jr(i)===0)return null;case"keydown":case"keyup":e=Kx;break;case"blur":case"focus":e=Gx;break;case"click":if(i.button===2)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":e=hr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=qx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=eS;break;case jp:case Bp:case _p:e=Zx;break;case Vp:e=tS;break;case"scroll":e=dr;break;case"wheel":e=iS;break;case"copy":case"cut":case"paste":e=Yx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=ff;break;default:e=We}return t=e.getPooled(r,t,i,n),Ki(t),t}};if(ps)throw Error(M(101));ps=Array.prototype.slice.call("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));mp();var rS=cr;Nl=Kl;fp=rS;gp=xi;vp({SimpleEventPlugin:nS,EnterLeaveEventPlugin:Wx,ChangeEventPlugin:Vx,SelectEventPlugin:Qx,BeforeInputEventPlugin:Nx});var Pa=[],Bi=-1;function ie(e){0>Bi||(e.current=Pa[Bi],Pa[Bi]=null,Bi--)}function ae(e,t){Bi++,Pa[Bi]=e.current,e.current=t}var Jt={},Ce={current:Jt},Ne={current:!1},Mi=Jt;function qi(e,t){var i=e.type.contextTypes;if(!i)return Jt;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in i)r[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function De(e){return e=e.childContextTypes,e!=null}function ys(){ie(Ne),ie(Ce)}function Yc(e,t,i){if(Ce.current!==Jt)throw Error(M(168));ae(Ce,t),ae(Ne,i)}function mf(e,t,i){var n=e.stateNode;if(e=t.childContextTypes,typeof n.getChildContext!="function")return i;n=n.getChildContext();for(var r in n)if(!(r in e))throw Error(M(108,kt(t)||"Unknown",r));return Ae({},i,{},n)}function Kr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Jt,Mi=Ce.current,ae(Ce,e),ae(Ne,Ne.current),!0}function Gc(e,t,i){var n=e.stateNode;if(!n)throw Error(M(169));i?(e=mf(e,t,Mi),n.__reactInternalMemoizedMergedChildContext=e,ie(Ne),ie(Ce),ae(Ce,e)):ie(Ne),ae(Ne,i)}var sS=me.unstable_runWithPriority,iu=me.unstable_scheduleCallback,vf=me.unstable_cancelCallback,Xc=me.unstable_requestPaint,Na=me.unstable_now,oS=me.unstable_getCurrentPriorityLevel,Ks=me.unstable_ImmediatePriority,wf=me.unstable_UserBlockingPriority,yf=me.unstable_NormalPriority,xf=me.unstable_LowPriority,Sf=me.unstable_IdlePriority,Mf={},aS=me.unstable_shouldYield,lS=Xc!==void 0?Xc:function(){},It=null,qr=null,ko=!1,Jc=Na(),Qe=1e4>Jc?Na:function(){return Na()-Jc};function qs(){switch(oS()){case Ks:return 99;case wf:return 98;case yf:return 97;case xf:return 96;case Sf:return 95;default:throw Error(M(332))}}function Cf(e){switch(e){case 99:return Ks;case 98:return wf;case 97:return yf;case 96:return xf;case 95:return Sf;default:throw Error(M(332))}}function Kt(e,t){return e=Cf(e),sS(e,t)}function If(e,t,i){return e=Cf(e),iu(e,t,i)}function Kc(e){return It===null?(It=[e],qr=iu(Ks,bf)):It.push(e),Mf}function wt(){if(qr!==null){var e=qr;qr=null,vf(e)}bf()}function bf(){if(!ko&&It!==null){ko=!0;var e=0;try{var t=It;Kt(99,function(){for(;e<t.length;e++){var i=t[e];do i=i(!0);while(i!==null)}}),It=null}catch(i){throw It!==null&&(It=It.slice(e+1)),iu(Ks,wt),i}finally{ko=!1}}}function es(e,t,i){return i/=10,1073741821-(((1073741821-e+t/10)/i|0)+1)*i}function it(e,t){if(e&&e.defaultProps){t=Ae({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i])}return t}var xs={current:null},Ss=null,_i=null,Ms=null;function nu(){Ms=_i=Ss=null}function ru(e){var t=xs.current;ie(xs),e.type._context._currentValue=t}function Af(e,t){for(;e!==null;){var i=e.alternate;if(e.childExpirationTime<t)e.childExpirationTime=t,i!==null&&i.childExpirationTime<t&&(i.childExpirationTime=t);else if(i!==null&&i.childExpirationTime<t)i.childExpirationTime=t;else break;e=e.return}}function Fi(e,t){Ss=e,Ms=_i=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.expirationTime>=t&&(pt=!0),e.firstContext=null)}function Ge(e,t){if(Ms!==e&&t!==!1&&t!==0)if((typeof t!="number"||t===1073741823)&&(Ms=e,t=1073741823),t={context:e,observedBits:t,next:null},_i===null){if(Ss===null)throw Error(M(308));_i=t,Ss.dependencies={expirationTime:0,firstContext:t,responders:null}}else _i=_i.next=t;return e._currentValue}var Rt=!1;function su(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function ou(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function Qt(e,t){return e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null},e.next=e}function Zt(e,t){if(e=e.updateQueue,e!==null){e=e.shared;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}}function qc(e,t){var i=e.alternate;i!==null&&ou(i,e),e=e.updateQueue,i=e.baseQueue,i===null?(e.baseQueue=t.next=t,t.next=t):(t.next=i.next,i.next=t)}function Gn(e,t,i,n){var r=e.updateQueue;Rt=!1;var s=r.baseQueue,o=r.shared.pending;if(o!==null){if(s!==null){var a=s.next;s.next=o.next,o.next=a}s=o,r.shared.pending=null,a=e.alternate,a!==null&&(a=a.updateQueue,a!==null&&(a.baseQueue=o))}if(s!==null){a=s.next;var l=r.baseState,u=0,c=null,d=null,m=null;if(a!==null){var w=a;do{if(o=w.expirationTime,o<n){var v={expirationTime:w.expirationTime,suspenseConfig:w.suspenseConfig,tag:w.tag,payload:w.payload,callback:w.callback,next:null};m===null?(d=m=v,c=l):m=m.next=v,o>u&&(u=o)}else{m!==null&&(m=m.next={expirationTime:1073741823,suspenseConfig:w.suspenseConfig,tag:w.tag,payload:w.payload,callback:w.callback,next:null}),ig(o,w.suspenseConfig);e:{var x=e,h=w;switch(o=t,v=i,h.tag){case 1:if(x=h.payload,typeof x=="function"){l=x.call(v,l,o);break e}l=x;break e;case 3:x.effectTag=x.effectTag&-4097|64;case 0:if(x=h.payload,o=typeof x=="function"?x.call(v,l,o):x,o==null)break e;l=Ae({},l,o);break e;case 2:Rt=!0}}w.callback!==null&&(e.effectTag|=32,o=r.effects,o===null?r.effects=[w]:o.push(w))}if(w=w.next,w===null||w===a){if(o=r.shared.pending,o===null)break;w=s.next=o.next,o.next=a,r.baseQueue=s=o,r.shared.pending=null}}while(1)}m===null?c=l:m.next=d,r.baseState=c,r.baseQueue=m,ro(u),e.expirationTime=u,e.memoizedState=l}}function ed(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],r=n.callback;if(r!==null){if(n.callback=null,n=r,r=i,typeof n!="function")throw Error(M(191,n));n.call(r)}}}var jn=rt.ReactCurrentBatchConfig,Ef=new Zs.Component().refs;function Cs(e,t,i,n){t=e.memoizedState,i=i(n,t),i=i==null?t:Ae({},t,i),e.memoizedState=i,e.expirationTime===0&&(e.updateQueue.baseState=i)}var eo={isMounted:function(e){return(e=e._reactInternalFiber)?Ei(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternalFiber;var n=mt(),r=jn.suspense;n=mi(n,e,r),r=Qt(n,r),r.payload=t,i!=null&&(r.callback=i),Zt(e,r),Gt(e,n)},enqueueReplaceState:function(e,t,i){e=e._reactInternalFiber;var n=mt(),r=jn.suspense;n=mi(n,e,r),r=Qt(n,r),r.tag=1,r.payload=t,i!=null&&(r.callback=i),Zt(e,r),Gt(e,n)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var i=mt(),n=jn.suspense;i=mi(i,e,n),n=Qt(i,n),n.tag=2,t!=null&&(n.callback=t),Zt(e,n),Gt(e,i)}};function td(e,t,i,n,r,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,s,o):t.prototype&&t.prototype.isPureReactComponent?!Yn(i,n)||!Yn(r,s):!0}function Tf(e,t,i){var n=!1,r=Jt,s=t.contextType;return typeof s=="object"&&s!==null?s=Ge(s):(r=De(t)?Mi:Ce.current,n=t.contextTypes,s=(n=n!=null)?qi(e,r):Jt),t=new t(i,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=eo,e.stateNode=t,t._reactInternalFiber=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=s),t}function id(e,t,i,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,n),t.state!==e&&eo.enqueueReplaceState(t,t.state,null)}function Da(e,t,i,n){var r=e.stateNode;r.props=i,r.state=e.memoizedState,r.refs=Ef,su(e);var s=t.contextType;typeof s=="object"&&s!==null?r.context=Ge(s):(s=De(t)?Mi:Ce.current,r.context=qi(e,s)),Gn(e,i,r,n),r.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Cs(e,t,s,i),r.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(t=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),t!==r.state&&eo.enqueueReplaceState(r,r.state,null),Gn(e,i,r,n),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.effectTag|=4)}var Nr=Array.isArray;function mn(e,t,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(M(309));var n=i.stateNode}if(!n)throw Error(M(147,e));var r=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===r?t.ref:(t=function(s){var o=n.refs;o===Ef&&(o=n.refs={}),s===null?delete o[r]:o[r]=s},t._stringRef=r,t)}if(typeof e!="string")throw Error(M(284));if(!i._owner)throw Error(M(290,e))}return e}function Dr(e,t){if(e.type!=="textarea")throw Error(M(31,Object.prototype.toString.call(t)==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":t,""))}function kf(e){function t(h,p){if(e){var f=h.lastEffect;f!==null?(f.nextEffect=p,h.lastEffect=p):h.firstEffect=h.lastEffect=p,p.nextEffect=null,p.effectTag=8}}function i(h,p){if(!e)return null;for(;p!==null;)t(h,p),p=p.sibling;return null}function n(h,p){for(h=new Map;p!==null;)p.key!==null?h.set(p.key,p):h.set(p.index,p),p=p.sibling;return h}function r(h,p){return h=Ci(h,p),h.index=0,h.sibling=null,h}function s(h,p,f){return h.index=f,e?(f=h.alternate,f!==null?(f=f.index,f<p?(h.effectTag=2,p):f):(h.effectTag=2,p)):p}function o(h){return e&&h.alternate===null&&(h.effectTag=2),h}function a(h,p,f,g){return p===null||p.tag!==6?(p=Ro(f,h.mode,g),p.return=h,p):(p=r(p,f),p.return=h,p)}function l(h,p,f,g){return p!==null&&p.elementType===f.type?(g=r(p,f.props),g.ref=mn(h,p,f),g.return=h,g):(g=rs(f.type,f.key,f.props,null,h.mode,g),g.ref=mn(h,p,f),g.return=h,g)}function u(h,p,f,g){return p===null||p.tag!==4||p.stateNode.containerInfo!==f.containerInfo||p.stateNode.implementation!==f.implementation?(p=jo(f,h.mode,g),p.return=h,p):(p=r(p,f.children||[]),p.return=h,p)}function c(h,p,f,g,y){return p===null||p.tag!==7?(p=Ot(f,h.mode,g,y),p.return=h,p):(p=r(p,f),p.return=h,p)}function d(h,p,f){if(typeof p=="string"||typeof p=="number")return p=Ro(""+p,h.mode,f),p.return=h,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Er:return f=rs(p.type,p.key,p.props,null,h.mode,f),f.ref=mn(h,null,p),f.return=h,f;case zi:return p=jo(p,h.mode,f),p.return=h,p}if(Nr(p)||cn(p))return p=Ot(p,h.mode,f,null),p.return=h,p;Dr(h,p)}return null}function m(h,p,f,g){var y=p!==null?p.key:null;if(typeof f=="string"||typeof f=="number")return y!==null?null:a(h,p,""+f,g);if(typeof f=="object"&&f!==null){switch(f.$$typeof){case Er:return f.key===y?f.type===si?c(h,p,f.props.children,g,y):l(h,p,f,g):null;case zi:return f.key===y?u(h,p,f,g):null}if(Nr(f)||cn(f))return y!==null?null:c(h,p,f,g,null);Dr(h,f)}return null}function w(h,p,f,g,y){if(typeof g=="string"||typeof g=="number")return h=h.get(f)||null,a(p,h,""+g,y);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Er:return h=h.get(g.key===null?f:g.key)||null,g.type===si?c(p,h,g.props.children,y,g.key):l(p,h,g,y);case zi:return h=h.get(g.key===null?f:g.key)||null,u(p,h,g,y)}if(Nr(g)||cn(g))return h=h.get(f)||null,c(p,h,g,y,null);Dr(p,g)}return null}function v(h,p,f,g){for(var y=null,S=null,T=p,N=p=0,k=null;T!==null&&N<f.length;N++){T.index>N?(k=T,T=null):k=T.sibling;var P=m(h,T,f[N],g);if(P===null){T===null&&(T=k);break}e&&T&&P.alternate===null&&t(h,T),p=s(P,p,N),S===null?y=P:S.sibling=P,S=P,T=k}if(N===f.length)return i(h,T),y;if(T===null){for(;N<f.length;N++)T=d(h,f[N],g),T!==null&&(p=s(T,p,N),S===null?y=T:S.sibling=T,S=T);return y}for(T=n(h,T);N<f.length;N++)k=w(T,h,N,f[N],g),k!==null&&(e&&k.alternate!==null&&T.delete(k.key===null?N:k.key),p=s(k,p,N),S===null?y=k:S.sibling=k,S=k);return e&&T.forEach(function(ne){return t(h,ne)}),y}function x(h,p,f,g){var y=cn(f);if(typeof y!="function")throw Error(M(150));if(f=y.call(f),f==null)throw Error(M(151));for(var S=y=null,T=p,N=p=0,k=null,P=f.next();T!==null&&!P.done;N++,P=f.next()){T.index>N?(k=T,T=null):k=T.sibling;var ne=m(h,T,P.value,g);if(ne===null){T===null&&(T=k);break}e&&T&&ne.alternate===null&&t(h,T),p=s(ne,p,N),S===null?y=ne:S.sibling=ne,S=ne,T=k}if(P.done)return i(h,T),y;if(T===null){for(;!P.done;N++,P=f.next())P=d(h,P.value,g),P!==null&&(p=s(P,p,N),S===null?y=P:S.sibling=P,S=P);return y}for(T=n(h,T);!P.done;N++,P=f.next())P=w(T,h,N,P.value,g),P!==null&&(e&&P.alternate!==null&&T.delete(P.key===null?N:P.key),p=s(P,p,N),S===null?y=P:S.sibling=P,S=P);return e&&T.forEach(function(b){return t(h,b)}),y}return function(h,p,f,g){var y=typeof f=="object"&&f!==null&&f.type===si&&f.key===null;y&&(f=f.props.children);var S=typeof f=="object"&&f!==null;if(S)switch(f.$$typeof){case Er:e:{for(S=f.key,y=p;y!==null;){if(y.key===S){switch(y.tag){case 7:if(f.type===si){i(h,y.sibling),p=r(y,f.props.children),p.return=h,h=p;break e}break;default:if(y.elementType===f.type){i(h,y.sibling),p=r(y,f.props),p.ref=mn(h,y,f),p.return=h,h=p;break e}}i(h,y);break}else t(h,y);y=y.sibling}f.type===si?(p=Ot(f.props.children,h.mode,g,f.key),p.return=h,h=p):(g=rs(f.type,f.key,f.props,null,h.mode,g),g.ref=mn(h,p,f),g.return=h,h=g)}return o(h);case zi:e:{for(y=f.key;p!==null;){if(p.key===y)if(p.tag===4&&p.stateNode.containerInfo===f.containerInfo&&p.stateNode.implementation===f.implementation){i(h,p.sibling),p=r(p,f.children||[]),p.return=h,h=p;break e}else{i(h,p);break}else t(h,p);p=p.sibling}p=jo(f,h.mode,g),p.return=h,h=p}return o(h)}if(typeof f=="string"||typeof f=="number")return f=""+f,p!==null&&p.tag===6?(i(h,p.sibling),p=r(p,f),p.return=h,h=p):(i(h,p),p=Ro(f,h.mode,g),p.return=h,h=p),o(h);if(Nr(f))return v(h,p,f,g);if(cn(f))return x(h,p,f,g);if(S&&Dr(h,f),typeof f=="undefined"&&!y)switch(h.tag){case 1:case 0:throw h=h.type,Error(M(152,h.displayName||h.name||"Component"))}return i(h,p)}}var en=kf(!0),au=kf(!1),pr={},gt={current:pr},Xn={current:pr},Jn={current:pr};function ai(e){if(e===pr)throw Error(M(174));return e}function za(e,t){switch(ae(Jn,t),ae(Xn,e),ae(gt,pr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ma(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ma(t,e)}ie(gt),ae(gt,t)}function tn(){ie(gt),ie(Xn),ie(Jn)}function nd(e){ai(Jn.current);var t=ai(gt.current),i=ma(t,e.type);t!==i&&(ae(Xn,e),ae(gt,i))}function lu(e){Xn.current===e&&(ie(gt),ie(Xn))}var se={current:0};function Is(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data===Gl||i.data===Xl))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.effectTag&64)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function uu(e,t){return{responder:e,props:t}}var ts=rt.ReactCurrentDispatcher,Ze=rt.ReactCurrentBatchConfig,_t=0,de=null,Se=null,Me=null,bs=!1;function je(){throw Error(M(321))}function cu(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Si(e[i],t[i]))return!1;return!0}function du(e,t,i,n,r,s){if(_t=s,de=t,t.memoizedState=null,t.updateQueue=null,t.expirationTime=0,ts.current=e===null||e.memoizedState===null?uS:cS,e=i(n,r),t.expirationTime===_t){s=0;do{if(t.expirationTime=0,!(25>s))throw Error(M(301));s+=1,Me=Se=null,t.updateQueue=null,ts.current=dS,e=i(n,r)}while(t.expirationTime===_t)}if(ts.current=Ts,t=Se!==null&&Se.next!==null,_t=0,Me=Se=de=null,bs=!1,t)throw Error(M(300));return e}function Qi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Me===null?de.memoizedState=Me=e:Me=Me.next=e,Me}function sn(){if(Se===null){var e=de.alternate;e=e!==null?e.memoizedState:null}else e=Se.next;var t=Me===null?de.memoizedState:Me.next;if(t!==null)Me=t,Se=e;else{if(e===null)throw Error(M(310));Se=e,e={memoizedState:Se.memoizedState,baseState:Se.baseState,baseQueue:Se.baseQueue,queue:Se.queue,next:null},Me===null?de.memoizedState=Me=e:Me=Me.next=e}return Me}function pi(e,t){return typeof t=="function"?t(e):t}function zr(e){var t=sn(),i=t.queue;if(i===null)throw Error(M(311));i.lastRenderedReducer=e;var n=Se,r=n.baseQueue,s=i.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}n.baseQueue=r=s,i.pending=null}if(r!==null){r=r.next,n=n.baseState;var a=o=s=null,l=r;do{var u=l.expirationTime;if(u<_t){var c={expirationTime:l.expirationTime,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null};a===null?(o=a=c,s=n):a=a.next=c,u>de.expirationTime&&(de.expirationTime=u,ro(u))}else a!==null&&(a=a.next={expirationTime:1073741823,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null}),ig(u,l.suspenseConfig),n=l.eagerReducer===e?l.eagerState:e(n,l.action);l=l.next}while(l!==null&&l!==r);a===null?s=n:a.next=o,Si(n,t.memoizedState)||(pt=!0),t.memoizedState=n,t.baseState=s,t.baseQueue=a,i.lastRenderedState=n}return[t.memoizedState,i.dispatch]}function Lr(e){var t=sn(),i=t.queue;if(i===null)throw Error(M(311));i.lastRenderedReducer=e;var n=i.dispatch,r=i.pending,s=t.memoizedState;if(r!==null){i.pending=null;var o=r=r.next;do s=e(s,o.action),o=o.next;while(o!==r);Si(s,t.memoizedState)||(pt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),i.lastRenderedState=s}return[s,n]}function Po(e){var t=Qi();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e=t.queue={pending:null,dispatch:null,lastRenderedReducer:pi,lastRenderedState:e},e=e.dispatch=Rf.bind(null,de,e),[t.memoizedState,e]}function La(e,t,i,n){return e={tag:e,create:t,destroy:i,deps:n,next:null},t=de.updateQueue,t===null?(t={lastEffect:null},de.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(n=i.next,i.next=e,e.next=n,t.lastEffect=e)),e}function Pf(){return sn().memoizedState}function Ra(e,t,i,n){var r=Qi();de.effectTag|=e,r.memoizedState=La(1|t,i,void 0,n===void 0?null:n)}function hu(e,t,i,n){var r=sn();n=n===void 0?null:n;var s=void 0;if(Se!==null){var o=Se.memoizedState;if(s=o.destroy,n!==null&&cu(n,o.deps)){La(t,i,s,n);return}}de.effectTag|=e,r.memoizedState=La(1|t,i,s,n)}function rd(e,t){return Ra(516,4,e,t)}function As(e,t){return hu(516,4,e,t)}function Nf(e,t){return hu(4,2,e,t)}function Df(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function zf(e,t,i){return i=i!=null?i.concat([e]):null,hu(4,2,Df.bind(null,t,e),i)}function pu(){}function sd(e,t){return Qi().memoizedState=[e,t===void 0?null:t],e}function Es(e,t){var i=sn();t=t===void 0?null:t;var n=i.memoizedState;return n!==null&&t!==null&&cu(t,n[1])?n[0]:(i.memoizedState=[e,t],e)}function Lf(e,t){var i=sn();t=t===void 0?null:t;var n=i.memoizedState;return n!==null&&t!==null&&cu(t,n[1])?n[0]:(e=e(),i.memoizedState=[e,t],e)}function fu(e,t,i){var n=qs();Kt(98>n?98:n,function(){e(!0)}),Kt(97<n?97:n,function(){var r=Ze.suspense;Ze.suspense=t===void 0?null:t;try{e(!1),i()}finally{Ze.suspense=r}})}function Rf(e,t,i){var n=mt(),r=jn.suspense;n=mi(n,e,r),r={expirationTime:n,suspenseConfig:r,action:i,eagerReducer:null,eagerState:null,next:null};var s=t.pending;if(s===null?r.next=r:(r.next=s.next,s.next=r),t.pending=r,s=e.alternate,e===de||s!==null&&s===de)bs=!0,r.expirationTime=_t,de.expirationTime=_t;else{if(e.expirationTime===0&&(s===null||s.expirationTime===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,i);if(r.eagerReducer=s,r.eagerState=a,Si(a,o))return}catch{}finally{}Gt(e,n)}}var Ts={readContext:Ge,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},uS={readContext:Ge,useCallback:sd,useContext:Ge,useEffect:rd,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,Ra(4,2,Df.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Ra(4,2,e,t)},useMemo:function(e,t){var i=Qi();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var n=Qi();return t=i!==void 0?i(t):t,n.memoizedState=n.baseState=t,e=n.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},e=e.dispatch=Rf.bind(null,de,e),[n.memoizedState,e]},useRef:function(e){var t=Qi();return e={current:e},t.memoizedState=e},useState:Po,useDebugValue:pu,useResponder:uu,useDeferredValue:function(e,t){var i=Po(e),n=i[0],r=i[1];return rd(function(){var s=Ze.suspense;Ze.suspense=t===void 0?null:t;try{r(e)}finally{Ze.suspense=s}},[e,t]),n},useTransition:function(e){var t=Po(!1),i=t[0];return t=t[1],[sd(fu.bind(null,t,e),[t,e]),i]}},cS={readContext:Ge,useCallback:Es,useContext:Ge,useEffect:As,useImperativeHandle:zf,useLayoutEffect:Nf,useMemo:Lf,useReducer:zr,useRef:Pf,useState:function(){return zr(pi)},useDebugValue:pu,useResponder:uu,useDeferredValue:function(e,t){var i=zr(pi),n=i[0],r=i[1];return As(function(){var s=Ze.suspense;Ze.suspense=t===void 0?null:t;try{r(e)}finally{Ze.suspense=s}},[e,t]),n},useTransition:function(e){var t=zr(pi),i=t[0];return t=t[1],[Es(fu.bind(null,t,e),[t,e]),i]}},dS={readContext:Ge,useCallback:Es,useContext:Ge,useEffect:As,useImperativeHandle:zf,useLayoutEffect:Nf,useMemo:Lf,useReducer:Lr,useRef:Pf,useState:function(){return Lr(pi)},useDebugValue:pu,useResponder:uu,useDeferredValue:function(e,t){var i=Lr(pi),n=i[0],r=i[1];return As(function(){var s=Ze.suspense;Ze.suspense=t===void 0?null:t;try{r(e)}finally{Ze.suspense=s}},[e,t]),n},useTransition:function(e){var t=Lr(pi),i=t[0];return t=t[1],[Es(fu.bind(null,t,e),[t,e]),i]}},Et=null,Vt=null,fi=!1;function jf(e,t){var i=ft(5,null,null,0);i.elementType="DELETED",i.type="DELETED",i.stateNode=t,i.return=e,i.effectTag=8,e.lastEffect!==null?(e.lastEffect.nextEffect=i,e.lastEffect=i):e.firstEffect=e.lastEffect=i}function od(e,t){switch(e.tag){case 5:var i=e.type;return t=t.nodeType!==1||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,!0):!1;case 13:return!1;default:return!1}}function ja(e){if(fi){var t=Vt;if(t){var i=t;if(!od(e,t)){if(t=$i(i.nextSibling),!t||!od(e,t)){e.effectTag=e.effectTag&-1025|2,fi=!1,Et=e;return}jf(Et,i)}Et=e,Vt=$i(t.firstChild)}else e.effectTag=e.effectTag&-1025|2,fi=!1,Et=e}}function ad(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Et=e}function Rr(e){if(e!==Et)return!1;if(!fi)return ad(e),fi=!0,!1;var t=e.type;if(e.tag!==5||t!=="head"&&t!=="body"&&!ba(t,e.memoizedProps))for(t=Vt;t;)jf(e,t),t=$i(t.nextSibling);if(ad(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i===tf){if(t===0){Vt=$i(e.nextSibling);break e}t--}else i!==ef&&i!==Xl&&i!==Gl||t++}e=e.nextSibling}Vt=null}}else Vt=Et?$i(e.stateNode.nextSibling):null;return!0}function No(){Vt=Et=null,fi=!1}var hS=rt.ReactCurrentOwner,pt=!1;function Be(e,t,i,n){t.child=e===null?au(t,null,i,n):en(t,e.child,i,n)}function ld(e,t,i,n,r){i=i.render;var s=t.ref;return Fi(t,r),n=du(e,t,i,n,s,r),e!==null&&!pt?(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=r&&(e.expirationTime=0),Tt(e,t,r)):(t.effectTag|=1,Be(e,t,n,r),t.child)}function ud(e,t,i,n,r,s){if(e===null){var o=i.type;return typeof o=="function"&&!yu(o)&&o.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=o,Bf(e,t,o,n,r,s)):(e=rs(i.type,null,n,null,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}return o=e.child,r<s&&(r=o.memoizedProps,i=i.compare,i=i!==null?i:Yn,i(r,n)&&e.ref===t.ref)?Tt(e,t,s):(t.effectTag|=1,e=Ci(o,n),e.ref=t.ref,e.return=t,t.child=e)}function Bf(e,t,i,n,r,s){return e!==null&&Yn(e.memoizedProps,n)&&e.ref===t.ref&&(pt=!1,r<s)?(t.expirationTime=e.expirationTime,Tt(e,t,s)):Ba(e,t,i,n,s)}function _f(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.effectTag|=128)}function Ba(e,t,i,n,r){var s=De(i)?Mi:Ce.current;return s=qi(t,s),Fi(t,r),i=du(e,t,i,n,s,r),e!==null&&!pt?(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=r&&(e.expirationTime=0),Tt(e,t,r)):(t.effectTag|=1,Be(e,t,i,r),t.child)}function cd(e,t,i,n,r){if(De(i)){var s=!0;Kr(t)}else s=!1;if(Fi(t,r),t.stateNode===null)e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),Tf(t,i,n),Da(t,i,n,r),n=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,u=i.contextType;typeof u=="object"&&u!==null?u=Ge(u):(u=De(i)?Mi:Ce.current,u=qi(t,u));var c=i.getDerivedStateFromProps,d=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==u)&&id(t,o,n,u),Rt=!1;var m=t.memoizedState;o.state=m,Gn(t,n,o,r),l=t.memoizedState,a!==n||m!==l||Ne.current||Rt?(typeof c=="function"&&(Cs(t,i,c,n),l=t.memoizedState),(a=Rt||td(t,i,a,n,m,l,u))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.effectTag|=4)):(typeof o.componentDidMount=="function"&&(t.effectTag|=4),t.memoizedProps=n,t.memoizedState=l),o.props=n,o.state=l,o.context=u,n=a):(typeof o.componentDidMount=="function"&&(t.effectTag|=4),n=!1)}else o=t.stateNode,ou(e,t),a=t.memoizedProps,o.props=t.type===t.elementType?a:it(t.type,a),l=o.context,u=i.contextType,typeof u=="object"&&u!==null?u=Ge(u):(u=De(i)?Mi:Ce.current,u=qi(t,u)),c=i.getDerivedStateFromProps,(d=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==u)&&id(t,o,n,u),Rt=!1,l=t.memoizedState,o.state=l,Gn(t,n,o,r),m=t.memoizedState,a!==n||l!==m||Ne.current||Rt?(typeof c=="function"&&(Cs(t,i,c,n),m=t.memoizedState),(c=Rt||td(t,i,a,n,l,m,u))?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,u),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,u)),typeof o.componentDidUpdate=="function"&&(t.effectTag|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.effectTag|=256)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=256),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=u,n=c):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=256),n=!1);return _a(e,t,i,n,s,r)}function _a(e,t,i,n,r,s){_f(e,t);var o=(t.effectTag&64)!==0;if(!n&&!o)return r&&Gc(t,i,!1),Tt(e,t,s);n=t.stateNode,hS.current=t;var a=o&&typeof i.getDerivedStateFromError!="function"?null:n.render();return t.effectTag|=1,e!==null&&o?(t.child=en(t,e.child,null,s),t.child=en(t,null,a,s)):Be(e,t,a,s),t.memoizedState=n.state,r&&Gc(t,i,!0),t.child}function dd(e){var t=e.stateNode;t.pendingContext?Yc(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Yc(e,t.context,!1),za(e,t.containerInfo)}var Do={dehydrated:null,retryTime:0};function hd(e,t,i){var n=t.mode,r=t.pendingProps,s=se.current,o=!1,a;if((a=(t.effectTag&64)!==0)||(a=(s&2)!==0&&(e===null||e.memoizedState!==null)),a?(o=!0,t.effectTag&=-65):e!==null&&e.memoizedState===null||r.fallback===void 0||r.unstable_avoidThisFallback===!0||(s|=1),ae(se,s&1),e===null){if(r.fallback!==void 0&&ja(t),o){if(o=r.fallback,r=Ot(null,n,0,null),r.return=t,(t.mode&2)===0)for(e=t.memoizedState!==null?t.child.child:t.child,r.child=e;e!==null;)e.return=r,e=e.sibling;return i=Ot(o,n,i,null),i.return=t,r.sibling=i,t.memoizedState=Do,t.child=r,i}return n=r.children,t.memoizedState=null,t.child=au(t,null,n,i)}if(e.memoizedState!==null){if(e=e.child,n=e.sibling,o){if(r=r.fallback,i=Ci(e,e.pendingProps),i.return=t,(t.mode&2)===0&&(o=t.memoizedState!==null?t.child.child:t.child,o!==e.child))for(i.child=o;o!==null;)o.return=i,o=o.sibling;return n=Ci(n,r),n.return=t,i.sibling=n,i.childExpirationTime=0,t.memoizedState=Do,t.child=i,n}return i=en(t,e.child,r.children,i),t.memoizedState=null,t.child=i}if(e=e.child,o){if(o=r.fallback,r=Ot(null,n,0,null),r.return=t,r.child=e,e!==null&&(e.return=r),(t.mode&2)===0)for(e=t.memoizedState!==null?t.child.child:t.child,r.child=e;e!==null;)e.return=r,e=e.sibling;return i=Ot(o,n,i,null),i.return=t,r.sibling=i,i.effectTag|=2,r.childExpirationTime=0,t.memoizedState=Do,t.child=r,i}return t.memoizedState=null,t.child=en(t,e,r.children,i)}function pd(e,t){e.expirationTime<t&&(e.expirationTime=t);var i=e.alternate;i!==null&&i.expirationTime<t&&(i.expirationTime=t),Af(e.return,t)}function zo(e,t,i,n,r,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:i,tailExpiration:0,tailMode:r,lastEffect:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=i,o.tailExpiration=0,o.tailMode=r,o.lastEffect=s)}function fd(e,t,i){var n=t.pendingProps,r=n.revealOrder,s=n.tail;if(Be(e,t,n.children,i),n=se.current,(n&2)!==0)n=n&1|2,t.effectTag|=64;else{if(e!==null&&(e.effectTag&64)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&pd(e,i);else if(e.tag===19)pd(e,i);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(ae(se,n),(t.mode&2)===0)t.memoizedState=null;else switch(r){case"forwards":for(i=t.child,r=null;i!==null;)e=i.alternate,e!==null&&Is(e)===null&&(r=i),i=i.sibling;i=r,i===null?(r=t.child,t.child=null):(r=i.sibling,i.sibling=null),zo(t,!1,r,i,s,t.lastEffect);break;case"backwards":for(i=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Is(e)===null){t.child=r;break}e=r.sibling,r.sibling=i,i=r,r=e}zo(t,!0,i,null,s,t.lastEffect);break;case"together":zo(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function Tt(e,t,i){e!==null&&(t.dependencies=e.dependencies);var n=t.expirationTime;if(n!==0&&ro(n),t.childExpirationTime<i)return null;if(e!==null&&t.child!==e.child)throw Error(M(153));if(t.child!==null){for(e=t.child,i=Ci(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Ci(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}var Vf,Va,Of,Uf;Vf=function(e,t){for(var i=t.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};Va=function(){};Of=function(e,t,i,n,r){var s=e.memoizedProps;if(s!==n){var o=t.stateNode;switch(ai(gt.current),e=null,i){case"input":s=da(o,s),n=da(o,n),e=[];break;case"option":s=fa(o,s),n=fa(o,n),e=[];break;case"select":s=Ae({},s,{value:void 0}),n=Ae({},n,{value:void 0}),e=[];break;case"textarea":s=ga(o,s),n=ga(o,n),e=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(o.onclick=ms)}Sa(i,n);var a,l;i=null;for(a in s)if(!n.hasOwnProperty(a)&&s.hasOwnProperty(a)&&s[a]!=null)if(a==="style")for(l in o=s[a],o)o.hasOwnProperty(l)&&(i||(i={}),i[l]="");else a!=="dangerouslySetInnerHTML"&&a!=="children"&&a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Xi.hasOwnProperty(a)?e||(e=[]):(e=e||[]).push(a,null));for(a in n){var u=n[a];if(o=s!=null?s[a]:void 0,n.hasOwnProperty(a)&&u!==o&&(u!=null||o!=null))if(a==="style")if(o){for(l in o)!o.hasOwnProperty(l)||u&&u.hasOwnProperty(l)||(i||(i={}),i[l]="");for(l in u)u.hasOwnProperty(l)&&o[l]!==u[l]&&(i||(i={}),i[l]=u[l])}else i||(e||(e=[]),e.push(a,i)),i=u;else a==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(e=e||[]).push(a,u)):a==="children"?o===u||typeof u!="string"&&typeof u!="number"||(e=e||[]).push(a,""+u):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&(Xi.hasOwnProperty(a)?(u!=null&&xt(r,a),e||o===u||(e=[])):(e=e||[]).push(a,u))}i&&(e=e||[]).push("style",i),r=e,(t.updateQueue=r)&&(t.effectTag|=4)}};Uf=function(e,t,i,n){i!==n&&(t.effectTag|=4)};function jr(e,t){switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var n=null;i!==null;)i.alternate!==null&&(n=i),i=i.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function pS(e,t,i){var n=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return De(t.type)&&ys(),null;case 3:return tn(),ie(Ne),ie(Ce),i=t.stateNode,i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),e!==null&&e.child!==null||!Rr(t)||(t.effectTag|=4),Va(t),null;case 5:lu(t),i=ai(Jn.current);var r=t.type;if(e!==null&&t.stateNode!=null)Of(e,t,r,n,i),e.ref!==t.ref&&(t.effectTag|=128);else{if(!n){if(t.stateNode===null)throw Error(M(166));return null}if(e=ai(gt.current),Rr(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[jt]=t,n[vs]=s,r){case"iframe":case"object":case"embed":re("load",n);break;case"video":case"audio":for(e=0;e<Sn.length;e++)re(Sn[e],n);break;case"source":re("error",n);break;case"img":case"image":case"link":re("error",n),re("load",n);break;case"form":re("reset",n),re("submit",n);break;case"details":re("toggle",n);break;case"input":bc(n,s),re("invalid",n),xt(i,"onChange");break;case"select":n._wrapperState={wasMultiple:!!s.multiple},re("invalid",n),xt(i,"onChange");break;case"textarea":Ec(n,s),re("invalid",n),xt(i,"onChange")}Sa(r,s),e=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?n.textContent!==a&&(e=["children",a]):typeof a=="number"&&n.textContent!==""+a&&(e=["children",""+a]):Xi.hasOwnProperty(o)&&a!=null&&xt(i,o)}switch(r){case"input":Tr(n),Ac(n,s,!0);break;case"textarea":Tr(n),Tc(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=ms)}i=e,t.updateQueue=i,i!==null&&(t.effectTag|=4)}else{switch(o=i.nodeType===9?i:i.ownerDocument,e===Lc&&(e=zp(r)),e===Lc?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[jt]=t,e[vs]=n,Vf(e,t,!1,!1),t.stateNode=e,o=Ma(r,n),r){case"iframe":case"object":case"embed":re("load",e),a=n;break;case"video":case"audio":for(a=0;a<Sn.length;a++)re(Sn[a],e);a=n;break;case"source":re("error",e),a=n;break;case"img":case"image":case"link":re("error",e),re("load",e),a=n;break;case"form":re("reset",e),re("submit",e),a=n;break;case"details":re("toggle",e),a=n;break;case"input":bc(e,n),a=da(e,n),re("invalid",e),xt(i,"onChange");break;case"option":a=fa(e,n);break;case"select":e._wrapperState={wasMultiple:!!n.multiple},a=Ae({},n,{value:void 0}),re("invalid",e),xt(i,"onChange");break;case"textarea":Ec(e,n),a=ga(e,n),re("invalid",e),xt(i,"onChange");break;default:a=n}Sa(r,a);var l=a;for(s in l)if(l.hasOwnProperty(s)){var u=l[s];s==="style"?Kp(e,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Lp(e,u)):s==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&$n(e,u):typeof u=="number"&&$n(e,""+u):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Xi.hasOwnProperty(s)?u!=null&&xt(i,s):u!=null&&_l(e,s,u,o))}switch(r){case"input":Tr(e),Ac(e,n,!1);break;case"textarea":Tr(e),Tc(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Xt(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?Hi(e,!!n.multiple,i,!1):n.defaultValue!=null&&Hi(e,!!n.multiple,n.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=ms)}nf(r,n)&&(t.effectTag|=4)}t.ref!==null&&(t.effectTag|=128)}return null;case 6:if(e&&t.stateNode!=null)Uf(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(M(166));i=ai(Jn.current),ai(gt.current),Rr(t)?(i=t.stateNode,n=t.memoizedProps,i[jt]=t,i.nodeValue!==n&&(t.effectTag|=4)):(i=(i.nodeType===9?i:i.ownerDocument).createTextNode(n),i[jt]=t,t.stateNode=i)}return null;case 13:return ie(se),n=t.memoizedState,(t.effectTag&64)!==0?(t.expirationTime=i,t):(i=n!==null,n=!1,e===null?t.memoizedProps.fallback!==void 0&&Rr(t):(r=e.memoizedState,n=r!==null,i||r===null||(r=e.child.sibling,r!==null&&(s=t.firstEffect,s!==null?(t.firstEffect=r,r.nextEffect=s):(t.firstEffect=t.lastEffect=r,r.nextEffect=null),r.effectTag=8))),i&&!n&&(t.mode&2)!==0&&(e===null&&t.memoizedProps.unstable_avoidThisFallback!==!0||(se.current&1)!==0?fe===gi&&(fe=Ns):((fe===gi||fe===Ns)&&(fe=to),qn!==0&&Oe!==null&&(ci(Oe,ze),ag(Oe,qn)))),(i||n)&&(t.effectTag|=4),null);case 4:return tn(),Va(t),null;case 10:return ru(t),null;case 17:return De(t.type)&&ys(),null;case 19:if(ie(se),n=t.memoizedState,n===null)return null;if(r=(t.effectTag&64)!==0,s=n.rendering,s===null){if(r)jr(n,!1);else if(fe!==gi||e!==null&&(e.effectTag&64)!==0)for(s=t.child;s!==null;){if(e=Is(s),e!==null){for(t.effectTag|=64,jr(n,!1),r=e.updateQueue,r!==null&&(t.updateQueue=r,t.effectTag|=4),n.lastEffect===null&&(t.firstEffect=null),t.lastEffect=n.lastEffect,n=t.child;n!==null;)r=n,s=i,r.effectTag&=2,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null,e=r.alternate,e===null?(r.childExpirationTime=0,r.expirationTime=s,r.child=null,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null):(r.childExpirationTime=e.childExpirationTime,r.expirationTime=e.expirationTime,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,s=e.dependencies,r.dependencies=s===null?null:{expirationTime:s.expirationTime,firstContext:s.firstContext,responders:s.responders}),n=n.sibling;return ae(se,se.current&1|2),t.child}s=s.sibling}}else{if(!r)if(e=Is(s),e!==null){if(t.effectTag|=64,r=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.effectTag|=4),jr(n,!0),n.tail===null&&n.tailMode==="hidden"&&!s.alternate)return t=t.lastEffect=n.lastEffect,t!==null&&(t.nextEffect=null),null}else 2*Qe()-n.renderingStartTime>n.tailExpiration&&1<i&&(t.effectTag|=64,r=!0,jr(n,!1),t.expirationTime=t.childExpirationTime=i-1);n.isBackwards?(s.sibling=t.child,t.child=s):(i=n.last,i!==null?i.sibling=s:t.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=t.lastEffect,n.renderingStartTime=Qe(),i.sibling=null,t=se.current,ae(se,r?t&1|2:t&1),i):null}throw Error(M(156,t.tag))}function fS(e){switch(e.tag){case 1:De(e.type)&&ys();var t=e.effectTag;return t&4096?(e.effectTag=t&-4097|64,e):null;case 3:if(tn(),ie(Ne),ie(Ce),t=e.effectTag,(t&64)!==0)throw Error(M(285));return e.effectTag=t&-4097|64,e;case 5:return lu(e),null;case 13:return ie(se),t=e.effectTag,t&4096?(e.effectTag=t&-4097|64,e):null;case 19:return ie(se),null;case 4:return tn(),null;case 10:return ru(e),null;default:return null}}function gu(e,t){return{value:e,source:t,stack:Ul(t)}}var gS=typeof WeakSet=="function"?WeakSet:Set;function Oa(e,t){var i=t.source,n=t.stack;n===null&&i!==null&&(n=Ul(i)),i!==null&&kt(i.type),t=t.value,e!==null&&e.tag===1&&kt(e.type);try{console.error(t)}catch(r){setTimeout(function(){throw r})}}function mS(e,t){try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(i){vi(e,i)}}function gd(e){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){vi(e,i)}else t.current=null}function vS(e,t){switch(t.tag){case 0:case 11:case 15:case 22:return;case 1:if(t.effectTag&256&&e!==null){var i=e.memoizedProps,n=e.memoizedState;e=t.stateNode,t=e.getSnapshotBeforeUpdate(t.elementType===t.type?i:it(t.type,i),n),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:case 5:case 6:case 4:case 17:return}throw Error(M(163))}function Wf(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var n=i.destroy;i.destroy=void 0,n!==void 0&&n()}i=i.next}while(i!==t)}}function Hf(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var n=i.create;i.destroy=n()}i=i.next}while(i!==t)}}function wS(e,t,i){switch(i.tag){case 0:case 11:case 15:case 22:Hf(3,i);return;case 1:if(e=i.stateNode,i.effectTag&4)if(t===null)e.componentDidMount();else{var n=i.elementType===i.type?t.memoizedProps:it(i.type,t.memoizedProps);e.componentDidUpdate(n,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate)}t=i.updateQueue,t!==null&&ed(i,t,e);return;case 3:if(t=i.updateQueue,t!==null){if(e=null,i.child!==null)switch(i.child.tag){case 5:e=i.child.stateNode;break;case 1:e=i.child.stateNode}ed(i,t,e)}return;case 5:e=i.stateNode,t===null&&i.effectTag&4&&nf(i.type,i.memoizedProps)&&e.focus();return;case 6:return;case 4:return;case 12:return;case 13:i.memoizedState===null&&(i=i.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&Yp(i))));return;case 19:case 17:case 20:case 21:return}throw Error(M(163))}function md(e,t,i){switch(typeof Ya=="function"&&Ya(t),t.tag){case 0:case 11:case 14:case 15:case 22:if(e=t.updateQueue,e!==null&&(e=e.lastEffect,e!==null)){var n=e.next;Kt(97<i?97:i,function(){var r=n;do{var s=r.destroy;if(s!==void 0){var o=t;try{s()}catch(a){vi(o,a)}}r=r.next}while(r!==n)})}break;case 1:gd(t),i=t.stateNode,typeof i.componentWillUnmount=="function"&&mS(t,i);break;case 5:gd(t);break;case 4:Ff(e,t,i)}}function $f(e){var t=e.alternate;e.return=null,e.child=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.alternate=null,e.firstEffect=null,e.lastEffect=null,e.pendingProps=null,e.memoizedProps=null,e.stateNode=null,t!==null&&$f(t)}function vd(e){return e.tag===5||e.tag===3||e.tag===4}function wd(e){e:{for(var t=e.return;t!==null;){if(vd(t)){var i=t;break e}t=t.return}throw Error(M(160))}switch(t=i.stateNode,i.tag){case 5:var n=!1;break;case 3:t=t.containerInfo,n=!0;break;case 4:t=t.containerInfo,n=!0;break;default:throw Error(M(161))}i.effectTag&16&&($n(t,""),i.effectTag&=-17);e:t:for(i=e;;){for(;i.sibling===null;){if(i.return===null||vd(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?Ua(e,i,t):Wa(e,i,t)}function Ua(e,t,i){var n=e.tag,r=n===5||n===6;if(r)e=r?e.stateNode:e.stateNode.instance,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=ms));else if(n!==4&&(e=e.child,e!==null))for(Ua(e,t,i),e=e.sibling;e!==null;)Ua(e,t,i),e=e.sibling}function Wa(e,t,i){var n=e.tag,r=n===5||n===6;if(r)e=r?e.stateNode:e.stateNode.instance,t?i.insertBefore(e,t):i.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Wa(e,t,i),e=e.sibling;e!==null;)Wa(e,t,i),e=e.sibling}function Ff(e,t,i){for(var n=t,r=!1,s,o;;){if(!r){r=n.return;e:for(;;){if(r===null)throw Error(M(160));switch(s=r.stateNode,r.tag){case 5:o=!1;break e;case 3:s=s.containerInfo,o=!0;break e;case 4:s=s.containerInfo,o=!0;break e}r=r.return}r=!0}if(n.tag===5||n.tag===6){e:for(var a=e,l=n,u=i,c=l;;)if(md(a,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}o?(a=s,l=n.stateNode,a.nodeType===8?a.parentNode.removeChild(l):a.removeChild(l)):s.removeChild(n.stateNode)}else if(n.tag===4){if(n.child!==null){s=n.stateNode.containerInfo,o=!0,n.child.return=n,n=n.child;continue}}else if(md(e,n,i),n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return,n.tag===4&&(r=!1)}n.sibling.return=n.return,n=n.sibling}}function Lo(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:Wf(3,t);return;case 1:return;case 5:var i=t.stateNode;if(i!=null){var n=t.memoizedProps,r=e!==null?e.memoizedProps:n;e=t.type;var s=t.updateQueue;if(t.updateQueue=null,s!==null){for(i[vs]=n,e==="input"&&n.type==="radio"&&n.name!=null&&Pp(i,n),Ma(e,r),t=Ma(e,n),r=0;r<s.length;r+=2){var o=s[r],a=s[r+1];o==="style"?Kp(i,a):o==="dangerouslySetInnerHTML"?Lp(i,a):o==="children"?$n(i,a):_l(i,o,a,t)}switch(e){case"input":ha(i,n);break;case"textarea":Np(i,n);break;case"select":t=i._wrapperState.wasMultiple,i._wrapperState.wasMultiple=!!n.multiple,e=n.value,e!=null?Hi(i,!!n.multiple,e,!1):t!==!!n.multiple&&(n.defaultValue!=null?Hi(i,!!n.multiple,n.defaultValue,!0):Hi(i,!!n.multiple,n.multiple?[]:"",!1))}}}return;case 6:if(t.stateNode===null)throw Error(M(162));t.stateNode.nodeValue=t.memoizedProps;return;case 3:t=t.stateNode,t.hydrate&&(t.hydrate=!1,Yp(t.containerInfo));return;case 12:return;case 13:if(i=t,t.memoizedState===null?n=!1:(n=!0,i=t.child,wu=Qe()),i!==null)e:for(e=i;;){if(e.tag===5)s=e.stateNode,n?(s=s.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(s=e.stateNode,r=e.memoizedProps.style,r=r!=null&&r.hasOwnProperty("display")?r.display:null,s.style.display=Jp("display",r));else if(e.tag===6)e.stateNode.nodeValue=n?"":e.memoizedProps;else if(e.tag===13&&e.memoizedState!==null&&e.memoizedState.dehydrated===null){s=e.child.sibling,s.return=e,e=s;continue}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break;for(;e.sibling===null;){if(e.return===null||e.return===i)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}yd(t);return;case 19:yd(t);return;case 17:return}throw Error(M(163))}function yd(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new gS),t.forEach(function(n){var r=TS.bind(null,e,n);i.has(n)||(i.add(n),n.then(r,r))})}}var yS=typeof WeakMap=="function"?WeakMap:Map;function Qf(e,t,i){i=Qt(i,null),i.tag=3,i.payload={element:null};var n=t.value;return i.callback=function(){Ls||(Ls=!0,Ha=n),Oa(e,t)},i}function Zf(e,t,i){i=Qt(i,null),i.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var r=t.value;i.payload=function(){return Oa(e,t),n(r)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(i.callback=function(){typeof n!="function"&&(Yt===null?Yt=new Set([this]):Yt.add(this),Oa(e,t));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),i}var xS=Math.ceil,ks=rt.ReactCurrentDispatcher,Yf=rt.ReactCurrentOwner,ge=0,mu=8,st=16,vt=32,gi=0,Ps=1,Gf=2,Ns=3,to=4,vu=5,_=ge,Oe=null,W=null,ze=0,fe=gi,io=null,At=1073741823,Kn=1073741823,Ds=null,qn=0,zs=!1,wu=0,Xf=500,D=null,Ls=!1,Ha=null,Yt=null,Rs=!1,Bn=null,Cn=90,li=null,_n=0,$a=null,is=0;function mt(){return(_&(st|vt))!==ge?1073741821-(Qe()/10|0):is!==0?is:is=1073741821-(Qe()/10|0)}function mi(e,t,i){if(t=t.mode,(t&2)===0)return 1073741823;var n=qs();if((t&4)===0)return n===99?1073741823:1073741822;if((_&st)!==ge)return ze;if(i!==null)e=es(e,i.timeoutMs|0||5e3,250);else switch(n){case 99:e=1073741823;break;case 98:e=es(e,150,100);break;case 97:case 96:e=es(e,5e3,250);break;case 95:e=2;break;default:throw Error(M(326))}return Oe!==null&&e===ze&&--e,e}function Gt(e,t){if(50<_n)throw _n=0,$a=null,Error(M(185));if(e=no(e,t),e!==null){var i=qs();t===1073741823?(_&mu)!==ge&&(_&(st|vt))===ge?Fa(e):(Ue(e),_===ge&&wt()):Ue(e),(_&4)===ge||i!==98&&i!==99||(li===null?li=new Map([[e,t]]):(i=li.get(e),(i===void 0||i>t)&&li.set(e,t)))}}function no(e,t){e.expirationTime<t&&(e.expirationTime=t);var i=e.alternate;i!==null&&i.expirationTime<t&&(i.expirationTime=t);var n=e.return,r=null;if(n===null&&e.tag===3)r=e.stateNode;else for(;n!==null;){if(i=n.alternate,n.childExpirationTime<t&&(n.childExpirationTime=t),i!==null&&i.childExpirationTime<t&&(i.childExpirationTime=t),n.return===null&&n.tag===3){r=n.stateNode;break}n=n.return}return r!==null&&(Oe===r&&(ro(t),fe===to&&ci(r,ze)),ag(r,t)),r}function ns(e){var t=e.lastExpiredTime;if(t!==0||(t=e.firstPendingTime,!og(e,t)))return t;var i=e.lastPingedTime;return e=e.nextKnownPendingLevel,e=i>e?i:e,2>=e&&t!==e?0:e}function Ue(e){if(e.lastExpiredTime!==0)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=Kc(Fa.bind(null,e));else{var t=ns(e),i=e.callbackNode;if(t===0)i!==null&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var n=mt();if(t===1073741823?n=99:t===1||t===2?n=95:(n=10*(1073741821-t)-10*(1073741821-n),n=0>=n?99:250>=n?98:5250>=n?97:95),i!==null){var r=e.callbackPriority;if(e.callbackExpirationTime===t&&r>=n)return;i!==Mf&&vf(i)}e.callbackExpirationTime=t,e.callbackPriority=n,t=t===1073741823?Kc(Fa.bind(null,e)):If(n,Jf.bind(null,e),{timeout:10*(1073741821-t)-Qe()}),e.callbackNode=t}}}function Jf(e,t){if(is=0,t)return t=mt(),Ga(e,t),Ue(e),null;var i=ns(e);if(i!==0){if(t=e.callbackNode,(_&(st|vt))!==ge)throw Error(M(327));if(on(),e===Oe&&i===ze||ui(e,i),W!==null){var n=_;_|=st;var r=tg();do try{CS();break}catch(a){eg(e,a)}while(1);if(nu(),_=n,ks.current=r,fe===Ps)throw t=io,ui(e,i),ci(e,i),Ue(e),t;if(W===null)switch(r=e.finishedWork=e.current.alternate,e.finishedExpirationTime=i,n=fe,Oe=null,n){case gi:case Ps:throw Error(M(345));case Gf:Ga(e,2<i?2:i);break;case Ns:if(ci(e,i),n=e.lastSuspendedTime,i===n&&(e.nextKnownPendingLevel=Qa(r)),At===1073741823&&(r=wu+Xf-Qe(),10<r)){if(zs){var s=e.lastPingedTime;if(s===0||s>=i){e.lastPingedTime=i,ui(e,i);break}}if(s=ns(e),s!==0&&s!==i)break;if(n!==0&&n!==i){e.lastPingedTime=n;break}e.timeoutHandle=To(ri.bind(null,e),r);break}ri(e);break;case to:if(ci(e,i),n=e.lastSuspendedTime,i===n&&(e.nextKnownPendingLevel=Qa(r)),zs&&(r=e.lastPingedTime,r===0||r>=i)){e.lastPingedTime=i,ui(e,i);break}if(r=ns(e),r!==0&&r!==i)break;if(n!==0&&n!==i){e.lastPingedTime=n;break}if(Kn!==1073741823?n=10*(1073741821-Kn)-Qe():At===1073741823?n=0:(n=10*(1073741821-At)-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*xS(n/1960))-n,i<n&&(n=i)),10<n){e.timeoutHandle=To(ri.bind(null,e),n);break}ri(e);break;case vu:if(At!==1073741823&&Ds!==null){s=At;var o=Ds;if(n=o.busyMinDurationMs|0,0>=n?n=0:(r=o.busyDelayMs|0,s=Qe()-(10*(1073741821-s)-(o.timeoutMs|0||5e3)),n=s<=r?0:r+n-s),10<n){ci(e,i),e.timeoutHandle=To(ri.bind(null,e),n);break}}ri(e);break;default:throw Error(M(329))}if(Ue(e),e.callbackNode===t)return Jf.bind(null,e)}}return null}function Fa(e){var t=e.lastExpiredTime;if(t=t!==0?t:1073741823,(_&(st|vt))!==ge)throw Error(M(327));if(on(),e===Oe&&t===ze||ui(e,t),W!==null){var i=_;_|=st;var n=tg();do try{MS();break}catch(r){eg(e,r)}while(1);if(nu(),_=i,ks.current=n,fe===Ps)throw i=io,ui(e,t),ci(e,t),Ue(e),i;if(W!==null)throw Error(M(261));e.finishedWork=e.current.alternate,e.finishedExpirationTime=t,Oe=null,ri(e),Ue(e)}return null}function SS(){if(li!==null){var e=li;li=null,e.forEach(function(t,i){Ga(i,t),Ue(i)}),wt()}}function Kf(e,t){var i=_;_|=1;try{return e(t)}finally{_=i,_===ge&&wt()}}function qf(e,t){var i=_;_&=-2,_|=mu;try{return e(t)}finally{_=i,_===ge&&wt()}}function ui(e,t){e.finishedWork=null,e.finishedExpirationTime=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,xx(i)),W!==null)for(i=W.return;i!==null;){var n=i;switch(n.tag){case 1:n=n.type.childContextTypes,n!=null&&ys();break;case 3:tn(),ie(Ne),ie(Ce);break;case 5:lu(n);break;case 4:tn();break;case 13:ie(se);break;case 19:ie(se);break;case 10:ru(n)}i=i.return}Oe=e,W=Ci(e.current,null),ze=t,fe=gi,io=null,Kn=At=1073741823,Ds=null,qn=0,zs=!1}function eg(e,t){do{try{if(nu(),ts.current=Ts,bs)for(var i=de.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}if(_t=0,Me=Se=de=null,bs=!1,W===null||W.return===null)return fe=Ps,io=t,W=null;e:{var r=e,s=W.return,o=W,a=t;if(t=ze,o.effectTag|=2048,o.firstEffect=o.lastEffect=null,a!==null&&typeof a=="object"&&typeof a.then=="function"){var l=a;if((o.mode&2)===0){var u=o.alternate;u?(o.updateQueue=u.updateQueue,o.memoizedState=u.memoizedState,o.expirationTime=u.expirationTime):(o.updateQueue=null,o.memoizedState=null)}var c=(se.current&1)!==0,d=s;do{var m;if(m=d.tag===13){var w=d.memoizedState;if(w!==null)m=w.dehydrated!==null;else{var v=d.memoizedProps;m=v.fallback===void 0?!1:v.unstable_avoidThisFallback!==!0?!0:!c}}if(m){var x=d.updateQueue;if(x===null){var h=new Set;h.add(l),d.updateQueue=h}else x.add(l);if((d.mode&2)===0){if(d.effectTag|=64,o.effectTag&=-2981,o.tag===1)if(o.alternate===null)o.tag=17;else{var p=Qt(1073741823,null);p.tag=2,Zt(o,p)}o.expirationTime=1073741823;break e}a=void 0,o=t;var f=r.pingCache;if(f===null?(f=r.pingCache=new yS,a=new Set,f.set(l,a)):(a=f.get(l),a===void 0&&(a=new Set,f.set(l,a))),!a.has(o)){a.add(o);var g=ES.bind(null,r,l,o);l.then(g,g)}d.effectTag|=4096,d.expirationTime=t;break e}d=d.return}while(d!==null);a=Error((kt(o.type)||"A React component")+` suspended while rendering, but no fallback UI was specified.
43
+ */var ta=Ai.exports,Ae=rf,me=mf.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(!ta)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,ps=null,gs=!1,fo=null,Rx={onError:function(t){Vn=!0,ps=t}};function jx(t,e,i,n,r,s,a,o,l){Vn=!1,ps=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=ps;Vn=!1,ps=null}else throw Error(I(198));gs||(gs=!0,fo=u)}}var jl=null,wf=null,yf=null;function xc(t,e,i){var n=t.type||"unknown-event";t.currentTarget=yf(i),_x(n,e,void 0,t),t.currentTarget=null}var ms=null,Li={};function xf(){if(ms)for(var t in Li){var e=Li[t],i=ms.indexOf(t);if(!(-1<i))throw Error(I(96,t));if(!vs[i]){if(!e.extractEvents)throw Error(I(97,t));vs[i]=e,i=e.eventTypes;for(var n in i){var r=void 0,s=i[n],a=e,o=n;if(po.hasOwnProperty(o))throw Error(I(99,o));po[o]=s;var l=s.phasedRegistrationNames;if(l){for(r in l)l.hasOwnProperty(r)&&Sc(l[r],a,o);r=!0}else s.registrationName?(Sc(s.registrationName,a,o),r=!0):r=!1;if(!r)throw Error(I(98,n,t))}}}}function Sc(t,e,i){if(en[t])throw Error(I(100,t));en[t]=e,_l[t]=e.eventTypes[i].dependencies}var vs=[],po={},en={},_l={};function Sf(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&&xf()}var Kt=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),go=null,Fi=null,Qi=null;function Mc(t){if(t=wf(t)){if(typeof go!="function")throw Error(I(280));var e=t.stateNode;e&&(e=jl(e),go(t.stateNode,t.type,e))}}function Mf(t){Fi?Qi?Qi.push(t):Qi=[t]:Fi=t}function If(){if(Fi){var t=Fi,e=Qi;if(Qi=Fi=null,Mc(t),e)for(t=0;t<e.length;t++)Mc(e[t])}}function Vl(t,e){return t(e)}function Cf(t,e,i,n,r){return t(e,i,n,r)}function Ol(){}var bf=Vl,si=!1,Na=!1;function Ul(){(Fi!==null||Qi!==null)&&(Ol(),If())}function Af(t,e,i){if(Na)return t(e,i);Na=!0;try{return bf(t,e,i)}finally{Na=!1,Ul()}}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]*$/,Ic=Object.prototype.hasOwnProperty,Cc={},bc={};function Ox(t){return Ic.call(bc,t)?!0:Ic.call(Cc,t)?!1:Vx.test(t)?bc[t]=!0:(Cc[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 $l=/[\-:]([a-z])/g;function Wl(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($l,Wl);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($l,Wl);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($l,Wl);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=ta.__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 Hl(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,Br=Re?Symbol.for("react.element"):60103,Ri=Re?Symbol.for("react.portal"):60106,ri=Re?Symbol.for("react.fragment"):60107,Tf=Re?Symbol.for("react.strict_mode"):60108,Xr=Re?Symbol.for("react.profiler"):60114,Ef=Re?Symbol.for("react.provider"):60109,Nf=Re?Symbol.for("react.context"):60110,Hx=Re?Symbol.for("react.concurrent_mode"):60111,Fl=Re?Symbol.for("react.forward_ref"):60112,Jr=Re?Symbol.for("react.suspense"):60113,mo=Re?Symbol.for("react.suspense_list"):60120,Ql=Re?Symbol.for("react.memo"):60115,kf=Re?Symbol.for("react.lazy"):60116,Pf=Re?Symbol.for("react.block"):60121,Ac=typeof Symbol=="function"&&Symbol.iterator;function wn(t){return t===null||typeof t!="object"?null:(t=Ac&&t[Ac]||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 ri:return"Fragment";case Ri:return"Portal";case Xr:return"Profiler";case Tf:return"StrictMode";case Jr:return"Suspense";case mo:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Nf:return"Context.Consumer";case Ef:return"Context.Provider";case Fl:var e=t.render;return e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case Ql:return Et(t.type);case Pf:return Et(t.render);case kf:if(t=t._status===1?t._result:null)return Et(t)}return null}function Zl(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 Zt(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 Dr(t){t._valueTracker||(t._valueTracker=Qx(t))}function Bf(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 vo(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 Tc(t,e){var i=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;i=Zt(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 Df(t,e){e=e.checked,e!=null&&Hl(t,"checked",e,!1)}function wo(t,e){Df(t,e);var i=Zt(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")?yo(t,e.type,i):e.hasOwnProperty("defaultValue")&&yo(t,e.type,Zt(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Ec(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 yo(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 ta.Children.forEach(t,function(i){i!=null&&(e+=i)}),e}function xo(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=""+Zt(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 So(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(I(91));return Ae({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Nc(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:Zt(i)}}function Lf(t,e){var i=Zt(e.value),n=Zt(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 kc(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}var Rf={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function jf(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 Mo(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?jf(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Lr,_f=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!==Rf.svg||"innerHTML"in t)t.innerHTML=e;else{for(Lr=Lr||document.createElement("div"),Lr.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Lr.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 Rr(t,e){var i={};return i[t.toLowerCase()]=e.toLowerCase(),i["Webkit"+t]="webkit"+e,i["Moz"+t]="moz"+e,i}var ji={animationend:Rr("Animation","AnimationEnd"),animationiteration:Rr("Animation","AnimationIteration"),animationstart:Rr("Animation","AnimationStart"),transitionend:Rr("Transition","TransitionEnd")},ka={},Vf={};Kt&&(Vf=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 ia(t){if(ka[t])return ka[t];if(!ji[t])return t;var e=ji[t],i;for(i in e)if(e.hasOwnProperty(i)&&i in Vf)return ka[t]=e[i];return t}var Of=ia("animationend"),Uf=ia("animationiteration"),$f=ia("animationstart"),Wf=ia("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(" "),Pc=new(typeof WeakMap=="function"?WeakMap:Map);function Yl(t){var e=Pc.get(t);return e===void 0&&(e=new Map,Pc.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 Hf(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 zc(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 zc(r),t;if(s===n)return zc(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 Ff(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 Gl(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++)xc(t,e[n],i[n]);else e&&xc(t,e,i);t._dispatchListeners=null,t._dispatchInstances=null,t.isPersistent()||t.constructor.release(t)}}function na(t){if(t!==null&&(yn=tn(yn,t)),t=yn,yn=null,t){if(Gl(t,Gx),yn)throw Error(I(95));if(gs)throw t=fo,gs=!1,fo=null,t}}function Xl(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}function Qf(t){if(!Kt)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 ws=[];function Zf(t){t.topLevelType=null,t.nativeEvent=null,t.targetInst=null,t.ancestors.length=0,10>ws.length&&ws.push(t)}function Yf(t,e,i,n){if(ws.length){var r=ws.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 Gf(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=vr(n)}while(i);for(i=0;i<t.ancestors.length;i++){e=t.ancestors[i];var r=Xl(t.nativeEvent);n=t.topLevelType;var s=t.nativeEvent,a=t.eventSystemFlags;i===0&&(a|=64);for(var o=null,l=0;l<vs.length;l++){var u=vs[l];u&&(u=u.extractEvents(n,e,s,r,a))&&(o=tn(o,u))}na(o)}}function Io(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":Qf(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 Xf,Jl,Jf,Co=!1,dt=[],Ot=null,Ut=null,$t=null,qn=new Map,er=new Map,xn=[],bo="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=Yl(e);bo.forEach(function(n){Io(n,e,i)}),Xx.forEach(function(n){Io(n,e,i)})}function Ao(t,e,i,n,r){return{blockedOn:t,topLevelType:e,eventSystemFlags:i|32,nativeEvent:r,container:n}}function Bc(t,e){switch(t){case"focus":case"blur":Ot=null;break;case"dragenter":case"dragleave":Ut=null;break;case"mouseover":case"mouseout":$t=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=Ao(e,i,n,r,s),e!==null&&(e=wr(e),e!==null&&Jl(e)),t):(t.eventSystemFlags|=n,t)}function Kx(t,e,i,n,r){switch(e){case"focus":return Ot=Sn(Ot,t,e,i,n,r),!0;case"dragenter":return Ut=Sn(Ut,t,e,i,n,r),!0;case"mouseover":return $t=Sn($t,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=vr(t.target);if(e!==null){var i=Ti(e);if(i!==null){if(e=i.tag,e===13){if(e=Hf(i),e!==null){t.blockedOn=e,me.unstable_runWithPriority(t.priority,function(){Jf(i)});return}}else if(e===3&&i.stateNode.hydrate){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Kr(t){if(t.blockedOn!==null)return!1;var e=eu(t.topLevelType,t.eventSystemFlags,t.container,t.nativeEvent);if(e!==null){var i=wr(e);return i!==null&&Jl(i),t.blockedOn=e,!1}return!0}function Dc(t,e,i){Kr(t)&&i.delete(e)}function e0(){for(Co=!1;0<dt.length;){var t=dt[0];if(t.blockedOn!==null){t=wr(t.blockedOn),t!==null&&Xf(t);break}var e=eu(t.topLevelType,t.eventSystemFlags,t.container,t.nativeEvent);e!==null?t.blockedOn=e:dt.shift()}Ot!==null&&Kr(Ot)&&(Ot=null),Ut!==null&&Kr(Ut)&&(Ut=null),$t!==null&&Kr($t)&&($t=null),qn.forEach(Dc),er.forEach(Dc)}function Mn(t,e){t.blockedOn===e&&(t.blockedOn=null,Co||(Co=!0,me.unstable_scheduleCallback(me.unstable_NormalPriority,e0)))}function Kf(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(Ot!==null&&Mn(Ot,t),Ut!==null&&Mn(Ut,t),$t!==null&&Mn($t,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 qf={},ep=new Map,Kl=new Map,t0=["abort","abort",Of,"animationEnd",Uf,"animationIteration",$f,"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",Wf,"transitionEnd","waiting","waiting"];function ql(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},Kl.set(n,e),ep.set(n,s),qf[r]=s}}ql("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);ql("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);ql(t0,2);for(var Lc="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Pa=0;Pa<Lc.length;Pa++)Kl.set(Lc[Pa],0);var i0=me.unstable_UserBlockingPriority,n0=me.unstable_runWithPriority,qr=!0;function ne(t,e){kn(e,t,!1)}function kn(t,e,i){var n=Kl.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=ra.bind(null,e,1,t)}i?t.addEventListener(e,n,!0):t.addEventListener(e,n,!1)}function r0(t,e,i,n){si||Ol();var r=ra,s=si;si=!0;try{Cf(r,t,e,i,n)}finally{(si=s)||Ul()}}function s0(t,e,i,n){n0(i0,ra.bind(null,t,e,i,n))}function ra(t,e,i,n){if(qr)if(0<dt.length&&-1<bo.indexOf(t))t=Ao(null,t,e,i,n),dt.push(t);else{var r=eu(t,e,i,n);if(r===null)Bc(t,n);else if(-1<bo.indexOf(t))t=Ao(r,t,e,i,n),dt.push(t);else if(!Kx(r,t,e,i,n)){Bc(t,n),t=Yf(t,n,null,e);try{Af(Gf,t)}finally{Zf(t)}}}}function eu(t,e,i,n){if(i=Xl(n),i=vr(i),i!==null){var r=Ti(i);if(r===null)i=null;else{var s=r.tag;if(s===13){if(i=Hf(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=Yf(t,n,i,e);try{Af(Gf,t)}finally{Zf(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 tp(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 ip(t,e){t=t.style;for(var i in e)if(e.hasOwnProperty(i)){var n=i.indexOf("--")===0,r=tp(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 To(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 Eo(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 Rc=Rf.html;function xt(t,e){t=t.nodeType===9||t.nodeType===11?t:t.ownerDocument;var i=Yl(t);e=_l[e];for(var n=0;n<e.length;n++)Io(e[n],t,i)}function ys(){}function No(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 jc(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function _c(t,e){var i=jc(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=jc(i)}}function np(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?np(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Vc(){for(var t=window,e=No();e instanceof t.HTMLIFrameElement;){try{var i=typeof e.contentWindow.location.href=="string"}catch{i=!1}if(i)t=e.contentWindow;else break;e=No(t.document)}return e}function ko(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 rp="$",sp="/$",tu="$?",iu="$!",za=null,Ba=null;function ap(t,e){switch(t){case"button":case"input":case"select":case"textarea":return!!e.autoFocus}return!1}function Po(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 Da=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 Oc(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var i=t.data;if(i===rp||i===iu||i===tu){if(e===0)return t;e--}else i===sp&&e++}t=t.previousSibling}return null}var nu=Math.random().toString(36).slice(2),Bt="__reactInternalInstance$"+nu,xs="__reactEventHandlers$"+nu,mr="__reactContainere$"+nu;function vr(t){var e=t[Bt];if(e)return e;for(var i=t.parentNode;i;){if(e=i[mr]||i[Bt]){if(i=e.alternate,e.child!==null||i!==null&&i.child!==null)for(t=Oc(t);t!==null;){if(i=t[Bt])return i;t=Oc(t)}return e}t=i,i=t.parentNode}return null}function wr(t){return t=t[Bt]||t[mr],!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 ru(t){return t[xs]||null}function St(t){do t=t.return;while(t&&t.tag!==5);return t||null}function op(t,e){var i=t.stateNode;if(!i)return null;var n=jl(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 Uc(t,e,i){(e=op(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--;)Uc(i[e],"captured",t);for(e=0;e<i.length;e++)Uc(i[e],"bubbled",t)}}function zo(t,e,i){t&&i&&i.dispatchConfig.registrationName&&(e=op(t,i.dispatchConfig.registrationName))&&(i._dispatchListeners=tn(i._dispatchListeners,e),i._dispatchInstances=tn(i._dispatchInstances,t))}function c0(t){t&&t.dispatchConfig.registrationName&&zo(t._targetInst,null,t)}function nn(t){Gl(t,u0)}var Dt=null,su=null,es=null;function lp(){if(es)return es;var t,e=su,i=e.length,n,r="value"in Dt?Dt.value:Dt.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 es=r.slice(t,1<n?1-n:void 0)}function ts(){return!0}function Ss(){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)?ts:Ss,this.isPropagationStopped=Ss,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=ts)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=ts)},persist:function(){this.isPersistent=ts},isPersistent:Ss,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=Ss,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,up(i),i};up(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 up(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],au=Kt&&"CompositionEvent"in window,Un=null;Kt&&"documentMode"in document&&(Un=document.documentMode);var m0=Kt&&"TextEvent"in window&&!Un,cp=Kt&&(!au||Un&&8<Un&&11>=Un),$c=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(" ")}},Wc=!1;function hp(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 dp(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 dp(e);case"keypress":return e.which!==32?null:(Wc=!0,$c);case"textInput":return t=e.data,t===$c&&Wc?null:t;default:return null}}function w0(t,e){if(_i)return t==="compositionend"||!au&&hp(t,e)?(t=lp(),es=su=Dt=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 cp&&e.locale!=="ko"?null:e.data;default:return null}}var y0={eventTypes:yt,extractEvents:function(t,e,i,n){var r;if(au)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?hp(t,i)&&(s=yt.compositionEnd):t==="keydown"&&i.keyCode===229&&(s=yt.compositionStart);return s?(cp&&i.locale!=="ko"&&(_i||s!==yt.compositionStart?s===yt.compositionEnd&&_i&&(r=lp()):(Dt=n,su="value"in Dt?Dt.value:Dt.textContent,_i=!0)),s=f0.getPooled(s,e,i,n),r?s.data=r:(r=dp(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 fp(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!x0[t.type]:e==="textarea"}var pp={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function gp(t,e,i){return t=He.getPooled(pp.change,t,e,i),t.type="change",Mf(i),nn(t),t}var $n=null,tr=null;function S0(t){na(t)}function sa(t){var e=xi(t);if(Bf(e))return t}function M0(t,e){if(t==="change")return e}var Bo=!1;Kt&&(Bo=Qf("input")&&(!document.documentMode||9<document.documentMode));function Hc(){$n&&($n.detachEvent("onpropertychange",mp),tr=$n=null)}function mp(t){if(t.propertyName==="value"&&sa(tr))if(t=gp(tr,t,Xl(t)),si)na(t);else{si=!0;try{Vl(S0,t)}finally{si=!1,Ul()}}}function I0(t,e,i){t==="focus"?(Hc(),$n=e,tr=i,$n.attachEvent("onpropertychange",mp)):t==="blur"&&Hc()}function C0(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return sa(tr)}function b0(t,e){if(t==="click")return sa(e)}function A0(t,e){if(t==="input"||t==="change")return sa(e)}var T0={eventTypes:pp,_isInputEventSupported:Bo,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(fp(r))if(Bo)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 gp(a,i,n);o&&o(t,r,e),t==="blur"&&(t=r._wrapperState)&&t.controlled&&r.type==="number"&&yo(r,"number",r.value)}},yr=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 ou(){return N0}var Fc=0,Qc=0,Zc=!1,Yc=!1,xr=yr.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:ou,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=Fc;return Fc=t.screenX,Zc?t.type==="mousemove"?t.screenX-e:0:(Zc=!0,0)},movementY:function(t){if("movementY"in t)return t.movementY;var e=Qc;return Qc=t.screenY,Yc?t.type==="mousemove"?t.screenY-e:0:(Yc=!0,0)}}),vp=xr.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)?vr(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=xr,u=In.mouseLeave,c=In.mouseEnter,h="mouse";else(t==="pointerout"||t==="pointerover")&&(l=vp,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++)zo(l[h],"bubbled",u);for(h=n.length;0<h--;)zo(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,z0=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(!z0.call(e,i[n])||!Si(t[i[n]],e[i[n]]))return!1;return!0}var B0=Kt&&"documentMode"in document&&11>=document.documentMode,wp={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Vi=null,Do=null,Wn=null,Lo=!1;function Gc(t,e){var i=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;return Lo||Vi==null||Vi!==No(i)?null:(i=Vi,"selectionStart"in i&&ko(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(wp.select,Do,t,e),t.type="select",t.target=Vi,nn(t),t))}var D0={eventTypes:wp,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=Yl(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?xi(e):window,t){case"focus":(fp(r)||r.contentEditable==="true")&&(Vi=r,Do=e,Wn=null);break;case"blur":Wn=Do=Vi=null;break;case"mousedown":Lo=!0;break;case"contextmenu":case"mouseup":case"dragend":return Lo=!1,Gc(i,n);case"selectionchange":if(B0)break;case"keydown":case"keyup":return Gc(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=yr.extend({relatedTarget:null});function is(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=yr.extend({key:function(t){if(t.key){var e=_0[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=is(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:ou,charCode:function(t){return t.type==="keypress"?is(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?is(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),U0=xr.extend({dataTransfer:null}),$0=yr.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:ou}),W0=He.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),H0=xr.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:qf,extractEvents:function(t,e,i,n){var r=ep.get(t);if(!r)return null;switch(t){case"keypress":if(is(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=xr;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 Of:case Uf:case $f:t=L0;break;case Wf:t=W0;break;case"scroll":t=yr;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=vp;break;default:t=He}return e=t.getPooled(r,e,i,n),nn(e),e}};if(ms)throw Error(I(101));ms=Array.prototype.slice.call("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));xf();var Q0=wr;jl=ru;wf=Q0;yf=xi;Sf({SimpleEventPlugin:F0,EnterLeaveEventPlugin:k0,ChangeEventPlugin:T0,SelectEventPlugin:D0,BeforeInputEventPlugin:y0});var Ro=[],Oi=-1;function ee(t){0>Oi||(t.current=Ro[Oi],Ro[Oi]=null,Oi--)}function oe(t,e){Oi++,Ro[Oi]=t.current,t.current=e}var Yt={},Me={current:Yt},Be={current:!1},Mi=Yt;function rn(t,e){var i=t.type.contextTypes;if(!i)return Yt;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 Ms(){ee(Be),ee(Me)}function Xc(t,e,i){if(Me.current!==Yt)throw Error(I(168));oe(Me,e),oe(Be,i)}function yp(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 ns(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Yt,Mi=Me.current,oe(Me,t),oe(Be,Be.current),!0}function Jc(t,e,i){var n=t.stateNode;if(!n)throw Error(I(169));i?(t=yp(t,e,Mi),n.__reactInternalMemoizedMergedChildContext=t,ee(Be),ee(Me),oe(Me,t)):ee(Be),oe(Be,i)}var Z0=me.unstable_runWithPriority,lu=me.unstable_scheduleCallback,xp=me.unstable_cancelCallback,Kc=me.unstable_requestPaint,jo=me.unstable_now,Y0=me.unstable_getCurrentPriorityLevel,aa=me.unstable_ImmediatePriority,Sp=me.unstable_UserBlockingPriority,Mp=me.unstable_NormalPriority,Ip=me.unstable_LowPriority,Cp=me.unstable_IdlePriority,bp={},G0=me.unstable_shouldYield,X0=Kc!==void 0?Kc:function(){},It=null,rs=null,La=!1,qc=jo(),Qe=1e4>qc?jo:function(){return jo()-qc};function oa(){switch(Y0()){case aa:return 99;case Sp:return 98;case Mp:return 97;case Ip:return 96;case Cp:return 95;default:throw Error(I(332))}}function Ap(t){switch(t){case 99:return aa;case 98:return Sp;case 97:return Mp;case 96:return Ip;case 95:return Cp;default:throw Error(I(332))}}function Gt(t,e){return t=Ap(t),Z0(t,e)}function Tp(t,e,i){return t=Ap(t),lu(t,e,i)}function eh(t){return It===null?(It=[t],rs=lu(aa,Ep)):It.push(t),bp}function wt(){if(rs!==null){var t=rs;rs=null,xp(t)}Ep()}function Ep(){if(!La&&It!==null){La=!0;var t=0;try{var e=It;Gt(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)),lu(aa,wt),i}finally{La=!1}}}function ss(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 Is={current:null},Cs=null,Ui=null,bs=null;function uu(){bs=Ui=Cs=null}function cu(t){var e=Is.current;ee(Is),t.type._context._currentValue=e}function Np(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){Cs=t,bs=Ui=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.expirationTime>=e&&(ft=!0),t.firstContext=null)}function Ye(t,e){if(bs!==t&&e!==!1&&e!==0)if((typeof e!="number"||e===1073741823)&&(bs=t,e=1073741823),e={context:t,observedBits:e,next:null},Ui===null){if(Cs===null)throw Error(I(308));Ui=e,Cs.dependencies={expirationTime:0,firstContext:e,responders:null}}else Ui=Ui.next=e;return t._currentValue}var zt=!1;function hu(t){t.updateQueue={baseState:t.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function du(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,baseQueue:t.baseQueue,shared:t.shared,effects:t.effects})}function Wt(t,e){return t={expirationTime:t,suspenseConfig:e,tag:0,payload:null,callback:null,next:null},t.next=t}function Ht(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 th(t,e){var i=t.alternate;i!==null&&du(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}),sg(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,da(u),t.expirationTime=u,t.memoizedState=l}}function ih(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,kp=new ta.Component().refs;function As(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 la={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=gi(n,t,r),r=Wt(n,r),r.payload=e,i!=null&&(r.callback=i),Ht(t,r),Qt(t,n)},enqueueReplaceState:function(t,e,i){t=t._reactInternalFiber;var n=mt(),r=Hn.suspense;n=gi(n,t,r),r=Wt(n,r),r.tag=1,r.payload=e,i!=null&&(r.callback=i),Ht(t,r),Qt(t,n)},enqueueForceUpdate:function(t,e){t=t._reactInternalFiber;var i=mt(),n=Hn.suspense;i=gi(i,t,n),n=Wt(i,n),n.tag=2,e!=null&&(n.callback=e),Ht(t,n),Qt(t,i)}};function nh(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 Pp(t,e,i){var n=!1,r=Yt,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):Yt),e=new e(i,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=la,t.stateNode=e,e._reactInternalFiber=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=s),e}function rh(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&&la.enqueueReplaceState(e,e.state,null)}function _o(t,e,i,n){var r=t.stateNode;r.props=i,r.state=t.memoizedState,r.refs=kp,hu(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"&&(As(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&&la.enqueueReplaceState(r,r.state,null),nr(t,i,r,n),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.effectTag|=4)}var jr=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===kp&&(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 _r(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=Ua(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=us(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=$a(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=jt(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=Ua(""+f,d.mode,p),f.return=d,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case Br:return p=us(f.type,f.key,f.props,null,d.mode,p),p.ref=Cn(d,null,f),p.return=d,p;case Ri:return f=$a(f,d.mode,p),f.return=d,f}if(jr(f)||wn(f))return f=jt(f,d.mode,p,null),f.return=d,f;_r(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 Br:return p.key===y?p.type===ri?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(jr(p)||wn(p))return y!==null?null:c(d,f,p,g,null);_r(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 Br:return d=d.get(g.key===null?p:g.key)||null,g.type===ri?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(jr(g)||wn(g))return d=d.get(p)||null,c(f,d,g,y,null);_r(f,g)}return null}function w(d,f,p,g){for(var y=null,x=null,E=f,B=f=0,P=null;E!==null&&B<p.length;B++){E.index>B?(P=E,E=null):P=E.sibling;var z=m(d,E,p[B],g);if(z===null){E===null&&(E=P);break}t&&E&&z.alternate===null&&e(d,E),f=s(z,f,B),x===null?y=z:x.sibling=z,x=z,E=P}if(B===p.length)return i(d,E),y;if(E===null){for(;B<p.length;B++)E=h(d,p[B],g),E!==null&&(f=s(E,f,B),x===null?y=E:x.sibling=E,x=E);return y}for(E=n(d,E);B<p.length;B++)P=v(E,d,B,p[B],g),P!==null&&(t&&P.alternate!==null&&E.delete(P.key===null?B:P.key),f=s(P,f,B),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,B=f=0,P=null,z=p.next();E!==null&&!z.done;B++,z=p.next()){E.index>B?(P=E,E=null):P=E.sibling;var te=m(d,E,z.value,g);if(te===null){E===null&&(E=P);break}t&&E&&te.alternate===null&&e(d,E),f=s(te,f,B),x===null?y=te:x.sibling=te,x=te,E=P}if(z.done)return i(d,E),y;if(E===null){for(;!z.done;B++,z=p.next())z=h(d,z.value,g),z!==null&&(f=s(z,f,B),x===null?y=z:x.sibling=z,x=z);return y}for(E=n(d,E);!z.done;B++,z=p.next())z=v(E,d,B,z.value,g),z!==null&&(t&&z.alternate!==null&&E.delete(z.key===null?B:z.key),f=s(z,f,B),x===null?y=z:x.sibling=z,x=z);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===ri&&p.key===null;y&&(p=p.props.children);var x=typeof p=="object"&&p!==null;if(x)switch(p.$$typeof){case Br:e:{for(x=p.key,y=f;y!==null;){if(y.key===x){switch(y.tag){case 7:if(p.type===ri){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===ri?(f=jt(p.props.children,d.mode,g,p.key),f.return=d,d=f):(g=us(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=$a(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=Ua(p,d.mode,g),f.return=d,d=f),a(d);if(jr(p))return w(d,f,p,g);if(wn(p))return M(d,f,p,g);if(x&&_r(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),fu=zp(!1),Sr={},gt={current:Sr},rr={current:Sr},sr={current:Sr};function ai(t){if(t===Sr)throw Error(I(174));return t}function Vo(t,e){switch(oe(sr,e),oe(rr,t),oe(gt,Sr),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Mo(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Mo(e,t)}ee(gt),oe(gt,e)}function an(){ee(gt),ee(rr),ee(sr)}function sh(t){ai(sr.current);var e=ai(gt.current),i=Mo(e,t.type);e!==i&&(oe(rr,t),oe(gt,i))}function pu(t){rr.current===t&&(ee(gt),ee(rr))}var re={current:0};function Ts(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===tu||i.data===iu))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 gu(t,e){return{responder:t,props:e}}var as=et.ReactCurrentDispatcher,Ze=et.ReactCurrentBatchConfig,Lt=0,ce=null,xe=null,Se=null,Es=!1;function je(){throw Error(I(321))}function mu(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 vu(t,e,i,n,r,s){if(Lt=s,ce=e,e.memoizedState=null,e.updateQueue=null,e.expirationTime=0,as.current=t===null||t.memoizedState===null?J0:K0,t=i(n,r),e.expirationTime===Lt){s=0;do{if(e.expirationTime=0,!(25>s))throw Error(I(301));s+=1,Se=xe=null,e.updateQueue=null,as.current=q0,t=i(n,r)}while(e.expirationTime===Lt)}if(as.current=Ps,e=xe!==null&&xe.next!==null,Lt=0,Se=xe=ce=null,Es=!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 di(t,e){return typeof e=="function"?e(t):e}function Vr(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<Lt){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,da(u))}else o!==null&&(o=o.next={expirationTime:1073741823,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null}),sg(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 Or(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 Ra(t){var e=Xi();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t=e.queue={pending:null,dispatch:null,lastRenderedReducer:di,lastRenderedState:t},t=t.dispatch=_p.bind(null,ce,t),[e.memoizedState,t]}function Oo(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 Bp(){return cn().memoizedState}function Uo(t,e,i,n){var r=Xi();ce.effectTag|=t,r.memoizedState=Oo(1|e,i,void 0,n===void 0?null:n)}function wu(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&&mu(n,a.deps)){Oo(e,i,s,n);return}}ce.effectTag|=t,r.memoizedState=Oo(1|e,i,s,n)}function ah(t,e){return Uo(516,4,t,e)}function Ns(t,e){return wu(516,4,t,e)}function Dp(t,e){return wu(4,2,t,e)}function Lp(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 Rp(t,e,i){return i=i!=null?i.concat([t]):null,wu(4,2,Lp.bind(null,e,t),i)}function yu(){}function oh(t,e){return Xi().memoizedState=[t,e===void 0?null:e],t}function ks(t,e){var i=cn();e=e===void 0?null:e;var n=i.memoizedState;return n!==null&&e!==null&&mu(e,n[1])?n[0]:(i.memoizedState=[t,e],t)}function jp(t,e){var i=cn();e=e===void 0?null:e;var n=i.memoizedState;return n!==null&&e!==null&&mu(e,n[1])?n[0]:(t=t(),i.memoizedState=[t,e],t)}function xu(t,e,i){var n=oa();Gt(98>n?98:n,function(){t(!0)}),Gt(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 _p(t,e,i){var n=mt(),r=Hn.suspense;n=gi(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)Es=!0,r.expirationTime=Lt,ce.expirationTime=Lt;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{}Qt(t,n)}}var Ps={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:oh,useContext:Ye,useEffect:ah,useImperativeHandle:function(t,e,i){return i=i!=null?i.concat([t]):null,Uo(4,2,Lp.bind(null,e,t),i)},useLayoutEffect:function(t,e){return Uo(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=_p.bind(null,ce,t),[n.memoizedState,t]},useRef:function(t){var e=Xi();return t={current:t},e.memoizedState=t},useState:Ra,useDebugValue:yu,useResponder:gu,useDeferredValue:function(t,e){var i=Ra(t),n=i[0],r=i[1];return ah(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=Ra(!1),i=e[0];return e=e[1],[oh(xu.bind(null,e,t),[e,t]),i]}},K0={readContext:Ye,useCallback:ks,useContext:Ye,useEffect:Ns,useImperativeHandle:Rp,useLayoutEffect:Dp,useMemo:jp,useReducer:Vr,useRef:Bp,useState:function(){return Vr(di)},useDebugValue:yu,useResponder:gu,useDeferredValue:function(t,e){var i=Vr(di),n=i[0],r=i[1];return Ns(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=Vr(di),i=e[0];return e=e[1],[ks(xu.bind(null,e,t),[e,t]),i]}},q0={readContext:Ye,useCallback:ks,useContext:Ye,useEffect:Ns,useImperativeHandle:Rp,useLayoutEffect:Dp,useMemo:jp,useReducer:Or,useRef:Bp,useState:function(){return Or(di)},useDebugValue:yu,useResponder:gu,useDeferredValue:function(t,e){var i=Or(di),n=i[0],r=i[1];return Ns(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(di),i=e[0];return e=e[1],[ks(xu.bind(null,e,t),[e,t]),i]}},At=null,Rt=null,fi=!1;function Vp(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 lh(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 $o(t){if(fi){var e=Rt;if(e){var i=e;if(!lh(t,e)){if(e=Yi(i.nextSibling),!e||!lh(t,e)){t.effectTag=t.effectTag&-1025|2,fi=!1,At=t;return}Vp(At,i)}At=t,Rt=Yi(e.firstChild)}else t.effectTag=t.effectTag&-1025|2,fi=!1,At=t}}function uh(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;At=t}function Ur(t){if(t!==At)return!1;if(!fi)return uh(t),fi=!0,!1;var e=t.type;if(t.tag!==5||e!=="head"&&e!=="body"&&!Po(e,t.memoizedProps))for(e=Rt;e;)Vp(t,e),e=Yi(e.nextSibling);if(uh(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===sp){if(e===0){Rt=Yi(t.nextSibling);break e}e--}else i!==rp&&i!==iu&&i!==tu||e++}t=t.nextSibling}Rt=null}}else Rt=At?Yi(t.stateNode.nextSibling):null;return!0}function ja(){Rt=At=null,fi=!1}var eS=et.ReactCurrentOwner,ft=!1;function Ve(t,e,i,n){e.child=t===null?fu(e,null,i,n):sn(e,t.child,i,n)}function ch(t,e,i,n,r){i=i.render;var s=e.ref;return Gi(e,r),n=vu(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 hh(t,e,i,n,r,s){if(t===null){var a=i.type;return typeof a=="function"&&!bu(a)&&a.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(e.tag=15,e.type=a,Op(t,e,a,n,r,s)):(t=us(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 Op(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)):Wo(t,e,i,n,s)}function Up(t,e){var i=e.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(e.effectTag|=128)}function Wo(t,e,i,n,r){var s=De(i)?Mi:Me.current;return s=rn(e,s),Gi(e,r),i=vu(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 dh(t,e,i,n,r){if(De(i)){var s=!0;ns(e)}else s=!1;if(Gi(e,r),e.stateNode===null)t!==null&&(t.alternate=null,e.alternate=null,e.effectTag|=2),Pp(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=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)&&rh(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||Be.current||zt?(typeof c=="function"&&(As(e,i,c,n),l=e.memoizedState),(o=zt||nh(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,du(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)&&rh(e,a,n,u),zt=!1,l=e.memoizedState,a.state=l,nr(e,n,a,r),m=e.memoizedState,o!==n||l!==m||Be.current||zt?(typeof c=="function"&&(As(e,i,c,n),m=e.memoizedState),(c=zt||nh(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 Ho(t,e,i,n,s,r)}function Ho(t,e,i,n,r,s){Up(t,e);var a=(e.effectTag&64)!==0;if(!n&&!a)return r&&Jc(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&&Jc(e,i,!0),e.child}function fh(t){var e=t.stateNode;e.pendingContext?Xc(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Xc(t,e.context,!1),Vo(t,e.containerInfo)}var _a={dehydrated:null,retryTime:0};function ph(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&&$o(e),a){if(a=r.fallback,r=jt(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=jt(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=fu(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=sn(e,t.child,r.children,i),e.memoizedState=null,e.child=i}if(t=t.child,a){if(a=r.fallback,r=jt(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=jt(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=sn(e,t,r.children,i)}function gh(t,e){t.expirationTime<e&&(t.expirationTime=e);var i=t.alternate;i!==null&&i.expirationTime<e&&(i.expirationTime=e),Np(t.return,e)}function Va(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(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&&gh(t,i);else if(t.tag===19)gh(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&&Ts(t)===null&&(r=i),i=i.sibling;i=r,i===null?(r=e.child,e.child=null):(r=i.sibling,i.sibling=null),Va(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&&Ts(t)===null){e.child=r;break}t=r.sibling,r.sibling=i,i=r,r=t}Va(e,!0,i,null,s,e.lastEffect);break;case"together":Va(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&&da(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 $p,Fo,Wp,Hp;$p=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}};Fo=function(){};Wp=function(t,e,i,n,r){var s=t.memoizedProps;if(s!==n){var a=e.stateNode;switch(ai(gt.current),t=null,i){case"input":s=vo(a,s),n=vo(a,n),t=[];break;case"option":s=xo(a,s),n=xo(a,n),t=[];break;case"select":s=Ae({},s,{value:void 0}),n=Ae({},n,{value:void 0}),t=[];break;case"textarea":s=So(a,s),n=So(a,n),t=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(a.onclick=ys)}To(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)}};Hp=function(t,e,i,n){i!==n&&(e.effectTag|=4)};function $r(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)&&Ms(),null;case 3:return an(),ee(Be),ee(Me),i=e.stateNode,i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),t!==null&&t.child!==null||!Ur(e)||(e.effectTag|=4),Fo(e),null;case 5:pu(e),i=ai(sr.current);var r=e.type;if(t!==null&&e.stateNode!=null)Wp(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=ai(gt.current),Ur(e)){n=e.stateNode,r=e.type;var s=e.memoizedProps;switch(n[Bt]=e,n[xs]=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":Tc(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":Nc(n,s),ne("invalid",n),xt(i,"onChange")}To(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":Dr(n),Ec(n,s,!0);break;case"textarea":Dr(n),kc(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=ys)}i=t,e.updateQueue=i,i!==null&&(e.effectTag|=4)}else{switch(a=i.nodeType===9?i:i.ownerDocument,t===Rc&&(t=jf(r)),t===Rc?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[Bt]=e,t[xs]=n,$p(t,e,!1,!1),e.stateNode=t,a=Eo(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":Tc(t,n),o=vo(t,n),ne("invalid",t),xt(i,"onChange");break;case"option":o=xo(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":Nc(t,n),o=So(t,n),ne("invalid",t),xt(i,"onChange");break;default:o=n}To(r,o);var l=o;for(s in l)if(l.hasOwnProperty(s)){var u=l[s];s==="style"?ip(t,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&_f(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&&Hl(t,s,u,a))}switch(r){case"input":Dr(t),Ec(t,n,!1);break;case"textarea":Dr(t),kc(t);break;case"option":n.value!=null&&t.setAttribute("value",""+Zt(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=ys)}ap(r,n)&&(e.effectTag|=4)}e.ref!==null&&(e.effectTag|=128)}return null;case 6:if(t&&e.stateNode!=null)Hp(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(I(166));i=ai(sr.current),ai(gt.current),Ur(e)?(i=e.stateNode,n=e.memoizedProps,i[Bt]=e,i.nodeValue!==n&&(e.effectTag|=4)):(i=(i.nodeType===9?i:i.ownerDocument).createTextNode(n),i[Bt]=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&&Ur(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===pi&&(fe=Ds):((fe===pi||fe===Ds)&&(fe=ua),or!==0&&$e!==null&&(ui($e,Le),cg($e,or)))),(i||n)&&(e.effectTag|=4),null);case 4:return an(),Fo(e),null;case 10:return cu(e),null;case 17:return De(e.type)&&Ms(),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)$r(n,!1);else if(fe!==pi||t!==null&&(t.effectTag&64)!==0)for(s=e.child;s!==null;){if(t=Ts(s),t!==null){for(e.effectTag|=64,$r(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=Ts(s),t!==null){if(e.effectTag|=64,r=!0,i=t.updateQueue,i!==null&&(e.updateQueue=i,e.effectTag|=4),$r(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,$r(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)&&Ms();var e=t.effectTag;return e&4096?(t.effectTag=e&-4097|64,t):null;case 3:if(an(),ee(Be),ee(Me),e=t.effectTag,(e&64)!==0)throw Error(I(285));return t.effectTag=e&-4097|64,t;case 5:return pu(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 cu(t),null;default:return null}}function Su(t,e){return{value:t,source:e,stack:Zl(e)}}var nS=typeof WeakSet=="function"?WeakSet:Set;function Qo(t,e){var i=e.source,n=e.stack;n===null&&i!==null&&(n=Zl(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){mi(t,i)}}function vh(t){var e=t.ref;if(e!==null)if(typeof e=="function")try{e(null)}catch(i){mi(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 Fp(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 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.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:Qp(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&&ih(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}ih(i,e,t)}return;case 5:t=i.stateNode,e===null&&i.effectTag&4&&ap(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&&Kf(i))));return;case 19:case 17:case 20:case 21:return}throw Error(I(163))}function wh(t,e,i){switch(typeof el=="function"&&el(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;Gt(97<i?97:i,function(){var r=n;do{var s=r.destroy;if(s!==void 0){var a=e;try{s()}catch(o){mi(a,o)}}r=r.next}while(r!==n)})}break;case 1:vh(e),i=e.stateNode,typeof i.componentWillUnmount=="function"&&rS(e,i);break;case 5:vh(e);break;case 4:Yp(t,e,i)}}function Zp(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&&Zp(e)}function yh(t){return t.tag===5||t.tag===3||t.tag===4}function xh(t){e:{for(var e=t.return;e!==null;){if(yh(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||yh(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?Zo(t,i,e):Yo(t,i,e)}function Zo(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=ys));else if(n!==4&&(t=t.child,t!==null))for(Zo(t,e,i),t=t.sibling;t!==null;)Zo(t,e,i),t=t.sibling}function Yo(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(Yo(t,e,i),t=t.sibling;t!==null;)Yo(t,e,i),t=t.sibling}function Yp(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(wh(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(wh(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 Oa(t,e){switch(e.tag){case 0:case 11:case 14:case 15:case 22:Fp(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[xs]=n,t==="input"&&n.type==="radio"&&n.name!=null&&Df(i,n),Eo(t,r),e=Eo(t,n),r=0;r<s.length;r+=2){var a=s[r],o=s[r+1];a==="style"?ip(i,o):a==="dangerouslySetInnerHTML"?_f(i,o):a==="children"?Kn(i,o):Hl(i,a,o,e)}switch(t){case"input":wo(i,n);break;case"textarea":Lf(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,Kf(e.containerInfo));return;case 12:return;case 13:if(i=e,e.memoizedState===null?n=!1:(n=!0,i=e.child,Cu=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=tp("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}Sh(e);return;case 19:Sh(e);return;case 17:return}throw Error(I(163))}function Sh(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 Gp(t,e,i){i=Wt(i,null),i.tag=3,i.payload={element:null};var n=e.value;return i.callback=function(){js||(js=!0,Go=n),Qo(t,e)},i}function Xp(t,e,i){i=Wt(i,null),i.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var r=e.value;i.payload=function(){return Qo(t,e),n(r)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(i.callback=function(){typeof n!="function"&&(Ft===null?Ft=new Set([this]):Ft.add(this),Qo(t,e));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),i}var lS=Math.ceil,zs=et.ReactCurrentDispatcher,Jp=et.ReactCurrentOwner,pe=0,Mu=8,tt=16,vt=32,pi=0,Bs=1,Kp=2,Ds=3,ua=4,Iu=5,$=pe,$e=null,H=null,Le=0,fe=pi,ca=null,bt=1073741823,ar=1073741823,Ls=null,or=0,Rs=!1,Cu=0,qp=500,D=null,js=!1,Go=null,Ft=null,_s=!1,Fn=null,Pn=90,oi=null,Qn=0,Xo=null,os=0;function mt(){return($&(tt|vt))!==pe?1073741821-(Qe()/10|0):os!==0?os:os=1073741821-(Qe()/10|0)}function gi(t,e,i){if(e=e.mode,(e&2)===0)return 1073741823;var n=oa();if((e&4)===0)return n===99?1073741823:1073741822;if(($&tt)!==pe)return Le;if(i!==null)t=ss(t,i.timeoutMs|0||5e3,250);else switch(n){case 99:t=1073741823;break;case 98:t=ss(t,150,100);break;case 97:case 96:t=ss(t,5e3,250);break;case 95:t=2;break;default:throw Error(I(326))}return $e!==null&&t===Le&&--t,t}function Qt(t,e){if(50<Qn)throw Qn=0,Xo=null,Error(I(185));if(t=ha(t,e),t!==null){var i=oa();e===1073741823?($&Mu)!==pe&&($&(tt|vt))===pe?Jo(t):(We(t),$===pe&&wt()):We(t),($&4)===pe||i!==98&&i!==99||(oi===null?oi=new Map([[t,e]]):(i=oi.get(t),(i===void 0||i>e)&&oi.set(t,e)))}}function ha(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&&(da(e),fe===ua&&ui(r,Le)),cg(r,e)),r}function ls(t){var e=t.lastExpiredTime;if(e!==0||(e=t.firstPendingTime,!ug(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=eh(Jo.bind(null,t));else{var e=ls(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!==bp&&xp(i)}t.callbackExpirationTime=e,t.callbackPriority=n,e=e===1073741823?eh(Jo.bind(null,t)):Tp(n,eg.bind(null,t),{timeout:10*(1073741821-e)-Qe()}),t.callbackNode=e}}}function eg(t,e){if(os=0,e)return e=mt(),tl(t,e),We(t),null;var i=ls(t);if(i!==0){if(e=t.callbackNode,($&(tt|vt))!==pe)throw Error(I(327));if(hn(),t===$e&&i===Le||li(t,i),H!==null){var n=$;$|=tt;var r=rg();do try{hS();break}catch(o){ng(t,o)}while(1);if(uu(),$=n,zs.current=r,fe===Bs)throw e=ca,li(t,i),ui(t,i),We(t),e;if(H===null)switch(r=t.finishedWork=t.current.alternate,t.finishedExpirationTime=i,n=fe,$e=null,n){case pi:case Bs:throw Error(I(345));case Kp:tl(t,2<i?2:i);break;case Ds:if(ui(t,i),n=t.lastSuspendedTime,i===n&&(t.nextKnownPendingLevel=Ko(r)),bt===1073741823&&(r=Cu+qp-Qe(),10<r)){if(Rs){var s=t.lastPingedTime;if(s===0||s>=i){t.lastPingedTime=i,li(t,i);break}}if(s=ls(t),s!==0&&s!==i)break;if(n!==0&&n!==i){t.lastPingedTime=n;break}t.timeoutHandle=Da(ni.bind(null,t),r);break}ni(t);break;case ua:if(ui(t,i),n=t.lastSuspendedTime,i===n&&(t.nextKnownPendingLevel=Ko(r)),Rs&&(r=t.lastPingedTime,r===0||r>=i)){t.lastPingedTime=i,li(t,i);break}if(r=ls(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=Da(ni.bind(null,t),n);break}ni(t);break;case Iu:if(bt!==1073741823&&Ls!==null){s=bt;var a=Ls;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){ui(t,i),t.timeoutHandle=Da(ni.bind(null,t),n);break}}ni(t);break;default:throw Error(I(329))}if(We(t),t.callbackNode===e)return eg.bind(null,t)}}return null}function Jo(t){var e=t.lastExpiredTime;if(e=e!==0?e:1073741823,($&(tt|vt))!==pe)throw Error(I(327));if(hn(),t===$e&&e===Le||li(t,e),H!==null){var i=$;$|=tt;var n=rg();do try{cS();break}catch(r){ng(t,r)}while(1);if(uu(),$=i,zs.current=n,fe===Bs)throw i=ca,li(t,e),ui(t,e),We(t),i;if(H!==null)throw Error(I(261));t.finishedWork=t.current.alternate,t.finishedExpirationTime=e,$e=null,ni(t),We(t)}return null}function uS(){if(oi!==null){var t=oi;oi=null,t.forEach(function(e,i){tl(i,e),We(i)}),wt()}}function tg(t,e){var i=$;$|=1;try{return t(e)}finally{$=i,$===pe&&wt()}}function ig(t,e){var i=$;$&=-2,$|=Mu;try{return t(e)}finally{$=i,$===pe&&wt()}}function li(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&&Ms();break;case 3:an(),ee(Be),ee(Me);break;case 5:pu(n);break;case 4:an();break;case 13:ee(re);break;case 19:ee(re);break;case 10:cu(n)}i=i.return}$e=t,H=Ii(t.current,null),Le=e,fe=pi,ca=null,ar=bt=1073741823,Ls=null,or=0,Rs=!1}function ng(t,e){do{try{if(uu(),as.current=Ps,Es)for(var i=ce.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}if(Lt=0,Se=xe=ce=null,Es=!1,H===null||H.return===null)return fe=Bs,ca=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=Wt(1073741823,null);f.tag=2,Ht(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.
58
45
 
59
- Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`+Ul(o))}fe!==vu&&(fe=Gf),a=gu(a,o),d=s;do{switch(d.tag){case 3:l=a,d.effectTag|=4096,d.expirationTime=t;var y=Qf(d,l,t);qc(d,y);break e;case 1:l=a;var S=d.type,T=d.stateNode;if((d.effectTag&64)===0&&(typeof S.getDerivedStateFromError=="function"||T!==null&&typeof T.componentDidCatch=="function"&&(Yt===null||!Yt.has(T)))){d.effectTag|=4096,d.expirationTime=t;var N=Zf(d,l,t);qc(d,N);break e}}d=d.return}while(d!==null)}W=rg(W)}catch(k){t=k;continue}break}while(1)}function tg(){var e=ks.current;return ks.current=Ts,e===null?Ts:e}function ig(e,t){e<At&&2<e&&(At=e),t!==null&&e<Kn&&2<e&&(Kn=e,Ds=t)}function ro(e){e>qn&&(qn=e)}function MS(){for(;W!==null;)W=ng(W)}function CS(){for(;W!==null&&!aS();)W=ng(W)}function ng(e){var t=sg(e.alternate,e,ze);return e.memoizedProps=e.pendingProps,t===null&&(t=rg(e)),Yf.current=null,t}function rg(e){W=e;do{var t=W.alternate;if(e=W.return,(W.effectTag&2048)===0){if(t=pS(t,W,ze),ze===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(t!==null)return t;e!==null&&(e.effectTag&2048)===0&&(e.firstEffect===null&&(e.firstEffect=W.firstEffect),W.lastEffect!==null&&(e.lastEffect!==null&&(e.lastEffect.nextEffect=W.firstEffect),e.lastEffect=W.lastEffect),1<W.effectTag&&(e.lastEffect!==null?e.lastEffect.nextEffect=W:e.firstEffect=W,e.lastEffect=W))}else{if(t=fS(W),t!==null)return t.effectTag&=2047,t;e!==null&&(e.firstEffect=e.lastEffect=null,e.effectTag|=2048)}if(t=W.sibling,t!==null)return t;W=e}while(W!==null);return fe===gi&&(fe=vu),null}function Qa(e){var t=e.expirationTime;return e=e.childExpirationTime,t>e?t:e}function ri(e){var t=qs();return Kt(99,IS.bind(null,e,t)),null}function IS(e,t){do on();while(Bn!==null);if((_&(st|vt))!==ge)throw Error(M(327));var i=e.finishedWork,n=e.finishedExpirationTime;if(i===null)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,i===e.current)throw Error(M(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var r=Qa(i);if(e.firstPendingTime=r,n<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:n<=e.firstSuspendedTime&&(e.firstSuspendedTime=n-1),n<=e.lastPingedTime&&(e.lastPingedTime=0),n<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===Oe&&(W=Oe=null,ze=0),1<i.effectTag?i.lastEffect!==null?(i.lastEffect.nextEffect=i,r=i.firstEffect):r=i:r=i.firstEffect,r!==null){var s=_;_|=vt,Yf.current=null,Ao=Yr;var o=Bc();if(Ia(o)){if("selectionStart"in o)var a={start:o.selectionStart,end:o.selectionEnd};else e:{a=(a=o.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var u=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{a.nodeType,c.nodeType}catch{a=null;break e}var d=0,m=-1,w=-1,v=0,x=0,h=o,p=null;t:for(;;){for(var f;h!==a||u!==0&&h.nodeType!==3||(m=d+u),h!==c||l!==0&&h.nodeType!==3||(w=d+l),h.nodeType===3&&(d+=h.nodeValue.length),(f=h.firstChild)!==null;)p=h,h=f;for(;;){if(h===o)break t;if(p===a&&++v===u&&(m=d),p===c&&++x===l&&(w=d),(f=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=f}a=m===-1||w===-1?null:{start:m,end:w}}else a=null}a=a||{start:0,end:0}}else a=null;Eo={activeElementDetached:null,focusedElem:o,selectionRange:a},Yr=!1,D=r;do try{bS()}catch(P){if(D===null)throw Error(M(330));vi(D,P),D=D.nextEffect}while(D!==null);D=r;do try{for(o=e,a=t;D!==null;){var g=D.effectTag;if(g&16&&$n(D.stateNode,""),g&128){var y=D.alternate;if(y!==null){var S=y.ref;S!==null&&(typeof S=="function"?S(null):S.current=null)}}switch(g&1038){case 2:wd(D),D.effectTag&=-3;break;case 6:wd(D),D.effectTag&=-3,Lo(D.alternate,D);break;case 1024:D.effectTag&=-1025;break;case 1028:D.effectTag&=-1025,Lo(D.alternate,D);break;case 4:Lo(D.alternate,D);break;case 8:u=D,Ff(o,u,a),$f(u)}D=D.nextEffect}}catch(P){if(D===null)throw Error(M(330));vi(D,P),D=D.nextEffect}while(D!==null);if(S=Eo,y=Bc(),g=S.focusedElem,a=S.selectionRange,y!==g&&g&&g.ownerDocument&&qp(g.ownerDocument.documentElement,g)){for(a!==null&&Ia(g)&&(y=a.start,S=a.end,S===void 0&&(S=y),"selectionStart"in g?(g.selectionStart=y,g.selectionEnd=Math.min(S,g.value.length)):(S=(y=g.ownerDocument||document)&&y.defaultView||window,S.getSelection&&(S=S.getSelection(),u=g.textContent.length,o=Math.min(a.start,u),a=a.end===void 0?o:Math.min(a.end,u),!S.extend&&o>a&&(u=a,a=o,o=u),u=jc(g,o),c=jc(g,a),u&&c&&(S.rangeCount!==1||S.anchorNode!==u.node||S.anchorOffset!==u.offset||S.focusNode!==c.node||S.focusOffset!==c.offset)&&(y=y.createRange(),y.setStart(u.node,u.offset),S.removeAllRanges(),o>a?(S.addRange(y),S.extend(c.node,c.offset)):(y.setEnd(c.node,c.offset),S.addRange(y)))))),y=[],S=g;S=S.parentNode;)S.nodeType===1&&y.push({element:S,left:S.scrollLeft,top:S.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<y.length;g++)S=y[g],S.element.scrollLeft=S.left,S.element.scrollTop=S.top}Yr=!!Ao,Eo=Ao=null,e.current=i,D=r;do try{for(g=e;D!==null;){var T=D.effectTag;if(T&36&&wS(g,D.alternate,D),T&128){y=void 0;var N=D.ref;if(N!==null){var k=D.stateNode;switch(D.tag){case 5:y=k;break;default:y=k}typeof N=="function"?N(y):N.current=y}}D=D.nextEffect}}catch(P){if(D===null)throw Error(M(330));vi(D,P),D=D.nextEffect}while(D!==null);D=null,lS(),_=s}else e.current=i;if(Rs)Rs=!1,Bn=e,Cn=t;else for(D=r;D!==null;)t=D.nextEffect,D.nextEffect=null,D=t;if(t=e.firstPendingTime,t===0&&(Yt=null),t===1073741823?e===$a?_n++:(_n=0,$a=e):_n=0,typeof Za=="function"&&Za(i.stateNode,n),Ue(e),Ls)throw Ls=!1,e=Ha,Ha=null,e;return(_&mu)!==ge||wt(),null}function bS(){for(;D!==null;){var e=D.effectTag;(e&256)!==0&&vS(D.alternate,D),(e&512)===0||Rs||(Rs=!0,If(97,function(){return on(),null})),D=D.nextEffect}}function on(){if(Cn!==90){var e=97<Cn?97:Cn;return Cn=90,Kt(e,AS)}}function AS(){if(Bn===null)return!1;var e=Bn;if(Bn=null,(_&(st|vt))!==ge)throw Error(M(331));var t=_;for(_|=vt,e=e.current.firstEffect;e!==null;){try{var i=e;if((i.effectTag&512)!==0)switch(i.tag){case 0:case 11:case 15:case 22:Wf(5,i),Hf(5,i)}}catch(n){if(e===null)throw Error(M(330));vi(e,n)}i=e.nextEffect,e.nextEffect=null,e=i}return _=t,wt(),!0}function xd(e,t,i){t=gu(i,t),t=Qf(e,t,1073741823),Zt(e,t),e=no(e,1073741823),e!==null&&Ue(e)}function vi(e,t){if(e.tag===3)xd(e,e,t);else for(var i=e.return;i!==null;){if(i.tag===3){xd(i,e,t);break}else if(i.tag===1){var n=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Yt===null||!Yt.has(n))){e=gu(t,e),e=Zf(i,e,1073741823),Zt(i,e),i=no(i,1073741823),i!==null&&Ue(i);break}}i=i.return}}function ES(e,t,i){var n=e.pingCache;n!==null&&n.delete(t),Oe===e&&ze===i?fe===to||fe===Ns&&At===1073741823&&Qe()-wu<Xf?ui(e,ze):zs=!0:og(e,i)&&(t=e.lastPingedTime,t!==0&&t<i||(e.lastPingedTime=i,Ue(e)))}function TS(e,t){var i=e.stateNode;i!==null&&i.delete(t),t=0,t===0&&(t=mt(),t=mi(t,e,null)),e=no(e,t),e!==null&&Ue(e)}var sg;sg=function(e,t,i){var n=t.expirationTime;if(e!==null){var r=t.pendingProps;if(e.memoizedProps!==r||Ne.current)pt=!0;else{if(n<i){switch(pt=!1,t.tag){case 3:dd(t),No();break;case 5:if(nd(t),t.mode&4&&i!==1&&r.hidden)return t.expirationTime=t.childExpirationTime=1,null;break;case 1:De(t.type)&&Kr(t);break;case 4:za(t,t.stateNode.containerInfo);break;case 10:n=t.memoizedProps.value,r=t.type._context,ae(xs,r._currentValue),r._currentValue=n;break;case 13:if(t.memoizedState!==null)return n=t.child.childExpirationTime,n!==0&&n>=i?hd(e,t,i):(ae(se,se.current&1),t=Tt(e,t,i),t!==null?t.sibling:null);ae(se,se.current&1);break;case 19:if(n=t.childExpirationTime>=i,(e.effectTag&64)!==0){if(n)return fd(e,t,i);t.effectTag|=64}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null),ae(se,se.current),!n)return null}return Tt(e,t,i)}pt=!1}}else pt=!1;switch(t.expirationTime=0,t.tag){case 2:if(n=t.type,e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,r=qi(t,Ce.current),Fi(t,i),r=du(null,t,n,e,r,i),t.effectTag|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,De(n)){var s=!0;Kr(t)}else s=!1;t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,su(t);var o=n.getDerivedStateFromProps;typeof o=="function"&&Cs(t,n,o,e),r.updater=eo,t.stateNode=r,r._reactInternalFiber=t,Da(t,n,e,i),t=_a(null,t,n,!0,s,i)}else t.tag=0,Be(null,t,r,i),t=t.child;return t;case 16:e:{if(r=t.elementType,e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,nx(r),r._status!==1)throw r._result;switch(r=r._result,t.type=r,s=t.tag=NS(r),e=it(r,e),s){case 0:t=Ba(null,t,r,e,i);break e;case 1:t=cd(null,t,r,e,i);break e;case 11:t=ld(null,t,r,e,i);break e;case 14:t=ud(null,t,r,it(r.type,e),n,i);break e}throw Error(M(306,r,""))}return t;case 0:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:it(n,r),Ba(e,t,n,r,i);case 1:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:it(n,r),cd(e,t,n,r,i);case 3:if(dd(t),n=t.updateQueue,e===null||n===null)throw Error(M(282));if(n=t.pendingProps,r=t.memoizedState,r=r!==null?r.element:null,ou(e,t),Gn(t,n,null,i),n=t.memoizedState.element,n===r)No(),t=Tt(e,t,i);else{if((r=t.stateNode.hydrate)&&(Vt=$i(t.stateNode.containerInfo.firstChild),Et=t,r=fi=!0),r)for(i=au(t,null,n,i),t.child=i;i;)i.effectTag=i.effectTag&-3|1024,i=i.sibling;else Be(e,t,n,i),No();t=t.child}return t;case 5:return nd(t),e===null&&ja(t),n=t.type,r=t.pendingProps,s=e!==null?e.memoizedProps:null,o=r.children,ba(n,r)?o=null:s!==null&&ba(n,s)&&(t.effectTag|=16),_f(e,t),t.mode&4&&i!==1&&r.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(Be(e,t,o,i),t=t.child),t;case 6:return e===null&&ja(t),null;case 13:return hd(e,t,i);case 4:return za(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=en(t,null,n,i):Be(e,t,n,i),t.child;case 11:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:it(n,r),ld(e,t,n,r,i);case 7:return Be(e,t,t.pendingProps,i),t.child;case 8:return Be(e,t,t.pendingProps.children,i),t.child;case 12:return Be(e,t,t.pendingProps.children,i),t.child;case 10:e:{n=t.type._context,r=t.pendingProps,o=t.memoizedProps,s=r.value;var a=t.type._context;if(ae(xs,a._currentValue),a._currentValue=s,o!==null)if(a=o.value,s=Si(a,s)?0:(typeof n._calculateChangedBits=="function"?n._calculateChangedBits(a,s):1073741823)|0,s===0){if(o.children===r.children&&!Ne.current){t=Tt(e,t,i);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var u=l.firstContext;u!==null;){if(u.context===n&&(u.observedBits&s)!==0){a.tag===1&&(u=Qt(i,null),u.tag=2,Zt(a,u)),a.expirationTime<i&&(a.expirationTime=i),u=a.alternate,u!==null&&u.expirationTime<i&&(u.expirationTime=i),Af(a.return,i),l.expirationTime<i&&(l.expirationTime=i);break}u=u.next}}else o=a.tag===10&&a.type===t.type?null:a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Be(e,t,r.children,i),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps,n=s.children,Fi(t,i),r=Ge(r,s.unstable_observedBits),n=n(r),t.effectTag|=1,Be(e,t,n,i),t.child;case 14:return r=t.type,s=it(r,t.pendingProps),s=it(r.type,s),ud(e,t,r,s,n,i);case 15:return Bf(e,t,t.type,t.pendingProps,n,i);case 17:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:it(n,r),e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),t.tag=1,De(n)?(e=!0,Kr(t)):e=!1,Fi(t,i),Tf(t,n,r),Da(t,n,r,i),_a(null,t,n,!0,e,i);case 19:return fd(e,t,i)}throw Error(M(156,t.tag))};var Za=null,Ya=null;function kS(e){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined")return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var i=t.inject(e);Za=function(n){try{t.onCommitFiberRoot(i,n,void 0,(n.current.effectTag&64)===64)}catch{}},Ya=function(n){try{t.onCommitFiberUnmount(i,n)}catch{}}}catch{}return!0}function PS(e,t,i,n){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function ft(e,t,i,n){return new PS(e,t,i,n)}function yu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function NS(e){if(typeof e=="function")return yu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Vl)return 11;if(e===Ol)return 14}return 2}function Ci(e,t){var i=e.alternate;return i===null?(i=ft(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.effectTag=0,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null),i.childExpirationTime=e.childExpirationTime,i.expirationTime=e.expirationTime,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{expirationTime:t.expirationTime,firstContext:t.firstContext,responders:t.responders},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function rs(e,t,i,n,r,s){var o=2;if(n=e,typeof e=="function")yu(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case si:return Ot(i.children,r,s,t);case ix:o=8,r|=7;break;case Cp:o=8,r|=1;break;case Fr:return e=ft(12,i,t,r|8),e.elementType=Fr,e.type=Fr,e.expirationTime=s,e;case Qr:return e=ft(13,i,t,r),e.type=Qr,e.elementType=Qr,e.expirationTime=s,e;case ca:return e=ft(19,i,t,r),e.elementType=ca,e.expirationTime=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ip:o=10;break e;case bp:o=9;break e;case Vl:o=11;break e;case Ol:o=14;break e;case Ap:o=16,n=null;break e;case Ep:o=22;break e}throw Error(M(130,e==null?e:typeof e,""))}return t=ft(o,i,t,r),t.elementType=e,t.type=n,t.expirationTime=s,t}function Ot(e,t,i,n){return e=ft(7,e,n,t),e.expirationTime=i,e}function Ro(e,t,i){return e=ft(6,e,null,t),e.expirationTime=i,e}function jo(e,t,i){return t=ft(4,e.children!==null?e.children:[],e.key,t),t.expirationTime=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function DS(e,t,i){this.tag=t,this.current=null,this.containerInfo=e,this.pingCache=this.pendingChildren=null,this.finishedExpirationTime=0,this.finishedWork=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=i,this.callbackNode=null,this.callbackPriority=90,this.lastExpiredTime=this.lastPingedTime=this.nextKnownPendingLevel=this.lastSuspendedTime=this.firstSuspendedTime=this.firstPendingTime=0}function og(e,t){var i=e.firstSuspendedTime;return e=e.lastSuspendedTime,i!==0&&i>=t&&e<=t}function ci(e,t){var i=e.firstSuspendedTime,n=e.lastSuspendedTime;i<t&&(e.firstSuspendedTime=t),(n>t||i===0)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function ag(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var i=e.firstSuspendedTime;i!==0&&(t>=i?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function Ga(e,t){var i=e.lastExpiredTime;(i===0||i>t)&&(e.lastExpiredTime=t)}function js(e,t,i,n){var r=t.current,s=mt(),o=jn.suspense;s=mi(s,r,o);e:if(i){i=i._reactInternalFiber;t:{if(Ei(i)!==i||i.tag!==1)throw Error(M(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break t;case 1:if(De(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break t}}a=a.return}while(a!==null);throw Error(M(171))}if(i.tag===1){var l=i.type;if(De(l)){i=mf(i,l,a);break e}}i=a}else i=Jt;return t.context===null?t.context=i:t.pendingContext=i,t=Qt(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),Zt(r,t),Gt(r,s),s}function Bo(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Sd(e,t){e=e.memoizedState,e!==null&&e.dehydrated!==null&&e.retryTime<t&&(e.retryTime=t)}function xu(e,t){Sd(e,t),(e=e.alternate)&&Sd(e,t)}function Su(e,t,i){i=i!=null&&i.hydrate===!0;var n=new DS(e,t,i),r=ft(3,null,null,t===2?7:t===1?3:0);n.current=r,r.stateNode=n,su(r),e[lr]=n.current,i&&t!==0&&ux(e,e.nodeType===9?e:e.ownerDocument),this._internalRoot=n}Su.prototype.render=function(e){js(e,this._internalRoot,null,null)};Su.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;js(null,e,null,function(){t[lr]=null})};function fr(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function zS(e,t){if(t||(t=e?e.nodeType===9?e.documentElement:e.firstChild:null,t=!(!t||t.nodeType!==1||!t.hasAttribute("data-reactroot"))),!t)for(var i;i=e.lastChild;)e.removeChild(i);return new Su(e,0,t?{hydrate:!0}:void 0)}function so(e,t,i,n,r){var s=i._reactRootContainer;if(s){var o=s._internalRoot;if(typeof r=="function"){var a=r;r=function(){var u=Bo(o);a.call(u)}}js(t,o,e,r)}else{if(s=i._reactRootContainer=zS(i,n),o=s._internalRoot,typeof r=="function"){var l=r;r=function(){var u=Bo(o);l.call(u)}}qf(function(){js(t,o,e,r)})}return Bo(o)}function LS(e,t,i){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:zi,key:n==null?null:""+n,children:e,containerInfo:t,implementation:i}}Qp=function(e){if(e.tag===13){var t=es(mt(),150,100);Gt(e,t),xu(e,t)}};Fl=function(e){e.tag===13&&(Gt(e,3),xu(e,3))};Zp=function(e){if(e.tag===13){var t=mt();t=mi(t,e,null),Gt(e,t),xu(e,t)}};ua=function(e,t,i){switch(t){case"input":if(ha(e,i),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var n=i[t];if(n!==e&&n.form===e.form){var r=Kl(n);if(!r)throw Error(M(90));kp(n),ha(n,r)}}}break;case"textarea":Np(e,i);break;case"select":t=i.value,t!=null&&Hi(e,!!i.multiple,t,!1)}};zl=Kf;xp=function(e,t,i,n,r){var s=_;_|=4;try{return Kt(98,e.bind(null,t,i,n,r))}finally{_=s,_===ge&&wt()}};Ll=function(){(_&(1|st|vt))===ge&&(SS(),on())};Sp=function(e,t){var i=_;_|=2;try{return e(t)}finally{_=i,_===ge&&wt()}};function lg(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!fr(t))throw Error(M(200));return LS(e,t,null,i)}var RS={Events:[cr,xi,Kl,vp,la,Ki,function(e){Hl(e,Mx)},wp,yp,Xs,Gs,on,{current:!1}]};(function(e){var t=e.findFiberByHostInstance;return kS(Ae({},e,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:rt.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Up(i),i===null?null:i.stateNode},findFiberByHostInstance:function(i){return t?t(i):null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null}))})({findFiberByHostInstance:ur,bundleType:0,version:"16.14.0",rendererPackageName:"react-dom"});Xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=RS;Xe.createPortal=lg;Xe.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternalFiber;if(t===void 0)throw typeof e.render=="function"?Error(M(188)):Error(M(268,Object.keys(e)));return e=Up(t),e=e===null?null:e.stateNode,e};Xe.flushSync=function(e,t){if((_&(st|vt))!==ge)throw Error(M(187));var i=_;_|=1;try{return Kt(99,e.bind(null,t))}finally{_=i,wt()}};Xe.hydrate=function(e,t,i){if(!fr(t))throw Error(M(200));return so(null,e,t,!0,i)};Xe.render=function(e,t,i){if(!fr(t))throw Error(M(200));return so(null,e,t,!1,i)};Xe.unmountComponentAtNode=function(e){if(!fr(e))throw Error(M(40));return e._reactRootContainer?(qf(function(){so(null,null,e,!1,function(){e._reactRootContainer=null,e[lr]=null})}),!0):!1};Xe.unstable_batchedUpdates=Kf;Xe.unstable_createPortal=function(e,t){return lg(e,t,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)};Xe.unstable_renderSubtreeIntoContainer=function(e,t,i,n){if(!fr(i))throw Error(M(200));if(e==null||e._reactInternalFiber===void 0)throw Error(M(38));return so(e,t,i,!1,n)};Xe.version="16.14.0";function ug(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ug)}catch(e){console.error(e)}}ug(),dp.exports=Xe;var Br=dp.exports,jS=Object.defineProperty,BS=Object.defineProperties,_S=Object.getOwnPropertyDescriptors,Md=Object.getOwnPropertySymbols,VS=Object.prototype.hasOwnProperty,OS=Object.prototype.propertyIsEnumerable,Cd=(e,t,i)=>t in e?jS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ve=(e,t)=>{for(var i in t||(t={}))VS.call(t,i)&&Cd(e,i,t[i]);if(Md)for(var i of Md(t))OS.call(t,i)&&Cd(e,i,t[i]);return e};const cg={src:"",currentTime:0,hostTime:0,muted:!1,paused:!0,volume:1},dg={currentTimeMaxError:1,syncInterval:1e3,retryInterval:15e3,verbose:!1,log:console.log.bind(console)};let Ct=dg;function hg(e){Ct=Ve(Ve({},dg),e)}function _r(e,t){if(e.paused)return e.currentTime;const i=function(n){if(n.player)return n.player.beginTimestamp+n.player.progressTime;if(n.room)return n.room.calibrationTimestamp}(t);return i?e.currentTime+(i-e.hostTime)/1e3:e.currentTime}const US=navigator.userAgent.includes("Safari"),WS=navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPad"),pg=[".aac",".mid",".midi",".mp3",".ogg",".oga",".wav",".weba"];var HS=typeof global=="object"&&global&&global.Object===Object&&global,$S=typeof self=="object"&&self&&self.Object===Object&&self,fg=HS||$S||Function("return this")(),Bs=fg.Symbol,gg=Object.prototype,FS=gg.hasOwnProperty,QS=gg.toString,vn=Bs?Bs.toStringTag:void 0,ZS=Object.prototype.toString,Id=Bs?Bs.toStringTag:void 0;function YS(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Id&&Id in Object(e)?function(t){var i=FS.call(t,vn),n=t[vn];try{t[vn]=void 0;var r=!0}catch{}var s=QS.call(t);return r&&(i?t[vn]=n:delete t[vn]),s}(e):function(t){return ZS.call(t)}(e)}var GS=/\s/,XS=/^\s+/;function JS(e){return e&&e.slice(0,function(t){for(var i=t.length;i--&&GS.test(t.charAt(i)););return i}(e)+1).replace(XS,"")}function Xa(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var KS=/^[-+]0x[0-9a-f]+$/i,qS=/^0b[01]+$/i,eM=/^0o[0-7]+$/i,tM=parseInt;function bd(e){if(typeof e=="number")return e;if(function(n){return typeof n=="symbol"||function(r){return r!=null&&typeof r=="object"}(n)&&YS(n)=="[object Symbol]"}(e))return NaN;if(Xa(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Xa(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=JS(e);var i=qS.test(e);return i||eM.test(e)?tM(e.slice(2),i?2:8):KS.test(e)?NaN:+e}var _o=function(){return fg.Date.now()},iM=Math.max,nM=Math.min;function Vr(e,t,i){var n,r,s,o,a,l,u=0,c=!1,d=!1,m=!0;if(typeof e!="function")throw new TypeError("Expected a function");function w(g){var y=n,S=r;return n=r=void 0,u=g,o=e.apply(S,y)}function v(g){return u=g,a=setTimeout(h,t),c?w(g):o}function x(g){var y=g-l;return l===void 0||y>=t||y<0||d&&g-u>=s}function h(){var g=_o();if(x(g))return p(g);a=setTimeout(h,function(y){var S=t-(y-l);return d?nM(S,s-(y-u)):S}(g))}function p(g){return a=void 0,m&&n?w(g):(n=r=void 0,o)}function f(){var g=_o(),y=x(g);if(n=arguments,r=this,l=g,y){if(a===void 0)return v(l);if(d)return clearTimeout(a),a=setTimeout(h,t),w(l)}return a===void 0&&(a=setTimeout(h,t)),o}return t=bd(t)||0,Xa(i)&&(c=!!i.leading,s=(d="maxWait"in i)?iM(bd(i.maxWait)||0,t):s,m="trailing"in i?!!i.trailing:m),f.cancel=function(){a!==void 0&&clearTimeout(a),u=0,n=l=r=a=void 0},f.flush=function(){return a===void 0?o:p(_o())},f}class Ad extends Ai.exports.Component{constructor(t){super(t),this.seeking=!1,this.mobileSeeking=!1,this.track=null,this.hoverTime=null,this.offset=0,this.secondsPrefix="00:00:",this.minutesPrefix="00:",this.seekPause=!1,this.handleTouchSeeking=i=>{let n=0;for(let 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=Ve(Ve({},this.getPositionStyle(this.props.buffered)),this.props.bufferColor&&{backgroundColor:this.props.bufferColor});return $.createElement("div",{className:"buffered",style:i})}return null},this.renderProgress=()=>{const i=Ve(Ve({},this.getPositionStyle(this.props.current)),this.props.sliderColor&&{backgroundColor:this.props.sliderColor});return $.createElement("div",{className:"connect",style:i})},this.renderHoverProgress=()=>{const i=Ve(Ve({},this.getSeekHoverPosition()),this.props.sliderHoverColor&&{backgroundColor:this.props.sliderHoverColor});return $.createElement("div",{className:"seek-hover",style:i})},this.renderThumb=()=>$.createElement("div",{className:this.isThumbActive()?"thumb active":"thumb",style:this.getThumbHandlerPosition()},$.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(t){if(this.track){const i=this.props.scale||1;let n=(t-this.track.getBoundingClientRect().left)/i;n=Math.min(this.state.trackWidth,Math.max(0,n)),this.setState({seekHoverPosition:n});const r=+(n/this.state.trackWidth*this.props.total).toFixed(0);this.props.onChange(r)}}getPositionStyle(t){return{transform:`scaleX(${100*t/this.props.total/100})`}}getThumbHandlerPosition(){return{transform:`translateX(${this.state.trackWidth/(this.props.total/this.props.current)}px)`}}getSeekHoverPosition(){return{transform:`scaleX(${100*this.state.seekHoverPosition/this.state.trackWidth/100})`}}getHoverTimePosition(){let t=0;return this.hoverTime&&(t=this.state.seekHoverPosition-this.hoverTime.offsetWidth/2,this.props.limitTimeTooltipBySides&&(t<0?t=0:t+this.hoverTime.offsetWidth>this.state.trackWidth&&(t=this.state.trackWidth-this.hoverTime.offsetWidth))),{transform:`translateX(${t}px)`}}secondsToTime(t){t=Math.round(t+this.offset);const i=Math.floor(t/3600),n=t%3600,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 t=100*this.state.seekHoverPosition/this.state.trackWidth,i=Math.floor(+t*(this.props.total/100)),n=this.secondsToTime(i);return this.props.total+this.offset<60?this.secondsPrefix+n.ss:this.props.total+this.offset<3600?this.minutesPrefix+n.mm+":"+n.ss:n.hh+":"+n.mm+":"+n.ss}isThumbActive(){return this.state.seekHoverPosition>0||this.seeking}drawHoverTime(){return this.props.hideHoverTime?null:$.createElement("div",{className:this.isThumbActive()?"hover-time active":"hover-time",style:this.getHoverTimePosition(),ref:t=>this.hoverTime=t},this.getHoverTime())}render(){return $.createElement("div",{className:"seek-slider"},$.createElement("div",{className:"track",ref:t=>this.track=t,onMouseMove:t=>this.handleTrackHover(!1,t),onMouseLeave:t=>this.handleTrackHover(!0,t),onMouseDown:this.onMouseDown,onTouchStart:t=>{this.setMobileSeeking(!0),this.onMouseDown(t)},onMouseUp:this.onMouseUp,onTouchEnd:this.onMouseUp},$.createElement("div",{className:"main"},this.renderBufferProgress(),this.renderHoverProgress(),this.renderProgress())),this.drawHoverTime(),this.renderThumb())}}class rM extends Ai.exports.Component{constructor(t){super(t),this.stageVolume=0,this.updateVolumeTimer=0,this.onVolumeSeeking=!1,this.onClickOperationButton=()=>{const{paused:i}=this.props;i?this.props.play():this.props.pause()},this.operationButton=()=>{const{paused:i}=this.props;return i?$.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1LjE0djE0bDExLTdsLTExLTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):$.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMTloNFY1aC00TTYgMTloNFY1SDZ2MTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="})},this.operationVolumeButton=()=>this.props.volume>.9?$.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg0LTUgNi43djIuMDdjNC0uOTEgNy00LjQ5IDctOC43N2MwLTQuMjgtMy03Ljg2LTctOC43N00xNi41IDEyYzAtMS43Ny0xLTMuMjktMi41LTQuMDNWMTZjMS41LS43MSAyLjUtMi4yNCAyLjUtNE0zIDl2Nmg0bDUgNVY0TDcgOUgzeiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}):this.props.volume===0?$.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNyA5djZoNGw1IDVWNGwtNSA1SDd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):$.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=Vr(i=>{this.props.setCurrentTime(i)},50),this.onVolumeChange=i=>{this.changeVolume(i),this.setState({seekVolume:i/100})},this.changeVolume=Vr(i=>{this.props.setVolume(i/100)},50),this.onVolumeSeekStart=()=>{this.onVolumeSeeking=!0},this.onVolumeSeekEnd=Vr(()=>{this.onVolumeSeeking=!1},500),this.onProgressSeekStart=()=>this.setState({isPlayerSeeking:!0}),this.onProgressSeekEnd=Vr(()=>{this.setState({isPlayerSeeking:!1})},500),this.state={isPlayerSeeking:!1,isVolumeHover:!1,seekVolume:1,visible:!0,currentTime:0},this.stageVolume=t.volume}componentDidMount(){this.updateVolumeTimer=setInterval(()=>{this.onVolumeSeeking||this.setState({seekVolume:this.props.volume}),this.state.isPlayerSeeking||this.setState({currentTime:this.props.currentTime})},100)}componentWillUnmount(){this.updateVolumeTimer&&clearInterval(this.updateVolumeTimer)}render(){const{duration:t,currentTime:i}=this.props;return $.createElement("div",{className:"player-controller",style:{opacity:this.props.visible?"1":"0"}},$.createElement("div",{className:"player-controller-progress"},$.createElement(Ad,{total:t,current:this.state.currentTime,onChange:this.onChange,buffered:this.props.buffered,bufferColor:"rgba(255,255,255,0.3)",hideHoverTime:!0,limitTimeTooltipBySides:!0,onSeekStart:this.onProgressSeekStart,onSeekEnd:this.onProgressSeekEnd,play:this.props.play,pause:this.props.pause,paused:this.props.paused,scale:this.props.scale})),$.createElement("div",{className:"player-controller-actions"},$.createElement("div",{className:"player-controller-actions-left"},$.createElement("div",{onClick:this.onClickOperationButton,className:"player-controller-play"},this.operationButton()),$.createElement("div",{className:"player-volume-box",onMouseEnter:()=>this.setState({isVolumeHover:!0}),onMouseLeave:()=>this.setState({isVolumeHover:!1})},$.createElement("div",{onClick:this.handleClickVolume,className:"player-volume"},this.operationVolumeButton()),$.createElement("div",{className:"player-volume-slider"},$.createElement(Ad,{total:100,current:100*this.state.seekVolume,onChange:this.onVolumeChange,onSeekStart:this.onVolumeSeekStart,onSeekEnd:this.onVolumeSeekEnd,scale:this.props.scale,limitTimeTooltipBySides:!0,hideHoverTime:!0})))),$.createElement("div",{className:"player-mid-box-time"},Ed(Math.floor(i/1e3))," /"," ",Ed(Math.floor(t/1e3)))))}}function Ed(e){const t=e%60,i=(e-t)/60;if(i>=60){const n=i%60;return`${wn((i-n)/60)}:${wn(n)}:${wn(t)}`}return`${wn(i)}:${wn(t)}`}function wn(e){return e<=9?`0${e}`:`${e}`}let sM=99999;var Ja,ki;(ki=Ja||(Ja={}))[ki.Idle=0]="Idle",ki[ki.Playing=1]="Playing",ki[ki.Paused=2]="Paused";let we={};function pe(e,...t){Ct.verbose&&console.log(`[RTCEffect] ${e}`,...t)}function oM(e,t,i){function n(s){we[s].playState===0?(e.playEffect(s,i,0,1,0,100,!1,0).then(()=>{pe(">>> Play Success",{playingId:s})}),we[s].playState=1):pe(">>> Skip Play",{playingId:s,state:we[s].playState})}function r(s){we[s].playState=0,we[s].previousVideoJSAdvance=0,we[s].previousSeekTargetTime=0,we[s].previousBeginSeekTime=0}t.one("ready",()=>{var s;const o=((s=t==null?void 0:t.tagAttributes)==null?void 0:s.src)||"";pg.includes("."+o.split(".").pop()||"")||(pe(">>> Mute js player",{src:o}),t.muted(!0),t.muted=l=>!1);const a=function(){const l=sM--,u={playState:Ja.Idle,previousVideoJSAdvance:0,previousSeekTargetTime:0,previousBeginSeekTime:0};return we[l]=u,l}();pe(">>> Setup",{playingId:a,src:o}),e.addListener("error",l=>{pe(">>> Error",{soundId:l}),r(l)}),e.addListener("effectFinished",l=>{pe(">>> Finished",{soundId:l}),r(l)}),t.on("play",()=>{switch(we[a].playState){case 0:pe(">>> Start play",{playingId:a}),n(a);break;case 2:pe(">>> Resume play",{playingId:a}),e.resumeEffect(a),we[a].playState=1}}),t.on("pause",()=>{const l=we[a].playState;switch(l){case 1:pe(">>> Pause play",{playingId:a}),e.pauseEffect(a),we[a].playState=2;break;default:pe(">>> Skip Pause",{playingId:a,currenState:l})}}),t.on("timeupdate",()=>{we[a],e.getEffectCurrentPosition(a).then(l=>{const u=we[a],c=l/1e3,d=t.currentTime(),m=u.previousSeekTargetTime!==0&&u.previousBeginSeekTime!==0;if(pe(`>>> EffectSecond rtc: ${c} js: ${d} seeking: ${m}`,{playingId:a}),u.playState==0)return void(t.paused()||(pe(">>> Play effect due to time update.",{playingId:a}),n(a)));if(m&&c<u.previousSeekTargetTime)return;if(u.playState!==1)return void pe(">>> Skip timupdate",{playingId:a,state:u.playState,jsTime:t.currentTime(),rtcEffectTime:c});function w(x,h){e.setEffectPosition(h,1e3*x),u.previousBeginSeekTime=Date.now()/1e3,u.previousSeekTargetTime=x}const v=u.previousBeginSeekTime;if(l>0){const x=d-c,h=Math.abs(x),p=.5;if(h>p)if(m){const f=u.previousSeekTargetTime-c,g=Date.now()/1e3-v,y=g+(x>0?x:0),S=d+y;w(S,a),pe(">>> Start seeking after seeking lag",{jsPlayerTime:d,rtcEffectTime:c,jsPlayerTimerAdvance:x,lastSeekingCost:g,estimatedRTCLag:y,targetRTCSeekTime:S,previousBeginSeekTime:v,timeElapse:f})}else if(h>10)w(d,a),pe(">>> DirectSeek",{time:d,rtcEffectTime:c,jsPlayerTimerAdvance:x});else{const f=u.previousVideoJSAdvance,g=0,y=d+g;u.previousVideoJSAdvance=g,w(y,a),pe(">>> Start seeking with lag",{jsPlayerTime:d,rtcEffectTime:c,jsPlayerTimerAdvance:x,previousAdvance:f,estimatedRTCLag:g,targetRTCSeekTime:y})}else m&&(pe(">>> SeekingFinish no lag",{jsPlayerTime:d,rtcEffectTime:c,jsPlayerTimerAdvance:x,previousBeginSeekTime:v,rtcLagTolerance:p}),u.previousBeginSeekTime=0,u.previousSeekTargetTime=0)}})}),t.on("dispose",()=>{we[a].playState&&(e.stopEffect(a),delete we[a],pe(">>> Dispose",{playingId:a}))})})}class Td extends Ai.exports.Component{constructor(){super(...arguments),this.putAttributes=t=>{const{context:i}=this.props,n=i.getAttributes()||{};for(const r in t)n[r]!==t[r]&&i.updateAttributes([r],t[r])}}render(){const{context:t}=this.props,i=t.getRoom(),n=i?void 0:t.getDisplayer(),r=this.putAttributes;return $.createElement(aM,{room:i,player:n,context:t,plugin:{putAttributes:r}})}}class aM extends Ai.exports.Component{constructor(t){super(t),this.alertMask=null,this.container=$.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=_r(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=_r(n,this.props);let o=Ct.currentTimeMaxError;if(this.state.NoSound&&(o*=3),s>r.duration())this.resetPlayer();else if(Math.abs(r.currentTime()-s)>o){if(this.debug("<<< currentTime -> %o",s),WS)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(US&&s.includes("NotAllowedError")||s.includes("interact"))(n=this.player)==null||n.autoplay("any"),this.setState({NoSound:!0});else{const o=(r=this.player)==null?void 0:r.error();o&&(this.retryCount<=3?(this.initPlayer(),this.retryCount=this.retryCount+1):(this.debug("catch videojs media error",o),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(),o=document.createElement("div");o.setAttribute("data-vjs-player","");const a=document.createElement("video");a.className="video-js",a.crossOrigin="anonymous",s&&(a.poster=s),a.setAttribute("playsInline",""),a.setAttribute("webkit-playsinline","");const l=document.createElement("source");new URL(r).pathname.endsWith(".m3u8")?l.type="application/x-mpegURL":a.src=r,l.src=r,n&&(l.type=n),a.appendChild(l),o.appendChild(a),this.container.current.appendChild(o),await new Promise(m=>(window.requestAnimationFrame||window.setTimeout)(m)),this.debug("initializing videojs() ...");const u=bu.default(a);this.player=u,window.player=u,u.one("loadedmetadata",this.gracefullyUpdate);const c=window.__mediaPlayerAudioEffectClient;c!==void 0&&oM(c,u,r);const d=window.__pcmProxy;d!==void 0&&(u.one("play",()=>{const m=d.connect(a);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=Ct.onPlayer)==null||m.call(Ct,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},t.room&&function(i){if(!i.calibrationTimestamp)throw new Error("@netless/app-media-player@0.1.0-alpha.5 requires white-web-sdk@^2.13.8 to work properly.")}(t.room)}getAttributes(){const{context:t}=this.props;let i=t.getAttributes();if(i){if(i=Ve(Ve({},cg),i),this.player){let r=_r(i,this.props),s=this.player.duration();!i.paused&&r>s&&(n=Ve({},i),i=BS(n,_S({currentTime:0,paused:!0})),this.resetPlayer())}var n;return i}}isShowingPoster(){const t=this.getAttributes();return!(t!=null&&t.src)||pg.some(i=>t.src.endsWith(i))}render(){var t,i;if(!this.props.room&&!this.props.player)return null;const n=this.getAttributes();if(!n)return null;const r=1e3*(((t=this.player)==null?void 0:t.duration())||1e3),s=((i=this.player)==null?void 0:i.bufferedPercent())||0;return $.createElement("div",{className:this.isEnabled()?"vjs-p":"vjs-p disabled",onMouseEnter:this.showController,onMouseMove:this.showController},$.createElement("div",{className:"video-js-plugin-player",ref:this.container}),this.isShowingPoster()&&$.createElement("div",{className:"video-js-plugin-poster"},n.poster&&$.createElement("img",{src:n.poster,alt:"",draggable:!1})),$.createElement(rM,{duration:r,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*_r(n,this.props),setCurrentTime:this.setCurrentTime,buffered:r*s,visible:!0}),this.state.NoSound&&$.createElement("div",{ref:this.setupAlert,className:"videojs-plugin-muted-alert"}),this.state.MediaError&&$.createElement("div",{className:"videojs-plugin-recovery-mode"},$.createElement("button",{ref:this.setupReload},"Reload Player")))}debug(t,...i){Ct.verbose&&Ct.log(`[MediaPlayer] ${t}`,...i)}componentDidMount(){this.debug("app version =","0.1.0-alpha.5"),this.debug("video.js version =",bu.default.VERSION),this.initPlayer(),this.props.context.emitter.on("attributesUpdate",this.syncPlayerWithAttributes),this.syncPlayerTimer=setInterval(this.syncPlayerWithAttributes,Ct.syncInterval),this.decreaseRetryTimer=setInterval(this.decreaseRetryCount,Ct.retryInterval)}componentWillUnmount(){var t;this.debug("unmount"),this.props.context.emitter.off("attributesUpdate",this.syncPlayerWithAttributes),(t=this.player)==null||t.dispose(),clearInterval(this.syncPlayerTimer),clearInterval(this.decreaseRetryTimer)}isEnabled(){return this.props.context.getIsWritable()}}const Ka={kind:"MediaPlayer",setup(e){let t=e.getAttributes();if(!t||!t.src)return e.emitter.emit("destroy",{error:new Error("[MediaPlayer]: Missing 'attributes'.'src'.")});t=Ve(Ve({},cg),t);const i=e.getBox();i.mountStyles(`.vjs-p{display:flex;flex-grow:1}.vjs-p *{pointer-events:auto}.vjs-p.disabled *{pointer-events:none}.vjs-p .video-js-plugin-poster{position:absolute;top:0;left:0;right:0;bottom:0;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgQAAACACAYAAAB0vHFxAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACBKADAAQAAAABAAAAgAAAAACE3oPTAAAKXUlEQVR4Ae3dYW4ktxEG0LW9FwkC2McycokAOUGAXMLwtQwYvomdP4akHUnNnm6SVUU+/xqpe8ji+yiDWz3a/e7L5v/98se//3pL8K9//O+7t19Hv85eX7RP9vnllz2h4/rkd+wz+ir/0cLfjv/9t1/6igABAgQIENhRwIFgx9StmQABAgQIPAg4EDyA+JIAAQIECOwo8HXHRVvzPIHRzwBHjz9PKudMo31Hj59TdZ2qsueXvb5sO0GHIFsi6iFAgAABAgECOgQB6KbsJ5Dtt0L6rWyPkeRXO+fs+WWvL1v6OgTZElEPAQIECBAIENAhCEA3ZT8Bzwj7WUaMJL8I9X5zZs8ve339kugzkg5BH0ejECBAgACB0gIOBKXjUzwBAgQIEOgj4EDQx9EoBAgQIECgtIADQen4FE+AAAECBPoIOBD0cTQKAQIECBAoLeC3DErHp/iWgE8Zt4RyX5df7nxa1Y3Ob/T4rfWtdl2HYLVErYcAAQIECFwQWL5DsPoJcvX1XdjTpd4iv1JxvStWfu9IfCORwLP7U4cgUXhKIUCAAAECUQIOBFHy5iVAgAABAokEHAgShaEUAgQIECAQJXD7MwTPPqOIWujVeUevb/T4V9ftfecE5HfOKetd8suajLoiBHQIItTNSYAAAQIEkgnc7hAkW0/3ckb/e9qjx+8OYsBvBOT3DUe5L+RXLjIFDxTQIRiIa2gCBAgQIFBFoNkh2P0Z2+j1jx4/+0asvv7q9d/dH9XXX73+3fO7u/7W+3fbHzoErR3hOgECBAgQ2ECg2SHwjG2DXRC4xOj9tdufAHpHLb/eonPHk9+xd7TPcXX9r+oQ9Dc1IgECBAgQKCfgQFAuMgUTIECAAIH+Ag4E/U2NSIAAAQIEygk0P0MQvaLsz3hb9bWu840WOJ5ffsc+2a/KL3tC6jsSmL1/dQiO0nCNAAECBAhsItDsEMw+oTzrHl1f61OorevPrvfZ+6N9WvVmr09+xwnKr7ZP9vyOdcdfze7Tuz4dgvF7ygwECBAgQCC9QLNDkH0F0X+C45NdoHZ99rf8aguofqRA7/8/6BCMTMvYBAgQIECgiED5DkHvZyhFcjtdJp/TVClvlF/KWE4XJb/TVG68INB7f+kQXAjBWwgQIECAwGoCDgSrJWo9BAgQIEDggoADwQU0byFAgAABAqsJfO39DGI1IOuJFbA/Y/3vzi6/u4Kx7189v7vru/v+2HTfz65D8N7EdwgQIECAwHYCw3/LYLUT1HY7pLFg+TaAkl+WX/KAGuXJrwEUfLlaPjoEwRvG9AQIECBAIIPA8A5B779JKQOaGl4F5PtqUfGV/Cqm9lqz/F4tMr6qlo8OQcZdpCYCBAgQIDBZYHiHoNozlMn+5aeTb+0I5Se/2gK5q6/286VDkHs/qY4AAQIECEwRcCCYwmwSAgQIECCQW8CBIHc+qiNAgAABAlMEhn+GYMoqTEKAAAEC7wSqPcN+twDfmCqgQzCV22QECBAgQCCnQHiHoPoJtlV/63rObfFaVfX6X1dy7VX19Vev/1pqr++qvv7q9b8m4dVHAtny1SH4KCXfI0CAAAECmwmEdwiq/U1Om+2PL/Kpnbj85FdbYO3qs/186hCsvd+sjgABAgQInBJwIDjF5CYCBAgQILC2gAPB2vlaHQECBAgQOCUQ/hmCbJ+yPKW20U3yqR22/ORXW2Dt6qN/Ph/n1yFYe79ZHQECBAgQOCXgQHCKyU0ECBAgQGBtAQeCtfO1OgIECBAgcErAgeAUk5sIECBAgMDaAg4Ea+drdQQIECBA4JTA1+///OGnoztd52N/fC7g58PPx+e748sX+8P+qLQ/dAiO0nKNAAECBAhsIuBAsEnQlkmAAAECBI4EHAiOdFwjQIAAAQKbCDgQbBK0ZRIgQIAAgSMBB4IjHdcIECBAgMAmAuH/lsHP//zvb5tYl1ymfErG9lK0/F4oSr6QX8nYThcdne/j/DoEp6NzIwECBAgQWFfAgWDdbK2MAAECBAicFnAgOE3lRgIECBAgsK5A+GcIfv39Pz++5X18pvH2mtfzBeQz37znjPLrqTl/LPnNN585Y7Z8dQhmpm8uAgQIECCQVCC8Q1C9I9Cqv3U96b54Kat6/S8Lufii+vqr138xtpe3VV9/9fpfgvDiQ4Fs+eoQfBiTbxIgQIAAgb0EwjsEe3FbLQECBOYJZPsT6LyVm+mKgA7BFTXvIUCAAAECiwk4ECwWqOUQIECAAIErAg4EV9S8hwABAgQILCYw/DMEnmEttmMeliPfB5BiX8qvWGAP5crvASTZl9Xy0SFItoGUQ4AAAQIEIgSGdwiy/U1MEcgrzynf2unKT361BXJXX+3nS4cg935SHQECBAgQmCIwvENQ7RnKFPWFJpFv7TDlJ7/aArmrr/bzpUOQez+pjgABAgQITBH4Wu0EM0XFJGkE7M80UVwqRH6X2NK8afX87q7v7vvTBP13IToE2RJRDwECBAgQCBBwIAhANyUBAgQIEMgm4ECQLRH1ECBAgACBAIHhv2Uwek2rPcPp7cWnt+jc8eQ317v3bPLrLWq8twK995cOwVtdrwkQIECAwKYC5TsE1f4mqNn7jM9s8b7zya+v5+zR5DdbfK/5eu8vHYK99o/VEiBAgACBDwWaHYLezyg+rOLGN6Pra53QWtdvLP3UW6N9WkVmr09+xwnKr7ZP9vyOdcdfze7Tuz4dgvF7ygwECBAgQCC9QLNDEL2C3ieg3utp1de63rueZ8fLXt+z6+l9f3af7PX1zuPZ8bL7ZK/vWW/39xWYvT90CPrmZzQCBAgQIFBSwIGgZGyKJkCAAAECfQUcCPp6Go0AAQIECJQUaH6GIPpT1iVVFX1aIHp/zX5GdxqmyI3yKxLUJ2XK7xOYv78d7XNcXf+rOgT9TY1IgAABAgTKCTQ7BLv/CWr0+kePn31HVl9/9frv7o/q669e/+753V1/6/277Q8dgtaOcJ0AAQIECGwg0OwQbGBwuMTRz5BGj3+4OBdvC8jvNmHoAPIL5Td5MgEdgmSBKIcAAQIECEQI3O4QrP6MZfT6Ro8fsal2mlN+tdOWX+38VN9XQIegr6fRCBAgQIBASQEHgpKxKZoAAQIECPQVcCDo62k0AgQIECBQUuD2Zwiyr3r1Z4Srry/7/rpbn/zuCsa+X36x/mY/Fnh2f+oQHHu6SoAAAQIEthBYvkOwRYoW+anAsyfkTwdyIURAfiHs3SYdnd/o8btBFBlIh6BIUMokQIAAAQIjBRwIRuoamwABAgQIFBFwICgSlDIJECBAgMBIAQeCkbrGJkCAAAECRQQcCIoEpUwCBAgQIDBSwG8ZjNQ19nABnzIeTjx0AvkN5R0+ePb8stc3PKAnJ9AheBLM7QQIECBAYEUBHYIVU91oTf49+9phy09+IwXsr+d0dQie83I3AQIECBBYUkCHYMlY8yxq9DO80ePnkYypZLTv6PFj1PaZNXt+2evLtlN0CLIloh4CBAgQIBAg4EAQgG5KAgQIECCQTcCBIFsi6iFAgAABAgEC/wdVfx9UuC8B6AAAAABJRU5ErkJggg==);background-repeat:repeat-x;background-position:0 50%;display:flex;align-items:center;justify-content:center}.vjs-p .video-js-plugin-poster img{box-shadow:0 0 5px 10px #0006}.vjs-p .player-controller,.vjs-p .videojs-plugin-muted-alert{pointer-events:auto}.vjs-p.disabled .videojs-plugin-close-icon,.vjs-p.disabled .player-controller{pointer-events:none}.vjs-p .video-js-plugin-player{position:absolute;top:0;left:0;right:0;bottom:0}.video-js,[data-vjs-player]{width:100%;height:100%}.vjs-p .videojs-plugin-muted-alert{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:43}.vjs-p .videojs-plugin-muted-alert:before{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:43;content:"\\f104";background:rgba(0,0,0,.3);font-family:VideoJS;font-size:2em;display:flex;align-items:center;justify-content:center;color:#fff}.vjs-p .videojs-plugin-recovery-mode{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:44}.vjs-p .videojs-plugin-recovery-mode button{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.vjs-p .seek-slider{position:relative;width:100%}.vjs-p .seek-slider:focus{outline:none}.vjs-p .seek-slider .track{padding:10px 0;cursor:pointer;outline:none}.vjs-p .seek-slider .track:focus{border:0;outline:none}.vjs-p .seek-slider .track .main{width:100%;height:3px;background-color:#ffffff4d;border-radius:30px;position:absolute;left:0;top:8.5px;transition:transform .4s;outline:none}.vjs-p .seek-slider .track .main:focus{border:0;outline:none}.vjs-p .seek-slider .track .main .buffered{position:absolute;background-color:#ffffff4d;width:100%;height:100%;transform:scaleX(.8);z-index:2;transform-origin:0 0}.vjs-p .seek-slider .track .main .seek-hover{position:absolute;background-color:#ffffff80;width:100%;height:100%;z-index:1;transform:scaleX(.6);transform-origin:0 0;opacity:0;transition:opacity .4s}.vjs-p .seek-slider .track .main .connect{position:absolute;background-color:#fff;width:100%;height:100%;z-index:3;left:0;transform:scaleX(.13);transform-origin:0 0}.vjs-p .seek-slider .track.active .main{transform:scaleY(2)}.vjs-p .seek-slider .thumb{pointer-events:none;position:absolute;width:12px;height:12px;left:-6px;top:4px;z-index:4;transform:translate(100px)}.vjs-p .seek-slider .thumb .handler{border-radius:100%;width:100%;height:100%;background-color:#fff;opacity:0;transform:scale(.4);cursor:pointer;transition:transform .2s;pointer-events:none}.vjs-p .seek-slider .thumb.active .handler{opacity:1;transform:scale(1)}.vjs-p .seek-slider .hover-time{position:absolute;background-color:#0000004d;line-height:18px;font-size:16px;color:#ddd;top:-25px;left:0;padding:5px 10px;border-radius:5px;box-shadow:0 0 5px #0000004d;opacity:0;transform:translate(150px);pointer-events:none}.vjs-p .seek-slider .hover-time.active{opacity:1}.vjs-p .seek-slider:hover .track .main .seek-hover{opacity:1}.vjs-p .player-controller{position:absolute;z-index:100;bottom:0px;left:0;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:stretch;height:64px;background-image:linear-gradient(0deg,#000,transparent);transition:opacity .2s;color:#fff}.vjs-p .player-menu-box{display:flex;align-items:center;justify-content:center;flex-direction:column;margin-bottom:40px}.vjs-p .player-menu-cell{width:100%;text-align:center;font-size:12px;color:#7a7b7c}.vjs-p .player-multiple-play{width:64px;height:120px}.vjs-p .player-controller-actions-left{display:flex;justify-content:center;align-items:center;flex-shrink:0}.vjs-p .player-right-box{font-size:14px;color:#7a7b7c;cursor:pointer;margin-right:12px}.vjs-p .player-controller-actions{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-left:8px;padding-right:8px;margin-top:2px}.vjs-p .player-mid-box-time{font-size:9px;display:flex;justify-content:center;align-items:center;color:#fff;flex-shrink:0;margin-right:8px;font-family:monospace}.vjs-p .player-controller-play{display:flex;align-items:center;justify-content:center;cursor:pointer;padding-right:4px}.vjs-p .player-controller-progress{width:calc(100% - 28px);margin-left:14px;display:flex;align-items:center;justify-content:center;margin-top:8px}.vjs-p .player-volume{display:flex;align-items:center;justify-content:center;cursor:pointer;margin-right:16px;margin-left:8px}.vjs-p .player-volume-slider{width:60px;margin-right:12px;display:flex;align-items:center}.vjs-p .player-volume-box{display:flex;flex-direction:row}.netless-app-media-player-container{display:flex;position:relative;height:100%}
60
- `);const n=document.createElement("div");if(n.classList.add("netless-app-media-player-container"),Br.render($.createElement(Td,{context:e}),n),i.mountContent(n),e.emitter.on("destroy",()=>{console.log("[MediaPlayer]: destroy"),Br.unmountComponentAtNode(n)}),window.__pcmProxy){const r=()=>{document.visibilityState==="hidden"?(console.log("[MediaPlayer]: visibilitychange -> hidden. unmount for pcmproxy"),Br.unmountComponentAtNode(n)):(console.log("[MediaPlayer]: visibilitychange -> visible. mount for pcmproxy"),Br.render($.createElement(Td,{context:e}),n))};document.addEventListener("visibilitychange",r),e.emitter.on("destroy",()=>{document.removeEventListener("visibilitychange",r)})}}},lM=()=>{Y.debug&&hg({verbose:!0}),Y.register({kind:na.kind,src:na}),Y.register({kind:Ka.kind,src:Ka})},uM={DocsViewer:na.kind,MediaPlayer:Ka.kind};var mg=(e=>(e.Init="Init",e.AttributesUpdate="AttributesUpdate",e.SetAttributes="SetAttributes",e.RegisterMagixEvent="RegisterMagixEvent",e.RemoveMagixEvent="RemoveMagixEvent",e.RemoveAllMagixEvent="RemoveAllMagixEvent",e.RoomStateChanged="RoomStateChanged",e.DispatchMagixEvent="DispatchMagixEvent",e.ReciveMagixEvent="ReciveMagixEvent",e.NextPage="NextPage",e.PrevPage="PrevPage",e.SDKCreate="SDKCreate",e.OnCreate="OnCreate",e.SetPage="SetPage",e.GetAttributes="GetAttributes",e.Ready="Ready",e.Destory="Destory",e.StartCreate="StartCreate",e.WrapperDidUpdate="WrapperDidUpdate",e.DispayIframe="DispayIframe",e.HideIframe="HideIframe",e.GetRootRect="GetRootRect",e.ReplayRootRect="ReplayRootRect",e.PageTo="PageTo",e))(mg||{}),vg=(e=>(e.WrapperDidMount="WrapperDidMount",e.IframeLoad="IframeLoad",e))(vg||{});const Lt={Ready:"Ready",RootRect:"ReplayRootRect",Message:"message",ComputeStyle:"computeStyle",Load:"load",DisplayerState:"displayerState",Show:"show",Hide:"hide"},cM=(e,t)=>new Array(e).fill(0).map((i,n)=>t(n)),ee=class{constructor(e,t){this.manager=e,this.appManager=t,this.magixEventMap=new Map,this.cssList=[],this.allowAppliances=["clicker"],this.bridgeDisposer=E.noop,this.rootRect=null,this.sideEffectManager=new er,this.execListenIframe=E.debounce(i=>{this.listenIframe(i)},50),this.onPhaseChangedListener=i=>{i===C.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay()},this.stateChangeListener=i=>{i=q({},i),i.cameraState=this.manager.cameraState,this.postMessage({kind:"RoomStateChanged",payload:i}),i.cameraState&&(ee.emitter.emit("GetRootRect"),this.computedStyle(i)),i.memberState&&(this.computedZindex(),this.updateStyle()),i.sceneState&&this.computedIframeDisplay(i,this.attributes)},this.displayer=ee.displayer=t.displayer,this.iframe=this._createIframe(),this.sideEffectManager.addDisposer(ee.emitter.on("ReplayRootRect",i=>{this.rootRect=i}),Lt.RootRect),this.sideEffectManager.addDisposer(ee.emitter.on("HideIframe",()=>{this.iframe.className=ee.hiddenClass}),Lt.Hide),this.sideEffectManager.addDisposer(ee.emitter.on("DispayIframe",()=>{this.iframe.className=""}),Lt.Show),this.sideEffectManager.addDisposer(ee.emitter.on("created",()=>{this.bridgeDisposer(),this.bridgeDisposer=C.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(e.emitter.on("cameraStateChange",()=>{this.computedStyle(this.displayer.state)})),ee.onCreate(this)}static onCreate(e){ee.emitter.emit("StartCreate"),ee.emitter.emit("OnCreate",e),ee.emitter.emit("created")}insert(e){const t={url:e.url,width:e.width,height:e.height,displaySceneDir:e.displaySceneDir,useClicker:e.useClicker||!1,useSelector:e.useSelector};this.setAttributes(t);const i=()=>{this.getIframe(),this.listenIframe(this.attributes),this.listenDisplayerState(),ee.emitter.emit("GetRootRect")};if(this.getIframe())i();else{const n=this.sideEffectManager.addDisposer(ee.emitter.on("WrapperDidMount",()=>{i(),this.sideEffectManager.flush(n)})),r=this.sideEffectManager.addDisposer(ee.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,Lt.Message),ee.alreadyCreate=!0,this}getComputedIframeStyle(){this.sideEffectManager.setTimeout(()=>{this.iframe&&getComputedStyle(this.iframe)},200,Lt.ComputeStyle)}destroy(){this.sideEffectManager.flushAll(),ee.emitter.emit("Destory"),ee.alreadyCreate=!1,ee.emitter.clearListeners()}getIframe(){return this.iframe||(this.iframe=this._createIframe()),this.iframe}setIframeSize(e){this.iframe&&(this.iframe.width=`${e.width}px`,this.iframe.height=`${e.height}px`,this.setAttributes({width:e.width,height:e.height}))}get attributes(){return this.appManager.store.getIframeBridge()}setAttributes(e){this.appManager.store.setIframeBridge(e)}_createIframe(){const e=document.createElement("iframe");return e.id="IframeBridge",e.className=ee.hiddenClass,this.appManager.mainView.divElement&&this.appManager.mainView.divElement.appendChild(e),e}scaleIframeToFit(e=C.AnimationMode.Immediately){if(!this.inDisplaySceneDir)return;const{width:t=1280,height:i=720}=this.attributes,n=t?-t/2:0,r=i?-i/2:0;this.manager.moveCameraToContain({originX:n,originY:r,width:t,height:i,animationMode:e})}get isReplay(){return this.manager.isReplay}handleSetPage(e){if(this.isReplay||!this.attributes.displaySceneDir)return;const t=e.payload,i=this.displayer,n=i.entireScenes()[this.attributes.displaySceneDir];if(!n||n.length!==t){const r=cM(t,s=>({name:String(s+1)}));i.putScenes(this.attributes.displaySceneDir,r),this.manager.setMainViewScenePath(this.attributes.displaySceneDir)}}listenIframe(e){const t=i=>{var n;this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:(n=ee.displayer)==null?void 0:n.state,currentPage:this.currentPage,observerId:this.displayer.observerId}}),ee.emitter.emit("IframeLoad",i),this.sideEffectManager.addDisposer(ee.emitter.on("Ready",()=>{var r;this.postMessage((r=this.attributes.lastEvent)==null?void 0:r.payload)}),Lt.Ready),this.computedStyleAndIframeDisplay()};e.url&&this.iframe.src!==e.url&&(this.src_url_equal_anchor||(this.src_url_equal_anchor=document.createElement("a")),this.src_url_equal_anchor.href=e.url,this.src_url_equal_anchor.href!==this.iframe.src&&(this.iframe.src=e.url)),this.iframe.width=`${e.width}px`,this.iframe.height=`${e.height}px`,this.sideEffectManager.addEventListener(this.iframe,"load",t,void 0,Lt.Load)}listenDisplayerState(){this.isReplay&&(this.displayer._phase===C.PlayerPhase.Playing&&this.computedStyleAndIframeDisplay(),this.sideEffectManager.add(()=>(this.displayer.callbacks.on("onPhaseChanged",this.onPhaseChangedListener),()=>this.displayer.callbacks.off("onPhaseChanged",this.onPhaseChangedListener)),Lt.DisplayerState)),this.computedStyleAndIframeDisplay()}computedStyleAndIframeDisplay(){this.computedStyle(this.displayer.state),this.computedIframeDisplay(this.displayer.state,this.attributes)}listenDisplayerCallbacks(){this.displayer.callbacks.on(this.callbackName,this.stateChangeListener)}get callbackName(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}computedStyle(e){const t=this.manager.cameraState,i=this.attributes.width||1280,n=this.attributes.height||720;if(this.iframe){const{width:r,height:s,scale:o,centerX:a,centerY:l}=t,u=this.rootRect||{x:0,y:0},c=`${r/2+u.x}px`,d=`${s/2+u.y}px`,m=`transform-origin: ${c} ${d};`,w=(r-i)/2*o,v=(s-n)/2*o,x=-(a*o)+w,h=-(l*o)+v,p=`transform: translate(${x}px,${h}px) scale(${o}, ${o});`,T=["position: absolute;","border: 0.1px solid rgba(0,0,0,0);","top: 0px;","left: 0px;",m,p];this.cssList=T,this.computedZindex(),this.updateStyle()}}computedIframeDisplay(e,t){this.inDisplaySceneDir?ee.emitter.emit("DispayIframe"):ee.emitter.emit("HideIframe")}computedZindex(){const e="z-index: -1;",t=this.cssList.findIndex(i=>i===e);t!==-1&&this.cssList.splice(t,1),(!this.isClicker()||this.isDisableInput)&&this.cssList.push(e)}updateStyle(){this.iframe.style.cssText=this.cssList.join(" ")}get iframeOrigin(){if(this.iframe)try{return new URL(this.iframe.src).origin}catch(e){console.warn(e)}}messageListener(e){if(nt("<<<",JSON.stringify(e.data)),e.origin!==this.iframeOrigin)return;const t=e.data;switch(t.kind){case"SetAttributes":{this.handleSetAttributes(t);break}case"RegisterMagixEvent":{this.handleRegisterMagixEvent(t);break}case"RemoveMagixEvent":{this.handleRemoveMagixEvent(t);break}case"DispatchMagixEvent":{this.handleDispatchMagixEvent(t);break}case"RemoveAllMagixEvent":{this.handleRemoveAllMagixEvent();break}case"NextPage":{this.handleNextPage();break}case"PrevPage":{this.handlePrevPage();break}case"SDKCreate":{this.handleSDKCreate();break}case"SetPage":{this.handleSetPage(t);break}case"GetAttributes":{this.handleGetAttributes();break}case"PageTo":{this.handlePageTo(t);break}default:{nt(`${t.kind} not allow event.`);break}}}handleSDKCreate(){this.postMessage({kind:"Init",payload:{attributes:this.attributes,roomState:this.displayer.state,currentPage:this.currentPage,observerId:this.displayer.observerId}})}handleDispatchMagixEvent(e){const t=e.payload;this.appManager.safeDispatchMagixEvent(t.event,t.payload)}handleSetAttributes(e){this.setAttributes(e.payload)}handleRegisterMagixEvent(e){const t=e.payload,i=n=>{n.authorId!==this.displayer.observerId&&this.postMessage({kind:"ReciveMagixEvent",payload:n})};this.magixEventMap.set(t,i),this.displayer.addMagixEventListener(t,i)}handleRemoveMagixEvent(e){const t=e.payload,i=this.magixEventMap.get(t);this.displayer.removeMagixEventListener(t,i)}handleNextPage(){this.manager.canOperate&&(this.manager.nextPage(),this.dispatchMagixEvent("NextPage",{}))}handlePrevPage(){this.manager.canOperate&&(this.manager.prevPage(),this.dispatchMagixEvent("PrevPage",{}))}handlePageTo(e){if(this.manager.canOperate){const t=e.payload;if(!Number.isSafeInteger(t)||t<=0)return;this.manager.setMainViewSceneIndex(t-1),this.dispatchMagixEvent("PageTo",t-1)}}handleRemoveAllMagixEvent(){this.magixEventMap.forEach((e,t)=>{this.displayer.removeMagixEventListener(t,e)}),this.magixEventMap.clear()}handleGetAttributes(){this.postMessage({kind:"GetAttributes",payload:this.attributes})}postMessage(e){var t;this.iframe&&((t=this.iframe.contentWindow)==null||t.postMessage(JSON.parse(JSON.stringify(e)),"*"))}dispatchMagixEvent(e,t){this.manager.canOperate&&(this.setAttributes({lastEvent:{name:e,payload:t}}),this.displayer.dispatchMagixEvent(e,t))}get currentIndex(){return this.manager.mainViewSceneIndex}get currentPage(){return this.currentIndex+1}get totalPage(){return this.manager.mainViewScenesLength}get readonly(){return!this.displayer.isWritable}get inDisplaySceneDir(){return this.manager.mainViewSceneDir===this.attributes.displaySceneDir}isClicker(){if(this.readonly)return!1;const e=this.displayer.state.memberState.currentApplianceName;return this.allowAppliances.includes(e)}get isDisableInput(){return"disableDeviceInputs"in this.displayer?this.displayer.disableDeviceInputs:!0}};let Ti=ee;Ti.kind="IframeBridge";Ti.hiddenClass="netless-iframe-brdige-hidden";Ti.emitter=new Ii.default;Ti.displayer=null;Ti.alreadyCreate=!1;class dM extends Ii.default{_inject(t){this.context=t}}class wg{constructor(t){this.extends=new Map,this.context={manager:this,windowManager:t.windowManager,internalEmitter:t.internalEmitter},t.container&&this.refreshContainer(t.container)}refreshContainer(t){this.context.windowManagerContainer=t,this.extends.forEach(i=>{i._inject(this.context)})}hasRegister(t){return Ie.appClasses.has(t)}use(t){this.extends.set(t.kind,t),t._inject(this.context),t.onCreate()}destroy(){this.extends.forEach(t=>{this.extends.delete(t.kind),t.onDestroy()})}}const yg=new mw({emitter:B}),O=class extends C.InvisiblePlugin{constructor(e){super(e);this.version="1.0.7-beta.1",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"^0.2.32",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.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",jspdf:"^2.5.1",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1","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=Q,this.viewMode=C.ViewMode.Broadcaster,this.isReplay=C.isPlayer(this.displayer),this._cursorUIDs=[],this.containerSizeRatio=O.containerSizeRatio,O.displayer=e.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"^0.2.32",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.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",jspdf:"^2.5.1",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1","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(e){O._resolve(e)}static async mount(e){const t=e.room;O.container=e.container,O.supportAppliancePlugin=e.supportAppliancePlugin;const i=e.containerSizeRatio,n=e.debug,r=e.cursor;O.params=e,O.displayer=e.room,xm();let s;if(C.isRoom(t)){if(t.phase!==C.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");t.phase===C.RoomPhase.Connected&&t.isWritable&&(t.disableSerialization=!1),s=await this.initManager(t)}if(O.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(n),this.debug&&hg({verbose:!0}),nt("Already insert room",s),C.isRoom(this.displayer)){if(!s)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await kd.default(async o=>{if(s=t.getInvisiblePlugin(O.kind),!s)throw nt(`manager is empty. retrying ${o}`),new Error},{retries:10,maxTimeout:5e3});if(!s)throw new Error("[WindowManager]: create manager failed");i&&(O.containerSizeRatio=i),await s.ensureAttributes(),s._fullscreen=e.fullscreen,s.appManager=new wm(s),s.appManager.polling=e.polling||!1,s._pageState=new gw(s.appManager),s.cursorManager=new fw(s.appManager,Boolean(r),e.cursorOptions,e.applianceIcons),s.extendPluginManager=new wg({internalEmitter:B,windowManager:s}),i&&(s.containerSizeRatio=i),e.container&&s.bindContainer(e.container),vw(t,s),B.emit("onCreated"),O.isCreated=!0;try{await Vg()}catch(o){console.warn("[WindowManager]: indexedDB open failed"),console.log(o)}return s}static initManager(e){return Sm(e)}static initContainer(e,t,i){const{chessboard:n,overwriteStyles:r,fullscreen:s}=i;O.container||(O.container=t);const{playground:o,wrapper:a,sizer:l,mainViewElement:u}=ym(t);if(O.playground=o,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,o.appendChild(c)}return e.containerResizeObserver=il.create(o,l,a,B),O.wrapper=a,O.sizer=l,u}static get registered(){return Ie.registered}bindContainer(e){var t,i,n,r,s,o,a;if(C.isRoom(this.displayer)&&this.room.phase!==C.RoomPhase.Connected)throw new Od;if(O.isCreated&&O.container)O.container.firstChild&&e.appendChild(O.container.firstChild);else if(O.params){const l=O.params,u=O.initContainer(this,e,l);this.boxManager&&this.boxManager.destroy();const c=Rv(this,Q,B,Mt,{collectorContainer:l.collectorContainer,collectorStyles:l.collectorStyles,prefersColorScheme:l.prefersColorScheme});this.boxManager=c,(t=this.appManager)==null||t.setBoxManager(c),this.bindMainView(u,l.disableCameraTransform),O.wrapper&&((i=this.cursorManager)==null||i.setupWrapper(O.wrapper))}B.emit("updateManagerRect"),(n=this.appManager)==null||n.refresh(),(r=this.appManager)==null||r.resetMaximized(),(s=this.appManager)==null||s.resetMinimized(),(o=this.appManager)==null||o.displayerWritableListener(!this.room.isWritable),O.container=e,(a=this.extendPluginManager)==null||a.refreshContainer(e)}bindCollectorContainer(e){O.isCreated&&this.boxManager?this.boxManager.setCollectorContainer(e):O.params&&(O.params.collectorContainer=e)}static register(e){return Ie.register(e)}static unregister(e){return Ie.unregister(e)}async addApp(e){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((t,i)=>{B.once("rootDirRemoved").then(async()=>{try{const n=await this._addApp(e);t(n)}catch(n){i(n.message)}})}):this._addApp(e);throw new et}async _addApp(e){var t,i,n;if(this.appManager){if(!e.kind||typeof e.kind!="string")throw new jd;e.src&&typeof e.src=="string"&&Ie.register({kind:e.kind,src:e.src});const r=await((t=Ie.appClasses.get(e.kind))==null?void 0:t());if(r&&((i=r.config)==null?void 0:i.singleton)&&this.appManager.appProxies.has(e.kind))throw new Ld;const s=this.setupScenePath(e,this.appManager);return s===void 0?void 0:((n=e==null?void 0:e.options)!=null&&n.scenePath&&(e.options.scenePath=nm(e.options.scenePath)),await this.appManager.addApp(e,Boolean(s)))}else throw new et}setupScenePath(e,t){let i=!1;if(e.options){const{scenePath:n,scenes:r}=e.options;if(n){if(!im(n))throw new _d;const s=Object.keys(this.apps||{});for(const o of s){const a=t.store.getAppScenePath(o);if(a&&a===n){if(console.warn(`[WindowManager]: ScenePath "${n}" already opened`),this.boxManager){const l=this.boxManager.getTopBox();l&&(this.boxManager.setZIndex(o,l.zIndex+1,!1),this.boxManager.focusBox({appId:o},!1))}return}}}n&&r&&r.length>0&&(this.isDynamicPPT(r)?(i=!0,Zi(this.displayer)[n]||In(this.room,n,r)):Zi(this.displayer)[n]||In(this.room,n,[{name:r[0].name}])),n&&r===void 0&&In(this.room,n,[{}])}return i}async setMainViewScenePath(e){this.appManager&&await this.appManager.setMainViewScenePath(e)}async setMainViewSceneIndex(e){this.appManager&&await this.appManager.setMainViewSceneIndex(e)}async nextPage(){if(this.appManager){const e=this.mainViewSceneIndex+1;return e>=this.mainViewScenesLength?(console.warn("[WindowManager]: current page is the last page"),!1):(await this.appManager.setMainViewSceneIndex(e),!0)}else return!1}async prevPage(){if(this.appManager){const e=this.mainViewSceneIndex-1;return e<0?(console.warn("[WindowManager]: current page is the first page"),!1):(await this.appManager.setMainViewSceneIndex(e),!0)}else return!1}async jumpPage(e){return this.appManager?e<0||e>=this.pageState.length?(console.warn(`[WindowManager]: index ${e} out of range`),!1):(await this.appManager.setMainViewSceneIndex(e),!0):!1}async addPage(e){if(this.appManager){const t=e==null?void 0:e.after,i=e==null?void 0:e.scene;if(t){const n=this.mainViewSceneIndex+1;this.room.putScenes(_e,[i||{}],n)}else this.room.putScenes(_e,[i||{}])}}async removePage(e){if(this.appManager){const t=e===void 0?this.pageState.index:e;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):t<0||t>=this.pageState.length?(console.warn(`[WindowManager]: index ${e} out of range`),!1):this.appManager.removeSceneByIndex(t)}else return!1}getMainViewScenePath(){var e;return(e=this.appManager)==null?void 0:e.store.getMainViewScenePath()}getMainViewSceneIndex(){var e;return(e=this.appManager)==null?void 0:e.store.getMainViewSceneIndex()}setReadonly(e){var t;this.readonly=e,(t=this.boxManager)==null||t.setReadonly(e),B.emit("setReadonly",e)}switchMainViewToWriter(){var e;return(e=this.appManager)==null?void 0:e.mainViewProxy.mainViewClickHandler()}onAppDestroy(e,t){em(`destroy-${e}`,t)}onAppEvent(e,t){return B.on(`custom-${e}`,t)}setViewMode(e){var t,i,n,r;(e===C.ViewMode.Broadcaster||e===C.ViewMode.Follower)&&(this.canOperate&&e===C.ViewMode.Broadcaster&&((t=this.appManager)==null||t.mainViewProxy.setCameraAndSize()),(i=this.appManager)==null||i.mainViewProxy.start()),e===C.ViewMode.Freedom&&((n=this.appManager)==null||n.mainViewProxy.stop()),this.viewMode=e,(r=this.appManager)==null||r.mainViewProxy.setViewMode(e)}setBoxState(e){if(!!this.canOperate)switch(e){case"normal":this.setMaximized(!1),this.setMinimized(!1);break;case"maximized":this.setMaximized(!0),this.setMinimized(!1);break;case"minimized":this.setMinimized(!0);break}}setMaximized(e){var t;!this.canOperate||(t=this.boxManager)==null||t.setMaximized(e,!1)}setMinimized(e){var t;!this.canOperate||(t=this.boxManager)==null||t.setMinimized(e,!1)}setFullscreen(e){var t;this._fullscreen!==e&&(this._fullscreen=e,(t=O.sizer)==null||t.classList.toggle("netless-window-manager-fullscreen",e),Q.emit("fullscreenChange",e))}get cursorUIDs(){return this._cursorUIDs}setCursorUIDs(e){var t,i;if(this._cursorUIDs=e||[],this._cursorUIDs.length===0)(t=this._cursorUIDsStyleDOM)==null||t.remove();else{this._cursorUIDsStyleDOM||(this._cursorUIDsStyleDOM=document.createElement("style")),(i=O.playground)==null||i.appendChild(this._cursorUIDsStyleDOM);let n="[data-cursor-uid] { display: none }";for(const r of this._cursorUIDs)n+=`
61
- [data-cursor-uid="${r}"] { display: flex }`;this._cursorUIDsStyleDOM.textContent=n}}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new et}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new et}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new et}get apps(){var e;return(e=this.appManager)==null?void 0:e.store.apps()}get boxState(){var e;if(this.appManager)return(e=this.appManager.boxManager)==null?void 0:e.boxState;throw new et}get darkMode(){var e,t;return Boolean((t=(e=this.appManager)==null?void 0:e.boxManager)==null?void 0:t.darkMode)}get prefersColorScheme(){var e;if(this.appManager)return(e=this.appManager.boxManager)==null?void 0:e.prefersColorScheme;throw new et}get focused(){return this.attributes.focus}get focusedView(){var e,t;return((t=(e=this.appManager)==null?void 0:e.focusApp)==null?void 0:t.view)||this.mainView}get polling(){var e;return((e=this.appManager)==null?void 0:e.polling)||!1}set polling(e){this.appManager&&(this.appManager.polling=e)}get cursorStyle(){var e;return((e=this.cursorManager)==null?void 0:e.style)||"default"}set cursorStyle(e){if(!this.cursorManager)throw new Error("[WindowManager]: cursor is not enabled, please set { cursor: true }.");this.cursorManager.style=e}get mainViewSceneIndex(){var e;return((e=this._pageState)==null?void 0:e.index)||0}get mainViewSceneDir(){var e;if(this.appManager)return(e=this.appManager)==null?void 0:e.getMainViewSceneDir();throw new et}get topApp(){var e,t;return(t=(e=this.boxManager)==null?void 0:e.getTopBox())==null?void 0:t.id}get mainViewScenesLength(){var e;return((e=this._pageState)==null?void 0:e.length)||0}get canRedoSteps(){var e;return((e=this.focusedView)==null?void 0:e.canRedoSteps)||0}get canUndoSteps(){var e;return((e=this.focusedView)==null?void 0:e.canUndoSteps)||0}get sceneState(){if(this.appManager)return this.appManager.sceneState;throw new et}get pageState(){if(this._pageState)return this._pageState.toObject();throw new et}get fullscreen(){return Boolean(this._fullscreen)}queryAll(){var e;return Array.from(((e=this.appManager)==null?void 0:e.appProxies.values())||[])}queryOne(e){var t;return(t=this.appManager)==null?void 0:t.appProxies.get(e)}async closeApp(e){var t;return(t=this.appManager)==null?void 0:t.closeApp(e)}focusApp(e){var i,n,r;const t=(i=this.boxManager)==null?void 0:i.getBox(e);t&&((n=this.boxManager)==null||n.focusBox({appId:e},!1),((r=this.boxManager)==null?void 0:r.teleBoxManager).makeBoxTop(t,!1))}moveCamera(e){var n;const t=E.omit(e,["animationMode"]),i=q({},this.mainView.camera);E.isEqual(q(q({},i),t),i)||(this.mainView.moveCamera(e),(n=this.appManager)==null||n.dispatchInternalEvent(K.MoveCamera,e),setTimeout(()=>{var r;(r=this.appManager)==null||r.mainViewProxy.setCameraAndSize()},500))}moveCameraToContain(e){var t;this.mainView.moveCameraToContain(e),(t=this.appManager)==null||t.dispatchInternalEvent(K.MoveCameraToContain,e),setTimeout(()=>{var i;(i=this.appManager)==null||i.mainViewProxy.setCameraAndSize()},500)}convertToPointInWorld(e){return this.mainView.convertToPointInWorld(e)}setCameraBound(e){this.mainView.setCameraBound(e)}onDestroy(){this._destroy()}destroy(){this._destroy()}_destroy(){var e,t,i,n,r,s;(e=this.containerResizeObserver)==null||e.disconnect(),(t=this.appManager)==null||t.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,nt("Destroyed")}bindMainView(e,t){var i;this.appManager&&(this.appManager.bindMainView(e,Boolean(t)),(i=this.cursorManager)==null||i.setMainViewDivElement(e))}get canOperate(){return C.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===C.RoomPhase.Connected:!1}get room(){return this.displayer}safeSetAttributes(e){this.canOperate&&this.setAttributes(e)}safeUpdateAttributes(e,t){this.canOperate&&this.updateAttributes(e,t)}setPrefersColorScheme(e){var t,i;(i=(t=this.appManager)==null?void 0:t.boxManager)==null||i.setPrefersColorScheme(e)}cleanCurrentScene(){var e;nt("clean current scene"),(e=this.focusedView)==null||e.cleanCurrentScene()}redo(){var e;return((e=this.focusedView)==null?void 0:e.redo())||0}undo(){var e;return((e=this.focusedView)==null?void 0:e.undo())||0}delete(){var e;(e=this.focusedView)==null||e.delete()}copy(){var e;(e=this.focusedView)==null||e.copy()}paste(){var e;(e=this.focusedView)==null||e.paste()}duplicate(){var e;(e=this.focusedView)==null||e.duplicate()}insertText(e,t,i){var n;return((n=this.focusedView)==null?void 0:n.insertText(e,t,i))||""}insertImage(e){var t;return(t=this.focusedView)==null?void 0:t.insertImage(e)}completeImageUpload(e,t){var i;return(i=this.focusedView)==null?void 0:i.completeImageUpload(e,t)}lockImage(e,t){var i;return(i=this.focusedView)==null?void 0:i.lockImage(e,t)}lockImages(e){var t;return(t=this.focusedView)==null?void 0:t.lockImages(e)}refresh(){var e;this._refresh(),(e=this.appManager)==null||e.dispatchInternalEvent(K.Refresh)}_refresh(){var e,t;(e=this.appManager)==null||e.mainViewProxy.rebind(),O.container&&this.bindContainer(O.container),(t=this.appManager)==null||t.refresher.refresh()}setContainerSizeRatio(e){if(!E.isNumber(e)||!(e>0))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a positive number. but got ${e}`);O.containerSizeRatio=e,this.containerSizeRatio=e,B.emit("containerSizeRatioUpdate",e)}isDynamicPPT(e){var i,n;const t=(n=(i=e[0])==null?void 0:i.ppt)==null?void 0:n.src;return t==null?void 0:t.startsWith("pptx://")}async ensureAttributes(){E.isNull(this.attributes)&&await zd(50),E.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:Nd}),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 Ti(this,this.appManager)),this._iframeBridge}useExtendPlugin(e){var t;(t=this.extendPluginManager)==null||t.use(e)}};let Y=O;Y.kind="WindowManager";Y.debug=!1;Y.containerSizeRatio=jg;Y.isCreated=!1;Y._resolve=e=>{};lM();exports.AppCreateError=Ld;exports.AppManagerNotInitError=et;exports.AppNotRegisterError=om;exports.BindContainerRoomPhaseInvalidError=Od;exports.BoxManagerNotFoundError=Vd;exports.BoxNotCreatedError=Bd;exports.BuiltinApps=uM;exports.DomEvents=vg;exports.ExtendPlugin=dM;exports.ExtendPluginManager=wg;exports.IframeBridge=Ti;exports.IframeEvents=mg;exports.InvalidScenePath=_d;exports.ParamsInvalidError=jd;exports.WhiteWebSDKInvalidError=Rd;exports.WindowManager=Y;exports.calculateNextIndex=el;exports.reconnectRefresher=yg;
46
+ Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`+Zl(a))}fe!==Iu&&(fe=Kp),o=Su(o,a),h=s;do{switch(h.tag){case 3:l=o,h.effectTag|=4096,h.expirationTime=e;var y=Gp(h,l,e);th(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"&&(Ft===null||!Ft.has(E)))){h.effectTag|=4096,h.expirationTime=e;var B=Xp(h,l,e);th(h,B);break e}}h=h.return}while(h!==null)}H=og(H)}catch(P){e=P;continue}break}while(1)}function rg(){var t=zs.current;return zs.current=Ps,t===null?Ps:t}function sg(t,e){t<bt&&2<t&&(bt=t),e!==null&&t<ar&&2<t&&(ar=t,Ls=e)}function da(t){t>or&&(or=t)}function cS(){for(;H!==null;)H=ag(H)}function hS(){for(;H!==null&&!G0();)H=ag(H)}function ag(t){var e=lg(t.alternate,t,Le);return t.memoizedProps=t.pendingProps,e===null&&(e=og(t)),Jp.current=null,e}function og(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===pi&&(fe=Iu),null}function Ko(t){var e=t.expirationTime;return t=t.childExpirationTime,e>t?e:t}function ni(t){var e=oa();return Gt(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=Ko(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,Jp.current=null,za=qr;var a=Vc();if(ko(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;Ba={activeElementDetached:null,focusedElem:a,selectionRange:o},qr=!1,D=r;do try{fS()}catch(z){if(D===null)throw Error(I(330));mi(D,z),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:xh(D),D.effectTag&=-3;break;case 6:xh(D),D.effectTag&=-3,Oa(D.alternate,D);break;case 1024:D.effectTag&=-1025;break;case 1028:D.effectTag&=-1025,Oa(D.alternate,D);break;case 4:Oa(D.alternate,D);break;case 8:u=D,Yp(a,u,o),Zp(u)}D=D.nextEffect}}catch(z){if(D===null)throw Error(I(330));mi(D,z),D=D.nextEffect}while(D!==null);if(x=Ba,y=Vc(),g=x.focusedElem,o=x.selectionRange,y!==g&&g&&g.ownerDocument&&np(g.ownerDocument.documentElement,g)){for(o!==null&&ko(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=_c(g,a),c=_c(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}qr=!!za,Ba=za=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 B=D.ref;if(B!==null){var P=D.stateNode;switch(D.tag){case 5:y=P;break;default:y=P}typeof B=="function"?B(y):B.current=y}}D=D.nextEffect}}catch(z){if(D===null)throw Error(I(330));mi(D,z),D=D.nextEffect}while(D!==null);D=null,X0(),$=s}else t.current=i;if(_s)_s=!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&&(Ft=null),e===1073741823?t===Xo?Qn++:(Qn=0,Xo=t):Qn=0,typeof qo=="function"&&qo(i.stateNode,n),We(t),js)throw js=!1,t=Go,Go=null,t;return($&Mu)!==pe||wt(),null}function fS(){for(;D!==null;){var t=D.effectTag;(t&256)!==0&&sS(D.alternate,D),(t&512)===0||_s||(_s=!0,Tp(97,function(){return hn(),null})),D=D.nextEffect}}function hn(){if(Pn!==90){var t=97<Pn?97:Pn;return Pn=90,Gt(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:Fp(5,i),Qp(5,i)}}catch(n){if(t===null)throw Error(I(330));mi(t,n)}i=t.nextEffect,t.nextEffect=null,t=i}return $=e,wt(),!0}function Mh(t,e,i){e=Su(i,e),e=Gp(t,e,1073741823),Ht(t,e),t=ha(t,1073741823),t!==null&&We(t)}function mi(t,e){if(t.tag===3)Mh(t,t,e);else for(var i=t.return;i!==null;){if(i.tag===3){Mh(i,t,e);break}else if(i.tag===1){var n=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Ft===null||!Ft.has(n))){t=Su(e,t),t=Xp(i,t,1073741823),Ht(i,t),i=ha(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===ua||fe===Ds&&bt===1073741823&&Qe()-Cu<qp?li(t,Le):Rs=!0:ug(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=gi(e,t,null)),t=ha(t,e),t!==null&&We(t)}var lg;lg=function(t,e,i){var n=e.expirationTime;if(t!==null){var r=e.pendingProps;if(t.memoizedProps!==r||Be.current)ft=!0;else{if(n<i){switch(ft=!1,e.tag){case 3:fh(e),ja();break;case 5:if(sh(e),e.mode&4&&i!==1&&r.hidden)return e.expirationTime=e.childExpirationTime=1,null;break;case 1:De(e.type)&&ns(e);break;case 4:Vo(e,e.stateNode.containerInfo);break;case 10:n=e.memoizedProps.value,r=e.type._context,oe(Is,r._currentValue),r._currentValue=n;break;case 13:if(e.memoizedState!==null)return n=e.child.childExpirationTime,n!==0&&n>=i?ph(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 mh(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=vu(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;ns(e)}else s=!1;e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,hu(e);var a=n.getDerivedStateFromProps;typeof a=="function"&&As(e,n,a,t),r.updater=la,e.stateNode=r,r._reactInternalFiber=e,_o(e,n,t,i),e=Ho(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=Wo(null,e,r,t,i);break e;case 1:e=dh(null,e,r,t,i);break e;case 11:e=ch(null,e,r,t,i);break e;case 14:e=hh(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),Wo(t,e,n,r,i);case 1:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:Ke(n,r),dh(t,e,n,r,i);case 3:if(fh(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,du(t,e),nr(e,n,null,i),n=e.memoizedState.element,n===r)ja(),e=Tt(t,e,i);else{if((r=e.stateNode.hydrate)&&(Rt=Yi(e.stateNode.containerInfo.firstChild),At=e,r=fi=!0),r)for(i=fu(e,null,n,i),e.child=i;i;)i.effectTag=i.effectTag&-3|1024,i=i.sibling;else Ve(t,e,n,i),ja();e=e.child}return e;case 5:return sh(e),t===null&&$o(e),n=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,a=r.children,Po(n,r)?a=null:s!==null&&Po(n,s)&&(e.effectTag|=16),Up(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&&$o(e),null;case 13:return ph(t,e,i);case 4:return Vo(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),ch(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(Is,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&&!Be.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=Wt(i,null),u.tag=2,Ht(o,u)),o.expirationTime<i&&(o.expirationTime=i),u=o.alternate,u!==null&&u.expirationTime<i&&(u.expirationTime=i),Np(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),hh(t,e,r,s,n,i);case 15:return Op(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,ns(e)):t=!1,Gi(e,i),Pp(e,n,r),_o(e,n,r,i),Ho(null,e,n,!0,t,i);case 19:return mh(t,e,i)}throw Error(I(156,e.tag))};var qo=null,el=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);qo=function(n){try{e.onCommitFiberRoot(i,n,void 0,(n.current.effectTag&64)===64)}catch{}},el=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 bu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function yS(t){if(typeof t=="function")return bu(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Fl)return 11;if(t===Ql)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 us(t,e,i,n,r,s){var a=2;if(n=t,typeof t=="function")bu(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case ri:return jt(i.children,r,s,e);case Hx:a=8,r|=7;break;case Tf:a=8,r|=1;break;case Xr:return t=pt(12,i,e,r|8),t.elementType=Xr,t.type=Xr,t.expirationTime=s,t;case Jr:return t=pt(13,i,e,r),t.type=Jr,t.elementType=Jr,t.expirationTime=s,t;case mo:return t=pt(19,i,e,r),t.elementType=mo,t.expirationTime=s,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ef:a=10;break e;case Nf:a=9;break e;case Fl:a=11;break e;case Ql:a=14;break e;case kf:a=16,n=null;break e;case Pf: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 jt(t,e,i,n){return t=pt(7,t,n,e),t.expirationTime=i,t}function Ua(t,e,i){return t=pt(6,t,null,e),t.expirationTime=i,t}function $a(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 ug(t,e){var i=t.firstSuspendedTime;return t=t.lastSuspendedTime,i!==0&&i>=e&&t<=e}function ui(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 cg(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 tl(t,e){var i=t.lastExpiredTime;(i===0||i>e)&&(t.lastExpiredTime=e)}function Vs(t,e,i,n){var r=e.current,s=mt(),a=Hn.suspense;s=gi(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=yp(i,l,o);break e}}i=o}else i=Yt;return e.context===null?e.context=i:e.pendingContext=i,e=Wt(s,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),Ht(r,e),Qt(r,s),s}function Wa(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 Ih(t,e){t=t.memoizedState,t!==null&&t.dehydrated!==null&&t.retryTime<e&&(t.retryTime=e)}function Au(t,e){Ih(t,e),(t=t.alternate)&&Ih(t,e)}function Tu(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,hu(r),t[mr]=n.current,i&&e!==0&&Jx(t,t.nodeType===9?t:t.ownerDocument),this._internalRoot=n}Tu.prototype.render=function(t){Vs(t,this._internalRoot,null,null)};Tu.prototype.unmount=function(){var t=this._internalRoot,e=t.containerInfo;Vs(null,t,null,function(){e[mr]=null})};function Mr(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 Tu(t,0,e?{hydrate:!0}:void 0)}function fa(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=Wa(a);o.call(u)}}Vs(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=Wa(a);l.call(u)}}ig(function(){Vs(e,a,t,r)})}return Wa(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}}Xf=function(t){if(t.tag===13){var e=ss(mt(),150,100);Qt(t,e),Au(t,e)}};Jl=function(t){t.tag===13&&(Qt(t,3),Au(t,3))};Jf=function(t){if(t.tag===13){var e=mt();e=gi(e,t,null),Qt(t,e),Au(t,e)}};go=function(t,e,i){switch(e){case"input":if(wo(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=ru(n);if(!r)throw Error(I(90));Bf(n),wo(n,r)}}}break;case"textarea":Lf(t,i);break;case"select":e=i.value,e!=null&&Zi(t,!!i.multiple,e,!1)}};Vl=tg;Cf=function(t,e,i,n,r){var s=$;$|=4;try{return Gt(98,t.bind(null,e,i,n,r))}finally{$=s,$===pe&&wt()}};Ol=function(){($&(1|tt|vt))===pe&&(uS(),hn())};bf=function(t,e){var i=$;$|=2;try{return t(e)}finally{$=i,$===pe&&wt()}};function hg(t,e){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Mr(e))throw Error(I(200));return MS(t,e,null,i)}var IS={Events:[wr,xi,ru,Sf,po,nn,function(t){Gl(t,c0)},Mf,If,ra,na,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=Ff(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:vr,bundleType:0,version:"16.14.0",rendererPackageName:"react-dom"});Ge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=IS;Ge.createPortal=hg;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=Ff(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 Gt(99,t.bind(null,e))}finally{$=i,wt()}};Ge.hydrate=function(t,e,i){if(!Mr(e))throw Error(I(200));return fa(null,t,e,!0,i)};Ge.render=function(t,e,i){if(!Mr(e))throw Error(I(200));return fa(null,t,e,!1,i)};Ge.unmountComponentAtNode=function(t){if(!Mr(t))throw Error(I(40));return t._reactRootContainer?(ig(function(){fa(null,null,t,!1,function(){t._reactRootContainer=null,t[mr]=null})}),!0):!1};Ge.unstable_batchedUpdates=tg;Ge.unstable_createPortal=function(t,e){return hg(t,e,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)};Ge.unstable_renderSubtreeIntoContainer=function(t,e,i,n){if(!Mr(i))throw Error(I(200));if(t==null||t._reactInternalFiber===void 0)throw Error(I(38));return fa(t,e,i,!1,n)};Ge.version="16.14.0";function dg(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(dg)}catch(t){console.error(t)}}dg(),gf.exports=Ge;var Wr=gf.exports,CS=Object.defineProperty,bS=Object.defineProperties,AS=Object.getOwnPropertyDescriptors,Ch=Object.getOwnPropertySymbols,TS=Object.prototype.hasOwnProperty,ES=Object.prototype.propertyIsEnumerable,bh=(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)&&bh(t,i,e[i]);if(Ch)for(var i of Ch(e))ES.call(e,i)&&bh(t,i,e[i]);return t};const fg={src:"",currentTime:0,hostTime:0,muted:!1,paused:!0,volume:1},pg={currentTimeMaxError:1,syncInterval:1e3,retryInterval:15e3,verbose:!1,log:console.log.bind(console)};let Mt=pg;function gg(t){Mt=Ue(Ue({},pg),t)}function Hr(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"),mg=[".aac",".mid",".midi",".mp3",".ogg",".oga",".wav",".weba"];var PS=typeof global=="object"&&global&&global.Object===Object&&global,zS=typeof self=="object"&&self&&self.Object===Object&&self,vg=PS||zS||Function("return this")(),Os=vg.Symbol,wg=Object.prototype,BS=wg.hasOwnProperty,DS=wg.toString,bn=Os?Os.toStringTag:void 0,LS=Object.prototype.toString,Ah=Os?Os.toStringTag:void 0;function RS(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Ah&&Ah in Object(t)?function(e){var i=BS.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 il(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 Th(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(il(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=il(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 Ha=function(){return vg.Date.now()},HS=Math.max,FS=Math.min;function Fr(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=Ha();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=Ha(),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=Th(e)||0,il(i)&&(c=!!i.leading,s=(h="maxWait"in i)?HS(Th(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(Ha())},p}class Eh 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=Fr(i=>{this.props.setCurrentTime(i)},50),this.onVolumeChange=i=>{this.changeVolume(i),this.setState({seekVolume:i/100})},this.changeVolume=Fr(i=>{this.props.setVolume(i/100)},50),this.onVolumeSeekStart=()=>{this.onVolumeSeeking=!0},this.onVolumeSeekEnd=Fr(()=>{this.onVolumeSeeking=!1},500),this.onProgressSeekStart=()=>this.setState({isPlayerSeeking:!0}),this.onProgressSeekEnd=Fr(()=>{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(Eh,{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(Eh,{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"},Nh(Math.floor(i/1e3))," /"," ",Nh(Math.floor(e/1e3)))))}}function Nh(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 nl,Pi;(Pi=nl||(nl={}))[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)||"";mg.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:nl.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 kh 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=Hr(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=Hr(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=Pu.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({},fg),i),this.player){let r=Hr(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)||mg.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*Hr(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 =",Pu.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 rl={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({},fg),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"),Wr.render(F.createElement(kh,{context:t}),n),i.mountContent(n),t.emitter.on("destroy",()=>{console.log("[MediaPlayer]: destroy"),Wr.unmountComponentAtNode(n)}),window.__pcmProxy){const r=()=>{document.visibilityState==="hidden"?(console.log("[MediaPlayer]: visibilitychange -> hidden. unmount for pcmproxy"),Wr.unmountComponentAtNode(n)):(console.log("[MediaPlayer]: visibilitychange -> visible. mount for pcmproxy"),Wr.render(F.createElement(kh,{context:t}),n))};document.addEventListener("visibilitychange",r),t.emitter.on("destroy",()=>{document.removeEventListener("visibilitychange",r)})}}},XS=()=>{Y.debug&&gg({verbose:!0}),Y.register({kind:lo.kind,src:lo}),Y.register({kind:rl.kind,src:rl})},JS={DocsViewer:lo.kind,MediaPlayer:rl.kind};const Pt={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}),Pt.RootRect),this.sideEffectManager.addDisposer(q.emitter.on("HideIframe",()=>{this.iframe.className=q.hiddenClass}),Pt.Hide),this.sideEffectManager.addDisposer(q.emitter.on("DispayIframe",()=>{this.iframe.className=""}),Pt.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,Pt.Message),q.alreadyCreate=!0,this}getComputedIframeStyle(){this.sideEffectManager.setTimeout(()=>{this.iframe&&getComputedStyle(this.iframe)},200,Pt.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)}),Pt.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,Pt.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)),Pt.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 yg{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)||Gs;case"BoxManager":return(e==null?void 0:e.BoxManager)||Hs;case"AttributesDelegate":return(e==null?void 0:e.AttributesDelegate)||Ys;case"CursorManager":return(e==null?void 0:e.CursorManager)||Zs;case"AppProxy":return(e==null?void 0:e.AppProxy)||on;case"AppContext":return(e==null?void 0:e.AppContext)||Us;default:return t}}const xg=new rw({emitter:O}),U=class extends b.InvisiblePlugin{constructor(t){super(t),this.version="1.0.7-beta.3",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=Z,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&&gg({verbose:!0}),qe("Already insert room",a),b.isRoom(this.displayer)){if(!a)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await Ph.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=wi(Gs,U.extendClass),l=wi(Zs,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 yg({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 Rg()}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=yl.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 $h;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,Z,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 _h;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 Rh;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=em(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(!qg(n))throw new Oh;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]||zn(this.room,n,r)):Ji(this.displayer)[n]||zn(this.room,n,[{name:r[0].name}])),n&&r===void 0&&zn(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){Jg(`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.boxManager)==null||i.setBoxStatus(t,e)}setLastNotMinimizedBoxStatus(t,e){var i;!this.canOperate||(i=this.boxManager)==null||i.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),Z.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 Lh(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:Bh}),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 Y=U;Y.kind="WindowManager";Y.debug=!1;Y.containerSizeRatio=Bg;Y.isCreated=!1;Y._resolve=t=>{};XS();exports.AppContext=Us;exports.AppCreateError=Rh;exports.AppManager=Gs;exports.AppManagerNotInitError=_e;exports.AppNotRegisterError=nm;exports.AppProxy=on;exports.AttributesDelegate=Ys;exports.BindContainerRoomPhaseInvalidError=$h;exports.BoxManager=Hs;exports.BoxManagerNotFoundError=Uh;exports.BoxNotCreatedError=Vh;exports.BuiltinApps=JS;exports.CursorManager=Zs;exports.ExtendPlugin=qS;exports.ExtendPluginManager=yg;exports.InvalidScenePath=Oh;exports.ParamsInvalidError=_h;exports.WhiteWebSDKInvalidError=jh;exports.WindowManager=Y;exports.calculateNextIndex=wl;exports.getExtendClass=eM;exports.reconnectRefresher=xg;
62
49
  //# sourceMappingURL=index.js.map