@netless/window-manager 1.0.0-canary.4 → 1.0.0-canary.40

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.
Files changed (90) hide show
  1. package/dist/index.cjs.js +115 -34
  2. package/dist/index.es.js +7269 -9721
  3. package/dist/index.umd.js +115 -34
  4. package/dist/{App → src/App}/AppContext.d.ts +12 -7
  5. package/dist/{App → src/App}/AppPageStateImpl.d.ts +0 -0
  6. package/dist/{App → src/App}/AppProxy.d.ts +29 -11
  7. package/dist/{App → src/App}/MagixEvent/index.d.ts +0 -0
  8. package/dist/{App → src/App}/Storage/StorageEvent.d.ts +0 -0
  9. package/dist/{App → src/App}/Storage/index.d.ts +0 -0
  10. package/dist/{App → src/App}/Storage/typings.d.ts +0 -0
  11. package/dist/{App → src/App}/Storage/utils.d.ts +0 -0
  12. package/dist/src/App/WhiteboardView.d.ts +27 -0
  13. package/dist/{App → src/App}/index.d.ts +1 -0
  14. package/dist/src/App/type.d.ts +21 -0
  15. package/dist/{AppListener.d.ts → src/AppListener.d.ts} +2 -2
  16. package/dist/{AppManager.d.ts → src/AppManager.d.ts} +6 -5
  17. package/dist/{AttributesDelegate.d.ts → src/AttributesDelegate.d.ts} +5 -2
  18. package/dist/{BoxEmitter.d.ts → src/BoxEmitter.d.ts} +0 -0
  19. package/dist/{BoxManager.d.ts → src/BoxManager.d.ts} +12 -6
  20. package/dist/{BuiltinApps.d.ts → src/BuiltinApps.d.ts} +3 -0
  21. package/dist/{Cursor → src/Cursor}/Cursor.d.ts +0 -0
  22. package/dist/{Cursor → src/Cursor}/icons.d.ts +0 -0
  23. package/dist/{Cursor → src/Cursor}/index.d.ts +3 -3
  24. package/dist/{Helper.d.ts → src/Helper.d.ts} +4 -8
  25. package/dist/{InternalEmitter.d.ts → src/InternalEmitter.d.ts} +3 -4
  26. package/dist/{Page → src/Page}/PageController.d.ts +1 -0
  27. package/dist/{Page → src/Page}/index.d.ts +0 -0
  28. package/dist/{PageState.d.ts → src/PageState.d.ts} +0 -0
  29. package/dist/{ReconnectRefresher.d.ts → src/ReconnectRefresher.d.ts} +0 -0
  30. package/dist/{RedoUndo.d.ts → src/RedoUndo.d.ts} +0 -0
  31. package/dist/{Register → src/Register}/index.d.ts +0 -0
  32. package/dist/{Register → src/Register}/loader.d.ts +0 -0
  33. package/dist/{Register → src/Register}/storage.d.ts +0 -0
  34. package/dist/{Utils → src/Utils}/AppCreateQueue.d.ts +0 -0
  35. package/dist/{Utils → src/Utils}/Common.d.ts +0 -0
  36. package/dist/{Utils → src/Utils}/Reactive.d.ts +0 -0
  37. package/dist/{Utils → src/Utils}/RoomHacker.d.ts +0 -0
  38. package/dist/{Utils → src/Utils}/error.d.ts +1 -1
  39. package/dist/{Utils → src/Utils}/log.d.ts +0 -0
  40. package/dist/src/View/CameraSynchronizer.d.ts +19 -0
  41. package/dist/{View → src/View}/MainView.d.ts +18 -7
  42. package/dist/{View → src/View}/ViewManager.d.ts +0 -0
  43. package/dist/src/View/ViewSync.d.ts +24 -0
  44. package/dist/{callback.d.ts → src/callback.d.ts} +10 -1
  45. package/dist/{constants.d.ts → src/constants.d.ts} +10 -5
  46. package/dist/src/image.d.ts +19 -0
  47. package/dist/{index.d.ts → src/index.d.ts} +44 -13
  48. package/dist/src/shim.d.ts +11 -0
  49. package/dist/{typings.d.ts → src/typings.d.ts} +8 -2
  50. package/dist/style.css +1 -1
  51. package/docs/app-context.md +155 -27
  52. package/docs/mirgrate-to-1.0.md +39 -0
  53. package/package.json +23 -19
  54. package/playwright.config.ts +29 -0
  55. package/pnpm-lock.yaml +3078 -4412
  56. package/src/App/AppContext.ts +60 -28
  57. package/src/App/AppProxy.ts +235 -113
  58. package/src/App/WhiteboardView.ts +34 -12
  59. package/src/App/index.ts +1 -0
  60. package/src/App/type.ts +22 -0
  61. package/src/AppListener.ts +30 -21
  62. package/src/AppManager.ts +65 -43
  63. package/src/AttributesDelegate.ts +6 -3
  64. package/src/BoxManager.ts +76 -38
  65. package/src/BuiltinApps.ts +9 -8
  66. package/src/Cursor/Cursor.ts +7 -3
  67. package/src/Cursor/index.ts +7 -8
  68. package/src/Helper.ts +25 -7
  69. package/src/InternalEmitter.ts +3 -4
  70. package/src/Page/PageController.ts +1 -0
  71. package/src/PageState.ts +1 -1
  72. package/src/ReconnectRefresher.ts +6 -2
  73. package/src/Utils/Common.ts +3 -0
  74. package/src/Utils/Reactive.ts +27 -26
  75. package/src/Utils/RoomHacker.ts +3 -0
  76. package/src/Utils/error.ts +2 -2
  77. package/src/View/CameraSynchronizer.ts +41 -39
  78. package/src/View/MainView.ts +116 -75
  79. package/src/View/ViewSync.ts +103 -6
  80. package/src/callback.ts +6 -1
  81. package/src/constants.ts +8 -3
  82. package/src/index.ts +173 -58
  83. package/src/style.css +3 -46
  84. package/src/typings.ts +8 -2
  85. package/vite.config.js +8 -4
  86. package/dist/App/AppViewSync.d.ts +0 -11
  87. package/dist/App/WhiteboardView.d.ts +0 -21
  88. package/dist/View/CameraSynchronizer.d.ts +0 -17
  89. package/dist/View/ViewSync.d.ts +0 -7
  90. package/src/App/AppViewSync.ts +0 -69
package/dist/index.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";var ng=Object.defineProperty,rg=Object.defineProperties;var sg=Object.getOwnPropertyDescriptors;var hu=Object.getOwnPropertySymbols;var og=Object.prototype.hasOwnProperty,ag=Object.prototype.propertyIsEnumerable;var pu=(e,t,i)=>t in e?ng(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Q=(e,t)=>{for(var i in t||(t={}))og.call(t,i)&&pu(e,i,t[i]);if(hu)for(var i of hu(t))ag.call(t,i)&&pu(e,i,t[i]);return e},tt=(e,t)=>rg(e,sg(t));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var lg=require("p-retry"),ug=require("emittery"),b=require("lodash"),E=require("white-web-sdk"),cg=require("uuid"),be=require("side-effect-manager"),A=require("value-enhancer"),wd=require("@juggle/resize-observer"),dg=require("video.js");function Ba(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var hg=Ba(lg),Qt=Ba(ug),fu=Ba(dg),Z=(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))(Z||{});const To="__WindowManger",Xs="__WindowMangerEnsureReconnected__";var Le=(e=>(e.Size="size",e.Position="position",e.SceneIndex="SceneIndex",e.ZIndex="zIndex",e))(Le||{}),yd=(e=>(e.setBoxSize="setBoxSize",e.setBoxMinSize="setBoxMinSize",e.destroy="destroy",e))(yd||{}),No=(e=>(e.StartCreate="StartCreate",e))(No||{}),xd=(e=>(e.Leave="leave",e.Normal="normal",e))(xd||{});const gu="2.16.1",pg=340/720,fg=340/720,gg=9/16,ze="/",Sd="/init",Cd=50,mu=500,ie=new Qt.default;class mg{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(()=>{ie.emit("ready")},Cd),this.isEmit=!0}empty(){this.list=[],this.clear()}destroy(){this.timer&&this.clear()}}const L=new Qt.default,vg="__WindowManagerAppCache";let jn,vu;const wg=async()=>{jn=await Sg()},yg=(e,t)=>{if(!!jn)return Mg(jn,{kind:e,sourceCode:t})},xg=async e=>jn?await Cg(jn,e):null;function Sg(){return new Promise((e,t)=>{const i=indexedDB.open(vg,2);i.onerror=n=>{t(n)},i.onupgradeneeded=n=>{const r=n.target.result;r.objectStoreNames.contains("apps")||(vu=r.createObjectStore("apps",{keyPath:"kind"}),vu.createIndex("kind","kind",{unique:!0}))},i.onsuccess=()=>{const n=i.result;e(n)}})}function Cg(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 Mg(e,t){return new Promise((i,n)=>{const r=e.transaction(["apps"],"readwrite").objectStore("apps").add(t);r.onsuccess=()=>i(),r.onerror=()=>n()})}const Ig="NetlessApp",bg=1e4,Eg=async e=>{const t=await xg(e);if(t)return t.sourceCode;{const n=await(await Tg(e,{timeout:bg})).text();return await yg(e,n),n}},wu=(e,t)=>{let i=Function(e+`
2
- ;return ${t}`)();return typeof i=="undefined"&&(i=window[t]),i},Ag=async(e,t,i)=>{const n=i||Ig+t;ie.emit("loadApp",{kind:t,status:"start"});try{const r=await Eg(e);if(!r||r.length===0){ie.emit("loadApp",{kind:t,status:"failed",reason:"script is empty."});return}try{const s=wu(r,n);return ie.emit("loadApp",{kind:t,status:"success"}),s}catch(s){if(s.message.includes("Can only have one anonymous define call per script file")){const o=window.define;typeof o=="function"&&o.amd&&delete o.amd;const a=wu(r,n);return ie.emit("loadApp",{kind:t,status:"success"}),a}ie.emit("loadApp",{kind:t,status:"failed",reason:s.message})}}catch(r){ie.emit("loadApp",{kind:t,status:"failed",reason:r.message})}};async function Tg(e,t){const{timeout:i=1e4}=t,n=new AbortController,r=setTimeout(()=>n.abort(),i),s=await fetch(e,tt(Q({},t),{signal:n.signal,headers:{"content-type":"text/plain"}}));return clearTimeout(r),s}class Ng{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()=>{let r=await Ag(i,t.kind,t.name);if(r)return r.__esModule&&(r=r.default),r;throw new Error(`[WindowManager]: load remote script failed, ${i}`)},this.syncRegisterApp&&this.syncRegisterApp({kind:t.kind,src:i,name:t.name})):typeof i=="function"?n=i: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 Qt.default;this.kindEmitters.set(t,i)}return this.kindEmitters.get(t)}}const je=new Ng,kg=async e=>{var i,n;const t=await((i=je.appClasses.get(e))==null?void 0:i());return t&&((n=t.config)==null?void 0:n.singleton)?e:`${e}-${cg.v4().replace("-","").slice(0,8)}`},gi=(e,t)=>{if(e.focusScenePath!==t)return e.focusScenePath=t,e},yu=e=>{e.didRelease||e.release()},ko=(e,t)=>{if(e&&e.isWritable&&e.state.sceneState.scenePath!==t){const i=t==="/"?"":t;e.setScenePath(i)}},Pg=(e,t,i)=>{var n;if(e&&t){const s=(n=mi(e)[t])==null?void 0:n[i];if(s)return`${t}/${s.name}`}},Po=(e,t,i)=>{e&&e.scenePathType(t)!==E.ScenePathType.None&&e.removeScenes(t,i)},zg=(e,t)=>{L.once(e).then(t)};b.debounce((e,t)=>{e.emit("mainViewModeChange",t)},200);const Dg=(e,t,i=0)=>{const n=mi(e)[t];if(!n)return;const r=n[i];if(!r)return;const s=r.name;return t===ze?`/${s}`:`${t}/${s}`},mi=e=>e.entireScenes(),ai=(e,t,i,n)=>e==null?void 0:e.putScenes(t,i,n),Lg=e=>e.startsWith("/"),Js=e=>{const t=e.split("/");t.pop();let i=t.join("/");return i===""&&(i="/"),i},jg=e=>e.endsWith("/")?e.slice(0,-1):e,xu=e=>{const t=e.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(t)},Su=e=>new Promise(t=>setTimeout(t,e)),Rg=e=>e.split("").reduce((i,n)=>(n===ze&&(i+=1),i),0)===1;class Vg{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 Z.AppMove:{this.appMoveHandler(n.payload);break}case Z.AppResize:{this.appResizeHandler(n.payload);break}case Z.AppBoxStateChange:{this.boxStateChangeHandler(n.payload);break}case Z.SetMainViewScenePath:{this.setMainViewScenePathHandler(n.payload);break}case Z.MoveCamera:{this.moveCameraHandler(n.payload);break}case Z.MoveCameraToContain:{this.moveCameraToContainHandler(n.payload);break}case Z.CursorMove:{this.cursorMoveHandler(n.payload);break}case Z.RootDirRemoved:{this.rootDirRemovedHandler();break}case Z.Refresh:{this.refreshHandler();break}case Z.InitMainViewCamera:{this.initMainViewCameraHandler();break}case Z.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=>{ie.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{gi(this.manager.mainView,i),ie.emit("mainViewScenePathChange",i)},this.moveCameraHandler=i=>{b.isEqual(b.omit(i,["animationMode"]),Q({},this.manager.mainView.camera))||this.manager.mainView.moveCamera(i)},this.moveCameraToContainHandler=i=>{this.manager.mainView.moveCameraToContain(i)},this.cursorMoveHandler=i=>{L.emit("cursorMove",i)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),L.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(To,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(To,this.mainMagixEventListener)}}class Md extends Error{constructor(){super(...arguments);this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class Bg extends Error{constructor(t){super(`[WindowManager]: app ${t} need register or provide src`)}}class Ye extends Error{constructor(){super(...arguments);this.message="[WindowManager]: AppManager must be initialized"}}class Id extends Error{constructor(t){super(`[WindowManager]: white-web-sdk version must large than ${t}`)}}class bd extends Error{constructor(){super(...arguments);this.message="[WindowManager]: kind must be a valid string"}}class Ed extends Error{constructor(){super(...arguments);this.message="[WindowManager]: box need created"}}class Ad extends Error{constructor(){super(...arguments);this.message='[WindowManager]: ScenePath should start with "/"'}}class Td extends Error{constructor(){super(...arguments);this.message="[WindowManager]: boxManager not found"}}class Nd extends Error{constructor(){super(...arguments);this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const kd=e=>(t,i)=>{if(t!==void 0)if(E.listenUpdated){const n=r=>{r.map(o=>o.kind).includes(e)&&i()};return E.listenUpdated(t,n),i(),()=>E.unlistenUpdated(t,n)}else return E.reaction(()=>t,()=>{i()},{fireImmediately:!0})},Pd=(e,t,i)=>{let n=null;const r=E.reaction(e,()=>{n&&(n(),n=null);const s=e();b.isObject(s)?(n=()=>E.unlistenUpdated(s,t),E.listenUpdated(s,t)):i==null||i(s)},{fireImmediately:!0});return()=>{n==null||n(),r()}},Og=kd(E.UpdateEventKind.Removed);kd(E.UpdateEventKind.Inserted);const Ks=Object.keys;function Cu(e){return Boolean(b.has(e,"__isRef"))}function _g(e){return{k:be.genUID(),v:e,__isRef:!0}}class Ug{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 Ge="_WM-STORAGE_";class Mu{constructor(t,i,n){if(this._sideEffect=new be.SideEffectManager,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new Ug,n&&!b.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.isWritable&&(this.id===null?t.isAddApp&&n&&this.setState(n):(r===this._state||!b.isObject(r))&&(b.get(this._context.getAttributes(),[Ge])||this._context.updateAttributes([Ge],{}),this._context.updateAttributes([Ge,this.id],this._state),n&&this.setState(n))),Ks(r).forEach(s=>{if(!(this.id===null&&s===Ge))try{const o=b.isObject(r[s])?JSON.parse(JSON.stringify(r[s])):r[s];Cu(o)?(this._state[s]=o.v,b.isObject(o.v)&&this._refMap.set(o.v,o)):this._state[s]=o}catch(o){console.error(o)}}),this._sideEffect.addDisposer(Pd(()=>this.id===null?t.getAttributes():b.get(t.getAttributes(),[Ge,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(Ks(t).reduce((i,n)=>(b.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.isWritable){console.error(new Error(`Cannot setState on Storage "${this.id}" without writable access`),t);return}const i=Ks(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(b.isObject(r)){let o=this._refMap.get(r);o||(o=_g(r),this._refMap.set(r,o)),s=o}this._setRawState(n,s)}})}emptyStorage(){if(!(b.size(this._state)<=0)){if(this._destroyed){console.error(new Error(`Cannot empty destroyed Storage "${this.id}".`));return}if(!this._context.isWritable){console.error(new Error(`Cannot empty Storage "${this.id}" without writable access.`));return}this.setState(b.mapValues(this._state,b.noop))}}deleteStorage(){if(this.id===null)throw new Error("Cannot delete main Storage");if(!this._context.isWritable){console.error(new Error(`Cannot delete Storage "${this.id}" without writable access.`));return}this.destroy(),this._context.updateAttributes([Ge,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:b.get(this._context.getAttributes(),[Ge,this.id],t)}_setRawState(t,i){if(this.id===null){if(t===Ge)throw new Error(`Cannot set attribute internal filed "${Ge}"`);return this._context.updateAttributes([t],i)}else return this._context.updateAttributes([Ge,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===Ge)continue;const a=b.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:{b.has(this._state,o)&&(l=this._state[o],delete this._state[o]),n[o]={oldValue:l};break}default:{let u=a;if(Cu(a)){const{k:c,v:d}=a,m=this._state[o];b.isObject(m)&&((i=this._refMap.get(m))==null?void 0:i.k)===c?u=m:(u=d,b.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 $g{constructor(t,i,n){this.appContext=t,this.appProxy=i,this.removeViewWrapper=n,this.nextPage=async()=>{const s=this.pageState.index+1;return this.jumpPage(s)},this.prevPage=async()=>{const s=this.pageState.index-1;return this.jumpPage(s)},this.jumpPage=async s=>s<0||s>=this.pageState.length?(console.warn(`[WindowManager]: index ${s} out of range`),!1):(this.appProxy.setSceneIndex(s),!0),this.addPage=async s=>{const o=s==null?void 0:s.after,a=s==null?void 0:s.scene,l=this.appProxy.scenePath;if(!!l)if(o){const u=this.pageState.index+1;ai(this.appContext.room,l,[a||{}],u)}else ai(this.appContext.room,l,[a||{}])},this.removePage=async s=>{const o=s===void 0?this.pageState.index:s;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 ${s} out of range`),!1):this.appProxy.removeSceneByIndex(o)};const r=new A.Val(i.pageState);this.pageState$=r,i.appEmitter.on("pageStateChange",s=>{r.setValue(s)})}get view(){return this.appContext.view}get pageState(){return this.pageState$.value}moveCamera(t){this.appProxy.moveCamera(t)}destroy(){this.removeViewWrapper()}}const Wg=e=>{const t=document.createElement("div");t.className="netless-window-manager-playground";const i=document.createElement("div");return i.className="netless-window-manager-main-view",t.appendChild(i),e.appendChild(t),{playground:t,mainViewElement:i}},Hg=()=>{if(xu(E.WhiteVersion)<xu(gu))throw new Id(gu)},zd=(e,t)=>{const i=e==null?void 0:e.state.roomMembers;return i==null?void 0:i.find(n=>{var r;return((r=n.payload)==null?void 0:r.uid)===t})},Fg=e=>e.map(t=>{var i;return Q({uid:((i=t.payload)==null?void 0:i.uid)||""},t)});class Qg{constructor(t,i,n,r,s){this.manager=t,this.boxManager=i,this.appId=n,this.appProxy=r,this.appOptions=s,this.mobxUtils={autorun:E.autorun,reaction:E.reaction,toJS:E.toJS},this.objectUtils={listenUpdated:E.listenUpdated,unlistenUpdated:E.unlistenUpdated,listenDisposed:E.listenDisposed,unlistenDisposed:E.unlistenDisposed},this.store=this.manager.store,this.isReplay=this.manager.isReplay,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.createWhiteBoardView=o=>{var c;if(this.whiteBoardView)return this.whiteBoardView;let a=this.view;a||(a=this.appProxy.createAppDir());const l=document.createElement("div");l.className="window-manager-view-wrapper",(c=this.box.$content.parentElement)==null||c.appendChild(l);const u=()=>{var d;(d=this.box.$content.parentElement)==null||d.removeChild(l)};return a.divElement=l,this.isAddApp&&this.initPageSize(o),this.whiteBoardView=new $g(this,this.appProxy,u),this.whiteBoardView},this.initPageSize=o=>{if(!b.isNumber(o)||!this.appProxy.scenePath||this.appProxy.pageState.length>=o)return;if(o<=0||o>=mu)throw Error(`[WindowManager]: size ${o} muse be in range [1, ${mu}]`);const a=o-this.appProxy.pageState.length,l=this.appProxy.pageState.length,u=new Array(a).fill({}).map((c,d)=>({name:`${l+d+1}`}));ai(this.room,this.appProxy.scenePath,u)},this.getInitScenePath=()=>this.manager.getAppInitPath(this.appId),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.room)==null||a.setScenePath(o))},this.getAppOptions=()=>typeof this.appOptions=="function"?this.appOptions():this.appOptions,this.createStorage=(o,a)=>{const l=new Mu(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.emitter=r.appEmitter,this.isAddApp=r.isAddApp}get displayer(){return this.manager.displayer}get view(){return this.appProxy.view}get isWritable(){return this.manager.canOperate}get box(){const t=this.boxManager.getBox(this.appId);if(t)return t;throw new Ed}get room(){return this.manager.room}get members(){return this.manager.members}get memberState(){const t=zd(this.room,this.manager.uid);if(!t)throw new Error(`Member ${this.manager.uid} not found.`);return Q({uid:this.manager.uid},t)}get storage(){return this._storage||(this._storage=new Mu(this)),this._storage}}class Zg{constructor(t){this.params=t,this.sceneNode=null,this.createSceneNode=r=>(this.scenePath=r,this.sceneNode&&this.sceneNode.dispose(),this.sceneNode=this.params.displayer.createScenesCallback(r,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}),this.sceneNode),this.onSceneChange=()=>{this.params.notifyPageStateChange()};const{displayer:i,scenePath:n}=this.params;this.view=this.params.view,n&&(this.scenePath=n,this.sceneNode=i.createScenesCallback(n,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}setView(t){this.view=t}getFullPath(t){var n;const i=(n=this.sceneNode)==null?void 0:n.scenes;if(this.scenePath&&i){const r=i[t];if(r)return`${this.scenePath}/${r}`}}toObject(){var t,i;return{index:((t=this.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()}}class Dd{constructor(t){this.saveCamera=t,this.onRemoteUpdate=b.throttle((i,n)=>{if(this.remoteCamera=i,this.remoteSize=n,this.remoteSize&&this.rect){let r;n.width<n.height?r=this.rect.width/n.width:r=this.rect.height/n.height;const s=i.scale*r,o=()=>{var a;return(a=this.view)==null?void 0:a.moveCamera({centerX:i.centerX,centerY:i.centerY,scale:s,animationMode:E.AnimationMode.Immediately})};b.delay(o,50)}},50),this.onLocalSizeUpdate=i=>{if(this.rect&&this.view){let n;i.width<i.height?n=this.rect.width/i.width:n=this.rect.height/i.height;const r=this.view.camera.scale/n;console.log("onLocalSizeUpdate",r.toFixed(3),n.toFixed(3)),this.view.moveCamera({scale:r,animationMode:E.AnimationMode.Immediately})}}}setRect(t){this.rect=t,this.remoteCamera&&this.remoteSize&&this.onRemoteUpdate(this.remoteCamera,this.remoteSize)}setView(t){this.view=t}onLocalCameraUpdate(t){this.saveCamera(t),this.remoteCamera=t}}class Gg{constructor(t){this.appProxy=t,this.sem=new be.SideEffectManager,this.bindView=n=>{!n||(this.synchronizer.setView(n),this.sem.add(()=>(n.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),()=>n.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice))))},this.onCameraUpdatedByDevice=n=>{var s;this.synchronizer.onLocalCameraUpdate(n);const r=(s=this.appProxy.box)==null?void 0:s.contentStageRect;if(r){const o={width:r.width,height:r.height,id:this.appProxy.uid};b.isEqual(o,this.appProxy.size$.value)||this.appProxy.storeSize(o)}},this.synchronizer=new Dd(n=>{this.appProxy.storeCamera(Q({id:this.appProxy.uid},n))}),this.bindView(t.view),this.sem.add(()=>this.appProxy.camera$.subscribe(n=>{const r=this.appProxy.size$.value;n&&r&&this.synchronizer.onRemoteUpdate(n,r)}));const i=this.appProxy.box;i&&i.contentStageRect&&(this.synchronizer.setRect(i.contentStageRect),this.sem.add(()=>i._contentStageRect$.subscribe(n=>{n&&this.synchronizer.setRect(n)})),this.appProxy.size$.value||this.appProxy.storeSize({id:this.appProxy.uid,width:i.contentStageRect.width,height:i.contentStageRect.height}))}destroy(){this.sem.flushAll()}}const wt=new Qt.default,Oa=(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};var me=(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.Camera="camera",e.Size="size",e))(me||{});class Yg{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 b.get(this.attributes,["apps"])}get focus(){return b.get(this.attributes,["focus"])}getAppAttributes(t){return b.get(this.apps(),[t])}getAppState(t){return b.get(this.apps(),[t,"state"])}getMaximized(){return b.get(this.attributes,["maximized"])}getMinimized(){return b.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=b.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"],{[Le.Size]:{},[Le.Position]:{},[Le.SceneIndex]:0})}updateAppState(t,i,n){b.get(this.attributes,["apps",t,"state"])&&this.context.safeUpdateAttributes(["apps",t,"state",i],n)}updateAppAttributes(t,i,n){this.context.safeUpdateAttributes(["apps",t,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[Le.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 b.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return b.get(this.attributes,["mainViewSize"])}setMainViewCamera(t){this.context.safeSetAttributes({mainViewCamera:Q({},t)})}setMainViewSize(t){this.context.safeSetAttributes({mainViewSize:Q({},t)})}setMainViewCameraAndSize(t,i){this.context.safeSetAttributes({mainViewCamera:Q({},t),mainViewSize:Q({},i)})}updateCursor(t,i){b.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),b.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"position"],i)}updateCursorState(t,i){b.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"cursorState"],i)}getCursorState(t){return b.get(this.attributes,["cursors",t,"cursorState"])}cleanCursor(t){this.context.safeUpdateAttributes(["cursors",t],void 0)}setMainViewFocusPath(t){const i=this.getMainViewScenePath();i&&gi(t,i)}}const Xg=new Yg({getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}}),Li=(...e)=>{ye.debug&&console.log("[WindowManager]:",...e)};class _a{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.uid=this.manager.uid,this.status="normal",this.sideEffectManager=new be.SideEffectManager,this.camera$=new A.Val(void 0),this.size$=new A.Val(void 0),this.box$=new A.Val(void 0),this.view$=new A.Val(void 0),this.getAppInitState=o=>{var p,h;const a=this.store.getAppState(o);if(!a)return;const l=a==null?void 0:a[Le.Position],u=this.store.focus,c=a==null?void 0:a[Le.Size],d=a==null?void 0:a[Le.SceneIndex],m=(p=this.attributes)==null?void 0:p.maximized,w=(h=this.attributes)==null?void 0:h.minimized,y=a==null?void 0:a.zIndex;let M={maximized:m,minimized:w,zIndex:y};return l&&(M=tt(Q({},M),{id:o,x:l.x,y:l.y})),u===o&&(M=tt(Q({},M),{focus:!0})),c&&(M=tt(Q({},M),{width:c.width,height:c.height})),d&&(M=tt(Q({},M),{sceneIndex:d})),M},this.appAttributesUpdateListener=o=>{var a,l,u;(a=this.manager.refresher)==null||a.add(o,()=>E.autorun(()=>{const c=this.manager.attributes[o];c&&this.appEmitter.emit("attributesUpdate",c)})),(l=this.manager.refresher)==null||l.add(this.stateKey,()=>E.autorun(()=>{var d,m,w;const c=(d=this.appAttributes)==null?void 0:d.state;(c==null?void 0:c.zIndex)>0&&c.zIndex!==((m=this.box)==null?void 0:m.zIndex)&&((w=this.boxManager)==null||w.setZIndex(o,c.zIndex))})),(u=this.manager.refresher)==null||u.add(`${o}-fullPath`,()=>E.autorun(()=>{var d;const c=(d=this.appAttributes)==null?void 0:d.fullPath;this.setFocusScenePathHandler(c),this._prevFullPath!==c&&(this.notifyPageStateChange(),this._prevFullPath=c)}))},this.setFocusScenePathHandler=b.debounce(o=>{var a;this.view&&o&&o!==((a=this.view)==null?void 0:a.focusScenePath)&&gi(this.view,o)},50),this.notifyPageStateChange=b.debounce(()=>{this.pageState&&this.appEmitter.emit("pageStateChange",this.pageState)},50),this.storeCamera=o=>{this.store.updateAppAttributes(this.id,me.Camera,o)},this.storeSize=o=>{this.store.updateAppAttributes(this.id,me.Size,o)},this.moveCamera=o=>{if(!this.camera$.value)return;const a=Q(Q({},this.camera$.value),o);this.storeCamera(a)},this.kind=t.kind,this.id=n,this.appScenePath=`/${this.id}-app-dir`,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new Qt.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=r,this.initScenes(),(s=this.params.options)!=null&&s.scenePath&&this.createView(),this.scenePath||(this.scenePath=this.appScenePath),this._pageState=new Zg({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange}),this.sideEffectManager.add(()=>()=>this._pageState.destroy()),this.sideEffectManager.add(()=>L.on("roomMembersChange",o=>{this.appEmitter.emit("roomMembersChange",o)})),this.camera$.setValue(E.toJS(this.appAttributes.camera)),this.size$.setValue(E.toJS(this.appAttributes.size)),this.sideEffectManager.add(()=>this.manager.refresher.add(`${this.id}-camera`,()=>E.reaction(()=>{var o;return(o=this.appAttributes)==null?void 0:o.camera},o=>{o&&o.id!==this.uid&&this.camera$.setValue(E.toJS(o))}))),this.sideEffectManager.add(()=>this.manager.refresher.add(`${this.id}-size`,()=>E.reaction(()=>{var o;return(o=this.appAttributes)==null?void 0:o.size},o=>{o&&o.id!==this.uid&&this.size$.setValue(E.toJS(o))}))),A.combine([this.box$,this.view$]).subscribe(([o,a])=>{if(o&&a){const l=new Gg(this);this.appViewSync=l,this.sideEffectManager.add(()=>()=>l.destroy())}})}createAppDir(){const t=this.scenePath||this.appScenePath;this._pageState.createSceneNode(t)||(ai(this.manager.room,t,[{name:"1"}]),this._pageState.createSceneNode(t),this.setSceneIndex(0)),this.scenes=mi(this.manager.displayer)[t];const n=this.createView();return this._pageState.setView(n),n}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=mi(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 b.get(this.appAttributes,[me.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const t=b.get(this.appAttributes,["state","SceneIndex"],0),i=Pg(this.manager.room,this.scenePath,t);return i&&this.setFullPath(i),i}setFullPath(t){this.store.updateAppAttributes(this.id,me.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=je.appClasses.get(i.kind))==null?void 0:s()),r=je.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 L.emit("updateManagerRect"),{appId:this.id,app:n}}get box(){return this.box$.value}async setupApp(t,i,n,r,s){var a;if(Li("setupApp",t,n,r),!this.boxManager)throw new Td;const o=new Qg(this.manager,this.boxManager,t,this,s);this.appContext=o;try{L.once(`${t}${Z.WindowCreated}`).then(async()=>{var c;let u;i||(u=this.getAppInitState(t),(c=this.boxManager)==null||c.updateBoxState(u)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(t),this.setViewFocusScenePath(),setTimeout(async()=>{const d=await n.setup(o);this.appResult=d,je.notifyApp(this.kind,"created",{appId:t,result:d}),this.fixMobileSize()},Cd)});const l=(a=this.boxManager)==null?void 0:a.createBox({appId:t,app:n,options:r,canOperate:this.manager.canOperate,smartPosition:this.isAddApp});this.box$.setValue(l),this.isAddApp&&this.box&&(this.store.updateAppState(t,Le.ZIndex,this.box.zIndex),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}))}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 _a(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 yd.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}),wt.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const t=this.getFullScenePath();this.manager.room&&t&&this.view&&ko(this.manager.room,t)}setViewFocusScenePath(){const t=this.getFullScenePath();return t&&this.view&&gi(this.view,t),t}createView(){const t=this.viewManager.createView(this.id);return this.view$.setValue(t),this.setViewFocusScenePath(),t}get pageState(){return this._pageState.toObject()}async removeSceneByIndex(t){const i=this._pageState.getFullPath(t);if(i&&this.pageState){const n=Oa(t,this.pageState);return this.setSceneIndexWithoutSync(n),this.manager.dispatchInternalEvent(Z.SetAppFocusIndex,{type:"app",appID:this.id,index:n}),setTimeout(()=>{Po(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,o,a,l;if(this.status!=="destroyed"){this.status="destroyed";try{await je.notifyApp(this.kind,"destroy",{appId:this.id}),await this.appEmitter.emit("destroy",{error:r})}catch(u){console.error("[WindowManager]: notifyApp error",u.message,u.stack)}this.appEmitter.clearListeners(),this.sideEffectManager.flushAll(),L.emit(`destroy-${this.id}`,{error:r}),t&&((s=this.boxManager)==null||s.closeBox(this.id,n)),i&&(this.store.cleanAppAttributes(this.id),this.scenePath&&Po(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),(o=this.manager.refresher)==null||o.remove(this.id),(a=this.manager.refresher)==null||a.remove(this.stateKey),(l=this.manager.refresher)==null||l.remove(`${this.id}-fullPath`),this._prevFullPath=void 0,this.camera$.destroy(),this.size$.destroy(),this.box$.destroy()}}close(){return this.destroy(!0,!0,!1)}}class Jg{constructor(t){this.displayer=t,this.views=new Map}createView(t){const i=Ld(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 Ld=e=>{const t=e.views.createView();return Kg(t),t},Kg=e=>{e.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class qg{constructor(t){var n;this.manager=t,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.sideEffectManager=new be.SideEffectManager,this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>L.on("writableChange",r=>{r&&this.ensureCameraAndSize()}))},this.addCameraReaction=()=>{var r;(r=this.manager.refresher)==null||r.add(me.MainViewCamera,this.cameraReaction)},this.cameraReaction=()=>E.reaction(()=>this.mainViewCamera,r=>{r&&r.id!==this.manager.uid&&this.synchronizer.onRemoteUpdate(r,this.mainViewSize)},{fireImmediately:!0}),this.sizeChangeHandler=b.debounce(r=>{},30),this.onUpdateContainerSizeRatio=()=>{const r=this.store.getMainViewSize();this.sizeChangeHandler(r),r.id===this.manager.uid&&this.setCameraAndSize()},this.onCameraUpdatedByDevice=r=>{this.synchronizer.onLocalCameraUpdate(r);const s=this.getStageSize();s&&!b.isEqual(s,this.mainViewSize)&&this.setMainViewSize(s)},this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=b.debounce(r=>{this.store.setMainViewSize(tt(Q({},r),{id:this.manager.uid}))},50),this.onCameraOrSizeUpdated=()=>{ie.emit("cameraStateChange",this.cameraState)},this.synchronizer=new Dd(r=>this.store.setMainViewCamera(tt(Q({},r),{id:this.manager.uid}))),this.mainView=this.createMainView(),this.moveCameraSizeByAttributes(),L.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()}),this.sideEffectManager.add(()=>L.on("containerSizeRatioUpdate",this.onUpdateContainerSizeRatio)),this.sideEffectManager.add(()=>L.on("startReconnect",()=>{yu(this.mainView)}));const i=(n=this.manager.boxManager)==null?void 0:n.stageRect;i&&this.synchronizer.setRect(i),this.sideEffectManager.add(()=>L.on("playgroundSizeChange",r=>{this.synchronizer.setRect(r)}))}ensureCameraAndSize(){(!this.mainViewCamera||!this.mainViewSize)&&(this.manager.dispatchInternalEvent(Z.InitMainViewCamera),this.setCameraAndSize())}get mainViewCamera(){return this.store.getMainViewCamera()}get mainViewSize(){return this.store.getMainViewSize()}get didRelease(){return b.get(this.view,["didRelease"])}moveCameraSizeByAttributes(){this.synchronizer.onRemoteUpdate(this.mainViewCamera,this.mainViewSize)}start(){this.started||(this.sizeChangeHandler(this.mainViewSize),this.addCameraListener(),this.addCameraReaction(),this.started=!0)}setCameraAndSize(){const t=this.getStageSize();if(t){const i=tt(Q({},this.mainView.camera),{id:this.manager.uid}),n=tt(Q({},t),{id:this.manager.uid});this.store.setMainViewCameraAndSize(i,n)}}get view(){return this.mainView}get cameraState(){return Q(Q({},this.view.camera),this.view.size)}createMainView(){const t=Ld(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&gi(t,i),this.synchronizer.setView(t),t}onReconnect(){if(this.didRelease)this.rebind();else{const t=this.store.getMainViewScenePath();this.setFocusScenePath(t)}}setFocusScenePath(t){if(t)return gi(this.view,t)}rebind(){const t=this.mainView.divElement,i=this.mainView.disableCameraTransform;this.stop(),yu(this.mainView),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=i,this.mainView.divElement=t,this.addMainViewListener(),this.start()}getStageSize(){var i;const t=(i=this.manager.boxManager)==null?void 0:i.stageRect;if(t)return{width:t.width,height:t.height}}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)}stop(){var t,i;this.removeCameraListener(),(t=this.manager.refresher)==null||t.remove(me.MainViewCamera),(i=this.manager.refresher)==null||i.remove(me.MainViewSize),this.started=!1}destroy(){this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class em{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=>{ie.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{ie.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)},L.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),L.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(t.focus()),this.addRedoUndoListeners(t.focus())}),this.addRedoUndoListeners(t.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class tm{constructor(t){this.windowManger=t,this.appProxies=new Map,this.appStatus=new Map,this.store=Xg,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new mg,this.sideEffectManager=new be.SideEffectManager,this.sceneState=null,this.rootDirRemoving=!1,this.onRemoveScenes=async i=>{var r,s;const{scenePath:n}=i;if(n===ze){await this.onRootDirRemoved(),this.dispatchInternalEvent(Z.RootDirRemoved);return}if(Rg(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(`${ze}${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(ze,{onAddScene:this.onSceneChange,onRemoveScene:async(n,r)=>{await this.onSceneChange(n),L.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=Oa(i,this.windowManger.pageState);this.setSceneIndexWithoutSync(n),this.dispatchInternalEvent(Z.SetAppFocusIndex,{type:"main",index:n});const r=(s=this.callbacksNode)==null?void 0:s.scenes[i];return setTimeout(()=>{r&&Po(this.room,`${ze}${r}`,i)},100),new Promise((o,a)=>{L.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(`${ze}${n}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([ie.emit("mainViewScenesLengthChange",i),L.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:`${ze}${r}`,contextPath:i.path,index:n,scenes:i.scenes.map(s=>({name:s})),sceneName:r},ie.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(Z.AppMove,i),this.store.updateAppState(i.appId,Le.Position,{x:i.x,y:i.y})},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(Z.AppResize,i),this.store.updateAppState(i.appId,Le.Size,{width:i.width,height:i.height}))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId})},this.onBoxClose=i=>{const n=this.appProxies.get(i.appId);n&&n.destroy(!1,!0,!0,i.error)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(Z.AppBoxStateChange,i)},this.addAppsChangeListener=()=>{var i;(i=this.refresher)==null||i.add("apps",()=>Pd(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{var i;(i=this.refresher)==null||i.add("appsClose",()=>Og(this.attributes.apps,()=>{this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this._prevSceneIndex!==i&&(ie.emit("mainViewSceneIndexChange",i),L.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this._prevSceneIndex=i)},this.onFocusChange=i=>{var n;this._prevFocused!==i&&(ie.emit("focusedChange",i),L.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&&je.notifyApp(r.kind,"focus",{appId:i})},0)))},this.attributesUpdateCallback=b.debounce(i=>this._attributesUpdateCallback(i),100),this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([n,r])=>{je.appClasses.has(n)||je.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=>{const n=i.sceneState;if(n){const r=n.scenePath;this.appProxies.forEach(s=>{s.scenePath&&r.startsWith(s.scenePath)&&(s.emitAppSceneStateChange(n),s.setFullPath(r))})}this.appProxies.forEach(r=>{r.appEmitter.emit("roomStateChange",i)}),i.roomMembers&&L.emit("roomMembersChange",this.members),L.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()}),n===!0?(this.mainView.disableCameraTransform=!1,this.room&&this.room.disableSerialization===!0&&(this.room.disableSerialization=!1)):this.mainView.disableCameraTransform=!0,L.emit("writableChange",n)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),n=Js(i),r=mi(this.displayer)[n];if(r.length){const s=i.replace(n,"").replace("/",""),o=r.findIndex(a=>a.name===s);b.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 qg(this),this.viewManager=new Jg(this.displayer),this.appListeners=new Vg(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=qf,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:L}),this.sideEffectManager.add(()=>()=>{var i,n,r;this.appCreateQueue.destroy(),this.mainViewProxy.destroy(),(i=this.refresher)==null||i.destroy(),this.viewManager.destroy(),(n=this.boxManager)==null||n.destroy(),(r=this.callbacksNode)==null||r.dispose()}),L.once("onCreated").then(()=>this.onCreated()),L.on("onReconnected",()=>this.onReconnected()),E.isPlayer(this.displayer)&&(L.on("seekStart",this.onPlayerSeekStart),L.on("seek",this.onPlayerSeekDone)),L.on("removeScenes",this.onRemoveScenes),L.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),je.setSyncRegisterApp(i=>{this.safeUpdateAttributes([me.Registered,i.kind],i)})}async onRootDirRemoved(t=!0){this.setMainViewScenePath(Sd),this.createRootDirScenesCallback();for(const[i,n]of this.appProxies.entries())n.view&&await this.closeApp(i,t);this.mainViewProxy.rebind(),L.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return E.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return E.isRoom(this.displayer)?this.displayer:void 0}get mainView(){return this.mainViewProxy.view}get focusApp(){if(this.store.focus)return this.appProxies.get(this.store.focus)}get uid(){var t;return((t=this.room)==null?void 0:t.uid)||""}get members(){return Fg(this.displayer.state.roomMembers)}getMainViewSceneDir(){const t=this.store.getMainViewScenePath();if(t)return Js(t);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var t,i,n,r,s,o;if(await this.attributesUpdateCallback(this.attributes.apps),L.emit("updateManagerRect"),wt.on("move",this.onBoxMove),wt.on("resize",this.onBoxResize),wt.on("focus",this.onBoxFocus),wt.on("close",this.onBoxClose),wt.on("boxStateChange",this.onBoxStateChange),this.addAppsChangeListener(),this.addAppCloseListener(),(t=this.refresher)==null||t.add("maximized",()=>E.autorun(()=>{var l;const a=this.attributes.maximized;(l=this.boxManager)==null||l.setMaximized(Boolean(a))})),(i=this.refresher)==null||i.add("minimized",()=>E.autorun(()=>{const a=this.attributes.minimized;this.onMinimized(a)})),(n=this.refresher)==null||n.add("mainViewIndex",()=>E.autorun(()=>{const a=b.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(a)})),(r=this.refresher)==null||r.add("focusedChange",()=>E.autorun(()=>{const a=b.get(this.attributes,"focus");this.onFocusChange(a)})),(s=this.refresher)==null||s.add("registeredChange",()=>E.autorun(()=>{const a=b.get(this.attributes,me.Registered);this.onRegisteredChange(a)})),!this.attributes.apps||Object.keys(this.attributes.apps).length===0){const a=this.store.getMainViewScenePath();if(!a)return;this.resetScenePath(a)}this.displayerWritableListener(!((o=this.room)!=null&&o.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this._prevFocused=this.attributes.focus,this.sideEffectManager.add(()=>{const a=new em({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:l=>this.appProxies.get(l)});return()=>a.destroy()})}async _attributesUpdateCallback(t){if(t&&ye.container){const i=Object.keys(t);i.length===0&&this.appCreateQueue.emitReady();const n=i.map(r=>({id:r,createdAt:t[r].createdAt}));for(const{id:r}of b.orderBy(n,"createdAt","asc"))if(!this.appProxies.has(r)&&!this.appStatus.has(r)){const s=t[r];try{if(!this.attributes[r])throw new Error("appAttributes is undefined");this.appCreateQueue.push(()=>(this.appStatus.set(r,No.StartCreate),this.baseInsertApp({kind:s.kind,options:s.options,isDynamicPPT:s.isDynamicPPT},r,!1))),this.focusByAttributes(t)}catch(o){console.warn("[WindowManager]: Insert App Error",o)}}}}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(),L.emit("mainViewMounted")}setMainViewFocusPath(t){var n;const i=t||this.store.getMainViewScenePath();if(i)return gi(this.mainView,i),((n=this.mainView)==null?void 0:n.focusScenePath)===i}resetScenePath(t){this.displayer.state.sceneState.scenePath!==t&&ko(this.room,t)}async addApp(t,i){Li("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,No.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;wt.emit("move",{appId:t.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(t.id,Le.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 _a(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(Js(t)!==ze)throw new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===E.ScenePathType.None)throw new Error(`[WindowManager]: ${t} not valid scene`);if(i===E.ScenePathType.Page)await this._setMainViewScenePath(t);else if(i===E.ScenePathType.Dir){const r=Dg(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=`${ze}${n}`;if(n)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.safeSetAttributes({_mainSceneIndex:t}),this.dispatchSetMainViewScenePath(r));else throw new Error(`[WindowManager]: ${t} not valid index`)}}dispatchSetMainViewScenePath(t){this.dispatchInternalEvent(Z.SetMainViewScenePath,{nextScenePath:t}),ko(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(){const i=Array.from(this.appProxies.values()).map(n=>n.onReconnected());this.mainViewProxy.onReconnect(),await Promise.all(i)}notifyContainerRectUpdate(t){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",t)})}dispatchInternalEvent(t,i){this.safeDispatchMagixEvent(To,{eventName:t,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),wt.clearListeners(),L.clearListeners(),this.appProxies.size&&this.appProxies.forEach(t=>{t.destroy(!0,!1,!0)}),ie.clearListeners(),this.sideEffectManager.flushAll(),this._prevFocused=void 0,this._prevSceneIndex=void 0}}/*! *****************************************************************************
1
+ "use strict";var Co=Object.defineProperty,Io=Object.defineProperties;var _o=Object.getOwnPropertyDescriptors;var oi=Object.getOwnPropertySymbols;var yr=Object.prototype.hasOwnProperty,wr=Object.prototype.propertyIsEnumerable;var br=(t,e,i)=>e in t?Co(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,j=(t,e)=>{for(var i in e||(e={}))yr.call(e,i)&&br(t,i,e[i]);if(oi)for(var i of oi(e))wr.call(e,i)&&br(t,i,e[i]);return t},oe=(t,e)=>Io(t,_o(e));var vr=(t,e)=>{var i={};for(var s in t)yr.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(t!=null&&oi)for(var s of oi(t))e.indexOf(s)<0&&wr.call(t,s)&&(i[s]=t[s]);return i};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Ao=require("p-retry"),ko=require("emittery"),C=require("lodash"),M=require("white-web-sdk"),To=require("uuid"),ve=require("side-effect-manager"),w=require("value-enhancer"),ha=require("@juggle/resize-observer");function da(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var No=da(Ao),rt=da(ko),Y=(t=>(t.AppMove="AppMove",t.AppFocus="AppFocus",t.AppResize="AppResize",t.AppBoxStateChange="AppBoxStateChange",t.GetAttributes="GetAttributes",t.UpdateWindowManagerWrapper="UpdateWindowManagerWrapper",t.WindowCreated="WindowCreated",t.SetMainViewScenePath="SetMainViewScenePath",t.SetMainViewSceneIndex="SetMainViewSceneIndex",t.SetAppFocusIndex="SetAppFocusIndex",t.SwitchViewsToFreedom="SwitchViewsToFreedom",t.CursorMove="CursorMove",t.RootDirRemoved="RootDirRemoved",t.Refresh="Refresh",t.InitMainViewCamera="InitMainViewCamera",t.InvokeAttributesUpdateCallback="InvokeAttributesUpdateCallback",t.MoveCamera="MoveCamera",t.MoveCameraToContain="moveCameraToContain",t))(Y||{});const us="__WindowManger",qi="__WindowMangerEnsureReconnected__";var Ee=(t=>(t.Size="size",t.Position="position",t.SceneIndex="SceneIndex",t.ZIndex="zIndex",t.Visible="visible",t.Ratio="ratio",t.StageRatio="stageRatio",t.Draggable="draggable",t.Resizable="resizable",t))(Ee||{}),ua=(t=>(t.setBoxSize="setBoxSize",t.setBoxMinSize="setBoxMinSize",t.destroy="destroy",t))(ua||{}),ps=(t=>(t.StartCreate="StartCreate",t))(ps||{}),pa=(t=>(t.Leave="leave",t.Normal="normal",t))(pa||{});const xr="2.16.1",Eo=340/720,Po=340/720,zo=9/16,we="/",ga="/init",ma=50,Mr=500,Q=new rt.default;class Do{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(()=>{Q.emit("ready")},ma),this.isEmit=!0}empty(){this.list=[],this.clear()}destroy(){this.timer&&this.clear()}}const P=new rt.default,Lo="__WindowManagerAppCache";let Zt,Sr;const Vo=async()=>{Zt=await Bo()},$o=(t,e)=>{if(!!Zt)return Oo(Zt,{kind:t,sourceCode:e})},jo=async t=>Zt?await Ro(Zt,t):null;function Bo(){return new Promise((t,e)=>{const i=indexedDB.open(Lo,2);i.onerror=s=>{e(s)},i.onupgradeneeded=s=>{const r=s.target.result;r.objectStoreNames.contains("apps")||(Sr=r.createObjectStore("apps",{keyPath:"kind"}),Sr.createIndex("kind","kind",{unique:!0}))},i.onsuccess=()=>{const s=i.result;t(s)}})}function Ro(t,e){return new Promise((i,s)=>{const a=t.transaction(["apps"]).objectStore("apps").index("kind").get(e);a.onerror=n=>s(n),a.onsuccess=()=>{a.result?i(a.result):i(null)}})}function Oo(t,e){return new Promise((i,s)=>{const r=t.transaction(["apps"],"readwrite").objectStore("apps").add(e);r.onsuccess=()=>i(),r.onerror=()=>s()})}const Uo="NetlessApp",Wo=1e4,Ho=async t=>{const e=await jo(t);if(e)return e.sourceCode;{const s=await(await Zo(t,{timeout:Wo})).text();return await $o(t,s),s}},Cr=(t,e)=>{let i=Function(t+`
2
+ ;return ${e}`)();return typeof i=="undefined"&&(i=window[e]),i},Fo=async(t,e,i)=>{const s=i||Uo+e;Q.emit("loadApp",{kind:e,status:"start"});try{const r=await Ho(t);if(!r||r.length===0){Q.emit("loadApp",{kind:e,status:"failed",reason:"script is empty."});return}try{const a=Cr(r,s);return Q.emit("loadApp",{kind:e,status:"success"}),a}catch(a){if(a.message.includes("Can only have one anonymous define call per script file")){const n=window.define;typeof n=="function"&&n.amd&&delete n.amd;const o=Cr(r,s);return Q.emit("loadApp",{kind:e,status:"success"}),o}Q.emit("loadApp",{kind:e,status:"failed",reason:a.message})}}catch(r){Q.emit("loadApp",{kind:e,status:"failed",reason:r.message})}};async function Zo(t,e){const{timeout:i=1e4}=e,s=new AbortController,r=setTimeout(()=>s.abort(),i),a=await fetch(t,oe(j({},e),{signal:s.signal,headers:{"content-type":"text/plain"}}));return clearTimeout(r),a}class Yo{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 s;if(typeof i=="string"?(s=async()=>{let r=await Fo(i,e.kind,e.name);if(r)return r.__esModule&&(r=r.default),r;throw new Error(`[WindowManager]: load remote script failed, ${i}`)},this.syncRegisterApp&&this.syncRegisterApp({kind:e.kind,src:i,name:e.name})):typeof i=="function"?s=i:s=async()=>i,this.appClasses.set(e.kind,async()=>{let r=this.appClassesCache.get(e.kind);return r||(r=s(),this.appClassesCache.set(e.kind,r)),r}),e.addHooks){const r=this.createKindEmitter(e.kind);r&&e.addHooks(r)}}unregister(e){this.appClasses.delete(e),this.appClassesCache.delete(e),this.registered.delete(e);const i=this.kindEmitters.get(e);i&&(i.clearListeners(),this.kindEmitters.delete(e))}async notifyApp(e,i,s){const r=this.kindEmitters.get(e);await(r==null?void 0:r.emit(i,s))}createKindEmitter(e){if(!this.kindEmitters.has(e)){const i=new rt.default;this.kindEmitters.set(e,i)}return this.kindEmitters.get(e)}}const pe=new Yo,Qo=async t=>{var i,s;const e=await((i=pe.appClasses.get(t))==null?void 0:i());return e&&((s=e.config)==null?void 0:s.singleton)?t:`${t}-${To.v4().replace("-","").slice(0,8)}`},dt=(t,e)=>{if(!t.didRelease&&t.focusScenePath!==e)return t.focusScenePath=e,t},Ir=t=>{t.didRelease||t.release()},Yt=(t,e)=>{if(t&&t.isWritable&&t.state.sceneState.scenePath!==e){const i=e==="/"?"":e;t.setScenePath(i)}},Go=(t,e,i)=>{var s;if(t&&e){const a=(s=ut(t)[e])==null?void 0:s[i];if(a)return`${e}/${a.name}`}},gs=(t,e,i)=>{t&&t.scenePathType(e)!==M.ScenePathType.None&&t.removeScenes(e,i)},qo=(t,e)=>{P.once(t).then(e)};C.debounce((t,e)=>{t.emit("mainViewModeChange",e)},200);const Jo=(t,e,i=0)=>{const s=ut(t)[e];if(!s)return;const r=s[i];if(!r)return;const a=r.name;return e===we?`/${a}`:`${e}/${a}`},ut=t=>t.entireScenes(),vt=(t,e,i,s)=>t==null?void 0:t.putScenes(e,i,s),Xo=t=>t.startsWith("/"),Ji=t=>{const e=t.split("/");e.pop();let i=e.join("/");return i===""&&(i="/"),i},Ko=t=>t.endsWith("/")?t.slice(0,-1):t,_r=t=>{const e=t.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(e)},Mi=t=>new Promise(e=>setTimeout(e,t)),el=t=>t.split("").reduce((i,s)=>(s===we&&(i+=1),i),0)===1;class tl{constructor(e){this.saveCamera=e,this.setRect=i=>{this.rect=i,this.remoteCamera&&this.remoteSize&&this.onRemoteUpdate(this.remoteCamera,this.remoteSize)},this.onRemoteUpdate=C.throttle((i,s)=>{if(this.remoteCamera=i,this.remoteSize=s,this.remoteSize&&this.rect){const a={scale:i.scale*Ei(s,this.rect)};i.centerX!==null&&(a.centerX=i.centerX),i.centerY!==null&&(a.centerY=i.centerY),this.moveCamera(a)}},10)}setView(e){this.view=e}onRemoteSizeUpdate(e){var s;this.remoteSize=e;const i=!C.isEqual(C.pick(this.rect,["width","height"]),C.pick(e,["width","height"]));if(this.rect&&this.remoteCamera&&i){if(!this.view)return;const r=this.view.camera;(s=this.view)==null||s.moveCameraToContain({width:e.width,height:e.height,originX:r.centerX-e.width/2,originY:r.centerY-e.height/2})}}onLocalCameraUpdate(e){this.saveCamera(e),this.remoteCamera=e}moveCamera(e){var i;(i=this.view)==null||i.moveCamera(oe(j({},e),{animationMode:M.AnimationMode.Immediately}))}}const Ei=(t,e)=>{const i=e.width/t.width,s=e.height/t.height;return Math.min(i,s)};class il{constructor(e){this.manager=e,this.displayer=this.manager.displayer,this.mainMagixEventListener=i=>{if(i.authorId!==this.displayer.observerId){const s=i.payload;switch(s.eventName){case Y.AppMove:{this.appMoveHandler(s.payload);break}case Y.AppResize:{this.appResizeHandler(s.payload);break}case Y.AppBoxStateChange:{this.boxStateChangeHandler(s.payload);break}case Y.SetMainViewScenePath:{this.setMainViewScenePathHandler(s.payload);break}case Y.CursorMove:{this.cursorMoveHandler(s.payload);break}case Y.RootDirRemoved:{this.rootDirRemovedHandler();break}case Y.Refresh:{this.refreshHandler();break}case Y.InitMainViewCamera:{this.initMainViewCameraHandler();break}case Y.SetAppFocusIndex:{this.setAppFocusViewIndexHandler(s.payload);break}case Y.InvokeAttributesUpdateCallback:{this.manager.attributesUpdateCallback(this.manager.attributes.apps);break}case Y.MoveCamera:{this.moveCameraHandler(s.payload);break}case Y.MoveCameraToContain:{this.moveCameraToContainHandler(s.payload);break}}}},this.appMoveHandler=i=>{var s;(s=this.boxManager)==null||s.moveBox(i)},this.appResizeHandler=i=>{var s,r;(s=this.boxManager)==null||s.resizeBox(Object.assign(i,{skipUpdate:!0})),(r=this.manager.room)==null||r.refreshViewSize()},this.boxStateChangeHandler=i=>{Q.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{dt(this.manager.mainView,i),Q.emit("mainViewScenePathChange",i)},this.cursorMoveHandler=i=>{P.emit("cursorMove",i)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),P.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 s=this.manager.appProxies.get(i.appID);s&&s.setSceneIndexWithoutSync(i.index)}},this.moveCameraHandler=i=>{var r;const s=i;if(i.scale){const a=this.manager.mainViewProxy.size$.value,n=(r=this.manager.boxManager)==null?void 0:r.stageRect;a&&n&&(s.scale=i.scale*Ei(a,n))}this.manager.mainView.moveCamera(s)},this.moveCameraToContainHandler=i=>{this.manager.mainView.moveCameraToContain(i)}}get boxManager(){return this.manager.boxManager}addListeners(){this.displayer.addMagixEventListener(us,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(us,this.mainMagixEventListener)}}class fa extends Error{constructor(){super(...arguments);this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class sl extends Error{constructor(e){super(`[WindowManager]: app ${e} need register or provide src`)}}class de extends Error{constructor(){super(...arguments);this.message="[WindowManager]: AppManager must be initialized"}}class ba extends Error{constructor(e){super(`[WindowManager]: white-web-sdk version must large than ${e}`)}}class ya extends Error{constructor(){super(...arguments);this.message="[WindowManager]: kind must be a valid string"}}class wa extends Error{constructor(){super(...arguments);this.message="[WindowManager]: box need created"}}class va extends Error{constructor(){super(...arguments);this.message='[WindowManager]: ScenePath should start with "/"'}}class Vs extends Error{constructor(){super(...arguments);this.message="[WindowManager]: boxManager need initialize"}}class xa extends Error{constructor(){super(...arguments);this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const Ma=t=>(e,i)=>{if(e!==void 0)if(M.listenUpdated){const s=r=>{r.map(n=>n.kind).includes(t)&&i()};return M.listenUpdated(e,s),i(),()=>M.unlistenUpdated(e,s)}else return M.reaction(()=>e,()=>{i()},{fireImmediately:!0})},Sa=(t,e,i)=>{let s=null;const r=M.reaction(t,()=>{s&&(s(),s=null);const a=t();C.isObject(a)?(s=()=>M.unlistenUpdated(a,e),M.listenUpdated(a,e)):i==null||i(a)},{fireImmediately:!0});return()=>{s==null||s(),r()}},rl=Ma(M.UpdateEventKind.Removed);Ma(M.UpdateEventKind.Inserted);const Xi=Object.keys;function Ar(t){return Boolean(C.has(t,"__isRef"))}function al(t){return{k:ve.genUID(),v:t,__isRef:!0}}class nl{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 Te="_WM-STORAGE_";class kr{constructor(e,i,s){if(this._sideEffect=new ve.SideEffectManager,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new nl,s&&!C.isObject(s))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.isWritable&&(this.id===null?e.isAddApp&&s&&this.setState(s):(r===this._state||!C.isObject(r))&&(C.get(this._context.getAttributes(),[Te])||this._context.updateAttributes([Te],{}),this._context.updateAttributes([Te,this.id],this._state),s&&this.setState(s))),Xi(r).forEach(a=>{if(!(this.id===null&&a===Te))try{const n=C.isObject(r[a])?JSON.parse(JSON.stringify(r[a])):r[a];Ar(n)?(this._state[a]=n.v,C.isObject(n.v)&&this._refMap.set(n.v,n)):this._state[a]=n}catch(n){console.error(n)}}),this._sideEffect.addDisposer(Sa(()=>this.id===null?e.getAttributes():C.get(e.getAttributes(),[Te,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(Xi(e).reduce((i,s)=>(C.has(this._state,s)||(i[s]=e[s]),i),{}))}setState(e){if(this._destroyed){console.error(new Error(`Cannot call setState on destroyed Storage "${this.id}".`));return}if(!this._context.isWritable){console.error(new Error(`Cannot setState on Storage "${this.id}" without writable access`),e);return}const i=Xi(e);i.length>0&&i.forEach(s=>{const r=e[s];if(r!==this._state[s])if(r===void 0)this._lastValue.set(s,this._state[s]),delete this._state[s],this._setRawState(s,r);else{this._lastValue.set(s,this._state[s]),this._state[s]=r;let a=r;if(C.isObject(r)){let n=this._refMap.get(r);n||(n=al(r),this._refMap.set(r,n)),a=n}this._setRawState(s,a)}})}emptyStorage(){if(!(C.size(this._state)<=0)){if(this._destroyed){console.error(new Error(`Cannot empty destroyed Storage "${this.id}".`));return}if(!this._context.isWritable){console.error(new Error(`Cannot empty Storage "${this.id}" without writable access.`));return}this.setState(C.mapValues(this._state,C.noop))}}deleteStorage(){if(this.id===null)throw new Error("Cannot delete main Storage");if(!this._context.isWritable){console.error(new Error(`Cannot delete Storage "${this.id}" without writable access.`));return}this.destroy(),this._context.updateAttributes([Te,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:C.get(this._context.getAttributes(),[Te,this.id],e)}_setRawState(e,i){if(this.id===null){if(e===Te)throw new Error(`Cannot set attribute internal filed "${Te}"`);return this._context.updateAttributes([e],i)}else return this._context.updateAttributes([Te,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 s={};for(let r=0;r<e.length;r++)try{const a=e[r],n=a.key;if(this.id===null&&n===Te)continue;const o=C.isObject(a.value)?JSON.parse(JSON.stringify(a.value)):a.value;let c;switch(this._lastValue.has(n)&&(c=this._lastValue.get(n),this._lastValue.delete(n)),a.kind){case 2:{C.has(this._state,n)&&(c=this._state[n],delete this._state[n]),s[n]={oldValue:c};break}default:{let l=o;if(Ar(o)){const{k:d,v:u}=o,p=this._state[n];C.isObject(p)&&((i=this._refMap.get(p))==null?void 0:i.k)===d?l=p:(l=u,C.isObject(u)&&this._refMap.set(u,o))}l!==this._state[n]&&(c=this._state[n],this._state[n]=l),s[n]={newValue:l,oldValue:c};break}}}catch(a){console.error(a)}this.onStateChanged.dispatch(s)}}}class ol{constructor(e,i,s,r){this.view=e,this.appContext=i,this.appProxy=s,this.ensureSize=r,this.nextPage=async()=>{const l=this.pageState.index+1;return this.jumpPage(l)},this.prevPage=async()=>{const l=this.pageState.index-1;return this.jumpPage(l)},this.jumpPage=async l=>l<0||l>=this.pageState.length?(console.warn(`[WindowManager]: index ${l} out of range`),!1):(this.appProxy.setSceneIndex(l),!0),this.addPage=async l=>{const d=l==null?void 0:l.after,u=l==null?void 0:l.scene,p=this.appProxy.scenePath;if(!!p)if(d){const m=this.pageState.index+1;vt(this.appContext.room,p,[u||{}],m)}else vt(this.appContext.room,p,[u||{}])},this.removePage=async l=>{const d=l===void 0?this.pageState.index:l;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):d<0||d>=this.pageState.length?(console.warn(`[WindowManager]: page index ${l} out of range`),!1):this.appProxy.removeSceneByIndex(d)};const a=new w.Val(s.pageState),n=new w.Val(s.size$.value),o=l=>C.pick(l,["centerX","centerY","scale"]),c=new w.Val(o(this.view.camera));this.baseRect$=n,this.pageState$=a,this.baseCamera$=c,this.appProxy.sideEffectManager.add(()=>[s.appEmitter.on("pageStateChange",l=>a.setValue(l)),s.camera$.subscribe(l=>{l&&c.setValue(o(l))}),s.size$.subscribe(l=>{l&&n.setValue(C.pick(l,["width","height"]))})]),e.disableCameraTransform=!0}get pageState(){return this.pageState$.value}moveCamera(e){this.appProxy.moveCamera(e)}setBaseRect(e){this.appProxy.updateSize(e.width,e.height)}}const Je=(...t)=>{ce.debug&&console.log("[WindowManager]:",...t)},ll=(t,e)=>{const i=document.createElement("div");i.className="netless-window-manager-playground";const s=document.createElement("div");return s.className="netless-window-manager-main-view",e.appendChild(s),t.appendChild(i),{playground:i,mainViewElement:s}},cl=()=>{if(_r(M.WhiteVersion)<_r(xr))throw new ba(xr)},Ca=(t,e)=>{const i=t==null?void 0:t.state.roomMembers;return i==null?void 0:i.find(s=>{var r;return((r=s.payload)==null?void 0:r.uid)===e})},Tr=t=>t.map(e=>{var i;return j({uid:((i=e.payload)==null?void 0:i.uid)||""},M.toJS(e))}),Nr=async t=>{try{return await t.createInvisiblePlugin(ce,{})}catch(e){if(e.message==='invisible plugin "WindowManager" exits')return await Mi(200),t.getInvisiblePlugin(ce.kind);Je("createInvisiblePlugin failed",e)}};class hl{constructor(e,i,s,r){this.manager=e,this.appId=i,this.appProxy=s,this.appOptions=r,this.mobxUtils={autorun:M.autorun,reaction:M.reaction,toJS:M.toJS},this.objectUtils={listenUpdated:M.listenUpdated,unlistenUpdated:M.unlistenUpdated,listenDisposed:M.listenDisposed,unlistenDisposed:M.unlistenDisposed},this.store=this.manager.store,this.isReplay=this.manager.isReplay,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.createWhiteBoardView=a=>{if(this.whiteBoardView)return this.whiteBoardView;let n=this.view;n||(n=this.appProxy.createAppDir()),a&&C.isBoolean(a.syncCamera)&&this.appProxy.syncCamera$.setValue(a.syncCamera);const o=document.createElement("div");return this._viewWrapper=o,o.className="window-manager-view-wrapper",this.box.$main.appendChild(o),n.divElement=o,this.appProxy.fireMemberStateChange(),this.isAddApp&&this.ensurePageSize(a==null?void 0:a.size),this.whiteBoardView=new ol(n,this,this.appProxy,this.ensurePageSize),this.appProxy.sideEffectManager.add(()=>[this.box._stageRect$.subscribe(c=>{o.style.left=`${c.x}px`,o.style.top=`${c.y}px`,o.style.width=`${c.width}px`,o.style.height=`${c.height}px`}),()=>()=>{this.whiteBoardView=void 0}]),this.appProxy.whiteBoardViewCreated$.setValue(!0),this.whiteBoardView},this.ensurePageSize=a=>{var c;if(!C.isNumber(a)||!this.appProxy.scenePath||this.appProxy.pageState.length>=a)return;if(a<=0||a>=Mr)throw Error(`[WindowManager]: size ${a} muse be in range [1, ${Mr}]`);const n=a-this.appProxy.pageState.length,o=new Array(n).fill({});(c=this.room)==null||c.putScenes(this.appProxy.scenePath,o)},this.getInitScenePath=()=>this.appProxy.scenePath,this.setAttributes=a=>{this.manager.safeSetAttributes({[this.appId]:a})},this.updateAttributes=(a,n)=>{this.manager.attributes[this.appId]&&this.manager.safeUpdateAttributes([this.appId,...a],n)},this.setScenePath=async a=>{var n;!this.appProxy.box||(this.appProxy.setFullPath(a),(n=this.room)==null||n.setScenePath(a))},this.getAppOptions=()=>typeof this.appOptions=="function"?this.appOptions():this.appOptions,this.createStorage=(a,n)=>{const o=new kr(this,a,n);return this.emitter.on("destroy",()=>{o.destroy()}),o},this.dispatchMagixEvent=(...a)=>{var o;const n=`${this.appId}:${a[0]}`;return(o=this.manager.room)==null?void 0:o.dispatchMagixEvent(n,a[1])},this.addMagixEventListener=(a,n,o)=>{const c=`${this.appId}:${a}`;return this.manager.displayer.addMagixEventListener(c,n,o),()=>this.manager.displayer.removeMagixEventListener(c,n)},this.removeMagixEventListener=this.manager.displayer.removeMagixEventListener.bind(this.manager.displayer),this.emitter=s.appEmitter,this.isAddApp=s.isAddApp}get displayer(){return this.manager.displayer}get destroyed(){return this.appProxy.status==="destroyed"}get view(){return this.appProxy.view}get now(){if(this.isReplay){const e=this.displayer;return e.beginTimestamp+e.progressTime}else return this.displayer.calibrationTimestamp}get isWritable(){return this.manager.canOperate&&!this.destroyed}get box(){const e=this.appProxy.box$.value;if(e)return e;throw new wa}get room(){return this.manager.room}get members(){return this.manager.members$.value}get currentMember(){const e=Ca(this.room,this.manager.uid);if(!e)throw new Error(`Member ${this.manager.uid} not found.`);return j({uid:this.manager.uid},e)}get storage(){return this._storage||(this._storage=new kr(this)),this._storage}}class dl{constructor(e){this.params=e,this.sceneNode=null,this.createSceneNode=r=>(this.scenePath=r,this.sceneNode&&this.sceneNode.dispose(),this.sceneNode=this.params.displayer.createScenesCallback(r,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}),this.sceneNode),this.onSceneChange=()=>{this.params.notifyPageStateChange()};const{displayer:i,scenePath:s}=this.params;this.view=this.params.view,s&&(this.scenePath=s,this.sceneNode=i.createScenesCallback(s,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}setView(e){this.view=e}getFullPath(e){var s;const i=(s=this.sceneNode)==null?void 0:s.scenes;if(this.scenePath&&i){const r=i[e];if(r)return`${this.scenePath}/${r}`}}toObject(){var e,i;return{index:((e=this.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()}}class Ia{constructor(e){this.context=e,this.sem=new ve.SideEffectManager,this.bindView=s=>{!s||(this.synchronizer.setView(s),this.sem.flush("view"),this.sem.add(()=>(s.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),()=>s.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice)),"view"))},this.onCameraUpdatedByDevice=s=>{if(!!s&&this.context.size$.value&&this.context.stageRect$.value){const r=Ei(this.context.size$.value,this.context.stageRect$.value),a=s.scale/r;this.synchronizer.onLocalCameraUpdate(oe(j({},s),{scale:a,id:this.context.uid}))}},this.synchronizer=new tl(s=>{this.context.camera$.setValue(s,!0),!(this.context.viewMode$&&this.context.viewMode$.value===M.ViewMode.Freedom)&&this.context.storeCamera(s)}),this.bindView(this.context.view$.value),this.sem.add(()=>[this.context.view$.subscribe(s=>{const r=this.context.camera$.value;r&&this.context.size$.value&&(s==null||s.moveCamera({scale:1,animationMode:M.AnimationMode.Immediately}),this.synchronizer.onRemoteUpdate(r,this.context.size$.value)),this.bindView(s)}),this.context.camera$.subscribe((s,r)=>{const a=this.context.size$.value;s&&a&&!r&&this.synchronizer.onRemoteUpdate(s,a)}),this.context.size$.subscribe(s=>{s&&this.synchronizer.onRemoteSizeUpdate(s)}),this.context.stageRect$.subscribe(s=>{s&&this.synchronizer.setRect(s)})]);const i=w.combine([this.context.camera$,this.context.size$]);i.reaction(([s,r])=>{s&&r&&(this.synchronizer.onRemoteUpdate(s,r),i.destroy())})}destroy(){this.sem.flushAll()}}const Ue=new rt.default,$s=(t,e)=>{let i=0;const s=e.length-1;return t===e.index?t===s?i=t-1:i=e.index+1:i=e.index,i};var ee=(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.Camera="camera",t.Size="size",t))(ee||{});class ul{constructor(e){this.context=e,this.setAppFocus=(i,s)=>{s?this.context.safeSetAttributes({focus:i}):this.context.safeSetAttributes({focus:void 0})}}setContext(e){this.context=e}get attributes(){return this.context.getAttributes()}apps(){return C.get(this.attributes,["apps"])}get focus(){return C.get(this.attributes,["focus"])}getAppAttributes(e){return C.get(this.apps(),[e])}getAppState(e){return C.get(this.apps(),[e,"state"])}getMaximized(){return C.get(this.attributes,["maximized"])}getMinimized(){return C.get(this.attributes,["minimized"])}setupAppAttributes(e,i,s){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const a=["scenePath","title"];s||a.push("scenes");const n=C.pick(e.options,a),o={kind:e.kind,options:n,isDynamicPPT:s,setup:!1};typeof e.src=="string"&&(o.src=e.src),o.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",i],o),this.context.safeUpdateAttributes(["apps",i,"state"],{[Ee.Size]:{},[Ee.Position]:{},[Ee.SceneIndex]:0})}updateAppState(e,i,s){C.get(this.attributes,["apps",e,"state"])&&this.context.safeUpdateAttributes(["apps",e,"state",i],s)}updateAppAttributes(e,i,s){this.context.safeUpdateAttributes(["apps",e,i],s)}cleanAppAttributes(e){this.context.safeUpdateAttributes(["apps",e],void 0),this.context.safeSetAttributes({[e]:void 0}),this.attributes.focus===e&&this.cleanFocus()}cleanFocus(){this.context.safeSetAttributes({focus:void 0})}getAppSceneIndex(e){var i;return(i=this.getAppState(e))==null?void 0:i[Ee.SceneIndex]}getAppScenePath(e){var i,s;return(s=(i=this.getAppAttributes(e))==null?void 0:i.options)==null?void 0:s.scenePath}getMainViewScenePath(){return this.attributes._mainScenePath}getMainViewSceneIndex(){return this.attributes._mainSceneIndex}getBoxState(){return this.attributes.boxState}setMainViewScenePath(e){this.context.safeSetAttributes({_mainScenePath:e})}setMainViewSceneIndex(e){this.context.safeSetAttributes({_mainSceneIndex:e})}getMainViewCamera(){return C.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return C.get(this.attributes,["mainViewSize"])}setMainViewCamera(e){this.context.safeSetAttributes({mainViewCamera:j({},e)})}setMainViewSize(e){this.context.safeSetAttributes({mainViewSize:j({},e)})}setMainViewCameraAndSize(e,i){this.context.safeSetAttributes({mainViewCamera:j({},e),mainViewSize:j({},i)})}updateCursor(e,i){C.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),C.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],i)}updateCursorState(e,i){C.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],i)}getCursorState(e){return C.get(this.attributes,["cursors",e,"cursorState"])}cleanCursor(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}setMainViewFocusPath(e){const i=this.getMainViewScenePath();i&&dt(e,i)}}const pl=new ul({getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}});class js{constructor(e,i,s,r){var a;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.uid=this.manager.uid,this.status="normal",this.sideEffectManager=new ve.SideEffectManager,this.valManager=new w.ValManager,this.fullPath$=this.valManager.attach(new w.Val(void 0)),this.camera$=this.valManager.attach(new w.Val(void 0)),this.size$=this.valManager.attach(new w.Val(void 0)),this.box$=this.valManager.attach(new w.Val(void 0)),this.view$=this.valManager.attach(new w.Val(void 0)),this.syncCamera$=this.valManager.attach(new w.Val(!0)),this.whiteBoardViewCreated$=this.valManager.attach(new w.Val(!1)),this.fireMemberStateChange=()=>{this.manager.room&&this.onMemberStateChange(this.manager.room.state.memberState)},this.onMemberStateChange=n=>{var c,l;n.currentApplianceName==="clicker"?(c=this.appContext)!=null&&c._viewWrapper&&(this.appContext._viewWrapper.style.pointerEvents="none"):(l=this.appContext)!=null&&l._viewWrapper&&(this.appContext._viewWrapper.style.pointerEvents="auto")},this.computedInitialRect=n=>{var c;const o=(c=this.manager.boxManager)==null?void 0:c.stageRect;if(o){const{width:l,height:d}=o,u=n.height/n.width;return d<480?{width:480/u,height:480}:{width:l*.65,height:d*.65}}},this.getAppInitState=n=>{var m,g;const o=this.store.getAppState(n);if(!o)return;const c=this.store.focus,l=(m=this.attributes)==null?void 0:m.maximized,d=(g=this.attributes)==null?void 0:g.minimized;let u={maximized:l,minimized:d,id:n};const p=C.omitBy(o,C.isUndefined);return c===n&&(u=oe(j({},u),{focus:!0})),Object.assign(u,p)},this.appAttributesUpdateListener=n=>{this.sideEffectManager.add(()=>[this.manager.refresher.add(n,()=>M.autorun(()=>{const o=this.manager.attributes[n];o&&this.appEmitter.emit("attributesUpdate",o)})),this.manager.refresher.add(this.stateKey,()=>M.autorun(()=>{var c,l,d;const o=(c=this.appAttributes)==null?void 0:c.state;(o==null?void 0:o.zIndex)>0&&o.zIndex!==((l=this.box)==null?void 0:l.zIndex)&&((d=this.boxManager)==null||d.setZIndex(n,o.zIndex))})),this.manager.refresher.add(`${n}-fullPath`,()=>M.autorun(()=>{var c;const o=(c=this.appAttributes)==null?void 0:c.fullPath;this.setFocusScenePathHandler(o),this.fullPath$.value!==o&&(this.notifyPageStateChange(),this.fullPath$.setValue(o))}))])},this.setFocusScenePathHandler=C.debounce(n=>{var o;this.view&&n&&n!==((o=this.view)==null?void 0:o.focusScenePath)&&dt(this.view,n)},50),this.notifyPageStateChange=C.debounce(()=>{this.pageState&&this.appEmitter.emit("pageStateChange",this.pageState)},50),this.storeCamera=n=>{this.store.updateAppAttributes(this.id,ee.Camera,n)},this.storeSize=n=>{this.store.updateAppAttributes(this.id,ee.Size,n)},this.updateSize=(n,o)=>{const c={id:this.manager.uid,width:n,height:o};this.store.updateAppAttributes(this.id,ee.Size,c),this.size$.setValue(c)},this.moveCamera=n=>{if(!this.camera$.value)return;const o=oe(j(j({},this.camera$.value),n),{id:this.uid});this.storeCamera(o),this.camera$.setValue(o)},this.addCameraReaction=()=>{this.sideEffectManager.add(()=>this.manager.refresher.add(`${this.id}-camera`,()=>M.reaction(()=>{var n;return(n=this.appAttributes)==null?void 0:n.camera},n=>{if(n){const o=M.toJS(n);C.isEqual(o,this.camera$.value)||this.camera$.setValue(o)}})),"camera")},this.addSizeReaction=()=>{this.sideEffectManager.add(()=>this.manager.refresher.add(`${this.id}-size`,()=>M.reaction(()=>{var n;return(n=this.appAttributes)==null?void 0:n.size},n=>{if(n){const o=M.toJS(n);C.isEqual(o,this.size$.value)||this.size$.setValue(o)}})),"size")},this.onFocus=()=>{this.setScenePath()},this.setupDone=()=>{this.store.updateAppAttributes(this.id,"setup",!0),this.manager.dispatchInternalEvent(Y.InvokeAttributesUpdateCallback)},this.kind=e.kind,this.id=s,this.appScenePath=`/${this.id}-app-dir`,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new rt.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=r,this.initScenes(),(a=this.params.options)!=null&&a.scenePath&&this.createView(),this.scenePath||(this.scenePath=this.appScenePath),this._pageState=new dl({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange}),this.sideEffectManager.add(()=>()=>this._pageState.destroy()),this.camera$.setValue(M.toJS(this.appAttributes.camera)),this.size$.setValue(M.toJS(this.appAttributes.size)),this.addCameraReaction(),this.addSizeReaction(),this.sideEffectManager.add(()=>P.on("memberStateChange",this.onMemberStateChange)),this.sideEffectManager.add(()=>[this.syncCamera$.reaction(n=>{n||this.viewSync&&(this.viewSync.destroy(),this.viewSync=void 0,this.sideEffectManager.flush("camera"),this.sideEffectManager.flush("size"))}),this.whiteBoardViewCreated$.reaction(n=>{if(n&&this.box){if(!this.syncCamera$.value)return;w.combine([this.box$,this.view$]).subscribe(([o,c])=>{if(o&&c){if(this.camera$.value||(this.storeCamera({centerX:null,centerY:null,scale:1,id:this.uid}),this.camera$.setValue(M.toJS(this.appAttributes.camera))),!this.size$.value&&o.stageRect){const l=this.computedInitialRect(o.stageRect),d=(l==null?void 0:l.width)||o.stageRect.width,u=(l==null?void 0:l.height)||o.stageRect.height;this.storeSize({id:this.uid,width:d,height:u}),this.size$.setValue(M.toJS(this.appAttributes.size))}this.viewSync=new Ia({uid:this.uid,view$:this.view$,camera$:this.camera$,size$:this.size$,stageRect$:o._stageRect$,storeCamera:this.storeCamera,storeSize:this.storeSize}),this.sideEffectManager.add(()=>()=>{var l;return(l=this.viewSync)==null?void 0:l.destroy()}),this.whiteBoardViewCreated$.destroy()}})}}),this.manager.members$.reaction(n=>{this.appEmitter.emit("roomMembersChange",n)})])}createAppDir(){const e=this.scenePath||this.appScenePath;this._pageState.createSceneNode(e)||(vt(this.manager.room,e,[{name:"1"}]),this._pageState.createSceneNode(e),this.setSceneIndex(0)),this.scenes=ut(this.manager.displayer)[e];const s=this.createView();return this._pageState.setView(s),s}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=ut(this.manager.displayer)[this.scenePath]:this.scenes=e.scenes)}get view(){return this.view$.value}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 C.get(this.appAttributes,[ee.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const e=C.get(this.appAttributes,["state","SceneIndex"],0),i=Go(this.manager.room,this.scenePath,e);return i&&this.setFullPath(i),i}setFullPath(e){this.store.updateAppAttributes(this.id,ee.FullPath,e)}async baseInsertApp(e=!1){var a;const i=this.params;if(!i.kind)throw new Error("[WindowManager]: kind require");const s=await((a=pe.appClasses.get(i.kind))==null?void 0:a()),r=pe.registered.get(i.kind);if(s)await this.setupApp(this.id,e,s,i.options,r==null?void 0:r.appOptions);else throw new Error(`[WindowManager]: app load failed ${i.kind} ${i.src}`);return P.emit("updateManagerRect"),{appId:this.id,app:s}}get box(){return this.box$.value}async setupApp(e,i,s,r,a){var o;if(Je("setupApp",e,s,r),!this.boxManager)throw new Vs;const n=new hl(this.manager,e,this,a);this.appContext=n;try{P.once(`${e}${Y.WindowCreated}`).then(async()=>{var u;let d;i||(d=this.getAppInitState(e),(u=this.boxManager)==null||u.updateBoxState(d)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(e),this.setViewFocusScenePath(),setTimeout(async()=>{const p=await s.setup(n);this.appResult=p,pe.notifyApp(this.kind,"created",{appId:e,result:p}),this.fixMobileSize(),this.isAddApp&&this.setupDone()},ma)});const c=(o=this.boxManager)==null?void 0:o.createBox({appId:e,app:s,options:r,canOperate:this.manager.canOperate,smartPosition:this.isAddApp}),l=pe.registered.get(this.kind);l!=null&&l.contentStyles&&(c==null||c.mountUserStyles(l.contentStyles)),this.box$.setValue(c),this.isAddApp&&this.box&&(this.store.updateAppState(e,Ee.ZIndex,this.box.zIndex),this.store.updateAppState(e,Ee.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,s;const e=(i=this.boxManager)==null?void 0:i.getBox(this.id);e&&(e.minimized||(s=this.boxManager)==null||s.resizeBox({appId:this.id,width:e.intrinsicWidth+.001,height:e.intrinsicHeight+.001,skipUpdate:!0}))}async onSeek(e){var s;this.appEmitter.emit("seek",e).catch(r=>{console.log(`[WindowManager]: emit seek error: ${r.message}`)});const i=this.getAppInitState(this.id);(s=this.boxManager)==null||s.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 s=this.params;await new js(s,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,s=this._pageState.getFullPath(i);s||(i=0,s=this._pageState.getFullPath(i)),s&&this.setFullPath(s),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,s)=>{var r,a,n,o;if(!!this.manager.canOperate)switch(i){case"setBoxSize":{(r=this.boxManager)==null||r.resizeBox({appId:e,width:s.width,height:s.height,skipUpdate:!1});break}case"setBoxMinSize":{(a=this.boxManager)==null||a.setBoxMinSize({appId:e,minWidth:s.minwidth,minHeight:s.minheight});break}case"setBoxTitle":{(n=this.boxManager)==null||n.setBoxTitle({appId:e,title:s.title});break}case ua.destroy:{if(this.status==="destroyed")return;this.destroy(!0,!1,!0,s==null?void 0:s.error),s!=null&&s.error&&console.error(s==null?void 0:s.error);break}case"focus":{(o=this.boxManager)==null||o.focusBox({appId:this.id}),Ue.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const e=this.getFullScenePath();this.manager.room&&e&&this.view&&Yt(this.manager.room,e)}setViewFocusScenePath(){if(this.status==="destroyed")return;const e=this.getFullScenePath();return e&&this.view&&dt(this.view,e),e}createView(){const e=this.viewManager.createView(this.id);return this.view$.setValue(e),this.setViewFocusScenePath(),e}get pageState(){return this._pageState.toObject()}async removeSceneByIndex(e){const i=this._pageState.getFullPath(e);if(i&&this.pageState){const s=$s(e,this.pageState);return this.setSceneIndexWithoutSync(s),this.manager.dispatchInternalEvent(Y.SetAppFocusIndex,{type:"app",appID:this.id,index:s}),setTimeout(()=>{gs(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),Yt(this.manager.room,i))}}async destroy(e,i,s,r){var a;if(this.status!=="destroyed"){this.status="destroyed";try{await pe.notifyApp(this.kind,"destroy",{appId:this.id}),Q.emit("appClose",{appId:this.id,kind:this.kind,error:r}),await this.appEmitter.emit("destroy",{error:r})}catch(n){console.error("[WindowManager]: notifyApp error",n.message,n.stack)}this.appEmitter.clearListeners(),this.sideEffectManager.flushAll(),P.emit(`destroy-${this.id}`,{error:r}),e&&((a=this.boxManager)==null||a.closeBox(this.id,s)),i&&(this.store.cleanAppAttributes(this.id),this.scenePath&&gs(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),this.valManager.destroy()}}close(){return this.destroy(!0,!0,!1)}}class gl{constructor(e){this.displayer=e,this.views=new Map}createView(e){const i=_a(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 s=this.views.get(e);s&&(s.focusScenePath=i)}destroy(){this.views.forEach(e=>{try{e.release()}catch{}}),this.views.clear()}}const _a=t=>{const e=t.views.createView();return ml(e),e},ml=t=>{t.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class fl{constructor(e){this.manager=e,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.sideEffectManager=new ve.SideEffectManager,this.camera$=new w.Val(void 0),this.size$=new w.Val(void 0),this.view$=new w.Val(void 0),this.createViewSync=()=>{var i;this.manager.boxManager&&!this.viewSync&&(this.viewSync=new Ia({uid:this.manager.uid,view$:this.view$,camera$:this.camera$,size$:this.size$,stageRect$:(i=this.manager.boxManager)==null?void 0:i.stageRect$,viewMode$:this.manager.windowManger.viewMode$,storeCamera:this.storeCamera,storeSize:this.storeSize}))},this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>P.on("writableChange",i=>{i&&this.ensureCameraAndSize()}))},this.addCameraReaction=()=>{this.manager.refresher.add(ee.MainViewCamera,this.cameraReaction),this.manager.refresher.add(ee.MainViewSize,this.sizeReaction)},this.storeCurrentCamera=()=>{const i=this.view.camera;this.storeCamera(j({id:this.manager.uid},i))},this.storeCurrentSize=()=>{var s;const i=(s=this.manager.boxManager)==null?void 0:s.stageRect;i&&this.storeSize({id:this.manager.uid,width:i.width,height:i.height})},this.storeCamera=i=>{this.store.setMainViewCamera(i)},this.storeSize=i=>{this.store.setMainViewSize(i)},this.cameraReaction=()=>M.reaction(()=>this.mainViewCamera,i=>{if(i){const s=M.toJS(i);C.isEqual(s,this.camera$.value)||this.camera$.setValue(s)}},{fireImmediately:!0}),this.sizeReaction=()=>M.reaction(()=>this.mainViewSize,i=>{if(i){const s=M.toJS(i);C.isEqual(s,this.size$.value)||this.size$.setValue(s)}},{fireImmediately:!0}),this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=C.debounce(i=>{this.store.setMainViewSize(oe(j({},i),{id:this.manager.uid}))},50),this.onCameraOrSizeUpdated=()=>{Q.emit("cameraStateChange",this.cameraState)},this.mainView=this.createMainView(),P.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()}),this.sideEffectManager.add(()=>[P.on("startReconnect",()=>{Ir(this.mainView)})]),this.createViewSync(),this.sideEffectManager.add(()=>P.on("focusedChange",({focused:i})=>{if(i===void 0){const s=this.store.getMainViewScenePath();s&&Yt(this.manager.room,s)}})),this.camera$.reaction(i=>{i&&Q.emit("baseCameraChange",i)}),this.size$.reaction(i=>{i&&Q.emit("baseSizeChange",i)})}ensureCameraAndSize(){var e;if(!this.mainViewCamera||!this.mainViewSize){this.manager.dispatchInternalEvent(Y.InitMainViewCamera),this.storeCamera(j({id:this.manager.uid},this.view.camera));const i=(e=this.manager.boxManager)==null?void 0:e.stageRect;i&&!this.mainViewSize&&this.storeSize({id:this.manager.uid,width:i.width,height:i.height})}}get mainViewCamera(){return this.store.getMainViewCamera()}get mainViewSize(){return this.store.getMainViewSize()}get didRelease(){return C.get(this.view,["didRelease"])}start(){this.started||(this.addCameraListener(),this.addCameraReaction(),this.started=!0)}get view(){return this.mainView}get cameraState(){return j(j({},this.view.camera),this.view.size)}createMainView(){const e=_a(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&dt(e,i),this.view$.setValue(e),e}onReconnect(){if(this.didRelease)this.rebind();else{const e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}setFocusScenePath(e){if(e)return dt(this.view,e)}rebind(){const e=this.mainView.divElement,i=this.mainView.disableCameraTransform,s=j({},this.mainView.camera);this.stop(),Ir(this.mainView),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=i,this.mainView.divElement=e,this.mainView.moveCamera(oe(j({},s),{animationMode:M.AnimationMode.Immediately})),this.addMainViewListener(),this.start()}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("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}removeCameraListener(){this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}stop(){this.removeCameraListener(),this.manager.refresher.remove(ee.MainViewCamera),this.manager.refresher.remove(ee.MainViewSize),this.started=!1}destroy(){this.camera$.destroy(),this.size$.destroy(),this.view$.destroy(),this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class bl{constructor(e){this.context=e,this.addRedoUndoListeners=i=>{if(i===void 0)this.addViewCallbacks(this.context.mainView(),this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate);else{const s=this.context.getAppProxy(i);s&&s.view&&this.addViewCallbacks(s.view,this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate)}},this.addViewCallbacks=(i,s,r)=>{s(i.canRedoSteps),r(i.canUndoSteps),i.callbacks.on("onCanRedoStepsUpdate",s),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 s;if(i===void 0)s=this.context.mainView();else{const r=this.context.getAppProxy(i);r&&r.view&&(s=r.view)}s&&this.disposeViewCallbacks(s)},P.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),P.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(e.focus()),this.addRedoUndoListeners(e.focus())}),this.addRedoUndoListeners(e.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class yl{constructor(e){this.windowManger=e,this.appProxies=new Map,this.appStatus=new Map,this.store=pl,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new Do,this.sceneIndex$=new w.Val(void 0),this.focused$=new w.Val(void 0),this.members$=new w.Val([]),this.sideEffectManager=new ve.SideEffectManager,this.sceneState=null,this.rootDirRemoving=!1,this.onRemoveScenes=async i=>{var r,a;const{scenePath:s}=i;if(s===we){await this.onRootDirRemoved(),this.dispatchInternalEvent(Y.RootDirRemoved);return}if(el(s)){let n=this.mainView.focusSceneIndex||0,o=(r=this.callbacksNode)==null?void 0:r.scenes[n];o||(n=0,o=(a=this.callbacksNode)==null?void 0:a.scenes[n]),o&&await this.setMainViewScenePath(`${we}${o}`),await this.setMainViewSceneIndex(n)}else this.appProxies.forEach(n=>{n.onRemoveScene(s)})},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(s=>{s.onSeek(i)})},this.createRootDirScenesCallback=()=>{let i=!1;this.callbacksNode&&(this.callbacksNode.dispose(),i=!0),this.callbacksNode=this.displayer.createScenesCallback(we,{onAddScene:this.onSceneChange,onRemoveScene:async(s,r)=>{await this.onSceneChange(s),P.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 a;const s=$s(i,this.windowManger.pageState);this.setSceneIndexWithoutSync(s),this.dispatchInternalEvent(Y.SetAppFocusIndex,{type:"main",index:s});const r=(a=this.callbacksNode)==null?void 0:a.scenes[i];return setTimeout(()=>{r&&gs(this.room,`${we}${r}`,i)},100),new Promise((n,o)=>{P.once("rootDirSceneRemoved").then(c=>{c===r&&n(!0)}).catch(c=>{console.log(`[WindowManager]: removePage error: ${c}`),o(!1)})})},this.setSceneIndexWithoutSync=i=>{var r;const s=(r=this.callbacksNode)==null?void 0:r.scenes[i];s&&this.mainViewProxy.setFocusScenePath(`${we}${s}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([Q.emit("mainViewScenesLengthChange",i),P.emit("changePageState")]),this.updateSceneState=i=>{const s=this.store.getMainViewSceneIndex()||0;let r=i.scenes[s];r||(r=i.scenes[this.mainView.focusSceneIndex||0]),this.sceneState={scenePath:`${we}${r}`,contextPath:i.path,index:s,scenes:i.scenes.map(a=>({name:a})),sceneName:r},Q.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(Y.AppMove,i),this.store.updateAppState(i.appId,Ee.Position,{x:i.x,y:i.y})},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(Y.AppResize,i),this.store.updateAppState(i.appId,Ee.Size,{width:i.width,height:i.height}))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId})},this.onBoxClose=i=>{const s=this.appProxies.get(i.appId);s&&s.destroy(!1,!0,!0,i.error)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(Y.AppBoxStateChange,i)},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>Sa(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{var i;(i=this.refresher)==null||i.add("appsClose",()=>rl(this.attributes.apps,()=>{this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this.sceneIndex$.value!==i&&(Q.emit("mainViewSceneIndexChange",i),P.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this.sceneIndex$.setValue(i))},this.onFocusChange=i=>{var s;this.focused$.value!==i&&(Q.emit("focusedChange",i),P.emit("focusedChange",{focused:i,prev:this.focused$.value}),this.focused$.setValue(i),i!==void 0&&((s=this.boxManager)==null||s.focusBox({appId:i}),setTimeout(()=>{const r=this.appProxies.get(i);r&&(r.onFocus(),pe.notifyApp(r.kind,"focus",{appId:i}))},0)))},this.attributesUpdateCallback=C.debounce(i=>this._attributesUpdateCallback(i),100),this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([s,r])=>{pe.appClasses.has(s)||pe.register({kind:s,src:r.src,name:r.name})})},this.onMinimized=i=>{var s,r;((s=this.boxManager)==null?void 0:s.minimized)!==i&&(i===!0&&((r=this.boxManager)==null||r.blurAllBox()),setTimeout(()=>{var a;(a=this.boxManager)==null||a.setMinimized(Boolean(i))},0))},this.onAppDelete=async i=>{const s=Object.keys(i);for(const[r,a]of this.appProxies.entries())s.includes(r)||await a.destroy(!0,!1,!0)},this.closeAll=async()=>{for(const[i,s]of this.appProxies.entries())await s.destroy(!0,!1,!0)},this.displayerStateListener=i=>{const s=i.sceneState;if(s){const r=s.scenePath;this.appProxies.forEach(a=>{a.scenePath&&r.startsWith(a.scenePath)&&(a.emitAppSceneStateChange(s),a.setFullPath(r))})}this.appProxies.forEach(r=>{r.appEmitter.emit("roomStateChange",i)}),i.roomMembers&&this.members$.setValue(Tr(i.roomMembers)),P.emit("observerIdChange",this.displayer.observerId),i.memberState&&P.emit("memberStateChange",M.toJS(i.memberState))},this.displayerWritableListener=i=>{var a,n;const s=!i,r=this.windowManger.readonly===void 0||!this.windowManger.readonly;this.windowManger.readonly===void 0?(a=this.boxManager)==null||a.setReadonly(i):(n=this.boxManager)==null||n.setReadonly(!(s&&r)),this.appProxies.forEach(o=>{o.emitAppIsWritableChange()}),s&&this.room&&this.room.disableSerialization===!0&&(this.room.disableSerialization=!1),P.emit("writableChange",s)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),s=Ji(i),r=ut(this.displayer)[s];if(r.length){const a=i.replace(s,"").replace("/",""),n=r.findIndex(o=>o.name===a);C.isInteger(n)&&n>=0&&this.safeSetAttributes({_mainSceneIndex:n})}},this.updateRootDirRemoving=i=>{this.rootDirRemoving=i},this.displayer=e.displayer,this.store.setContext({getAttributes:()=>this.attributes,safeSetAttributes:i=>this.safeSetAttributes(i),safeUpdateAttributes:(i,s)=>this.safeUpdateAttributes(i,s)}),this.mainViewProxy=new fl(this),this.viewManager=new gl(this.displayer),this.appListeners=new il(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=uo,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:P}),this.sideEffectManager.add(()=>()=>{var i,s,r;this.appCreateQueue.destroy(),this.mainViewProxy.destroy(),(i=this.refresher)==null||i.destroy(),this.viewManager.destroy(),(s=this.boxManager)==null||s.destroy(),(r=this.callbacksNode)==null||r.dispose()}),P.once("onCreated").then(()=>this.onCreated()),P.on("onReconnected",()=>this.onReconnected()),M.isPlayer(this.displayer)&&(P.on("seekStart",this.onPlayerSeekStart),P.on("seek",this.onPlayerSeekDone)),P.on("removeScenes",this.onRemoveScenes),P.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),pe.setSyncRegisterApp(i=>{this.safeUpdateAttributes([ee.Registered,i.kind],i)}),this.members$.setValue(Tr(this.displayer.state.roomMembers))}async onRootDirRemoved(e=!0){await this.setMainViewScenePath(ga),this.createRootDirScenesCallback();for(const[i,s]of this.appProxies.entries())s.view&&await this.closeApp(i,e);this.mainViewProxy.rebind(),await P.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return M.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return M.isRoom(this.displayer)?this.displayer:void 0}get mainView(){return this.mainViewProxy.view}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 Ji(e);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var e;if(await this.attributesUpdateCallback(this.attributes.apps),P.emit("updateManagerRect"),Ue.on("move",this.onBoxMove),Ue.on("resize",this.onBoxResize),Ue.on("focus",this.onBoxFocus),Ue.on("close",this.onBoxClose),Ue.on("boxStateChange",this.onBoxStateChange),this.addAppsChangeListener(),this.addAppCloseListener(),this.refresher.add("maximized",()=>M.autorun(()=>{var s;const i=this.attributes.maximized;(s=this.boxManager)==null||s.setMaximized(Boolean(i))})),this.refresher.add("minimized",()=>M.autorun(()=>{const i=this.attributes.minimized;this.onMinimized(i)})),this.refresher.add("mainViewIndex",()=>M.autorun(()=>{const i=C.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>M.autorun(()=>{const i=C.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>M.autorun(()=>{const i=C.get(this.attributes,ee.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.focused$.setValue(this.attributes.focus),this.sideEffectManager.add(()=>{const i=new bl({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:s=>this.appProxies.get(s)});return()=>i.destroy()})}async _attributesUpdateCallback(e){if(e&&ce.container){const i=Object.keys(e);i.length===0&&this.appCreateQueue.emitReady();let s=i.map(r=>e[r].setup?{id:r,createdAt:e[r].createdAt}:{});this.isReplay&&(s=i.map(r=>({id:r,createdAt:e[r].createdAt})));for(const{id:r}of C.orderBy(s,"createdAt","asc"))if(r&&!this.appProxies.has(r)&&!this.appStatus.has(r)){const a=e[r];try{if(!this.attributes[r])throw new Error("appAttributes is undefined");this.appCreateQueue.push(()=>(this.appStatus.set(r,ps.StartCreate),this.baseInsertApp({kind:a.kind,options:a.options,isDynamicPPT:a.isDynamicPPT},r,!1))),this.focusByAttributes(e)}catch(n){console.warn("[WindowManager]: Insert App Error",n)}}}}refresh(){this.attributesUpdateCallback(this.attributes.apps)}setBoxManager(e){this.boxManager=e,this.mainViewProxy.createViewSync()}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 s=this.mainViewProxy.view;s.disableCameraTransform=i,Mi(30).then(()=>{s.divElement=e,P.emit("mainViewMounted")}),s.focusScenePath||this.setMainViewFocusPath()}setMainViewFocusPath(e){var s;const i=e||this.store.getMainViewScenePath();if(i)return dt(this.mainView,i),((s=this.mainView)==null?void 0:s.focusScenePath)===i}resetScenePath(e){this.displayer.state.sceneState.scenePath!==e&&Yt(this.room,e)}async addApp(e,i){Je("addApp",e);const{appId:s,needFocus:r}=await this.beforeAddApp(e,i),a=await this.baseInsertApp(e,s,!0,r);return this.afterAddApp(a),a==null?void 0:a.id}async beforeAddApp(e,i){var n,o;const s=await Qo(e.kind);this.appStatus.set(s,ps.StartCreate);const r=(n=e.attributes)!=null?n:{};this.safeUpdateAttributes([s],r),this.store.setupAppAttributes(e,s,i);const a=!((o=this.boxManager)!=null&&o.minimized);return a&&this.store.setAppFocus(s,!0),{appId:s,needFocus:a}}afterAddApp(e){var i,s;if(e&&e.box){const r=e.box;Ue.emit("move",{appId:e.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(e.id,Ee.ZIndex,r.zIndex)}(i=this.boxManager)!=null&&i.minimized&&((s=this.boxManager)==null||s.setMinimized(!1,!1))}async closeApp(e,i=!0){const s=this.appProxies.get(e);s&&s.destroy(!0,i,!1)}async baseInsertApp(e,i,s,r){if(this.appProxies.has(i)){console.warn("[WindowManager]: app duplicate exists and cannot be created again");return}const a=new js(e,this,i,s);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(Ji(e)!==we)throw new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===M.ScenePathType.None)throw new Error(`[WindowManager]: ${e} not valid scene`);if(i===M.ScenePathType.Page)await this._setMainViewScenePath(e);else if(i===M.ScenePathType.Dir){const r=Jo(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 s=(i=this.callbacksNode)==null?void 0:i.scenes[e],r=`${we}${s}`;if(s)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.safeSetAttributes({_mainSceneIndex:e}),this.dispatchSetMainViewScenePath(r));else throw new Error(`[WindowManager]: ${e} not valid index`)}}dispatchSetMainViewScenePath(e){this.dispatchInternalEvent(Y.SetMainViewScenePath,{nextScenePath:e}),Yt(this.room,e)}getAppInitPath(e){var s;const i=this.store.getAppAttributes(e);if(i)return(s=i==null?void 0:i.options)==null?void 0:s.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 s=this.store.focus;s&&this.boxManager.focusBox({appId:s})}}async onReconnected(){this.attributesUpdateCallback(this.attributes.apps);const i=Array.from(this.appProxies.values()).map(s=>s.onReconnected());this.mainViewProxy.onReconnect(),await Promise.all(i)}notifyContainerRectUpdate(e){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",e)})}dispatchInternalEvent(e,i){this.safeDispatchMagixEvent(us,{eventName:e,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),Ue.clearListeners(),P.clearListeners(),this.appProxies.size&&this.appProxies.forEach(e=>{e.destroy(!0,!1,!0)}),Q.clearListeners(),this.sideEffectManager.flushAll(),this.sceneIndex$.destroy(),this.focused$.destroy(),this.members$.destroy()}}/*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
@@ -12,35 +12,116 @@ 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 xe=function(){return xe=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},xe.apply(this,arguments)};function Ua(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 qs=0,jd=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-qs));qs=t+i,setTimeout(function(){return e(qs)},i)},im=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},nm=40,Iu=1/60*1e3,Nr=!0,Rn=!1,zo=!1,mn={delta:0,timestamp:0},$a=["read","update","preRender","render","postRender"],rm=function(e){return Rn=e},Rd=$a.reduce(function(e,t){return e[t]=im(rm),e},{}),sm=$a.reduce(function(e,t){var i=Rd[t];return e[t]=function(n,r,s){return r===void 0&&(r=!1),s===void 0&&(s=!1),Rn||am(),i.schedule(n,r,s),n},e},{}),om=function(e){return Rd[e].process(mn)},Vd=function(e){Rn=!1,mn.delta=Nr?Iu:Math.max(Math.min(e-mn.timestamp,nm),1),Nr||(Iu=mn.delta),mn.timestamp=e,zo=!0,$a.forEach(om),zo=!1,Rn&&(Nr=!1,jd(Vd))},am=function(){Rn=!0,Nr=!0,zo||jd(Vd)},Bd=function(e,t){return function(i){return Math.max(Math.min(i,t),e)}},kr=function(e){return e%1?Number(e.toFixed(5)):e},Od=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,Es={test:function(e){return typeof e=="number"},parse:parseFloat,transform:function(e){return e}},Sn=xe(xe({},Es),{transform:Bd(0,1)}),cr=xe(xe({},Es),{default:1}),Wa=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}}},qt=Wa("deg"),Cn=Wa("%"),R=Wa("px"),bu=xe(xe({},Cn),{parse:function(e){return Cn.parse(e)/100},transform:function(e){return Cn.transform(e*100)}}),lm=function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))},um=Bd(0,255),Do=function(e){return e.red!==void 0},Lo=function(e){return e.hue!==void 0};function cm(e){return lm(e).replace(/(,|\/)/g," ").split(/ \s*/)}var _d=function(e){return function(t){if(typeof t!="string")return t;for(var i={},n=cm(t),r=0;r<4;r++)i[e[r]]=n[r]!==void 0?parseFloat(n[r]):1;return i}},dm=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+")"},hm=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+")"},eo=xe(xe({},Es),{transform:function(e){return Math.round(um(e))}});function Ha(e,t){return e.startsWith(t)&&Od.test(e)}var Pr={test:function(e){return typeof e=="string"?Ha(e,"rgb"):Do(e)},parse:_d(["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 dm({red:eo.transform(t),green:eo.transform(i),blue:eo.transform(n),alpha:kr(Sn.transform(s))})}},to={test:function(e){return typeof e=="string"?Ha(e,"hsl"):Lo(e)},parse:_d(["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 hm({hue:Math.round(t),saturation:Cn.transform(kr(i)),lightness:Cn.transform(kr(n)),alpha:kr(Sn.transform(s))})}},Eu=xe(xe({},Pr),{test:function(e){return typeof e=="string"&&Ha(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}}}),it={test:function(e){return typeof e=="string"&&Od.test(e)||Do(e)||Lo(e)},parse:function(e){return Pr.test(e)?Pr.parse(e):to.test(e)?to.parse(e):Eu.test(e)?Eu.parse(e):e},transform:function(e){return Do(e)?Pr.transform(e):Lo(e)?to.transform(e):e}},Fa=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=Ua(a,[]),u={},c=[],d=!1;function m(y,M){y.startsWith("--")&&(l.hasCSSVariable=!0);var p=u[y];u[y]=M,u[y]!==p&&(c.indexOf(y)===-1&&c.push(y),d||(d=!0,sm.render(w.render)))}var w={get:function(y,M){M===void 0&&(M=!1);var p=!M&&o&&!r.has(y)&&u[y]!==void 0;return p?u[y]:t(y,l)},set:function(y,M){if(typeof y=="string")m(y,M);else for(var p in y)m(p,y[p]);return this},render:function(y){return y===void 0&&(y=!1),(d||y===!0)&&(i(u,l,c),d=!1,c.length=0),this}};return w}},pm=/([a-z])([A-Z])/g,fm="$1-$2",As=function(e){return e.replace(pm,fm).toLowerCase()},Ud=new Map,Qa=new Map,$d=["Webkit","Moz","O","ms",""],gm=$d.length,mm=typeof document!="undefined",io,Wd=function(e,t){return Qa.set(e,As(t))},vm=function(e){io=io||document.createElement("div");for(var t=0;t<gm;t++){var i=$d[t],n=i==="",r=n?e:i+e.charAt(0).toUpperCase()+e.slice(1);if(r in io.style||n){if(n&&e==="clipPath"&&Qa.has(e))return;Ud.set(e,r),Wd(e,(n?"":"-")+As(r))}}},wm=function(e){return Wd(e,e)},Hd=function(e,t){t===void 0&&(t=!1);var i=t?Qa:Ud;return i.has(e)||(mm?vm(e):wm(e)),i.get(e)||e},ym=["","X","Y","Z"],xm=["translate","scale","rotate","skew","transformPerspective"],jo=xm.reduce(function(e,t){return ym.reduce(function(i,n){return i.push(t+n),i},e)},["x","y","z"]),Sm=jo.reduce(function(e,t){return e[t]=!0,e},{});function Za(e){return Sm[e]===!0}function Cm(e,t){return jo.indexOf(e)-jo.indexOf(t)}var Mm=new Set(["originX","originY","originZ"]);function Im(e){return Mm.has(e)}var Au=xe(xe({},Es),{transform:Math.round}),bm={color:it,backgroundColor:it,outlineColor:it,fill:it,stroke:it,borderColor:it,borderTopColor:it,borderRightColor:it,borderBottomColor:it,borderLeftColor:it,borderWidth:R,borderTopWidth:R,borderRightWidth:R,borderBottomWidth:R,borderLeftWidth:R,borderRadius:R,radius:R,borderTopLeftRadius:R,borderTopRightRadius:R,borderBottomRightRadius:R,borderBottomLeftRadius:R,width:R,maxWidth:R,height:R,maxHeight:R,size:R,top:R,right:R,bottom:R,left:R,padding:R,paddingTop:R,paddingRight:R,paddingBottom:R,paddingLeft:R,margin:R,marginTop:R,marginRight:R,marginBottom:R,marginLeft:R,rotate:qt,rotateX:qt,rotateY:qt,rotateZ:qt,scale:cr,scaleX:cr,scaleY:cr,scaleZ:cr,skew:qt,skewX:qt,skewY:qt,distance:R,translateX:R,translateY:R,translateZ:R,x:R,y:R,z:R,perspective:R,opacity:Sn,originX:bu,originY:bu,originZ:R,zIndex:Au,fillOpacity:Sn,strokeOpacity:Sn,numOctaves:Au},Ga=function(e){return bm[e]},Em=function(e,t){return t&&typeof e=="number"?t.transform(e):e},Mn="scrollLeft",In="scrollTop",Fd=new Set([Mn,In]),Am=new Set([Mn,In,"transform"]),Tm={x:"translateX",y:"translateY",z:"translateZ"};function Qd(e){return typeof e=="function"}function Nm(e,t,i,n,r,s){s===void 0&&(s=!0);var o="",a=!1;i.sort(Cm);for(var l=i.length,u=0;u<l;u++){var c=i[u];o+=(Tm[c]||c)+"("+t[c]+") ",a=c==="z"?!0:a}return!a&&r?o+="translateZ(0)":o=o.trim(),Qd(e.transform)?o=e.transform(t,n?"":o):s&&n&&(o="none"),o}function km(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=Ga(d),y=Em(m,w);Za(d)?(u=!0,n[d]=y,s.push(d),l&&(w.default&&m!==w.default||!w.default&&m!==0)&&(l=!1)):Im(d)?(r[d]=y,c=!0):(!Am.has(d)||!Qd(y))&&(i[Hd(d,o)]=y)}return(u||typeof e.transform=="function")&&(i.transform=Nm(e,n,s,l,t,a)),c&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function Ya(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,km(m,n,l,u,c,d,s,a),l}}function Pm(e,t){var i=t.element,n=t.preparseOutput,r=Ga(e);if(Za(e))return r&&r.default||0;if(Fd.has(e))return i[e];var s=window.getComputedStyle(i,null).getPropertyValue(Hd(e,!0))||0;return n&&r&&r.test(s)&&r.parse?r.parse(s):s}function zm(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(Mn)!==-1&&(n[Mn]=e[Mn]),i.indexOf(In)!==-1&&(n[In]=e[In])}var Dm=Fa({onRead:Pm,onRender:zm,uncachedValues:Fd});function Lm(e,t){t===void 0&&(t={});var i=t.enableHardwareAcceleration,n=t.allowTransformNone,r=Ua(t,["enableHardwareAcceleration","allowTransformNone"]);return Dm(xe({element:e,buildStyles:Ya({enableHardwareAcceleration:i,allowTransformNone:n}),preparseOutput:!0},r))}var Zd=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Tu=.5,Gd=function(){return{style:{}}},no=function(e,t){return R.transform(e*t)},jm={x:0,y:0,width:0,height:0};function Nu(e,t,i){return typeof e=="string"?e:R.transform(t+i*e)}function Rm(e,t,i){return Nu(t,e.x,e.width)+" "+Nu(i,e.y,e.height)}var Yd={enableHardwareAcceleration:!1,isDashCase:!1};function Vm(e,t,i,n,r,s){t===void 0&&(t=jm),n===void 0&&(n=Ya(Yd)),r===void 0&&(r=Gd()),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,y=w===void 0?0:w,M=Ua(e,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),p=n(M);for(var h in p)if(h==="transform")r.style.transform=p[h];else{var f=s&&!Zd.has(h)?As(h):h;r[f]=p[h]}return(l!==void 0||u!==void 0||p.transform)&&(r.style.transformOrigin=Rm(t,l!==void 0?l:Tu,u!==void 0?u:Tu)),o!==void 0&&(r.x=o),a!==void 0&&(r.y=a),i!==void 0&&c!==void 0&&(r[s?"stroke-dashoffset":"strokeDashoffset"]=no(-y,i),r[s?"stroke-dasharray":"strokeDasharray"]=no(c,i)+" "+no(m,i)),r}function Bm(e,t,i){i===void 0&&(i=!0);var n=Gd(),r=Ya(Yd);return function(s){return Vm(s,e,t,r,n,i)}}var Om=function(e){return typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()},_m=function(e){try{return Om(e)}catch{return{x:0,y:0,width:0,height:0}}},Um=function(e){return e.tagName==="path"},$m=Fa({onRead:function(e,t){var i=t.element;if(e=Zd.has(e)?e:As(e),Za(e)){var n=Ga(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])}}),Wm=function(e){var t=_m(e),i=Um(e)&&e.getTotalLength?e.getTotalLength():void 0;return $m({element:e,buildAttrs:Bm(t,i)})},Hm=Fa({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)}}),Ro=new WeakMap,Fm=function(e){return e instanceof HTMLElement||typeof e.click=="function"},Qm=function(e){return e instanceof SVGElement||"ownerSVGElement"in e},Zm=function(e,t){var i;return e===window?i=Hm(e):Fm(e)?i=Lm(e,t):Qm(e)&&(i=Wm(e)),Ro.set(e,i),i},Gm=function(e,t){return Ro.has(e)?Ro.get(e):Zm(e,t)};function Ym(e,t){var i=typeof e=="string"?document.querySelector(e):e;return Gm(i,t)}var rt=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},Xm=Object.defineProperty,Jm=Object.defineProperties,Km=Object.getOwnPropertyDescriptors,ku=Object.getOwnPropertySymbols,qm=Object.prototype.hasOwnProperty,ev=Object.prototype.propertyIsEnumerable,Pu=(e,t,i)=>t in e?Xm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,zu=(e,t)=>{for(var i in t||(t={}))qm.call(t,i)&&Pu(e,i,t[i]);if(ku)for(var i of ku(t))ev.call(t,i)&&Pu(e,i,t[i]);return e},Vo,ro,re,so,we,Ne,$e,oo,Xe,Nt;(ro=Vo||(Vo={})).Light="light",ro.Dark="dark",ro.Auto="auto",(so=re||(re={})).Normal="normal",so.Minimized="minimized",so.Maximized="maximized",(Ne=we||(we={})).DarkMode="dark_mode",Ne.PrefersColorScheme="prefers_color_scheme",Ne.Close="close",Ne.Focus="focus",Ne.Blur="blur",Ne.IntrinsicMove="intrinsic_move",Ne.IntrinsicResize="intrinsic_resize",Ne.ZIndex="z_index",Ne.State="state",Ne.Minimized="minimized",Ne.Maximized="maximized",Ne.Readonly="readonly",Ne.Destroyed="destroyed",(oo=$e||($e={})).Close="close",oo.Maximize="maximize",oo.Minimize="minimize",(Nt=Xe||(Xe={})).North="n",Nt.South="s",Nt.West="w",Nt.East="e",Nt.NorthWest="nw",Nt.NorthEast="ne",Nt.SouthEast="se",Nt.SouthWest="sw";function Ei(e,t,i){return Math.min(Math.max(e,t),i)}function ji(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}function Du(e){return e.touches?e.touches[0]:e}let tv=1;function iv(){return"New Box "+tv++}function nv(e){return Boolean(e)}function dr(e){return!e}class Xd{constructor({readonly$:t,state$:i,title$:n,buttons:r,onEvent:s,onDragStart:o,namespace:a="telebox"}){this.sideEffect=new be.SideEffectManager,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=l=>{var u;if(this.readonly$.value||l.button!==0||(u=l.target.dataset)!=null&&u.teleTitleBarNoDblClick)return;ji(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:$e.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$.value||(u=l.target.dataset)!=null&&u.teleTitleBarNoDblClick)return;ji(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:$e.Maximize}):this.onDragStart&&this.onDragStart(l),this.lastTitleBarTouch.timestamp=c,this.lastTitleBarTouch.clientX=d,this.lastTitleBarTouch.clientY=m},this.readonly$=t,this.state$=i,this.title$=n,this.onEvent=s,this.onDragStart=o,this.namespace=a,this.buttons=r||[{type:$e.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:$e.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:l=>l===re.Maximized},{type:$e.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}],this.$dragArea=this.renderDragArea()}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="dh";const i=document.createElement("h1");i.className=this.wrapClassName("title"),i.dataset.teleBoxHandle="dh",t.appendChild(i),t.appendChild(this.$dragArea);const n=document.createElement("div");n.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:r},s)=>{const o=String(s),a=document.createElement("button");a.className=`${this.wrapClassName("titlebar-btn")} ${r}`,a.dataset.teleTitleBarBtnIndex=o,a.dataset.teleTitleBarNoDblClick="true",n.appendChild(a)}),this.sideEffect.addDisposer(this.title$.subscribe(r=>{i.textContent=r,i.title=r}),"render-title"),this.sideEffect.addDisposer(this.state$.subscribe(r=>{this.buttons.forEach((s,o)=>{var a;s.isActive&&((a=n.children[o])==null||a.classList.toggle("is-active",s.isActive(r)))})}),"render-state-btns"),this.sideEffect.addEventListener(n,"click",r=>{var s;if(this.readonly$.value)return;const o=r.target,a=Number((s=o.dataset)==null?void 0:s.teleTitleBarBtnIndex);if(!Number.isNaN(a)&&a<this.buttons.length){ji(r);const l=this.buttons[a];this.onEvent&&this.onEvent({type:l.type,value:l.value})}},{},"render-btns-container-click"),this.$titleBar.appendChild(t),this.$titleBar.appendChild(n)}return this.$titleBar}renderDragArea(){const t=document.createElement("div");return t.className=this.wrapClassName("drag-area"),t.dataset.teleBoxHandle="dh",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.onDragStart=void 0,this.onEvent=void 0)}}class Jd{constructor({namespace:t,rootRect$:i,ratio$:n,highlightStage$:r,root$:s}){this._sideEffect=new be.SideEffectManager,this.namespace=t,this.highlightStage$=r,this.stageRect$=A.combine([i,n],([o,a])=>{if(a<=0||o.width<=0||o.height<=0)return o;const l=o.width*a;if(l===o.height)return o;if(l<o.height)return{x:0,y:(o.height-l)/2,width:o.width,height:l};const u=o.height/a;return{x:(o.width-u)/2,y:0,width:u,height:o.height}},{compare:rt}),this._sideEffect.addDisposer(A.combine([s,r]).subscribe(([o,a])=>{var l;o&&a?o.appendChild(this.render()):(l=this.$boxStage)!=null&&l.parentNode&&this.$boxStage.remove()}))}render(){if(this.$boxStage)return this.$boxStage;const t=document.createElement("div");t.className=this.wrapClassName("box-stage-container");const i=document.createElement("div");i.className=this.wrapClassName("box-stage-mask");const n=document.createElement("div");n.className=this.wrapClassName("box-stage-mask");const r=document.createElement("div");r.className=this.wrapClassName("box-stage-frame");const[s,o,a,l]=["M0 8V0h8v2H2v6H0Z","M8 8V0H0v2h6v6h2Z","M0 0v8h8V6H2V0H0Z","M8 0v8H0V6h6V0h2Z"].map((u,c)=>{const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("viewBox","0 0 8 8"),d.setAttribute("class",`${this.wrapClassName("box-stage-frame-corner")} is-${c}`);const m=document.createElementNS("http://www.w3.org/2000/svg","path");return m.setAttribute("d",u),m.setAttribute("fill","#3381FF"),d.appendChild(m),d});return r.appendChild(s),r.appendChild(a),r.appendChild(o),r.appendChild(l),t.appendChild(i),t.appendChild(r),t.appendChild(n),this._sideEffect.addDisposer(this.highlightStage$.subscribe(u=>{t.classList.toggle("is-active",u)})),this._sideEffect.addDisposer(A.combine([this.highlightStage$,this.stageRect$]).subscribe(([u,c])=>{u&&(c.x>0?(t.style.flexDirection="row",i.style.width=`${c.x}px`,i.style.height="",n.style.width=`${c.x}px`,n.style.height=""):c.y>0&&(t.style.flexDirection="column",i.style.width="",i.style.height=`${c.y}px`,n.style.width="",n.style.height=`${c.y}px`))})),this.$boxStage=t,t}destroy(){this._sideEffect.flushAll()}wrapClassName(t){return`${this.namespace}-${t}`}}const rv=window.ResizeObserver||wd.ResizeObserver;class sv{constructor({id:t=be.genUID(),title:i=iv(),namespace:n="telebox",visible:r=!0,width:s=.5,height:o=.5,minWidth:a=0,minHeight:l=0,x:u=.1,y:c=.1,resizable:d=!0,draggable:m=!0,ratio:w=-1,focus:y=!1,zIndex:M=100,stageRatio:p=null,titleBar:h,content:f,stage:g,footer:v,styles:C,highlightStage:x=null,darkMode$:N,fence$:z,minimized$:k,maximized$:K,readonly$:q,root$:ce,rootRect$:_,managerStageRect$:D,managerStageRatio$:W,collectorRect$:de,managerHighlightStage$:_e}){this.events=new Qt.default,this._delegateEvents=new Qt.default,this.handleTrackStart=O=>{var H;return(H=this._handleTrackStart)==null?void 0:H.call(this,O)},this._sideEffect=new be.SideEffectManager,this.id=t,this.namespace=n;const Te=new A.ValManager;this._sideEffect.addDisposer(()=>Te.destroy());const Kt=new A.Val(i),bi=new A.Val(r),nn=new A.Val(d),ar=new A.Val(m),lr=new A.Val(w),I=new A.Val(M),P=new A.Val(y),U=new A.Val(f),Y=new A.Val(g),ee=new A.Val(v),pt=new A.Val(C),Ze=A.combine([k,K],([O,H])=>O?re.Minimized:H?re.Maximized:re.Normal),ft=new A.Val({width:Ei(a,0,1),height:Ei(l,0,1)},{compare:rt}),At=A.combine([ft,D],([O,H])=>({width:O.width*H.width,height:O.height*H.height}),{compare:rt}),ur=new A.Val({width:s,height:o},{compare:rt});this._sideEffect.addDisposer(ft.reaction((O,H)=>{ur.setValue({width:Math.max(s,O.width),height:Math.max(o,O.height)},H)}));const Gs=new A.Val({x:u,y:c},{compare:rt}),Ys=A.combine([ur,D],([O,H])=>({width:H.width*O.width,height:H.height*O.height}),{compare:rt}),rn=A.combine([Gs,D],([O,H])=>({x:O.x*H.width+H.x,y:O.y*H.height+H.y}),{compare:rt}),ou=new A.Val(x),au=A.combine([ou,_e],([O,H])=>O!=null?O:H),lu=new A.Val(null),uu=new A.Val(_.value,{compare:rt}),cu=new A.Val(p),du=new Jd({namespace:n,root$:lu,rootRect$:uu,ratio$:A.combine([cu,W],([O,H])=>O!=null?O:H),highlightStage$:au});this._sideEffect.addDisposer(()=>du.destroy()),A.withReadonlyValueEnhancer(this,{darkMode:N,fence:z,minimized:k,maximized:K,readonly:q,rootRect:_,managerStageRect:D,collectorRect:de});const eg={zIndex:I,focus:P,$userContent:U,$userStage:Y,$userFooter:ee,$userStyles:pt,state:Ze,minSize:ft,pxMinSize:At,intrinsicSize:ur,intrinsicCoord:Gs,pxIntrinsicSize:Ys,pxIntrinsicCoord:rn,highlightStage:au,boxHighlightStage:ou,contentRect:uu,contentStageRect:du.stageRect$};A.withReadonlyValueEnhancer(this,eg,Te),A.withValueEnhancer(this,{title:Kt,visible:bi,resizable:nn,draggable:ar,ratio:lr,stageRatio:cu},Te),this.titleBar=h||new Xd({readonly$:q,state$:Ze,title$:Kt,namespace:this.namespace,onDragStart:O=>{var H;return(H=this._handleTrackStart)==null?void 0:H.call(this,O)},onEvent:O=>this._delegateEvents.emit(O.type)}),this._sideEffect.addDisposer(lr.subscribe(O=>{O>0&&this.transform(rn.value.x,rn.value.y,Ys.value.width,Ys.value.height,!0)})),this._sideEffect.addDisposer(z.subscribe(O=>{O&&this.move(rn.value.x,rn.value.y,!0)})),this.$box=this.render(),lu.setValue(this.$content.parentElement);const Tt=(O,H)=>{this._sideEffect.addDisposer(O.reaction((tg,ig)=>{ig||this.events.emit(H,tg)}))};Tt(N,we.DarkMode),Tt(q,we.Readonly),Tt(I,we.ZIndex),Tt(k,we.Minimized),Tt(K,we.Maximized),Tt(Ze,we.State),Tt(ur,we.IntrinsicResize),Tt(Gs,we.IntrinsicMove),this._sideEffect.addDisposer([bi.reaction((O,H)=>{H||O||this.events.emit(we.Close)}),P.reaction((O,H)=>{H||this.events.emit(O?we.Focus:we.Blur)}),ce.subscribe(O=>{O?O.appendChild(this.$box):this.$box.parentNode&&this.$box.remove()})])}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(t,i=!1){this._minSize$.setValue({width:t,height:this.minHeight},i)}setMinHeight(t,i=!1){this._minSize$.setValue({width:this.minWidth,height:t},i)}resize(t,i,n=!1){this._intrinsicSize$.setValue({width:Math.max(t,this.minWidth),height:Math.max(i,this.minHeight)},n)}get intrinsicX(){return this._intrinsicCoord$.value.x}get intrinsicY(){return this._intrinsicCoord$.value.y}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}move(t,i,n=!1){let r,s;const o=this.managerStageRect,a=this.pxIntrinsicSize;if(this.fence)r=Ei(t,o.x,o.x+o.width-a.width),s=Ei(i,o.y,o.y+o.height-a.height);else{const l=this.rootRect;r=Ei(t,0-a.width+20,0+l.width-20),s=Ei(i,0,0+l.height-20)}this._intrinsicCoord$.setValue({x:(r-o.x)/o.width,y:(s-o.y)/o.height},n)}transform(t,i,n,r,s=!1){const o=this.managerStageRect,a=this.rootRect;if(n=Math.max(n,this.pxMinSize.width),r=Math.max(r,this.pxMinSize.height),this.ratio>0){const l=this.ratio*n;i!==this.pxIntrinsicCoord.y&&(i-=l-r),r=l}i<a.y&&(i=a.y,r=this.pxIntrinsicSize.height),this.move(t,i,s),this._intrinsicSize$.setValue({width:n/o.width,height:r/o.height},s)}mountContent(t){this._$userContent$.setValue(t)}unmountContent(){this._$userContent$.setValue(void 0)}mountStage(t){this._$userStage$.setValue(t)}unmountStage(){this._$userStage$.setValue(void 0)}mountFooter(t){this._$userFooter$.setValue(t)}unmountFooter(){this._$userFooter$.setValue(void 0)}getUserStyles(){return this.$userStyles}mountStyles(t){let i;typeof t=="string"?(i=document.createElement("style"),i.textContent=t):i=t,this._$userStyles$.setValue(i)}unmountStyles(){this._$userStyles$.setValue(void 0)}setHighlightStage(t){this._boxHighlightStage$.setValue(t)}render(){if(this.$box)return this.$box;this.$box=document.createElement("div"),this.$box.classList.add(this.wrapClassName("box"));const t=(c,d,m,w=nv)=>this._sideEffect.add(()=>{const y=this.wrapClassName(m);return d.subscribe(M=>{c.classList.toggle(y,w(M))})});t(this.$box,this._readonly$,"readonly"),t(this.$box,this._draggable$,"no-drag",dr),t(this.$box,this._resizable$,"no-resize",dr),t(this.$box,this._focus$,"blur",dr),t(this.$box,this._darkMode$,"color-scheme-dark"),t(this.$box,this._darkMode$,"color-scheme-light",dr),this._sideEffect.add(()=>{const c=this.wrapClassName("minimized"),d=this.wrapClassName("maximized"),m="box-maximized-timer";return this._state$.subscribe(w=>{this.$box.classList.toggle(c,w===re.Minimized),w===re.Maximized?(this._sideEffect.flush(m),this.$box.classList.toggle(d,!0)):this._sideEffect.setTimeout(()=>{this.$box.classList.toggle(d,!1)},0,m)})}),this._sideEffect.addDisposer(this._visible$.subscribe(c=>{this.$box.style.display=c?"block":"none"})),this._sideEffect.addDisposer(this._zIndex$.subscribe(c=>{this.$box.style.zIndex=String(c)})),this.$box.dataset.teleBoxID=this.id;const i=Ym(this.$box),n=A.combine([this._maximized$,this._minimized$,this._pxIntrinsicSize$,this._pxIntrinsicCoord$,this._collectorRect$],([c,d,m,w,y])=>{const M=c?{x:0,y:0,width:"100%",height:"100%",scaleX:1,scaleY:1}:{x:w.x,y:w.y,width:m.width+"px",height:m.height+"px",scaleX:1,scaleY:1};if(d&&y){const{width:p,height:h}=c?this.rootRect:m;M.x=y.x-p/2+y.width/2,M.y=y.y-h/2+y.height/2,M.scaleX=y.width/p,M.scaleY=y.height/h}return M},{compare:rt}),r=n.value;this.$box.style.width=r.width,this.$box.style.height=r.height,this.$box.style.transform=`translate(${r.x-10}px,${r.y-10}px)`,this._sideEffect.addDisposer(n.subscribe(c=>{i.set(c)}));const s=document.createElement("div");s.className=this.wrapClassName("box-main"),this.$box.appendChild(s);const o=document.createElement("div");o.className=this.wrapClassName("titlebar-wrap"),o.appendChild(this.titleBar.render()),this.$titleBar=o;const a=document.createElement("div");a.className=this.wrapClassName("content-wrap");const l=document.createElement("div");l.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=l,this._sideEffect.add(()=>{const c=new rv(()=>{const d=l.getBoundingClientRect();this._contentRect$.setValue({x:d.x,y:d.y,width:d.width,height:d.height})});return c.observe(l),()=>c.disconnect()}),this._sideEffect.add(()=>{let c;return this._$userStyles$.subscribe(d=>{c&&c.remove(),c=d,d&&a.appendChild(d)})}),this._sideEffect.add(()=>{let c;return this._$userContent$.subscribe(d=>{c&&c.remove(),c=d,d&&l.appendChild(d)})}),this._sideEffect.add(()=>{let c;return this._$userStage$.subscribe(d=>{var m;if(c&&c.remove(),c=d,d){if(!this.$stage){const w=document.createElement("div");this.$stage=w,w.className=this.wrapClassName("content-stage"),this._sideEffect.addDisposer(this._contentStageRect$.subscribe(y=>{y&&(w.style.top=y.y+"px",w.style.left=y.x+"px",w.style.width=y.width+"px",w.style.height=y.height+"px")}),"content-stage-rect"),l.appendChild(w)}this.$stage.parentElement||l.appendChild(this.$stage),this.$stage.appendChild(d)}else(m=this.$stage)!=null&&m.parentElement&&this.$stage.remove()})}),a.appendChild(l);const u=document.createElement("div");return u.className=this.wrapClassName("footer-wrap"),this.$footer=u,this._sideEffect.add(()=>{let c;return this._$userFooter$.subscribe(d=>{c&&c.remove(),c=d,d&&u.appendChild(d)})}),s.appendChild(o),s.appendChild(a),s.appendChild(u),this._renderResizeHandlers(),this.$box}_renderResizeHandlers(){const t=document.createElement("div");t.className=this.wrapClassName("resize-handles"),Object.values(Xe).forEach(M=>{const p=document.createElement("div");p.className=this.wrapClassName(M)+" "+this.wrapClassName("resize-handle"),p.dataset.teleBoxHandle=M,t.appendChild(p)}),this.$box.appendChild(t);const i="handle-tracking-listener",n=this.wrapClassName("transforming");let r,s,o=0,a=0,l=0,u=0,c=0,d=0;const m=M=>{if(this.state!==re.Normal)return;ji(M);let{pageX:p,pageY:h}=Du(M);h<this.rootRect.y&&(h=this.rootRect.y);const f=p-c,g=h-d;let{x:v,y:C}=this.pxIntrinsicCoord,{width:x,height:N}=this.pxIntrinsicSize;switch(s){case Xe.North:C=a+g,N=u-g;break;case Xe.South:N=u+g;break;case Xe.West:v=o+f,x=l-f;break;case Xe.East:x=l+f;break;case Xe.NorthWest:v=o+f,C=a+g,x=l-f,N=u-g;break;case Xe.NorthEast:C=a+g,x=l+f,N=u-g;break;case Xe.SouthEast:x=l+f,N=u+g;break;case Xe.SouthWest:v=o+f,x=l-f,N=u+g;break;default:return void this.move(o+f,a+g)}this.transform(v,C,x,N)},w=M=>{s=void 0,r&&(ji(M),this.$box.classList.toggle(n,!1),this._sideEffect.flush(i),r.remove())},y=M=>{var p;if(this.readonly||M.button!=null&&M.button!==0||!this.draggable||s||this.state!==re.Normal)return;const h=M.target;if((p=h.dataset)!=null&&p.teleBoxHandle){ji(M),{x:o,y:a}=this.pxIntrinsicCoord,{width:l,height:u}=this.pxIntrinsicSize,{pageX:c,pageY:d}=Du(M),s=h.dataset.teleBoxHandle,r||(r=document.createElement("div"));const f=s?this.wrapClassName(`cursor-${s}`):"";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=y,this._sideEffect.addEventListener(t,"mousedown",y,{},"box-resizeHandles-mousedown"),this._sideEffect.addEventListener(t,"touchstart",y,{passive:!1},"box-resizeHandles-touchstart")}async destroy(){this.$box.remove(),this._sideEffect.flushAll(),this._sideEffect.flushAll(),await this.events.emit(we.Destroyed),this.events.clearListeners(),this._delegateEvents.clearListeners()}wrapClassName(t){return`${this.namespace}-${t}`}}var he,Ue;class ov{constructor({minimized$:t,readonly$:i,darkMode$:n,rootRect$:r,namespace:s="telebox",styles:o={},root$:a}){this._sideEffect=new be.SideEffectManager,this.namespace=s;const l=new A.ValManager;this._sideEffect.addDisposer(()=>l.destroy());const u=new A.Val(void 0),c=A.derive(t),d=new A.Val(o),m=new A.Val(document.createElement("button"));A.withValueEnhancer(this,{styles:d,$collector:m},l),A.withReadonlyValueEnhancer(this,{root:a}),A.withReadonlyValueEnhancer(this,{rect:u,visible:c},l),m.value.className=this.wrapClassName("collector"),m.value.style.backgroundImage="url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K')",this._sideEffect.addDisposer(m.subscribe(w=>{this._sideEffect.addEventListener(w,"click",()=>{i.value||t.setValue(!1)},{},"telebox-collector-click"),this._sideEffect.addDisposer([c.subscribe(y=>{w.classList.toggle(this.wrapClassName("collector-visible"),y)}),i.subscribe(y=>{w.classList.toggle(this.wrapClassName("collector-readonly"),y)}),n.subscribe(y=>{w.classList.toggle(this.wrapClassName("color-scheme-dark"),y),w.classList.toggle(this.wrapClassName("color-scheme-light"),!y)}),d.subscribe(y=>{Object.keys(y).forEach(M=>{const p=y[M];p!=null&&(w.style[M]=p)})}),a.subscribe(y=>{y&&y.appendChild(w)}),A.combine([t,r,a]).subscribe(([y,M,p])=>{if(y&&p){const{x:h,y:f,width:g,height:v}=w.getBoundingClientRect();u.setValue({x:h-M.x,y:f-M.y,width:g,height:v})}})],"telebox-collector-el")}))}destroy(){this._sideEffect.flushAll()}wrapClassName(t){return`${this.namespace}-${t}`}}(Ue=he||(he={})).Focused="focused",Ue.Blurred="blurred",Ue.Created="created",Ue.Removed="removed",Ue.State="state",Ue.Maximized="maximized",Ue.Minimized="minimized",Ue.IntrinsicMove="intrinsic_move",Ue.IntrinsicResize="intrinsic_resize",Ue.ZIndex="z_index",Ue.PrefersColorScheme="prefers_color_scheme",Ue.DarkMode="dark_mode";class av extends Xd{constructor(t){super(t),this.boxes$=t.boxes$,this.rootRect$=t.rootRect$,this.darkMode$=t.darkMode$,this.sideEffect.addDisposer(t.root$.subscribe(i=>{var n;i?i.appendChild(this.render()):(n=this.$titleBar)!=null&&n.parentNode&&this.$titleBar.remove()}))}focusBox(t){var i;if(!this.focusedBox||this.focusedBox!==t){if(this.$titles&&this.state$.value===re.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}}render(){if(this.$titleBar)return this.$titleBar;const t=super.render();t.classList.add(this.wrapClassName("max-titlebar")),this.sideEffect.addDisposer([this.state$.subscribe(n=>{t.classList.toggle(this.wrapClassName("max-titlebar-maximized"),n===re.Maximized)}),this.readonly$.subscribe(n=>{t.classList.toggle(this.wrapClassName("readonly"),n)}),this.darkMode$.subscribe(n=>{t.classList.toggle(this.wrapClassName("color-scheme-dark"),n),t.classList.toggle(this.wrapClassName("color-scheme-light"),!n)}),A.combine([this.state$,this.boxes$]).subscribe(([n,r])=>{n===re.Maximized&&(t.classList.toggle(this.wrapClassName("max-titlebar-single-title"),r.length===1),r.length!==1&&t.replaceChild(this.renderTitles(),t.firstElementChild))})],"max-render");const i=document.createElement("div");return i.classList.add(this.wrapClassName("titles-area")),t.insertBefore(i,t.firstElementChild),t}destroy(){super.destroy(),this.$titles=void 0,this.focusedBox=void 0}renderTitles(){this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.sideEffect.addEventListener(this.$titles,"wheel",n=>{n.currentTarget.scrollBy({left:n.deltaY>0?250:-250,behavior:"smooth"})},{passive:!1},"max-render-wheel-titles");const t=document.createElement("div");t.className=this.wrapClassName("titles-content"),this.$titles.appendChild(t);const i=this.boxes$.value.map(n=>{const r=document.createElement("button");return r.className=this.wrapClassName("titles-tab"),r.textContent=n.title,r.dataset.teleBoxID=n.id,r.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&n.id===this.focusedBox.id&&r.classList.add(this.wrapClassName("titles-tab-focus")),t.appendChild(r),n._title$.reaction(s=>r.textContent=s)});return this.sideEffect.addDisposer(()=>i.forEach(n=>n()),"max-render-tab-titles"),this.$titles}}const lv=window.ResizeObserver||wd.ResizeObserver;class uv{constructor({root:t=null,prefersColorScheme:i=Vo.Light,minimized:n=!1,maximized:r=!1,fence:s=!1,collector:o,namespace:a="telebox",readonly:l=!1,stageRatio:u=-1,highlightStage:c=!0}={}){this.events=new Qt.default,this._sideEffect=new be.SideEffectManager,this.namespace=a;const d=new A.ValManager;this._sideEffect.addDisposer(()=>d.destroy());const m=new A.Val(t),w=new A.Val(l),y=new A.Val(n),M=new A.Val(r),p=new A.Val(s),h=new A.Val(u),f=new A.Val(c),g=new A.Val({x:0,y:0,width:window.innerWidth,height:window.innerHeight},{compare:rt});this._sideEffect.addDisposer(m.subscribe(_=>{this._sideEffect.add(()=>{if(!_)return()=>{};const D=new lv(()=>{const W=_.getBoundingClientRect();g.setValue({x:W.x,y:W.y,width:W.width,height:W.height})});return D.observe(_),()=>D.disconnect()},"calc-root-rect")})),this.boxes$=new A.Val([]),this.topBox$=new A.Val(void 0),this._sideEffect.addDisposer(this.boxes$.subscribe(_=>{if(_.length>0){const D=_.reduce((W,de)=>W.zIndex>de.zIndex?W:de);this.topBox$.setValue(D)}else this.topBox$.setValue(void 0)}));const v=window.matchMedia("(prefers-color-scheme: dark)"),C=new A.Val(!1);v&&(C.setValue(v.matches),this._sideEffect.add(()=>{const _=D=>{C.setValue(D.matches)};return v.addEventListener("change",_),()=>v.removeEventListener("change",_)}));const x=new A.Val(i);this._sideEffect.addDisposer(x.reaction((_,D)=>{D||this.events.emit(he.PrefersColorScheme,_)}));const N=A.combine([C,x],([_,D])=>D==="auto"?_:D==="dark"),z=A.combine([y,M],([_,D])=>_?re.Minimized:D?re.Maximized:re.Normal);this.collector=o!=null?o:new ov({minimized$:y,readonly$:w,darkMode$:N,namespace:a,root$:m,rootRect$:g});const k=new Jd({namespace:a,rootRect$:g,ratio$:h,root$:m,highlightStage$:A.combine([f,M,y],([_,D,W])=>_&&(W||!D))});this._sideEffect.addDisposer(()=>k.destroy());const K={darkMode:N,state:z,root:m,rootRect:g,stageRect:k.stageRect$};A.withReadonlyValueEnhancer(this,K,d),A.withValueEnhancer(this,{prefersColorScheme:x,readonly:w,fence:p,minimized:y,maximized:M,stageRatio:h,highlightStage:f},d);const q=this.wrapClassName("titlebar-icon-close"),ce=_=>{var D;if(w.value)return;const W=_.target;if(W.tagName)for(let de=W;de;de=de.parentElement){if(de.classList&&de.classList.contains(q))return;const _e=(D=de.dataset)==null?void 0:D.teleBoxID;if(_e){const Te=this.getBox(_e);if(Te)return this.focusBox(Te),void this.makeBoxTop(Te)}}};this._sideEffect.addEventListener(window,"mousedown",ce,!0),this._sideEffect.addEventListener(window,"touchstart",ce,!0),this.titleBar=new av({namespace:this.namespace,title$:A.derive(this.topBox$,_=>(_==null?void 0:_.title)||""),boxes$:this.boxes$,darkMode$:N,readonly$:w,state$:z,root$:m,rootRect$:g,onEvent:_=>{switch(_.type){case $e.Maximize:M.setValue(!M.value);break;case $e.Minimize:y.setValue(!0);break;case we.Close:this.removeTopBox(),this.focusTopBox()}}}),this._sideEffect.addDisposer([z.reaction((_,D)=>{D||this.events.emit(he.State,_)}),M.reaction((_,D)=>{D||this.events.emit(he.Maximized,_)}),y.reaction((_,D)=>{D||this.events.emit(he.Minimized,_)}),N.reaction((_,D)=>{D||this.events.emit(he.DarkMode,_)})])}get boxes(){return this.boxes$.value}get topBox(){return this.topBox$.value}setState(t,i=!1){switch(t){case re.Maximized:this.setMinimized(!1,i),this.setMaximized(!0,i);break;case re.Minimized:this.setMinimized(!0,i),this.setMaximized(!1,i);break;default:this.setMinimized(!1,i),this.setMaximized(!1,i)}return this}create(t={},i=!0){const n=new sv((r=zu(zu({zIndex:this.topBox?this.topBox.zIndex+1:100},t),i?this.smartPosition(t):{}),s={namespace:this.namespace,root$:this._root$,darkMode$:this._darkMode$,maximized$:this._maximized$,minimized$:this._minimized$,fence$:this._fence$,rootRect$:this._rootRect$,managerStageRect$:this._stageRect$,managerStageRatio$:this._stageRatio$,readonly$:this._readonly$,collectorRect$:this.collector._rect$,managerHighlightStage$:this._highlightStage$},Jm(r,Km(s))));var r,s;return n.focus&&(this.focusBox(n),i&&this.makeBoxTop(n)),this.boxes$.setValue([...this.boxes,n]),this._sideEffect.addDisposer([n._delegateEvents.on($e.Maximize,()=>{this.setMaximized(!this.maximized)}),n._delegateEvents.on($e.Minimize,()=>{this.setMinimized(!0)}),n._delegateEvents.on($e.Close,()=>{this.remove(n),this.focusTopBox()}),n._intrinsicCoord$.reaction((o,a)=>{a||this.events.emit(he.IntrinsicMove,n)}),n._intrinsicSize$.reaction((o,a)=>{a||this.events.emit(he.IntrinsicResize,n)}),n._zIndex$.reaction((o,a)=>{if(this.boxes.length>0){const l=this.boxes.reduce((u,c)=>u.zIndex>c.zIndex?u:c);this.topBox$.setValue(l)}a||this.events.emit(he.ZIndex,n)})]),this.events.emit(he.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(he.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(he.Removed,i)),i}mount(t){this._root$.setValue(t)}unmount(){this._root$.setValue(null)}destroy(t=!1){this.events.clearListeners(),this._sideEffect.flushAll(),this.removeAll(t),this.collector.destroy(),this.titleBar.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._focus$.setValue(!0,i)),s&&!i&&this.events.emit(he.Focused,n)}else r.focus&&this.blurBox(r,i)}),this.titleBar.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._focus$.setValue(!1,i),i||this.events.emit(he.Blurred,n)),this.titleBar.focusedBox===n&&this.titleBar.focusBox())}blurAll(t=!1){this.boxes.forEach(i=>{i.focus&&(i._focus$.setValue(!1,t),t||this.events.emit(he.Blurred,i))}),this.titleBar.focusedBox&&this.titleBar.focusBox()}teleBoxMatcher(t){const i=Object.keys(t);return n=>i.every(r=>t[r]===n[r])}updateBox(t,i,n=!1){var r,s,o,a,l,u;i.x==null&&i.y==null||t._intrinsicCoord$.setValue({x:(r=i.x)!=null?r:t.intrinsicX,y:(s=i.y)!=null?s:t.intrinsicY},n),i.width==null&&i.height==null||t._intrinsicSize$.setValue({width:(o=i.width)!=null?o:t.intrinsicWidth,height:(a=i.height)!=null?a:t.intrinsicHeight},n),i.title!=null&&t._title$.setValue(i.title),i.visible!=null&&t._visible$.setValue(i.visible,n),i.resizable!=null&&t._resizable$.setValue(i.resizable,n),i.draggable!=null&&t._draggable$.setValue(i.draggable,n),i.ratio!=null&&t._ratio$.setValue(i.ratio,n),i.zIndex!=null&&t._zIndex$.setValue(i.zIndex,n),i.stageRatio!==void 0&&t.setStageRatio(i.stageRatio,n),i.content!=null&&t.mountContent(i.content),i.footer!=null&&t.mountFooter(i.footer),i.minHeight==null&&i.minWidth==null||t._minSize$.setValue({width:(l=i.minWidth)!=null?l:t.minWidth,height:(u=i.minHeight)!=null?u:t.minHeight},n)}smartPosition(t){let{x:i,y:n}=t;const{width:r=.5,height:s=.5}=t,o=this.stageRect,a=this.topBox;if(i==null){let l=o.x+20;if(a){const u=a.pxIntrinsicCoord.x+20;u+r*o.width<=o.x+o.width&&(l=u)}i=(l-o.x)/o.width}if(n==null){let l=o.y+20;if(a){const u=a.pxIntrinsicCoord.y+20;u+s*o.height<=o.y+o.height&&(l=u)}n=(l-o.y)/o.height}return{x:i,y:n,width:r,height:s}}makeBoxTop(t,i=!1){this.topBox&&t!==this.topBox&&t._zIndex$.setValue(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 cv=(e,t,i,n,r)=>new dv({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 dv{constructor(t,i){this.context=t,this.sideEffectManager=new be.SideEffectManager;const{emitter:n,callbacks:r,boxEmitter:s}=t;this.teleBoxManager=this.setupBoxManager(i),this.sideEffectManager.add(()=>[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,a)=>{if(!a)if(this.context.safeSetAttributes({minimized:o}),o)this.context.cleanFocus(),this.blurAllBox();else{const l=this.getTopBox();l&&(this.context.setAppFocus(l.id),this.focusBox({appId:l.id},!1))}}),this.teleBoxManager._maximized$.reaction((o,a)=>{a||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",b.debounce(o=>{s.emit("move",{appId:o.id,x:o.intrinsicX,y:o.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",b.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,Le.ZIndex,o.zIndex)}),this.teleBoxManager._stageRect$.subscribe(o=>{n.emit("playgroundSizeChange",o),this.context.notifyContainerRectUpdate(o)}),n.on("writableChange",o=>{this.teleBoxManager.setHighlightStage(o)}),n.on("containerSizeRatioUpdate",o=>{this.teleBoxManager._stageRatio$.setValue(o)})])}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}get stageRect(){return this.teleBoxManager.stageRect}createBox(t){var c,d,m;if(!this.teleBoxManager)return;let{minwidth:i=pg,minheight:n=fg}=(c=t.app.config)!=null?c:{};const{width:r,height:s}=(d=t.app.config)!=null?d:{},o=((m=t.options)==null?void 0:m.title)||t.appId,a=this.teleBoxManager.rootRect;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},u=this.teleBoxManager.create(l,t.smartPosition);return this.context.emitter.emit(`${t.appId}${Z.WindowCreated}`),u}setupBoxManager(t){const i=ye.playground,n={stageRatio:t==null?void 0:t.stageRatio,root:i,fence:!1,prefersColorScheme:t==null?void 0:t.prefersColorScheme},r=new uv(n);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=r;const s=t==null?void 0:t.collectorContainer;return s&&this.teleBoxManager.collector.set$collector(s),t!=null&&t.collectorStyles&&this.teleBoxManager.collector.setStyles(t.collectorStyles),r}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))}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)}setRoot(t){this.teleBoxManager._root$.setValue(t)}setCollector(t){this.teleBoxManager.collector.set$collector(t)}destroy(){this.sideEffectManager.flushAll(),this.teleBoxManager.destroy()}}function Gr(){}function Kd(e){return e()}function Lu(){return Object.create(null)}function Ts(e){e.forEach(Kd)}function hv(e){return typeof e=="function"}function pv(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let hr;function Yr(e,t){return hr||(hr=document.createElement("a")),hr.href=t,e===hr.href}function fv(e){return Object.keys(e).length===0}function xt(e,t){e.appendChild(t)}function Ns(e,t,i){e.insertBefore(t,i||null)}function Gn(e){e.parentNode.removeChild(e)}function Vt(e){return document.createElement(e)}function Xa(e){return document.createTextNode(e)}function Bo(){return Xa(" ")}function ae(e,t,i){i==null?e.removeAttribute(t):e.getAttribute(t)!==i&&e.setAttribute(t,i)}function gv(e){return Array.from(e.childNodes)}function qd(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function pe(e,t,i,n){i===null?e.style.removeProperty(t):e.style.setProperty(t,i,n?"important":"")}let Ja;function bn(e){Ja=e}const vn=[],ju=[],zr=[],Ru=[],mv=Promise.resolve();let Oo=!1;function vv(){Oo||(Oo=!0,mv.then(eh))}function _o(e){zr.push(e)}const ao=new Set;let pr=0;function eh(){const e=Ja;do{for(;pr<vn.length;){const t=vn[pr];pr++,bn(t),wv(t.$$)}for(bn(null),vn.length=0,pr=0;ju.length;)ju.pop()();for(let t=0;t<zr.length;t+=1){const i=zr[t];ao.has(i)||(ao.add(i),i())}zr.length=0}while(vn.length);for(;Ru.length;)Ru.pop()();Oo=!1,ao.clear(),bn(e)}function wv(e){if(e.fragment!==null){e.update(),Ts(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(_o)}}const yv=new Set;function xv(e,t){e&&e.i&&(yv.delete(e),e.i(t))}function Sv(e,t,i,n){const{fragment:r,on_mount:s,on_destroy:o,after_update:a}=e.$$;r&&r.m(t,i),n||_o(()=>{const l=s.map(Kd).filter(hv);o?o.push(...l):Ts(l),e.$$.on_mount=[]}),a.forEach(_o)}function Cv(e,t){const i=e.$$;i.fragment!==null&&(Ts(i.on_destroy),i.fragment&&i.fragment.d(t),i.on_destroy=i.fragment=null,i.ctx=[])}function Mv(e,t){e.$$.dirty[0]===-1&&(vn.push(e),vv(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Iv(e,t,i,n,r,s,o,a=[-1]){const l=Ja;bn(e);const u=e.$$={fragment:null,ctx:null,props:s,update:Gr,not_equal:r,bound:Lu(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:Lu(),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 y=w.length?w[0]:m;return u.ctx&&r(u.ctx[d],u.ctx[d]=y)&&(!u.skip_bound&&u.bound[d]&&u.bound[d](y),c&&Mv(e,d)),m}):[],u.update(),c=!0,Ts(u.before_update),u.fragment=n?n(u.ctx):!1,t.target){if(t.hydrate){const d=gv(t.target);u.fragment&&u.fragment.l(d),d.forEach(Gn)}else u.fragment&&u.fragment.c();t.intro&&xv(e.$$.fragment),Sv(e,t.target,t.anchor,t.customElement),eh()}bn(l)}class bv{$destroy(){Cv(this,1),this.$destroy=Gr}$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&&!fv(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Vu(e){let t,i,n,r,s,o,a=e[14]&&Bu(e),l=e[15]&&Ou(e);return{c(){t=Vt("div"),i=Vt("div"),a&&a.c(),n=Bo(),r=Vt("span"),s=Xa(e[0]),o=Bo(),l&&l.c(),pe(r,"overflow","hidden"),pe(r,"white-space","nowrap"),pe(r,"text-overflow","ellipsis"),pe(r,"max-width","80px"),ae(i,"class",e[8]),pe(i,"background-color",e[2]),pe(i,"color",e[9]),pe(i,"opacity",e[11]),ae(t,"class","netless-window-manager-cursor-name")},m(u,c){Ns(u,t,c),xt(t,i),a&&a.m(i,null),xt(i,n),xt(i,r),xt(r,s),xt(i,o),l&&l.m(i,null)},p(u,c){u[14]?a?a.p(u,c):(a=Bu(u),a.c(),a.m(i,n)):a&&(a.d(1),a=null),c&1&&qd(s,u[0]),u[15]?l?l.p(u,c):(l=Ou(u),l.c(),l.m(i,null)):l&&(l.d(1),l=null),c&256&&ae(i,"class",u[8]),c&4&&pe(i,"background-color",u[2]),c&512&&pe(i,"color",u[9]),c&2048&&pe(i,"opacity",u[11])},d(u){u&&Gn(t),a&&a.d(),l&&l.d()}}}function Bu(e){let t,i;return{c(){t=Vt("img"),ae(t,"class","netless-window-manager-cursor-selector-avatar"),ae(t,"style",e[16]()),Yr(t.src,i=e[7])||ae(t,"src",i),ae(t,"alt","avatar")},m(n,r){Ns(n,t,r)},p(n,r){r&128&&!Yr(t.src,i=n[7])&&ae(t,"src",i)},d(n){n&&Gn(t)}}}function Ou(e){let t,i;return{c(){t=Vt("span"),i=Xa(e[1]),ae(t,"class","netless-window-manager-cursor-tag-name"),pe(t,"background-color",e[10])},m(n,r){Ns(n,t,r),xt(t,i)},p(n,r){r&2&&qd(i,n[1]),r&1024&&pe(t,"background-color",n[10])},d(n){n&&Gn(t)}}}function Ev(e){let t,i,n,r,s,o,a=!e[12]&&Vu(e);return{c(){t=Vt("div"),a&&a.c(),i=Bo(),n=Vt("div"),r=Vt("img"),ae(r,"class",s="netless-window-manager-cursor-"+e[3]+"-image"),Yr(r.src,o=e[6])||ae(r,"src",o),ae(r,"alt",e[3]),ae(n,"class","cursor-image-wrapper"),ae(t,"class","netless-window-manager-cursor-mid"),pe(t,"transform","translateX("+e[4]+"px) translateY("+e[5]+"px)"),pe(t,"display",e[13])},m(l,u){Ns(l,t,u),a&&a.m(t,null),xt(t,i),xt(t,n),xt(n,r)},p(l,[u]){l[12]?a&&(a.d(1),a=null):a?a.p(l,u):(a=Vu(l),a.c(),a.m(t,i)),u&8&&s!==(s="netless-window-manager-cursor-"+l[3]+"-image")&&ae(r,"class",s),u&64&&!Yr(r.src,o=l[6])&&ae(r,"src",o),u&8&&ae(r,"alt",l[3]),u&48&&pe(t,"transform","translateX("+l[4]+"px) translateY("+l[5]+"px)"),u&8192&&pe(t,"display",l[13])},i:Gr,o:Gr,d(l){l&&Gn(t),a&&a.d()}}}function Av(e,t,i){let n,r,s,o,a,{cursorName:l}=t,{tagName:u}=t,{backgroundColor:c}=t,{appliance:d}=t,{x:m}=t,{y:w}=t,{src:y}=t,{visible:M}=t,{avatar:p}=t,{theme:h}=t,{color:f}=t,{cursorTagBackgroundColor:g}=t,{opacity:v}=t;const C=()=>Object.entries({width:(n?19:28)+"px",height:(n?19:28)+"px",position:n?"initial":"absolute","border-color":n?"white":c,"margin-right":(n?4:0)+"px"}).map(([x,N])=>`${x}: ${N}`).join(";");return e.$$set=x=>{"cursorName"in x&&i(0,l=x.cursorName),"tagName"in x&&i(1,u=x.tagName),"backgroundColor"in x&&i(2,c=x.backgroundColor),"appliance"in x&&i(3,d=x.appliance),"x"in x&&i(4,m=x.x),"y"in x&&i(5,w=x.y),"src"in x&&i(6,y=x.src),"visible"in x&&i(17,M=x.visible),"avatar"in x&&i(7,p=x.avatar),"theme"in x&&i(8,h=x.theme),"color"in x&&i(9,f=x.color),"cursorTagBackgroundColor"in x&&i(10,g=x.cursorTagBackgroundColor),"opacity"in x&&i(11,v=x.opacity)},e.$$.update=()=>{e.$$.dirty&1&&(n=!b.isEmpty(l)),e.$$.dirty&2&&i(15,r=!b.isEmpty(u)),e.$$.dirty&128&&i(14,s=!b.isEmpty(p)),e.$$.dirty&131072&&i(13,o=M?"initial":"none"),e.$$.dirty&8&&i(12,a=d===E.ApplianceNames.laserPointer)},[l,u,c,d,m,w,y,p,h,f,g,v,a,o,s,r,C,M]}class Tv extends bv{constructor(t){super();Iv(this,t,Av,Ev,pv,{cursorName:0,tagName:1,backgroundColor:2,appliance:3,x:4,y:5,src:6,visible:17,avatar:7,theme:8,color:9,cursorTagBackgroundColor:10,opacity:11})}}class Nv{constructor(t,i,n,r){this.manager=t,this.memberId=i,this.cursorManager=n,this.wrapper=r,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.leave=()=>{this.hide()},this.updateMember(),this.createCursor(),this.autoHidden()}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(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 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 Tv({target:this.wrapper,props:this.initProps()}))}initProps(){return{x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName}}getIcon(){if(this.member){const t=this.cursorManager.applianceIcons;return t[this.memberApplianceName||E.ApplianceNames.shape]||t[E.ApplianceNames.shape]}}updateMember(){return this.member=zd(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var t;(t=this.component)==null||t.$set(b.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 kv="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==",Pv="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==",zv="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=",Dv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",Lv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",jv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+";const _u={[E.ApplianceNames.pencil]:kv,[E.ApplianceNames.selector]:Pv,[E.ApplianceNames.eraser]:zv,[E.ApplianceNames.shape]:Dv,[E.ApplianceNames.text]:Lv,[E.ApplianceNames.laserPointer]:jv};class Rv{constructor(t,i,n){var s;this.manager=t,this.enableCursor=i,this.cursorInstances=new Map,this.sideEffectManager=new be.SideEffectManager,this.store=this.manager.store,this.applianceIcons=_u,this.onCursorMove=o=>{const a=this.initCursorInstance(o.uid);if(o.state===xd.Leave)a.leave();else{const l=a.updateMember();this.canMoveCursor(l)&&a.move(o.position)}},this.initCursorInstance=o=>{let a=this.cursorInstances.get(o);return a||(a=new Nv(this.manager,o,this,ye.playground),this.cursorInstances.set(o,a)),a},this.mouseMoveListener=b.throttle(o=>{o.pointerType==="touch"&&!o.isPrimary||this.updateCursor(this.getType(o),o.clientX,o.clientY)},16),this.getPoint=(o,a,l)=>{var c;const u=(c=o==null?void 0:o.divElement)==null?void 0:c.getBoundingClientRect();if(u)return o==null?void 0:o.convertToPointInWorld({x:a-u.x,y:l-u.y})},this.getType=o=>{var u;const a=o.target,l=this.manager.focusApp;switch(a.parentElement){case this.mainViewElement:return{type:"main"};case((u=l==null?void 0:l.view)==null?void 0:u.divElement):return{type:"app"};default:return{type:"main"}}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.roomMembers=(s=this.manager.room)==null?void 0:s.state.roomMembers;const r=ye.playground;r&&this.setupWrapper(r),this.sideEffectManager.add(()=>L.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>L.on("playgroundSizeChange",()=>this.updateContainerRect())),n&&(this.applianceIcons=Q(Q({},_u),n))}canMoveCursor(t){const i=(t==null?void 0:t.memberState.currentApplianceName)===E.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}updateCursor(t,i,n){if(this.wrapperRect&&this.manager.canOperate){const r=t.type==="main"?this.manager.mainView:this.focusView,s=this.getPoint(r,i,n);s&&this.manager.dispatchInternalEvent(Z.CursorMove,{uid:this.manager.uid,position:{x:s.x,y:s.y,type:t.type}})}}updateContainerRect(){var t,i;this.containerRect=(t=ye.container)==null?void 0:t.getBoundingClientRect(),this.wrapperRect=(i=ye.playground)==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 Vv{constructor(t){this.manager=t,L.on("changePageState",()=>{ie.emit("pageStateChange",this.toObject())})}get index(){var t;return((t=this.manager)==null?void 0:t.store.getMainViewSceneIndex())||0}get length(){var t;return((t=this.manager)==null?void 0:t.mainViewScenesLength)||0}toObject(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}}class Bv{constructor(t){this.ctx=t,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=i=>{var n;i===E.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===E.RoomPhase.Connected&&this.phase===E.RoomPhase.Reconnecting&&((n=this.room)==null||n.dispatchMagixEvent(Xs,{})),this.phase=i},this.onReconnected=b.debounce(()=>{this._onReconnected()},3e3),this._onReconnected=()=>{Li("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,n)=>{b.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(Xs,i=>{i.authorId===t.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(t){this.ctx=t}releaseDisposers(){this.disposers.forEach(t=>{b.isFunction(t)&&t()}),this.disposers.clear()}refresh(){this._onReconnected()}add(t,i){const n=this.disposers.get(t);return n&&b.isFunction(n)&&n(),b.isFunction(i)&&(this.reactors.set(t,i),this.disposers.set(t,i())),()=>this.remove(t)}remove(t){this.reactors.has(t)&&this.reactors.delete(t);const i=this.disposers.get(t);i&&(b.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(Xs,this.onReconnected),this.releaseDisposers()}}const Ov=(e,t)=>{if(E.isPlayer(e))Uv(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),_v(e,t)}},_v=(e,t)=>{const i=e.removeScenes;e.removeScenes=(n,r)=>{var o;n===ze&&((o=t.appManager)==null||o.updateRootDirRemoving(!0));const s=i.call(e,n);return L.emit("removeScenes",{scenePath:n,index:r}),s}},Uv=e=>{const t=e.seekToProgressTime;async function i(n){await L.emit("seekStart");const r=await t.call(e,n);return L.emit("seek",n),r}e.seekToProgressTime=i};var $v=Object.defineProperty,Wv=Object.defineProperties,Hv=Object.getOwnPropertyDescriptors,Uu=Object.getOwnPropertySymbols,Fv=Object.prototype.hasOwnProperty,Qv=Object.prototype.propertyIsEnumerable,$u=(e,t,i)=>t in e?$v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,th=(e,t)=>{for(var i in t||(t={}))Fv.call(t,i)&&$u(e,i,t[i]);if(Uu)for(var i of Uu(t))Qv.call(t,i)&&$u(e,i,t[i]);return e},ih=(e,t)=>Wv(e,Hv(t)),Zv=`.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}
16
- `;const Gv=(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);!Yv(r,s)&&n||Object.defineProperty(e,i,s)},Yv=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)},Xv=(e,t)=>{const i=Object.getPrototypeOf(t);i!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,i)},Jv=(e,t)=>`/* Wrapped ${e}*/
17
- ${t}`,Kv=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),qv=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),ew=(e,t,i)=>{const n=i===""?"":`with ${i.trim()}() `,r=Jv.bind(null,n,t.toString());Object.defineProperty(r,"name",qv),Object.defineProperty(e,"toString",ih(th({},Kv),{value:r}))};function tw(e,t,{ignoreNonConfigurable:i=!1}={}){const{name:n}=e;for(const r of Reflect.ownKeys(t))Gv(e,t,r,i);return Xv(e,t),ew(e,t,n),e}const iw=(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.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))},y=r&&!o;return clearTimeout(o),o=setTimeout(m,i),n>0&&n!==Number.Infinity&&!a&&(a=setTimeout(w,n)),y&&(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},nh="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",nw=nh.length,Wu=Array(20),sn=()=>{for(let e=0;e<20;e++)Wu[e]=nh.charAt(Math.random()*nw);return Wu.join("")};class ks{constructor(){this.disposers=new Map}add(t,i=sn()){return this.flush(i),this.disposers.set(i,t()),i}addDisposer(t,i=sn()){return this.flush(i),this.disposers.set(i,t),i}addEventListener(t,i,n,r,s=sn()){return this.add(()=>(t.addEventListener(i,n,r),()=>t.removeEventListener(i,n,r)),s),s}setTimeout(t,i,n=sn()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(n),t()},i);return()=>window.clearTimeout(r)},n)}setInterval(t,i,n=sn()){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 li=[],rw=function(){return li.some(function(e){return e.activeTargets.length>0})},sw=function(){return li.some(function(e){return e.skippedTargets.length>0})},Hu="ResizeObserver loop completed with undelivered notifications.",ow=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Hu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Hu),window.dispatchEvent(e)},Vn;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Vn||(Vn={}));var ui=function(e){return Object.freeze(e)},aw=function(){function e(t,i){this.inlineSize=t,this.blockSize=i,ui(this)}return e}(),rh=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,ui(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}(),Ka=function(e){return e instanceof SVGElement&&"getBBox"in e},sh=function(e){if(Ka(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)},Fu=function(e){var t,i;if(e instanceof Element)return!0;var n=(i=(t=e)===null||t===void 0?void 0:t.ownerDocument)===null||i===void 0?void 0:i.defaultView;return!!(n&&e instanceof n.Element)},lw=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},En=typeof window!="undefined"?window:{},fr=new WeakMap,Qu=/auto|scroll/,uw=/^tb|vertical/,cw=/msie|trident/i.test(En.navigator&&En.navigator.userAgent),nt=function(e){return parseFloat(e||"0")},Ri=function(e,t,i){return e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=!1),new aw((i?t:e)||0,(i?e:t)||0)},Zu=ui({devicePixelContentBoxSize:Ri(),borderBoxSize:Ri(),contentBoxSize:Ri(),contentRect:new rh(0,0,0,0)}),oh=function(e,t){if(t===void 0&&(t=!1),fr.has(e)&&!t)return fr.get(e);if(sh(e))return fr.set(e,Zu),Zu;var i=getComputedStyle(e),n=Ka(e)&&e.ownerSVGElement&&e.getBBox(),r=!cw&&i.boxSizing==="border-box",s=uw.test(i.writingMode||""),o=!n&&Qu.test(i.overflowY||""),a=!n&&Qu.test(i.overflowX||""),l=n?0:nt(i.paddingTop),u=n?0:nt(i.paddingRight),c=n?0:nt(i.paddingBottom),d=n?0:nt(i.paddingLeft),m=n?0:nt(i.borderTopWidth),w=n?0:nt(i.borderRightWidth),y=n?0:nt(i.borderBottomWidth),M=n?0:nt(i.borderLeftWidth),p=d+u,h=l+c,f=M+w,g=m+y,v=a?e.offsetHeight-g-e.clientHeight:0,C=o?e.offsetWidth-f-e.clientWidth:0,x=r?p+f:0,N=r?h+g:0,z=n?n.width:nt(i.width)-x-C,k=n?n.height:nt(i.height)-N-v,K=z+p+C+f,q=k+h+v+g,ce=ui({devicePixelContentBoxSize:Ri(Math.round(z*devicePixelRatio),Math.round(k*devicePixelRatio),s),borderBoxSize:Ri(K,q,s),contentBoxSize:Ri(z,k,s),contentRect:new rh(d,l,z,k)});return fr.set(e,ce),ce},ah=function(e,t,i){var n=oh(e,i),r=n.borderBoxSize,s=n.contentBoxSize,o=n.devicePixelContentBoxSize;switch(t){case Vn.DEVICE_PIXEL_CONTENT_BOX:return o;case Vn.BORDER_BOX:return r;default:return s}},dw=function(){function e(t){var i=oh(t);this.target=t,this.contentRect=i.contentRect,this.borderBoxSize=ui([i.borderBoxSize]),this.contentBoxSize=ui([i.contentBoxSize]),this.devicePixelContentBoxSize=ui([i.devicePixelContentBoxSize])}return e}(),lh=function(e){if(sh(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=[];li.forEach(function(o){if(o.activeTargets.length!==0){var a=[];o.activeTargets.forEach(function(u){var c=new dw(u.target),d=lh(u.target);a.push(c),u.lastReportedSize=ah(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},Gu=function(e){li.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(r){r.isActive()&&(lh(r.target)>e?i.activeTargets.push(r):i.skippedTargets.push(r))})})},pw=function(){var e=0;for(Gu(e);rw();)e=hw(),Gu(e);return sw()&&ow(),e>0},lo,uh=[],fw=function(){return uh.splice(0).forEach(function(e){return e()})},gw=function(e){if(!lo){var t=0,i=document.createTextNode(""),n={characterData:!0};new MutationObserver(function(){return fw()}).observe(i,n),lo=function(){i.textContent=""+(t?t--:t++)}}uh.push(e),lo()},mw=function(e){gw(function(){requestAnimationFrame(e)})},Dr=0,vw=function(){return!!Dr},ww=250,yw={attributes:!0,characterData:!0,childList:!0,subtree:!0},Yu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Xu=function(e){return e===void 0&&(e=0),Date.now()+e},uo=!1,xw=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=ww),!uo){uo=!0;var n=Xu(t);mw(function(){var r=!1;try{r=pw()}finally{if(uo=!1,t=n-Xu(),!vw())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,yw)};document.body?i():En.addEventListener("DOMContentLoaded",i)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Yu.forEach(function(i){return En.addEventListener(i,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Yu.forEach(function(i){return En.removeEventListener(i,t.listener,!0)}),this.stopped=!0)},e}(),Uo=new xw,Ju=function(e){!Dr&&e>0&&Uo.start(),Dr+=e,!Dr&&Uo.stop()},Sw=function(e){return!Ka(e)&&!lw(e)&&getComputedStyle(e).display==="inline"},Cw=function(){function e(t,i){this.target=t,this.observedBox=i||Vn.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=ah(this.target,this.observedBox,!0);return Sw(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Mw=function(){function e(t,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=i}return e}(),gr=new WeakMap,Ku=function(e,t){for(var i=0;i<e.length;i+=1)if(e[i].target===t)return i;return-1},mr=function(){function e(){}return e.connect=function(t,i){var n=new Mw(t,i);gr.set(t,n)},e.observe=function(t,i,n){var r=gr.get(t),s=r.observationTargets.length===0;Ku(r.observationTargets,i)<0&&(s&&li.push(r),r.observationTargets.push(new Cw(i,n&&n.box)),Ju(1),Uo.schedule())},e.unobserve=function(t,i){var n=gr.get(t),r=Ku(n.observationTargets,i),s=n.observationTargets.length===1;r>=0&&(s&&li.splice(li.indexOf(n),1),n.observationTargets.splice(r,1),Ju(-1))},e.disconnect=function(t){var i=this,n=gr.get(t);n.observationTargets.slice().forEach(function(r){return i.unobserve(t,r.target)}),n.activeTargets.splice(0,n.activeTargets.length)},e}(),Iw=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.");mr.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(!Fu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");mr.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(!Fu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");mr.unobserve(this,t)},e.prototype.disconnect=function(){mr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function bw(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 Ew(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 Aw(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 Tw(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 Nw(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 Si=typeof window!="undefined",ch=Si&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),dh=Si&&"IntersectionObserver"in window,hh=Si&&"classList"in document.createElement("p"),ph=Si&&window.devicePixelRatio>1,kw={elements_selector:".lazy",container:ch||Si?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_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},fh=e=>Object.assign({},kw,e),qu=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)},Pw=(e,t)=>{if(!!t)if(!t.length)qu(e,t);else for(let i=0,n;n=t[i];i+=1)qu(e,n)},bt="src",qa="srcset",el="sizes",gh="poster",Yn="llOriginalAttrs",mh="data",tl="loading",vh="loaded",wh="applied",zw="entered",il="error",yh="native",xh="data-",Sh="ll-status",Re=(e,t)=>e.getAttribute(xh+t),Dw=(e,t,i)=>{var n=xh+t;if(i===null){e.removeAttribute(n);return}e.setAttribute(n,i)},Xn=e=>Re(e,Sh),Ci=(e,t)=>Dw(e,Sh,t),Ps=e=>Ci(e,null),nl=e=>Xn(e)===null,Lw=e=>Xn(e)===tl,jw=e=>Xn(e)===il,rl=e=>Xn(e)===yh,Rw=[tl,vh,wh,il],Vw=e=>Rw.indexOf(Xn(e))>=0,Xt=(e,t,i,n)=>{if(!!e){if(n!==void 0){e(t,i,n);return}if(i!==void 0){e(t,i);return}e(t)}},Ki=(e,t)=>{if(hh){e.classList.add(t);return}e.className+=(e.className?" ":"")+t},st=(e,t)=>{if(hh){e.classList.remove(t);return}e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},Bw=e=>{e.llTempImage=document.createElement("IMG")},Ow=e=>{delete e.llTempImage},Ch=e=>e.llTempImage,zs=(e,t)=>{if(!t)return;const i=t._observer;!i||i.unobserve(e)},_w=e=>{e.disconnect()},Uw=(e,t,i)=>{t.unobserve_entered&&zs(e,i)},sl=(e,t)=>{!e||(e.loadingCount+=t)},$w=e=>{!e||(e.toLoadCount-=1)},Mh=(e,t)=>{!e||(e.toLoadCount=t)},Ww=e=>e.loadingCount>0,Hw=e=>e.toLoadCount>0,Ih=e=>{let t=[];for(let i=0,n;n=e.children[i];i+=1)n.tagName==="SOURCE"&&t.push(n);return t},ol=(e,t)=>{const i=e.parentNode;if(!i||i.tagName!=="PICTURE")return;Ih(i).forEach(t)},bh=(e,t)=>{Ih(e).forEach(t)},Ds=[bt],Eh=[bt,gh],Xr=[bt,qa,el],Ah=[mh],Ls=e=>!!e[Yn],Th=e=>e[Yn],Nh=e=>delete e[Yn],Wi=(e,t)=>{if(Ls(e))return;const i={};t.forEach(n=>{i[n]=e.getAttribute(n)}),e[Yn]=i},Fw=e=>{Ls(e)||(e[Yn]={backgroundImage:e.style.backgroundImage})},Qw=(e,t,i)=>{if(!i){e.removeAttribute(t);return}e.setAttribute(t,i)},Hi=(e,t)=>{if(!Ls(e))return;const i=Th(e);t.forEach(n=>{Qw(e,n,i[n])})},Zw=e=>{if(!Ls(e))return;const t=Th(e);e.style.backgroundImage=t.backgroundImage},Gw=(e,t,i)=>{Ki(e,t.class_applied),Ci(e,wh),i&&(t.unobserve_completed&&zs(e,t),Xt(t.callback_applied,e,i))},kh=(e,t,i)=>{Ki(e,t.class_loading),Ci(e,tl),i&&(sl(i,1),Xt(t.callback_loading,e,i))},Bt=(e,t,i)=>{!i||e.setAttribute(t,i)},ec=(e,t)=>{Bt(e,el,Re(e,t.data_sizes)),Bt(e,qa,Re(e,t.data_srcset)),Bt(e,bt,Re(e,t.data_src))},Yw=(e,t)=>{ol(e,i=>{Wi(i,Xr),ec(i,t)}),Wi(e,Xr),ec(e,t)},Xw=(e,t)=>{Wi(e,Ds),Bt(e,bt,Re(e,t.data_src))},Jw=(e,t)=>{bh(e,i=>{Wi(i,Ds),Bt(i,bt,Re(i,t.data_src))}),Wi(e,Eh),Bt(e,gh,Re(e,t.data_poster)),Bt(e,bt,Re(e,t.data_src)),e.load()},Kw=(e,t)=>{Wi(e,Ah),Bt(e,mh,Re(e,t.data_src))},qw=(e,t,i)=>{const n=Re(e,t.data_bg),r=Re(e,t.data_bg_hidpi),s=ph&&r?r:n;!s||(e.style.backgroundImage=`url("${s}")`,Ch(e).setAttribute(bt,s),kh(e,t,i))},ey=(e,t,i)=>{const n=Re(e,t.data_bg_multi),r=Re(e,t.data_bg_multi_hidpi),s=ph&&r?r:n;!s||(e.style.backgroundImage=s,Gw(e,t,i))},Ph={IMG:Yw,IFRAME:Xw,VIDEO:Jw,OBJECT:Kw},ty=(e,t)=>{const i=Ph[e.tagName];!i||i(e,t)},iy=(e,t,i)=>{const n=Ph[e.tagName];!n||(n(e,t),kh(e,t,i))},ny=["IMG","IFRAME","VIDEO","OBJECT"],ry=e=>ny.indexOf(e.tagName)>-1,zh=(e,t)=>{t&&!Ww(t)&&!Hw(t)&&Xt(e.callback_finish,t)},tc=(e,t,i)=>{e.addEventListener(t,i),e.llEvLisnrs[t]=i},sy=(e,t,i)=>{e.removeEventListener(t,i)},al=e=>!!e.llEvLisnrs,oy=(e,t,i)=>{al(e)||(e.llEvLisnrs={});const n=e.tagName==="VIDEO"?"loadeddata":"load";tc(e,n,t),tc(e,"error",i)},$o=e=>{if(!al(e))return;const t=e.llEvLisnrs;for(let i in t){const n=t[i];sy(e,i,n)}delete e.llEvLisnrs},Dh=(e,t,i)=>{Ow(e),sl(i,-1),$w(i),st(e,t.class_loading),t.unobserve_completed&&zs(e,i)},ay=(e,t,i,n)=>{const r=rl(t);Dh(t,i,n),Ki(t,i.class_loaded),Ci(t,vh),Xt(i.callback_loaded,t,n),r||zh(i,n)},ly=(e,t,i,n)=>{const r=rl(t);Dh(t,i,n),Ki(t,i.class_error),Ci(t,il),Xt(i.callback_error,t,n),r||zh(i,n)},ll=(e,t,i)=>{const n=Ch(e)||e;if(al(n))return;oy(n,o=>{ay(o,e,t,i),$o(n)},o=>{ly(o,e,t,i),$o(n)})},uy=(e,t,i)=>{Bw(e),ll(e,t,i),Fw(e),qw(e,t,i),ey(e,t,i)},cy=(e,t,i)=>{ll(e,t,i),iy(e,t,i)},ul=(e,t,i)=>{ry(e)?cy(e,t,i):uy(e,t,i)},dy=(e,t,i)=>{e.setAttribute("loading","lazy"),ll(e,t,i),ty(e,t),Ci(e,yh)},ic=e=>{e.removeAttribute(bt),e.removeAttribute(qa),e.removeAttribute(el)},hy=e=>{ol(e,t=>{ic(t)}),ic(e)},Lh=e=>{ol(e,t=>{Hi(t,Xr)}),Hi(e,Xr)},py=e=>{bh(e,t=>{Hi(t,Ds)}),Hi(e,Eh),e.load()},fy=e=>{Hi(e,Ds)},gy=e=>{Hi(e,Ah)},my={IMG:Lh,IFRAME:fy,VIDEO:py,OBJECT:gy},vy=e=>{const t=my[e.tagName];if(!t){Zw(e);return}t(e)},wy=(e,t)=>{nl(e)||rl(e)||(st(e,t.class_entered),st(e,t.class_exited),st(e,t.class_applied),st(e,t.class_loading),st(e,t.class_loaded),st(e,t.class_error))},yy=(e,t)=>{vy(e),wy(e,t),Ps(e),Nh(e)},xy=(e,t,i,n)=>{!i.cancel_on_exit||!Lw(e)||e.tagName==="IMG"&&($o(e),hy(e),Lh(e),st(e,i.class_loading),sl(n,-1),Ps(e),Xt(i.callback_cancel,e,t,n))},Sy=(e,t,i,n)=>{const r=Vw(e);Ci(e,zw),Ki(e,i.class_entered),st(e,i.class_exited),Uw(e,i,n),Xt(i.callback_enter,e,t,n),!r&&ul(e,i,n)},Cy=(e,t,i,n)=>{nl(e)||(Ki(e,i.class_exited),xy(e,t,i,n),Xt(i.callback_exit,e,t,n))},My=["IMG","IFRAME","VIDEO"],jh=e=>e.use_native&&"loading"in HTMLImageElement.prototype,Iy=(e,t,i)=>{e.forEach(n=>{My.indexOf(n.tagName)!==-1&&dy(n,t,i)}),Mh(i,0)},by=e=>e.isIntersecting||e.intersectionRatio>0,Ey=e=>({root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),Ay=(e,t,i)=>{e.forEach(n=>by(n)?Sy(n.target,n,t,i):Cy(n.target,n,t,i))},Ty=(e,t)=>{t.forEach(i=>{e.observe(i)})},Ny=(e,t)=>{_w(e),Ty(e,t)},ky=(e,t)=>{!dh||jh(e)||(t._observer=new IntersectionObserver(i=>{Ay(i,e,t)},Ey(e)))},Rh=e=>Array.prototype.slice.call(e),Jr=e=>e.container.querySelectorAll(e.elements_selector),Py=e=>Rh(e).filter(nl),zy=e=>jw(e),Dy=e=>Rh(e).filter(zy),nc=(e,t)=>Py(e||Jr(t)),Ly=(e,t)=>{Dy(Jr(e)).forEach(n=>{st(n,e.class_error),Ps(n)}),t.update()},jy=(e,t)=>{!Si||window.addEventListener("online",()=>{Ly(e,t)})},Jn=function(e,t){const i=fh(e);this._settings=i,this.loadingCount=0,ky(i,this),jy(i,this),this.update(t)};Jn.prototype={update:function(e){const t=this._settings,i=nc(e,t);if(Mh(this,i.length),ch||!dh){this.loadAll(i);return}if(jh(t)){Iy(i,t,this);return}Ny(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),Jr(this._settings).forEach(e=>{Nh(e)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){const t=this._settings;nc(e,t).forEach(n=>{zs(n,this),ul(n,t,this)})},restoreAll:function(){const e=this._settings;Jr(e).forEach(t=>{yy(t,e)})}};Jn.load=(e,t)=>{const i=fh(t);ul(e,i)};Jn.resetStatus=e=>{Ps(e)};Si&&Pw(Jn,window.lazyLoadOptions);class Vh{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 ks,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.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const t=new Jn({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))}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",bw(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",Ew(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",Tw(this.namespace),Nw(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",Aw(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 Fi(e,t,i){return Math.min(Math.max(e,t),i)}function rc(e){return e.touches?e.touches[0]:e}function Bh(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}class Ry{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 Vy{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 By=window.requestIdleCallback||(e=>window.setTimeout(e,5e3)),Oy=window.cancelIdleCallback||window.clearTimeout;class _y{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 Vy(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=By(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&&(Oy(this.gcTimer),this.gcTimer=null)}}class Uy{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"),ih(th({},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 _y(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=Fi(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 Fi(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 $y=30;class Wy{constructor(t){this.sideEffect=new ks,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||$y,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=Fi(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;Bh(n);const r=this.wrapClassName("scrollbar-dragging");t.classList.toggle(r,!0);const s=this.pagesScrollTop,{clientY:o}=rc(n),a=u=>{if(this.readonly)return;const{clientY:c}=rc(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 Fi(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 Hy=window.ResizeObserver||Iw,on=640;class Fy{constructor({whiteboardView:t,readonly:i,box:n,pages:r,pageScrollTop:s=0,mountWhiteboard:o,onUserScroll:a}){this.sideEffect=new ks,this.userScrolling=!1,this.onNewPageIndex=d=>{this.scrollToPage(d)},this.whiteboardView=t,this.readonly=i,this.box=n,this.pages=r,this.mountWhiteboard=o,this._onUserScroll=a;const l=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,l()},this.viewer=new Vh({readonly:i,box:n,pages:r,onNewPageIndex:this.onNewPageIndex});const{width:u,height:c}=this.whiteboardView.size;this.pageRenderer=new Uy({pagesScrollTop:s,pages:this.pages,containerWidth:u,containerHeight:c,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new Wy({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:u,containerHeight:c,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:d=>{this.pageScrollTo(d),this.updateUserScroll()}}),this.pageScrollStepper=new Ry({start:this.pageRenderer.pagesScrollTop,onStep:d=>{this.pageScrollTo(d)}}),this.render()}mount(){this.viewer.mount(),this.setupScrollListener();const t=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const i=new Hy(t);return i.observe(this.viewer.$content),()=>i.disconnect()}),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100),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<=on;if(this.viewer.setSmallBox(i),i){const n=26/on,r=26/t,s=26/on,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/on,26/t);this.box.$titleBar.style.height=`${n*100}%`}if(this.box.$footer){const n=Math.max(26/on,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=>{Bh(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:Fi(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 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)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=iw(t,i);return this.sideEffect.addDisposer(()=>r.cancel(),n),r}wrapClassName(t){return"netless-app-docs-viewer-static-"+t}}class Qy{constructor({context:t,whiteboardView:i,box:n,pages:r}){this.sideEffect=new ks,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 Vh({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)})}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=Fi(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.box.focus)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 Zy="DocsViewer",Wo={kind:Zy,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:s})=>s?{width:s.width,height:s.height,src:s.src,thumbnail:s.previewURL}:null).filter(s=>Boolean(s));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(Zv),r[0].src.startsWith("ppt")?Yy(e,n,t,r):Gy(e,n,t,r)}};function Gy(e,t,i,n){var r;t.disableCameraTransform=!e.getIsWritable();const s=new Fy({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)}}).mount();e.emitter.on("attributesUpdate",o=>{o&&o.pageScrollTop!=null&&s.syncPageScrollTop(o.pageScrollTop)}),e.emitter.on("writableChange",o=>{s.setReadonly(!o),t.disableCameraTransform=!o})}function Yy(e,t,i,n){t.disableCameraTransform=!0;const r=new Qy({context:e,whiteboardView:t,box:i,pages:n}).mount();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})}})}var Mi={exports:{}},F={};/*
18
- object-assign
19
- (c) Sindre Sorhus
20
- @license MIT
21
- */var sc=Object.getOwnPropertySymbols,Xy=Object.prototype.hasOwnProperty,Jy=Object.prototype.propertyIsEnumerable;function Ky(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function qy(){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 Oh=qy()?Object.assign:function(e,t){for(var i,n=Ky(e),r,s=1;s<arguments.length;s++){i=Object(arguments[s]);for(var o in i)Xy.call(i,o)&&(n[o]=i[o]);if(sc){r=sc(i);for(var a=0;a<r.length;a++)Jy.call(i,r[a])&&(n[r[a]]=i[r[a]])}}return n};/** @license React v16.14.0
22
- * react.production.min.js
23
- *
24
- * Copyright (c) Facebook, Inc. and its affiliates.
25
- *
26
- * This source code is licensed under the MIT license found in the
27
- * LICENSE file in the root directory of this source tree.
28
- */var cl=Oh,et=typeof Symbol=="function"&&Symbol.for,Kn=et?Symbol.for("react.element"):60103,e0=et?Symbol.for("react.portal"):60106,t0=et?Symbol.for("react.fragment"):60107,i0=et?Symbol.for("react.strict_mode"):60108,n0=et?Symbol.for("react.profiler"):60114,r0=et?Symbol.for("react.provider"):60109,s0=et?Symbol.for("react.context"):60110,o0=et?Symbol.for("react.forward_ref"):60112,a0=et?Symbol.for("react.suspense"):60113,l0=et?Symbol.for("react.memo"):60115,u0=et?Symbol.for("react.lazy"):60116,oc=typeof Symbol=="function"&&Symbol.iterator;function qn(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 _h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Uh={};function qi(e,t,i){this.props=e,this.context=t,this.refs=Uh,this.updater=i||_h}qi.prototype.isReactComponent={};qi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error(qn(85));this.updater.enqueueSetState(this,e,t,"setState")};qi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function $h(){}$h.prototype=qi.prototype;function dl(e,t,i){this.props=e,this.context=t,this.refs=Uh,this.updater=i||_h}var hl=dl.prototype=new $h;hl.constructor=dl;cl(hl,qi.prototype);hl.isPureReactComponent=!0;var pl={current:null},Wh=Object.prototype.hasOwnProperty,Hh={key:!0,ref:!0,__self:!0,__source:!0};function Fh(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)Wh.call(t,n)&&!Hh.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:Kn,type:e,key:s,ref:o,props:r,_owner:pl.current}}function c0(e,t){return{$$typeof:Kn,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function fl(e){return typeof e=="object"&&e!==null&&e.$$typeof===Kn}function d0(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(i){return t[i]})}var Qh=/\/+/g,Kr=[];function Zh(e,t,i,n){if(Kr.length){var r=Kr.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 Gh(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>Kr.length&&Kr.push(e)}function Ho(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 Kn:case e0:s=!0}}if(s)return i(n,e,t===""?"."+co(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+co(r,o);s+=Ho(r,a,i,n)}else if(e===null||typeof e!="object"?a=null:(a=oc&&e[oc]||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+co(r,o++),s+=Ho(r,a,i,n);else if(r==="object")throw i=""+e,Error(qn(31,i==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":i,""));return s}function Fo(e,t,i){return e==null?0:Ho(e,"",t,i)}function co(e,t){return typeof e=="object"&&e!==null&&e.key!=null?d0(e.key):t.toString(36)}function h0(e,t){e.func.call(e.context,t,e.count++)}function p0(e,t,i){var n=e.result,r=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?Qo(e,n,i,function(s){return s}):e!=null&&(fl(e)&&(e=c0(e,r+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(Qh,"$&/")+"/")+i)),n.push(e))}function Qo(e,t,i,n,r){var s="";i!=null&&(s=(""+i).replace(Qh,"$&/")+"/"),t=Zh(t,s,n,r),Fo(e,p0,t),Gh(t)}var Yh={current:null};function Et(){var e=Yh.current;if(e===null)throw Error(qn(321));return e}var f0={ReactCurrentDispatcher:Yh,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:pl,IsSomeRendererActing:{current:!1},assign:cl};F.Children={map:function(e,t,i){if(e==null)return e;var n=[];return Qo(e,n,null,t,i),n},forEach:function(e,t,i){if(e==null)return e;t=Zh(null,null,t,i),Fo(e,h0,t),Gh(t)},count:function(e){return Fo(e,function(){return null},null)},toArray:function(e){var t=[];return Qo(e,t,null,function(i){return i}),t},only:function(e){if(!fl(e))throw Error(qn(143));return e}};F.Component=qi;F.Fragment=t0;F.Profiler=n0;F.PureComponent=dl;F.StrictMode=i0;F.Suspense=a0;F.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=f0;F.cloneElement=function(e,t,i){if(e==null)throw Error(qn(267,e));var n=cl({},e.props),r=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=pl.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)Wh.call(t,l)&&!Hh.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:Kn,type:e.type,key:r,ref:s,props:n,_owner:o}};F.createContext=function(e,t){return t===void 0&&(t=null),e={$$typeof:s0,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider={$$typeof:r0,_context:e},e.Consumer=e};F.createElement=Fh;F.createFactory=function(e){var t=Fh.bind(null,e);return t.type=e,t};F.createRef=function(){return{current:null}};F.forwardRef=function(e){return{$$typeof:o0,render:e}};F.isValidElement=fl;F.lazy=function(e){return{$$typeof:u0,_ctor:e,_status:-1,_result:null}};F.memo=function(e,t){return{$$typeof:l0,type:e,compare:t===void 0?null:t}};F.useCallback=function(e,t){return Et().useCallback(e,t)};F.useContext=function(e,t){return Et().useContext(e,t)};F.useDebugValue=function(){};F.useEffect=function(e,t){return Et().useEffect(e,t)};F.useImperativeHandle=function(e,t,i){return Et().useImperativeHandle(e,t,i)};F.useLayoutEffect=function(e,t){return Et().useLayoutEffect(e,t)};F.useMemo=function(e,t){return Et().useMemo(e,t)};F.useReducer=function(e,t,i){return Et().useReducer(e,t,i)};F.useRef=function(e){return Et().useRef(e)};F.useState=function(e){return Et().useState(e)};F.version="16.14.0";Mi.exports=F;var $=Mi.exports,Xh={exports:{}},Qe={},Jh={exports:{}},Kh={};/** @license React v0.19.1
29
- * scheduler.production.min.js
30
- *
31
- * Copyright (c) Facebook, Inc. and its affiliates.
32
- *
33
- * This source code is licensed under the MIT license found in the
34
- * LICENSE file in the root directory of this source tree.
35
- */(function(e){var t,i,n,r,s;if(typeof window=="undefined"||typeof MessageChannel!="function"){var o=null,a=null,l=function(){if(o!==null)try{var I=e.unstable_now();o(!0,I),o=null}catch(P){throw setTimeout(l,0),P}},u=Date.now();e.unstable_now=function(){return Date.now()-u},t=function(I){o!==null?setTimeout(t,0,I):(o=I,setTimeout(l,0))},i=function(I,P){a=setTimeout(I,P)},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 y=window.cancelAnimationFrame;typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),typeof y!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if(typeof c=="object"&&typeof c.now=="function")e.unstable_now=function(){return c.now()};else{var M=d.now();e.unstable_now=function(){return d.now()-M}}var p=!1,h=null,f=-1,g=5,v=0;r=function(){return e.unstable_now()>=v},s=function(){},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):g=0<I?Math.floor(1e3/I):5};var C=new MessageChannel,x=C.port2;C.port1.onmessage=function(){if(h!==null){var I=e.unstable_now();v=I+g;try{h(!0,I)?x.postMessage(null):(p=!1,h=null)}catch(P){throw x.postMessage(null),P}}else p=!1},t=function(I){h=I,p||(p=!0,x.postMessage(null))},i=function(I,P){f=m(function(){I(e.unstable_now())},P)},n=function(){w(f),f=-1}}function N(I,P){var U=I.length;I.push(P);e:for(;;){var Y=U-1>>>1,ee=I[Y];if(ee!==void 0&&0<K(ee,P))I[Y]=P,I[U]=ee,U=Y;else break e}}function z(I){return I=I[0],I===void 0?null:I}function k(I){var P=I[0];if(P!==void 0){var U=I.pop();if(U!==P){I[0]=U;e:for(var Y=0,ee=I.length;Y<ee;){var pt=2*(Y+1)-1,Ze=I[pt],ft=pt+1,At=I[ft];if(Ze!==void 0&&0>K(Ze,U))At!==void 0&&0>K(At,Ze)?(I[Y]=At,I[ft]=U,Y=ft):(I[Y]=Ze,I[pt]=U,Y=pt);else if(At!==void 0&&0>K(At,U))I[Y]=At,I[ft]=U,Y=ft;else break e}}return P}return null}function K(I,P){var U=I.sortIndex-P.sortIndex;return U!==0?U:I.id-P.id}var q=[],ce=[],_=1,D=null,W=3,de=!1,_e=!1,Te=!1;function Kt(I){for(var P=z(ce);P!==null;){if(P.callback===null)k(ce);else if(P.startTime<=I)k(ce),P.sortIndex=P.expirationTime,N(q,P);else break;P=z(ce)}}function bi(I){if(Te=!1,Kt(I),!_e)if(z(q)!==null)_e=!0,t(nn);else{var P=z(ce);P!==null&&i(bi,P.startTime-I)}}function nn(I,P){_e=!1,Te&&(Te=!1,n()),de=!0;var U=W;try{for(Kt(P),D=z(q);D!==null&&(!(D.expirationTime>P)||I&&!r());){var Y=D.callback;if(Y!==null){D.callback=null,W=D.priorityLevel;var ee=Y(D.expirationTime<=P);P=e.unstable_now(),typeof ee=="function"?D.callback=ee:D===z(q)&&k(q),Kt(P)}else k(q);D=z(q)}if(D!==null)var pt=!0;else{var Ze=z(ce);Ze!==null&&i(bi,Ze.startTime-P),pt=!1}return pt}finally{D=null,W=U,de=!1}}function ar(I){switch(I){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var lr=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(I){I.callback=null},e.unstable_continueExecution=function(){_e||de||(_e=!0,t(nn))},e.unstable_getCurrentPriorityLevel=function(){return W},e.unstable_getFirstCallbackNode=function(){return z(q)},e.unstable_next=function(I){switch(W){case 1:case 2:case 3:var P=3;break;default:P=W}var U=W;W=P;try{return I()}finally{W=U}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=lr,e.unstable_runWithPriority=function(I,P){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var U=W;W=I;try{return P()}finally{W=U}},e.unstable_scheduleCallback=function(I,P,U){var Y=e.unstable_now();if(typeof U=="object"&&U!==null){var ee=U.delay;ee=typeof ee=="number"&&0<ee?Y+ee:Y,U=typeof U.timeout=="number"?U.timeout:ar(I)}else U=ar(I),ee=Y;return U=ee+U,I={id:_++,callback:P,priorityLevel:I,startTime:ee,expirationTime:U,sortIndex:-1},ee>Y?(I.sortIndex=ee,N(ce,I),z(q)===null&&I===z(ce)&&(Te?n():Te=!0,i(bi,ee-Y))):(I.sortIndex=U,N(q,I),_e||de||(_e=!0,t(nn))),I},e.unstable_shouldYield=function(){var I=e.unstable_now();Kt(I);var P=z(q);return P!==D&&D!==null&&P!==null&&P.callback!==null&&P.startTime<=I&&P.expirationTime<D.expirationTime||r()},e.unstable_wrapCallback=function(I){var P=W;return function(){var U=W;W=P;try{return I.apply(this,arguments)}finally{W=U}}}})(Kh);Jh.exports=Kh;/** @license React v16.14.0
36
- * react-dom.production.min.js
37
- *
38
- * Copyright (c) Facebook, Inc. and its affiliates.
39
- *
40
- * This source code is licensed under the MIT license found in the
41
- * LICENSE file in the root directory of this source tree.
42
- */var js=Mi.exports,Se=Oh,le=Jh.exports;function S(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(!js)throw Error(S(227));function g0(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 An=!1,qr=null,es=!1,Zo=null,m0={onError:function(e){An=!0,qr=e}};function v0(e,t,i,n,r,s,o,a,l){An=!1,qr=null,g0.apply(m0,arguments)}function w0(e,t,i,n,r,s,o,a,l){if(v0.apply(this,arguments),An){if(An){var u=qr;An=!1,qr=null}else throw Error(S(198));es||(es=!0,Zo=u)}}var gl=null,qh=null,ep=null;function ac(e,t,i){var n=e.type||"unknown-event";e.currentTarget=ep(i),w0(n,t,void 0,e),e.currentTarget=null}var ts=null,Ai={};function tp(){if(ts)for(var e in Ai){var t=Ai[e],i=ts.indexOf(e);if(!(-1<i))throw Error(S(96,e));if(!is[i]){if(!t.extractEvents)throw Error(S(97,e));is[i]=t,i=t.eventTypes;for(var n in i){var r=void 0,s=i[n],o=t,a=n;if(Go.hasOwnProperty(a))throw Error(S(99,a));Go[a]=s;var l=s.phasedRegistrationNames;if(l){for(r in l)l.hasOwnProperty(r)&&lc(l[r],o,a);r=!0}else s.registrationName?(lc(s.registrationName,o,a),r=!0):r=!1;if(!r)throw Error(S(98,n,e))}}}}function lc(e,t,i){if(Qi[e])throw Error(S(100,e));Qi[e]=t,ml[e]=t.eventTypes[i].dependencies}var is=[],Go={},Qi={},ml={};function ip(e){var t=!1,i;for(i in e)if(e.hasOwnProperty(i)){var n=e[i];if(!Ai.hasOwnProperty(i)||Ai[i]!==n){if(Ai[i])throw Error(S(102,i));Ai[i]=n,t=!0}}t&&tp()}var Jt=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),Yo=null,Vi=null,Bi=null;function uc(e){if(e=qh(e)){if(typeof Yo!="function")throw Error(S(280));var t=e.stateNode;t&&(t=gl(t),Yo(e.stateNode,e.type,t))}}function np(e){Vi?Bi?Bi.push(e):Bi=[e]:Vi=e}function rp(){if(Vi){var e=Vi,t=Bi;if(Bi=Vi=null,uc(e),t)for(e=0;e<t.length;e++)uc(t[e])}}function vl(e,t){return e(t)}function sp(e,t,i,n,r){return e(t,i,n,r)}function wl(){}var op=vl,ii=!1,ho=!1;function yl(){(Vi!==null||Bi!==null)&&(wl(),rp())}function ap(e,t,i){if(ho)return e(t,i);ho=!0;try{return op(e,t,i)}finally{ho=!1,yl()}}var y0=/^[: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]*$/,cc=Object.prototype.hasOwnProperty,dc={},hc={};function x0(e){return cc.call(hc,e)?!0:cc.call(dc,e)?!1:y0.test(e)?hc[e]=!0:(dc[e]=!0,!1)}function S0(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 C0(e,t,i,n){if(t===null||typeof t=="undefined"||S0(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 Ce(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 ue={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ue[e]=new Ce(e,0,!1,e,null,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ue[t]=new Ce(t,1,!1,e[1],null,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ue[e]=new Ce(e,2,!1,e.toLowerCase(),null,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ue[e]=new Ce(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){ue[e]=new Ce(e,3,!1,e.toLowerCase(),null,!1)});["checked","multiple","muted","selected"].forEach(function(e){ue[e]=new Ce(e,3,!0,e,null,!1)});["capture","download"].forEach(function(e){ue[e]=new Ce(e,4,!1,e,null,!1)});["cols","rows","size","span"].forEach(function(e){ue[e]=new Ce(e,6,!1,e,null,!1)});["rowSpan","start"].forEach(function(e){ue[e]=new Ce(e,5,!1,e.toLowerCase(),null,!1)});var xl=/[\-:]([a-z])/g;function Sl(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(xl,Sl);ue[t]=new Ce(t,1,!1,e,null,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(xl,Sl);ue[t]=new Ce(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(xl,Sl);ue[t]=new Ce(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)});["tabIndex","crossOrigin"].forEach(function(e){ue[e]=new Ce(e,1,!1,e.toLowerCase(),null,!1)});ue.xlinkHref=new Ce("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0);["src","href","action","formAction"].forEach(function(e){ue[e]=new Ce(e,1,!1,e.toLowerCase(),null,!0)});var Ke=js.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Ke.hasOwnProperty("ReactCurrentDispatcher")||(Ke.ReactCurrentDispatcher={current:null});Ke.hasOwnProperty("ReactCurrentBatchConfig")||(Ke.ReactCurrentBatchConfig={suspense:null});function Cl(e,t,i,n){var r=ue.hasOwnProperty(t)?ue[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||(C0(t,i,r,n)&&(i=null),n||r===null?x0(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 M0=/^(.*)[\\\/]/,Ae=typeof Symbol=="function"&&Symbol.for,vr=Ae?Symbol.for("react.element"):60103,Ti=Ae?Symbol.for("react.portal"):60106,ti=Ae?Symbol.for("react.fragment"):60107,lp=Ae?Symbol.for("react.strict_mode"):60108,Lr=Ae?Symbol.for("react.profiler"):60114,up=Ae?Symbol.for("react.provider"):60109,cp=Ae?Symbol.for("react.context"):60110,I0=Ae?Symbol.for("react.concurrent_mode"):60111,Ml=Ae?Symbol.for("react.forward_ref"):60112,jr=Ae?Symbol.for("react.suspense"):60113,Xo=Ae?Symbol.for("react.suspense_list"):60120,Il=Ae?Symbol.for("react.memo"):60115,dp=Ae?Symbol.for("react.lazy"):60116,hp=Ae?Symbol.for("react.block"):60121,pc=typeof Symbol=="function"&&Symbol.iterator;function an(e){return e===null||typeof e!="object"?null:(e=pc&&e[pc]||e["@@iterator"],typeof e=="function"?e:null)}function b0(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 It(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 ti:return"Fragment";case Ti:return"Portal";case Lr:return"Profiler";case lp:return"StrictMode";case jr:return"Suspense";case Xo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case cp:return"Context.Consumer";case up:return"Context.Provider";case Ml:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case Il:return It(e.type);case hp:return It(e.render);case dp:if(e=e._status===1?e._result:null)return It(e)}return null}function bl(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=It(e.type);i=null,n&&(i=It(n.type)),n=s,s="",r?s=" (at "+r.fileName.replace(M0,"")+":"+r.lineNumber+")":i&&(s=" (created by "+i+")"),i=`
43
- in `+(n||"Unknown")+s}t+=i,e=e.return}while(e);return t}function Zt(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function pp(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function E0(e){var t=pp(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 wr(e){e._valueTracker||(e._valueTracker=E0(e))}function fp(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),n="";return e&&(n=pp(e)?e.checked?"true":"false":e.value),e=n,e!==i?(t.setValue(e),!0):!1}function Jo(e,t){var i=t.checked;return Se({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i!=null?i:e._wrapperState.initialChecked})}function fc(e,t){var i=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;i=Zt(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 gp(e,t){t=t.checked,t!=null&&Cl(e,"checked",t,!1)}function Ko(e,t){gp(e,t);var i=Zt(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")?qo(e,t.type,i):t.hasOwnProperty("defaultValue")&&qo(e,t.type,Zt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function gc(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 qo(e,t,i){(t!=="number"||e.ownerDocument.activeElement!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}function A0(e){var t="";return js.Children.forEach(e,function(i){i!=null&&(t+=i)}),t}function ea(e,t){return e=Se({children:void 0},t),(t=A0(t.children))&&(e.children=t),e}function Oi(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=""+Zt(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 ta(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(S(91));return Se({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function mc(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(S(92));if(Array.isArray(i)){if(!(1>=i.length))throw Error(S(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:Zt(i)}}function mp(e,t){var i=Zt(t.value),n=Zt(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 vc(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}var vp={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function wp(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 ia(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?wp(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var yr,yp=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!==vp.svg||"innerHTML"in e)e.innerHTML=t;else{for(yr=yr||document.createElement("div"),yr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Bn(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}function xr(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Ni={animationend:xr("Animation","AnimationEnd"),animationiteration:xr("Animation","AnimationIteration"),animationstart:xr("Animation","AnimationStart"),transitionend:xr("Transition","TransitionEnd")},po={},xp={};Jt&&(xp=document.createElement("div").style,"AnimationEvent"in window||(delete Ni.animationend.animation,delete Ni.animationiteration.animation,delete Ni.animationstart.animation),"TransitionEvent"in window||delete Ni.transitionend.transition);function Rs(e){if(po[e])return po[e];if(!Ni[e])return e;var t=Ni[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in xp)return po[e]=t[i];return e}var Sp=Rs("animationend"),Cp=Rs("animationiteration"),Mp=Rs("animationstart"),Ip=Rs("transitionend"),wn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),wc=new(typeof WeakMap=="function"?WeakMap:Map);function El(e){var t=wc.get(e);return t===void 0&&(t=new Map,wc.set(e,t)),t}function Ii(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 bp(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 yc(e){if(Ii(e)!==e)throw Error(S(188))}function T0(e){var t=e.alternate;if(!t){if(t=Ii(e),t===null)throw Error(S(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 yc(r),e;if(s===n)return yc(r),t;s=s.sibling}throw Error(S(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(S(189))}}if(i.alternate!==n)throw Error(S(190))}if(i.tag!==3)throw Error(S(188));return i.stateNode.current===i?e:t}function Ep(e){if(e=T0(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 Zi(e,t){if(t==null)throw Error(S(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 Al(e,t,i){Array.isArray(e)?e.forEach(t,i):e&&t.call(i,e)}var ln=null;function N0(e){if(e){var t=e._dispatchListeners,i=e._dispatchInstances;if(Array.isArray(t))for(var n=0;n<t.length&&!e.isPropagationStopped();n++)ac(e,t[n],i[n]);else t&&ac(e,t,i);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function Vs(e){if(e!==null&&(ln=Zi(ln,e)),e=ln,ln=null,e){if(Al(e,N0),ln)throw Error(S(95));if(es)throw e=Zo,es=!1,Zo=null,e}}function Tl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}function Ap(e){if(!Jt)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 ns=[];function Tp(e){e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>ns.length&&ns.push(e)}function Np(e,t,i,n){if(ns.length){var r=ns.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 kp(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=tr(n)}while(i);for(i=0;i<e.ancestors.length;i++){t=e.ancestors[i];var r=Tl(e.nativeEvent);n=e.topLevelType;var s=e.nativeEvent,o=e.eventSystemFlags;i===0&&(o|=64);for(var a=null,l=0;l<is.length;l++){var u=is[l];u&&(u=u.extractEvents(n,t,s,r,o))&&(a=Zi(a,u))}Vs(a)}}function na(e,t,i){if(!i.has(e)){switch(e){case"scroll":yn(t,"scroll",!0);break;case"focus":case"blur":yn(t,"focus",!0),yn(t,"blur",!0),i.set("blur",null),i.set("focus",null);break;case"cancel":case"close":Ap(e)&&yn(t,e,!0);break;case"invalid":case"submit":case"reset":break;default:wn.indexOf(e)===-1&&X(e,t)}i.set(e,null)}}var Pp,Nl,zp,ra=!1,ot=[],Ot=null,_t=null,Ut=null,On=new Map,_n=new Map,un=[],sa="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(" "),k0="focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture".split(" ");function P0(e,t){var i=El(t);sa.forEach(function(n){na(n,t,i)}),k0.forEach(function(n){na(n,t,i)})}function oa(e,t,i,n,r){return{blockedOn:e,topLevelType:t,eventSystemFlags:i|32,nativeEvent:r,container:n}}function xc(e,t){switch(e){case"focus":case"blur":Ot=null;break;case"dragenter":case"dragleave":_t=null;break;case"mouseover":case"mouseout":Ut=null;break;case"pointerover":case"pointerout":On.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_n.delete(t.pointerId)}}function cn(e,t,i,n,r,s){return e===null||e.nativeEvent!==s?(e=oa(t,i,n,r,s),t!==null&&(t=ir(t),t!==null&&Nl(t)),e):(e.eventSystemFlags|=n,e)}function z0(e,t,i,n,r){switch(t){case"focus":return Ot=cn(Ot,e,t,i,n,r),!0;case"dragenter":return _t=cn(_t,e,t,i,n,r),!0;case"mouseover":return Ut=cn(Ut,e,t,i,n,r),!0;case"pointerover":var s=r.pointerId;return On.set(s,cn(On.get(s)||null,e,t,i,n,r)),!0;case"gotpointercapture":return s=r.pointerId,_n.set(s,cn(_n.get(s)||null,e,t,i,n,r)),!0}return!1}function D0(e){var t=tr(e.target);if(t!==null){var i=Ii(t);if(i!==null){if(t=i.tag,t===13){if(t=bp(i),t!==null){e.blockedOn=t,le.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 Rr(e){if(e.blockedOn!==null)return!1;var t=zl(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);if(t!==null){var i=ir(t);return i!==null&&Nl(i),e.blockedOn=t,!1}return!0}function Sc(e,t,i){Rr(e)&&i.delete(t)}function L0(){for(ra=!1;0<ot.length;){var e=ot[0];if(e.blockedOn!==null){e=ir(e.blockedOn),e!==null&&Pp(e);break}var t=zl(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);t!==null?e.blockedOn=t:ot.shift()}Ot!==null&&Rr(Ot)&&(Ot=null),_t!==null&&Rr(_t)&&(_t=null),Ut!==null&&Rr(Ut)&&(Ut=null),On.forEach(Sc),_n.forEach(Sc)}function dn(e,t){e.blockedOn===t&&(e.blockedOn=null,ra||(ra=!0,le.unstable_scheduleCallback(le.unstable_NormalPriority,L0)))}function Dp(e){function t(r){return dn(r,e)}if(0<ot.length){dn(ot[0],e);for(var i=1;i<ot.length;i++){var n=ot[i];n.blockedOn===e&&(n.blockedOn=null)}}for(Ot!==null&&dn(Ot,e),_t!==null&&dn(_t,e),Ut!==null&&dn(Ut,e),On.forEach(t),_n.forEach(t),i=0;i<un.length;i++)n=un[i],n.blockedOn===e&&(n.blockedOn=null);for(;0<un.length&&(i=un[0],i.blockedOn===null);)D0(i),i.blockedOn===null&&un.shift()}var Lp={},jp=new Map,kl=new Map,j0=["abort","abort",Sp,"animationEnd",Cp,"animationIteration",Mp,"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",Ip,"transitionEnd","waiting","waiting"];function Pl(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},kl.set(n,t),jp.set(n,s),Lp[r]=s}}Pl("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);Pl("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);Pl(j0,2);for(var Cc="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),fo=0;fo<Cc.length;fo++)kl.set(Cc[fo],0);var R0=le.unstable_UserBlockingPriority,V0=le.unstable_runWithPriority,Vr=!0;function X(e,t){yn(t,e,!1)}function yn(e,t,i){var n=kl.get(t);switch(n===void 0?2:n){case 0:n=B0.bind(null,t,1,e);break;case 1:n=O0.bind(null,t,1,e);break;default:n=Bs.bind(null,t,1,e)}i?e.addEventListener(t,n,!0):e.addEventListener(t,n,!1)}function B0(e,t,i,n){ii||wl();var r=Bs,s=ii;ii=!0;try{sp(r,e,t,i,n)}finally{(ii=s)||yl()}}function O0(e,t,i,n){V0(R0,Bs.bind(null,e,t,i,n))}function Bs(e,t,i,n){if(Vr)if(0<ot.length&&-1<sa.indexOf(e))e=oa(null,e,t,i,n),ot.push(e);else{var r=zl(e,t,i,n);if(r===null)xc(e,n);else if(-1<sa.indexOf(e))e=oa(r,e,t,i,n),ot.push(e);else if(!z0(r,e,t,i,n)){xc(e,n),e=Np(e,n,null,t);try{ap(kp,e)}finally{Tp(e)}}}}function zl(e,t,i,n){if(i=Tl(n),i=tr(i),i!==null){var r=Ii(i);if(r===null)i=null;else{var s=r.tag;if(s===13){if(i=bp(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=Np(e,n,i,t);try{ap(kp,e)}finally{Tp(e)}return null}var Tn={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},_0=["Webkit","ms","Moz","O"];Object.keys(Tn).forEach(function(e){_0.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Tn[t]=Tn[e]})});function Rp(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||Tn.hasOwnProperty(e)&&Tn[e]?(""+t).trim():t+"px"}function Vp(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var n=i.indexOf("--")===0,r=Rp(i,t[i],n);i==="float"&&(i="cssFloat"),n?e.setProperty(i,r):e[i]=r}}var U0=Se({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 aa(e,t){if(t){if(U0[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e,""));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(!(typeof t.dangerouslySetInnerHTML=="object"&&"__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62,""))}}function la(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 Mc=vp.html;function mt(e,t){e=e.nodeType===9||e.nodeType===11?e:e.ownerDocument;var i=El(e);t=ml[t];for(var n=0;n<t.length;n++)na(t[n],e,i)}function rs(){}function ua(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 Ic(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function bc(e,t){var i=Ic(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=Ic(i)}}function Bp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ec(){for(var e=window,t=ua();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=ua(e.document)}return t}function ca(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 Op="$",_p="/$",Dl="$?",Ll="$!",go=null,mo=null;function Up(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function da(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 vo=typeof setTimeout=="function"?setTimeout:void 0,$0=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 Ac(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i===Op||i===Ll||i===Dl){if(t===0)return e;t--}else i===_p&&t++}e=e.previousSibling}return null}var jl=Math.random().toString(36).slice(2),zt="__reactInternalInstance$"+jl,ss="__reactEventHandlers$"+jl,er="__reactContainere$"+jl;function tr(e){var t=e[zt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[er]||i[zt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Ac(e);e!==null;){if(i=e[zt])return i;e=Ac(e)}return t}e=i,i=e.parentNode}return null}function ir(e){return e=e[zt]||e[er],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function vi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(S(33))}function Rl(e){return e[ss]||null}function vt(e){do e=e.return;while(e&&e.tag!==5);return e||null}function $p(e,t){var i=e.stateNode;if(!i)return null;var n=gl(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(S(231,t,typeof i));return i}function Tc(e,t,i){(t=$p(e,i.dispatchConfig.phasedRegistrationNames[t]))&&(i._dispatchListeners=Zi(i._dispatchListeners,t),i._dispatchInstances=Zi(i._dispatchInstances,e))}function W0(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,i=[];t;)i.push(t),t=vt(t);for(t=i.length;0<t--;)Tc(i[t],"captured",e);for(t=0;t<i.length;t++)Tc(i[t],"bubbled",e)}}function ha(e,t,i){e&&i&&i.dispatchConfig.registrationName&&(t=$p(e,i.dispatchConfig.registrationName))&&(i._dispatchListeners=Zi(i._dispatchListeners,t),i._dispatchInstances=Zi(i._dispatchInstances,e))}function H0(e){e&&e.dispatchConfig.registrationName&&ha(e._targetInst,null,e)}function Gi(e){Al(e,W0)}var Dt=null,Vl=null,Br=null;function Wp(){if(Br)return Br;var e,t=Vl,i=t.length,n,r="value"in Dt?Dt.value:Dt.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 Br=r.slice(e,1<n?1-n:void 0)}function Or(){return!0}function os(){return!1}function Oe(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)?Or:os,this.isPropagationStopped=os,this}Se(Oe.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!="unknown"&&(e.returnValue=!1),this.isDefaultPrevented=Or)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!="unknown"&&(e.cancelBubble=!0),this.isPropagationStopped=Or)},persist:function(){this.isPersistent=Or},isPersistent:os,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=os,this._dispatchInstances=this._dispatchListeners=null}});Oe.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};Oe.extend=function(e){function t(){}function i(){return n.apply(this,arguments)}var n=this;t.prototype=n.prototype;var r=new t;return Se(r,i.prototype),i.prototype=r,i.prototype.constructor=i,i.Interface=Se({},n.Interface,e),i.extend=n.extend,Hp(i),i};Hp(Oe);function F0(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 Q0(e){if(!(e instanceof this))throw Error(S(279));e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function Hp(e){e.eventPool=[],e.getPooled=F0,e.release=Q0}var Z0=Oe.extend({data:null}),G0=Oe.extend({data:null}),Y0=[9,13,27,32],Bl=Jt&&"CompositionEvent"in window,Nn=null;Jt&&"documentMode"in document&&(Nn=document.documentMode);var X0=Jt&&"TextEvent"in window&&!Nn,Fp=Jt&&(!Bl||Nn&&8<Nn&&11>=Nn),Nc=String.fromCharCode(32),gt={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(" ")}},kc=!1;function Qp(e,t){switch(e){case"keyup":return Y0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Zp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ki=!1;function J0(e,t){switch(e){case"compositionend":return Zp(t);case"keypress":return t.which!==32?null:(kc=!0,Nc);case"textInput":return e=t.data,e===Nc&&kc?null:e;default:return null}}function K0(e,t){if(ki)return e==="compositionend"||!Bl&&Qp(e,t)?(e=Wp(),Br=Vl=Dt=null,ki=!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 Fp&&t.locale!=="ko"?null:t.data;default:return null}}var q0={eventTypes:gt,extractEvents:function(e,t,i,n){var r;if(Bl)e:{switch(e){case"compositionstart":var s=gt.compositionStart;break e;case"compositionend":s=gt.compositionEnd;break e;case"compositionupdate":s=gt.compositionUpdate;break e}s=void 0}else ki?Qp(e,i)&&(s=gt.compositionEnd):e==="keydown"&&i.keyCode===229&&(s=gt.compositionStart);return s?(Fp&&i.locale!=="ko"&&(ki||s!==gt.compositionStart?s===gt.compositionEnd&&ki&&(r=Wp()):(Dt=n,Vl="value"in Dt?Dt.value:Dt.textContent,ki=!0)),s=Z0.getPooled(s,t,i,n),r?s.data=r:(r=Zp(i),r!==null&&(s.data=r)),Gi(s),r=s):r=null,(e=X0?J0(e,i):K0(e,i))?(t=G0.getPooled(gt.beforeInput,t,i,n),t.data=e,Gi(t)):t=null,r===null?t:t===null?r:[r,t]}},ex={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 Gp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ex[e.type]:t==="textarea"}var Yp={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Xp(e,t,i){return e=Oe.getPooled(Yp.change,e,t,i),e.type="change",np(i),Gi(e),e}var kn=null,Un=null;function tx(e){Vs(e)}function Os(e){var t=vi(e);if(fp(t))return e}function ix(e,t){if(e==="change")return t}var pa=!1;Jt&&(pa=Ap("input")&&(!document.documentMode||9<document.documentMode));function Pc(){kn&&(kn.detachEvent("onpropertychange",Jp),Un=kn=null)}function Jp(e){if(e.propertyName==="value"&&Os(Un))if(e=Xp(Un,e,Tl(e)),ii)Vs(e);else{ii=!0;try{vl(tx,e)}finally{ii=!1,yl()}}}function nx(e,t,i){e==="focus"?(Pc(),kn=t,Un=i,kn.attachEvent("onpropertychange",Jp)):e==="blur"&&Pc()}function rx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Os(Un)}function sx(e,t){if(e==="click")return Os(t)}function ox(e,t){if(e==="input"||e==="change")return Os(t)}var ax={eventTypes:Yp,_isInputEventSupported:pa,extractEvents:function(e,t,i,n){var r=t?vi(t):window,s=r.nodeName&&r.nodeName.toLowerCase();if(s==="select"||s==="input"&&r.type==="file")var o=ix;else if(Gp(r))if(pa)o=ox;else{o=rx;var a=nx}else(s=r.nodeName)&&s.toLowerCase()==="input"&&(r.type==="checkbox"||r.type==="radio")&&(o=sx);if(o&&(o=o(e,t)))return Xp(o,i,n);a&&a(e,r,t),e==="blur"&&(e=r._wrapperState)&&e.controlled&&r.type==="number"&&qo(r,"number",r.value)}},nr=Oe.extend({view:null,detail:null}),lx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ux(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=lx[e])?!!t[e]:!1}function Ol(){return ux}var zc=0,Dc=0,Lc=!1,jc=!1,rr=nr.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Ol,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=zc;return zc=e.screenX,Lc?e.type==="mousemove"?e.screenX-t:0:(Lc=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=Dc;return Dc=e.screenY,jc?e.type==="mousemove"?e.screenY-t:0:(jc=!0,0)}}),Kp=rr.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),hn={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},cx={eventTypes:hn,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)?tr(t):null,t!==null){var a=Ii(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=rr,u=hn.mouseLeave,c=hn.mouseEnter,d="mouse";else(e==="pointerout"||e==="pointerover")&&(l=Kp,u=hn.pointerLeave,c=hn.pointerEnter,d="pointer");if(e=o==null?s:vi(o),s=t==null?s:vi(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=vt(e))o++;for(e=0,t=c;t;t=vt(t))e++;for(;0<o-e;)l=vt(l),o--;for(;0<e-o;)c=vt(c),e--;for(;o--;){if(l===c||l===c.alternate)break e;l=vt(l),c=vt(c)}l=null}else l=null;for(c=l,l=[];n&&n!==c&&(o=n.alternate,!(o!==null&&o===c));)l.push(n),n=vt(n);for(n=[];d&&d!==c&&(o=d.alternate,!(o!==null&&o===c));)n.push(d),d=vt(d);for(d=0;d<l.length;d++)ha(l[d],"bubbled",u);for(d=n.length;0<d--;)ha(n[d],"captured",i);return(r&64)===0?[u]:[u,i]}};function dx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wi=typeof Object.is=="function"?Object.is:dx,hx=Object.prototype.hasOwnProperty;function $n(e,t){if(wi(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(!hx.call(t,i[n])||!wi(e[i[n]],t[i[n]]))return!1;return!0}var px=Jt&&"documentMode"in document&&11>=document.documentMode,qp={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Pi=null,fa=null,Pn=null,ga=!1;function Rc(e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;return ga||Pi==null||Pi!==ua(i)?null:(i=Pi,"selectionStart"in i&&ca(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}),Pn&&$n(Pn,i)?null:(Pn=i,e=Oe.getPooled(qp.select,fa,e,t),e.type="select",e.target=Pi,Gi(e),e))}var fx={eventTypes:qp,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=El(r),s=ml.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?vi(t):window,e){case"focus":(Gp(r)||r.contentEditable==="true")&&(Pi=r,fa=t,Pn=null);break;case"blur":Pn=fa=Pi=null;break;case"mousedown":ga=!0;break;case"contextmenu":case"mouseup":case"dragend":return ga=!1,Rc(i,n);case"selectionchange":if(px)break;case"keydown":case"keyup":return Rc(i,n)}return null}},gx=Oe.extend({animationName:null,elapsedTime:null,pseudoElement:null}),mx=Oe.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vx=nr.extend({relatedTarget:null});function _r(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 wx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yx={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"},xx=nr.extend({key:function(e){if(e.key){var t=wx[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=_r(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?yx[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Ol,charCode:function(e){return e.type==="keypress"?_r(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?_r(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Sx=rr.extend({dataTransfer:null}),Cx=nr.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Ol}),Mx=Oe.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),Ix=rr.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}),bx={eventTypes:Lp,extractEvents:function(e,t,i,n){var r=jp.get(e);if(!r)return null;switch(e){case"keypress":if(_r(i)===0)return null;case"keydown":case"keyup":e=xx;break;case"blur":case"focus":e=vx;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=rr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=Sx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=Cx;break;case Sp:case Cp:case Mp:e=gx;break;case Ip:e=Mx;break;case"scroll":e=nr;break;case"wheel":e=Ix;break;case"copy":case"cut":case"paste":e=mx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=Kp;break;default:e=Oe}return t=e.getPooled(r,t,i,n),Gi(t),t}};if(ts)throw Error(S(101));ts=Array.prototype.slice.call("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));tp();var Ex=ir;gl=Rl;qh=Ex;ep=vi;ip({SimpleEventPlugin:bx,EnterLeaveEventPlugin:cx,ChangeEventPlugin:ax,SelectEventPlugin:fx,BeforeInputEventPlugin:q0});var ma=[],zi=-1;function G(e){0>zi||(e.current=ma[zi],ma[zi]=null,zi--)}function te(e,t){zi++,ma[zi]=e.current,e.current=t}var Gt={},ve={current:Gt},Me={current:!1},yi=Gt;function Yi(e,t){var i=e.type.contextTypes;if(!i)return Gt;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 Ie(e){return e=e.childContextTypes,e!=null}function as(){G(Me),G(ve)}function Vc(e,t,i){if(ve.current!==Gt)throw Error(S(168));te(ve,t),te(Me,i)}function ef(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(S(108,It(t)||"Unknown",r));return Se({},i,{},n)}function Ur(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gt,yi=ve.current,te(ve,e),te(Me,Me.current),!0}function Bc(e,t,i){var n=e.stateNode;if(!n)throw Error(S(169));i?(e=ef(e,t,yi),n.__reactInternalMemoizedMergedChildContext=e,G(Me),G(ve),te(ve,e)):G(Me),te(Me,i)}var Ax=le.unstable_runWithPriority,_l=le.unstable_scheduleCallback,tf=le.unstable_cancelCallback,Oc=le.unstable_requestPaint,va=le.unstable_now,Tx=le.unstable_getCurrentPriorityLevel,_s=le.unstable_ImmediatePriority,nf=le.unstable_UserBlockingPriority,rf=le.unstable_NormalPriority,sf=le.unstable_LowPriority,of=le.unstable_IdlePriority,af={},Nx=le.unstable_shouldYield,kx=Oc!==void 0?Oc:function(){},yt=null,$r=null,wo=!1,_c=va(),We=1e4>_c?va:function(){return va()-_c};function Us(){switch(Tx()){case _s:return 99;case nf:return 98;case rf:return 97;case sf:return 96;case of:return 95;default:throw Error(S(332))}}function lf(e){switch(e){case 99:return _s;case 98:return nf;case 97:return rf;case 96:return sf;case 95:return of;default:throw Error(S(332))}}function Yt(e,t){return e=lf(e),Ax(e,t)}function uf(e,t,i){return e=lf(e),_l(e,t,i)}function Uc(e){return yt===null?(yt=[e],$r=_l(_s,cf)):yt.push(e),af}function ht(){if($r!==null){var e=$r;$r=null,tf(e)}cf()}function cf(){if(!wo&&yt!==null){wo=!0;var e=0;try{var t=yt;Yt(99,function(){for(;e<t.length;e++){var i=t[e];do i=i(!0);while(i!==null)}}),yt=null}catch(i){throw yt!==null&&(yt=yt.slice(e+1)),_l(_s,ht),i}finally{wo=!1}}}function Wr(e,t,i){return i/=10,1073741821-(((1073741821-e+t/10)/i|0)+1)*i}function Je(e,t){if(e&&e.defaultProps){t=Se({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i])}return t}var ls={current:null},us=null,Di=null,cs=null;function Ul(){cs=Di=us=null}function $l(e){var t=ls.current;G(ls),e.type._context._currentValue=t}function df(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 Ui(e,t){us=e,cs=Di=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.expirationTime>=t&&(at=!0),e.firstContext=null)}function Fe(e,t){if(cs!==e&&t!==!1&&t!==0)if((typeof t!="number"||t===1073741823)&&(cs=e,t=1073741823),t={context:e,observedBits:t,next:null},Di===null){if(us===null)throw Error(S(308));Di=t,us.dependencies={expirationTime:0,firstContext:t,responders:null}}else Di=Di.next=t;return e._currentValue}var Pt=!1;function Wl(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function Hl(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function $t(e,t){return e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null},e.next=e}function Wt(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 $c(e,t){var i=e.alternate;i!==null&&Hl(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 Wn(e,t,i,n){var r=e.updateQueue;Pt=!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 y={expirationTime:w.expirationTime,suspenseConfig:w.suspenseConfig,tag:w.tag,payload:w.payload,callback:w.callback,next:null};m===null?(d=m=y,c=l):m=m.next=y,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}),Uf(o,w.suspenseConfig);e:{var M=e,p=w;switch(o=t,y=i,p.tag){case 1:if(M=p.payload,typeof M=="function"){l=M.call(y,l,o);break e}l=M;break e;case 3:M.effectTag=M.effectTag&-4097|64;case 0:if(M=p.payload,o=typeof M=="function"?M.call(y,l,o):M,o==null)break e;l=Se({},l,o);break e;case 2:Pt=!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,Qs(u),e.expirationTime=u,e.memoizedState=l}}function Wc(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(S(191,n));n.call(r)}}}var zn=Ke.ReactCurrentBatchConfig,hf=new js.Component().refs;function ds(e,t,i,n){t=e.memoizedState,i=i(n,t),i=i==null?t:Se({},t,i),e.memoizedState=i,e.expirationTime===0&&(e.updateQueue.baseState=i)}var $s={isMounted:function(e){return(e=e._reactInternalFiber)?Ii(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternalFiber;var n=ct(),r=zn.suspense;n=pi(n,e,r),r=$t(n,r),r.payload=t,i!=null&&(r.callback=i),Wt(e,r),Ft(e,n)},enqueueReplaceState:function(e,t,i){e=e._reactInternalFiber;var n=ct(),r=zn.suspense;n=pi(n,e,r),r=$t(n,r),r.tag=1,r.payload=t,i!=null&&(r.callback=i),Wt(e,r),Ft(e,n)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var i=ct(),n=zn.suspense;i=pi(i,e,n),n=$t(i,n),n.tag=2,t!=null&&(n.callback=t),Wt(e,n),Ft(e,i)}};function Hc(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?!$n(i,n)||!$n(r,s):!0}function pf(e,t,i){var n=!1,r=Gt,s=t.contextType;return typeof s=="object"&&s!==null?s=Fe(s):(r=Ie(t)?yi:ve.current,n=t.contextTypes,s=(n=n!=null)?Yi(e,r):Gt),t=new t(i,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=$s,e.stateNode=t,t._reactInternalFiber=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=s),t}function Fc(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&&$s.enqueueReplaceState(t,t.state,null)}function wa(e,t,i,n){var r=e.stateNode;r.props=i,r.state=e.memoizedState,r.refs=hf,Wl(e);var s=t.contextType;typeof s=="object"&&s!==null?r.context=Fe(s):(s=Ie(t)?yi:ve.current,r.context=Yi(e,s)),Wn(e,i,r,n),r.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(ds(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&&$s.enqueueReplaceState(r,r.state,null),Wn(e,i,r,n),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.effectTag|=4)}var Sr=Array.isArray;function pn(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(S(309));var n=i.stateNode}if(!n)throw Error(S(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===hf&&(o=n.refs={}),s===null?delete o[r]:o[r]=s},t._stringRef=r,t)}if(typeof e!="string")throw Error(S(284));if(!i._owner)throw Error(S(290,e))}return e}function Cr(e,t){if(e.type!=="textarea")throw Error(S(31,Object.prototype.toString.call(t)==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":t,""))}function ff(e){function t(p,h){if(e){var f=p.lastEffect;f!==null?(f.nextEffect=h,p.lastEffect=h):p.firstEffect=p.lastEffect=h,h.nextEffect=null,h.effectTag=8}}function i(p,h){if(!e)return null;for(;h!==null;)t(p,h),h=h.sibling;return null}function n(p,h){for(p=new Map;h!==null;)h.key!==null?p.set(h.key,h):p.set(h.index,h),h=h.sibling;return p}function r(p,h){return p=xi(p,h),p.index=0,p.sibling=null,p}function s(p,h,f){return p.index=f,e?(f=p.alternate,f!==null?(f=f.index,f<h?(p.effectTag=2,h):f):(p.effectTag=2,h)):h}function o(p){return e&&p.alternate===null&&(p.effectTag=2),p}function a(p,h,f,g){return h===null||h.tag!==6?(h=Io(f,p.mode,g),h.return=p,h):(h=r(h,f),h.return=p,h)}function l(p,h,f,g){return h!==null&&h.elementType===f.type?(g=r(h,f.props),g.ref=pn(p,h,f),g.return=p,g):(g=Zr(f.type,f.key,f.props,null,p.mode,g),g.ref=pn(p,h,f),g.return=p,g)}function u(p,h,f,g){return h===null||h.tag!==4||h.stateNode.containerInfo!==f.containerInfo||h.stateNode.implementation!==f.implementation?(h=bo(f,p.mode,g),h.return=p,h):(h=r(h,f.children||[]),h.return=p,h)}function c(p,h,f,g,v){return h===null||h.tag!==7?(h=Rt(f,p.mode,g,v),h.return=p,h):(h=r(h,f),h.return=p,h)}function d(p,h,f){if(typeof h=="string"||typeof h=="number")return h=Io(""+h,p.mode,f),h.return=p,h;if(typeof h=="object"&&h!==null){switch(h.$$typeof){case vr:return f=Zr(h.type,h.key,h.props,null,p.mode,f),f.ref=pn(p,null,h),f.return=p,f;case Ti:return h=bo(h,p.mode,f),h.return=p,h}if(Sr(h)||an(h))return h=Rt(h,p.mode,f,null),h.return=p,h;Cr(p,h)}return null}function m(p,h,f,g){var v=h!==null?h.key:null;if(typeof f=="string"||typeof f=="number")return v!==null?null:a(p,h,""+f,g);if(typeof f=="object"&&f!==null){switch(f.$$typeof){case vr:return f.key===v?f.type===ti?c(p,h,f.props.children,g,v):l(p,h,f,g):null;case Ti:return f.key===v?u(p,h,f,g):null}if(Sr(f)||an(f))return v!==null?null:c(p,h,f,g,null);Cr(p,f)}return null}function w(p,h,f,g,v){if(typeof g=="string"||typeof g=="number")return p=p.get(f)||null,a(h,p,""+g,v);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case vr:return p=p.get(g.key===null?f:g.key)||null,g.type===ti?c(h,p,g.props.children,v,g.key):l(h,p,g,v);case Ti:return p=p.get(g.key===null?f:g.key)||null,u(h,p,g,v)}if(Sr(g)||an(g))return p=p.get(f)||null,c(h,p,g,v,null);Cr(h,g)}return null}function y(p,h,f,g){for(var v=null,C=null,x=h,N=h=0,z=null;x!==null&&N<f.length;N++){x.index>N?(z=x,x=null):z=x.sibling;var k=m(p,x,f[N],g);if(k===null){x===null&&(x=z);break}e&&x&&k.alternate===null&&t(p,x),h=s(k,h,N),C===null?v=k:C.sibling=k,C=k,x=z}if(N===f.length)return i(p,x),v;if(x===null){for(;N<f.length;N++)x=d(p,f[N],g),x!==null&&(h=s(x,h,N),C===null?v=x:C.sibling=x,C=x);return v}for(x=n(p,x);N<f.length;N++)z=w(x,p,N,f[N],g),z!==null&&(e&&z.alternate!==null&&x.delete(z.key===null?N:z.key),h=s(z,h,N),C===null?v=z:C.sibling=z,C=z);return e&&x.forEach(function(K){return t(p,K)}),v}function M(p,h,f,g){var v=an(f);if(typeof v!="function")throw Error(S(150));if(f=v.call(f),f==null)throw Error(S(151));for(var C=v=null,x=h,N=h=0,z=null,k=f.next();x!==null&&!k.done;N++,k=f.next()){x.index>N?(z=x,x=null):z=x.sibling;var K=m(p,x,k.value,g);if(K===null){x===null&&(x=z);break}e&&x&&K.alternate===null&&t(p,x),h=s(K,h,N),C===null?v=K:C.sibling=K,C=K,x=z}if(k.done)return i(p,x),v;if(x===null){for(;!k.done;N++,k=f.next())k=d(p,k.value,g),k!==null&&(h=s(k,h,N),C===null?v=k:C.sibling=k,C=k);return v}for(x=n(p,x);!k.done;N++,k=f.next())k=w(x,p,N,k.value,g),k!==null&&(e&&k.alternate!==null&&x.delete(k.key===null?N:k.key),h=s(k,h,N),C===null?v=k:C.sibling=k,C=k);return e&&x.forEach(function(q){return t(p,q)}),v}return function(p,h,f,g){var v=typeof f=="object"&&f!==null&&f.type===ti&&f.key===null;v&&(f=f.props.children);var C=typeof f=="object"&&f!==null;if(C)switch(f.$$typeof){case vr:e:{for(C=f.key,v=h;v!==null;){if(v.key===C){switch(v.tag){case 7:if(f.type===ti){i(p,v.sibling),h=r(v,f.props.children),h.return=p,p=h;break e}break;default:if(v.elementType===f.type){i(p,v.sibling),h=r(v,f.props),h.ref=pn(p,v,f),h.return=p,p=h;break e}}i(p,v);break}else t(p,v);v=v.sibling}f.type===ti?(h=Rt(f.props.children,p.mode,g,f.key),h.return=p,p=h):(g=Zr(f.type,f.key,f.props,null,p.mode,g),g.ref=pn(p,h,f),g.return=p,p=g)}return o(p);case Ti:e:{for(v=f.key;h!==null;){if(h.key===v)if(h.tag===4&&h.stateNode.containerInfo===f.containerInfo&&h.stateNode.implementation===f.implementation){i(p,h.sibling),h=r(h,f.children||[]),h.return=p,p=h;break e}else{i(p,h);break}else t(p,h);h=h.sibling}h=bo(f,p.mode,g),h.return=p,p=h}return o(p)}if(typeof f=="string"||typeof f=="number")return f=""+f,h!==null&&h.tag===6?(i(p,h.sibling),h=r(h,f),h.return=p,p=h):(i(p,h),h=Io(f,p.mode,g),h.return=p,p=h),o(p);if(Sr(f))return y(p,h,f,g);if(an(f))return M(p,h,f,g);if(C&&Cr(p,f),typeof f=="undefined"&&!v)switch(p.tag){case 1:case 0:throw p=p.type,Error(S(152,p.displayName||p.name||"Component"))}return i(p,h)}}var Xi=ff(!0),Fl=ff(!1),sr={},ut={current:sr},Hn={current:sr},Fn={current:sr};function ni(e){if(e===sr)throw Error(S(174));return e}function ya(e,t){switch(te(Fn,t),te(Hn,e),te(ut,sr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ia(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ia(t,e)}G(ut),te(ut,t)}function Ji(){G(ut),G(Hn),G(Fn)}function Qc(e){ni(Fn.current);var t=ni(ut.current),i=ia(t,e.type);t!==i&&(te(Hn,e),te(ut,i))}function Ql(e){Hn.current===e&&(G(ut),G(Hn))}var J={current:0};function hs(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===Dl||i.data===Ll))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 Zl(e,t){return{responder:e,props:t}}var Hr=Ke.ReactCurrentDispatcher,He=Ke.ReactCurrentBatchConfig,Lt=0,ne=null,fe=null,ge=null,ps=!1;function ke(){throw Error(S(321))}function Gl(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!wi(e[i],t[i]))return!1;return!0}function Yl(e,t,i,n,r,s){if(Lt=s,ne=t,t.memoizedState=null,t.updateQueue=null,t.expirationTime=0,Hr.current=e===null||e.memoizedState===null?Px:zx,e=i(n,r),t.expirationTime===Lt){s=0;do{if(t.expirationTime=0,!(25>s))throw Error(S(301));s+=1,ge=fe=null,t.updateQueue=null,Hr.current=Dx,e=i(n,r)}while(t.expirationTime===Lt)}if(Hr.current=ms,t=fe!==null&&fe.next!==null,Lt=0,ge=fe=ne=null,ps=!1,t)throw Error(S(300));return e}function $i(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ge===null?ne.memoizedState=ge=e:ge=ge.next=e,ge}function en(){if(fe===null){var e=ne.alternate;e=e!==null?e.memoizedState:null}else e=fe.next;var t=ge===null?ne.memoizedState:ge.next;if(t!==null)ge=t,fe=e;else{if(e===null)throw Error(S(310));fe=e,e={memoizedState:fe.memoizedState,baseState:fe.baseState,baseQueue:fe.baseQueue,queue:fe.queue,next:null},ge===null?ne.memoizedState=ge=e:ge=ge.next=e}return ge}function ci(e,t){return typeof t=="function"?t(e):t}function Mr(e){var t=en(),i=t.queue;if(i===null)throw Error(S(311));i.lastRenderedReducer=e;var n=fe,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<Lt){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>ne.expirationTime&&(ne.expirationTime=u,Qs(u))}else a!==null&&(a=a.next={expirationTime:1073741823,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null}),Uf(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,wi(n,t.memoizedState)||(at=!0),t.memoizedState=n,t.baseState=s,t.baseQueue=a,i.lastRenderedState=n}return[t.memoizedState,i.dispatch]}function Ir(e){var t=en(),i=t.queue;if(i===null)throw Error(S(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);wi(s,t.memoizedState)||(at=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),i.lastRenderedState=s}return[s,n]}function yo(e){var t=$i();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e=t.queue={pending:null,dispatch:null,lastRenderedReducer:ci,lastRenderedState:e},e=e.dispatch=xf.bind(null,ne,e),[t.memoizedState,e]}function xa(e,t,i,n){return e={tag:e,create:t,destroy:i,deps:n,next:null},t=ne.updateQueue,t===null?(t={lastEffect:null},ne.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 gf(){return en().memoizedState}function Sa(e,t,i,n){var r=$i();ne.effectTag|=e,r.memoizedState=xa(1|t,i,void 0,n===void 0?null:n)}function Xl(e,t,i,n){var r=en();n=n===void 0?null:n;var s=void 0;if(fe!==null){var o=fe.memoizedState;if(s=o.destroy,n!==null&&Gl(n,o.deps)){xa(t,i,s,n);return}}ne.effectTag|=e,r.memoizedState=xa(1|t,i,s,n)}function Zc(e,t){return Sa(516,4,e,t)}function fs(e,t){return Xl(516,4,e,t)}function mf(e,t){return Xl(4,2,e,t)}function vf(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 wf(e,t,i){return i=i!=null?i.concat([e]):null,Xl(4,2,vf.bind(null,t,e),i)}function Jl(){}function Gc(e,t){return $i().memoizedState=[e,t===void 0?null:t],e}function gs(e,t){var i=en();t=t===void 0?null:t;var n=i.memoizedState;return n!==null&&t!==null&&Gl(t,n[1])?n[0]:(i.memoizedState=[e,t],e)}function yf(e,t){var i=en();t=t===void 0?null:t;var n=i.memoizedState;return n!==null&&t!==null&&Gl(t,n[1])?n[0]:(e=e(),i.memoizedState=[e,t],e)}function Kl(e,t,i){var n=Us();Yt(98>n?98:n,function(){e(!0)}),Yt(97<n?97:n,function(){var r=He.suspense;He.suspense=t===void 0?null:t;try{e(!1),i()}finally{He.suspense=r}})}function xf(e,t,i){var n=ct(),r=zn.suspense;n=pi(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===ne||s!==null&&s===ne)ps=!0,r.expirationTime=Lt,ne.expirationTime=Lt;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,wi(a,o))return}catch{}finally{}Ft(e,n)}}var ms={readContext:Fe,useCallback:ke,useContext:ke,useEffect:ke,useImperativeHandle:ke,useLayoutEffect:ke,useMemo:ke,useReducer:ke,useRef:ke,useState:ke,useDebugValue:ke,useResponder:ke,useDeferredValue:ke,useTransition:ke},Px={readContext:Fe,useCallback:Gc,useContext:Fe,useEffect:Zc,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,Sa(4,2,vf.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Sa(4,2,e,t)},useMemo:function(e,t){var i=$i();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var n=$i();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=xf.bind(null,ne,e),[n.memoizedState,e]},useRef:function(e){var t=$i();return e={current:e},t.memoizedState=e},useState:yo,useDebugValue:Jl,useResponder:Zl,useDeferredValue:function(e,t){var i=yo(e),n=i[0],r=i[1];return Zc(function(){var s=He.suspense;He.suspense=t===void 0?null:t;try{r(e)}finally{He.suspense=s}},[e,t]),n},useTransition:function(e){var t=yo(!1),i=t[0];return t=t[1],[Gc(Kl.bind(null,t,e),[t,e]),i]}},zx={readContext:Fe,useCallback:gs,useContext:Fe,useEffect:fs,useImperativeHandle:wf,useLayoutEffect:mf,useMemo:yf,useReducer:Mr,useRef:gf,useState:function(){return Mr(ci)},useDebugValue:Jl,useResponder:Zl,useDeferredValue:function(e,t){var i=Mr(ci),n=i[0],r=i[1];return fs(function(){var s=He.suspense;He.suspense=t===void 0?null:t;try{r(e)}finally{He.suspense=s}},[e,t]),n},useTransition:function(e){var t=Mr(ci),i=t[0];return t=t[1],[gs(Kl.bind(null,t,e),[t,e]),i]}},Dx={readContext:Fe,useCallback:gs,useContext:Fe,useEffect:fs,useImperativeHandle:wf,useLayoutEffect:mf,useMemo:yf,useReducer:Ir,useRef:gf,useState:function(){return Ir(ci)},useDebugValue:Jl,useResponder:Zl,useDeferredValue:function(e,t){var i=Ir(ci),n=i[0],r=i[1];return fs(function(){var s=He.suspense;He.suspense=t===void 0?null:t;try{r(e)}finally{He.suspense=s}},[e,t]),n},useTransition:function(e){var t=Ir(ci),i=t[0];return t=t[1],[gs(Kl.bind(null,t,e),[t,e]),i]}},Ct=null,jt=null,di=!1;function Sf(e,t){var i=lt(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 Yc(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 Ca(e){if(di){var t=jt;if(t){var i=t;if(!Yc(e,t)){if(t=_i(i.nextSibling),!t||!Yc(e,t)){e.effectTag=e.effectTag&-1025|2,di=!1,Ct=e;return}Sf(Ct,i)}Ct=e,jt=_i(t.firstChild)}else e.effectTag=e.effectTag&-1025|2,di=!1,Ct=e}}function Xc(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ct=e}function br(e){if(e!==Ct)return!1;if(!di)return Xc(e),di=!0,!1;var t=e.type;if(e.tag!==5||t!=="head"&&t!=="body"&&!da(t,e.memoizedProps))for(t=jt;t;)Sf(e,t),t=_i(t.nextSibling);if(Xc(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(S(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i===_p){if(t===0){jt=_i(e.nextSibling);break e}t--}else i!==Op&&i!==Ll&&i!==Dl||t++}e=e.nextSibling}jt=null}}else jt=Ct?_i(e.stateNode.nextSibling):null;return!0}function xo(){jt=Ct=null,di=!1}var Lx=Ke.ReactCurrentOwner,at=!1;function Pe(e,t,i,n){t.child=e===null?Fl(t,null,i,n):Xi(t,e.child,i,n)}function Jc(e,t,i,n,r){i=i.render;var s=t.ref;return Ui(t,r),n=Yl(e,t,i,n,s,r),e!==null&&!at?(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=r&&(e.expirationTime=0),Mt(e,t,r)):(t.effectTag|=1,Pe(e,t,n,r),t.child)}function Kc(e,t,i,n,r,s){if(e===null){var o=i.type;return typeof o=="function"&&!nu(o)&&o.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=o,Cf(e,t,o,n,r,s)):(e=Zr(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:$n,i(r,n)&&e.ref===t.ref)?Mt(e,t,s):(t.effectTag|=1,e=xi(o,n),e.ref=t.ref,e.return=t,t.child=e)}function Cf(e,t,i,n,r,s){return e!==null&&$n(e.memoizedProps,n)&&e.ref===t.ref&&(at=!1,r<s)?(t.expirationTime=e.expirationTime,Mt(e,t,s)):Ma(e,t,i,n,s)}function Mf(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.effectTag|=128)}function Ma(e,t,i,n,r){var s=Ie(i)?yi:ve.current;return s=Yi(t,s),Ui(t,r),i=Yl(e,t,i,n,s,r),e!==null&&!at?(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=r&&(e.expirationTime=0),Mt(e,t,r)):(t.effectTag|=1,Pe(e,t,i,r),t.child)}function qc(e,t,i,n,r){if(Ie(i)){var s=!0;Ur(t)}else s=!1;if(Ui(t,r),t.stateNode===null)e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),pf(t,i,n),wa(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=Fe(u):(u=Ie(i)?yi:ve.current,u=Yi(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)&&Fc(t,o,n,u),Pt=!1;var m=t.memoizedState;o.state=m,Wn(t,n,o,r),l=t.memoizedState,a!==n||m!==l||Me.current||Pt?(typeof c=="function"&&(ds(t,i,c,n),l=t.memoizedState),(a=Pt||Hc(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,Hl(e,t),a=t.memoizedProps,o.props=t.type===t.elementType?a:Je(t.type,a),l=o.context,u=i.contextType,typeof u=="object"&&u!==null?u=Fe(u):(u=Ie(i)?yi:ve.current,u=Yi(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)&&Fc(t,o,n,u),Pt=!1,l=t.memoizedState,o.state=l,Wn(t,n,o,r),m=t.memoizedState,a!==n||l!==m||Me.current||Pt?(typeof c=="function"&&(ds(t,i,c,n),m=t.memoizedState),(c=Pt||Hc(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 Ia(e,t,i,n,s,r)}function Ia(e,t,i,n,r,s){Mf(e,t);var o=(t.effectTag&64)!==0;if(!n&&!o)return r&&Bc(t,i,!1),Mt(e,t,s);n=t.stateNode,Lx.current=t;var a=o&&typeof i.getDerivedStateFromError!="function"?null:n.render();return t.effectTag|=1,e!==null&&o?(t.child=Xi(t,e.child,null,s),t.child=Xi(t,null,a,s)):Pe(e,t,a,s),t.memoizedState=n.state,r&&Bc(t,i,!0),t.child}function ed(e){var t=e.stateNode;t.pendingContext?Vc(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Vc(e,t.context,!1),ya(e,t.containerInfo)}var So={dehydrated:null,retryTime:0};function td(e,t,i){var n=t.mode,r=t.pendingProps,s=J.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),te(J,s&1),e===null){if(r.fallback!==void 0&&Ca(t),o){if(o=r.fallback,r=Rt(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=Rt(o,n,i,null),i.return=t,r.sibling=i,t.memoizedState=So,t.child=r,i}return n=r.children,t.memoizedState=null,t.child=Fl(t,null,n,i)}if(e.memoizedState!==null){if(e=e.child,n=e.sibling,o){if(r=r.fallback,i=xi(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=xi(n,r),n.return=t,i.sibling=n,i.childExpirationTime=0,t.memoizedState=So,t.child=i,n}return i=Xi(t,e.child,r.children,i),t.memoizedState=null,t.child=i}if(e=e.child,o){if(o=r.fallback,r=Rt(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=Rt(o,n,i,null),i.return=t,r.sibling=i,i.effectTag|=2,r.childExpirationTime=0,t.memoizedState=So,t.child=r,i}return t.memoizedState=null,t.child=Xi(t,e,r.children,i)}function id(e,t){e.expirationTime<t&&(e.expirationTime=t);var i=e.alternate;i!==null&&i.expirationTime<t&&(i.expirationTime=t),df(e.return,t)}function Co(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 nd(e,t,i){var n=t.pendingProps,r=n.revealOrder,s=n.tail;if(Pe(e,t,n.children,i),n=J.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&&id(e,i);else if(e.tag===19)id(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(te(J,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&&hs(e)===null&&(r=i),i=i.sibling;i=r,i===null?(r=t.child,t.child=null):(r=i.sibling,i.sibling=null),Co(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&&hs(e)===null){t.child=r;break}e=r.sibling,r.sibling=i,i=r,r=e}Co(t,!0,i,null,s,t.lastEffect);break;case"together":Co(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function Mt(e,t,i){e!==null&&(t.dependencies=e.dependencies);var n=t.expirationTime;if(n!==0&&Qs(n),t.childExpirationTime<i)return null;if(e!==null&&t.child!==e.child)throw Error(S(153));if(t.child!==null){for(e=t.child,i=xi(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=xi(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}var If,ba,bf,Ef;If=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}};ba=function(){};bf=function(e,t,i,n,r){var s=e.memoizedProps;if(s!==n){var o=t.stateNode;switch(ni(ut.current),e=null,i){case"input":s=Jo(o,s),n=Jo(o,n),e=[];break;case"option":s=ea(o,s),n=ea(o,n),e=[];break;case"select":s=Se({},s,{value:void 0}),n=Se({},n,{value:void 0}),e=[];break;case"textarea":s=ta(o,s),n=ta(o,n),e=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(o.onclick=rs)}aa(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"&&(Qi.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"&&(Qi.hasOwnProperty(a)?(u!=null&&mt(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)}};Ef=function(e,t,i,n){i!==n&&(t.effectTag|=4)};function Er(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 jx(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 Ie(t.type)&&as(),null;case 3:return Ji(),G(Me),G(ve),i=t.stateNode,i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),e!==null&&e.child!==null||!br(t)||(t.effectTag|=4),ba(t),null;case 5:Ql(t),i=ni(Fn.current);var r=t.type;if(e!==null&&t.stateNode!=null)bf(e,t,r,n,i),e.ref!==t.ref&&(t.effectTag|=128);else{if(!n){if(t.stateNode===null)throw Error(S(166));return null}if(e=ni(ut.current),br(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[zt]=t,n[ss]=s,r){case"iframe":case"object":case"embed":X("load",n);break;case"video":case"audio":for(e=0;e<wn.length;e++)X(wn[e],n);break;case"source":X("error",n);break;case"img":case"image":case"link":X("error",n),X("load",n);break;case"form":X("reset",n),X("submit",n);break;case"details":X("toggle",n);break;case"input":fc(n,s),X("invalid",n),mt(i,"onChange");break;case"select":n._wrapperState={wasMultiple:!!s.multiple},X("invalid",n),mt(i,"onChange");break;case"textarea":mc(n,s),X("invalid",n),mt(i,"onChange")}aa(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]):Qi.hasOwnProperty(o)&&a!=null&&mt(i,o)}switch(r){case"input":wr(n),gc(n,s,!0);break;case"textarea":wr(n),vc(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=rs)}i=e,t.updateQueue=i,i!==null&&(t.effectTag|=4)}else{switch(o=i.nodeType===9?i:i.ownerDocument,e===Mc&&(e=wp(r)),e===Mc?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[zt]=t,e[ss]=n,If(e,t,!1,!1),t.stateNode=e,o=la(r,n),r){case"iframe":case"object":case"embed":X("load",e),a=n;break;case"video":case"audio":for(a=0;a<wn.length;a++)X(wn[a],e);a=n;break;case"source":X("error",e),a=n;break;case"img":case"image":case"link":X("error",e),X("load",e),a=n;break;case"form":X("reset",e),X("submit",e),a=n;break;case"details":X("toggle",e),a=n;break;case"input":fc(e,n),a=Jo(e,n),X("invalid",e),mt(i,"onChange");break;case"option":a=ea(e,n);break;case"select":e._wrapperState={wasMultiple:!!n.multiple},a=Se({},n,{value:void 0}),X("invalid",e),mt(i,"onChange");break;case"textarea":mc(e,n),a=ta(e,n),X("invalid",e),mt(i,"onChange");break;default:a=n}aa(r,a);var l=a;for(s in l)if(l.hasOwnProperty(s)){var u=l[s];s==="style"?Vp(e,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&yp(e,u)):s==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&Bn(e,u):typeof u=="number"&&Bn(e,""+u):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Qi.hasOwnProperty(s)?u!=null&&mt(i,s):u!=null&&Cl(e,s,u,o))}switch(r){case"input":wr(e),gc(e,n,!1);break;case"textarea":wr(e),vc(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Zt(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?Oi(e,!!n.multiple,i,!1):n.defaultValue!=null&&Oi(e,!!n.multiple,n.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=rs)}Up(r,n)&&(t.effectTag|=4)}t.ref!==null&&(t.effectTag|=128)}return null;case 6:if(e&&t.stateNode!=null)Ef(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(S(166));i=ni(Fn.current),ni(ut.current),br(t)?(i=t.stateNode,n=t.memoizedProps,i[zt]=t,i.nodeValue!==n&&(t.effectTag|=4)):(i=(i.nodeType===9?i:i.ownerDocument).createTextNode(n),i[zt]=t,t.stateNode=i)}return null;case 13:return G(J),n=t.memoizedState,(t.effectTag&64)!==0?(t.expirationTime=i,t):(i=n!==null,n=!1,e===null?t.memoizedProps.fallback!==void 0&&br(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||(J.current&1)!==0?se===hi&&(se=ys):((se===hi||se===ys)&&(se=Ws),Zn!==0&&Ve!==null&&(oi(Ve,Ee),Qf(Ve,Zn)))),(i||n)&&(t.effectTag|=4),null);case 4:return Ji(),ba(t),null;case 10:return $l(t),null;case 17:return Ie(t.type)&&as(),null;case 19:if(G(J),n=t.memoizedState,n===null)return null;if(r=(t.effectTag&64)!==0,s=n.rendering,s===null){if(r)Er(n,!1);else if(se!==hi||e!==null&&(e.effectTag&64)!==0)for(s=t.child;s!==null;){if(e=hs(s),e!==null){for(t.effectTag|=64,Er(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 te(J,J.current&1|2),t.child}s=s.sibling}}else{if(!r)if(e=hs(s),e!==null){if(t.effectTag|=64,r=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.effectTag|=4),Er(n,!0),n.tail===null&&n.tailMode==="hidden"&&!s.alternate)return t=t.lastEffect=n.lastEffect,t!==null&&(t.nextEffect=null),null}else 2*We()-n.renderingStartTime>n.tailExpiration&&1<i&&(t.effectTag|=64,r=!0,Er(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=We()+500),i=n.tail,n.rendering=i,n.tail=i.sibling,n.lastEffect=t.lastEffect,n.renderingStartTime=We(),i.sibling=null,t=J.current,te(J,r?t&1|2:t&1),i):null}throw Error(S(156,t.tag))}function Rx(e){switch(e.tag){case 1:Ie(e.type)&&as();var t=e.effectTag;return t&4096?(e.effectTag=t&-4097|64,e):null;case 3:if(Ji(),G(Me),G(ve),t=e.effectTag,(t&64)!==0)throw Error(S(285));return e.effectTag=t&-4097|64,e;case 5:return Ql(e),null;case 13:return G(J),t=e.effectTag,t&4096?(e.effectTag=t&-4097|64,e):null;case 19:return G(J),null;case 4:return Ji(),null;case 10:return $l(e),null;default:return null}}function ql(e,t){return{value:e,source:t,stack:bl(t)}}var Vx=typeof WeakSet=="function"?WeakSet:Set;function Ea(e,t){var i=t.source,n=t.stack;n===null&&i!==null&&(n=bl(i)),i!==null&&It(i.type),t=t.value,e!==null&&e.tag===1&&It(e.type);try{console.error(t)}catch(r){setTimeout(function(){throw r})}}function Bx(e,t){try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(i){fi(e,i)}}function rd(e){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){fi(e,i)}else t.current=null}function Ox(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:Je(t.type,i),n),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:case 5:case 6:case 4:case 17:return}throw Error(S(163))}function Af(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 Tf(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 _x(e,t,i){switch(i.tag){case 0:case 11:case 15:case 22:Tf(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:Je(i.type,t.memoizedProps);e.componentDidUpdate(n,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate)}t=i.updateQueue,t!==null&&Wc(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}Wc(i,t,e)}return;case 5:e=i.stateNode,t===null&&i.effectTag&4&&Up(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&&Dp(i))));return;case 19:case 17:case 20:case 21:return}throw Error(S(163))}function sd(e,t,i){switch(typeof La=="function"&&La(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;Yt(97<i?97:i,function(){var r=n;do{var s=r.destroy;if(s!==void 0){var o=t;try{s()}catch(a){fi(o,a)}}r=r.next}while(r!==n)})}break;case 1:rd(t),i=t.stateNode,typeof i.componentWillUnmount=="function"&&Bx(t,i);break;case 5:rd(t);break;case 4:kf(e,t,i)}}function Nf(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&&Nf(t)}function od(e){return e.tag===5||e.tag===3||e.tag===4}function ad(e){e:{for(var t=e.return;t!==null;){if(od(t)){var i=t;break e}t=t.return}throw Error(S(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(S(161))}i.effectTag&16&&(Bn(t,""),i.effectTag&=-17);e:t:for(i=e;;){for(;i.sibling===null;){if(i.return===null||od(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?Aa(e,i,t):Ta(e,i,t)}function Aa(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=rs));else if(n!==4&&(e=e.child,e!==null))for(Aa(e,t,i),e=e.sibling;e!==null;)Aa(e,t,i),e=e.sibling}function Ta(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(Ta(e,t,i),e=e.sibling;e!==null;)Ta(e,t,i),e=e.sibling}function kf(e,t,i){for(var n=t,r=!1,s,o;;){if(!r){r=n.return;e:for(;;){if(r===null)throw Error(S(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(sd(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(sd(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 Mo(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:Af(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[ss]=n,e==="input"&&n.type==="radio"&&n.name!=null&&gp(i,n),la(e,r),t=la(e,n),r=0;r<s.length;r+=2){var o=s[r],a=s[r+1];o==="style"?Vp(i,a):o==="dangerouslySetInnerHTML"?yp(i,a):o==="children"?Bn(i,a):Cl(i,o,a,t)}switch(e){case"input":Ko(i,n);break;case"textarea":mp(i,n);break;case"select":t=i._wrapperState.wasMultiple,i._wrapperState.wasMultiple=!!n.multiple,e=n.value,e!=null?Oi(i,!!n.multiple,e,!1):t!==!!n.multiple&&(n.defaultValue!=null?Oi(i,!!n.multiple,n.defaultValue,!0):Oi(i,!!n.multiple,n.multiple?[]:"",!1))}}}return;case 6:if(t.stateNode===null)throw Error(S(162));t.stateNode.nodeValue=t.memoizedProps;return;case 3:t=t.stateNode,t.hydrate&&(t.hydrate=!1,Dp(t.containerInfo));return;case 12:return;case 13:if(i=t,t.memoizedState===null?n=!1:(n=!0,i=t.child,iu=We()),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=Rp("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}ld(t);return;case 19:ld(t);return;case 17:return}throw Error(S(163))}function ld(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new Vx),t.forEach(function(n){var r=Xx.bind(null,e,n);i.has(n)||(i.add(n),n.then(r,r))})}}var Ux=typeof WeakMap=="function"?WeakMap:Map;function Pf(e,t,i){i=$t(i,null),i.tag=3,i.payload={element:null};var n=t.value;return i.callback=function(){Cs||(Cs=!0,Na=n),Ea(e,t)},i}function zf(e,t,i){i=$t(i,null),i.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var r=t.value;i.payload=function(){return Ea(e,t),n(r)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(i.callback=function(){typeof n!="function"&&(Ht===null?Ht=new Set([this]):Ht.add(this),Ea(e,t));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),i}var $x=Math.ceil,vs=Ke.ReactCurrentDispatcher,Df=Ke.ReactCurrentOwner,oe=0,eu=8,qe=16,dt=32,hi=0,ws=1,Lf=2,ys=3,Ws=4,tu=5,j=oe,Ve=null,V=null,Ee=0,se=hi,Hs=null,St=1073741823,Qn=1073741823,xs=null,Zn=0,Ss=!1,iu=0,jf=500,T=null,Cs=!1,Na=null,Ht=null,Ms=!1,Dn=null,xn=90,ri=null,Ln=0,ka=null,Fr=0;function ct(){return(j&(qe|dt))!==oe?1073741821-(We()/10|0):Fr!==0?Fr:Fr=1073741821-(We()/10|0)}function pi(e,t,i){if(t=t.mode,(t&2)===0)return 1073741823;var n=Us();if((t&4)===0)return n===99?1073741823:1073741822;if((j&qe)!==oe)return Ee;if(i!==null)e=Wr(e,i.timeoutMs|0||5e3,250);else switch(n){case 99:e=1073741823;break;case 98:e=Wr(e,150,100);break;case 97:case 96:e=Wr(e,5e3,250);break;case 95:e=2;break;default:throw Error(S(326))}return Ve!==null&&e===Ee&&--e,e}function Ft(e,t){if(50<Ln)throw Ln=0,ka=null,Error(S(185));if(e=Fs(e,t),e!==null){var i=Us();t===1073741823?(j&eu)!==oe&&(j&(qe|dt))===oe?Pa(e):(Be(e),j===oe&&ht()):Be(e),(j&4)===oe||i!==98&&i!==99||(ri===null?ri=new Map([[e,t]]):(i=ri.get(e),(i===void 0||i>t)&&ri.set(e,t)))}}function Fs(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&&(Ve===r&&(Qs(t),se===Ws&&oi(r,Ee)),Qf(r,t)),r}function Qr(e){var t=e.lastExpiredTime;if(t!==0||(t=e.firstPendingTime,!Ff(e,t)))return t;var i=e.lastPingedTime;return e=e.nextKnownPendingLevel,e=i>e?i:e,2>=e&&t!==e?0:e}function Be(e){if(e.lastExpiredTime!==0)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=Uc(Pa.bind(null,e));else{var t=Qr(e),i=e.callbackNode;if(t===0)i!==null&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var n=ct();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!==af&&tf(i)}e.callbackExpirationTime=t,e.callbackPriority=n,t=t===1073741823?Uc(Pa.bind(null,e)):uf(n,Rf.bind(null,e),{timeout:10*(1073741821-t)-We()}),e.callbackNode=t}}}function Rf(e,t){if(Fr=0,t)return t=ct(),ja(e,t),Be(e),null;var i=Qr(e);if(i!==0){if(t=e.callbackNode,(j&(qe|dt))!==oe)throw Error(S(327));if(tn(),e===Ve&&i===Ee||si(e,i),V!==null){var n=j;j|=qe;var r=_f();do try{Fx();break}catch(a){Of(e,a)}while(1);if(Ul(),j=n,vs.current=r,se===ws)throw t=Hs,si(e,i),oi(e,i),Be(e),t;if(V===null)switch(r=e.finishedWork=e.current.alternate,e.finishedExpirationTime=i,n=se,Ve=null,n){case hi:case ws:throw Error(S(345));case Lf:ja(e,2<i?2:i);break;case ys:if(oi(e,i),n=e.lastSuspendedTime,i===n&&(e.nextKnownPendingLevel=za(r)),St===1073741823&&(r=iu+jf-We(),10<r)){if(Ss){var s=e.lastPingedTime;if(s===0||s>=i){e.lastPingedTime=i,si(e,i);break}}if(s=Qr(e),s!==0&&s!==i)break;if(n!==0&&n!==i){e.lastPingedTime=n;break}e.timeoutHandle=vo(ei.bind(null,e),r);break}ei(e);break;case Ws:if(oi(e,i),n=e.lastSuspendedTime,i===n&&(e.nextKnownPendingLevel=za(r)),Ss&&(r=e.lastPingedTime,r===0||r>=i)){e.lastPingedTime=i,si(e,i);break}if(r=Qr(e),r!==0&&r!==i)break;if(n!==0&&n!==i){e.lastPingedTime=n;break}if(Qn!==1073741823?n=10*(1073741821-Qn)-We():St===1073741823?n=0:(n=10*(1073741821-St)-5e3,r=We(),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*$x(n/1960))-n,i<n&&(n=i)),10<n){e.timeoutHandle=vo(ei.bind(null,e),n);break}ei(e);break;case tu:if(St!==1073741823&&xs!==null){s=St;var o=xs;if(n=o.busyMinDurationMs|0,0>=n?n=0:(r=o.busyDelayMs|0,s=We()-(10*(1073741821-s)-(o.timeoutMs|0||5e3)),n=s<=r?0:r+n-s),10<n){oi(e,i),e.timeoutHandle=vo(ei.bind(null,e),n);break}}ei(e);break;default:throw Error(S(329))}if(Be(e),e.callbackNode===t)return Rf.bind(null,e)}}return null}function Pa(e){var t=e.lastExpiredTime;if(t=t!==0?t:1073741823,(j&(qe|dt))!==oe)throw Error(S(327));if(tn(),e===Ve&&t===Ee||si(e,t),V!==null){var i=j;j|=qe;var n=_f();do try{Hx();break}catch(r){Of(e,r)}while(1);if(Ul(),j=i,vs.current=n,se===ws)throw i=Hs,si(e,t),oi(e,t),Be(e),i;if(V!==null)throw Error(S(261));e.finishedWork=e.current.alternate,e.finishedExpirationTime=t,Ve=null,ei(e),Be(e)}return null}function Wx(){if(ri!==null){var e=ri;ri=null,e.forEach(function(t,i){ja(i,t),Be(i)}),ht()}}function Vf(e,t){var i=j;j|=1;try{return e(t)}finally{j=i,j===oe&&ht()}}function Bf(e,t){var i=j;j&=-2,j|=eu;try{return e(t)}finally{j=i,j===oe&&ht()}}function si(e,t){e.finishedWork=null,e.finishedExpirationTime=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,$0(i)),V!==null)for(i=V.return;i!==null;){var n=i;switch(n.tag){case 1:n=n.type.childContextTypes,n!=null&&as();break;case 3:Ji(),G(Me),G(ve);break;case 5:Ql(n);break;case 4:Ji();break;case 13:G(J);break;case 19:G(J);break;case 10:$l(n)}i=i.return}Ve=e,V=xi(e.current,null),Ee=t,se=hi,Hs=null,Qn=St=1073741823,xs=null,Zn=0,Ss=!1}function Of(e,t){do{try{if(Ul(),Hr.current=ms,ps)for(var i=ne.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}if(Lt=0,ge=fe=ne=null,ps=!1,V===null||V.return===null)return se=ws,Hs=t,V=null;e:{var r=e,s=V.return,o=V,a=t;if(t=Ee,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=(J.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 y=d.memoizedProps;m=y.fallback===void 0?!1:y.unstable_avoidThisFallback!==!0?!0:!c}}if(m){var M=d.updateQueue;if(M===null){var p=new Set;p.add(l),d.updateQueue=p}else M.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 h=$t(1073741823,null);h.tag=2,Wt(o,h)}o.expirationTime=1073741823;break e}a=void 0,o=t;var f=r.pingCache;if(f===null?(f=r.pingCache=new Ux,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=Yx.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((It(o.type)||"A React component")+` suspended while rendering, but no fallback UI was specified.
44
-
45
- Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`+bl(o))}se!==tu&&(se=Lf),a=ql(a,o),d=s;do{switch(d.tag){case 3:l=a,d.effectTag|=4096,d.expirationTime=t;var v=Pf(d,l,t);$c(d,v);break e;case 1:l=a;var C=d.type,x=d.stateNode;if((d.effectTag&64)===0&&(typeof C.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Ht===null||!Ht.has(x)))){d.effectTag|=4096,d.expirationTime=t;var N=zf(d,l,t);$c(d,N);break e}}d=d.return}while(d!==null)}V=Wf(V)}catch(z){t=z;continue}break}while(1)}function _f(){var e=vs.current;return vs.current=ms,e===null?ms:e}function Uf(e,t){e<St&&2<e&&(St=e),t!==null&&e<Qn&&2<e&&(Qn=e,xs=t)}function Qs(e){e>Zn&&(Zn=e)}function Hx(){for(;V!==null;)V=$f(V)}function Fx(){for(;V!==null&&!Nx();)V=$f(V)}function $f(e){var t=Hf(e.alternate,e,Ee);return e.memoizedProps=e.pendingProps,t===null&&(t=Wf(e)),Df.current=null,t}function Wf(e){V=e;do{var t=V.alternate;if(e=V.return,(V.effectTag&2048)===0){if(t=jx(t,V,Ee),Ee===1||V.childExpirationTime!==1){for(var i=0,n=V.child;n!==null;){var r=n.expirationTime,s=n.childExpirationTime;r>i&&(i=r),s>i&&(i=s),n=n.sibling}V.childExpirationTime=i}if(t!==null)return t;e!==null&&(e.effectTag&2048)===0&&(e.firstEffect===null&&(e.firstEffect=V.firstEffect),V.lastEffect!==null&&(e.lastEffect!==null&&(e.lastEffect.nextEffect=V.firstEffect),e.lastEffect=V.lastEffect),1<V.effectTag&&(e.lastEffect!==null?e.lastEffect.nextEffect=V:e.firstEffect=V,e.lastEffect=V))}else{if(t=Rx(V),t!==null)return t.effectTag&=2047,t;e!==null&&(e.firstEffect=e.lastEffect=null,e.effectTag|=2048)}if(t=V.sibling,t!==null)return t;V=e}while(V!==null);return se===hi&&(se=tu),null}function za(e){var t=e.expirationTime;return e=e.childExpirationTime,t>e?t:e}function ei(e){var t=Us();return Yt(99,Qx.bind(null,e,t)),null}function Qx(e,t){do tn();while(Dn!==null);if((j&(qe|dt))!==oe)throw Error(S(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(S(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var r=za(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===Ve&&(V=Ve=null,Ee=0),1<i.effectTag?i.lastEffect!==null?(i.lastEffect.nextEffect=i,r=i.firstEffect):r=i:r=i.firstEffect,r!==null){var s=j;j|=dt,Df.current=null,go=Vr;var o=Ec();if(ca(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,y=0,M=0,p=o,h=null;t:for(;;){for(var f;p!==a||u!==0&&p.nodeType!==3||(m=d+u),p!==c||l!==0&&p.nodeType!==3||(w=d+l),p.nodeType===3&&(d+=p.nodeValue.length),(f=p.firstChild)!==null;)h=p,p=f;for(;;){if(p===o)break t;if(h===a&&++y===u&&(m=d),h===c&&++M===l&&(w=d),(f=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=f}a=m===-1||w===-1?null:{start:m,end:w}}else a=null}a=a||{start:0,end:0}}else a=null;mo={activeElementDetached:null,focusedElem:o,selectionRange:a},Vr=!1,T=r;do try{Zx()}catch(k){if(T===null)throw Error(S(330));fi(T,k),T=T.nextEffect}while(T!==null);T=r;do try{for(o=e,a=t;T!==null;){var g=T.effectTag;if(g&16&&Bn(T.stateNode,""),g&128){var v=T.alternate;if(v!==null){var C=v.ref;C!==null&&(typeof C=="function"?C(null):C.current=null)}}switch(g&1038){case 2:ad(T),T.effectTag&=-3;break;case 6:ad(T),T.effectTag&=-3,Mo(T.alternate,T);break;case 1024:T.effectTag&=-1025;break;case 1028:T.effectTag&=-1025,Mo(T.alternate,T);break;case 4:Mo(T.alternate,T);break;case 8:u=T,kf(o,u,a),Nf(u)}T=T.nextEffect}}catch(k){if(T===null)throw Error(S(330));fi(T,k),T=T.nextEffect}while(T!==null);if(C=mo,v=Ec(),g=C.focusedElem,a=C.selectionRange,v!==g&&g&&g.ownerDocument&&Bp(g.ownerDocument.documentElement,g)){for(a!==null&&ca(g)&&(v=a.start,C=a.end,C===void 0&&(C=v),"selectionStart"in g?(g.selectionStart=v,g.selectionEnd=Math.min(C,g.value.length)):(C=(v=g.ownerDocument||document)&&v.defaultView||window,C.getSelection&&(C=C.getSelection(),u=g.textContent.length,o=Math.min(a.start,u),a=a.end===void 0?o:Math.min(a.end,u),!C.extend&&o>a&&(u=a,a=o,o=u),u=bc(g,o),c=bc(g,a),u&&c&&(C.rangeCount!==1||C.anchorNode!==u.node||C.anchorOffset!==u.offset||C.focusNode!==c.node||C.focusOffset!==c.offset)&&(v=v.createRange(),v.setStart(u.node,u.offset),C.removeAllRanges(),o>a?(C.addRange(v),C.extend(c.node,c.offset)):(v.setEnd(c.node,c.offset),C.addRange(v)))))),v=[],C=g;C=C.parentNode;)C.nodeType===1&&v.push({element:C,left:C.scrollLeft,top:C.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<v.length;g++)C=v[g],C.element.scrollLeft=C.left,C.element.scrollTop=C.top}Vr=!!go,mo=go=null,e.current=i,T=r;do try{for(g=e;T!==null;){var x=T.effectTag;if(x&36&&_x(g,T.alternate,T),x&128){v=void 0;var N=T.ref;if(N!==null){var z=T.stateNode;switch(T.tag){case 5:v=z;break;default:v=z}typeof N=="function"?N(v):N.current=v}}T=T.nextEffect}}catch(k){if(T===null)throw Error(S(330));fi(T,k),T=T.nextEffect}while(T!==null);T=null,kx(),j=s}else e.current=i;if(Ms)Ms=!1,Dn=e,xn=t;else for(T=r;T!==null;)t=T.nextEffect,T.nextEffect=null,T=t;if(t=e.firstPendingTime,t===0&&(Ht=null),t===1073741823?e===ka?Ln++:(Ln=0,ka=e):Ln=0,typeof Da=="function"&&Da(i.stateNode,n),Be(e),Cs)throw Cs=!1,e=Na,Na=null,e;return(j&eu)!==oe||ht(),null}function Zx(){for(;T!==null;){var e=T.effectTag;(e&256)!==0&&Ox(T.alternate,T),(e&512)===0||Ms||(Ms=!0,uf(97,function(){return tn(),null})),T=T.nextEffect}}function tn(){if(xn!==90){var e=97<xn?97:xn;return xn=90,Yt(e,Gx)}}function Gx(){if(Dn===null)return!1;var e=Dn;if(Dn=null,(j&(qe|dt))!==oe)throw Error(S(331));var t=j;for(j|=dt,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:Af(5,i),Tf(5,i)}}catch(n){if(e===null)throw Error(S(330));fi(e,n)}i=e.nextEffect,e.nextEffect=null,e=i}return j=t,ht(),!0}function ud(e,t,i){t=ql(i,t),t=Pf(e,t,1073741823),Wt(e,t),e=Fs(e,1073741823),e!==null&&Be(e)}function fi(e,t){if(e.tag===3)ud(e,e,t);else for(var i=e.return;i!==null;){if(i.tag===3){ud(i,e,t);break}else if(i.tag===1){var n=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Ht===null||!Ht.has(n))){e=ql(t,e),e=zf(i,e,1073741823),Wt(i,e),i=Fs(i,1073741823),i!==null&&Be(i);break}}i=i.return}}function Yx(e,t,i){var n=e.pingCache;n!==null&&n.delete(t),Ve===e&&Ee===i?se===Ws||se===ys&&St===1073741823&&We()-iu<jf?si(e,Ee):Ss=!0:Ff(e,i)&&(t=e.lastPingedTime,t!==0&&t<i||(e.lastPingedTime=i,Be(e)))}function Xx(e,t){var i=e.stateNode;i!==null&&i.delete(t),t=0,t===0&&(t=ct(),t=pi(t,e,null)),e=Fs(e,t),e!==null&&Be(e)}var Hf;Hf=function(e,t,i){var n=t.expirationTime;if(e!==null){var r=t.pendingProps;if(e.memoizedProps!==r||Me.current)at=!0;else{if(n<i){switch(at=!1,t.tag){case 3:ed(t),xo();break;case 5:if(Qc(t),t.mode&4&&i!==1&&r.hidden)return t.expirationTime=t.childExpirationTime=1,null;break;case 1:Ie(t.type)&&Ur(t);break;case 4:ya(t,t.stateNode.containerInfo);break;case 10:n=t.memoizedProps.value,r=t.type._context,te(ls,r._currentValue),r._currentValue=n;break;case 13:if(t.memoizedState!==null)return n=t.child.childExpirationTime,n!==0&&n>=i?td(e,t,i):(te(J,J.current&1),t=Mt(e,t,i),t!==null?t.sibling:null);te(J,J.current&1);break;case 19:if(n=t.childExpirationTime>=i,(e.effectTag&64)!==0){if(n)return nd(e,t,i);t.effectTag|=64}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null),te(J,J.current),!n)return null}return Mt(e,t,i)}at=!1}}else at=!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=Yi(t,ve.current),Ui(t,i),r=Yl(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,Ie(n)){var s=!0;Ur(t)}else s=!1;t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Wl(t);var o=n.getDerivedStateFromProps;typeof o=="function"&&ds(t,n,o,e),r.updater=$s,t.stateNode=r,r._reactInternalFiber=t,wa(t,n,e,i),t=Ia(null,t,n,!0,s,i)}else t.tag=0,Pe(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,b0(r),r._status!==1)throw r._result;switch(r=r._result,t.type=r,s=t.tag=qx(r),e=Je(r,e),s){case 0:t=Ma(null,t,r,e,i);break e;case 1:t=qc(null,t,r,e,i);break e;case 11:t=Jc(null,t,r,e,i);break e;case 14:t=Kc(null,t,r,Je(r.type,e),n,i);break e}throw Error(S(306,r,""))}return t;case 0:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:Je(n,r),Ma(e,t,n,r,i);case 1:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:Je(n,r),qc(e,t,n,r,i);case 3:if(ed(t),n=t.updateQueue,e===null||n===null)throw Error(S(282));if(n=t.pendingProps,r=t.memoizedState,r=r!==null?r.element:null,Hl(e,t),Wn(t,n,null,i),n=t.memoizedState.element,n===r)xo(),t=Mt(e,t,i);else{if((r=t.stateNode.hydrate)&&(jt=_i(t.stateNode.containerInfo.firstChild),Ct=t,r=di=!0),r)for(i=Fl(t,null,n,i),t.child=i;i;)i.effectTag=i.effectTag&-3|1024,i=i.sibling;else Pe(e,t,n,i),xo();t=t.child}return t;case 5:return Qc(t),e===null&&Ca(t),n=t.type,r=t.pendingProps,s=e!==null?e.memoizedProps:null,o=r.children,da(n,r)?o=null:s!==null&&da(n,s)&&(t.effectTag|=16),Mf(e,t),t.mode&4&&i!==1&&r.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(Pe(e,t,o,i),t=t.child),t;case 6:return e===null&&Ca(t),null;case 13:return td(e,t,i);case 4:return ya(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Xi(t,null,n,i):Pe(e,t,n,i),t.child;case 11:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:Je(n,r),Jc(e,t,n,r,i);case 7:return Pe(e,t,t.pendingProps,i),t.child;case 8:return Pe(e,t,t.pendingProps.children,i),t.child;case 12:return Pe(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(te(ls,a._currentValue),a._currentValue=s,o!==null)if(a=o.value,s=wi(a,s)?0:(typeof n._calculateChangedBits=="function"?n._calculateChangedBits(a,s):1073741823)|0,s===0){if(o.children===r.children&&!Me.current){t=Mt(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=$t(i,null),u.tag=2,Wt(a,u)),a.expirationTime<i&&(a.expirationTime=i),u=a.alternate,u!==null&&u.expirationTime<i&&(u.expirationTime=i),df(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}Pe(e,t,r.children,i),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps,n=s.children,Ui(t,i),r=Fe(r,s.unstable_observedBits),n=n(r),t.effectTag|=1,Pe(e,t,n,i),t.child;case 14:return r=t.type,s=Je(r,t.pendingProps),s=Je(r.type,s),Kc(e,t,r,s,n,i);case 15:return Cf(e,t,t.type,t.pendingProps,n,i);case 17:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:Je(n,r),e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),t.tag=1,Ie(n)?(e=!0,Ur(t)):e=!1,Ui(t,i),pf(t,n,r),wa(t,n,r,i),Ia(null,t,n,!0,e,i);case 19:return nd(e,t,i)}throw Error(S(156,t.tag))};var Da=null,La=null;function Jx(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);Da=function(n){try{t.onCommitFiberRoot(i,n,void 0,(n.current.effectTag&64)===64)}catch{}},La=function(n){try{t.onCommitFiberUnmount(i,n)}catch{}}}catch{}return!0}function Kx(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 lt(e,t,i,n){return new Kx(e,t,i,n)}function nu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qx(e){if(typeof e=="function")return nu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ml)return 11;if(e===Il)return 14}return 2}function xi(e,t){var i=e.alternate;return i===null?(i=lt(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 Zr(e,t,i,n,r,s){var o=2;if(n=e,typeof e=="function")nu(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ti:return Rt(i.children,r,s,t);case I0:o=8,r|=7;break;case lp:o=8,r|=1;break;case Lr:return e=lt(12,i,t,r|8),e.elementType=Lr,e.type=Lr,e.expirationTime=s,e;case jr:return e=lt(13,i,t,r),e.type=jr,e.elementType=jr,e.expirationTime=s,e;case Xo:return e=lt(19,i,t,r),e.elementType=Xo,e.expirationTime=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case up:o=10;break e;case cp:o=9;break e;case Ml:o=11;break e;case Il:o=14;break e;case dp:o=16,n=null;break e;case hp:o=22;break e}throw Error(S(130,e==null?e:typeof e,""))}return t=lt(o,i,t,r),t.elementType=e,t.type=n,t.expirationTime=s,t}function Rt(e,t,i,n){return e=lt(7,e,n,t),e.expirationTime=i,e}function Io(e,t,i){return e=lt(6,e,null,t),e.expirationTime=i,e}function bo(e,t,i){return t=lt(4,e.children!==null?e.children:[],e.key,t),t.expirationTime=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function eS(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 Ff(e,t){var i=e.firstSuspendedTime;return e=e.lastSuspendedTime,i!==0&&i>=t&&e<=t}function oi(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 Qf(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 ja(e,t){var i=e.lastExpiredTime;(i===0||i>t)&&(e.lastExpiredTime=t)}function Is(e,t,i,n){var r=t.current,s=ct(),o=zn.suspense;s=pi(s,r,o);e:if(i){i=i._reactInternalFiber;t:{if(Ii(i)!==i||i.tag!==1)throw Error(S(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break t;case 1:if(Ie(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break t}}a=a.return}while(a!==null);throw Error(S(171))}if(i.tag===1){var l=i.type;if(Ie(l)){i=ef(i,l,a);break e}}i=a}else i=Gt;return t.context===null?t.context=i:t.pendingContext=i,t=$t(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),Wt(r,t),Ft(r,s),s}function Eo(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 cd(e,t){e=e.memoizedState,e!==null&&e.dehydrated!==null&&e.retryTime<t&&(e.retryTime=t)}function ru(e,t){cd(e,t),(e=e.alternate)&&cd(e,t)}function su(e,t,i){i=i!=null&&i.hydrate===!0;var n=new eS(e,t,i),r=lt(3,null,null,t===2?7:t===1?3:0);n.current=r,r.stateNode=n,Wl(r),e[er]=n.current,i&&t!==0&&P0(e,e.nodeType===9?e:e.ownerDocument),this._internalRoot=n}su.prototype.render=function(e){Is(e,this._internalRoot,null,null)};su.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;Is(null,e,null,function(){t[er]=null})};function or(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function tS(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 Zs(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=Eo(o);a.call(u)}}Is(t,o,e,r)}else{if(s=i._reactRootContainer=tS(i,n),o=s._internalRoot,typeof r=="function"){var l=r;r=function(){var u=Eo(o);l.call(u)}}Bf(function(){Is(t,o,e,r)})}return Eo(o)}function iS(e,t,i){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ti,key:n==null?null:""+n,children:e,containerInfo:t,implementation:i}}Pp=function(e){if(e.tag===13){var t=Wr(ct(),150,100);Ft(e,t),ru(e,t)}};Nl=function(e){e.tag===13&&(Ft(e,3),ru(e,3))};zp=function(e){if(e.tag===13){var t=ct();t=pi(t,e,null),Ft(e,t),ru(e,t)}};Yo=function(e,t,i){switch(t){case"input":if(Ko(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=Rl(n);if(!r)throw Error(S(90));fp(n),Ko(n,r)}}}break;case"textarea":mp(e,i);break;case"select":t=i.value,t!=null&&Oi(e,!!i.multiple,t,!1)}};vl=Vf;sp=function(e,t,i,n,r){var s=j;j|=4;try{return Yt(98,e.bind(null,t,i,n,r))}finally{j=s,j===oe&&ht()}};wl=function(){(j&(1|qe|dt))===oe&&(Wx(),tn())};op=function(e,t){var i=j;j|=2;try{return e(t)}finally{j=i,j===oe&&ht()}};function Zf(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!or(t))throw Error(S(200));return iS(e,t,null,i)}var nS={Events:[ir,vi,Rl,ip,Go,Gi,function(e){Al(e,H0)},np,rp,Bs,Vs,tn,{current:!1}]};(function(e){var t=e.findFiberByHostInstance;return Jx(Se({},e,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ke.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Ep(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:tr,bundleType:0,version:"16.14.0",rendererPackageName:"react-dom"});Qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=nS;Qe.createPortal=Zf;Qe.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(S(188)):Error(S(268,Object.keys(e)));return e=Ep(t),e=e===null?null:e.stateNode,e};Qe.flushSync=function(e,t){if((j&(qe|dt))!==oe)throw Error(S(187));var i=j;j|=1;try{return Yt(99,e.bind(null,t))}finally{j=i,ht()}};Qe.hydrate=function(e,t,i){if(!or(t))throw Error(S(200));return Zs(null,e,t,!0,i)};Qe.render=function(e,t,i){if(!or(t))throw Error(S(200));return Zs(null,e,t,!1,i)};Qe.unmountComponentAtNode=function(e){if(!or(e))throw Error(S(40));return e._reactRootContainer?(Bf(function(){Zs(null,null,e,!1,function(){e._reactRootContainer=null,e[er]=null})}),!0):!1};Qe.unstable_batchedUpdates=Vf;Qe.unstable_createPortal=function(e,t){return Zf(e,t,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)};Qe.unstable_renderSubtreeIntoContainer=function(e,t,i,n){if(!or(i))throw Error(S(200));if(e==null||e._reactInternalFiber===void 0)throw Error(S(38));return Zs(e,t,i,!1,n)};Qe.version="16.14.0";function Gf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Gf)}catch(e){console.error(e)}}Gf(),Xh.exports=Qe;var dd=Xh.exports,rS=Object.defineProperty,sS=Object.defineProperties,oS=Object.getOwnPropertyDescriptors,hd=Object.getOwnPropertySymbols,aS=Object.prototype.hasOwnProperty,lS=Object.prototype.propertyIsEnumerable,pd=(e,t,i)=>t in e?rS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,De=(e,t)=>{for(var i in t||(t={}))aS.call(t,i)&&pd(e,i,t[i]);if(hd)for(var i of hd(t))lS.call(t,i)&&pd(e,i,t[i]);return e};const Yf={src:"",currentTime:0,hostTime:0,muted:!1,paused:!0,volume:1},Xf={currentTimeMaxError:1,syncInterval:1e3,retryInterval:15e3,verbose:!1,log:console.log.bind(console)};let kt=Xf;function uS(e){kt=De(De({},Xf),e)}function Ar(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 cS=navigator.userAgent.includes("Safari"),dS=[".aac",".mid",".midi",".mp3",".ogg",".oga",".wav",".weba"];var hS=typeof global=="object"&&global&&global.Object===Object&&global,pS=typeof self=="object"&&self&&self.Object===Object&&self,Jf=hS||pS||Function("return this")(),bs=Jf.Symbol,Kf=Object.prototype,fS=Kf.hasOwnProperty,gS=Kf.toString,fn=bs?bs.toStringTag:void 0,mS=Object.prototype.toString,fd=bs?bs.toStringTag:void 0;function vS(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":fd&&fd in Object(e)?function(t){var i=fS.call(t,fn),n=t[fn];try{t[fn]=void 0;var r=!0}catch{}var s=gS.call(t);return r&&(i?t[fn]=n:delete t[fn]),s}(e):function(t){return mS.call(t)}(e)}var wS=/\s/,yS=/^\s+/;function xS(e){return e&&e.slice(0,function(t){for(var i=t.length;i--&&wS.test(t.charAt(i)););return i}(e)+1).replace(yS,"")}function Ra(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var SS=/^[-+]0x[0-9a-f]+$/i,CS=/^0b[01]+$/i,MS=/^0o[0-7]+$/i,IS=parseInt;function gd(e){if(typeof e=="number")return e;if(function(n){return typeof n=="symbol"||function(r){return r!=null&&typeof r=="object"}(n)&&vS(n)=="[object Symbol]"}(e))return NaN;if(Ra(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ra(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=xS(e);var i=CS.test(e);return i||MS.test(e)?IS(e.slice(2),i?2:8):SS.test(e)?NaN:+e}var Ao=function(){return Jf.Date.now()},bS=Math.max,ES=Math.min;function Tr(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 v=n,C=r;return n=r=void 0,u=g,o=e.apply(C,v)}function y(g){return u=g,a=setTimeout(p,t),c?w(g):o}function M(g){var v=g-l;return l===void 0||v>=t||v<0||d&&g-u>=s}function p(){var g=Ao();if(M(g))return h(g);a=setTimeout(p,function(v){var C=t-(v-l);return d?ES(C,s-(v-u)):C}(g))}function h(g){return a=void 0,m&&n?w(g):(n=r=void 0,o)}function f(){var g=Ao(),v=M(g);if(n=arguments,r=this,l=g,v){if(a===void 0)return y(l);if(d)return clearTimeout(a),a=setTimeout(p,t),w(l)}return a===void 0&&(a=setTimeout(p,t)),o}return t=gd(t)||0,Ra(i)&&(c=!!i.leading,s=(d="maxWait"in i)?bS(gd(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:h(Ao())},f}class md extends Mi.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=De(De({},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=De(De({},this.getPositionStyle(this.props.current)),this.props.sliderColor&&{backgroundColor:this.props.sliderColor});return $.createElement("div",{className:"connect",style:i})},this.renderHoverProgress=()=>{const i=De(De({},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 AS extends Mi.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=Tr(i=>{this.props.setCurrentTime(i)},50),this.onVolumeChange=i=>{this.changeVolume(i),this.setState({seekVolume:i/100})},this.changeVolume=Tr(i=>{this.props.setVolume(i/100)},50),this.onVolumeSeekStart=()=>{this.onVolumeSeeking=!0},this.onVolumeSeekEnd=Tr(()=>{this.onVolumeSeeking=!1},500),this.onProgressSeekStart=()=>this.setState({isPlayerSeeking:!0}),this.onProgressSeekEnd=Tr(()=>{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(md,{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(md,{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"},vd(Math.floor(i/1e3))," /"," ",vd(Math.floor(t/1e3)))))}}function vd(e){const t=e%60,i=(e-t)/60;if(i>=60){const n=i%60;return`${gn((i-n)/60)}:${gn(n)}:${gn(t)}`}return`${gn(i)}:${gn(t)}`}function gn(e){return e<=9?`0${e}`:`${e}`}class TS extends Mi.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(NS,{room:i,player:n,context:t,plugin:{putAttributes:r}})}}class NS extends Mi.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.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=Ar(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)),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=Ar(n,this.props);let o=kt.currentTimeMaxError;this.state.NoSound&&(o*=3),s>r.duration()?this.resetPlayer():Math.abs(r.currentTime()-s)>o&&(this.debug("<<< currentTime -> %o",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(cS&&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",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(c=>(window.requestAnimationFrame||window.setTimeout)(c)),this.debug("initializing videojs() ...");const u=fu.default(a);this.player=u,window.player=u,u.one("loadedmetadata",this.gracefullyUpdate),u.on("ready",()=>{var c;(c=kt.onPlayer)==null||c.call(kt,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=De(De({},Yf),i),this.player){let r=Ar(i,this.props),s=this.player.duration();!i.paused&&r>s&&(n=De({},i),i=sS(n,oS({currentTime:0,paused:!0})),this.resetPlayer())}var n;return i}}isShowingPoster(){const t=this.getAttributes();return!(t!=null&&t.src)||dS.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(AS,{duration:r,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*Ar(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){kt.verbose&&kt.log(`[MediaPlayer] ${t}`,...i)}componentDidMount(){this.debug("app version =","0.1.0-alpha.5"),this.debug("video.js version =",fu.default.VERSION),this.initPlayer(),this.props.context.emitter.on("attributesUpdate",this.syncPlayerWithAttributes),this.syncPlayerTimer=setInterval(this.syncPlayerWithAttributes,kt.syncInterval),this.decreaseRetryTimer=setInterval(this.decreaseRetryCount,kt.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 Va={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=De(De({},Yf),t);const i=e.getBox();i.mountStyles(`.vjs-p{display:flex;flex-grow:1}.vjs-p *{pointer-events:auto}.vjs-p.disabled *{pointer-events:none}.vjs-p .video-js-plugin-poster{position:absolute;top:0;left:0;right:0;bottom:0;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgQAAACACAYAAAB0vHFxAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACBKADAAQAAAABAAAAgAAAAACE3oPTAAAKXUlEQVR4Ae3dYW4ktxEG0LW9FwkC2McycokAOUGAXMLwtQwYvomdP4akHUnNnm6SVUU+/xqpe8ji+yiDWz3a/e7L5v/98se//3pL8K9//O+7t19Hv85eX7RP9vnllz2h4/rkd+wz+ir/0cLfjv/9t1/6igABAgQIENhRwIFgx9StmQABAgQIPAg4EDyA+JIAAQIECOwo8HXHRVvzPIHRzwBHjz9PKudMo31Hj59TdZ2qsueXvb5sO0GHIFsi6iFAgAABAgECOgQB6KbsJ5Dtt0L6rWyPkeRXO+fs+WWvL1v6OgTZElEPAQIECBAIENAhCEA3ZT8Bzwj7WUaMJL8I9X5zZs8ve339kugzkg5BH0ejECBAgACB0gIOBKXjUzwBAgQIEOgj4EDQx9EoBAgQIECgtIADQen4FE+AAAECBPoIOBD0cTQKAQIECBAoLeC3DErHp/iWgE8Zt4RyX5df7nxa1Y3Ob/T4rfWtdl2HYLVErYcAAQIECFwQWL5DsPoJcvX1XdjTpd4iv1JxvStWfu9IfCORwLP7U4cgUXhKIUCAAAECUQIOBFHy5iVAgAABAokEHAgShaEUAgQIECAQJXD7MwTPPqOIWujVeUevb/T4V9ftfecE5HfOKetd8suajLoiBHQIItTNSYAAAQIEkgnc7hAkW0/3ckb/e9qjx+8OYsBvBOT3DUe5L+RXLjIFDxTQIRiIa2gCBAgQIFBFoNkh2P0Z2+j1jx4/+0asvv7q9d/dH9XXX73+3fO7u/7W+3fbHzoErR3hOgECBAgQ2ECg2SHwjG2DXRC4xOj9tdufAHpHLb/eonPHk9+xd7TPcXX9r+oQ9Dc1IgECBAgQKCfgQFAuMgUTIECAAIH+Ag4E/U2NSIAAAQIEygk0P0MQvaLsz3hb9bWu840WOJ5ffsc+2a/KL3tC6jsSmL1/dQiO0nCNAAECBAhsItDsEMw+oTzrHl1f61OorevPrvfZ+6N9WvVmr09+xwnKr7ZP9vyOdcdfze7Tuz4dgvF7ygwECBAgQCC9QLNDkH0F0X+C45NdoHZ99rf8aguofqRA7/8/6BCMTMvYBAgQIECgiED5DkHvZyhFcjtdJp/TVClvlF/KWE4XJb/TVG68INB7f+kQXAjBWwgQIECAwGoCDgSrJWo9BAgQIEDggoADwQU0byFAgAABAqsJfO39DGI1IOuJFbA/Y/3vzi6/u4Kx7189v7vru/v+2HTfz65D8N7EdwgQIECAwHYCw3/LYLUT1HY7pLFg+TaAkl+WX/KAGuXJrwEUfLlaPjoEwRvG9AQIECBAIIPA8A5B779JKQOaGl4F5PtqUfGV/Cqm9lqz/F4tMr6qlo8OQcZdpCYCBAgQIDBZYHiHoNozlMn+5aeTb+0I5Se/2gK5q6/286VDkHs/qY4AAQIECEwRcCCYwmwSAgQIECCQW8CBIHc+qiNAgAABAlMEhn+GYMoqTEKAAAEC7wSqPcN+twDfmCqgQzCV22QECBAgQCCnQHiHoPoJtlV/63rObfFaVfX6X1dy7VX19Vev/1pqr++qvv7q9b8m4dVHAtny1SH4KCXfI0CAAAECmwmEdwiq/U1Om+2PL/Kpnbj85FdbYO3qs/186hCsvd+sjgABAgQInBJwIDjF5CYCBAgQILC2gAPB2vlaHQECBAgQOCUQ/hmCbJ+yPKW20U3yqR22/ORXW2Dt6qN/Ph/n1yFYe79ZHQECBAgQOCXgQHCKyU0ECBAgQGBtAQeCtfO1OgIECBAgcErAgeAUk5sIECBAgMDaAg4Ea+drdQQIECBA4JTA1+///OGnoztd52N/fC7g58PPx+e748sX+8P+qLQ/dAiO0nKNAAECBAhsIuBAsEnQlkmAAAECBI4EHAiOdFwjQIAAAQKbCDgQbBK0ZRIgQIAAgSMBB4IjHdcIECBAgMAmAuH/lsHP//zvb5tYl1ymfErG9lK0/F4oSr6QX8nYThcdne/j/DoEp6NzIwECBAgQWFfAgWDdbK2MAAECBAicFnAgOE3lRgIECBAgsK5A+GcIfv39Pz++5X18pvH2mtfzBeQz37znjPLrqTl/LPnNN585Y7Z8dQhmpm8uAgQIECCQVCC8Q1C9I9Cqv3U96b54Kat6/S8Lufii+vqr138xtpe3VV9/9fpfgvDiQ4Fs+eoQfBiTbxIgQIAAgb0EwjsEe3FbLQECBOYJZPsT6LyVm+mKgA7BFTXvIUCAAAECiwk4ECwWqOUQIECAAIErAg4EV9S8hwABAgQILCYw/DMEnmEttmMeliPfB5BiX8qvWGAP5crvASTZl9Xy0SFItoGUQ4AAAQIEIgSGdwiy/U1MEcgrzynf2unKT361BXJXX+3nS4cg935SHQECBAgQmCIwvENQ7RnKFPWFJpFv7TDlJ7/aArmrr/bzpUOQez+pjgABAgQITBH4Wu0EM0XFJGkE7M80UVwqRH6X2NK8afX87q7v7vvTBP13IToE2RJRDwECBAgQCBBwIAhANyUBAgQIEMgm4ECQLRH1ECBAgACBAIHhv2Uwek2rPcPp7cWnt+jc8eQ317v3bPLrLWq8twK995cOwVtdrwkQIECAwKYC5TsE1f4mqNn7jM9s8b7zya+v5+zR5DdbfK/5eu8vHYK99o/VEiBAgACBDwWaHYLezyg+rOLGN6Pra53QWtdvLP3UW6N9WkVmr09+xwnKr7ZP9vyOdcdfze7Tuz4dgvF7ygwECBAgQCC9QLNDEL2C3ieg3utp1de63rueZ8fLXt+z6+l9f3af7PX1zuPZ8bL7ZK/vWW/39xWYvT90CPrmZzQCBAgQIFBSwIGgZGyKJkCAAAECfQUcCPp6Go0AAQIECJQUaH6GIPpT1iVVFX1aIHp/zX5GdxqmyI3yKxLUJ2XK7xOYv78d7XNcXf+rOgT9TY1IgAABAgTKCTQ7BLv/CWr0+kePn31HVl9/9frv7o/q669e/+753V1/6/277Q8dgtaOcJ0AAQIECGwg0OwQbGBwuMTRz5BGj3+4OBdvC8jvNmHoAPIL5Td5MgEdgmSBKIcAAQIECEQI3O4QrP6MZfT6Ro8fsal2mlN+tdOWX+38VN9XQIegr6fRCBAgQIBASQEHgpKxKZoAAQIECPQVcCDo62k0AgQIECBQUuD2Zwiyr3r1Z4Srry/7/rpbn/zuCsa+X36x/mY/Fnh2f+oQHHu6SoAAAQIEthBYvkOwRYoW+anAsyfkTwdyIURAfiHs3SYdnd/o8btBFBlIh6BIUMokQIAAAQIjBRwIRuoamwABAgQIFBFwICgSlDIJECBAgMBIAQeCkbrGJkCAAAECRQQcCIoEpUwCBAgQIDBSwG8ZjNQ19nABnzIeTjx0AvkN5R0+ePb8stc3PKAnJ9AheBLM7QQIECBAYEUBHYIVU91oTf49+9phy09+IwXsr+d0dQie83I3AQIECBBYUkCHYMlY8yxq9DO80ePnkYypZLTv6PFj1PaZNXt+2evLtlN0CLIloh4CBAgQIBAg4EAQgG5KAgQIECCQTcCBIFsi6iFAgAABAgEC/wdVfx9UuC8B6AAAAABJRU5ErkJggg==);background-repeat:repeat-x;background-position:0 50%;display:flex;align-items:center;justify-content:center}.vjs-p .video-js-plugin-poster img{box-shadow:0 0 5px 10px #0006}.vjs-p .player-controller,.vjs-p .videojs-plugin-muted-alert{pointer-events:auto}.vjs-p.disabled .videojs-plugin-close-icon,.vjs-p.disabled .player-controller{pointer-events:none}.vjs-p .video-js-plugin-player{position:absolute;top:0;left:0;right:0;bottom:0}.video-js,[data-vjs-player]{width:100%;height:100%}.vjs-p .videojs-plugin-muted-alert{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:43}.vjs-p .videojs-plugin-muted-alert:before{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:43;content:"\\f104";background:rgba(0,0,0,.3);font-family:VideoJS;font-size:2em;display:flex;align-items:center;justify-content:center;color:#fff}.vjs-p .videojs-plugin-recovery-mode{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:44}.vjs-p .videojs-plugin-recovery-mode button{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.vjs-p .seek-slider{position:relative;width:100%}.vjs-p .seek-slider:focus{outline:none}.vjs-p .seek-slider .track{padding:10px 0;cursor:pointer;outline:none}.vjs-p .seek-slider .track:focus{border:0;outline:none}.vjs-p .seek-slider .track .main{width:100%;height:3px;background-color:#ffffff4d;border-radius:30px;position:absolute;left:0;top:8.5px;transition:transform .4s;outline:none}.vjs-p .seek-slider .track .main:focus{border:0;outline:none}.vjs-p .seek-slider .track .main .buffered{position:absolute;background-color:#ffffff4d;width:100%;height:100%;transform:scaleX(.8);z-index:2;transform-origin:0 0}.vjs-p .seek-slider .track .main .seek-hover{position:absolute;background-color:#ffffff80;width:100%;height:100%;z-index:1;transform:scaleX(.6);transform-origin:0 0;opacity:0;transition:opacity .4s}.vjs-p .seek-slider .track .main .connect{position:absolute;background-color:#fff;width:100%;height:100%;z-index:3;left:0;transform:scaleX(.13);transform-origin:0 0}.vjs-p .seek-slider .track.active .main{transform:scaleY(2)}.vjs-p .seek-slider .thumb{pointer-events:none;position:absolute;width:12px;height:12px;left:-6px;top:4px;z-index:4;transform:translate(100px)}.vjs-p .seek-slider .thumb .handler{border-radius:100%;width:100%;height:100%;background-color:#fff;opacity:0;transform:scale(.4);cursor:pointer;transition:transform .2s;pointer-events:none}.vjs-p .seek-slider .thumb.active .handler{opacity:1;transform:scale(1)}.vjs-p .seek-slider .hover-time{position:absolute;background-color:#0000004d;line-height:18px;font-size:16px;color:#ddd;top:-25px;left:0;padding:5px 10px;border-radius:5px;box-shadow:0 0 5px #0000004d;opacity:0;transform:translate(150px);pointer-events:none}.vjs-p .seek-slider .hover-time.active{opacity:1}.vjs-p .seek-slider:hover .track .main .seek-hover{opacity:1}.vjs-p .player-controller{position:absolute;z-index:100;bottom:0px;left:0;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:stretch;height:64px;background-image:linear-gradient(0deg,#000,transparent);transition:opacity .2s;color:#fff}.vjs-p .player-menu-box{display:flex;align-items:center;justify-content:center;flex-direction:column;margin-bottom:40px}.vjs-p .player-menu-cell{width:100%;text-align:center;font-size:12px;color:#7a7b7c}.vjs-p .player-multiple-play{width:64px;height:120px}.vjs-p .player-controller-actions-left{display:flex;justify-content:center;align-items:center;flex-shrink:0}.vjs-p .player-right-box{font-size:14px;color:#7a7b7c;cursor:pointer;margin-right:12px}.vjs-p .player-controller-actions{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-left:8px;padding-right:8px;margin-top:2px}.vjs-p .player-mid-box-time{font-size:9px;display:flex;justify-content:center;align-items:center;color:#fff;flex-shrink:0;margin-right:8px;font-family:monospace}.vjs-p .player-controller-play{display:flex;align-items:center;justify-content:center;cursor:pointer;padding-right:4px}.vjs-p .player-controller-progress{width:calc(100% - 28px);margin-left:14px;display:flex;align-items:center;justify-content:center;margin-top:8px}.vjs-p .player-volume{display:flex;align-items:center;justify-content:center;cursor:pointer;margin-right:16px;margin-left:8px}.vjs-p .player-volume-slider{width:60px;margin-right:12px;display:flex;align-items:center}.vjs-p .player-volume-box{display:flex;flex-direction:row}.netless-app-media-player-container{display:flex;position:relative;height:100%}
46
- `);const n=document.createElement("div");n.classList.add("netless-app-media-player-container"),dd.render($.createElement(TS,{context:e}),n),i.mountContent(n),e.emitter.on("destroy",()=>{console.log("[MediaPlayer]: destroy"),dd.unmountComponentAtNode(n)})}},kS=()=>{ye.debug&&uS({verbose:!0}),ye.register({kind:Wo.kind,src:Wo}),ye.register({kind:Va.kind,src:Va})},PS={DocsViewer:Wo.kind,MediaPlayer:Va.kind};const qf=new Bv({emitter:L}),B=class extends E.InvisiblePlugin{constructor(e){super(e);this.version="1.0.0-canary.4",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"1.0.0-alpha.12",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^1.1.0",uuid:"^7.0.3","value-enhancer":"^1.2.1","video.js":">=7"},peerDependencies:{"white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.9","@netless/app-media-player":"0.1.0-beta.5","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3",vitest:"^0.14.1","white-web-sdk":"2.16.10"}},this.emitter=ie,this.viewMode=E.ViewMode.Broadcaster,this.isReplay=E.isPlayer(this.displayer),this.containerSizeRatio=B.containerSizeRatio,B.displayer=e.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"1.0.0-alpha.12",emittery:"^0.9.2",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^1.1.0",uuid:"^7.0.3","value-enhancer":"^1.2.1","video.js":">=7"},peerDependencies:{"white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.9","@netless/app-media-player":"0.1.0-beta.5","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",less:"^4.1.1",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3",vitest:"^0.14.1","white-web-sdk":"2.16.10"}}}static async mount(e){var o;const t=e.room;B.container=e.container;const i=e.containerSizeRatio,n=e.debug,r=e.cursor;B.params=e,B.displayer=e.room,Hg();let s;if(E.isRoom(t)){if(t.phase!==E.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");t.phase===E.RoomPhase.Connected&&t.isWritable&&(t.disableSerialization=!1),s=await this.initManager(t)}if(B.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(n),Li("Already insert room",s),E.isRoom(this.displayer)){if(!s)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await hg.default(async a=>{if(s=await t.getInvisiblePlugin(B.kind),!s)throw Li(`manager is empty. retrying ${a}`),new Error},{retries:10});if(!s)throw new Error("[WindowManager]: create manager failed");i&&(B.containerSizeRatio=i),await s.ensureAttributes(),s.appManager=new tm(s),s._pageState=new Vv(s.appManager),s.cursorManager=new Rv(s.appManager,Boolean(r),e.applianceIcons),i&&(s.containerSizeRatio=i),s.boxManager=cv(s,ie,L,wt,{collectorContainer:e.collectorContainer,collectorStyles:e.collectorStyles,prefersColorScheme:e.prefersColorScheme,stageRatio:e.containerSizeRatio}),(o=s.appManager)==null||o.setBoxManager(s.boxManager),e.container&&s.bindContainer(e.container),Ov(t,s),L.emit("onCreated"),B.isCreated=!0;try{await wg()}catch(a){console.warn("[WindowManager]: indexedDB open failed"),console.log(a)}return s}static async initManager(e){let t=e.getInvisiblePlugin(B.kind);if(!t&&E.isRoom(e))if(e.isWritable===!1){try{await e.setWritable(!0)}catch{throw new Error("[WindowManger]: room must be switched to be writable")}t=await e.createInvisiblePlugin(B,{}),t.ensureAttributes(),await Su(500),await e.setWritable(!1)}else t=await e.createInvisiblePlugin(B,{});return t}static initContainer(e,t){B.container||(B.container=e);const{playground:i,mainViewElement:n}=Wg(e);if(B.playground=i,t){const r=document.createElement("style");r.textContent=t,i.appendChild(r)}return n}static get registered(){return je.registered}bindContainer(e){var t,i,n,r,s;if(E.isRoom(this.displayer)&&this.room.phase!==E.RoomPhase.Connected)throw new Nd;if(B.isCreated&&B.container)B.container.firstChild&&e.appendChild(B.container.firstChild);else if(B.params){const o=B.params,a=B.initContainer(e,o.overwriteStyles);this.boxManager&&B.playground&&this.boxManager.setRoot(B.playground),this.bindMainView(a,o.disableCameraTransform),B.playground&&((t=this.cursorManager)==null||t.setupWrapper(B.playground))}L.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),B.container=e}bindCollectorContainer(e){B.isCreated&&this.boxManager?this.boxManager.setCollector(e):B.params&&(B.params.collectorContainer=e)}static register(e){return je.register(e)}static unregister(e){return je.unregister(e)}async addApp(e){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((t,i)=>{L.once("rootDirRemoved").then(async()=>{try{const n=await this._addApp(e);t(n)}catch(n){i(n.message)}})}):this._addApp(e);throw new Ye}async _addApp(e){var t,i,n;if(this.appManager){if(!e.kind||typeof e.kind!="string")throw new bd;const r=await((t=je.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 Md;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=jg(e.options.scenePath)),await this.appManager.addApp(e,Boolean(s)))}else throw new Ye}setupScenePath(e,t){let i=!1;if(e.options){const{scenePath:n,scenes:r}=e.options;if(n){if(!Lg(n))throw new Ad;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)}return}}}n&&r&&r.length>0&&(this.isDynamicPPT(r)?(i=!0,mi(this.displayer)[n]||ai(this.room,n,r)):mi(this.displayer)[n]||ai(this.room,n,[{name:r[0].name}])),n&&r===void 0&&ai(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 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(ze,[i||{}],n)}else this.room.putScenes(ze,[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),L.emit("setReadonly",e)}switchMainViewToWriter(){var e;return(e=this.appManager)==null?void 0:e.mainViewProxy.mainViewClickHandler()}onAppDestroy(e,t){zg(`destroy-${e}`,t)}setViewMode(e){var t,i,n;e===E.ViewMode.Broadcaster&&(this.canOperate&&((t=this.appManager)==null||t.mainViewProxy.setCameraAndSize()),(i=this.appManager)==null||i.mainViewProxy.start()),e===E.ViewMode.Freedom&&((n=this.appManager)==null||n.mainViewProxy.stop()),this.viewMode=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)}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new Ye}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new Ye}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new Ye}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 Ye}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 Ye}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 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 Ye}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 Ye}get pageState(){if(this._pageState)return this._pageState.toObject();throw new Ye}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)}moveCamera(e){var n;const t=b.omit(e,["animationMode"]),i=Q({},this.mainView.camera);b.isEqual(Q(Q({},i),t),i)||(this.mainView.moveCamera(e),(n=this.appManager)==null||n.dispatchInternalEvent(Z.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(Z.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;(e=this.appManager)==null||e.destroy(),(t=this.cursorManager)==null||t.destroy(),B.container=void 0,B.isCreated=!1,B.playground&&((i=B.playground.parentNode)==null||i.removeChild(B.playground)),B.params=void 0,Li("Destroyed")}bindMainView(e,t){var i;this.appManager&&(this.appManager.bindMainView(e,Boolean(t)),(i=this.cursorManager)==null||i.setMainViewDivElement(e))}get canOperate(){return E.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===E.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;(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(Z.Refresh)}_refresh(){var e,t,i;(e=this.appManager)==null||e.mainViewProxy.rebind(),B.container&&this.bindContainer(B.container),(i=(t=this.appManager)==null?void 0:t.refresher)==null||i.refresh()}setContainerSizeRatio(e){if(!b.isNumber(e))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a number. but got ${e}`);B.containerSizeRatio=e,this.containerSizeRatio=e,L.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(){b.isNull(this.attributes)&&await Su(50),b.isObject(this.attributes)&&(this.attributes[me.Apps]||this.safeSetAttributes({[me.Apps]:{}}),this.attributes[me.Cursors]||this.safeSetAttributes({[me.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:Sd}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[me.Registered]||this.safeSetAttributes({[me.Registered]:{}}))}};let ye=B;ye.kind="WindowManager";ye.debug=!1;ye.containerSizeRatio=gg;ye.isCreated=!1;kS();exports.AppCreateError=Md;exports.AppManagerNotInitError=Ye;exports.AppNotRegisterError=Bg;exports.BindContainerRoomPhaseInvalidError=Nd;exports.BoxManagerNotFoundError=Td;exports.BoxNotCreatedError=Ed;exports.BuiltinApps=PS;exports.InvalidScenePath=Ad;exports.ParamsInvalidError=bd;exports.WhiteWebSDKInvalidError=Id;exports.WindowManager=ye;exports.calculateNextIndex=Oa;exports.reconnectRefresher=qf;
15
+ ***************************************************************************** */var he=function(){return he=Object.assign||function(e){for(var i,s=1,r=arguments.length;s<r;s++){i=arguments[s];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},he.apply(this,arguments)};function Bs(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]]);return i}var Ki=0,Aa=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-Ki));Ki=e+i,setTimeout(function(){return t(Ki)},i)},wl=function(t){var e=[],i=[],s=0,r=!1,a=0,n=new WeakSet,o=new WeakSet,c={cancel:function(l){var d=i.indexOf(l);n.add(l),d!==-1&&i.splice(d,1)},process:function(l){var d;if(r=!0,d=[i,e],e=d[0],i=d[1],i.length=0,s=e.length,s){var u;for(a=0;a<s;a++)u=e[a],u(l),o.has(u)===!0&&!n.has(u)&&(c.schedule(u),t(!0))}r=!1},schedule:function(l,d,u){d===void 0&&(d=!1),u===void 0&&(u=!1);var p=u&&r,m=p?e:i;n.delete(l),d&&o.add(l),m.indexOf(l)===-1&&(m.push(l),p&&(s=e.length))}};return c},vl=40,Er=1/60*1e3,pi=!0,Qt=!1,ms=!1,zt={delta:0,timestamp:0},Rs=["read","update","preRender","render","postRender"],xl=function(t){return Qt=t},ka=Rs.reduce(function(t,e){return t[e]=wl(xl),t},{}),Ml=Rs.reduce(function(t,e){var i=ka[e];return t[e]=function(s,r,a){return r===void 0&&(r=!1),a===void 0&&(a=!1),Qt||Cl(),i.schedule(s,r,a),s},t},{}),Sl=function(t){return ka[t].process(zt)},Ta=function(t){Qt=!1,zt.delta=pi?Er:Math.max(Math.min(t-zt.timestamp,vl),1),pi||(Er=zt.delta),zt.timestamp=t,ms=!0,Rs.forEach(Sl),ms=!1,Qt&&(pi=!1,Aa(Ta))},Cl=function(){Qt=!0,pi=!0,ms||Aa(Ta)},Na=function(t,e){return function(i){return Math.max(Math.min(i,e),t)}},gi=function(t){return t%1?Number(t.toFixed(5)):t},Ea=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,Pi={test:function(t){return typeof t=="number"},parse:parseFloat,transform:function(t){return t}},Vt=he(he({},Pi),{transform:Na(0,1)}),li=he(he({},Pi),{default:1}),Os=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}}},lt=Os("deg"),$t=Os("%"),L=Os("px"),Pr=he(he({},$t),{parse:function(t){return $t.parse(t)/100},transform:function(t){return $t.transform(t*100)}}),Il=function(t){return t.substring(t.indexOf("(")+1,t.lastIndexOf(")"))},_l=Na(0,255),fs=function(t){return t.red!==void 0},bs=function(t){return t.hue!==void 0};function Al(t){return Il(t).replace(/(,|\/)/g," ").split(/ \s*/)}var Pa=function(t){return function(e){if(typeof e!="string")return e;for(var i={},s=Al(e),r=0;r<4;r++)i[t[r]]=s[r]!==void 0?parseFloat(s[r]):1;return i}},kl=function(t){var e=t.red,i=t.green,s=t.blue,r=t.alpha,a=r===void 0?1:r;return"rgba("+e+", "+i+", "+s+", "+a+")"},Tl=function(t){var e=t.hue,i=t.saturation,s=t.lightness,r=t.alpha,a=r===void 0?1:r;return"hsla("+e+", "+i+", "+s+", "+a+")"},es=he(he({},Pi),{transform:function(t){return Math.round(_l(t))}});function Us(t,e){return t.startsWith(e)&&Ea.test(t)}var mi={test:function(t){return typeof t=="string"?Us(t,"rgb"):fs(t)},parse:Pa(["red","green","blue","alpha"]),transform:function(t){var e=t.red,i=t.green,s=t.blue,r=t.alpha,a=r===void 0?1:r;return kl({red:es.transform(e),green:es.transform(i),blue:es.transform(s),alpha:gi(Vt.transform(a))})}},ts={test:function(t){return typeof t=="string"?Us(t,"hsl"):bs(t)},parse:Pa(["hue","saturation","lightness","alpha"]),transform:function(t){var e=t.hue,i=t.saturation,s=t.lightness,r=t.alpha,a=r===void 0?1:r;return Tl({hue:Math.round(e),saturation:$t.transform(gi(i)),lightness:$t.transform(gi(s)),alpha:gi(Vt.transform(a))})}},zr=he(he({},mi),{test:function(t){return typeof t=="string"&&Us(t,"#")},parse:function(t){var e="",i="",s="";return t.length>4?(e=t.substr(1,2),i=t.substr(3,2),s=t.substr(5,2)):(e=t.substr(1,1),i=t.substr(2,1),s=t.substr(3,1),e+=e,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(s,16),alpha:1}}}),ze={test:function(t){return typeof t=="string"&&Ea.test(t)||fs(t)||bs(t)},parse:function(t){return mi.test(t)?mi.parse(t):ts.test(t)?ts.parse(t):zr.test(t)?zr.parse(t):t},transform:function(t){return fs(t)?mi.transform(t):bs(t)?ts.transform(t):t}},Ws=function(t){var e=t.onRead,i=t.onRender,s=t.uncachedValues,r=s===void 0?new Set:s,a=t.useCache,n=a===void 0?!0:a;return function(o){o===void 0&&(o={});var c=Bs(o,[]),l={},d=[],u=!1;function p(g,f){g.startsWith("--")&&(c.hasCSSVariable=!0);var b=l[g];l[g]=f,l[g]!==b&&(d.indexOf(g)===-1&&d.push(g),u||(u=!0,Ml.render(m.render)))}var m={get:function(g,f){f===void 0&&(f=!1);var b=!f&&n&&!r.has(g)&&l[g]!==void 0;return b?l[g]:e(g,c)},set:function(g,f){if(typeof g=="string")p(g,f);else for(var b in g)p(b,g[b]);return this},render:function(g){return g===void 0&&(g=!1),(u||g===!0)&&(i(l,c,d),u=!1,d.length=0),this}};return m}},Nl=/([a-z])([A-Z])/g,El="$1-$2",zi=function(t){return t.replace(Nl,El).toLowerCase()},za=new Map,Hs=new Map,Da=["Webkit","Moz","O","ms",""],Pl=Da.length,zl=typeof document!="undefined",is,La=function(t,e){return Hs.set(t,zi(e))},Dl=function(t){is=is||document.createElement("div");for(var e=0;e<Pl;e++){var i=Da[e],s=i==="",r=s?t:i+t.charAt(0).toUpperCase()+t.slice(1);if(r in is.style||s){if(s&&t==="clipPath"&&Hs.has(t))return;za.set(t,r),La(t,(s?"":"-")+zi(r))}}},Ll=function(t){return La(t,t)},Va=function(t,e){e===void 0&&(e=!1);var i=e?Hs:za;return i.has(t)||(zl?Dl(t):Ll(t)),i.get(t)||t},Vl=["","X","Y","Z"],$l=["translate","scale","rotate","skew","transformPerspective"],ys=$l.reduce(function(t,e){return Vl.reduce(function(i,s){return i.push(e+s),i},t)},["x","y","z"]),jl=ys.reduce(function(t,e){return t[e]=!0,t},{});function Fs(t){return jl[t]===!0}function Bl(t,e){return ys.indexOf(t)-ys.indexOf(e)}var Rl=new Set(["originX","originY","originZ"]);function Ol(t){return Rl.has(t)}var Dr=he(he({},Pi),{transform:Math.round}),Ul={color:ze,backgroundColor:ze,outlineColor:ze,fill:ze,stroke:ze,borderColor:ze,borderTopColor:ze,borderRightColor:ze,borderBottomColor:ze,borderLeftColor:ze,borderWidth:L,borderTopWidth:L,borderRightWidth:L,borderBottomWidth:L,borderLeftWidth:L,borderRadius:L,radius:L,borderTopLeftRadius:L,borderTopRightRadius:L,borderBottomRightRadius:L,borderBottomLeftRadius:L,width:L,maxWidth:L,height:L,maxHeight:L,size:L,top:L,right:L,bottom:L,left:L,padding:L,paddingTop:L,paddingRight:L,paddingBottom:L,paddingLeft:L,margin:L,marginTop:L,marginRight:L,marginBottom:L,marginLeft:L,rotate:lt,rotateX:lt,rotateY:lt,rotateZ:lt,scale:li,scaleX:li,scaleY:li,scaleZ:li,skew:lt,skewX:lt,skewY:lt,distance:L,translateX:L,translateY:L,translateZ:L,x:L,y:L,z:L,perspective:L,opacity:Vt,originX:Pr,originY:Pr,originZ:L,zIndex:Dr,fillOpacity:Vt,strokeOpacity:Vt,numOctaves:Dr},Zs=function(t){return Ul[t]},Wl=function(t,e){return e&&typeof t=="number"?e.transform(t):t},jt="scrollLeft",Bt="scrollTop",$a=new Set([jt,Bt]),Hl=new Set([jt,Bt,"transform"]),Fl={x:"translateX",y:"translateY",z:"translateZ"};function ja(t){return typeof t=="function"}function Zl(t,e,i,s,r,a){a===void 0&&(a=!0);var n="",o=!1;i.sort(Bl);for(var c=i.length,l=0;l<c;l++){var d=i[l];n+=(Fl[d]||d)+"("+e[d]+") ",o=d==="z"?!0:o}return!o&&r?n+="translateZ(0)":n=n.trim(),ja(t.transform)?n=t.transform(e,s?"":n):a&&s&&(n="none"),n}function Yl(t,e,i,s,r,a,n,o){e===void 0&&(e=!0),i===void 0&&(i={}),s===void 0&&(s={}),r===void 0&&(r={}),a===void 0&&(a=[]),n===void 0&&(n=!1),o===void 0&&(o=!0);var c=!0,l=!1,d=!1;for(var u in t){var p=t[u],m=Zs(u),g=Wl(p,m);Fs(u)?(l=!0,s[u]=g,a.push(u),c&&(m.default&&p!==m.default||!m.default&&p!==0)&&(c=!1)):Ol(u)?(r[u]=g,d=!0):(!Hl.has(u)||!ja(g))&&(i[Va(u,n)]=g)}return(l||typeof t.transform=="function")&&(i.transform=Zl(t,s,a,c,e,o)),d&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function Ys(t){var e=t===void 0?{}:t,i=e.enableHardwareAcceleration,s=i===void 0?!0:i,r=e.isDashCase,a=r===void 0?!0:r,n=e.allowTransformNone,o=n===void 0?!0:n,c={},l={},d={},u=[];return function(p){return u.length=0,Yl(p,s,c,l,d,u,a,o),c}}function Ql(t,e){var i=e.element,s=e.preparseOutput,r=Zs(t);if(Fs(t))return r&&r.default||0;if($a.has(t))return i[t];var a=window.getComputedStyle(i,null).getPropertyValue(Va(t,!0))||0;return s&&r&&r.test(a)&&r.parse?r.parse(a):a}function Gl(t,e,i){var s=e.element,r=e.buildStyles,a=e.hasCSSVariable;if(Object.assign(s.style,r(t)),a)for(var n=i.length,o=0;o<n;o++){var c=i[o];c.startsWith("--")&&s.style.setProperty(c,t[c])}i.indexOf(jt)!==-1&&(s[jt]=t[jt]),i.indexOf(Bt)!==-1&&(s[Bt]=t[Bt])}var ql=Ws({onRead:Ql,onRender:Gl,uncachedValues:$a});function Jl(t,e){e===void 0&&(e={});var i=e.enableHardwareAcceleration,s=e.allowTransformNone,r=Bs(e,["enableHardwareAcceleration","allowTransformNone"]);return ql(he({element:t,buildStyles:Ys({enableHardwareAcceleration:i,allowTransformNone:s}),preparseOutput:!0},r))}var Ba=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Lr=.5,Ra=function(){return{style:{}}},ss=function(t,e){return L.transform(t*e)},Xl={x:0,y:0,width:0,height:0};function Vr(t,e,i){return typeof t=="string"?t:L.transform(e+i*t)}function Kl(t,e,i){return Vr(e,t.x,t.width)+" "+Vr(i,t.y,t.height)}var Oa={enableHardwareAcceleration:!1,isDashCase:!1};function ec(t,e,i,s,r,a){e===void 0&&(e=Xl),s===void 0&&(s=Ys(Oa)),r===void 0&&(r=Ra()),a===void 0&&(a=!0);var n=t.attrX,o=t.attrY,c=t.originX,l=t.originY,d=t.pathLength,u=t.pathSpacing,p=u===void 0?1:u,m=t.pathOffset,g=m===void 0?0:m,f=Bs(t,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),b=s(f);for(var v in b)if(v==="transform")r.style.transform=b[v];else{var x=a&&!Ba.has(v)?zi(v):v;r[x]=b[v]}return(c!==void 0||l!==void 0||b.transform)&&(r.style.transformOrigin=Kl(e,c!==void 0?c:Lr,l!==void 0?l:Lr)),n!==void 0&&(r.x=n),o!==void 0&&(r.y=o),i!==void 0&&d!==void 0&&(r[a?"stroke-dashoffset":"strokeDashoffset"]=ss(-g,i),r[a?"stroke-dasharray":"strokeDasharray"]=ss(d,i)+" "+ss(p,i)),r}function tc(t,e,i){i===void 0&&(i=!0);var s=Ra(),r=Ys(Oa);return function(a){return ec(a,t,e,r,s,i)}}var ic=function(t){return typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()},sc=function(t){try{return ic(t)}catch{return{x:0,y:0,width:0,height:0}}},rc=function(t){return t.tagName==="path"},ac=Ws({onRead:function(t,e){var i=e.element;if(t=Ba.has(t)?t:zi(t),Fs(t)){var s=Zs(t);return s&&s.default||0}else return i.getAttribute(t)},onRender:function(t,e){var i=e.element,s=e.buildAttrs,r=s(t);for(var a in r)a==="style"?Object.assign(i.style,r.style):i.setAttribute(a,r[a])}}),nc=function(t){var e=sc(t),i=rc(t)&&t.getTotalLength?t.getTotalLength():void 0;return ac({element:t,buildAttrs:tc(e,i)})},oc=Ws({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,s=t.scrollLeft,r=s===void 0?0:s;return window.scrollTo(r,i)}}),ws=new WeakMap,lc=function(t){return t instanceof HTMLElement||typeof t.click=="function"},cc=function(t){return t instanceof SVGElement||"ownerSVGElement"in t},hc=function(t,e){var i;return t===window?i=oc(t):lc(t)?i=Jl(t,e):cc(t)&&(i=nc(t)),ws.set(t,i),i},dc=function(t,e){return ws.has(t)?ws.get(t):hc(t,e)};function uc(t,e){var i=typeof t=="string"?document.querySelector(t):t;return dc(i,e)}var Ne=function(e,i,s,r){var a=s?s.call(r,e,i):void 0;if(a!==void 0)return!!a;if(e===i)return!0;if(typeof e!="object"||!e||typeof i!="object"||!i)return!1;var n=Object.keys(e),o=Object.keys(i);if(n.length!==o.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(i),l=0;l<n.length;l++){var d=n[l];if(!c(d))return!1;var u=e[d],p=i[d];if(a=s?s.call(r,u,p,d):void 0,a===!1||a===void 0&&u!==p)return!1}return!0},pc=(()=>`.tele-fancy-scrollbar {
16
+ overscroll-behavior: contain;
17
+ overflow: auto;
18
+ overflow-y: scroll;
19
+ overflow-y: overlay;
20
+ -webkit-overflow-scrolling: touch;
21
+ -ms-overflow-style: -ms-autohiding-scrollbar;
22
+ scrollbar-width: auto;
23
+ }
24
+ .tele-fancy-scrollbar::-webkit-scrollbar {
25
+ height: 8px;
26
+ width: 8px;
27
+ }
28
+ .tele-fancy-scrollbar::-webkit-scrollbar-track {
29
+ background-color: transparent;
30
+ }
31
+ .tele-fancy-scrollbar::-webkit-scrollbar-thumb {
32
+ background-color: rgba(68, 78, 96, 0.1);
33
+ background-color: transparent;
34
+ border-radius: 4px;
35
+ transition: background-color 0.4s;
36
+ }
37
+ .tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb {
38
+ background-color: rgba(68, 78, 96, 0.1);
39
+ }
40
+ .tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover {
41
+ background-color: rgba(68, 78, 96, 0.2);
42
+ }
43
+ .tele-fancy-scrollbar::-webkit-scrollbar-thumb:active {
44
+ background-color: rgba(68, 78, 96, 0.2);
45
+ }
46
+ .tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical {
47
+ min-height: 50px;
48
+ }
49
+ .tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal {
50
+ min-width: 50px;
51
+ }
52
+ .telebox-quarantine {
53
+ all: initial;
54
+ position: relative;
55
+ width: 100%;
56
+ height: 100%;
57
+ display: flex;
58
+ flex-direction: column;
59
+ }
60
+ .telebox-body-wrap {
61
+ color: #191919;
62
+ color: var(--tele-boxColor, #191919);
63
+ flex: 1;
64
+ width: 100%;
65
+ overflow: hidden;
66
+ display: flex;
67
+ justify-content: center;
68
+ align-items: center;
69
+ position: relative;
70
+ }
71
+ .telebox-content {
72
+ width: 100%;
73
+ height: 100%;
74
+ position: relative;
75
+ background-color: #f9f9f9;
76
+ background-color: var(--tele-boxContainerBackground, #f9f9f9);
77
+ }
78
+ .telebox-box-stage {
79
+ position: absolute;
80
+ z-index: 1;
81
+ overflow: hidden;
82
+ background-color: #fff;
83
+ background-color: var(--tele-boxStageBackground, #fff);
84
+ box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.08);
85
+ box-shadow: var(--tele-boxStageShadow, 0px 0px 16px rgba(0, 0, 0, 0.08));
86
+ }
87
+ .telebox-footer-wrap {
88
+ flex-shrink: 0;
89
+ display: flex;
90
+ flex-direction: column;
91
+ color: #191919;
92
+ color: var(--tele-boxFooterColor, #191919);
93
+ background-color: #fff;
94
+ background-color: var(--tele-boxFooterBackground, #fff);
95
+ }
96
+ .telebox-footer-wrap::before {
97
+ content: "";
98
+ display: block;
99
+ flex: 1;
100
+ }
101
+ .telebox-color-scheme-dark {
102
+ color-scheme: dark;
103
+ }
104
+ .telebox-color-scheme-dark .telebox-body-wrap {
105
+ color: #e9e9e9;
106
+ color: var(--tele-boxColor, #e9e9e9);
107
+ }
108
+ .telebox-color-scheme-dark .telebox-content {
109
+ background-color: #25282e;
110
+ background-color: var(--tele-boxContainerBackground, #25282e);
111
+ }
112
+ .telebox-color-scheme-dark .telebox-box-stage {
113
+ background-color: #272a30;
114
+ background-color: var(--tele-boxStageBackground, #272a30);
115
+ box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.24);
116
+ box-shadow: var(--tele-boxStageShadow, 0px 0px 16px rgba(0, 0, 0, 0.24));
117
+ }
118
+ .telebox-color-scheme-dark .telebox-footer-wrap {
119
+ color: #e9e9e9;
120
+ color: var(--tele-boxFooterColor, #e9e9e9);
121
+ background-color: #383b42;
122
+ background-color: var(--tele-boxFooterBackground, #383b42);
123
+ }`)(),Ua=(t=>(t.Light="light",t.Dark="dark",t.Auto="auto",t))(Ua||{}),se=(t=>(t.Normal="normal",t.Minimized="minimized",t.Maximized="maximized",t))(se||{}),ue=(t=>(t.DarkMode="dark_mode",t.PrefersColorScheme="prefers_color_scheme",t.Close="close",t.Focus="focus",t.Blur="blur",t.IntrinsicMove="intrinsic_move",t.IntrinsicResize="intrinsic_resize",t.ZIndex="z_index",t.State="state",t.Minimized="minimized",t.Maximized="maximized",t.Readonly="readonly",t.Destroyed="destroyed",t))(ue||{}),je=(t=>(t.Close="close",t.Maximize="maximize",t.Minimize="minimize",t))(je||{}),De=(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))(De||{});const rs="dh";function wt(t,e,i){return Math.min(Math.max(t,e),i)}function Rt(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}let gc=1;function mc(){return`New Box ${gc++}`}class Wa{constructor({readonly$:e,state$:i,title$:s,buttons:r,onEvent:a,onDragStart:n,namespace:o="telebox"}){this.sideEffect=new ve.SideEffectManager,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=c=>{var l;if(!c.isPrimary||this.readonly$.value||c.button!==0||(l=c.target.dataset)!=null&&l.teleTitleBarNoDblClick)return;Rt(c);const d=Date.now();d-this.lastTitleBarClick.timestamp<=500?Math.abs(c.clientX-this.lastTitleBarClick.clientX)<=5&&Math.abs(c.clientY-this.lastTitleBarClick.clientY)<=5&&this.onEvent&&this.onEvent({type:je.Maximize}):this.onDragStart&&this.onDragStart(c),this.lastTitleBarClick.timestamp=d,this.lastTitleBarClick.clientX=c.clientX,this.lastTitleBarClick.clientY=c.clientY},this.readonly$=e,this.state$=i,this.title$=s,this.onEvent=a,this.onDragStart=n,this.namespace=o,this.buttons=r||[{type:je.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:je.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:c=>c===se.Maximized},{type:je.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}],this.$dragArea=this.renderDragArea()}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=rs;const i=document.createElement("h1");i.className=this.wrapClassName("title"),i.dataset.teleBoxHandle=rs,e.appendChild(i),e.appendChild(this.$dragArea);const s=document.createElement("div");s.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:r},a)=>{const n=String(a),o=document.createElement("button");o.className=`${this.wrapClassName("titlebar-btn")} ${r}`,o.dataset.teleTitleBarBtnIndex=n,o.dataset.teleTitleBarNoDblClick="true",s.appendChild(o)}),this.sideEffect.addDisposer(this.title$.subscribe(r=>{i.textContent=r,i.title=r}),"render-title"),this.sideEffect.addDisposer(this.state$.subscribe(r=>{this.buttons.forEach((a,n)=>{var o;a.isActive&&((o=s.children[n])==null||o.classList.toggle("is-active",a.isActive(r)))})}),"render-state-btns"),this.sideEffect.addEventListener(s,"click",r=>{var a;if(this.readonly$.value)return;const n=r.target,o=Number((a=n.dataset)==null?void 0:a.teleTitleBarBtnIndex);if(!Number.isNaN(o)&&o<this.buttons.length){Rt(r);const c=this.buttons[o];this.onEvent&&this.onEvent({type:c.type,value:c.value})}},{},"render-btns-container-click"),this.$titleBar.appendChild(e),this.$titleBar.appendChild(s)}return this.$titleBar}renderDragArea(){const e=document.createElement("div");return e.className=this.wrapClassName("drag-area"),e.dataset.teleBoxHandle=rs,this.sideEffect.addEventListener(e,"pointerdown",this.handleTitleBarClick),e}dragHandle(){return this.$titleBar}wrapClassName(e){return`${this.namespace}-${e}`}destroy(){this.sideEffect.flushAll(),this.$titleBar&&(this.$titleBar=void 0,this.onDragStart=void 0,this.onEvent=void 0)}}function Ha([t,e]){if(e<=0||t.width<=0||t.height<=0)return t;const i=t.width*e;if(i===t.height)return t;if(i<t.height)return{x:0,y:(t.height-i)/2,width:t.width,height:i};const s=t.height/e;return{x:(t.width-s)/2,y:0,width:s,height:t.height}}const fc=window.ResizeObserver||ha.ResizeObserver;class bc{constructor({id:e=ve.genUID(),title:i=mc(),namespace:s="telebox",visible:r=!0,width:a=.5,height:n=.5,minWidth:o=0,minHeight:c=0,x:l=.1,y:d=.1,resizable:u=!0,draggable:p=!0,boxRatio:m=-1,focus:g=!1,zIndex:f=100,stageRatio:b=null,enableShadowDOM:v=!0,titleBar:x,content:y,stage:k,footer:z,styles:T,userStyles:O,bodyStyle:te=null,stageStyle:G=null,darkMode$:xe,fence$:Re,root:me,rootRect$:Ie,managerMinimized$:fe,managerMaximized$:_e,managerReadonly$:be,managerStageRect$:ye,managerStageRatio$:Me,defaultBoxBodyStyle$:Ae,defaultBoxStageStyle$:Se,collectorRect$:ot}){this.events=new rt.default,this._delegateEvents=new rt.default,this.handleTrackStart=D=>{var U;return(U=this._handleTrackStart)==null?void 0:U.call(this,D)},this._sideEffect=new ve.SideEffectManager,this.id=e,this.namespace=s,this.enableShadowDOM=v;const Oe=new w.ValManager;this._sideEffect.addDisposer(()=>Oe.destroy());const Qe=new w.Val(i),bt=new w.Val(r),A=new w.Val(u),R=new w.Val(p),ke=new w.Val(m),Ce=new w.Val(f),Tt=new w.Val(g),yt=new w.Val(null),pr=new w.Val(null),gr=new w.Val(null),Hi=w.combine([yt,_e],([D,U])=>D!=null?D:U),ai=w.combine([pr,fe],([D,U])=>D!=null?D:U),Fi=w.combine([gr,be],([D,U])=>D!=null?D:U),Zi=w.combine([ai,Hi],([D,U])=>D?se.Minimized:U?se.Maximized:se.Normal),Yi=new w.Val({width:wt(o,0,1),height:wt(c,0,1)},{compare:Ne}),po=w.combine([Yi,ye],([D,U])=>({width:D.width*U.width,height:D.height*U.height}),{compare:Ne}),ni=new w.Val({width:a,height:n},{compare:Ne});this._sideEffect.addDisposer(Yi.reaction((D,U)=>{ni.setValue({width:Math.max(a,D.width),height:Math.max(n,D.height)},U)}));const Qi=new w.Val({x:l,y:d},{compare:Ne}),Gi=w.combine([ni,ye],([D,U])=>({width:U.width*D.width,height:U.height*D.height}),{compare:Ne}),Nt=w.combine([Qi,ye],([D,U])=>({x:D.x*U.width,y:D.y*U.height}),{compare:Ne}),go=new w.Val(te),mo=new w.Val(G),fo=new w.Val(null),mr=new w.Val(ye.value,{compare:Ne}),fr=new w.Val(b),bo=w.combine([fr,Me],([D,U])=>D!=null?D:U),yo=w.combine([mr,bo],Ha,{compare:Ne}),wo={darkMode:xe,fence:Re,rootRect:Ie,managerMinimized:fe,managerMaximized:_e,managerReadonly:be,managerStageRect:ye,managerStageRatio:Me,defaultBoxBodyStyle:Ae,defaultBoxStageStyle:Se,collectorRect:ot};w.withReadonlyValueEnhancer(this,wo);const vo={zIndex:Ce,focus:Tt,state:Zi,minSize:Yi,pxMinSize:po,intrinsicSize:ni,intrinsicCoord:Qi,pxIntrinsicSize:Gi,pxIntrinsicCoord:Nt,bodyRect:mr,stageRect:yo,minimized:ai,maximized:Hi,readonly:Fi};w.withReadonlyValueEnhancer(this,vo,Oe);const xo={title:Qe,visible:bt,resizable:A,draggable:R,boxRatio:ke,boxMinimized:pr,boxMaximized:yt,boxReadonly:gr,stageRatio:fr,bodyStyle:go,stageStyle:mo};w.withValueEnhancer(this,xo,Oe),this.titleBar=x||new Wa({readonly$:Fi,state$:Zi,title$:Qe,namespace:this.namespace,onDragStart:D=>{var U;return(U=this._handleTrackStart)==null?void 0:U.call(this,D)},onEvent:D=>this._delegateEvents.emit(D.type)}),this._sideEffect.addDisposer(w.combine([ke,ai]).subscribe(([D,U])=>{!U&&D>0&&this.transform(Nt.value.x,Nt.value.y,Gi.value.width,Gi.value.height)})),this._sideEffect.addDisposer(Re.subscribe(D=>{D&&this.move(Nt.value.x,Nt.value.y)})),this.$box=this._render(),fo.setValue(this.$content.parentElement),y&&this.mountContent(y),k&&this.mountStage(k),z&&this.mountFooter(z),T&&this.mountStyles(T),O&&this.mountUserStyles(O),me.appendChild(this.$box);const Ge=(D,U)=>{this._sideEffect.addDisposer(D.reaction((Mo,So)=>{So||this.events.emit(U,Mo)}))};Ge(xe,ue.DarkMode),Ge(Fi,ue.Readonly),Ge(Ce,ue.ZIndex),Ge(ai,ue.Minimized),Ge(Hi,ue.Maximized),Ge(Zi,ue.State),Ge(ni,ue.IntrinsicResize),Ge(Qi,ue.IntrinsicMove),this._sideEffect.addDisposer([bt.reaction((D,U)=>{!U&&!D&&this.events.emit(ue.Close)}),Tt.reaction((D,U)=>{U||this.events.emit(D?ue.Focus:ue.Blur)})])}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(e,i=!1){this._minSize$.setValue({width:e,height:this.minHeight},i)}setMinHeight(e,i=!1){this._minSize$.setValue({width:this.minWidth,height:e},i)}resize(e,i,s=!1){this._intrinsicSize$.setValue({width:Math.max(e,this.minWidth),height:Math.max(i,this.minHeight)},s)}get intrinsicX(){return this._intrinsicCoord$.value.x}get intrinsicY(){return this._intrinsicCoord$.value.y}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}move(e,i,s=!1){let r,a;const n=this.managerStageRect,o=this.pxIntrinsicSize;this.fence?(r=wt(e,0,n.width-o.width),a=wt(i,0,n.height-o.height)):(r=wt(e,-(o.width-120),0+n.width-20),a=wt(i,0,0+n.height-20)),this._intrinsicCoord$.setValue({x:r/n.width,y:a/n.height},s)}transform(e,i,s,r,a=!1){const n=this.managerStageRect;if(s=Math.max(s,this.pxMinSize.width),r=Math.max(r,this.pxMinSize.height),this.boxRatio>0){const o=this.boxRatio*s;i!==this.pxIntrinsicCoord.y&&(i-=o-r),r=o}i<0&&(i=0,r=this.pxIntrinsicSize.height),this.move(e,i,a),this._intrinsicSize$.setValue({width:s/n.width,height:r/n.height},a)}mountContent(e){var i;(i=this.$authorContent)==null||i.remove(),this.$authorContent=e,this.$content.appendChild(e)}unmountContent(){this.$authorContent&&(this.$authorContent.remove(),this.$authorContent=void 0)}mountStage(e){var i;(i=this.$authorStage)==null||i.remove(),this.$authorStage=e,this.$stage||(this.$stage=this._renderStage()),this.$stage.appendChild(e),this.$stage.parentElement||this.$body.appendChild(this.$stage)}unmountStage(){var e;this.$authorStage&&(this.$authorStage.remove(),this.$authorStage=void 0),(e=this.$stage)==null||e.remove()}mountFooter(e){var i;(i=this.$authorFooter)==null||i.remove(),this.$authorFooter=e,this.$footer.appendChild(e)}unmountFooter(){this.$authorFooter&&(this.$authorFooter.remove(),this.$authorFooter=void 0)}mountStyles(e){this.$styles.textContent=e}unmountStyles(){this.$styles.textContent=""}mountUserStyles(e){this.$userStyles.textContent=e}unmountUserStyles(){this.$userStyles.textContent=""}_render(){if(this.$box)return this.$box;const e=(b,v)=>this._sideEffect.addDisposer([this._readonly$.subscribe(x=>b.classList.toggle(this.wrapClassName("readonly"),x)),this._draggable$.subscribe(x=>b.classList.toggle(this.wrapClassName("no-drag"),!x)),this._resizable$.subscribe(x=>b.classList.toggle(this.wrapClassName("no-resize"),!x)),this._focus$.subscribe(x=>b.classList.toggle(this.wrapClassName("blur"),!x)),this._darkMode$.subscribe(x=>{b.classList.toggle(this.wrapClassName("color-scheme-dark"),x),b.classList.toggle(this.wrapClassName("color-scheme-light"),!x)})],v);this.$box=document.createElement("div"),this.$box.classList.add(this.wrapClassName("box")),e(this.$box,"bind-box-state"),this._sideEffect.add(()=>{const b=this.wrapClassName("minimized"),v=this.wrapClassName("maximized"),x="box-maximized-timer";return this._state$.subscribe(y=>{this.$box.classList.toggle(b,y===se.Minimized),y===se.Maximized?(this._sideEffect.flush(x),this.$box.classList.toggle(v,!0)):this._sideEffect.setTimeout(()=>{this.$box.classList.toggle(v,!1)},0,x)})}),this._sideEffect.addDisposer(this._visible$.subscribe(b=>{this.$box.style.display=b?"block":"none"})),this._sideEffect.addDisposer(this._zIndex$.subscribe(b=>{this.$box.style.zIndex=String(b)})),this.$box.dataset.teleBoxID=this.id;const i=uc(this.$box),s=w.combine([this._maximized$,this._minimized$,this._pxIntrinsicSize$,this._pxIntrinsicCoord$,this._collectorRect$,this._rootRect$,this._managerStageRect$],([b,v,x,y,k,z,T])=>{const O=b?{x:-T.x,y:-T.y,width:z.width,height:z.height,scaleX:1,scaleY:1}:{x:y.x,y:y.y,width:x.width,height:x.height,scaleX:1,scaleY:1};if(v&&k){const{width:te,height:G}=b?this.rootRect:x;O.x=k.x-te/2+k.width/2-T.x,O.y=k.y-G/2+k.height/2-T.y,O.scaleX=k.width/te,O.scaleY=k.height/G}return O},{compare:Ne}),r=s.value;this.$box.style.width=r.width+"px",this.$box.style.height=r.height+"px",this.$box.style.transform=`translate(${r.x-10}px,${r.y-10}px)`,this._sideEffect.addDisposer(s.subscribe(b=>{i.set(b)}));const a=document.createElement("div");a.className=this.wrapClassName("box-main"),this.$box.appendChild(a);const n=document.createElement("div");n.className=this.wrapClassName("titlebar-wrap"),n.appendChild(this.titleBar.render()),this.$titleBar=n;const o=document.createElement("div");o.className=this.wrapClassName("body-wrap"),this.$body=o;const c=document.createElement("style");this.$styles=c,o.appendChild(c);const l=document.createElement("style");this.$userStyles=l,o.appendChild(l);const d=document.createElement("div");d.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=d,this._sideEffect.addDisposer(w.combine([this._bodyStyle$,this._defaultBoxBodyStyle$],([b,v])=>b!=null?b:v).subscribe(b=>d.style.cssText=b||"")),o.appendChild(d);const u=document.createElement("div");u.className=this.wrapClassName("footer-wrap"),this.$footer=u,a.appendChild(n);const p=document.createElement("div");p.className=this.wrapClassName("main"),this.$main=p,a.appendChild(p);const m=document.createElement("div");m.className=this.wrapClassName("quarantine-outer"),p.appendChild(m);const g=document.createElement("div");if(g.className=this.wrapClassName("quarantine"),g.appendChild(o),g.appendChild(u),this.enableShadowDOM){e(g,"bind-quarantine-state");const b=document.createElement("style");b.textContent=pc,g.insertBefore(b,g.firstChild),m.attachShadow({mode:"open"}).appendChild(g)}else m.appendChild(g);this._renderResizeHandlers();const f=()=>{const b=o.getBoundingClientRect();this._bodyRect$.setValue({x:0,y:0,width:b.width,height:b.height})};return this._sideEffect.add(()=>{const b=new fc(()=>{this.minimized||f()});return b.observe(o),()=>b.disconnect()}),this._sideEffect.addDisposer(this._minimized$.reaction(b=>{b||this._sideEffect.setTimeout(f,400,"minimized-content-rect-fix")})),this.$box}_renderStage(){const e=document.createElement("div");e.className=this.wrapClassName("box-stage");const i=s=>{e.style.top=s.y+"px",e.style.left=s.x+"px",e.style.width=s.width+"px",e.style.height=s.height+"px"};return this._sideEffect.addDisposer([w.combine([this._stageStyle$,this._defaultBoxStageStyle$],([s,r])=>s!=null?s:r).subscribe(s=>{e.style.cssText=s||"",i(this._stageRect$.value)}),this._stageRect$.subscribe(i)],"box-stage-styles"),e}_renderResizeHandlers(){const e=document.createElement("div");e.className=this.wrapClassName("resize-handles"),Object.values(De).forEach(f=>{const b=document.createElement("div");b.className=this.wrapClassName(f)+" "+this.wrapClassName("resize-handle"),b.dataset.teleBoxHandle=f,e.appendChild(b)}),this.$box.appendChild(e);const i="handle-tracking-listener",s=this.wrapClassName("transforming");let r,a=0,n=0,o=0,c=0,l=0,d=0,u;const p=f=>{if(!f.isPrimary||this.state!==se.Normal)return;Rt(f);let{pageX:b,pageY:v}=f;v<0&&(v=0);const x=b-l,y=v-d;let{x:k,y:z}=this.pxIntrinsicCoord,{width:T,height:O}=this.pxIntrinsicSize;switch(u){case De.North:{z=n+y,O=c-y;break}case De.South:{O=c+y;break}case De.West:{k=a+x,T=o-x;break}case De.East:{T=o+x;break}case De.NorthWest:{k=a+x,z=n+y,T=o-x,O=c-y;break}case De.NorthEast:{z=n+y,T=o+x,O=c-y;break}case De.SouthEast:{T=o+x,O=c+y;break}case De.SouthWest:{k=a+x,T=o-x,O=c+y;break}default:{this.move(a+x,n+y);return}}this.transform(k,z,T,O)},m=f=>{!f.isPrimary||(u=void 0,r&&(Rt(f),this.$box.classList.toggle(s,!1),this._sideEffect.flush(i),r.remove()))},g=f=>{var b;if(!f.isPrimary||this.readonly||f.button!=null&&f.button!==0||!this.draggable||u||this.state!==se.Normal)return;const v=f.target;if((b=v.dataset)!=null&&b.teleBoxHandle){Rt(f),{x:a,y:n}=this.pxIntrinsicCoord,{width:o,height:c}=this.pxIntrinsicSize,{pageX:l,pageY:d}=f,u=v.dataset.teleBoxHandle,r||(r=document.createElement("div"));const x=u?this.wrapClassName(`cursor-${u}`):"";r.className=this.wrapClassName(`track-mask${x?` ${x}`:""}`),this.$box.appendChild(r),this.$box.classList.add(s),this._sideEffect.add(()=>(window.addEventListener("pointermove",p,{passive:!1}),window.addEventListener("pointerup",m,{passive:!1}),window.addEventListener("pointercancel",m,{passive:!1}),()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}),i)}};this._handleTrackStart=g,this._sideEffect.addEventListener(e,"pointerdown",g,{},"box-resizeHandles-pointerdown")}async destroy(){this.$box.remove(),this._sideEffect.flushAll(),this._sideEffect.flushAll(),await this.events.emit(ue.Destroyed),this.events.clearListeners(),this._delegateEvents.clearListeners()}wrapClassName(e){return`${this.namespace}-${e}`}}var yc="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class wc{constructor({minimized$:e,readonly$:i,darkMode$:s,namespace:r="telebox",styles:a={},root:n,onClick:o}){this._sideEffect=new ve.SideEffectManager,this.namespace=r;const c=new w.ValManager;this._sideEffect.addDisposer(()=>c.destroy());const l=new w.Val(void 0),d=w.derive(e),u=new w.Val(a),p=new w.Val(document.createElement("button")),m={styles:u,$collector:p};w.withValueEnhancer(this,m,c);const g={rect:l,visible:d};w.withReadonlyValueEnhancer(this,g,c),p.value.className=this.wrapClassName("collector"),p.value.style.backgroundImage=`url('${yc}')`,this._sideEffect.addDisposer(p.subscribe(f=>{this._sideEffect.add(()=>(n.appendChild(f),()=>f.remove()),"telebox-collector-mount"),this._sideEffect.addEventListener(f,"click",()=>{i.value||o==null||o()},{},"telebox-collector-click"),this._sideEffect.addDisposer([d.subscribe(b=>{f.classList.toggle(this.wrapClassName("collector-visible"),b)}),i.subscribe(b=>{f.classList.toggle(this.wrapClassName("collector-readonly"),b)}),s.subscribe(b=>{f.classList.toggle(this.wrapClassName("color-scheme-dark"),b),f.classList.toggle(this.wrapClassName("color-scheme-light"),!b)}),u.subscribe(b=>{Object.keys(b).forEach(v=>{const x=b[v];x!=null&&(f.style[v]=x)})}),e.subscribe(b=>{if(b){const{x:v,y:x,width:y,height:k}=f.getBoundingClientRect(),z=n.getBoundingClientRect();l.setValue({x:v-z.x,y:x-z.y,width:y,height:k})}})],"telebox-collector-el")}))}destroy(){this._sideEffect.flushAll()}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.IntrinsicMove="intrinsic_move",t.IntrinsicResize="intrinsic_resize",t.ZIndex="z_index",t.PrefersColorScheme="prefers_color_scheme",t.DarkMode="dark_mode",t))(le||{});class vc extends Wa{constructor(e){super(e);this.boxes$=e.boxes$,this.rootRect$=e.rootRect$,this.darkMode$=e.darkMode$,e.root.appendChild(this.render())}focusBox(e){var i;if(!(this.focusedBox&&this.focusedBox===e)){if(this.$titles&&this.state$.value===se.Maximized){const{children:s}=this.$titles.firstElementChild;for(let r=s.length-1;r>=0;r-=1){const a=s[r],n=(i=a.dataset)==null?void 0:i.teleBoxID;n&&(e&&n===e.id?a.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&n===this.focusedBox.id&&a.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}}this.focusedBox=e}}render(){if(this.$titleBar)return this.$titleBar;const e=super.render();e.classList.add(this.wrapClassName("max-titlebar")),this.sideEffect.addDisposer([w.combine([this.boxes$,this.state$]).subscribe(([s,r])=>{e.classList.toggle(this.wrapClassName("max-titlebar-active"),r===se.Maximized&&s.length>0)}),this.readonly$.subscribe(s=>{e.classList.toggle(this.wrapClassName("readonly"),s)}),w.combine([this.state$,this.boxes$]).subscribe(([s,r])=>{s===se.Maximized&&(e.classList.toggle(this.wrapClassName("max-titlebar-single-title"),r.length===1),r.length!==1&&e.replaceChild(this.renderTitles(),e.firstElementChild))})],"max-render");const i=document.createElement("div");return i.classList.add(this.wrapClassName("titles-area")),e.insertBefore(i,e.firstElementChild),e}destroy(){super.destroy(),this.$titles=void 0,this.focusedBox=void 0}renderTitles(){this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.sideEffect.addEventListener(this.$titles,"wheel",s=>{s.currentTarget.scrollBy({left:s.deltaY>0?250:-250,behavior:"smooth"})},{passive:!1},"max-render-wheel-titles");const e=document.createElement("div");e.className=this.wrapClassName("titles-content"),this.$titles.appendChild(e);const i=this.boxes$.value.map(s=>{const r=document.createElement("button");return r.className=this.wrapClassName("titles-tab"),r.textContent=s.title,r.dataset.teleBoxID=s.id,r.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&s.id===this.focusedBox.id&&r.classList.add(this.wrapClassName("titles-tab-focus")),e.appendChild(r),s._title$.reaction(a=>r.textContent=a)});return this.sideEffect.addDisposer(()=>i.forEach(s=>s()),"max-render-tab-titles"),this.$titles}}const xc=window.ResizeObserver||ha.ResizeObserver;class Mc{constructor({root:e=null,fullscreen:i=!1,prefersColorScheme:s=Ua.Light,minimized:r=!1,maximized:a=!1,fence:n=!0,collector:o,namespace:c="telebox",readonly:l=!1,stageRatio:d=-1,containerStyle:u="",stageStyle:p="",defaultBoxBodyStyle:m=null,defaultBoxStageStyle:g=null,theme:f={}}={}){this.events=new rt.default,this._sideEffect=new ve.SideEffectManager,this.namespace=c;const b=new w.ValManager;this._sideEffect.addDisposer(()=>b.destroy());const v=new w.Val(e),x=new w.Val(l),y=new w.Val(n),k=new w.Val(u),z=new w.Val(p),T=new w.Val(d),O=new w.Val(m),te=new w.Val(g),G=new w.Val(i),xe=new w.Val(r),Re=new w.Val(a),me=w.combine([Re,G],([A,R])=>R?!0:A),Ie=w.combine([xe,G],([A,R])=>R?!1:A);this.setMaximized=(A,R)=>Re.setValue(A,R),this.setMinimized=(A,R)=>xe.setValue(A,R);const fe=new w.Val({x:0,y:0,width:window.innerWidth,height:window.innerHeight},{compare:Ne});this._sideEffect.addDisposer(v.subscribe(A=>{this._sideEffect.add(()=>{if(!A)return()=>{};const R=new xc(()=>{const ke=A.getBoundingClientRect();fe.setValue({x:0,y:0,width:ke.width,height:ke.height})});return R.observe(A),()=>R.disconnect()},"calc-root-rect")}));const _e=w.combine([fe,T],Ha,{compare:Ne});this.boxes$=new w.Val([]),this.topBox$=new w.Val(void 0),this._sideEffect.addDisposer(this.boxes$.subscribe(A=>{if(A.length>0){const R=A.reduce((ke,Ce)=>ke.zIndex>Ce.zIndex?ke:Ce);this.topBox$.setValue(R)}else this.topBox$.setValue(void 0)}));const be=window.matchMedia("(prefers-color-scheme: dark)"),ye=new w.Val(!1);be&&(ye.setValue(be.matches),this._sideEffect.add(()=>{const A=R=>{ye.setValue(R.matches)};return be.addEventListener("change",A),()=>be.removeEventListener("change",A)}));const Me=new w.Val(s);this._sideEffect.addDisposer(Me.reaction((A,R)=>{R||this.events.emit(le.PrefersColorScheme,A)}));const Ae=w.combine([ye,Me],([A,R])=>R==="auto"?A:R==="dark"),Se=w.combine([Ie,me],([A,R])=>A?se.Minimized:R?se.Maximized:se.Normal),ot={darkMode:Ae,state:Se,root:v,rootRect:fe,stageRect:_e,minimized:Ie,maximized:me};w.withReadonlyValueEnhancer(this,ot,b);const Oe={fullscreen:G,prefersColorScheme:Me,readonly:x,fence:y,stageRatio:T,containerStyle:k,stageStyle:z,defaultBoxBodyStyle:O,defaultBoxStageStyle:te};w.withValueEnhancer(this,Oe,b);const Qe=this.wrapClassName("titlebar-icon-close"),bt=A=>{var R;if(!A.isPrimary||x.value)return;const ke=A.target;if(!!ke.tagName)for(let Ce=ke;Ce;Ce=Ce.parentElement){if(Ce.classList&&Ce.classList.contains(Qe))return;const Tt=(R=Ce.dataset)==null?void 0:R.teleBoxID;if(Tt){const yt=this.getBox(Tt);if(yt){this.focusBox(yt),this.makeBoxTop(yt);return}}}};this._sideEffect.addEventListener(window,"pointerdown",bt,!0),this.$container=document.createElement("div"),this.$container.className=this.wrapClassName("manager-container"),this.setTheme(f),this.$stage=document.createElement("div"),this.$stage.className=this.wrapClassName("manager-stage"),this.$container.appendChild(this.$stage),this._sideEffect.addDisposer([Ae.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("color-scheme-dark"),A),this.$container.classList.toggle(this.wrapClassName("color-scheme-light"),!A)}),G.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-fullscreen"),Boolean(A))}),w.combine([this.boxes$,G],([A,R])=>R==="no-titlebar"||R===!0&&A.length<=1).subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("hide-fullscreen-titlebar"),A)}),me.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-maximized"),A)}),Ie.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-minimized"),A)}),k.subscribe(A=>{this.$container.style.cssText=A}),z.subscribe(A=>{this.$stage.style.cssText=A,this.$stage.style.width=_e.value.width+"px",this.$stage.style.height=_e.value.height+"px"}),_e.subscribe(A=>{this.$stage.style.width=A.width+"px",this.$stage.style.height=A.height+"px"}),v.subscribe(A=>{A?A.appendChild(this.$container):this.$container.parentElement&&this.$container.remove()})]),this.collector=o!=null?o:new wc({minimized$:Ie,readonly$:x,darkMode$:Ae,namespace:c,root:this.$container,onClick:()=>xe.setValue(!1)}),this.titleBar=new vc({namespace:this.namespace,title$:w.derive(this.topBox$,A=>(A==null?void 0:A.title)||""),boxes$:this.boxes$,darkMode$:Ae,readonly$:x,state$:Se,rootRect$:fe,root:this.$container,onEvent:A=>{switch(A.type){case je.Maximize:{this.setMaximized(!me.value);break}case je.Minimize:{this.setMinimized(!0);break}case ue.Close:{this.removeTopBox(),this.focusTopBox();break}}}}),this._sideEffect.addDisposer([Se.reaction((A,R)=>{R||this.events.emit(le.State,A)}),me.reaction((A,R)=>{R||this.events.emit(le.Maximized,A)}),Ie.reaction((A,R)=>{R||this.events.emit(le.Minimized,A)}),Ae.reaction((A,R)=>{R||this.events.emit(le.DarkMode,A)})])}get boxes(){return this.boxes$.value}get topBox(){return this.topBox$.value}setState(e,i=!1){switch(e){case se.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case se.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}create(e={},i=!0){const s=new bc(oe(j(j({zIndex:this.topBox?this.topBox.zIndex+1:100},e),i?this.smartPosition(e):{}),{namespace:this.namespace,root:this.$stage,darkMode$:this._darkMode$,fence$:this._fence$,rootRect$:this._rootRect$,managerStageRect$:this._stageRect$,managerStageRatio$:this._stageRatio$,managerMaximized$:this._maximized$,managerMinimized$:this._minimized$,managerReadonly$:this._readonly$,collectorRect$:this.collector._rect$,defaultBoxBodyStyle$:this._defaultBoxBodyStyle$,defaultBoxStageStyle$:this._defaultBoxStageStyle$}));return s.focus&&(this.focusBox(s),i&&this.makeBoxTop(s)),this.boxes$.setValue([...this.boxes,s]),this._sideEffect.addDisposer([s._delegateEvents.on(je.Maximize,()=>{this.setMaximized(!this.maximized)}),s._delegateEvents.on(je.Minimize,()=>{this.setMinimized(!0)}),s._delegateEvents.on(je.Close,()=>{this.remove(s),this.focusTopBox()}),s._intrinsicCoord$.reaction((r,a)=>{a||this.events.emit(le.IntrinsicMove,s)}),s._intrinsicSize$.reaction((r,a)=>{a||this.events.emit(le.IntrinsicResize,s)}),s._zIndex$.reaction((r,a)=>{if(this.boxes.length>0){const n=this.boxes.reduce((o,c)=>o.zIndex>c.zIndex?o:c);this.topBox$.setValue(n)}a||this.events.emit(le.ZIndex,s)})]),this.events.emit(le.Created,s),s}query(e){return e?this.boxes.filter(this.teleBoxMatcher(e)):[...this.boxes]}queryOne(e){return e?this.boxes.find(this.teleBoxMatcher(e)):this.boxes[0]}update(e,i,s=!1){const r=this.boxes.find(a=>a.id===e);if(r)return this.updateBox(r,i,s)}updateAll(e,i=!1){this.boxes.forEach(s=>{this.updateBox(s,e,i)})}remove(e,i=!1){const s=this.getBoxIndex(e);if(s>=0){const r=this.boxes.slice(),a=r.splice(s,1);return this.boxes$.setValue(r),a.forEach(n=>n.destroy()),i||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(le.Removed,a)),a[0]}}removeTopBox(){if(this.topBox)return this.remove(this.topBox)}removeAll(e=!1){const i=this.boxes$.value;return this.boxes$.setValue([]),i.forEach(s=>s.destroy()),e||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(le.Removed,i)),i}setTheme(e){Object.keys(e).forEach(i=>{var s;this.$container.style.setProperty(`--tele-${i}`,(s=e[i])!=null?s:null)})}mount(e){this._root$.setValue(e)}unmount(){this._root$.setValue(null)}destroy(e=!1){this.events.clearListeners(),this._sideEffect.flushAll(),this.removeAll(e),this.collector.destroy(),this.titleBar.destroy()}wrapClassName(e){return`${this.namespace}-${e}`}focusBox(e,i=!1){const s=this.getBox(e);s&&(this.boxes.forEach(r=>{if(s===r){let a=!1;s.focus||(a=!0,s._focus$.setValue(!0,i)),a&&!i&&this.events.emit(le.Focused,s)}else r.focus&&this.blurBox(r,i)}),this.titleBar.focusBox(s))}focusTopBox(){if(this.topBox&&!this.topBox.focus)return this.focusBox(this.topBox)}blurBox(e,i=!1){const s=this.getBox(e);s&&(s.focus&&(s._focus$.setValue(!1,i),i||this.events.emit(le.Blurred,s)),this.titleBar.focusedBox===s&&this.titleBar.focusBox())}blurAll(e=!1){this.boxes.forEach(i=>{i.focus&&(i._focus$.setValue(!1,e),e||this.events.emit(le.Blurred,i))}),this.titleBar.focusedBox&&this.titleBar.focusBox()}teleBoxMatcher(e){const i=Object.keys(e);return s=>i.every(r=>e[r]===s[r])}updateBox(e,i,s=!1){var r,a,n,o,c,l;(i.x!=null||i.y!=null)&&e._intrinsicCoord$.setValue({x:(r=i.x)!=null?r:e.intrinsicX,y:(a=i.y)!=null?a:e.intrinsicY},s),(i.width!=null||i.height!=null)&&e._intrinsicSize$.setValue({width:(n=i.width)!=null?n:e.intrinsicWidth,height:(o=i.height)!=null?o:e.intrinsicHeight},s),i.title!=null&&e._title$.setValue(i.title),i.visible!=null&&e._visible$.setValue(i.visible,s),i.resizable!=null&&e._resizable$.setValue(i.resizable,s),i.draggable!=null&&e._draggable$.setValue(i.draggable,s),i.boxRatio!=null&&e._boxRatio$.setValue(i.boxRatio,s),i.zIndex!=null&&e._zIndex$.setValue(i.zIndex,s),i.stageRatio!==void 0&&e.setStageRatio(i.stageRatio,s),i.content!=null&&e.mountContent(i.content),i.footer!=null&&e.mountFooter(i.footer),(i.minHeight!=null||i.minWidth!=null)&&e._minSize$.setValue({width:(c=i.minWidth)!=null?c:e.minWidth,height:(l=i.minHeight)!=null?l:e.minHeight},s)}smartPosition(e){let{x:i,y:s}=e;const{width:r=.5,height:a=.5}=e,n=this.stageRect,o=this.topBox;if(i==null){let c=20;if(o){const l=o.pxIntrinsicCoord.x+20,d=r*n.width;l+d<=n.width&&(c=l)}i=c/n.width}if(s==null){let c=20;if(o){const l=o.pxIntrinsicCoord.y+20,d=a*n.height;l+d<=n.height&&(c=l)}s=c/n.height}return{x:i,y:s,width:r,height:a}}makeBoxTop(e,i=!1){this.topBox&&e!==this.topBox&&e._zIndex$.setValue(this.topBox.zIndex+1,i)}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}}const Sc=(t,e,i,s,r)=>new Cc({safeSetAttributes:a=>t.safeSetAttributes(a),updateAppState:(...a)=>{var n;return(n=t.appManager)==null?void 0:n.store.updateAppState(...a)},canOperate:()=>t.canOperate,notifyContainerRectUpdate:a=>{var n;return(n=t.appManager)==null?void 0:n.notifyContainerRectUpdate(a)},cleanFocus:()=>{var a;return(a=t.appManager)==null?void 0:a.store.cleanFocus()},setAppFocus:a=>{var n;return(n=t.appManager)==null?void 0:n.store.setAppFocus(a,!0)},callbacks:e,emitter:i,boxEmitter:s},r);class Cc{constructor(e,i){this.context=e,this.sideEffectManager=new ve.SideEffectManager;const{emitter:s,callbacks:r,boxEmitter:a}=e;this.teleBoxManager=this.setupBoxManager(i),this.sideEffectManager.add(()=>[this.teleBoxManager.onValChanged("state",n=>{r.emit("boxStateChange",n),s.emit("boxStateChange",n)}),this.teleBoxManager.onValChanged("darkMode",n=>{r.emit("darkModeChange",n)}),this.teleBoxManager.onValChanged("prefersColorScheme",n=>{r.emit("prefersColorSchemeChange",n)}),this.teleBoxManager.onValChanged("minimized",(n,o)=>{if(!o)if(this.context.safeSetAttributes({minimized:n}),n)this.context.cleanFocus(),this.blurAllBox();else{const c=this.getTopBox();c&&(this.context.setAppFocus(c.id),this.focusBox({appId:c.id},!1))}}),this.teleBoxManager.onValChanged("maximized",(n,o)=>{o||this.context.safeSetAttributes({maximized:n})}),this.teleBoxManager.events.on("removed",n=>{n.forEach(o=>{a.emit("close",{appId:o.id})})}),this.teleBoxManager.events.on("intrinsic_move",C.debounce(n=>{a.emit("move",{appId:n.id,x:n.intrinsicX,y:n.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",C.debounce(n=>{a.emit("resize",{appId:n.id,width:n.intrinsicWidth,height:n.intrinsicHeight})},200)),this.teleBoxManager.events.on("focused",n=>{n&&(this.canOperate?a.emit("focus",{appId:n.id}):this.teleBoxManager.blurBox(n.id))}),this.teleBoxManager.events.on("z_index",n=>{this.context.updateAppState(n.id,Ee.ZIndex,n.zIndex)}),s.on("containerSizeRatioUpdate",n=>{this.teleBoxManager._stageRatio$.setValue(n)}),this.teleBoxManager._fullscreen$.reaction(n=>{r.emit("fullscreenChange",n)})])}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}get stageRect(){return this.teleBoxManager.stageRect}get stageRect$(){return this.teleBoxManager._stageRect$}createBox(e){var u,p,m;if(!this.teleBoxManager)return;let{minwidth:i=Eo,minheight:s=Po,enableShadowDOM:r=!0}=(u=e.app.config)!=null?u:{};const{width:a,height:n}=(p=e.app.config)!=null?p:{},o=((m=e.options)==null?void 0:m.title)||e.appId,c=this.teleBoxManager.rootRect;i>1&&(i=i/c.width),s>1&&(s=s/c.height);const l={title:o,minWidth:i,minHeight:s,width:a,height:n,id:e.appId,enableShadowDOM:r},d=this.teleBoxManager.create(l,e.smartPosition);return this.context.emitter.emit(`${e.appId}${Y.WindowCreated}`),d}setupBoxManager(e){const i=ce.playground,s={stageRatio:e==null?void 0:e.stageRatio,root:i,fence:!1,prefersColorScheme:e==null?void 0:e.prefersColorScheme};e!=null&&e.containerStyle&&(s.containerStyle=e.containerStyle),e!=null&&e.stageStyle&&(s.stageStyle=e.stageStyle),e!=null&&e.fullscreen&&(s.fullscreen=e.fullscreen),(e==null?void 0:e.defaultBoxBodyStyle)!==void 0&&(s.defaultBoxBodyStyle=e.defaultBoxBodyStyle),(e==null?void 0:e.defaultBoxStageStyle)!==void 0&&(s.defaultBoxStageStyle=e.defaultBoxStageStyle),e!=null&&e.theme&&(s.theme=e.theme);const r=new Mc(s);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=r;const a=e==null?void 0:e.collectorContainer;return a&&this.teleBoxManager.collector.set$collector(a),e!=null&&e.collectorStyles&&this.teleBoxManager.collector.setStyles(e.collectorStyles),r}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&&(e.size&&i._intrinsicSize$.setValue(e.size,!0),e.position&&i._intrinsicCoord$.setValue(e.position,!0),e.zIndex&&i._zIndex$.setValue(e.zIndex,!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))}moveBox({appId:e,x:i,y:s}){const r=this.getBox(e);r&&r._intrinsicCoord$.setValue({x:i,y:s},!0)}focusBox({appId:e},i=!0){this.teleBoxManager.focusBox(e,i)}resizeBox({appId:e,width:i,height:s,skipUpdate:r}){const a=this.getBox(e);a&&a._intrinsicSize$.setValue({width:i,height:s},r)}setBoxMinSize(e){this.teleBoxManager.update(e.appId,{minWidth:e.minWidth,minHeight:e.minHeight},!0)}setBoxTitle(e){this.teleBoxManager.update(e.appId,{title:e.title},!0)}blurAllBox(){this.teleBoxManager.blurAll()}updateAll(e){this.teleBoxManager.updateAll(e)}setMaximized(e,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,s=!0){this.teleBoxManager.update(e,i,s)}setReadonly(e){this.teleBoxManager.setReadonly(e)}setPrefersColorScheme(e){this.teleBoxManager.setPrefersColorScheme(e)}setZIndex(e,i,s=!0){this.teleBoxManager.update(e,{zIndex:i},s)}setRoot(e){this.teleBoxManager._root$.setValue(e)}setCollector(e){this.teleBoxManager.collector.set$collector(e)}destroy(){this.sideEffectManager.flushAll(),this.teleBoxManager.destroy()}}function Si(){}function Fa(t){return t()}function $r(){return Object.create(null)}function Di(t){t.forEach(Fa)}function Ic(t){return typeof t=="function"}function _c(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ci;function Ci(t,e){return ci||(ci=document.createElement("a")),ci.href=e,t===ci.href}function Ac(t){return Object.keys(t).length===0}function We(t,e){t.appendChild(e)}function Li(t,e,i){t.insertBefore(e,i||null)}function Kt(t){t.parentNode.removeChild(t)}function et(t){return document.createElement(t)}function Qs(t){return document.createTextNode(t)}function vs(){return Qs(" ")}function ie(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function kc(t){return Array.from(t.childNodes)}function Za(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function ne(t,e,i,s){i===null?t.style.removeProperty(e):t.style.setProperty(e,i,s?"important":"")}let Gs;function Ot(t){Gs=t}const Dt=[],jr=[],fi=[],Br=[],Tc=Promise.resolve();let xs=!1;function Nc(){xs||(xs=!0,Tc.then(Ya))}function Ms(t){fi.push(t)}const as=new Set;let hi=0;function Ya(){const t=Gs;do{for(;hi<Dt.length;){const e=Dt[hi];hi++,Ot(e),Ec(e.$$)}for(Ot(null),Dt.length=0,hi=0;jr.length;)jr.pop()();for(let e=0;e<fi.length;e+=1){const i=fi[e];as.has(i)||(as.add(i),i())}fi.length=0}while(Dt.length);for(;Br.length;)Br.pop()();xs=!1,as.clear(),Ot(t)}function Ec(t){if(t.fragment!==null){t.update(),Di(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Ms)}}const Pc=new Set;function zc(t,e){t&&t.i&&(Pc.delete(t),t.i(e))}function Dc(t,e,i,s){const{fragment:r,on_mount:a,on_destroy:n,after_update:o}=t.$$;r&&r.m(e,i),s||Ms(()=>{const c=a.map(Fa).filter(Ic);n?n.push(...c):Di(c),t.$$.on_mount=[]}),o.forEach(Ms)}function Lc(t,e){const i=t.$$;i.fragment!==null&&(Di(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function Vc(t,e){t.$$.dirty[0]===-1&&(Dt.push(t),Nc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function $c(t,e,i,s,r,a,n,o=[-1]){const c=Gs;Ot(t);const l=t.$$={fragment:null,ctx:null,props:a,update:Si,not_equal:r,bound:$r(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:$r(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};n&&n(l.root);let d=!1;if(l.ctx=i?i(t,e.props||{},(u,p,...m)=>{const g=m.length?m[0]:p;return l.ctx&&r(l.ctx[u],l.ctx[u]=g)&&(!l.skip_bound&&l.bound[u]&&l.bound[u](g),d&&Vc(t,u)),p}):[],l.update(),d=!0,Di(l.before_update),l.fragment=s?s(l.ctx):!1,e.target){if(e.hydrate){const u=kc(e.target);l.fragment&&l.fragment.l(u),u.forEach(Kt)}else l.fragment&&l.fragment.c();e.intro&&zc(t.$$.fragment),Dc(t,e.target,e.anchor,e.customElement),Ya()}Ot(c)}class jc{$destroy(){Lc(this,1),this.$destroy=Si}$on(e,i){const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(i),()=>{const r=s.indexOf(i);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Ac(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function Rr(t){let e,i,s,r,a,n,o=t[14]&&Or(t),c=t[15]&&Ur(t);return{c(){e=et("div"),i=et("div"),o&&o.c(),s=vs(),r=et("span"),a=Qs(t[0]),n=vs(),c&&c.c(),ne(r,"overflow","hidden"),ne(r,"white-space","nowrap"),ne(r,"text-overflow","ellipsis"),ne(r,"max-width","80px"),ie(i,"class",t[8]),ne(i,"background-color",t[2]),ne(i,"color",t[9]),ne(i,"opacity",t[11]),ie(e,"class","netless-window-manager-cursor-name")},m(l,d){Li(l,e,d),We(e,i),o&&o.m(i,null),We(i,s),We(i,r),We(r,a),We(i,n),c&&c.m(i,null)},p(l,d){l[14]?o?o.p(l,d):(o=Or(l),o.c(),o.m(i,s)):o&&(o.d(1),o=null),d&1&&Za(a,l[0]),l[15]?c?c.p(l,d):(c=Ur(l),c.c(),c.m(i,null)):c&&(c.d(1),c=null),d&256&&ie(i,"class",l[8]),d&4&&ne(i,"background-color",l[2]),d&512&&ne(i,"color",l[9]),d&2048&&ne(i,"opacity",l[11])},d(l){l&&Kt(e),o&&o.d(),c&&c.d()}}}function Or(t){let e,i;return{c(){e=et("img"),ie(e,"class","netless-window-manager-cursor-selector-avatar"),ie(e,"style",t[16]()),Ci(e.src,i=t[7])||ie(e,"src",i),ie(e,"alt","avatar")},m(s,r){Li(s,e,r)},p(s,r){r&128&&!Ci(e.src,i=s[7])&&ie(e,"src",i)},d(s){s&&Kt(e)}}}function Ur(t){let e,i;return{c(){e=et("span"),i=Qs(t[1]),ie(e,"class","netless-window-manager-cursor-tag-name"),ne(e,"background-color",t[10])},m(s,r){Li(s,e,r),We(e,i)},p(s,r){r&2&&Za(i,s[1]),r&1024&&ne(e,"background-color",s[10])},d(s){s&&Kt(e)}}}function Bc(t){let e,i,s,r,a,n,o=!t[12]&&Rr(t);return{c(){e=et("div"),o&&o.c(),i=vs(),s=et("div"),r=et("img"),ie(r,"class",a="netless-window-manager-cursor-"+t[3]+"-image"),Ci(r.src,n=t[6])||ie(r,"src",n),ie(r,"alt",t[3]),ie(s,"class","cursor-image-wrapper"),ie(e,"class","netless-window-manager-cursor-mid"),ne(e,"transform","translateX("+t[4]+"px) translateY("+t[5]+"px)"),ne(e,"display",t[13])},m(c,l){Li(c,e,l),o&&o.m(e,null),We(e,i),We(e,s),We(s,r)},p(c,[l]){c[12]?o&&(o.d(1),o=null):o?o.p(c,l):(o=Rr(c),o.c(),o.m(e,i)),l&8&&a!==(a="netless-window-manager-cursor-"+c[3]+"-image")&&ie(r,"class",a),l&64&&!Ci(r.src,n=c[6])&&ie(r,"src",n),l&8&&ie(r,"alt",c[3]),l&48&&ne(e,"transform","translateX("+c[4]+"px) translateY("+c[5]+"px)"),l&8192&&ne(e,"display",c[13])},i:Si,o:Si,d(c){c&&Kt(e),o&&o.d()}}}function Rc(t,e,i){let s,r,a,n,o,{cursorName:c}=e,{tagName:l}=e,{backgroundColor:d}=e,{appliance:u}=e,{x:p}=e,{y:m}=e,{src:g}=e,{visible:f}=e,{avatar:b}=e,{theme:v}=e,{color:x}=e,{cursorTagBackgroundColor:y}=e,{opacity:k}=e;const z=()=>Object.entries({width:(s?19:28)+"px",height:(s?19:28)+"px",position:s?"initial":"absolute","border-color":s?"white":d,"margin-right":(s?4:0)+"px"}).map(([T,O])=>`${T}: ${O}`).join(";");return t.$$set=T=>{"cursorName"in T&&i(0,c=T.cursorName),"tagName"in T&&i(1,l=T.tagName),"backgroundColor"in T&&i(2,d=T.backgroundColor),"appliance"in T&&i(3,u=T.appliance),"x"in T&&i(4,p=T.x),"y"in T&&i(5,m=T.y),"src"in T&&i(6,g=T.src),"visible"in T&&i(17,f=T.visible),"avatar"in T&&i(7,b=T.avatar),"theme"in T&&i(8,v=T.theme),"color"in T&&i(9,x=T.color),"cursorTagBackgroundColor"in T&&i(10,y=T.cursorTagBackgroundColor),"opacity"in T&&i(11,k=T.opacity)},t.$$.update=()=>{t.$$.dirty&1&&(s=!C.isEmpty(c)),t.$$.dirty&2&&i(15,r=!C.isEmpty(l)),t.$$.dirty&128&&i(14,a=!C.isEmpty(b)),t.$$.dirty&131072&&i(13,n=f?"initial":"none"),t.$$.dirty&8&&i(12,o=u===M.ApplianceNames.laserPointer)},[c,l,d,u,p,m,g,b,v,x,y,k,o,n,a,r,z,f]}class Oc extends jc{constructor(e){super();$c(this,e,Rc,Bc,_c,{cursorName:0,tagName:1,backgroundColor:2,appliance:3,x:4,y:5,src:6,visible:17,avatar:7,theme:8,color:9,cursorTagBackgroundColor:10,opacity:11})}}class Uc{constructor(e,i,s,r){this.manager=e,this.memberId=i,this.cursorManager=s,this.wrapper=r,this.move=a=>{var n,o;if(a.type==="main"){const c=(n=this.manager.boxManager)==null?void 0:n.stageRect;this.component&&c&&(this.autoHidden(),this.moveCursor(a,c,this.manager.mainView))}else{const c=this.cursorManager.focusView,l=(o=c==null?void 0:c.divElement)==null?void 0:o.getBoundingClientRect(),d=c==null?void 0:c.camera;c&&l&&d&&this.component&&(this.autoHidden(),this.moveCursor(a,l,c))}},this.leave=()=>{this.hide()},this.updateMember(),this.createCursor(),this.autoHidden()}moveCursor(e,i,s){var c,l;const{x:r,y:a,type:n}=e,o=s==null?void 0:s.screen.convertPointToScreen(r,a);if(o){let d=o.x-2,u=o.y-18;if(n==="app"){const p=this.cursorManager.playgroundRect;p&&(d=d+i.x-p.x,u=u+i.y-p.y)}else d=d+i.x,u=u+i.y;o.x<0||o.x>i.width||o.y<0||o.y>i.height?(c=this.component)==null||c.$set({visible:!1,x:d,y:u}):(l=this.component)==null||l.$set({visible:!0,x:d,y:u})}}get memberApplianceName(){var e,i;return(i=(e=this.member)==null?void 0:e.memberState)==null?void 0:i.currentApplianceName}get memberColor(){var i,s;return`rgb(${(s=(i=this.member)==null?void 0:i.memberState)==null?void 0:s.strokeColor.join(",")})`}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 Oc({target:this.wrapper,props:this.initProps()}))}initProps(){return{x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName}}getIcon(){if(this.member){const e=this.cursorManager.applianceIcons;return e[this.memberApplianceName||M.ApplianceNames.shape]||e[M.ApplianceNames.shape]}}updateMember(){return this.member=Ca(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var e;(e=this.component)==null||e.$set(C.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 Wc="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==",Hc="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==",Fc="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=",Zc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",Yc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",Qc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+";const Wr={[M.ApplianceNames.pencil]:Wc,[M.ApplianceNames.selector]:Hc,[M.ApplianceNames.eraser]:Fc,[M.ApplianceNames.shape]:Zc,[M.ApplianceNames.text]:Yc,[M.ApplianceNames.laserPointer]:Qc};class Gc{constructor(e,i,s){var a;this.manager=e,this.enableCursor=i,this.cursorInstances=new Map,this.sideEffectManager=new ve.SideEffectManager,this.store=this.manager.store,this.applianceIcons=Wr,this.onCursorMove=n=>{const o=this.initCursorInstance(n.uid);if(n.state===pa.Leave)o.leave();else{const c=o.updateMember();this.canMoveCursor(c)&&o.move(n.position)}},this.initCursorInstance=n=>{let o=this.cursorInstances.get(n);return o||(o=new Uc(this.manager,n,this,ce.playground),this.cursorInstances.set(n,o)),o},this.mouseMoveListener=C.throttle(n=>{n.pointerType==="touch"&&!n.isPrimary||this.updateCursor(this.getType(n),n.clientX,n.clientY)},48),this.getPoint=(n,o,c)=>{var d;const l=(d=n==null?void 0:n.divElement)==null?void 0:d.getBoundingClientRect();if(l)return n==null?void 0:n.convertToPointInWorld({x:o-l.x,y:c-l.y})},this.getType=n=>{var l;const o=n.target,c=this.manager.focusApp;switch(o.parentElement){case this.mainViewElement:return{type:"main"};case((l=c==null?void 0:c.view)==null?void 0:l.divElement):return{type:"app"};default:return{type:"main"}}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.roomMembers=(a=this.manager.room)==null?void 0:a.state.roomMembers;const r=ce.playground;r&&this.setupWrapper(r),this.sideEffectManager.add(()=>P.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>P.on("playgroundSizeChange",()=>this.updateContainerRect())),s&&(this.applianceIcons=j(j({},Wr),s))}canMoveCursor(e){const i=(e==null?void 0:e.memberState.currentApplianceName)===M.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.updateContainerRect()}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}updateCursor(e,i,s){if(this.wrapperRect&&this.manager.canOperate){const r=e.type==="main"?this.manager.mainView:this.focusView,a=this.getPoint(r,i,s);a&&this.manager.dispatchInternalEvent(Y.CursorMove,{uid:this.manager.uid,position:{x:a.x,y:a.y,type:e.type}})}}updateContainerRect(){var e,i;this.wrapperRect=(e=this.manager.boxManager)==null?void 0:e.stageRect,this.playgroundRect=(i=ce.playground)==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())}}class qc{constructor(e){this.manager=e,P.on("changePageState",()=>{Q.emit("pageStateChange",this.toObject())})}get index(){var e;return((e=this.manager)==null?void 0:e.store.getMainViewSceneIndex())||0}get length(){var e;return((e=this.manager)==null?void 0:e.mainViewScenesLength)||0}toObject(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}}class Jc{constructor(e){this.ctx=e,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=i=>{var s,r;i===M.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===M.RoomPhase.Connected&&this.phase===M.RoomPhase.Reconnecting&&((s=this.room)!=null&&s.isWritable?(r=this.room)==null||r.dispatchMagixEvent(qi,{}):this.onReconnected()),this.phase=i},this.onReconnected=C.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{Je("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,s)=>{C.isFunction(i)&&this.disposers.set(s,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(qi,i=>{i.authorId===e.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(e){this.ctx=e}releaseDisposers(){this.disposers.forEach(e=>{C.isFunction(e)&&e()}),this.disposers.clear()}refresh(){this._onReconnected()}add(e,i){const s=this.disposers.get(e);return s&&C.isFunction(s)&&s(),C.isFunction(i)&&(this.reactors.set(e,i),this.disposers.set(e,i())),()=>this.remove(e)}remove(e){this.reactors.has(e)&&this.reactors.delete(e);const i=this.disposers.get(e);i&&(C.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(qi,this.onReconnected),this.releaseDisposers()}}const Xc=(t,e)=>{if(M.isPlayer(t))eh(t);else{if(t=t,Object.getOwnPropertyDescriptor(t,"disableCameraTransform"))return;Object.defineProperty(t,"disableCameraTransform",{get(){return e.mainView.disableCameraTransform},set(s){e.mainView.disableCameraTransform=s}}),Object.defineProperty(t,"canUndoSteps",{get(){return e.canUndoSteps}}),Object.defineProperty(t,"canRedoSteps",{get(){return e.canRedoSteps}}),t.moveCamera=s=>e.moveCamera(s),t.moveCameraToContain=(...s)=>e.moveCameraToContain(...s),t.convertToPointInWorld=(...s)=>e.mainView.convertToPointInWorld(...s),t.setCameraBound=(...s)=>e.mainView.setCameraBound(...s),t.scenePreview=(...s)=>e.mainView.scenePreview(...s),t.fillSceneSnapshot=(...s)=>e.mainView.fillSceneSnapshot(...s),t.generateScreenshot=(...s)=>e.mainView.generateScreenshot(...s),t.setMemberState=(...s)=>e.mainView.setMemberState(...s),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=(...s)=>e.insertImage(...s),t.completeImageUpload=(...s)=>e.completeImageUpload(...s),t.insertText=(...s)=>e.insertText(...s),t.lockImage=(...s)=>e.lockImage(...s),t.lockImages=(...s)=>e.lockImages(...s),Kc(t,e),t.dynamicPpt.slideStateAdapter.pptHandler||(t.dynamicPpt.slideStateAdapter.pptHandler=e.createPPTHandler())}},Kc=(t,e)=>{const i=t.removeScenes;t.removeScenes=(s,r)=>{var n;s===we&&((n=e.appManager)==null||n.updateRootDirRemoving(!0));const a=i.call(t,s);return P.emit("removeScenes",{scenePath:s,index:r}),a}},eh=t=>{const e=t.seekToProgressTime;async function i(s){await P.emit("seekStart");const r=await e.call(t,s);return P.emit("seek",s),r}t.seekToProgressTime=i};var th=(()=>`.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;font-family:PingFang SC,Source Han Sans SC,Microsoft YaHei,Helvetica Neue,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif}.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{display:flex;align-items:center;height:26px;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 .5em 0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;font-family:PingFang SC,Source Han Sans SC,Microsoft YaHei,Helvetica Neue,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif;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}.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:currentColor;background:#25282e}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.netless-app-docs-viewer-preview.netless-app-docs-viewer-preview-active{transform:translate(0)}.netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{position:absolute;z-index:10200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;position:absolute;z-index:10300;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;user-select:none}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{box-sizing:border-box;position:absolute;top:0;right:0;z-index:2147483647;width:16px;min-height:30px;margin:0;padding:0 0 0 8px;border:none;outline:none;opacity:0;background:transparent;transition:opacity .4s 3s,transform .1s;user-select:none;touch-action:none}.netless-app-docs-viewer-static-scrollbar:after{content:"";display:block;width:8px;height:100%;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;transition:background .4s}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrolling{opacity:1;transition:opacity .4s,transform .1s}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{opacity:1;transition:opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging:after{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-static-scrollbar:hover:after,.netless-app-docs-viewer-static-scrollbar:focus:after{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active:after{background:rgba(68,78,96,.6)}.telebox-body-wrap:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:opacity .4s,transform .1s}.telebox-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.page-renderer-pages-container{position:relative;width:100%;height:100%}.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-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}
124
+ `)();const Qa="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",ih=Qa.length,Hr=Array(20),sh=()=>{for(let t=0;t<20;t++)Hr[t]=Qa.charAt(Math.random()*ih);return Hr.join("")};function Fr(t){try{return t()}catch(e){console.error(e)}}class gt{constructor(){this.disposers=new Map}addDisposer(e,i=this.genUID()){return this.flush(i),this.disposers.set(i,Array.isArray(e)?()=>e.forEach(Fr):e),i}add(e,i=this.genUID()){const s=e();return s?this.addDisposer(s,i):i}addEventListener(e,i,s,r,a=this.genUID()){return e.addEventListener(i,s,r),this.addDisposer(()=>e.removeEventListener(i,s,r),a),a}setTimeout(e,i,s=this.genUID()){const r=window.setTimeout(()=>{this.remove(s),e()},i);return this.addDisposer(()=>window.clearTimeout(r),s)}setInterval(e,i,s=this.genUID()){const r=window.setInterval(e,i);return this.addDisposer(()=>window.clearInterval(r),s)}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(s){console.error(s)}}flushAll(){this.disposers.forEach(Fr),this.disposers.clear()}genUID(){let e;do e=sh();while(this.disposers.has(e));return e}}var rh=Object.defineProperty,ah=Object.defineProperties,nh=Object.getOwnPropertyDescriptors,Zr=Object.getOwnPropertySymbols,oh=Object.prototype.hasOwnProperty,lh=Object.prototype.propertyIsEnumerable,Ss=(t,e,i)=>e in t?rh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ga=(t,e)=>{for(var i in e||(e={}))oh.call(e,i)&&Ss(t,i,e[i]);if(Zr)for(var i of Zr(e))lh.call(e,i)&&Ss(t,i,e[i]);return t},qa=(t,e)=>ah(t,nh(e)),tt=(t,e,i)=>(Ss(t,typeof e!="symbol"?e+"":e,i),i);class ch{constructor(e){tt(this,"_subscribers"),tt(this,"_bSub"),tt(this,"_bSubDisposer"),this._bSub=e}get size(){return this._subscribers?this._subscribers.size:0}invoke(e,i){this._subscribers&&this._subscribers.forEach(s=>s(e,i))}add(e){this._bSub&&(!this._subscribers||this._subscribers.size<=0)&&(this._bSubDisposer=this._bSub()),this._subscribers||(this._subscribers=new Set),this._subscribers.add(e)}remove(e){if(this._subscribers&&this._subscribers.delete(e),this._subscribers&&this._subscribers.size<=0&&this._bSubDisposer){const i=this._bSubDisposer;this._bSubDisposer=null,i()}}clear(){if(this._subscribers&&this._subscribers.clear(),this._bSubDisposer){const e=this._bSubDisposer;this._bSubDisposer=null,e()}}destroy(){this.clear()}}class qs{constructor(e,i){tt(this,"_subscribers"),tt(this,"_value"),this._value=e;let s;if(i&&(i.compare&&(this.compare=i.compare),i.beforeSubscribe)){const r=i.beforeSubscribe,a=this._setValue.bind(this);s=()=>r(a)}this._subscribers=new ch(s)}_setValue(e,i){this.compare(e,this._value)||(this._value=e,this._subscribers.invoke(e,i))}get value(){return this._value}reaction(e){return this._subscribers.add(e),()=>{this._subscribers.remove(e)}}subscribe(e,i){const s=this.reaction(e);return e(this._value,i),s}destroy(){this._subscribers.destroy()}unsubscribe(e){this._subscribers.remove(e)}get size(){return this._subscribers.size}compare(e,i){return e===i}}class Fe extends qs{constructor(){super(...arguments);tt(this,"setValue",this._setValue)}}class hh extends qs{constructor(e,i,s={}){super(i(e.value),qa(Ga({},s),{beforeSubscribe:r=>{const a=e.subscribe((n,o)=>r(i(n),o));if(s.beforeSubscribe){const n=s.beforeSubscribe(r);if(n)return()=>{a(),n()}}return a}}));tt(this,"_srcValue"),this._srcValue=()=>i(e.value)}get value(){if(this.size<=0){const e=this._srcValue();return this.compare(e,this._value)?this._value:e}return this._value}}function Ut(t,e=s=>s,i={}){return new hh(t,e,i)}class dh extends qs{constructor(e,i,s={}){super(i(ns(e)),qa(Ga({},s),{beforeSubscribe:r=>{let a=ns(e);r(i(a));const n=e.map((c,l)=>c.reaction((d,u)=>{a=a.slice(),a[l]=d,r(i(a),u)})),o=()=>n.forEach(c=>c());if(s.beforeSubscribe){const c=s.beforeSubscribe(r);if(c)return()=>{o(),c()}}return o}}));tt(this,"_srcValue"),this._srcValue=()=>i(ns(e))}get value(){if(this.size<=0){const e=this._srcValue();return this.compare(e,this._value)?this._value:e}return this._value}}function ns(t){return t.map(uh)}function uh(t){return t.value}function Pe(t,e=s=>s,i={}){return new dh(t,e,i)}function Ja(t){t.onValChanged||(t.onValChanged=ph)}function ph(t,e){const i=this[`_${t}$`]||this[t];if(!(i!=null&&i.reaction))throw new TypeError(`"${t}" is not related to a Val in this instance`);return i.reaction(e)}function gh(t,e,i){Object.keys(e).forEach(s=>{mh(t,s,e[s]),i&&i.attach(e[s])}),Ja(t)}function mh(t,e,i){return Object.defineProperties(t,{[e]:{get(){return i.value}},[`_${e}$`]:{value:i}}),t}function fh(t,e,i){Object.keys(e).forEach(s=>{bh(t,s,e[s]),i&&i.attach(e[s])}),Ja(t)}function bh(t,e,i){return Object.defineProperties(t,{[e]:{get(){return i.value},set(s){i.setValue(s)}},[`_${e}$`]:{value:i},[`set${yh(e)}`]:{value:(s,r)=>i.setValue(s,r)}}),t}function yh(t){return t[0].toUpperCase()+t.slice(1)}const at=typeof window!="undefined",Xa=at&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Ka=at&&"IntersectionObserver"in window,en=at&&"classList"in document.createElement("p"),tn=at&&window.devicePixelRatio>1,wh={elements_selector:".lazy",container:Xa||at?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},sn=t=>Object.assign({},wh,t),Yr=function(t,e){let i;const s="LazyLoad::Initialized",r=new t(e);try{i=new CustomEvent(s,{detail:{instance:r}})}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent(s,!1,!1,{instance:r})}window.dispatchEvent(i)},vh=(t,e)=>{if(!!e)if(!e.length)Yr(t,e);else for(let i=0,s;s=e[i];i+=1)Yr(t,s)},Ze="src",Js="srcset",Xs="sizes",rn="poster",ei="llOriginalAttrs",an="data",Ks="loading",nn="loaded",on="applied",xh="entered",er="error",ln="native",cn="data-",hn="ll-status",ge=(t,e)=>t.getAttribute(cn+e),Mh=(t,e,i)=>{var s=cn+e;if(i===null){t.removeAttribute(s);return}t.setAttribute(s,i)},ti=t=>ge(t,hn),mt=(t,e)=>Mh(t,hn,e),Vi=t=>mt(t,null),tr=t=>ti(t)===null,Sh=t=>ti(t)===Ks,Ch=t=>ti(t)===er,ir=t=>ti(t)===ln,Ih=[Ks,nn,on,er],_h=t=>Ih.indexOf(ti(t))>=0,nt=(t,e,i,s)=>{if(!!t){if(s!==void 0){t(e,i,s);return}if(i!==void 0){t(e,i);return}t(e)}},_t=(t,e)=>{if(en){t.classList.add(e);return}t.className+=(t.className?" ":"")+e},$e=(t,e)=>{if(en){t.classList.remove(e);return}t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},Ah=t=>{t.llTempImage=document.createElement("IMG")},kh=t=>{delete t.llTempImage},dn=t=>t.llTempImage,$i=(t,e)=>{if(!e)return;const i=e._observer;!i||i.unobserve(t)},Th=t=>{t.disconnect()},Nh=(t,e,i)=>{e.unobserve_entered&&$i(t,i)},sr=(t,e)=>{!t||(t.loadingCount+=e)},Eh=t=>{!t||(t.toLoadCount-=1)},un=(t,e)=>{!t||(t.toLoadCount=e)},Ph=t=>t.loadingCount>0,zh=t=>t.toLoadCount>0,pn=t=>{let e=[];for(let i=0,s;s=t.children[i];i+=1)s.tagName==="SOURCE"&&e.push(s);return e},rr=(t,e)=>{const i=t.parentNode;if(!i||i.tagName!=="PICTURE")return;pn(i).forEach(e)},gn=(t,e)=>{pn(t).forEach(e)},ji=[Ze],mn=[Ze,rn],Gt=[Ze,Js,Xs],fn=[an],Bi=t=>!!t[ei],bn=t=>t[ei],yn=t=>delete t[ei],St=(t,e)=>{if(Bi(t))return;const i={};e.forEach(s=>{i[s]=t.getAttribute(s)}),t[ei]=i},Dh=t=>{Bi(t)||(t[ei]={backgroundImage:t.style.backgroundImage})},Lh=(t,e,i)=>{if(!i){t.removeAttribute(e);return}t.setAttribute(e,i)},pt=(t,e)=>{if(!Bi(t))return;const i=bn(t);e.forEach(s=>{Lh(t,s,i[s])})},Vh=t=>{if(!Bi(t))return;const e=bn(t);t.style.backgroundImage=e.backgroundImage},wn=(t,e,i)=>{_t(t,e.class_applied),mt(t,on),i&&(e.unobserve_completed&&$i(t,e),nt(e.callback_applied,t,i))},vn=(t,e,i)=>{_t(t,e.class_loading),mt(t,Ks),i&&(sr(i,1),nt(e.callback_loading,t,i))},it=(t,e,i)=>{!i||t.setAttribute(e,i)},Qr=(t,e)=>{it(t,Xs,ge(t,e.data_sizes)),it(t,Js,ge(t,e.data_srcset)),it(t,Ze,ge(t,e.data_src))},$h=(t,e)=>{rr(t,i=>{St(i,Gt),Qr(i,e)}),St(t,Gt),Qr(t,e)},jh=(t,e)=>{St(t,ji),it(t,Ze,ge(t,e.data_src))},Bh=(t,e)=>{gn(t,i=>{St(i,ji),it(i,Ze,ge(i,e.data_src))}),St(t,mn),it(t,rn,ge(t,e.data_poster)),it(t,Ze,ge(t,e.data_src)),t.load()},Rh=(t,e)=>{St(t,fn),it(t,an,ge(t,e.data_src))},Oh=(t,e,i)=>{const s=ge(t,e.data_bg),r=ge(t,e.data_bg_hidpi),a=tn&&r?r:s;!a||(t.style.backgroundImage=`url("${a}")`,dn(t).setAttribute(Ze,a),vn(t,e,i))},Uh=(t,e,i)=>{const s=ge(t,e.data_bg_multi),r=ge(t,e.data_bg_multi_hidpi),a=tn&&r?r:s;!a||(t.style.backgroundImage=a,wn(t,e,i))},Wh=(t,e,i)=>{const s=ge(t,e.data_bg_set);if(!s)return;const r=s.split("|");let a=r.map(n=>`image-set(${n})`);t.style.backgroundImage=a.join(),t.style.backgroundImage===""&&(a=r.map(n=>`-webkit-image-set(${n})`),t.style.backgroundImage=a.join()),wn(t,e,i)},xn={IMG:$h,IFRAME:jh,VIDEO:Bh,OBJECT:Rh},Hh=(t,e)=>{const i=xn[t.tagName];!i||i(t,e)},Fh=(t,e,i)=>{const s=xn[t.tagName];!s||(s(t,e),vn(t,e,i))},Zh=["IMG","IFRAME","VIDEO","OBJECT"],Yh=t=>Zh.indexOf(t.tagName)>-1,Mn=(t,e)=>{e&&!Ph(e)&&!zh(e)&&nt(t.callback_finish,e)},Gr=(t,e,i)=>{t.addEventListener(e,i),t.llEvLisnrs[e]=i},Qh=(t,e,i)=>{t.removeEventListener(e,i)},ar=t=>!!t.llEvLisnrs,Gh=(t,e,i)=>{ar(t)||(t.llEvLisnrs={});const s=t.tagName==="VIDEO"?"loadeddata":"load";Gr(t,s,e),Gr(t,"error",i)},Cs=t=>{if(!ar(t))return;const e=t.llEvLisnrs;for(let i in e){const s=e[i];Qh(t,i,s)}delete t.llEvLisnrs},Sn=(t,e,i)=>{kh(t),sr(i,-1),Eh(i),$e(t,e.class_loading),e.unobserve_completed&&$i(t,i)},qh=(t,e,i,s)=>{const r=ir(e);Sn(e,i,s),_t(e,i.class_loaded),mt(e,nn),nt(i.callback_loaded,e,s),r||Mn(i,s)},Jh=(t,e,i,s)=>{const r=ir(e);Sn(e,i,s),_t(e,i.class_error),mt(e,er),nt(i.callback_error,e,s),i.restore_on_error&&pt(e,Gt),r||Mn(i,s)},nr=(t,e,i)=>{const s=dn(t)||t;if(ar(s))return;Gh(s,n=>{qh(n,t,e,i),Cs(s)},n=>{Jh(n,t,e,i),Cs(s)})},Xh=(t,e,i)=>{Ah(t),nr(t,e,i),Dh(t),Oh(t,e,i),Uh(t,e,i),Wh(t,e,i)},Kh=(t,e,i)=>{nr(t,e,i),Fh(t,e,i)},or=(t,e,i)=>{Yh(t)?Kh(t,e,i):Xh(t,e,i)},ed=(t,e,i)=>{t.setAttribute("loading","lazy"),nr(t,e,i),Hh(t,e),mt(t,ln)},qr=t=>{t.removeAttribute(Ze),t.removeAttribute(Js),t.removeAttribute(Xs)},td=t=>{rr(t,e=>{qr(e)}),qr(t)},Cn=t=>{rr(t,e=>{pt(e,Gt)}),pt(t,Gt)},id=t=>{gn(t,e=>{pt(e,ji)}),pt(t,mn),t.load()},sd=t=>{pt(t,ji)},rd=t=>{pt(t,fn)},ad={IMG:Cn,IFRAME:sd,VIDEO:id,OBJECT:rd},nd=t=>{const e=ad[t.tagName];if(!e){Vh(t);return}e(t)},od=(t,e)=>{tr(t)||ir(t)||($e(t,e.class_entered),$e(t,e.class_exited),$e(t,e.class_applied),$e(t,e.class_loading),$e(t,e.class_loaded),$e(t,e.class_error))},ld=(t,e)=>{nd(t),od(t,e),Vi(t),yn(t)},cd=(t,e,i,s)=>{!i.cancel_on_exit||!Sh(t)||t.tagName==="IMG"&&(Cs(t),td(t),Cn(t),$e(t,i.class_loading),sr(s,-1),Vi(t),nt(i.callback_cancel,t,e,s))},hd=(t,e,i,s)=>{const r=_h(t);mt(t,xh),_t(t,i.class_entered),$e(t,i.class_exited),Nh(t,i,s),nt(i.callback_enter,t,e,s),!r&&or(t,i,s)},dd=(t,e,i,s)=>{tr(t)||(_t(t,i.class_exited),cd(t,e,i,s),nt(i.callback_exit,t,e,s))},ud=["IMG","IFRAME","VIDEO"],In=t=>t.use_native&&"loading"in HTMLImageElement.prototype,pd=(t,e,i)=>{t.forEach(s=>{ud.indexOf(s.tagName)!==-1&&ed(s,e,i)}),un(i,0)},gd=t=>t.isIntersecting||t.intersectionRatio>0,md=t=>({root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}),fd=(t,e,i)=>{t.forEach(s=>gd(s)?hd(s.target,s,e,i):dd(s.target,s,e,i))},bd=(t,e)=>{e.forEach(i=>{t.observe(i)})},yd=(t,e)=>{Th(t),bd(t,e)},wd=(t,e)=>{!Ka||In(t)||(e._observer=new IntersectionObserver(i=>{fd(i,t,e)},md(t)))},_n=t=>Array.prototype.slice.call(t),Ii=t=>t.container.querySelectorAll(t.elements_selector),vd=t=>_n(t).filter(tr),xd=t=>Ch(t),Md=t=>_n(t).filter(xd),Jr=(t,e)=>vd(t||Ii(e)),Sd=(t,e)=>{Md(Ii(t)).forEach(s=>{$e(s,t.class_error),Vi(s)}),e.update()},Cd=(t,e)=>{!at||(e._onlineHandler=()=>{Sd(t,e)},window.addEventListener("online",e._onlineHandler))},Id=t=>{!at||window.removeEventListener("online",t._onlineHandler)},ii=function(t,e){const i=sn(t);this._settings=i,this.loadingCount=0,wd(i,this),Cd(i,this),this.update(e)};ii.prototype={update:function(t){const e=this._settings,i=Jr(t,e);if(un(this,i.length),Xa||!Ka){this.loadAll(i);return}if(In(e)){pd(i,e,this);return}yd(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),Id(this),Ii(this._settings).forEach(t=>{yn(t)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){const e=this._settings;Jr(t,e).forEach(s=>{$i(s,this),or(s,e,this)})},restoreAll:function(){const t=this._settings;Ii(t).forEach(e=>{ld(e,t)})}};ii.load=(t,e)=>{const i=sn(e);or(t,i)};ii.resetStatus=t=>{Vi(t)};at&&vh(ii,window.lazyLoadOptions);class _d{constructor({namespace:e,pages$:i,sideEffect:s,readonly$:r,events:a,wrapClassName:n,root:o,pagesIndex$:c}){this.showPreview$=new Fe(!1),this.namespace=e,this.pages$=i,this.sideEffect=s,this.readonly$=r,this.events=a,this.wrapClassName=n,this.sideEffect.addDisposer(this.events.on("togglePreview",()=>{this.showPreview$.setValue(!this.showPreview$.value)})),this.sideEffect.addDisposer(this.showPreview$.subscribe(l=>{this.sideEffect.add(()=>{const d=this.renderPreview(),u=this.renderPreviewMask();if(l){o.appendChild(d),o.appendChild(u),d.scrollTop;const p=d.querySelector("."+this.wrapClassName(`preview-page-${c.value}`));return p&&d.scrollTo({top:p.offsetTop-16}),d.classList.toggle(this.wrapClassName("preview-active"),!0),this.previewLazyLoad=new ii({container:this.$preview,elements_selector:"."+this.wrapClassName("preview-page>img")}),()=>{var m;return(m=this.previewLazyLoad)==null?void 0:m.destroy()}}else return d.classList.toggle(this.wrapClassName("preview-active"),!1),this.sideEffect.setTimeout(()=>{d.remove(),u.remove()},500,"preview-remove"),null},"preview-lazyload")}))}destroy(){var e,i;(e=this.$preview)==null||e.remove(),(i=this.$previewMask)==null||i.remove()}renderPreview(){if(this.$preview)return this.$preview;const e=document.createElement("div");return e.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=e,this.sideEffect.addEventListener(e,"wheel",i=>i.stopPropagation(),{passive:!1}),this.sideEffect.addDisposer(this.pages$.subscribe(i=>{var s;this.sideEffect.add(()=>{const r=i.map((a,n)=>{var o;const c=(o=a.thumbnail)!=null?o:a.src.startsWith("ppt")?void 0:a.src;if(!c)return;const l=String(n),d=document.createElement("a");d.className=this.wrapClassName("preview-page")+" "+this.wrapClassName(`preview-page-${n}`),d.setAttribute("href","#"),d.dataset.pageIndex=l;const u=document.createElement("span");u.className=this.wrapClassName("preview-page-name"),u.textContent=String(n+1),u.dataset.pageIndex=l;const p=document.createElement("img");return p.width=a.width,p.height=a.height,p.dataset.src=c,p.dataset.pageIndex=l,d.appendChild(p),d.appendChild(u),e.appendChild(d),d});return()=>r.forEach(a=>a==null?void 0:a.remove())},"render-preview-pages"),(s=this.previewLazyLoad)==null||s.update()})),this.sideEffect.addEventListener(e,"click",i=>{var s;if(this.readonly$.value)return;const r=(s=i.target.dataset)==null?void 0:s.pageIndex;r&&(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),this.events.emit("jumpPage",Number(r)),this.showPreview$.setValue(!1))}),e}renderPreviewMask(){if(this.$previewMask)return this.$previewMask;const e=document.createElement("div");return e.className=this.wrapClassName("preview-mask"),this.$previewMask=e,this.sideEffect.addEventListener(e,"click",i=>{this.readonly$.value||i.target===e&&this.showPreview$.setValue(!1)}),e}}function Ad(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 s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.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(s),i}function kd(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 s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.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(s),i}function Td(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 s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.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(s),i}function Nd(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 s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.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(s),i}function Ed(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 s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.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(s),i}class Pd{constructor({namespace:e,pages$:i,sideEffect:s,readonly$:r,events:a,playable:n,wrapClassName:o,pagesIndex$:c,root:l}){this.namespace=e,this.pages$=i,this.sideEffect=s,this.readonly$=r,this.events=a,this.wrapClassName=o,this.pagesIndex$=c,this.playable=n,this.$footer=this.render(),l.appendChild(this.$footer)}destroy(){this.$footer.remove()}render(){const e=document.createElement("div");e.className=this.wrapClassName("footer"),this.sideEffect.addDisposer(this.readonly$.subscribe(l=>e.classList.toggle(this.wrapClassName("readonly"),l)));const i=this.renderFooterBtn("btn-sidebar",Ad(this.namespace));this.sideEffect.addEventListener(i,"click",()=>{this.readonly$.value||this.events.emit("togglePreview")}),e.appendChild(i),this.sideEffect.addDisposer(this.pages$.subscribe(l=>{const d=l.some(u=>u.thumbnail||!u.src.startsWith("ppt"));i.style.display=d?"":"none"}));const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const r=this.renderFooterBtn("btn-page-back",kd(this.namespace));if(this.sideEffect.addEventListener(r,"click",()=>{this.readonly$.value||this.events.emit("back")}),s.appendChild(r),this.playable){const l=this.renderFooterBtn("btn-page-play",Nd(this.namespace),Ed(this.namespace));this.sideEffect.addEventListener(l,"click",()=>{this.readonly$.value||(l.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.events.emit("play"),this.sideEffect.setTimeout(()=>l.classList.toggle(this.wrapClassName("footer-btn-playing"),!1),500,"returnPlay"))}),s.appendChild(l)}const a=this.renderFooterBtn("btn-page-next",Td(this.namespace));this.sideEffect.addEventListener(a,"click",()=>{this.readonly$.value||this.events.emit("next")}),s.appendChild(a);const n=document.createElement("div");n.className=this.wrapClassName("page-number");const o=document.createElement("input");o.className=this.wrapClassName("page-number-input"),this.sideEffect.addDisposer(this.readonly$.subscribe(l=>o.disabled=l)),this.sideEffect.addDisposer(this.pagesIndex$.subscribe(l=>o.value=String(l+1))),this.sideEffect.addEventListener(o,"focus",()=>{o.select()}),this.sideEffect.addEventListener(o,"change",()=>{if(this.readonly$.value)return;const l=Number(o.value)-1;l>=0&&this.events.emit("jumpPage",l)});const c=document.createElement("span");return this.sideEffect.addDisposer(this.pages$.subscribe(l=>{c.textContent=" / "+l.length})),n.appendChild(o),n.appendChild(c),e.appendChild(s),e.appendChild(n),e}renderFooterBtn(e,i,s){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(i),s&&r.appendChild(s),r}}class zd{constructor(){this.listeners=new Map,this.relayListeners=new Set}emit(e,i){var s;(s=this.listeners.get(e))==null||s.forEach(r=>r(i))}on(e,i){let s=this.listeners.get(e);return s||(s=new Set,this.listeners.set(e,s)),s.add(i),s.size===1&&this.relayListeners.forEach(r=>r.start(e)),()=>{this.off(e,i)}}off(e,i){const s=this.listeners.get(e);if(s){const r=s.delete(i);return s.size<=0&&(this.listeners.delete(e),this.relayListeners.forEach(a=>a.dispose(e))),r}return!1}clear(e){var i;e?(i=this.listeners.get(e))==null||i.clear():this.listeners.clear()}count(e){var i;if(e)return((i=this.listeners.get(e))==null?void 0:i.size)||0;{let s=0;return this.listeners.forEach(r=>{s+=r.size}),s}}remit(e,i){let s;const r={start:a=>{a===e&&(s=i(this))},dispose:a=>{s&&(!a||a===e)&&s()}};return this.relayListeners.add(r),()=>{this.relayListeners.delete(r),s&&s()}}destroy(){this.clear(),this.relayListeners.forEach(e=>e.dispose()),this.relayListeners.clear()}}class An{constructor({readonly$:e,pagesIndex$:i,box:s,pages:r=[],playable:a}){this.wrapClassName=o=>`${this.namespace}-${o}`,this.namespace="netless-app-docs-viewer",this.sideEffect=new gt,this.events=new zd;const n=new Fe(r);fh(this,{pages:n}),this.preview=new _d({pages$:n,readonly$:e,pagesIndex$:i,root:s.$body,sideEffect:this.sideEffect,events:this.events,namespace:this.namespace,wrapClassName:this.wrapClassName}),this.footer=new Pd({pages$:n,readonly$:e,playable:a,pagesIndex$:i,root:s.$footer,namespace:this.namespace,sideEffect:this.sideEffect,events:this.events,wrapClassName:this.wrapClassName})}destroy(){this.preview.destroy(),this.footer.destroy(),this.sideEffect.flushAll(),this.events.destroy()}}function Xe(t,e,i){return Math.min(Math.max(t,e),i)}function Xr(t){return t.touches?t.touches[0]:t}function kn(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function Tn(t,e){return t.width===e.width&&t.height===e.height}class Dd{constructor(e){var i,s,r;this.velocity=0,this._paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=a=>{var n;if(this._paused)return;let o=Math.floor((a-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=a;o-- >0;)this.stepper();(n=this.onStep)==null||n.call(this,this.current),this._paused?this._animationFrameID=null:this._animationFrameID=window.requestAnimationFrame(this.looper)},this.current=(i=e.start)!=null?i:0,this.target=this.current,this.stiffness=(s=e.stiffness)!=null?s:170,this.damping=(r=e.damping)!=null?r:26,this.onStep=e.onStep}get paused(){return this._paused}stepTo(e,i){var s;this._paused&&i!=null&&(this.current=i),this._paused=!1,this.target=e,(s=this.onStep)==null||s.call(this,this.current),this._loopTimestamp=Date.now(),this._animationFrameID=window.requestAnimationFrame(this.looper)}pause(){this._paused=!0,this._animationFrameID!=null&&window.cancelAnimationFrame(this._animationFrameID)}destroy(){this.pause(),this.onStep=void 0}stepper(){const e=-this.stiffness*(this.current-this.target),i=-this.damping*this.velocity,s=this.velocity+(e+i)/60,r=this.current+s/60;Math.abs(s-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0,this._paused=!0):(this.current=r,this.velocity=s)}}class Ld{constructor(e,i,s,r,a,n){this.index=e,this.lastVisit=Date.now(),this.sideEffect=new gt;const o=Ut(i,p=>p[e]||{width:0,height:0}),c=Pe([o,s],([p,m])=>(m.width-p.width)/2),l=Pe([a,n],([p,m])=>(p[e]||0)-m),d=document.createElement("div");d.className="page-renderer-page",d.dataset.index=`${e}`;const u=document.createElement("img");u.className="page-renderer-page-img",d.appendChild(u),this.sideEffect.addDisposer([Pe([o,r]).subscribe(([p,m])=>{d.style.width=`${p.width*m}px`,d.style.height=`${p.height*m}px`}),o.subscribe(p=>{p.thumbnail&&(d.style.backgroundImage=`url("${p.thumbnail}")`),u.width=p.width,u.height=p.height,u.src=p.src}),Pe([c,l,r]).subscribe(([p,m,g])=>{d.style.transform=`translate(${p*g}px, ${m*g}px)`})]),this.$page=d}destroy(){this.sideEffect.flushAll(),this.$page.remove()}}const Vd=window.requestIdleCallback||(t=>window.setTimeout(t,5e3)),$d=window.cancelIdleCallback||window.clearTimeout;class jd{constructor(e,i,s,r,a){this.pages$=e,this.pagesSize$=i,this.scale$=s,this.pagesYs$=r,this.pagesScrollTop$=a,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{var n;if(this.gcTimer=null,this.els.size>this.maxElCount){const o=[...this.els.values()].sort((c,l)=>l.lastVisit-c.lastVisit);for(let c=Math.floor(this.maxElCount/4);c<o.length;c++)(n=this.els.get(o[c].index))==null||n.destroy(),this.els.delete(o[c].index)}}}getEl(e){let i=this.els.get(e);return i||(i=new Ld(e,this.pages$,this.pagesSize$,this.scale$,this.pagesYs$,this.pagesScrollTop$),this.els.set(e,i)),i.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=Vd(this.gc)),i}destroy(){this.els.forEach(e=>e.destroy()),this.els.clear(),this.gcTimer!==null&&($d(this.gcTimer),this.gcTimer=null)}}class Bd{constructor({pagesScrollTop$:e,containerRect$:i,pages$:s,pagesSize$:r}){this.sideEffect=new gt,s=Ut(s,m=>m.map(g=>{if(g.thumbnail)return g;try{const f=new URL(g.src);return f.searchParams.set("x-oss-process","image/resize,l_50"),oe(j({},g),{thumbnail:f.toString()})}catch(f){return console.error(f),g}}));const a=Ut(s,m=>{const g=Array(m.length);for(let f=0;f<m.length;f++)g[f]=f>0?g[f-1]+m[f-1].height:0;return g}),n=Ut(s,m=>{let g=1/0;for(let f=m.length-1;f>=0;f--)m[f].height<=g&&(g=m[f].height);return g}),o=Pe([e,a,s],([m,g,f])=>{for(let b=0;b<g.length;b++)if(g[b]+f[b].height-m>=.001)return b;return g.length-1}),c=Pe([i,r],([m,g])=>m.width/g.width||1),l=Pe([s,i,n,c],([m,g,f,b])=>Xe(Math.ceil(g.height/b/f/2),1,m.length));gh(this,{pagesScrollTop:e,containerRect:i,pages:s,pagesSize:r,pagesIndex:o,pagesYs:a,pagesMinHeight:n,scale:c}),this.pageElManager=new jd(s,r,c,a,e),this.$pages=this.renderPages();const d=new Fe(!1);this.sideEffect.addDisposer(d.subscribe(m=>this.$pages.classList.toggle("is-hwa",m)));const u=()=>d.setValue(!1),p=()=>{this.sideEffect.setTimeout(u,1e3,"turn-off-hwa"),d.setValue(!0)};this.sideEffect.addDisposer(Pe([o,l,s]).subscribe(([m,g,f])=>{p();const b=Math.max(m-g,0),v=Math.min(m+g,f.length-1);for(let x=0;x<this.$pages.children.length;x++){const y=this.$pages.children[x],k=Number(y.dataset.index);k>=b&&k<=v||(y.remove(),x--)}for(let x=b;x<=v;x++){const y=this.pageElManager.getEl(x);y.$page.parentElement!==this.$pages&&this.$pages.appendChild(y.$page)}}))}renderPages(){const e=document.createElement("div");return e.className="page-renderer-pages-container",this.sideEffect.addDisposer(this._containerRect$.subscribe(i=>{e.style.width=`${i.width}px`,e.style.height=`${i.height}px`}),"render-pages-size"),e}destroy(){this.sideEffect.flushAll(),this.$pages.remove(),this.pageElManager.destroy()}}const Rd=30;class Od{constructor({pagesScrollTop$:e,containerRect$:i,stageRect$:s,pagesSize$:r,readonly$:a,scrollbarMinHeight:n=Rd,wrapClassName:o,onDragScroll:c}){this.sideEffect=new gt,this.scrolling$=new Fe(!1),this.pagesScrollTop$=e,this.containerRect$=i,this.stageRect$=s,this.pagesSize$=r,this.scrollbarMinHeight=n,this.readonly$=a,this.wrapClassName=o,this.onDragScroll=c,this.scrollbarHeight$=Pe([i,s,r],([l,d,u])=>Xe(d.height/(d.width/u.width*u.height)*l.height,n,l.height)),this.scrollTop$=Pe([i,s,r,this.scrollbarHeight$,this.pagesScrollTop$],([l,d,u,p,m])=>Xe(m/(u.height-u.width/d.width*d.height)*(l.height-p),0,l.height-p)),this.$scrollbar=this.renderScrollbar()}mount(e){e.appendChild(this.$scrollbar)}destroy(){this.$scrollbar.remove(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const e=document.createElement("button");e.className=this.wrapClassName("scrollbar"),e.style.minHeight=`${this.scrollbarMinHeight}px`,this.sideEffect.addDisposer([this.scrollbarHeight$.subscribe(s=>{e.style.height=`${s}px`}),this.scrollTop$.subscribe(s=>{this.scrolling$.setValue(!0),this.sideEffect.setTimeout(()=>this.scrolling$.setValue(!1),100,"reset-scrolling");const r=()=>e.style.transform=`translateY(${s}px)`;window.requestAnimationFrame?window.requestAnimationFrame(r):r()}),this.scrolling$.subscribe(s=>{e.classList.toggle(this.wrapClassName("scrolling"),s)})]);const i=s=>{if(!s.isPrimary||this.readonly$.value||s.button!=null&&s.button!==0)return;kn(s);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const a=this.pagesScrollTop$.value,{clientY:n}=Xr(s),o=l=>{if(!l.isPrimary||this.readonly$.value)return;const{clientY:d}=Xr(l),u=d-n;Math.abs(u)>0&&this.onDragScroll&&this.onDragScroll(a+u/this.containerRect$.value.height*this.pagesSize$.value.height)},c=l=>{!l.isPrimary||(e.classList.toggle(r,!1),window.removeEventListener("pointermove",o,!0),window.removeEventListener("pointerup",c,!0),window.removeEventListener("pointercancel",c,!0))};window.addEventListener("pointermove",o,!0),window.addEventListener("pointerup",c,!0),window.addEventListener("pointercancel",c,!0)};return this.sideEffect.addEventListener(e,"pointerdown",i),e}}class Ud{constructor({whiteboard:e,readonly$:i,box:s,pages:r,pagesScrollTop:a=0,onUserScroll:n}){this.sideEffect=new gt,this.userScrolling=!1,this.whiteboard=e,this.readonly$=i,this.box=s,this.pages=r,this.onUserScroll=n;const o=()=>{var l;this.userScrolling=!1,(l=this.onUserScroll)==null||l.call(this,this.pagesScrollTop$.value)};this.debounceOnUserScroll=()=>{this.userScrolling=!0,this.sideEffect.setTimeout(o,80,"debounceOnUserScroll")};const c=new Fe(r);this.pagesScrollTop$=new Fe(a),this.pagesSize$=Ut(c,l=>{let d=0,u=0;for(let p=l.length-1;p>=0;p--){const m=l[p];m.width>d&&(d=m.width),u+=m.height}return{width:Math.max(1,d),height:Math.max(1,u)}},{compare:Tn}),this.pageRenderer=new Bd({pagesScrollTop$:this.pagesScrollTop$,containerRect$:s._stageRect$,pages$:c,pagesSize$:this.pagesSize$}),this.viewer=new An({readonly$:i,pagesIndex$:this.pageRenderer._pagesIndex$,box:s,pages:r,playable:!1}),this.sideEffect.addDisposer([this.viewer.events.on("next",()=>{this.userScrollByPercent(.8)}),this.viewer.events.on("back",()=>{this.userScrollByPercent(-.8)})]),this.scrollbar=new Od({pagesScrollTop$:this.pagesScrollTop$,containerRect$:s._bodyRect$,stageRect$:s._stageRect$,pagesSize$:this.pagesSize$,readonly$:i,wrapClassName:this.wrapClassName.bind(this),onDragScroll:l=>{this.pageScrollTo(l),this.debounceOnUserScroll()}}),this.pageScrollStepper=new Dd({start:this.pagesScrollTop$.value,onStep:l=>{this.pageScrollTo(l)}}),this.sideEffect.addDisposer(this.viewer.events.on("jumpPage",l=>this.userScrollToPageIndex(l))),this.render(),this.setupScrollListener(),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100)}get pagesScrollTop(){return this.pagesScrollTop$.value}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this.onUserScroll=void 0,this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(e){!this.userScrolling&&e>=0&&Math.abs(this.pagesScrollTop$.value-e)>.01&&this.pageScrollStepper.stepTo(e,this.pagesScrollTop$.value)}render(){this.box.$content.style.overflow="hidden",this.box.mountStage(this.pageRenderer.$pages),this.scrollbar.mount(this.box.$body)}pageScrollTo(e){const i=this.whiteboard.view.size.height/2/this.pageRenderer.scale;this.whiteboard.view.moveCamera({centerY:Xe(e+i,i,this.pagesSize$.value.height-i),animationMode:"immediately"})}userScrollToPageIndex(e){var i;if(e=Xe(e,0,this.pages.length-1),!this.readonly$.value&&!Number.isNaN(e)){const s=this.pageRenderer.pagesYs[e];s>=0&&((i=this.onUserScroll)==null||i.call(this,s+5/this.pageRenderer.scale))}}userScrollByPercent(e){var i;this.readonly$.value||(i=this.onUserScroll)==null||i.call(this,Xe(this.pageRenderer.pagesScrollTop+this.pageRenderer.containerRect.height/this.pageRenderer.scale*Xe(e,-1,1),0,this.pageRenderer.pagesSize.height-this.pageRenderer.containerRect.height/this.pageRenderer.scale))}setupScrollListener(){this.sideEffect.addEventListener(this.box.$main,"wheel",e=>{kn(e),!this.readonly$.value&&this.pageScrollStepper.paused&&(this.pageScrollTo(this.pagesScrollTop+e.deltaY),this.debounceOnUserScroll())},{passive:!1}),this.sideEffect.addEventListener(this.box.$main,"touchmove",e=>{!this.readonly$.value&&e.touches.length>1&&this.debounceOnUserScroll()},{passive:!0,capture:!0}),this.sideEffect.add(()=>{const e=i=>{const{width:s,height:r}=this.whiteboard.view.size;if(s<=0||r<=0)return;const a=i.centerY-this.pageRenderer.containerRect.height/this.pageRenderer.scale/2;this.pagesScrollTop$.setValue(a)};return this.whiteboard.view.callbacks.on("onCameraUpdated",e),()=>this.whiteboard.view.callbacks.off("onCameraUpdated",e)}),this.sideEffect.addDisposer(this.box._stageRect$.subscribe(e=>{const{width:i,height:s}=this.pagesSize$.value;this.whiteboard.view.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:i,height:e.height/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboard.view.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:i/2,centerY:s/2,width:i,height:s})}),"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",e=>{if(!(this.readonly$.value||!this.box.focus||this.box.minimized))switch(e.key){case"PageDown":{this.userScrollByPercent(.8);break}case"PageUp":{this.userScrollByPercent(-.8);break}case"ArrowLeft":{this.userScrollByPercent(-.25);break}case"ArrowRight":{this.userScrollByPercent(.25);break}case"ArrowDown":{this.userScrollByPercent(.5);break}case"ArrowUp":{this.userScrollByPercent(-.5);break}}},{capture:!0})}wrapClassName(e){return"netless-app-docs-viewer-static-"+e}}class Wd{constructor({readonly$:e,context:i,whiteboard:s,box:r,pages:a}){this.sideEffect=new gt,this.context=i,this.whiteboard=s,this.box=r,this.pages=a;const n=new Fe(i.displayer.state.sceneState.index||0);this.pagesIndex$=n,this.sideEffect.add(()=>{const o=c=>{this.jumpToPage(c.index)};return this.context.emitter.on("sceneStateChange",o),()=>this.context.emitter.off("sceneStateChange",o)}),this.viewer=new An({readonly$:e,pagesIndex$:n,box:r,pages:a,playable:!0}),this.sideEffect.addDisposer([this.viewer.events.on("jumpPage",o=>this.jumpToPage(o,!0)),this.viewer.events.on("play",()=>{var o;return(o=this.context.room)==null?void 0:o.pptNextStep()}),this.viewer.events.on("back",()=>this.prevPage()),this.viewer.events.on("next",()=>this.nextPage())]),this.render(),this.sideEffect.addDisposer(n.subscribe((o,c)=>{var l,d;if(e.value)return;const u=this.context.getInitScenePath(),p=(d=(l=this.context.getScenes())==null?void 0:l[o])==null?void 0:d.name;if(u&&p&&this.context.setScenePath(`${u}/${p}`),c){const m=this.context.room;if(m){const g=m.state.globalState.__pptState;m.setGlobalState({__pptState:g&&{uuid:g.uuid,pageIndex:o,disableAutoPlay:g.disableAutoPlay}})}}}))}destroy(){this.sideEffect.flushAll(),this.viewer.destroy()}nextPage(){this.jumpToPage(this.pagesIndex$.value+1,!0)}prevPage(){this.jumpToPage(this.pagesIndex$.value-1,!0)}jumpToPage(e,i=!1){this.pagesIndex$.setValue(Xe(e,0,this.pages.length-1),i)}render(){var e;this.box.mountStage(document.createElement("div")),this.sideEffect.addEventListener(window,"keydown",s=>{var r;if(this.box.focus)switch(s.key){case"ArrowUp":case"ArrowLeft":{this.prevPage();break}case"ArrowRight":case"ArrowDown":{(r=this.context.room)==null||r.pptNextStep();break}}});const i=(e=this.whiteboard.view.divElement)==null?void 0:e.parentElement;i&&this.sideEffect.addEventListener(i,"click",s=>{var r;const a=this.context.room;if(a&&a.state.memberState.currentApplianceName==="clicker"){for(let n=s.target;n;n=n.parentElement)if((r=n.classList)!=null&&r.contains("ppt-event-source"))return;a.pptNextStep()}})}wrapClassName(e){return"netless-app-docs-viewer-dynamic-"+e}}const Hd="DocsViewer",_i={kind:Hd,setup(t){const e=t.box,i=t.getScenes();if(!i)throw new Error("[Docs Viewer]: scenes not found.");const s=new gt,r=i.map(({ppt:n})=>n?{width:n.width,height:n.height,src:n.src,thumbnail:n.previewURL}:null).filter(n=>Boolean(n));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");e.mountStyles(th);const a=new Fe(!t.isWritable);s.addDisposer(t.emitter.on("writableChange",n=>{a.setValue(!n)})),r[0].src.startsWith("ppt")?Zd(s,t,e,r,a):Fd(s,t,e,r,a),s.addDisposer(t.emitter.on("destroy",()=>{s.flushAll()}))}};function Fd(t,e,i,s,r){const a=e.createWhiteBoardView({syncCamera:!1});t.addDisposer(r.subscribe(l=>{a.view.disableCameraTransform=l}));const n=e.createStorage("static-docs-viewer",{pagesScrollTop:0}),o=new Ud({whiteboard:a,readonly$:r,box:i,pages:s,pagesScrollTop:n.state.pagesScrollTop,onUserScroll:l=>{e.isWritable&&n.setState({pagesScrollTop:l})}});t.addDisposer(()=>o.destroy()),t.addDisposer(n.addStateChangedListener(l=>{l.pagesScrollTop&&o.syncPageScrollTop(l.pagesScrollTop.newValue||0)}));let c=1;if(s.length>0){const{width:l,height:d}=s[0];d<=l?c=d/l:c=1/2*d/l}t.addDisposer(Pe([i._maximized$,i._managerStageRect$,i._intrinsicSize$],([l,d,u])=>l?c:u.height*(d.height/d.width)/u.width).subscribe(l=>{i.setStageRatio(l)}))}function Zd(t,e,i,s,r){const a=e.createWhiteBoardView();a.view.disableCameraTransform=!0;const n=new Wd({context:e,whiteboard:a,box:i,pages:s,readonly$:r});t.addDisposer(()=>n.destroy());const o=new Fe({width:s[0].width,height:s[0].height},{compare:Tn});if(t.addDisposer(n.pagesIndex$.subscribe(c=>{const l=s[c];l&&o.setValue({width:l.width,height:l.height})})),t.addDisposer(o.subscribe(c=>{r.value||a.setBaseRect(c)})),e.isAddApp){const c=t.add(()=>{const l=({width:d,height:u})=>{if(s.length>0&&i.state!=="maximized"){const{width:p,height:m}=s[0],f=m/p*d-u;f!==0&&e.isWritable&&e.emitter.emit("setBoxSize",{width:i.intrinsicWidth,height:i.intrinsicHeight+f/i.rootRect.height})}t.remove(c)};return a.view.callbacks.once("onSizeUpdated",l),()=>a.view.callbacks.off("onSizeUpdated",l)})}}function st(){}function Nn(t){return t()}function Kr(){return Object.create(null)}function Ri(t){t.forEach(Nn)}function Yd(t){return typeof t=="function"}function En(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let di;function Pn(t,e){return di||(di=document.createElement("a")),di.href=e,t===di.href}function Qd(t){return Object.keys(t).length===0}function V(t,e){t.appendChild(e)}function At(t,e,i){t.insertBefore(e,i||null)}function ft(t){t.parentNode.removeChild(t)}function Ct(t){return document.createElement(t)}function B(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Is(t){return document.createTextNode(t)}function Gd(){return Is(" ")}function I(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function qd(t){return Array.from(t.childNodes)}function Jd(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}let qt;function Wt(t){qt=t}function zn(){if(!qt)throw new Error("Function called outside component initialization");return qt}function Xd(t){zn().$$.on_mount.push(t)}function Kd(t){zn().$$.on_destroy.push(t)}const Lt=[],Ht=[],bi=[],ea=[],eu=Promise.resolve();let _s=!1;function tu(){_s||(_s=!0,eu.then(Dn))}function As(t){bi.push(t)}const os=new Set;let ui=0;function Dn(){const t=qt;do{for(;ui<Lt.length;){const e=Lt[ui];ui++,Wt(e),iu(e.$$)}for(Wt(null),Lt.length=0,ui=0;Ht.length;)Ht.pop()();for(let e=0;e<bi.length;e+=1){const i=bi[e];os.has(i)||(os.add(i),i())}bi.length=0}while(Lt.length);for(;ea.length;)ea.pop()();_s=!1,os.clear(),Wt(t)}function iu(t){if(t.fragment!==null){t.update(),Ri(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(As)}}const yi=new Set;let su;function Ln(t,e){t&&t.i&&(yi.delete(t),t.i(e))}function ru(t,e,i,s){if(t&&t.o){if(yi.has(t))return;yi.add(t),su.c.push(()=>{yi.delete(t),s&&(i&&t.d(1),s())}),t.o(e)}}function au(t){t&&t.c()}function Vn(t,e,i,s){const{fragment:r,on_mount:a,on_destroy:n,after_update:o}=t.$$;r&&r.m(e,i),s||As(()=>{const c=a.map(Nn).filter(Yd);n?n.push(...c):Ri(c),t.$$.on_mount=[]}),o.forEach(As)}function $n(t,e){const i=t.$$;i.fragment!==null&&(Ri(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function nu(t,e){t.$$.dirty[0]===-1&&(Lt.push(t),tu(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function jn(t,e,i,s,r,a,n,o=[-1]){const c=qt;Wt(t);const l=t.$$={fragment:null,ctx:null,props:a,update:st,not_equal:r,bound:Kr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Kr(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};n&&n(l.root);let d=!1;if(l.ctx=i?i(t,e.props||{},(u,p,...m)=>{const g=m.length?m[0]:p;return l.ctx&&r(l.ctx[u],l.ctx[u]=g)&&(!l.skip_bound&&l.bound[u]&&l.bound[u](g),d&&nu(t,u)),p}):[],l.update(),d=!0,Ri(l.before_update),l.fragment=s?s(l.ctx):!1,e.target){if(e.hydrate){const u=qd(e.target);l.fragment&&l.fragment.l(u),u.forEach(ft)}else l.fragment&&l.fragment.c();e.intro&&Ln(t.$$.fragment),Vn(t,e.target,e.anchor,e.customElement),Dn()}Wt(c)}class Bn{$destroy(){$n(this,1),this.$destroy=st}$on(e,i){const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(i),()=>{const r=s.indexOf(i);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Qd(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ou={"3g2":"video/3gpp2","3gp":"video/3gpp","3gpp":"audio/3gpp",aac:"audio/x-aac",adp:"audio/adpcm",aif:"audio/x-aiff",aifc:"audio/x-aiff",aiff:"audio/x-aiff",amr:"audio/amr",asf:"video/x-ms-asf",asx:"video/x-ms-asf",au:"audio/basic",avi:"video/x-msvideo",caf:"audio/x-caf",dra:"audio/vnd.dra",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",dvb:"video/vnd.dvb.file",eol:"audio/vnd.digital-winds",f4v:"video/x-f4v",flac:"audio/x-flac",fli:"video/x-fli",flv:"video/x-flv",fvt:"video/vnd.fvt",h261:"video/h261",h263:"video/h263",h264:"video/h264",jpgm:"video/jpm",jpgv:"video/jpeg",kar:"audio/midi",lvp:"audio/vnd.lucent.voice",m1v:"video/mpeg",m2a:"audio/mpeg",m2v:"video/mpeg",m3a:"audio/mpeg",m3u:"audio/x-mpegurl",m4a:"audio/mp4",m4s:"video/iso.segment",m4u:"video/vnd.mpegurl",m4v:"video/x-m4v",mid:"audio/midi",midi:"audio/midi",mj2:"video/mj2",mjp2:"video/mj2",mk3d:"video/x-matroska",mka:"audio/x-matroska",mks:"video/x-matroska",mkv:"video/x-matroska",mng:"video/x-mng",mov:"video/quicktime",movie:"video/x-sgi-movie",mp2:"audio/mpeg",mp2a:"audio/mpeg",mp3:"audio/mp3",mp4:"video/mp4",mp4a:"audio/mp4",mp4v:"video/mp4",mpe:"video/mpeg",mpeg:"video/mpeg",mpg:"video/mpeg",mpg4:"video/mp4",mpga:"audio/mpeg",mxmf:"audio/mobile-xmf",mxu:"video/vnd.mpegurl",oga:"audio/ogg",ogg:"audio/ogg",ogv:"video/ogg",opus:"audio/ogg",pya:"audio/vnd.ms-playready.media.pya",pyv:"video/vnd.ms-playready.media.pyv",qt:"video/quicktime",ra:"audio/x-pn-realaudio",ram:"audio/x-pn-realaudio",rip:"audio/vnd.rip",rmi:"audio/midi",rmp:"audio/x-pn-realaudio-plugin",s3m:"audio/s3m",sil:"audio/silk",smv:"video/x-smv",snd:"audio/basic",spx:"audio/ogg",ts:"video/mp2t",uva:"audio/vnd.dece.audio",uvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvu:"video/vnd.uvvu.mp4",uvv:"video/vnd.dece.video",uvva:"audio/vnd.dece.audio",uvvh:"video/vnd.dece.hd",uvvm:"video/vnd.dece.mobile",uvvp:"video/vnd.dece.pd",uvvs:"video/vnd.dece.sd",uvvu:"video/vnd.uvvu.mp4",uvvv:"video/vnd.dece.video",viv:"video/vnd.vivo",vob:"video/x-ms-vob",wav:"audio/wav",wax:"audio/x-ms-wax",weba:"audio/webm",webm:"video/webm",wm:"video/x-ms-wm",wma:"audio/x-ms-wma",wmv:"video/x-ms-wmv",wmx:"video/x-ms-wmx",wvx:"video/x-ms-wvx",xm:"audio/xm",m3u8:"application/vnd.apple.mpegurl"},lu=["application/x-mpegurl","application/vnd.apple.mpegurl"];function cu(t){if(!t)return;const e=t.lastIndexOf(".");if(!~e)return;const i=t.slice(e+1);return ou[i]}async function hu(t){try{return await t.play(),!0}catch(e){return t.muted=!0,await t.play(),console.debug(e),!1}}function du(t){const e=document.createElement("script");return new Promise((i,s)=>{e.onload=()=>i(),e.onerror=s,e.src=t,document.head.appendChild(e)})}async function uu(){const t={loadSource(i){},attachMedia(i){}};let e=window.Hls;if(e===null||e===!1)return t;if(e===void 0&&(await du("https://cdn.jsdelivr.net/npm/hls.js"),e=window.Hls),typeof e=="function")try{return new e}catch(i){return console.debug(i),t}else return t}function pu(t){return"canPlayType"in t&&!t.canPlayType("application/vnd.apple.mpegurl")}function gu(t,e,i){return t<e?e:t>i?i:t}function mu(t){return Array.isArray(t)?t[0]:t}function fu(t){let e,i,s,r,a,n,o,c,l,d,u,p,m,g,f,b,v,x,y,k,z,T,O,te,G,xe,Re,me,Ie,fe,_e,be,ye,Me,Ae,Se,ot,Oe;return{c(){e=B("svg"),i=B("symbol"),s=B("path"),r=B("path"),a=B("symbol"),n=B("path"),o=B("symbol"),c=B("path"),l=B("symbol"),d=B("path"),u=B("symbol"),p=B("path"),m=B("symbol"),g=B("path"),f=B("symbol"),b=B("path"),v=B("symbol"),x=B("path"),y=B("symbol"),k=B("path"),z=B("symbol"),T=B("path"),O=B("symbol"),te=B("path"),G=B("symbol"),xe=B("path"),Re=B("path"),me=B("symbol"),Ie=B("path"),fe=B("symbol"),_e=B("path"),be=B("symbol"),ye=B("path"),Me=B("symbol"),Ae=B("path"),Se=B("symbol"),ot=B("path"),Oe=B("path"),I(s,"d","M16 1H2a1 1 0 00-1 1v10a1 1 0 001 1h3v-2H3V3h12v8h-2v2h3a1 1 0 001-1V2a1 1 0 00-1-1z"),I(r,"d","M4 17h10l-5-6z"),I(i,"id","plyr-airplay"),I(i,"viewBox","0 0 18 18"),I(n,"d","M1 1c-.6 0-1 .4-1 1v11c0 .6.4 1 1 1h4.6l2.7 2.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3l2.7-2.7H17c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1H1zm4.52 10.15c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41C8.47 4.96 7.46 3.76 5.5 3.76c-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69zm7.57 0c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41c-.28-1.15-1.29-2.35-3.25-2.35-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69z"),I(n,"fill-rule","evenodd"),I(n,"fill-opacity",".5"),I(a,"id","plyr-captions-off"),I(a,"viewBox","0 0 18 18"),I(c,"d","M1 1c-.6 0-1 .4-1 1v11c0 .6.4 1 1 1h4.6l2.7 2.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3l2.7-2.7H17c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1H1zm4.52 10.15c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41C8.47 4.96 7.46 3.76 5.5 3.76c-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69zm7.57 0c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41c-.28-1.15-1.29-2.35-3.25-2.35-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69z"),I(c,"fill-rule","evenodd"),I(o,"id","plyr-captions-on"),I(o,"viewBox","0 0 18 18"),I(d,"d","M9 13c.3 0 .5-.1.7-.3L15.4 7 14 5.6l-4 4V1H8v8.6l-4-4L2.6 7l5.7 5.7c.2.2.4.3.7.3zm-7 2h14v2H2z"),I(l,"id","plyr-download"),I(l,"viewBox","0 0 18 18"),I(p,"d","M10 3h3.6l-4 4L11 8.4l4-4V8h2V1h-7zM7 9.6l-4 4V10H1v7h7v-2H4.4l4-4z"),I(u,"id","plyr-enter-fullscreen"),I(u,"viewBox","0 0 18 18"),I(g,"d","M1 12h3.6l-4 4L2 17.4l4-4V17h2v-7H1zM16 .6l-4 4V1h-2v7h7V6h-3.6l4-4z"),I(m,"id","plyr-exit-fullscreen"),I(m,"viewBox","0 0 18 18"),I(b,"d","M7.875 7.171L0 1v16l7.875-6.171V17L18 9 7.875 1z"),I(f,"id","plyr-fast-forward"),I(f,"viewBox","0 0 18 18"),I(x,"d","M17 5.3c-.1 1.6-1.2 3.7-3.3 6.4-2.2 2.8-4 4.2-5.5 4.2-.9 0-1.7-.9-2.4-2.6C5 10.9 4.4 6 3 6c-.1 0-.5.3-1.2.8l-.8-1c.8-.7 3.5-3.4 4.7-3.5 1.2-.1 2 .7 2.3 2.5.3 2 .8 6.1 1.8 6.1.9 0 2.5-3.4 2.6-4 .1-.9-.3-1.9-2.3-1.1.8-2.6 2.3-3.8 4.5-3.8 1.7.1 2.5 1.2 2.4 3.3z"),I(v,"id","plyr-logo-vimeo"),I(v,"viewBox","0 0 18 18"),I(k,"d","M16.8 5.8c-.2-1.3-.8-2.2-2.2-2.4C12.4 3 9 3 9 3s-3.4 0-5.6.4C2 3.6 1.3 4.5 1.2 5.8 1 7.1 1 9 1 9s0 1.9.2 3.2c.2 1.3.8 2.2 2.2 2.4C5.6 15 9 15 9 15s3.4 0 5.6-.4c1.4-.3 2-1.1 2.2-2.4.2-1.3.2-3.2.2-3.2s0-1.9-.2-3.2zM7 12V6l5 3-5 3z"),I(y,"id","plyr-logo-youtube"),I(y,"viewBox","0 0 18 18"),I(T,"d","M12.4 12.5l2.1-2.1 2.1 2.1 1.4-1.4L15.9 9 18 6.9l-1.4-1.4-2.1 2.1-2.1-2.1L11 6.9 13.1 9 11 11.1zM3.786 6.008H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601L3.786 6.008z"),I(z,"id","plyr-muted"),I(z,"viewBox","0 0 18 18"),I(te,"d","M6 1H3c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1zm6 0c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1h-3z"),I(O,"id","plyr-pause"),I(O,"viewBox","0 0 18 18"),I(xe,"d","M13.293 3.293L7.022 9.564l1.414 1.414 6.271-6.271L17 7V1h-6z"),I(Re,"d","M13 15H3V5h5V3H2a1 1 0 00-1 1v12a1 1 0 001 1h12a1 1 0 001-1v-6h-2v5z"),I(G,"id","plyr-pip"),I(G,"viewBox","0 0 18 18"),I(Ie,"d","M15.562 8.1L3.87.225c-.818-.562-1.87 0-1.87.9v15.75c0 .9 1.052 1.462 1.87.9L15.563 9.9c.584-.45.584-1.35 0-1.8z"),I(me,"id","plyr-play"),I(me,"viewBox","0 0 18 18"),I(_e,"d","M9.7 1.2l.7 6.4 2.1-2.1c1.9 1.9 1.9 5.1 0 7-.9 1-2.2 1.5-3.5 1.5-1.3 0-2.6-.5-3.5-1.5-1.9-1.9-1.9-5.1 0-7 .6-.6 1.4-1.1 2.3-1.3l-.6-1.9C6 2.6 4.9 3.2 4 4.1 1.3 6.8 1.3 11.2 4 14c1.3 1.3 3.1 2 4.9 2 1.9 0 3.6-.7 4.9-2 2.7-2.7 2.7-7.1 0-9.9L16 1.9l-6.3-.7z"),I(fe,"id","plyr-restart"),I(fe,"viewBox","0 0 18 18"),I(ye,"d","M10.125 1L0 9l10.125 8v-6.171L18 17V1l-7.875 6.171z"),I(be,"id","plyr-rewind"),I(be,"viewBox","0 0 18 18"),I(Ae,"d","M16.135 7.784a2 2 0 01-1.23-2.969c.322-.536.225-.998-.094-1.316l-.31-.31c-.318-.318-.78-.415-1.316-.094a2 2 0 01-2.969-1.23C10.065 1.258 9.669 1 9.219 1h-.438c-.45 0-.845.258-.997.865a2 2 0 01-2.969 1.23c-.536-.322-.999-.225-1.317.093l-.31.31c-.318.318-.415.781-.093 1.317a2 2 0 01-1.23 2.969C1.26 7.935 1 8.33 1 8.781v.438c0 .45.258.845.865.997a2 2 0 011.23 2.969c-.322.536-.225.998.094 1.316l.31.31c.319.319.782.415 1.316.094a2 2 0 012.969 1.23c.151.607.547.865.997.865h.438c.45 0 .845-.258.997-.865a2 2 0 012.969-1.23c.535.321.997.225 1.316-.094l.31-.31c.318-.318.415-.781.094-1.316a2 2 0 011.23-2.969c.607-.151.865-.547.865-.997v-.438c0-.451-.26-.846-.865-.997zM9 12a3 3 0 110-6 3 3 0 010 6z"),I(Me,"id","plyr-settings"),I(Me,"viewBox","0 0 18 18"),I(ot,"d","M15.6 3.3c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4C15.4 5.9 16 7.4 16 9c0 1.6-.6 3.1-1.8 4.3-.4.4-.4 1 0 1.4.2.2.5.3.7.3.3 0 .5-.1.7-.3C17.1 13.2 18 11.2 18 9s-.9-4.2-2.4-5.7z"),I(Oe,"d","M11.282 5.282a.909.909 0 000 1.316c.735.735.995 1.458.995 2.402 0 .936-.425 1.917-.995 2.487a.909.909 0 000 1.316c.145.145.636.262 1.018.156a.725.725 0 00.298-.156C13.773 11.733 14.13 10.16 14.13 9c0-.17-.002-.34-.011-.51-.053-.992-.319-2.005-1.522-3.208a.909.909 0 00-1.316 0zm-7.496.726H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601L3.786 6.008z"),I(Se,"id","plyr-volume"),I(Se,"viewBox","0 0 18 18"),I(e,"xmlns","http://www.w3.org/2000/svg"),I(e,"xmlns:xlink","http://www.w3.org/1999/xlink")},m(Qe,bt){At(Qe,e,bt),V(e,i),V(i,s),V(i,r),V(e,a),V(a,n),V(e,o),V(o,c),V(e,l),V(l,d),V(e,u),V(u,p),V(e,m),V(m,g),V(e,f),V(f,b),V(e,v),V(v,x),V(e,y),V(y,k),V(e,z),V(z,T),V(e,O),V(O,te),V(e,G),V(G,xe),V(G,Re),V(e,me),V(me,Ie),V(e,fe),V(fe,_e),V(e,be),V(be,ye),V(e,Me),V(Me,Ae),V(e,Se),V(Se,ot),V(Se,Oe)},p:st,i:st,o:st,d(Qe){Qe&&ft(e)}}}class bu extends Bn{constructor(e){super();jn(this,e,null,fu,En,{})}}function _(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function yu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ta(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function wu(t,e,i){return e&&ta(t.prototype,e),i&&ta(t,i),t}function vu(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ia(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,s)}return i}function sa(t){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?ia(Object(i),!0).forEach(function(s){vu(t,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ia(Object(i)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(i,s))})}return t}var ra={addCSS:!0,thumbWidth:15,watch:!0};function xu(t,e){return function(){return Array.from(document.querySelectorAll(e)).includes(this)}.call(t,e)}function Mu(t,e){if(t&&e){var i=new Event(e,{bubbles:!0});t.dispatchEvent(i)}}var si=function(t){return t!=null?t.constructor:null},lr=function(t,e){return!!(t&&e&&t instanceof e)},Rn=function(t){return t==null},On=function(t){return si(t)===Object},Su=function(t){return si(t)===Number&&!Number.isNaN(t)},Un=function(t){return si(t)===String},Cu=function(t){return si(t)===Boolean},Iu=function(t){return si(t)===Function},Wn=function(t){return Array.isArray(t)},Hn=function(t){return lr(t,NodeList)},_u=function(t){return lr(t,Element)},Au=function(t){return lr(t,Event)},ku=function(t){return Rn(t)||(Un(t)||Wn(t)||Hn(t))&&!t.length||On(t)&&!Object.keys(t).length},ae={nullOrUndefined:Rn,object:On,number:Su,string:Un,boolean:Cu,function:Iu,array:Wn,nodeList:Hn,element:_u,event:Au,empty:ku};function Tu(t){var e="".concat(t).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0}function Nu(t,e){if(1>e){var i=Tu(e);return parseFloat(t.toFixed(i))}return Math.round(t/e)*e}var Eu=function(){function t(e,i){yu(this,t),ae.element(e)?this.element=e:ae.string(e)&&(this.element=document.querySelector(e)),ae.element(this.element)&&ae.empty(this.element.rangeTouch)&&(this.config=sa({},ra,{},i),this.init())}return wu(t,[{key:"init",value:function(){t.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){t.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var i=this,s=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(r){i.element[s](r,function(a){return i.set(a)},!1)})}},{key:"get",value:function(e){if(!t.enabled||!ae.event(e))return null;var i,s=e.target,r=e.changedTouches[0],a=parseFloat(s.getAttribute("min"))||0,n=parseFloat(s.getAttribute("max"))||100,o=parseFloat(s.getAttribute("step"))||1,c=s.getBoundingClientRect(),l=100/c.width*(this.config.thumbWidth/2)/100;return 0>(i=100/c.width*(r.clientX-c.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*l:50<i&&(i+=2*(i-50)*l),a+Nu(i/100*(n-a),o)}},{key:"set",value:function(e){t.enabled&&ae.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),Mu(e.target,e.type==="touchend"?"change":"input"))}}],[{key:"setup",value:function(e){var i=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},s=null;if(ae.empty(e)||ae.string(e)?s=Array.from(document.querySelectorAll(ae.string(e)?e:'input[type="range"]')):ae.element(e)?s=[e]:ae.nodeList(e)?s=Array.from(e):ae.array(e)&&(s=e.filter(ae.element)),ae.empty(s))return null;var r=sa({},ra,{},i);if(ae.string(e)&&r.watch){var a=new MutationObserver(function(n){Array.from(n).forEach(function(o){Array.from(o.addedNodes).forEach(function(c){ae.element(c)&&xu(c,e)&&new t(c,r)})})});a.observe(document.body,{childList:!0,subtree:!0})}return s.map(function(n){return new t(n,i)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),t}();const kt=t=>t!=null?t.constructor:null,Ye=(t,e)=>Boolean(t&&e&&t instanceof e),cr=t=>t==null,Fn=t=>kt(t)===Object,Pu=t=>kt(t)===Number&&!Number.isNaN(t),Oi=t=>kt(t)===String,zu=t=>kt(t)===Boolean,Zn=t=>kt(t)===Function,Yn=t=>Array.isArray(t),Du=t=>Ye(t,WeakMap),Qn=t=>Ye(t,NodeList),Lu=t=>kt(t)===Text,Vu=t=>Ye(t,Event),$u=t=>Ye(t,KeyboardEvent),ju=t=>Ye(t,window.TextTrackCue)||Ye(t,window.VTTCue),Bu=t=>Ye(t,TextTrack)||!cr(t)&&Oi(t.kind),Ru=t=>Ye(t,Promise)&&Zn(t.then),Ou=t=>t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object",Gn=t=>cr(t)||(Oi(t)||Yn(t)||Qn(t))&&!t.length||Fn(t)&&!Object.keys(t).length,Uu=t=>{if(Ye(t,window.URL))return!0;if(!Oi(t))return!1;let e=t;t.startsWith("http://")&&t.startsWith("https://")||(e=`http://${t}`);try{return!Gn(new URL(e).hostname)}catch{return!1}};var h={nullOrUndefined:cr,object:Fn,number:Pu,string:Oi,boolean:zu,function:Zn,array:Yn,weakMap:Du,nodeList:Qn,element:Ou,textNode:Lu,event:Vu,keyboardEvent:$u,cue:ju,track:Bu,promise:Ru,url:Uu,empty:Gn};const ks=(()=>{const t=document.createElement("span"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(e).find(s=>t.style[s]!==void 0);return!!h.string(i)&&e[i]})();function qn(t,e){setTimeout(()=>{try{t.hidden=!0,t.offsetHeight,t.hidden=!1}catch{}},e)}const re={isIE:Boolean(window.document.documentMode),isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1||/(iPad|iPhone|iPod)/gi.test(navigator.platform)};function Wu(t){return JSON.parse(JSON.stringify(t))}function Jn(t,e){return e.split(".").reduce((i,s)=>i&&i[s],t)}function J(t={},...e){if(!e.length)return t;const i=e.shift();return h.object(i)?(Object.keys(i).forEach(s=>{h.object(i[s])?(Object.keys(t).includes(s)||Object.assign(t,{[s]:{}}),J(t[s],i[s])):Object.assign(t,{[s]:i[s]})}),J(t,...e)):t}function Xn(t,e){const i=t.length?t:[t];Array.from(i).reverse().forEach((s,r)=>{const a=r>0?e.cloneNode(!0):e,n=s.parentNode,o=s.nextSibling;a.appendChild(s),o?n.insertBefore(a,o):n.appendChild(a)})}function Ts(t,e){h.element(t)&&!h.empty(e)&&Object.entries(e).filter(([,i])=>!h.nullOrUndefined(i)).forEach(([i,s])=>t.setAttribute(i,s))}function N(t,e,i){const s=document.createElement(t);return h.object(e)&&Ts(s,e),h.string(i)&&(s.innerText=i),s}function Hu(t,e){h.element(t)&&h.element(e)&&e.parentNode.insertBefore(t,e.nextSibling)}function aa(t,e,i,s){h.element(e)&&e.appendChild(N(t,i,s))}function He(t){h.nodeList(t)||h.array(t)?Array.from(t).forEach(He):h.element(t)&&h.element(t.parentNode)&&t.parentNode.removeChild(t)}function wi(t){if(!h.element(t))return;let{length:e}=t.childNodes;for(;e>0;)t.removeChild(t.lastChild),e-=1}function Ai(t,e){return h.element(e)&&h.element(e.parentNode)&&h.element(t)?(e.parentNode.replaceChild(t,e),t):null}function Le(t,e){if(!h.string(t)||h.empty(t))return{};const i={},s=J({},e);return t.split(",").forEach(r=>{const a=r.trim(),n=a.replace(".",""),o=a.replace(/[[\]]/g,"").split("="),[c]=o,l=o.length>1?o[1].replace(/["']/g,""):"";switch(a.charAt(0)){case".":h.string(s.class)?i.class=`${s.class} ${n}`:i.class=n;break;case"#":i.id=a.replace("#","");break;case"[":i[c]=l}}),J(s,i)}function ct(t,e){if(!h.element(t))return;let i=e;h.boolean(i)||(i=!t.hidden),t.hidden=i}function W(t,e,i){if(h.nodeList(t))return Array.from(t).map(s=>W(s,e,i));if(h.element(t)){let s="toggle";return i!==void 0&&(s=i?"add":"remove"),t.classList[s](e),t.classList.contains(e)}return!1}function ki(t,e){return h.element(t)&&t.classList.contains(e)}function ht(t,e){const{prototype:i}=Element;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(e)).includes(this)}).call(t,e)}function Fu(t,e){const{prototype:i}=Element;return(i.closest||function(){let s=this;do{if(ht.matches(s,e))return s;s=s.parentElement||s.parentNode}while(s!==null&&s.nodeType===1);return null}).call(t,e)}function xt(t){return this.elements.container.querySelectorAll(t)}function X(t){return this.elements.container.querySelector(t)}function ls(t=null,e=!1){h.element(t)&&(t.focus({preventScroll:!0}),e&&W(t,this.config.classNames.tabFocus))}const na={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},q={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(t,e,i){const s=re.isIPhone&&i&&q.playsinline,r=q[t]||e!=="html5";return{api:r,ui:r&&q.rangeInput&&(t!=="video"||!re.isIPhone||s)}},pip:!(re.isIPhone||!h.function(N("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||N("video").disablePictureInPicture)),airplay:h.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(t){if(h.empty(t))return!1;const[e]=t.split("/");let i=t;if(!this.isHTML5||e!==this.type)return!1;Object.keys(na).includes(i)&&(i+=`; codecs="${na[t]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch{return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const t=document.createElement("input");return t.type="range",t.type==="range"})(),touch:"ontouchstart"in document.documentElement,transitions:ks!==!1,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Zu=(()=>{let t=!1;try{const e=Object.defineProperty({},"passive",{get:()=>(t=!0,null)});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch{}return t})();function Mt(t,e,i,s=!1,r=!0,a=!1){if(!t||!("addEventListener"in t)||h.empty(e)||!h.function(i))return;const n=e.split(" ");let o=a;Zu&&(o={passive:r,capture:a}),n.forEach(c=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:t,type:c,callback:i,options:o}),t[s?"addEventListener":"removeEventListener"](c,i,o)})}function H(t,e="",i,s=!0,r=!1){Mt.call(this,t,e,i,!0,s,r)}function Ui(t,e="",i,s=!0,r=!1){Mt.call(this,t,e,i,!1,s,r)}function hr(t,e="",i,s=!0,r=!1){const a=(...n)=>{Ui(t,e,a,s,r),i.apply(this,n)};Mt.call(this,t,e,a,!0,s,r)}function E(t,e="",i=!1,s={}){if(!h.element(t)||h.empty(e))return;const r=new CustomEvent(e,{bubbles:i,detail:oe(j({},s),{plyr:this})});t.dispatchEvent(r)}function Yu(){this&&this.eventListeners&&(this.eventListeners.forEach(t=>{const{element:e,type:i,callback:s,options:r}=t;e.removeEventListener(i,s,r)}),this.eventListeners=[])}function Qu(){return new Promise(t=>this.ready?setTimeout(t,0):H.call(this,this.elements.container,"ready",t)).then(()=>{})}function Be(t){h.promise(t)&&t.then(null,()=>{})}function Ns(t){return h.array(t)?t.filter((e,i)=>t.indexOf(e)===i):t}function Kn(t,e){return h.array(t)&&t.length?t.reduce((i,s)=>Math.abs(s-e)<Math.abs(i-e)?s:i):null}function eo(t){return!(!window||!window.CSS)&&window.CSS.supports(t)}const oa=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce((t,[e,i])=>oe(j({},t),{[e/i]:[e,i]}),{});function to(t){return h.array(t)||h.string(t)&&t.includes(":")?(h.array(t)?t:t.split(":")).map(Number).every(h.number):!1}function Ti(t){if(!h.array(t)||!t.every(h.number))return null;const[e,i]=t,s=(a,n)=>n===0?a:s(n,a%n),r=s(e,i);return[e/r,i/r]}function dr(t){const e=s=>to(s)?s.split(":").map(Number):null;let i=e(t);if(i===null&&(i=e(this.config.ratio)),i===null&&!h.empty(this.embed)&&h.array(this.embed.ratio)&&({ratio:i}=this.embed),i===null&&this.isHTML5){const{videoWidth:s,videoHeight:r}=this.media;i=[s,r]}return Ti(i)}function It(t){if(!this.isVideo)return{};const{wrapper:e}=this.elements,i=dr.call(this,t);if(!h.array(i))return{};const[s,r]=Ti(i),a=100/s*r;if(eo(`aspect-ratio: ${s}/${r}`)?e.style.aspectRatio=`${s}/${r}`:e.style.paddingBottom=`${a}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const n=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),o=(n-a)/(n/50);this.fullscreen.active?e.style.paddingBottom=null:this.media.style.transform=`translateY(-${o}%)`}else this.isHTML5&&e.classList.add(this.config.classNames.videoFixedRatio);return{padding:a,ratio:i}}function io(t,e,i=.05){const s=t/e,r=Kn(Object.keys(oa),s);return Math.abs(r-s)<=i?oa[r]:[t,e]}function Gu(){return[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)]}const Ke={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter(t=>{const e=t.getAttribute("type");return!!h.empty(e)||q.mime.call(this,e)}):[]},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:Ke.getSources.call(this).map(t=>Number(t.getAttribute("size"))).filter(Boolean)},setup(){if(!this.isHTML5)return;const t=this;t.options.speed=t.config.speed.options,h.empty(this.config.ratio)||It.call(t),Object.defineProperty(t.media,"quality",{get(){const e=Ke.getSources.call(t).find(i=>i.getAttribute("src")===t.source);return e&&Number(e.getAttribute("size"))},set(e){if(t.quality!==e){if(t.config.quality.forced&&h.function(t.config.quality.onChange))t.config.quality.onChange(e);else{const i=Ke.getSources.call(t).find(c=>Number(c.getAttribute("size"))===e);if(!i)return;const{currentTime:s,paused:r,preload:a,readyState:n,playbackRate:o}=t.media;t.media.src=i.getAttribute("src"),(a!=="none"||n)&&(t.once("loadedmetadata",()=>{t.speed=o,t.currentTime=s,r||Be(t.play())}),t.media.load())}E.call(t,t.media,"qualitychange",!1,{quality:e})}}})},cancelRequests(){this.isHTML5&&(He(Ke.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function qu(t){return`${t}-${Math.floor(1e4*Math.random())}`}function Es(t,...e){return h.empty(t)?t:t.toString().replace(/{(\d+)}/g,(i,s)=>e[s].toString())}function Ju(t,e){return t===0||e===0||Number.isNaN(t)||Number.isNaN(e)?0:(t/e*100).toFixed(2)}const Ft=(t="",e="",i="")=>t.replace(new RegExp(e.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString()),so=(t="")=>t.toString().replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase());function Xu(t=""){let e=t.toString();return e=Ft(e,"-"," "),e=Ft(e,"_"," "),e=so(e),Ft(e," ","")}function Ku(t=""){let e=t.toString();return e=Xu(e),e.charAt(0).toLowerCase()+e.slice(1)}function ep(t){const e=document.createDocumentFragment(),i=document.createElement("div");return e.appendChild(i),i.innerHTML=t,e.firstChild.innerText}function tp(t){const e=document.createElement("div");return e.appendChild(t),e.innerHTML}const la={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},K={get(t="",e={}){if(h.empty(t)||h.empty(e))return"";let i=Jn(e.i18n,t);if(h.empty(i))return Object.keys(la).includes(t)?la[t]:"";const s={"{seektime}":e.seekTime,"{title}":e.title};return Object.entries(s).forEach(([r,a])=>{i=Ft(i,r,a)}),i}};class Jt{constructor(e){_(this,"get",i=>{if(!Jt.supported||!this.enabled)return null;const s=window.localStorage.getItem(this.key);if(h.empty(s))return null;const r=JSON.parse(s);return h.string(i)&&i.length?r[i]:r}),_(this,"set",i=>{if(!Jt.supported||!this.enabled||!h.object(i))return;let s=this.get();h.empty(s)&&(s={}),J(s,i);try{window.localStorage.setItem(this.key,JSON.stringify(s))}catch{}}),this.enabled=e.config.storage.enabled,this.key=e.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}}function ri(t,e="text"){return new Promise((i,s)=>{try{const r=new XMLHttpRequest;if(!("withCredentials"in r))return;r.addEventListener("load",()=>{if(e==="text")try{i(JSON.parse(r.responseText))}catch{i(r.responseText)}else i(r.response)}),r.addEventListener("error",()=>{throw new Error(r.status)}),r.open("GET",t,!0),r.responseType=e,r.send()}catch(r){s(r)}})}function ro(t,e){if(!h.string(t))return;const i=h.string(e);let s=!1;const r=()=>document.getElementById(e)!==null,a=(n,o)=>{n.innerHTML=o,i&&r()||document.body.insertAdjacentElement("afterbegin",n)};if(!i||!r()){const n=Jt.supported,o=document.createElement("div");if(o.setAttribute("hidden",""),i&&o.setAttribute("id",e),n){const c=window.localStorage.getItem(`cache-${e}`);if(s=c!==null,s){const l=JSON.parse(c);a(o,l.content)}}ri(t).then(c=>{if(!h.empty(c)){if(n)try{window.localStorage.setItem(`cache-${e}`,JSON.stringify({content:c}))}catch{}a(o,c)}}).catch(()=>{})}}const ao=t=>Math.trunc(t/60/60%60,10),ip=t=>Math.trunc(t%60,10);function Wi(t=0,e=!1,i=!1){if(!h.number(t))return Wi(void 0,e,i);const s=c=>`0${c}`.slice(-2);let r=ao(t);const a=(n=t,Math.trunc(n/60%60,10));var n;const o=ip(t);return r=e||r>0?`${r}:`:"",`${i&&t>0?"-":""}${r}${s(a)}:${s(o)}`}const S={getIconUrl(){const t=new URL(this.config.iconUrl,window.location),e=window.location.host?window.location.host:window.top.location.host,i=t.host!==e||re.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:i}},findElements(){try{return this.elements.controls=X.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:xt.call(this,this.config.selectors.buttons.play),pause:X.call(this,this.config.selectors.buttons.pause),restart:X.call(this,this.config.selectors.buttons.restart),rewind:X.call(this,this.config.selectors.buttons.rewind),fastForward:X.call(this,this.config.selectors.buttons.fastForward),mute:X.call(this,this.config.selectors.buttons.mute),pip:X.call(this,this.config.selectors.buttons.pip),airplay:X.call(this,this.config.selectors.buttons.airplay),settings:X.call(this,this.config.selectors.buttons.settings),captions:X.call(this,this.config.selectors.buttons.captions),fullscreen:X.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=X.call(this,this.config.selectors.progress),this.elements.inputs={seek:X.call(this,this.config.selectors.inputs.seek),volume:X.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:X.call(this,this.config.selectors.display.buffer),currentTime:X.call(this,this.config.selectors.display.currentTime),duration:X.call(this,this.config.selectors.display.duration)},h.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(t){return this.debug.warn("It looks like there is a problem with your custom controls HTML",t),this.toggleNativeControls(!0),!1}},createIcon(t,e){const i="http://www.w3.org/2000/svg",s=S.getIconUrl.call(this),r=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");Ts(a,J(e,{"aria-hidden":"true",focusable:"false"}));const n=document.createElementNS(i,"use"),o=`${r}-${t}`;return"href"in n&&n.setAttributeNS("http://www.w3.org/1999/xlink","href",o),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),a.appendChild(n),a},createLabel(t,e={}){const i=K.get(t,this.config);return N("span",oe(j({},e),{class:[e.class,this.config.classNames.hidden].filter(Boolean).join(" ")}),i)},createBadge(t){if(h.empty(t))return null;const e=N("span",{class:this.config.classNames.menu.value});return e.appendChild(N("span",{class:this.config.classNames.menu.badge},t)),e},createButton(t,e){const i=J({},e);let s=Ku(t);const r={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(n=>{Object.keys(i).includes(n)&&(r[n]=i[n],delete i[n])}),r.element!=="button"||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some(n=>n===this.config.classNames.control)||J(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,t){case"play":r.toggle=!0,r.label="play",r.labelPressed="pause",r.icon="play",r.iconPressed="pause";break;case"mute":r.toggle=!0,r.label="mute",r.labelPressed="unmute",r.icon="volume",r.iconPressed="muted";break;case"captions":r.toggle=!0,r.label="enableCaptions",r.labelPressed="disableCaptions",r.icon="captions-off",r.iconPressed="captions-on";break;case"fullscreen":r.toggle=!0,r.label="enterFullscreen",r.labelPressed="exitFullscreen",r.icon="enter-fullscreen",r.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,s="play",r.label="play",r.icon="play";break;default:h.empty(r.label)&&(r.label=s),h.empty(r.icon)&&(r.icon=t)}const a=N(r.element);return r.toggle?(a.appendChild(S.createIcon.call(this,r.iconPressed,{class:"icon--pressed"})),a.appendChild(S.createIcon.call(this,r.icon,{class:"icon--not-pressed"})),a.appendChild(S.createLabel.call(this,r.labelPressed,{class:"label--pressed"})),a.appendChild(S.createLabel.call(this,r.label,{class:"label--not-pressed"}))):(a.appendChild(S.createIcon.call(this,r.icon)),a.appendChild(S.createLabel.call(this,r.label))),J(i,Le(this.config.selectors.buttons[s],i)),Ts(a,i),s==="play"?(h.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(a)):this.elements.buttons[s]=a,a},createRange(t,e){const i=N("input",J(Le(this.config.selectors.inputs[t]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":K.get(t,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},e));return this.elements.inputs[t]=i,S.updateRangeFill.call(this,i),Eu.setup(i),i},createProgress(t,e){const i=N("progress",J(Le(this.config.selectors.display[t]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},e));if(t!=="volume"){i.appendChild(N("span",null,"0"));const s={played:"played",buffer:"buffered"}[t],r=s?K.get(s,this.config):"";i.innerText=`% ${r.toLowerCase()}`}return this.elements.display[t]=i,i},createTime(t,e){const i=Le(this.config.selectors.display[t],e),s=N("div",J(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":K.get(t,this.config)}),"00:00");return this.elements.display[t]=s,s},bindMenuItemShortcuts(t,e){H.call(this,t,"keydown keyup",i=>{if(!["Space","ArrowUp","ArrowDown","ArrowRight"].includes(i.key)||(i.preventDefault(),i.stopPropagation(),i.type==="keydown"))return;const s=ht(t,'[role="menuitemradio"]');if(!s&&["Space","ArrowRight"].includes(i.key))S.showMenuPanel.call(this,e,!0);else{let r;i.key!=="Space"&&(i.key==="ArrowDown"||s&&i.key==="ArrowRight"?(r=t.nextElementSibling,h.element(r)||(r=t.parentNode.firstElementChild)):(r=t.previousElementSibling,h.element(r)||(r=t.parentNode.lastElementChild)),ls.call(this,r,!0))}},!1),H.call(this,t,"keyup",i=>{i.key==="Return"&&S.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:t,list:e,type:i,title:s,badge:r=null,checked:a=!1}){const n=Le(this.config.selectors.inputs[i]),o=N("button",J(n,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${n.class?n.class:""}`.trim(),"aria-checked":a,value:t})),c=N("span");c.innerHTML=s,h.element(r)&&c.appendChild(r),o.appendChild(c),Object.defineProperty(o,"checked",{enumerable:!0,get:()=>o.getAttribute("aria-checked")==="true",set(l){l&&Array.from(o.parentNode.children).filter(d=>ht(d,'[role="menuitemradio"]')).forEach(d=>d.setAttribute("aria-checked","false")),o.setAttribute("aria-checked",l?"true":"false")}}),this.listeners.bind(o,"click keyup",l=>{if(!h.keyboardEvent(l)||l.key==="Space"){switch(l.preventDefault(),l.stopPropagation(),o.checked=!0,i){case"language":this.currentTrack=Number(t);break;case"quality":this.quality=t;break;case"speed":this.speed=parseFloat(t)}S.showMenuPanel.call(this,"home",h.keyboardEvent(l))}},i,!1),S.bindMenuItemShortcuts.call(this,o,i),e.appendChild(o)},formatTime(t=0,e=!1){return h.number(t)?Wi(t,ao(this.duration)>0,e):t},updateTimeDisplay(t=null,e=0,i=!1){h.element(t)&&h.number(e)&&(t.innerText=S.formatTime(e,i))},updateVolume(){this.supported.ui&&(h.element(this.elements.inputs.volume)&&S.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),h.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||this.volume===0))},setRange(t,e=0){h.element(t)&&(t.value=e,S.updateRangeFill.call(this,t))},updateProgress(t){if(!this.supported.ui||!h.event(t))return;let e=0;const i=(s,r)=>{const a=h.number(r)?r:0,n=h.element(s)?s:this.elements.display.buffer;if(h.element(n)){n.value=a;const o=n.getElementsByTagName("span")[0];h.element(o)&&(o.childNodes[0].nodeValue=a)}};if(t)switch(t.type){case"timeupdate":case"seeking":case"seeked":e=Ju(this.currentTime,this.duration),t.type==="timeupdate"&&S.setRange.call(this,this.elements.inputs.seek,e);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered)}},updateRangeFill(t){const e=h.event(t)?t.target:t;if(h.element(e)&&e.getAttribute("type")==="range"){if(ht(e,this.config.selectors.inputs.seek)){e.setAttribute("aria-valuenow",this.currentTime);const i=S.formatTime(this.currentTime),s=S.formatTime(this.duration),r=K.get("seekLabel",this.config);e.setAttribute("aria-valuetext",r.replace("{currentTime}",i).replace("{duration}",s))}else if(ht(e,this.config.selectors.inputs.volume)){const i=100*e.value;e.setAttribute("aria-valuenow",i),e.setAttribute("aria-valuetext",`${i.toFixed(1)}%`)}else e.setAttribute("aria-valuenow",e.value);re.isWebkit&&e.style.setProperty("--value",e.value/e.max*100+"%")}},updateSeekTooltip(t){var e,i;if(!this.config.tooltips.seek||!h.element(this.elements.inputs.seek)||!h.element(this.elements.display.seekTooltip)||this.duration===0)return;const s=this.elements.display.seekTooltip,r=`${this.config.classNames.tooltip}--visible`,a=d=>W(s,r,d);if(this.touch)return void a(!1);let n=0;const o=this.elements.progress.getBoundingClientRect();if(h.event(t))n=100/o.width*(t.pageX-o.left);else{if(!ki(s,r))return;n=parseFloat(s.style.left,10)}n<0?n=0:n>100&&(n=100);const c=this.duration/100*n;s.innerText=S.formatTime(c);const l=(e=this.config.markers)===null||e===void 0||(i=e.points)===null||i===void 0?void 0:i.find(({time:d})=>d===Math.round(c));l&&s.insertAdjacentHTML("afterbegin",`${l.label}<br>`),s.style.left=`${n}%`,h.event(t)&&["mouseenter","mouseleave"].includes(t.type)&&a(t.type==="mouseenter")},timeUpdate(t){const e=!h.element(this.elements.display.duration)&&this.config.invertTime;S.updateTimeDisplay.call(this,this.elements.display.currentTime,e?this.duration-this.currentTime:this.currentTime,e),t&&t.type==="timeupdate"&&this.media.seeking||S.updateProgress.call(this,t)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return ct(this.elements.display.currentTime,!0),void ct(this.elements.progress,!0);h.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const t=h.element(this.elements.display.duration);!t&&this.config.displayDuration&&this.paused&&S.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),t&&S.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&S.setMarkers.call(this),S.updateSeekTooltip.call(this)},toggleMenuButton(t,e){ct(this.elements.settings.buttons[t],!e)},updateSetting(t,e,i){const s=this.elements.settings.panels[t];let r=null,a=e;if(t==="captions")r=this.currentTrack;else{if(r=h.empty(i)?this[t]:i,h.empty(r)&&(r=this.config[t].default),!h.empty(this.options[t])&&!this.options[t].includes(r))return void this.debug.warn(`Unsupported value of '${r}' for ${t}`);if(!this.config[t].options.includes(r))return void this.debug.warn(`Disabled value of '${r}' for ${t}`)}if(h.element(a)||(a=s&&s.querySelector('[role="menu"]')),!h.element(a))return;this.elements.settings.buttons[t].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=S.getLabel.call(this,t,r);const n=a&&a.querySelector(`[value="${r}"]`);h.element(n)&&(n.checked=!0)},getLabel(t,e){switch(t){case"speed":return e===1?K.get("normal",this.config):`${e}&times;`;case"quality":if(h.number(e)){const i=K.get(`qualityLabel.${e}`,this.config);return i.length?i:`${e}p`}return so(e);case"captions":return F.getLabel.call(this);default:return null}},setQualityMenu(t){if(!h.element(this.elements.settings.panels.quality))return;const e="quality",i=this.elements.settings.panels.quality.querySelector('[role="menu"]');h.array(t)&&(this.options.quality=Ns(t).filter(a=>this.config.quality.options.includes(a)));const s=!h.empty(this.options.quality)&&this.options.quality.length>1;if(S.toggleMenuButton.call(this,e,s),wi(i),S.checkMenu.call(this),!s)return;const r=a=>{const n=K.get(`qualityBadge.${a}`,this.config);return n.length?S.createBadge.call(this,n):null};this.options.quality.sort((a,n)=>{const o=this.config.quality.options;return o.indexOf(a)>o.indexOf(n)?1:-1}).forEach(a=>{S.createMenuItem.call(this,{value:a,list:i,type:e,title:S.getLabel.call(this,"quality",a),badge:r(a)})}),S.updateSetting.call(this,e,i)},setCaptionsMenu(){if(!h.element(this.elements.settings.panels.captions))return;const t="captions",e=this.elements.settings.panels.captions.querySelector('[role="menu"]'),i=F.getTracks.call(this),s=Boolean(i.length);if(S.toggleMenuButton.call(this,t,s),wi(e),S.checkMenu.call(this),!s)return;const r=i.map((a,n)=>({value:n,checked:this.captions.toggled&&this.currentTrack===n,title:F.getLabel.call(this,a),badge:a.language&&S.createBadge.call(this,a.language.toUpperCase()),list:e,type:"language"}));r.unshift({value:-1,checked:!this.captions.toggled,title:K.get("disabled",this.config),list:e,type:"language"}),r.forEach(S.createMenuItem.bind(this)),S.updateSetting.call(this,t,e)},setSpeedMenu(){if(!h.element(this.elements.settings.panels.speed))return;const t="speed",e=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter(s=>s>=this.minimumSpeed&&s<=this.maximumSpeed);const i=!h.empty(this.options.speed)&&this.options.speed.length>1;S.toggleMenuButton.call(this,t,i),wi(e),S.checkMenu.call(this),i&&(this.options.speed.forEach(s=>{S.createMenuItem.call(this,{value:s,list:e,type:t,title:S.getLabel.call(this,"speed",s)})}),S.updateSetting.call(this,t,e))},checkMenu(){const{buttons:t}=this.elements.settings,e=!h.empty(t)&&Object.values(t).some(i=>!i.hidden);ct(this.elements.settings.menu,!e)},focusFirstMenuItem(t,e=!1){if(this.elements.settings.popup.hidden)return;let i=t;h.element(i)||(i=Object.values(this.elements.settings.panels).find(r=>!r.hidden));const s=i.querySelector('[role^="menuitem"]');ls.call(this,s,e)},toggleMenu(t){const{popup:e}=this.elements.settings,i=this.elements.buttons.settings;if(!h.element(e)||!h.element(i))return;const{hidden:s}=e;let r=s;if(h.boolean(t))r=t;else if(h.keyboardEvent(t)&&t.key==="Escape")r=!1;else if(h.event(t)){const a=h.function(t.composedPath)?t.composedPath()[0]:t.target,n=e.contains(a);if(n||!n&&t.target!==i&&r)return}i.setAttribute("aria-expanded",r),ct(e,!r),W(this.elements.container,this.config.classNames.menu.open,r),r&&h.keyboardEvent(t)?S.focusFirstMenuItem.call(this,null,!0):r||s||ls.call(this,i,h.keyboardEvent(t))},getMenuSize(t){const e=t.cloneNode(!0);e.style.position="absolute",e.style.opacity=0,e.removeAttribute("hidden"),t.parentNode.appendChild(e);const i=e.scrollWidth,s=e.scrollHeight;return He(e),{width:i,height:s}},showMenuPanel(t="",e=!1){const i=this.elements.container.querySelector(`#plyr-settings-${this.id}-${t}`);if(!h.element(i))return;const s=i.parentNode,r=Array.from(s.children).find(a=>!a.hidden);if(q.transitions&&!q.reducedMotion){s.style.width=`${r.scrollWidth}px`,s.style.height=`${r.scrollHeight}px`;const a=S.getMenuSize.call(this,i),n=o=>{o.target===s&&["width","height"].includes(o.propertyName)&&(s.style.width="",s.style.height="",Ui.call(this,s,ks,n))};H.call(this,s,ks,n),s.style.width=`${a.width}px`,s.style.height=`${a.height}px`}ct(r,!0),ct(i,!1),S.focusFirstMenuItem.call(this,i,e)},setDownloadUrl(){const t=this.elements.buttons.download;h.element(t)&&t.setAttribute("href",this.download)},create(t){const{bindMenuItemShortcuts:e,createButton:i,createProgress:s,createRange:r,createTime:a,setQualityMenu:n,setSpeedMenu:o,showMenuPanel:c}=S;this.elements.controls=null,h.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const l=N("div",Le(this.config.selectors.controls.wrapper));this.elements.controls=l;const d={class:"plyr__controls__item"};return Ns(h.array(this.config.controls)?this.config.controls:[]).forEach(u=>{if(u==="restart"&&l.appendChild(i.call(this,"restart",d)),u==="rewind"&&l.appendChild(i.call(this,"rewind",d)),u==="play"&&l.appendChild(i.call(this,"play",d)),u==="fast-forward"&&l.appendChild(i.call(this,"fast-forward",d)),u==="progress"){const p=N("div",{class:`${d.class} plyr__progress__container`}),m=N("div",Le(this.config.selectors.progress));if(m.appendChild(r.call(this,"seek",{id:`plyr-seek-${t.id}`})),m.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const g=N("span",{class:this.config.classNames.tooltip},"00:00");m.appendChild(g),this.elements.display.seekTooltip=g}this.elements.progress=m,p.appendChild(this.elements.progress),l.appendChild(p)}if(u==="current-time"&&l.appendChild(a.call(this,"currentTime",d)),u==="duration"&&l.appendChild(a.call(this,"duration",d)),u==="mute"||u==="volume"){let{volume:p}=this.elements;if(h.element(p)&&l.contains(p)||(p=N("div",J({},d,{class:`${d.class} plyr__volume`.trim()})),this.elements.volume=p,l.appendChild(p)),u==="mute"&&p.appendChild(i.call(this,"mute")),u==="volume"&&!re.isIos){const m={max:1,step:.05,value:this.config.volume};p.appendChild(r.call(this,"volume",J(m,{id:`plyr-volume-${t.id}`})))}}if(u==="captions"&&l.appendChild(i.call(this,"captions",d)),u==="settings"&&!h.empty(this.config.settings)){const p=N("div",J({},d,{class:`${d.class} plyr__menu`.trim(),hidden:""}));p.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${t.id}`,"aria-expanded":!1}));const m=N("div",{class:"plyr__menu__container",id:`plyr-settings-${t.id}`,hidden:""}),g=N("div"),f=N("div",{id:`plyr-settings-${t.id}-home`}),b=N("div",{role:"menu"});f.appendChild(b),g.appendChild(f),this.elements.settings.panels.home=f,this.config.settings.forEach(v=>{const x=N("button",J(Le(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));e.call(this,x,v),H.call(this,x,"click",()=>{c.call(this,v,!1)});const y=N("span",null,K.get(v,this.config)),k=N("span",{class:this.config.classNames.menu.value});k.innerHTML=t[v],y.appendChild(k),x.appendChild(y),b.appendChild(x);const z=N("div",{id:`plyr-settings-${t.id}-${v}`,hidden:""}),T=N("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});T.appendChild(N("span",{"aria-hidden":!0},K.get(v,this.config))),T.appendChild(N("span",{class:this.config.classNames.hidden},K.get("menuBack",this.config))),H.call(this,z,"keydown",O=>{O.key==="ArrowLeft"&&(O.preventDefault(),O.stopPropagation(),c.call(this,"home",!0))},!1),H.call(this,T,"click",()=>{c.call(this,"home",!1)}),z.appendChild(T),z.appendChild(N("div",{role:"menu"})),g.appendChild(z),this.elements.settings.buttons[v]=x,this.elements.settings.panels[v]=z}),m.appendChild(g),p.appendChild(m),l.appendChild(p),this.elements.settings.popup=m,this.elements.settings.menu=p}if(u==="pip"&&q.pip&&l.appendChild(i.call(this,"pip",d)),u==="airplay"&&q.airplay&&l.appendChild(i.call(this,"airplay",d)),u==="download"){const p=J({},d,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(p.download="");const{download:m}=this.config.urls;!h.url(m)&&this.isEmbed&&J(p,{icon:`logo-${this.provider}`,label:this.provider}),l.appendChild(i.call(this,"download",p))}u==="fullscreen"&&l.appendChild(i.call(this,"fullscreen",d))}),this.isHTML5&&n.call(this,Ke.getQualityOptions.call(this)),o.call(this),l},inject(){if(this.config.loadSprite){const r=S.getIconUrl.call(this);r.cors&&ro(r.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let t=null;this.elements.controls=null;const e={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i=!0;h.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,e)),this.config.controls||(this.config.controls=[]),h.element(this.config.controls)||h.string(this.config.controls)?t=this.config.controls:(t=S.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:F.getLabel.call(this)}),i=!1);let s;if(i&&h.string(this.config.controls)&&(t=(r=>{let a=r;return Object.entries(e).forEach(([n,o])=>{a=Ft(a,`{${n}}`,o)}),a})(t)),h.string(this.config.selectors.controls.container)&&(s=document.querySelector(this.config.selectors.controls.container)),h.element(s)||(s=this.elements.container),s[h.element(t)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",t),h.element(this.elements.controls)||S.findElements.call(this),!h.empty(this.elements.buttons)){const r=a=>{const n=this.config.classNames.controlPressed;Object.defineProperty(a,"pressed",{enumerable:!0,get:()=>ki(a,n),set(o=!1){W(a,n,o)}})};Object.values(this.elements.buttons).filter(Boolean).forEach(a=>{h.array(a)||h.nodeList(a)?Array.from(a).filter(Boolean).forEach(r):r(a)})}if(re.isEdge&&qn(s),this.config.tooltips.controls){const{classNames:r,selectors:a}=this.config,n=`${a.controls.wrapper} ${a.labels} .${r.hidden}`,o=xt.call(this,n);Array.from(o).forEach(c=>{W(c,this.config.classNames.hidden,!1),W(c,this.config.classNames.tooltip,!0)})}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch{}},setMarkers(){var t,e;if(!this.duration||this.elements.markers)return;const i=(t=this.config.markers)===null||t===void 0||(e=t.points)===null||e===void 0?void 0:e.filter(({time:c})=>c>0&&c<this.duration);if(i==null||!i.length)return;const s=document.createDocumentFragment(),r=document.createDocumentFragment();let a=null;const n=`${this.config.classNames.tooltip}--visible`,o=c=>W(a,n,c);i.forEach(c=>{const l=N("span",{class:this.config.classNames.marker},""),d=c.time/this.duration*100+"%";a&&(l.addEventListener("mouseenter",()=>{c.label||(a.style.left=d,a.innerHTML=c.label,o(!0))}),l.addEventListener("mouseleave",()=>{o(!1)})),l.addEventListener("click",()=>{this.currentTime=c.time}),l.style.left=d,r.appendChild(l)}),s.appendChild(r),this.config.tooltips.seek||(a=N("span",{class:this.config.classNames.tooltip},""),s.appendChild(a)),this.elements.markers={points:r,tip:a},this.elements.progress.appendChild(s)}};function no(t,e=!0){let i=t;if(e){const s=document.createElement("a");s.href=i,i=s.href}try{return new URL(i)}catch{return null}}function oo(t){const e=new URLSearchParams;return h.object(t)&&Object.entries(t).forEach(([i,s])=>{e.set(i,s)}),e}const F={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!q.textTracks)return void(h.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&S.setCaptionsMenu.call(this));if(h.element(this.elements.captions)||(this.elements.captions=N("div",Le(this.config.selectors.captions)),Hu(this.elements.captions,this.elements.wrapper)),re.isIE&&window.URL){const s=this.media.querySelectorAll("track");Array.from(s).forEach(r=>{const a=r.getAttribute("src"),n=no(a);n!==null&&n.hostname!==window.location.href.hostname&&["http:","https:"].includes(n.protocol)&&ri(a,"blob").then(o=>{r.setAttribute("src",window.URL.createObjectURL(o))}).catch(()=>{He(r)})})}const t=Ns((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map(s=>s.split("-")[0]));let e=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();e==="auto"&&([e]=t);let i=this.storage.get("captions");if(h.boolean(i)||({active:i}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:i,language:e,languages:t}),this.isHTML5){const s=this.config.captions.update?"addtrack removetrack":"removetrack";H.call(this,this.media.textTracks,s,F.update.bind(this))}setTimeout(F.update.bind(this),0)},update(){const t=F.getTracks.call(this,!0),{active:e,language:i,meta:s,currentTrackNode:r}=this.captions,a=Boolean(t.find(n=>n.language===i));this.isHTML5&&this.isVideo&&t.filter(n=>!s.get(n)).forEach(n=>{this.debug.log("Track added",n),s.set(n,{default:n.mode==="showing"}),n.mode==="showing"&&(n.mode="hidden"),H.call(this,n,"cuechange",()=>F.updateCues.call(this))}),(a&&this.language!==i||!t.includes(r))&&(F.setLanguage.call(this,i),F.toggle.call(this,e&&a)),this.elements&&W(this.elements.container,this.config.classNames.captions.enabled,!h.empty(t)),h.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&S.setCaptionsMenu.call(this)},toggle(t,e=!0){if(!this.supported.ui)return;const{toggled:i}=this.captions,s=this.config.classNames.captions.active,r=h.nullOrUndefined(t)?!i:t;if(r!==i){if(e||(this.captions.active=r,this.storage.set({captions:r})),!this.language&&r&&!e){const a=F.getTracks.call(this),n=F.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=n.language,void F.set.call(this,a.indexOf(n))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=r),W(this.elements.container,s,r),this.captions.toggled=r,S.updateSetting.call(this,"captions"),E.call(this,this.media,r?"captionsenabled":"captionsdisabled")}setTimeout(()=>{r&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(t,e=!0){const i=F.getTracks.call(this);if(t!==-1)if(h.number(t))if(t in i){if(this.captions.currentTrack!==t){this.captions.currentTrack=t;const s=i[t],{language:r}=s||{};this.captions.currentTrackNode=s,S.updateSetting.call(this,"captions"),e||(this.captions.language=r,this.storage.set({language:r})),this.isVimeo&&this.embed.enableTextTrack(r),E.call(this,this.media,"languagechange")}F.toggle.call(this,!0,e),this.isHTML5&&this.isVideo&&F.updateCues.call(this)}else this.debug.warn("Track not found",t);else this.debug.warn("Invalid caption argument",t);else F.toggle.call(this,!1,e)},setLanguage(t,e=!0){if(!h.string(t))return void this.debug.warn("Invalid language argument",t);const i=t.toLowerCase();this.captions.language=i;const s=F.getTracks.call(this),r=F.findTrack.call(this,[i]);F.set.call(this,s.indexOf(r),e)},getTracks(t=!1){return Array.from((this.media||{}).textTracks||[]).filter(e=>!this.isHTML5||t||this.captions.meta.has(e)).filter(e=>["captions","subtitles"].includes(e.kind))},findTrack(t,e=!1){const i=F.getTracks.call(this),s=n=>Number((this.captions.meta.get(n)||{}).default),r=Array.from(i).sort((n,o)=>s(o)-s(n));let a;return t.every(n=>(a=r.find(o=>o.language===n),!a)),a||(e?r[0]:void 0)},getCurrentTrack(){return F.getTracks.call(this)[this.currentTrack]},getLabel(t){let e=t;return!h.track(e)&&q.textTracks&&this.captions.toggled&&(e=F.getCurrentTrack.call(this)),h.track(e)?h.empty(e.label)?h.empty(e.language)?K.get("enabled",this.config):t.language.toUpperCase():e.label:K.get("disabled",this.config)},updateCues(t){if(!this.supported.ui)return;if(!h.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!h.nullOrUndefined(t)&&!Array.isArray(t))return void this.debug.warn("updateCues: Invalid input",t);let e=t;if(!e){const s=F.getCurrentTrack.call(this);e=Array.from((s||{}).activeCues||[]).map(r=>r.getCueAsHTML()).map(tp)}const i=e.map(s=>s.trim()).join(`
125
+ `);if(i!==this.elements.captions.innerHTML){wi(this.elements.captions);const s=N("span",Le(this.config.selectors.caption));s.innerHTML=i,this.elements.captions.appendChild(s),E.call(this,this.media,"cuechange")}}},lo={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.7.2/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},tabFocus:"plyr__tab-focus",previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},cs={active:"picture-in-picture",inactive:"inline"},qe={html5:"html5",youtube:"youtube",vimeo:"vimeo"},hs={audio:"audio",video:"video"};function sp(t){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(t)?qe.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(t)?qe.vimeo:null}const ds=()=>{};class rp{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):ds}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):ds}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):ds}}class Ve{constructor(e){_(this,"onChange",()=>{if(!this.enabled)return;const i=this.player.elements.buttons.fullscreen;h.element(i)&&(i.pressed=this.active);const s=this.target===this.player.media?this.target:this.player.elements.container;E.call(this.player,s,this.active?"enterfullscreen":"exitfullscreen",!0)}),_(this,"toggleFallback",(i=!1)=>{if(i?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=i?"hidden":"",W(this.target,this.player.config.classNames.fullscreen.fallback,i),re.isIos){let s=document.head.querySelector('meta[name="viewport"]');const r="viewport-fit=cover";s||(s=document.createElement("meta"),s.setAttribute("name","viewport"));const a=h.string(s.content)&&s.content.includes(r);i?(this.cleanupViewport=!a,a||(s.content+=`,${r}`)):this.cleanupViewport&&(s.content=s.content.split(",").filter(n=>n.trim()!==r).join(","))}this.onChange()}),_(this,"trapFocus",i=>{if(re.isIos||!this.active||i.key!=="Tab")return;const s=document.activeElement,r=xt.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[a]=r,n=r[r.length-1];s!==n||i.shiftKey?s===a&&i.shiftKey&&(n.focus(),i.preventDefault()):(a.focus(),i.preventDefault())}),_(this,"update",()=>{if(this.enabled){let i;i=this.forceFallback?"Fallback (forced)":Ve.native?"Native":"Fallback",this.player.debug.log(`${i} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");W(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}),_(this,"enter",()=>{this.enabled&&(re.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!Ve.native||this.forceFallback?this.toggleFallback(!0):this.prefix?h.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))}),_(this,"exit",()=>{if(this.enabled)if(re.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),Be(this.player.play());else if(!Ve.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!h.empty(this.prefix)){const i=this.prefix==="moz"?"Cancel":"Exit";document[`${this.prefix}${i}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}),_(this,"toggle",()=>{this.active?this.exit():this.enter()}),this.player=e,this.prefix=Ve.prefix,this.property=Ve.property,this.scrollPosition={x:0,y:0},this.forceFallback=e.config.fullscreen.fallback==="force",this.player.elements.fullscreen=e.config.fullscreen.container&&Fu(this.player.elements.container,e.config.fullscreen.container),H.call(this.player,document,this.prefix==="ms"?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),H.call(this.player,this.player.elements.container,"dblclick",i=>{h.element(this.player.elements.controls)&&this.player.elements.controls.contains(i.target)||this.player.listeners.proxy(i,this.toggle,"fullscreen")}),H.call(this,this.player.elements.container,"keydown",i=>this.trapFocus(i)),this.update()}static get native(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get usingNative(){return Ve.native&&!this.forceFallback}static get prefix(){if(h.function(document.exitFullscreen))return"";let e="";return["webkit","moz","ms"].some(i=>!(!h.function(document[`${i}ExitFullscreen`])&&!h.function(document[`${i}CancelFullScreen`]))&&(e=i,!0)),e}static get property(){return this.prefix==="moz"?"FullScreen":"Fullscreen"}get enabled(){return(Ve.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}get active(){if(!this.enabled)return!1;if(!Ve.native||this.forceFallback)return ki(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){return re.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}function vi(t,e=1){return new Promise((i,s)=>{const r=new Image,a=()=>{delete r.onload,delete r.onerror,(r.naturalWidth>=e?i:s)(r)};Object.assign(r,{onload:a,onerror:a,src:t})})}const Z={addStyleHook(){W(this.elements.container,this.config.selectors.container.replace(".",""),!0),W(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(t=!1){t&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void Z.toggleNativeControls.call(this,!0);h.element(this.elements.controls)||(S.inject.call(this),this.listeners.controls()),Z.toggleNativeControls.call(this),this.isHTML5&&F.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,S.updateVolume.call(this),S.timeUpdate.call(this),S.durationUpdate.call(this),Z.checkPlaying.call(this),W(this.elements.container,this.config.classNames.pip.supported,q.pip&&this.isHTML5&&this.isVideo),W(this.elements.container,this.config.classNames.airplay.supported,q.airplay&&this.isHTML5),W(this.elements.container,this.config.classNames.isIos,re.isIos),W(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{E.call(this,this.media,"ready")},0),Z.setTitle.call(this),this.poster&&Z.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&S.durationUpdate.call(this),this.config.mediaMetadata&&S.setMediaMetadata.call(this)},setTitle(){let t=K.get("play",this.config);if(h.string(this.config.title)&&!h.empty(this.config.title)&&(t+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach(e=>{e.setAttribute("aria-label",t)}),this.isEmbed){const e=X.call(this,"iframe");if(!h.element(e))return;const i=h.empty(this.config.title)?"video":this.config.title,s=K.get("frameTitle",this.config);e.setAttribute("title",s.replace("{title}",i))}},togglePoster(t){W(this.elements.container,this.config.classNames.posterEnabled,t)},setPoster(t,e=!0){return e&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",t),this.elements.poster.removeAttribute("hidden"),Qu.call(this).then(()=>vi(t)).catch(i=>{throw t===this.poster&&Z.togglePoster.call(this,!1),i}).then(()=>{if(t!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")}).then(()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${t}')`,backgroundSize:""}),Z.togglePoster.call(this,!0),t)))},checkPlaying(t){W(this.elements.container,this.config.classNames.playing,this.playing),W(this.elements.container,this.config.classNames.paused,this.paused),W(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",K.get(this.playing?"pause":"play",this.config))}),h.event(t)&&t.type==="timeupdate"||Z.toggleControls.call(this)},checkLoading(t){this.loading=["stalled","waiting"].includes(t.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{W(this.elements.container,this.config.classNames.loading,this.loading),Z.toggleControls.call(this)},this.loading?250:0)},toggleControls(t){const{controls:e}=this.elements;if(e&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(t||this.loading||this.paused||e.pressed||e.hover||i))}},migrateStyles(){Object.values(j({},this.media.style)).filter(t=>!h.empty(t)&&h.string(t)&&t.startsWith("--plyr")).forEach(t=>{this.elements.container.style.setProperty(t,this.media.style.getPropertyValue(t)),this.media.style.removeProperty(t)}),h.empty(this.media.style)&&this.media.removeAttribute("style")}};class ap{constructor(e){_(this,"firstTouch",()=>{const{player:i}=this,{elements:s}=i;i.touch=!0,W(s.container,i.config.classNames.isTouch,!0)}),_(this,"setTabFocus",i=>{const{player:s}=this,{elements:r}=s,{key:a,type:n,timeStamp:o}=i;if(clearTimeout(this.focusTimer),n==="keydown"&&a!=="Tab")return;n==="keydown"&&(this.lastKeyDown=o);const c=o-this.lastKeyDown<=20;(n!=="focus"||c)&&((()=>{const l=s.config.classNames.tabFocus;W(xt.call(s,`.${l}`),l,!1)})(),n!=="focusout"&&(this.focusTimer=setTimeout(()=>{const l=document.activeElement;r.container.contains(l)&&W(document.activeElement,s.config.classNames.tabFocus,!0)},10)))}),_(this,"global",(i=!0)=>{const{player:s}=this;s.config.keyboard.global&&Mt.call(s,window,"keydown keyup",this.handleKey,i,!1),Mt.call(s,document.body,"click",this.toggleMenu,i),hr.call(s,document.body,"touchstart",this.firstTouch),Mt.call(s,document.body,"keydown focus blur focusout",this.setTabFocus,i,!1,!0)}),_(this,"container",()=>{const{player:i}=this,{config:s,elements:r,timers:a}=i;!s.keyboard.global&&s.keyboard.focused&&H.call(i,r.container,"keydown keyup",this.handleKey,!1),H.call(i,r.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",c=>{const{controls:l}=r;l&&c.type==="enterfullscreen"&&(l.pressed=!1,l.hover=!1);let d=0;["touchstart","touchmove","mousemove"].includes(c.type)&&(Z.toggleControls.call(i,!0),d=i.touch?3e3:2e3),clearTimeout(a.controls),a.controls=setTimeout(()=>Z.toggleControls.call(i,!1),d)});const n=()=>{if(!i.isVimeo||i.config.vimeo.premium)return;const c=r.wrapper,{active:l}=i.fullscreen,[d,u]=dr.call(i),p=eo(`aspect-ratio: ${d} / ${u}`);if(!l)return void(p?(c.style.width=null,c.style.height=null):(c.style.maxWidth=null,c.style.margin=null));const[m,g]=Gu(),f=m/g>d/u;p?(c.style.width=f?"auto":"100%",c.style.height=f?"100%":"auto"):(c.style.maxWidth=f?g/u*d+"px":null,c.style.margin=f?"0 auto":null)},o=()=>{clearTimeout(a.resized),a.resized=setTimeout(n,50)};H.call(i,r.container,"enterfullscreen exitfullscreen",c=>{const{target:l}=i.fullscreen;l===r.container&&(!i.isEmbed&&h.empty(i.config.ratio)||(n(),(c.type==="enterfullscreen"?H:Ui).call(i,window,"resize",o)))})}),_(this,"media",()=>{const{player:i}=this,{elements:s}=i;if(H.call(i,i.media,"timeupdate seeking seeked",a=>S.timeUpdate.call(i,a)),H.call(i,i.media,"durationchange loadeddata loadedmetadata",a=>S.durationUpdate.call(i,a)),H.call(i,i.media,"ended",()=>{i.isHTML5&&i.isVideo&&i.config.resetOnEnd&&(i.restart(),i.pause())}),H.call(i,i.media,"progress playing seeking seeked",a=>S.updateProgress.call(i,a)),H.call(i,i.media,"volumechange",a=>S.updateVolume.call(i,a)),H.call(i,i.media,"playing play pause ended emptied timeupdate",a=>Z.checkPlaying.call(i,a)),H.call(i,i.media,"waiting canplay seeked playing",a=>Z.checkLoading.call(i,a)),i.supported.ui&&i.config.clickToPlay&&!i.isAudio){const a=X.call(i,`.${i.config.classNames.video}`);if(!h.element(a))return;H.call(i,s.container,"click",n=>{([s.container,a].includes(n.target)||a.contains(n.target))&&(i.touch&&i.config.hideControls||(i.ended?(this.proxy(n,i.restart,"restart"),this.proxy(n,()=>{Be(i.play())},"play")):this.proxy(n,()=>{Be(i.togglePlay())},"play")))})}i.supported.ui&&i.config.disableContextMenu&&H.call(i,s.wrapper,"contextmenu",a=>{a.preventDefault()},!1),H.call(i,i.media,"volumechange",()=>{i.storage.set({volume:i.volume,muted:i.muted})}),H.call(i,i.media,"ratechange",()=>{S.updateSetting.call(i,"speed"),i.storage.set({speed:i.speed})}),H.call(i,i.media,"qualitychange",a=>{S.updateSetting.call(i,"quality",null,a.detail.quality)}),H.call(i,i.media,"ready qualitychange",()=>{S.setDownloadUrl.call(i)});const r=i.config.events.concat(["keyup","keydown"]).join(" ");H.call(i,i.media,r,a=>{let{detail:n={}}=a;a.type==="error"&&(n=i.media.error),E.call(i,s.container,a.type,!0,n)})}),_(this,"proxy",(i,s,r)=>{const{player:a}=this,n=a.config.listeners[r];let o=!0;h.function(n)&&(o=n.call(a,i)),o!==!1&&h.function(s)&&s.call(a,i)}),_(this,"bind",(i,s,r,a,n=!0)=>{const{player:o}=this,c=o.config.listeners[a],l=h.function(c);H.call(o,i,s,d=>this.proxy(d,r,a),n&&!l)}),_(this,"controls",()=>{const{player:i}=this,{elements:s}=i,r=re.isIE?"change":"input";if(s.buttons.play&&Array.from(s.buttons.play).forEach(a=>{this.bind(a,"click",()=>{Be(i.togglePlay())},"play")}),this.bind(s.buttons.restart,"click",i.restart,"restart"),this.bind(s.buttons.rewind,"click",()=>{i.lastSeekTime=Date.now(),i.rewind()},"rewind"),this.bind(s.buttons.fastForward,"click",()=>{i.lastSeekTime=Date.now(),i.forward()},"fastForward"),this.bind(s.buttons.mute,"click",()=>{i.muted=!i.muted},"mute"),this.bind(s.buttons.captions,"click",()=>i.toggleCaptions()),this.bind(s.buttons.download,"click",()=>{E.call(i,i.media,"download")},"download"),this.bind(s.buttons.fullscreen,"click",()=>{i.fullscreen.toggle()},"fullscreen"),this.bind(s.buttons.pip,"click",()=>{i.pip="toggle"},"pip"),this.bind(s.buttons.airplay,"click",i.airplay,"airplay"),this.bind(s.buttons.settings,"click",a=>{a.stopPropagation(),a.preventDefault(),S.toggleMenu.call(i,a)},null,!1),this.bind(s.buttons.settings,"keyup",a=>{["Space","Enter"].includes(a.key)&&(a.key!=="Enter"?(a.preventDefault(),a.stopPropagation(),S.toggleMenu.call(i,a)):S.focusFirstMenuItem.call(i,null,!0))},null,!1),this.bind(s.settings.menu,"keydown",a=>{a.key==="Escape"&&S.toggleMenu.call(i,a)}),this.bind(s.inputs.seek,"mousedown mousemove",a=>{const n=s.progress.getBoundingClientRect(),o=100/n.width*(a.pageX-n.left);a.currentTarget.setAttribute("seek-value",o)}),this.bind(s.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",a=>{const n=a.currentTarget,o="play-on-seeked";if(h.keyboardEvent(a)&&!["ArrowLeft","ArrowRight"].includes(a.key))return;i.lastSeekTime=Date.now();const c=n.hasAttribute(o),l=["mouseup","touchend","keyup"].includes(a.type);c&&l?(n.removeAttribute(o),Be(i.play())):!l&&i.playing&&(n.setAttribute(o,""),i.pause())}),re.isIos){const a=xt.call(i,'input[type="range"]');Array.from(a).forEach(n=>this.bind(n,r,o=>qn(o.target)))}this.bind(s.inputs.seek,r,a=>{const n=a.currentTarget;let o=n.getAttribute("seek-value");h.empty(o)&&(o=n.value),n.removeAttribute("seek-value"),i.currentTime=o/n.max*i.duration},"seek"),this.bind(s.progress,"mouseenter mouseleave mousemove",a=>S.updateSeekTooltip.call(i,a)),this.bind(s.progress,"mousemove touchmove",a=>{const{previewThumbnails:n}=i;n&&n.loaded&&n.startMove(a)}),this.bind(s.progress,"mouseleave touchend click",()=>{const{previewThumbnails:a}=i;a&&a.loaded&&a.endMove(!1,!0)}),this.bind(s.progress,"mousedown touchstart",a=>{const{previewThumbnails:n}=i;n&&n.loaded&&n.startScrubbing(a)}),this.bind(s.progress,"mouseup touchend",a=>{const{previewThumbnails:n}=i;n&&n.loaded&&n.endScrubbing(a)}),re.isWebkit&&Array.from(xt.call(i,'input[type="range"]')).forEach(a=>{this.bind(a,"input",n=>S.updateRangeFill.call(i,n.target))}),i.config.toggleInvert&&!h.element(s.display.duration)&&this.bind(s.display.currentTime,"click",()=>{i.currentTime!==0&&(i.config.invertTime=!i.config.invertTime,S.timeUpdate.call(i))}),this.bind(s.inputs.volume,r,a=>{i.volume=a.target.value},"volume"),this.bind(s.controls,"mouseenter mouseleave",a=>{s.controls.hover=!i.touch&&a.type==="mouseenter"}),s.fullscreen&&Array.from(s.fullscreen.children).filter(a=>!a.contains(s.container)).forEach(a=>{this.bind(a,"mouseenter mouseleave",n=>{s.controls&&(s.controls.hover=!i.touch&&n.type==="mouseenter")})}),this.bind(s.controls,"mousedown mouseup touchstart touchend touchcancel",a=>{s.controls.pressed=["mousedown","touchstart"].includes(a.type)}),this.bind(s.controls,"focusin",()=>{const{config:a,timers:n}=i;W(s.controls,a.classNames.noTransition,!0),Z.toggleControls.call(i,!0),setTimeout(()=>{W(s.controls,a.classNames.noTransition,!1)},0);const o=this.touch?3e3:4e3;clearTimeout(n.controls),n.controls=setTimeout(()=>Z.toggleControls.call(i,!1),o)}),this.bind(s.inputs.volume,"wheel",a=>{const n=a.webkitDirectionInvertedFromDevice,[o,c]=[a.deltaX,-a.deltaY].map(u=>n?-u:u),l=Math.sign(Math.abs(o)>Math.abs(c)?o:c);i.increaseVolume(l/50);const{volume:d}=i.media;(l===1&&d<1||l===-1&&d>0)&&a.preventDefault()},"volume",!1)}),this.player=e,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(e){const{player:i}=this,{elements:s}=i,{key:r,type:a,altKey:n,ctrlKey:o,metaKey:c,shiftKey:l}=e,d=a==="keydown",u=d&&r===this.lastKey;if(!(n||o||c||l)&&!!r){if(d){const m=document.activeElement;if(h.element(m)){const{editable:g}=i.config.selectors,{seek:f}=s.inputs;if(m!==f&&ht(m,g)||e.key==="Space"&&ht(m,'button, [role^="menuitem"]'))return}switch(["Space","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(r)&&(e.preventDefault(),e.stopPropagation()),r){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":u||(p=parseInt(r,10),i.currentTime=i.duration/10*p);break;case"Space":case"k":u||Be(i.togglePlay());break;case"ArrowUp":i.increaseVolume(.1);break;case"ArrowDown":i.decreaseVolume(.1);break;case"m":u||(i.muted=!i.muted);break;case"ArrowRight":i.forward();break;case"ArrowLeft":i.rewind();break;case"f":i.fullscreen.toggle();break;case"c":u||i.toggleCaptions();break;case"l":i.loop=!i.loop}r==="Escape"&&!i.fullscreen.usingNative&&i.fullscreen.active&&i.fullscreen.toggle(),this.lastKey=r}else this.lastKey=null;var p}}toggleMenu(e){S.toggleMenu.call(this.player,e)}}function np(t,e){return t(e={exports:{}},e.exports),e.exports}var op=np(function(t,e){t.exports=function(){var i=function(){},s={},r={},a={};function n(p,m){p=p.push?p:[p];var g,f,b,v=[],x=p.length,y=x;for(g=function(k,z){z.length&&v.push(k),--y||m(v)};x--;)f=p[x],(b=r[f])?g(f,b):(a[f]=a[f]||[]).push(g)}function o(p,m){if(p){var g=a[p];if(r[p]=m,g)for(;g.length;)g[0](p,m),g.splice(0,1)}}function c(p,m){p.call&&(p={success:p}),m.length?(p.error||i)(m):(p.success||i)(p)}function l(p,m,g,f){var b,v,x=document,y=g.async,k=(g.numRetries||0)+1,z=g.before||i,T=p.replace(/[\?|#].*$/,""),O=p.replace(/^(css|img)!/,"");f=f||0,/(^css!|\.css$)/.test(T)?((v=x.createElement("link")).rel="stylesheet",v.href=O,(b="hideFocus"in v)&&v.relList&&(b=0,v.rel="preload",v.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(T)?(v=x.createElement("img")).src=O:((v=x.createElement("script")).src=p,v.async=y===void 0||y),v.onload=v.onerror=v.onbeforeload=function(te){var G=te.type[0];if(b)try{v.sheet.cssText.length||(G="e")}catch(xe){xe.code!=18&&(G="e")}if(G=="e"){if((f+=1)<k)return l(p,m,g,f)}else if(v.rel=="preload"&&v.as=="style")return v.rel="stylesheet";m(p,G,te.defaultPrevented)},z(p,v)!==!1&&x.head.appendChild(v)}function d(p,m,g){var f,b,v=(p=p.push?p:[p]).length,x=v,y=[];for(f=function(k,z,T){if(z=="e"&&y.push(k),z=="b"){if(!T)return;y.push(k)}--v||m(y)},b=0;b<x;b++)l(p[b],f,g)}function u(p,m,g){var f,b;if(m&&m.trim&&(f=m),b=(f?g:m)||{},f){if(f in s)throw"LoadJS";s[f]=!0}function v(x,y){d(p,function(k){c(b,k),x&&c({success:x,error:y},k),o(f,k)},b)}if(b.returnPromise)return new Promise(v);v()}return u.ready=function(p,m){return n(p,function(g){c(m,g)}),u},u.done=function(p){o(p,[])},u.reset=function(){s={},r={},a={}},u.isDefined=function(p){return p in s},u}()});function ur(t){return new Promise((e,i)=>{op(t,{success:e,error:i})})}function lp(t){return h.empty(t)?null:h.number(Number(t))?t:t.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:t}function cp(t){const e=t.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return e&&e.length===5?e[4]:null}function Et(t){t&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===t&&(this.media.paused=!t,E.call(this,this.media,t?"play":"pause"))}const Ps={setup(){const t=this;W(t.elements.wrapper,t.config.classNames.embed,!0),t.options.speed=t.config.speed.options,It.call(t),h.object(window.Vimeo)?Ps.ready.call(t):ur(t.config.urls.vimeo.sdk).then(()=>{Ps.ready.call(t)}).catch(e=>{t.debug.warn("Vimeo SDK (player.js) failed to load",e)})},ready(){const t=this,e=t.config.vimeo,x=e,{premium:i,referrerPolicy:s}=x,r=vr(x,["premium","referrerPolicy"]);let a=t.media.getAttribute("src"),n="";h.empty(a)?(a=t.media.getAttribute(t.config.attributes.embed.id),n=t.media.getAttribute(t.config.attributes.embed.hash)):n=cp(a);const o=n?{h:n}:{};i&&Object.assign(r,{controls:!1,sidedock:!1});const c=oo(j(j({loop:t.config.loop.active,autoplay:t.autoplay,muted:t.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},o),r)),l=lp(a),d=N("iframe"),u=Es(t.config.urls.vimeo.iframe,l,c);if(d.setAttribute("src",u),d.setAttribute("allowfullscreen",""),d.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),h.empty(s)||d.setAttribute("referrerPolicy",s),i||!e.customControls)d.setAttribute("data-poster",t.poster),t.media=Ai(d,t.media);else{const y=N("div",{class:t.config.classNames.embedContainer,"data-poster":t.poster});y.appendChild(d),t.media=Ai(y,t.media)}e.customControls||ri(Es(t.config.urls.vimeo.api,u)).then(y=>{!h.empty(y)&&y.thumbnail_url&&Z.setPoster.call(t,y.thumbnail_url).catch(()=>{})}),t.embed=new window.Vimeo.Player(d,{autopause:t.config.autopause,muted:t.muted}),t.media.paused=!0,t.media.currentTime=0,t.supported.ui&&t.embed.disableTextTrack(),t.media.play=()=>(Et.call(t,!0),t.embed.play()),t.media.pause=()=>(Et.call(t,!1),t.embed.pause()),t.media.stop=()=>{t.pause(),t.currentTime=0};let{currentTime:p}=t.media;Object.defineProperty(t.media,"currentTime",{get:()=>p,set(y){const{embed:k,media:z,paused:T,volume:O}=t,te=T&&!k.hasPlayed;z.seeking=!0,E.call(t,z,"seeking"),Promise.resolve(te&&k.setVolume(0)).then(()=>k.setCurrentTime(y)).then(()=>te&&k.pause()).then(()=>te&&k.setVolume(O)).catch(()=>{})}});let m=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:()=>m,set(y){t.embed.setPlaybackRate(y).then(()=>{m=y,E.call(t,t.media,"ratechange")}).catch(()=>{t.options.speed=[1]})}});let{volume:g}=t.config;Object.defineProperty(t.media,"volume",{get:()=>g,set(y){t.embed.setVolume(y).then(()=>{g=y,E.call(t,t.media,"volumechange")})}});let{muted:f}=t.config;Object.defineProperty(t.media,"muted",{get:()=>f,set(y){const k=!!h.boolean(y)&&y;t.embed.setVolume(k?0:t.config.volume).then(()=>{f=k,E.call(t,t.media,"volumechange")})}});let b,{loop:v}=t.config;Object.defineProperty(t.media,"loop",{get:()=>v,set(y){const k=h.boolean(y)?y:t.config.loop.active;t.embed.setLoop(k).then(()=>{v=k})}}),t.embed.getVideoUrl().then(y=>{b=y,S.setDownloadUrl.call(t)}).catch(y=>{this.debug.warn(y)}),Object.defineProperty(t.media,"currentSrc",{get:()=>b}),Object.defineProperty(t.media,"ended",{get:()=>t.currentTime===t.duration}),Promise.all([t.embed.getVideoWidth(),t.embed.getVideoHeight()]).then(y=>{const[k,z]=y;t.embed.ratio=io(k,z),It.call(this)}),t.embed.setAutopause(t.config.autopause).then(y=>{t.config.autopause=y}),t.embed.getVideoTitle().then(y=>{t.config.title=y,Z.setTitle.call(this)}),t.embed.getCurrentTime().then(y=>{p=y,E.call(t,t.media,"timeupdate")}),t.embed.getDuration().then(y=>{t.media.duration=y,E.call(t,t.media,"durationchange")}),t.embed.getTextTracks().then(y=>{t.media.textTracks=y,F.setup.call(t)}),t.embed.on("cuechange",({cues:y=[]})=>{const k=y.map(z=>ep(z.text));F.updateCues.call(t,k)}),t.embed.on("loaded",()=>{t.embed.getPaused().then(y=>{Et.call(t,!y),y||E.call(t,t.media,"playing")}),h.element(t.embed.element)&&t.supported.ui&&t.embed.element.setAttribute("tabindex",-1)}),t.embed.on("bufferstart",()=>{E.call(t,t.media,"waiting")}),t.embed.on("bufferend",()=>{E.call(t,t.media,"playing")}),t.embed.on("play",()=>{Et.call(t,!0),E.call(t,t.media,"playing")}),t.embed.on("pause",()=>{Et.call(t,!1)}),t.embed.on("timeupdate",y=>{t.media.seeking=!1,p=y.seconds,E.call(t,t.media,"timeupdate")}),t.embed.on("progress",y=>{t.media.buffered=y.percent,E.call(t,t.media,"progress"),parseInt(y.percent,10)===1&&E.call(t,t.media,"canplaythrough"),t.embed.getDuration().then(k=>{k!==t.media.duration&&(t.media.duration=k,E.call(t,t.media,"durationchange"))})}),t.embed.on("seeked",()=>{t.media.seeking=!1,E.call(t,t.media,"seeked")}),t.embed.on("ended",()=>{t.media.paused=!0,E.call(t,t.media,"ended")}),t.embed.on("error",y=>{t.media.error=y,E.call(t,t.media,"error")}),e.customControls&&setTimeout(()=>Z.build.call(t),0)}};function hp(t){return h.empty(t)?null:t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:t}function Pt(t){t&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===t&&(this.media.paused=!t,E.call(this,this.media,t?"play":"pause"))}function dp(t){return t.noCookie?"https://www.youtube-nocookie.com":window.location.protocol==="http:"?"http://www.youtube.com":void 0}const xi={setup(){if(W(this.elements.wrapper,this.config.classNames.embed,!0),h.object(window.YT)&&h.function(window.YT.Player))xi.ready.call(this);else{const t=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{h.function(t)&&t(),xi.ready.call(this)},ur(this.config.urls.youtube.sdk).catch(e=>{this.debug.warn("YouTube API failed to load",e)})}},getTitle(t){ri(Es(this.config.urls.youtube.api,t)).then(e=>{if(h.object(e)){const{title:i,height:s,width:r}=e;this.config.title=i,Z.setTitle.call(this),this.embed.ratio=io(r,s)}It.call(this)}).catch(()=>{It.call(this)})},ready(){const t=this,e=t.config.youtube,i=t.media&&t.media.getAttribute("id");if(!h.empty(i)&&i.startsWith("youtube-"))return;let s=t.media.getAttribute("src");h.empty(s)&&(s=t.media.getAttribute(this.config.attributes.embed.id));const r=hp(s),a=N("div",{id:qu(t.provider),"data-poster":e.customControls?t.poster:void 0});if(t.media=Ai(a,t.media),e.customControls){const n=o=>`https://i.ytimg.com/vi/${r}/${o}default.jpg`;vi(n("maxres"),121).catch(()=>vi(n("sd"),121)).catch(()=>vi(n("hq"))).then(o=>Z.setPoster.call(t,o.src)).then(o=>{o.includes("maxres")||(t.elements.poster.style.backgroundSize="cover")}).catch(()=>{})}t.embed=new window.YT.Player(t.media,{videoId:r,host:dp(e),playerVars:J({},{autoplay:t.config.autoplay?1:0,hl:t.config.hl,controls:t.supported.ui&&e.customControls?0:1,disablekb:1,playsinline:t.config.fullscreen.iosNative?0:1,cc_load_policy:t.captions.active?1:0,cc_lang_pref:t.config.captions.language,widget_referrer:window?window.location.href:null},e),events:{onError(n){if(!t.media.error){const o=n.data,c={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[o]||"An unknown error occured";t.media.error={code:o,message:c},E.call(t,t.media,"error")}},onPlaybackRateChange(n){const o=n.target;t.media.playbackRate=o.getPlaybackRate(),E.call(t,t.media,"ratechange")},onReady(n){if(h.function(t.media.play))return;const o=n.target;xi.getTitle.call(t,r),t.media.play=()=>{Pt.call(t,!0),o.playVideo()},t.media.pause=()=>{Pt.call(t,!1),o.pauseVideo()},t.media.stop=()=>{o.stopVideo()},t.media.duration=o.getDuration(),t.media.paused=!0,t.media.currentTime=0,Object.defineProperty(t.media,"currentTime",{get:()=>Number(o.getCurrentTime()),set(u){t.paused&&!t.embed.hasPlayed&&t.embed.mute(),t.media.seeking=!0,E.call(t,t.media,"seeking"),o.seekTo(u)}}),Object.defineProperty(t.media,"playbackRate",{get:()=>o.getPlaybackRate(),set(u){o.setPlaybackRate(u)}});let{volume:c}=t.config;Object.defineProperty(t.media,"volume",{get:()=>c,set(u){c=u,o.setVolume(100*c),E.call(t,t.media,"volumechange")}});let{muted:l}=t.config;Object.defineProperty(t.media,"muted",{get:()=>l,set(u){const p=h.boolean(u)?u:l;l=p,o[p?"mute":"unMute"](),o.setVolume(100*c),E.call(t,t.media,"volumechange")}}),Object.defineProperty(t.media,"currentSrc",{get:()=>o.getVideoUrl()}),Object.defineProperty(t.media,"ended",{get:()=>t.currentTime===t.duration});const d=o.getAvailablePlaybackRates();t.options.speed=d.filter(u=>t.config.speed.options.includes(u)),t.supported.ui&&e.customControls&&t.media.setAttribute("tabindex",-1),E.call(t,t.media,"timeupdate"),E.call(t,t.media,"durationchange"),clearInterval(t.timers.buffering),t.timers.buffering=setInterval(()=>{t.media.buffered=o.getVideoLoadedFraction(),(t.media.lastBuffered===null||t.media.lastBuffered<t.media.buffered)&&E.call(t,t.media,"progress"),t.media.lastBuffered=t.media.buffered,t.media.buffered===1&&(clearInterval(t.timers.buffering),E.call(t,t.media,"canplaythrough"))},200),e.customControls&&setTimeout(()=>Z.build.call(t),50)},onStateChange(n){const o=n.target;switch(clearInterval(t.timers.playing),t.media.seeking&&[1,2].includes(n.data)&&(t.media.seeking=!1,E.call(t,t.media,"seeked")),n.data){case-1:E.call(t,t.media,"timeupdate"),t.media.buffered=o.getVideoLoadedFraction(),E.call(t,t.media,"progress");break;case 0:Pt.call(t,!1),t.media.loop?(o.stopVideo(),o.playVideo()):E.call(t,t.media,"ended");break;case 1:e.customControls&&!t.config.autoplay&&t.media.paused&&!t.embed.hasPlayed?t.media.pause():(Pt.call(t,!0),E.call(t,t.media,"playing"),t.timers.playing=setInterval(()=>{E.call(t,t.media,"timeupdate")},50),t.media.duration!==o.getDuration()&&(t.media.duration=o.getDuration(),E.call(t,t.media,"durationchange")));break;case 2:t.muted||t.embed.unMute(),Pt.call(t,!1);break;case 3:E.call(t,t.media,"waiting")}E.call(t,t.elements.container,"statechange",!1,{code:n.data})}}})}},co={setup(){this.media?(W(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),W(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&W(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=N("div",{class:this.config.classNames.video}),Xn(this.media,this.elements.wrapper),this.elements.poster=N("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?Ke.setup.call(this):this.isYouTube?xi.setup.call(this):this.isVimeo&&Ps.setup.call(this)):this.debug.warn("No media element found!")}};class up{constructor(e){_(this,"load",()=>{this.enabled&&(h.object(window.google)&&h.object(window.google.ima)?this.ready():ur(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))}))}),_(this,"ready",()=>{var i;this.enabled||((i=this).manager&&i.manager.destroy(),i.elements.displayContainer&&i.elements.displayContainer.destroy(),i.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(()=>{this.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}),_(this,"setupIMA",()=>{this.elements.container=N("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,i=>this.onAdsManagerLoaded(i),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,i=>this.onAdError(i),!1),this.requestAds()}),_(this,"requestAds",()=>{const{container:i}=this.player.elements;try{const s=new google.ima.AdsRequest;s.adTagUrl=this.tagUrl,s.linearAdSlotWidth=i.offsetWidth,s.linearAdSlotHeight=i.offsetHeight,s.nonLinearAdSlotWidth=i.offsetWidth,s.nonLinearAdSlotHeight=i.offsetHeight,s.forceNonLinearFullSlot=!1,s.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(s)}catch(s){this.onAdError(s)}}),_(this,"pollCountdown",(i=!1)=>{if(!i)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval(()=>{const s=Wi(Math.max(this.manager.getRemainingTime(),0)),r=`${K.get("advertisement",this.player.config)} - ${s}`;this.elements.container.setAttribute("data-badge-text",r)},100)}),_(this,"onAdsManagerLoaded",i=>{if(!this.enabled)return;const s=new google.ima.AdsRenderingSettings;s.restoreCustomPlaybackStateOnAdBreakComplete=!0,s.enablePreloading=!0,this.manager=i.getAdsManager(this.player,s),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,r=>this.onAdError(r)),Object.keys(google.ima.AdEvent.Type).forEach(r=>{this.manager.addEventListener(google.ima.AdEvent.Type[r],a=>this.onAdEvent(a))}),this.trigger("loaded")}),_(this,"addCuePoints",()=>{h.empty(this.cuePoints)||this.cuePoints.forEach(i=>{if(i!==0&&i!==-1&&i<this.player.duration){const s=this.player.elements.progress;if(h.element(s)){const r=100/this.player.duration*i,a=N("span",{class:this.player.config.classNames.cues});a.style.left=`${r.toString()}%`,s.appendChild(a)}}})}),_(this,"onAdEvent",i=>{const{container:s}=this.player.elements,r=i.getAd(),a=i.getAdData();switch((n=>{E.call(this.player,this.player.media,`ads${n.replace(/_/g,"").toLowerCase()}`)})(i.type),i.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),r.isLinear()||(r.width=s.offsetWidth,r.height=s.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:a.adError&&this.player.debug.warn(`Non-fatal ad error: ${a.adError.getMessage()}`)}}),_(this,"onAdError",i=>{this.cancel(),this.player.debug.warn("Ads error",i)}),_(this,"listeners",()=>{const{container:i}=this.player.elements;let s;this.player.on("canplay",()=>{this.addCuePoints()}),this.player.on("ended",()=>{this.loader.contentComplete()}),this.player.on("timeupdate",()=>{s=this.player.currentTime}),this.player.on("seeked",()=>{const r=this.player.currentTime;h.empty(this.cuePoints)||this.cuePoints.forEach((a,n)=>{s<a&&a<r&&(this.manager.discardAdBreak(),this.cuePoints.splice(n,1))})}),window.addEventListener("resize",()=>{this.manager&&this.manager.resize(i.offsetWidth,i.offsetHeight,google.ima.ViewMode.NORMAL)})}),_(this,"play",()=>{const{container:i}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then(()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(i.offsetWidth,i.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(s){this.onAdError(s)}}).catch(()=>{})}),_(this,"resumeContent",()=>{this.elements.container.style.zIndex="",this.playing=!1,Be(this.player.media.play())}),_(this,"pauseContent",()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}),_(this,"cancel",()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}),_(this,"loadAds",()=>{this.managerPromise.then(()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise(i=>{this.on("loaded",i),this.player.debug.log(this.manager)}),this.initialized=!1,this.requestAds()}).catch(()=>{})}),_(this,"trigger",(i,...s)=>{const r=this.events[i];h.array(r)&&r.forEach(a=>{h.function(a)&&a.apply(this,s)})}),_(this,"on",(i,s)=>(h.array(this.events[i])||(this.events[i]=[]),this.events[i].push(s),this)),_(this,"startSafetyTimer",(i,s)=>{this.player.debug.log(`Safety timer invoked from: ${s}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")},i)}),_(this,"clearSafetyTimer",i=>{h.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${i}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)}),this.player=e,this.config=e.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((i,s)=>{this.on("loaded",i),this.on("error",s)}),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!h.empty(e.publisherId)||h.url(e.tagUrl))}get tagUrl(){const{config:e}=this;return h.url(e.tagUrl)?e.tagUrl:`https://go.aniview.com/api/adserver6/vast/?${oo({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}}function ho(t=0,e=0,i=255){return Math.min(Math.max(t,e),i)}const pp=t=>{const e=[];return t.split(/\r\n\r\n|\n\n|\r\r/).forEach(i=>{const s={};i.split(/\r\n|\n|\r/).forEach(r=>{if(h.number(s.startTime)){if(!h.empty(r.trim())&&h.empty(s.text)){const a=r.trim().split("#xywh=");[s.text]=a,a[1]&&([s.x,s.y,s.w,s.h]=a[1].split(","))}}else{const a=r.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);a&&(s.startTime=60*Number(a[1]||0)*60+60*Number(a[2])+Number(a[3])+Number(`0.${a[4]}`),s.endTime=60*Number(a[6]||0)*60+60*Number(a[7])+Number(a[8])+Number(`0.${a[9]}`))}}),s.text&&e.push(s)}),e},ca=(t,e)=>{const i={};return t>e.width/e.height?(i.width=e.width,i.height=1/t*e.width):(i.height=e.height,i.width=t*e.height),i};class zs{constructor(e){_(this,"load",()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then(()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.loaded=!0)})}),_(this,"getThumbnails",()=>new Promise(i=>{const{src:s}=this.player.config.previewThumbnails;if(h.empty(s))throw new Error("Missing previewThumbnails.src config attribute");const r=()=>{this.thumbnails.sort((a,n)=>a.height-n.height),this.player.debug.log("Preview thumbnails",this.thumbnails),i()};if(h.function(s))s(a=>{this.thumbnails=a,r()});else{const a=(h.string(s)?[s]:s).map(n=>this.getThumbnail(n));Promise.all(a).then(r)}})),_(this,"getThumbnail",i=>new Promise(s=>{ri(i).then(r=>{const a={frames:pp(r),height:null,urlPrefix:""};a.frames[0].text.startsWith("/")||a.frames[0].text.startsWith("http://")||a.frames[0].text.startsWith("https://")||(a.urlPrefix=i.substring(0,i.lastIndexOf("/")+1));const n=new Image;n.onload=()=>{a.height=n.naturalHeight,a.width=n.naturalWidth,this.thumbnails.push(a),s()},n.src=a.urlPrefix+a.frames[0].text})})),_(this,"startMove",i=>{if(this.loaded&&h.event(i)&&["touchmove","mousemove"].includes(i.type)&&this.player.media.duration){if(i.type==="touchmove")this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var s,r;const a=this.player.elements.progress.getBoundingClientRect(),n=100/a.width*(i.pageX-a.left);this.seekTime=this.player.media.duration*(n/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=i.pageX,this.elements.thumb.time.innerText=Wi(this.seekTime);const o=(s=this.player.config.markers)===null||s===void 0||(r=s.points)===null||r===void 0?void 0:r.find(({time:c})=>c===Math.round(this.seekTime));o&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${o.label}<br>`)}this.showImageAtCurrentTime()}}),_(this,"endMove",()=>{this.toggleThumbContainer(!1,!0)}),_(this,"startScrubbing",i=>{(h.nullOrUndefined(i.button)||i.button===!1||i.button===0)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}),_(this,"endScrubbing",()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):hr.call(this.player,this.player.media,"timeupdate",()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}),_(this,"listeners",()=>{this.player.on("play",()=>{this.toggleThumbContainer(!1,!0)}),this.player.on("seeked",()=>{this.toggleThumbContainer(!1)}),this.player.on("timeupdate",()=>{this.lastTime=this.player.media.currentTime})}),_(this,"render",()=>{this.elements.thumb.container=N("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=N("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const i=N("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=N("span",{},"00:00"),i.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(i),h.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=N("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}),_(this,"destroy",()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}),_(this,"showImageAtCurrentTime",()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const i=this.thumbnails[0].frames.findIndex(a=>this.seekTime>=a.startTime&&this.seekTime<=a.endTime),s=i>=0;let r=0;this.mouseDown||this.toggleThumbContainer(s),s&&(this.thumbnails.forEach((a,n)=>{this.loadedImages.includes(a.frames[i].text)&&(r=n)}),i!==this.showingThumb&&(this.showingThumb=i,this.loadImage(r)))}),_(this,"loadImage",(i=0)=>{const s=this.showingThumb,r=this.thumbnails[i],{urlPrefix:a}=r,n=r.frames[s],o=r.frames[s].text,c=a+o;if(this.currentImageElement&&this.currentImageElement.dataset.filename===o)this.showImage(this.currentImageElement,n,i,s,o,!1),this.currentImageElement.dataset.index=s,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const l=new Image;l.src=c,l.dataset.index=s,l.dataset.filename=o,this.showingThumbFilename=o,this.player.debug.log(`Loading image: ${c}`),l.onload=()=>this.showImage(l,n,i,s,o,!0),this.loadingImage=l,this.removeOldImages(l)}}),_(this,"showImage",(i,s,r,a,n,o=!0)=>{this.player.debug.log(`Showing thumb: ${n}. num: ${a}. qual: ${r}. newimg: ${o}`),this.setImageSizeAndOffset(i,s),o&&(this.currentImageContainer.appendChild(i),this.currentImageElement=i,this.loadedImages.includes(n)||this.loadedImages.push(n)),this.preloadNearby(a,!0).then(this.preloadNearby(a,!1)).then(this.getHigherQuality(r,i,s,n))}),_(this,"removeOldImages",i=>{Array.from(this.currentImageContainer.children).forEach(s=>{if(s.tagName.toLowerCase()!=="img")return;const r=this.usingSprites?500:1e3;if(s.dataset.index!==i.dataset.index&&!s.dataset.deleting){s.dataset.deleting=!0;const{currentImageContainer:a}=this;setTimeout(()=>{a.removeChild(s),this.player.debug.log(`Removing thumb: ${s.dataset.filename}`)},r)}})}),_(this,"preloadNearby",(i,s=!0)=>new Promise(r=>{setTimeout(()=>{const a=this.thumbnails[0].frames[i].text;if(this.showingThumbFilename===a){let n;n=s?this.thumbnails[0].frames.slice(i):this.thumbnails[0].frames.slice(0,i).reverse();let o=!1;n.forEach(c=>{const l=c.text;if(l!==a&&!this.loadedImages.includes(l)){o=!0,this.player.debug.log(`Preloading thumb filename: ${l}`);const{urlPrefix:d}=this.thumbnails[0],u=d+l,p=new Image;p.src=u,p.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${l}`),this.loadedImages.includes(l)||this.loadedImages.push(l),r()}}}),o||r()}},300)})),_(this,"getHigherQuality",(i,s,r,a)=>{if(i<this.thumbnails.length-1){let n=s.naturalHeight;this.usingSprites&&(n=r.h),n<this.thumbContainerHeight&&setTimeout(()=>{this.showingThumbFilename===a&&(this.player.debug.log(`Showing higher quality thumb for: ${a}`),this.loadImage(i+1))},300)}}),_(this,"toggleThumbContainer",(i=!1,s=!1)=>{const r=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(r,i),!i&&s&&(this.showingThumb=null,this.showingThumbFilename=null)}),_(this,"toggleScrubbingContainer",(i=!1)=>{const s=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(s,i),i||(this.showingThumb=null,this.showingThumbFilename=null)}),_(this,"determineContainerAutoSizing",()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}),_(this,"setThumbContainerSizeAndPos",()=>{const{imageContainer:i}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(i.clientHeight>20&&i.clientWidth<20){const s=Math.floor(i.clientHeight*this.thumbAspectRatio);i.style.width=`${s}px`}else if(i.clientHeight<20&&i.clientWidth>20){const s=Math.floor(i.clientWidth/this.thumbAspectRatio);i.style.height=`${s}px`}}else{const s=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);i.style.height=`${this.thumbContainerHeight}px`,i.style.width=`${s}px`}this.setThumbContainerPos()}),_(this,"setThumbContainerPos",()=>{const i=this.player.elements.progress.getBoundingClientRect(),s=this.player.elements.container.getBoundingClientRect(),{container:r}=this.elements.thumb,a=s.left-i.left+10,n=s.right-i.left-r.clientWidth-10,o=this.mousePosX-i.left-r.clientWidth/2,c=ho(o,a,n);r.style.left=`${c}px`,r.style.setProperty("--preview-arrow-offset",o-c+"px")}),_(this,"setScrubbingContainerSize",()=>{const{width:i,height:s}=ca(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${i}px`,this.elements.scrubbing.container.style.height=`${s}px`}),_(this,"setImageSizeAndOffset",(i,s)=>{if(!this.usingSprites)return;const r=this.thumbContainerHeight/s.h;i.style.height=i.naturalHeight*r+"px",i.style.width=i.naturalWidth*r+"px",i.style.left=`-${s.x*r}px`,i.style.top=`-${s.y*r}px`}),this.player=e,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=ca(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}const Ds={insertElements(t,e){h.string(e)?aa(t,this.media,{src:e}):h.array(e)&&e.forEach(i=>{aa(t,this.media,i)})},change(t){Jn(t,"sources.length")?(Ke.cancelRequests.call(this),this.destroy.call(this,()=>{this.options.quality=[],He(this.media),this.media=null,h.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:e,type:i}=t,[{provider:s=qe.html5,src:r}]=e,a=s==="html5"?i:"div",n=s==="html5"?{}:{src:r};Object.assign(this,{provider:s,type:i,supported:q.check(i,s,this.config.playsinline),media:N(a,n)}),this.elements.container.appendChild(this.media),h.boolean(t.autoplay)&&(this.config.autoplay=t.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),h.empty(t.poster)||(this.poster=t.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),Z.addStyleHook.call(this),this.isHTML5&&Ds.insertElements.call(this,"source",e),this.config.title=t.title,co.setup.call(this),this.isHTML5&&Object.keys(t).includes("tracks")&&Ds.insertElements.call(this,"track",t.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Z.build.call(this),this.isHTML5&&this.media.load(),h.empty(t.previewThumbnails)||(Object.assign(this.config.previewThumbnails,t.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new zs(this))),this.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}};class Xt{constructor(e,i){if(_(this,"play",()=>h.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>Be(this.media.play())),this.media.play()):null),_(this,"pause",()=>this.playing&&h.function(this.media.pause)?this.media.pause():null),_(this,"togglePlay",o=>(h.boolean(o)?o:!this.playing)?this.play():this.pause()),_(this,"stop",()=>{this.isHTML5?(this.pause(),this.restart()):h.function(this.media.stop)&&this.media.stop()}),_(this,"restart",()=>{this.currentTime=0}),_(this,"rewind",o=>{this.currentTime-=h.number(o)?o:this.config.seekTime}),_(this,"forward",o=>{this.currentTime+=h.number(o)?o:this.config.seekTime}),_(this,"increaseVolume",o=>{const c=this.media.muted?0:this.volume;this.volume=c+(h.number(o)?o:0)}),_(this,"decreaseVolume",o=>{this.increaseVolume(-o)}),_(this,"airplay",()=>{q.airplay&&this.media.webkitShowPlaybackTargetPicker()}),_(this,"toggleControls",o=>{if(this.supported.ui&&!this.isAudio){const c=ki(this.elements.container,this.config.classNames.hideControls),l=o===void 0?void 0:!o,d=W(this.elements.container,this.config.classNames.hideControls,l);if(d&&h.array(this.config.controls)&&this.config.controls.includes("settings")&&!h.empty(this.config.settings)&&S.toggleMenu.call(this,!1),d!==c){const u=d?"controlshidden":"controlsshown";E.call(this,this.media,u)}return!d}return!1}),_(this,"on",(o,c)=>{H.call(this,this.elements.container,o,c)}),_(this,"once",(o,c)=>{hr.call(this,this.elements.container,o,c)}),_(this,"off",(o,c)=>{Ui(this.elements.container,o,c)}),_(this,"destroy",(o,c=!1)=>{if(!this.ready)return;const l=()=>{document.body.style.overflow="",this.embed=null,c?(Object.keys(this.elements).length&&(He(this.elements.buttons.play),He(this.elements.captions),He(this.elements.controls),He(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),h.function(o)&&o()):(Yu.call(this),Ke.cancelRequests.call(this),Ai(this.elements.original,this.elements.container),E.call(this,this.elements.original,"destroyed",!0),h.function(o)&&o.call(this.elements.original),this.ready=!1,setTimeout(()=>{this.elements=null,this.media=null},200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(Z.toggleNativeControls.call(this,!0),l()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),this.embed!==null&&h.function(this.embed.destroy)&&this.embed.destroy(),l()):this.isVimeo&&(this.embed!==null&&this.embed.unload().then(l),setTimeout(l,200))}),_(this,"supports",o=>q.mime.call(this,o)),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=q.touch,this.media=e,h.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||h.nodeList(this.media)||h.array(this.media))&&(this.media=this.media[0]),this.config=J({},lo,Xt.defaults,i||{},(()=>{try{return JSON.parse(this.media.getAttribute("data-plyr-config"))}catch{return{}}})()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new rp(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",q),h.nullOrUndefined(this.media)||!h.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!q.check().api)return void this.debug.error("Setup failed: no support");const s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;const r=this.media.tagName.toLowerCase();let a=null,n=null;switch(r){case"div":if(a=this.media.querySelector("iframe"),h.element(a)){if(n=no(a.getAttribute("src")),this.provider=sp(n.toString()),this.elements.container=this.media,this.media=a,this.elements.container.className="",n.search.length){const o=["1","true"];o.includes(n.searchParams.get("autoplay"))&&(this.config.autoplay=!0),o.includes(n.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=o.includes(n.searchParams.get("playsinline")),this.config.youtube.hl=n.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(h.empty(this.provider)||!Object.values(qe).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=hs.video;break;case"video":case"audio":this.type=r,this.provider=qe.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=q.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new ap(this),this.storage=new Jt(this),this.media.plyr=this,h.element(this.elements.container)||(this.elements.container=N("div",{tabindex:0}),Xn(this.media,this.elements.container)),Z.migrateStyles.call(this),Z.addStyleHook.call(this),co.setup.call(this),this.config.debug&&H.call(this,this.elements.container,this.config.events.join(" "),o=>{this.debug.log(`event: ${o.type}`)}),this.fullscreen=new Ve(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Z.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new up(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",()=>Be(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new zs(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===qe.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===qe.youtube}get isVimeo(){return this.provider===qe.vimeo}get isVideo(){return this.type===hs.video}get isAudio(){return this.type===hs.audio}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&this.currentTime===0)}get ended(){return Boolean(this.media.ended)}set currentTime(e){if(!this.duration)return;const i=h.number(e)&&e>0;this.media.currentTime=i?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return h.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const e=parseFloat(this.config.duration),i=(this.media||{}).duration,s=h.number(i)&&i!==1/0?i:0;return e||s}set volume(e){let i=e;h.string(i)&&(i=Number(i)),h.number(i)||(i=this.storage.get("volume")),h.number(i)||({volume:i}=this.config),i>1&&(i=1),i<0&&(i=0),this.config.volume=i,this.media.volume=i,!h.empty(e)&&this.muted&&i>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let i=e;h.boolean(i)||(i=this.storage.get("muted")),h.boolean(i)||(i=this.config.muted),this.config.muted=i,this.media.muted=i}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||!!this.isAudio||Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)}set speed(e){let i=null;h.number(e)&&(i=e),h.number(i)||(i=this.storage.get("speed")),h.number(i)||(i=this.config.speed.selected);const{minimumSpeed:s,maximumSpeed:r}=this;i=ho(i,s,r),this.config.speed.selected=i,setTimeout(()=>{this.media&&(this.media.playbackRate=i)},0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const i=this.config.quality,s=this.options.quality;if(!s.length)return;let r=[!h.empty(e)&&Number(e),this.storage.get("quality"),i.selected,i.default].find(h.number),a=!0;if(!s.includes(r)){const n=Kn(s,r);this.debug.warn(`Unsupported quality option: ${r}, using ${n} instead`),r=n,a=!1}i.selected=r,this.media.quality=r,a&&this.storage.set({quality:r})}get quality(){return this.media.quality}set loop(e){const i=h.boolean(e)?e:this.config.loop.active;this.config.loop.active=i,this.media.loop=i}get loop(){return Boolean(this.media.loop)}set source(e){Ds.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return h.url(e)?e:this.source}set download(e){h.url(e)&&(this.config.urls.download=e,S.setDownloadUrl.call(this))}set poster(e){this.isVideo?Z.setPoster.call(this,e,!1).catch(()=>{}):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=Ti(dr.call(this));return h.array(e)?e.join(":"):e}set ratio(e){this.isVideo?h.string(e)&&to(e)?(this.config.ratio=Ti(e),It.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){this.config.autoplay=h.boolean(e)?e:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(e){F.toggle.call(this,e,!1)}set currentTrack(e){F.set.call(this,e,!1),F.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:i}=this.captions;return e?i:-1}set language(e){F.setLanguage.call(this,e,!1)}get language(){return(F.getCurrentTrack.call(this)||{}).language}set pip(e){if(!q.pip)return;const i=h.boolean(e)?e:!this.pip;h.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(i?cs.active:cs.inactive),h.function(this.media.requestPictureInPicture)&&(!this.pip&&i?this.media.requestPictureInPicture():this.pip&&!i&&document.exitPictureInPicture())}get pip(){return q.pip?h.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===cs.active:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new zs(this))}static supported(e,i,s){return q.check(e,i,s)}static loadSprite(e,i){return ro(e,i)}static setup(e,i={}){let s=null;return h.string(e)?s=Array.from(document.querySelectorAll(e)):h.nodeList(e)?s=Array.from(e):h.array(e)&&(s=e.filter(h.element)),h.empty(s)?null:s.map(r=>new Xt(r,i))}}Xt.defaults=Wu(lo);function gp(t){let e,i,s;return{c(){e=Ct("video"),i=Ct("source"),Pn(i.src,s=t[3])||I(i,"src",s),I(i,"type",t[2]),I(e,"data-app-kind","Plyr"),I(e,"crossorigin","anonymous"),e.playsInline=!0,I(e,"data-poster",t[4])},m(r,a){At(r,e,a),V(e,i),t[8](e)},p:st,d(r){r&&ft(e),t[8](null)}}}function mp(t){let e,i,s;return{c(){e=Ct("audio"),i=Ct("source"),Pn(i.src,s=t[3])||I(i,"src",s),I(i,"type",t[2]),I(e,"data-app-kind","Plyr"),I(e,"crossorigin","anonymous"),I(e,"data-poster",t[4])},m(r,a){At(r,e,a),V(e,i),t[7](e)},p:st,d(r){r&&ft(e),t[7](null)}}}function fp(t){let e,i,s=JSON.stringify({src:t[3],type:t[0].state.type})+"",r;return{c(){e=Ct("div"),i=Is(`Invalid "src" or "type".
126
+ `),r=Is(s),I(e,"data-app-kind","Plyr"),I(e,"class","plyr--audio")},m(a,n){At(a,e,n),V(e,i),V(e,r)},p(a,n){n&1&&s!==(s=JSON.stringify({src:a[3],type:a[0].state.type})+"")&&Jd(r,s)},d(a){a&&ft(e)}}}function bp(t){let e;return{c(){e=Ct("div"),I(e,"data-app-kind","Plyr"),I(e,"class","plyr__video-embed"),I(e,"data-plyr-provider","youtube"),I(e,"data-plyr-embed-id",t[3]),I(e,"data-poster",t[4])},m(i,s){At(i,e,s),t[6](e)},p:st,d(i){i&&ft(e),t[6](null)}}}function yp(t){let e,i,s,r;function a(c,l){return c[0].state.provider==="youtube"?bp:c[2]?(e==null&&(e=!!c[2].startsWith("audio/")),e?mp:gp):fp}let n=a(t),o=n(t);return s=new bu({}),{c(){o.c(),i=Gd(),au(s.$$.fragment)},m(c,l){o.m(c,l),At(c,i,l),Vn(s,c,l),r=!0},p(c,[l]){n===(n=a(c))&&o?o.p(c,l):(o.d(1),o=n(c),o&&(o.c(),o.m(i.parentNode,i)))},i(c){r||(Ln(s.$$.fragment,c),r=!0)},o(c){ru(s.$$.fragment,c),r=!1},d(c){o.d(c),c&&ft(i),$n(s,c)}}}function wp(t,e,i){let{storage:s}=e,{sync:r}=e;const a=s.state.provider?void 0:s.state.type||cu(s.state.src),{src:n,poster:o}=s.state,c=lu.includes(String(a).toLowerCase());let l,d;Xd(async()=>{if(l){if(c&&pu(l)){const g=await uu();g.loadSource(n),g.attachMedia(l)}d=new Xt(l,{fullscreen:{enabled:!1},controls:["play","progress","current-time","mute","volume"],clickToPlay:!1,youtube:{autoplay:!0},loadSprite:!1}),i(5,r.player=d,r)}}),Kd(()=>{try{r.dispose(),d==null||d.destroy()}catch(g){console.warn("[Plyr] destroy plyr error",g)}});function u(g){Ht[g?"unshift":"push"](()=>{l=g,i(1,l)})}function p(g){Ht[g?"unshift":"push"](()=>{l=g,i(1,l)})}function m(g){Ht[g?"unshift":"push"](()=>{l=g,i(1,l)})}return t.$$set=g=>{"storage"in g&&i(0,s=g.storage),"sync"in g&&i(5,r=g.sync)},[s,l,a,n,o,r,u,p,m]}class vp extends Bn{constructor(e){super();jn(this,e,wp,yp,En,{storage:0,sync:5})}}class xp{constructor(e){this.context=e,this.behavior="owner",this._skip_next_play_pause=0,this._sync_timer=0,this._interval=1e3,this._blink=0,this._player=null,this._buffering=!1,this._throttle=0,this._dispatch_time_again=!1,this._buffering_timer=0,this._disposer=null;const i=e.room,s=e.displayer;this.uid=i?i.uid:"",this.getTimestamp=i?()=>i.calibrationTimestamp:()=>s.beginTimestamp+s.progressTime,this._disposer=this.context.storage.addStateChangedListener(this.syncAll.bind(this))}dispose(){this._disposer&&this._disposer(),this._disposer=null,clearInterval(this._sync_timer),clearTimeout(this._buffering_timer)}get player(){return this._player}set player(e){this._player=e,e&&e.once("ready",this.setupPlayer.bind(this,e))}setupPlayer(e){this.registerListeners(e),this.watchUserInputs(e),this._sync_timer=setInterval(this.syncAll.bind(this),this._interval)}syncAll(){const{behavior:e,player:i,context:s}=this;if(!i)return;const{storage:r}=s,{currentTime:a,hostTime:n,muted:o,paused:c,volume:l,owner:d}=r.state;e==="owner"&&d===this.uid||(c!==i.paused&&!this._skip_next_play_pause&&(console.log("< sync paused",c),c?i.pause():hu(i)),o!==i.muted&&(console.log("< sync muted",o),i.muted=o),l!==i.volume&&(console.log("< sync volume",l),i.volume=l),!this._buffering&&(c?Math.abs(i.currentTime-a)>.5&&(console.log("< sync current time (paused)",a),i.currentTime=a):this.syncCurrentTime(n,a,i)))}watchUserInputs(e){const i=e.elements.controls,s=mu(e.elements.buttons.play),r=i==null?void 0:i.querySelector('input[data-plyr="seek"]'),a=i==null?void 0:i.querySelector('button[data-plyr="mute"]'),n=i==null?void 0:i.querySelector('input[data-plyr="volume"]');this.fixSeekBarOnInit(r,e),s==null||s.addEventListener("click",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchPlayPause(e)}),r==null||r.addEventListener("change",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchSeek(e,r)}),a==null||a.addEventListener("click",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchVolume(e)}),n==null||n.addEventListener("change",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchVolume(e)})}fixSeekBarOnInit(e,i){const{currentTime:s}=this.context.storage.state;if(i.duration&&s&&e){const r=100*s/i.duration;e.value=r.toFixed(2)}}registerListeners(e){e.on("ended",()=>{e.stop(),this.context.storage.setState({paused:!0,currentTime:0})}),e.on("waiting",()=>{this._buffering=!0,this._buffering_timer=setTimeout(this.clearBuffering.bind(this),this._interval/2)}),e.on("playing",()=>{this._buffering=!1}),e.on("timeupdate",()=>{this.isOwner()&&this.dispatchCurrentTime(e)}),e.on("volumechange",()=>{this.isOwner()&&this.dispatchVolume(e)}),e.on("play",()=>{this.isOwner()&&this.dispatchPlayPause(e)}),e.on("pause",()=>{this.isOwner()&&this.dispatchPlayPause(e)})}clearBuffering(){this._buffering=!1,this._buffering_timer=0}dispatchOwner(){this.context.storage.state.owner!==this.uid&&(console.log("> set owner",this.uid),this.context.storage.setState({owner:this.uid}))}dispatchPlayPause(e){console.log("> set paused",e.paused),this.context.storage.setState({hostTime:this.getTimestamp(),currentTime:e.currentTime,paused:e.paused}),clearTimeout(this._skip_next_play_pause),this._skip_next_play_pause=setTimeout(this.skipNextPlayPause.bind(this),500)}skipNextPlayPause(){this._skip_next_play_pause=0}dispatchVolume(e){console.log("> set volume",e.volume),this.context.storage.setState({muted:e.muted,volume:e.volume})}dispatchSeek(e,i){const s=i.valueAsNumber*e.duration/100;console.log("> set current time (seek)",s),this.context.storage.setState({hostTime:this.getTimestamp(),currentTime:s})}dispatchCurrentTime(e){if(this._throttle){this._dispatch_time_again=!0;return}console.log("> set current time",e.currentTime),this.context.storage.setState({hostTime:this.getTimestamp(),currentTime:e.currentTime}),this._throttle=setTimeout(this.clearThrottle.bind(this,e),1e3)}clearThrottle(e){this._throttle=0,this._dispatch_time_again&&(this._dispatch_time_again=!1,this.dispatchCurrentTime(e))}isOwner(){return this.behavior==="owner"&&this.context.storage.state.owner===this.uid}syncCurrentTime(e,i,s){const r=this.getTimestamp();if(r&&e){const a=i+(r-e)/1e3;Math.abs(a-s.currentTime)>1?(console.log("< sync current time (playing)",a),s.currentTime=a,this._blink++,this._blink>3&&this.updateSyncInterval(!0)):this.updateSyncInterval(!1)}}updateSyncInterval(e){this._blink=0,this._interval=gu(this._interval+(e?2e3:-2e3),1e3,15e3),clearTimeout(this._sync_timer),this._sync_timer=setInterval(this.syncAll.bind(this),this._interval)}}var Mp=(()=>`@charset "UTF-8";@keyframes plyr-progress{to{background-position:25px 0;background-position:var(--plyr-progress-loading-size,25px) 0}}@keyframes plyr-popup{0%{opacity:.5;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes plyr-fade-in{0%{opacity:0}to{opacity:1}}.plyr{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;align-items:center;direction:ltr;display:flex;flex-direction:column;font-family:inherit;font-family:var(--plyr-font-family,inherit);font-variant-numeric:tabular-nums;font-weight:400;font-weight:var(--plyr-font-weight-regular,400);line-height:1.7;line-height:var(--plyr-line-height,1.7);max-width:100%;min-width:200px;position:relative;text-shadow:none;transition:box-shadow .3s ease;z-index:0}.plyr audio,.plyr iframe,.plyr video{display:block;height:100%;width:100%}.plyr button{font:inherit;line-height:inherit;width:auto}.plyr:focus{outline:0}.plyr--full-ui{box-sizing:border-box}.plyr--full-ui *,.plyr--full-ui :after,.plyr--full-ui :before{box-sizing:inherit}.plyr--full-ui a,.plyr--full-ui button,.plyr--full-ui input,.plyr--full-ui label{touch-action:manipulation}.plyr__badge{background:#4a5464;background:var(--plyr-badge-background,#4a5464);border-radius:2px;border-radius:var(--plyr-badge-border-radius,2px);color:#fff;color:var(--plyr-badge-text-color,#fff);font-size:9px;font-size:var(--plyr-font-size-badge,9px);line-height:1;padding:3px 4px}.plyr--full-ui ::-webkit-media-text-track-container{display:none}.plyr__captions{animation:plyr-fade-in .3s ease;bottom:0;display:none;font-size:13px;font-size:var(--plyr-font-size-small,13px);left:0;padding:10px;padding:var(--plyr-control-spacing,10px);position:absolute;text-align:center;transition:transform .4s ease-in-out;width:100%}.plyr__captions span:empty{display:none}@media (min-width:480px){.plyr__captions{font-size:15px;font-size:var(--plyr-font-size-base,15px);padding:20px;padding:calc(var(--plyr-control-spacing, 10px)*2)}}@media (min-width:768px){.plyr__captions{font-size:18px;font-size:var(--plyr-font-size-large,18px)}}.plyr--captions-active .plyr__captions{display:block}.plyr:not(.plyr--hide-controls) .plyr__controls:not(:empty)~.plyr__captions{transform:translateY(-40px);transform:translateY(calc(var(--plyr-control-spacing, 10px)*-4))}.plyr__caption{background:rgba(0,0,0,.8);background:var(--plyr-captions-background,rgba(0,0,0,.8));border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone;color:#fff;color:var(--plyr-captions-text-color,#fff);line-height:185%;padding:.2em .5em;white-space:pre-wrap}.plyr__caption div{display:inline}.plyr__control{background:transparent;border:0;border-radius:3px;border-radius:var(--plyr-control-radius,3px);color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;padding:calc(var(--plyr-control-spacing, 10px)*.7);position:relative;transition:all .3s ease}.plyr__control svg{fill:currentColor;display:block;height:18px;height:var(--plyr-control-icon-size,18px);pointer-events:none;width:18px;width:var(--plyr-control-icon-size,18px)}.plyr__control:focus{outline:0}.plyr__control.plyr__tab-focus{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}a.plyr__control{text-decoration:none}.plyr__control.plyr__control--pressed .icon--not-pressed,.plyr__control.plyr__control--pressed .label--not-pressed,.plyr__control:not(.plyr__control--pressed) .icon--pressed,.plyr__control:not(.plyr__control--pressed) .label--pressed,a.plyr__control:after,a.plyr__control:before{display:none}.plyr--full-ui ::-webkit-media-controls{display:none}.plyr__controls{align-items:center;display:flex;justify-content:flex-end;text-align:center}.plyr__controls .plyr__progress__container{flex:1;min-width:0}.plyr__controls .plyr__controls__item{margin-left:2.5px;margin-left:calc(var(--plyr-control-spacing, 10px)/4)}.plyr__controls .plyr__controls__item:first-child{margin-left:0;margin-right:auto}.plyr__controls .plyr__controls__item.plyr__progress__container{padding-left:2.5px;padding-left:calc(var(--plyr-control-spacing, 10px)/4)}.plyr__controls .plyr__controls__item.plyr__time{padding:0 5px;padding:0 calc(var(--plyr-control-spacing, 10px)/2)}.plyr__controls .plyr__controls__item.plyr__progress__container:first-child,.plyr__controls .plyr__controls__item.plyr__time+.plyr__time,.plyr__controls .plyr__controls__item.plyr__time:first-child{padding-left:0}.plyr [data-plyr=airplay],.plyr [data-plyr=captions],.plyr [data-plyr=fullscreen],.plyr [data-plyr=pip],.plyr__controls:empty{display:none}.plyr--airplay-supported [data-plyr=airplay],.plyr--captions-enabled [data-plyr=captions],.plyr--fullscreen-enabled [data-plyr=fullscreen],.plyr--pip-supported [data-plyr=pip]{display:inline-block}.plyr__menu{display:flex;position:relative}.plyr__menu .plyr__control svg{transition:transform .3s ease}.plyr__menu .plyr__control[aria-expanded=true] svg{transform:rotate(90deg)}.plyr__menu .plyr__control[aria-expanded=true] .plyr__tooltip{display:none}.plyr__menu__container{animation:plyr-popup .2s ease;background:hsla(0,0%,100%,.9);background:var(--plyr-menu-background,hsla(0,0%,100%,.9));border-radius:4px;bottom:100%;box-shadow:0 1px 2px #00000026;box-shadow:var(--plyr-menu-shadow,0 1px 2px rgba(0,0,0,.15));color:#4a5464;color:var(--plyr-menu-color,#4a5464);font-size:15px;font-size:var(--plyr-font-size-base,15px);margin-bottom:10px;position:absolute;right:-3px;text-align:left;white-space:nowrap;z-index:3}.plyr__menu__container>div{overflow:hidden;transition:height .35s cubic-bezier(.4,0,.2,1),width .35s cubic-bezier(.4,0,.2,1)}.plyr__menu__container:after{border:4px solid transparent;border-top-color:#ffffffe6;border:var(--plyr-menu-arrow-size,4px) solid transparent;border-top-color:var(--plyr-menu-background,hsla(0,0%,100%,.9));content:"";height:0;position:absolute;right:14px;right:calc(var(--plyr-control-icon-size, 18px)/2 + var(--plyr-control-spacing, 10px)*.7 - var(--plyr-menu-arrow-size, 4px)/2);top:100%;width:0}.plyr__menu__container [role=menu]{padding:7px;padding:calc(var(--plyr-control-spacing, 10px)*.7)}.plyr__menu__container [role=menuitem],.plyr__menu__container [role=menuitemradio]{margin-top:2px}.plyr__menu__container [role=menuitem]:first-child,.plyr__menu__container [role=menuitemradio]:first-child{margin-top:0}.plyr__menu__container .plyr__control{align-items:center;color:#4a5464;color:var(--plyr-menu-color,#4a5464);display:flex;font-size:13px;font-size:var(--plyr-font-size-menu,var(--plyr-font-size-small,13px));padding:4.66667px 10.5px;padding:calc(var(--plyr-control-spacing, 10px)*.7/1.5) calc(var(--plyr-control-spacing, 10px)*.7*1.5);-webkit-user-select:none;user-select:none;width:100%}.plyr__menu__container .plyr__control>span{align-items:inherit;display:flex;width:100%}.plyr__menu__container .plyr__control:after{border:4px solid transparent;border:var(--plyr-menu-item-arrow-size,4px) solid transparent;content:"";position:absolute;top:50%;transform:translateY(-50%)}.plyr__menu__container .plyr__control--forward{padding-right:28px;padding-right:calc(var(--plyr-control-spacing, 10px)*.7*4)}.plyr__menu__container .plyr__control--forward:after{border-left-color:#728197;border-left-color:var(--plyr-menu-arrow-color,#728197);right:6.5px;right:calc(var(--plyr-control-spacing, 10px)*.7*1.5 - var(--plyr-menu-item-arrow-size, 4px))}.plyr__menu__container .plyr__control--forward.plyr__tab-focus:after,.plyr__menu__container .plyr__control--forward:hover:after{border-left-color:currentColor}.plyr__menu__container .plyr__control--back{font-weight:400;font-weight:var(--plyr-font-weight-regular,400);margin:7px;margin:calc(var(--plyr-control-spacing, 10px)*.7);margin-bottom:3.5px;margin-bottom:calc(var(--plyr-control-spacing, 10px)*.7/2);padding-left:28px;padding-left:calc(var(--plyr-control-spacing, 10px)*.7*4);position:relative;width:calc(100% - 14px);width:calc(100% - var(--plyr-control-spacing, 10px)*.7*2)}.plyr__menu__container .plyr__control--back:after{border-right-color:#728197;border-right-color:var(--plyr-menu-arrow-color,#728197);left:6.5px;left:calc(var(--plyr-control-spacing, 10px)*.7*1.5 - var(--plyr-menu-item-arrow-size, 4px))}.plyr__menu__container .plyr__control--back:before{background:#dcdfe5;background:var(--plyr-menu-back-border-color,#dcdfe5);box-shadow:0 1px #fff;box-shadow:0 1px 0 var(--plyr-menu-back-border-shadow-color,#fff);content:"";height:1px;left:0;margin-top:3.5px;margin-top:calc(var(--plyr-control-spacing, 10px)*.7/2);overflow:hidden;position:absolute;right:0;top:100%}.plyr__menu__container .plyr__control--back.plyr__tab-focus:after,.plyr__menu__container .plyr__control--back:hover:after{border-right-color:currentColor}.plyr__menu__container .plyr__control[role=menuitemradio]{padding-left:7px;padding-left:calc(var(--plyr-control-spacing, 10px)*.7)}.plyr__menu__container .plyr__control[role=menuitemradio]:after,.plyr__menu__container .plyr__control[role=menuitemradio]:before{border-radius:100%}.plyr__menu__container .plyr__control[role=menuitemradio]:before{background:rgba(0,0,0,.1);content:"";display:block;flex-shrink:0;height:16px;margin-right:10px;margin-right:var(--plyr-control-spacing,10px);transition:all .3s ease;width:16px}.plyr__menu__container .plyr__control[role=menuitemradio]:after{background:#fff;border:0;height:6px;left:12px;opacity:0;top:50%;transform:translateY(-50%) scale(0);transition:transform .3s ease,opacity .3s ease;width:6px}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]:before{background:#00b2ff;background:var(--plyr-control-toggle-checked-background,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)))}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]:after{opacity:1;transform:translateY(-50%) scale(1)}.plyr__menu__container .plyr__control[role=menuitemradio].plyr__tab-focus:before,.plyr__menu__container .plyr__control[role=menuitemradio]:hover:before{background:rgba(35,40,47,.1)}.plyr__menu__container .plyr__menu__value{align-items:center;display:flex;margin-left:auto;margin-right:calc(-7px + 2);margin-right:calc(var(--plyr-control-spacing, 10px)*.7*-1 - -2);overflow:hidden;padding-left:24.5px;padding-left:calc(var(--plyr-control-spacing, 10px)*.7*3.5);pointer-events:none}.plyr--full-ui input[type=range]{-webkit-appearance:none;appearance:none;background:transparent;border:0;border-radius:26px;border-radius:calc(var(--plyr-range-thumb-height, 13px)*2);color:#00b2ff;color:var(--plyr-range-fill-background,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));display:block;height:19px;height:calc(var(--plyr-range-thumb-active-shadow-width, 3px)*2 + var(--plyr-range-thumb-height, 13px));margin:0;min-width:0;padding:0;transition:box-shadow .3s ease;width:100%}.plyr--full-ui input[type=range]::-webkit-slider-runnable-track{background:transparent;background-image:linear-gradient(90deg,currentColor 0,transparent 0);background-image:linear-gradient(to right,currentColor var(--value,0),transparent var(--value,0));border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-webkit-transition:box-shadow .3s ease;transition:box-shadow .3s ease;-webkit-user-select:none;user-select:none}.plyr--full-ui input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);margin-top:-4px;margin-top:calc((var(--plyr-range-thumb-height, 13px) - var(--plyr-range-track-height, 5px))/2*-1);position:relative;-webkit-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px)}.plyr--full-ui input[type=range]::-moz-range-track{background:transparent;border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-moz-transition:box-shadow .3s ease;transition:box-shadow .3s ease;user-select:none}.plyr--full-ui input[type=range]::-moz-range-thumb{background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);position:relative;-moz-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px)}.plyr--full-ui input[type=range]::-moz-range-progress{background:currentColor;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px)}.plyr--full-ui input[type=range]::-ms-track{color:transparent}.plyr--full-ui input[type=range]::-ms-fill-upper,.plyr--full-ui input[type=range]::-ms-track{background:transparent;border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-ms-transition:box-shadow .3s ease;transition:box-shadow .3s ease;user-select:none}.plyr--full-ui input[type=range]::-ms-fill-lower{background:transparent;background:currentColor;border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-ms-transition:box-shadow .3s ease;transition:box-shadow .3s ease;user-select:none}.plyr--full-ui input[type=range]::-ms-thumb{background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);margin-top:0;position:relative;-ms-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px)}.plyr--full-ui input[type=range]::-ms-tooltip{display:none}.plyr--full-ui input[type=range]::-moz-focus-outer{border:0}.plyr--full-ui input[type=range]:focus{outline:0}.plyr--full-ui input[type=range].plyr__tab-focus::-webkit-slider-runnable-track{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}.plyr--full-ui input[type=range].plyr__tab-focus::-moz-range-track{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}.plyr--full-ui input[type=range].plyr__tab-focus::-ms-track{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}.plyr__poster{background-color:#000;background-color:var(--plyr-video-background,var(--plyr-video-background,#000));background-position:50% 50%;background-repeat:no-repeat;background-size:contain;height:100%;left:0;opacity:0;position:absolute;top:0;transition:opacity .2s ease;width:100%;z-index:1}.plyr--stopped.plyr__poster-enabled .plyr__poster{opacity:1}.plyr--youtube.plyr--paused.plyr__poster-enabled:not(.plyr--stopped) .plyr__poster{display:none}.plyr__time{font-size:13px;font-size:var(--plyr-font-size-time,var(--plyr-font-size-small,13px))}.plyr__time+.plyr__time:before{content:"\\2044";margin-right:10px;margin-right:var(--plyr-control-spacing,10px)}@media (max-width:767px){.plyr__time+.plyr__time{display:none}}.plyr__tooltip{background:hsla(0,0%,100%,.9);background:var(--plyr-tooltip-background,hsla(0,0%,100%,.9));border-radius:5px;border-radius:var(--plyr-tooltip-radius,5px);bottom:100%;box-shadow:0 1px 2px #00000026;box-shadow:var(--plyr-tooltip-shadow,0 1px 2px rgba(0,0,0,.15));color:#4a5464;color:var(--plyr-tooltip-color,#4a5464);font-size:13px;font-size:var(--plyr-font-size-small,13px);font-weight:400;font-weight:var(--plyr-font-weight-regular,400);left:50%;line-height:1.3;margin-bottom:10px;margin-bottom:calc(var(--plyr-control-spacing, 10px)/2*2);opacity:0;padding:5px 7.5px;padding:calc(var(--plyr-control-spacing, 10px)/2) calc(var(--plyr-control-spacing, 10px)/2*1.5);pointer-events:none;position:absolute;transform:translate(-50%,10px) scale(.8);transform-origin:50% 100%;transition:transform .2s ease .1s,opacity .2s ease .1s;white-space:nowrap;z-index:2}.plyr__tooltip:before{border-left:4px solid transparent;border-left:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-right:4px solid transparent;border-right:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-top:4px solid hsla(0,0%,100%,.9);border-top:var(--plyr-tooltip-arrow-size,4px) solid var(--plyr-tooltip-background,hsla(0,0%,100%,.9));bottom:-4px;bottom:calc(var(--plyr-tooltip-arrow-size, 4px)*-1);content:"";height:0;left:50%;position:absolute;transform:translate(-50%);width:0;z-index:2}.plyr .plyr__control.plyr__tab-focus .plyr__tooltip,.plyr .plyr__control:hover .plyr__tooltip,.plyr__tooltip--visible{opacity:1;transform:translate(-50%) scale(1)}.plyr .plyr__control:hover .plyr__tooltip{z-index:3}.plyr__controls>.plyr__control:first-child .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip{left:0;transform:translateY(10px) scale(.8);transform-origin:0 100%}.plyr__controls>.plyr__control:first-child .plyr__tooltip:before,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip:before{left:16px;left:calc(var(--plyr-control-icon-size, 18px)/2 + var(--plyr-control-spacing, 10px)*.7)}.plyr__controls>.plyr__control:last-child .plyr__tooltip{left:auto;right:0;transform:translateY(10px) scale(.8);transform-origin:100% 100%}.plyr__controls>.plyr__control:last-child .plyr__tooltip:before{left:auto;right:16px;right:calc(var(--plyr-control-icon-size, 18px)/2 + var(--plyr-control-spacing, 10px)*.7);transform:translate(50%)}.plyr__controls>.plyr__control:first-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control:hover .plyr__tooltip,.plyr__controls>.plyr__control:first-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child:hover .plyr__tooltip,.plyr__controls>.plyr__control:last-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:last-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:last-child:hover .plyr__tooltip{transform:translate(0) scale(1)}.plyr__progress{left:6.5px;left:calc(var(--plyr-range-thumb-height, 13px)*.5);margin-right:13px;margin-right:var(--plyr-range-thumb-height,13px);position:relative}.plyr__progress input[type=range],.plyr__progress__buffer{margin-left:-6.5px;margin-left:calc(var(--plyr-range-thumb-height, 13px)*-.5);margin-right:-6.5px;margin-right:calc(var(--plyr-range-thumb-height, 13px)*-.5);width:calc(100% + 13px);width:calc(100% + var(--plyr-range-thumb-height, 13px))}.plyr__progress input[type=range]{position:relative;z-index:2}.plyr__progress .plyr__tooltip{left:0;max-width:120px;overflow-wrap:break-word;white-space:normal}.plyr__progress__buffer{-webkit-appearance:none;background:transparent;border:0;border-radius:100px;height:5px;height:var(--plyr-range-track-height,5px);left:0;margin-top:-2.5px;margin-top:calc((var(--plyr-range-track-height, 5px)/2)*-1);padding:0;position:absolute;top:50%}.plyr__progress__buffer::-webkit-progress-bar{background:transparent}.plyr__progress__buffer::-webkit-progress-value{background:currentColor;border-radius:100px;min-width:5px;min-width:var(--plyr-range-track-height,5px);-webkit-transition:width .2s ease;transition:width .2s ease}.plyr__progress__buffer::-moz-progress-bar{background:currentColor;border-radius:100px;min-width:5px;min-width:var(--plyr-range-track-height,5px);-moz-transition:width .2s ease;transition:width .2s ease}.plyr__progress__buffer::-ms-fill{border-radius:100px;-ms-transition:width .2s ease;transition:width .2s ease}.plyr--loading .plyr__progress__buffer{animation:plyr-progress 1s linear infinite;background-image:linear-gradient(-45deg,rgba(35,40,47,.6) 25%,transparent 0,transparent 50%,rgba(35,40,47,.6) 0,rgba(35,40,47,.6) 75%,transparent 0,transparent);background-image:linear-gradient(-45deg,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 25%,transparent 25%,transparent 50%,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 50%,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 75%,transparent 75%,transparent);background-repeat:repeat-x;background-size:25px 25px;background-size:var(--plyr-progress-loading-size,25px) var(--plyr-progress-loading-size,25px);color:transparent}.plyr--video.plyr--loading .plyr__progress__buffer{background-color:#ffffff40;background-color:var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25))}.plyr--audio.plyr--loading .plyr__progress__buffer{background-color:#c1c8d199;background-color:var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6))}.plyr__progress__marker{background-color:#fff;background-color:var(--plyr-progress-marker-background,#fff);border-radius:1px;height:5px;height:var(--plyr-range-track-height,5px);position:absolute;top:50%;transform:translate(-50%,-50%);width:3px;width:var(--plyr-progress-marker-width,3px);z-index:3}.plyr__volume{align-items:center;display:flex;max-width:110px;min-width:80px;position:relative;width:20%}.plyr__volume input[type=range]{margin-left:5px;margin-left:calc(var(--plyr-control-spacing, 10px)/2);margin-right:5px;margin-right:calc(var(--plyr-control-spacing, 10px)/2);position:relative;z-index:2}.plyr--is-ios .plyr__volume{min-width:0;width:auto}.plyr--audio{display:block}.plyr--audio .plyr__controls{background:#fff;background:var(--plyr-audio-controls-background,#fff);border-radius:inherit;color:#4a5464;color:var(--plyr-audio-control-color,#4a5464);padding:10px;padding:var(--plyr-control-spacing,10px)}.plyr--audio .plyr__control.plyr__tab-focus,.plyr--audio .plyr__control:hover,.plyr--audio .plyr__control[aria-expanded=true]{background:#00b2ff;background:var(--plyr-audio-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));color:#fff;color:var(--plyr-audio-control-color-hover,#fff)}.plyr--full-ui.plyr--audio input[type=range]::-webkit-slider-runnable-track{background-color:#c1c8d199;background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]::-moz-range-track{background-color:#c1c8d199;background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]::-ms-track{background-color:#c1c8d199;background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #23282f1a;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--full-ui.plyr--audio input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #23282f1a;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--full-ui.plyr--audio input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #23282f1a;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--audio .plyr__progress__buffer{color:#c1c8d199;color:var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6))}.plyr--video{background:#000;background:var(--plyr-video-background,var(--plyr-video-background,#000));overflow:hidden}.plyr--video.plyr--menu-open{overflow:visible}.plyr__video-wrapper{background:#000;background:var(--plyr-video-background,var(--plyr-video-background,#000));height:100%;margin:auto;overflow:hidden;position:relative;width:100%}.plyr__video-embed,.plyr__video-wrapper--fixed-ratio{aspect-ratio:16/9}@supports not (aspect-ratio:16/9){.plyr__video-embed,.plyr__video-wrapper--fixed-ratio{height:0;padding-bottom:56.25%;position:relative}}.plyr__video-embed iframe,.plyr__video-wrapper--fixed-ratio video{border:0;height:100%;left:0;position:absolute;top:0;width:100%}.plyr--full-ui .plyr__video-embed>.plyr__video-embed__container{padding-bottom:240%;position:relative;transform:translateY(-38.28125%)}.plyr--video .plyr__controls{background:linear-gradient(transparent,rgba(0,0,0,.75));background:var(--plyr-video-controls-background,linear-gradient(transparent,rgba(0,0,0,.75)));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;bottom:0;color:#fff;color:var(--plyr-video-control-color,#fff);left:0;padding:5px;padding:calc(var(--plyr-control-spacing, 10px)/2);padding-top:20px;padding-top:calc(var(--plyr-control-spacing, 10px)*2);position:absolute;right:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out;z-index:3}@media (min-width:480px){.plyr--video .plyr__controls{padding:10px;padding:var(--plyr-control-spacing,10px);padding-top:35px;padding-top:calc(var(--plyr-control-spacing, 10px)*3.5)}}.plyr--video.plyr--hide-controls .plyr__controls{opacity:0;pointer-events:none;transform:translateY(100%)}.plyr--video .plyr__control.plyr__tab-focus,.plyr--video .plyr__control:hover,.plyr--video .plyr__control[aria-expanded=true]{background:#00b2ff;background:var(--plyr-video-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));color:#fff;color:var(--plyr-video-control-color-hover,#fff)}.plyr__control--overlaid{background:#00b2ff;background:var(--plyr-video-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));border:0;border-radius:100%;color:#fff;color:var(--plyr-video-control-color,#fff);display:none;left:50%;opacity:.9;padding:15px;padding:calc(var(--plyr-control-spacing, 10px)*1.5);position:absolute;top:50%;transform:translate(-50%,-50%);transition:.3s;z-index:2}.plyr__control--overlaid svg{left:2px;position:relative}.plyr__control--overlaid:focus,.plyr__control--overlaid:hover{opacity:1}.plyr--playing .plyr__control--overlaid{opacity:0;visibility:hidden}.plyr--full-ui.plyr--video .plyr__control--overlaid{display:block}.plyr--full-ui.plyr--video input[type=range]::-webkit-slider-runnable-track{background-color:#ffffff40;background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25)))}.plyr--full-ui.plyr--video input[type=range]::-moz-range-track{background-color:#ffffff40;background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25)))}.plyr--full-ui.plyr--video input[type=range]::-ms-track{background-color:#ffffff40;background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25)))}.plyr--full-ui.plyr--video input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #ffffff80;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,hsla(0,0%,100%,.5))}.plyr--full-ui.plyr--video input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #ffffff80;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,hsla(0,0%,100%,.5))}.plyr--full-ui.plyr--video input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #ffffff80;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,hsla(0,0%,100%,.5))}.plyr--video .plyr__progress__buffer{color:#ffffff40;color:var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25))}.plyr:fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:fullscreen video{height:100%}.plyr:fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:fullscreen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:fullscreen .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr--fullscreen-fallback{background:#000;border-radius:0!important;bottom:0;display:block;height:100%;left:0;margin:0;position:fixed;right:0;top:0;width:100%;z-index:10000000}.plyr--fullscreen-fallback video{height:100%}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen{display:block}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr--fullscreen-fallback.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr--fullscreen-fallback .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr__ads{border-radius:inherit;bottom:0;cursor:pointer;left:0;overflow:hidden;position:absolute;right:0;top:0;z-index:-1}.plyr__ads>div,.plyr__ads>div iframe{height:100%;position:absolute;width:100%}.plyr__ads:after{background:#23282f;border-radius:2px;bottom:10px;bottom:var(--plyr-control-spacing,10px);color:#fff;content:attr(data-badge-text);font-size:11px;padding:2px 6px;pointer-events:none;position:absolute;right:10px;right:var(--plyr-control-spacing,10px);z-index:3}.plyr__ads:empty:after{display:none}.plyr__cues{background:currentColor;display:block;height:5px;height:var(--plyr-range-track-height,5px);left:0;opacity:.8;position:absolute;top:50%;transform:translateY(-50%);width:3px;z-index:3}.plyr__preview-thumb{background-color:#ffffffe6;background-color:var(--plyr-tooltip-background,hsla(0,0%,100%,.9));border-radius:5px;border-radius:var(--plyr-tooltip-radius,5px);bottom:100%;box-shadow:0 1px 2px #00000026;box-shadow:var(--plyr-tooltip-shadow,0 1px 2px rgba(0,0,0,.15));margin-bottom:10px;margin-bottom:calc(var(--plyr-control-spacing, 10px)/2*2);opacity:0;padding:3px;pointer-events:none;position:absolute;transform:translateY(10px) scale(.8);transform-origin:50% 100%;transition:transform .2s ease .1s,opacity .2s ease .1s;z-index:2}.plyr__preview-thumb--is-shown{opacity:1;transform:translate(0) scale(1)}.plyr__preview-thumb:before{border-left:4px solid transparent;border-left:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-right:4px solid transparent;border-right:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-top:4px solid hsla(0,0%,100%,.9);border-top:var(--plyr-tooltip-arrow-size,4px) solid var(--plyr-tooltip-background,hsla(0,0%,100%,.9));bottom:-4px;bottom:calc(var(--plyr-tooltip-arrow-size, 4px)*-1);content:"";height:0;left:calc(50% + var(--preview-arrow-offset));position:absolute;transform:translate(-50%);width:0;z-index:2}.plyr__preview-thumb__image-container{background:#c1c8d1;border-radius:4px;border-radius:calc(var(--plyr-tooltip-radius, 5px) - 1px);overflow:hidden;position:relative;z-index:0}.plyr__preview-thumb__image-container img,.plyr__preview-thumb__image-container:after{height:100%;left:0;position:absolute;top:0;width:100%}.plyr__preview-thumb__image-container:after{border-radius:inherit;box-shadow:inset 0 0 0 1px #00000026;content:"";pointer-events:none}.plyr__preview-thumb__image-container img{max-height:none;max-width:none}.plyr__preview-thumb__time-container{background:linear-gradient(transparent,rgba(0,0,0,.75));background:var(--plyr-video-controls-background,linear-gradient(transparent,rgba(0,0,0,.75)));border-bottom-left-radius:4px;border-bottom-left-radius:calc(var(--plyr-tooltip-radius, 5px) - 1px);border-bottom-right-radius:4px;border-bottom-right-radius:calc(var(--plyr-tooltip-radius, 5px) - 1px);bottom:0;left:0;line-height:1.1;padding:20px 6px 6px;position:absolute;right:0;z-index:3}.plyr__preview-thumb__time-container span{color:#fff;font-size:13px;font-size:var(--plyr-font-size-time,var(--plyr-font-size-small,13px))}.plyr__preview-scrubbing{bottom:0;filter:blur(1px);height:100%;left:0;margin:auto;opacity:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .3s ease;width:100%;z-index:1}.plyr__preview-scrubbing--is-shown{opacity:1}.plyr__preview-scrubbing img{height:100%;left:0;max-height:none;max-width:none;-o-object-fit:contain;object-fit:contain;position:absolute;top:0;width:100%}.plyr--no-transition{transition:none!important}.plyr__sr-only{clip:rect(1px,1px,1px,1px);border:0!important;height:1px!important;overflow:hidden;padding:0!important;position:absolute!important;width:1px!important}.plyr [hidden]{display:none!important}.plyr--video{width:100%;height:100%}.plyr--audio{width:100%;height:100%;display:flex;align-items:stretch;justify-content:center;background-color:#fff}.telebox-color-scheme-dark .plyr--audio{color-scheme:dark;background-color:#121212;--plyr-audio-controls-background: #121212;--plyr-audio-control-color: #eee}
127
+ `)();const Sp={volume:1,paused:!0,muted:!1,currentTime:0},Ni={kind:"Plyr",config:{minwidth:300,minheight:80},setup(t){const e=t.storage;if(e.ensureState(Sp),!e.state.src){t.emitter.emit("destroy",{error:new Error('[Plyr]: missing "src"')});return}!e.state.type&&!e.state.provider&&console.warn('[Plyr]: missing "type", will guess from file extension');const i=t.box;i.mountStyles(Mp);const s=new xp(t),r=new vp({target:i.$content,props:{storage:t.storage,sync:s}});t.emitter.on("destroy",()=>{try{s.dispose(),r.$destroy()}catch{}})}},Cp=()=>{ce.register({kind:_i.kind,src:_i}),ce.register({kind:Ni.kind,src:Ni})},Ls={DocsViewer:_i.kind,MediaPlayer:Ni.kind},Ip={[Ls.DocsViewer]:_i,[Ls.MediaPlayer]:Ni};const uo=new Jc({emitter:P}),$=class extends M.InvisiblePlugin{constructor(t){super(t);this.version="1.0.0-canary.40",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"1.0.0-alpha.34",emittery:"^0.11.0",lodash:"^4.17.21","p-retry":"^4.6.2","side-effect-manager":"^1.1.1",uuid:"^7.0.3","value-enhancer":"^1.3.2"},peerDependencies:{"white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.3.0","@netless/app-plyr":"0.2.0","@playwright/test":"^1.23.2","@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.49","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.6","@types/node":"^18.0.3","@types/uuid":"^8.3.4","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.2",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",less:"^4.1.3",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3","vite-plugin-dts":"^1.2.1",vitest:"^0.18.0","white-web-sdk":"2.16.26"}},this.emitter=Q,this.viewMode=M.ViewMode.Broadcaster,this.viewMode$=new w.Val(M.ViewMode.Broadcaster),this.isReplay=M.isPlayer(this.displayer),this.containerSizeRatio=$.containerSizeRatio,this.moveCamera=C.debounce(e=>{var r;const i=j({},this.mainView.camera),s=j(j({},i),e);if(!C.isEqual(s,i)&&!!this.appManager)if(e.animationMode===M.AnimationMode.Immediately)this.appManager.mainViewProxy.storeCamera(j({id:this.appManager.uid},s));else{const a=this.appManager.mainViewProxy.size$.value,n=(r=this.boxManager)==null?void 0:r.stageRect;let o;e.scale&&a&&n&&(o=e.scale*Ei(a,n)),o?this.mainView.moveCamera(oe(j({},e),{scale:o})):this.mainView.moveCamera(e),this.appManager.dispatchInternalEvent(Y.MoveCamera,e),setTimeout(()=>{!this.appManager||this.appManager.mainViewProxy.storeCamera(j({id:this.appManager.uid},s))},200)}},200),$.displayer=t.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"1.0.0-alpha.34",emittery:"^0.11.0",lodash:"^4.17.21","p-retry":"^4.6.2","side-effect-manager":"^1.1.1",uuid:"^7.0.3","value-enhancer":"^1.3.2"},peerDependencies:{"white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.3.0","@netless/app-plyr":"0.2.0","@playwright/test":"^1.23.2","@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.49","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.6","@types/node":"^18.0.3","@types/uuid":"^8.3.4","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.2",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",less:"^4.1.3",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3","vite-plugin-dts":"^1.2.1",vitest:"^0.18.0","white-web-sdk":"2.16.26"}}}static async mount(t){var a;const e=t.room;$.container=t.container;const i=t.debug,s=t.cursor;$.params=t,$.displayer=t.room,cl();let r;if(M.isRoom(e)){if(e.phase!==M.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");e.phase===M.RoomPhase.Connected&&e.isWritable&&(e.disableSerialization=!1),r=await this.initManager(e)}if($.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(i),Je("Already insert room",r),M.isRoom(this.displayer)){if(!r)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await No.default(async n=>{if(r=await e.getInvisiblePlugin($.kind),!r)throw Je(`manager is empty. retrying ${n}`),new Error},{retries:10});if(!r)throw new Error("[WindowManager]: create manager failed");t.containerSizeRatio&&($.containerSizeRatio=t.containerSizeRatio),r.containerSizeRatio=$.containerSizeRatio,await r.ensureAttributes(),r.appManager=new yl(r),r._pageState=new qc(r.appManager),r.cursorManager=new Gc(r.appManager,Boolean(s),t.applianceIcons),r.boxManager=Sc(r,Q,P,Ue,{collectorContainer:t.collectorContainer,collectorStyles:t.collectorStyles,prefersColorScheme:t.prefersColorScheme,stageRatio:$.containerSizeRatio,containerStyle:t.containerStyle,stageStyle:t.stageStyle,fullscreen:t.fullscreen}),(a=r.appManager)==null||a.setBoxManager(r.boxManager),t.container&&r.bindContainer(t.container),Xc(e,r),P.emit("onCreated"),$.isCreated=!0;try{await Vo()}catch(n){console.warn("[WindowManager]: indexedDB open failed"),console.log(n)}return r}static async initManager(t){let e=t.getInvisiblePlugin($.kind);if(!e&&M.isRoom(t))if(t.isWritable===!1){try{await t.setWritable(!0)}catch{throw new Error("[WindowManger]: room must be switched to be writable")}e=await Nr(t),e==null||e.ensureAttributes(),await Mi(500),await t.setWritable(!1)}else e=await Nr(t);return e}static initContainer(t,e,i){$.container||($.container=t);const{playground:s,mainViewElement:r}=ll(t,e);if($.playground=s,i){const a=document.createElement("style");a.textContent=i,s.appendChild(a)}return r}static get registered(){return pe.registered}bindContainer(t){var e,i,s,r,a,n;if(M.isRoom(this.displayer)&&this.room.phase!==M.RoomPhase.Connected)throw new xa;if($.isCreated&&$.container)$.container.firstChild&&t.appendChild($.container.firstChild);else{const o=(e=this.boxManager)==null?void 0:e.teleBoxManager.$stage;if($.params&&o){const c=$.params,l=$.initContainer(t,o,c.overwriteStyles);this.boxManager&&$.playground&&this.boxManager.setRoot($.playground),this.bindMainView(l,c.disableCameraTransform),$.playground&&((i=this.cursorManager)==null||i.setupWrapper($.playground))}}P.emit("updateManagerRect"),(s=this.appManager)==null||s.refresh(),(r=this.appManager)==null||r.resetMaximized(),(a=this.appManager)==null||a.resetMinimized(),(n=this.appManager)==null||n.displayerWritableListener(!this.room.isWritable),$.container=t}bindCollectorContainer(t){$.isCreated&&this.boxManager?this.boxManager.setCollector(t):$.params&&($.params.collectorContainer=t)}static register(t){return pe.register(t)}static unregister(t){return pe.unregister(t)}async addApp(t){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((e,i)=>{P.once("rootDirRemoved").then(async()=>{try{const s=await this._addApp(t);e(s)}catch(s){i(s.message)}})}):this._addApp(t);throw new de}async _addApp(t){var e,i,s;if(this.appManager){if(!t.kind||typeof t.kind!="string")throw new ya;const r=await((e=pe.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 fa;const a=this.setupScenePath(t,this.appManager);return a===void 0?void 0:((s=t==null?void 0:t.options)!=null&&s.scenePath&&(t.options.scenePath=Ko(t.options.scenePath)),await this.appManager.addApp(t,Boolean(a)))}else throw new de}setupScenePath(t,e){let i=!1;if(t.options){const{scenePath:s,scenes:r}=t.options;if(s){if(!Xo(s))throw new va;const a=Object.keys(this.apps||{});for(const n of a){const o=e.store.getAppScenePath(n);if(o&&o===s){if(console.warn(`[WindowManager]: ScenePath ${s} Already opened`),this.boxManager){const c=this.boxManager.getTopBox();c&&this.boxManager.setZIndex(n,c.zIndex+1,!1)}return}}}s&&r&&r.length>0&&(this.isDynamicPPT(r)?(i=!0,ut(this.displayer)[s]||vt(this.room,s,r)):ut(this.displayer)[s]||vt(this.room,s,[{name:r[0].name}])),s&&r===void 0&&vt(this.room,s,[{}])}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 s=this.mainViewSceneIndex+1;this.room.putScenes(we,[i||{}],s)}else this.room.putScenes(we,[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),P.emit("setReadonly",t)}switchMainViewToWriter(){var t;return(t=this.appManager)==null?void 0:t.mainViewProxy.mainViewClickHandler()}onAppDestroy(t,e){qo(`destroy-${t}`,e)}setViewMode(t){var i;Je("setViewMode",t);const e=(i=this.appManager)==null?void 0:i.mainViewProxy;t===M.ViewMode.Broadcaster&&(this.canOperate&&(e==null||e.storeCurrentCamera()),e==null||e.start()),t===M.ViewMode.Freedom&&(e==null||e.stop()),this.viewMode=t,this.viewMode$.setValue(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)}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new de}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new de}get baseCamera(){if(this.appManager)return this.appManager.mainViewProxy.camera$.value;throw new de}get baseSize(){if(this.appManager)return this.appManager.mainViewProxy.size$.value;throw new de}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new de}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 de}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 de}get fullscreen(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.teleBoxManager.fullscreen;throw new de}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 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 de}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 de}get pageState(){if(this._pageState)return this._pageState.toObject();throw new de}get teleboxManager(){if(!this.boxManager)throw new Vs;return this.boxManager.teleBoxManager}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)}convertToPointInWorld(t){return this.mainView.convertToPointInWorld(t)}setCameraBound(t){this.mainView.setCameraBound(t)}onDestroy(){this._destroy()}destroy(){this._destroy()}_destroy(){var t,e,i;(t=this.appManager)==null||t.destroy(),(e=this.cursorManager)==null||e.destroy(),$.container=void 0,$.isCreated=!1,$.playground&&((i=$.playground.parentNode)==null||i.removeChild($.playground)),$.params=void 0,Je("Destroyed")}bindMainView(t,e){var i;this.appManager&&(this.appManager.bindMainView(t,Boolean(e)),(i=this.cursorManager)==null||i.setMainViewDivElement(t))}get canOperate(){return M.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===M.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)}setFullscreen(t){var e,i;(i=(e=this.appManager)==null?void 0:e.boxManager)==null||i.teleBoxManager.setFullscreen(t)}cleanCurrentScene(){var t;(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 s;return((s=this.focusedView)==null?void 0:s.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(Y.Refresh)}_refresh(){var t,e;(t=this.appManager)==null||t.mainViewProxy.rebind(),$.container&&this.bindContainer($.container),(e=this.appManager)==null||e.refresher.refresh()}setContainerSizeRatio(t){if(!C.isNumber(t))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a number. but got ${t}`);$.containerSizeRatio=t,this.containerSizeRatio=t,P.emit("containerSizeRatioUpdate",t)}setContainerStyle(t){var e;(e=this.boxManager)==null||e.teleBoxManager.setContainerStyle(t)}setStageStyle(t){var e;(e=this.boxManager)==null||e.teleBoxManager.setStageStyle(t)}setBaseSize(t){var e;(e=this.appManager)==null||e.mainViewProxy.setMainViewSize(t),setTimeout(()=>{!this.appManager||!this.appManager.mainViewProxy.camera$.value||this.appManager.mainViewProxy.storeCamera(oe(j({},this.appManager.mainViewProxy.camera$.value),{id:this.appManager.uid,scale:1}))},500)}createPPTHandler(){return{onPageJumpTo:(t,e)=>{var i,s,r,a;(a=(r=(s=(i=this.appManager)==null?void 0:i.focusApp)==null?void 0:s.appContext)==null?void 0:r.whiteBoardView)==null||a.jumpPage(e)},onPageToNext:()=>{var t,e,i,s;this.focused&&((s=(i=(e=(t=this.appManager)==null?void 0:t.focusApp)==null?void 0:e.appContext)==null?void 0:i.whiteBoardView)==null||s.nextPage())},onPageToPrev:()=>{var t,e,i,s;this.focused&&((s=(i=(e=(t=this.appManager)==null?void 0:t.focusApp)==null?void 0:e.appContext)==null?void 0:i.whiteBoardView)==null||s.prevPage())}}}isDynamicPPT(t){var i,s;const e=(s=(i=t[0])==null?void 0:i.ppt)==null?void 0:s.src;return e==null?void 0:e.startsWith("pptx://")}async ensureAttributes(){C.isNull(this.attributes)&&await Mi(50),C.isObject(this.attributes)&&(this.attributes[ee.Apps]||this.safeSetAttributes({[ee.Apps]:{}}),this.attributes[ee.Cursors]||this.safeSetAttributes({[ee.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:ga}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[ee.Registered]||this.safeSetAttributes({[ee.Registered]:{}}))}};let ce=$;ce.kind="WindowManager";ce.debug=!1;ce.containerSizeRatio=zo;ce.isCreated=!1;Cp();exports.AppCreateError=fa;exports.AppManagerNotInitError=de;exports.AppNotRegisterError=sl;exports.BindContainerRoomPhaseInvalidError=xa;exports.BoxManagerNotInitializeError=Vs;exports.BoxNotCreatedError=wa;exports.BuiltinApps=Ls;exports.BuiltinAppsMap=Ip;exports.InvalidScenePath=va;exports.ParamsInvalidError=ya;exports.WhiteWebSDKInvalidError=ba;exports.WindowManager=ce;exports.calculateNextIndex=$s;exports.reconnectRefresher=uo;