@netless/slide 0.5.16-alpha.0 → 0.5.16-y.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/Slide.js +1 -1
  2. package/package.json +2 -2
package/lib/Slide.js CHANGED
@@ -247,4 +247,4 @@ var BE=function(t,e){return(BE=Object.setPrototypeOf||{__proto__:[]}instanceof A
247
247
  *
248
248
  * pixi.js is licensed under the MIT License.
249
249
  * http://www.opensource.org/licenses/mit-license
250
- */vb.registerPlugin("accessibility",ny),vb.registerPlugin("extract",Fb),vb.registerPlugin("interaction",py),vb.registerPlugin("particle",$T),vb.registerPlugin("prepare",iS),vb.registerPlugin("batch",Ab),vb.registerPlugin("tilingSprite",cS),Kb.registerPlugin(NS),Kb.registerPlugin(cT),Kb.registerPlugin(PT),Kb.registerPlugin(WT),Kb.registerPlugin(oS),Lb.registerPlugin(oy),Lb.registerPlugin(Qb);var VE,WE={AlphaFilter:FS,BlurFilter:aE,BlurFilterPass:sE,ColorMatrixFilter:uE,DisplacementFilter:cE,FXAAFilter:pE,NoiseFilter:NE};class XE extends a.a{constructor(){super(),this.prevTime=-1,this.times=0,this.valueTotal=0,this.destroyed=!1,this.value=0,this.calcFps()}calcFps(){requestAnimationFrame(t=>{const e=t-this.prevTime;this.valueTotal+=e,this.times+=1,this.times>20&&(this.value=Math.floor(1e3*this.times/this.valueTotal),this.valueTotal=0,this.times=0,this.destroyed||this.emit("update",this.value)),this.prevTime=t,this.destroyed||this.calcFps()})}destroy(){this.destroyed=!0}}!function(t){t.ResourceError="RESOURCE_ERROR",t.RuntimeError="RUNTIME_ERROR",t.RuntimeWarn="RUNTIME_WARN",t.CanvasCrash="CANVAS_CRASH"}(VE||(VE={}));class qE extends Error{constructor(t,e){var n,i;super(e),n=this,i=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(n,i):n.__proto__&&(n.__proto__=i),this.errorType=t,this.errorMsg=e}static transform(t){return t instanceof qE?t:new qE(VE.RuntimeError,t.message)}}function YE(){return function(t,e,n){const i=n.value;n.value=function(...t){try{return i.apply(this,t)}catch(t){throw new qE(VE.RuntimeWarn,t.message)}}}}var ZE=n(6),JE=n.n(ZE);function $E(t,e,n=5){return Math.abs(t-e)<=Math.pow(10,-n)}function KE(t){return Math.floor(1e6*t)/1e6}class QE{constructor(){this.point={x:0,y:0},this.slope=Math.PI/4}static fromPointSlope(t,e){const n=new QE;return n.point=t,n.slope=e,n}resolveY(t){return Math.tan(this.slope)*(t-this.point.x)+this.point.y}distanceToLinearEquation(t){return $E(this.slope,t.slope)?this.distanceToPoint(t.point):-1}distanceToPoint(t){let e=0;if(Math.tan(this.slope)*(t.x-this.point.x)+this.point.y===t.y)return 0;e=this.slope>=Math.PI/2?this.slope-Math.PI/2:Math.PI/2+this.slope;const n=QE.fromPointSlope(t,e),i=this.crossPoint(n);return i?Math.ceil(Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2))):0}crossPoint(t){if($E(t.slope,this.slope))return null;let e=0,n=0;const i=Math.tan(t.slope),r=Math.tan(this.slope),{x:o,y:s}=this.point,{x:a,y:l}=t.point;return $E(this.slope,Math.PI/2)?(e=this.point.x,n=i*(e-a)+l):$E(t.slope,Math.PI/2)?(e=t.point.x,n=r*(e-o)+s):$E(this.slope,Math.PI)||$E(this.slope,0)?(n=this.point.y,e=(n-l)/i+a):$E(t.slope,Math.PI)||$E(t.slope,0)?(n=t.point.y,e=(n-s)/r+o):(e=(i*a-l+s-r*o)/(i-r),n=r*(e-o)+s),{x:e,y:n}}}var tM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function eM(){return Date.now().toString(32)+Math.random().toString(32).substring(2)}const nM="__delay_resolve_result__";function iM(t,e){return tM(this,void 0,void 0,(function*(){const n=yield Promise.race([t(),(i=e,new Promise(t=>{setTimeout(()=>{t(nM)},i)}))]);var i;return n===nM?nM:n}))}var rM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function oM(t,e){return rM(this,void 0,void 0,(function*(){const n=yield iM(()=>fetch(t),e);if(n===nM)throw new qE(VE.ResourceError,`"${t}" loaded timeout"`);if(!n.ok)throw new qE(VE.ResourceError,`"${t}" loaded failed with status "${n.status}"`);return n}))}class sM{constructor(t,e,n,i,r){this.timeout=15e3,this.useCache=!1,this.taskId="",this.delegate=null,this.useCache=e,this.localStorage=t,this.logger=n,this.timeout=i,this.delegate=r||null}attachTaskId(t){this.taskId=t}fetchJson(t){return rM(this,void 0,void 0,(function*(){let e;if(this.useCache&&(this.logger.info("load resource from cache. "+t,this.taskId||""),e=yield this.localStorage.getItem(t)),e)return this.logger.info("cache hit. "+t,this.taskId||""),e;{let e;if(this.delegate){this.logger.info("load resource by delegate. "+t,this.taskId||"");const n=yield iM(()=>this.delegate.loadJson(t),this.timeout);if(n===nM)throw new qE(VE.ResourceError,`"${t}" loaded timeout"`);e=JSON.parse(n)}else this.logger.info("load resource from server. "+t,this.taskId||""),e=yield(yield oM(""+t,this.timeout)).json();return this.logger.info("load end. "+t,this.taskId||""),this.useCache&&this.localStorage.setItem(t,e).catch(()=>{}),e}}))}fetchPng(t){return rM(this,void 0,void 0,(function*(){let e;if(this.useCache&&(this.logger.info("load resource from cache. "+t,this.taskId||""),e=yield this.localStorage.getItem(t)),e)return this.logger.info("cache hit. "+t,this.taskId||""),e;{let n;if(this.delegate){if(this.logger.info("load resource by delegate. "+t,this.taskId||""),n=yield iM(()=>this.delegate.loadImage(t),this.timeout),n===nM)throw new qE(VE.ResourceError,`"${t}" loaded timeout"`)}else{this.logger.info("load resource from server. "+t,this.taskId||"");const e=yield oM(t,this.timeout);n=yield e.blob()}return e=yield function(t){return new Promise((e,n)=>{const i=new FileReader;i.onload=()=>{e(i.result)},i.onerror=()=>{n(new qE(VE.ResourceError,"Failed parse blob data."))},i.readAsDataURL(t)})}(n),this.logger.info("load end. "+t,this.taskId||""),this.useCache&&this.localStorage.setItem(t,e).catch(()=>{}),e}}))}destroy(){}}var aM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class lM{constructor(t){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=t=>{const e=t/(mv.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=e,this.callbackList=this.callbackList.filter(t=>t&&!t.applied);let{length:t}=this.callbackList;for(let e=0;e<t;e++){const n=this.callbackList[e];if(n&&!n.applied){if(!(n.triggerTime<=this.timestamp))break;n.running=!0,n.fn(),n.applied=!0,t=this.callbackList.length}}}},this.ticker=t,this.ticker.add(this.onTimeUpdate)}setTimeout(t,e){const n=eM(),i=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:t,triggerTime:i,id:n,applied:!1,running:!1}),this.callbackList.sort((t,e)=>t.triggerTime-e.triggerTime),n}clearTimeout(t){const e=this.callbackList.findIndex(e=>e.id===t);e>=0&&!this.callbackList[e].running&&this.callbackList.splice(e,1)}delay(t){return new Promise(e=>{this.setTimeout(e,t)})}waitUntil(t,e){return aM(this,void 0,void 0,(function*(){const n=this.timestamp;for(;!t()&&this.timestamp-n<e;)yield this.delay(50)}))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var uM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function hM(t,e,n){return n?Math.floor(parseFloat(t)*e):Math.ceil(parseFloat(t)*e)}const cM={w:!0,h:!0,x:!1,y:!1};class dM{constructor(t){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.loader=t}getTexture(t){return this.textures[t]||null}getFrameData(t){return this.frames[t]}getGifFrames(t){return this.gifs[t]?this.gifs[t].filter(t=>!!t):[]}loadSpriteSheetItem(t,e,n,i){return uM(this,void 0,void 0,(function*(){const r=yield this.loader.fetchJson(`${t}/${e}/jsonOutput/${n}.json`),o=yield this.loader.fetchPng(`${t}/${e}/jsonOutput/${n}.png`),s=document.createElement("img");s.src=o,yield new Promise((t,e)=>{s.onload=()=>t(""),s.onerror=()=>e()});let a=i;const l=s.width||1,u=s.height||1;if(l>2048||u>2048){a*=2048/l;const t=a*u;t>2048&&(a*=u/t)}!function(t,e){t.meta&&t.meta.size&&["w","h"].forEach(n=>{t.meta.size[n]=hM(t.meta.size[n],e,cM[n])}),t.frames&&Object.keys(t.frames).forEach(n=>{t.frames[n].frame&&["x","y","w","h"].forEach(i=>{t.frames[n].frame[i]=hM(t.frames[n].frame[i],e,cM[i])}),t.frames[n].spriteSourceSize&&["x","y","w","h"].forEach(i=>{t.frames[n].spriteSourceSize[i]=hM(t.frames[n].spriteSourceSize[i],e,cM[i])}),t.frames[n].sourceSize&&["w","h"].forEach(i=>{t.frames[n].sourceSize[i]=hM(t.frames[n].sourceSize[i],e,cM[i])})})}(r,a);const h=document.createElement("canvas"),c=Math.ceil(s.width*a),d=Math.ceil(s.height*a);h.width=c,h.height=d;h.getContext("2d").drawImage(s,0,0,c,d);const p=new wy(h,{resolution:1}),f=new rS(p,r);yield new Promise(t=>{f.parse(()=>t(""))}),this.spriteSheets.push(f),Object.keys(f.textures).forEach(t=>{const e=t.match(/^(.+)_gif_(\d+)$/);if(e&&e[1]&&e[2]){const n=e[1];this.gifs[n]||(this.gifs[n]=[]);const i=parseInt(e[2],10);this.gifs[n][i]=f.textures[t]}else this.frames[t]=r.frames[t],this.textures[t]=f.textures[t]})}))}destroy(){this.spriteSheets.forEach(t=>t.destroy(!0)),this.spriteSheets=[],this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null)}}var pM=n(2),fM=n.n(pM);function mM(t,e,n){let i,r;const o=Math.round(t)%360;if(o%180==0)i=Math.cos(o*(Math.PI/180))*e,r=0;else if(o%90==0)i=0,r=Math.sin(o*(Math.PI/180))*n;else{const t=function(t){const e=t*Math.PI/180;return Math.tan(e)}(o);i=e*n/Math.sqrt(Math.pow(n,2)+Math.pow(e*t,2)),(o>90&&o<270||o<-90&&o>-270)&&(i=-i),r=t*i}return{x:i,y:r}}function gM(t,e,n,i,r,o){const s=t,a=e;let l,u,h,c,d;if(0===Math.round(i))l=r,u=o,d=0;else if(Math.round(i)>=360)l=r,u=o,h=r+2*t*Math.abs(Math.cos(-n/180*Math.PI)),c=o+2*e*Math.sin(-n/180*Math.PI),d=1;else{const t=-n,e=-(n+i),{x:h,y:c}=mM(t,s,a),p=r-h,f=o+c,{x:m,y:g}=mM(e,s,a);l=m+p,u=f-g,d=i>=-360&&i<-180?1:i>=-180&&i<0||i>0&&i<180?0:1}return{radiusX:s,radiusY:a,xAxisRotation:0,largeArcFlag:d,sweepFlag:i>0?1:0,endX:l,endY:u,middleX:h,middleY:c}}class vM{constructor(){this.pool=[]}getObject(t){const e=this.pool.find(t=>!t.isUsed);if(e)return e.isUsed=!0,e.obj;{const e={obj:this.createObject(),isUsed:!0,group:t};return this.pool.push(e),e.obj}}collectObject(t){const e=this.pool.find(e=>e.obj===t);e&&(e.isUsed=!1,this.resetObject(e.obj))}collectObjectByGroup(t){this.pool.filter(e=>e.group===t).forEach(t=>this.collectObject(t.obj))}}const _M=new class extends vM{createObject(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("version","1.1"),t}resetObject(t){t.removeAttribute("viewBox"),t.removeAttribute("width"),t.removeAttribute("height"),t.innerHTML=""}};const yM=new class extends vM{createObject(){return document.createElement("img")}resetObject(t){t.removeAttribute("src")}};var xM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class bM{constructor(){this.imgElements=[],this.svgElements=[],this.idToHashMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.hashToIdMap=Object.create(null)}render(t,e,n){return xM(this,void 0,void 0,(function*(){const{items:e,width:i,height:r}=t,o=yM.getObject(n),s=new wy(o,{width:i,height:r,resolution:1}),a=_M.getObject(n);this.imgElements.push(o),this.svgElements.push(a),a.setAttribute("viewBox",`0 0 ${i} ${r}`),a.setAttribute("width",""+i),a.setAttribute("height",""+r);const u={},h={};e.forEach(t=>{const{item:e,x:n,y:i}=t,r=n+2,o=i+2;e.pathsData.forEach(t=>{let e="";t.cmds.forEach(([n,i])=>{e+=n+" ",e+=i.map(e=>(Object(l.isNumber)(e)||(e.x=e.x+t.offset.x+r,e.y=e.y+t.offset.y+o),e)).reduce((t,e)=>(Object(l.isNumber)(e)?t+=e+" ":t+=`${e.x} ${e.y} `,t),""),e+=" "}),t.pathElement.setAttribute("d",e),a.appendChild(t.pathElement)});const c=e.width-4-2*e.padding,d=e.height-4-2*e.padding;this.textures[e.hash]={texture:new ky(s,new d_(r+2,o+2,c,d)),pivot:e.pivot},u[e.hash]={x:r+2,y:o+2,w:c,h:d,pivot:e.pivot},h[e.hash]=this.hashToIdMap[e.hash]});const c=(d='<?xml version="1.0" encoding="utf-8"?>'+a.outerHTML,"data:image/svg+xml,"+encodeURIComponent(d).replace(/'/g,"%27").replace(/"/g,"%22"));var d;o.src=c,yield new Promise((t,e)=>{o.onload=()=>t(""),o.onerror=()=>e()})}))}getGraphicsData(t){const e=this.idToHashMap[t]||"";return this.textures[e]||null}addGraphics(t,e,n,i,r,o,s,a,l,u,h){var c,d;if(!s&&!l)return t;const p=fM()(n+(null!==(d=null===(c=null==s?void 0:s.width)||void 0===c?void 0:c.toString())&&void 0!==d?d:0)+l+u+h);if(this.hashToIdMap[p]||(this.hashToIdMap[p]=[]),this.hashToIdMap[p].push(t),this.idToHashMap[t]=p,this.graphics.findIndex(t=>t.hash===p)<0){const{graphicsWidth:t,graphicsHeight:n,pathsData:a,pivot:c,padding:d}=function(t,e,n,i,r,o,s,a,l){var u;const h=[],c={x:Math.abs(r.x),y:Math.abs(r.y)};let d=0,p=0,f=0,m=0,g=0,v="none";const _=null!==(u=null==i?void 0:i.width)&&void 0!==u?u:0;return s?(d=e,p=n,g=0):(v=l||"#ff0000",g=_,f=.5*_,m=.5*_,d=e+_,p=n+_,c.x+=.5*_,c.y+=.5*_),d+=Math.abs(r.x),p+=Math.abs(r.y),f+=Math.abs(r.x),m+=Math.abs(r.y),d+=4,p+=4,f+=2,m+=2,d=Math.ceil(d),p=Math.ceil(p),t.forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","path");"none"!==t.fill&&s?e.setAttribute("fill",a||"#ff0000"):e.setAttribute("fill","none"),t.hasStroke&&!s&&(e.setAttribute("stroke-linecap",(null==i?void 0:i.cap)||"butt"),e.setAttribute("stroke-linejoin",(null==i?void 0:i.join)||"miter"),e.setAttribute("stroke-width",g.toString()),e.setAttribute("stroke",v),(null==i?void 0:i.dash)&&e.setAttribute("stroke-dasharray",i.dash));const{scale:n}=t,r=t.path.trim().split(" ");let o={x:0,y:0};const l={offset:{x:f,y:m},cmds:[],pathElement:e};for(let t=0;t<r.length;t+=2){const e=r[t],i=r[t+1];if("M"===e){let[t,e]=i.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*n.x,e=e/9525*n.y,l.cmds.push(["M",[{x:t,y:e}]])}else if("A"===e){const[t,e,r,s]=i.split(",").map(t=>Number(t)),a=r/Math.PI*180,u=s/Math.PI*180,h=gM(t,e,a,u,o.x,o.y);Math.round(u)>=360?(o={x:h.endX,y:h.endY},l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.middleX/9525*n.x,y:h.middleY/9525*n.y}]]),l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.endX/9525*n.x,y:h.endY/9525*n.y}]])):(o={x:h.endX,y:h.endY},l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.endX/9525*n.x,y:h.endY/9525*n.y}]]))}else if("L"===e){let[t,e]=i.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*n.x,e=e/9525*n.y,l.cmds.push(["L",[{x:t,y:e}]])}else if("QB"===e){let[t,e,r,s]=i.split(",").map(t=>Number(t));o={x:r,y:s},t=t/9525*n.x,e=e/9525*n.y,r=r/9525*n.x,s=s/9525*n.y,l.cmds.push(["Q",[{x:t,y:e},{x:r,y:s}]])}else if("CB"===e){let[t,e,r,s,a,u]=i.split(",").map(t=>Number(t));o={x:a,y:u},t=t/9525*n.x,e=e/9525*n.y,r=r/9525*n.x,s=s/9525*n.y,a=a/9525*n.x,u=u/9525*n.y,l.cmds.push(["C",[{x:t,y:e},{x:r,y:s},{x:a,y:u}]])}else"C"===e&&l.cmds.push(["Z",[]])}h.push(l)}),{graphicsWidth:d,graphicsHeight:p,pivot:c,padding:2,pathsData:h}}(e,r,o,s,i,0,l,u,h);this.graphics.push({hash:p,pathsData:a,pivot:c,width:t,height:n,padding:d})}return t}pack(){this.graphics.forEach(t=>{t.width+=4,t.height+=4});return function t(e){const n=[],i=e.filter(t=>{const e=t.width<2048&&t.height<2048;return e||n.push(t),e}).sort((t,e)=>t.width*t.height-e.width*e.height);let r=i.length+1,o=2050,s=2050;const a=[];let l=null;for(;(o>2048||s>2048)&&i.length>0;)r-=1,l=JE()(i.slice(0,r)),o=l.width,s=l.height;return l&&a.push(l),n.forEach(t=>{const e=JE()([t]);a.push(e)}),r<i.length?a.concat(t(i.slice(r))):a}(this.graphics)}destroy(){Object.keys(this.textures).forEach(t=>{var e;null===(e=this.textures[t])||void 0===e||e.texture.destroy(!0)}),this.textures=Object.create(null),this.imgElements.forEach(t=>yM.collectObject(t)),this.svgElements.forEach(t=>_M.collectObject(t)),this.graphics=[]}}class TM{constructor(){this.runningTimeNodes={}}addRunningTimeNode(t,e,n){const i=`${e}_${t}`;if(this.runningTimeNodes[i])try{this.runningTimeNodes[i].dispose(!0)}catch(t){}this.runningTimeNodes[i]=n}removeRunningTimeNode(t,e){const n=`${e}_${t}`;delete this.runningTimeNodes[n]}}class wM{constructor(t){this.eventHub=t,this.targets=Object.create(null)}getTargets(){return Object.keys(this.targets).map(t=>this.targets[t])}addTarget(t,e){this.targets[t]=e}getTargetById(t){return this.targets[t]}getTarget(t,e,n={type:"el",index:0,id:""}){var i,r;let o=this.targets[t.id];return"shape"!==t.type?o:("shape"===t.type&&t.txEl&&(o=null!==(i=null==o?void 0:o.getTextElement(t.txEl.type,t.txEl.range))&&void 0!==i?i:null),"shape"===t.type&&t.bg&&0===n.index&&(e=!1,o=null!==(r=null==o?void 0:o.getBgElement())&&void 0!==r?r:null,this.eventHub.emit("IterateTimeNodeEnd",n.id)),e&&o?o.getIterateEntry(n.type,n.index,n.id):(o||this.eventHub.emit("IterateTimeNodeEnd",n.id),o))}clearTargets(){this.targets=Object.create(null)}}class SM{constructor(t){this.target=t}get color(){return this.target.strokeColorFilter.currentColor}set color(t){this.target.strokeColorFilter.color=t}get on(){return this.target.strokeActive?"true":"false"}set on(t){this.target.strokeActive="true"===t}}class EM{constructor(t){this.target=t}applyCommand(t,e){this.target.applyCommand(t,e)}}class MM{constructor(t){this.target=t}get color(){return this.target.fillColorFilter.currentColor}set color(t){this.target.fillActive&&(this.target.fillColorFilter.color=t)}get on(){return this.target.fillActive?"true":"false"}set on(t){this.target.fillActive="true"===t}get designColor(){return this.target.fillColorFilter.designColor}}class AM{constructor(t,e){this.hardHidden=!1,this.target=t,!0===e&&(this.hardHidden=!0)}get opacity(){return this.target.alpha}set opacity(t){this.target.alpha=t}get rotation(){return this.target.rotation/Math.PI*180}set rotation(t){this.target.rotation=t/180*Math.PI}get visibility(){return this.target.visible?"visible":"hidden"}set visibility(t){this.visibility===t||this.hardHidden||(this.target.visible="visible"===t)}}class RM{constructor(t,e){this.actions=[],this.ctx=e,this.object=t,this.object.interactive=!0}reset(t){this.object.interactive=!1,this.object.removeAllListeners(),this.object=t,this.object.interactive=!0}addAction(t,e){this.actions.push([t,e]),"click"===e?(this.object.addListener("click",()=>this.handleAction(t)),this.object.cursor="pointer"):"hover"===e&&this.object.addListener("mouseover",()=>this.handleAction(t))}addProxy(t){this.proxy=t,this.hitArea=this.getOriginHitArea(),this.proxy.interactive=!0,this.actions.forEach(([t,e])=>{var n,i;"click"===e?null===(n=this.proxy)||void 0===n||n.addListener("click",e=>this.handleProxyAction(e,t)):"hover"===e&&(null===(i=this.proxy)||void 0===i||i.addListener("mouseover",e=>this.handleProxyAction(e,t)))})}handleProxyAction(t,e){var n;const i=t.data.global,r=this.object.getGlobalPosition(),o=i.x-r.x+this.object.pivot.x,s=i.y-r.y+this.object.pivot.y;(null===(n=this.hitArea)||void 0===n?void 0:n.contains(o,s))&&this.object.visible&&this.handleAction(e,!0)}getOriginHitArea(){return this.object.hitArea?this.object.hitArea:new g_(0,0,this.object.width,this.object.height)}handleAction(t,e=!1){this.proxy&&!e||(this.ctx.eventHub.emit($R.hyperlinkTrigger,t),this.execAction(t))}execAction(t){var e;if(this.ctx.eventHub.emit($R.userInput),"ppaction://hlinksldjump"===t.action){const n=(null!==(e=null==t?void 0:t.target)&&void 0!==e?e:"").match(/slide(\d+)\.xml/);n&&n[1]&&this.ctx.eventHub.emit($R.requestGotoSlide,Number(n[1]))}else if("ppaction://hlinkshowjump?jump=nextslide"===t.action)this.ctx.eventHub.emit($R.requestNextSlide);else if("ppaction://hlinkshowjump?jump=previousslide"===t.action)this.ctx.eventHub.emit($R.requestPrevSlide);else if("ppaction://hlinkshowjump?jump=firstslide"===t.action)this.ctx.eventHub.emit($R.requestGotoSlide,1);else if("ppaction://hlinkshowjump?jump=lastslide"===t.action)this.ctx.eventHub.emit($R.requestGotoSlide,-1);else if("ppaction://hlinkshowjump?jump=lastslideviewed"===t.action){const t=this.ctx.lastViewedIndex;this.ctx.eventHub.emit($R.requestGotoSlide,t)}else"ppaction://hlinkshowjump?jump=endshow"===t.action&&this.ctx.eventHub.emit($R.requestGotoSlide,-1)}}class PM{constructor(t,e,n){var i,r,o,s,a,l;this.scaleExt={x:1,y:1},this.scaleOrigin={x:1,y:1},this.designScale={x:1,y:1},this.bound=new d_(0,0,1,1),this.pptX=0,this.pptY=0,this.presetSubType=0,this.designWidth=0,this.designHeight=0,this.designX=0,this.designY=0,this.hasPreset=!1,this.container=new ty,this.ctx=e,this.style=new AM(this.container,t.hardHidden),this.designGlobalPosition={x:n.x+(null!==(r=null===(i=t.position)||void 0===i?void 0:i.x)&&void 0!==r?r:0),y:n.y+(null!==(s=null===(o=t.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0)},this.container.interactive=!0,(t.hlinkClick||t.hlinkHover)&&(this.hyperlink=new RM(this.container,this.ctx),t.hlinkHover&&(null===(a=this.hyperlink)||void 0===a||a.addAction(t.hlinkHover,"hover")),t.hlinkClick&&(null===(l=this.hyperlink)||void 0===l||l.addAction(t.hlinkClick,"click"))),this.ctx.clock.waitUntil(()=>{try{return!!this.container.width}catch(t){return!1}},3e3).then(()=>{try{this.designWidth=this.designWidth||this.container.width}catch(t){}}),this.ctx.clock.waitUntil(()=>{try{return!!this.container.height}catch(t){return!1}},3e3).then(()=>{try{this.designHeight=this.designHeight||this.container.height}catch(t){}})}updateScale(){this.container&&(this.container.scale.x=this.designScale.x*this.scaleExt.x*this.scaleOrigin.x,this.container.scale.y=this.designScale.y*this.scaleExt.y*this.scaleOrigin.y)}updateTransform(t){var e,n,i,r,o,s,a,l;this.designWidth=t.width,this.designHeight=t.height,this.designX=null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,this.designY=null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0;const u=this.designWidth/2,h=this.designHeight/2;this.container.width=this.designWidth,this.container.height=this.designHeight,this.container.pivot.x=u,this.container.pivot.y=h;const c=null!==(s=null===(o=t.position)||void 0===o?void 0:o.x)&&void 0!==s?s:0,d=null!==(l=null===(a=t.position)||void 0===a?void 0:a.y)&&void 0!==l?l:0;this.container.x=c+u,this.container.y=d+h,t.scale&&(this.designScale={x:t.scale.x,y:t.scale.y},this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y),t.rotation&&(this.container.rotation=t.rotation);const p=new Aw;p.drawRect(0,0,this.designWidth,this.designHeight),this.container.addChild(p),this.json.hardHidden&&(this.container.visible=!1),this.bound.x=c,this.bound.y=d,this.bound.width=this.designWidth,this.bound.height=this.designHeight}get scale(){return this.scaleOrigin}set scale(t){this.scaleOrigin.x=t.x,this.scaleOrigin.y=t.y,this.updateScale()}get design_ppt_w(){return KE(this.designWidth/this.ctx.stageWidth)}get design_ppt_h(){return KE((this.designHeight||this.container.height)/this.ctx.stageHeight)}get design_ppt_x(){return KE(this.designX/this.ctx.stageWidth)}get design_ppt_y(){return KE(this.designY/this.ctx.stageHeight)}get ppt_w(){return this.scaleExt.x*this.scaleOrigin.x*this.designWidth/this.ctx.stageWidth}set ppt_w(t){this.designWidth&&(this.scaleExt.x=t*this.ctx.stageWidth/this.designWidth,this.updateScale())}get ppt_h(){const t=this.designHeight||this.container.height;return this.scaleExt.y*this.scaleOrigin.y*t/this.ctx.stageHeight}set ppt_h(t){this.designHeight&&(this.scaleExt.y=t*this.ctx.stageHeight/this.designHeight,this.updateScale())}get ppt_x(){return(this.container.position.x-this.container.pivot.x)/this.ctx.stageWidth}set ppt_x(t){this.pptX=t;const e=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=t*this.ctx.stageWidth+this.container.pivot.x*e}get ppt_y(){return(this.container.position.y-this.container.pivot.y)/this.ctx.stageHeight}set ppt_y(t){this.pptY=t;const e=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=t*this.ctx.stageHeight+this.container.pivot.y*e}get r(){return this.container.rotation}set r(t){this.container.rotation=t}set xshear(t){this.container.skew.x=t}get xshear(){return this.container.skew.x}set yshear(t){this.container.skew.y=t}get yshear(){return this.container.skew.y}}class CM{constructor(t){if(this._isInit=!1,this.h=0,this.s=0,this.l=0,this.a=1,t){this._isInit=!0;const e=t.match(/-?[0-9]+/g);e&&(this.h=parseInt(e[0],10),this.s=parseInt(e[1],10)/100,this.l=parseInt(e[2],10)/100)}}isInit(){return this._isInit}by(t,e){e.h=Math.max(Math.min(this.h+t.h,359),0),e.s=Math.max(Math.min(this.s+t.s,1),0),e.l=Math.max(Math.min(this.l+t.l,1),0),e.a=Math.max(Math.min(this.a+t.a,1),0)}fromHexString(t){const[e,n,i,r]=LM(t);let o=0,s=0,a=0;const l=Math.max(e,n,i),u=Math.min(e,n,i),h=l-u;a=(l+u)/2,0===h?o=0:l===e?o=(n-i)/h%6*60:l===n?o=60*((i-e)/h+2):l===i&&(o=60*((e-n)/h+4)),s=0===h?0:h/(1-Math.abs(2*a-1)),this.h=o,this.s=s,this.l=a,this.a=r}interpolationFrom(t,e,n){const i=t.h+(this.h-t.h)*e,r=t.s+(this.s-t.s)*e,o=t.l+(this.l-t.l)*e,s=t.a+(this.a-t.a)*e;n.h=Math.max(Math.min(i,359),0),n.s=Math.max(Math.min(r,1),0),n.l=Math.max(Math.min(o,1),0),n.a=Math.max(Math.min(s,1),0)}toHexString(){let t=[0,0,0,0];const{h:e,s:n,l:i}=this;if(e<360&&e>=0&&n<=1&&n>=0&&i<=1&&i>=0){let r,o,s;const a=(1-Math.abs(2*i-1))*n,l=a*(1-Math.abs(e/60%2-1)),u=i-a/2;[r,o,s]=e>=0&&e<60?[a,l,0]:e>=60&&e<120?[l,a,0]:e>=120&&e<180?[0,a,l]:e>=180&&e<240?[0,l,a]:e>=240&&e<300?[l,0,a]:[a,0,l],t=[r+u,o+u,s+u,this.a]}return NM(t)}}class IM{constructor(t){this._isInit=!1,this.r=0,this.g=0,this.b=0,this.a=0,t&&(this._isInit=!0,this.fromHexString(t))}fromHexString(t){const[e,n,i,r]=LM(t);this.r=e,this.g=n,this.b=i,this.a=r}isInit(){return this._isInit}interpolationFrom(t,e,n){n.r=t.r+(this.r-t.r)*e,n.g=t.g+(this.g-t.g)*e,n.b=t.b+(this.b-t.b)*e,n.a=t.a+(this.a-t.a)*e}by(t,e){e.r=Math.min(Math.max(this.r+t.r,0),255),e.g=Math.min(Math.max(this.g+t.g,0),255),e.b=Math.min(Math.max(this.b+t.b,0),255),e.a=Math.min(Math.max(this.a+t.a,0),1)}toHexString(){return NM([this.r,this.g,this.b,this.a])}}function OM(t){const e=t.substring(1);return[parseInt(e.substring(0,6),16),parseInt(e.substring(6,8),16)/255]}function LM(t){return 0===(t=t.replace(/^#/,"")).substring(6,8).length&&(t+="FF"),[parseInt(t.substring(0,2).padStart(8,"0"),16)/255,parseInt(t.substring(2,4).padStart(8,"0"),16)/255,parseInt(t.substring(4,6).padStart(8,"0"),16)/255,parseInt(t.substring(6,8).padStart(8,"0"),16)/255]}function NM(t){return"#"+Math.round(255*t[0]).toString(16).padStart(2,"0")+Math.round(255*t[1]).toString(16).padStart(2,"0")+Math.round(255*t[2]).toString(16).padStart(2,"0")+Math.round(255*t[3]).toString(16).padStart(2,"0")}function DM(t,e,n){const i=LM(t),r=LM(e),o=Math.round(255*(i[0]+(r[0]-i[0])*n)),s=Math.round(255*(i[1]+(r[1]-i[1])*n)),a=Math.round(255*(i[2]+(r[2]-i[2])*n)),l=Math.round(255*(i[3]+(r[3]-i[3])*n));return"#"+o.toString(16).padStart(2,"0")+s.toString(16).padStart(2,"0")+a.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")}class FM extends Gx{constructor(){super(void 0,"\nvarying vec2 vTextureCoord;\n\nuniform vec4 color;\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n\n if (texColor.a > 0.0) {\n vec4 resultColor = color;\n resultColor = resultColor * texColor.a;\n gl_FragColor = resultColor;\n } else {\n gl_FragColor = texColor;\n }\n}\n",{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF",this.designColor="#FFFFFFFF"}set color(t){this.currentColor=t;const e=LM(t);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const BM=new WE.ColorMatrixFilter;BM.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const UM=new WE.ColorMatrixFilter;UM.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const kM=new WE.ColorMatrixFilter;kM.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const GM=new WE.ColorMatrixFilter;GM.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const HM={darken:BM,darkenLess:UM,lightenLess:GM,lighten:kM};class zM extends PM{constructor(t,e,n){super({position:{x:t.x,y:t.y},width:t.width,height:t.height},e,n),this.fillColorFilter=new FM,this.fill=new MM(this),this.json=t,this.ctx=e,this.parentGlobalPos=n,this.global={x:n.x+t.x,y:n.y+t.y},this.updateTransform({position:{x:t.x,y:t.y},width:t.width,height:t.height})}get fillActive(){var t,e;return(null!==(e=null===(t=this.container.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set fillActive(t){var e,n;t?(null!==(n=null===(e=this.container.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}clearOnSlideChange(){}initOnReuse(){}isStatic(){return!0}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(t){const e=t*this.ctx.stageWidth-this.global.x,n=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*n}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(t){const e=t*this.ctx.stageHeight-this.global.y,n=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*n}get design_ppt_x(){return KE(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return KE(this.global.y/this.ctx.stageHeight)}}class jM{constructor(t,e,n,i,r,o,s,a,l,u,h){this.ctx=t,this.type=e,this.lineWidth=n,this.width=i,this.height=r,this.fillColor=o,this.isHorz=s,this.renderContainer=new ty,this.ghcTextureId=`${a}-text-p${l}-l${u}-u${h}-underLine`}createPaths(){if("ww"===this.type)return null;{let t=`M 0,0 L ${9525*this.width},0`,[e,n]=[this.width,this.lineWidth];return this.isHorz||(t="M 0,0 L 0,"+9525*this.height,[e,n]=[this.lineWidth,this.height]),{paths:[{id:eM(),path:t,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:fM()(t)}],width:e,height:n}}}getLineStyle(){const t={width:this.lineWidth};return"dotted"===this.type&&(t.dash=""+this.lineWidth),t}preRender(){const t=this.createPaths();if(t){const{paths:e,width:n,height:i}=t,r=e.reduce((t,e)=>t+e.hash,"");this.ctx.graphicsTexture.addGraphics(this.ghcTextureId,e,r,{x:0,y:0},n,i,this.getLineStyle(),this.ctx.objectPoolGroup,!1,null,this.fillColor)}}render(){if(this.ghcTextureId){const t=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);t&&(this.sprite=new Ow,this.sprite.texture=t.texture,this.sprite.pivot.x=t.pivot.x)}}destroy(){var t;null===(t=this.sprite)||void 0===t||t.destroy({texture:!0})}}const VM=134217729;function WM(t,e,n,i,r){let o,s,a,l,u=e[0],h=i[0],c=0,d=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=i[++d]);let p=0;if(c<t&&d<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=i[++d]),o=s,0!==a&&(r[p++]=a);c<t&&d<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=i[++d]),o=s,0!==a&&(r[p++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(r[p++]=a);for(;d<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=i[++d],o=s,0!==a&&(r[p++]=a);return 0===o&&0!==p||(r[p++]=o),p}function XM(t,e){let n=e[0];for(let i=1;i<t;i++)n+=e[i];return n}function qM(t){return new Float64Array(t)}const YM=qM(4),ZM=qM(8),JM=qM(12),$M=qM(16),KM=qM(4);function QM(t,e,n,i,r,o){const s=(e-o)*(n-r),a=(t-r)*(i-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const u=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*u?l:-function(t,e,n,i,r,o,s){let a,l,u,h,c,d,p,f,m,g,v,_,y,x,b,T,w,S;const E=t-r,M=n-r,A=e-o,R=i-o;x=E*R,d=VM*E,p=d-(d-E),f=E-p,d=VM*R,m=d-(d-R),g=R-m,b=f*g-(x-p*m-f*m-p*g),T=A*M,d=VM*A,p=d-(d-A),f=A-p,d=VM*M,m=d-(d-M),g=M-m,w=f*g-(T-p*m-f*m-p*g),v=b-w,c=b-v,YM[0]=b-(v+c)+(c-w),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,YM[1]=y-(v+c)+(c-T),S=_+v,c=S-_,YM[2]=_-(S-c)+(v-c),YM[3]=S;let P=XM(4,YM),C=22204460492503146e-32*s;if(P>=C||-P>=C)return P;if(c=t-E,a=t-(E+c)+(c-r),c=n-M,u=n-(M+c)+(c-r),c=e-A,l=e-(A+c)+(c-o),c=i-R,h=i-(R+c)+(c-o),0===a&&0===l&&0===u&&0===h)return P;if(C=11093356479670487e-47*s+33306690738754706e-32*Math.abs(P),P+=E*h+R*a-(A*u+M*l),P>=C||-P>=C)return P;x=a*R,d=VM*a,p=d-(d-a),f=a-p,d=VM*R,m=d-(d-R),g=R-m,b=f*g-(x-p*m-f*m-p*g),T=l*M,d=VM*l,p=d-(d-l),f=l-p,d=VM*M,m=d-(d-M),g=M-m,w=f*g-(T-p*m-f*m-p*g),v=b-w,c=b-v,KM[0]=b-(v+c)+(c-w),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,KM[1]=y-(v+c)+(c-T),S=_+v,c=S-_,KM[2]=_-(S-c)+(v-c),KM[3]=S;const I=WM(4,YM,4,KM,ZM);x=E*h,d=VM*E,p=d-(d-E),f=E-p,d=VM*h,m=d-(d-h),g=h-m,b=f*g-(x-p*m-f*m-p*g),T=A*u,d=VM*A,p=d-(d-A),f=A-p,d=VM*u,m=d-(d-u),g=u-m,w=f*g-(T-p*m-f*m-p*g),v=b-w,c=b-v,KM[0]=b-(v+c)+(c-w),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,KM[1]=y-(v+c)+(c-T),S=_+v,c=S-_,KM[2]=_-(S-c)+(v-c),KM[3]=S;const O=WM(I,ZM,4,KM,JM);x=a*h,d=VM*a,p=d-(d-a),f=a-p,d=VM*h,m=d-(d-h),g=h-m,b=f*g-(x-p*m-f*m-p*g),T=l*u,d=VM*l,p=d-(d-l),f=l-p,d=VM*u,m=d-(d-u),g=u-m,w=f*g-(T-p*m-f*m-p*g),v=b-w,c=b-v,KM[0]=b-(v+c)+(c-w),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,KM[1]=y-(v+c)+(c-T),S=_+v,c=S-_,KM[2]=_-(S-c)+(v-c),KM[3]=S;const L=WM(O,JM,4,KM,$M);return $M[L-1]}(t,e,n,i,r,o,u)}qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(8),qM(8),qM(8),qM(4),qM(8),qM(8),qM(8),qM(12);qM(192),qM(192);qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(8),qM(8),qM(8),qM(8),qM(8),qM(8),qM(8),qM(8),qM(8),qM(4),qM(4),qM(4),qM(8),qM(16),qM(16),qM(16),qM(32),qM(32),qM(48),qM(64);qM(1152),qM(1152);qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(24),qM(24),qM(24),qM(24),qM(24),qM(24),qM(24),qM(24),qM(24),qM(24),qM(1152),qM(1152),qM(1152),qM(1152),qM(1152),qM(2304),qM(2304),qM(3456),qM(5760),qM(8),qM(8),qM(8),qM(16),qM(24),qM(48),qM(48),qM(96),qM(192),qM(384),qM(384),qM(384),qM(768);qM(96),qM(96),qM(96),qM(1152);const tA=Math.pow(2,-52),eA=new Uint32Array(512);class nA{static from(t,e=lA,n=uA){const i=t.length,r=new Float64Array(2*i);for(let o=0;o<i;o++){const i=t[o];r[2*o]=e(i),r[2*o+1]=n(i)}return new nA(r)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:i,_hullHash:r}=this,o=t.length>>1;let s=1/0,a=1/0,l=-1/0,u=-1/0;for(let e=0;e<o;e++){const n=t[2*e],i=t[2*e+1];n<s&&(s=n),i<a&&(a=i),n>l&&(l=n),i>u&&(u=i),this._ids[e]=e}const h=(s+l)/2,c=(a+u)/2;let d,p,f,m=1/0;for(let e=0;e<o;e++){const n=iA(h,c,t[2*e],t[2*e+1]);n<m&&(d=e,m=n)}const g=t[2*d],v=t[2*d+1];m=1/0;for(let e=0;e<o;e++){if(e===d)continue;const n=iA(g,v,t[2*e],t[2*e+1]);n<m&&n>0&&(p=e,m=n)}let _=t[2*p],y=t[2*p+1],x=1/0;for(let e=0;e<o;e++){if(e===d||e===p)continue;const n=oA(g,v,_,y,t[2*e],t[2*e+1]);n<x&&(f=e,x=n)}let b=t[2*f],T=t[2*f+1];if(x===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];sA(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,i=-1/0;t<o;t++){const r=this._ids[t];this._dists[r]>i&&(e[n++]=r,i=this._dists[r])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(QM(g,v,_,y,b,T)<0){const t=p,e=_,n=y;p=f,_=b,y=T,f=t,b=e,T=n}const w=function(t,e,n,i,r,o){const s=n-t,a=i-e,l=r-t,u=o-e,h=s*s+a*a,c=l*l+u*u,d=.5/(s*u-a*l);return{x:t+(u*h-a*c)*d,y:e+(s*c-l*h)*d}}(g,v,_,y,b,T);this._cx=w.x,this._cy=w.y;for(let e=0;e<o;e++)this._dists[e]=iA(t[2*e],t[2*e+1],w.x,w.y);sA(this._ids,this._dists,0,o-1),this._hullStart=d;let S=3;n[d]=e[f]=p,n[p]=e[d]=f,n[f]=e[p]=d,i[d]=0,i[p]=1,i[f]=2,r.fill(-1),r[this._hashKey(g,v)]=d,r[this._hashKey(_,y)]=p,r[this._hashKey(b,T)]=f,this.trianglesLen=0,this._addTriangle(d,p,f,-1,-1,-1);for(let o,s,a=0;a<this._ids.length;a++){const l=this._ids[a],u=t[2*l],h=t[2*l+1];if(a>0&&Math.abs(u-o)<=tA&&Math.abs(h-s)<=tA)continue;if(o=u,s=h,l===d||l===p||l===f)continue;let c=0;for(let t=0,e=this._hashKey(u,h);t<this._hashSize&&(c=r[(e+t)%this._hashSize],-1===c||c===n[c]);t++);c=e[c];let m,g=c;for(;m=n[g],QM(u,h,t[2*g],t[2*g+1],t[2*m],t[2*m+1])>=0;)if(g=m,g===c){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,l,n[g],-1,-1,i[g]);i[l]=this._legalize(v+2),i[g]=v,S++;let _=n[g];for(;m=n[_],QM(u,h,t[2*_],t[2*_+1],t[2*m],t[2*m+1])<0;)v=this._addTriangle(_,l,m,i[l],-1,i[_]),i[l]=this._legalize(v+2),n[_]=_,S--,_=m;if(g===c)for(;m=e[g],QM(u,h,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(m,l,g,-1,i[g],i[m]),this._legalize(v+2),i[m]=v,n[g]=g,S--,g=m;this._hullStart=e[l]=g,n[g]=e[_]=l,n[l]=_,r[this._hashKey(u,h)]=l,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(S);for(let t=0,e=this._hullStart;t<S;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const s=n[t],a=t-t%3;if(o=a+(t+2)%3,-1===s){if(0===r)break;t=eA[--r];continue}const l=s-s%3,u=a+(t+1)%3,h=l+(s+2)%3,c=e[o],d=e[t],p=e[u],f=e[h];if(rA(i[2*c],i[2*c+1],i[2*d],i[2*d+1],i[2*p],i[2*p+1],i[2*f],i[2*f+1])){e[t]=f,e[s]=c;const i=n[h];if(-1===i){let e=this._hullStart;do{if(this._hullTri[e]===h){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,i),this._link(s,n[o]),this._link(o,h);const a=l+(s+1)%3;r<eA.length&&(eA[r++]=a)}else{if(0===r)break;t=eA[--r]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,i,r,o){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=e,this._triangles[s+2]=n,this._link(s,i),this._link(s+1,r),this._link(s+2,o),this.trianglesLen+=3,s}}function iA(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}function rA(t,e,n,i,r,o,s,a){const l=t-s,u=e-a,h=n-s,c=i-a,d=r-s,p=o-a,f=h*h+c*c,m=d*d+p*p;return l*(c*m-f*p)-u*(h*m-f*d)+(l*l+u*u)*(h*p-c*d)<0}function oA(t,e,n,i,r,o){const s=n-t,a=i-e,l=r-t,u=o-e,h=s*s+a*a,c=l*l+u*u,d=.5/(s*u-a*l),p=(u*h-a*c)*d,f=(s*c-l*h)*d;return p*p+f*f}function sA(t,e,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=t[r],o=e[i];let s=r-1;for(;s>=n&&e[t[s]]>o;)t[s+1]=t[s--];t[s+1]=i}else{let r=n+1,o=i;aA(t,n+i>>1,r),e[t[n]]>e[t[i]]&&aA(t,n,i),e[t[r]]>e[t[i]]&&aA(t,r,i),e[t[n]]>e[t[r]]&&aA(t,n,r);const s=t[r],a=e[s];for(;;){do{r++}while(e[t[r]]<a);do{o--}while(e[t[o]]>a);if(o<r)break;aA(t,r,o)}t[n+1]=t[o],t[o]=s,i-r+1>=o-n?(sA(t,e,r,i),sA(t,e,n,o-1)):(sA(t,e,n,o-1),sA(t,e,r,i))}}function aA(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function lA(t){return t[0]}function uA(t){return t[1]}function hA(t,e,n){let i=null;const r=new ty;if(t.stopList.sort((t,e)=>t.pos-e.pos),!t.stopList.find(t=>0===t.pos)){const e=t.stopList[0];t.stopList.unshift({pos:0,color:e.color})}if(!t.stopList.find(t=>1===t.pos)){const e=t.stopList[t.stopList.length-1];t.stopList.push({pos:1,color:e.color})}const o=t=>{const e=[];for(let n=0,i=t.length;n<i-1;n++){const i=t[n],r=t[n+1],o=i.pos+.5*(r.pos-i.pos),s=DM(i.color,r.color,.5),a=2*n;e[a]=i,e[a+1]={color:s,pos:o},e[a+2]=r}return e};if(t.stopList=o(t.stopList),t.stopList=o(t.stopList),i=t.line?cA(t,e,n):t.path?function(t,e,n){var i,r,o;const s=[],a={x:0,y:0};if("circle"===(null===(i=t.path)||void 0===i?void 0:i.path)||"rect"===(null===(r=t.path)||void 0===r?void 0:r.path)||"shape"===(null===(o=t.path)||void 0===o?void 0:o.path)){const i=e/2,r=n/2,o=Math.sqrt(i*i+r*r);t.stopList.forEach(t=>{if(0===t.pos)s.push({point:{x:0,y:0},color:t.color});else{const e=o*t.pos,n=new xc;n.absellipse(0,0,e,e,0,2*Math.PI,!1,0),n.getPoints(50).forEach(e=>{s.push({point:{x:e.x,y:e.y},color:t.color})})}a.x=i,a.y=r})}return{points:s,position:a}}(t,e,n):cA(t,e,n),i){const t=[],o=[],{position:s,points:a}=i,l=nA.from(a,t=>t.point.x,t=>t.point.y);for(let e=0;e<l.triangles.length;e+=3)t.push(a[l.triangles[e]].point.x,a[l.triangles[e]].point.y),t.push(a[l.triangles[e+1]].point.x,a[l.triangles[e+1]].point.y),t.push(a[l.triangles[e+2]].point.x,a[l.triangles[e+2]].point.y),o.push(...LM(a[l.triangles[e]].color)),o.push(...LM(a[l.triangles[e+1]].color)),o.push(...LM(a[l.triangles[e+2]].color));const u=new Jy;u.addAttribute("aVertexPosition",t,2),u.addAttribute("aColor",o,4);const h=Ux.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec4 aColor;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec4 vColor;\n void main() {\n vColor = aColor;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","precision mediump float; \n varying vec4 vColor;\n void main() {\n float alpha = vColor.a;\n vec4 color = vColor;\n color.a = 1.0;\n gl_FragColor = color * alpha;\n }\n "),c=new Aw;c.drawRect(0,0,e+1,n+1),r.mask=c,r.addChild(c);const d=new vS(u,h);d.position.x=s.x,d.position.y=s.y,r.addChild(d)}return r}function cA(t,e,n){const i=e/2,r=n/2,o=[{x:-i,y:r},{x:-i,y:-r},{x:i,y:r},{x:i,y:-r}],s=[QE.fromPointSlope({x:-i,y:0},Math.PI/2),QE.fromPointSlope({x:0,y:r},0),QE.fromPointSlope({x:i,y:0},Math.PI/2),QE.fromPointSlope({x:0,y:-r},0)],a=[],l=t.stopList.slice(1,t.stopList.length-1).map(o=>{var l,u,h;const c=2*Math.PI;let d=null!==(u=null===(l=t.line)||void 0===l?void 0:l.ang)&&void 0!==u?u:0;for(;d>c;)d-=c;for(;d<0;)d+=c;const p={x:0,y:0};$E(d,Math.PI/2)?(p.x=0,p.y=n/2-o.pos*n):$E(d,0)?(p.x=o.pos*e-e/2,p.y=0):(p.x=o.pos*e-e/2,p.y=n/2-o.pos*n),d>Math.PI/2&&d<=Math.PI&&(p.x*=-1),d>Math.PI&&d<=2*Math.PI&&(p.y*=-1);const f=QE.fromPointSlope(p,Math.PI/2-((null===(h=t.line)||void 0===h?void 0:h.ang)||0)),m=s.map(t=>f.crossPoint(t)).filter(t=>t&&t.x<=i&&t.x>=-i&&t.y<=r&&t.y>=-r).map(t=>({point:t,color:o.color})).sort((t,e)=>e.point.y-t.point.y);a.push(...m);let g=Math.abs(m[1].point.x-m[0].point.x)/10;for(let t=20;t--;){const e=t%2==0?1:-1,n=p.x+e*g,s=f.resolveY(n);n<=i&&n>=-i&&s<=r&&s>=-r&&a.push({point:{x:n,y:s},color:o.color}),g+=g}return f});let u=[],h=[];t:for(let e=0;e<o.length;e++){const n=o[e];for(let e=0;e<l.length-1;e++){const i=l[e],r=l[e+1],o=i.distanceToLinearEquation(r),s=i.distanceToPoint(n),u=r.distanceToPoint(n);if(s<o&&u<o){const i=t.stopList.slice(1,t.stopList.length-1)[e],r=t.stopList.slice(1,t.stopList.length-1)[e+1],l=DM(i.color,r.color,s/o);a.splice(e+1,0,{point:n,color:l});continue t}}const i=l[0],r=l[l.length-1],s=i.distanceToPoint(n),c=r.distanceToPoint(n);s<=c?u.push({point:n,dis:s}):h.push({point:n,dis:c})}u=u.sort((t,e)=>e.dis-t.dis);const c=u.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[0].color};{const n=t.stopList[0].color,i=t.stopList[1].color;return{point:e.point,color:DM(n,i,1-(0===u[0].dis?1:e.dis/u[0].dis))}}}).sort((t,e)=>e.point.y-t.point.y);h=h.sort((t,e)=>e.dis-t.dis);const d=h.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[t.stopList.length-1].color};{const n=t.stopList[t.stopList.length-2].color,i=t.stopList[t.stopList.length-1].color;return{point:e.point,color:DM(n,i,0===h[0].dis?0:e.dis/h[0].dis)}}}).sort((t,e)=>e.point.y-t.point.y),p=c.concat(...a).concat(d);for(let t=0;t<p.length;t++)p[t].point.x+=i,p[t].point.y=-p[t].point.y+r;return{points:p,position:{x:0,y:0}}}const dA="\nvec3 rgb2hsl(vec3 rgb) {\n float cMax = max(max(rgb.r, rgb.g), rgb.b);\n float cMin = min(min(rgb.r, rgb.g), rgb.b);\n float delta = cMax - cMin;\n \n float h = 0.0;\n if (delta == 0.0) {\n h = 0.0;\n } else if (cMax == rgb.r) {\n h = 60.0 * mod(((rgb.g - rgb.b) / delta), 6.0);\n } else if (cMax == rgb.g ) {\n h = 60.0 * ((rgb.b - rgb.r) / delta + 2.0);\n } else if (cMax == rgb.b) {\n h = 60.0 * ((rgb.r - rgb.g) / delta + 4.0);\n }\n \n float l = (cMax + cMin) / 2.0;\n \n float s = 0.0;\n if (delta == 0.0) {\n s = 0.0;\n } else {\n s = delta / (1.0 - abs(2.0 * l - 1.0));\n }\n \n return vec3(h, s, l);\n}\n",pA=[dA],fA={biLevel:"\nvec4 transform(vec4 texColor, float arg) {\n vec3 hsl = rgb2hsl(texColor.rgb);\n mat3 rgb2yuv = mat3(\n 0.2126, 0.7152, 0.0722,\n -0.09991, -0.33609, 0.43600,\n 0.615, -0.5586, -0.05639\n );\n vec3 yuv = texColor.rgb * rgb2yuv;\n if (yuv.x >= 0.49 || texColor.a < 0.9) {\n return vec4(1.0, 1.0, 1.0, 1.0) * texColor.a;\n } else {\n return vec4(0.0, 0.0, 0.0, 1.0) * texColor.a;\n }\n}\n",alphaModFix:"\nvec4 transform(vec4 texColor, float arg) {\n return texColor * arg;\n}\n"};class mA extends Gx{constructor(t,e){var n;super(void 0,(n=fA[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg;\nuniform sampler2D uSampler;\n\n${pA.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg);\n}\n`),{arg:e})}}const gA=[dA],vA={clrChange:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float epsilon = 0.001;\n vec3 colorDiff = arg1.rgb - (texColor.rgb / max(texColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n if (colorDistance < epsilon) {\n arg2.rgb *= arg2.a;\n return arg2;\n } else {\n return texColor;\n }\n}\n",changeBulletColor:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n if (texColor.a == 0.0) {\n return texColor;\n } else {\n return arg2;\n }\n}\n"};class _A extends Gx{constructor(t,e,n){var i;super(void 0,(i=vA[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform vec4 arg2;\nuniform sampler2D uSampler;\n\n${gA.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:Float32Array.from(e),arg2:Float32Array.from(n)})}}const yA=[dA],xA={lum:"\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n if (arg1 > 0.0) {\n texColor.r += (1.0 - texColor.r) * arg1;\n texColor.g += (1.0 - texColor.g) * arg1;\n texColor.b += (1.0 - texColor.b) * arg1;\n } else if (arg1 < 0.0) {\n texColor.r -= texColor.r * arg1;\n texColor.g -= texColor.g * arg1;\n texColor.b -= texColor.b * arg1;\n }\n // todo 对比度\n texColor.rgb *= texColor.a;\n return texColor;\n}\n"};class bA extends Gx{constructor(t,e,n){var i;super(void 0,(i=xA[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg1;\nuniform float arg2;\nuniform sampler2D uSampler;\n\n${yA.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:e,arg2:n})}}class TA{constructor(t,e,n,i,r){this.ctx=t,this.fillStyle=e,this.width=n,this.height=i,this.config=r,this.clonedObjects=[],this._displayObject=null,this.gradientHash=fM()(`${JSON.stringify(e)}${Math.ceil(n)}${Math.ceil(i)}`)}get displayObject(){return this._displayObject||(this._displayObject=this.createDisplayObject()),this._displayObject}set displayObject(t){this._displayObject&&this._displayObject.destroy({children:!0,texture:!0}),this._displayObject=t}get hasFill(){return!!this.fillStyle&&"noFill"!==this.fillStyle.fillType}createDisplayObject(){var t;if(!this.fillStyle)return null;if(this.config.useSlideBackgroundFill&&this.ctx.bgTexture){const t=new Ow;return t.texture=this.ctx.bgTexture,t}if("solidFill"===this.fillStyle.fillType||"noFill"===this.fillStyle.fillType)return null;if("gradientFill"===this.fillStyle.fillType){const t=new Ow;let e=TA.gradientPool.get(this.gradientHash);if(!e){const t=hA(this.fillStyle,this.width,this.height),n=Hy.create({width:this.width,height:this.height,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(t,{renderTexture:n}),e=n,TA.gradientPool.set(this.gradientHash,e),t.destroy({children:!0,texture:!0})}return t.texture=e,t}if("blipFill"===this.fillStyle.fillType){const{src:e,filters:n}=this.fillStyle,i=this.ctx.spriteTexture.getTexture(e),r=this.ctx.spriteTexture.getFrameData(e);if(i){const e=new Ow;if(e.texture=i,n.length>0&&this.config.useFilter&&(e.filters=function(t){const e=[];return t.forEach(t=>{if("biLevel"===t.type)e.push(new mA("biLevel",t.args[0]));else if("clrChange"===t.type||"changeBulletColor"===t.type){const n=LM(t.args[0]),i=LM(t.args[1]);e.push(new _A(t.type,n,i))}else"alphaModFix"===t.type?e.push(new mA(t.type,t.args[0])):"lum"===t.type&&e.push(new bA(t.type,t.args[0],t.args[1]))}),e}(n)),this.config.fillFloat){const{l:n,t:i,r:r,b:o}=this.config.fillFloat.fillRect,s=this.width*(1-n-r),a=this.height*(1-i-o),l=null!==(t=this.config.shapeRotation)&&void 0!==t?t:0,u=new Aw;u.drawRect(0,0,s,a),u.pivot.x=s/2,u.pivot.y=a/2,u.rotation=l;const h=u.getBounds(),c=h.width,d=h.height;e.width=c,e.height=d,e.anchor.x=.5,e.anchor.y=.5,e.rotation=-1*l,e.name="math-texture",0===l?(e.position.x=c/2+n*this.width,e.position.y=d/2+i*this.width):(e.position.x=this.width/2,e.position.y=this.height/2)}else e.width=this.width,e.height=this.height,r.rotate&&(e.position.x=this.width/2,e.position.y=this.height/2,e.anchor.x=.5,e.anchor.y=.5,e.rotation=r.rotate/180*Math.PI);return e}}else if("gifFill"===this.fillStyle.fillType){const{src:t,delays:e}=this.fillStyle,n=this.ctx.spriteTexture.getGifFrames(t).map((t,n)=>({texture:t,time:e[n]||20})),i=new jE(n,!0);i.width=this.width,i.height=this.height;const r=this.fillStyle.loop;let o=1;return i.onLoop=()=>{o+=1,r>0&&o>r&&i.gotoAndStop(i.totalFrames)},i}return null}isSolidFill(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)}getSolidFillColor(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)?this.fillStyle.color:"#000000"}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}TA.gradientPool=new Map;var wA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class SA extends zM{constructor(t,e,n){var i;super(t,e,n),this.textureContainer=new ty,this.underline=null,this.cacheSprite=new Ow;const{shapeId:r,paragraphIndex:o,lineIndex:s,unitIndex:a,lineHeight:l,width:u,underLine:h,fill:c,height:d,isHorz:p,lineWidth:f}=t,m="solidFill"===(null===(i=null==c?void 0:c.fill)||void 0===i?void 0:i.fillType)?c.fill.color:null;if(h){const t=p?l/16:f/16;this.underline=new jM(e,h.type,t,u,d,m,p,r,o,s,a)}this.textGraphics=this.createTextGraphics(),this.textFill=this.createTextFill(),this.strokeGraphics=this.createStrokeGraphics(),this.strokeFill=this.createStrokeFill()}createStrokeFill(){const{stroke:t,lineWidth:e,lineHeight:n}=this.json;return new TA(this.ctx,null==t?void 0:t.fill,e,n,{useFilter:!1,useSlideBackgroundFill:!1})}createStrokeGraphics(){const{stroke:t}=this.json,e=(null==t?void 0:t.key)?{fillType:"blipFill",src:t.key,filters:[]}:void 0;return new TA(this.ctx,e,(null==t?void 0:t.width)||0,(null==t?void 0:t.height)||0,{useFilter:!1,useSlideBackgroundFill:!1})}createTextFill(){const{isHorz:t,fill:e,lineWidth:n,lineHeight:i,fillLineHeight:r}=this.json;return t?new TA(this.ctx,null==e?void 0:e.fill,n,Math.max(r,i),{useFilter:!1,useSlideBackgroundFill:!1}):new TA(this.ctx,null==e?void 0:e.fill,r,i,{useFilter:!1,useSlideBackgroundFill:!1})}createTextGraphics(){var t;const{fill:e,content:n}=this.json;let i="#000000";"solidFill"===(null===(t=null==e?void 0:e.fill)||void 0===t?void 0:t.fillType)&&(i=e.fill.color);const r=(null==e?void 0:e.key)?{fillType:"blipFill",src:e.key,filters:[{type:"changeBulletColor",args:["#000000",i]}]}:void 0;return new TA(this.ctx,r,(null==e?void 0:e.width)||0,(null==e?void 0:e.height)||0,{useFilter:"◾"===n,useSlideBackgroundFill:!1})}getIterateEntry(){return null}getBgElement(){return null}updateTransform(t){var e,n,i,r;const{isHorz:o}=this.json;t.position={x:o&&null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,y:o?0:null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0},t.width=o?this.json.width:this.json.lineWidth,t.height=o?this.json.lineHeight:this.json.height,super.updateTransform(t)}preRender(){var t;null===(t=this.underline)||void 0===t||t.preRender()}render(t){t.addSubMTask(()=>wA(this,void 0,void 0,(function*(){this.doRender()})),"@TextUnitImpl[doRender]")}doRender(){let t=!1;const{lineWidth:e,lineHeight:n,baseLine:i,isHorz:r,underline:o,height:s,width:a,highlightColor:l,x:u,y:h,content:c,fillLineHeight:d,fill:p}=this.json;let f=!1!==this.json.needFill;if(p&&p.fill&&"solidFill"!==p.fill.fillType&&(f=!0),l){const t=new Aw,[i,o]=OM(l);t.beginFill(i,o),t.drawRect(0,0,r?a:e,r?n:s),t.endFill(),this.textureContainer.addChild(t)}if(this.textGraphics.displayObject){const e=this.textGraphics.displayObject;if(r&&(e.position.y=h>0?h:0),f){const n=this.textFill.displayObject;if(n)n.mask=e,n.addChild(e),n.position.x=-u,e.position.x+=u,t=!0,this.textureContainer.addChild(n);else if(this.textFill.isSolidFill()){const n=new FM;n.color=this.textFill.getSolidFillColor(),e.filters=[n],t=!0,this.textureContainer.addChild(e)}}else this.textureContainer.addChild(e)}if(this.strokeGraphics.displayObject){const e=this.strokeGraphics.displayObject;if(f){const n=this.strokeFill.displayObject;if(n)n.mask=e,n.addChild(e),r?n.position.y=h>0?h:0:n.position.x=u,this.textureContainer.addChild(n);else if(this.strokeFill.isSolidFill()){r?e.position.y=h>0?h:0:e.position.x=u;const n=new FM;n.color=this.strokeFill.getSolidFillColor(),e.filters=[n],t=!0,this.textureContainer.addChild(e)}}else r?e.position.y=h>0?h:0:e.position.x=u,this.textureContainer.addChild(e)}if(this.underline&&(this.underline.render(),this.underline.sprite)){r?(this.underline.sprite.position.y=o?o-n/16:i,this.underline.sprite.position.x=0):(this.underline.sprite.position.x=0,this.underline.sprite.position.y=0);const t=this.textFill.getClonedDisplayObject();t?(t.mask=this.underline.sprite,t.addChild(this.underline.sprite),this.textureContainer.addChild(t)):this.textureContainer.addChild(this.underline.sprite)}if(t){const t=Hy.create({width:r?a:e,height:r?Math.max(d,n):s,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(this.textureContainer,{renderTexture:t}),this.cacheSprite.texture=t,r&&h<0&&(this.cacheSprite.position.y=h),this.container.addChild(this.cacheSprite)}else this.container.addChild(this.textureContainer);this.container.name=c}destroy(){this.textFill.destroy(),this.textGraphics.destroy(),this.strokeFill.destroy(),this.strokeGraphics.destroy(),this.cacheSprite.texture.destroy(!0),this.cacheSprite.destroy(),this.textureContainer.destroy(),this.container.destroy()}}var EA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class MA extends zM{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(t,e,n){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){}createUnits(t,e,n,i){for(let r=0,o=this.json.textUnits.length;r<o;r++)i.addSubMTask(()=>EA(this,void 0,void 0,(function*(){const i=this.json.textUnits[r],{height:o,width:s,fillHeight:a,baseline:l,y:u,underline:h}=this.json,c=new SA(Object.assign(Object.assign({},i),{lineHeight:o,lineWidth:s,baseLine:l-u,underline:h,fillLineHeight:a||o,isHorz:this.isHorz,shapeId:t,paragraphIndex:e,lineIndex:n,unitIndex:r}),this.ctx,this.global);c.preRender(),this.units.push(c)})),"@TextLineImpl[createUnits]")}render(t){for(const e of this.units.reverse())e.render(t),t.addSubMTask(()=>EA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextLineImpl[container.addChild]")}destroy(){this.units.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var AA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class RA extends zM{constructor(){super(...arguments),this.iterateElements=[],this.lines=[],this.isHorz=!0}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const t=this.lines.reduce((t,e)=>t=t.concat(e.getIterateElements()),[]);return this.iterateElements=t,t}getIterateEntry(t,e,n){const i=this.getIterateElements();return i[e]?i[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){}createLines(t,e,n){for(let i=0,r=this.json.lines.length;i<r;i++)n.addSubMTask(()=>AA(this,void 0,void 0,(function*(){const r=this.json.lines[i],o=new MA(r,this.ctx,this.global);o.isHorz=this.isHorz,o.container.name="line-"+i,o.createUnits(t,e,i,n),this.lines.push(o)})),"@TextParagraphImpl[createLines]")}render(t){for(const e of this.lines)e.render(t),t.addSubMTask(()=>AA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextParagraphImpl[container.addChild]")}destroy(){this.lines.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var PA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class CA{constructor(t,e,n,i){this.iterateElements=[],this.paragraphs=[],this.container=new ty,this.json=t,this.ctx=e,this.parentGlobalPos=i,this.iterateType=n,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+t.position.x,y:this.parentGlobalPos.y+t.position.y},this.container.position.x=t.position.x,this.container.position.y=t.position.y,this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y;const r=new Aw;r.drawRect(0,0,t.width,t.height),this.container.addChild(r)}get width(){return this.json.width}get height(){return this.json.height}get x(){return this.json.position.x}get y(){return this.json.position.y}getTextElement(t,e){return"paragraph"===t?this.paragraphs[e[0]]:null}getIterateEntry(t,e){return this.iterateElements[t]?this.iterateElements[t]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(t=>{t.destroy()})}createParagraphs(t,e){for(let n=0,i=this.json.paragraphs.length;n<i;n++)e.addSubMTask(()=>PA(this,void 0,void 0,(function*(){var i;const r=this.json.paragraphs[n],o=new RA(r,this.ctx,this.global);o.isHorz=null===(i=this.json.isHorz)||void 0===i||i,o.createLines(t,n,e),e.addSubMTask(()=>PA(this,void 0,void 0,(function*(){this.iterateElements=this.iterateElements.concat(o.getIterateElements()),o.container.name="段落-"+n,this.paragraphs.push(o)})),"@TextBodyImpl[paragraphs.push]")})),"@TextBodyImpl[createParagraphs]")}render(t){for(const e of this.paragraphs)e.render(t),t.addSubMTask(()=>PA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextBodyImpl[container.addChild]");t.addSubMTask(()=>PA(this,void 0,void 0,(function*(){const{width:t}=this.container;this.container.scale.x<0&&(this.container.x+=-1*t)})),"@TextBodyImpl[reset width]")}}var IA=n(47),OA=n.n(IA),LA=n(48),NA=n.n(LA);const DA={Reflection:class extends Gx{constructor(t){super(OA.a,NA.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uStartAlpha:t.startAlpha,uEndAlpha:t.endAlpha,uBlur:0}),this.json=t}}};class FA{constructor(t){this.scaleX=1,this.scaleY=1,this.pivot={x:0,y:0},this.paths=[],this.hash="",this.width=0,this.height=0,this.graphicsId="",this.textureId="",this.id=t.id,this.type=t.type,this.heightSize=t.heightSize,this.widthSize=t.widthSize,this.fillStyle=t.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=t.lineWidth||1,this.position=t.position||{x:0,y:0},this.rotate=t.rotation||1,this.path=this.getUnitPath(),this.setScaleFromLineWidth(),this.setScaleFromSize(),this.generatePaths(),this.setPivot()}setPivot(){switch(this.type){case"oval":case"diamond":this.pivot={x:this.width/2,y:this.height/2};break;case"triangle":this.pivot={x:.7*this.width,y:this.height/2};break;case"arrow":case"stealth":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+fM()(this.path+this.scaleX+this.scaleY),this.paths=[{id:this.id,path:this.path,fill:"norm",hasStroke:!1,hash:this.hash,scale:{x:this.scaleX,y:this.scaleY}}]}getUnitPath(){switch(this.type){case"stealth":return"M 0,0 L 95250,47625 L 0,95250 L 28575,47625 C C";case"oval":return"M 0,47625 A 47625,47625,-3.14159265,6.2831853 C C";case"diamond":return"M 47625,0 L 95250,47625 L 47625,95250 L 0,47625 C C";case"arrow":return"M 9525,0 L 95250,47625 L 9525,95250 L 0,85725 L 68389.5,47625 L 0,9525 C C";case"triangle":return"M 0,0 L 95250,47625 L 0,95250 C C";default:return""}}setScaleFromLineWidth(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=.29*this.lineWidth+.7,this.scaleY*=.29*this.lineWidth+.7;break;default:throw new Error("can't match any arrow type!")}}setScaleFromSize(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=1,this.scaleY*=1;break;default:throw new Error("can't match any arrow type!")}switch(this.widthSize){case"sm":this.scaleX*=3/4;break;case"lg":this.scaleX*=1.25;break;case"med":this.scaleX*=1}switch(this.heightSize){case"sm":this.scaleY*=3/4;break;case"lg":this.scaleY*=1.25;break;case"med":this.scaleY*=1}this.width=10*this.scaleX,this.height=10*this.scaleY}}class BA{constructor(t,e,n,i,r,o,s,a,l,u,h){this.id=t,this.ctx=e,this.paths=n,this.hash=i,this.nept=r,this.width=o,this.height=s,this.lineStyle=a,this.shouldFill=l,this.bgColor=u,this.lnColor=h,this.clonedObjects=[],this._displayObject=null,this.isRectangle=!1,this.isPureRect=!1,this.isColoredPureRect=!1,this.isRectangle=this.rectangleDetect(n),this.isRectangle&&l?this.bgColor?this.isColoredPureRect=!0:this.isPureRect=!0:this.ctx.graphicsTexture.addGraphics(this.id,this.paths,this.hash,this.nept,this.width,this.height,this.lineStyle,this.ctx.objectPoolGroup,this.shouldFill,this.bgColor,this.lnColor)}get displayObject(){return this._displayObject}pointDis(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)}rectangleDetect(t){if(1!==t.length)return!1;const e=t[0].path.trim().split(" ");if(10!==e.length)return!1;const n=[],i=[];for(let t=0;t<e.length;t+=2){const r=e[t],o=e[t+1],[s,a]=o.split(",").map(t=>Number(t)/100);n.push(r),i.push({x:s,y:a})}if("MLLLC"!==n.join(""))return!1;for(let t=0;t<3;t++){const e=i[t],n=i[t+1];if(e.x!==n.x&&e.y!==n.y)return!1}const r=i.slice(0,4).reduce((t,e)=>t+e.x,0)/4,o=i.slice(0,4).reduce((t,e)=>t+e.y,0)/4;if(Number.isNaN(r)||Number.isNaN(o))return!1;const s={x:r,y:o};return $E(this.pointDis(s,i[0]),this.pointDis(s,i[1]))&&$E(this.pointDis(s,i[0]),this.pointDis(s,i[2]))&&$E(this.pointDis(s,i[0]),this.pointDis(s,i[3]))&&this.pointDis(s,i[0])===this.pointDis(s,i[1])}createDisplayObject(){if(this.isPureRect){const t=new Aw;return t.beginFill(0,1),t.drawRect(0,0,this.width,this.height),t}if(this.isColoredPureRect&&this.bgColor){const t=new Aw,[e,n]=OM(this.bgColor);return t.beginFill(e,n),t.drawRect(0,0,this.width,this.height),t}{const t=new Ow,e=this.ctx.graphicsTexture.getGraphicsData(this.id);return e?(t.texture=e.texture,t.pivot.x=e.pivot.x,t.pivot.y=e.pivot.y,t):null}}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}render(){this._displayObject=this.createDisplayObject()}isNeedMask(t,e){let n=!1;return this._displayObject&&(n=!(this.isRectangle&&Math.abs(t-this._displayObject.width)<2&&Math.abs(e-this._displayObject.height)<2&&this.shouldFill)),n}addArrows(t){var e;null===(e=this._displayObject)||void 0===e||e.addChild(t)}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}var UA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const kA={pivot:{x:0,y:0},width:0,height:0};class GA extends PM{constructor(t,e,n,i){var r;super(t,e,n),this.renderContainer=new ty,this.needCacheAsBitMap=!1,this.backgroundGraphics=null,this.filterAreaJustifies=[],this.strokeGraphics=null,this.arrowList=[],this.fillColorFilter=new FM,this.strokeColorFilter=new FM,this.id="",this.fill=new MM(this),this.stroke=new SM(this),this.updateFilterArea=()=>{const t=this.renderContainer.getBounds(!1),e=this.filterAreaJustifies.map(e=>e(t)),n=e.map(t=>t.width),i=e.map(t=>t.height),r=new d_(t.x,t.y,Math.max(...n),Math.max(...i));this.renderContainer.filterArea=r,(this.renderContainer.filters||[]).forEach(t=>{t.uniforms.uShapeFilterArea=new Float32Array(4),t.uniforms.uShapeFilterArea[0]=r.x,t.uniforms.uShapeFilterArea[1]=r.y,t.uniforms.uShapeFilterArea[2]=r.width,t.uniforms.uShapeFilterArea[3]=r.height})},this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i&&(this.json.fillStyle=i),this.id=t.id;const{fillStyle:o,lineStyle:s}=this.json;this.container.name=t.id,this.renderContainer.name=t.id+"-render-container",this.generateArrowList(),this.backgroundFill=this.createBackgroundFill(),this.backgroundGraphics=this.createBackgroundGraphics(),this.strokeFill=this.createStrokeFill(),this.strokeGraphics=this.createStrokeGraphics(),this.ctx.timingTargets.addTarget(this.id,this),"solidFill"===(null==o?void 0:o.fillType)&&(this.fillColorFilter.currentColor=o.color,this.fillColorFilter.designColor=o.color),"solidFill"===(null===(r=null==s?void 0:s.fill)||void 0===r?void 0:r.fillType)&&(this.strokeColorFilter.currentColor=s.fill.color,this.strokeColorFilter.designColor=s.fill.color),this.updateTransform(this.json),t.textBody&&(this.text=new CA(t.textBody,this.ctx,t.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new g_(1,1,this.json.width,this.json.height)}get interactiveContainer(){return this.renderContainer}get strokeActive(){var t,e,n,i,r,o,s;return this.strokeFill.displayObject?(null!==(n=null===(e=null===(t=this.strokeFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==n?n:-1)>0:(null!==(s=null===(o=null===(r=null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set strokeActive(t){var e,n,i,r,o,s;const{displayObject:a}=this.strokeFill;t?a&&(null!==(n=null===(e=a.filters)||void 0===e?void 0:e.indexOf(this.strokeColorFilter))&&void 0!==n?n:-1)<0?a.filters=[this.strokeColorFilter]:(null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)&&(null!==(o=null===(r=this.strokeGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.strokeColorFilter))&&void 0!==o?o:-1)<0&&(this.strokeGraphics.displayObject.filters=[this.strokeColorFilter]):a?a.filters=[]:(null===(s=this.strokeGraphics)||void 0===s?void 0:s.displayObject)&&(this.strokeGraphics.displayObject.filters=[])}get fillActive(){var t,e,n,i,r,o,s;return this.backgroundFill.displayObject?(null!==(n=null===(e=null===(t=this.backgroundFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==n?n:-1)>0:(null!==(s=null===(o=null===(r=null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set fillActive(t){var e,n,i,r,o,s;t?this.backgroundFill.displayObject&&(null!==(n=null===(e=this.backgroundFill.displayObject.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0?this.backgroundFill.displayObject.filters=[this.fillColorFilter]:(null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)&&(null!==(o=null===(r=this.backgroundGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.fillColorFilter))&&void 0!==o?o:-1)<0&&(this.backgroundGraphics.displayObject.filters=[this.fillColorFilter]):this.backgroundFill.displayObject?this.backgroundFill.displayObject.filters=[]:(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.displayObject)&&(this.backgroundGraphics.displayObject.filters=[])}getTextElement(t,e){var n,i;return null!==(i=null===(n=this.text)||void 0===n?void 0:n.getTextElement(t,e))&&void 0!==i?i:null}getBgElement(){return this}getIterateEntry(t,e,n){return 0===e?this:"el"===t?(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null):this.text?this.text.getIterateEntry(e-1,n)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}createStrokeGraphics(){var t,e,n,i;const{id:r,geometry:o,lineStyle:s}=this.json,{width:a,height:l,pivot:u}=(null==o?void 0:o.lineTransform)||kA,h=a||this.json.width,c=l||this.json.height,d="solidFill"===(null===(t=null==s?void 0:s.fill)||void 0===t?void 0:t.fillType)?s.fill.color:null;return s&&"noFill"!==(null===(e=s.fill)||void 0===e?void 0:e.fillType)?new BA(r+"-path-graphics",this.ctx,null!==(n=null==o?void 0:o.paths)&&void 0!==n?n:[],null!==(i=null==o?void 0:o.hash)&&void 0!==i?i:"",u||{x:0,y:0},h,c,s,!1,null,d):null}createStrokeFill(){const[t,e]=this.calculateFillObjectOffset(),{geometry:n,lineStyle:i,width:r,height:o}=this.json,s=(null==n?void 0:n.lineTransform)||kA,a=Object(l.isNumber)(null==i?void 0:i.width)?i.width:1;return new TA(this.ctx,null==i?void 0:i.fill,(s.width||r)+a+t,Math.max((s.height||o)+a,e),{useFilter:!1,useSlideBackgroundFill:!1})}createBackgroundGraphics(){var t;const{geometry:e,lineStyle:n,fillStyle:i,id:r}=this.json,{width:o,height:s,pivot:a}=(null==e?void 0:e.lineTransform)||kA,l=o||this.json.width,u=s||this.json.height,h="solidFill"===(null==i?void 0:i.fillType)?i.color:null;return i&&"noFill"!==i.fillType||this.json.isPicture?new BA(r+"-bg-graphics",this.ctx,null!==(t=null==e?void 0:e.paths)&&void 0!==t?t:[],(null==e?void 0:e.hash)||"",a||{x:0,y:0},l,u,n,!0,h,null):null}createBackgroundFill(){var t,e;const{fillStyle:n,width:i,height:r,lineStyle:o,geometry:s}=this.json,a=(null==s?void 0:s.fillTransform)||kA;return new TA(this.ctx,n,(a.width||i)+(null!==(t=null==o?void 0:o.width)&&void 0!==t?t:0),(a.height||r)+(null!==(e=null==o?void 0:o.width)&&void 0!==e?e:0),{useFilter:!1,useSlideBackgroundFill:this.json.useBgFill,fillFloat:this.json.fillFloat,shapeRotation:this.json.rotation})}createBackground(){var t,e,n,i,r,o,s,a;const{pivot:l,width:u,height:h}=(null===(t=this.json.geometry)||void 0===t?void 0:t.fillTransform)||kA,{displayObject:c}=this.backgroundFill;c?(this.json.useBgFill&&(null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)?(this.needCacheAsBitMap=!0,c.mask=this.backgroundGraphics.displayObject,c.pivot.x=(null===(i=this.json.position)||void 0===i?void 0:i.x)||0,c.pivot.y=(null===(r=this.json.position)||void 0===r?void 0:r.y)||0,this.container.addChild(this.backgroundGraphics.displayObject)):"gifFill"===(null===(o=this.json.fillStyle)||void 0===o?void 0:o.fillType)?(c.height=h||this.designHeight,c.width=u||this.designWidth,c instanceof jE&&c.play(),(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.isNeedMask(c.width,c.height))&&(c.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.container.addChild(this.backgroundGraphics.displayObject))):(null===(a=this.backgroundGraphics)||void 0===a?void 0:a.isNeedMask(c.width,c.height))&&(this.json.fillFloat||(this.needCacheAsBitMap=!0,c.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.container.addChild(this.backgroundGraphics.displayObject))),this.json.fillFloat||(c.x=l.x,c.y=l.y),this.container.addChild(c)):this.backgroundFill.hasFill&&(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.displayObject)&&this.container.addChild(this.backgroundGraphics.displayObject)}createPathFill(){var t,e,n;const{displayObject:i}=this.strokeFill,r=null===(t=this.strokeGraphics)||void 0===t?void 0:t.displayObject,[o,s]=this.calculateFillObjectOffset();i?((null===(e=this.strokeGraphics)||void 0===e?void 0:e.isNeedMask(i.width,i.height))&&r&&(this.needCacheAsBitMap=!0,i.pivot.x=r.pivot.x,i.pivot.y=r.pivot.y,r.pivot.x=0,r.pivot.y=0,i.mask=r,i.addChild(r),i.position.x=-o/2,i.position.y=-s/2,r.position.x=o/2,r.position.y=s/2),this.container.addChild(i)):this.strokeFill.hasFill&&(null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)&&this.container.addChild(this.strokeGraphics.displayObject)}createFilledPathMask(){var t,e,n;const i=(null===(e=null===(t=this.json.geometry)||void 0===t?void 0:t.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[];for(const t of i){const e=this.ctx.graphicsTexture.getGraphicsData(t.id);if(e){const i=new Ow(e.texture);i.pivot.x=e.pivot.x,i.pivot.y=e.pivot.y;const r=this.backgroundFill.getClonedDisplayObject(),o=null===(n=this.backgroundGraphics)||void 0===n?void 0:n.getClonedDisplayObject(),s=r||o;s&&(this.backgroundFill.displayObject&&(s.pivot.x=this.backgroundFill.displayObject.pivot.x,s.pivot.y=this.backgroundFill.displayObject.pivot.y),s.mask=i,s.filters=[HM[t.fill]],this.needCacheAsBitMap=!0,this.container.addChild(s),this.container.addChild(i))}}}createArrow(){this.arrowList.length&&this.arrowList.forEach(t=>{var e;const n=this.ctx.graphicsTexture.getGraphicsData(t.graphicsId);if(n){const{texture:i}=n,r=new Ow(i);r.pivot.x=t.pivot.x,r.pivot.y=t.pivot.y,r.position.x=t.position.x,r.position.y=t.position.y,r.rotation=t.rotate/180*Math.PI,null===(e=this.backgroundGraphics)||void 0===e||e.addArrows(r)}})}generateArrowList(){var t,e;const{lineArrowList:n,lineStyle:i,id:r}=this.json,o="solidFill"===(null===(t=null==i?void 0:i.fill)||void 0===t?void 0:t.fillType)?i.fill.color:null;null===(e=n||[])||void 0===e||e.forEach((t,e)=>{var n,s;const a=new FA(Object.assign(Object.assign({},t),{fillStyle:null==i?void 0:i.fill,lineWidth:null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0}));a.graphicsId=`${r}-arrow-${e}-graphics`,a.textureId=`${r}-arrow-${e}-fill`,this.ctx.graphicsTexture.addGraphics(a.graphicsId,null!==(s=a.paths)&&void 0!==s?s:[],a.hash,{x:0,y:0},a.width,a.height,void 0,this.ctx.objectPoolGroup,!0,o,null),this.arrowList.push(a)})}calculateFillObjectOffset(){let[t,e]=[0,0];return this.arrowList.length&&(t=this.arrowList.reduce((t,e)=>Math.max(t,e.width),0),e=this.arrowList.reduce((t,e)=>Math.max(t,e.height),0)),[t,e]}preRender(t){var e,n,i;const{lineStyle:r,geometry:o}=this.json,{width:s,height:a}=(null==o?void 0:o.lineTransform)||kA,l=s||this.json.width,u=a||this.json.height,h=(null===(e=null==o?void 0:o.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[],c="solidFill"===(null===(n=null==r?void 0:r.fill)||void 0===n?void 0:n.fillType)?r.fill.color:null;t.addSubMTask(()=>UA(this,void 0,void 0,(function*(){for(const t of h)this.ctx.graphicsTexture.addGraphics(t.id,[t],t.hash,((null==o?void 0:o.lineTransform)||kA).pivot,l,u,r,this.ctx.objectPoolGroup,!0,null,c)})),"@ShapeImpl[addGraphics]"),null===(i=this.text)||void 0===i||i.createParagraphs(this.json.id,t)}subClassRender(){}setupEffect(){const{effectList:t}=this.json;if(t&&t.length>0){const e=[];return t.forEach(t=>{"reflection"===t.type&&(this.filterAreaJustifies.push(t=>(t.height*=2,t)),e.push(new DA.Reflection(t)))}),this.ctx.ticker.add(this.updateFilterArea,void 0,-20),this.renderContainer.filters=e,!0}return!1}render(t){t.addSubMTask(()=>UA(this,void 0,void 0,(function*(){var t,e;null===(t=this.strokeGraphics)||void 0===t||t.render(),null===(e=this.backgroundGraphics)||void 0===e||e.render(),this.createBackground(),this.subClassRender(),this.createFilledPathMask(),this.createPathFill(),this.createArrow()})),"@ShapeImpl[render]"),this.text&&this.text.render(t),t.addSubMTask(()=>UA(this,void 0,void 0,(function*(){var t,e,n,i,r,o,s,a;if("wd"===(null===(t=this.json.textBody)||void 0===t?void 0:t.iterateType)||"lt"===(null===(e=this.json.textBody)||void 0===e?void 0:e.iterateType))this.renderContainer.addChild(this.container),this.text&&(this.text.container.scale.y=null!==(i=null===(n=this.json.scale)||void 0===n?void 0:n.y)&&void 0!==i?i:1,this.text.container.position.x+=(null!==(o=null===(r=this.json.position)||void 0===r?void 0:r.x)&&void 0!==o?o:0)+this.text.x,this.text.container.position.y+=(null!==(a=null===(s=this.json.position)||void 0===s?void 0:s.y)&&void 0!==a?a:0)+this.text.y,-1===this.text.container.scale.y&&(this.text.container.position.y+=this.text.height),this.renderContainer.addChild(this.text.container));else{if(this.text){if(Object(l.isBoolean)(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const t=this.json.rotation||0;this.text.container.rotation=-t;const{width:e}=this.text;this.text.container.position.x=e}this.container.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.needCacheAsBitMap,"background"===this.json.id&&this.ctx.hasBackgroundFillShape){const t=Hy.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:t}),this.ctx.bgTexture=t}})),"@ShapeImpl[post.render]")}clearOnSlideChange(){}initOnReuse(){}isStatic(){return!!this.json.cacheAsBitMap}destroy(){var t,e,n,i;null===(t=this.text)||void 0===t||t.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.backgroundFill.destroy(),null===(e=this.backgroundGraphics)||void 0===e||e.destroy(),this.strokeFill.destroy(),null===(n=this.strokeGraphics)||void 0===n||n.destroy(),this.renderContainer.destroy(),null===(i=this.arrowRenderTexture)||void 0===i||i.destroy(!0),this.arrowList=[]}}var HA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function zA(t,e){for(const n in e)t.style[n]=e[n]}class jA{constructor(t){var e,n;this.progress=document.createElement("div"),this.totalTime=document.createElement("span"),this.playButton=document.createElement("div"),this.pauseButton=document.createElement("div"),this.currentTime=document.createElement("span"),this.mediaController=document.createElement("div"),this.currentProgress=document.createElement("div"),this.medianIsEnd=!1,this.pickBookmarkIndex=0,this.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=t=>{if(this.ctx.isPlayerPaused())return void this.ctx.logger.info("Media controller prevent seek event with paused state",this.ctx.taskId);t.stopPropagation();const e=t.offsetX/this.progress.clientWidth*this.duration;this.medianIsEnd=!1,"interactive"!==this.ctx.mode&&this.jumpToTime(e),"local"!==this.ctx.mode&&this.ctx.eventHub.emit($R.mediaSeek,{id:this.targetId,time:e,isPlaying:this.media.isPlaying})},this.jumpToTime=(t=0)=>{const e=Math.floor(t)+this.start;this.media.currentTime!==e&&(this.media.currentTime=e,this.changeBookmarkIndex(e,e>this.media.currentTime))},this.showController=t=>{t.stopPropagation(),this.show()},this.getMediaDuration=()=>{this.duration&&!Number.isNaN(this.duration)||(this.duration=this.media.duration,this.start&&(this.duration-=this.start,this.jumpToTime()),this.end&&(this.duration-=this.end)),this.totalTime.innerText=jA.formatTime(this.duration)},this.playMedia=()=>HA(this,void 0,void 0,(function*(){this.playButton.style.display="none",this.pauseButton.style.display="block",yield this.media.play(),this.medianIsEnd&&(this.medianIsEnd=!1,this.jumpToTime()),this.playCallBackList.forEach(t=>{t()})})),this.pauseMedia=()=>HA(this,void 0,void 0,(function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()})),this.onMouseOut=t=>{t.stopPropagation(),this.mediaController.style.display="none"},this.mediaTimeUpdate=()=>HA(this,void 0,void 0,(function*(){const t=this.media.currentTime-this.start;if(this.duration>0&&(t>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=jA.formatTime(t),this.currentProgress.style.flex=(t/this.duration).toString(),!this.bookmarkList||0===this.bookmarkList.length)return;const e=this.bookmarkList[this.pickBookmarkIndex];e&&e.time.toFixed(0)===this.media.currentTime.toFixed(0)&&(this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${e.name}`),this.pickBookmarkIndex+=1)})),this.onPauseMedia=()=>{this.playButton.style.display="block",this.pauseButton.style.display="none"},this.onPlayMedia=()=>{this.playButton.style.display="none",this.pauseButton.style.display="block",this.playCallBackList.forEach(t=>{t()})},this.playMediaFromCtrl=()=>{this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent play event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.playMedia(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit($R.mediaPlay,{id:this.targetId,time:this.media.currentTime-this.start}))},this.pauseMediaFromCtrl=()=>{this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent pause event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.pauseMedia(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit($R.mediaPause,{id:this.targetId,time:this.media.currentTime-this.start}))},this.targetId=t.targetId,this.ctx=t.ctx,this.height=t.height,this.width=t.width,this.target=t.target,this.media=t.media,this.info=t.info,this.shapeId=t.shapeId,this.canvasElement=t.canvasElement,this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=null!==(e=this.info.cut.start)&&void 0!==e?e:0,this.end=null!==(n=this.info.cut.end)&&void 0!==n?n:0),this.info.bookmarkList&&(this.bookmarkList=this.info.bookmarkList.sort((t,e)=>t.time-e.time))}getMedianContainer(){var t;let e=null===(t=this.canvasElement.parentElement)||void 0===t?void 0:t.querySelector(".median-container");e||(e=document.createElement("div"),e.className="median-container",this.canvasElement.parentElement.appendChild(e)),this.container=e}static formatTime(t){let e="00:00";if(t){const n=Math.floor(t/60),i=String(n<0?0:n).padStart(2,"0"),r=Math.floor(t%60);e=`${i}:${String(r<0?0:r).padStart(2,"0")}`}return e}createButton(){const t={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};zA(this.playButton,Object.assign(Object.assign({},t),{display:"block"}));const e=document.createElement("img");zA(e,{height:"20px"}),e.src="https://convertcdn.netless.link/publicFiles/icon/play.png",this.playButton.appendChild(e),zA(this.pauseButton,Object.assign(Object.assign({},t),{display:"none"}));const n=document.createElement("img");zA(n,{height:"20px"}),n.src="https://convertcdn.netless.link/publicFiles/icon/pause.png",this.pauseButton.appendChild(n)}createTimer(){const t=document.createElement("div");zA(t,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",t.append(this.currentTime,e,this.totalTime),t}createProgress(){zA(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const t=document.createElement("div");zA(t,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(t),zA(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),t.appendChild(this.currentProgress)}changeBookmarkIndex(t,e){if(this.bookmarkList&&0!==this.bookmarkList.length){if(this.pickBookmarkIndex>0)for(let e=0;e<this.pickBookmarkIndex;e++)if(this.bookmarkList[e].time>t){this.pickBookmarkIndex=e;break}if(e){let e=this.pickBookmarkIndex-1;for(let n=0;n<this.bookmarkList.length;n++)this.bookmarkList[n].time<t&&(e=n);for(let t=this.pickBookmarkIndex;t<=e;t++){const e=this.bookmarkList[t];e&&this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${e.name}`)}this.pickBookmarkIndex=e+1}}}bindEvent(){this.mediaController.addEventListener("mouseover",this.showController,!1),this.mediaController.addEventListener("mouseout",this.onMouseOut,!1),this.progress.addEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.addEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.addEventListener("click",this.pauseMediaFromCtrl,!1),this.media.on("durationchange",this.getMediaDuration,!1),this.media.on("timeupdate",this.mediaTimeUpdate,!1),this.media.on("pause",this.onPauseMedia,!1),this.media.on("play",this.onPlayMedia,!1)}setControllerPosition(){var t;const{target:e}=this,{stageWidth:n,stageHeight:i}=this.ctx,r=e.getGlobalPosition(),o=Number(null===(t=this.container)||void 0===t?void 0:t.getAttribute("data-scale")),s=n*o,a=1/o*(300>s?s/300:1);r.y=r.y+this.height-50,r.x=Math.max(r.x,0),r.x=Math.min(r.x,n-300*a),r.y=Math.max(r.y,0),r.y=Math.min(r.y,i-50),zA(this.mediaController,{height:"50px",borderRadius:"25px",width:"300px",flexDirection:"row",alignItems:"center",position:"absolute",left:r.x+"px",top:r.y+"px",display:"none",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${a})`,transformOrigin:"0 100%"})}createMediaController(){this.setControllerPosition(),this.createButton();const t=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,t,this.progress),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(t){this.playCallBackList.push(t)}unbindEvent(){this.mediaController.removeEventListener("mouseover",this.showController,!1),this.mediaController.removeEventListener("mouseout",this.onMouseOut,!1),this.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.removeEventListener("click",this.pauseMediaFromCtrl,!1),this.media.removeAllListeners()}show(){this.setControllerPosition(),this.mediaController.style.display="flex"}hide(){this.mediaController.style.display="none"}destroy(){var t;this.unbindEvent(),this.playCallBackList=[],null===(t=this.container)||void 0===t||t.removeChild(this.mediaController)}}var VA=n(49),WA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class XA extends a.a{constructor(t,e){super(),this.isGlobalPause=!1,this.lastTime=-1,this.howl=null,this.rctClient=null,this._isResourceExist="unknow",this.url=t,this.runningAudio=e,KR.RtcAudioClazz?(this.rctClient=new KR.RtcAudioClazz(t),this.rctClient.on("load",()=>this.emit("load")),this.rctClient.on("pause",()=>this.emit("pause")),this.rctClient.on("play",()=>this.emit("play"))):(this.howl=new VA.Howl({src:[t]}),this.howl.on("load",()=>this.emit("load")),this.howl.on("pause",()=>this.emit("pause")),this.howl.on("play",()=>this.emit("play"))),this.detectResourceExist()}startTimeChangeEmit(){this.currentTime!==this.lastTime&&(this.lastTime=this.currentTime,this.emit("timeupdate")),this.isEnded||setTimeout(()=>this.startTimeChangeEmit(),300)}detectResourceExist(){return new Promise(t=>{fetch(this.url,{method:"HEAD"}).then(e=>{this._isResourceExist=e.ok?"true":"false",t(e.ok)}).catch(()=>{this._isResourceExist="false",t(!1)})})}isResourceExist(){return WA(this,void 0,void 0,(function*(){return"unknow"!==this._isResourceExist?"true"===this._isResourceExist:this.detectResourceExist()}))}play(){var t,e,n;this.runningAudio.has(this.url)&&(null===(t=this.runningAudio.get(this.url))||void 0===t||t.stop(),this.runningAudio.delete(this.url)),this.lastTime=-1,null===(e=this.howl)||void 0===e||e.play(),null===(n=this.rctClient)||void 0===n||n.play(),this.startTimeChangeEmit(),this.runningAudio.set(this.url,this)}pause(){var t,e;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.rctClient)||void 0===e||e.pause(),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}globalPause(){this.isPaused||(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}stop(){var t;null===(t=this.howl)||void 0===t||t.stop(),this.rctClient&&(this.rctClient.pause(),this.rctClient.currentTime=0),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}destroy(){var t,e,n,i,r,o,s;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.howl)||void 0===e||e.unload(),null===(n=this.rctClient)||void 0===n||n.pause(),null===(i=this.rctClient)||void 0===i||i.destroy(),null===(r=this.rctClient)||void 0===r||r.removeAllListeners("load"),null===(o=this.rctClient)||void 0===o||o.removeAllListeners("play"),null===(s=this.rctClient)||void 0===s||s.removeAllListeners("pause"),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}get currentTime(){return this.rctClient?this.rctClient.currentTime:this.howl?this.howl.seek():-1}set currentTime(t){this.rctClient?this.rctClient.currentTime=t:this.howl&&this.howl.seek(t)}get duration(){return this.rctClient?this.rctClient.duration:this.howl?this.howl.duration():0}get isEnded(){return Math.abs(this.currentTime-this.duration)<.001}get isPaused(){return this.rctClient?this.rctClient.isPaused:!!this.howl&&this.howl.playing()}}var qA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class YA extends a.a{constructor(t){var e,n;super(),this.type="video",this.sprite=new Ow,this.isPlaying=!1,this.isGlobalPause=!1,this.id=t.id,this.start=null===(e=t.video.cut)||void 0===e?void 0:e.start,this.end=null===(n=t.video.cut)||void 0===n?void 0:n.end,this.container=t.container,this.ctx=t.ctx,this.ctx.medias[this.id]=this;let i=t.video.src;this.ctx.loaderDelegate&&(i=this.ctx.loaderDelegate.redirectMedia(i),this.ctx.logger.info(`redirect media url from ${t.video.src} to ${i} by delegate.`,t.ctx.taskId)),this.videoResource=new Iy(i,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});let r=t.video.src.replace(/4$/,"3");this.ctx.loaderDelegate&&(r=this.ctx.loaderDelegate.redirectMedia(r),this.ctx.logger.info(`redirect media url from ${t.video.src.replace(/4$/,"3")} to ${r} by delegate.`,t.ctx.taskId)),this.rtcAudio=new XA(r,t.ctx.runningAudio);const{video:o,width:s,height:a,target:l}=t;this.controller=new jA({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,width:s,height:a,target:l,media:this,info:o,canvasElement:t.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=s,this.sprite.height=a,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const u=new wy(null,{height:a,width:s});u.resource=this.videoResource,this.videoResource.bind(u),this.sprite=new Ow,this.sprite.visible=!1,this.sprite.texture=new ky(u),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",t=>{t.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",t=>{t.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(t=>{this.videoResource.source.addEventListener(t,()=>{"timeupdate"!==t||this.isPlaying||this.pause(),this.emit(t)})}),this.ctx.activeMedia.add(this)}get currentTime(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.currentTime)&&void 0!==e?e:0}set currentTime(t){KR.RtcAudioClazz&&(this.rtcAudio.currentTime=t),this.videoResource.source&&(this.videoResource.source.currentTime=t)}get paused(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.paused)||void 0===e||e}get ended(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.ended)||void 0===e||e}get duration(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.duration)&&void 0!==e?e:0}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){var t;return qA(this,void 0,void 0,(function*(){this.isPlaying=!0,yield this.load(),yield this.ctx.clock.waitUntil(()=>{const t=this.videoResource.source;return!!(t&&t.videoWidth>0)},3e3);const e=this.videoResource.source;if(e&&e.videoWidth<=0)return;const n=yield this.rtcAudio.isResourceExist();KR.RtcAudioClazz&&n?(this.videoResource.source.volume=0,this.rtcAudio.once("play",()=>{var t;null===(t=this.videoResource.source)||void 0===t||t.play()}),this.rtcAudio.play()):yield null===(t=this.videoResource.source)||void 0===t?void 0:t.play()}))}load(){return this.videoResource.load()}pause(){var t;this.isPlaying=!1,KR.RtcAudioClazz?(this.rtcAudio.once("pause",()=>{var t;null===(t=this.videoResource.source)||void 0===t||t.pause()}),this.rtcAudio.pause()):null===(t=this.videoResource.source)||void 0===t||t.pause()}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){var t;this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),null===(t=this.videoResource)||void 0===t||t.destroy(),this.rtcAudio.destroy(),this.controller.destroy(),this.ctx.activeMedia.delete(this)}}var ZA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class JA extends a.a{constructor(t){super(),this.type="audio",this.isPlaying=!1,this.isGlobalPause=!1,this.id=t.id;let e=t.audio.src;t.ctx.loaderDelegate&&(e=t.ctx.loaderDelegate.redirectMedia(e),t.ctx.logger.info(`redirect media url from ${t.audio.src} to ${e} by delegate.`,t.ctx.taskId)),this.audioPlayer=new XA(e,t.ctx.runningAudio),t.audio.cut&&(this.start=t.audio.cut.start,this.end=t.audio.cut.end),this.ctx=t.ctx,this.ctx.medias[this.id]=this;const{width:n,height:i,target:r}=t;this.controller=new jA({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,height:i,width:n,target:r,media:this,info:t.audio,canvasElement:t.canvasElement}),this.audioPlayer.on("load",()=>this.emit("durationchange")),this.audioPlayer.on("timeupdate",()=>this.emit("timeupdate")),this.audioPlayer.on("pause",()=>this.emit("pause")),this.audioPlayer.on("play",()=>this.emit("play")),this.ctx.activeMedia.add(this)}get currentTime(){return this.audioPlayer.currentTime}set currentTime(t){this.audioPlayer.currentTime=t}get paused(){return this.audioPlayer.isPaused}get isPaused(){return this.audioPlayer.isPaused}get ended(){return this.audioPlayer.isEnded}get duration(){return this.audioPlayer.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return ZA(this,void 0,void 0,(function*(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent play event with paused state",this.ctx.taskId):(this.isPlaying=!0,this.audioPlayer.play())}))}pause(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent pause event with paused state",this.ctx.taskId):(this.isPlaying=!1,this.audioPlayer.pause())}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent seek event with paused state",this.ctx.taskId):this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){this.audioPlayer.pause(),this.controller.destroy(),this.ctx.activeMedia.delete(this)}}class $A extends GA{constructor(t,e,n,i){super(Object.assign(Object.assign({},t),{type:"Shape",useBgFill:!1,textRotateWithShape:!0,isPicture:!0}),e,n,i),this.isInteractiveOutside=!1,this.cmd=new EM(this),this.media=null==t?void 0:t.media,this.picFill=new TA(this.ctx,t.picFill,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1})}applyCommand(t,e){var n,i,r,o,s;if("call"===e)if(/playFrom\(([0-9.]+)\)/.test(t)){const e=t.match(/playFrom\(([0-9.]+)\)/),i=Number(e[1]||"0");null===(n=this.mediaPlayer)||void 0===n||n.play().then(()=>{var t;null===(t=this.mediaPlayer)||void 0===t||t.seek(i)})}else"custom-pause"===t?null===(i=this.mediaPlayer)||void 0===i||i.pause():"togglePause"===t?null===(r=this.mediaPlayer)||void 0===r||r.togglePause():"stop"===t&&(null===(o=this.mediaPlayer)||void 0===o||o.pause(),null===(s=this.mediaPlayer)||void 0===s||s.seek(0))}renderPic(){var t,e,n,i,r;const{displayObject:o}=this.picFill;if(o){const s=null===(t=this.backgroundGraphics)||void 0===t?void 0:t.getClonedDisplayObject();(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.isNeedMask(o.width,o.height))&&s&&(o.mask=s,this.container.addChild(s)),o.width=this.designWidth,o.height=this.designHeight,o instanceof jE&&this.ctx.slideScopeEventHub.once("slide-render",t=>{this.ctx.slideIndex===t&&o.play()}),this.container.addChild(o),"video"===(null===(n=this.media)||void 0===n?void 0:n.type)&&this.media.src?(this.mediaPlayer=new YA({id:this.json.id+"-video",shapeId:this.json.id,ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,target:o,container:this.container,canvasElement:this.ctx.view}),null===(i=this.mediaPlayer)||void 0===i||i.sprite):"audio"===(null===(r=this.media)||void 0===r?void 0:r.type)&&this.media.src&&(this.mediaPlayer=new JA({id:this.json.id+"-audio",shapeId:this.json.id,ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,target:o,canvasElement:this.ctx.view})),this.mediaPlayer&&(this.isInteractiveOutside=this.container.interactive,this.container.interactive=!0,this.container.on("mouseover",()=>{this.mediaPlayer.showController()}),this.container.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))}}preRender(t){super.preRender(t)}subClassRender(){this.renderPic()}clearOnSlideChange(){super.clearOnSlideChange(),this.mediaPlayer&&(this.container.interactive=!1,this.mediaPlayer.stop(),this.mediaPlayer.hideController())}initOnReuse(){super.initOnReuse(),this.mediaPlayer&&(this.container.interactive=!0)}isStatic(){const t=this.json;return(!t.media||"video"!==t.media.type)&&super.isStatic()}destroy(){this.mediaPlayer&&(this.picFill.displayObject&&!this.isInteractiveOutside&&(this.container.interactive=!1),this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picFill.destroy()}}var KA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class QA extends PM{constructor(t,e,n,i,r){super(t,e,n),this.children=[],this.cacheSprite=new Ow,this.cacheContainer=new ty,this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i&&(this.json.fillStyle=i),this.container.name=t.id,this.cacheContainer.name=t.id+"-cache-container",this.ctx.timingTargets.addTarget(t.id,this),this.updateTransform(this.json),this.fillObject=new TA(this.ctx,t.fillStyle,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1}),this.createChildren(r)}createChildren(t){var e,n,i,r;const o={x:null!==(n=null===(e=this.json.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,y:null!==(r=null===(i=this.json.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0};for(let e=0,n=this.json.children.length;e<n;e++)t.addSubMTask(()=>KA(this,void 0,void 0,(function*(){const n=this.json.children[e];let i=null;"Shape"===(null==n?void 0:n.type)?i=new GA(n,this.ctx,o,this.json.fillStyle):"Picture"===(null==n?void 0:n.type)?i=new $A(n,this.ctx,o,this.json.fillStyle):"Container"===(null==n?void 0:n.type)&&(i=new QA(n,this.ctx,o,this.json.fillStyle,t)),i&&this.children.push(i)})),"@ContainerImpl[child.init]")}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(t){for(const e of this.children)t.addSubMTask(()=>KA(this,void 0,void 0,(function*(){e.preRender(t)})),"@ContainerImpl[child.preRender]")}getBgElement(){return null}getIterateEntry(t,e,n){return 0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}getTextElement(){return null}render(t){let e=new ty;for(const n of this.children)n.render(t),t.addSubMTask(()=>KA(this,void 0,void 0,(function*(){var t;n.isStatic()&&!this.json.cacheAsTexture&&n.json.width<4096&&n.json.height<4096?e.addChild(n.renderContainer):(e.children.length>0&&(e.cacheAsBitmap=!0,this.cacheContainer.addChild(e),e=new ty),this.cacheContainer.addChild(n.renderContainer)),(n.json.hlinkHover||n.json.hlinkClick)&&(null===(t=n.hyperlink)||void 0===t||t.addProxy(this.container))})),"@ContainerImpl[child.render]");t.addMTask(()=>KA(this,void 0,void 0,(function*(){e.children.length>0&&(e.cacheAsBitmap=!0,this.cacheContainer.addChild(e))})),"@ContainerImpl[child.render]"),t.addSubMTask(()=>KA(this,void 0,void 0,(function*(){this.container.addChild(this.cacheContainer),this.json.cacheAsTexture&&(!function(t,e,n,i,r){const o=t.getBounds(),s=Math.min(o.x,e.x,o.x+o.width,e.x+e.width),a=Math.max(o.x,e.x,o.x+o.width,e.x+e.width),l=Math.min(o.y,e.y,o.y+o.height,e.y+e.height),u=a-s,h=Math.max(o.y,e.y,o.y+o.height,e.y+e.height)-l;let c=KE(e.x-o.x),d=KE(e.y-o.y);r||(c=Math.max(0,c),d=Math.max(0,d));const p=Hy.create({width:u,height:h,resolution:i.renderer.resolution});t.position.x=c,t.position.y=d,i.renderer.render(t,{renderTexture:p}),n.texture=p,n.position.x=-c,n.position.y=-d}(this.cacheContainer,new d_(this.designX,this.designY,this.designWidth,this.designHeight),this.cacheSprite,this.ctx,!1),this.container.addChild(this.cacheSprite),this.cacheContainer.position.x=0,this.cacheContainer.position.y=0,this.cacheContainer.visible=!1)})),"@ContainerImpl[child.append]")}clearOnSlideChange(){this.children.forEach(t=>t.clearOnSlideChange())}initOnReuse(){this.children.forEach(t=>t.initOnReuse())}isStatic(){return!!this.json.cacheAsTexture}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(t=>t.destroy()),this.container.destroy({children:!0,texture:!0,baseTexture:!0}),this.cacheContainer.destroy({children:!0,texture:!0,baseTexture:!0})}}class tR extends a.a{constructor(t,e,n,i){super(),this.cond={},this.timeoutIds=[],this.condHandle=(t,e={})=>{if(t)if(t.delay&&t.delay>0){const n=this.ctx.clock.setTimeout(()=>{t.event&&(this.cond[t.event]=!0,this.detectTrigger(e))},t.delay);this.timeoutIds.push(n)}else this.cond[t.event]=!0,this.detectTrigger(e);else this.detectTrigger(e)},this.id=t,this.ctx=i,this.eventHubs=n,e.forEach(t=>{this.addCond(t)})}setTriggerParams(t){this.triggerParams=t}addCond(t){const e=e=>{this.condHandle(t,e)};t.event&&(/^shape/.test(t.event)||/^time/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.global.addListener(t.event,e)):/^runtime/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):/^self/.test(t.event)?t.delay&&t.delay>0&&(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):this.cond[t.event]=!1)}isTrigger(){return Object.keys(this.cond).every(t=>!!this.cond[t])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(t=>"self"!==t).every(t=>!!this.cond[t])}detectTrigger(t){if(Object.keys(this.cond).every(t=>!!this.cond[t])){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1});const e=this.triggerParams;this.triggerParams=void 0,this.emit("active",e,t)}}reset(){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1}),this.timeoutIds.forEach(t=>this.ctx.clock.clearTimeout(t))}}class eR extends a.a{constructor(t){super(),this.isTimeNodeEndSync=!1,this.interactiveListeners=[],this.runtimeNodeEventHub=new a.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=(t=!1)=>{var e,n,i,r,o,s;this.hasPrev()||!this.isMainSeq?"idle"===this.currentSeqState?(this.decrSeqIndex(),null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.seekToStart(),null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"running"===this.currentSeqState?(null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.seekToStart(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"end"===this.currentSeqState&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.seekToStart(),null===(s=this.commonTimeNode.children[this.currentSeqIndex])||void 0===s||s.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide",t)},this.handleNext=(t=!1)=>{var e,n,i,r;this.isTimeNodeEndSync&&(this.isTimeNodeEndSync=!1,this.currentSeqState="idle",this.currentSeqIndex=0),this.hasNext()||!this.isMainSeq?"idle"===this.currentSeqState?null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.startTimeNodeForce():"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.startTimeNodeForce()):"end"===this.currentSeqState&&(this.incrSeqIndex(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide",t)};const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:s,eventHub:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}=t;this.isMainSeq="mainSeq"===e.ctn.nodeType,this.isInteractiveSeq="interactiveSeq"===e.ctn.nodeType,this.id=e.ctn.id,this.isIterate=i,this.json=e,this.ctx=s,this.globalEventHub=l,this.commonTimeNode=new PR({json:e.ctn,isSub:r,eventHubs:{global:l,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:n,iterateIndex:u,iterateId:h,isInInteractiveSeq:c||this.isInteractiveSeq}),this.bindShapeEvent(),this.nextConds=new tR("mainSeq",e.nextCondLst,{global:l,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new tR("mainSeq",e.preCondLst,{global:l,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit($R.mainSeqStepStart,e)}),this.commonTimeNode.on("childTimeNodeEnd",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext()}),this.isMainSeq&&this.ctx.eventHub.emit($R.mainSeqStepEnd,e)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.isTimeNodeEndSync=!0,this.commonTimeNode.resetForRepeat()}),this.commonTimeNode.on("timeNodeDestroy",()=>{this.interactiveListeners.forEach(([t,e])=>{t&&e&&t.interactiveContainer.removeListener("pointerdown",e)}),this.interactiveListeners=[]}),this.nextConds.on("active",(t,e)=>{this.handleNext(e)}),this.prevConds.on("active",(t,e)=>{this.handlePrev(e)})}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(t){this._currentSeqIndex=t,this.isMainSeq?this.ctx.eventHub.emit($R.mainSeqStepChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit($R.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:t,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(t){this._currentSeqState=t,this.isMainSeq?this.ctx.eventHub.emit($R.mainSeqStateChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit($R.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:t}})}get stepLength(){return this.commonTimeNode.children.length}get currentStep(){return this.currentSeqIndex}get currentState(){return this.currentSeqState}startAutoPlay(){this.autoPlay=!0,this.commonTimeNode.children[0].commonTimeNode.startTimeNodeForce()}incrSeqIndex(){this.currentSeqIndex+1<=this.commonTimeNode.children.length&&(this.currentSeqIndex+=1)}decrSeqIndex(){this.currentSeqIndex-1>=-1&&(this.currentSeqIndex-=1)}hasPrev(){return!(this.currentSeqIndex<=0&&"idle"===this.currentSeqState)}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&"end"===this.currentSeqState)}bindShapeEvent(){"interactiveSeq"===this.json.ctn.nodeType&&this.json.nextCondLst.forEach(t=>{if(/^shape/.test(t.event)){const e=t.event.split(" ")[1];if(e){const t=this.ctx.timingTargets.getTargetById(e);if(t){t.interactiveContainer.interactive=!0,t.interactiveContainer.cursor="pointer";const n=()=>{this.ctx.eventHub.emit($R.userInput);const t=`shape ${e} onClick`,{mode:n}=this.ctx;"interactive"!==n&&"sync"!==n||this.ctx.eventHub.emit($R.interactiveSeqAction,{action:t,seqId:this.json.ctn.id}),"sync"!==n&&"local"!==n||this.globalEventHub.emit(t)};t.interactiveContainer.on("pointerdown",n),this.interactiveListeners.push([t,n])}}}})}setCurrentStep(t,e){this.isInteractiveSeq&&0===this.commonTimeNode.applyCount&&(this.commonTimeNode.applyCount=1);let n=t;this.commonTimeNode.seekToStart();const{length:i}=this.commonTimeNode.children;if(-1===n&&(n=i-1),n>=0&&n<i)for(let t=0;t<=n;t++){const i=this.commonTimeNode.children[t];t!==n?i.commonTimeNode.seekToEnd(!1,!0):"start"===e?i.commonTimeNode.seekToStart():"end"===e&&i.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=n,this.currentSeqState="start"===e?"idle":"end"}}function nR(t,e,n){const i=e.split(".");i.reduce((r,o,s)=>{if(r)return s!==i.length-1?r[o]:void(r[o]=n);console.warn(`${t} not support ${e}`)},t)}function iR(t,e){if(!e)return null;return e.split(".").reduce((n,i)=>{if(n)return n[i];console.warn(`${t} not support ${e}`)},t)}class rR{constructor(t){this.timingTarget=null,this.runtimeNodeEventHub=new a.a,this.basicOnTimeNodeEnd=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr,e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.removeRunningTimeNode(e,this.modifyAttrKey)}},this.basicOnTimeLineStart=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr;if("next"===this.activeWhenConflict){const e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.addRunningTimeNode(e,this.modifyAttrKey,this.commonTimeNode)}else"prev"===this.activeWhenConflict&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:n,json:i,ctx:r,parent:o,eventHub:s,iterateType:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}=t;this.json=i,this.id=i.cBhvr.ctn.id,this.ctx=r,this.globalEventHub=s,this.commonTimeNode=new PR({json:i.cBhvr.ctn,isSub:n,eventHubs:{global:s,runtime:this.runtimeNodeEventHub},ctx:r,parent:o,isIterate:e,iterateType:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}),this.timingTarget=this.ctx.timingTargets.getTarget(i.cBhvr.target,e,{type:l,index:u,id:h}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.basicOnTimeLineStart),this.commonTimeNode.on("timeNodeEnd",this.basicOnTimeNodeEnd)}getTargetId(t){let e=t.id;return"shape"===t.type&&t.txEl&&(e=`${e}-txEl-${t.txEl.range[0]}`),this.commonTimeNode.isIterate&&(e=`${e}-iterate-${this.commonTimeNode.iterateIndex}`),e}}class oR extends rR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=iR(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const t=this.json.cBhvr.attrList[0];null!==this.startVal&&this.timingTarget&&nR(this.timingTarget,t,this.startVal)},this.onSeekToEnd=()=>{const t=this.json.cBhvr.attrList[0],e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&nR(this.timingTarget,t,e)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:t,delta:e})=>{if(e/t>=1){const t=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&nR(this.timingTarget,t,e)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}var sR=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};class aR{constructor(t,e){this.math={pi:Math.PI,e:Math.E,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,cosh:Math.cosh,deg:t=>t/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:t=>t/180*Math.PI,rand:Math.random,sin:Math.sin,sinh:Math.sinh,sqrt:Math.sqrt,tan:Math.tan,tanh:Math.tanh},this.timingTarget=e,this.val=t.val.value,this.time=t.time,t.fmla&&(this.fmla=this.parseFmla(t.fmla))}parseFmla(t){let e=t.replace(/#ppt_h/g,`(${this.timingTarget.design_ppt_h})`);return e=e.replace(/#ppt_w/g,`(${this.timingTarget.design_ppt_w})`),e=e.replace(/#ppt_x/g,`(${this.timingTarget.design_ppt_x})`),e=e.replace(/#ppt_y/g,`(${this.timingTarget.design_ppt_y})`),e=e.replace(/ppt_w/g,"vars.ppt_w"),e=e.replace(/ppt_h/g,"vars.ppt_h"),e=e.replace(/ppt_x/g,"vars.ppt_x"),e=e.replace(/ppt_y/g,"vars.ppt_y"),e=e.replace(/#/g,"vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(t=>{const n=new RegExp(`([^a-z])${t}([^a-z])`,"g");e=e.replace(n,(e,n,i)=>`${n}math.${t}${i}`)}),new Function("vars","math","$","return "+e)}}class lR extends aR{constructor(t,e,n){super(t,e),this.value=t.val.value,n&&(this.fmla=this.parseFmla(n))}resolveValue(){return this.value}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue()-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}sR([YE()],lR.prototype,"interpolationFrom",null);class uR extends aR{constructor(t,e){var n;super(t,e),this.value=null===(n=t.val)||void 0===n?void 0:n.value}interpolationFrom(t,e,n){let i=t.resolveValue(n);return e>this.time&&(i=this.resolveValue()),i}resolveValue(){return this.value||""}}sR([YE()],uR.prototype,"interpolationFrom",null);class hR extends aR{constructor(t,e){super(t,e),this.fn=this.parseFmla(this.val)}resolveValue(t){return this.fn(t,this.math,1)}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue(n)-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}sR([YE()],hR.prototype,"interpolationFrom",null);class cR extends aR{constructor(t,e){super(t,e),this.value=t.val.value}interpolationFrom(t,e){return DM(t.resolveValue(),this.value,e)}resolveValue(){return this.value}}sR([YE()],cR.prototype,"interpolationFrom",null);class dR extends rR{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.vars={ppt_x:0,ppt_y:0,ppt_w:0,ppt_h:0},this.keyFrames=[],this.isColorAnim=!1,this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal=iR(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var t,e,n,i;(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),(null===(n=this.timingTarget)||void 0===n?void 0:n.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),(null===(i=this.timingTarget)||void 0===i?void 0:i.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t,i=this.keyFrames.findIndex(t=>n<=t[0]),{attrList:r}=this.json.cBhvr;if(i<0){const t=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&r&&r[0]&&nR(this.timingTarget,r[0],t[1].resolveValue(this.vars)))}const o=i-1,s=this.keyFrames[i],a=this.keyFrames[o]||s,l=s[0]-a[0]==0?1:(n-a[0])/(s[0]-a[0]),u=s[1].interpolationFrom(a[1],l,this.vars);this.timingTarget&&r&&r[0]&&nR(this.timingTarget,r[0],u)},this.onSeekToStart=()=>{null!==this.startVal&&this.timingTarget&&nR(this.timingTarget,this.json.cBhvr.attrList[0],this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.initKeyFrames(),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timelineStart",this.updateVars),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}initKeyFrames(){var t;const{valueType:e}=this.json;if(this.json.tavLst.length<=0)if(this.json.to){if(this.json.from||this.startVal){const t={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if("num"===e&&this.timingTarget){const e=new hR(t,this.timingTarget);this.keyFrames.push([t.time,e])}}const t={time:1,val:{type:"string",value:this.json.to},fmla:""};if("num"===e&&this.timingTarget){const e=new hR(t,this.timingTarget);this.keyFrames.push([t.time,e])}}else if(this.json.by){const n={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if("num"===e&&this.timingTarget){const t=new hR(n,this.timingTarget);this.keyFrames.push([n.time,t])}const i={time:1,val:{type:"string",value:((null===(t=n.val)||void 0===t?void 0:t.value)||"")+"+"+this.json.by},fmla:""};if("num"===e&&this.timingTarget){const t=new hR(i,this.timingTarget);this.keyFrames.push([i.time,t])}}if(this.json.tavLst.length>0)for(const t of this.json.tavLst)if(t.val&&this.timingTarget){let n=null;"string"===t.val.type?"num"===e?n=new hR(t,this.timingTarget):"str"===e&&(n=new uR(t,this.timingTarget)):"number"===t.val.type?n=new lR(t,this.timingTarget):"color"===t.val.type?(this.isColorAnim=!0,n=new cR(t,this.timingTarget)):"boolean"===t.val.type&&console.warn("not implements"),n&&this.keyFrames.push([t.time,n])}}}var pR=n(50),fR=n.n(pR),mR=n(51),gR=n.n(mR);class vR extends Gx{constructor(){super(gR.a,fR.a,{percent:0,direction:1,transition:0})}set transition(t){this.uniforms.transition=t}set percent(t){this.uniforms.percent=t}set direction(t){this.uniforms.direction=t}}var _R=n(52),yR=n.n(_R);class xR extends Gx{constructor(){super(void 0,yR.a,{percent:0,transition:1})}set transition(t){this.uniforms.transition=Math.pow(t,t)}set percent(t){this.uniforms.percent=t}}class bR extends rR{constructor(t){var e;super(t),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t;this.filter&&(this.filter.percent=this.commonTimeNode.applyTimeFilter(n)),n>=1&&this.timingTarget&&this.ctx.clock.setTimeout(()=>{this.timingTarget&&(this.timingTarget.container.filters=[])})},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.onSeekToEnd=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.commonTimeNode.on("timelineStart",()=>{this.filter&&this.timingTarget&&(this.timingTarget.container.filters=[this.filter])}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate);let n=0;"out"===t.json.transition?n=-1:"in"===t.json.transition&&(n=1);const i=null===(e=t.json.filter)||void 0===e?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(i){const t=i[1],e=i[3];if("wipe"===t){const n=new vR;"up"===e?n.direction=1:"down"===e?n.direction=2:"left"===e?n.direction=3:"right"===e&&(n.direction=4),this.filter=n,this.filterType=`${t}-${e}`}else if("fade"===t){const e=new xR;this.filter=e,this.filterType=""+t}this.filter&&(this.filter.transition=n)}}get modifyAttrKey(){return this.filterType}}class TR extends rR{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startPos=null,this.onTimeNodeStart=()=>{var t,e;this.startPos={x:(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_x)||0,y:(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_y)||0}},this.onTimeUpdate=({duration:t,delta:e})=>{var n;const i=e/t,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{this.timingTarget&&this.startPos&&(this.timingTarget.ppt_x=this.startPos.x,this.timingTarget.ppt_y=this.startPos.y)},this.onSeekToEnd=()=>{var t,e,n;const i=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i>0?1:0);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var t;const e=new xc,n=null===(t=this.json.path)||void 0===t?void 0:t.match(/[MLCmlc][^MLCmlc]+/g);if(n)for(const t of n){const[n,...i]=t.trim().replace(/\s+/g," ").split(" ");if("M"===n){const[t,n]=i.map(t=>Number(t));e.moveTo(t,n)}else if("L"===n){const[t,n]=i.map(t=>Number(t));e.lineTo(t,n)}else if("C"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t));e.bezierCurveTo(t,n,r,o,s,a)}else if("Z"===n)e.closePath();else if("E"===n)console.warn("not implements");else if("c"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t)),l=e.currentPoint;e.bezierCurveTo(t+l.x,n+l.y,r+l.x,o+l.y,s+l.x,a+l.y)}else if("l"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.lineTo(n+t.x,r+t.y)}else if("m"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.moveTo(n+t.x,r+t.y)}}this.path=e}}class wR extends rR{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=t=>{t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{var n,i,r,o,s;const a=e/t,l={x:1,y:1};if(this.to){const t=null!==(n=this.from)&&void 0!==n?n:{x:null!==(r=null===(i=this.startVal)||void 0===i?void 0:i.x)&&void 0!==r?r:1,y:null!==(s=null===(o=this.startVal)||void 0===o?void 0:o.y)&&void 0!==s?s:1};l.x=t.x+(this.to.x-t.x)*a,l.y=t.y+(this.to.y-t.y)*a}else if(this.by){const t={x:this.by.x,y:this.by.y};l.x=1+(t.x-1)*a,l.y=1+(t.y-1)*a}this.timingTarget&&(this.timingTarget.scale=l)},this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})},this.onSeekToStart=()=>{this.timingTarget&&this.startVal&&(this.timingTarget.scale=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=t.json.from,this.to=t.json.to,this.by=t.json.by,this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart)}get modifyAttrKey(){return"scale"}updateCurrentValue(){this.timingTarget&&(this.current={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})}}class SR extends rR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isTimelineStart=!1,this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=t=>{if(this.isTimelineStart)return;this.isTimelineStart=!0,t.isReverse||this.updateCurrentValue(),this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to);const[e]=this.json.cBhvr.attrList[0].split(".");nR(this.timingTarget,e+".on","true")},this.onTimeNodeEnd=()=>{if("remove"===this.json.cBhvr.ctn.fill){const[t]=this.json.cBhvr.attrList[0].split(".");nR(this.timingTarget,t+".on","false")}this.isTimelineStart=!1},this.onSeekToStart=()=>{var t;if(this.timingTarget&&(this.onTimeUpdate({duration:1,delta:0}),(null===(t=this.timingTarget.fill)||void 0===t?void 0:t.designColor.toUpperCase())===this.from.toHexString().toUpperCase())){const[t]=this.json.cBhvr.attrList[0].split(".");nR(this.timingTarget,t+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const t=iR(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.startColorString=t)}},this.onTimeUpdate=({delta:t,duration:e})=>{const n=t/e;this.to.interpolationFrom(this.from,n,this.target),this.timingTarget&&nR(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.isTimelineStart||this.onTimelineStart({isReverse:!1,activeCount:0,id:""}),this.onTimeUpdate({duration:1,delta:1})},"rgb"===this.json.clrSpc?(this.from=new IM(this.json.from),this.to=new IM(this.json.to),this.by=new IM(this.json.by),this.target=new IM):(this.from=new CM(this.json.from),this.to=new CM(this.json.to),this.by=new CM(this.json.by),this.target=new CM),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeEnd",this.onTimeNodeEnd),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}updateCurrentValue(){if(this.timingTarget){const t=iR(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.currentColorString=t)}}}class ER extends rR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=t=>{this.lastVal=null,t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t;let i=0,r=0;if(void 0!==this.from&&void 0!==this.to){i=this.from,r=this.to;const t=i+(r-i)*n;this.timingTarget&&(this.timingTarget.r=t)}else if(void 0!==this.by){this.lastVal||(this.lastVal=0);const t=this.by*n-this.lastVal;this.lastVal=this.by*n,this.timingTarget&&(this.timingTarget.r+=t)}},this.onTimeNodeStart=()=>{var t;Object(l.isNumber)(null===(t=this.timingTarget)||void 0===t?void 0:t.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&null!==this.startVal&&(this.timingTarget.r=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=this.json.from,this.to=this.json.to,this.by=this.json.by,this.by?this.isConflict=!1:this.isConflict=!0,this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return"rotate"}updateCurrentValue(){var t;this.currentVal=null===(t=this.timingTarget)||void 0===t?void 0:t.r}}class MR extends rR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var t,e;const{cmd:n,cmdType:i}=this.json;!this.isApplied&&n&&i&&(this.isApplied=!0,null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand(n,i))},this.onSeekToStart=()=>{var t,e;null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand("custom-pause","call")},this.onSeekToEnd=()=>{},this.commonTimeNode.on("timeNodeStart",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeNodeEnd",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("seekToStart",this.onSeekToStart),this.commonTimeNode.on("seekToEnd",this.onSeekToEnd)}get modifyAttrKey(){var t,e,n,i;return(null!==(e=null===(t=this.json)||void 0===t?void 0:t.cmd)&&void 0!==e?e:"")+(null!==(i=null===(n=this.json)||void 0===n?void 0:n.cmdType)&&void 0!==i?i:"")}}class AR{constructor(t){this.runtimeNodeEventHub=new a.a,this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy(),this.ctx.activeMedia.delete(this.audio)};const{json:e,isIterate:n,isSub:i,eventHub:r,ctx:o,parent:s,iterateType:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}=t;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new PR({json:e.cMediaNode.ctn,isSub:i,eventHubs:{global:r,runtime:this.runtimeNodeEventHub},ctx:o,parent:s,isIterate:n,iterateType:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c});let d=e.cMediaNode.tgtEl;o.loaderDelegate&&(d=o.loaderDelegate.redirectMedia(d),o.logger.info(`redirect media url from ${e.cMediaNode.tgtEl} to ${d} by delegate.`,o.taskId)),this.audio=new XA(d,o.runningAudio),o.activeMedia.add(this.audio),this.commonTimeNode.on("timelineStart",()=>{this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy),this.ctx=o}}var RR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class PR extends a.a{constructor(t){var e,n;super(),this.uuid=Date.now().toString(32)+Math.random().toString(32).substring(2),this.isSub=!1,this.isShadow=!1,this.startCount=0,this.applyCount=0,this.isReverse=!1,this.isConflictDispose=!1,this.isIterateEnd=!1,this.parentTimeNode=null,this.isActive=!1,this.isDestroy=!1,this.shouldSeekOnStart=!1,this.repeatTimeoutId="",this.iterateShadows=[],this.isEndEventsEmitted=!1,this.tmFilter=[],this.timeDelta=0,this.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.isInfiniteRepeat()?this.repeatTimeNodeEnd():this.seekToEnd(!1,!0))},this.handleActive=(t=!0)=>{if(this.isActive=!0,this.isConflictDispose=!1,this.applyCount+=1,this.json.iterate||this.emit("timeNodeStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startCount>0&&this.json.restart){if("never"===this.json.restart)return;"whenNotActive"!==this.json.restart&&"always"!==this.json.restart||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(t))}else this.startTimeLine(t)},this.updateTimeLine=t=>{const e=t/(mv.TARGET_FPMS||.06);this.timeDelta+=e,this.duration-this.timeDelta<=e&&(this.timeDelta=this.duration),this.timeDelta<this.duration?this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?this.duration-this.timeDelta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}):(this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?0:this.duration,duration:this.duration,isReverse:this.isReverse}),this.onTimeLineEnd())},this.handleEnd=(t=!1)=>{(this.isTimeNodeEnd()||t)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:i,isIterate:r,ctx:o,eventHubs:s,parent:a,json:l,iterateType:u,iterateId:h,iterateIndex:c,isInInteractiveSeq:d}=t;this.isSub=i,this.isInInteractiveSeq=d,this.isIterate=r,this.parentTimeNode=a,this.json=l,this.ctx=o,this.iterateIndex=c,this.eventHubs=s,this.iterateType=u,this.iterateId=h,this.tmFilter=null!==(n=null===(e=l.tmFilter)||void 0===e?void 0:e.split(";").map(t=>t.split(",").map(t=>parseFloat(t.trim()))))&&void 0!==n?n:[];const p=Number(this.json.dur),f=this.json.spd||1;this.isNegativeSpeed=f<0,Number.isNaN(p)||(this.duration=p/Math.abs(f)),this.uuid+="--"+this.json.id,this.setPreStyle(),l.childTnLst&&this.createChildren(l.childTnLst),this.startConds=new tR(this.json.id||"",l.stCondLst,s,this.ctx),this.endConds=new tR(this.json.id||"",l.endCondLst,s,this.ctx),l.endSync&&(this.endSync=new tR(this.json.id||"",[l.endSync],s,this.ctx),this.endSync.on("active",()=>{var t;"interactiveSeq"===this.json.nodeType&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),null===(t=this.endSync)||void 0===t||t.reset())})),this.startConds.on("active",t=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(t))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(t=>t.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&"nextClick"===this.json.masterRel&&this.startConds.addCond({event:"shape slide onNext"}),this.json.iterate&&!1===this.isIterate&&this.createIterateShadow()}createIterateShadow(){const t=eM();let e=!0,n=0;const i=n=>{n===t&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",i))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",i);e;){const e=JSON.parse(JSON.stringify(this.json)),i=new PR({json:e,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:e.iterate.type,iterateIndex:n,iterateId:t,isInInteractiveSeq:this.isInInteractiveSeq});this.iterateShadows[n]=i,n+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(t){this.isReverse=t}createTimeNode(t,e){let n=null;const i={json:t,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId,isInInteractiveSeq:this.isInInteractiveSeq};return"seq"===t.type?n=new eR(i):"par"===t.type?n=new CR(i):"set"===t.type?n=new oR(i):"anim"===t.type?n=new dR(i):"animEffect"===t.type?n=new bR(i):"animMotion"===t.type?n=new TR(i):"animScale"===t.type?n=new wR(i):"animClr"===t.type?n=new SR(i):"animRot"===t.type?n=new ER(i):"cmd"===t.type?n=new MR(i):"audio"===t.type&&(n=new AR(i)),n}createSubList(t){this.subList=[],t.forEach(t=>{const e=this.createTimeNode(t,!0);e&&this.subList.push(e)})}bindCommonTimeNodeEvent(t){t.commonTimeNode.on("timeNodeStart",t=>{this.emit("childTimeNodeStart",t)}),t.commonTimeNode.on("timeNodeEnd",t=>{this.emit("childTimeNodeEnd",t),this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(t){function e(t){return(e=t,function(t){var e;return!!(null===(e=t)||void 0===e?void 0:e.cBhvr)}(e)?e.cBhvr.ctn:function(t){var e,n;return!!(null===(n=null===(e=t)||void 0===e?void 0:e.cMediaNode)||void 0===n?void 0:n.ctn)}(e)?e.cMediaNode.ctn:e.ctn).presetOrder;var e}if(t&&t[0]&&e(t[0])){[...t].sort((t,n)=>{var i,r;return(null!==(i=e(t))&&void 0!==i?i:0)-(null!==(r=e(n))&&void 0!==r?r:0)}).forEach(e=>{const n=t.findIndex(t=>t===e),i=this.createTimeNode(e,!1);i&&(this.bindCommonTimeNodeEvent(i),this.children[n]=i)})}else t.forEach(t=>{const e=this.createTimeNode(t,!1);e&&(this.bindCommonTimeNodeEvent(e),this.children.push(e))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(t=>t.commonTimeNode.playReverse())}allChildrenEndHandle(){if(!this.isDestroy){if(this.json.autoRev&&!this.isReverse)return this.isReverse=!0,void this.playReverse();this.isReverse&&(this.isReverse=!1),this.json.repeatCount&&this.json.repeatCount>this.applyCount?this.repeatTimeoutId=this.ctx.clock.setTimeout(()=>{this.seekToStart(!1),this.resetForRepeat(),this.startTimeNodeRepeat()}):(this.json.iterate&&!this.isIterate&&(this.isIterateEnd=!0),this.eventHubs.runtime.emit("runtime all end"),this.startSubList(),this.handleEnd())}}resetForRepeat(){this.isInInteractiveSeq&&this.isInfiniteRepeat()&&this.repeatTimeNodeEnd(),this.timeDelta=0,this.children.forEach(t=>t.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(t=>t.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.isEndEventsEmitted=!1,this.timeDelta=0;const t=1e3/this.ctx.ticker.maxFPS;this.duration<=t&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit($R.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>t&&(this.ctx.eventHub.emit($R.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(t=!0){if(t&&(this.isEndEventsEmitted=!1,this.eventHubs.global.emit(`time ${this.json.id} begin`),this.eventHubs.global.emit(`time ${this.json.id} onBegin`),this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)),this.json.iterate)return void this.startIterate();this.timeDelta=0,this.emit("timelineStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse});const e=1e3/this.ctx.ticker.maxFPS;this.duration<=e&&this.duration>0?(this.timeDelta=this.isReverse?0:this.duration,this.emit("timeUpdate",{delta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}),this.emit("timelineEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.ctx.ticker.addOnce(()=>{this.onTimeLineEnd()})):this.duration>e&&(this.ctx.eventHub.emit($R.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return RR(this,void 0,void 0,(function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const t of this.iterateShadows){if(this.isIterateEnd)break;t.children.forEach(t=>{t.commonTimeNode.startTimeNode()}),t.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}}))}applyTimeFilter(t){if(!this.tmFilter.every(t=>Object(l.isNumber)(t[0])&&Object(l.isNumber)(t[1])))return t;for(let e=0;e<this.tmFilter.length;e++){const n=this.tmFilter[e];if(t<n[0]){const i=this.tmFilter[e-1];return(t-i[0])/(n[0]-i[0])*(n[1]-i[1])+i[1]}}return this.tmFilter.length>0?this.tmFilter[this.tmFilter.length-1][1]:t}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}findTargets(){const t=[],e=n=>{n.forEach(n=>{var i,r,o;n.cBhvr&&n.cBhvr.target&&t.findIndex(t=>t.id===n.cBhvr.target.id)<0&&t.push(n.cBhvr.target),(null===(r=null===(i=null==n?void 0:n.cBhvr)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.childTnLst)&&n.cBhvr.ctn.childTnLst.length>0&&e(n.cBhvr.ctn.childTnLst),(null===(o=null==n?void 0:n.ctn)||void 0===o?void 0:o.childTnLst)&&n.ctn.childTnLst.length>0&&e(n.ctn.childTnLst)})};return e(this.json.childTnLst||[]),t}setPreStyle(){this.json.presetClass&&this.findTargets().forEach(t=>{if(this.json.iterate){let e=0,n=!0;for(;n;){const i=this.ctx.timingTargets.getTarget(t,!0,{type:this.json.iterate.type,index:e,id:""});i&&(this.setPreStyleForTarget(i),e+=1),n=!!i}}else{const e=this.ctx.timingTargets.getTarget(t,!1);e&&this.setPreStyleForTarget(e)}})}setPreStyleForTarget(t){var e,n;if(t&&this.json.presetSubtype&&(t.presetSubType=this.json.presetSubtype),t&&!t.hasPreset)if("entr"===this.json.presetClass){const i=null===(n=null===(e=this.json)||void 0===e?void 0:e.childTnLst)||void 0===n?void 0:n.filter(t=>"set"===t.type&&"visible"===t.to);(null==i?void 0:i.length)&&(t.hasPreset=!0,t.style.visibility="hidden")}else("exit"===this.json.presetClass||"path"===this.json.presetClass)&&(t.hasPreset=!0,t.style.visibility="visible")}startTimeNodeRepeat(){this.timeDelta=0,this.isActive=!0,this.applyCount+=1,this.startTimeLine(!1),this.json.iterate||this.emit("timeNodeRepeat",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse})}startTimeNodeForce(){this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.timeDelta=0,this.isActive=!0,this.handleActive(!1)}startTimeNode(t=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(t);const e=this.json.stCondLst.filter(t=>/^self/.test(t.event||""))[0];e&&this.startConds.condHandle(e);const n=this.json.endCondLst.filter(t=>/^self/.test(t.event||""))[0];n&&this.endConds.condHandle(n),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(0===this.children.length||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(t=>t.commonTimeNode.destroy())}seekToStart(t=!0){if(this.isEndEventsEmitted=!1,this.isActive=!1,this.dispose(),this.timeDelta=0,this.emit("seekToStart"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(e=>e.seekToStart(t));if(t)for(let t=this.subList.length-1;t>=0;t--){const e=this.subList[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}}repeatTimeNodeEnd(){this.dispose(),this.children.forEach(t=>{t.commonTimeNode.isActive=!1,t.commonTimeNode.dispose()})}dispose(t=!1){this.isConflictDispose=t,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit($R.animateEnd);try{this.ctx.ticker.remove(this.updateTimeLine)}catch(t){}this.startConds.reset(),this.endConds.reset()}seekToEnd(t,e=!1){if(this.isInfiniteRepeat())return;!this.isActive&&this.applyCount<=0&&this.collectStartValue(),this.applyCount=this.json.repeatCount,this.json.autoRev&&(this.isReverse=!0),this.timeDelta=this.duration,this.isActive=!1,this.dispose();const n=this.json.autoRev||t;if(n?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(t=>t.seekToEnd(n,e));0===this.children.length&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(t=>t.commonTimeNode.seekToEnd(n,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(t=>t.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEndWhenDetectEndSync(){if(this.isInInteractiveSeq&&this.isInfiniteRepeat())return!0;let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}isTimeNodeEnd(){let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}emitEndEvents(){this.isEndEventsEmitted||(this.isEndEventsEmitted=!0,this.eventHubs.global.emit(`time ${this.json.id} end`),this.eventHubs.global.emit(`time ${this.json.id} onEnd`),this.eventHubs.runtime.emit(`runtime ${this.json.id} end`),this.emit("timeNodeEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}))}collectStartValue(){this.emit("timeNodeCreate"),this.children.forEach(t=>t.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(t=>t.commonTimeNode.destroy()),this.clearSubList()}}class CR extends a.a{constructor(t){super(),this.isRunning=!1,this.runtimeNodeEventHub=new a.a;const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:s,eventHub:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}=t;this.id=e.ctn.id,this.json=e,this.ctx=s,this.isIterate=i,this.globalEventHub=l,this.commonTimeNode=new PR({json:e.ctn,isSub:r,eventHubs:{global:l,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:n,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),t.commonTimeNode.startTimeNode()}),this.isRunning||(this.isRunning=!0,this.globalEventHub.emit(`runtime ${this.id} begin`),this.emit("begin"))}),this.commonTimeNode.on("timeNodeRepeat",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.startTimeNode(!1)})}),this.commonTimeNode.on("timeNodeEnd",()=>{this.commonTimeNode.isTimeNodeEnd()&&this.isRunning&&(this.isRunning=!1,this.globalEventHub.emit(`runtime ${this.id} end`),this.emit("end"))})}}var IR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class OR{constructor(t,e,n){this.json=t,this.ctx=n,this.globalEventHub=e;const i=t.timeNodeList.find(t=>"par"===t.type&&"tmRoot"===t.ctn.nodeType);i&&(this.tmRoot=new CR({json:i,isSub:!1,isIterate:!1,eventHub:e,ctx:n,parent:null,iterateType:"el",iterateIndex:0,iterateId:"",isInInteractiveSeq:!1}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(t=>{var e,n,i;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"mainSeq"===(null===(i=null===(n=t.json)||void 0===n?void 0:n.ctn)||void 0===i?void 0:i.nodeType)}))}findSeq(t){var e;return null===(e=this.tmRoot)||void 0===e?void 0:e.commonTimeNode.children.find(e=>{var n,i,r;return"seq"===(null===(n=e.json)||void 0===n?void 0:n.type)&&(null===(r=null===(i=e.json)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.id)===t})}start(){var t,e;return IR(this,void 0,void 0,(function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.startTimeNode()):null===(e=this.mainSeq)||void 0===e||e.commonTimeNode.startTimeNode()}))}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var t;null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.collectStartValue()}setMainSeqStep(t,e){var n;-1===t&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),null===(n=this.mainSeq)||void 0===n||n.setCurrentStep(t,e)}destroy(){var t;this.globalEventHub.removeAllListeners(),null===(t=this.tmRoot)||void 0===t||t.commonTimeNode.destroy()}hasMainSeq(){return!!this.mainSeq&&this.mainSeq.commonTimeNode.children.length>0}currentMainSeqState(){return this.mainSeq?this.mainSeq.currentState:null}currentMainSeqStep(){return this.mainSeq?this.mainSeq.currentStep:0}currentMainSeqLength(){return this.mainSeq?this.mainSeq.stepLength:0}mainSeqHasNextStep(){return!!this.mainSeq&&this.mainSeq.hasNext()}mainSeqHasPrevStep(){return!!this.mainSeq&&this.mainSeq.hasPrev()}seekInteractiveSeqToEnd(t){const e=this.findSeq(t);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(t,e,n){const i=this.findSeq(t);i&&i.setCurrentStep(e,n)}resetAllInteractiveSeq(){var t;((null===(t=this.tmRoot)||void 0===t?void 0:t.commonTimeNode.children.filter(t=>{var e,n,i;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"interactiveSeq"===(null===(i=null===(n=t.json)||void 0===n?void 0:n.ctn)||void 0===i?void 0:i.nodeType)}))||[]).forEach(t=>{t.setCurrentStep(0,"start")})}applyInteractiveAction(t){this.globalEventHub.emit(t)}}var LR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class NR extends QA{constructor(t,e,n,i){super({id:"stage",width:t.width,height:t.height,type:"Container",children:t.children},e,n,void 0,i),this.isRendered=!1,this.isTimingStartValueCollected=!1,this.json=t,e.hasBackgroundFillShape=this.detectUseBackgroundFill(this.json),this.container.visible=!1,this.ctx=e;const r=new Aw;r.beginFill(16777215),r.drawRect(0,0,t.width,t.height),r.endFill(),this.container.addChild(r)}detectUseBackgroundFill(t){return!!t&&("Picture"===t.type||"Shape"===t.type?t.useBgFill:!(!t.children||!Object(l.isArray)(t.children))&&t.children.some(t=>this.detectUseBackgroundFill(t)))}initOnReuse(){super.initOnReuse(),this.ctx.timingEventHub.on("c:prev slide",t=>{this.ctx.eventHub.emit($R.requestPrevSlide,t)}),this.ctx.timingEventHub.on("c:next slide",t=>{this.ctx.eventHub.emit($R.requestNextSlide,t)})}get interactiveContainer(){return this.container}render(t){this.isRendered||(this.isRendered=!0,super.render(t),t.addSubMTask(()=>LR(this,void 0,void 0,(function*(){this.ctx.eventHub.emit("StageRenderEnd")})),"@StageImpl[emit.StageRenderEnd]"))}createTiming(){this.json.timing&&!this.timing&&(this.timing=new OR(this.json.timing,this.ctx.timingEventHub,this.ctx))}startTiming(){var t;return(null===(t=this.timing)||void 0===t?void 0:t.start())||Promise.resolve()}setMainSeqApplied(){var t;null===(t=this.timing)||void 0===t||t.setMainSeqApplied()}setMainSeqStep(t,e){var n;null===(n=this.timing)||void 0===n||n.setMainSeqStep(t,e)}collectMainSeqStartValue(){var t;this.isTimingStartValueCollected||(this.isTimingStartValueCollected=!0,null===(t=this.timing)||void 0===t||t.collectMainSeqStartValue())}hasTiming(){return!!this.timing}clearOnSlideChange(){this.ctx.eventHub.removeAllListeners(),this.ctx.timingEventHub.removeAllListeners(),super.clearOnSlideChange()}clearOnTransactionEnd(){var t,e;this.ctx.timingTargets.getTargets().forEach(t=>{t.hasPreset=!1}),null===(t=this.timing)||void 0===t||t.resetAllInteractiveSeq(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0}destroy(){var t,e;this.isTimingStartValueCollected=!1,this.isRendered=!1,this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),null===(t=this.ctx.bgTexture)||void 0===t||t.destroy(!0),this.ctx.spriteTexture.destroy(),this.ctx.timingEventHub.removeAllListeners(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0,super.destroy()}mainSeqStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqStep())&&void 0!==e?e:0}mainSeqLength(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqLength())&&void 0!==e?e:0}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(t=!1){var e;this.hasTiming()&&(null===(e=this.timing)||void 0===e?void 0:e.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onNext",t)):this.ctx.eventHub.emit($R.requestNextSlide,t)}prevStep(t=!1){var e;this.hasTiming()&&(null===(e=this.timing)||void 0===e?void 0:e.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onPrev",t)):this.ctx.eventHub.emit($R.requestPrevSlide,t)}applyInteractiveAction(t){var e;null===(e=this.timing)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.timing)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var i;null===(i=this.timing)||void 0===i||i.setInteractiveSeqState(t,e,n)}setMediaState(t,e){return LR(this,void 0,void 0,(function*(){const n=this.ctx.medias[t];n&&(e?yield n.play():yield n.pause())}))}setMediaCurrentTime(t,e){const n=this.ctx.medias[t];n&&n.seek(e)}}class DR{constructor(t){this.ticker=t,this.tasks=[],this.couldRunning=!1,this.applyNext=()=>{const t=this.tasks[0];t&&t.applyNext()},t.add(this.applyNext)}addTask(t){this.tasks.push(t),t.once("task-finish",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)}),t.once("task-error",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)})}start(){this.couldRunning=!0}stop(){this.couldRunning=!1}}var FR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const BR=t=>new Promise(e=>setTimeout(e,t));class UR extends a.a{constructor(t,e,n){super(),this.slideIndex=t,this.taskId=e,this.logger=n,this.uuid=eM(),this.isCancel=!1,this.tasks=[]}addMTask(t,e){this.tasks.push({fn:t,state:"wait",sub:[],name:e})}addSubMTask(t,e){let n=this.tasks.findIndex(t=>"running"===t.state);n<0&&(n=0),this.tasks[n].sub.push({fn:t,state:"wait",sub:[],name:e})}cancel(){this.tasks=[],this.isCancel=!0}applyNext(){if(this.tasks.some(t=>"running"===t.state))return;if(this.tasks.some(t=>"error"===t.state))return;if(this.tasks.every(t=>"finish"===t.state))return void(this.isCancel||this.emit("task-finish"));const t=this.tasks.find(t=>"wait"===t.state);t&&(t.state="running",t.fn.apply(null).then(()=>{if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}).catch(e=>{t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",qE.transform(e),this.slideIndex)}))}applyAll(){return FR(this,void 0,void 0,(function*(){for(;!this.tasks.every(t=>"finish"===t.state);)if(this.tasks.some(t=>"running"===t.state))yield BR(16);else{if(this.tasks.some(t=>"error"===t.state))return;{const t=this.tasks.find(t=>"wait"===t.state);if(t){t.state="running";try{if((yield iM(()=>t.fn.apply(null),6e4))===nM)throw new qE(VE.RuntimeError,`subtask ${t.name} apply timeout`);if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}catch(e){let n;n=(null==e?void 0:e.errorType)?e:new qE(VE.RuntimeError,`subtask ${t.name} error. ${e}`),t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",qE.transform(n),this.slideIndex);break}}}}!this.isCancel&&this.tasks.every(t=>"finish"===t.state)&&this.emit("task-finish")}))}}var kR=n(53);const GR=new(n.n(kR).a),HR=GR.getDevice(),zR=GR.getBrowser(),jR=GR.getOS(),VR={isDesktop(){let t=!0;return"mobile"===HR.type&&(t=!1),/Samsung/.test(zR.name||"")&&(t=!1),window.__nativeTags&&window.__nativeTags.platform&&(t=!1),t},isIOS(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^ios/i.test(window.__nativeTags.platform)&&(t=!0),jR.name&&/iOS/.test(jR.name)&&(t=!0),t},isAndroid(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^android/i.test(window.__nativeTags.platform)&&(t=!0),jR.name&&/android/i.test(jR.name)&&(t=!0),t},isLowGpuMemory(){var t,e;const n=null!==(e=null===(t=window.__nativeTags)||void 0===t?void 0:t.platform)&&void 0!==e?e:"";if(n){const t=n.split(" ");if(t[1]){if(/^iPad/.test(t[1])){const e=t[1].match(/^iPad(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=6)}if(/^iPhone/.test(t[1])){const e=t[1].match(/^iPhone(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=9)}return!1}return!1}return!0}};var WR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class XR{constructor(t,e,n,i,r,o,s,a,l,u,h,c,d){this.loader=t,this.mode=e,this.renderer=n,this.ticker=i,this.view=r,this.clock=o,this.objPoolGroup=s,this.errorChannel=a,this.localstorage=l,this.logger=u,this.loaderDelegate=h,this.isPlayerPaused=c,this.maxResolution=d,this.currentStageIndex=0,this.cacheCount=VR.isDesktop()?2:1,this.stageStates=Object.create(null),this.stageJsons=Object.create(null),this.stageCtxs=Object.create(null),this.stageImpls=Object.create(null),this.taskId="",this.url="",this.runningAudio=new Map,this.activeMedia=new Set,this.microTaskManager=new DR(i)}setResourceData(t,e){this.taskId=t,this.url=e}createCtx(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const e=new dM(this.loader),n=new a.a,i={taskId:this.taskId,mode:this.mode,renderer:this.renderer,graphicsTexture:new bM,stageWidth:0,stageHeight:0,ticker:this.ticker,timingTargets:new wM(n),eventHub:n,view:this.view,medias:Object.create(null),lastViewedIndex:0,conflictTimeNodeManager:new TM,clock:this.clock,spriteTexture:e,slideIndex:t,objectPoolGroup:this.objPoolGroup,hasBackgroundFillShape:!1,slideScopeEventHub:new a.a,logger:this.logger,loaderDelegate:this.loaderDelegate,runningAudio:this.runningAudio,activeMedia:this.activeMedia,isPlayerPaused:this.isPlayerPaused,timingEventHub:new a.a,maxResolution:this.maxResolution};this.stageCtxs[t]=i})),"@StagePool[createCtx]")}loadStageJson(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`);this.stageJsons[t]=e,this.stageCtxs[t].stageWidth=e.width,this.stageCtxs[t].stageHeight=e.height})),"@StagePool[loadStageJson]")}loadSpriteSheets(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const n=this.stageJsons[t],{spriteTexture:i,stageWidth:r,stageHeight:o}=this.stageCtxs[t],{coloredSheets:s,sheets:a}=n,l=s||a;return l&&l.forEach(t=>{e.addSubMTask(()=>{let e=1;if(r>this.maxResolution.x||o>this.maxResolution.y){e=this.maxResolution.x/r;const t=e*o;t>this.maxResolution.y&&(e*=this.maxResolution.y/t)}return i.loadSpriteSheetItem(this.url,this.taskId,t,e)},"@StagePool[spriteTexture.loadSpriteSheetItem]")}),Promise.resolve()},"@StagePool[loadSpriteSheets]")}createStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const n=this.stageJsons[t],i=this.stageCtxs[t],r=new NR(n,i,{x:0,y:0},e);return this.stageImpls[t]=r,Promise.resolve()},"@StagePool[createStage]")}preRenderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>(this.stageImpls[t].preRender(e),Promise.resolve()),"@StagePool[preRenderStage]")}createGraphicsTexture(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const n=this.stageCtxs[t];n.graphicsTexture.pack().forEach((t,i)=>{e.addSubMTask(()=>n.graphicsTexture.render(t,i,this.objPoolGroup),"@StagePool[graphicsTexture.render]")})})),"@StagePool[createGraphicsTexture]")}renderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const n=this.stageImpls[t],i=this.stageCtxs[t];yield n.render(e),e.addSubMTask(()=>WR(this,void 0,void 0,(function*(){var e;const r=`snapshot-${t.toString()}-start`;if(!(yield null===(e=this.localstorage)||void 0===e?void 0:e.getItem(r))&&KR.platform.isLowGpuMemory()){n.createTiming(),n.container.visible=!0,n.collectMainSeqStartValue(),n.setMainSeqStep(0,"start");const t=Hy.create({width:n.json.width,height:n.json.height,resolution:1});i.renderer.render(n.container,{renderTexture:t});const e=i.renderer.plugins.extract.base64(t,"image/jpeg");this.localstorage.setItem(r,e,!0).catch(()=>{}),n.container.visible=!1,t.destroy(),n.timing&&(n.timing.destroy(),n.timing=void 0)}})),"@StagePool[snapshot]")})),"@StagePool[renderStage]")}destroyStageByIndex(t){"load"===this.stageStates[t].state&&this.stageStates[t].task.cancel(),delete this.stageStates[t];this.stageImpls[t].destroy(),delete this.stageImpls[t],delete this.stageCtxs[t]}destroyStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);Math.abs(this.currentStageIndex-e)>this.cacheCount&&this.destroyStageByIndex(e)})}destroyAllStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);this.destroyStageByIndex(e)})}preload(t,e=!1){if(this.stageImpls[t]||this.stageStates[t])return Promise.resolve();const n=new UR(t,this.taskId,this.logger);return n.on("task-error",(t,e)=>{delete this.stageStates[e],delete this.stageImpls[e],delete this.stageCtxs[e],this.errorChannel.emit("error",t,e)}),this.stageStates[t]={state:"load",task:n},this.createCtx(t),this.loadStageJson(t),this.loadSpriteSheets(t),this.createStage(t),this.preRenderStage(t),this.createGraphicsTexture(t),this.renderStage(t),this.microTaskManager.addTask(n),e?n.applyAll():new Promise(e=>{n.once("task-finish",()=>{this.stageStates[t].state="finish";Object.keys(this.stageStates).length>2*this.cacheCount+1&&this.destroyStage(),e()})})}getStageJson(t){return this.stageJsons[t]||null}getStage(t){return WR(this,void 0,void 0,(function*(){this.currentStageIndex=t;const e=this.stageStates[t];return"finish"===(null==e?void 0:e.state)&&this.stageImpls[t]?this.stageImpls[t]:"load"===(null==e?void 0:e.state)?(yield e.task.applyAll(),this.stageImpls[t]):(yield this.preload(t,!0),this.stageImpls[t])}))}destroy(){this.runningAudio.clear()}}var qR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class YR{constructor(t){var e;this.logger=t,this.taskId="",this.isIndexDBReady=!1,this.memoryCache=new Map,null===(e=YR.localCache)||void 0===e||e.ready(()=>{this.isIndexDBReady=!0}).catch(()=>{t.warn("local storage not ready",this.taskId)})}get couldUseIndexDBCache(){return this.isIndexDBReady&&this.taskId.length>0}attachTaskId(t){this.taskId=t}getItem(t){return qR(this,void 0,void 0,(function*(){let e=null;return this.couldUseIndexDBCache&&YR.localCache&&(e=yield iM(()=>YR.localCache.getItem(`${this.taskId}/${t}`),500)),e=e===nM?null:e,e||this.memoryCache.get(t)||null}))}setItem(t,e,n=!1){return qR(this,void 0,void 0,(function*(){if(!this.couldUseIndexDBCache)return n&&this.memoryCache.set(t,e),Promise.resolve();if(YR.localCache){(yield iM(()=>YR.localCache.setItem(`${this.taskId}/${t}`,e).catch(()=>{n&&this.memoryCache.set(t,e)}),500))===nM&&n&&this.memoryCache.set(t,e)}}))}dispose(){var t;this.memoryCache=new Map,this.couldUseIndexDBCache&&(null===(t=YR.localCache)||void 0===t||t.keys().then(t=>{t.filter(t=>t.indexOf(this.taskId)>=0).forEach(t=>{var e;null===(e=YR.localCache)||void 0===e||e.removeItem(t).catch(()=>{})})}))}}YR.localCache=null;try{YR.localCache=o.createInstance({name:"slide_local_cache",driver:o.INDEXEDDB,version:1})}catch(t){}var ZR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};r.skipHello();const JR={randomBar:"RandomLines",circle:"Shape",ripple:"Ripples",wipe:"Erase",dissolve:"Dissolve",morph:"Smooth",fade:"FadeInOut",push:"Push",split:"Separation",reveal:"Display",pull:"Uncover",cover:"Cover",flash:"Flash",checker:"Checkerboard",blinds:"WindowShades",curtains:"Curtain",fallOver:"Fall",drape:"Suspension",wheel:"Clock",comb:"Combing",warp:"Scale",peelOff:"PeelOff",flip:"Flip"},$R={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqAction:"interactiveSeqAction",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",slideChange:"slideChange",renderStart:"renderStart",renderEnd:"renderEnd",hyperlinkTrigger:"hyperlinkTrigger",animateStart:"animateStart",animateEnd:"animateEnd",mediaSeek:"mediaSeek",mediaPlay:"mediaPlay",mediaPause:"mediaPause",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide",userInput:"userInput"};class KR extends a.a{constructor(t,e={}){super(),this.errorChannel=new a.a,this.transactionPlayer=null,this.transactionSprite=new Ow,this.isForward=!0,this.drawCall=0,this.scale=1,this.prevSlideBase64=null,this._isPaused=!1,this.maxResolution=new v_(0,0),this.fps=new XE,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.isPlayerPaused=()=>this._isPaused,this.onWebGLLost=()=>{this.errorChannel.emit("error",new qE(VE.CanvasCrash,"webgl context lost."))},this.logger=t.logger,this.mode=t.mode,this.localStorage=new YR(this.logger);let n=Math.max(window.devicePixelRatio,2);VR.isDesktop()||(n=1),this.config={minFPS:Object(l.isUndefined)(e.minFPS)?30:e.minFPS,maxFPS:Object(l.isUndefined)(e.maxFPS)?40:e.maxFPS,resolution:Object(l.isUndefined)(e.resolution)?n:e.resolution,autoFPS:!Object(l.isUndefined)(e.autoFPS)&&e.autoFPS,autoResolution:!Object(l.isUndefined)(e.autoResolution)&&e.autoResolution,transactionBgColor:Object(l.isUndefined)(e.transactionBgColor)?0:e.transactionBgColor,maxResolutionLevel:this.getMaxResolution(e.maxResolutionLevel)},this.updateMaxResolutionLevel(this.config.maxResolutionLevel),this.loader=new sM(this.localStorage,t.useLocalCache,this.logger,t.resourceTimeout,t.loadDelegate),this.app=new Lb({antialias:!0,autoDensity:!1,backgroundColor:16777215}),this.updateConfig(this.config),this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const i=this.app.renderer,{drawElements:r}=i.gl;i.gl.drawElements=(...t)=>{r.call(i.gl,...t),this.drawCall+=1},this.fps.on("update",t=>{if(t<this.config.minFPS){if(this.config.autoResolution){const t=.7*this.scale,e=this.app.renderer.resolution,n=Math.max(t,e-.1);n>=t&&this.updateResolution(n)}if(this.config.autoFPS){const t=14,{minFPS:e,maxFPS:n}=this.app.ticker,i=Math.max(t,e-2),r=Math.max(t,n-2);i>=t&&r>=t&&(this.app.ticker.minFPS=i,this.app.ticker.maxFPS=r)}}else if(t>this.config.maxFPS){if(this.config.autoResolution){const t=this.scale*this.config.resolution,e=this.app.renderer.resolution,n=Math.min(t,e+.1);n<=this.config.resolution&&this.updateResolution(n)}if(this.config.autoFPS){const t=this.config.minFPS,e=this.config.maxFPS,{minFPS:n,maxFPS:i}=this.app.ticker,r=Math.min(t,n+2),o=Math.min(e,i+2);r<=t&&o<=e&&(this.app.ticker.minFPS=r,this.app.ticker.maxFPS=o)}}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,ey.LOW),this.clock=new lM(this.app.ticker),this.objPoolGroup=eM(),this.stagePool=new XR(this.loader,this.mode,this.app.renderer,this.app.ticker,this.app.view,this.clock,this.objPoolGroup,this.errorChannel,this.localStorage,this.logger,t.loadDelegate,this.isPlayerPaused,this.maxResolution),this.app.view.addEventListener("webglcontextlost",this.onWebGLLost);try{this.transactionPlayer=new og}catch(t){/Error creating WebGL context/.test(t.message)?this.errorChannel.emit("error",new qE(VE.CanvasCrash,"webgl context lost.")):this.errorChannel.emit("error",new qE(VE.RuntimeWarn,t.message))}}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.nextIndex)?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.prevIndex)?this.currentStage.json.prevIndex:this.currentIndex-1}getMaxResolution(t){return!Object(l.isUndefined)(t)&&Number.isInteger(t)?(t<1&&(t=1),t>4&&(t=4),t):KR.platform.isAndroid()||KR.platform.isIOS()?2:4}updateMaxResolutionLevel(t){t<1&&(t=1),t>4&&(t=4);const e=[999999,960,1280,1920,3200][t],n=[999999,540,720,1080,1800][t];this.maxResolution.set(e,n)}updateConfig(t){Object(l.isUndefined)(t.minFPS)||(this.config.minFPS=t.minFPS,this.app.ticker.minFPS=t.minFPS),Object(l.isUndefined)(t.maxFPS)||(this.config.maxFPS=t.maxFPS,this.app.ticker.maxFPS=t.maxFPS),Object(l.isUndefined)(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),Object(l.isUndefined)(t.autoFPS)||(this.config.autoFPS=t.autoFPS),Object(l.isUndefined)(t.autoResolution)||(this.config.autoResolution=t.autoResolution),Object(l.isUndefined)(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor),this.taskId&&this.logger.info("ppt player update config: "+JSON.stringify(this.config),this.taskId),Object(l.isUndefined)(t.maxResolutionLevel)||(this.config.maxResolutionLevel=t.maxResolutionLevel,this.updateMaxResolutionLevel(this.config.maxResolutionLevel))}preload(t){return ZR(this,void 0,void 0,(function*(){t<1||t>this.slideCount||(this.logger.info(`preload slide ${t} begin`,this.taskId),yield this.stagePool.preload(t),this.logger.info(`preload slide ${t} end`,this.taskId))}))}setResourceData(t,e){this.logger.info("ppt player init config: "+JSON.stringify(this.config),t),this.logger.info("set resource to "+e,t),this.taskId=t,this.url=e,this.stagePool.setResourceData(t,e),this.localStorage.attachTaskId(t),this.loader.attachTaskId(t)}setInteractive(t){this.app.stage.interactive=t,this.app.stage.interactiveChildren=t}translateEvent(t,e){e.forEach(e=>{t.on(e,(...t)=>{this.emit(e,...t)})})}renderSlide(t,e=!1){var n;return ZR(this,void 0,void 0,(function*(){if(this._isPaused)return void this.logger.info("ppt play prevent render slide with paused state",this.taskId);this.logger.info("render slide "+t,this.taskId),this.emit($R.renderStart,t);const i=yield this.stagePool.getStage(t);if(!i)return;this.translateEvent(i.ctx.eventHub,[$R.mainSeqStepChange,$R.mainSeqStateChange,$R.hyperlinkTrigger,$R.interactiveSeqAction,$R.mainSeqStepStart,$R.mainSeqStepEnd,$R.animateStart,$R.animateEnd,$R.mediaPlay,$R.mediaPause,$R.mediaSeek,$R.requestGotoSlide,$R.requestNextSlide,$R.requestPrevSlide,$R.interactiveSeqStateChange,$R.userInput]),this.currentIndex=Number(t);const{width:r,height:o,slideCount:s}=i.json;this.slideCount=s,this.designWidth=r,this.designHeight=o,i.json.transition&&i.json.transition.type&&!this.prevSlideBase64&&this.currentStage&&(this.prevSlideBase64=this.getBase64(this.currentStage)),null===(n=this.currentStage)||void 0===n||n.clearOnSlideChange();const a=this.currentStage;this.currentStage=i,i.initOnReuse(),i.createTiming(),i.container.visible=!0,i.collectMainSeqStartValue(),this.isForward?i.setMainSeqStep(0,"start"):i.setMainSeqStep(-1,"end");let l=null;if(i.json.transition&&i.json.transition.type){const n=t.toString()+(this.isForward||e?"-start":"-end"),i=yield this.localStorage.getItem("snapshot-"+n);l=i||this.getBase64(this.currentStage)}i.container.visible=!1,this.app.stage.addChild(i.container);let{transition:u}=i.json;!this.isForward&&(null==a?void 0:a.json.transition)&&(u=a.json.transition),this.prevSlideBase64&&l&&u&&u.type&&a&&i&&(yield this.playTransaction(this.prevSlideBase64,l,u,a,i),this.prevSlideBase64=null),this.isForward?yield i.startTiming():i.setMainSeqApplied(),this.updateResolution(this.config.resolution*this.scale),i.container.visible=!0,a&&(a.setMainSeqStep(0,"start"),a.clearOnTransactionEnd(),this.app.stage.removeChild(a.container)),i.ctx.slideScopeEventHub.emit("slide-render",i.ctx.slideIndex),this.emit($R.renderEnd,t),this.emit($R.slideChange,t),this.preload(t+1).catch(e=>{this.errorChannel.emit("error",qE.transform(e),t+1)}),this.preload(t-1).catch(e=>{this.errorChannel.emit("error",qE.transform(e),t-1)})}))}renderToBase64(t,e,n){return ZR(this,void 0,void 0,(function*(){const i=yield this.stagePool.getStage(t);if(i){const{width:r,height:o}=i.json;this.designWidth=r,this.designHeight=o;const s=Hy.create({width:this.designWidth,height:this.designHeight,resolution:e});i.container.visible=!0,this.app.renderer.render(i.container,{renderTexture:s});const a=this.app.renderer.plugins.extract.base64(s,n);return this.stagePool.destroyStageByIndex(t),a}return"__null__"}))}getBase64(t){if(!t.container.transform)return null;const e=Hy.create({width:this.designWidth,height:this.designHeight,resolution:1});this.app.renderer.render(t.container,{renderTexture:e});const n=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(!0),n}playTransaction(t,e,n,i,r){return ZR(this,void 0,void 0,(function*(){const o=this.app.view.parentElement;if(t&&e&&o&&JR[n.type]&&this.transactionPlayer){this.transactionSprite.zIndex=999,this.transactionSprite.visible=!1,this.app.stage.addChild(this.transactionSprite);const o=this.transactionPlayer.renderer.domElement,s=ky.from(o),a=()=>s.update();return this.app.ticker.add(a),this.transactionSprite.texture=s,setTimeout(()=>{this.transactionSprite.visible=!0},100),new Promise(o=>{var s,l,u,h;null===(s=this.transactionPlayer)||void 0===s||s.play({reverse:!this.isForward,prevTextureUrl:t,nextTextureUrl:e,textureWidth:this.designWidth,textureHeight:this.designHeight,presetType:JR[n.type],stageWidth:this.designWidth,stageHeight:this.designHeight,duration:null===(u=null===(l=this.currentStage)||void 0===l?void 0:l.json.transition)||void 0===u?void 0:u.dur,delay:0,clearColor:this.config.transactionBgColor,maxFPS:Math.ceil(null!==(h=this.config.maxFPS)&&void 0!==h?h:60),onTransactionEnd:()=>{var t,e;o(),i.container.visible=!1,r.container.visible=!0,null===(t=this.app.stage)||void 0===t||t.removeChild(this.transactionSprite),null===(e=this.app.ticker)||void 0===e||e.remove(a)}})})}return Promise.resolve()}))}scaleView(t,e,n){if(this.view&&(this.view.style.width=Math.floor(this.designWidth*t)+"px",this.view.style.height=Math.floor(this.designHeight*t)+"px"),e){this.scale=t;const e=this.scale*this.config.resolution;this.updateResolution(e,n)}}updateResolution(t,e){this.app.ticker.addOnce(()=>{let n=VR.isDesktop()?t:1;for(;n*this.designWidth>this.maxResolution.x||n*this.designHeight>this.maxResolution.y;)n-=.1;this.app.renderer.resolution=n,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight),Object(l.isFunction)(e)&&e()})}nextStep(t=!1){var e;if(this._isPaused)this.logger.info("ppt play prevent next step with paused state",this.taskId);else{this.logger.info("ppt play trigger next step",this.taskId);try{null===(e=this.currentStage)||void 0===e||e.nextStep(t)}catch(t){this.errorChannel.emit("error",qE.transform(t),this.currentIndex)}}}prevStep(t=!1){var e;if(this._isPaused)this.logger.info("ppt play prevent prev step with paused state",this.taskId);else{this.logger.info("ppt play trigger prev step",this.taskId);try{null===(e=this.currentStage)||void 0===e||e.prevStep(t)}catch(t){this.errorChannel.emit("error",qE.transform(t),this.currentIndex)}}}mainSeqLength(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqLength())&&void 0!==e?e:0}mainSeqStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqStep())&&void 0!==e?e:0}setMainSeqStep(t,e){var n;null===(n=this.currentStage)||void 0===n||n.setMainSeqStep(t,e)}mainSeqState(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqState())&&void 0!==e?e:null}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},ey.LOW)}applyInteractiveAction(t){var e;null===(e=this.currentStage)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.currentStage)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var i;null===(i=this.currentStage)||void 0===i||i.setInteractiveSeqState(t,e,n)}setMediaState(t,e){var n;return ZR(this,void 0,void 0,(function*(){yield null===(n=this.currentStage)||void 0===n?void 0:n.setMediaState(t,e)}))}setMediaCurrentTime(t,e){var n;null===(n=this.currentStage)||void 0===n||n.setMediaCurrentTime(t,e)}pause(){var t;this.app.ticker.stop(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalPause()}),this._isPaused=!0}resume(){var t;this._isPaused=!1,this.app.ticker.start(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalResume()})}getSnapshot(){return this.currentStage&&this.getBase64(this.currentStage)||""}createSnapshotForNextSlide(t){return ZR(this,void 0,void 0,(function*(){const e=this.nextSlideIndex,n=this.stagePool.getStageJson(e);if(n&&n.transition&&n.transition.type&&this.currentStage&&this.transactionPlayer){const e=t?`snapshot-${this.currentStage.json.index}-start`:`snapshot-${this.currentStage.json.index}-end`;if(this.currentStage.timing&&(t?this.currentStage.timing.mainSeqHasPrevStep():this.currentStage.timing.mainSeqHasNextStep()))this.prevSlideBase64=this.getBase64(this.currentStage);else{const t=yield this.localStorage.getItem(e);t?this.prevSlideBase64=t:(this.prevSlideBase64=this.getBase64(this.currentStage),this.localStorage.setItem(e,this.prevSlideBase64,!0).catch(()=>{}))}}}))}clearLocalCache(){this.localStorage.dispose()}static clearLocalCache(){var t;null===(t=YR.localCache)||void 0===t||t.clear().catch(()=>{})}destroy(){var t;try{this.app.view.removeEventListener("webglcontextlost",this.onWebGLLost);try{this.app.renderer.filter.texturePool.clear(!0)}catch(t){}_M.collectObjectByGroup(this.objPoolGroup),yM.collectObjectByGroup(this.objPoolGroup),null===(t=this.transactionPlayer)||void 0===t||t.destroy(),this.loader.destroy(),this.fps.destroy(),this.stagePool.destroyAllStage(),this.stagePool.destroy();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){}this.app.destroy(!0,{children:!0,texture:!0,baseTexture:!0})}catch(t){}}}KR.platform=VR,KR.RtcAudioClazz=null;var QR=new Map;function tP(t){var e=QR.get(t.hookPoint)||[];e.push(t),QR.set(t.hookPoint,e)}var eP,nP=[],iP="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(eP||(eP={}));var rP,oP=function(t){return Object.freeze(t)},sP=function(t,e){this.inlineSize=t,this.blockSize=e,oP(this)},aP=function(){function t(t,e,n,i){return this.x=t,this.y=e,this.width=n,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,oP(this)}return t.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),lP=function(t){return t instanceof SVGElement&&"getBBox"in t},uP=function(t){if(lP(t)){var e=t.getBBox(),n=e.width,i=e.height;return!n&&!i}var r=t,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||t.getClientRects().length)},hP=function(t){var e,n;if(t instanceof Element)return!0;var i=null===(n=null===(e=t)||void 0===e?void 0:e.ownerDocument)||void 0===n?void 0:n.defaultView;return!!(i&&t instanceof i.Element)},cP="undefined"!=typeof window?window:{},dP=new WeakMap,pP=/auto|scroll/,fP=/^tb|vertical/,mP=/msie|trident/i.test(cP.navigator&&cP.navigator.userAgent),gP=function(t){return parseFloat(t||"0")},vP=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=!1),new sP((n?e:t)||0,(n?t:e)||0)},_P=oP({devicePixelContentBoxSize:vP(),borderBoxSize:vP(),contentBoxSize:vP(),contentRect:new aP(0,0,0,0)}),yP=function(t,e){if(void 0===e&&(e=!1),dP.has(t)&&!e)return dP.get(t);if(uP(t))return dP.set(t,_P),_P;var n=getComputedStyle(t),i=lP(t)&&t.ownerSVGElement&&t.getBBox(),r=!mP&&"border-box"===n.boxSizing,o=fP.test(n.writingMode||""),s=!i&&pP.test(n.overflowY||""),a=!i&&pP.test(n.overflowX||""),l=i?0:gP(n.paddingTop),u=i?0:gP(n.paddingRight),h=i?0:gP(n.paddingBottom),c=i?0:gP(n.paddingLeft),d=i?0:gP(n.borderTopWidth),p=i?0:gP(n.borderRightWidth),f=i?0:gP(n.borderBottomWidth),m=c+u,g=l+h,v=(i?0:gP(n.borderLeftWidth))+p,_=d+f,y=a?t.offsetHeight-_-t.clientHeight:0,x=s?t.offsetWidth-v-t.clientWidth:0,b=r?m+v:0,T=r?g+_:0,w=i?i.width:gP(n.width)-b-x,S=i?i.height:gP(n.height)-T-y,E=w+m+x+v,M=S+g+y+_,A=oP({devicePixelContentBoxSize:vP(Math.round(w*devicePixelRatio),Math.round(S*devicePixelRatio),o),borderBoxSize:vP(E,M,o),contentBoxSize:vP(w,S,o),contentRect:new aP(c,l,w,S)});return dP.set(t,A),A},xP=function(t,e,n){var i=yP(t,n),r=i.borderBoxSize,o=i.contentBoxSize,s=i.devicePixelContentBoxSize;switch(e){case eP.DEVICE_PIXEL_CONTENT_BOX:return s;case eP.BORDER_BOX:return r;default:return o}},bP=function(t){var e=yP(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=oP([e.borderBoxSize]),this.contentBoxSize=oP([e.contentBoxSize]),this.devicePixelContentBoxSize=oP([e.devicePixelContentBoxSize])},TP=function(t){if(uP(t))return 1/0;for(var e=0,n=t.parentNode;n;)e+=1,n=n.parentNode;return e},wP=function(){var t=1/0,e=[];nP.forEach((function(n){if(0!==n.activeTargets.length){var i=[];n.activeTargets.forEach((function(e){var n=new bP(e.target),r=TP(e.target);i.push(n),e.lastReportedSize=xP(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){n.callback.call(n.observer,i,n.observer)})),n.activeTargets.splice(0,n.activeTargets.length)}}));for(var n=0,i=e;n<i.length;n++){(0,i[n])()}return t},SP=function(t){nP.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(n){n.isActive()&&(TP(n.target)>t?e.activeTargets.push(n):e.skippedTargets.push(n))}))}))},EP=function(){var t,e=0;for(SP(e);nP.some((function(t){return t.activeTargets.length>0}));)e=wP(),SP(e);return nP.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:iP}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=iP),window.dispatchEvent(t)),e>0},MP=[],AP=function(t){if(!rP){var e=0,n=document.createTextNode("");new MutationObserver((function(){return MP.splice(0).forEach((function(t){return t()}))})).observe(n,{characterData:!0}),rP=function(){n.textContent=""+(e?e--:e++)}}MP.push(t),rP()},RP=0,PP={attributes:!0,characterData:!0,childList:!0,subtree:!0},CP=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],IP=function(t){return void 0===t&&(t=0),Date.now()+t},OP=!1,LP=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!OP){OP=!0;var n,i=IP(t);n=function(){var n=!1;try{n=EP()}finally{if(OP=!1,t=i-IP(),!RP)return;n?e.run(1e3):t>0?e.run(t):e.start()}},AP((function(){requestAnimationFrame(n)}))}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,PP)};document.body?e():cP.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),CP.forEach((function(e){return cP.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),CP.forEach((function(e){return cP.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),NP=function(t){!RP&&t>0&&LP.start(),!(RP+=t)&&LP.stop()},DP=function(){function t(t,e){this.target=t,this.observedBox=e||eP.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=xP(this.target,this.observedBox,!0);return t=this.target,lP(t)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),FP=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},BP=new WeakMap,UP=function(t,e){for(var n=0;n<t.length;n+=1)if(t[n].target===e)return n;return-1},kP=function(){function t(){}return t.connect=function(t,e){var n=new FP(t,e);BP.set(t,n)},t.observe=function(t,e,n){var i=BP.get(t),r=0===i.observationTargets.length;UP(i.observationTargets,e)<0&&(r&&nP.push(i),i.observationTargets.push(new DP(e,n&&n.box)),NP(1),LP.schedule())},t.unobserve=function(t,e){var n=BP.get(t),i=UP(n.observationTargets,e),r=1===n.observationTargets.length;i>=0&&(r&&nP.splice(nP.indexOf(n),1),n.observationTargets.splice(i,1),NP(-1))},t.disconnect=function(t){var e=this,n=BP.get(t);n.observationTargets.slice().forEach((function(n){return e.unobserve(t,n.target)})),n.activeTargets.splice(0,n.activeTargets.length)},t}(),GP=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");kP.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!hP(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");kP.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!hP(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");kP.unobserve(this,t)},t.prototype.disconnect=function(){kP.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),HP=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},zP=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},jP=function(){function t(t,e,n,i,r){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=n,this.index=t,this.slideIndex=e,this.eventHub=i,this.id=r}return t.prototype.apply=function(){return HP(this,void 0,void 0,(function(){var t;return zP(this,(function(e){switch(e.label){case 0:this.eventHub.emit("task-start",this),e.label=1;case 1:return e.trys.push([1,3,,4]),this.state="start",[4,this.fn()];case 2:return e.sent(),this.state="end",this.eventHub.emit("task-end",this),[3,4];case 3:return t=e.sent(),this.eventHub.emit("task-error",{task:this,error:t}),[3,4];case 4:return[2]}}))}))},t}(),VP=function(){function t(){var t=this;this.eventHub=new a.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",(function(e){var n,i=t.tasks.findIndex((function(t){return t.index===e.index})),r=i+1;r>=0&&(null===(n=t.tasks[r])||void 0===n||n.apply()),i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)})),this.eventHub.on("task-error",(function(e){var n=e.task,i=t.tasks.findIndex((function(t){return t.index===n.index}));i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask())}))}return t.prototype.replaceIdleTask=function(){for(var t,e=this,n=new Set,i=0,r=this.tasks.length;i<r;i++)"idle"===this.tasks[i].state&&"idle"===(null===(t=this.tasks[i+1])||void 0===t?void 0:t.state)&&n.add(i);Array.from(n).forEach((function(t){e.tasks.splice(t,1)}))},t.prototype.addTask=function(t,e,n){var i=new jP(this.index++,e,t,this.eventHub,n);this.tasks.push(i),this.tasks.sort((function(t,e){return t.index-e.index})),this.replaceIdleTask(),1===this.tasks.length&&i.apply()},t.prototype.hasStartTask=function(){return this.tasks.some((function(t){return"start"===t.state}))},t.prototype.destroy=function(){this.eventHub.removeAllListeners()},t}();function WP(t,e){var n=t.__state.conversionName.toString(),i=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),s=t.a,a=Math.round(t.h),l=t.s.toFixed(1),u=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=t.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+s+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+s+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+u+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+u+",a:"+s+"}":"unknown format"}var XP=Array.prototype.forEach,qP=Array.prototype.slice,YP={BREAK:{},extend:function(t){return this.each(qP.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))}),this),t},defaults:function(t){return this.each(qP.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))}),this),t},compose:function(){var t=qP.call(arguments);return function(){for(var e=qP.call(arguments),n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},each:function(t,e,n){if(t)if(XP&&t.forEach&&t.forEach===XP)t.forEach(e,n);else if(t.length===t.length+0){var i,r=void 0;for(r=0,i=t.length;r<i;r++)if(r in t&&e.call(n,t[r],r)===this.BREAK)return}else for(var o in t)if(e.call(n,t[o],o)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,n){var i=void 0;return function(){var r=this,o=arguments;function s(){i=null,n||t.apply(r,o)}var a=n||!i;clearTimeout(i),i=setTimeout(s,e),a&&t.apply(r,o)}},toArray:function(t){return t.toArray?t.toArray():qP.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return isNaN(t)})),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return t instanceof Function}},ZP=[{litmus:YP.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:WP},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:WP},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:WP},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:WP}}},{litmus:YP.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:YP.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:YP.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(YP.isNumber(t.r)&&YP.isNumber(t.g)&&YP.isNumber(t.b)&&YP.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(YP.isNumber(t.r)&&YP.isNumber(t.g)&&YP.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(YP.isNumber(t.h)&&YP.isNumber(t.s)&&YP.isNumber(t.v)&&YP.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(YP.isNumber(t.h)&&YP.isNumber(t.s)&&YP.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],JP=void 0,$P=void 0,KP=function(){$P=!1;var t=arguments.length>1?YP.toArray(arguments):arguments[0];return YP.each(ZP,(function(e){if(e.litmus(t))return YP.each(e.conversions,(function(e,n){if(JP=e.read(t),!1===$P&&!1!==JP)return $P=JP,JP.conversionName=n,JP.conversion=e,YP.BREAK})),YP.BREAK})),$P},QP=void 0,tC={hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),s=n*(1-r*e),a=n*(1-(1-r)*e),l=[[n,a,o],[s,n,o],[o,n,a],[o,s,n],[a,o,n],[n,o,s]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,n){var i=Math.min(t,e,n),r=Math.max(t,e,n),o=r-i,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=t===r?(e-n)/o:e===r?2+(n-t)/o:4+(t-e)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(QP=8*e)|t&~(255<<QP)}},eC="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nC=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},iC=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),rC=function t(e,n,i){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):void 0},oC=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},sC=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},aC=function(){function t(){if(nC(this,t),this.__state=KP.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return iC(t,[{key:"toString",value:function(){return WP(this)}},{key:"toHexString",value:function(){return WP(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function lC(t,e,n){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||aC.recalculateRGB(this,e,n),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(aC.recalculateRGB(this,e,n),this.__state.space="RGB"),this.__state[e]=t}})}function uC(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||aC.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(aC.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}aC.recalculateRGB=function(t,e,n){if("HEX"===t.__state.space)t.__state[e]=tC.component_from_hex(t.__state.hex,n);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");YP.extend(t.__state,tC.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},aC.recalculateHSV=function(t){var e=tC.rgb_to_hsv(t.r,t.g,t.b);YP.extend(t.__state,{s:e.s,v:e.v}),YP.isNaN(e.h)?YP.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},aC.COMPONENTS=["r","g","b","h","s","v","hex","a"],lC(aC.prototype,"r",2),lC(aC.prototype,"g",1),lC(aC.prototype,"b",0),uC(aC.prototype,"h"),uC(aC.prototype,"s"),uC(aC.prototype,"v"),Object.defineProperty(aC.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(aC.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=tC.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}});var hC=function(){function t(e,n){nC(this,t),this.initialValue=e[n],this.domElement=document.createElement("div"),this.object=e,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return iC(t,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),t}(),cC={};YP.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){YP.each(t,(function(t){cC[t]=e}))}));var dC=/(\d+(\.\d+)?)px/;function pC(t){if("0"===t||YP.isUndefined(t))return 0;var e=t.match(dC);return YP.isNull(e)?0:parseFloat(e[1])}var fC={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,n){var i=n,r=e;YP.isUndefined(r)&&(r=!0),YP.isUndefined(i)&&(i=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),i&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,n,i){var r=n||{},o=cC[e];if(!o)throw new Error("Event type "+e+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var a=r.x||r.clientX||0,l=r.y||r.clientY||0;s.initMouseEvent(e,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,a,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var u=s.initKeyboardEvent||s.initKeyEvent;YP.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),u(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(e,r.bubbles||!1,r.cancelable||!0)}YP.defaults(s,i),t.dispatchEvent(s)},bind:function(t,e,n,i){var r=i||!1;return t.addEventListener?t.addEventListener(e,n,r):t.attachEvent&&t.attachEvent("on"+e,n),fC},unbind:function(t,e,n,i){var r=i||!1;return t.removeEventListener?t.removeEventListener(e,n,r):t.detachEvent&&t.detachEvent("on"+e,n),fC},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var n=t.className.split(/ +/);-1===n.indexOf(e)&&(n.push(e),t.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return fC},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var n=t.className.split(/ +/),i=n.indexOf(e);-1!==i&&(n.splice(i,1),t.className=n.join(" "))}else t.className=void 0;return fC},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return pC(e["border-left-width"])+pC(e["border-right-width"])+pC(e["padding-left"])+pC(e["padding-right"])+pC(e.width)},getHeight:function(t){var e=getComputedStyle(t);return pC(e["border-top-width"])+pC(e["border-bottom-width"])+pC(e["padding-top"])+pC(e["padding-bottom"])+pC(e.height)},getOffset:function(t){var e=t,n={left:0,top:0};if(e.offsetParent)do{n.left+=e.offsetLeft,n.top+=e.offsetTop,e=e.offsetParent}while(e);return n},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},mC=function(t){function e(t,n){nC(this,e);var i=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;return i.__prev=i.getValue(),i.__checkbox=document.createElement("input"),i.__checkbox.setAttribute("type","checkbox"),fC.bind(i.__checkbox,"change",(function(){r.setValue(!r.__prev)}),!1),i.domElement.appendChild(i.__checkbox),i.updateDisplay(),i}return oC(e,t),iC(e,[{key:"setValue",value:function(t){var n=rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(hC),gC=function(t){function e(t,n,i){nC(this,e);var r=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i,s=r;if(r.__select=document.createElement("select"),YP.isArray(o)){var a={};YP.each(o,(function(t){a[t]=t})),o=a}return YP.each(o,(function(t,e){var n=document.createElement("option");n.innerHTML=e,n.setAttribute("value",t),s.__select.appendChild(n)})),r.updateDisplay(),fC.bind(r.__select,"change",(function(){var t=this.options[this.selectedIndex].value;s.setValue(t)})),r.domElement.appendChild(r.__select),r}return oC(e,t),iC(e,[{key:"setValue",value:function(t){var n=rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return fC.isActive(this.__select)?this:(this.__select.value=this.getValue(),rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(hC),vC=function(t){function e(t,n){nC(this,e);var i=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;function o(){r.setValue(r.__input.value)}return i.__input=document.createElement("input"),i.__input.setAttribute("type","text"),fC.bind(i.__input,"keyup",o),fC.bind(i.__input,"change",o),fC.bind(i.__input,"blur",(function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())})),fC.bind(i.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),i.updateDisplay(),i.domElement.appendChild(i.__input),i}return oC(e,t),iC(e,[{key:"updateDisplay",value:function(){return fC.isActive(this.__input)||(this.__input.value=this.getValue()),rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(hC);function _C(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var yC=function(t){function e(t,n,i){nC(this,e);var r=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i||{};return r.__min=o.min,r.__max=o.max,r.__step=o.step,YP.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=_C(r.__impliedStep),r}return oC(e,t),iC(e,[{key:"setValue",value:function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=_C(t),this}}]),e}(hC);var xC=function(t){function e(t,n,i){nC(this,e);var r=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,i));r.__truncationSuspended=!1;var o=r,s=void 0;function a(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function l(t){var e=s-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),s=t.clientY}function u(){fC.unbind(window,"mousemove",l),fC.unbind(window,"mouseup",u),a()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),fC.bind(r.__input,"change",(function(){var t=parseFloat(o.__input.value);YP.isNaN(t)||o.setValue(t)})),fC.bind(r.__input,"blur",(function(){a()})),fC.bind(r.__input,"mousedown",(function(t){fC.bind(window,"mousemove",l),fC.bind(window,"mouseup",u),s=t.clientY})),fC.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,a())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return oC(e,t),iC(e,[{key:"updateDisplay",value:function(){var t,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(t*i)/i),rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(yC);function bC(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}var TC=function(t){function e(t,n,i,r,o){nC(this,e);var s=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:i,max:r,step:o})),a=s;function l(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(bC(t.clientX,e.left,e.right,a.__min,a.__max)),!1}function u(){fC.unbind(window,"mousemove",l),fC.unbind(window,"mouseup",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(t){var e=t.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(bC(e,n.left,n.right,a.__min,a.__max))}function c(){fC.unbind(window,"touchmove",h),fC.unbind(window,"touchend",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),fC.bind(s.__background,"mousedown",(function(t){document.activeElement.blur(),fC.bind(window,"mousemove",l),fC.bind(window,"mouseup",u),l(t)})),fC.bind(s.__background,"touchstart",(function(t){if(1!==t.touches.length)return;fC.bind(window,"touchmove",h),fC.bind(window,"touchend",c),h(t)})),fC.addClass(s.__background,"slider"),fC.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return oC(e,t),iC(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(yC),wC=function(t){function e(t,n,i){nC(this,e);var r=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,fC.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),fC.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return oC(e,t),iC(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(hC),SC=function(t){function e(t,n){nC(this,e);var i=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.__color=new aC(i.getValue()),i.__temp=new aC(0);var r=i;i.domElement=document.createElement("div"),fC.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",fC.bind(i.__input,"keydown",(function(t){13===t.keyCode&&c.call(this)})),fC.bind(i.__input,"blur",c),fC.bind(i.__selector,"mousedown",(function(){fC.addClass(this,"drag").bind(window,"mouseup",(function(){fC.removeClass(r.__selector,"drag")}))})),fC.bind(i.__selector,"touchstart",(function(){fC.addClass(this,"drag").bind(window,"touchend",(function(){fC.removeClass(r.__selector,"drag")}))}));var o,s=document.createElement("div");function a(t){p(t),fC.bind(window,"mousemove",p),fC.bind(window,"touchmove",p),fC.bind(window,"mouseup",u),fC.bind(window,"touchend",u)}function l(t){f(t),fC.bind(window,"mousemove",f),fC.bind(window,"touchmove",f),fC.bind(window,"mouseup",h),fC.bind(window,"touchend",h)}function u(){fC.unbind(window,"mousemove",p),fC.unbind(window,"touchmove",p),fC.unbind(window,"mouseup",u),fC.unbind(window,"touchend",u),d()}function h(){fC.unbind(window,"mousemove",f),fC.unbind(window,"touchmove",f),fC.unbind(window,"mouseup",h),fC.unbind(window,"touchend",h),d()}function c(){var t=KP(this.value);!1!==t?(r.__color.__state=t,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientX,o=n.clientY,s=(i-e.left)/(e.right-e.left),a=1-(o-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),n=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return YP.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),YP.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),YP.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),YP.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),YP.extend(s.style,{width:"100%",height:"100%",background:"none"}),MC(s,"top","rgba(0,0,0,0)","#000"),YP.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=i.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",YP.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),fC.bind(i.__saturation_field,"mousedown",a),fC.bind(i.__saturation_field,"touchstart",a),fC.bind(i.__field_knob,"mousedown",a),fC.bind(i.__field_knob,"touchstart",a),fC.bind(i.__hue_field,"mousedown",l),fC.bind(i.__hue_field,"touchstart",l),i.__saturation_field.appendChild(s),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return oC(e,t),iC(e,[{key:"updateDisplay",value:function(){var t=KP(this.getValue());if(!1!==t){var e=!1;YP.each(aC.COMPONENTS,(function(n){if(!YP.isUndefined(t[n])&&!YP.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}}),this),e&&YP.extend(this.__color.__state,t)}YP.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;YP.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,MC(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),YP.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),e}(hC),EC=["-moz-","-o-","-webkit-","-ms-",""];function MC(t,e,n,i){t.style.background="",YP.each(EC,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+n+" 0%, "+i+" 100%); "}))}var AC=function(t,e){var n=e||document,i=document.createElement("style");i.type="text/css",i.innerHTML=t;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(t){}},RC='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',PC=function(t,e){var n=t[e];return YP.isArray(arguments[2])||YP.isObject(arguments[2])?new gC(t,e,arguments[2]):YP.isNumber(n)?YP.isNumber(arguments[2])&&YP.isNumber(arguments[3])?YP.isNumber(arguments[4])?new TC(t,e,arguments[2],arguments[3],arguments[4]):new TC(t,e,arguments[2],arguments[3]):YP.isNumber(arguments[4])?new xC(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new xC(t,e,{min:arguments[2],max:arguments[3]}):YP.isString(n)?new vC(t,e):YP.isFunction(n)?new wC(t,e,""):YP.isBoolean(n)?new mC(t,e):null};var CC=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},IC=function(){function t(){nC(this,t),this.backgroundElement=document.createElement("div"),YP.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),fC.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),YP.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;fC.bind(this.backgroundElement,"click",(function(){e.hide()}))}return iC(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),YP.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",fC.unbind(t.domElement,"webkitTransitionEnd",e),fC.unbind(t.domElement,"transitionend",e),fC.unbind(t.domElement,"oTransitionEnd",e)};fC.bind(this.domElement,"webkitTransitionEnd",e),fC.bind(this.domElement,"transitionend",e),fC.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-fC.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-fC.getHeight(this.domElement)/2+"px"}}]),t}();AC(function(t){if(t&&"undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var OC=function(){try{return!!window.localStorage}catch(t){return!1}}(),LC=void 0,NC=!0,DC=void 0,FC=!1,BC=[],UC=function t(e){var n=this,i=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),fC.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=YP.defaults(i,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),i=YP.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),YP.isUndefined(i.load)?i.load={preset:"Default"}:i.preset&&(i.load.preset=i.preset),YP.isUndefined(i.parent)&&i.hideable&&BC.push(this),i.resizable=YP.isUndefined(i.parent)&&i.resizable,i.autoPlace&&YP.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,o=OC&&"true"===localStorage.getItem(VC(this,"isLocal")),s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(t){n.parent?n.getRoot().preset=t:i.load.preset=t,function(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}(this),n.revert()}},width:{get:function(){return i.width},set:function(t){i.width=t,ZC(n,t)}},name:{get:function(){return i.name},set:function(t){i.name=t,a&&(a.innerHTML=i.name)}},closed:{get:function(){return i.closed},set:function(e){i.closed=e,i.closed?fC.addClass(n.__ul,t.CLASS_CLOSED):fC.removeClass(n.__ul,t.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return i.load}},useLocalStorage:{get:function(){return o},set:function(t){OC&&(o=t,t?fC.bind(window,"unload",s):fC.unbind(window,"unload",s),localStorage.setItem(VC(n,"isLocal"),t))}}}),YP.isUndefined(i.parent)){if(this.closed=i.closed||!1,fC.addClass(this.domElement,t.CLASS_MAIN),fC.makeSelectable(this.domElement,!1),OC&&o){n.useLocalStorage=!0;var l=localStorage.getItem(VC(this,"gui"));l&&(i.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,fC.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),i.closeOnTop?(fC.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(fC.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),fC.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===i.closed&&(i.closed=!0);var u=document.createTextNode(i.name);fC.addClass(u,"controller-name"),a=kC(n,u);fC.addClass(this.__ul,t.CLASS_CLOSED),fC.addClass(a,"title"),fC.bind(a,"click",(function(t){return t.preventDefault(),n.closed=!n.closed,!1})),i.closed||(this.closed=!1)}i.autoPlace&&(YP.isUndefined(i.parent)&&(NC&&(DC=document.createElement("div"),fC.addClass(DC,"dg"),fC.addClass(DC,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(DC),NC=!1),DC.appendChild(this.domElement),fC.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||ZC(n,i.width)),this.__resizeHandler=function(){n.onResizeDebounced()},fC.bind(window,"resize",this.__resizeHandler),fC.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),fC.bind(this.__ul,"transitionend",this.__resizeHandler),fC.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),i.resizable&&YC(this),s=function(){OC&&"true"===localStorage.getItem(VC(n,"isLocal"))&&localStorage.setItem(VC(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=s,i.parent||((r=n.getRoot()).width+=1,YP.defer((function(){r.width-=1})))};function kC(t,e,n){var i=document.createElement("li");return e&&i.appendChild(e),n?t.__ul.insertBefore(i,n):t.__ul.appendChild(i),t.onResize(),i}function GC(t){fC.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&fC.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function HC(t,e){var n=t.__preset_select[t.__preset_select.selectedIndex];n.innerHTML=e?n.value+"*":n.value}function zC(t,e){var n=t.getRoot(),i=n.__rememberedObjects.indexOf(e.object);if(-1!==i){var r=n.__rememberedObjectIndecesToControllers[i];if(void 0===r&&(r={},n.__rememberedObjectIndecesToControllers[i]=r),r[e.property]=e,n.load&&n.load.remembered){var o=n.load.remembered,s=void 0;if(o[t.preset])s=o[t.preset];else{if(!o.Default)return;s=o.Default}if(s[i]&&void 0!==s[i][e.property]){var a=s[i][e.property];e.initialValue=a,e.setValue(a)}}}}function jC(t,e,n,i){if(void 0===e[n])throw new Error('Object "'+e+'" has no property "'+n+'"');var r=void 0;if(i.color)r=new SC(e,n);else{var o=[e,n].concat(i.factoryArgs);r=PC.apply(t,o)}i.before instanceof hC&&(i.before=i.before.__li),zC(t,r),fC.addClass(r.domElement,"c");var s=document.createElement("span");fC.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var l=kC(t,a,i.before);return fC.addClass(l,UC.CLASS_CONTROLLER_ROW),r instanceof SC?fC.addClass(l,"color"):fC.addClass(l,eC(r.getValue())),function(t,e,n){if(n.__li=e,n.__gui=t,YP.extend(n,{options:function(e){if(arguments.length>1){var i=n.__li.nextElementSibling;return n.remove(),jC(t,n.object,n.property,{before:i,factoryArgs:[YP.toArray(arguments)]})}if(YP.isArray(e)||YP.isObject(e)){var r=n.__li.nextElementSibling;return n.remove(),jC(t,n.object,n.property,{before:r,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof TC){var i=new xC(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});YP.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=n[t],r=i[t];n[t]=i[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(i,t),e.apply(n,t)}})),fC.addClass(e,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof xC){var r=function(e){if(YP.isNumber(n.__min)&&YP.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=jC(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(i),r&&o.listen(),o}return e};n.min=YP.compose(r,n.min),n.max=YP.compose(r,n.max)}else n instanceof mC?(fC.bind(e,"click",(function(){fC.fakeEvent(n.__checkbox,"click")})),fC.bind(n.__checkbox,"click",(function(t){t.stopPropagation()}))):n instanceof wC?(fC.bind(e,"click",(function(){fC.fakeEvent(n.__button,"click")})),fC.bind(e,"mouseover",(function(){fC.addClass(n.__button,"hover")})),fC.bind(e,"mouseout",(function(){fC.removeClass(n.__button,"hover")}))):n instanceof SC&&(fC.addClass(e,"color"),n.updateDisplay=YP.compose((function(t){return e.style.borderLeftColor=n.__color.toString(),t}),n.updateDisplay),n.updateDisplay());n.setValue=YP.compose((function(e){return t.getRoot().__preset_select&&n.isModified()&&HC(t.getRoot(),!0),e}),n.setValue)}(t,l,r),t.__controllers.push(r),r}function VC(t,e){return document.location.href+"."+e}function WC(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function XC(t,e){e.style.display=t.useLocalStorage?"block":"none"}function qC(t){var e=t.__save_row=document.createElement("li");fC.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),fC.addClass(e,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",fC.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",fC.addClass(i,"button"),fC.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",fC.addClass(r,"button"),fC.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",fC.addClass(o,"button"),fC.addClass(o,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?YP.each(t.load.remembered,(function(e,n){WC(t,n,n===t.preset)})):WC(t,"Default",!1),fC.bind(s,"change",(function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value})),e.appendChild(s),e.appendChild(n),e.appendChild(i),e.appendChild(r),e.appendChild(o),OC){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(VC(0,"isLocal"))&&l.setAttribute("checked","checked"),XC(t,a),fC.bind(l,"change",(function(){t.useLocalStorage=!t.useLocalStorage,XC(t,a)}))}var u=document.getElementById("dg-new-constructor");fC.bind(u,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||LC.hide()})),fC.bind(n,"click",(function(){u.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),LC.show(),u.focus(),u.select()})),fC.bind(i,"click",(function(){t.save()})),fC.bind(r,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),fC.bind(o,"click",(function(){t.revert()}))}function YC(t){var e=void 0;function n(n){return n.preventDefault(),t.width+=e-n.clientX,t.onResize(),e=n.clientX,!1}function i(){fC.removeClass(t.__closeButton,UC.CLASS_DRAG),fC.unbind(window,"mousemove",n),fC.unbind(window,"mouseup",i)}function r(r){return r.preventDefault(),e=r.clientX,fC.addClass(t.__closeButton,UC.CLASS_DRAG),fC.bind(window,"mousemove",n),fC.bind(window,"mouseup",i),!1}t.__resize_handle=document.createElement("div"),YP.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),fC.bind(t.__resize_handle,"mousedown",r),fC.bind(t.__closeButton,"mousedown",r),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function ZC(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function JC(t,e){var n={};return YP.each(t.__rememberedObjects,(function(i,r){var o={},s=t.__rememberedObjectIndecesToControllers[r];YP.each(s,(function(t,n){o[n]=e?t.initialValue:t.getValue()})),n[r]=o})),n}UC.toggleHide=function(){FC=!FC,YP.each(BC,(function(t){t.domElement.style.display=FC?"none":""}))},UC.CLASS_AUTO_PLACE="a",UC.CLASS_AUTO_PLACE_CONTAINER="ac",UC.CLASS_MAIN="main",UC.CLASS_CONTROLLER_ROW="cr",UC.CLASS_TOO_TALL="taller-than-window",UC.CLASS_CLOSED="closed",UC.CLASS_CLOSE_BUTTON="close-button",UC.CLASS_CLOSE_TOP="close-top",UC.CLASS_CLOSE_BOTTOM="close-bottom",UC.CLASS_DRAG="drag",UC.DEFAULT_WIDTH=245,UC.TEXT_CLOSED="Close Controls",UC.TEXT_OPEN="Open Controls",UC._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||UC.toggleHide()},fC.bind(window,"keydown",UC._keydownHandler,!1),YP.extend(UC.prototype,{add:function(t,e){return jC(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return jC(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;YP.defer((function(){e.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&DC.removeChild(this.domElement);var t=this;YP.each(this.__folders,(function(e){t.removeFolder(e)})),fC.unbind(window,"keydown",UC._keydownHandler,!1),GC(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var n=new UC(e);this.__folders[t]=n;var i=kC(this,n.domElement);return fC.addClass(i,"folder"),n},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],GC(t);var e=this;YP.each(t.__folders,(function(e){t.removeFolder(e)})),YP.defer((function(){e.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var t=this.getRoot();if(t.scrollable){var e=fC.getOffset(t.__ul).top,n=0;YP.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(n+=fC.getHeight(e))})),window.innerHeight-e-20<n?(fC.addClass(t.domElement,UC.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(fC.removeClass(t.domElement,UC.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&YP.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:YP.debounce((function(){this.onResize()}),50),remember:function(){if(YP.isUndefined(LC)&&((LC=new IC).domElement.innerHTML=RC),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;YP.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&qC(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&ZC(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=JC(this)),t.folders={},YP.each(this.__folders,(function(e,n){t.folders[n]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=JC(this),HC(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=JC(this,!0)),this.load.remembered[t]=JC(this),this.preset=t,WC(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){YP.each(this.__controllers,(function(e){this.getRoot().load.remembered?zC(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),YP.each(this.__folders,(function(t){t.revert(t)})),t||HC(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&CC.call(window,(function(){t(e)}));YP.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){YP.each(this.__controllers,(function(t){t.updateDisplay()})),YP.each(this.__folders,(function(t){t.updateDisplay()}))}});var $C=UC,KC=function(){function t(t){this.runTime={fps:0,resolution:""},this.target=t.target,this.data=t.params,this.player=t.player,this.gui=this.createControllerGUI(),this.createStats(),this.addEventListener()}return t.prototype.createStats=function(){var t=this;this.stateId=setInterval((function(){t.player.view&&(t.controller.runTimeFps.setValue(t.player.fps.value),t.controller.drawCall.setValue(t.player.runtime.drawCall),t.controller.runTimeResolution.setValue(t.player.view.width+"*"+t.player.view.height))}),500)},t.prototype.createControllerGUI=function(){var t,e,n,i,r,o=new $C({autoPlace:!0,closed:!0});o.domElement.style.opacity=".6",o.domElement.style.transformOrigin="100% 0",o.domElement.style.transform="scale(1)",this.target.appendChild(o.domElement),o.domElement.style.position="absolute",o.domElement.style.right="0",o.domElement.style.top="0",o.domElement.style.zIndex="2";var s=o.add({FPS:0},"FPS",0),a=o.add({drawCall:0},"drawCall",0),l=o.add({"分辨率":""},"分辨率",""),u=o.add({"额外计算":0},"额外计算",0,200),h=o.addFolder("renderOptions");return this.controller={runTimeResolution:l,runTimeFps:s,drawCall:a,moreCalculation:u,minFPS:h.add({"最低fps":null!==(t=this.data.minFPS)&&void 0!==t?t:40},"最低fps",0,60),maxFPS:h.add({"最高fps":null!==(e=this.data.maxFPS)&&void 0!==e?e:50},"最高fps",0,60),resolution:h.add({"目标分辨倍率":null!==(n=this.data.resolution)&&void 0!==n?n:window.devicePixelRatio},"目标分辨倍率",.5,6),autoResolution:h.add({"自动分辨率":null!==(i=this.data.autoResolution)&&void 0!==i&&i},"自动分辨率",!0),autoFps:h.add({"自动fps":null===(r=this.data.autoFPS)||void 0===r||r},"自动fps",!0),transactionBgColor:h.addColor({"切页背景色":this.data.transactionBgColor},"切页背景色")},this.controller.runTimeFps.disabled=!0,this.controller.runTimeResolution.disabled=!0,o},t.prototype.addEventListener=function(){var t,e=this;this.controller.autoFps.onChange((function(t){e.data.autoFPS=t,e.player.updateConfig(e.data)})),this.controller.maxFPS.onChange((function(t){e.data.maxFPS=t,e.player.updateConfig(e.data)})),this.controller.minFPS.onChange((function(t){e.data.minFPS=t,e.player.updateConfig(e.data)})),this.controller.autoResolution.onChange((function(t){e.data.autoResolution=t,e.player.updateConfig(e.data)})),this.controller.resolution.onChange((function(t){e.data.resolution=t,e.player.updateConfig(e.data)})),this.controller.transactionBgColor.onChange((function(t){e.data.transactionBgColor=t,e.player.updateConfig(e.data)})),this.controller.moreCalculation.onChange((function(n){t&&e.player.app.ticker.remove(t),n>0&&(t=function(){for(var t="";t.length<8e3*n;)t+=Math.random().toString(32).substr(2);fM()(t)},e.player.app.ticker.add(t))}))},t.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.target.removeChild(this.gui.domElement),this.gui.destroy()}catch(t){}},t}(),QC=function(){function t(t){var e=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){e.isScheduling=!0;var t=e.tasks.shift();t&&!e.isDestroy&&e.fn(t).then((function(){e.tasks.length>0?window.requestAnimationFrame(e.schedule):e.isScheduling=!1}))},this.fn=t}return t.prototype.destroy=function(){this.isDestroy=!0},t.prototype.addTask=function(t){this.tasks.push(t),this.isScheduling||this.schedule()},t}(),tI=function(){function t(t){this.autoUnlock=Object.create(null),this.locks=Object.create(null),this.available=!1,this.available=t}return t.prototype.addLock=function(t,e){var n=this;this.available&&(this.locks[t]=e,this.autoUnlock[t]=window.setTimeout((function(){delete n.locks[t]}),3e3))},t.prototype.unlock=function(t,e){this.available&&e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t])},t.prototype.isLocked=function(t){return!!this.available&&!!this.locks[t]},t}(),eI=function(){function t(){var t=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){t.isScheduling=!0;var e=t.tasks.shift();e&&!t.isDestroy&&(e.status="running",e.fn.apply(null).then((function(){t.tasks.length>0?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})).catch((function(){t.tasks.length>0?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})))}}return t.prototype.getRunningTask=function(){return this.tasks[0]&&"running"===this.tasks[0].status?this.tasks[0]:null},t.prototype.addTask=function(t,e){var n={type:t,status:"wait",fn:e},i=this.getRunningTask();i&&t===i.type||(this.tasks=this.tasks.filter((function(e){return e.type!==t})),this.tasks.push(n),this.isScheduling||this.schedule())},t.prototype.destroy=function(){this.isDestroy=!0},t}(),nI=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),iI=function(){return(iI=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},rI=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},oI=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},sI=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},aI=window.ResizeObserver||GP,lI=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function uI(t,e){return oI(this,void 0,void 0,(function(){var n;return sI(this,(function(i){switch(i.label){case 0:n=Date.now(),i.label=1;case 1:return!t()&&Date.now()-n<e?[4,lI(50)]:[3,3];case 2:return i.sent(),[3,1];case 3:return[2]}}))}))}var hI={syncDispatch:"syncDispatch",syncReceive:"syncReceive",syncEventLag:"syncEventLag",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange"},cI={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},dI="";try{dI="0.5.14-alpha.0"}catch(t){dI="development"}var pI=null;try{pI=o.createInstance({name:"__slide_local_log__",driver:o.INDEXEDDB,version:1})}catch(t){}var fI=function(t){function e(n){var i=t.call(this)||this;return i.iosResetCache=[],i.needClearCacheImage=!1,i.version=dI,i.__slideState=Object(l.cloneDeep)(cI),i.userInputTime=0,i.isSyncingSlideState=!1,i.frozenTaskManager=new eI,i.randomId=Math.random().toString(32).substr(2),i.resize=!1,i.isAnimating=!1,i.renderingTaskManager=new VP,i.isLoading=!1,i.interactive=!0,i.renderingIndex=0,i.frameWidth=1,i.frameHeight=1,i.frame=document.createElement("div"),i.medianController=document.createElement("div"),i.frameResizeObserver=new aI((function(){return i.frameResizeHandler()})),i.timestamp=function(){return Date.now()},i.mode="local",i.enableGlobalClick=!1,i.lastEmitedState=null,i.playerController=null,i.isInitResized=!1,i.cacheImage=document.createElement("img"),i.isTouchStart=!1,i.touchStartId=void 0,i.taskId="",i.designWidth=0,i.designHeight=0,i._slideCount=0,i._dispatchIncrId=0,i._receiveIncrId=0,i.userInputHandle=function(){i.userInputTime=Date.now()},i.handleViewClick=function(){setTimeout((function(){var t=Date.now();Math.abs(t-i.userInputTime)>500&&i.enableGlobalClick&&i.nextStep()}))},i.handleViewTouchStart=function(){window.clearTimeout(i.touchStartId),i.isTouchStart=!0,i.touchStartId=setTimeout((function(){i.isTouchStart=!1}),350)},i.handleViewTouchEnd=function(){i.isTouchStart&&(i.isTouchStart=!1,i.handleViewClick())},i.handleSlideRef=function(){console.log(i),window.__slide=i},i.receiveSyncHandler=function(t){return oI(i,void 0,void 0,(function(){var e,n,i,r,o=this;return sI(this,(function(s){switch(s.label){case 0:return Object(l.isNumber)(t.incrId)&&(t.incrId&&t.incrId-this._receiveIncrId!=1&&this.emit(hI.syncEventLag),this._receiveIncrId=t.incrId||0),this.logger.info("sync receive "+JSON.stringify(t),this.taskId),"nextStep"!==t.type?[3,1]:(this.mainSeqStep!==t.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(t.next,"start"),this.player.nextTick((function(){o.doNextStep(!0)}))):this.doNextStep(!0),[3,6]);case 1:return"prevStep"!==t.type?[3,2]:(0===this.mainSeqStep&&"idle"===this.mainSeqState||this.mainSeqStep===t.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep(!0):(this.setMainSeqStep(t.next+1,"start"),null===(e=this.player)||void 0===e||e.nextTick((function(){o.doPrevStep(!0)}))),[3,6]);case 2:return"interactiveAnim"!==t.type?[3,3]:(this.player?this.player.applyInteractiveAction(t.action):this.__slideState.interactiveSeqState[t.seqId].step+=1,[3,6]);case 3:return"renderSlide"!==t.type?[3,5]:[4,this.doRenderSlide(t.index,t.isForward)];case 4:return s.sent(),[3,6];case 5:"mediaPlay"===t.type?(null===(n=this.player)||void 0===n||n.setMediaState(t.id,!0),this.__slideState.mediaState[t.id]=t.state):"mediaPause"===t.type?(null===(i=this.player)||void 0===i||i.setMediaState(t.id,!1),this.__slideState.mediaState[t.id]=t.state):"mediaSeek"===t.type&&(null===(r=this.player)||void 0===r||r.setMediaCurrentTime(t.id,t.time),this.__slideState.mediaState[t.id]=t.state),s.label=6;case 6:return[2]}}))}))},i.handlePrevSlide=function(t){return void 0===t&&(t=!1),oI(i,void 0,void 0,(function(){var e,n;return sI(this,(function(i){switch(i.label){case 0:return this.player?[4,null===(n=this.player)||void 0===n?void 0:n.createSnapshotForNextSlide(!0)]:[2];case 1:return i.sent(),(e=this.player.prevSlideIndex)>=1&&(this.config.navigatorDelegate?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!1):this.renderSlide(e,!1)),[2]}}))}))},i.handleNextSlide=function(t){return void 0===t&&(t=!1),oI(i,void 0,void 0,(function(){var e,n;return sI(this,(function(i){switch(i.label){case 0:return this.player?[4,null===(n=this.player)||void 0===n?void 0:n.createSnapshotForNextSlide(!1)]:[2];case 1:return i.sent(),(e=this.player.nextSlideIndex)<=this.slideCount&&(this.config.navigatorDelegate?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!0):this.renderSlide(e,!0)),[2]}}))}))},i.handleGotoSlide=function(t){if(t<=i.slideCount&&t>=1){var e=i.slideState.currentSlideIndex<=t;i.renderSlide(t,e)}else-1===t&&i.renderSlide(i.slideCount,!0)},i.config=i.initSlideConfig(n),i.logger={info:function(t,n){var r,o;(null===(r=i.config.logger)||void 0===r?void 0:r.info)&&(e._tempLog+="INFO - "+(new Date).toISOString()+" - {"+i.randomId+"}["+n+"] "+t+"\n\n",null===(o=i.config.logger)||void 0===o||o.info("["+n+"] "+t))},warn:function(t,n){var r,o;(null===(r=i.config.logger)||void 0===r?void 0:r.warn)&&(e._tempLog+="WARN - "+(new Date).toISOString()+" - {"+i.randomId+"}["+n+"] "+t+"\n\n",null===(o=i.config.logger)||void 0===o||o.warn("["+n+"] "+t))},error:function(t,n){var r,o;(null===(r=i.config.logger)||void 0===r?void 0:r.error)&&(e._tempLog+="ERROR - "+(new Date).toISOString()+" - {"+i.randomId+"}["+n+"] "+t+"\n\n",null===(o=i.config.logger)||void 0===o||o.error("["+n+"] "+t))}},i.anchor=i.config.anchor,i.syncQueue=new QC(i.receiveSyncHandler),i.lock=new tI("interactive"===i.mode),i.cacheImage.style.position="absolute",i.cacheImage.style.zIndex="100",i.setMedianControllerAttribute(),i.frame.appendChild(i.medianController),i.frameResizeObserver.observe(i.frame),i.on(hI.syncReceive,(function(t){i.lock.unlock(t.type,t.uuid),i.syncQueue.addTask(t)})),i.renderingTaskManager.eventHub.on("task-error",(function(t){var e=t.error,n=t.task,r=qE.transform(e);r.errorType===VE.RuntimeWarn?i.logger.warn(r.message,i.taskId):i.logger.error(r.message,i.taskId),i.isLoading=!1,i.emit(hI.renderError,{error:r,index:n.slideIndex})})),window.addEventListener("__slide_ref__",i.handleSlideRef),i.resizeView=Object(l.debounce)(i.resizeView.bind(i),50),i.player=i.initPlayer(i.config),i.config.controller&&i.createController(),i.player.view&&i.frame.appendChild(i.player.view),i.handleViewClick=Object(l.debounce)(i.handleViewClick,300),i.player.errorChannel.on("error",(function(t,e){var n=qE.transform(t);n.errorType===VE.RuntimeWarn?i.logger.warn(n.message,i.taskId):i.logger.error(n.message,i.taskId),i.isLoading=!1,e===i.renderingIndex&&i.emit(hI.renderError,{error:t,index:e})})),i}var n;return nI(e,t),e.flushLog=function(){return oI(this,void 0,void 0,(function(){return sI(this,(function(t){switch(t.label){case 0:return e._tempLog.length>0?[4,null==pI?void 0:pI.setItem("run_time_log_"+e._tempLogIndex,e._tempLog)]:[3,2];case 1:t.sent(),e._tempLog="",e._tempLogIndex+=1,t.label=2;case 2:return[2]}}))}))},Object.defineProperty(e.prototype,"dispatchIncrId",{get:function(){return this._dispatchIncrId++},enumerable:!1,configurable:!0}),e.prototype.initSlideConfig=function(t){return t.timestamp&&(this.timestamp=t.timestamp),t.rtcAudio&&(KR.RtcAudioClazz=t.rtcAudio),this.mode=t.mode,this.anchor=t.anchor,this.anchor.appendChild(this.frame),this.enableGlobalClick=!Object(l.isUndefined)(t.enableGlobalClick)&&t.enableGlobalClick,this.resize=t.resize||!1,this.interactive=t.interactive,this.frame.style.cssText=t.fixedFrameSize?"width:"+t.fixedFrameSize.width+"px;height:"+t.fixedFrameSize.height+"px;":"width:100%;height:100%",this.frame.style.cssText+="display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",t.fixedFrameSize&&(this.frameWidth=t.fixedFrameSize.width,this.frameHeight=t.fixedFrameSize.height),t},e.prototype.initPlayer=function(t){var e,n,i,r=this,o=new KR({mode:this.mode,useLocalCache:!!Object(l.isUndefined)(this.config.useLocalCache)||this.config.useLocalCache,logger:this.logger,resourceTimeout:Object(l.isUndefined)(this.config.resourceTimeout)?15e3:this.config.resourceTimeout,loadDelegate:this.config.loaderDelegate});return o.setInteractive(this.interactive),o.updateConfig(t.renderOptions||{}),o.on($R.renderStart,(function(t){r.isLoading=!0,r.emit(hI.renderStart,t)})),o.on($R.renderEnd,(function(t){r.isLoading=!1,r.player&&(r.designHeight=r.player.designHeight,r.designWidth=r.player.designWidth,r.cacheImage.style.width=r.player.designWidth+"px",r.cacheImage.style.height=r.player.designHeight+"px",r._slideCount=r.player.slideCount),r.emit(hI.renderEnd,t)})),o.on($R.slideChange,(function(t){r.__slideState.currentSlideIndex=t,r.emitStateChange(),r.emit(hI.slideChange,t)})),o.on($R.mainSeqStateChange,(function(t){r.__slideState.mainSeqState=t,r.emitStateChange()})),o.on($R.mainSeqStepChange,(function(t){r.__slideState.mainSeqStep=t,r.emitStateChange()})),o.on($R.interactiveSeqStateChange,(function(t){var e=t.id,n=t.state;r.__slideState.interactiveSeqState[e]=n,r.emitStateChange()})),o.on($R.animateStart,(function(){!0!==r.isAnimating&&(r.isAnimating=!0,r.emit(hI.animateStart))})),o.on($R.animateEnd,(function(){!1!==r.isAnimating&&(r.isAnimating=!1,r.emit(hI.animateEnd))})),o.on($R.interactiveSeqAction,(function(t){var e=t.action,n=t.seqId;r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"interactiveAnim",action:e,seqId:n}),r.emitStateChange()})),o.on($R.mainSeqStepStart,(function(t){r.emit(hI.mainSeqStepStart,t)})),o.on($R.mainSeqStepEnd,(function(t){r.emit(hI.mainSeqStepEnd,t)})),o.on($R.mediaPlay,(function(t){var e={type:"play",time:r.timestamp()-1e3*t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:e}),r.emitStateChange()})),o.on($R.mediaPause,(function(t){var e={type:"pause",time:t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:e}),r.emitStateChange()})),o.on($R.mediaSeek,(function(t){var e={type:"pause",time:0};t.isPlaying?(e.type="play",r.__slideState.mediaState[t.id]?e.time=r.__slideState.mediaState[t.id].time-1e3*t.time:e.time=r.timestamp()-1e3*t.time,r.__slideState.mediaState[t.id]=e):(e.type="pause",e.time=t.time,r.__slideState.mediaState[t.id]=e),r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaSeek",id:t.id,time:t.time,state:e}),r.emitStateChange()})),o.on($R.requestPrevSlide,(function(t){r.handlePrevSlide(t)})),o.on($R.requestNextSlide,(function(t){r.handleNextSlide(t)})),o.on($R.requestGotoSlide,(function(t){r.config.navigatorDelegate?r.config.navigatorDelegate.gotoPage(t):r.handleGotoSlide(t)})),null===(e=o.view)||void 0===e||e.addEventListener("touchend",this.handleViewTouchEnd),null===(n=o.view)||void 0===n||n.addEventListener("touchstart",this.handleViewTouchStart),null===(i=o.view)||void 0===i||i.addEventListener("click",this.handleViewClick),o.on($R.userInput,this.userInputHandle),o},e.prototype.createController=function(){this.player&&(this.playerController=new KC({player:this.player,params:this.player.config||{},target:this.frame}))},e.prototype.setMedianControllerAttribute=function(){this.medianController.className="median-container",this.medianController.style.position="absolute",this.medianController.style.left="0",this.medianController.style.top="0",this.medianController.style.zIndex="2"},e.prototype.frameResizeHandler=function(){if(!this.config.fixedFrameSize){var t=this.frame.getBoundingClientRect(),e=t.width,n=t.height;this.frameWidth=e,this.frameHeight=n,this.resizeView()}},e.prototype.updateFixedFrameSize=function(t,e,n){this.config.fixedFrameSize&&(this.frameWidth=t,this.frameHeight=e,this.frame.style.width=t+"px",this.frame.style.height=e+"px",this.resizeView(n))},e.prototype.resizeView=function(t){var e,n,i=this,r=this.width,o=this.height;if(r>0&&o>0){var s=this.frameWidth/r,a=s*o;a>this.frameHeight&&(s*=this.frameHeight/a),null===(e=this.player)||void 0===e||e.scaleView(s,this.resize,t),this.cacheImage.style.transform="scale("+s+")",this.medianController.style.transform="scale("+s+")",this.medianController.style.top=(this.frameHeight-o*s)/2+"px",this.medianController.setAttribute("data-scale",s.toString()),this.isInitResized||(this.isInitResized=!0,null===(n=this.player)||void 0===n||n.clock.setTimeout((function(){i.frame.style.visibility="visible"}),32))}},e.prototype.setSlideState=function(t){var e,n,i;return oI(this,void 0,void 0,(function(){var r,o=this;return sI(this,(function(s){switch(s.label){case 0:return this.isSyncingSlideState=!0,this.logger.info("stateChange receive "+JSON.stringify(t),this.taskId),t.taskId&&t.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=t.taskId,null===(e=this.player)||void 0===e||e.setResourceData(t.taskId,this.__slideState.url)),t.url&&t.url!==this.__slideState.url&&(this.__slideState.url=t.url,null===(n=this.player)||void 0===n||n.setResourceData(this.__slideState.taskId,t.url)),Number.isInteger(t.currentSlideIndex)&&t.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=t.currentSlideIndex,[4,this.doRenderSlide(t.currentSlideIndex)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[4,null===(i=this.player)||void 0===i?void 0:i.clock.waitUntil((function(){var e,n;return(null===(e=o.player)||void 0===e?void 0:e.currentIndex)===t.currentSlideIndex&&(null===(n=o.player)||void 0===n?void 0:n.currentStage)}),3e3)];case 3:return s.sent(),r=!1,Number.isInteger(t.mainSeqStep)&&t.mainSeqStep!==this.__slideState.mainSeqStep&&(r=!0,this.__slideState.mainSeqStep=t.mainSeqStep),t.mainSeqState&&t.mainSeqState!==this.__slideState.mainSeqState&&(r=!0,this.__slideState.mainSeqState=t.mainSeqState),r&&this.setMainSeqStep(this.__slideState.mainSeqStep,"idle"===this.__slideState.mainSeqState?"start":"end"),t.mediaState&&(this.initMedia(t),this.__slideState.mediaState=t.mediaState),t.interactiveSeqState&&(this.initInteractiveSeq(t),this.__slideState.interactiveSeqState=t.interactiveSeqState),this.isSyncingSlideState=!1,[2]}}))}))},e.prototype.initInteractiveSeq=function(t){var e;for(var n in t.interactiveSeqState){var i=t.interactiveSeqState[n];null===(e=this.player)||void 0===e||e.setInteractiveSeqState(n,i.step,"end"===i.state?"end":"start")}},e.prototype.initMedia=function(t){var e,n,i=this,r=function(r){var s=t.mediaState[r],a=o.__slideState.mediaState[r];if(a&&s.type===a.type&&s.time===a.time)return"continue";"play"===s.type?null===(e=o.player)||void 0===e||e.setMediaState(r,!0).then((function(){var t,e=i.timestamp();null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,(e-s.time)/1e3)})):null===(n=o.player)||void 0===n||n.setMediaState(r,!1).then((function(){var t;null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,s.time)}))},o=this;for(var s in t.mediaState)r(s)},Object.defineProperty(e.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),e.prototype.getSizeAsync=function(){return oI(this,void 0,void 0,(function(){var t;return sI(this,(function(e){switch(e.label){case 0:if(this.width>0&&this.height>0)return[2,[this.width,this.height]];e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,e.sent().json()];case 3:return[2,[(t=e.sent()).width,t.height]];case 4:return e.sent(),[2,[0,0]];case 5:return[2]}}))}))},e.prototype.getSlideCountAsync=function(){return oI(this,void 0,void 0,(function(){return sI(this,(function(t){switch(t.label){case 0:if(this._slideCount>0)return[2,this._slideCount];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,t.sent().json()];case 3:return[2,t.sent().slideCount];case 4:return t.sent(),[2,0];case 5:return[2]}}))}))},Object.defineProperty(e.prototype,"slideState",{get:function(){return this.__slideState.mainSeqState=this.mainSeqState,this.__slideState.mainSeqStep=this.mainSeqStep,JSON.parse(JSON.stringify(this.__slideState))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqLength",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqStep",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqState",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderOptions",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawCall",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"runtimeFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"view",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),e.prototype.updateRenderOption=function(t){this.player&&(this.player.updateConfig(t),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},e.prototype.setResource=function(t,e){var n;this.taskId=t,null===(n=this.player)||void 0===n||n.setResourceData(t,e),this.__slideState.taskId=t,this.__slideState.url=e,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:t,url:e})},e.prototype._renderSlide=function(t){var e;return oI(this,void 0,void 0,(function(){var n=this;return sI(this,(function(i){switch(i.label){case 0:return this.renderingIndex=t,this.player&&t===this.player.currentIndex?[2]:((KR.platform.isIOS()||KR.platform.isAndroid())&&this.iosResetCache.indexOf(t)<0&&this.iosResetCache.push(t),[4,null===(e=this.player)||void 0===e?void 0:e.renderSlide(t)]);case 1:return i.sent(),this.__slideState.currentSlideIndex=t,this.resizeView(),this.__slideState.interactiveSeqState={},this.emitStateChange(),setTimeout((function(){var t,e;if("hidden"===(null===(e=null===(t=n.player)||void 0===t?void 0:t.view)||void 0===e?void 0:e.style.visibility)&&(n.player.view.style.visibility="visible"),"hidden"===n.frame.style.visibility&&(n.frame.style.visibility="visible"),n.needClearCacheImage)try{n.frame.removeChild(n.cacheImage)}catch(t){}}),100),[2]}}))}))},e.prototype.renderSlide=function(t,e){if(void 0===e&&(e=!0),this.player){var n=Number(t);(n!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(n>this.slideCount&&this.slideCount>0||this.poseRenderSlide(n,e))}},e.prototype.needCreateNewPlayer=function(){var t=KR.platform.isLowGpuMemory()?15:30;return(KR.platform.isIOS()||KR.platform.isAndroid())&&this.iosResetCache.length>t},e.prototype.poseRenderSlide=function(t,e){"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e}):"sync"===this.mode?(this.doRenderSlide(t,e),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e})):this.doRenderSlide(t,e)},e.prototype.doRenderSlide=function(t,e){var n,i,r,o=this;if(void 0===e&&(e=!0),!this.player)return Promise.resolve();if(this.needCreateNewPlayer()&&(this.iosResetCache=[],this.iosNewPlayer=this.initPlayer(this.config),this.iosNewPlayer.setResourceData(this.__slideState.taskId,this.__slideState.url)),this.iosNewPlayer){var s=this.player.getSnapshot();this.cacheImage.src=s,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(n=this.playerController)||void 0===n||n.destroy(),this.player=this.iosNewPlayer,this.iosNewPlayer=void 0,(null===(i=this.config)||void 0===i?void 0:i.controller)&&this.createController(),this.needClearCacheImage=!0,(null===(r=null==this?void 0:this.player)||void 0===r?void 0:r.view)&&(this.player.view.style.visibility="hidden",this.frame.appendChild(this.player.view))}var a=Math.random().toString(32).substr(2);return this.player.isForward=e,this.renderingTaskManager.addTask((function(){return o._renderSlide(t)}),t,a),new Promise((function(t){o.renderingTaskManager.eventHub.once("task-end-"+a,t)}))},e.prototype.nextStep=function(){!this.isLoading&&this.player&&this.interactive?this.player.mainSeqHasNextStep()?"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):"sync"===this.mode?(this.doNextStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep():this.handleNextSlide():this.logger.info("prevent nextStep. "+this.isLoading+" "+this.player+" "+this.interactive,this.taskId)},e.prototype.doNextStep=function(t){if(void 0===t&&(t=!1),this.player){this.player.nextStep(t);var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},e.prototype.prevStep=function(){!this.isLoading&&this.player&&this.interactive?this.player.mainSeqHasPrevStep()?"interactive"===this.mode?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):"sync"===this.mode?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide():this.logger.info("prevent nextStep. "+this.isLoading+" "+this.player+" "+this.interactive,this.taskId)},e.prototype.doPrevStep=function(t){if(void 0===t&&(t=!1),this.player){this.player.prevStep(t);var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},e.prototype.isSlideStateReady=function(t){return t.taskId.length>0&&t.url.length>0&&t.currentSlideIndex>0},e.prototype.emitStateChange=function(){if("local"!==this.mode&&!this.isSyncingSlideState){var t=this.slideState;!Object(l.isEqual)(this.lastEmitedState,t)&&this.isSlideStateReady(t)&&(this.lastEmitedState=t,this.emit(hI.stateChange,t),this.logger.info("stateChange dispatch "+JSON.stringify(this.slideState),this.taskId))}},e.prototype.emitSyncDispatch=function(t){if(!this.lock.isLocked(t.type)){var e=Math.random().toString(32).substr(2);this.lock.addLock(t.type,e);var n=iI(iI({},t),{uuid:e});"sync"===this.config.mode&&(n.incrId=this.dispatchIncrId),this.emit(hI.syncDispatch,n),this.logger.info("sync dispatch "+JSON.stringify(n),this.taskId)}},e.prototype.setMainSeqStep=function(t,e){var n;null===(n=this.player)||void 0===n||n.setMainSeqStep(t,e)},e.prototype.setInteractive=function(t){var e;this.interactive=t,null===(e=this.player)||void 0===e||e.setInteractive(t)},e.prototype.pause=function(){var t;null===(t=this.player)||void 0===t||t.pause()},e.prototype.resume=function(){var t;null===(t=this.player)||void 0===t||t.resume()},e.prototype._doFrozen=function(){var t;return oI(this,void 0,void 0,(function(){var e,n,i,r=this;return sI(this,(function(o){switch(o.label){case 0:return this.view&&this.player?[4,this.player.clock.waitUntil((function(){return!r.isLoading}),6e4)]:[3,2];case 1:for(n in o.sent(),e=this.player.getSnapshot()||"",this.cacheImage.src=e,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(t=this.playerController)||void 0===t||t.destroy(),this.player=void 0,this.__slideState.mediaState)i=this.__slideState.mediaState[n],this.__slideState.mediaState[n]=iI(iI({},i),{frozenTime:this.timestamp()});o.label=2;case 2:return[2]}}))}))},e.prototype.frozen=function(){var t=this;this.frozenTaskManager.addTask("frozen",(function(){return t._doFrozen()}))},e.prototype._doRelease=function(){var t,e;return oI(this,void 0,void 0,(function(){var n,i,r,o;return sI(this,(function(s){switch(s.label){case 0:if(this.player)return[2];for(i in this.player=this.initPlayer(this.config),(null===(t=this.config)||void 0===t?void 0:t.controller)&&this.createController(),this.player.view&&(this.frame.appendChild(this.player.view),this.player.view.style.visibility="hidden"),n=this.__slideState,this.__slideState=Object(l.cloneDeep)(cI),n.mediaState)"play"===(r=n.mediaState[i]).type&&(o=Math.max(null!==(e=r.frozenTime)&&void 0!==e?e:0,r.time),r.time=this.timestamp()-(o-r.time),r.frozenTime=void 0);return[4,this.setSlideState(n)];case 1:return s.sent(),[4,this.player.clock.delay(333)];case 2:s.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch(t){}return[2]}}))}))},e.prototype.release=function(){var t=this;this.frozenTaskManager.addTask("release",(function(){return t._doRelease()}))},e.prototype._doDestroy=function(){var t,e,n,i;this.logger.info("do destroy slide",""),this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),null===(t=this.player)||void 0===t||t.removeAllListeners(),null===(e=this.player)||void 0===e||e.destroy(),null===(n=this.player)||void 0===n||n.removeAllListeners(),this.logger={warn:function(){return{}},info:function(){return{}},error:function(){return{}}},this.syncQueue.destroy(),this.renderingTaskManager.destroy(),this.frozenTaskManager.destroy(),window.removeEventListener("__slide_ref__",this.handleSlideRef),this.removeAllListeners();try{(null===(i=this.player)||void 0===i?void 0:i.view)&&this.anchor.removeChild(this.player.view),this.anchor.removeChild(this.frame)}catch(t){}},e.prototype.waitLoadEnd=function(){return oI(this,void 0,void 0,(function(){var t;return sI(this,(function(e){switch(e.label){case 0:t=0,e.label=1;case 1:return this.isLoading&&t<10?[4,lI(100)]:[3,3];case 2:return e.sent(),t+=1,[3,1];case 3:return[2]}}))}))},e.prototype.destroy=function(){var t=this;this.logger.info("pre destroy slide",""),this.isLoading?this.waitLoadEnd().then((function(){t._doDestroy()})):this._doDestroy()},e.prototype.clearSlideCache=function(){var t;null===(t=this.player)||void 0===t||t.clearLocalCache()},e.prototype.hasNextStep=function(){if(!this.player)return!1;var t=this.player.currentIndex===this.slideCount,e=0===this.mainSeqLength||this.mainSeqStep>=this.mainSeqLength-1,n="end"===this.mainSeqState||"running"===this.mainSeqState||null==this.mainSeqState;return!(t&&e&&n)},e.prototype.hasPrevStep=function(){if(!this.player)return!1;var t=1===this.player.currentIndex,e=0===this.mainSeqLength||0===this.mainSeqStep,n="idle"===this.mainSeqState||null===this.mainSeqState;return!(t&&e&&n)},e.clearLocalCache=function(){KR.clearLocalCache()},e.disposeLocalCache=function(){},e._tempLog="",e._tempLogIndex=1,e.usePlugin=tP,e.handleLogDownload=function(){return oI(void 0,void 0,void 0,(function(){var t,e,n,i,r,o,s;return sI(this,(function(a){switch(a.label){case 0:return t="",pI?[4,pI.keys()]:[3,5];case 1:e=(a.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),n=0,i=e,a.label=2;case 2:return n<i.length?(r=i[n],o=t,[4,pI.getItem(r)]):[3,5];case 3:t=o+(a.sent()||""),a.label=4;case 4:return n++,[3,2];case 5:return(s=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),s.setAttribute("download","slide_log"),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),window.__slideLogText=t,[2]}}))}))},rI([(n="Slide.initConfig",function(t,e,i){var r=i.value;i.value=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=QR.get(n)||[],o=t,s=0,a=i;s<a.length;s++){var l=a[s];try{o=l.before(o)}catch(t){}if(!Array.isArray(o)||o.length!==t.length)throw new Error("plugin before hook return invalid args")}for(var u=r.bind(this).apply(void 0,o),h=0,c=i.reverse();h<c.length;h++){l=c[h];try{u=l.after(u)}catch(t){}if(!u)throw new Error("plugin after hook return undefined result")}return u}})],e.prototype,"initSlideConfig",null),e}(a.a);null==pI||pI.clear(),window.addEventListener("__slide_log__",fI.handleLogDownload),window.setInterval((function(){fI.flushLog().catch((function(){}))}),9e3)}]);
250
+ */vb.registerPlugin("accessibility",ny),vb.registerPlugin("extract",Fb),vb.registerPlugin("interaction",py),vb.registerPlugin("particle",$T),vb.registerPlugin("prepare",iS),vb.registerPlugin("batch",Ab),vb.registerPlugin("tilingSprite",cS),Kb.registerPlugin(NS),Kb.registerPlugin(cT),Kb.registerPlugin(PT),Kb.registerPlugin(WT),Kb.registerPlugin(oS),Lb.registerPlugin(oy),Lb.registerPlugin(Qb);var VE,WE={AlphaFilter:FS,BlurFilter:aE,BlurFilterPass:sE,ColorMatrixFilter:uE,DisplacementFilter:cE,FXAAFilter:pE,NoiseFilter:NE};class XE extends a.a{constructor(){super(),this.prevTime=-1,this.times=0,this.valueTotal=0,this.destroyed=!1,this.value=0,this.calcFps()}calcFps(){requestAnimationFrame(t=>{const e=t-this.prevTime;this.valueTotal+=e,this.times+=1,this.times>20&&(this.value=Math.floor(1e3*this.times/this.valueTotal),this.valueTotal=0,this.times=0,this.destroyed||this.emit("update",this.value)),this.prevTime=t,this.destroyed||this.calcFps()})}destroy(){this.destroyed=!0}}!function(t){t.ResourceError="RESOURCE_ERROR",t.RuntimeError="RUNTIME_ERROR",t.RuntimeWarn="RUNTIME_WARN",t.CanvasCrash="CANVAS_CRASH"}(VE||(VE={}));class qE extends Error{constructor(t,e){var n,i;super(e),n=this,i=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(n,i):n.__proto__&&(n.__proto__=i),this.errorType=t,this.errorMsg=e}static transform(t){return t instanceof qE?t:new qE(VE.RuntimeError,t.message)}}function YE(){return function(t,e,n){const i=n.value;n.value=function(...t){try{return i.apply(this,t)}catch(t){throw new qE(VE.RuntimeWarn,t.message)}}}}var ZE=n(6),JE=n.n(ZE);function $E(t,e,n=5){return Math.abs(t-e)<=Math.pow(10,-n)}function KE(t){return Math.floor(1e6*t)/1e6}class QE{constructor(){this.point={x:0,y:0},this.slope=Math.PI/4}static fromPointSlope(t,e){const n=new QE;return n.point=t,n.slope=e,n}resolveY(t){return Math.tan(this.slope)*(t-this.point.x)+this.point.y}distanceToLinearEquation(t){return $E(this.slope,t.slope)?this.distanceToPoint(t.point):-1}distanceToPoint(t){let e=0;if(Math.tan(this.slope)*(t.x-this.point.x)+this.point.y===t.y)return 0;e=this.slope>=Math.PI/2?this.slope-Math.PI/2:Math.PI/2+this.slope;const n=QE.fromPointSlope(t,e),i=this.crossPoint(n);return i?Math.ceil(Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2))):0}crossPoint(t){if($E(t.slope,this.slope))return null;let e=0,n=0;const i=Math.tan(t.slope),r=Math.tan(this.slope),{x:o,y:s}=this.point,{x:a,y:l}=t.point;return $E(this.slope,Math.PI/2)?(e=this.point.x,n=i*(e-a)+l):$E(t.slope,Math.PI/2)?(e=t.point.x,n=r*(e-o)+s):$E(this.slope,Math.PI)||$E(this.slope,0)?(n=this.point.y,e=(n-l)/i+a):$E(t.slope,Math.PI)||$E(t.slope,0)?(n=t.point.y,e=(n-s)/r+o):(e=(i*a-l+s-r*o)/(i-r),n=r*(e-o)+s),{x:e,y:n}}}var tM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function eM(){return Date.now().toString(32)+Math.random().toString(32).substring(2)}const nM="__delay_resolve_result__";function iM(t,e){return tM(this,void 0,void 0,(function*(){const n=yield Promise.race([t(),(i=e,new Promise(t=>{setTimeout(()=>{t(nM)},i)}))]);var i;return n===nM?nM:n}))}var rM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function oM(t,e){return rM(this,void 0,void 0,(function*(){const n=yield iM(()=>fetch(t),e);if(n===nM)throw new qE(VE.ResourceError,`"${t}" loaded timeout"`);if(!n.ok)throw new qE(VE.ResourceError,`"${t}" loaded failed with status "${n.status}"`);return n}))}class sM{constructor(t,e,n,i,r){this.timeout=15e3,this.useCache=!1,this.taskId="",this.delegate=null,this.useCache=e,this.localStorage=t,this.logger=n,this.timeout=i,this.delegate=r||null}attachTaskId(t){this.taskId=t}fetchJson(t){return rM(this,void 0,void 0,(function*(){let e;if(this.useCache&&(this.logger.info("load resource from cache. "+t,this.taskId||""),e=yield this.localStorage.getItem(t)),e)return this.logger.info("cache hit. "+t,this.taskId||""),e;{let e;if(this.delegate){this.logger.info("load resource by delegate. "+t,this.taskId||"");const n=yield iM(()=>this.delegate.loadJson(t),this.timeout);if(n===nM)throw new qE(VE.ResourceError,`"${t}" loaded timeout"`);e=JSON.parse(n)}else this.logger.info("load resource from server. "+t,this.taskId||""),e=yield(yield oM(""+t,this.timeout)).json();return this.logger.info("load end. "+t,this.taskId||""),this.useCache&&this.localStorage.setItem(t,e).catch(()=>{}),e}}))}fetchPng(t){return rM(this,void 0,void 0,(function*(){let e;if(this.useCache&&(this.logger.info("load resource from cache. "+t,this.taskId||""),e=yield this.localStorage.getItem(t)),e)return this.logger.info("cache hit. "+t,this.taskId||""),e;{let n;if(this.delegate){if(this.logger.info("load resource by delegate. "+t,this.taskId||""),n=yield iM(()=>this.delegate.loadImage(t),this.timeout),n===nM)throw new qE(VE.ResourceError,`"${t}" loaded timeout"`)}else{this.logger.info("load resource from server. "+t,this.taskId||"");const e=yield oM(t,this.timeout);n=yield e.blob()}return e=yield function(t){return new Promise((e,n)=>{const i=new FileReader;i.onload=()=>{e(i.result)},i.onerror=()=>{n(new qE(VE.ResourceError,"Failed parse blob data."))},i.readAsDataURL(t)})}(n),this.logger.info("load end. "+t,this.taskId||""),this.useCache&&this.localStorage.setItem(t,e).catch(()=>{}),e}}))}destroy(){}}var aM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class lM{constructor(t){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=t=>{const e=t/(mv.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=e,this.callbackList=this.callbackList.filter(t=>t&&!t.applied);let{length:t}=this.callbackList;for(let e=0;e<t;e++){const n=this.callbackList[e];if(n&&!n.applied){if(!(n.triggerTime<=this.timestamp))break;n.running=!0,n.fn(),n.applied=!0,t=this.callbackList.length}}}},this.ticker=t,this.ticker.add(this.onTimeUpdate)}setTimeout(t,e){const n=eM(),i=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:t,triggerTime:i,id:n,applied:!1,running:!1}),this.callbackList.sort((t,e)=>t.triggerTime-e.triggerTime),n}clearTimeout(t){const e=this.callbackList.findIndex(e=>e.id===t);e>=0&&!this.callbackList[e].running&&this.callbackList.splice(e,1)}delay(t){return new Promise(e=>{this.setTimeout(e,t)})}waitUntil(t,e){return aM(this,void 0,void 0,(function*(){const n=this.timestamp;for(;!t()&&this.timestamp-n<e;)yield this.delay(50)}))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var uM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function hM(t,e,n){return n?Math.floor(parseFloat(t)*e):Math.ceil(parseFloat(t)*e)}const cM={w:!0,h:!0,x:!1,y:!1};class dM{constructor(t){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.loader=t}getTexture(t){return this.textures[t]||null}getFrameData(t){return this.frames[t]}getGifFrames(t){return this.gifs[t]?this.gifs[t].filter(t=>!!t):[]}loadSpriteSheetItem(t,e,n,i){return uM(this,void 0,void 0,(function*(){const r=yield this.loader.fetchJson(`${t}/${e}/jsonOutput/${n}.json`),o=yield this.loader.fetchPng(`${t}/${e}/jsonOutput/${n}.png`),s=document.createElement("img");s.src=o,yield new Promise((t,e)=>{s.onload=()=>t(""),s.onerror=()=>e()});let a=i;const l=s.width||1,u=s.height||1;if(l>2048||u>2048){a*=2048/l;const t=a*u;t>2048&&(a*=u/t)}!function(t,e){t.meta&&t.meta.size&&["w","h"].forEach(n=>{t.meta.size[n]=hM(t.meta.size[n],e,cM[n])}),t.frames&&Object.keys(t.frames).forEach(n=>{t.frames[n].frame&&["x","y","w","h"].forEach(i=>{t.frames[n].frame[i]=hM(t.frames[n].frame[i],e,cM[i])}),t.frames[n].spriteSourceSize&&["x","y","w","h"].forEach(i=>{t.frames[n].spriteSourceSize[i]=hM(t.frames[n].spriteSourceSize[i],e,cM[i])}),t.frames[n].sourceSize&&["w","h"].forEach(i=>{t.frames[n].sourceSize[i]=hM(t.frames[n].sourceSize[i],e,cM[i])})})}(r,a);const h=document.createElement("canvas"),c=Math.ceil(s.width*a),d=Math.ceil(s.height*a);h.width=c,h.height=d;h.getContext("2d").drawImage(s,0,0,c,d);const p=new wy(h,{resolution:1}),f=new rS(p,r);yield new Promise(t=>{f.parse(()=>t(""))}),this.spriteSheets.push(f),Object.keys(f.textures).forEach(t=>{const e=t.match(/^(.+)_gif_(\d+)$/);if(e&&e[1]&&e[2]){const n=e[1];this.gifs[n]||(this.gifs[n]=[]);const i=parseInt(e[2],10);this.gifs[n][i]=f.textures[t]}else this.frames[t]=r.frames[t],this.textures[t]=f.textures[t]})}))}destroy(){this.spriteSheets.forEach(t=>t.destroy(!0)),this.spriteSheets=[],this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null)}}var pM=n(2),fM=n.n(pM);function mM(t,e,n){let i,r;const o=Math.round(t)%360;if(o%180==0)i=Math.cos(o*(Math.PI/180))*e,r=0;else if(o%90==0)i=0,r=Math.sin(o*(Math.PI/180))*n;else{const t=function(t){const e=t*Math.PI/180;return Math.tan(e)}(o);i=e*n/Math.sqrt(Math.pow(n,2)+Math.pow(e*t,2)),(o>90&&o<270||o<-90&&o>-270)&&(i=-i),r=t*i}return{x:i,y:r}}function gM(t,e,n,i,r,o){const s=t,a=e;let l,u,h,c,d;if(0===Math.round(i))l=r,u=o,d=0;else if(Math.round(i)>=360)l=r,u=o,h=r+2*t*Math.abs(Math.cos(-n/180*Math.PI)),c=o+2*e*Math.sin(-n/180*Math.PI),d=1;else{const t=-n,e=-(n+i),{x:h,y:c}=mM(t,s,a),p=r-h,f=o+c,{x:m,y:g}=mM(e,s,a);l=m+p,u=f-g,d=i>=-360&&i<-180?1:i>=-180&&i<0||i>0&&i<180?0:1}return{radiusX:s,radiusY:a,xAxisRotation:0,largeArcFlag:d,sweepFlag:i>0?1:0,endX:l,endY:u,middleX:h,middleY:c}}class vM{constructor(){this.pool=[]}getObject(t){const e=this.pool.find(t=>!t.isUsed);if(e)return e.isUsed=!0,e.obj;{const e={obj:this.createObject(),isUsed:!0,group:t};return this.pool.push(e),e.obj}}collectObject(t){const e=this.pool.find(e=>e.obj===t);e&&(e.isUsed=!1,this.resetObject(e.obj))}collectObjectByGroup(t){this.pool.filter(e=>e.group===t).forEach(t=>this.collectObject(t.obj))}}const _M=new class extends vM{createObject(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("version","1.1"),t}resetObject(t){t.removeAttribute("viewBox"),t.removeAttribute("width"),t.removeAttribute("height"),t.innerHTML=""}};const yM=new class extends vM{createObject(){return document.createElement("img")}resetObject(t){t.removeAttribute("src")}};var xM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class bM{constructor(){this.imgElements=[],this.svgElements=[],this.idToHashMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.hashToIdMap=Object.create(null)}render(t,e,n){return xM(this,void 0,void 0,(function*(){const{items:e,width:i,height:r}=t,o=yM.getObject(n),s=new wy(o,{width:i,height:r,resolution:1}),a=_M.getObject(n);this.imgElements.push(o),this.svgElements.push(a),a.setAttribute("viewBox",`0 0 ${i} ${r}`),a.setAttribute("width",""+i),a.setAttribute("height",""+r);const u={},h={};e.forEach(t=>{const{item:e,x:n,y:i}=t,r=n+2,o=i+2;e.pathsData.forEach(t=>{let e="";t.cmds.forEach(([n,i])=>{e+=n+" ",e+=i.map(e=>(Object(l.isNumber)(e)||(e.x=e.x+t.offset.x+r,e.y=e.y+t.offset.y+o),e)).reduce((t,e)=>(Object(l.isNumber)(e)?t+=e+" ":t+=`${e.x} ${e.y} `,t),""),e+=" "}),t.pathElement.setAttribute("d",e),a.appendChild(t.pathElement)});const c=e.width-4-2*e.padding,d=e.height-4-2*e.padding;this.textures[e.hash]={texture:new ky(s,new d_(r+2,o+2,c,d)),pivot:e.pivot},u[e.hash]={x:r+2,y:o+2,w:c,h:d,pivot:e.pivot},h[e.hash]=this.hashToIdMap[e.hash]});const c=(d='<?xml version="1.0" encoding="utf-8"?>'+a.outerHTML,"data:image/svg+xml,"+encodeURIComponent(d).replace(/'/g,"%27").replace(/"/g,"%22"));var d;o.src=c,yield new Promise((t,e)=>{o.onload=()=>t(""),o.onerror=()=>e()})}))}getGraphicsData(t){const e=this.idToHashMap[t]||"";return this.textures[e]||null}addGraphics(t,e,n,i,r,o,s,a,l,u,h){var c,d;if(!s&&!l)return t;const p=fM()(n+(null!==(d=null===(c=null==s?void 0:s.width)||void 0===c?void 0:c.toString())&&void 0!==d?d:0)+l+u+h);if(this.hashToIdMap[p]||(this.hashToIdMap[p]=[]),this.hashToIdMap[p].push(t),this.idToHashMap[t]=p,this.graphics.findIndex(t=>t.hash===p)<0){const{graphicsWidth:t,graphicsHeight:n,pathsData:a,pivot:c,padding:d}=function(t,e,n,i,r,o,s,a,l){var u;const h=[],c={x:Math.abs(r.x),y:Math.abs(r.y)};let d=0,p=0,f=0,m=0,g=0,v="none";const _=null!==(u=null==i?void 0:i.width)&&void 0!==u?u:0;return s?(d=e,p=n,g=0):(v=l||"#ff0000",g=_,f=.5*_,m=.5*_,d=e+_,p=n+_,c.x+=.5*_,c.y+=.5*_),d+=Math.abs(r.x),p+=Math.abs(r.y),f+=Math.abs(r.x),m+=Math.abs(r.y),d+=4,p+=4,f+=2,m+=2,d=Math.ceil(d),p=Math.ceil(p),t.forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","path");"none"!==t.fill&&s?e.setAttribute("fill",a||"#ff0000"):e.setAttribute("fill","none"),t.hasStroke&&!s&&(e.setAttribute("stroke-linecap",(null==i?void 0:i.cap)||"butt"),e.setAttribute("stroke-linejoin",(null==i?void 0:i.join)||"miter"),e.setAttribute("stroke-width",g.toString()),e.setAttribute("stroke",v),(null==i?void 0:i.dash)&&e.setAttribute("stroke-dasharray",i.dash));const{scale:n}=t,r=t.path.trim().split(" ");let o={x:0,y:0};const l={offset:{x:f,y:m},cmds:[],pathElement:e};for(let t=0;t<r.length;t+=2){const e=r[t],i=r[t+1];if("M"===e){let[t,e]=i.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*n.x,e=e/9525*n.y,l.cmds.push(["M",[{x:t,y:e}]])}else if("A"===e){const[t,e,r,s]=i.split(",").map(t=>Number(t)),a=r/Math.PI*180,u=s/Math.PI*180,h=gM(t,e,a,u,o.x,o.y);Math.round(u)>=360?(o={x:h.endX,y:h.endY},l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.middleX/9525*n.x,y:h.middleY/9525*n.y}]]),l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.endX/9525*n.x,y:h.endY/9525*n.y}]])):(o={x:h.endX,y:h.endY},l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.endX/9525*n.x,y:h.endY/9525*n.y}]]))}else if("L"===e){let[t,e]=i.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*n.x,e=e/9525*n.y,l.cmds.push(["L",[{x:t,y:e}]])}else if("QB"===e){let[t,e,r,s]=i.split(",").map(t=>Number(t));o={x:r,y:s},t=t/9525*n.x,e=e/9525*n.y,r=r/9525*n.x,s=s/9525*n.y,l.cmds.push(["Q",[{x:t,y:e},{x:r,y:s}]])}else if("CB"===e){let[t,e,r,s,a,u]=i.split(",").map(t=>Number(t));o={x:a,y:u},t=t/9525*n.x,e=e/9525*n.y,r=r/9525*n.x,s=s/9525*n.y,a=a/9525*n.x,u=u/9525*n.y,l.cmds.push(["C",[{x:t,y:e},{x:r,y:s},{x:a,y:u}]])}else"C"===e&&l.cmds.push(["Z",[]])}h.push(l)}),{graphicsWidth:d,graphicsHeight:p,pivot:c,padding:2,pathsData:h}}(e,r,o,s,i,0,l,u,h);this.graphics.push({hash:p,pathsData:a,pivot:c,width:t,height:n,padding:d})}return t}pack(){this.graphics.forEach(t=>{t.width+=4,t.height+=4});return function t(e){const n=[],i=e.filter(t=>{const e=t.width<2048&&t.height<2048;return e||n.push(t),e}).sort((t,e)=>t.width*t.height-e.width*e.height);let r=i.length+1,o=2050,s=2050;const a=[];let l=null;for(;(o>2048||s>2048)&&i.length>0;)r-=1,l=JE()(i.slice(0,r)),o=l.width,s=l.height;return l&&a.push(l),n.forEach(t=>{const e=JE()([t]);a.push(e)}),r<i.length?a.concat(t(i.slice(r))):a}(this.graphics)}destroy(){Object.keys(this.textures).forEach(t=>{var e;null===(e=this.textures[t])||void 0===e||e.texture.destroy(!0)}),this.textures=Object.create(null),this.imgElements.forEach(t=>yM.collectObject(t)),this.svgElements.forEach(t=>_M.collectObject(t)),this.graphics=[]}}class TM{constructor(){this.runningTimeNodes={}}addRunningTimeNode(t,e,n){const i=`${e}_${t}`;if(this.runningTimeNodes[i])try{this.runningTimeNodes[i].dispose(!0)}catch(t){}this.runningTimeNodes[i]=n}removeRunningTimeNode(t,e){const n=`${e}_${t}`;delete this.runningTimeNodes[n]}}class wM{constructor(t){this.eventHub=t,this.targets=Object.create(null)}getTargets(){return Object.keys(this.targets).map(t=>this.targets[t])}addTarget(t,e){this.targets[t]=e}getTargetById(t){return this.targets[t]}getTarget(t,e,n={type:"el",index:0,id:""}){var i,r;let o=this.targets[t.id];return"shape"!==t.type?o:("shape"===t.type&&t.txEl&&(o=null!==(i=null==o?void 0:o.getTextElement(t.txEl.type,t.txEl.range))&&void 0!==i?i:null),"shape"===t.type&&t.bg&&0===n.index&&(e=!1,o=null!==(r=null==o?void 0:o.getBgElement())&&void 0!==r?r:null,this.eventHub.emit("IterateTimeNodeEnd",n.id)),e&&o?o.getIterateEntry(n.type,n.index,n.id):(o||this.eventHub.emit("IterateTimeNodeEnd",n.id),o))}clearTargets(){this.targets=Object.create(null)}}class SM{constructor(t){this.target=t}get color(){return this.target.strokeColorFilter.currentColor}set color(t){this.target.strokeColorFilter.color=t}get on(){return this.target.strokeActive?"true":"false"}set on(t){this.target.strokeActive="true"===t}}class EM{constructor(t){this.target=t}applyCommand(t,e){this.target.applyCommand(t,e)}}class MM{constructor(t){this.target=t}get color(){return this.target.fillColorFilter.currentColor}set color(t){this.target.fillActive&&(this.target.fillColorFilter.color=t)}get on(){return this.target.fillActive?"true":"false"}set on(t){this.target.fillActive="true"===t}get designColor(){return this.target.fillColorFilter.designColor}}class AM{constructor(t,e){this.hardHidden=!1,this.target=t,!0===e&&(this.hardHidden=!0)}get opacity(){return this.target.alpha}set opacity(t){this.target.alpha=t}get rotation(){return this.target.rotation/Math.PI*180}set rotation(t){this.target.rotation=t/180*Math.PI}get visibility(){return this.target.visible?"visible":"hidden"}set visibility(t){this.visibility===t||this.hardHidden||(this.target.visible="visible"===t)}}class RM{constructor(t,e){this.actions=[],this.ctx=e,this.object=t,this.object.interactive=!0}reset(t){this.object.interactive=!1,this.object.removeAllListeners(),this.object=t,this.object.interactive=!0}addAction(t,e){this.actions.push([t,e]),"click"===e?(this.object.addListener("click",()=>this.handleAction(t)),this.object.cursor="pointer"):"hover"===e&&this.object.addListener("mouseover",()=>this.handleAction(t))}addProxy(t){this.proxy=t,this.hitArea=this.getOriginHitArea(),this.proxy.interactive=!0,this.actions.forEach(([t,e])=>{var n,i;"click"===e?null===(n=this.proxy)||void 0===n||n.addListener("click",e=>this.handleProxyAction(e,t)):"hover"===e&&(null===(i=this.proxy)||void 0===i||i.addListener("mouseover",e=>this.handleProxyAction(e,t)))})}handleProxyAction(t,e){var n;const i=t.data.global,r=this.object.getGlobalPosition(),o=i.x-r.x+this.object.pivot.x,s=i.y-r.y+this.object.pivot.y;(null===(n=this.hitArea)||void 0===n?void 0:n.contains(o,s))&&this.object.visible&&this.handleAction(e,!0)}getOriginHitArea(){return this.object.hitArea?this.object.hitArea:new g_(0,0,this.object.width,this.object.height)}handleAction(t,e=!1){this.proxy&&!e||(this.ctx.eventHub.emit($R.hyperlinkTrigger,t),this.execAction(t))}execAction(t){var e;if(this.ctx.eventHub.emit($R.userInput),"ppaction://hlinksldjump"===t.action){const n=(null!==(e=null==t?void 0:t.target)&&void 0!==e?e:"").match(/slide(\d+)\.xml/);n&&n[1]&&this.ctx.eventHub.emit($R.requestGotoSlide,Number(n[1]))}else if("ppaction://hlinkshowjump?jump=nextslide"===t.action)this.ctx.eventHub.emit($R.requestNextSlide);else if("ppaction://hlinkshowjump?jump=previousslide"===t.action)this.ctx.eventHub.emit($R.requestPrevSlide);else if("ppaction://hlinkshowjump?jump=firstslide"===t.action)this.ctx.eventHub.emit($R.requestGotoSlide,1);else if("ppaction://hlinkshowjump?jump=lastslide"===t.action)this.ctx.eventHub.emit($R.requestGotoSlide,-1);else if("ppaction://hlinkshowjump?jump=lastslideviewed"===t.action){const t=this.ctx.lastViewedIndex;this.ctx.eventHub.emit($R.requestGotoSlide,t)}else"ppaction://hlinkshowjump?jump=endshow"===t.action&&this.ctx.eventHub.emit($R.requestGotoSlide,-1)}}class PM{constructor(t,e,n){var i,r,o,s,a,l;this.scaleExt={x:1,y:1},this.scaleOrigin={x:1,y:1},this.designScale={x:1,y:1},this.bound=new d_(0,0,1,1),this.pptX=0,this.pptY=0,this.presetSubType=0,this.designWidth=0,this.designHeight=0,this.designX=0,this.designY=0,this.hasPreset=!1,this.container=new ty,this.ctx=e,this.style=new AM(this.container,t.hardHidden),this.designGlobalPosition={x:n.x+(null!==(r=null===(i=t.position)||void 0===i?void 0:i.x)&&void 0!==r?r:0),y:n.y+(null!==(s=null===(o=t.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0)},this.container.interactive=!0,(t.hlinkClick||t.hlinkHover)&&(this.hyperlink=new RM(this.container,this.ctx),t.hlinkHover&&(null===(a=this.hyperlink)||void 0===a||a.addAction(t.hlinkHover,"hover")),t.hlinkClick&&(null===(l=this.hyperlink)||void 0===l||l.addAction(t.hlinkClick,"click"))),this.ctx.clock.waitUntil(()=>{try{return!!this.container.width}catch(t){return!1}},3e3).then(()=>{try{this.designWidth=this.designWidth||this.container.width}catch(t){}}),this.ctx.clock.waitUntil(()=>{try{return!!this.container.height}catch(t){return!1}},3e3).then(()=>{try{this.designHeight=this.designHeight||this.container.height}catch(t){}})}updateScale(){this.container&&(this.container.scale.x=this.designScale.x*this.scaleExt.x*this.scaleOrigin.x,this.container.scale.y=this.designScale.y*this.scaleExt.y*this.scaleOrigin.y)}updateTransform(t){var e,n,i,r,o,s,a,l;this.designWidth=t.width,this.designHeight=t.height,this.designX=null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,this.designY=null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0;const u=this.designWidth/2,h=this.designHeight/2;this.container.width=this.designWidth,this.container.height=this.designHeight,this.container.pivot.x=u,this.container.pivot.y=h;const c=null!==(s=null===(o=t.position)||void 0===o?void 0:o.x)&&void 0!==s?s:0,d=null!==(l=null===(a=t.position)||void 0===a?void 0:a.y)&&void 0!==l?l:0;this.container.x=c+u,this.container.y=d+h,t.scale&&(this.designScale={x:t.scale.x,y:t.scale.y},this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y),t.rotation&&(this.container.rotation=t.rotation);const p=new Aw;p.drawRect(0,0,this.designWidth,this.designHeight),this.container.addChild(p),this.json.hardHidden&&(this.container.visible=!1),this.bound.x=c,this.bound.y=d,this.bound.width=this.designWidth,this.bound.height=this.designHeight}get scale(){return this.scaleOrigin}set scale(t){this.scaleOrigin.x=t.x,this.scaleOrigin.y=t.y,this.updateScale()}get design_ppt_w(){return KE(this.designWidth/this.ctx.stageWidth)}get design_ppt_h(){return KE((this.designHeight||this.container.height)/this.ctx.stageHeight)}get design_ppt_x(){return KE(this.designX/this.ctx.stageWidth)}get design_ppt_y(){return KE(this.designY/this.ctx.stageHeight)}get ppt_w(){return this.scaleExt.x*this.scaleOrigin.x*this.designWidth/this.ctx.stageWidth}set ppt_w(t){this.designWidth&&(this.scaleExt.x=t*this.ctx.stageWidth/this.designWidth,this.updateScale())}get ppt_h(){const t=this.designHeight||this.container.height;return this.scaleExt.y*this.scaleOrigin.y*t/this.ctx.stageHeight}set ppt_h(t){this.designHeight&&(this.scaleExt.y=t*this.ctx.stageHeight/this.designHeight,this.updateScale())}get ppt_x(){return(this.container.position.x-this.container.pivot.x)/this.ctx.stageWidth}set ppt_x(t){this.pptX=t;const e=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=t*this.ctx.stageWidth+this.container.pivot.x*e}get ppt_y(){return(this.container.position.y-this.container.pivot.y)/this.ctx.stageHeight}set ppt_y(t){this.pptY=t;const e=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=t*this.ctx.stageHeight+this.container.pivot.y*e}get r(){return this.container.rotation}set r(t){this.container.rotation=t}set xshear(t){this.container.skew.x=t}get xshear(){return this.container.skew.x}set yshear(t){this.container.skew.y=t}get yshear(){return this.container.skew.y}}class CM{constructor(t){if(this._isInit=!1,this.h=0,this.s=0,this.l=0,this.a=1,t){this._isInit=!0;const e=t.match(/-?[0-9]+/g);e&&(this.h=parseInt(e[0],10),this.s=parseInt(e[1],10)/100,this.l=parseInt(e[2],10)/100)}}isInit(){return this._isInit}by(t,e){e.h=Math.max(Math.min(this.h+t.h,359),0),e.s=Math.max(Math.min(this.s+t.s,1),0),e.l=Math.max(Math.min(this.l+t.l,1),0),e.a=Math.max(Math.min(this.a+t.a,1),0)}fromHexString(t){const[e,n,i,r]=LM(t);let o=0,s=0,a=0;const l=Math.max(e,n,i),u=Math.min(e,n,i),h=l-u;a=(l+u)/2,0===h?o=0:l===e?o=(n-i)/h%6*60:l===n?o=60*((i-e)/h+2):l===i&&(o=60*((e-n)/h+4)),s=0===h?0:h/(1-Math.abs(2*a-1)),this.h=o,this.s=s,this.l=a,this.a=r}interpolationFrom(t,e,n){const i=t.h+(this.h-t.h)*e,r=t.s+(this.s-t.s)*e,o=t.l+(this.l-t.l)*e,s=t.a+(this.a-t.a)*e;n.h=Math.max(Math.min(i,359),0),n.s=Math.max(Math.min(r,1),0),n.l=Math.max(Math.min(o,1),0),n.a=Math.max(Math.min(s,1),0)}toHexString(){let t=[0,0,0,0];const{h:e,s:n,l:i}=this;if(e<360&&e>=0&&n<=1&&n>=0&&i<=1&&i>=0){let r,o,s;const a=(1-Math.abs(2*i-1))*n,l=a*(1-Math.abs(e/60%2-1)),u=i-a/2;[r,o,s]=e>=0&&e<60?[a,l,0]:e>=60&&e<120?[l,a,0]:e>=120&&e<180?[0,a,l]:e>=180&&e<240?[0,l,a]:e>=240&&e<300?[l,0,a]:[a,0,l],t=[r+u,o+u,s+u,this.a]}return NM(t)}}class IM{constructor(t){this._isInit=!1,this.r=0,this.g=0,this.b=0,this.a=0,t&&(this._isInit=!0,this.fromHexString(t))}fromHexString(t){const[e,n,i,r]=LM(t);this.r=e,this.g=n,this.b=i,this.a=r}isInit(){return this._isInit}interpolationFrom(t,e,n){n.r=t.r+(this.r-t.r)*e,n.g=t.g+(this.g-t.g)*e,n.b=t.b+(this.b-t.b)*e,n.a=t.a+(this.a-t.a)*e}by(t,e){e.r=Math.min(Math.max(this.r+t.r,0),255),e.g=Math.min(Math.max(this.g+t.g,0),255),e.b=Math.min(Math.max(this.b+t.b,0),255),e.a=Math.min(Math.max(this.a+t.a,0),1)}toHexString(){return NM([this.r,this.g,this.b,this.a])}}function OM(t){const e=t.substring(1);return[parseInt(e.substring(0,6),16),parseInt(e.substring(6,8),16)/255]}function LM(t){return 0===(t=t.replace(/^#/,"")).substring(6,8).length&&(t+="FF"),[parseInt(t.substring(0,2).padStart(8,"0"),16)/255,parseInt(t.substring(2,4).padStart(8,"0"),16)/255,parseInt(t.substring(4,6).padStart(8,"0"),16)/255,parseInt(t.substring(6,8).padStart(8,"0"),16)/255]}function NM(t){return"#"+Math.round(255*t[0]).toString(16).padStart(2,"0")+Math.round(255*t[1]).toString(16).padStart(2,"0")+Math.round(255*t[2]).toString(16).padStart(2,"0")+Math.round(255*t[3]).toString(16).padStart(2,"0")}function DM(t,e,n){const i=LM(t),r=LM(e),o=Math.round(255*(i[0]+(r[0]-i[0])*n)),s=Math.round(255*(i[1]+(r[1]-i[1])*n)),a=Math.round(255*(i[2]+(r[2]-i[2])*n)),l=Math.round(255*(i[3]+(r[3]-i[3])*n));return"#"+o.toString(16).padStart(2,"0")+s.toString(16).padStart(2,"0")+a.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")}class FM extends Gx{constructor(){super(void 0,"\nvarying vec2 vTextureCoord;\n\nuniform vec4 color;\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n\n if (texColor.a > 0.0) {\n vec4 resultColor = color;\n resultColor = resultColor * texColor.a;\n gl_FragColor = resultColor;\n } else {\n gl_FragColor = texColor;\n }\n}\n",{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF",this.designColor="#FFFFFFFF"}set color(t){this.currentColor=t;const e=LM(t);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const BM=new WE.ColorMatrixFilter;BM.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const UM=new WE.ColorMatrixFilter;UM.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const kM=new WE.ColorMatrixFilter;kM.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const GM=new WE.ColorMatrixFilter;GM.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const HM={darken:BM,darkenLess:UM,lightenLess:GM,lighten:kM};class zM extends PM{constructor(t,e,n){super({position:{x:t.x,y:t.y},width:t.width,height:t.height},e,n),this.fillColorFilter=new FM,this.fill=new MM(this),this.json=t,this.ctx=e,this.parentGlobalPos=n,this.global={x:n.x+t.x,y:n.y+t.y},this.updateTransform({position:{x:t.x,y:t.y},width:t.width,height:t.height})}get fillActive(){var t,e;return(null!==(e=null===(t=this.container.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set fillActive(t){var e,n;t?(null!==(n=null===(e=this.container.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}clearOnSlideChange(){}initOnReuse(){}isStatic(){return!1}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(t){const e=t*this.ctx.stageWidth-this.global.x,n=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*n}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(t){const e=t*this.ctx.stageHeight-this.global.y,n=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*n}get design_ppt_x(){return KE(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return KE(this.global.y/this.ctx.stageHeight)}}class jM{constructor(t,e,n,i,r,o,s,a,l,u,h){this.ctx=t,this.type=e,this.lineWidth=n,this.width=i,this.height=r,this.fillColor=o,this.isHorz=s,this.renderContainer=new ty,this.ghcTextureId=`${a}-text-p${l}-l${u}-u${h}-underLine`}createPaths(){if("ww"===this.type)return null;{let t=`M 0,0 L ${9525*this.width},0`,[e,n]=[this.width,this.lineWidth];return this.isHorz||(t="M 0,0 L 0,"+9525*this.height,[e,n]=[this.lineWidth,this.height]),{paths:[{id:eM(),path:t,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:fM()(t)}],width:e,height:n}}}getLineStyle(){const t={width:this.lineWidth};return"dotted"===this.type&&(t.dash=""+this.lineWidth),t}preRender(){const t=this.createPaths();if(t){const{paths:e,width:n,height:i}=t,r=e.reduce((t,e)=>t+e.hash,"");this.ctx.graphicsTexture.addGraphics(this.ghcTextureId,e,r,{x:0,y:0},n,i,this.getLineStyle(),this.ctx.objectPoolGroup,!1,null,this.fillColor)}}render(){if(this.ghcTextureId){const t=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);t&&(this.sprite=new Ow,this.sprite.texture=t.texture,this.sprite.pivot.x=t.pivot.x)}}destroy(){var t;null===(t=this.sprite)||void 0===t||t.destroy({texture:!0})}}const VM=134217729;function WM(t,e,n,i,r){let o,s,a,l,u=e[0],h=i[0],c=0,d=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=i[++d]);let p=0;if(c<t&&d<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=i[++d]),o=s,0!==a&&(r[p++]=a);c<t&&d<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=i[++d]),o=s,0!==a&&(r[p++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(r[p++]=a);for(;d<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=i[++d],o=s,0!==a&&(r[p++]=a);return 0===o&&0!==p||(r[p++]=o),p}function XM(t,e){let n=e[0];for(let i=1;i<t;i++)n+=e[i];return n}function qM(t){return new Float64Array(t)}const YM=qM(4),ZM=qM(8),JM=qM(12),$M=qM(16),KM=qM(4);function QM(t,e,n,i,r,o){const s=(e-o)*(n-r),a=(t-r)*(i-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const u=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*u?l:-function(t,e,n,i,r,o,s){let a,l,u,h,c,d,p,f,m,g,v,_,y,x,b,T,w,S;const E=t-r,M=n-r,A=e-o,R=i-o;x=E*R,d=VM*E,p=d-(d-E),f=E-p,d=VM*R,m=d-(d-R),g=R-m,b=f*g-(x-p*m-f*m-p*g),T=A*M,d=VM*A,p=d-(d-A),f=A-p,d=VM*M,m=d-(d-M),g=M-m,w=f*g-(T-p*m-f*m-p*g),v=b-w,c=b-v,YM[0]=b-(v+c)+(c-w),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,YM[1]=y-(v+c)+(c-T),S=_+v,c=S-_,YM[2]=_-(S-c)+(v-c),YM[3]=S;let P=XM(4,YM),C=22204460492503146e-32*s;if(P>=C||-P>=C)return P;if(c=t-E,a=t-(E+c)+(c-r),c=n-M,u=n-(M+c)+(c-r),c=e-A,l=e-(A+c)+(c-o),c=i-R,h=i-(R+c)+(c-o),0===a&&0===l&&0===u&&0===h)return P;if(C=11093356479670487e-47*s+33306690738754706e-32*Math.abs(P),P+=E*h+R*a-(A*u+M*l),P>=C||-P>=C)return P;x=a*R,d=VM*a,p=d-(d-a),f=a-p,d=VM*R,m=d-(d-R),g=R-m,b=f*g-(x-p*m-f*m-p*g),T=l*M,d=VM*l,p=d-(d-l),f=l-p,d=VM*M,m=d-(d-M),g=M-m,w=f*g-(T-p*m-f*m-p*g),v=b-w,c=b-v,KM[0]=b-(v+c)+(c-w),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,KM[1]=y-(v+c)+(c-T),S=_+v,c=S-_,KM[2]=_-(S-c)+(v-c),KM[3]=S;const I=WM(4,YM,4,KM,ZM);x=E*h,d=VM*E,p=d-(d-E),f=E-p,d=VM*h,m=d-(d-h),g=h-m,b=f*g-(x-p*m-f*m-p*g),T=A*u,d=VM*A,p=d-(d-A),f=A-p,d=VM*u,m=d-(d-u),g=u-m,w=f*g-(T-p*m-f*m-p*g),v=b-w,c=b-v,KM[0]=b-(v+c)+(c-w),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,KM[1]=y-(v+c)+(c-T),S=_+v,c=S-_,KM[2]=_-(S-c)+(v-c),KM[3]=S;const O=WM(I,ZM,4,KM,JM);x=a*h,d=VM*a,p=d-(d-a),f=a-p,d=VM*h,m=d-(d-h),g=h-m,b=f*g-(x-p*m-f*m-p*g),T=l*u,d=VM*l,p=d-(d-l),f=l-p,d=VM*u,m=d-(d-u),g=u-m,w=f*g-(T-p*m-f*m-p*g),v=b-w,c=b-v,KM[0]=b-(v+c)+(c-w),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,KM[1]=y-(v+c)+(c-T),S=_+v,c=S-_,KM[2]=_-(S-c)+(v-c),KM[3]=S;const L=WM(O,JM,4,KM,$M);return $M[L-1]}(t,e,n,i,r,o,u)}qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(8),qM(8),qM(8),qM(4),qM(8),qM(8),qM(8),qM(12);qM(192),qM(192);qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(8),qM(8),qM(8),qM(8),qM(8),qM(8),qM(8),qM(8),qM(8),qM(4),qM(4),qM(4),qM(8),qM(16),qM(16),qM(16),qM(32),qM(32),qM(48),qM(64);qM(1152),qM(1152);qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(4),qM(24),qM(24),qM(24),qM(24),qM(24),qM(24),qM(24),qM(24),qM(24),qM(24),qM(1152),qM(1152),qM(1152),qM(1152),qM(1152),qM(2304),qM(2304),qM(3456),qM(5760),qM(8),qM(8),qM(8),qM(16),qM(24),qM(48),qM(48),qM(96),qM(192),qM(384),qM(384),qM(384),qM(768);qM(96),qM(96),qM(96),qM(1152);const tA=Math.pow(2,-52),eA=new Uint32Array(512);class nA{static from(t,e=lA,n=uA){const i=t.length,r=new Float64Array(2*i);for(let o=0;o<i;o++){const i=t[o];r[2*o]=e(i),r[2*o+1]=n(i)}return new nA(r)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:i,_hullHash:r}=this,o=t.length>>1;let s=1/0,a=1/0,l=-1/0,u=-1/0;for(let e=0;e<o;e++){const n=t[2*e],i=t[2*e+1];n<s&&(s=n),i<a&&(a=i),n>l&&(l=n),i>u&&(u=i),this._ids[e]=e}const h=(s+l)/2,c=(a+u)/2;let d,p,f,m=1/0;for(let e=0;e<o;e++){const n=iA(h,c,t[2*e],t[2*e+1]);n<m&&(d=e,m=n)}const g=t[2*d],v=t[2*d+1];m=1/0;for(let e=0;e<o;e++){if(e===d)continue;const n=iA(g,v,t[2*e],t[2*e+1]);n<m&&n>0&&(p=e,m=n)}let _=t[2*p],y=t[2*p+1],x=1/0;for(let e=0;e<o;e++){if(e===d||e===p)continue;const n=oA(g,v,_,y,t[2*e],t[2*e+1]);n<x&&(f=e,x=n)}let b=t[2*f],T=t[2*f+1];if(x===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];sA(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,i=-1/0;t<o;t++){const r=this._ids[t];this._dists[r]>i&&(e[n++]=r,i=this._dists[r])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(QM(g,v,_,y,b,T)<0){const t=p,e=_,n=y;p=f,_=b,y=T,f=t,b=e,T=n}const w=function(t,e,n,i,r,o){const s=n-t,a=i-e,l=r-t,u=o-e,h=s*s+a*a,c=l*l+u*u,d=.5/(s*u-a*l);return{x:t+(u*h-a*c)*d,y:e+(s*c-l*h)*d}}(g,v,_,y,b,T);this._cx=w.x,this._cy=w.y;for(let e=0;e<o;e++)this._dists[e]=iA(t[2*e],t[2*e+1],w.x,w.y);sA(this._ids,this._dists,0,o-1),this._hullStart=d;let S=3;n[d]=e[f]=p,n[p]=e[d]=f,n[f]=e[p]=d,i[d]=0,i[p]=1,i[f]=2,r.fill(-1),r[this._hashKey(g,v)]=d,r[this._hashKey(_,y)]=p,r[this._hashKey(b,T)]=f,this.trianglesLen=0,this._addTriangle(d,p,f,-1,-1,-1);for(let o,s,a=0;a<this._ids.length;a++){const l=this._ids[a],u=t[2*l],h=t[2*l+1];if(a>0&&Math.abs(u-o)<=tA&&Math.abs(h-s)<=tA)continue;if(o=u,s=h,l===d||l===p||l===f)continue;let c=0;for(let t=0,e=this._hashKey(u,h);t<this._hashSize&&(c=r[(e+t)%this._hashSize],-1===c||c===n[c]);t++);c=e[c];let m,g=c;for(;m=n[g],QM(u,h,t[2*g],t[2*g+1],t[2*m],t[2*m+1])>=0;)if(g=m,g===c){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,l,n[g],-1,-1,i[g]);i[l]=this._legalize(v+2),i[g]=v,S++;let _=n[g];for(;m=n[_],QM(u,h,t[2*_],t[2*_+1],t[2*m],t[2*m+1])<0;)v=this._addTriangle(_,l,m,i[l],-1,i[_]),i[l]=this._legalize(v+2),n[_]=_,S--,_=m;if(g===c)for(;m=e[g],QM(u,h,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(m,l,g,-1,i[g],i[m]),this._legalize(v+2),i[m]=v,n[g]=g,S--,g=m;this._hullStart=e[l]=g,n[g]=e[_]=l,n[l]=_,r[this._hashKey(u,h)]=l,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(S);for(let t=0,e=this._hullStart;t<S;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const s=n[t],a=t-t%3;if(o=a+(t+2)%3,-1===s){if(0===r)break;t=eA[--r];continue}const l=s-s%3,u=a+(t+1)%3,h=l+(s+2)%3,c=e[o],d=e[t],p=e[u],f=e[h];if(rA(i[2*c],i[2*c+1],i[2*d],i[2*d+1],i[2*p],i[2*p+1],i[2*f],i[2*f+1])){e[t]=f,e[s]=c;const i=n[h];if(-1===i){let e=this._hullStart;do{if(this._hullTri[e]===h){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,i),this._link(s,n[o]),this._link(o,h);const a=l+(s+1)%3;r<eA.length&&(eA[r++]=a)}else{if(0===r)break;t=eA[--r]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,i,r,o){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=e,this._triangles[s+2]=n,this._link(s,i),this._link(s+1,r),this._link(s+2,o),this.trianglesLen+=3,s}}function iA(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}function rA(t,e,n,i,r,o,s,a){const l=t-s,u=e-a,h=n-s,c=i-a,d=r-s,p=o-a,f=h*h+c*c,m=d*d+p*p;return l*(c*m-f*p)-u*(h*m-f*d)+(l*l+u*u)*(h*p-c*d)<0}function oA(t,e,n,i,r,o){const s=n-t,a=i-e,l=r-t,u=o-e,h=s*s+a*a,c=l*l+u*u,d=.5/(s*u-a*l),p=(u*h-a*c)*d,f=(s*c-l*h)*d;return p*p+f*f}function sA(t,e,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=t[r],o=e[i];let s=r-1;for(;s>=n&&e[t[s]]>o;)t[s+1]=t[s--];t[s+1]=i}else{let r=n+1,o=i;aA(t,n+i>>1,r),e[t[n]]>e[t[i]]&&aA(t,n,i),e[t[r]]>e[t[i]]&&aA(t,r,i),e[t[n]]>e[t[r]]&&aA(t,n,r);const s=t[r],a=e[s];for(;;){do{r++}while(e[t[r]]<a);do{o--}while(e[t[o]]>a);if(o<r)break;aA(t,r,o)}t[n+1]=t[o],t[o]=s,i-r+1>=o-n?(sA(t,e,r,i),sA(t,e,n,o-1)):(sA(t,e,n,o-1),sA(t,e,r,i))}}function aA(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function lA(t){return t[0]}function uA(t){return t[1]}function hA(t,e,n){let i=null;const r=new ty;if(t.stopList.sort((t,e)=>t.pos-e.pos),!t.stopList.find(t=>0===t.pos)){const e=t.stopList[0];t.stopList.unshift({pos:0,color:e.color})}if(!t.stopList.find(t=>1===t.pos)){const e=t.stopList[t.stopList.length-1];t.stopList.push({pos:1,color:e.color})}const o=t=>{const e=[];for(let n=0,i=t.length;n<i-1;n++){const i=t[n],r=t[n+1],o=i.pos+.5*(r.pos-i.pos),s=DM(i.color,r.color,.5),a=2*n;e[a]=i,e[a+1]={color:s,pos:o},e[a+2]=r}return e};if(t.stopList=o(t.stopList),t.stopList=o(t.stopList),i=t.line?cA(t,e,n):t.path?function(t,e,n){var i,r,o;const s=[],a={x:0,y:0};if("circle"===(null===(i=t.path)||void 0===i?void 0:i.path)||"rect"===(null===(r=t.path)||void 0===r?void 0:r.path)||"shape"===(null===(o=t.path)||void 0===o?void 0:o.path)){const i=e/2,r=n/2,o=Math.sqrt(i*i+r*r);t.stopList.forEach(t=>{if(0===t.pos)s.push({point:{x:0,y:0},color:t.color});else{const e=o*t.pos,n=new xc;n.absellipse(0,0,e,e,0,2*Math.PI,!1,0),n.getPoints(50).forEach(e=>{s.push({point:{x:e.x,y:e.y},color:t.color})})}a.x=i,a.y=r})}return{points:s,position:a}}(t,e,n):cA(t,e,n),i){const t=[],o=[],{position:s,points:a}=i,l=nA.from(a,t=>t.point.x,t=>t.point.y);for(let e=0;e<l.triangles.length;e+=3)t.push(a[l.triangles[e]].point.x,a[l.triangles[e]].point.y),t.push(a[l.triangles[e+1]].point.x,a[l.triangles[e+1]].point.y),t.push(a[l.triangles[e+2]].point.x,a[l.triangles[e+2]].point.y),o.push(...LM(a[l.triangles[e]].color)),o.push(...LM(a[l.triangles[e+1]].color)),o.push(...LM(a[l.triangles[e+2]].color));const u=new Jy;u.addAttribute("aVertexPosition",t,2),u.addAttribute("aColor",o,4);const h=Ux.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec4 aColor;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec4 vColor;\n void main() {\n vColor = aColor;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","precision mediump float; \n varying vec4 vColor;\n void main() {\n float alpha = vColor.a;\n vec4 color = vColor;\n color.a = 1.0;\n gl_FragColor = color * alpha;\n }\n "),c=new Aw;c.drawRect(0,0,e+1,n+1),r.mask=c,r.addChild(c);const d=new vS(u,h);d.position.x=s.x,d.position.y=s.y,r.addChild(d)}return r}function cA(t,e,n){const i=e/2,r=n/2,o=[{x:-i,y:r},{x:-i,y:-r},{x:i,y:r},{x:i,y:-r}],s=[QE.fromPointSlope({x:-i,y:0},Math.PI/2),QE.fromPointSlope({x:0,y:r},0),QE.fromPointSlope({x:i,y:0},Math.PI/2),QE.fromPointSlope({x:0,y:-r},0)],a=[],l=t.stopList.slice(1,t.stopList.length-1).map(o=>{var l,u,h;const c=2*Math.PI;let d=null!==(u=null===(l=t.line)||void 0===l?void 0:l.ang)&&void 0!==u?u:0;for(;d>c;)d-=c;for(;d<0;)d+=c;const p={x:0,y:0};$E(d,Math.PI/2)?(p.x=0,p.y=n/2-o.pos*n):$E(d,0)?(p.x=o.pos*e-e/2,p.y=0):(p.x=o.pos*e-e/2,p.y=n/2-o.pos*n),d>Math.PI/2&&d<=Math.PI&&(p.x*=-1),d>Math.PI&&d<=2*Math.PI&&(p.y*=-1);const f=QE.fromPointSlope(p,Math.PI/2-((null===(h=t.line)||void 0===h?void 0:h.ang)||0)),m=s.map(t=>f.crossPoint(t)).filter(t=>t&&t.x<=i&&t.x>=-i&&t.y<=r&&t.y>=-r).map(t=>({point:t,color:o.color})).sort((t,e)=>e.point.y-t.point.y);a.push(...m);let g=Math.abs(m[1].point.x-m[0].point.x)/10;for(let t=20;t--;){const e=t%2==0?1:-1,n=p.x+e*g,s=f.resolveY(n);n<=i&&n>=-i&&s<=r&&s>=-r&&a.push({point:{x:n,y:s},color:o.color}),g+=g}return f});let u=[],h=[];t:for(let e=0;e<o.length;e++){const n=o[e];for(let e=0;e<l.length-1;e++){const i=l[e],r=l[e+1],o=i.distanceToLinearEquation(r),s=i.distanceToPoint(n),u=r.distanceToPoint(n);if(s<o&&u<o){const i=t.stopList.slice(1,t.stopList.length-1)[e],r=t.stopList.slice(1,t.stopList.length-1)[e+1],l=DM(i.color,r.color,s/o);a.splice(e+1,0,{point:n,color:l});continue t}}const i=l[0],r=l[l.length-1],s=i.distanceToPoint(n),c=r.distanceToPoint(n);s<=c?u.push({point:n,dis:s}):h.push({point:n,dis:c})}u=u.sort((t,e)=>e.dis-t.dis);const c=u.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[0].color};{const n=t.stopList[0].color,i=t.stopList[1].color;return{point:e.point,color:DM(n,i,1-(0===u[0].dis?1:e.dis/u[0].dis))}}}).sort((t,e)=>e.point.y-t.point.y);h=h.sort((t,e)=>e.dis-t.dis);const d=h.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[t.stopList.length-1].color};{const n=t.stopList[t.stopList.length-2].color,i=t.stopList[t.stopList.length-1].color;return{point:e.point,color:DM(n,i,0===h[0].dis?0:e.dis/h[0].dis)}}}).sort((t,e)=>e.point.y-t.point.y),p=c.concat(...a).concat(d);for(let t=0;t<p.length;t++)p[t].point.x+=i,p[t].point.y=-p[t].point.y+r;return{points:p,position:{x:0,y:0}}}const dA="\nvec3 rgb2hsl(vec3 rgb) {\n float cMax = max(max(rgb.r, rgb.g), rgb.b);\n float cMin = min(min(rgb.r, rgb.g), rgb.b);\n float delta = cMax - cMin;\n \n float h = 0.0;\n if (delta == 0.0) {\n h = 0.0;\n } else if (cMax == rgb.r) {\n h = 60.0 * mod(((rgb.g - rgb.b) / delta), 6.0);\n } else if (cMax == rgb.g ) {\n h = 60.0 * ((rgb.b - rgb.r) / delta + 2.0);\n } else if (cMax == rgb.b) {\n h = 60.0 * ((rgb.r - rgb.g) / delta + 4.0);\n }\n \n float l = (cMax + cMin) / 2.0;\n \n float s = 0.0;\n if (delta == 0.0) {\n s = 0.0;\n } else {\n s = delta / (1.0 - abs(2.0 * l - 1.0));\n }\n \n return vec3(h, s, l);\n}\n",pA=[dA],fA={biLevel:"\nvec4 transform(vec4 texColor, float arg) {\n vec3 hsl = rgb2hsl(texColor.rgb);\n mat3 rgb2yuv = mat3(\n 0.2126, 0.7152, 0.0722,\n -0.09991, -0.33609, 0.43600,\n 0.615, -0.5586, -0.05639\n );\n vec3 yuv = texColor.rgb * rgb2yuv;\n if (yuv.x >= 0.49 || texColor.a < 0.9) {\n return vec4(1.0, 1.0, 1.0, 1.0) * texColor.a;\n } else {\n return vec4(0.0, 0.0, 0.0, 1.0) * texColor.a;\n }\n}\n",alphaModFix:"\nvec4 transform(vec4 texColor, float arg) {\n return texColor * arg;\n}\n"};class mA extends Gx{constructor(t,e){var n;super(void 0,(n=fA[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg;\nuniform sampler2D uSampler;\n\n${pA.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg);\n}\n`),{arg:e})}}const gA=[dA],vA={clrChange:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float epsilon = 0.001;\n vec3 colorDiff = arg1.rgb - (texColor.rgb / max(texColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n if (colorDistance < epsilon) {\n arg2.rgb *= arg2.a;\n return arg2;\n } else {\n return texColor;\n }\n}\n",changeBulletColor:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n if (texColor.a == 0.0) {\n return texColor;\n } else {\n return arg2;\n }\n}\n"};class _A extends Gx{constructor(t,e,n){var i;super(void 0,(i=vA[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform vec4 arg2;\nuniform sampler2D uSampler;\n\n${gA.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:Float32Array.from(e),arg2:Float32Array.from(n)})}}const yA=[dA],xA={lum:"\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n if (arg1 > 0.0) {\n texColor.r += (1.0 - texColor.r) * arg1;\n texColor.g += (1.0 - texColor.g) * arg1;\n texColor.b += (1.0 - texColor.b) * arg1;\n } else if (arg1 < 0.0) {\n texColor.r -= texColor.r * arg1;\n texColor.g -= texColor.g * arg1;\n texColor.b -= texColor.b * arg1;\n }\n // todo 对比度\n texColor.rgb *= texColor.a;\n return texColor;\n}\n"};class bA extends Gx{constructor(t,e,n){var i;super(void 0,(i=xA[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg1;\nuniform float arg2;\nuniform sampler2D uSampler;\n\n${yA.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:e,arg2:n})}}class TA{constructor(t,e,n,i,r){this.ctx=t,this.fillStyle=e,this.width=n,this.height=i,this.config=r,this.clonedObjects=[],this._displayObject=null,this.gradientHash=fM()(`${JSON.stringify(e)}${Math.ceil(n)}${Math.ceil(i)}`)}get displayObject(){return this._displayObject||(this._displayObject=this.createDisplayObject()),this._displayObject}set displayObject(t){this._displayObject&&this._displayObject.destroy({children:!0,texture:!0}),this._displayObject=t}get hasFill(){return!!this.fillStyle&&"noFill"!==this.fillStyle.fillType}createDisplayObject(){var t;if(!this.fillStyle)return null;if(this.config.useSlideBackgroundFill&&this.ctx.bgTexture){const t=new Ow;return t.texture=this.ctx.bgTexture,t}if("solidFill"===this.fillStyle.fillType||"noFill"===this.fillStyle.fillType)return null;if("gradientFill"===this.fillStyle.fillType){const t=new Ow;let e=TA.gradientPool.get(this.gradientHash);if(!e){const t=hA(this.fillStyle,this.width,this.height),n=Hy.create({width:this.width,height:this.height,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(t,{renderTexture:n}),e=n,TA.gradientPool.set(this.gradientHash,e),t.destroy({children:!0,texture:!0})}return t.texture=e,t}if("blipFill"===this.fillStyle.fillType){const{src:e,filters:n}=this.fillStyle,i=this.ctx.spriteTexture.getTexture(e),r=this.ctx.spriteTexture.getFrameData(e);if(i){const e=new Ow;if(e.texture=i,n.length>0&&this.config.useFilter&&(e.filters=function(t){const e=[];return t.forEach(t=>{if("biLevel"===t.type)e.push(new mA("biLevel",t.args[0]));else if("clrChange"===t.type||"changeBulletColor"===t.type){const n=LM(t.args[0]),i=LM(t.args[1]);e.push(new _A(t.type,n,i))}else"alphaModFix"===t.type?e.push(new mA(t.type,t.args[0])):"lum"===t.type&&e.push(new bA(t.type,t.args[0],t.args[1]))}),e}(n)),this.config.fillFloat){const{l:n,t:i,r:r,b:o}=this.config.fillFloat.fillRect,s=this.width*(1-n-r),a=this.height*(1-i-o),l=null!==(t=this.config.shapeRotation)&&void 0!==t?t:0,u=new Aw;u.drawRect(0,0,s,a),u.pivot.x=s/2,u.pivot.y=a/2,u.rotation=l;const h=u.getBounds(),c=h.width,d=h.height;e.width=c,e.height=d,e.anchor.x=.5,e.anchor.y=.5,e.rotation=-1*l,e.name="math-texture",0===l?(e.position.x=c/2+n*this.width,e.position.y=d/2+i*this.width):(e.position.x=this.width/2,e.position.y=this.height/2)}else e.width=this.width,e.height=this.height,r.rotate&&(e.position.x=this.width/2,e.position.y=this.height/2,e.anchor.x=.5,e.anchor.y=.5,e.rotation=r.rotate/180*Math.PI);return e}}else if("gifFill"===this.fillStyle.fillType){const{src:t,delays:e}=this.fillStyle,n=this.ctx.spriteTexture.getGifFrames(t).map((t,n)=>({texture:t,time:e[n]||20})),i=new jE(n,!0);i.width=this.width,i.height=this.height;const r=this.fillStyle.loop;let o=1;return i.onLoop=()=>{o+=1,r>0&&o>r&&i.gotoAndStop(i.totalFrames)},i}return null}isSolidFill(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)}getSolidFillColor(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)?this.fillStyle.color:"#000000"}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}TA.gradientPool=new Map;var wA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class SA extends zM{constructor(t,e,n){var i;super(t,e,n),this.textureContainer=new ty,this.underline=null,this.cacheSprite=new Ow;const{shapeId:r,paragraphIndex:o,lineIndex:s,unitIndex:a,lineHeight:l,width:u,underLine:h,fill:c,height:d,isHorz:p,lineWidth:f}=t,m="solidFill"===(null===(i=null==c?void 0:c.fill)||void 0===i?void 0:i.fillType)?c.fill.color:null;if(h){const t=p?l/16:f/16;this.underline=new jM(e,h.type,t,u,d,m,p,r,o,s,a)}this.textGraphics=this.createTextGraphics(),this.textFill=this.createTextFill(),this.strokeGraphics=this.createStrokeGraphics(),this.strokeFill=this.createStrokeFill()}createStrokeFill(){const{stroke:t,lineWidth:e,lineHeight:n}=this.json;return new TA(this.ctx,null==t?void 0:t.fill,e,n,{useFilter:!1,useSlideBackgroundFill:!1})}createStrokeGraphics(){const{stroke:t}=this.json,e=(null==t?void 0:t.key)?{fillType:"blipFill",src:t.key,filters:[]}:void 0;return new TA(this.ctx,e,(null==t?void 0:t.width)||0,(null==t?void 0:t.height)||0,{useFilter:!1,useSlideBackgroundFill:!1})}createTextFill(){const{isHorz:t,fill:e,lineWidth:n,lineHeight:i,fillLineHeight:r}=this.json;return t?new TA(this.ctx,null==e?void 0:e.fill,n,Math.max(r,i),{useFilter:!1,useSlideBackgroundFill:!1}):new TA(this.ctx,null==e?void 0:e.fill,r,i,{useFilter:!1,useSlideBackgroundFill:!1})}createTextGraphics(){var t;const{fill:e,content:n}=this.json;let i="#000000";"solidFill"===(null===(t=null==e?void 0:e.fill)||void 0===t?void 0:t.fillType)&&(i=e.fill.color);const r=(null==e?void 0:e.key)?{fillType:"blipFill",src:e.key,filters:[{type:"changeBulletColor",args:["#000000",i]}]}:void 0;return new TA(this.ctx,r,(null==e?void 0:e.width)||0,(null==e?void 0:e.height)||0,{useFilter:"◾"===n,useSlideBackgroundFill:!1})}getIterateEntry(){return null}getBgElement(){return null}updateTransform(t){var e,n,i,r;const{isHorz:o}=this.json;t.position={x:o&&null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,y:o?0:null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0},t.width=o?this.json.width:this.json.lineWidth,t.height=o?this.json.lineHeight:this.json.height,super.updateTransform(t)}preRender(){var t;null===(t=this.underline)||void 0===t||t.preRender()}render(t){t.addSubMTask(()=>wA(this,void 0,void 0,(function*(){this.doRender()})),"@TextUnitImpl[doRender]")}doRender(){let t=!1;const{lineWidth:e,lineHeight:n,baseLine:i,isHorz:r,underline:o,height:s,width:a,highlightColor:l,x:u,y:h,content:c,fillLineHeight:d,fill:p}=this.json;let f=!1!==this.json.needFill;if(p&&p.fill&&"solidFill"!==p.fill.fillType&&(f=!0),l){const t=new Aw,[i,o]=OM(l);t.beginFill(i,o),t.drawRect(0,0,r?a:e,r?n:s),t.endFill(),this.textureContainer.addChild(t)}if(this.textGraphics.displayObject){const e=this.textGraphics.displayObject;if(r&&(e.position.y=h>0?h:0),f){const n=this.textFill.displayObject;if(n)n.mask=e,n.addChild(e),n.position.x=-u,e.position.x+=u,t=!0,this.textureContainer.addChild(n);else if(this.textFill.isSolidFill()){const n=new FM;n.color=this.textFill.getSolidFillColor(),e.filters=[n],t=!0,this.textureContainer.addChild(e)}}else this.textureContainer.addChild(e)}if(this.strokeGraphics.displayObject){const e=this.strokeGraphics.displayObject;if(f){const n=this.strokeFill.displayObject;if(n)n.mask=e,n.addChild(e),r?n.position.y=h>0?h:0:n.position.x=u,this.textureContainer.addChild(n);else if(this.strokeFill.isSolidFill()){r?e.position.y=h>0?h:0:e.position.x=u;const n=new FM;n.color=this.strokeFill.getSolidFillColor(),e.filters=[n],t=!0,this.textureContainer.addChild(e)}}else r?e.position.y=h>0?h:0:e.position.x=u,this.textureContainer.addChild(e)}if(this.underline&&(this.underline.render(),this.underline.sprite)){r?(this.underline.sprite.position.y=o?o-n/16:i,this.underline.sprite.position.x=0):(this.underline.sprite.position.x=0,this.underline.sprite.position.y=0);const t=this.textFill.getClonedDisplayObject();t?(t.mask=this.underline.sprite,t.addChild(this.underline.sprite),this.textureContainer.addChild(t)):this.textureContainer.addChild(this.underline.sprite)}if(t){const t=Hy.create({width:r?a:e,height:r?Math.max(d,n):s,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(this.textureContainer,{renderTexture:t}),this.cacheSprite.texture=t,r&&h<0&&(this.cacheSprite.position.y=h),this.container.addChild(this.cacheSprite)}else this.container.addChild(this.textureContainer);this.container.name=c}destroy(){this.textFill.destroy(),this.textGraphics.destroy(),this.strokeFill.destroy(),this.strokeGraphics.destroy(),this.cacheSprite.texture.destroy(!0),this.cacheSprite.destroy(),this.textureContainer.destroy(),this.container.destroy()}}var EA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class MA extends zM{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(t,e,n){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){}createUnits(t,e,n,i){for(let r=0,o=this.json.textUnits.length;r<o;r++)i.addSubMTask(()=>EA(this,void 0,void 0,(function*(){const i=this.json.textUnits[r],{height:o,width:s,fillHeight:a,baseline:l,y:u,underline:h}=this.json,c=new SA(Object.assign(Object.assign({},i),{lineHeight:o,lineWidth:s,baseLine:l-u,underline:h,fillLineHeight:a||o,isHorz:this.isHorz,shapeId:t,paragraphIndex:e,lineIndex:n,unitIndex:r}),this.ctx,this.global);c.preRender(),this.units.push(c)})),"@TextLineImpl[createUnits]")}render(t){for(const e of this.units.reverse())e.render(t),t.addSubMTask(()=>EA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextLineImpl[container.addChild]")}destroy(){this.units.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var AA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class RA extends zM{constructor(){super(...arguments),this.iterateElements=[],this.lines=[],this.isHorz=!0}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const t=this.lines.reduce((t,e)=>t=t.concat(e.getIterateElements()),[]);return this.iterateElements=t,t}getIterateEntry(t,e,n){const i=this.getIterateElements();return i[e]?i[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){}createLines(t,e,n){for(let i=0,r=this.json.lines.length;i<r;i++)n.addSubMTask(()=>AA(this,void 0,void 0,(function*(){const r=this.json.lines[i],o=new MA(r,this.ctx,this.global);o.isHorz=this.isHorz,o.container.name="line-"+i,o.createUnits(t,e,i,n),this.lines.push(o)})),"@TextParagraphImpl[createLines]")}render(t){for(const e of this.lines)e.render(t),t.addSubMTask(()=>AA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextParagraphImpl[container.addChild]")}destroy(){this.lines.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var PA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class CA{constructor(t,e,n,i){this.iterateElements=[],this.paragraphs=[],this.container=new ty,this.json=t,this.ctx=e,this.parentGlobalPos=i,this.iterateType=n,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+t.position.x,y:this.parentGlobalPos.y+t.position.y},this.container.position.x=t.position.x,this.container.position.y=t.position.y,this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y;const r=new Aw;r.drawRect(0,0,t.width,t.height),this.container.addChild(r)}get width(){return this.json.width}get height(){return this.json.height}get x(){return this.json.position.x}get y(){return this.json.position.y}getTextElement(t,e){return"paragraph"===t?this.paragraphs[e[0]]:null}getIterateEntry(t,e){return this.iterateElements[t]?this.iterateElements[t]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(t=>{t.destroy()})}createParagraphs(t,e){for(let n=0,i=this.json.paragraphs.length;n<i;n++)e.addSubMTask(()=>PA(this,void 0,void 0,(function*(){var i;const r=this.json.paragraphs[n],o=new RA(r,this.ctx,this.global);o.isHorz=null===(i=this.json.isHorz)||void 0===i||i,o.createLines(t,n,e),e.addSubMTask(()=>PA(this,void 0,void 0,(function*(){this.iterateElements=this.iterateElements.concat(o.getIterateElements()),o.container.name="段落-"+n,this.paragraphs.push(o)})),"@TextBodyImpl[paragraphs.push]")})),"@TextBodyImpl[createParagraphs]")}render(t){for(const e of this.paragraphs)e.render(t),t.addSubMTask(()=>PA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextBodyImpl[container.addChild]");t.addSubMTask(()=>PA(this,void 0,void 0,(function*(){const{width:t}=this.container;this.container.scale.x<0&&(this.container.x+=-1*t)})),"@TextBodyImpl[reset width]")}}var IA=n(47),OA=n.n(IA),LA=n(48),NA=n.n(LA);const DA={Reflection:class extends Gx{constructor(t){super(OA.a,NA.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uStartAlpha:t.startAlpha,uEndAlpha:t.endAlpha,uBlur:0}),this.json=t}}};class FA{constructor(t){this.scaleX=1,this.scaleY=1,this.pivot={x:0,y:0},this.paths=[],this.hash="",this.width=0,this.height=0,this.graphicsId="",this.textureId="",this.id=t.id,this.type=t.type,this.heightSize=t.heightSize,this.widthSize=t.widthSize,this.fillStyle=t.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=t.lineWidth||1,this.position=t.position||{x:0,y:0},this.rotate=t.rotation||1,this.path=this.getUnitPath(),this.setScaleFromLineWidth(),this.setScaleFromSize(),this.generatePaths(),this.setPivot()}setPivot(){switch(this.type){case"oval":case"diamond":this.pivot={x:this.width/2,y:this.height/2};break;case"triangle":this.pivot={x:.7*this.width,y:this.height/2};break;case"arrow":case"stealth":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+fM()(this.path+this.scaleX+this.scaleY),this.paths=[{id:this.id,path:this.path,fill:"norm",hasStroke:!1,hash:this.hash,scale:{x:this.scaleX,y:this.scaleY}}]}getUnitPath(){switch(this.type){case"stealth":return"M 0,0 L 95250,47625 L 0,95250 L 28575,47625 C C";case"oval":return"M 0,47625 A 47625,47625,-3.14159265,6.2831853 C C";case"diamond":return"M 47625,0 L 95250,47625 L 47625,95250 L 0,47625 C C";case"arrow":return"M 9525,0 L 95250,47625 L 9525,95250 L 0,85725 L 68389.5,47625 L 0,9525 C C";case"triangle":return"M 0,0 L 95250,47625 L 0,95250 C C";default:return""}}setScaleFromLineWidth(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=.29*this.lineWidth+.7,this.scaleY*=.29*this.lineWidth+.7;break;default:throw new Error("can't match any arrow type!")}}setScaleFromSize(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=1,this.scaleY*=1;break;default:throw new Error("can't match any arrow type!")}switch(this.widthSize){case"sm":this.scaleX*=3/4;break;case"lg":this.scaleX*=1.25;break;case"med":this.scaleX*=1}switch(this.heightSize){case"sm":this.scaleY*=3/4;break;case"lg":this.scaleY*=1.25;break;case"med":this.scaleY*=1}this.width=10*this.scaleX,this.height=10*this.scaleY}}class BA{constructor(t,e,n,i,r,o,s,a,l,u,h){this.id=t,this.ctx=e,this.paths=n,this.hash=i,this.nept=r,this.width=o,this.height=s,this.lineStyle=a,this.shouldFill=l,this.bgColor=u,this.lnColor=h,this.clonedObjects=[],this._displayObject=null,this.isRectangle=!1,this.isPureRect=!1,this.isColoredPureRect=!1,this.isRectangle=this.rectangleDetect(n),this.isRectangle&&l?this.bgColor?this.isColoredPureRect=!0:this.isPureRect=!0:this.ctx.graphicsTexture.addGraphics(this.id,this.paths,this.hash,this.nept,this.width,this.height,this.lineStyle,this.ctx.objectPoolGroup,this.shouldFill,this.bgColor,this.lnColor)}get displayObject(){return this._displayObject}pointDis(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)}rectangleDetect(t){if(1!==t.length)return!1;const e=t[0].path.trim().split(" ");if(10!==e.length)return!1;const n=[],i=[];for(let t=0;t<e.length;t+=2){const r=e[t],o=e[t+1],[s,a]=o.split(",").map(t=>Number(t)/100);n.push(r),i.push({x:s,y:a})}if("MLLLC"!==n.join(""))return!1;for(let t=0;t<3;t++){const e=i[t],n=i[t+1];if(e.x!==n.x&&e.y!==n.y)return!1}const r=i.slice(0,4).reduce((t,e)=>t+e.x,0)/4,o=i.slice(0,4).reduce((t,e)=>t+e.y,0)/4;if(Number.isNaN(r)||Number.isNaN(o))return!1;const s={x:r,y:o};return $E(this.pointDis(s,i[0]),this.pointDis(s,i[1]))&&$E(this.pointDis(s,i[0]),this.pointDis(s,i[2]))&&$E(this.pointDis(s,i[0]),this.pointDis(s,i[3]))&&this.pointDis(s,i[0])===this.pointDis(s,i[1])}createDisplayObject(){if(this.isPureRect){const t=new Aw;return t.beginFill(0,1),t.drawRect(0,0,this.width,this.height),t}if(this.isColoredPureRect&&this.bgColor){const t=new Aw,[e,n]=OM(this.bgColor);return t.beginFill(e,n),t.drawRect(0,0,this.width,this.height),t}{const t=new Ow,e=this.ctx.graphicsTexture.getGraphicsData(this.id);return e?(t.texture=e.texture,t.pivot.x=e.pivot.x,t.pivot.y=e.pivot.y,t):null}}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}render(){this._displayObject=this.createDisplayObject()}isNeedMask(t,e){let n=!1;return this._displayObject&&(n=!(this.isRectangle&&Math.abs(t-this._displayObject.width)<2&&Math.abs(e-this._displayObject.height)<2&&this.shouldFill)),n}addArrows(t){var e;null===(e=this._displayObject)||void 0===e||e.addChild(t)}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}var UA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const kA={pivot:{x:0,y:0},width:0,height:0};class GA extends PM{constructor(t,e,n,i){var r;super(t,e,n),this.renderContainer=new ty,this.needCacheAsBitMap=!1,this.backgroundGraphics=null,this.filterAreaJustifies=[],this.strokeGraphics=null,this.arrowList=[],this.fillColorFilter=new FM,this.strokeColorFilter=new FM,this.id="",this.fill=new MM(this),this.stroke=new SM(this),this.updateFilterArea=()=>{const t=this.renderContainer.getBounds(!1),e=this.filterAreaJustifies.map(e=>e(t)),n=e.map(t=>t.width),i=e.map(t=>t.height),r=new d_(t.x,t.y,Math.max(...n),Math.max(...i));this.renderContainer.filterArea=r,(this.renderContainer.filters||[]).forEach(t=>{t.uniforms.uShapeFilterArea=new Float32Array(4),t.uniforms.uShapeFilterArea[0]=r.x,t.uniforms.uShapeFilterArea[1]=r.y,t.uniforms.uShapeFilterArea[2]=r.width,t.uniforms.uShapeFilterArea[3]=r.height})},this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i&&(this.json.fillStyle=i),this.id=t.id;const{fillStyle:o,lineStyle:s}=this.json;this.container.name=t.id,this.renderContainer.name=t.id+"-render-container",this.generateArrowList(),this.backgroundFill=this.createBackgroundFill(),this.backgroundGraphics=this.createBackgroundGraphics(),this.strokeFill=this.createStrokeFill(),this.strokeGraphics=this.createStrokeGraphics(),this.ctx.timingTargets.addTarget(this.id,this),"solidFill"===(null==o?void 0:o.fillType)&&(this.fillColorFilter.currentColor=o.color,this.fillColorFilter.designColor=o.color),"solidFill"===(null===(r=null==s?void 0:s.fill)||void 0===r?void 0:r.fillType)&&(this.strokeColorFilter.currentColor=s.fill.color,this.strokeColorFilter.designColor=s.fill.color),this.updateTransform(this.json),t.textBody&&(this.text=new CA(t.textBody,this.ctx,t.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new g_(1,1,this.json.width,this.json.height)}get interactiveContainer(){return this.renderContainer}get strokeActive(){var t,e,n,i,r,o,s;return this.strokeFill.displayObject?(null!==(n=null===(e=null===(t=this.strokeFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==n?n:-1)>0:(null!==(s=null===(o=null===(r=null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set strokeActive(t){var e,n,i,r,o,s;const{displayObject:a}=this.strokeFill;t?a&&(null!==(n=null===(e=a.filters)||void 0===e?void 0:e.indexOf(this.strokeColorFilter))&&void 0!==n?n:-1)<0?a.filters=[this.strokeColorFilter]:(null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)&&(null!==(o=null===(r=this.strokeGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.strokeColorFilter))&&void 0!==o?o:-1)<0&&(this.strokeGraphics.displayObject.filters=[this.strokeColorFilter]):a?a.filters=[]:(null===(s=this.strokeGraphics)||void 0===s?void 0:s.displayObject)&&(this.strokeGraphics.displayObject.filters=[])}get fillActive(){var t,e,n,i,r,o,s;return this.backgroundFill.displayObject?(null!==(n=null===(e=null===(t=this.backgroundFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==n?n:-1)>0:(null!==(s=null===(o=null===(r=null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set fillActive(t){var e,n,i,r,o,s;t?this.backgroundFill.displayObject&&(null!==(n=null===(e=this.backgroundFill.displayObject.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0?this.backgroundFill.displayObject.filters=[this.fillColorFilter]:(null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)&&(null!==(o=null===(r=this.backgroundGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.fillColorFilter))&&void 0!==o?o:-1)<0&&(this.backgroundGraphics.displayObject.filters=[this.fillColorFilter]):this.backgroundFill.displayObject?this.backgroundFill.displayObject.filters=[]:(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.displayObject)&&(this.backgroundGraphics.displayObject.filters=[])}getTextElement(t,e){var n,i;return null!==(i=null===(n=this.text)||void 0===n?void 0:n.getTextElement(t,e))&&void 0!==i?i:null}getBgElement(){return this}getIterateEntry(t,e,n){return 0===e?this:"el"===t?(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null):this.text?this.text.getIterateEntry(e-1,n)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}createStrokeGraphics(){var t,e,n,i;const{id:r,geometry:o,lineStyle:s}=this.json,{width:a,height:l,pivot:u}=(null==o?void 0:o.lineTransform)||kA,h=a||this.json.width,c=l||this.json.height,d="solidFill"===(null===(t=null==s?void 0:s.fill)||void 0===t?void 0:t.fillType)?s.fill.color:null;return s&&"noFill"!==(null===(e=s.fill)||void 0===e?void 0:e.fillType)?new BA(r+"-path-graphics",this.ctx,null!==(n=null==o?void 0:o.paths)&&void 0!==n?n:[],null!==(i=null==o?void 0:o.hash)&&void 0!==i?i:"",u||{x:0,y:0},h,c,s,!1,null,d):null}createStrokeFill(){const[t,e]=this.calculateFillObjectOffset(),{geometry:n,lineStyle:i,width:r,height:o}=this.json,s=(null==n?void 0:n.lineTransform)||kA,a=Object(l.isNumber)(null==i?void 0:i.width)?i.width:1;return new TA(this.ctx,null==i?void 0:i.fill,(s.width||r)+a+t,Math.max((s.height||o)+a,e),{useFilter:!1,useSlideBackgroundFill:!1})}createBackgroundGraphics(){var t;const{geometry:e,lineStyle:n,fillStyle:i,id:r}=this.json,{width:o,height:s,pivot:a}=(null==e?void 0:e.lineTransform)||kA,l=o||this.json.width,u=s||this.json.height,h="solidFill"===(null==i?void 0:i.fillType)?i.color:null;return i&&"noFill"!==i.fillType||this.json.isPicture?new BA(r+"-bg-graphics",this.ctx,null!==(t=null==e?void 0:e.paths)&&void 0!==t?t:[],(null==e?void 0:e.hash)||"",a||{x:0,y:0},l,u,n,!0,h,null):null}createBackgroundFill(){var t,e;const{fillStyle:n,width:i,height:r,lineStyle:o,geometry:s}=this.json,a=(null==s?void 0:s.fillTransform)||kA;return new TA(this.ctx,n,(a.width||i)+(null!==(t=null==o?void 0:o.width)&&void 0!==t?t:0),(a.height||r)+(null!==(e=null==o?void 0:o.width)&&void 0!==e?e:0),{useFilter:!1,useSlideBackgroundFill:this.json.useBgFill,fillFloat:this.json.fillFloat,shapeRotation:this.json.rotation})}createBackground(){var t,e,n,i,r,o,s,a;const{pivot:l,width:u,height:h}=(null===(t=this.json.geometry)||void 0===t?void 0:t.fillTransform)||kA,{displayObject:c}=this.backgroundFill;c?(this.json.useBgFill&&(null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)?(this.needCacheAsBitMap=!0,c.mask=this.backgroundGraphics.displayObject,c.pivot.x=(null===(i=this.json.position)||void 0===i?void 0:i.x)||0,c.pivot.y=(null===(r=this.json.position)||void 0===r?void 0:r.y)||0,this.container.addChild(this.backgroundGraphics.displayObject)):"gifFill"===(null===(o=this.json.fillStyle)||void 0===o?void 0:o.fillType)?(c.height=h||this.designHeight,c.width=u||this.designWidth,c instanceof jE&&c.play(),(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.isNeedMask(c.width,c.height))&&(c.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.container.addChild(this.backgroundGraphics.displayObject))):(null===(a=this.backgroundGraphics)||void 0===a?void 0:a.isNeedMask(c.width,c.height))&&(this.json.fillFloat||(this.needCacheAsBitMap=!0,c.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.container.addChild(this.backgroundGraphics.displayObject))),this.json.fillFloat||(c.x=l.x,c.y=l.y),this.container.addChild(c)):this.backgroundFill.hasFill&&(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.displayObject)&&this.container.addChild(this.backgroundGraphics.displayObject)}createPathFill(){var t,e,n;const{displayObject:i}=this.strokeFill,r=null===(t=this.strokeGraphics)||void 0===t?void 0:t.displayObject,[o,s]=this.calculateFillObjectOffset();i?((null===(e=this.strokeGraphics)||void 0===e?void 0:e.isNeedMask(i.width,i.height))&&r&&(this.needCacheAsBitMap=!0,i.pivot.x=r.pivot.x,i.pivot.y=r.pivot.y,r.pivot.x=0,r.pivot.y=0,i.mask=r,i.addChild(r),i.position.x=-o/2,i.position.y=-s/2,r.position.x=o/2,r.position.y=s/2),this.container.addChild(i)):this.strokeFill.hasFill&&(null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)&&this.container.addChild(this.strokeGraphics.displayObject)}createFilledPathMask(){var t,e,n;const i=(null===(e=null===(t=this.json.geometry)||void 0===t?void 0:t.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[];for(const t of i){const e=this.ctx.graphicsTexture.getGraphicsData(t.id);if(e){const i=new Ow(e.texture);i.pivot.x=e.pivot.x,i.pivot.y=e.pivot.y;const r=this.backgroundFill.getClonedDisplayObject(),o=null===(n=this.backgroundGraphics)||void 0===n?void 0:n.getClonedDisplayObject(),s=r||o;s&&(this.backgroundFill.displayObject&&(s.pivot.x=this.backgroundFill.displayObject.pivot.x,s.pivot.y=this.backgroundFill.displayObject.pivot.y),s.mask=i,s.filters=[HM[t.fill]],this.needCacheAsBitMap=!0,this.container.addChild(s),this.container.addChild(i))}}}createArrow(){this.arrowList.length&&this.arrowList.forEach(t=>{var e;const n=this.ctx.graphicsTexture.getGraphicsData(t.graphicsId);if(n){const{texture:i}=n,r=new Ow(i);r.pivot.x=t.pivot.x,r.pivot.y=t.pivot.y,r.position.x=t.position.x,r.position.y=t.position.y,r.rotation=t.rotate/180*Math.PI,null===(e=this.backgroundGraphics)||void 0===e||e.addArrows(r)}})}generateArrowList(){var t,e;const{lineArrowList:n,lineStyle:i,id:r}=this.json,o="solidFill"===(null===(t=null==i?void 0:i.fill)||void 0===t?void 0:t.fillType)?i.fill.color:null;null===(e=n||[])||void 0===e||e.forEach((t,e)=>{var n,s;const a=new FA(Object.assign(Object.assign({},t),{fillStyle:null==i?void 0:i.fill,lineWidth:null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0}));a.graphicsId=`${r}-arrow-${e}-graphics`,a.textureId=`${r}-arrow-${e}-fill`,this.ctx.graphicsTexture.addGraphics(a.graphicsId,null!==(s=a.paths)&&void 0!==s?s:[],a.hash,{x:0,y:0},a.width,a.height,void 0,this.ctx.objectPoolGroup,!0,o,null),this.arrowList.push(a)})}calculateFillObjectOffset(){let[t,e]=[0,0];return this.arrowList.length&&(t=this.arrowList.reduce((t,e)=>Math.max(t,e.width),0),e=this.arrowList.reduce((t,e)=>Math.max(t,e.height),0)),[t,e]}preRender(t){var e,n,i;const{lineStyle:r,geometry:o}=this.json,{width:s,height:a}=(null==o?void 0:o.lineTransform)||kA,l=s||this.json.width,u=a||this.json.height,h=(null===(e=null==o?void 0:o.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[],c="solidFill"===(null===(n=null==r?void 0:r.fill)||void 0===n?void 0:n.fillType)?r.fill.color:null;t.addSubMTask(()=>UA(this,void 0,void 0,(function*(){for(const t of h)this.ctx.graphicsTexture.addGraphics(t.id,[t],t.hash,((null==o?void 0:o.lineTransform)||kA).pivot,l,u,r,this.ctx.objectPoolGroup,!0,null,c)})),"@ShapeImpl[addGraphics]"),null===(i=this.text)||void 0===i||i.createParagraphs(this.json.id,t)}subClassRender(){}setupEffect(){const{effectList:t}=this.json;if(t&&t.length>0){const e=[];return t.forEach(t=>{"reflection"===t.type&&(this.filterAreaJustifies.push(t=>(t.height*=2,t)),e.push(new DA.Reflection(t)))}),this.ctx.ticker.add(this.updateFilterArea,void 0,-20),this.renderContainer.filters=e,!0}return!1}render(t){t.addSubMTask(()=>UA(this,void 0,void 0,(function*(){var t,e;null===(t=this.strokeGraphics)||void 0===t||t.render(),null===(e=this.backgroundGraphics)||void 0===e||e.render(),this.createBackground(),this.subClassRender(),this.createFilledPathMask(),this.createPathFill(),this.createArrow()})),"@ShapeImpl[render]"),this.text&&this.text.render(t),t.addSubMTask(()=>UA(this,void 0,void 0,(function*(){var t,e,n,i,r,o,s,a;if("wd"===(null===(t=this.json.textBody)||void 0===t?void 0:t.iterateType)||"lt"===(null===(e=this.json.textBody)||void 0===e?void 0:e.iterateType))this.renderContainer.addChild(this.container),this.text&&(this.text.container.scale.y=null!==(i=null===(n=this.json.scale)||void 0===n?void 0:n.y)&&void 0!==i?i:1,this.text.container.position.x+=(null!==(o=null===(r=this.json.position)||void 0===r?void 0:r.x)&&void 0!==o?o:0)+this.text.x,this.text.container.position.y+=(null!==(a=null===(s=this.json.position)||void 0===s?void 0:s.y)&&void 0!==a?a:0)+this.text.y,-1===this.text.container.scale.y&&(this.text.container.position.y+=this.text.height),this.renderContainer.addChild(this.text.container));else{if(this.text){if(Object(l.isBoolean)(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const t=this.json.rotation||0;this.text.container.rotation=-t;const{width:e}=this.text;this.text.container.position.x=e}this.container.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.needCacheAsBitMap,"background"===this.json.id&&this.ctx.hasBackgroundFillShape){const t=Hy.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:t}),this.ctx.bgTexture=t}})),"@ShapeImpl[post.render]")}clearOnSlideChange(){}initOnReuse(){}isStatic(){return!!this.json.cacheAsBitMap&&!this.ctx.animatedIds.has(this.json.id)}destroy(){var t,e,n,i;null===(t=this.text)||void 0===t||t.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.backgroundFill.destroy(),null===(e=this.backgroundGraphics)||void 0===e||e.destroy(),this.strokeFill.destroy(),null===(n=this.strokeGraphics)||void 0===n||n.destroy(),this.renderContainer.destroy(),null===(i=this.arrowRenderTexture)||void 0===i||i.destroy(!0),this.arrowList=[]}}var HA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function zA(t,e){for(const n in e)t.style[n]=e[n]}class jA{constructor(t){var e,n;this.progress=document.createElement("div"),this.totalTime=document.createElement("span"),this.playButton=document.createElement("div"),this.pauseButton=document.createElement("div"),this.currentTime=document.createElement("span"),this.mediaController=document.createElement("div"),this.currentProgress=document.createElement("div"),this.medianIsEnd=!1,this.pickBookmarkIndex=0,this.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=t=>{if(this.ctx.isPlayerPaused())return void this.ctx.logger.info("Media controller prevent seek event with paused state",this.ctx.taskId);t.stopPropagation();const e=t.offsetX/this.progress.clientWidth*this.duration;this.medianIsEnd=!1,"interactive"!==this.ctx.mode&&this.jumpToTime(e),"local"!==this.ctx.mode&&this.ctx.eventHub.emit($R.mediaSeek,{id:this.targetId,time:e,isPlaying:this.media.isPlaying})},this.jumpToTime=(t=0)=>{const e=Math.floor(t)+this.start;this.media.currentTime!==e&&(this.media.currentTime=e,this.changeBookmarkIndex(e,e>this.media.currentTime))},this.showController=t=>{t.stopPropagation(),this.show()},this.getMediaDuration=()=>{this.duration&&!Number.isNaN(this.duration)||(this.duration=this.media.duration,this.start&&(this.duration-=this.start,this.jumpToTime()),this.end&&(this.duration-=this.end)),this.totalTime.innerText=jA.formatTime(this.duration)},this.playMedia=()=>HA(this,void 0,void 0,(function*(){this.playButton.style.display="none",this.pauseButton.style.display="block",yield this.media.play(),this.medianIsEnd&&(this.medianIsEnd=!1,this.jumpToTime()),this.playCallBackList.forEach(t=>{t()})})),this.pauseMedia=()=>HA(this,void 0,void 0,(function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()})),this.onMouseOut=t=>{t.stopPropagation(),this.mediaController.style.display="none"},this.mediaTimeUpdate=()=>HA(this,void 0,void 0,(function*(){const t=this.media.currentTime-this.start;if(this.duration>0&&(t>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=jA.formatTime(t),this.currentProgress.style.flex=(t/this.duration).toString(),!this.bookmarkList||0===this.bookmarkList.length)return;const e=this.bookmarkList[this.pickBookmarkIndex];e&&e.time.toFixed(0)===this.media.currentTime.toFixed(0)&&(this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${e.name}`),this.pickBookmarkIndex+=1)})),this.onPauseMedia=()=>{this.playButton.style.display="block",this.pauseButton.style.display="none"},this.onPlayMedia=()=>{this.playButton.style.display="none",this.pauseButton.style.display="block",this.playCallBackList.forEach(t=>{t()})},this.playMediaFromCtrl=()=>{this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent play event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.playMedia(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit($R.mediaPlay,{id:this.targetId,time:this.media.currentTime-this.start}))},this.pauseMediaFromCtrl=()=>{this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent pause event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.pauseMedia(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit($R.mediaPause,{id:this.targetId,time:this.media.currentTime-this.start}))},this.targetId=t.targetId,this.ctx=t.ctx,this.height=t.height,this.width=t.width,this.target=t.target,this.media=t.media,this.info=t.info,this.shapeId=t.shapeId,this.canvasElement=t.canvasElement,this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=null!==(e=this.info.cut.start)&&void 0!==e?e:0,this.end=null!==(n=this.info.cut.end)&&void 0!==n?n:0),this.info.bookmarkList&&(this.bookmarkList=this.info.bookmarkList.sort((t,e)=>t.time-e.time))}getMedianContainer(){var t;let e=null===(t=this.canvasElement.parentElement)||void 0===t?void 0:t.querySelector(".median-container");e||(e=document.createElement("div"),e.className="median-container",this.canvasElement.parentElement.appendChild(e)),this.container=e}static formatTime(t){let e="00:00";if(t){const n=Math.floor(t/60),i=String(n<0?0:n).padStart(2,"0"),r=Math.floor(t%60);e=`${i}:${String(r<0?0:r).padStart(2,"0")}`}return e}createButton(){const t={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};zA(this.playButton,Object.assign(Object.assign({},t),{display:"block"}));const e=document.createElement("img");zA(e,{height:"20px"}),e.src="https://convertcdn.netless.link/publicFiles/icon/play.png",this.playButton.appendChild(e),zA(this.pauseButton,Object.assign(Object.assign({},t),{display:"none"}));const n=document.createElement("img");zA(n,{height:"20px"}),n.src="https://convertcdn.netless.link/publicFiles/icon/pause.png",this.pauseButton.appendChild(n)}createTimer(){const t=document.createElement("div");zA(t,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",t.append(this.currentTime,e,this.totalTime),t}createProgress(){zA(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const t=document.createElement("div");zA(t,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(t),zA(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),t.appendChild(this.currentProgress)}changeBookmarkIndex(t,e){if(this.bookmarkList&&0!==this.bookmarkList.length){if(this.pickBookmarkIndex>0)for(let e=0;e<this.pickBookmarkIndex;e++)if(this.bookmarkList[e].time>t){this.pickBookmarkIndex=e;break}if(e){let e=this.pickBookmarkIndex-1;for(let n=0;n<this.bookmarkList.length;n++)this.bookmarkList[n].time<t&&(e=n);for(let t=this.pickBookmarkIndex;t<=e;t++){const e=this.bookmarkList[t];e&&this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${e.name}`)}this.pickBookmarkIndex=e+1}}}bindEvent(){this.mediaController.addEventListener("mouseover",this.showController,!1),this.mediaController.addEventListener("mouseout",this.onMouseOut,!1),this.progress.addEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.addEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.addEventListener("click",this.pauseMediaFromCtrl,!1),this.media.on("durationchange",this.getMediaDuration,!1),this.media.on("timeupdate",this.mediaTimeUpdate,!1),this.media.on("pause",this.onPauseMedia,!1),this.media.on("play",this.onPlayMedia,!1)}setControllerPosition(){var t;const{target:e}=this,{stageWidth:n,stageHeight:i}=this.ctx,r=e.getGlobalPosition(),o=Number(null===(t=this.container)||void 0===t?void 0:t.getAttribute("data-scale")),s=n*o,a=1/o*(300>s?s/300:1);r.y=r.y+this.height-50,r.x=Math.max(r.x,0),r.x=Math.min(r.x,n-300*a),r.y=Math.max(r.y,0),r.y=Math.min(r.y,i-50),zA(this.mediaController,{height:"50px",borderRadius:"25px",width:"300px",flexDirection:"row",alignItems:"center",position:"absolute",left:r.x+"px",top:r.y+"px",display:"none",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${a})`,transformOrigin:"0 100%"})}createMediaController(){this.setControllerPosition(),this.createButton();const t=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,t,this.progress),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(t){this.playCallBackList.push(t)}unbindEvent(){this.mediaController.removeEventListener("mouseover",this.showController,!1),this.mediaController.removeEventListener("mouseout",this.onMouseOut,!1),this.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.removeEventListener("click",this.pauseMediaFromCtrl,!1),this.media.removeAllListeners()}show(){this.setControllerPosition(),this.mediaController.style.display="flex"}hide(){this.mediaController.style.display="none"}destroy(){var t;this.unbindEvent(),this.playCallBackList=[],null===(t=this.container)||void 0===t||t.removeChild(this.mediaController)}}var VA=n(49),WA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class XA extends a.a{constructor(t,e){super(),this.isGlobalPause=!1,this.lastTime=-1,this.howl=null,this.rctClient=null,this._isResourceExist="unknow",this.url=t,this.runningAudio=e,KR.RtcAudioClazz?(this.rctClient=new KR.RtcAudioClazz(t),this.rctClient.on("load",()=>this.emit("load")),this.rctClient.on("pause",()=>this.emit("pause")),this.rctClient.on("play",()=>this.emit("play"))):(this.howl=new VA.Howl({src:[t]}),this.howl.on("load",()=>this.emit("load")),this.howl.on("pause",()=>this.emit("pause")),this.howl.on("play",()=>this.emit("play"))),this.detectResourceExist()}startTimeChangeEmit(){this.currentTime!==this.lastTime&&(this.lastTime=this.currentTime,this.emit("timeupdate")),this.isEnded||setTimeout(()=>this.startTimeChangeEmit(),300)}detectResourceExist(){return new Promise(t=>{fetch(this.url,{method:"HEAD"}).then(e=>{this._isResourceExist=e.ok?"true":"false",t(e.ok)}).catch(()=>{this._isResourceExist="false",t(!1)})})}isResourceExist(){return WA(this,void 0,void 0,(function*(){return"unknow"!==this._isResourceExist?"true"===this._isResourceExist:this.detectResourceExist()}))}play(){var t,e,n;this.runningAudio.has(this.url)&&(null===(t=this.runningAudio.get(this.url))||void 0===t||t.stop(),this.runningAudio.delete(this.url)),this.lastTime=-1,null===(e=this.howl)||void 0===e||e.play(),null===(n=this.rctClient)||void 0===n||n.play(),this.startTimeChangeEmit(),this.runningAudio.set(this.url,this)}pause(){var t,e;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.rctClient)||void 0===e||e.pause(),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}globalPause(){this.isPaused||(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}stop(){var t;null===(t=this.howl)||void 0===t||t.stop(),this.rctClient&&(this.rctClient.pause(),this.rctClient.currentTime=0),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}destroy(){var t,e,n,i,r,o,s;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.howl)||void 0===e||e.unload(),null===(n=this.rctClient)||void 0===n||n.pause(),null===(i=this.rctClient)||void 0===i||i.destroy(),null===(r=this.rctClient)||void 0===r||r.removeAllListeners("load"),null===(o=this.rctClient)||void 0===o||o.removeAllListeners("play"),null===(s=this.rctClient)||void 0===s||s.removeAllListeners("pause"),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}get currentTime(){return this.rctClient?this.rctClient.currentTime:this.howl?this.howl.seek():-1}set currentTime(t){this.rctClient?this.rctClient.currentTime=t:this.howl&&this.howl.seek(t)}get duration(){return this.rctClient?this.rctClient.duration:this.howl?this.howl.duration():0}get isEnded(){return Math.abs(this.currentTime-this.duration)<.001}get isPaused(){return this.rctClient?this.rctClient.isPaused:!!this.howl&&this.howl.playing()}}var qA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class YA extends a.a{constructor(t){var e,n;super(),this.type="video",this.sprite=new Ow,this.isPlaying=!1,this.isGlobalPause=!1,this.id=t.id,this.start=null===(e=t.video.cut)||void 0===e?void 0:e.start,this.end=null===(n=t.video.cut)||void 0===n?void 0:n.end,this.container=t.container,this.ctx=t.ctx,this.ctx.medias[this.id]=this;let i=t.video.src;this.ctx.loaderDelegate&&(i=this.ctx.loaderDelegate.redirectMedia(i),this.ctx.logger.info(`redirect media url from ${t.video.src} to ${i} by delegate.`,t.ctx.taskId)),this.videoResource=new Iy(i,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});let r=t.video.src.replace(/4$/,"3");this.ctx.loaderDelegate&&(r=this.ctx.loaderDelegate.redirectMedia(r),this.ctx.logger.info(`redirect media url from ${t.video.src.replace(/4$/,"3")} to ${r} by delegate.`,t.ctx.taskId)),this.rtcAudio=new XA(r,t.ctx.runningAudio);const{video:o,width:s,height:a,target:l}=t;this.controller=new jA({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,width:s,height:a,target:l,media:this,info:o,canvasElement:t.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=s,this.sprite.height=a,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const u=new wy(null,{height:a,width:s});u.resource=this.videoResource,this.videoResource.bind(u),this.sprite=new Ow,this.sprite.visible=!1,this.sprite.texture=new ky(u),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",t=>{t.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",t=>{t.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(t=>{this.videoResource.source.addEventListener(t,()=>{"timeupdate"!==t||this.isPlaying||this.pause(),this.emit(t)})}),this.ctx.activeMedia.add(this)}get currentTime(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.currentTime)&&void 0!==e?e:0}set currentTime(t){KR.RtcAudioClazz&&(this.rtcAudio.currentTime=t),this.videoResource.source&&(this.videoResource.source.currentTime=t)}get paused(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.paused)||void 0===e||e}get ended(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.ended)||void 0===e||e}get duration(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.duration)&&void 0!==e?e:0}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){var t;return qA(this,void 0,void 0,(function*(){this.isPlaying=!0,yield this.load(),yield this.ctx.clock.waitUntil(()=>{const t=this.videoResource.source;return!!(t&&t.videoWidth>0)},3e3);const e=this.videoResource.source;if(e&&e.videoWidth<=0)return;const n=yield this.rtcAudio.isResourceExist();KR.RtcAudioClazz&&n?(this.videoResource.source.volume=0,this.rtcAudio.once("play",()=>{var t;null===(t=this.videoResource.source)||void 0===t||t.play()}),this.rtcAudio.play()):yield null===(t=this.videoResource.source)||void 0===t?void 0:t.play()}))}load(){return this.videoResource.load()}pause(){var t;this.isPlaying=!1,KR.RtcAudioClazz?(this.rtcAudio.once("pause",()=>{var t;null===(t=this.videoResource.source)||void 0===t||t.pause()}),this.rtcAudio.pause()):null===(t=this.videoResource.source)||void 0===t||t.pause()}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){var t;this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),null===(t=this.videoResource)||void 0===t||t.destroy(),this.rtcAudio.destroy(),this.controller.destroy(),this.ctx.activeMedia.delete(this)}}var ZA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class JA extends a.a{constructor(t){super(),this.type="audio",this.isPlaying=!1,this.isGlobalPause=!1,this.id=t.id;let e=t.audio.src;t.ctx.loaderDelegate&&(e=t.ctx.loaderDelegate.redirectMedia(e),t.ctx.logger.info(`redirect media url from ${t.audio.src} to ${e} by delegate.`,t.ctx.taskId)),this.audioPlayer=new XA(e,t.ctx.runningAudio),t.audio.cut&&(this.start=t.audio.cut.start,this.end=t.audio.cut.end),this.ctx=t.ctx,this.ctx.medias[this.id]=this;const{width:n,height:i,target:r}=t;this.controller=new jA({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,height:i,width:n,target:r,media:this,info:t.audio,canvasElement:t.canvasElement}),this.audioPlayer.on("load",()=>this.emit("durationchange")),this.audioPlayer.on("timeupdate",()=>this.emit("timeupdate")),this.audioPlayer.on("pause",()=>this.emit("pause")),this.audioPlayer.on("play",()=>this.emit("play")),this.ctx.activeMedia.add(this)}get currentTime(){return this.audioPlayer.currentTime}set currentTime(t){this.audioPlayer.currentTime=t}get paused(){return this.audioPlayer.isPaused}get isPaused(){return this.audioPlayer.isPaused}get ended(){return this.audioPlayer.isEnded}get duration(){return this.audioPlayer.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return ZA(this,void 0,void 0,(function*(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent play event with paused state",this.ctx.taskId):(this.isPlaying=!0,this.audioPlayer.play())}))}pause(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent pause event with paused state",this.ctx.taskId):(this.isPlaying=!1,this.audioPlayer.pause())}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent seek event with paused state",this.ctx.taskId):this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){this.audioPlayer.pause(),this.controller.destroy(),this.ctx.activeMedia.delete(this)}}class $A extends GA{constructor(t,e,n,i){super(Object.assign(Object.assign({},t),{type:"Shape",useBgFill:!1,textRotateWithShape:!0,isPicture:!0}),e,n,i),this.isInteractiveOutside=!1,this.cmd=new EM(this),this.media=null==t?void 0:t.media,this.picFill=new TA(this.ctx,t.picFill,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1})}applyCommand(t,e){var n,i,r,o,s;if("call"===e)if(/playFrom\(([0-9.]+)\)/.test(t)){const e=t.match(/playFrom\(([0-9.]+)\)/),i=Number(e[1]||"0");null===(n=this.mediaPlayer)||void 0===n||n.play().then(()=>{var t;null===(t=this.mediaPlayer)||void 0===t||t.seek(i)})}else"custom-pause"===t?null===(i=this.mediaPlayer)||void 0===i||i.pause():"togglePause"===t?null===(r=this.mediaPlayer)||void 0===r||r.togglePause():"stop"===t&&(null===(o=this.mediaPlayer)||void 0===o||o.pause(),null===(s=this.mediaPlayer)||void 0===s||s.seek(0))}renderPic(){var t,e,n,i,r;const{displayObject:o}=this.picFill;if(o){const s=null===(t=this.backgroundGraphics)||void 0===t?void 0:t.getClonedDisplayObject();(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.isNeedMask(o.width,o.height))&&s&&(o.mask=s,this.container.addChild(s)),o.width=this.designWidth,o.height=this.designHeight,o instanceof jE&&this.ctx.slideScopeEventHub.once("slide-render",t=>{this.ctx.slideIndex===t&&o.play()}),this.container.addChild(o),"video"===(null===(n=this.media)||void 0===n?void 0:n.type)&&this.media.src?(this.mediaPlayer=new YA({id:this.json.id+"-video",shapeId:this.json.id,ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,target:o,container:this.container,canvasElement:this.ctx.view}),null===(i=this.mediaPlayer)||void 0===i||i.sprite):"audio"===(null===(r=this.media)||void 0===r?void 0:r.type)&&this.media.src&&(this.mediaPlayer=new JA({id:this.json.id+"-audio",shapeId:this.json.id,ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,target:o,canvasElement:this.ctx.view})),this.mediaPlayer&&(this.isInteractiveOutside=this.container.interactive,this.container.interactive=!0,this.container.on("mouseover",()=>{this.mediaPlayer.showController()}),this.container.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))}}preRender(t){super.preRender(t)}subClassRender(){this.renderPic()}clearOnSlideChange(){super.clearOnSlideChange(),this.mediaPlayer&&(this.container.interactive=!1,this.mediaPlayer.stop(),this.mediaPlayer.hideController())}initOnReuse(){super.initOnReuse(),this.mediaPlayer&&(this.container.interactive=!0)}isStatic(){const t=this.json;return(!t.media||"video"!==t.media.type)&&super.isStatic()}destroy(){this.mediaPlayer&&(this.picFill.displayObject&&!this.isInteractiveOutside&&(this.container.interactive=!1),this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picFill.destroy()}}var KA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class QA extends PM{constructor(t,e,n,i,r){super(t,e,n),this.children=[],this.cacheSprite=new Ow,this.cacheContainer=new ty,this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i&&(this.json.fillStyle=i),this.container.name=t.id,this.cacheContainer.name=t.id+"-cache-container",this.ctx.timingTargets.addTarget(t.id,this),this.updateTransform(this.json),this.fillObject=new TA(this.ctx,t.fillStyle,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1}),this.createChildren(r)}createChildren(t){var e,n,i,r;const o={x:null!==(n=null===(e=this.json.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,y:null!==(r=null===(i=this.json.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0};for(let e=0,n=this.json.children.length;e<n;e++)t.addSubMTask(()=>KA(this,void 0,void 0,(function*(){const n=this.json.children[e];let i=null;"Shape"===(null==n?void 0:n.type)?i=new GA(n,this.ctx,o,this.json.fillStyle):"Picture"===(null==n?void 0:n.type)?i=new $A(n,this.ctx,o,this.json.fillStyle):"Container"===(null==n?void 0:n.type)&&(i=new QA(n,this.ctx,o,this.json.fillStyle,t)),i&&this.children.push(i)})),"@ContainerImpl[child.init]")}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(t){for(const e of this.children)t.addSubMTask(()=>KA(this,void 0,void 0,(function*(){e.preRender(t)})),"@ContainerImpl[child.preRender]")}getBgElement(){return null}getIterateEntry(t,e,n){return 0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}getTextElement(){return null}render(t){let e=new ty;for(const n of this.children)n.render(t),t.addSubMTask(()=>KA(this,void 0,void 0,(function*(){var t;n.isStatic()&&!this.json.cacheAsTexture&&n.json.width<4096&&n.json.height<4096?e.addChild(n.renderContainer):(e.children.length>0&&(e.cacheAsBitmap=!0,this.cacheContainer.addChild(e),e=new ty),this.cacheContainer.addChild(n.renderContainer)),(n.json.hlinkHover||n.json.hlinkClick)&&(null===(t=n.hyperlink)||void 0===t||t.addProxy(this.container))})),"@ContainerImpl[child.render]");t.addMTask(()=>KA(this,void 0,void 0,(function*(){e.children.length>0&&(e.cacheAsBitmap=!0,this.cacheContainer.addChild(e))})),"@ContainerImpl[child.render]"),t.addSubMTask(()=>KA(this,void 0,void 0,(function*(){this.container.addChild(this.cacheContainer),this.json.cacheAsTexture&&(!function(t,e,n,i,r){const o=t.getBounds(),s=Math.min(o.x,e.x,o.x+o.width,e.x+e.width),a=Math.max(o.x,e.x,o.x+o.width,e.x+e.width),l=Math.min(o.y,e.y,o.y+o.height,e.y+e.height),u=a-s,h=Math.max(o.y,e.y,o.y+o.height,e.y+e.height)-l;let c=KE(e.x-o.x),d=KE(e.y-o.y);r||(c=Math.max(0,c),d=Math.max(0,d));const p=Hy.create({width:u,height:h,resolution:i.renderer.resolution});t.position.x=c,t.position.y=d,i.renderer.render(t,{renderTexture:p}),n.texture=p,n.position.x=-c,n.position.y=-d}(this.cacheContainer,new d_(this.designX,this.designY,this.designWidth,this.designHeight),this.cacheSprite,this.ctx,!1),this.container.addChild(this.cacheSprite),this.cacheContainer.position.x=0,this.cacheContainer.position.y=0,this.cacheContainer.visible=!1)})),"@ContainerImpl[child.append]")}clearOnSlideChange(){this.children.forEach(t=>t.clearOnSlideChange())}initOnReuse(){this.children.forEach(t=>t.initOnReuse())}isStatic(){return!!this.json.cacheAsTexture&&!this.ctx.animatedIds.has(this.json.id)}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(t=>t.destroy()),this.container.destroy({children:!0,texture:!0,baseTexture:!0}),this.cacheContainer.destroy({children:!0,texture:!0,baseTexture:!0})}}class tR extends a.a{constructor(t,e,n,i){super(),this.cond={},this.timeoutIds=[],this.condHandle=(t,e={})=>{if(t)if(t.delay&&t.delay>0){const n=this.ctx.clock.setTimeout(()=>{t.event&&(this.cond[t.event]=!0,this.detectTrigger(e))},t.delay);this.timeoutIds.push(n)}else this.cond[t.event]=!0,this.detectTrigger(e);else this.detectTrigger(e)},this.id=t,this.ctx=i,this.eventHubs=n,e.forEach(t=>{this.addCond(t)})}setTriggerParams(t){this.triggerParams=t}addCond(t){const e=e=>{this.condHandle(t,e)};t.event&&(/^shape/.test(t.event)||/^time/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.global.addListener(t.event,e)):/^runtime/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):/^self/.test(t.event)?t.delay&&t.delay>0&&(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):this.cond[t.event]=!1)}isTrigger(){return Object.keys(this.cond).every(t=>!!this.cond[t])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(t=>"self"!==t).every(t=>!!this.cond[t])}detectTrigger(t){if(Object.keys(this.cond).every(t=>!!this.cond[t])){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1});const e=this.triggerParams;this.triggerParams=void 0,this.emit("active",e,t)}}reset(){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1}),this.timeoutIds.forEach(t=>this.ctx.clock.clearTimeout(t))}}class eR extends a.a{constructor(t){super(),this.isTimeNodeEndSync=!1,this.interactiveListeners=[],this.runtimeNodeEventHub=new a.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=(t=!1)=>{var e,n,i,r,o,s;this.hasPrev()||!this.isMainSeq?"idle"===this.currentSeqState?(this.decrSeqIndex(),null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.seekToStart(),null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"running"===this.currentSeqState?(null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.seekToStart(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"end"===this.currentSeqState&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.seekToStart(),null===(s=this.commonTimeNode.children[this.currentSeqIndex])||void 0===s||s.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide",t)},this.handleNext=(t=!1)=>{var e,n,i,r;this.isTimeNodeEndSync&&(this.isTimeNodeEndSync=!1,this.currentSeqState="idle",this.currentSeqIndex=0),this.hasNext()||!this.isMainSeq?"idle"===this.currentSeqState?null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.startTimeNodeForce():"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.startTimeNodeForce()):"end"===this.currentSeqState&&(this.incrSeqIndex(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide",t)};const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:s,eventHub:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}=t;this.isMainSeq="mainSeq"===e.ctn.nodeType,this.isInteractiveSeq="interactiveSeq"===e.ctn.nodeType,this.id=e.ctn.id,this.isIterate=i,this.json=e,this.ctx=s,this.globalEventHub=l,this.commonTimeNode=new PR({json:e.ctn,isSub:r,eventHubs:{global:l,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:n,iterateIndex:u,iterateId:h,isInInteractiveSeq:c||this.isInteractiveSeq}),this.bindShapeEvent(),this.nextConds=new tR("mainSeq",e.nextCondLst,{global:l,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new tR("mainSeq",e.preCondLst,{global:l,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit($R.mainSeqStepStart,e)}),this.commonTimeNode.on("childTimeNodeEnd",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext()}),this.isMainSeq&&this.ctx.eventHub.emit($R.mainSeqStepEnd,e)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.isTimeNodeEndSync=!0,this.commonTimeNode.resetForRepeat()}),this.commonTimeNode.on("timeNodeDestroy",()=>{this.interactiveListeners.forEach(([t,e])=>{t&&e&&t.interactiveContainer.removeListener("pointerdown",e)}),this.interactiveListeners=[]}),this.nextConds.on("active",(t,e)=>{this.handleNext(e)}),this.prevConds.on("active",(t,e)=>{this.handlePrev(e)})}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(t){this._currentSeqIndex=t,this.isMainSeq?this.ctx.eventHub.emit($R.mainSeqStepChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit($R.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:t,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(t){this._currentSeqState=t,this.isMainSeq?this.ctx.eventHub.emit($R.mainSeqStateChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit($R.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:t}})}get stepLength(){return this.commonTimeNode.children.length}get currentStep(){return this.currentSeqIndex}get currentState(){return this.currentSeqState}startAutoPlay(){this.autoPlay=!0,this.commonTimeNode.children[0].commonTimeNode.startTimeNodeForce()}incrSeqIndex(){this.currentSeqIndex+1<=this.commonTimeNode.children.length&&(this.currentSeqIndex+=1)}decrSeqIndex(){this.currentSeqIndex-1>=-1&&(this.currentSeqIndex-=1)}hasPrev(){return!(this.currentSeqIndex<=0&&"idle"===this.currentSeqState)}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&"end"===this.currentSeqState)}bindShapeEvent(){"interactiveSeq"===this.json.ctn.nodeType&&this.json.nextCondLst.forEach(t=>{if(/^shape/.test(t.event)){const e=t.event.split(" ")[1];if(e){const t=this.ctx.timingTargets.getTargetById(e);if(t){t.interactiveContainer.interactive=!0,t.interactiveContainer.cursor="pointer";const n=()=>{this.ctx.eventHub.emit($R.userInput);const t=`shape ${e} onClick`,{mode:n}=this.ctx;"interactive"!==n&&"sync"!==n||this.ctx.eventHub.emit($R.interactiveSeqAction,{action:t,seqId:this.json.ctn.id}),"sync"!==n&&"local"!==n||this.globalEventHub.emit(t)};t.interactiveContainer.on("pointerdown",n),this.interactiveListeners.push([t,n])}}}})}setCurrentStep(t,e){this.isInteractiveSeq&&0===this.commonTimeNode.applyCount&&(this.commonTimeNode.applyCount=1);let n=t;this.commonTimeNode.seekToStart();const{length:i}=this.commonTimeNode.children;if(-1===n&&(n=i-1),n>=0&&n<i)for(let t=0;t<=n;t++){const i=this.commonTimeNode.children[t];t!==n?i.commonTimeNode.seekToEnd(!1,!0):"start"===e?i.commonTimeNode.seekToStart():"end"===e&&i.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=n,this.currentSeqState="start"===e?"idle":"end"}}function nR(t,e,n){const i=e.split(".");i.reduce((r,o,s)=>{if(r)return s!==i.length-1?r[o]:void(r[o]=n);console.warn(`${t} not support ${e}`)},t)}function iR(t,e){if(!e)return null;return e.split(".").reduce((n,i)=>{if(n)return n[i];console.warn(`${t} not support ${e}`)},t)}class rR{constructor(t){this.timingTarget=null,this.runtimeNodeEventHub=new a.a,this.basicOnTimeNodeEnd=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr,e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.removeRunningTimeNode(e,this.modifyAttrKey)}},this.basicOnTimeLineStart=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr;if("next"===this.activeWhenConflict){const e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.addRunningTimeNode(e,this.modifyAttrKey,this.commonTimeNode)}else"prev"===this.activeWhenConflict&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:n,json:i,ctx:r,parent:o,eventHub:s,iterateType:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}=t;this.json=i,this.id=i.cBhvr.ctn.id,this.ctx=r,this.globalEventHub=s,this.commonTimeNode=new PR({json:i.cBhvr.ctn,isSub:n,eventHubs:{global:s,runtime:this.runtimeNodeEventHub},ctx:r,parent:o,isIterate:e,iterateType:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}),this.timingTarget=this.ctx.timingTargets.getTarget(i.cBhvr.target,e,{type:l,index:u,id:h}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.basicOnTimeLineStart),this.commonTimeNode.on("timeNodeEnd",this.basicOnTimeNodeEnd)}getTargetId(t){let e=t.id;return"shape"===t.type&&t.txEl&&(e=`${e}-txEl-${t.txEl.range[0]}`),this.commonTimeNode.isIterate&&(e=`${e}-iterate-${this.commonTimeNode.iterateIndex}`),e}}class oR extends rR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=iR(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const t=this.json.cBhvr.attrList[0];null!==this.startVal&&this.timingTarget&&nR(this.timingTarget,t,this.startVal)},this.onSeekToEnd=()=>{const t=this.json.cBhvr.attrList[0],e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&nR(this.timingTarget,t,e)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:t,delta:e})=>{if(e/t>=1){const t=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&nR(this.timingTarget,t,e)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}var sR=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};class aR{constructor(t,e){this.math={pi:Math.PI,e:Math.E,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,cosh:Math.cosh,deg:t=>t/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:t=>t/180*Math.PI,rand:Math.random,sin:Math.sin,sinh:Math.sinh,sqrt:Math.sqrt,tan:Math.tan,tanh:Math.tanh},this.timingTarget=e,this.val=t.val.value,this.time=t.time,t.fmla&&(this.fmla=this.parseFmla(t.fmla))}parseFmla(t){let e=t.replace(/#ppt_h/g,`(${this.timingTarget.design_ppt_h})`);return e=e.replace(/#ppt_w/g,`(${this.timingTarget.design_ppt_w})`),e=e.replace(/#ppt_x/g,`(${this.timingTarget.design_ppt_x})`),e=e.replace(/#ppt_y/g,`(${this.timingTarget.design_ppt_y})`),e=e.replace(/ppt_w/g,"vars.ppt_w"),e=e.replace(/ppt_h/g,"vars.ppt_h"),e=e.replace(/ppt_x/g,"vars.ppt_x"),e=e.replace(/ppt_y/g,"vars.ppt_y"),e=e.replace(/#/g,"vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(t=>{const n=new RegExp(`([^a-z])${t}([^a-z])`,"g");e=e.replace(n,(e,n,i)=>`${n}math.${t}${i}`)}),new Function("vars","math","$","return "+e)}}class lR extends aR{constructor(t,e,n){super(t,e),this.value=t.val.value,n&&(this.fmla=this.parseFmla(n))}resolveValue(){return this.value}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue()-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}sR([YE()],lR.prototype,"interpolationFrom",null);class uR extends aR{constructor(t,e){var n;super(t,e),this.value=null===(n=t.val)||void 0===n?void 0:n.value}interpolationFrom(t,e,n){let i=t.resolveValue(n);return e>this.time&&(i=this.resolveValue()),i}resolveValue(){return this.value||""}}sR([YE()],uR.prototype,"interpolationFrom",null);class hR extends aR{constructor(t,e){super(t,e),this.fn=this.parseFmla(this.val)}resolveValue(t){return this.fn(t,this.math,1)}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue(n)-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}sR([YE()],hR.prototype,"interpolationFrom",null);class cR extends aR{constructor(t,e){super(t,e),this.value=t.val.value}interpolationFrom(t,e){return DM(t.resolveValue(),this.value,e)}resolveValue(){return this.value}}sR([YE()],cR.prototype,"interpolationFrom",null);class dR extends rR{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.vars={ppt_x:0,ppt_y:0,ppt_w:0,ppt_h:0},this.keyFrames=[],this.isColorAnim=!1,this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal=iR(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var t,e,n,i;(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),(null===(n=this.timingTarget)||void 0===n?void 0:n.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),(null===(i=this.timingTarget)||void 0===i?void 0:i.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t,i=this.keyFrames.findIndex(t=>n<=t[0]),{attrList:r}=this.json.cBhvr;if(i<0){const t=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&r&&r[0]&&nR(this.timingTarget,r[0],t[1].resolveValue(this.vars)))}const o=i-1,s=this.keyFrames[i],a=this.keyFrames[o]||s,l=s[0]-a[0]==0?1:(n-a[0])/(s[0]-a[0]),u=s[1].interpolationFrom(a[1],l,this.vars);this.timingTarget&&r&&r[0]&&nR(this.timingTarget,r[0],u)},this.onSeekToStart=()=>{null!==this.startVal&&this.timingTarget&&nR(this.timingTarget,this.json.cBhvr.attrList[0],this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.initKeyFrames(),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timelineStart",this.updateVars),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}initKeyFrames(){var t;const{valueType:e}=this.json;if(this.json.tavLst.length<=0)if(this.json.to){if(this.json.from||this.startVal){const t={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if("num"===e&&this.timingTarget){const e=new hR(t,this.timingTarget);this.keyFrames.push([t.time,e])}}const t={time:1,val:{type:"string",value:this.json.to},fmla:""};if("num"===e&&this.timingTarget){const e=new hR(t,this.timingTarget);this.keyFrames.push([t.time,e])}}else if(this.json.by){const n={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if("num"===e&&this.timingTarget){const t=new hR(n,this.timingTarget);this.keyFrames.push([n.time,t])}const i={time:1,val:{type:"string",value:((null===(t=n.val)||void 0===t?void 0:t.value)||"")+"+"+this.json.by},fmla:""};if("num"===e&&this.timingTarget){const t=new hR(i,this.timingTarget);this.keyFrames.push([i.time,t])}}if(this.json.tavLst.length>0)for(const t of this.json.tavLst)if(t.val&&this.timingTarget){let n=null;"string"===t.val.type?"num"===e?n=new hR(t,this.timingTarget):"str"===e&&(n=new uR(t,this.timingTarget)):"number"===t.val.type?n=new lR(t,this.timingTarget):"color"===t.val.type?(this.isColorAnim=!0,n=new cR(t,this.timingTarget)):"boolean"===t.val.type&&console.warn("not implements"),n&&this.keyFrames.push([t.time,n])}}}var pR=n(50),fR=n.n(pR),mR=n(51),gR=n.n(mR);class vR extends Gx{constructor(){super(gR.a,fR.a,{percent:0,direction:1,transition:0})}set transition(t){this.uniforms.transition=t}set percent(t){this.uniforms.percent=t}set direction(t){this.uniforms.direction=t}}var _R=n(52),yR=n.n(_R);class xR extends Gx{constructor(){super(void 0,yR.a,{percent:0,transition:1})}set transition(t){this.uniforms.transition=Math.pow(t,t)}set percent(t){this.uniforms.percent=t}}class bR extends rR{constructor(t){var e;super(t),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t;this.filter&&(this.filter.percent=this.commonTimeNode.applyTimeFilter(n)),n>=1&&this.timingTarget&&this.ctx.clock.setTimeout(()=>{this.timingTarget&&(this.timingTarget.container.filters=[])})},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.onSeekToEnd=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.commonTimeNode.on("timelineStart",()=>{this.filter&&this.timingTarget&&(this.timingTarget.container.filters=[this.filter])}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate);let n=0;"out"===t.json.transition?n=-1:"in"===t.json.transition&&(n=1);const i=null===(e=t.json.filter)||void 0===e?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(i){const t=i[1],e=i[3];if("wipe"===t){const n=new vR;"up"===e?n.direction=1:"down"===e?n.direction=2:"left"===e?n.direction=3:"right"===e&&(n.direction=4),this.filter=n,this.filterType=`${t}-${e}`}else if("fade"===t){const e=new xR;this.filter=e,this.filterType=""+t}this.filter&&(this.filter.transition=n)}}get modifyAttrKey(){return this.filterType}}class TR extends rR{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startPos=null,this.onTimeNodeStart=()=>{var t,e;this.startPos={x:(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_x)||0,y:(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_y)||0}},this.onTimeUpdate=({duration:t,delta:e})=>{var n;const i=e/t,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{this.timingTarget&&this.startPos&&(this.timingTarget.ppt_x=this.startPos.x,this.timingTarget.ppt_y=this.startPos.y)},this.onSeekToEnd=()=>{var t,e,n;const i=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i>0?1:0);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var t;const e=new xc,n=null===(t=this.json.path)||void 0===t?void 0:t.match(/[MLCmlc][^MLCmlc]+/g);if(n)for(const t of n){const[n,...i]=t.trim().replace(/\s+/g," ").split(" ");if("M"===n){const[t,n]=i.map(t=>Number(t));e.moveTo(t,n)}else if("L"===n){const[t,n]=i.map(t=>Number(t));e.lineTo(t,n)}else if("C"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t));e.bezierCurveTo(t,n,r,o,s,a)}else if("Z"===n)e.closePath();else if("E"===n)console.warn("not implements");else if("c"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t)),l=e.currentPoint;e.bezierCurveTo(t+l.x,n+l.y,r+l.x,o+l.y,s+l.x,a+l.y)}else if("l"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.lineTo(n+t.x,r+t.y)}else if("m"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.moveTo(n+t.x,r+t.y)}}this.path=e}}class wR extends rR{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=t=>{t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{var n,i,r,o,s;const a=e/t,l={x:1,y:1};if(this.to){const t=null!==(n=this.from)&&void 0!==n?n:{x:null!==(r=null===(i=this.startVal)||void 0===i?void 0:i.x)&&void 0!==r?r:1,y:null!==(s=null===(o=this.startVal)||void 0===o?void 0:o.y)&&void 0!==s?s:1};l.x=t.x+(this.to.x-t.x)*a,l.y=t.y+(this.to.y-t.y)*a}else if(this.by){const t={x:this.by.x,y:this.by.y};l.x=1+(t.x-1)*a,l.y=1+(t.y-1)*a}this.timingTarget&&(this.timingTarget.scale=l)},this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})},this.onSeekToStart=()=>{this.timingTarget&&this.startVal&&(this.timingTarget.scale=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=t.json.from,this.to=t.json.to,this.by=t.json.by,this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart)}get modifyAttrKey(){return"scale"}updateCurrentValue(){this.timingTarget&&(this.current={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})}}class SR extends rR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isTimelineStart=!1,this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=t=>{if(this.isTimelineStart)return;this.isTimelineStart=!0,t.isReverse||this.updateCurrentValue(),this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to);const[e]=this.json.cBhvr.attrList[0].split(".");nR(this.timingTarget,e+".on","true")},this.onTimeNodeEnd=()=>{if("remove"===this.json.cBhvr.ctn.fill){const[t]=this.json.cBhvr.attrList[0].split(".");nR(this.timingTarget,t+".on","false")}this.isTimelineStart=!1},this.onSeekToStart=()=>{var t;if(this.timingTarget&&(this.onTimeUpdate({duration:1,delta:0}),(null===(t=this.timingTarget.fill)||void 0===t?void 0:t.designColor.toUpperCase())===this.from.toHexString().toUpperCase())){const[t]=this.json.cBhvr.attrList[0].split(".");nR(this.timingTarget,t+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const t=iR(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.startColorString=t)}},this.onTimeUpdate=({delta:t,duration:e})=>{const n=t/e;this.to.interpolationFrom(this.from,n,this.target),this.timingTarget&&nR(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.isTimelineStart||this.onTimelineStart({isReverse:!1,activeCount:0,id:""}),this.onTimeUpdate({duration:1,delta:1})},"rgb"===this.json.clrSpc?(this.from=new IM(this.json.from),this.to=new IM(this.json.to),this.by=new IM(this.json.by),this.target=new IM):(this.from=new CM(this.json.from),this.to=new CM(this.json.to),this.by=new CM(this.json.by),this.target=new CM),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeEnd",this.onTimeNodeEnd),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}updateCurrentValue(){if(this.timingTarget){const t=iR(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.currentColorString=t)}}}class ER extends rR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=t=>{this.lastVal=null,t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t;let i=0,r=0;if(void 0!==this.from&&void 0!==this.to){i=this.from,r=this.to;const t=i+(r-i)*n;this.timingTarget&&(this.timingTarget.r=t)}else if(void 0!==this.by){this.lastVal||(this.lastVal=0);const t=this.by*n-this.lastVal;this.lastVal=this.by*n,this.timingTarget&&(this.timingTarget.r+=t)}},this.onTimeNodeStart=()=>{var t;Object(l.isNumber)(null===(t=this.timingTarget)||void 0===t?void 0:t.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&null!==this.startVal&&(this.timingTarget.r=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=this.json.from,this.to=this.json.to,this.by=this.json.by,this.by?this.isConflict=!1:this.isConflict=!0,this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return"rotate"}updateCurrentValue(){var t;this.currentVal=null===(t=this.timingTarget)||void 0===t?void 0:t.r}}class MR extends rR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var t,e;const{cmd:n,cmdType:i}=this.json;!this.isApplied&&n&&i&&(this.isApplied=!0,null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand(n,i))},this.onSeekToStart=()=>{var t,e;null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand("custom-pause","call")},this.onSeekToEnd=()=>{},this.commonTimeNode.on("timeNodeStart",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeNodeEnd",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("seekToStart",this.onSeekToStart),this.commonTimeNode.on("seekToEnd",this.onSeekToEnd)}get modifyAttrKey(){var t,e,n,i;return(null!==(e=null===(t=this.json)||void 0===t?void 0:t.cmd)&&void 0!==e?e:"")+(null!==(i=null===(n=this.json)||void 0===n?void 0:n.cmdType)&&void 0!==i?i:"")}}class AR{constructor(t){this.runtimeNodeEventHub=new a.a,this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy(),this.ctx.activeMedia.delete(this.audio)};const{json:e,isIterate:n,isSub:i,eventHub:r,ctx:o,parent:s,iterateType:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}=t;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new PR({json:e.cMediaNode.ctn,isSub:i,eventHubs:{global:r,runtime:this.runtimeNodeEventHub},ctx:o,parent:s,isIterate:n,iterateType:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c});let d=e.cMediaNode.tgtEl;o.loaderDelegate&&(d=o.loaderDelegate.redirectMedia(d),o.logger.info(`redirect media url from ${e.cMediaNode.tgtEl} to ${d} by delegate.`,o.taskId)),this.audio=new XA(d,o.runningAudio),o.activeMedia.add(this.audio),this.commonTimeNode.on("timelineStart",()=>{this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy),this.ctx=o}}var RR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class PR extends a.a{constructor(t){var e,n;super(),this.uuid=Date.now().toString(32)+Math.random().toString(32).substring(2),this.isSub=!1,this.isShadow=!1,this.startCount=0,this.applyCount=0,this.isReverse=!1,this.isConflictDispose=!1,this.isIterateEnd=!1,this.parentTimeNode=null,this.isActive=!1,this.isDestroy=!1,this.shouldSeekOnStart=!1,this.repeatTimeoutId="",this.iterateShadows=[],this.isEndEventsEmitted=!1,this.tmFilter=[],this.timeDelta=0,this.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.isInfiniteRepeat()?this.repeatTimeNodeEnd():this.seekToEnd(!1,!0))},this.handleActive=(t=!0)=>{if(this.isActive=!0,this.isConflictDispose=!1,this.applyCount+=1,this.json.iterate||this.emit("timeNodeStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startCount>0&&this.json.restart){if("never"===this.json.restart)return;"whenNotActive"!==this.json.restart&&"always"!==this.json.restart||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(t))}else this.startTimeLine(t)},this.updateTimeLine=t=>{const e=t/(mv.TARGET_FPMS||.06);this.timeDelta+=e,this.duration-this.timeDelta<=e&&(this.timeDelta=this.duration),this.timeDelta<this.duration?this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?this.duration-this.timeDelta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}):(this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?0:this.duration,duration:this.duration,isReverse:this.isReverse}),this.onTimeLineEnd())},this.handleEnd=(t=!1)=>{(this.isTimeNodeEnd()||t)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:i,isIterate:r,ctx:o,eventHubs:s,parent:a,json:l,iterateType:u,iterateId:h,iterateIndex:c,isInInteractiveSeq:d}=t;this.isSub=i,this.isInInteractiveSeq=d,this.isIterate=r,this.parentTimeNode=a,this.json=l,this.ctx=o,this.iterateIndex=c,this.eventHubs=s,this.iterateType=u,this.iterateId=h,this.tmFilter=null!==(n=null===(e=l.tmFilter)||void 0===e?void 0:e.split(";").map(t=>t.split(",").map(t=>parseFloat(t.trim()))))&&void 0!==n?n:[];const p=Number(this.json.dur),f=this.json.spd||1;this.isNegativeSpeed=f<0,Number.isNaN(p)||(this.duration=p/Math.abs(f)),this.uuid+="--"+this.json.id,this.setPreStyle(),l.childTnLst&&this.createChildren(l.childTnLst),this.startConds=new tR(this.json.id||"",l.stCondLst,s,this.ctx),this.endConds=new tR(this.json.id||"",l.endCondLst,s,this.ctx),l.endSync&&(this.endSync=new tR(this.json.id||"",[l.endSync],s,this.ctx),this.endSync.on("active",()=>{var t;"interactiveSeq"===this.json.nodeType&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),null===(t=this.endSync)||void 0===t||t.reset())})),this.startConds.on("active",t=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(t))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(t=>t.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&"nextClick"===this.json.masterRel&&this.startConds.addCond({event:"shape slide onNext"}),this.json.iterate&&!1===this.isIterate&&this.createIterateShadow()}createIterateShadow(){const t=eM();let e=!0,n=0;const i=n=>{n===t&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",i))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",i);e;){const e=JSON.parse(JSON.stringify(this.json)),i=new PR({json:e,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:e.iterate.type,iterateIndex:n,iterateId:t,isInInteractiveSeq:this.isInInteractiveSeq});this.iterateShadows[n]=i,n+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(t){this.isReverse=t}createTimeNode(t,e){let n=null;const i={json:t,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId,isInInteractiveSeq:this.isInInteractiveSeq};return"seq"===t.type?n=new eR(i):"par"===t.type?n=new CR(i):"set"===t.type?n=new oR(i):"anim"===t.type?n=new dR(i):"animEffect"===t.type?n=new bR(i):"animMotion"===t.type?n=new TR(i):"animScale"===t.type?n=new wR(i):"animClr"===t.type?n=new SR(i):"animRot"===t.type?n=new ER(i):"cmd"===t.type?n=new MR(i):"audio"===t.type&&(n=new AR(i)),n}createSubList(t){this.subList&&this.subList.forEach(t=>t.commonTimeNode.destroy()),this.subList=[],t.forEach(t=>{const e=this.createTimeNode(t,!0);e&&this.subList.push(e)})}bindCommonTimeNodeEvent(t){t.commonTimeNode.on("timeNodeStart",t=>{this.emit("childTimeNodeStart",t)}),t.commonTimeNode.on("timeNodeEnd",t=>{this.emit("childTimeNodeEnd",t),this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(t){function e(t){return(e=t,function(t){var e;return!!(null===(e=t)||void 0===e?void 0:e.cBhvr)}(e)?e.cBhvr.ctn:function(t){var e,n;return!!(null===(n=null===(e=t)||void 0===e?void 0:e.cMediaNode)||void 0===n?void 0:n.ctn)}(e)?e.cMediaNode.ctn:e.ctn).presetOrder;var e}if(t&&t[0]&&e(t[0])){[...t].sort((t,n)=>{var i,r;return(null!==(i=e(t))&&void 0!==i?i:0)-(null!==(r=e(n))&&void 0!==r?r:0)}).forEach(e=>{const n=t.findIndex(t=>t===e),i=this.createTimeNode(e,!1);i&&(this.bindCommonTimeNodeEvent(i),this.children[n]=i)})}else t.forEach(t=>{const e=this.createTimeNode(t,!1);e&&(this.bindCommonTimeNodeEvent(e),this.children.push(e))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(t=>t.commonTimeNode.playReverse())}allChildrenEndHandle(){if(!this.isDestroy){if(this.json.autoRev&&!this.isReverse)return this.isReverse=!0,void this.playReverse();this.isReverse&&(this.isReverse=!1),this.json.repeatCount&&this.json.repeatCount>this.applyCount?this.repeatTimeoutId=this.ctx.clock.setTimeout(()=>{this.seekToStart(!1),this.resetForRepeat(),this.startTimeNodeRepeat()}):(this.json.iterate&&!this.isIterate&&(this.isIterateEnd=!0),this.eventHubs.runtime.emit("runtime all end"),this.startSubList(),this.handleEnd())}}resetForRepeat(){this.isInInteractiveSeq&&this.isInfiniteRepeat()&&this.repeatTimeNodeEnd(),this.timeDelta=0,this.children.forEach(t=>t.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(t=>t.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.isEndEventsEmitted=!1,this.timeDelta=0;const t=1e3/this.ctx.ticker.maxFPS;this.duration<=t&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit($R.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>t&&(this.ctx.eventHub.emit($R.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(t=!0){if(t&&(this.isEndEventsEmitted=!1,this.eventHubs.global.emit(`time ${this.json.id} begin`),this.eventHubs.global.emit(`time ${this.json.id} onBegin`),this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)),this.json.iterate)return void this.startIterate();this.timeDelta=0,this.emit("timelineStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse});const e=1e3/this.ctx.ticker.maxFPS;this.duration<=e&&this.duration>0?(this.timeDelta=this.isReverse?0:this.duration,this.emit("timeUpdate",{delta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}),this.emit("timelineEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.ctx.ticker.addOnce(()=>{this.onTimeLineEnd()})):this.duration>e&&(this.ctx.eventHub.emit($R.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return RR(this,void 0,void 0,(function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const t of this.iterateShadows){if(this.isIterateEnd)break;t.children.forEach(t=>{t.commonTimeNode.startTimeNode()}),t.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}}))}applyTimeFilter(t){if(!this.tmFilter.every(t=>Object(l.isNumber)(t[0])&&Object(l.isNumber)(t[1])))return t;for(let e=0;e<this.tmFilter.length;e++){const n=this.tmFilter[e];if(t<n[0]){const i=this.tmFilter[e-1];return(t-i[0])/(n[0]-i[0])*(n[1]-i[1])+i[1]}}return this.tmFilter.length>0?this.tmFilter[this.tmFilter.length-1][1]:t}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}findTargets(){const t=[],e=n=>{n.forEach(n=>{var i,r,o;n.cBhvr&&n.cBhvr.target&&t.findIndex(t=>t.id===n.cBhvr.target.id)<0&&t.push(n.cBhvr.target),(null===(r=null===(i=null==n?void 0:n.cBhvr)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.childTnLst)&&n.cBhvr.ctn.childTnLst.length>0&&e(n.cBhvr.ctn.childTnLst),(null===(o=null==n?void 0:n.ctn)||void 0===o?void 0:o.childTnLst)&&n.ctn.childTnLst.length>0&&e(n.ctn.childTnLst)})};return e(this.json.childTnLst||[]),t}setPreStyle(){this.json.presetClass&&this.findTargets().forEach(t=>{if(this.json.iterate){let e=0,n=!0;for(;n;){const i=this.ctx.timingTargets.getTarget(t,!0,{type:this.json.iterate.type,index:e,id:""});i&&(this.setPreStyleForTarget(i),e+=1),n=!!i}}else{const e=this.ctx.timingTargets.getTarget(t,!1);e&&this.setPreStyleForTarget(e)}})}setPreStyleForTarget(t){var e,n;if(t&&this.json.presetSubtype&&(t.presetSubType=this.json.presetSubtype),t&&!t.hasPreset)if("entr"===this.json.presetClass){const i=null===(n=null===(e=this.json)||void 0===e?void 0:e.childTnLst)||void 0===n?void 0:n.filter(t=>"set"===t.type&&"visible"===t.to);(null==i?void 0:i.length)&&(t.hasPreset=!0,t.style.visibility="hidden")}else("exit"===this.json.presetClass||"path"===this.json.presetClass)&&(t.hasPreset=!0,t.style.visibility="visible")}startTimeNodeRepeat(){this.timeDelta=0,this.isActive=!0,this.applyCount+=1,this.startTimeLine(!1),this.json.iterate||this.emit("timeNodeRepeat",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse})}startTimeNodeForce(){this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.timeDelta=0,this.isActive=!0,this.handleActive(!1)}startTimeNode(t=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(t);const e=this.json.stCondLst.filter(t=>/^self/.test(t.event||""))[0];e&&this.startConds.condHandle(e);const n=this.json.endCondLst.filter(t=>/^self/.test(t.event||""))[0];n&&this.endConds.condHandle(n),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(0===this.children.length||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(t=>t.commonTimeNode.destroy())}seekToStart(t=!0){if(this.isEndEventsEmitted=!1,this.isActive=!1,this.dispose(),this.timeDelta=0,this.emit("seekToStart"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(e=>e.seekToStart(t));if(t)for(let t=this.subList.length-1;t>=0;t--){const e=this.subList[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}}repeatTimeNodeEnd(){this.dispose(),this.children.forEach(t=>{t.commonTimeNode.isActive=!1,t.commonTimeNode.dispose()})}dispose(t=!1){this.isConflictDispose=t,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit($R.animateEnd);try{this.ctx.ticker.remove(this.updateTimeLine)}catch(t){}this.startConds.reset(),this.endConds.reset()}seekToEnd(t,e=!1){if(this.isInfiniteRepeat())return;!this.isActive&&this.applyCount<=0&&this.collectStartValue(),this.applyCount=this.json.repeatCount,this.json.autoRev&&(this.isReverse=!0),this.timeDelta=this.duration,this.isActive=!1,this.dispose();const n=this.json.autoRev||t;if(n?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(t=>t.seekToEnd(n,e));0===this.children.length&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(t=>t.commonTimeNode.seekToEnd(n,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(t=>t.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEndWhenDetectEndSync(){if(this.isInInteractiveSeq&&this.isInfiniteRepeat())return!0;let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}isTimeNodeEnd(){let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}emitEndEvents(){this.isEndEventsEmitted||(this.isEndEventsEmitted=!0,this.eventHubs.global.emit(`time ${this.json.id} end`),this.eventHubs.global.emit(`time ${this.json.id} onEnd`),this.eventHubs.runtime.emit(`runtime ${this.json.id} end`),this.emit("timeNodeEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}))}collectStartValue(){this.emit("timeNodeCreate"),this.children.forEach(t=>t.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(t=>t.commonTimeNode.destroy()),this.clearSubList()}}class CR extends a.a{constructor(t){super(),this.isRunning=!1,this.runtimeNodeEventHub=new a.a;const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:s,eventHub:l,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}=t;this.id=e.ctn.id,this.json=e,this.ctx=s,this.isIterate=i,this.globalEventHub=l,this.commonTimeNode=new PR({json:e.ctn,isSub:r,eventHubs:{global:l,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:n,iterateIndex:u,iterateId:h,isInInteractiveSeq:c}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),t.commonTimeNode.startTimeNode()}),this.isRunning||(this.isRunning=!0,this.globalEventHub.emit(`runtime ${this.id} begin`),this.emit("begin"))}),this.commonTimeNode.on("timeNodeRepeat",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.startTimeNode(!1)})}),this.commonTimeNode.on("timeNodeEnd",()=>{this.commonTimeNode.isTimeNodeEnd()&&this.isRunning&&(this.isRunning=!1,this.globalEventHub.emit(`runtime ${this.id} end`),this.emit("end"))})}}var IR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class OR{constructor(t,e,n){this.json=t,this.ctx=n,this.globalEventHub=e;const i=t.timeNodeList.find(t=>"par"===t.type&&"tmRoot"===t.ctn.nodeType);i&&(this.tmRoot=new CR({json:i,isSub:!1,isIterate:!1,eventHub:e,ctx:n,parent:null,iterateType:"el",iterateIndex:0,iterateId:"",isInInteractiveSeq:!1}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(t=>{var e,n,i;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"mainSeq"===(null===(i=null===(n=t.json)||void 0===n?void 0:n.ctn)||void 0===i?void 0:i.nodeType)}))}findSeq(t){var e;return null===(e=this.tmRoot)||void 0===e?void 0:e.commonTimeNode.children.find(e=>{var n,i,r;return"seq"===(null===(n=e.json)||void 0===n?void 0:n.type)&&(null===(r=null===(i=e.json)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.id)===t})}start(){var t,e;return IR(this,void 0,void 0,(function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.startTimeNode()):null===(e=this.mainSeq)||void 0===e||e.commonTimeNode.startTimeNode()}))}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var t;null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.collectStartValue()}setMainSeqStep(t,e){var n;-1===t&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),null===(n=this.mainSeq)||void 0===n||n.setCurrentStep(t,e)}destroy(){var t;this.globalEventHub.removeAllListeners(),null===(t=this.tmRoot)||void 0===t||t.commonTimeNode.destroy()}hasMainSeq(){return!!this.mainSeq&&this.mainSeq.commonTimeNode.children.length>0}currentMainSeqState(){return this.mainSeq?this.mainSeq.currentState:null}currentMainSeqStep(){return this.mainSeq?this.mainSeq.currentStep:0}currentMainSeqLength(){return this.mainSeq?this.mainSeq.stepLength:0}mainSeqHasNextStep(){return!!this.mainSeq&&this.mainSeq.hasNext()}mainSeqHasPrevStep(){return!!this.mainSeq&&this.mainSeq.hasPrev()}seekInteractiveSeqToEnd(t){const e=this.findSeq(t);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(t,e,n){const i=this.findSeq(t);i&&i.setCurrentStep(e,n)}resetAllInteractiveSeq(){var t;((null===(t=this.tmRoot)||void 0===t?void 0:t.commonTimeNode.children.filter(t=>{var e,n,i;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"interactiveSeq"===(null===(i=null===(n=t.json)||void 0===n?void 0:n.ctn)||void 0===i?void 0:i.nodeType)}))||[]).forEach(t=>{t.setCurrentStep(0,"start")})}applyInteractiveAction(t){this.globalEventHub.emit(t)}}var LR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class NR extends QA{constructor(t,e,n,i){super({id:"stage",width:t.width,height:t.height,type:"Container",children:t.children},e,n,void 0,i),this.isRendered=!1,this.isTimingStartValueCollected=!1,this.json=t,e.hasBackgroundFillShape=this.detectUseBackgroundFill(this.json),this.container.visible=!1,this.ctx=e;const r=new Aw;r.beginFill(16777215),r.drawRect(0,0,t.width,t.height),r.endFill(),this.container.addChild(r)}detectUseBackgroundFill(t){return!!t&&("Picture"===t.type||"Shape"===t.type?t.useBgFill:!(!t.children||!Object(l.isArray)(t.children))&&t.children.some(t=>this.detectUseBackgroundFill(t)))}initOnReuse(){super.initOnReuse(),this.ctx.timingEventHub.on("c:prev slide",t=>{this.ctx.eventHub.emit($R.requestPrevSlide,t)}),this.ctx.timingEventHub.on("c:next slide",t=>{this.ctx.eventHub.emit($R.requestNextSlide,t)})}get interactiveContainer(){return this.container}render(t){if(this.isRendered)return;this.collectAnimatedIds().forEach(t=>this.ctx.animatedIds.add(t)),this.isRendered=!0,super.render(t),t.addSubMTask(()=>LR(this,void 0,void 0,(function*(){this.ctx.eventHub.emit("StageRenderEnd")})),"@StageImpl[emit.StageRenderEnd]")}isListTimeNode(t){return["excel","seq","par"].indexOf(t.type)>=0}isAnimatedTimeNode(t){return!!t.cBhvr}collectAnimatedIdsForTimeNode(t,e){var n;this.isListTimeNode(t)?null===(n=t.ctn.childTnLst)||void 0===n||n.forEach(t=>{this.collectAnimatedIdsForTimeNode(t,e)}):this.isAnimatedTimeNode(t)&&e.push(t.cBhvr.target.id)}collectAnimatedIds(){const t=[];return this.json.timing&&this.json.timing.timeNodeList.forEach(e=>{this.collectAnimatedIdsForTimeNode(e,t)}),t}createTiming(){this.json.timing&&!this.timing&&(this.timing=new OR(this.json.timing,this.ctx.timingEventHub,this.ctx))}startTiming(){var t;return(null===(t=this.timing)||void 0===t?void 0:t.start())||Promise.resolve()}setMainSeqApplied(){var t;null===(t=this.timing)||void 0===t||t.setMainSeqApplied()}setMainSeqStep(t,e){var n;null===(n=this.timing)||void 0===n||n.setMainSeqStep(t,e)}collectMainSeqStartValue(){var t;this.isTimingStartValueCollected||(this.isTimingStartValueCollected=!0,null===(t=this.timing)||void 0===t||t.collectMainSeqStartValue())}hasTiming(){return!!this.timing}clearOnSlideChange(){this.ctx.eventHub.removeAllListeners(),this.ctx.timingEventHub.removeAllListeners(),super.clearOnSlideChange()}clearOnTransactionEnd(){var t,e;this.ctx.timingTargets.getTargets().forEach(t=>{t.hasPreset=!1}),null===(t=this.timing)||void 0===t||t.resetAllInteractiveSeq(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0}destroy(){var t,e;this.isTimingStartValueCollected=!1,this.isRendered=!1,this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),null===(t=this.ctx.bgTexture)||void 0===t||t.destroy(!0),this.ctx.spriteTexture.destroy(),this.ctx.timingEventHub.removeAllListeners(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0,super.destroy()}mainSeqStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqStep())&&void 0!==e?e:0}mainSeqLength(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqLength())&&void 0!==e?e:0}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(t=!1){var e;this.hasTiming()&&(null===(e=this.timing)||void 0===e?void 0:e.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onNext",t)):this.ctx.eventHub.emit($R.requestNextSlide,t)}prevStep(t=!1){var e;this.hasTiming()&&(null===(e=this.timing)||void 0===e?void 0:e.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onPrev",t)):this.ctx.eventHub.emit($R.requestPrevSlide,t)}applyInteractiveAction(t){var e;null===(e=this.timing)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.timing)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var i;null===(i=this.timing)||void 0===i||i.setInteractiveSeqState(t,e,n)}setMediaState(t,e){return LR(this,void 0,void 0,(function*(){const n=this.ctx.medias[t];n&&(e?yield n.play():yield n.pause())}))}setMediaCurrentTime(t,e){const n=this.ctx.medias[t];n&&n.seek(e)}}class DR{constructor(t){this.ticker=t,this.tasks=[],this.couldRunning=!1,this.applyNext=()=>{const t=this.tasks[0];t&&t.applyNext()},t.add(this.applyNext)}addTask(t){this.tasks.push(t),t.once("task-finish",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)}),t.once("task-error",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)})}start(){this.couldRunning=!0}stop(){this.couldRunning=!1}}var FR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const BR=t=>new Promise(e=>setTimeout(e,t));class UR extends a.a{constructor(t,e,n){super(),this.slideIndex=t,this.taskId=e,this.logger=n,this.uuid=eM(),this.isCancel=!1,this.tasks=[]}addMTask(t,e){this.tasks.push({fn:t,state:"wait",sub:[],name:e})}addSubMTask(t,e){let n=this.tasks.findIndex(t=>"running"===t.state);n<0&&(n=0),this.tasks[n].sub.push({fn:t,state:"wait",sub:[],name:e})}cancel(){this.tasks=[],this.isCancel=!0}applyNext(){if(this.tasks.some(t=>"running"===t.state))return;if(this.tasks.some(t=>"error"===t.state))return;if(this.tasks.every(t=>"finish"===t.state))return void(this.isCancel||this.emit("task-finish"));const t=this.tasks.find(t=>"wait"===t.state);t&&(t.state="running",t.fn.apply(null).then(()=>{if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}).catch(e=>{t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",qE.transform(e),this.slideIndex)}))}applyAll(){return FR(this,void 0,void 0,(function*(){for(;!this.tasks.every(t=>"finish"===t.state);)if(this.tasks.some(t=>"running"===t.state))yield BR(16);else{if(this.tasks.some(t=>"error"===t.state))return;{const t=this.tasks.find(t=>"wait"===t.state);if(t){t.state="running";try{if((yield iM(()=>t.fn.apply(null),6e4))===nM)throw new qE(VE.RuntimeError,`subtask ${t.name} apply timeout`);if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}catch(e){let n;n=(null==e?void 0:e.errorType)?e:new qE(VE.RuntimeError,`subtask ${t.name} error. ${e}`),t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",qE.transform(n),this.slideIndex);break}}}}!this.isCancel&&this.tasks.every(t=>"finish"===t.state)&&this.emit("task-finish")}))}}var kR=n(53);const GR=new(n.n(kR).a),HR=GR.getDevice(),zR=GR.getBrowser(),jR=GR.getOS(),VR={isDesktop(){let t=!0;return"mobile"===HR.type&&(t=!1),/Samsung/.test(zR.name||"")&&(t=!1),window.__nativeTags&&window.__nativeTags.platform&&(t=!1),t},isIOS(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^ios/i.test(window.__nativeTags.platform)&&(t=!0),jR.name&&/iOS/.test(jR.name)&&(t=!0),t},isAndroid(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^android/i.test(window.__nativeTags.platform)&&(t=!0),jR.name&&/android/i.test(jR.name)&&(t=!0),t},isLowGpuMemory(){var t,e;const n=null!==(e=null===(t=window.__nativeTags)||void 0===t?void 0:t.platform)&&void 0!==e?e:"";if(n){const t=n.split(" ");if(t[1]){if(/^iPad/.test(t[1])){const e=t[1].match(/^iPad(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=6)}if(/^iPhone/.test(t[1])){const e=t[1].match(/^iPhone(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=9)}return!1}return!1}return!0}};var WR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class XR{constructor(t,e,n,i,r,o,s,a,l,u,h,c,d){this.loader=t,this.mode=e,this.renderer=n,this.ticker=i,this.view=r,this.clock=o,this.objPoolGroup=s,this.errorChannel=a,this.localstorage=l,this.logger=u,this.loaderDelegate=h,this.isPlayerPaused=c,this.maxResolution=d,this.currentStageIndex=0,this.cacheCount=VR.isDesktop()?2:1,this.stageStates=Object.create(null),this.stageJsons=Object.create(null),this.stageCtxs=Object.create(null),this.stageImpls=Object.create(null),this.taskId="",this.url="",this.runningAudio=new Map,this.activeMedia=new Set,this.microTaskManager=new DR(i)}setResourceData(t,e){this.taskId=t,this.url=e}createCtx(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const e=new dM(this.loader),n=new a.a,i={taskId:this.taskId,mode:this.mode,renderer:this.renderer,graphicsTexture:new bM,stageWidth:0,stageHeight:0,ticker:this.ticker,timingTargets:new wM(n),eventHub:n,view:this.view,medias:Object.create(null),lastViewedIndex:0,conflictTimeNodeManager:new TM,clock:this.clock,spriteTexture:e,slideIndex:t,objectPoolGroup:this.objPoolGroup,hasBackgroundFillShape:!1,slideScopeEventHub:new a.a,logger:this.logger,loaderDelegate:this.loaderDelegate,runningAudio:this.runningAudio,activeMedia:this.activeMedia,isPlayerPaused:this.isPlayerPaused,timingEventHub:new a.a,maxResolution:this.maxResolution,animatedIds:new Set};this.stageCtxs[t]=i})),"@StagePool[createCtx]")}loadStageJson(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`);this.stageJsons[t]=e,this.stageCtxs[t].stageWidth=e.width,this.stageCtxs[t].stageHeight=e.height})),"@StagePool[loadStageJson]")}loadSpriteSheets(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const n=this.stageJsons[t],{spriteTexture:i,stageWidth:r,stageHeight:o}=this.stageCtxs[t],{coloredSheets:s,sheets:a}=n,l=s||a;return l&&l.forEach(t=>{e.addSubMTask(()=>{let e=1;if(r>this.maxResolution.x||o>this.maxResolution.y){e=this.maxResolution.x/r;const t=e*o;t>this.maxResolution.y&&(e*=this.maxResolution.y/t)}return i.loadSpriteSheetItem(this.url,this.taskId,t,e)},"@StagePool[spriteTexture.loadSpriteSheetItem]")}),Promise.resolve()},"@StagePool[loadSpriteSheets]")}createStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const n=this.stageJsons[t],i=this.stageCtxs[t],r=new NR(n,i,{x:0,y:0},e);return this.stageImpls[t]=r,Promise.resolve()},"@StagePool[createStage]")}preRenderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>(this.stageImpls[t].preRender(e),Promise.resolve()),"@StagePool[preRenderStage]")}createGraphicsTexture(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const n=this.stageCtxs[t];n.graphicsTexture.pack().forEach((t,i)=>{e.addSubMTask(()=>n.graphicsTexture.render(t,i,this.objPoolGroup),"@StagePool[graphicsTexture.render]")})})),"@StagePool[createGraphicsTexture]")}renderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const n=this.stageImpls[t],i=this.stageCtxs[t];yield n.render(e),e.addSubMTask(()=>WR(this,void 0,void 0,(function*(){var e;const r=`snapshot-${t.toString()}-start`;if(!(yield null===(e=this.localstorage)||void 0===e?void 0:e.getItem(r))&&KR.platform.isLowGpuMemory()){n.createTiming(),n.container.visible=!0,n.collectMainSeqStartValue(),n.setMainSeqStep(0,"start");const t=Hy.create({width:n.json.width,height:n.json.height,resolution:1});i.renderer.render(n.container,{renderTexture:t});const e=i.renderer.plugins.extract.base64(t,"image/jpeg");this.localstorage.setItem(r,e,!0).catch(()=>{}),n.container.visible=!1,t.destroy(),n.timing&&(n.timing.destroy(),n.timing=void 0)}})),"@StagePool[snapshot]")})),"@StagePool[renderStage]")}destroyStageByIndex(t){"load"===this.stageStates[t].state&&this.stageStates[t].task.cancel(),delete this.stageStates[t];this.stageImpls[t].destroy(),delete this.stageImpls[t],delete this.stageCtxs[t]}destroyStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);Math.abs(this.currentStageIndex-e)>this.cacheCount&&this.destroyStageByIndex(e)})}destroyAllStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);this.destroyStageByIndex(e)})}preload(t,e=!1){if(this.stageImpls[t]||this.stageStates[t])return Promise.resolve();const n=new UR(t,this.taskId,this.logger);return n.on("task-error",(t,e)=>{delete this.stageStates[e],delete this.stageImpls[e],delete this.stageCtxs[e],this.errorChannel.emit("error",t,e)}),this.stageStates[t]={state:"load",task:n},this.createCtx(t),this.loadStageJson(t),this.loadSpriteSheets(t),this.createStage(t),this.preRenderStage(t),this.createGraphicsTexture(t),this.renderStage(t),this.microTaskManager.addTask(n),e?n.applyAll():new Promise(e=>{n.once("task-finish",()=>{this.stageStates[t].state="finish";Object.keys(this.stageStates).length>2*this.cacheCount+1&&this.destroyStage(),e()})})}getStageJson(t){return this.stageJsons[t]||null}getStage(t){return WR(this,void 0,void 0,(function*(){this.currentStageIndex=t;const e=this.stageStates[t];return"finish"===(null==e?void 0:e.state)&&this.stageImpls[t]?this.stageImpls[t]:"load"===(null==e?void 0:e.state)?(yield e.task.applyAll(),this.stageImpls[t]):(yield this.preload(t,!0),this.stageImpls[t])}))}destroy(){this.runningAudio.clear()}}var qR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class YR{constructor(t){var e;this.logger=t,this.taskId="",this.isIndexDBReady=!1,this.memoryCache=new Map,null===(e=YR.localCache)||void 0===e||e.ready(()=>{this.isIndexDBReady=!0}).catch(()=>{t.warn("local storage not ready",this.taskId)})}get couldUseIndexDBCache(){return this.isIndexDBReady&&this.taskId.length>0}attachTaskId(t){this.taskId=t}getItem(t){return qR(this,void 0,void 0,(function*(){let e=null;return this.couldUseIndexDBCache&&YR.localCache&&(e=yield iM(()=>YR.localCache.getItem(`${this.taskId}/${t}`),500)),e=e===nM?null:e,e||this.memoryCache.get(t)||null}))}setItem(t,e,n=!1){return qR(this,void 0,void 0,(function*(){if(!this.couldUseIndexDBCache)return n&&this.memoryCache.set(t,e),Promise.resolve();if(YR.localCache){(yield iM(()=>YR.localCache.setItem(`${this.taskId}/${t}`,e).catch(()=>{n&&this.memoryCache.set(t,e)}),500))===nM&&n&&this.memoryCache.set(t,e)}}))}dispose(){var t;this.memoryCache=new Map,this.couldUseIndexDBCache&&(null===(t=YR.localCache)||void 0===t||t.keys().then(t=>{t.filter(t=>t.indexOf(this.taskId)>=0).forEach(t=>{var e;null===(e=YR.localCache)||void 0===e||e.removeItem(t).catch(()=>{})})}))}}YR.localCache=null;try{YR.localCache=o.createInstance({name:"slide_local_cache",driver:o.INDEXEDDB,version:1})}catch(t){}var ZR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};r.skipHello();const JR={randomBar:"RandomLines",circle:"Shape",ripple:"Ripples",wipe:"Erase",dissolve:"Dissolve",morph:"Smooth",fade:"FadeInOut",push:"Push",split:"Separation",reveal:"Display",pull:"Uncover",cover:"Cover",flash:"Flash",checker:"Checkerboard",blinds:"WindowShades",curtains:"Curtain",fallOver:"Fall",drape:"Suspension",wheel:"Clock",comb:"Combing",warp:"Scale",peelOff:"PeelOff",flip:"Flip"},$R={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqAction:"interactiveSeqAction",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",slideChange:"slideChange",renderStart:"renderStart",renderEnd:"renderEnd",hyperlinkTrigger:"hyperlinkTrigger",animateStart:"animateStart",animateEnd:"animateEnd",mediaSeek:"mediaSeek",mediaPlay:"mediaPlay",mediaPause:"mediaPause",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide",userInput:"userInput"};class KR extends a.a{constructor(t,e={}){super(),this.errorChannel=new a.a,this.transactionPlayer=null,this.transactionSprite=new Ow,this.isForward=!0,this.drawCall=0,this.scale=1,this.prevSlideBase64=null,this._isPaused=!1,this.maxResolution=new v_(0,0),this.fps=new XE,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.isPlayerPaused=()=>this._isPaused,this.onWebGLLost=()=>{this.errorChannel.emit("error",new qE(VE.CanvasCrash,"webgl context lost."))},this.logger=t.logger,this.mode=t.mode,this.localStorage=new YR(this.logger);let n=Math.max(window.devicePixelRatio,2);VR.isDesktop()||(n=1),this.config={minFPS:Object(l.isUndefined)(e.minFPS)?30:e.minFPS,maxFPS:Object(l.isUndefined)(e.maxFPS)?40:e.maxFPS,resolution:Object(l.isUndefined)(e.resolution)?n:e.resolution,autoFPS:!Object(l.isUndefined)(e.autoFPS)&&e.autoFPS,autoResolution:!Object(l.isUndefined)(e.autoResolution)&&e.autoResolution,transactionBgColor:Object(l.isUndefined)(e.transactionBgColor)?0:e.transactionBgColor,maxResolutionLevel:this.getMaxResolution(e.maxResolutionLevel)},this.updateMaxResolutionLevel(this.config.maxResolutionLevel),this.loader=new sM(this.localStorage,t.useLocalCache,this.logger,t.resourceTimeout,t.loadDelegate),this.app=new Lb({antialias:!0,autoDensity:!1,backgroundColor:16777215}),this.updateConfig(this.config),this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const i=this.app.renderer,{drawElements:r}=i.gl;i.gl.drawElements=(...t)=>{r.call(i.gl,...t),this.drawCall+=1},this.fps.on("update",t=>{if(t<this.config.minFPS){if(this.config.autoResolution){const t=.7*this.scale,e=this.app.renderer.resolution,n=Math.max(t,e-.1);n>=t&&this.updateResolution(n)}if(this.config.autoFPS){const t=14,{minFPS:e,maxFPS:n}=this.app.ticker,i=Math.max(t,e-2),r=Math.max(t,n-2);i>=t&&r>=t&&(this.app.ticker.minFPS=i,this.app.ticker.maxFPS=r)}}else if(t>this.config.maxFPS){if(this.config.autoResolution){const t=this.scale*this.config.resolution,e=this.app.renderer.resolution,n=Math.min(t,e+.1);n<=this.config.resolution&&this.updateResolution(n)}if(this.config.autoFPS){const t=this.config.minFPS,e=this.config.maxFPS,{minFPS:n,maxFPS:i}=this.app.ticker,r=Math.min(t,n+2),o=Math.min(e,i+2);r<=t&&o<=e&&(this.app.ticker.minFPS=r,this.app.ticker.maxFPS=o)}}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,ey.LOW),this.clock=new lM(this.app.ticker),this.objPoolGroup=eM(),this.stagePool=new XR(this.loader,this.mode,this.app.renderer,this.app.ticker,this.app.view,this.clock,this.objPoolGroup,this.errorChannel,this.localStorage,this.logger,t.loadDelegate,this.isPlayerPaused,this.maxResolution),this.app.view.addEventListener("webglcontextlost",this.onWebGLLost);try{this.transactionPlayer=new og}catch(t){/Error creating WebGL context/.test(t.message)?this.errorChannel.emit("error",new qE(VE.CanvasCrash,"webgl context lost.")):this.errorChannel.emit("error",new qE(VE.RuntimeWarn,t.message))}}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.nextIndex)?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.prevIndex)?this.currentStage.json.prevIndex:this.currentIndex-1}getMaxResolution(t){return!Object(l.isUndefined)(t)&&Number.isInteger(t)?(t<1&&(t=1),t>4&&(t=4),t):KR.platform.isAndroid()||KR.platform.isIOS()?2:4}updateMaxResolutionLevel(t){t<1&&(t=1),t>4&&(t=4);const e=[999999,960,1280,1920,3200][t],n=[999999,540,720,1080,1800][t];this.maxResolution.set(e,n)}updateConfig(t){Object(l.isUndefined)(t.minFPS)||(this.config.minFPS=t.minFPS,this.app.ticker.minFPS=t.minFPS),Object(l.isUndefined)(t.maxFPS)||(this.config.maxFPS=t.maxFPS,this.app.ticker.maxFPS=t.maxFPS),Object(l.isUndefined)(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),Object(l.isUndefined)(t.autoFPS)||(this.config.autoFPS=t.autoFPS),Object(l.isUndefined)(t.autoResolution)||(this.config.autoResolution=t.autoResolution),Object(l.isUndefined)(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor),this.taskId&&this.logger.info("ppt player update config: "+JSON.stringify(this.config),this.taskId),Object(l.isUndefined)(t.maxResolutionLevel)||(this.config.maxResolutionLevel=t.maxResolutionLevel,this.updateMaxResolutionLevel(this.config.maxResolutionLevel))}preload(t){return ZR(this,void 0,void 0,(function*(){t<1||t>this.slideCount||(this.logger.info(`preload slide ${t} begin`,this.taskId),yield this.stagePool.preload(t),this.logger.info(`preload slide ${t} end`,this.taskId))}))}setResourceData(t,e){this.logger.info("ppt player init config: "+JSON.stringify(this.config),t),this.logger.info("set resource to "+e,t),this.taskId=t,this.url=e,this.stagePool.setResourceData(t,e),this.localStorage.attachTaskId(t),this.loader.attachTaskId(t)}setInteractive(t){this.app.stage.interactive=t,this.app.stage.interactiveChildren=t}translateEvent(t,e){e.forEach(e=>{t.on(e,(...t)=>{this.emit(e,...t)})})}renderSlide(t,e=!1){var n;return ZR(this,void 0,void 0,(function*(){if(this._isPaused)return void this.logger.info("ppt play prevent render slide with paused state",this.taskId);this.logger.info("render slide "+t,this.taskId),this.emit($R.renderStart,t);const i=yield this.stagePool.getStage(t);if(!i)return;this.translateEvent(i.ctx.eventHub,[$R.mainSeqStepChange,$R.mainSeqStateChange,$R.hyperlinkTrigger,$R.interactiveSeqAction,$R.mainSeqStepStart,$R.mainSeqStepEnd,$R.animateStart,$R.animateEnd,$R.mediaPlay,$R.mediaPause,$R.mediaSeek,$R.requestGotoSlide,$R.requestNextSlide,$R.requestPrevSlide,$R.interactiveSeqStateChange,$R.userInput]),this.currentIndex=Number(t);const{width:r,height:o,slideCount:s}=i.json;this.slideCount=s,this.designWidth=r,this.designHeight=o,i.json.transition&&i.json.transition.type&&!this.prevSlideBase64&&this.currentStage&&(this.prevSlideBase64=this.getBase64(this.currentStage)),null===(n=this.currentStage)||void 0===n||n.clearOnSlideChange();const a=this.currentStage;this.currentStage=i,i.initOnReuse(),i.createTiming(),i.container.visible=!0,i.collectMainSeqStartValue(),this.isForward?i.setMainSeqStep(0,"start"):i.setMainSeqStep(-1,"end");let l=null;if(i.json.transition&&i.json.transition.type){const n=t.toString()+(this.isForward||e?"-start":"-end"),i=yield this.localStorage.getItem("snapshot-"+n);l=i||this.getBase64(this.currentStage)}i.container.visible=!1,this.app.stage.addChild(i.container);let{transition:u}=i.json;!this.isForward&&(null==a?void 0:a.json.transition)&&(u=a.json.transition),this.prevSlideBase64&&l&&u&&u.type&&a&&i&&(yield this.playTransaction(this.prevSlideBase64,l,u,a,i),this.prevSlideBase64=null),this.isForward?yield i.startTiming():i.setMainSeqApplied(),this.updateResolution(this.config.resolution*this.scale),i.container.visible=!0,a&&(a.setMainSeqStep(0,"start"),a.clearOnTransactionEnd(),this.app.stage.removeChild(a.container)),i.ctx.slideScopeEventHub.emit("slide-render",i.ctx.slideIndex),this.emit($R.renderEnd,t),this.emit($R.slideChange,t),this.preload(t+1).catch(e=>{this.errorChannel.emit("error",qE.transform(e),t+1)}),this.preload(t-1).catch(e=>{this.errorChannel.emit("error",qE.transform(e),t-1)})}))}renderToBase64(t,e,n){return ZR(this,void 0,void 0,(function*(){const i=yield this.stagePool.getStage(t);if(i){const{width:r,height:o}=i.json;this.designWidth=r,this.designHeight=o;const s=Hy.create({width:this.designWidth,height:this.designHeight,resolution:e});i.container.visible=!0,this.app.renderer.render(i.container,{renderTexture:s});const a=this.app.renderer.plugins.extract.base64(s,n);return this.stagePool.destroyStageByIndex(t),a}return"__null__"}))}getBase64(t){if(!t.container.transform)return null;const e=Hy.create({width:this.designWidth,height:this.designHeight,resolution:1});this.app.renderer.render(t.container,{renderTexture:e});const n=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(!0),n}playTransaction(t,e,n,i,r){return ZR(this,void 0,void 0,(function*(){const o=this.app.view.parentElement;if(t&&e&&o&&JR[n.type]&&this.transactionPlayer){this.transactionSprite.zIndex=999,this.transactionSprite.visible=!1,this.app.stage.addChild(this.transactionSprite);const o=this.transactionPlayer.renderer.domElement,s=ky.from(o),a=()=>s.update();return this.app.ticker.add(a),this.transactionSprite.texture=s,setTimeout(()=>{this.transactionSprite.visible=!0},100),new Promise(o=>{var s,l,u,h;null===(s=this.transactionPlayer)||void 0===s||s.play({reverse:!this.isForward,prevTextureUrl:t,nextTextureUrl:e,textureWidth:this.designWidth,textureHeight:this.designHeight,presetType:JR[n.type],stageWidth:this.designWidth,stageHeight:this.designHeight,duration:null===(u=null===(l=this.currentStage)||void 0===l?void 0:l.json.transition)||void 0===u?void 0:u.dur,delay:0,clearColor:this.config.transactionBgColor,maxFPS:Math.ceil(null!==(h=this.config.maxFPS)&&void 0!==h?h:60),onTransactionEnd:()=>{var t,e;o(),i.container.visible=!1,r.container.visible=!0,null===(t=this.app.stage)||void 0===t||t.removeChild(this.transactionSprite),null===(e=this.app.ticker)||void 0===e||e.remove(a)}})})}return Promise.resolve()}))}scaleView(t,e,n){if(this.view&&(this.view.style.width=Math.floor(this.designWidth*t)+"px",this.view.style.height=Math.floor(this.designHeight*t)+"px"),e){this.scale=t;const e=this.scale*this.config.resolution;this.updateResolution(e,n)}}updateResolution(t,e){this.app.ticker.addOnce(()=>{let n=VR.isDesktop()?t:1;for(;n*this.designWidth>this.maxResolution.x||n*this.designHeight>this.maxResolution.y;)n-=.1;this.app.renderer.resolution=n,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight),Object(l.isFunction)(e)&&e()})}nextStep(t=!1){var e;if(this._isPaused)this.logger.info("ppt play prevent next step with paused state",this.taskId);else{this.logger.info("ppt play trigger next step",this.taskId);try{null===(e=this.currentStage)||void 0===e||e.nextStep(t)}catch(t){this.errorChannel.emit("error",qE.transform(t),this.currentIndex)}}}prevStep(t=!1){var e;if(this._isPaused)this.logger.info("ppt play prevent prev step with paused state",this.taskId);else{this.logger.info("ppt play trigger prev step",this.taskId);try{null===(e=this.currentStage)||void 0===e||e.prevStep(t)}catch(t){this.errorChannel.emit("error",qE.transform(t),this.currentIndex)}}}mainSeqLength(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqLength())&&void 0!==e?e:0}mainSeqStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqStep())&&void 0!==e?e:0}setMainSeqStep(t,e){var n;null===(n=this.currentStage)||void 0===n||n.setMainSeqStep(t,e)}mainSeqState(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqState())&&void 0!==e?e:null}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},ey.LOW)}applyInteractiveAction(t){var e;null===(e=this.currentStage)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.currentStage)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var i;null===(i=this.currentStage)||void 0===i||i.setInteractiveSeqState(t,e,n)}setMediaState(t,e){var n;return ZR(this,void 0,void 0,(function*(){yield null===(n=this.currentStage)||void 0===n?void 0:n.setMediaState(t,e)}))}setMediaCurrentTime(t,e){var n;null===(n=this.currentStage)||void 0===n||n.setMediaCurrentTime(t,e)}pause(){var t;this.app.ticker.stop(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalPause()}),this._isPaused=!0}resume(){var t;this._isPaused=!1,this.app.ticker.start(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalResume()})}getSnapshot(){return this.currentStage&&this.getBase64(this.currentStage)||""}createSnapshotForNextSlide(t){return ZR(this,void 0,void 0,(function*(){const e=this.nextSlideIndex,n=this.stagePool.getStageJson(e);if(n&&n.transition&&n.transition.type&&this.currentStage&&this.transactionPlayer){const e=t?`snapshot-${this.currentStage.json.index}-start`:`snapshot-${this.currentStage.json.index}-end`;if(this.currentStage.timing&&(t?this.currentStage.timing.mainSeqHasPrevStep():this.currentStage.timing.mainSeqHasNextStep()))this.prevSlideBase64=this.getBase64(this.currentStage);else{const t=yield this.localStorage.getItem(e);t?this.prevSlideBase64=t:(this.prevSlideBase64=this.getBase64(this.currentStage),this.localStorage.setItem(e,this.prevSlideBase64,!0).catch(()=>{}))}}}))}clearLocalCache(){this.localStorage.dispose()}static clearLocalCache(){var t;null===(t=YR.localCache)||void 0===t||t.clear().catch(()=>{})}destroy(){var t;try{this.app.view.removeEventListener("webglcontextlost",this.onWebGLLost);try{this.app.renderer.filter.texturePool.clear(!0)}catch(t){}_M.collectObjectByGroup(this.objPoolGroup),yM.collectObjectByGroup(this.objPoolGroup),null===(t=this.transactionPlayer)||void 0===t||t.destroy(),this.loader.destroy(),this.fps.destroy(),this.stagePool.destroyAllStage(),this.stagePool.destroy();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){}this.app.destroy(!0,{children:!0,texture:!0,baseTexture:!0})}catch(t){}}}KR.platform=VR,KR.RtcAudioClazz=null;var QR=new Map;function tP(t){var e=QR.get(t.hookPoint)||[];e.push(t),QR.set(t.hookPoint,e)}var eP,nP=[],iP="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(eP||(eP={}));var rP,oP=function(t){return Object.freeze(t)},sP=function(t,e){this.inlineSize=t,this.blockSize=e,oP(this)},aP=function(){function t(t,e,n,i){return this.x=t,this.y=e,this.width=n,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,oP(this)}return t.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),lP=function(t){return t instanceof SVGElement&&"getBBox"in t},uP=function(t){if(lP(t)){var e=t.getBBox(),n=e.width,i=e.height;return!n&&!i}var r=t,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||t.getClientRects().length)},hP=function(t){var e,n;if(t instanceof Element)return!0;var i=null===(n=null===(e=t)||void 0===e?void 0:e.ownerDocument)||void 0===n?void 0:n.defaultView;return!!(i&&t instanceof i.Element)},cP="undefined"!=typeof window?window:{},dP=new WeakMap,pP=/auto|scroll/,fP=/^tb|vertical/,mP=/msie|trident/i.test(cP.navigator&&cP.navigator.userAgent),gP=function(t){return parseFloat(t||"0")},vP=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=!1),new sP((n?e:t)||0,(n?t:e)||0)},_P=oP({devicePixelContentBoxSize:vP(),borderBoxSize:vP(),contentBoxSize:vP(),contentRect:new aP(0,0,0,0)}),yP=function(t,e){if(void 0===e&&(e=!1),dP.has(t)&&!e)return dP.get(t);if(uP(t))return dP.set(t,_P),_P;var n=getComputedStyle(t),i=lP(t)&&t.ownerSVGElement&&t.getBBox(),r=!mP&&"border-box"===n.boxSizing,o=fP.test(n.writingMode||""),s=!i&&pP.test(n.overflowY||""),a=!i&&pP.test(n.overflowX||""),l=i?0:gP(n.paddingTop),u=i?0:gP(n.paddingRight),h=i?0:gP(n.paddingBottom),c=i?0:gP(n.paddingLeft),d=i?0:gP(n.borderTopWidth),p=i?0:gP(n.borderRightWidth),f=i?0:gP(n.borderBottomWidth),m=c+u,g=l+h,v=(i?0:gP(n.borderLeftWidth))+p,_=d+f,y=a?t.offsetHeight-_-t.clientHeight:0,x=s?t.offsetWidth-v-t.clientWidth:0,b=r?m+v:0,T=r?g+_:0,w=i?i.width:gP(n.width)-b-x,S=i?i.height:gP(n.height)-T-y,E=w+m+x+v,M=S+g+y+_,A=oP({devicePixelContentBoxSize:vP(Math.round(w*devicePixelRatio),Math.round(S*devicePixelRatio),o),borderBoxSize:vP(E,M,o),contentBoxSize:vP(w,S,o),contentRect:new aP(c,l,w,S)});return dP.set(t,A),A},xP=function(t,e,n){var i=yP(t,n),r=i.borderBoxSize,o=i.contentBoxSize,s=i.devicePixelContentBoxSize;switch(e){case eP.DEVICE_PIXEL_CONTENT_BOX:return s;case eP.BORDER_BOX:return r;default:return o}},bP=function(t){var e=yP(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=oP([e.borderBoxSize]),this.contentBoxSize=oP([e.contentBoxSize]),this.devicePixelContentBoxSize=oP([e.devicePixelContentBoxSize])},TP=function(t){if(uP(t))return 1/0;for(var e=0,n=t.parentNode;n;)e+=1,n=n.parentNode;return e},wP=function(){var t=1/0,e=[];nP.forEach((function(n){if(0!==n.activeTargets.length){var i=[];n.activeTargets.forEach((function(e){var n=new bP(e.target),r=TP(e.target);i.push(n),e.lastReportedSize=xP(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){n.callback.call(n.observer,i,n.observer)})),n.activeTargets.splice(0,n.activeTargets.length)}}));for(var n=0,i=e;n<i.length;n++){(0,i[n])()}return t},SP=function(t){nP.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(n){n.isActive()&&(TP(n.target)>t?e.activeTargets.push(n):e.skippedTargets.push(n))}))}))},EP=function(){var t,e=0;for(SP(e);nP.some((function(t){return t.activeTargets.length>0}));)e=wP(),SP(e);return nP.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:iP}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=iP),window.dispatchEvent(t)),e>0},MP=[],AP=function(t){if(!rP){var e=0,n=document.createTextNode("");new MutationObserver((function(){return MP.splice(0).forEach((function(t){return t()}))})).observe(n,{characterData:!0}),rP=function(){n.textContent=""+(e?e--:e++)}}MP.push(t),rP()},RP=0,PP={attributes:!0,characterData:!0,childList:!0,subtree:!0},CP=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],IP=function(t){return void 0===t&&(t=0),Date.now()+t},OP=!1,LP=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!OP){OP=!0;var n,i=IP(t);n=function(){var n=!1;try{n=EP()}finally{if(OP=!1,t=i-IP(),!RP)return;n?e.run(1e3):t>0?e.run(t):e.start()}},AP((function(){requestAnimationFrame(n)}))}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,PP)};document.body?e():cP.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),CP.forEach((function(e){return cP.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),CP.forEach((function(e){return cP.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),NP=function(t){!RP&&t>0&&LP.start(),!(RP+=t)&&LP.stop()},DP=function(){function t(t,e){this.target=t,this.observedBox=e||eP.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=xP(this.target,this.observedBox,!0);return t=this.target,lP(t)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),FP=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},BP=new WeakMap,UP=function(t,e){for(var n=0;n<t.length;n+=1)if(t[n].target===e)return n;return-1},kP=function(){function t(){}return t.connect=function(t,e){var n=new FP(t,e);BP.set(t,n)},t.observe=function(t,e,n){var i=BP.get(t),r=0===i.observationTargets.length;UP(i.observationTargets,e)<0&&(r&&nP.push(i),i.observationTargets.push(new DP(e,n&&n.box)),NP(1),LP.schedule())},t.unobserve=function(t,e){var n=BP.get(t),i=UP(n.observationTargets,e),r=1===n.observationTargets.length;i>=0&&(r&&nP.splice(nP.indexOf(n),1),n.observationTargets.splice(i,1),NP(-1))},t.disconnect=function(t){var e=this,n=BP.get(t);n.observationTargets.slice().forEach((function(n){return e.unobserve(t,n.target)})),n.activeTargets.splice(0,n.activeTargets.length)},t}(),GP=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");kP.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!hP(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");kP.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!hP(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");kP.unobserve(this,t)},t.prototype.disconnect=function(){kP.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),HP=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},zP=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},jP=function(){function t(t,e,n,i,r){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=n,this.index=t,this.slideIndex=e,this.eventHub=i,this.id=r}return t.prototype.apply=function(){return HP(this,void 0,void 0,(function(){var t;return zP(this,(function(e){switch(e.label){case 0:this.eventHub.emit("task-start",this),e.label=1;case 1:return e.trys.push([1,3,,4]),this.state="start",[4,this.fn()];case 2:return e.sent(),this.state="end",this.eventHub.emit("task-end",this),[3,4];case 3:return t=e.sent(),this.eventHub.emit("task-error",{task:this,error:t}),[3,4];case 4:return[2]}}))}))},t}(),VP=function(){function t(){var t=this;this.eventHub=new a.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",(function(e){var n,i=t.tasks.findIndex((function(t){return t.index===e.index})),r=i+1;r>=0&&(null===(n=t.tasks[r])||void 0===n||n.apply()),i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)})),this.eventHub.on("task-error",(function(e){var n=e.task,i=t.tasks.findIndex((function(t){return t.index===n.index}));i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask())}))}return t.prototype.replaceIdleTask=function(){for(var t,e=this,n=new Set,i=0,r=this.tasks.length;i<r;i++)"idle"===this.tasks[i].state&&"idle"===(null===(t=this.tasks[i+1])||void 0===t?void 0:t.state)&&n.add(i);Array.from(n).forEach((function(t){e.tasks.splice(t,1)}))},t.prototype.addTask=function(t,e,n){var i=new jP(this.index++,e,t,this.eventHub,n);this.tasks.push(i),this.tasks.sort((function(t,e){return t.index-e.index})),this.replaceIdleTask(),1===this.tasks.length&&i.apply()},t.prototype.hasStartTask=function(){return this.tasks.some((function(t){return"start"===t.state}))},t.prototype.destroy=function(){this.eventHub.removeAllListeners()},t}();function WP(t,e){var n=t.__state.conversionName.toString(),i=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),s=t.a,a=Math.round(t.h),l=t.s.toFixed(1),u=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=t.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+s+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+s+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+u+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+u+",a:"+s+"}":"unknown format"}var XP=Array.prototype.forEach,qP=Array.prototype.slice,YP={BREAK:{},extend:function(t){return this.each(qP.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))}),this),t},defaults:function(t){return this.each(qP.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))}),this),t},compose:function(){var t=qP.call(arguments);return function(){for(var e=qP.call(arguments),n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},each:function(t,e,n){if(t)if(XP&&t.forEach&&t.forEach===XP)t.forEach(e,n);else if(t.length===t.length+0){var i,r=void 0;for(r=0,i=t.length;r<i;r++)if(r in t&&e.call(n,t[r],r)===this.BREAK)return}else for(var o in t)if(e.call(n,t[o],o)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,n){var i=void 0;return function(){var r=this,o=arguments;function s(){i=null,n||t.apply(r,o)}var a=n||!i;clearTimeout(i),i=setTimeout(s,e),a&&t.apply(r,o)}},toArray:function(t){return t.toArray?t.toArray():qP.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return isNaN(t)})),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return t instanceof Function}},ZP=[{litmus:YP.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:WP},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:WP},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:WP},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:WP}}},{litmus:YP.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:YP.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:YP.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(YP.isNumber(t.r)&&YP.isNumber(t.g)&&YP.isNumber(t.b)&&YP.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(YP.isNumber(t.r)&&YP.isNumber(t.g)&&YP.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(YP.isNumber(t.h)&&YP.isNumber(t.s)&&YP.isNumber(t.v)&&YP.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(YP.isNumber(t.h)&&YP.isNumber(t.s)&&YP.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],JP=void 0,$P=void 0,KP=function(){$P=!1;var t=arguments.length>1?YP.toArray(arguments):arguments[0];return YP.each(ZP,(function(e){if(e.litmus(t))return YP.each(e.conversions,(function(e,n){if(JP=e.read(t),!1===$P&&!1!==JP)return $P=JP,JP.conversionName=n,JP.conversion=e,YP.BREAK})),YP.BREAK})),$P},QP=void 0,tC={hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),s=n*(1-r*e),a=n*(1-(1-r)*e),l=[[n,a,o],[s,n,o],[o,n,a],[o,s,n],[a,o,n],[n,o,s]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,n){var i=Math.min(t,e,n),r=Math.max(t,e,n),o=r-i,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=t===r?(e-n)/o:e===r?2+(n-t)/o:4+(t-e)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(QP=8*e)|t&~(255<<QP)}},eC="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nC=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},iC=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),rC=function t(e,n,i){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):void 0},oC=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},sC=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},aC=function(){function t(){if(nC(this,t),this.__state=KP.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return iC(t,[{key:"toString",value:function(){return WP(this)}},{key:"toHexString",value:function(){return WP(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function lC(t,e,n){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||aC.recalculateRGB(this,e,n),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(aC.recalculateRGB(this,e,n),this.__state.space="RGB"),this.__state[e]=t}})}function uC(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||aC.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(aC.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}aC.recalculateRGB=function(t,e,n){if("HEX"===t.__state.space)t.__state[e]=tC.component_from_hex(t.__state.hex,n);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");YP.extend(t.__state,tC.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},aC.recalculateHSV=function(t){var e=tC.rgb_to_hsv(t.r,t.g,t.b);YP.extend(t.__state,{s:e.s,v:e.v}),YP.isNaN(e.h)?YP.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},aC.COMPONENTS=["r","g","b","h","s","v","hex","a"],lC(aC.prototype,"r",2),lC(aC.prototype,"g",1),lC(aC.prototype,"b",0),uC(aC.prototype,"h"),uC(aC.prototype,"s"),uC(aC.prototype,"v"),Object.defineProperty(aC.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(aC.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=tC.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}});var hC=function(){function t(e,n){nC(this,t),this.initialValue=e[n],this.domElement=document.createElement("div"),this.object=e,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return iC(t,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),t}(),cC={};YP.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){YP.each(t,(function(t){cC[t]=e}))}));var dC=/(\d+(\.\d+)?)px/;function pC(t){if("0"===t||YP.isUndefined(t))return 0;var e=t.match(dC);return YP.isNull(e)?0:parseFloat(e[1])}var fC={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,n){var i=n,r=e;YP.isUndefined(r)&&(r=!0),YP.isUndefined(i)&&(i=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),i&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,n,i){var r=n||{},o=cC[e];if(!o)throw new Error("Event type "+e+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var a=r.x||r.clientX||0,l=r.y||r.clientY||0;s.initMouseEvent(e,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,a,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var u=s.initKeyboardEvent||s.initKeyEvent;YP.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),u(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(e,r.bubbles||!1,r.cancelable||!0)}YP.defaults(s,i),t.dispatchEvent(s)},bind:function(t,e,n,i){var r=i||!1;return t.addEventListener?t.addEventListener(e,n,r):t.attachEvent&&t.attachEvent("on"+e,n),fC},unbind:function(t,e,n,i){var r=i||!1;return t.removeEventListener?t.removeEventListener(e,n,r):t.detachEvent&&t.detachEvent("on"+e,n),fC},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var n=t.className.split(/ +/);-1===n.indexOf(e)&&(n.push(e),t.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return fC},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var n=t.className.split(/ +/),i=n.indexOf(e);-1!==i&&(n.splice(i,1),t.className=n.join(" "))}else t.className=void 0;return fC},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return pC(e["border-left-width"])+pC(e["border-right-width"])+pC(e["padding-left"])+pC(e["padding-right"])+pC(e.width)},getHeight:function(t){var e=getComputedStyle(t);return pC(e["border-top-width"])+pC(e["border-bottom-width"])+pC(e["padding-top"])+pC(e["padding-bottom"])+pC(e.height)},getOffset:function(t){var e=t,n={left:0,top:0};if(e.offsetParent)do{n.left+=e.offsetLeft,n.top+=e.offsetTop,e=e.offsetParent}while(e);return n},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},mC=function(t){function e(t,n){nC(this,e);var i=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;return i.__prev=i.getValue(),i.__checkbox=document.createElement("input"),i.__checkbox.setAttribute("type","checkbox"),fC.bind(i.__checkbox,"change",(function(){r.setValue(!r.__prev)}),!1),i.domElement.appendChild(i.__checkbox),i.updateDisplay(),i}return oC(e,t),iC(e,[{key:"setValue",value:function(t){var n=rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(hC),gC=function(t){function e(t,n,i){nC(this,e);var r=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i,s=r;if(r.__select=document.createElement("select"),YP.isArray(o)){var a={};YP.each(o,(function(t){a[t]=t})),o=a}return YP.each(o,(function(t,e){var n=document.createElement("option");n.innerHTML=e,n.setAttribute("value",t),s.__select.appendChild(n)})),r.updateDisplay(),fC.bind(r.__select,"change",(function(){var t=this.options[this.selectedIndex].value;s.setValue(t)})),r.domElement.appendChild(r.__select),r}return oC(e,t),iC(e,[{key:"setValue",value:function(t){var n=rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return fC.isActive(this.__select)?this:(this.__select.value=this.getValue(),rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(hC),vC=function(t){function e(t,n){nC(this,e);var i=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;function o(){r.setValue(r.__input.value)}return i.__input=document.createElement("input"),i.__input.setAttribute("type","text"),fC.bind(i.__input,"keyup",o),fC.bind(i.__input,"change",o),fC.bind(i.__input,"blur",(function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())})),fC.bind(i.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),i.updateDisplay(),i.domElement.appendChild(i.__input),i}return oC(e,t),iC(e,[{key:"updateDisplay",value:function(){return fC.isActive(this.__input)||(this.__input.value=this.getValue()),rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(hC);function _C(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var yC=function(t){function e(t,n,i){nC(this,e);var r=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i||{};return r.__min=o.min,r.__max=o.max,r.__step=o.step,YP.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=_C(r.__impliedStep),r}return oC(e,t),iC(e,[{key:"setValue",value:function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=_C(t),this}}]),e}(hC);var xC=function(t){function e(t,n,i){nC(this,e);var r=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,i));r.__truncationSuspended=!1;var o=r,s=void 0;function a(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function l(t){var e=s-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),s=t.clientY}function u(){fC.unbind(window,"mousemove",l),fC.unbind(window,"mouseup",u),a()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),fC.bind(r.__input,"change",(function(){var t=parseFloat(o.__input.value);YP.isNaN(t)||o.setValue(t)})),fC.bind(r.__input,"blur",(function(){a()})),fC.bind(r.__input,"mousedown",(function(t){fC.bind(window,"mousemove",l),fC.bind(window,"mouseup",u),s=t.clientY})),fC.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,a())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return oC(e,t),iC(e,[{key:"updateDisplay",value:function(){var t,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(t*i)/i),rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(yC);function bC(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}var TC=function(t){function e(t,n,i,r,o){nC(this,e);var s=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:i,max:r,step:o})),a=s;function l(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(bC(t.clientX,e.left,e.right,a.__min,a.__max)),!1}function u(){fC.unbind(window,"mousemove",l),fC.unbind(window,"mouseup",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(t){var e=t.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(bC(e,n.left,n.right,a.__min,a.__max))}function c(){fC.unbind(window,"touchmove",h),fC.unbind(window,"touchend",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),fC.bind(s.__background,"mousedown",(function(t){document.activeElement.blur(),fC.bind(window,"mousemove",l),fC.bind(window,"mouseup",u),l(t)})),fC.bind(s.__background,"touchstart",(function(t){if(1!==t.touches.length)return;fC.bind(window,"touchmove",h),fC.bind(window,"touchend",c),h(t)})),fC.addClass(s.__background,"slider"),fC.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return oC(e,t),iC(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",rC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(yC),wC=function(t){function e(t,n,i){nC(this,e);var r=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,fC.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),fC.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return oC(e,t),iC(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(hC),SC=function(t){function e(t,n){nC(this,e);var i=sC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.__color=new aC(i.getValue()),i.__temp=new aC(0);var r=i;i.domElement=document.createElement("div"),fC.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",fC.bind(i.__input,"keydown",(function(t){13===t.keyCode&&c.call(this)})),fC.bind(i.__input,"blur",c),fC.bind(i.__selector,"mousedown",(function(){fC.addClass(this,"drag").bind(window,"mouseup",(function(){fC.removeClass(r.__selector,"drag")}))})),fC.bind(i.__selector,"touchstart",(function(){fC.addClass(this,"drag").bind(window,"touchend",(function(){fC.removeClass(r.__selector,"drag")}))}));var o,s=document.createElement("div");function a(t){p(t),fC.bind(window,"mousemove",p),fC.bind(window,"touchmove",p),fC.bind(window,"mouseup",u),fC.bind(window,"touchend",u)}function l(t){f(t),fC.bind(window,"mousemove",f),fC.bind(window,"touchmove",f),fC.bind(window,"mouseup",h),fC.bind(window,"touchend",h)}function u(){fC.unbind(window,"mousemove",p),fC.unbind(window,"touchmove",p),fC.unbind(window,"mouseup",u),fC.unbind(window,"touchend",u),d()}function h(){fC.unbind(window,"mousemove",f),fC.unbind(window,"touchmove",f),fC.unbind(window,"mouseup",h),fC.unbind(window,"touchend",h),d()}function c(){var t=KP(this.value);!1!==t?(r.__color.__state=t,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientX,o=n.clientY,s=(i-e.left)/(e.right-e.left),a=1-(o-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),n=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return YP.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),YP.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),YP.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),YP.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),YP.extend(s.style,{width:"100%",height:"100%",background:"none"}),MC(s,"top","rgba(0,0,0,0)","#000"),YP.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=i.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",YP.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),fC.bind(i.__saturation_field,"mousedown",a),fC.bind(i.__saturation_field,"touchstart",a),fC.bind(i.__field_knob,"mousedown",a),fC.bind(i.__field_knob,"touchstart",a),fC.bind(i.__hue_field,"mousedown",l),fC.bind(i.__hue_field,"touchstart",l),i.__saturation_field.appendChild(s),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return oC(e,t),iC(e,[{key:"updateDisplay",value:function(){var t=KP(this.getValue());if(!1!==t){var e=!1;YP.each(aC.COMPONENTS,(function(n){if(!YP.isUndefined(t[n])&&!YP.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}}),this),e&&YP.extend(this.__color.__state,t)}YP.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;YP.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,MC(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),YP.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),e}(hC),EC=["-moz-","-o-","-webkit-","-ms-",""];function MC(t,e,n,i){t.style.background="",YP.each(EC,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+n+" 0%, "+i+" 100%); "}))}var AC=function(t,e){var n=e||document,i=document.createElement("style");i.type="text/css",i.innerHTML=t;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(t){}},RC='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',PC=function(t,e){var n=t[e];return YP.isArray(arguments[2])||YP.isObject(arguments[2])?new gC(t,e,arguments[2]):YP.isNumber(n)?YP.isNumber(arguments[2])&&YP.isNumber(arguments[3])?YP.isNumber(arguments[4])?new TC(t,e,arguments[2],arguments[3],arguments[4]):new TC(t,e,arguments[2],arguments[3]):YP.isNumber(arguments[4])?new xC(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new xC(t,e,{min:arguments[2],max:arguments[3]}):YP.isString(n)?new vC(t,e):YP.isFunction(n)?new wC(t,e,""):YP.isBoolean(n)?new mC(t,e):null};var CC=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},IC=function(){function t(){nC(this,t),this.backgroundElement=document.createElement("div"),YP.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),fC.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),YP.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;fC.bind(this.backgroundElement,"click",(function(){e.hide()}))}return iC(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),YP.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",fC.unbind(t.domElement,"webkitTransitionEnd",e),fC.unbind(t.domElement,"transitionend",e),fC.unbind(t.domElement,"oTransitionEnd",e)};fC.bind(this.domElement,"webkitTransitionEnd",e),fC.bind(this.domElement,"transitionend",e),fC.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-fC.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-fC.getHeight(this.domElement)/2+"px"}}]),t}();AC(function(t){if(t&&"undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var OC=function(){try{return!!window.localStorage}catch(t){return!1}}(),LC=void 0,NC=!0,DC=void 0,FC=!1,BC=[],UC=function t(e){var n=this,i=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),fC.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=YP.defaults(i,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),i=YP.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),YP.isUndefined(i.load)?i.load={preset:"Default"}:i.preset&&(i.load.preset=i.preset),YP.isUndefined(i.parent)&&i.hideable&&BC.push(this),i.resizable=YP.isUndefined(i.parent)&&i.resizable,i.autoPlace&&YP.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,o=OC&&"true"===localStorage.getItem(VC(this,"isLocal")),s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(t){n.parent?n.getRoot().preset=t:i.load.preset=t,function(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}(this),n.revert()}},width:{get:function(){return i.width},set:function(t){i.width=t,ZC(n,t)}},name:{get:function(){return i.name},set:function(t){i.name=t,a&&(a.innerHTML=i.name)}},closed:{get:function(){return i.closed},set:function(e){i.closed=e,i.closed?fC.addClass(n.__ul,t.CLASS_CLOSED):fC.removeClass(n.__ul,t.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return i.load}},useLocalStorage:{get:function(){return o},set:function(t){OC&&(o=t,t?fC.bind(window,"unload",s):fC.unbind(window,"unload",s),localStorage.setItem(VC(n,"isLocal"),t))}}}),YP.isUndefined(i.parent)){if(this.closed=i.closed||!1,fC.addClass(this.domElement,t.CLASS_MAIN),fC.makeSelectable(this.domElement,!1),OC&&o){n.useLocalStorage=!0;var l=localStorage.getItem(VC(this,"gui"));l&&(i.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,fC.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),i.closeOnTop?(fC.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(fC.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),fC.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===i.closed&&(i.closed=!0);var u=document.createTextNode(i.name);fC.addClass(u,"controller-name"),a=kC(n,u);fC.addClass(this.__ul,t.CLASS_CLOSED),fC.addClass(a,"title"),fC.bind(a,"click",(function(t){return t.preventDefault(),n.closed=!n.closed,!1})),i.closed||(this.closed=!1)}i.autoPlace&&(YP.isUndefined(i.parent)&&(NC&&(DC=document.createElement("div"),fC.addClass(DC,"dg"),fC.addClass(DC,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(DC),NC=!1),DC.appendChild(this.domElement),fC.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||ZC(n,i.width)),this.__resizeHandler=function(){n.onResizeDebounced()},fC.bind(window,"resize",this.__resizeHandler),fC.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),fC.bind(this.__ul,"transitionend",this.__resizeHandler),fC.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),i.resizable&&YC(this),s=function(){OC&&"true"===localStorage.getItem(VC(n,"isLocal"))&&localStorage.setItem(VC(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=s,i.parent||((r=n.getRoot()).width+=1,YP.defer((function(){r.width-=1})))};function kC(t,e,n){var i=document.createElement("li");return e&&i.appendChild(e),n?t.__ul.insertBefore(i,n):t.__ul.appendChild(i),t.onResize(),i}function GC(t){fC.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&fC.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function HC(t,e){var n=t.__preset_select[t.__preset_select.selectedIndex];n.innerHTML=e?n.value+"*":n.value}function zC(t,e){var n=t.getRoot(),i=n.__rememberedObjects.indexOf(e.object);if(-1!==i){var r=n.__rememberedObjectIndecesToControllers[i];if(void 0===r&&(r={},n.__rememberedObjectIndecesToControllers[i]=r),r[e.property]=e,n.load&&n.load.remembered){var o=n.load.remembered,s=void 0;if(o[t.preset])s=o[t.preset];else{if(!o.Default)return;s=o.Default}if(s[i]&&void 0!==s[i][e.property]){var a=s[i][e.property];e.initialValue=a,e.setValue(a)}}}}function jC(t,e,n,i){if(void 0===e[n])throw new Error('Object "'+e+'" has no property "'+n+'"');var r=void 0;if(i.color)r=new SC(e,n);else{var o=[e,n].concat(i.factoryArgs);r=PC.apply(t,o)}i.before instanceof hC&&(i.before=i.before.__li),zC(t,r),fC.addClass(r.domElement,"c");var s=document.createElement("span");fC.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var l=kC(t,a,i.before);return fC.addClass(l,UC.CLASS_CONTROLLER_ROW),r instanceof SC?fC.addClass(l,"color"):fC.addClass(l,eC(r.getValue())),function(t,e,n){if(n.__li=e,n.__gui=t,YP.extend(n,{options:function(e){if(arguments.length>1){var i=n.__li.nextElementSibling;return n.remove(),jC(t,n.object,n.property,{before:i,factoryArgs:[YP.toArray(arguments)]})}if(YP.isArray(e)||YP.isObject(e)){var r=n.__li.nextElementSibling;return n.remove(),jC(t,n.object,n.property,{before:r,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof TC){var i=new xC(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});YP.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=n[t],r=i[t];n[t]=i[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(i,t),e.apply(n,t)}})),fC.addClass(e,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof xC){var r=function(e){if(YP.isNumber(n.__min)&&YP.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=jC(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(i),r&&o.listen(),o}return e};n.min=YP.compose(r,n.min),n.max=YP.compose(r,n.max)}else n instanceof mC?(fC.bind(e,"click",(function(){fC.fakeEvent(n.__checkbox,"click")})),fC.bind(n.__checkbox,"click",(function(t){t.stopPropagation()}))):n instanceof wC?(fC.bind(e,"click",(function(){fC.fakeEvent(n.__button,"click")})),fC.bind(e,"mouseover",(function(){fC.addClass(n.__button,"hover")})),fC.bind(e,"mouseout",(function(){fC.removeClass(n.__button,"hover")}))):n instanceof SC&&(fC.addClass(e,"color"),n.updateDisplay=YP.compose((function(t){return e.style.borderLeftColor=n.__color.toString(),t}),n.updateDisplay),n.updateDisplay());n.setValue=YP.compose((function(e){return t.getRoot().__preset_select&&n.isModified()&&HC(t.getRoot(),!0),e}),n.setValue)}(t,l,r),t.__controllers.push(r),r}function VC(t,e){return document.location.href+"."+e}function WC(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function XC(t,e){e.style.display=t.useLocalStorage?"block":"none"}function qC(t){var e=t.__save_row=document.createElement("li");fC.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),fC.addClass(e,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",fC.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",fC.addClass(i,"button"),fC.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",fC.addClass(r,"button"),fC.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",fC.addClass(o,"button"),fC.addClass(o,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?YP.each(t.load.remembered,(function(e,n){WC(t,n,n===t.preset)})):WC(t,"Default",!1),fC.bind(s,"change",(function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value})),e.appendChild(s),e.appendChild(n),e.appendChild(i),e.appendChild(r),e.appendChild(o),OC){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(VC(0,"isLocal"))&&l.setAttribute("checked","checked"),XC(t,a),fC.bind(l,"change",(function(){t.useLocalStorage=!t.useLocalStorage,XC(t,a)}))}var u=document.getElementById("dg-new-constructor");fC.bind(u,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||LC.hide()})),fC.bind(n,"click",(function(){u.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),LC.show(),u.focus(),u.select()})),fC.bind(i,"click",(function(){t.save()})),fC.bind(r,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),fC.bind(o,"click",(function(){t.revert()}))}function YC(t){var e=void 0;function n(n){return n.preventDefault(),t.width+=e-n.clientX,t.onResize(),e=n.clientX,!1}function i(){fC.removeClass(t.__closeButton,UC.CLASS_DRAG),fC.unbind(window,"mousemove",n),fC.unbind(window,"mouseup",i)}function r(r){return r.preventDefault(),e=r.clientX,fC.addClass(t.__closeButton,UC.CLASS_DRAG),fC.bind(window,"mousemove",n),fC.bind(window,"mouseup",i),!1}t.__resize_handle=document.createElement("div"),YP.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),fC.bind(t.__resize_handle,"mousedown",r),fC.bind(t.__closeButton,"mousedown",r),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function ZC(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function JC(t,e){var n={};return YP.each(t.__rememberedObjects,(function(i,r){var o={},s=t.__rememberedObjectIndecesToControllers[r];YP.each(s,(function(t,n){o[n]=e?t.initialValue:t.getValue()})),n[r]=o})),n}UC.toggleHide=function(){FC=!FC,YP.each(BC,(function(t){t.domElement.style.display=FC?"none":""}))},UC.CLASS_AUTO_PLACE="a",UC.CLASS_AUTO_PLACE_CONTAINER="ac",UC.CLASS_MAIN="main",UC.CLASS_CONTROLLER_ROW="cr",UC.CLASS_TOO_TALL="taller-than-window",UC.CLASS_CLOSED="closed",UC.CLASS_CLOSE_BUTTON="close-button",UC.CLASS_CLOSE_TOP="close-top",UC.CLASS_CLOSE_BOTTOM="close-bottom",UC.CLASS_DRAG="drag",UC.DEFAULT_WIDTH=245,UC.TEXT_CLOSED="Close Controls",UC.TEXT_OPEN="Open Controls",UC._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||UC.toggleHide()},fC.bind(window,"keydown",UC._keydownHandler,!1),YP.extend(UC.prototype,{add:function(t,e){return jC(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return jC(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;YP.defer((function(){e.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&DC.removeChild(this.domElement);var t=this;YP.each(this.__folders,(function(e){t.removeFolder(e)})),fC.unbind(window,"keydown",UC._keydownHandler,!1),GC(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var n=new UC(e);this.__folders[t]=n;var i=kC(this,n.domElement);return fC.addClass(i,"folder"),n},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],GC(t);var e=this;YP.each(t.__folders,(function(e){t.removeFolder(e)})),YP.defer((function(){e.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var t=this.getRoot();if(t.scrollable){var e=fC.getOffset(t.__ul).top,n=0;YP.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(n+=fC.getHeight(e))})),window.innerHeight-e-20<n?(fC.addClass(t.domElement,UC.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(fC.removeClass(t.domElement,UC.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&YP.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:YP.debounce((function(){this.onResize()}),50),remember:function(){if(YP.isUndefined(LC)&&((LC=new IC).domElement.innerHTML=RC),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;YP.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&qC(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&ZC(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=JC(this)),t.folders={},YP.each(this.__folders,(function(e,n){t.folders[n]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=JC(this),HC(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=JC(this,!0)),this.load.remembered[t]=JC(this),this.preset=t,WC(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){YP.each(this.__controllers,(function(e){this.getRoot().load.remembered?zC(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),YP.each(this.__folders,(function(t){t.revert(t)})),t||HC(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&CC.call(window,(function(){t(e)}));YP.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){YP.each(this.__controllers,(function(t){t.updateDisplay()})),YP.each(this.__folders,(function(t){t.updateDisplay()}))}});var $C=UC,KC=function(){function t(t){this.runTime={fps:0,resolution:""},this.target=t.target,this.data=t.params,this.player=t.player,this.gui=this.createControllerGUI(),this.createStats(),this.addEventListener()}return t.prototype.createStats=function(){var t=this;this.stateId=setInterval((function(){t.player.view&&(t.controller.runTimeFps.setValue(t.player.fps.value),t.controller.drawCall.setValue(t.player.runtime.drawCall),t.controller.runTimeResolution.setValue(t.player.view.width+"*"+t.player.view.height))}),500)},t.prototype.createControllerGUI=function(){var t,e,n,i,r,o=new $C({autoPlace:!0,closed:!0});o.domElement.style.opacity=".6",o.domElement.style.transformOrigin="100% 0",o.domElement.style.transform="scale(1)",this.target.appendChild(o.domElement),o.domElement.style.position="absolute",o.domElement.style.right="0",o.domElement.style.top="0",o.domElement.style.zIndex="2";var s=o.add({FPS:0},"FPS",0),a=o.add({drawCall:0},"drawCall",0),l=o.add({"分辨率":""},"分辨率",""),u=o.add({"额外计算":0},"额外计算",0,200),h=o.addFolder("renderOptions");return this.controller={runTimeResolution:l,runTimeFps:s,drawCall:a,moreCalculation:u,minFPS:h.add({"最低fps":null!==(t=this.data.minFPS)&&void 0!==t?t:40},"最低fps",0,60),maxFPS:h.add({"最高fps":null!==(e=this.data.maxFPS)&&void 0!==e?e:50},"最高fps",0,60),resolution:h.add({"目标分辨倍率":null!==(n=this.data.resolution)&&void 0!==n?n:window.devicePixelRatio},"目标分辨倍率",.5,6),autoResolution:h.add({"自动分辨率":null!==(i=this.data.autoResolution)&&void 0!==i&&i},"自动分辨率",!0),autoFps:h.add({"自动fps":null===(r=this.data.autoFPS)||void 0===r||r},"自动fps",!0),transactionBgColor:h.addColor({"切页背景色":this.data.transactionBgColor},"切页背景色")},this.controller.runTimeFps.disabled=!0,this.controller.runTimeResolution.disabled=!0,o},t.prototype.addEventListener=function(){var t,e=this;this.controller.autoFps.onChange((function(t){e.data.autoFPS=t,e.player.updateConfig(e.data)})),this.controller.maxFPS.onChange((function(t){e.data.maxFPS=t,e.player.updateConfig(e.data)})),this.controller.minFPS.onChange((function(t){e.data.minFPS=t,e.player.updateConfig(e.data)})),this.controller.autoResolution.onChange((function(t){e.data.autoResolution=t,e.player.updateConfig(e.data)})),this.controller.resolution.onChange((function(t){e.data.resolution=t,e.player.updateConfig(e.data)})),this.controller.transactionBgColor.onChange((function(t){e.data.transactionBgColor=t,e.player.updateConfig(e.data)})),this.controller.moreCalculation.onChange((function(n){t&&e.player.app.ticker.remove(t),n>0&&(t=function(){for(var t="";t.length<8e3*n;)t+=Math.random().toString(32).substr(2);fM()(t)},e.player.app.ticker.add(t))}))},t.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.target.removeChild(this.gui.domElement),this.gui.destroy()}catch(t){}},t}(),QC=function(){function t(t){var e=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){e.isScheduling=!0;var t=e.tasks.shift();t&&!e.isDestroy&&e.fn(t).then((function(){e.tasks.length>0?window.requestAnimationFrame(e.schedule):e.isScheduling=!1}))},this.fn=t}return t.prototype.destroy=function(){this.isDestroy=!0},t.prototype.addTask=function(t){this.tasks.push(t),this.isScheduling||this.schedule()},t}(),tI=function(){function t(t){this.autoUnlock=Object.create(null),this.locks=Object.create(null),this.available=!1,this.available=t}return t.prototype.addLock=function(t,e){var n=this;this.available&&(this.locks[t]=e,this.autoUnlock[t]=window.setTimeout((function(){delete n.locks[t]}),3e3))},t.prototype.unlock=function(t,e){this.available&&e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t])},t.prototype.isLocked=function(t){return!!this.available&&!!this.locks[t]},t}(),eI=function(){function t(){var t=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){t.isScheduling=!0;var e=t.tasks.shift();e&&!t.isDestroy&&(e.status="running",e.fn.apply(null).then((function(){t.tasks.length>0?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})).catch((function(){t.tasks.length>0?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})))}}return t.prototype.getRunningTask=function(){return this.tasks[0]&&"running"===this.tasks[0].status?this.tasks[0]:null},t.prototype.addTask=function(t,e){var n={type:t,status:"wait",fn:e},i=this.getRunningTask();i&&t===i.type||(this.tasks=this.tasks.filter((function(e){return e.type!==t})),this.tasks.push(n),this.isScheduling||this.schedule())},t.prototype.destroy=function(){this.isDestroy=!0},t}(),nI=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),iI=function(){return(iI=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},rI=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},oI=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},sI=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},aI=window.ResizeObserver||GP,lI=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function uI(t,e){return oI(this,void 0,void 0,(function(){var n;return sI(this,(function(i){switch(i.label){case 0:n=Date.now(),i.label=1;case 1:return!t()&&Date.now()-n<e?[4,lI(50)]:[3,3];case 2:return i.sent(),[3,1];case 3:return[2]}}))}))}var hI={syncDispatch:"syncDispatch",syncReceive:"syncReceive",syncEventLag:"syncEventLag",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange"},cI={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},dI="";try{dI="0.5.16-alpha.1"}catch(t){dI="development"}var pI=null;try{pI=o.createInstance({name:"__slide_local_log__",driver:o.INDEXEDDB,version:1})}catch(t){}var fI=function(t){function e(n){var i=t.call(this)||this;return i.iosResetCache=[],i.needClearCacheImage=!1,i.version=dI,i.__slideState=Object(l.cloneDeep)(cI),i.userInputTime=0,i.isSyncingSlideState=!1,i.frozenTaskManager=new eI,i.randomId=Math.random().toString(32).substr(2),i.resize=!1,i.isAnimating=!1,i.renderingTaskManager=new VP,i.isLoading=!1,i.interactive=!0,i.renderingIndex=0,i.frameWidth=1,i.frameHeight=1,i.frame=document.createElement("div"),i.medianController=document.createElement("div"),i.frameResizeObserver=new aI((function(){return i.frameResizeHandler()})),i.timestamp=function(){return Date.now()},i.mode="local",i.enableGlobalClick=!1,i.lastEmitedState=null,i.playerController=null,i.isInitResized=!1,i.cacheImage=document.createElement("img"),i.isTouchStart=!1,i.touchStartId=void 0,i.taskId="",i.designWidth=0,i.designHeight=0,i._slideCount=0,i._dispatchIncrId=0,i._receiveIncrId=0,i.userInputHandle=function(){i.userInputTime=Date.now()},i.handleViewClick=function(){setTimeout((function(){var t=Date.now();Math.abs(t-i.userInputTime)>500&&i.enableGlobalClick&&i.nextStep()}))},i.handleViewTouchStart=function(){window.clearTimeout(i.touchStartId),i.isTouchStart=!0,i.touchStartId=setTimeout((function(){i.isTouchStart=!1}),350)},i.handleViewTouchEnd=function(){i.isTouchStart&&(i.isTouchStart=!1,i.handleViewClick())},i.handleSlideRef=function(){console.log(i),window.__slide=i},i.receiveSyncHandler=function(t){return oI(i,void 0,void 0,(function(){var e,n,i,r,o=this;return sI(this,(function(s){switch(s.label){case 0:return Object(l.isNumber)(t.incrId)&&(t.incrId&&t.incrId-this._receiveIncrId!=1&&this.emit(hI.syncEventLag),this._receiveIncrId=t.incrId||0),this.logger.info("sync receive "+JSON.stringify(t),this.taskId),"nextStep"!==t.type?[3,1]:(this.mainSeqStep!==t.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(t.next,"start"),this.player.nextTick((function(){o.doNextStep(!0)}))):this.doNextStep(!0),[3,6]);case 1:return"prevStep"!==t.type?[3,2]:(0===this.mainSeqStep&&"idle"===this.mainSeqState||this.mainSeqStep===t.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep(!0):(this.setMainSeqStep(t.next+1,"start"),null===(e=this.player)||void 0===e||e.nextTick((function(){o.doPrevStep(!0)}))),[3,6]);case 2:return"interactiveAnim"!==t.type?[3,3]:(this.player?this.player.applyInteractiveAction(t.action):this.__slideState.interactiveSeqState[t.seqId].step+=1,[3,6]);case 3:return"renderSlide"!==t.type?[3,5]:[4,this.doRenderSlide(t.index,t.isForward)];case 4:return s.sent(),[3,6];case 5:"mediaPlay"===t.type?(null===(n=this.player)||void 0===n||n.setMediaState(t.id,!0),this.__slideState.mediaState[t.id]=t.state):"mediaPause"===t.type?(null===(i=this.player)||void 0===i||i.setMediaState(t.id,!1),this.__slideState.mediaState[t.id]=t.state):"mediaSeek"===t.type&&(null===(r=this.player)||void 0===r||r.setMediaCurrentTime(t.id,t.time),this.__slideState.mediaState[t.id]=t.state),s.label=6;case 6:return[2]}}))}))},i.handlePrevSlide=function(t){return void 0===t&&(t=!1),oI(i,void 0,void 0,(function(){var e,n;return sI(this,(function(i){switch(i.label){case 0:return this.player?[4,null===(n=this.player)||void 0===n?void 0:n.createSnapshotForNextSlide(!0)]:[2];case 1:return i.sent(),(e=this.player.prevSlideIndex)>=1&&(this.config.navigatorDelegate?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!1):this.renderSlide(e,!1)),[2]}}))}))},i.handleNextSlide=function(t){return void 0===t&&(t=!1),oI(i,void 0,void 0,(function(){var e,n;return sI(this,(function(i){switch(i.label){case 0:return this.player?[4,null===(n=this.player)||void 0===n?void 0:n.createSnapshotForNextSlide(!1)]:[2];case 1:return i.sent(),(e=this.player.nextSlideIndex)<=this.slideCount&&(this.config.navigatorDelegate?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!0):this.renderSlide(e,!0)),[2]}}))}))},i.handleGotoSlide=function(t){if(t<=i.slideCount&&t>=1){var e=i.slideState.currentSlideIndex<=t;i.renderSlide(t,e)}else-1===t&&i.renderSlide(i.slideCount,!0)},i.config=i.initSlideConfig(n),i.logger={info:function(t,n){var r,o;(null===(r=i.config.logger)||void 0===r?void 0:r.info)&&(e._tempLog+="INFO - "+(new Date).toISOString()+" - {"+i.randomId+"}["+n+"] "+t+"\n\n",null===(o=i.config.logger)||void 0===o||o.info("["+n+"] "+t))},warn:function(t,n){var r,o;(null===(r=i.config.logger)||void 0===r?void 0:r.warn)&&(e._tempLog+="WARN - "+(new Date).toISOString()+" - {"+i.randomId+"}["+n+"] "+t+"\n\n",null===(o=i.config.logger)||void 0===o||o.warn("["+n+"] "+t))},error:function(t,n){var r,o;(null===(r=i.config.logger)||void 0===r?void 0:r.error)&&(e._tempLog+="ERROR - "+(new Date).toISOString()+" - {"+i.randomId+"}["+n+"] "+t+"\n\n",null===(o=i.config.logger)||void 0===o||o.error("["+n+"] "+t))}},i.anchor=i.config.anchor,i.syncQueue=new QC(i.receiveSyncHandler),i.lock=new tI("interactive"===i.mode),i.cacheImage.style.position="absolute",i.cacheImage.style.zIndex="100",i.setMedianControllerAttribute(),i.frame.appendChild(i.medianController),i.frameResizeObserver.observe(i.frame),i.on(hI.syncReceive,(function(t){i.lock.unlock(t.type,t.uuid),i.syncQueue.addTask(t)})),i.renderingTaskManager.eventHub.on("task-error",(function(t){var e=t.error,n=t.task,r=qE.transform(e);r.errorType===VE.RuntimeWarn?i.logger.warn(r.message,i.taskId):i.logger.error(r.message,i.taskId),i.isLoading=!1,i.emit(hI.renderError,{error:r,index:n.slideIndex})})),window.addEventListener("__slide_ref__",i.handleSlideRef),i.resizeView=Object(l.debounce)(i.resizeView.bind(i),50),i.player=i.initPlayer(i.config),i.config.controller&&i.createController(),i.player.view&&i.frame.appendChild(i.player.view),i.handleViewClick=Object(l.debounce)(i.handleViewClick,300),i.player.errorChannel.on("error",(function(t,e){var n=qE.transform(t);n.errorType===VE.RuntimeWarn?i.logger.warn(n.message,i.taskId):i.logger.error(n.message,i.taskId),i.isLoading=!1,e===i.renderingIndex&&i.emit(hI.renderError,{error:t,index:e})})),i}var n;return nI(e,t),e.flushLog=function(){return oI(this,void 0,void 0,(function(){return sI(this,(function(t){switch(t.label){case 0:return e._tempLog.length>0?[4,null==pI?void 0:pI.setItem("run_time_log_"+e._tempLogIndex,e._tempLog)]:[3,2];case 1:t.sent(),e._tempLog="",e._tempLogIndex+=1,t.label=2;case 2:return[2]}}))}))},Object.defineProperty(e.prototype,"dispatchIncrId",{get:function(){return this._dispatchIncrId++},enumerable:!1,configurable:!0}),e.prototype.initSlideConfig=function(t){return t.timestamp&&(this.timestamp=t.timestamp),t.rtcAudio&&(KR.RtcAudioClazz=t.rtcAudio),this.mode=t.mode,this.anchor=t.anchor,this.anchor.appendChild(this.frame),this.enableGlobalClick=!Object(l.isUndefined)(t.enableGlobalClick)&&t.enableGlobalClick,this.resize=t.resize||!1,this.interactive=t.interactive,this.frame.style.cssText=t.fixedFrameSize?"width:"+t.fixedFrameSize.width+"px;height:"+t.fixedFrameSize.height+"px;":"width:100%;height:100%",this.frame.style.cssText+="display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",t.fixedFrameSize&&(this.frameWidth=t.fixedFrameSize.width,this.frameHeight=t.fixedFrameSize.height),t},e.prototype.initPlayer=function(t){var e,n,i,r=this,o=new KR({mode:this.mode,useLocalCache:!!Object(l.isUndefined)(this.config.useLocalCache)||this.config.useLocalCache,logger:this.logger,resourceTimeout:Object(l.isUndefined)(this.config.resourceTimeout)?15e3:this.config.resourceTimeout,loadDelegate:this.config.loaderDelegate});return o.setInteractive(this.interactive),o.updateConfig(t.renderOptions||{}),o.on($R.renderStart,(function(t){r.isLoading=!0,r.emit(hI.renderStart,t)})),o.on($R.renderEnd,(function(t){r.isLoading=!1,r.player&&(r.designHeight=r.player.designHeight,r.designWidth=r.player.designWidth,r.cacheImage.style.width=r.player.designWidth+"px",r.cacheImage.style.height=r.player.designHeight+"px",r._slideCount=r.player.slideCount),r.emit(hI.renderEnd,t)})),o.on($R.slideChange,(function(t){r.__slideState.currentSlideIndex=t,r.emitStateChange(),r.emit(hI.slideChange,t)})),o.on($R.mainSeqStateChange,(function(t){r.__slideState.mainSeqState=t,r.emitStateChange()})),o.on($R.mainSeqStepChange,(function(t){r.__slideState.mainSeqStep=t,r.emitStateChange()})),o.on($R.interactiveSeqStateChange,(function(t){var e=t.id,n=t.state;r.__slideState.interactiveSeqState[e]=n,r.emitStateChange()})),o.on($R.animateStart,(function(){!0!==r.isAnimating&&(r.isAnimating=!0,r.emit(hI.animateStart))})),o.on($R.animateEnd,(function(){!1!==r.isAnimating&&(r.isAnimating=!1,r.emit(hI.animateEnd))})),o.on($R.interactiveSeqAction,(function(t){var e=t.action,n=t.seqId;r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"interactiveAnim",action:e,seqId:n}),r.emitStateChange()})),o.on($R.mainSeqStepStart,(function(t){r.emit(hI.mainSeqStepStart,t)})),o.on($R.mainSeqStepEnd,(function(t){r.emit(hI.mainSeqStepEnd,t)})),o.on($R.mediaPlay,(function(t){var e={type:"play",time:r.timestamp()-1e3*t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:e}),r.emitStateChange()})),o.on($R.mediaPause,(function(t){var e={type:"pause",time:t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:e}),r.emitStateChange()})),o.on($R.mediaSeek,(function(t){var e={type:"pause",time:0};t.isPlaying?(e.type="play",r.__slideState.mediaState[t.id]?e.time=r.__slideState.mediaState[t.id].time-1e3*t.time:e.time=r.timestamp()-1e3*t.time,r.__slideState.mediaState[t.id]=e):(e.type="pause",e.time=t.time,r.__slideState.mediaState[t.id]=e),r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaSeek",id:t.id,time:t.time,state:e}),r.emitStateChange()})),o.on($R.requestPrevSlide,(function(t){r.handlePrevSlide(t)})),o.on($R.requestNextSlide,(function(t){r.handleNextSlide(t)})),o.on($R.requestGotoSlide,(function(t){r.config.navigatorDelegate?r.config.navigatorDelegate.gotoPage(t):r.handleGotoSlide(t)})),null===(e=o.view)||void 0===e||e.addEventListener("touchend",this.handleViewTouchEnd),null===(n=o.view)||void 0===n||n.addEventListener("touchstart",this.handleViewTouchStart),null===(i=o.view)||void 0===i||i.addEventListener("click",this.handleViewClick),o.on($R.userInput,this.userInputHandle),o},e.prototype.createController=function(){this.player&&(this.playerController=new KC({player:this.player,params:this.player.config||{},target:this.frame}))},e.prototype.setMedianControllerAttribute=function(){this.medianController.className="median-container",this.medianController.style.position="absolute",this.medianController.style.left="0",this.medianController.style.top="0",this.medianController.style.zIndex="2"},e.prototype.frameResizeHandler=function(){if(!this.config.fixedFrameSize){var t=this.frame.getBoundingClientRect(),e=t.width,n=t.height;this.frameWidth=e,this.frameHeight=n,this.resizeView()}},e.prototype.updateFixedFrameSize=function(t,e,n){this.config.fixedFrameSize&&(this.frameWidth=t,this.frameHeight=e,this.frame.style.width=t+"px",this.frame.style.height=e+"px",this.resizeView(n))},e.prototype.resizeView=function(t){var e,n,i=this,r=this.width,o=this.height;if(r>0&&o>0){var s=this.frameWidth/r,a=s*o;a>this.frameHeight&&(s*=this.frameHeight/a),null===(e=this.player)||void 0===e||e.scaleView(s,this.resize,t),this.cacheImage.style.transform="scale("+s+")",this.medianController.style.transform="scale("+s+")",this.medianController.style.top=(this.frameHeight-o*s)/2+"px",this.medianController.setAttribute("data-scale",s.toString()),this.isInitResized||(this.isInitResized=!0,null===(n=this.player)||void 0===n||n.clock.setTimeout((function(){i.frame.style.visibility="visible"}),32))}},e.prototype.setSlideState=function(t){var e,n,i;return oI(this,void 0,void 0,(function(){var r,o=this;return sI(this,(function(s){switch(s.label){case 0:return this.isSyncingSlideState=!0,this.logger.info("stateChange receive "+JSON.stringify(t),this.taskId),t.taskId&&t.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=t.taskId,null===(e=this.player)||void 0===e||e.setResourceData(t.taskId,this.__slideState.url)),t.url&&t.url!==this.__slideState.url&&(this.__slideState.url=t.url,null===(n=this.player)||void 0===n||n.setResourceData(this.__slideState.taskId,t.url)),Number.isInteger(t.currentSlideIndex)&&t.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=t.currentSlideIndex,[4,this.doRenderSlide(t.currentSlideIndex)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[4,null===(i=this.player)||void 0===i?void 0:i.clock.waitUntil((function(){var e,n;return(null===(e=o.player)||void 0===e?void 0:e.currentIndex)===t.currentSlideIndex&&(null===(n=o.player)||void 0===n?void 0:n.currentStage)}),3e3)];case 3:return s.sent(),r=!1,Number.isInteger(t.mainSeqStep)&&t.mainSeqStep!==this.__slideState.mainSeqStep&&(r=!0,this.__slideState.mainSeqStep=t.mainSeqStep),t.mainSeqState&&t.mainSeqState!==this.__slideState.mainSeqState&&(r=!0,this.__slideState.mainSeqState=t.mainSeqState),r&&this.setMainSeqStep(this.__slideState.mainSeqStep,"idle"===this.__slideState.mainSeqState?"start":"end"),t.mediaState&&(this.initMedia(t),this.__slideState.mediaState=t.mediaState),t.interactiveSeqState&&(this.initInteractiveSeq(t),this.__slideState.interactiveSeqState=t.interactiveSeqState),this.isSyncingSlideState=!1,[2]}}))}))},e.prototype.initInteractiveSeq=function(t){var e;for(var n in t.interactiveSeqState){var i=t.interactiveSeqState[n];null===(e=this.player)||void 0===e||e.setInteractiveSeqState(n,i.step,"end"===i.state?"end":"start")}},e.prototype.initMedia=function(t){var e,n,i=this,r=function(r){var s=t.mediaState[r],a=o.__slideState.mediaState[r];if(a&&s.type===a.type&&s.time===a.time)return"continue";"play"===s.type?null===(e=o.player)||void 0===e||e.setMediaState(r,!0).then((function(){var t,e=i.timestamp();null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,(e-s.time)/1e3)})):null===(n=o.player)||void 0===n||n.setMediaState(r,!1).then((function(){var t;null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,s.time)}))},o=this;for(var s in t.mediaState)r(s)},Object.defineProperty(e.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),e.prototype.getSizeAsync=function(){return oI(this,void 0,void 0,(function(){var t;return sI(this,(function(e){switch(e.label){case 0:if(this.width>0&&this.height>0)return[2,[this.width,this.height]];e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,e.sent().json()];case 3:return[2,[(t=e.sent()).width,t.height]];case 4:return e.sent(),[2,[0,0]];case 5:return[2]}}))}))},e.prototype.getSlideCountAsync=function(){return oI(this,void 0,void 0,(function(){return sI(this,(function(t){switch(t.label){case 0:if(this._slideCount>0)return[2,this._slideCount];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,t.sent().json()];case 3:return[2,t.sent().slideCount];case 4:return t.sent(),[2,0];case 5:return[2]}}))}))},Object.defineProperty(e.prototype,"slideState",{get:function(){return this.__slideState.mainSeqState=this.mainSeqState,this.__slideState.mainSeqStep=this.mainSeqStep,JSON.parse(JSON.stringify(this.__slideState))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqLength",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqStep",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqState",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderOptions",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawCall",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"runtimeFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"view",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),e.prototype.updateRenderOption=function(t){this.player&&(this.player.updateConfig(t),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},e.prototype.setResource=function(t,e){var n;this.taskId=t,null===(n=this.player)||void 0===n||n.setResourceData(t,e),this.__slideState.taskId=t,this.__slideState.url=e,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:t,url:e})},e.prototype._renderSlide=function(t){var e;return oI(this,void 0,void 0,(function(){var n=this;return sI(this,(function(i){switch(i.label){case 0:return this.renderingIndex=t,this.player&&t===this.player.currentIndex?[2]:((KR.platform.isIOS()||KR.platform.isAndroid())&&this.iosResetCache.indexOf(t)<0&&this.iosResetCache.push(t),[4,null===(e=this.player)||void 0===e?void 0:e.renderSlide(t)]);case 1:return i.sent(),this.__slideState.currentSlideIndex=t,this.resizeView(),this.__slideState.interactiveSeqState={},this.emitStateChange(),setTimeout((function(){var t,e;if("hidden"===(null===(e=null===(t=n.player)||void 0===t?void 0:t.view)||void 0===e?void 0:e.style.visibility)&&(n.player.view.style.visibility="visible"),"hidden"===n.frame.style.visibility&&(n.frame.style.visibility="visible"),n.needClearCacheImage)try{n.frame.removeChild(n.cacheImage)}catch(t){}}),100),[2]}}))}))},e.prototype.renderSlide=function(t,e){if(void 0===e&&(e=!0),this.player){var n=Number(t);(n!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(n>this.slideCount&&this.slideCount>0||this.poseRenderSlide(n,e))}},e.prototype.needCreateNewPlayer=function(){var t=KR.platform.isLowGpuMemory()?15:30;return(KR.platform.isIOS()||KR.platform.isAndroid())&&this.iosResetCache.length>t},e.prototype.poseRenderSlide=function(t,e){"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e}):"sync"===this.mode?(this.doRenderSlide(t,e),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e})):this.doRenderSlide(t,e)},e.prototype.doRenderSlide=function(t,e){var n,i,r,o=this;if(void 0===e&&(e=!0),!this.player)return Promise.resolve();if(this.needCreateNewPlayer()&&(this.iosResetCache=[],this.iosNewPlayer=this.initPlayer(this.config),this.iosNewPlayer.setResourceData(this.__slideState.taskId,this.__slideState.url)),this.iosNewPlayer){var s=this.player.getSnapshot();this.cacheImage.src=s,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(n=this.playerController)||void 0===n||n.destroy(),this.player=this.iosNewPlayer,this.iosNewPlayer=void 0,(null===(i=this.config)||void 0===i?void 0:i.controller)&&this.createController(),this.needClearCacheImage=!0,(null===(r=null==this?void 0:this.player)||void 0===r?void 0:r.view)&&(this.player.view.style.visibility="hidden",this.frame.appendChild(this.player.view))}var a=Math.random().toString(32).substr(2);return this.player.isForward=e,this.renderingTaskManager.addTask((function(){return o._renderSlide(t)}),t,a),new Promise((function(t){o.renderingTaskManager.eventHub.once("task-end-"+a,t)}))},e.prototype.nextStep=function(){!this.isLoading&&this.player&&this.interactive?this.player.mainSeqHasNextStep()?"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):"sync"===this.mode?(this.doNextStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep():this.handleNextSlide():this.logger.info("prevent nextStep. "+this.isLoading+" "+this.player+" "+this.interactive,this.taskId)},e.prototype.doNextStep=function(t){if(void 0===t&&(t=!1),this.player){this.player.nextStep(t);var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},e.prototype.prevStep=function(){!this.isLoading&&this.player&&this.interactive?this.player.mainSeqHasPrevStep()?"interactive"===this.mode?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):"sync"===this.mode?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide():this.logger.info("prevent nextStep. "+this.isLoading+" "+this.player+" "+this.interactive,this.taskId)},e.prototype.doPrevStep=function(t){if(void 0===t&&(t=!1),this.player){this.player.prevStep(t);var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},e.prototype.isSlideStateReady=function(t){return t.taskId.length>0&&t.url.length>0&&t.currentSlideIndex>0},e.prototype.emitStateChange=function(){if("local"!==this.mode&&!this.isSyncingSlideState){var t=this.slideState;!Object(l.isEqual)(this.lastEmitedState,t)&&this.isSlideStateReady(t)&&(this.lastEmitedState=t,this.emit(hI.stateChange,t),this.logger.info("stateChange dispatch "+JSON.stringify(this.slideState),this.taskId))}},e.prototype.emitSyncDispatch=function(t){if(!this.lock.isLocked(t.type)){var e=Math.random().toString(32).substr(2);this.lock.addLock(t.type,e);var n=iI(iI({},t),{uuid:e});"sync"===this.config.mode&&(n.incrId=this.dispatchIncrId),this.emit(hI.syncDispatch,n),this.logger.info("sync dispatch "+JSON.stringify(n),this.taskId)}},e.prototype.setMainSeqStep=function(t,e){var n;null===(n=this.player)||void 0===n||n.setMainSeqStep(t,e)},e.prototype.setInteractive=function(t){var e;this.interactive=t,null===(e=this.player)||void 0===e||e.setInteractive(t)},e.prototype.pause=function(){var t;null===(t=this.player)||void 0===t||t.pause()},e.prototype.resume=function(){var t;null===(t=this.player)||void 0===t||t.resume()},e.prototype._doFrozen=function(){var t;return oI(this,void 0,void 0,(function(){var e,n,i,r=this;return sI(this,(function(o){switch(o.label){case 0:return this.view&&this.player?[4,this.player.clock.waitUntil((function(){return!r.isLoading}),6e4)]:[3,2];case 1:for(n in o.sent(),e=this.player.getSnapshot()||"",this.cacheImage.src=e,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(t=this.playerController)||void 0===t||t.destroy(),this.player=void 0,this.__slideState.mediaState)i=this.__slideState.mediaState[n],this.__slideState.mediaState[n]=iI(iI({},i),{frozenTime:this.timestamp()});o.label=2;case 2:return[2]}}))}))},e.prototype.frozen=function(){var t=this;this.frozenTaskManager.addTask("frozen",(function(){return t._doFrozen()}))},e.prototype._doRelease=function(){var t,e;return oI(this,void 0,void 0,(function(){var n,i,r,o;return sI(this,(function(s){switch(s.label){case 0:if(this.player)return[2];for(i in this.player=this.initPlayer(this.config),(null===(t=this.config)||void 0===t?void 0:t.controller)&&this.createController(),this.player.view&&(this.frame.appendChild(this.player.view),this.player.view.style.visibility="hidden"),n=this.__slideState,this.__slideState=Object(l.cloneDeep)(cI),n.mediaState)"play"===(r=n.mediaState[i]).type&&(o=Math.max(null!==(e=r.frozenTime)&&void 0!==e?e:0,r.time),r.time=this.timestamp()-(o-r.time),r.frozenTime=void 0);return[4,this.setSlideState(n)];case 1:return s.sent(),[4,this.player.clock.delay(333)];case 2:s.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch(t){}return[2]}}))}))},e.prototype.release=function(){var t=this;this.frozenTaskManager.addTask("release",(function(){return t._doRelease()}))},e.prototype._doDestroy=function(){var t,e,n,i;this.logger.info("do destroy slide",""),this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),null===(t=this.player)||void 0===t||t.removeAllListeners(),null===(e=this.player)||void 0===e||e.destroy(),null===(n=this.player)||void 0===n||n.removeAllListeners(),this.logger={warn:function(){return{}},info:function(){return{}},error:function(){return{}}},this.syncQueue.destroy(),this.renderingTaskManager.destroy(),this.frozenTaskManager.destroy(),window.removeEventListener("__slide_ref__",this.handleSlideRef),this.removeAllListeners();try{(null===(i=this.player)||void 0===i?void 0:i.view)&&this.anchor.removeChild(this.player.view),this.anchor.removeChild(this.frame)}catch(t){}},e.prototype.waitLoadEnd=function(){return oI(this,void 0,void 0,(function(){var t;return sI(this,(function(e){switch(e.label){case 0:t=0,e.label=1;case 1:return this.isLoading&&t<10?[4,lI(100)]:[3,3];case 2:return e.sent(),t+=1,[3,1];case 3:return[2]}}))}))},e.prototype.destroy=function(){var t=this;this.logger.info("pre destroy slide",""),this.isLoading?this.waitLoadEnd().then((function(){t._doDestroy()})):this._doDestroy()},e.prototype.clearSlideCache=function(){var t;null===(t=this.player)||void 0===t||t.clearLocalCache()},e.prototype.hasNextStep=function(){if(!this.player)return!1;var t=this.player.currentIndex===this.slideCount,e=0===this.mainSeqLength||this.mainSeqStep>=this.mainSeqLength-1,n="end"===this.mainSeqState||"running"===this.mainSeqState||null==this.mainSeqState;return!(t&&e&&n)},e.prototype.hasPrevStep=function(){if(!this.player)return!1;var t=1===this.player.currentIndex,e=0===this.mainSeqLength||0===this.mainSeqStep,n="idle"===this.mainSeqState||null===this.mainSeqState;return!(t&&e&&n)},e.clearLocalCache=function(){KR.clearLocalCache()},e.disposeLocalCache=function(){},e._tempLog="",e._tempLogIndex=1,e.usePlugin=tP,e.handleLogDownload=function(){return oI(void 0,void 0,void 0,(function(){var t,e,n,i,r,o,s;return sI(this,(function(a){switch(a.label){case 0:return t="",pI?[4,pI.keys()]:[3,5];case 1:e=(a.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),n=0,i=e,a.label=2;case 2:return n<i.length?(r=i[n],o=t,[4,pI.getItem(r)]):[3,5];case 3:t=o+(a.sent()||""),a.label=4;case 4:return n++,[3,2];case 5:return(s=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),s.setAttribute("download","slide_log"),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),window.__slideLogText=t,[2]}}))}))},rI([(n="Slide.initConfig",function(t,e,i){var r=i.value;i.value=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=QR.get(n)||[],o=t,s=0,a=i;s<a.length;s++){var l=a[s];try{o=l.before(o)}catch(t){}if(!Array.isArray(o)||o.length!==t.length)throw new Error("plugin before hook return invalid args")}for(var u=r.bind(this).apply(void 0,o),h=0,c=i.reverse();h<c.length;h++){l=c[h];try{u=l.after(u)}catch(t){}if(!u)throw new Error("plugin after hook return undefined result")}return u}})],e.prototype,"initSlideConfig",null),e}(a.a);null==pI||pI.clear(),window.addEventListener("__slide_log__",fI.handleLogDownload),window.setInterval((function(){fI.flushLog().catch((function(){}))}),9e3)}]);