@netless/app-slide 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/main.cjs.js +2 -2
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +6 -6
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +2 -2
- package/dist/main.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/SlideController/index.ts +1 -1
- package/src/index.ts +2 -0
package/dist/main.iife.js
CHANGED
|
@@ -6364,6 +6364,6 @@ void main(void){
|
|
|
6364
6364
|
`)}},e.prototype.emitSyncDispatch=function(t){if(!this.lock.isLocked(t.type)){var n=Math.random().toString(32).substr(2);this.lock.addLock(t.type,n),this.emit(Io.syncDispatch,Np(Np({},t),{uuid:n})),this.log+="=== sync dispatch ["+new Date().toISOString()+`] ===
|
|
6365
6365
|
`,this.log+=JSON.stringify(t,null,2),this.log+=`
|
|
6366
6366
|
|
|
6367
|
-
`}},e.prototype.setMainSeqStep=function(t,n){var r;(r=this.player)===null||r===void 0||r.setMainSeqStep(t,n)},e.prototype.setInteractive=function(t){var n;this.interactive=t,(n=this.player)===null||n===void 0||n.setInteractive(t)},e.prototype.pause=function(){var t;(t=this.player)===null||t===void 0||t.pause()},e.prototype.resume=function(){var t;(t=this.player)===null||t===void 0||t.resume()},e.prototype.frozen=function(){var t;return Hs(this,void 0,void 0,function(){var n,r,o,s=this;return zs(this,function(a){switch(a.label){case 0:return this.isFrowning?[2,ey(function(){return!s.isFrowning},6e4)]:this.view&&this.player?(this.isFrowning=!0,[4,this.player.clock.waitUntil(function(){return!s.isLoading},6e4)]):[3,2];case 1:for(r in a.sent(),n=this.player.getSnapshot()||"",this.cacheImage.src=n,this.frame.appendChild(this.cacheImage),this.player.destroy(),(t=this.playerController)===null||t===void 0||t.destroy(),this.player=void 0,this.__slideState.mediaState)o=this.__slideState.mediaState[r],this.__slideState.mediaState[r]=Np(Np({},o),{frozenTime:this.timestamp()});this.isFrowning=!1,a.label=2;case 2:return[2]}})})},e.prototype.release=function(){var t,n;return Hs(this,void 0,void 0,function(){var r,o,s,a,l=this;return zs(this,function(u){switch(u.label){case 0:if(this.isReleasing)return[2,ey(function(){return!l.isReleasing},6e4)];for(o in this.isReleasing=!0,this.player=this.initPlayer(this.config),!((t=this.config)===null||t===void 0)&&t.controller&&this.createController(),this.player.view&&(this.frame.appendChild(this.player.view),this.player.view.style.visibility="hidden"),r=this.__slideState,this.__slideState=Object(q.cloneDeep)(HT),r.mediaState)(s=r.mediaState[o]).type==="play"&&(a=Math.max((n=s.frozenTime)!==null&&n!==void 0?n:0,s.time),s.time=this.timestamp()-(a-s.time),s.frozenTime=void 0);return[4,this.setSlideState(r)];case 1:return u.sent(),[4,this.player.clock.delay(333)];case 2:u.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch{}return this.isReleasing=!1,[2]}})})},e.prototype.destroy=function(){var t,n,r,o;this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),(t=this.player)===null||t===void 0||t.removeAllListeners(),(n=this.player)===null||n===void 0||n.destroy(),(r=this.player)===null||r===void 0||r.removeAllListeners(),window.removeEventListener("__slide_log__",this.handleLogDownload),window.removeEventListener("__slide_state__",this.handleSlideStateLog),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.clearInterval(this.persistLogId),Hu&&Hu.removeItem(this.logId).catch(function(){});try{!((o=this.player)===null||o===void 0)&&o.view&&this.anchor.removeChild(this.player.view),this.anchor.removeChild(this.frame)}catch{}},e.disposeLocalCache=function(){wr.storeManager.dispose()},e}(L.a)}]);function sy(E,P,_){return Math.min(Math.max(E,P),_)}function tE(E){return typeof E=="object"&&E!==null}var ay={exports:{}},nE={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},ly={exports:{}},iE=function(P){return!P||typeof P=="string"?!1:P instanceof Array||Array.isArray(P)||P.length>=0&&(P.splice instanceof Function||Object.getOwnPropertyDescriptor(P,P.length-1)&&P.constructor.name!=="String")},rE=iE,oE=Array.prototype.concat,sE=Array.prototype.slice,uy=ly.exports=function(P){for(var _=[],b=0,te=P.length;b<te;b++){var fe=P[b];rE(fe)?_=oE.call(_,sE.call(fe)):_.push(fe)}return _};uy.wrap=function(E){return function(){return E(uy(arguments))}};var Dc=nE,Fc=ly.exports,hy=Object.hasOwnProperty,cy={};for(var Pg in Dc)hy.call(Dc,Pg)&&(cy[Dc[Pg]]=Pg);var Zr=ay.exports={to:{},get:{}};Zr.get=function(E){var P=E.substring(0,3).toLowerCase(),_,b;switch(P){case"hsl":_=Zr.get.hsl(E),b="hsl";break;case"hwb":_=Zr.get.hwb(E),b="hwb";break;default:_=Zr.get.rgb(E),b="rgb";break}return _?{model:b,value:_}:null},Zr.get.rgb=function(E){if(!E)return null;var P=/^#([a-f0-9]{3,4})$/i,_=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,b=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,te=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,fe=/^(\w+)$/,$=[0,0,0,1],L,q,j;if(L=E.match(_)){for(j=L[2],L=L[1],q=0;q<3;q++){var F=q*2;$[q]=parseInt(L.slice(F,F+2),16)}j&&($[3]=parseInt(j,16)/255)}else if(L=E.match(P)){for(L=L[1],j=L[3],q=0;q<3;q++)$[q]=parseInt(L[q]+L[q],16);j&&($[3]=parseInt(j+j,16)/255)}else if(L=E.match(b)){for(q=0;q<3;q++)$[q]=parseInt(L[q+1],0);L[4]&&(L[5]?$[3]=parseFloat(L[4])*.01:$[3]=parseFloat(L[4]))}else if(L=E.match(te)){for(q=0;q<3;q++)$[q]=Math.round(parseFloat(L[q+1])*2.55);L[4]&&(L[5]?$[3]=parseFloat(L[4])*.01:$[3]=parseFloat(L[4]))}else return(L=E.match(fe))?L[1]==="transparent"?[0,0,0,0]:hy.call(Dc,L[1])?($=Dc[L[1]],$[3]=1,$):null:null;for(q=0;q<3;q++)$[q]=Da($[q],0,255);return $[3]=Da($[3],0,1),$},Zr.get.hsl=function(E){if(!E)return null;var P=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,_=E.match(P);if(_){var b=parseFloat(_[4]),te=(parseFloat(_[1])%360+360)%360,fe=Da(parseFloat(_[2]),0,100),$=Da(parseFloat(_[3]),0,100),L=Da(isNaN(b)?1:b,0,1);return[te,fe,$,L]}return null},Zr.get.hwb=function(E){if(!E)return null;var P=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,_=E.match(P);if(_){var b=parseFloat(_[4]),te=(parseFloat(_[1])%360+360)%360,fe=Da(parseFloat(_[2]),0,100),$=Da(parseFloat(_[3]),0,100),L=Da(isNaN(b)?1:b,0,1);return[te,fe,$,L]}return null},Zr.to.hex=function(){var E=Fc(arguments);return"#"+kp(E[0])+kp(E[1])+kp(E[2])+(E[3]<1?kp(Math.round(E[3]*255)):"")},Zr.to.rgb=function(){var E=Fc(arguments);return E.length<4||E[3]===1?"rgb("+Math.round(E[0])+", "+Math.round(E[1])+", "+Math.round(E[2])+")":"rgba("+Math.round(E[0])+", "+Math.round(E[1])+", "+Math.round(E[2])+", "+E[3]+")"},Zr.to.rgb.percent=function(){var E=Fc(arguments),P=Math.round(E[0]/255*100),_=Math.round(E[1]/255*100),b=Math.round(E[2]/255*100);return E.length<4||E[3]===1?"rgb("+P+"%, "+_+"%, "+b+"%)":"rgba("+P+"%, "+_+"%, "+b+"%, "+E[3]+")"},Zr.to.hsl=function(){var E=Fc(arguments);return E.length<4||E[3]===1?"hsl("+E[0]+", "+E[1]+"%, "+E[2]+"%)":"hsla("+E[0]+", "+E[1]+"%, "+E[2]+"%, "+E[3]+")"},Zr.to.hwb=function(){var E=Fc(arguments),P="";return E.length>=4&&E[3]!==1&&(P=", "+E[3]),"hwb("+E[0]+", "+E[1]+"%, "+E[2]+"%"+P+")"},Zr.to.keyword=function(E){return cy[E.slice(0,3)]};function Da(E,P,_){return Math.min(Math.max(P,E),_)}function kp(E){var P=Math.round(E).toString(16).toUpperCase();return P.length<2?"0"+P:P}var aE=ay.exports;class lE{constructor(P){this.enable=P,this.apps={},this.level="debug",this._onMessage=_=>{let b;_ instanceof CustomEvent?b=_.detail:tE(_.data)&&(b=_.data),b&&(typeof b.slide=="boolean"?this.enable=b.slide:b.slide==="__instance"?console.log(this):b.slide==="__debug"&&Object.values(this.apps).forEach(te=>{var fe,$;($=(fe=te.controller)==null?void 0:fe.slide)==null||$.createController()}))},window.addEventListener("message",this._onMessage)}log(...P){this.enable&&console.log(...P)}verbose(...P){this.enable&&this.level==="verbose"&&console.log(...P)}dispose(P){this.enable=!1,delete this.apps[P],window.removeEventListener("message",this._onMessage)}}const ls=new lE(!1),Mi=ls.log.bind(ls),uE=ls.verbose.bind(ls);function dy(E){try{const P=window.getComputedStyle(E).backgroundColor;if(P!=="rgba(0, 0, 0, 0)"&&P!=="transparent")return P;if(E.parentElement)return dy(E.parentElement)}catch{}return"#ffffff"}function hE(E){const P=aE.get(E);if(P&&P.model==="rgb"){const _=P.value,te=(((Math.round(_[0])&255)<<16)+((Math.round(_[1])&255)<<8)+(Math.round(_[2])&255)).toString(16);return"#"+"000000".substring(te.length)+te}else return E}let Gp="";function py(E){return Gp||(Gp=hE(dy(E)),Mi("[Slide] guess bg color",Gp)),Gp}function fy(E){const{width:P,height:_,slideCount:b,slideState:te}=E,{taskId:fe,url:$}=te,L=[];for(let q=1;q<=b;++q)L.push({width:P,height:_,thumbnail:`${$}/${fe}/preview/${q}.png`,src:"ppt"});return L}function my(E,P,_,b){var L;const te=_.slideState.currentSlideIndex;if(!(te>0)||!P.getIsWritable())return;const fe=[b,te].join("/");if(E.scenePathType(fe)!=="page"){E.removeScenes(b);const q=_.slideCount,j=[];for(let F=1;F<=q;++F)j.push({name:`${F}`});E.putScenes(b,j)}let $;P.getBox().focus?$=E.state.sceneState.scenePath:$=((L=P.getView())==null?void 0:L.focusScenePath)||"",$!==fe&&P.setScenePath(fe)}const Ig="https://convertcdn.netless.link/dynamicConvert",cE=40,Og={taskId:"",url:"",state:null};class dE{constructor({context:P,anchor:_,onPageChanged:b,onTransitionStart:te,onTransitionEnd:fe,onError:$}){this.sideEffect=new Nc,this.ready=!1,this.readyPromise=new Promise(L=>{this.resolveReady=()=>setTimeout(()=>{this.ready=!0,L()},1e3)}),this.onSyncDispatch=L=>{if(this.context.getIsWritable()&&this.room){const q={type:di.SLIDE_EVENTS.syncDispatch,payload:L};Mi("[Slide] dispatch",L),this.context.dispatchMagixEvent(di.SLIDE_EVENTS.syncDispatch,q)}},this.magixEventListener=L=>{const{type:q,payload:j}=L.payload;q===di.SLIDE_EVENTS.syncDispatch&&(this.syncStateOnce(),Mi("[Slide] receive",j),this.slide.emit(di.SLIDE_EVENTS.syncReceive,j))},this.onStateChange=L=>{this.context.getIsWritable()&&(uE("[Slide] state change",JSON.stringify(L,null,2)),this.context.storage.setState({state:L}))},this.pollCount=0,this.pollReadyState=()=>{this.ready?this._toFreeze===1?this.freeze():this._toFreeze===-1&&this.unfreeze():this.pollCount<cE?(this.pollCount++,setTimeout(this.pollReadyState,500)):(this.pollCount=0,Mi("[Slide] renderSlide (retry after timeout)",1),this.slide.renderSlide(1))},this._pageCount=0,this.destroyed=!1,this.timestamp=()=>this.room&&this.room.calibrationTimestamp?this.room.calibrationTimestamp:this.player?this.player.beginTimestamp+this.player.progressTime:Date.now(),this.isFrozen=!1,this._toFreeze=0,this.freezePromise=null,this.freeze=()=>{this.ready?(Mi("[Slide] freeze",this.context.appId),this.freezePromise?this._toFreeze=1:this.isFrozen||(this._toFreeze=0,this.freezePromise=this.slide.frozen().then(this.afterFreeze.bind(this,1)))):this._toFreeze=1},this.unfreeze=async()=>{!this.visible||(this.ready?(Mi("[Slide] unfreeze",this.context.appId),this.freezePromise?this._toFreeze=-1:this.isFrozen&&(this._toFreeze=0,this.freezePromise=this.slide.release().then(this.afterFreeze.bind(this,-1)))):this._toFreeze=-1)},this.onVisibilityChange=async()=>{(this.visible=document.visibilityState==="visible")?(Mi("[Slide] unfreeze because tab becomes visible",{savedIsFrozen:this.savedIsFrozen}),this.savedIsFrozen||this.unfreeze()):(this.savedIsFrozen=this.freezePromise?this._toFreeze===1:this.isFrozen,Mi("[Slide] freeze because tab becomes invisible"),this.freeze())},this.onPageChanged=b,this.onTransitionStart=te,this.onTransitionEnd=fe,this.onError=$,this.context=P,this.room=P.getRoom(),this.player=this.room?void 0:P.getDisplayer(),this.slide=this.createSlide(_),this.syncStateOnceFlag=!this.context.isAddApp,this.visible=document.visibilityState==="visible",this.savedIsFrozen=!1,this.initialize()}jumpToPage(P){this.ready&&(P=sy(P,1,this.pageCount),this.slide.renderSlide(P))}initialize(){this.registerEventListeners(),this.kickStart()}kickStart(){const{context:P,slide:_}=this;P.getIsWritable()&&P.storage.ensureState(Og);const{taskId:b,url:te,state:fe}=P.storage.state;_.setResource(b,te||Ig),fe?(Mi("[Slide] init with state",fe),this.syncStateOnceFlag=!1,_.setSlideState(fe)):P.isAddApp&&(Mi("[Slide] init by renderSlide",1),_.renderSlide(1)),this.pollReadyState()}registerEventListeners(){const{context:P,slide:_}=this,b=this.sideEffect.addDisposer(P.storage.addStateChangedListener(()=>{P.storage.state.state&&(this.syncStateOnce(),this.sideEffect.flush(b))}));this.sideEffect.add(()=>P.addMagixEventListener(di.SLIDE_EVENTS.syncDispatch,this.magixEventListener,{fireSelfEventAfterCommit:!0})),_.on(di.SLIDE_EVENTS.slideChange,this.onPageChanged),_.on(di.SLIDE_EVENTS.renderStart,this.onTransitionStart),_.on(di.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),_.on(di.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),_.on(di.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),_.on(di.SLIDE_EVENTS.renderError,this.onError),_.on(di.SLIDE_EVENTS.stateChange,this.onStateChange),_.on(di.SLIDE_EVENTS.syncDispatch,this.onSyncDispatch),_.on(di.SLIDE_EVENTS.renderEnd,this.resolveReady),this.sideEffect.add(()=>(document.addEventListener("visibilitychange",this.onVisibilityChange),()=>document.removeEventListener("visibilitychange",this.onVisibilityChange)))}syncStateOnce(){if(this.syncStateOnceFlag){this.context.getIsWritable()&&this.context.storage.ensureState(Og);const{state:P}=this.context.storage.state;P&&(Mi("[Slide] sync with state (once)",P),this.slide.setSlideState(P),this.syncStateOnceFlag=!1)}}get pageCount(){return this._pageCount>0?this._pageCount:(this._pageCount=this.slide.slideCount,this._pageCount)}get page(){return this.slide.slideState.currentSlideIndex}createSlide(P){var b,te,fe,$,L,q;return new di.Slide({anchor:P,interactive:!0,mode:"interactive",resize:!0,controller:ls.enable,enableGlobalClick:!0,renderOptions:{minFPS:((b=this.context.getAppOptions())==null?void 0:b.minFPS)||25,maxFPS:((te=this.context.getAppOptions())==null?void 0:te.maxFPS)||30,autoFPS:!0,autoResolution:($=(fe=this.context.getAppOptions())==null?void 0:fe.autoResolution)!=null?$:!0,resolution:(L=this.context.getAppOptions())==null?void 0:L.resolution,transactionBgColor:((q=this.context.getAppOptions())==null?void 0:q.bgColor)||py(P)},timestamp:this.timestamp})}destroy(){this.sideEffect.flushAll(),this.destroyed||(Mi("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0)}afterFreeze(P){P===1?(this.isFrozen=!0,this.freezePromise=null,this._toFreeze===-1&&this.unfreeze()):P===-1&&(this.isFrozen=!1,this.freezePromise=null,this._toFreeze===1&&this.freeze())}}function pE(E){const P="http://www.w3.org/2000/svg",_=document.createElementNS(P,"svg");_.setAttribute("class",`${E}-footer-icon-sidebar`),_.setAttribute("viewBox","0 0 64 64");const b=document.createElementNS(P,"path");return b.setAttribute("fill","currentColor"),b.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"),_.appendChild(b),_}function fE(E){const P="http://www.w3.org/2000/svg",_=document.createElementNS(P,"svg");_.setAttribute("class",`${E}-footer-icon-arrow-left`),_.setAttribute("viewBox","0 0 500 500");const b=document.createElementNS(P,"path");return b.setAttribute("fill","currentColor"),b.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"),_.appendChild(b),_}function mE(E){const P="http://www.w3.org/2000/svg",_=document.createElementNS(P,"svg");_.setAttribute("class",`${E}-footer-icon-arrow-right`),_.setAttribute("viewBox","0 0 500 500");const b=document.createElementNS(P,"path");return b.setAttribute("fill","currentColor"),b.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"),_.appendChild(b),_}function gE(E){const P="http://www.w3.org/2000/svg",_=document.createElementNS(P,"svg");_.setAttribute("class",`${E}-footer-icon-play`),_.setAttribute("viewBox","0 0 500 500");const b=document.createElementNS(P,"path");return b.setAttribute("fill","currentColor"),b.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"),_.appendChild(b),_}function vE(E){const P="http://www.w3.org/2000/svg",_=document.createElementNS(P,"svg");_.setAttribute("class",`${E}-footer-icon-pause`),_.setAttribute("viewBox","0 0 500 500");const b=document.createElementNS(P,"path");return b.setAttribute("fill","currentColor"),b.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"),_.appendChild(b),_}const Pl=typeof window!="undefined",gy=Pl&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),vy=Pl&&"IntersectionObserver"in window,_y=Pl&&"classList"in document.createElement("p"),yy=Pl&&window.devicePixelRatio>1,_E={elements_selector:".lazy",container:gy||Pl?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},xy=E=>Object.assign({},_E,E),by=function(E,P){let _;const b="LazyLoad::Initialized",te=new E(P);try{_=new CustomEvent(b,{detail:{instance:te}})}catch{_=document.createEvent("CustomEvent"),_.initCustomEvent(b,!1,!1,{instance:te})}window.dispatchEvent(_)},yE=(E,P)=>{if(!!P)if(!P.length)by(E,P);else for(let _=0,b;b=P[_];_+=1)by(E,b)},Vs="src",Lg="srcset",Ng="sizes",wy="poster",Bc="llOriginalAttrs",Sy="data",Dg="loading",Ty="loaded",Ey="applied",xE="entered",Fg="error",My="native",Ay="data-",Ry="ll-status",Kr=(E,P)=>E.getAttribute(Ay+P),bE=(E,P,_)=>{var b=Ay+P;if(_===null){E.removeAttribute(b);return}E.setAttribute(b,_)},Uc=E=>Kr(E,Ry),Il=(E,P)=>bE(E,Ry,P),Hp=E=>Il(E,null),Bg=E=>Uc(E)===null,wE=E=>Uc(E)===Dg,SE=E=>Uc(E)===Fg,Ug=E=>Uc(E)===My,TE=[Dg,Ty,Ey,Fg],EE=E=>TE.indexOf(Uc(E))>=0,Fa=(E,P,_,b)=>{if(!!E){if(b!==void 0){E(P,_,b);return}if(_!==void 0){E(P,_);return}E(P)}},ju=(E,P)=>{if(_y){E.classList.add(P);return}E.className+=(E.className?" ":"")+P},us=(E,P)=>{if(_y){E.classList.remove(P);return}E.className=E.className.replace(new RegExp("(^|\\s+)"+P+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},ME=E=>{E.llTempImage=document.createElement("IMG")},AE=E=>{delete E.llTempImage},Cy=E=>E.llTempImage,zp=(E,P)=>{if(!P)return;const _=P._observer;!_||_.unobserve(E)},RE=E=>{E.disconnect()},CE=(E,P,_)=>{P.unobserve_entered&&zp(E,_)},kg=(E,P)=>{!E||(E.loadingCount+=P)},PE=E=>{!E||(E.toLoadCount-=1)},Py=(E,P)=>{!E||(E.toLoadCount=P)},IE=E=>E.loadingCount>0,OE=E=>E.toLoadCount>0,Iy=E=>{let P=[];for(let _=0,b;b=E.children[_];_+=1)b.tagName==="SOURCE"&&P.push(b);return P},Gg=(E,P)=>{const _=E.parentNode;if(!_||_.tagName!=="PICTURE")return;Iy(_).forEach(P)},Oy=(E,P)=>{Iy(E).forEach(P)},jp=[Vs],Ly=[Vs,wy],Vp=[Vs,Lg,Ng],Ny=[Sy],Wp=E=>!!E[Bc],Dy=E=>E[Bc],Fy=E=>delete E[Bc],Vu=(E,P)=>{if(Wp(E))return;const _={};P.forEach(b=>{_[b]=E.getAttribute(b)}),E[Bc]=_},LE=E=>{Wp(E)||(E[Bc]={backgroundImage:E.style.backgroundImage})},NE=(E,P,_)=>{if(!_){E.removeAttribute(P);return}E.setAttribute(P,_)},Wu=(E,P)=>{if(!Wp(E))return;const _=Dy(E);P.forEach(b=>{NE(E,b,_[b])})},DE=E=>{if(!Wp(E))return;const P=Dy(E);E.style.backgroundImage=P.backgroundImage},FE=(E,P,_)=>{ju(E,P.class_applied),Il(E,Ey),_&&(P.unobserve_completed&&zp(E,P),Fa(P.callback_applied,E,_))},By=(E,P,_)=>{ju(E,P.class_loading),Il(E,Dg),_&&(kg(_,1),Fa(P.callback_loading,E,_))},Ba=(E,P,_)=>{!_||E.setAttribute(P,_)},Uy=(E,P)=>{Ba(E,Ng,Kr(E,P.data_sizes)),Ba(E,Lg,Kr(E,P.data_srcset)),Ba(E,Vs,Kr(E,P.data_src))},BE=(E,P)=>{Gg(E,_=>{Vu(_,Vp),Uy(_,P)}),Vu(E,Vp),Uy(E,P)},UE=(E,P)=>{Vu(E,jp),Ba(E,Vs,Kr(E,P.data_src))},kE=(E,P)=>{Oy(E,_=>{Vu(_,jp),Ba(_,Vs,Kr(_,P.data_src))}),Vu(E,Ly),Ba(E,wy,Kr(E,P.data_poster)),Ba(E,Vs,Kr(E,P.data_src)),E.load()},GE=(E,P)=>{Vu(E,Ny),Ba(E,Sy,Kr(E,P.data_src))},HE=(E,P,_)=>{const b=Kr(E,P.data_bg),te=Kr(E,P.data_bg_hidpi),fe=yy&&te?te:b;!fe||(E.style.backgroundImage=`url("${fe}")`,Cy(E).setAttribute(Vs,fe),By(E,P,_))},zE=(E,P,_)=>{const b=Kr(E,P.data_bg_multi),te=Kr(E,P.data_bg_multi_hidpi),fe=yy&&te?te:b;!fe||(E.style.backgroundImage=fe,FE(E,P,_))},ky={IMG:BE,IFRAME:UE,VIDEO:kE,OBJECT:GE},jE=(E,P)=>{const _=ky[E.tagName];!_||_(E,P)},VE=(E,P,_)=>{const b=ky[E.tagName];!b||(b(E,P),By(E,P,_))},WE=["IMG","IFRAME","VIDEO","OBJECT"],XE=E=>WE.indexOf(E.tagName)>-1,Gy=(E,P)=>{P&&!IE(P)&&!OE(P)&&Fa(E.callback_finish,P)},Hy=(E,P,_)=>{E.addEventListener(P,_),E.llEvLisnrs[P]=_},qE=(E,P,_)=>{E.removeEventListener(P,_)},Hg=E=>!!E.llEvLisnrs,YE=(E,P,_)=>{Hg(E)||(E.llEvLisnrs={});const b=E.tagName==="VIDEO"?"loadeddata":"load";Hy(E,b,P),Hy(E,"error",_)},zg=E=>{if(!Hg(E))return;const P=E.llEvLisnrs;for(let _ in P){const b=P[_];qE(E,_,b)}delete E.llEvLisnrs},zy=(E,P,_)=>{AE(E),kg(_,-1),PE(_),us(E,P.class_loading),P.unobserve_completed&&zp(E,_)},$E=(E,P,_,b)=>{const te=Ug(P);zy(P,_,b),ju(P,_.class_loaded),Il(P,Ty),Fa(_.callback_loaded,P,b),te||Gy(_,b)},JE=(E,P,_,b)=>{const te=Ug(P);zy(P,_,b),ju(P,_.class_error),Il(P,Fg),Fa(_.callback_error,P,b),te||Gy(_,b)},jg=(E,P,_)=>{const b=Cy(E)||E;if(Hg(b))return;YE(b,$=>{$E($,E,P,_),zg(b)},$=>{JE($,E,P,_),zg(b)})},ZE=(E,P,_)=>{ME(E),jg(E,P,_),LE(E),HE(E,P,_),zE(E,P,_)},KE=(E,P,_)=>{jg(E,P,_),VE(E,P,_)},Vg=(E,P,_)=>{XE(E)?KE(E,P,_):ZE(E,P,_)},QE=(E,P,_)=>{E.setAttribute("loading","lazy"),jg(E,P,_),jE(E,P),Il(E,My)},jy=E=>{E.removeAttribute(Vs),E.removeAttribute(Lg),E.removeAttribute(Ng)},eM=E=>{Gg(E,P=>{jy(P)}),jy(E)},Vy=E=>{Gg(E,P=>{Wu(P,Vp)}),Wu(E,Vp)},tM={IMG:Vy,IFRAME:E=>{Wu(E,jp)},VIDEO:E=>{Oy(E,P=>{Wu(P,jp)}),Wu(E,Ly),E.load()},OBJECT:E=>{Wu(E,Ny)}},nM=E=>{const P=tM[E.tagName];if(!P){DE(E);return}P(E)},iM=(E,P)=>{Bg(E)||Ug(E)||(us(E,P.class_entered),us(E,P.class_exited),us(E,P.class_applied),us(E,P.class_loading),us(E,P.class_loaded),us(E,P.class_error))},rM=(E,P)=>{nM(E),iM(E,P),Hp(E),Fy(E)},oM=(E,P,_,b)=>{!_.cancel_on_exit||!wE(E)||E.tagName==="IMG"&&(zg(E),eM(E),Vy(E),us(E,_.class_loading),kg(b,-1),Hp(E),Fa(_.callback_cancel,E,P,b))},sM=(E,P,_,b)=>{const te=EE(E);Il(E,xE),ju(E,_.class_entered),us(E,_.class_exited),CE(E,_,b),Fa(_.callback_enter,E,P,b),!te&&Vg(E,_,b)},aM=(E,P,_,b)=>{Bg(E)||(ju(E,_.class_exited),oM(E,P,_,b),Fa(_.callback_exit,E,P,b))},lM=["IMG","IFRAME","VIDEO"],Wy=E=>E.use_native&&"loading"in HTMLImageElement.prototype,uM=(E,P,_)=>{E.forEach(b=>{lM.indexOf(b.tagName)!==-1&&QE(b,P,_)}),Py(_,0)},hM=E=>E.isIntersecting||E.intersectionRatio>0,cM=E=>({root:E.container===document?null:E.container,rootMargin:E.thresholds||E.threshold+"px"}),dM=(E,P,_)=>{E.forEach(b=>hM(b)?sM(b.target,b,P,_):aM(b.target,b,P,_))},pM=(E,P)=>{P.forEach(_=>{E.observe(_)})},fM=(E,P)=>{RE(E),pM(E,P)},mM=(E,P)=>{!vy||Wy(E)||(P._observer=new IntersectionObserver(_=>{dM(_,E,P)},cM(E)))},Xy=E=>Array.prototype.slice.call(E),Xp=E=>E.container.querySelectorAll(E.elements_selector),gM=E=>Xy(E).filter(Bg),vM=E=>SE(E),_M=E=>Xy(E).filter(vM),qy=(E,P)=>gM(E||Xp(P)),yM=(E,P)=>{_M(Xp(E)).forEach(b=>{us(b,E.class_error),Hp(b)}),P.update()},xM=(E,P)=>{!Pl||window.addEventListener("online",()=>{yM(E,P)})},kc=function(E,P){const _=xy(E);this._settings=_,this.loadingCount=0,mM(_,this),xM(_,this),this.update(P)};kc.prototype={update:function(E){const P=this._settings,_=qy(E,P);if(Py(this,_.length),gy||!vy){this.loadAll(_);return}if(Wy(P)){uM(_,P,this);return}fM(this._observer,_)},destroy:function(){this._observer&&this._observer.disconnect(),Xp(this._settings).forEach(E=>{Fy(E)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(E){const P=this._settings;qy(E,P).forEach(b=>{zp(b,this),Vg(b,P,this)})},restoreAll:function(){const E=this._settings;Xp(E).forEach(P=>{rM(P,E)})}},kc.load=(E,P)=>{const _=xy(P);Vg(E,_)},kc.resetStatus=E=>{Hp(E)},Pl&&yE(kc,window.lazyLoadOptions);class Yy{constructor({readonly:P,onNewPageIndex:_,onPlay:b}){this._pages=[],this.pageIndex=0,this.setPaused=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},this.setPlaying=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!0)},this.namespace="netless-app-slide",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new Nc,this.readonly=P,this.onNewPageIndex=_,this.onPlay=b,this.render()}set pages(P){this._pages=P,this.refreshPreview(),this.refreshTotalPage(),this.refreshBtnSidebar()}get pages(){return this._pages}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(P){this.readonly=P,this.$content.classList.toggle(this.wrapClassName("readonly"),P),this.$footer.classList.toggle(this.wrapClassName("readonly"),P),this.$pageNumberInput.disabled=P}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(P){Number.isNaN(P)||(this.pageIndex=P,this.$pageNumberInput.value=String(P+1))}refreshTotalPage(){this.pages.length?this.$totalPage.textContent=" / "+this.pages.length:this.$totalPage.textContent=""}setSmallBox(P){this.isSmallBox!==P&&(this.isSmallBox=P,this.$footer.classList.toggle(this.wrapClassName("float-footer"),P))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const P=document.createElement("div");P.className=this.wrapClassName("content"),this.$content=P,this.readonly&&P.classList.add(this.wrapClassName("readonly")),P.appendChild(this.renderPreviewMask()),P.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const P=document.createElement("div");P.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=P,this.sideEffect.add(()=>(this.previewLazyLoad=new kc({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`}),()=>{var _;return(_=this.previewLazyLoad)==null?void 0:_.destroy()})),this.refreshPreview(),this.sideEffect.addEventListener(P,"click",_=>{var te;if(this.readonly)return;const b=(te=_.target.dataset)==null?void 0:te.pageIndex;b&&(_.preventDefault(),_.stopPropagation(),_.stopImmediatePropagation(),this.onNewPageIndex(Number(b)),this.togglePreview(!1))})}return this.$preview}refreshPreview(){var te;const{$preview:P}=this,_=this.wrapClassName("preview-page"),b=this.wrapClassName("preview-page-name");for(;P.firstChild;)P.firstChild.remove();this.pages.forEach((fe,$)=>{var xe;const L=(xe=fe.thumbnail)!=null?xe:fe.src.startsWith("ppt")?void 0:fe.src;if(!L)return;const q=String($),j=document.createElement("a");j.className=_+" "+this.wrapClassName(`preview-page-${$}`),j.setAttribute("href","#"),j.dataset.pageIndex=q;const F=document.createElement("span");F.className=b,F.textContent=String($+1),F.dataset.pageIndex=q;const K=document.createElement("img");K.width=fe.width,K.height=fe.height,K.dataset.src=L,K.dataset.pageIndex=q,j.appendChild(K),j.appendChild(F),P.appendChild(j)}),(te=this.previewLazyLoad)==null||te.update()}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",P=>{this.readonly||P.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}refreshBtnSidebar(){this.$btnSidebar.style.display=this.pages.length>0?"":"none"}renderFooter(){if(!this.$footer){const P=document.createElement("div");P.className=this.wrapClassName("footer"),this.$footer=P,this.readonly&&P.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&P.classList.add(this.wrapClassName("float-footer"));const _=this.renderFooterBtn("btn-sidebar",pE(this.namespace));this.sideEffect.addEventListener(_,"click",()=>{this.readonly||this.togglePreview()}),this.$btnSidebar=_,this.$btnSidebar.style.display="none",this.$footer.appendChild(_);const b=document.createElement("div");b.className=this.wrapClassName("page-jumps");const te=this.renderFooterBtn("btn-page-back",fE(this.namespace));if(this.sideEffect.addEventListener(te,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),b.appendChild(te),this.onPlay){const j=this.renderFooterBtn("btn-page-play",gE(this.namespace),vE(this.namespace));this.$btnPlay=j,this.sideEffect.addEventListener(j,"click",()=>{this.readonly||(this.setPlaying(),this.onPlay&&this.onPlay())}),b.appendChild(j)}const fe=this.renderFooterBtn("btn-page-next",mE(this.namespace));this.sideEffect.addEventListener(fe,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),b.appendChild(fe);const $=document.createElement("div");$.className=this.wrapClassName("page-number");const L=document.createElement("input");L.className=this.wrapClassName("page-number-input"),L.value=String(this.pageIndex+1),this.readonly&&(L.disabled=!0),this.$pageNumberInput=L,this.sideEffect.addEventListener(L,"focus",()=>{L.select()}),this.sideEffect.addEventListener(L,"change",()=>{this.readonly||L.value&&this.onNewPageIndex(Number(L.value)-1)});const q=document.createElement("span");this.$totalPage=q,$.appendChild(L),$.appendChild(q),this.$footer.appendChild(b),this.$footer.appendChild($)}return this.$footer}renderFooterBtn(P,_,b){const te=document.createElement("button");return te.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(P),te.appendChild(_),b&&te.appendChild(b),te}togglePreview(P){if(this.isShowPreview=P!=null?P:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const _=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));_&&this.$preview.scrollTo({top:_.offsetTop-16})}}wrapClassName(P){return`${this.namespace}-${P}`}}const bM=new Set(["clicker"]);class wM{constructor({box:P,view:_,mountSlideController:b,mountWhiteboard:te}){this.slideController=null,this.isViewMounted=!1,this.onError=({error:fe})=>{this.viewer.setPaused(),console.warn("[Slide] render error",fe)},this.refreshPages=()=>{this.slideController&&(this.viewer.pages=fy(this.slideController.slide),this.viewer.setPageIndex(this.getPageIndex(this.slideController.page)),this.scaleDocsToFit())},this.scaleDocsToFit=()=>{if(this.slideController){const{width:fe,height:$}=this.slideController.slide;fe&&$&&(this.whiteboardView.moveCameraToContain({originX:-fe/2,originY:-$/2,width:fe,height:$,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.whiteboardView.camera.scale,minContentMode:()=>this.whiteboardView.camera.scale,centerX:0,centerY:0,width:fe,height:$}),this.isViewMounted||(this.isViewMounted=!0,console.log("[Slide] mount whiteboard view"),this.mountWhiteboard(this.$whiteboardView)))}},this.onPlay=()=>{this.slideController&&this.slideController.slide.nextStep()},this.onNewPageIndex=fe=>{this.slideController&&this.slideController.jumpToPage(fe+1)},this.sideEffect=new Nc,this.namespace="netless-app-slide",this.box=P,this.whiteboardView=_,this.mountSlideController=b,this.mountWhiteboard=te,this.viewer=new Yy({readonly:P.readonly,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.sideEffect.add(()=>{const fe=$=>{this.setReadonly($)};return P.events.on("readonly",fe),()=>P.events.off("readonly",fe)}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",P=>{if(this.box.focus&&this.slideController)switch(P.key){case"ArrowUp":case"ArrowLeft":{this.slideController.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slideController.slide.nextStep();break}}})}renderSlideContainer(){if(!this.$slide){const P=document.createElement("div");P.className=this.wrapClassName("slide"),P.dataset.appKind="Slide",this.$slide=P}return this.$slide}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view")),this.$whiteboardView}mount(){return this.box.mountContent(this.viewer.$content),this.box.mountFooter(this.viewer.$footer),this.slideController=this.mountSlideController({anchor:this.$slide,onTransitionStart:this.viewer.setPlaying,onTransitionEnd:this.viewer.setPaused,onReady:this.refreshPages,onError:this.onError}),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit))),this}getPageIndex(P){return(P>0?P:1)-1}unmount(){return this.slideController&&(this.slideController.destroy(),this.slideController=null),this.viewer.unmount(),this}setReadonly(P){this.viewer.setReadonly(P)}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}toggleClickThrough(P){this.$whiteboardView.style.pointerEvents=!P||bM.has(P)?"none":"auto"}wrapClassName(P){return`${this.namespace}-${P}`}}let Wg=!1;const $y=2,qp={map:new Map,queue:[],validateQueue(){for(Mi("[Slide] freezer: validate",this.queue);this.queue.length>$y;){const E=this.queue.pop(),P=this.map.get(E);P&&(Mi("[Slide] freezer: validate-freeze",E,this.queue),P.freeze())}},set(E,P){Mi("[Slide] freezer: add",E,this.queue),this.map.set(E,P),this.queue.includes(E)||this.queue.unshift(E),this.validateQueue()},delete(E){Mi("[Slide] freezer: delete",E,this.queue),this.map.delete(E),this.queue=this.queue.filter(P=>P!==E)},focus(E){const P=this.map.get(E),_=this.queue.indexOf(E);_>-1&&this.queue.splice(_,1),this.queue.unshift(E),this.validateQueue(),Mi("[Slide] freezer: focus",E,this.queue),P&&P.unfreeze()}},SM=E=>{Wg=!0,E.on("focus",({appId:P})=>{qp.focus(P)})};var Jy=`.netless-app-slide-content{position:relative;height:100%;overflow:hidden}.netless-app-slide-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-slide-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-slide-preview-active .netless-app-slide-preview-mask{display:block}.netless-app-slide-preview-active .netless-app-slide-preview{transform:translate(0)}.netless-app-slide-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-slide-preview-page:hover,.netless-app-slide-preview-page.netless-app-slide-preview-page-active{border-color:#444e601a}.netless-app-slide-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-slide-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-slide-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-slide-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-slide-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-slide-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-slide-footer-btn:hover{background:transparent!important}}.netless-app-slide-footer-btn>svg{width:100%;height:100%}.netless-app-slide-footer-btn>svg:nth-of-type(2){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-slide-footer-btn~.netless-app-slide-footer-btn{margin-left:15px}.netless-app-slide-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-slide-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-slide-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-slide-page-number-input:hover,.netless-app-slide-page-number-input:focus,.netless-app-slide-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-slide-readonly.netless-app-slide-footer{display:none}.telebox-color-scheme-dark .netless-app-slide-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-slide-page-number-input:active,.telebox-color-scheme-dark .netless-app-slide-page-number-input:focus,.telebox-color-scheme-dark .netless-app-slide-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-slide-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-slide-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-slide-preview{background:rgba(50,50,50,.9)}.netless-app-slide-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-slide-slide{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-slide-slide canvas{transform:scale(var(--netless-app-slide-scale, 1))}
|
|
6368
|
-
`;function TM({container:E,taskId:P,url:_=Ig,debug:b=!1}){if(!P)throw new Error("[Slide] taskId is required");E.style.cssText+="display:flex;flex-direction:column";const te=new Zy({target:E});return te.debug=!!b,te.mount(P,_),te}class Zy{constructor(P){this.slide=null,this.debug=!1,this.sideEffect=new Nc,this.ready=!1,this.readyPromise=new Promise(_=>{this.resolveReady=()=>{this.ready=!0,_()}}),this.hotkeyListener=_=>{if(this.slide)switch(_.key){case"ArrowUp":case"ArrowLeft":{this.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slide.nextStep();break}}},this.onPageChanged=_=>{this.viewer.setPageIndex(_-1)},this.onTransitionStart=()=>{this.viewer.setPlaying()},this.onTransitionEnd=()=>{this.viewer.setPaused()},this.onError=({error:_})=>{this.viewer.setPaused(),console.warn("[Slide] render error",_)},this.destroyed=!1,this.refreshPages=()=>{this.slide&&(this.viewer.pages=fy(this.slide),this.viewer.setPageIndex(this.getPageIndex(this.slide.slideState.currentSlideIndex)))},this.onPlay=()=>{this.slide&&this.slide.nextStep()},this.onNewPageIndex=_=>{this.slide&&this.slide.slideCount>0&&this.slide.renderSlide(sy(_+1,1,this.slide.slideCount))},this.namespace="netless-app-slide",this.target=P.target,this.bgColor=py(this.target),this.viewer=new Yy({readonly:!1,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.registerHotKeys(window)}registerHotKeys(P){this.sideEffect.addEventListener(P,"keydown",this.hotkeyListener,void 0,"hotkey")}mount(P,_){this.target.appendChild(this.renderStyle()),this.target.appendChild(this.viewer.$content),this.target.appendChild(this.viewer.$footer),this.slide=new di.Slide({anchor:this.$slide,interactive:!1,mode:"local",resize:!0,controller:this.debug,enableGlobalClick:!0,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,transactionBgColor:this.bgColor}}),this.registerEventListeners(),this.slide.setResource(P,_),this.slide.renderSlide(1)}renderStyle(){const P=document.createElement("style");return P.appendChild(document.createTextNode(Jy)),P}registerEventListeners(){if(!this.slide)return;const{slide:P}=this;P.on(di.SLIDE_EVENTS.slideChange,this.onPageChanged),P.on(di.SLIDE_EVENTS.renderStart,this.onTransitionStart),P.on(di.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),P.on(di.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),P.on(di.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),P.on(di.SLIDE_EVENTS.renderError,this.onError),P.on(di.SLIDE_EVENTS.renderEnd,this.resolveReady),this.readyPromise.then(this.refreshPages)}destroy(){this.sideEffect.flushAll(),this.slide&&!this.destroyed&&(Mi("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0),this.viewer.destroy()}getPageIndex(P){return(P>0?P:1)-1}renderSlideContainer(){if(!this.$slide){const P=document.createElement("div");P.className=this.wrapClassName("slide"),P.dataset.appKind="Slide",this.$slide=P}return this.$slide}wrapClassName(P){return`${this.namespace}-${P}`}}const Xg="0.1.
|
|
6367
|
+
`}},e.prototype.setMainSeqStep=function(t,n){var r;(r=this.player)===null||r===void 0||r.setMainSeqStep(t,n)},e.prototype.setInteractive=function(t){var n;this.interactive=t,(n=this.player)===null||n===void 0||n.setInteractive(t)},e.prototype.pause=function(){var t;(t=this.player)===null||t===void 0||t.pause()},e.prototype.resume=function(){var t;(t=this.player)===null||t===void 0||t.resume()},e.prototype.frozen=function(){var t;return Hs(this,void 0,void 0,function(){var n,r,o,s=this;return zs(this,function(a){switch(a.label){case 0:return this.isFrowning?[2,ey(function(){return!s.isFrowning},6e4)]:this.view&&this.player?(this.isFrowning=!0,[4,this.player.clock.waitUntil(function(){return!s.isLoading},6e4)]):[3,2];case 1:for(r in a.sent(),n=this.player.getSnapshot()||"",this.cacheImage.src=n,this.frame.appendChild(this.cacheImage),this.player.destroy(),(t=this.playerController)===null||t===void 0||t.destroy(),this.player=void 0,this.__slideState.mediaState)o=this.__slideState.mediaState[r],this.__slideState.mediaState[r]=Np(Np({},o),{frozenTime:this.timestamp()});this.isFrowning=!1,a.label=2;case 2:return[2]}})})},e.prototype.release=function(){var t,n;return Hs(this,void 0,void 0,function(){var r,o,s,a,l=this;return zs(this,function(u){switch(u.label){case 0:if(this.isReleasing)return[2,ey(function(){return!l.isReleasing},6e4)];for(o in this.isReleasing=!0,this.player=this.initPlayer(this.config),!((t=this.config)===null||t===void 0)&&t.controller&&this.createController(),this.player.view&&(this.frame.appendChild(this.player.view),this.player.view.style.visibility="hidden"),r=this.__slideState,this.__slideState=Object(q.cloneDeep)(HT),r.mediaState)(s=r.mediaState[o]).type==="play"&&(a=Math.max((n=s.frozenTime)!==null&&n!==void 0?n:0,s.time),s.time=this.timestamp()-(a-s.time),s.frozenTime=void 0);return[4,this.setSlideState(r)];case 1:return u.sent(),[4,this.player.clock.delay(333)];case 2:u.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch{}return this.isReleasing=!1,[2]}})})},e.prototype.destroy=function(){var t,n,r,o;this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),(t=this.player)===null||t===void 0||t.removeAllListeners(),(n=this.player)===null||n===void 0||n.destroy(),(r=this.player)===null||r===void 0||r.removeAllListeners(),window.removeEventListener("__slide_log__",this.handleLogDownload),window.removeEventListener("__slide_state__",this.handleSlideStateLog),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.clearInterval(this.persistLogId),Hu&&Hu.removeItem(this.logId).catch(function(){});try{!((o=this.player)===null||o===void 0)&&o.view&&this.anchor.removeChild(this.player.view),this.anchor.removeChild(this.frame)}catch{}},e.disposeLocalCache=function(){wr.storeManager.dispose()},e}(L.a)}]);function sy(E,P,_){return Math.min(Math.max(E,P),_)}function tE(E){return typeof E=="object"&&E!==null}var ay={exports:{}},nE={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},ly={exports:{}},iE=function(P){return!P||typeof P=="string"?!1:P instanceof Array||Array.isArray(P)||P.length>=0&&(P.splice instanceof Function||Object.getOwnPropertyDescriptor(P,P.length-1)&&P.constructor.name!=="String")},rE=iE,oE=Array.prototype.concat,sE=Array.prototype.slice,uy=ly.exports=function(P){for(var _=[],b=0,te=P.length;b<te;b++){var fe=P[b];rE(fe)?_=oE.call(_,sE.call(fe)):_.push(fe)}return _};uy.wrap=function(E){return function(){return E(uy(arguments))}};var Dc=nE,Fc=ly.exports,hy=Object.hasOwnProperty,cy={};for(var Pg in Dc)hy.call(Dc,Pg)&&(cy[Dc[Pg]]=Pg);var Zr=ay.exports={to:{},get:{}};Zr.get=function(E){var P=E.substring(0,3).toLowerCase(),_,b;switch(P){case"hsl":_=Zr.get.hsl(E),b="hsl";break;case"hwb":_=Zr.get.hwb(E),b="hwb";break;default:_=Zr.get.rgb(E),b="rgb";break}return _?{model:b,value:_}:null},Zr.get.rgb=function(E){if(!E)return null;var P=/^#([a-f0-9]{3,4})$/i,_=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,b=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,te=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,fe=/^(\w+)$/,$=[0,0,0,1],L,q,j;if(L=E.match(_)){for(j=L[2],L=L[1],q=0;q<3;q++){var F=q*2;$[q]=parseInt(L.slice(F,F+2),16)}j&&($[3]=parseInt(j,16)/255)}else if(L=E.match(P)){for(L=L[1],j=L[3],q=0;q<3;q++)$[q]=parseInt(L[q]+L[q],16);j&&($[3]=parseInt(j+j,16)/255)}else if(L=E.match(b)){for(q=0;q<3;q++)$[q]=parseInt(L[q+1],0);L[4]&&(L[5]?$[3]=parseFloat(L[4])*.01:$[3]=parseFloat(L[4]))}else if(L=E.match(te)){for(q=0;q<3;q++)$[q]=Math.round(parseFloat(L[q+1])*2.55);L[4]&&(L[5]?$[3]=parseFloat(L[4])*.01:$[3]=parseFloat(L[4]))}else return(L=E.match(fe))?L[1]==="transparent"?[0,0,0,0]:hy.call(Dc,L[1])?($=Dc[L[1]],$[3]=1,$):null:null;for(q=0;q<3;q++)$[q]=Da($[q],0,255);return $[3]=Da($[3],0,1),$},Zr.get.hsl=function(E){if(!E)return null;var P=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,_=E.match(P);if(_){var b=parseFloat(_[4]),te=(parseFloat(_[1])%360+360)%360,fe=Da(parseFloat(_[2]),0,100),$=Da(parseFloat(_[3]),0,100),L=Da(isNaN(b)?1:b,0,1);return[te,fe,$,L]}return null},Zr.get.hwb=function(E){if(!E)return null;var P=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,_=E.match(P);if(_){var b=parseFloat(_[4]),te=(parseFloat(_[1])%360+360)%360,fe=Da(parseFloat(_[2]),0,100),$=Da(parseFloat(_[3]),0,100),L=Da(isNaN(b)?1:b,0,1);return[te,fe,$,L]}return null},Zr.to.hex=function(){var E=Fc(arguments);return"#"+kp(E[0])+kp(E[1])+kp(E[2])+(E[3]<1?kp(Math.round(E[3]*255)):"")},Zr.to.rgb=function(){var E=Fc(arguments);return E.length<4||E[3]===1?"rgb("+Math.round(E[0])+", "+Math.round(E[1])+", "+Math.round(E[2])+")":"rgba("+Math.round(E[0])+", "+Math.round(E[1])+", "+Math.round(E[2])+", "+E[3]+")"},Zr.to.rgb.percent=function(){var E=Fc(arguments),P=Math.round(E[0]/255*100),_=Math.round(E[1]/255*100),b=Math.round(E[2]/255*100);return E.length<4||E[3]===1?"rgb("+P+"%, "+_+"%, "+b+"%)":"rgba("+P+"%, "+_+"%, "+b+"%, "+E[3]+")"},Zr.to.hsl=function(){var E=Fc(arguments);return E.length<4||E[3]===1?"hsl("+E[0]+", "+E[1]+"%, "+E[2]+"%)":"hsla("+E[0]+", "+E[1]+"%, "+E[2]+"%, "+E[3]+")"},Zr.to.hwb=function(){var E=Fc(arguments),P="";return E.length>=4&&E[3]!==1&&(P=", "+E[3]),"hwb("+E[0]+", "+E[1]+"%, "+E[2]+"%"+P+")"},Zr.to.keyword=function(E){return cy[E.slice(0,3)]};function Da(E,P,_){return Math.min(Math.max(P,E),_)}function kp(E){var P=Math.round(E).toString(16).toUpperCase();return P.length<2?"0"+P:P}var aE=ay.exports;class lE{constructor(P){this.enable=P,this.apps={},this.level="debug",this._onMessage=_=>{let b;_ instanceof CustomEvent?b=_.detail:tE(_.data)&&(b=_.data),b&&(typeof b.slide=="boolean"?this.enable=b.slide:b.slide==="__instance"?console.log(this):b.slide==="__debug"&&Object.values(this.apps).forEach(te=>{var fe,$;($=(fe=te.controller)==null?void 0:fe.slide)==null||$.createController()}))},window.addEventListener("message",this._onMessage)}log(...P){this.enable&&console.log(...P)}verbose(...P){this.enable&&this.level==="verbose"&&console.log(...P)}dispose(P){this.enable=!1,delete this.apps[P],window.removeEventListener("message",this._onMessage)}}const ls=new lE(!1),Mi=ls.log.bind(ls),uE=ls.verbose.bind(ls);function dy(E){try{const P=window.getComputedStyle(E).backgroundColor;if(P!=="rgba(0, 0, 0, 0)"&&P!=="transparent")return P;if(E.parentElement)return dy(E.parentElement)}catch{}return"#ffffff"}function hE(E){const P=aE.get(E);if(P&&P.model==="rgb"){const _=P.value,te=(((Math.round(_[0])&255)<<16)+((Math.round(_[1])&255)<<8)+(Math.round(_[2])&255)).toString(16);return"#"+"000000".substring(te.length)+te}else return E}let Gp="";function py(E){return Gp||(Gp=hE(dy(E)),Mi("[Slide] guess bg color",Gp)),Gp}function fy(E){const{width:P,height:_,slideCount:b,slideState:te}=E,{taskId:fe,url:$}=te,L=[];for(let q=1;q<=b;++q)L.push({width:P,height:_,thumbnail:`${$}/${fe}/preview/${q}.png`,src:"ppt"});return L}function my(E,P,_,b){var L;const te=_.slideState.currentSlideIndex;if(!(te>0)||!P.getIsWritable())return;const fe=[b,te].join("/");if(E.scenePathType(fe)!=="page"){E.removeScenes(b);const q=_.slideCount,j=[];for(let F=1;F<=q;++F)j.push({name:`${F}`});E.putScenes(b,j)}let $;P.getBox().focus?$=E.state.sceneState.scenePath:$=((L=P.getView())==null?void 0:L.focusScenePath)||"",$!==fe&&P.setScenePath(fe)}const Ig="https://convertcdn.netless.link/dynamicConvert",cE=40,Og={taskId:"",url:"",state:null};class dE{constructor({context:P,anchor:_,onPageChanged:b,onTransitionStart:te,onTransitionEnd:fe,onError:$}){this.sideEffect=new Nc,this.ready=!1,this.readyPromise=new Promise(L=>{this.resolveReady=()=>setTimeout(()=>{this.ready=!0,L()},1e3)}),this.onSyncDispatch=L=>{if(this.context.getIsWritable()&&this.room){const q={type:di.SLIDE_EVENTS.syncDispatch,payload:L};Mi("[Slide] dispatch",L),this.context.dispatchMagixEvent(di.SLIDE_EVENTS.syncDispatch,q)}},this.magixEventListener=L=>{const{type:q,payload:j}=L.payload;q===di.SLIDE_EVENTS.syncDispatch&&(this.syncStateOnce(),Mi("[Slide] receive",j),this.slide.emit(di.SLIDE_EVENTS.syncReceive,j))},this.onStateChange=L=>{this.context.getIsWritable()&&(uE("[Slide] state change",JSON.stringify(L,null,2)),this.context.storage.setState({state:L}))},this.pollCount=0,this.pollReadyState=()=>{this.ready?this._toFreeze===1?this.freeze():this._toFreeze===-1&&this.unfreeze():this.pollCount<cE?(this.pollCount++,setTimeout(this.pollReadyState,500)):(this.pollCount=0,Mi("[Slide] renderSlide (retry after timeout)",1),this.slide.renderSlide(1))},this._pageCount=0,this.destroyed=!1,this.timestamp=()=>this.room&&this.room.calibrationTimestamp?this.room.calibrationTimestamp:this.player?this.player.beginTimestamp+this.player.progressTime:Date.now(),this.isFrozen=!1,this._toFreeze=0,this.freezePromise=null,this.freeze=()=>{this.ready?(Mi("[Slide] freeze",this.context.appId),this.freezePromise?this._toFreeze=1:this.isFrozen||(this._toFreeze=0,this.freezePromise=this.slide.frozen().then(this.afterFreeze.bind(this,1)))):this._toFreeze=1},this.unfreeze=async()=>{!this.visible||(this.ready?(Mi("[Slide] unfreeze",this.context.appId),this.freezePromise?this._toFreeze=-1:this.isFrozen&&(this._toFreeze=0,this.freezePromise=this.slide.release().then(this.afterFreeze.bind(this,-1)))):this._toFreeze=-1)},this.onVisibilityChange=async()=>{(this.visible=document.visibilityState==="visible")?(Mi("[Slide] unfreeze because tab becomes visible",{savedIsFrozen:this.savedIsFrozen}),this.savedIsFrozen||this.unfreeze()):(this.savedIsFrozen=this.freezePromise?this._toFreeze===1:this.isFrozen,Mi("[Slide] freeze because tab becomes invisible"),this.freeze())},this.onPageChanged=b,this.onTransitionStart=te,this.onTransitionEnd=fe,this.onError=$,this.context=P,this.room=P.getRoom(),this.player=this.room?void 0:P.getDisplayer(),this.slide=this.createSlide(_),this.syncStateOnceFlag=!this.context.isAddApp,this.visible=document.visibilityState==="visible",this.savedIsFrozen=!1,this.initialize()}jumpToPage(P){this.ready&&(P=sy(P,1,this.pageCount),this.slide.renderSlide(P))}initialize(){this.registerEventListeners(),this.kickStart()}kickStart(){const{context:P,slide:_}=this;P.getIsWritable()&&P.storage.ensureState(Og);const{taskId:b,url:te,state:fe}=P.storage.state;_.setResource(b,te||Ig),fe?(Mi("[Slide] init with state",fe),this.syncStateOnceFlag=!1,_.setSlideState(fe)):P.isAddApp&&(Mi("[Slide] init by renderSlide",1),_.renderSlide(1)),this.pollReadyState()}registerEventListeners(){const{context:P,slide:_}=this,b=this.sideEffect.addDisposer(P.storage.addStateChangedListener(()=>{P.storage.state.state&&(this.syncStateOnce(),this.sideEffect.flush(b))}));this.sideEffect.add(()=>P.addMagixEventListener(di.SLIDE_EVENTS.syncDispatch,this.magixEventListener,{fireSelfEventAfterCommit:!0})),_.on(di.SLIDE_EVENTS.slideChange,this.onPageChanged),_.on(di.SLIDE_EVENTS.renderStart,this.onTransitionStart),_.on(di.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),_.on(di.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),_.on(di.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),_.on(di.SLIDE_EVENTS.renderError,this.onError),_.on(di.SLIDE_EVENTS.stateChange,this.onStateChange),_.on(di.SLIDE_EVENTS.syncDispatch,this.onSyncDispatch),_.on(di.SLIDE_EVENTS.renderEnd,this.resolveReady),this.sideEffect.add(()=>(document.addEventListener("visibilitychange",this.onVisibilityChange),()=>document.removeEventListener("visibilitychange",this.onVisibilityChange)))}syncStateOnce(){if(this.syncStateOnceFlag){this.context.getIsWritable()&&this.context.storage.ensureState(Og);const{state:P}=this.context.storage.state;P&&(Mi("[Slide] sync with state (once)",P),this.slide.setSlideState(P),this.syncStateOnceFlag=!1)}}get pageCount(){return this._pageCount>0?this._pageCount:(this._pageCount=this.slide.slideCount,this._pageCount)}get page(){return this.slide.slideState.currentSlideIndex}createSlide(P){var b,te,fe,$,L,q,j,F;return new di.Slide({anchor:P,interactive:!0,mode:"interactive",resize:!0,controller:ls.enable,enableGlobalClick:!0,renderOptions:{minFPS:((b=this.context.getAppOptions())==null?void 0:b.minFPS)||25,maxFPS:((te=this.context.getAppOptions())==null?void 0:te.maxFPS)||30,autoFPS:($=(fe=this.context.getAppOptions())==null?void 0:fe.autoFPS)!=null?$:!0,autoResolution:(q=(L=this.context.getAppOptions())==null?void 0:L.autoResolution)!=null?q:!0,resolution:(j=this.context.getAppOptions())==null?void 0:j.resolution,transactionBgColor:((F=this.context.getAppOptions())==null?void 0:F.bgColor)||py(P)},timestamp:this.timestamp})}destroy(){this.sideEffect.flushAll(),this.destroyed||(Mi("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0)}afterFreeze(P){P===1?(this.isFrozen=!0,this.freezePromise=null,this._toFreeze===-1&&this.unfreeze()):P===-1&&(this.isFrozen=!1,this.freezePromise=null,this._toFreeze===1&&this.freeze())}}function pE(E){const P="http://www.w3.org/2000/svg",_=document.createElementNS(P,"svg");_.setAttribute("class",`${E}-footer-icon-sidebar`),_.setAttribute("viewBox","0 0 64 64");const b=document.createElementNS(P,"path");return b.setAttribute("fill","currentColor"),b.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"),_.appendChild(b),_}function fE(E){const P="http://www.w3.org/2000/svg",_=document.createElementNS(P,"svg");_.setAttribute("class",`${E}-footer-icon-arrow-left`),_.setAttribute("viewBox","0 0 500 500");const b=document.createElementNS(P,"path");return b.setAttribute("fill","currentColor"),b.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"),_.appendChild(b),_}function mE(E){const P="http://www.w3.org/2000/svg",_=document.createElementNS(P,"svg");_.setAttribute("class",`${E}-footer-icon-arrow-right`),_.setAttribute("viewBox","0 0 500 500");const b=document.createElementNS(P,"path");return b.setAttribute("fill","currentColor"),b.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"),_.appendChild(b),_}function gE(E){const P="http://www.w3.org/2000/svg",_=document.createElementNS(P,"svg");_.setAttribute("class",`${E}-footer-icon-play`),_.setAttribute("viewBox","0 0 500 500");const b=document.createElementNS(P,"path");return b.setAttribute("fill","currentColor"),b.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"),_.appendChild(b),_}function vE(E){const P="http://www.w3.org/2000/svg",_=document.createElementNS(P,"svg");_.setAttribute("class",`${E}-footer-icon-pause`),_.setAttribute("viewBox","0 0 500 500");const b=document.createElementNS(P,"path");return b.setAttribute("fill","currentColor"),b.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"),_.appendChild(b),_}const Pl=typeof window!="undefined",gy=Pl&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),vy=Pl&&"IntersectionObserver"in window,_y=Pl&&"classList"in document.createElement("p"),yy=Pl&&window.devicePixelRatio>1,_E={elements_selector:".lazy",container:gy||Pl?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},xy=E=>Object.assign({},_E,E),by=function(E,P){let _;const b="LazyLoad::Initialized",te=new E(P);try{_=new CustomEvent(b,{detail:{instance:te}})}catch{_=document.createEvent("CustomEvent"),_.initCustomEvent(b,!1,!1,{instance:te})}window.dispatchEvent(_)},yE=(E,P)=>{if(!!P)if(!P.length)by(E,P);else for(let _=0,b;b=P[_];_+=1)by(E,b)},Vs="src",Lg="srcset",Ng="sizes",wy="poster",Bc="llOriginalAttrs",Sy="data",Dg="loading",Ty="loaded",Ey="applied",xE="entered",Fg="error",My="native",Ay="data-",Ry="ll-status",Kr=(E,P)=>E.getAttribute(Ay+P),bE=(E,P,_)=>{var b=Ay+P;if(_===null){E.removeAttribute(b);return}E.setAttribute(b,_)},Uc=E=>Kr(E,Ry),Il=(E,P)=>bE(E,Ry,P),Hp=E=>Il(E,null),Bg=E=>Uc(E)===null,wE=E=>Uc(E)===Dg,SE=E=>Uc(E)===Fg,Ug=E=>Uc(E)===My,TE=[Dg,Ty,Ey,Fg],EE=E=>TE.indexOf(Uc(E))>=0,Fa=(E,P,_,b)=>{if(!!E){if(b!==void 0){E(P,_,b);return}if(_!==void 0){E(P,_);return}E(P)}},ju=(E,P)=>{if(_y){E.classList.add(P);return}E.className+=(E.className?" ":"")+P},us=(E,P)=>{if(_y){E.classList.remove(P);return}E.className=E.className.replace(new RegExp("(^|\\s+)"+P+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},ME=E=>{E.llTempImage=document.createElement("IMG")},AE=E=>{delete E.llTempImage},Cy=E=>E.llTempImage,zp=(E,P)=>{if(!P)return;const _=P._observer;!_||_.unobserve(E)},RE=E=>{E.disconnect()},CE=(E,P,_)=>{P.unobserve_entered&&zp(E,_)},kg=(E,P)=>{!E||(E.loadingCount+=P)},PE=E=>{!E||(E.toLoadCount-=1)},Py=(E,P)=>{!E||(E.toLoadCount=P)},IE=E=>E.loadingCount>0,OE=E=>E.toLoadCount>0,Iy=E=>{let P=[];for(let _=0,b;b=E.children[_];_+=1)b.tagName==="SOURCE"&&P.push(b);return P},Gg=(E,P)=>{const _=E.parentNode;if(!_||_.tagName!=="PICTURE")return;Iy(_).forEach(P)},Oy=(E,P)=>{Iy(E).forEach(P)},jp=[Vs],Ly=[Vs,wy],Vp=[Vs,Lg,Ng],Ny=[Sy],Wp=E=>!!E[Bc],Dy=E=>E[Bc],Fy=E=>delete E[Bc],Vu=(E,P)=>{if(Wp(E))return;const _={};P.forEach(b=>{_[b]=E.getAttribute(b)}),E[Bc]=_},LE=E=>{Wp(E)||(E[Bc]={backgroundImage:E.style.backgroundImage})},NE=(E,P,_)=>{if(!_){E.removeAttribute(P);return}E.setAttribute(P,_)},Wu=(E,P)=>{if(!Wp(E))return;const _=Dy(E);P.forEach(b=>{NE(E,b,_[b])})},DE=E=>{if(!Wp(E))return;const P=Dy(E);E.style.backgroundImage=P.backgroundImage},FE=(E,P,_)=>{ju(E,P.class_applied),Il(E,Ey),_&&(P.unobserve_completed&&zp(E,P),Fa(P.callback_applied,E,_))},By=(E,P,_)=>{ju(E,P.class_loading),Il(E,Dg),_&&(kg(_,1),Fa(P.callback_loading,E,_))},Ba=(E,P,_)=>{!_||E.setAttribute(P,_)},Uy=(E,P)=>{Ba(E,Ng,Kr(E,P.data_sizes)),Ba(E,Lg,Kr(E,P.data_srcset)),Ba(E,Vs,Kr(E,P.data_src))},BE=(E,P)=>{Gg(E,_=>{Vu(_,Vp),Uy(_,P)}),Vu(E,Vp),Uy(E,P)},UE=(E,P)=>{Vu(E,jp),Ba(E,Vs,Kr(E,P.data_src))},kE=(E,P)=>{Oy(E,_=>{Vu(_,jp),Ba(_,Vs,Kr(_,P.data_src))}),Vu(E,Ly),Ba(E,wy,Kr(E,P.data_poster)),Ba(E,Vs,Kr(E,P.data_src)),E.load()},GE=(E,P)=>{Vu(E,Ny),Ba(E,Sy,Kr(E,P.data_src))},HE=(E,P,_)=>{const b=Kr(E,P.data_bg),te=Kr(E,P.data_bg_hidpi),fe=yy&&te?te:b;!fe||(E.style.backgroundImage=`url("${fe}")`,Cy(E).setAttribute(Vs,fe),By(E,P,_))},zE=(E,P,_)=>{const b=Kr(E,P.data_bg_multi),te=Kr(E,P.data_bg_multi_hidpi),fe=yy&&te?te:b;!fe||(E.style.backgroundImage=fe,FE(E,P,_))},ky={IMG:BE,IFRAME:UE,VIDEO:kE,OBJECT:GE},jE=(E,P)=>{const _=ky[E.tagName];!_||_(E,P)},VE=(E,P,_)=>{const b=ky[E.tagName];!b||(b(E,P),By(E,P,_))},WE=["IMG","IFRAME","VIDEO","OBJECT"],XE=E=>WE.indexOf(E.tagName)>-1,Gy=(E,P)=>{P&&!IE(P)&&!OE(P)&&Fa(E.callback_finish,P)},Hy=(E,P,_)=>{E.addEventListener(P,_),E.llEvLisnrs[P]=_},qE=(E,P,_)=>{E.removeEventListener(P,_)},Hg=E=>!!E.llEvLisnrs,YE=(E,P,_)=>{Hg(E)||(E.llEvLisnrs={});const b=E.tagName==="VIDEO"?"loadeddata":"load";Hy(E,b,P),Hy(E,"error",_)},zg=E=>{if(!Hg(E))return;const P=E.llEvLisnrs;for(let _ in P){const b=P[_];qE(E,_,b)}delete E.llEvLisnrs},zy=(E,P,_)=>{AE(E),kg(_,-1),PE(_),us(E,P.class_loading),P.unobserve_completed&&zp(E,_)},$E=(E,P,_,b)=>{const te=Ug(P);zy(P,_,b),ju(P,_.class_loaded),Il(P,Ty),Fa(_.callback_loaded,P,b),te||Gy(_,b)},JE=(E,P,_,b)=>{const te=Ug(P);zy(P,_,b),ju(P,_.class_error),Il(P,Fg),Fa(_.callback_error,P,b),te||Gy(_,b)},jg=(E,P,_)=>{const b=Cy(E)||E;if(Hg(b))return;YE(b,$=>{$E($,E,P,_),zg(b)},$=>{JE($,E,P,_),zg(b)})},ZE=(E,P,_)=>{ME(E),jg(E,P,_),LE(E),HE(E,P,_),zE(E,P,_)},KE=(E,P,_)=>{jg(E,P,_),VE(E,P,_)},Vg=(E,P,_)=>{XE(E)?KE(E,P,_):ZE(E,P,_)},QE=(E,P,_)=>{E.setAttribute("loading","lazy"),jg(E,P,_),jE(E,P),Il(E,My)},jy=E=>{E.removeAttribute(Vs),E.removeAttribute(Lg),E.removeAttribute(Ng)},eM=E=>{Gg(E,P=>{jy(P)}),jy(E)},Vy=E=>{Gg(E,P=>{Wu(P,Vp)}),Wu(E,Vp)},tM={IMG:Vy,IFRAME:E=>{Wu(E,jp)},VIDEO:E=>{Oy(E,P=>{Wu(P,jp)}),Wu(E,Ly),E.load()},OBJECT:E=>{Wu(E,Ny)}},nM=E=>{const P=tM[E.tagName];if(!P){DE(E);return}P(E)},iM=(E,P)=>{Bg(E)||Ug(E)||(us(E,P.class_entered),us(E,P.class_exited),us(E,P.class_applied),us(E,P.class_loading),us(E,P.class_loaded),us(E,P.class_error))},rM=(E,P)=>{nM(E),iM(E,P),Hp(E),Fy(E)},oM=(E,P,_,b)=>{!_.cancel_on_exit||!wE(E)||E.tagName==="IMG"&&(zg(E),eM(E),Vy(E),us(E,_.class_loading),kg(b,-1),Hp(E),Fa(_.callback_cancel,E,P,b))},sM=(E,P,_,b)=>{const te=EE(E);Il(E,xE),ju(E,_.class_entered),us(E,_.class_exited),CE(E,_,b),Fa(_.callback_enter,E,P,b),!te&&Vg(E,_,b)},aM=(E,P,_,b)=>{Bg(E)||(ju(E,_.class_exited),oM(E,P,_,b),Fa(_.callback_exit,E,P,b))},lM=["IMG","IFRAME","VIDEO"],Wy=E=>E.use_native&&"loading"in HTMLImageElement.prototype,uM=(E,P,_)=>{E.forEach(b=>{lM.indexOf(b.tagName)!==-1&&QE(b,P,_)}),Py(_,0)},hM=E=>E.isIntersecting||E.intersectionRatio>0,cM=E=>({root:E.container===document?null:E.container,rootMargin:E.thresholds||E.threshold+"px"}),dM=(E,P,_)=>{E.forEach(b=>hM(b)?sM(b.target,b,P,_):aM(b.target,b,P,_))},pM=(E,P)=>{P.forEach(_=>{E.observe(_)})},fM=(E,P)=>{RE(E),pM(E,P)},mM=(E,P)=>{!vy||Wy(E)||(P._observer=new IntersectionObserver(_=>{dM(_,E,P)},cM(E)))},Xy=E=>Array.prototype.slice.call(E),Xp=E=>E.container.querySelectorAll(E.elements_selector),gM=E=>Xy(E).filter(Bg),vM=E=>SE(E),_M=E=>Xy(E).filter(vM),qy=(E,P)=>gM(E||Xp(P)),yM=(E,P)=>{_M(Xp(E)).forEach(b=>{us(b,E.class_error),Hp(b)}),P.update()},xM=(E,P)=>{!Pl||window.addEventListener("online",()=>{yM(E,P)})},kc=function(E,P){const _=xy(E);this._settings=_,this.loadingCount=0,mM(_,this),xM(_,this),this.update(P)};kc.prototype={update:function(E){const P=this._settings,_=qy(E,P);if(Py(this,_.length),gy||!vy){this.loadAll(_);return}if(Wy(P)){uM(_,P,this);return}fM(this._observer,_)},destroy:function(){this._observer&&this._observer.disconnect(),Xp(this._settings).forEach(E=>{Fy(E)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(E){const P=this._settings;qy(E,P).forEach(b=>{zp(b,this),Vg(b,P,this)})},restoreAll:function(){const E=this._settings;Xp(E).forEach(P=>{rM(P,E)})}},kc.load=(E,P)=>{const _=xy(P);Vg(E,_)},kc.resetStatus=E=>{Hp(E)},Pl&&yE(kc,window.lazyLoadOptions);class Yy{constructor({readonly:P,onNewPageIndex:_,onPlay:b}){this._pages=[],this.pageIndex=0,this.setPaused=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},this.setPlaying=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!0)},this.namespace="netless-app-slide",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new Nc,this.readonly=P,this.onNewPageIndex=_,this.onPlay=b,this.render()}set pages(P){this._pages=P,this.refreshPreview(),this.refreshTotalPage(),this.refreshBtnSidebar()}get pages(){return this._pages}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(P){this.readonly=P,this.$content.classList.toggle(this.wrapClassName("readonly"),P),this.$footer.classList.toggle(this.wrapClassName("readonly"),P),this.$pageNumberInput.disabled=P}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(P){Number.isNaN(P)||(this.pageIndex=P,this.$pageNumberInput.value=String(P+1))}refreshTotalPage(){this.pages.length?this.$totalPage.textContent=" / "+this.pages.length:this.$totalPage.textContent=""}setSmallBox(P){this.isSmallBox!==P&&(this.isSmallBox=P,this.$footer.classList.toggle(this.wrapClassName("float-footer"),P))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const P=document.createElement("div");P.className=this.wrapClassName("content"),this.$content=P,this.readonly&&P.classList.add(this.wrapClassName("readonly")),P.appendChild(this.renderPreviewMask()),P.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const P=document.createElement("div");P.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=P,this.sideEffect.add(()=>(this.previewLazyLoad=new kc({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`}),()=>{var _;return(_=this.previewLazyLoad)==null?void 0:_.destroy()})),this.refreshPreview(),this.sideEffect.addEventListener(P,"click",_=>{var te;if(this.readonly)return;const b=(te=_.target.dataset)==null?void 0:te.pageIndex;b&&(_.preventDefault(),_.stopPropagation(),_.stopImmediatePropagation(),this.onNewPageIndex(Number(b)),this.togglePreview(!1))})}return this.$preview}refreshPreview(){var te;const{$preview:P}=this,_=this.wrapClassName("preview-page"),b=this.wrapClassName("preview-page-name");for(;P.firstChild;)P.firstChild.remove();this.pages.forEach((fe,$)=>{var xe;const L=(xe=fe.thumbnail)!=null?xe:fe.src.startsWith("ppt")?void 0:fe.src;if(!L)return;const q=String($),j=document.createElement("a");j.className=_+" "+this.wrapClassName(`preview-page-${$}`),j.setAttribute("href","#"),j.dataset.pageIndex=q;const F=document.createElement("span");F.className=b,F.textContent=String($+1),F.dataset.pageIndex=q;const K=document.createElement("img");K.width=fe.width,K.height=fe.height,K.dataset.src=L,K.dataset.pageIndex=q,j.appendChild(K),j.appendChild(F),P.appendChild(j)}),(te=this.previewLazyLoad)==null||te.update()}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",P=>{this.readonly||P.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}refreshBtnSidebar(){this.$btnSidebar.style.display=this.pages.length>0?"":"none"}renderFooter(){if(!this.$footer){const P=document.createElement("div");P.className=this.wrapClassName("footer"),this.$footer=P,this.readonly&&P.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&P.classList.add(this.wrapClassName("float-footer"));const _=this.renderFooterBtn("btn-sidebar",pE(this.namespace));this.sideEffect.addEventListener(_,"click",()=>{this.readonly||this.togglePreview()}),this.$btnSidebar=_,this.$btnSidebar.style.display="none",this.$footer.appendChild(_);const b=document.createElement("div");b.className=this.wrapClassName("page-jumps");const te=this.renderFooterBtn("btn-page-back",fE(this.namespace));if(this.sideEffect.addEventListener(te,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),b.appendChild(te),this.onPlay){const j=this.renderFooterBtn("btn-page-play",gE(this.namespace),vE(this.namespace));this.$btnPlay=j,this.sideEffect.addEventListener(j,"click",()=>{this.readonly||(this.setPlaying(),this.onPlay&&this.onPlay())}),b.appendChild(j)}const fe=this.renderFooterBtn("btn-page-next",mE(this.namespace));this.sideEffect.addEventListener(fe,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),b.appendChild(fe);const $=document.createElement("div");$.className=this.wrapClassName("page-number");const L=document.createElement("input");L.className=this.wrapClassName("page-number-input"),L.value=String(this.pageIndex+1),this.readonly&&(L.disabled=!0),this.$pageNumberInput=L,this.sideEffect.addEventListener(L,"focus",()=>{L.select()}),this.sideEffect.addEventListener(L,"change",()=>{this.readonly||L.value&&this.onNewPageIndex(Number(L.value)-1)});const q=document.createElement("span");this.$totalPage=q,$.appendChild(L),$.appendChild(q),this.$footer.appendChild(b),this.$footer.appendChild($)}return this.$footer}renderFooterBtn(P,_,b){const te=document.createElement("button");return te.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(P),te.appendChild(_),b&&te.appendChild(b),te}togglePreview(P){if(this.isShowPreview=P!=null?P:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const _=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));_&&this.$preview.scrollTo({top:_.offsetTop-16})}}wrapClassName(P){return`${this.namespace}-${P}`}}const bM=new Set(["clicker"]);class wM{constructor({box:P,view:_,mountSlideController:b,mountWhiteboard:te}){this.slideController=null,this.isViewMounted=!1,this.onError=({error:fe})=>{this.viewer.setPaused(),console.warn("[Slide] render error",fe)},this.refreshPages=()=>{this.slideController&&(this.viewer.pages=fy(this.slideController.slide),this.viewer.setPageIndex(this.getPageIndex(this.slideController.page)),this.scaleDocsToFit())},this.scaleDocsToFit=()=>{if(this.slideController){const{width:fe,height:$}=this.slideController.slide;fe&&$&&(this.whiteboardView.moveCameraToContain({originX:-fe/2,originY:-$/2,width:fe,height:$,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.whiteboardView.camera.scale,minContentMode:()=>this.whiteboardView.camera.scale,centerX:0,centerY:0,width:fe,height:$}),this.isViewMounted||(this.isViewMounted=!0,console.log("[Slide] mount whiteboard view"),this.mountWhiteboard(this.$whiteboardView)))}},this.onPlay=()=>{this.slideController&&this.slideController.slide.nextStep()},this.onNewPageIndex=fe=>{this.slideController&&this.slideController.jumpToPage(fe+1)},this.sideEffect=new Nc,this.namespace="netless-app-slide",this.box=P,this.whiteboardView=_,this.mountSlideController=b,this.mountWhiteboard=te,this.viewer=new Yy({readonly:P.readonly,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.sideEffect.add(()=>{const fe=$=>{this.setReadonly($)};return P.events.on("readonly",fe),()=>P.events.off("readonly",fe)}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",P=>{if(this.box.focus&&this.slideController)switch(P.key){case"ArrowUp":case"ArrowLeft":{this.slideController.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slideController.slide.nextStep();break}}})}renderSlideContainer(){if(!this.$slide){const P=document.createElement("div");P.className=this.wrapClassName("slide"),P.dataset.appKind="Slide",this.$slide=P}return this.$slide}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view")),this.$whiteboardView}mount(){return this.box.mountContent(this.viewer.$content),this.box.mountFooter(this.viewer.$footer),this.slideController=this.mountSlideController({anchor:this.$slide,onTransitionStart:this.viewer.setPlaying,onTransitionEnd:this.viewer.setPaused,onReady:this.refreshPages,onError:this.onError}),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit))),this}getPageIndex(P){return(P>0?P:1)-1}unmount(){return this.slideController&&(this.slideController.destroy(),this.slideController=null),this.viewer.unmount(),this}setReadonly(P){this.viewer.setReadonly(P)}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}toggleClickThrough(P){this.$whiteboardView.style.pointerEvents=!P||bM.has(P)?"none":"auto"}wrapClassName(P){return`${this.namespace}-${P}`}}let Wg=!1;const $y=2,qp={map:new Map,queue:[],validateQueue(){for(Mi("[Slide] freezer: validate",this.queue);this.queue.length>$y;){const E=this.queue.pop(),P=this.map.get(E);P&&(Mi("[Slide] freezer: validate-freeze",E,this.queue),P.freeze())}},set(E,P){Mi("[Slide] freezer: add",E,this.queue),this.map.set(E,P),this.queue.includes(E)||this.queue.unshift(E),this.validateQueue()},delete(E){Mi("[Slide] freezer: delete",E,this.queue),this.map.delete(E),this.queue=this.queue.filter(P=>P!==E)},focus(E){const P=this.map.get(E),_=this.queue.indexOf(E);_>-1&&this.queue.splice(_,1),this.queue.unshift(E),this.validateQueue(),Mi("[Slide] freezer: focus",E,this.queue),P&&P.unfreeze()}},SM=E=>{Wg=!0,E.on("focus",({appId:P})=>{qp.focus(P)})};var Jy=`.netless-app-slide-content{position:relative;height:100%;overflow:hidden}.netless-app-slide-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-slide-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-slide-preview-active .netless-app-slide-preview-mask{display:block}.netless-app-slide-preview-active .netless-app-slide-preview{transform:translate(0)}.netless-app-slide-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-slide-preview-page:hover,.netless-app-slide-preview-page.netless-app-slide-preview-page-active{border-color:#444e601a}.netless-app-slide-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-slide-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-slide-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-slide-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-slide-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-slide-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-slide-footer-btn:hover{background:transparent!important}}.netless-app-slide-footer-btn>svg{width:100%;height:100%}.netless-app-slide-footer-btn>svg:nth-of-type(2){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-slide-footer-btn~.netless-app-slide-footer-btn{margin-left:15px}.netless-app-slide-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-slide-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-slide-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-slide-page-number-input:hover,.netless-app-slide-page-number-input:focus,.netless-app-slide-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-slide-readonly.netless-app-slide-footer{display:none}.telebox-color-scheme-dark .netless-app-slide-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-slide-page-number-input:active,.telebox-color-scheme-dark .netless-app-slide-page-number-input:focus,.telebox-color-scheme-dark .netless-app-slide-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-slide-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-slide-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-slide-preview{background:rgba(50,50,50,.9)}.netless-app-slide-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-slide-slide{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-slide-slide canvas{transform:scale(var(--netless-app-slide-scale, 1))}
|
|
6368
|
+
`;function TM({container:E,taskId:P,url:_=Ig,debug:b=!1}){if(!P)throw new Error("[Slide] taskId is required");E.style.cssText+="display:flex;flex-direction:column";const te=new Zy({target:E});return te.debug=!!b,te.mount(P,_),te}class Zy{constructor(P){this.slide=null,this.debug=!1,this.sideEffect=new Nc,this.ready=!1,this.readyPromise=new Promise(_=>{this.resolveReady=()=>{this.ready=!0,_()}}),this.hotkeyListener=_=>{if(this.slide)switch(_.key){case"ArrowUp":case"ArrowLeft":{this.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slide.nextStep();break}}},this.onPageChanged=_=>{this.viewer.setPageIndex(_-1)},this.onTransitionStart=()=>{this.viewer.setPlaying()},this.onTransitionEnd=()=>{this.viewer.setPaused()},this.onError=({error:_})=>{this.viewer.setPaused(),console.warn("[Slide] render error",_)},this.destroyed=!1,this.refreshPages=()=>{this.slide&&(this.viewer.pages=fy(this.slide),this.viewer.setPageIndex(this.getPageIndex(this.slide.slideState.currentSlideIndex)))},this.onPlay=()=>{this.slide&&this.slide.nextStep()},this.onNewPageIndex=_=>{this.slide&&this.slide.slideCount>0&&this.slide.renderSlide(sy(_+1,1,this.slide.slideCount))},this.namespace="netless-app-slide",this.target=P.target,this.bgColor=py(this.target),this.viewer=new Yy({readonly:!1,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.registerHotKeys(window)}registerHotKeys(P){this.sideEffect.addEventListener(P,"keydown",this.hotkeyListener,void 0,"hotkey")}mount(P,_){this.target.appendChild(this.renderStyle()),this.target.appendChild(this.viewer.$content),this.target.appendChild(this.viewer.$footer),this.slide=new di.Slide({anchor:this.$slide,interactive:!1,mode:"local",resize:!0,controller:this.debug,enableGlobalClick:!0,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,transactionBgColor:this.bgColor}}),this.registerEventListeners(),this.slide.setResource(P,_),this.slide.renderSlide(1)}renderStyle(){const P=document.createElement("style");return P.appendChild(document.createTextNode(Jy)),P}registerEventListeners(){if(!this.slide)return;const{slide:P}=this;P.on(di.SLIDE_EVENTS.slideChange,this.onPageChanged),P.on(di.SLIDE_EVENTS.renderStart,this.onTransitionStart),P.on(di.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),P.on(di.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),P.on(di.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),P.on(di.SLIDE_EVENTS.renderError,this.onError),P.on(di.SLIDE_EVENTS.renderEnd,this.resolveReady),this.readyPromise.then(this.refreshPages)}destroy(){this.sideEffect.flushAll(),this.slide&&!this.destroyed&&(Mi("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0),this.viewer.destroy()}getPageIndex(P){return(P>0?P:1)-1}renderSlideContainer(){if(!this.$slide){const P=document.createElement("div");P.className=this.wrapClassName("slide"),P.dataset.appKind="Slide",this.$slide=P}return this.$slide}wrapClassName(P){return`${this.namespace}-${P}`}}const Xg="0.1.5",EM={kind:"Slide",setup(E){if(console.log("[Slide] setup @ "+Xg),E.getIsWritable()&&E.storage.ensureState(Og),!E.storage.state.taskId)throw new Error("[Slide] no taskId");const P=E.getView();if(!P)throw new Error("[Slide] no view, please set scenePath on addApp()");P.disableCameraTransform=!0;const _=E.getBox();_.mountStyles(Jy);try{_.$content.dataset.appSlideVersion=Xg}catch{}const b=E.getInitScenePath();let te=null;const fe=j=>{const F=E.getRoom();if(te&&te.slideController){let K=!1;F&&E.getIsWritable()&&(my(F,E,te.slideController.slide,b),K=!0),Mi("[Slide] page to",j,K),te.viewer.setPageIndex(j-1)}},$=j=>{var K,xe;const F=new dE(eE(ry({context:E},j),{onPageChanged:fe}));return Wg&&qp.set(E.appId,F),((K=ls.apps)[xe=E.appId]||(K[xe]={})).controller=F,F.readyPromise.then(j.onReady).then(()=>{const Re=E.getRoom();let Ie=!1;Re&&E.getIsWritable()&&(my(Re,E,F.slide,b),Ie=!0),Mi("[Slide] page to",F.slide.slideState.currentSlideIndex,Ie)}),F};te=new wM({box:_,view:P,mountSlideController:$,mountWhiteboard:E.mountView.bind(E)});const L=E.getRoom(),q=new Nc;return q.add(()=>{var j,F,K;return((j=ls.apps)[F=E.appId]||(j[F]={})).context=E,ls.enable=((K=E.getAppOptions())==null?void 0:K.debug)||!1,ls.level="debug",()=>ls.dispose(E.appId)}),L&&(te.toggleClickThrough(L.state.memberState.currentApplianceName),q.add(()=>{const j=F=>{F.memberState&&te&&te.toggleClickThrough(F.memberState.currentApplianceName)};return L.callbacks.on("onRoomStateChanged",j),()=>L.callbacks.off("onRoomStateChanged",j)})),E.emitter.on("destroy",()=>{Mi("[Slide]: destroy"),Wg&&qp.delete(E.appId),q.flushAll(),te&&(te.destroy(),te=null)}),te.mount(),{slide:()=>{var j;return(j=te==null?void 0:te.slideController)==null?void 0:j.slide},nextStep:()=>{var j;return te&&te.slideController?((j=te==null?void 0:te.slideController)==null||j.slide.nextStep(),!0):!1},prevStep:()=>{var j;return te&&te.slideController?((j=te==null?void 0:te.slideController)==null||j.slide.prevStep(),!0):!1},position:()=>{const j=te==null?void 0:te.slideController;if(j)return[j.page,j.pageCount]},nextPage:()=>{const j=te==null?void 0:te.slideController;if(j){const{page:F,pageCount:K}=j;if(K>0&&F<K)return j.jumpToPage(F+1),!0}return!1},prevPage:()=>{const j=te==null?void 0:te.slideController;if(j){const{page:F,pageCount:K}=j;if(K>0&&F>1)return j.jumpToPage(F-1),!0}return!1}}}};return Fi.DefaultUrl=Ig,Fi.FreezerLength=$y,Fi.SlidePreviewer=Zy,Fi.addHooks=SM,Fi.apps=qp,Fi.default=EM,Fi.previewSlide=TM,Fi.version=Xg,Object.defineProperties(Fi,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),Fi}({});
|
|
6369
6369
|
//# sourceMappingURL=main.iife.js.map
|