@netless/app-slide 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.cjs.js +1 -1
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +1 -1
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +1 -1
- package/dist/main.iife.js.map +1 -1
- package/package.json +2 -2
package/dist/main.iife.js
CHANGED
|
@@ -5888,7 +5888,7 @@ void main(void){
|
|
|
5888
5888
|
gl_FragColor = texColor;
|
|
5889
5889
|
}
|
|
5890
5890
|
}
|
|
5891
|
-
`,{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF"}set color(n){this.currentColor=n;const e=Rs(n);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const zh=new ai.ColorMatrixFilter;zh.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const jh=new ai.ColorMatrixFilter;jh.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const tp=new ai.ColorMatrixFilter;tp.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const Vh=new ai.ColorMatrixFilter;Vh.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const ep={darken:zh,darkenLess:jh,lightenLess:Vh,lighten:tp};var np=S(2),Gu=S.n(np);class rp{constructor(n){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=n.id,this.type=n.type,this.heightSize=n.heightSize,this.widthSize=n.widthSize,this.fillStyle=n.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=n.lineWidth||1,this.position=n.position||{x:0,y:0},this.rotate=n.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"arrow":case"stealth":case"triangle":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+Gu()(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 qc extends Hh{constructor(n,e,r){super({position:{x:n.x,y:n.y},width:n.width,height:n.height},e,r),this.fillColorFilter=new Uu,this.fill=new iu(this),this.json=n,this.ctx=e,this.parentGlobalPos=r,this.global={x:r.x+n.x,y:r.y+n.y},this.updateTransform({position:{x:n.x,y:n.y},width:n.width,height:n.height})}get fillActive(){var n,e;return((e=(n=this.container.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set fillActive(n){var e,r;n?((r=(e=this.container.filters)===null||e===void 0?void 0:e.indexOf(this.fillColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(n){const e=n*this.ctx.stageWidth-this.global.x,r=this.presetSubType===544?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*r}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(n){const e=n*this.ctx.stageHeight-this.global.y,r=this.presetSubType===544?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*r}get design_ppt_x(){return Cs(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return Cs(this.global.y/this.ctx.stageHeight)}}var Yc=S(9),no=S.n(Yc);function Is(){return Date.now().toString(32)+Math.random().toString(32).substring(2)}function Zc(o){const n=[],e=o.filter(y=>{const b=y.width<2048&&y.height<2048;return b||n.push(y),b}).sort((y,b)=>y.width*y.height-b.width*b.height);let r=e.length+1,s=2050,u=2050;const h=[];let f=null;for(;(s>2048||u>2048)&&e.length>0;)r-=1,f=no()(e.slice(0,r)),s=f.width,u=f.height;return f&&h.push(f),n.forEach(y=>{const b=no()([y]);h.push(b)}),r<e.length?h.concat(Zc(e.slice(r))):h}function Kp(o,n,e){let r,s,u=n,h=e;u===0&&(u=h/1e4),h===0&&(h=u/1e4);const f=o%360;if(f%180==0)r=Math.cos(f*(Math.PI/180))*u,s=0;else if(f%90==0)r=0,s=-Math.sin(f*(Math.PI/180))*h;else{const y=Math.tan(f*Math.PI/180);r=u*h/Math.sqrt(Math.pow(h,2)+Math.pow(u*y,2)),(f>90&&f<270||f<-90&&f>-270)&&(r=-r),s=-y*r}return{x:r,y:s}}function Hu(o,n,e,r,s,u,h){const f={x:0,y:0},y=-u,b=Kp((s=-s)/Math.PI*180,e,r),T=o.x-b.x,P=o.y-b.y;for(let j=0;j<51;j++){const G=Kp((s+j/50*y)/Math.PI*180,e,r);G.x+=T,G.y+=P,j/50==1&&(f.x=G.x,f.y=G.y),G.x=G.x/9525*n.x,G.y=G.y/9525*n.y,h.lineTo(G.x,G.y)}return f}class Jc{constructor(n,e,r,s){this.renderContainer=new Ri,this.ctx=n,this.type=e,this.lineWidth=r,this.width=s}createPaths(){if(this.type==="ww")return null;{const n=`M 0,0 L ${9525*this.width},0`;return{paths:[{id:Is(),path:n,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:Gu()(n)}],width:this.width,height:this.lineWidth}}}preRender(){const n=this.createPaths();if(n){const{paths:e,width:r,height:s}=n,u=e.reduce((h,f)=>h+f.hash,"");this.ghcTextureId=this.ctx.graphicsTexture.addGraphics(e,u,{x:0,y:0},r,s,{width:this.lineWidth},!1)}}render(){if(this.ghcTextureId){const n=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);n&&(this.sprite=new Nr,this.sprite.pivot.x=n.pivot.x,this.sprite.texture=n.texture)}}destroy(){console.log("")}}var Qp=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class $c extends qc{constructor(n,e,r){super(n,e,r),this.fillMaskSprite=new Nr,this.fillSprite=new Nr,this.strokeMaskSprite=new Nr,this.strokeSprite=new Nr,this.textureContainer=new Ri,this.underline=null;const{underLine:s,lineHeight:u,width:h}=this.json;s&&(this.underline=new Jc(e,s.type,u/16,h))}getIterateEntry(){return null}getBgElement(){return null}updateTransform(n){var e,r,s,u;const{isHorz:h}=this.json;n.position={x:h&&(r=(e=n.position)===null||e===void 0?void 0:e.x)!==null&&r!==void 0?r:0,y:h?0:(u=(s=n.position)===null||s===void 0?void 0:s.y)!==null&&u!==void 0?u:0},n.width=h?this.json.width:this.json.lineWidth,n.height=h?this.json.lineHeight:this.json.height,super.updateTransform(n)}preRender(){const{fill:n,stroke:e,lineWidth:r,lineHeight:s,content:u}=this.json;n&&(this.fillTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:n.key,filters:[{type:"changeBulletColor",args:["#000000","#FFA500"]}]},n.width,n.height,void 0,u==="\u25FE"),n.fill&&n.fill.fillType!=="noFill"&&(this.fillBgId=this.ctx.fillTexture.addFill(n.fill,r,s))),e&&(this.strokeTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:e.key,filters:[]},e.width,e.height),e.fill&&e.fill.fillType!=="noFill"&&(this.strokeBgId=this.ctx.fillTexture.addFill(e.fill,r,s))),this.underline&&this.underline.preRender()}render(){var n;return Qp(this,void 0,void 0,function*(){const{lineWidth:e,lineHeight:r,baseLine:s,isHorz:u,height:h,width:f,highlightColor:y,x:b,y:T,content:P}=this.json;if(y){const V=new ps,[K,_t]=Bu(y);V.beginFill(K,_t),V.drawRect(0,0,u?f:e,u?r:h),V.endFill(),this.textureContainer.addChild(V)}if(this.fillBgId&&this.fillTextureId){const V=this.ctx.fillTexture.getTexture(this.fillTextureId);(V==null?void 0:V.texture)&&(this.fillMaskSprite.texture=V.texture,this.fillMaskSprite.scale.x=.5,this.fillMaskSprite.scale.y=.5);const K=this.ctx.fillTexture.getTexture(this.fillBgId);K.texture&&(this.fillSprite.texture=K.texture,this.fillSprite.mask=this.fillMaskSprite,this.fillSprite.addChild(this.fillMaskSprite),u?this.fillSprite.position.y=T:this.fillSprite.position.x=b,this.textureContainer.addChild(this.fillSprite))}if(this.strokeBgId&&this.strokeTextureId){const V=this.ctx.fillTexture.getTexture(this.strokeTextureId);(V==null?void 0:V.texture)&&(this.strokeMaskSprite.texture=V.texture,this.strokeMaskSprite.scale.x=.5,this.strokeMaskSprite.scale.y=.5);const K=this.ctx.fillTexture.getTexture(this.strokeBgId);(K==null?void 0:K.texture)&&(this.strokeSprite.texture=K.texture,this.strokeSprite.mask=this.strokeMaskSprite,this.strokeSprite.addChild(this.strokeMaskSprite),u?this.strokeSprite.position.y=T:this.strokeSprite.position.x=b,this.textureContainer.addChild(this.strokeSprite))}if(this.underline&&(this.underline.render(),this.underline.sprite&&this.fillMaskSprite)){let V=null;this.fillBgId&&(V=this.ctx.fillTexture.getTexture(this.fillBgId)),this.underline.sprite.position.y=s,this.underline.sprite.position.x=0;const K=new Nr;K.texture=(n=V==null?void 0:V.texture)!==null&&n!==void 0?n:null,K.mask=this.underline.sprite,K.addChild(this.underline.sprite),this.textureContainer.addChild(K)}const j=Li.create({width:u?f:e,height:u?r:h,resolution:2});this.ctx.renderer.render(this.textureContainer,{renderTexture:j});const G=new Nr;G.texture=j,this.container.addChild(G),this.container.name=P})}destroy(){this.textureContainer.destroy({texture:!0}),this.container.destroy({children:!0,texture:!0})}}var Wh=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Kc extends qc{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(n,e,r){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}preRender(){for(let n=0,e=this.json.textUnits.length;n<e;n++){const r=this.json.textUnits[n];if(!r.content)continue;const{height:s,width:u,baseline:h}=this.json,f=new $c(Object.assign(Object.assign({},r),{lineHeight:s,lineWidth:u,baseLine:h,isHorz:this.isHorz}),this.ctx,this.global);f.preRender(),this.units.push(f)}}render(){return Wh(this,void 0,void 0,function*(){for(const n of this.units.reverse())yield n.render(),this.container.addChild(n.container)})}destroy(){this.units.forEach(n=>{n.destroy()}),this.container.destroy({children:!1})}}var ro=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class tf extends qc{constructor(){super(...arguments),this.iterateElements=[],this.lines=[],this.isHorz=!0}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const n=this.lines.reduce((e,r)=>e=e.concat(r.getIterateElements()),[]);return this.iterateElements=n,n}getIterateEntry(n,e,r){const s=this.getIterateElements();return s[e]?s[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}preRender(){for(let n=0,e=this.json.lines.length;n<e;n++){const r=this.json.lines[n],s=new Kc(r,this.ctx,this.global);s.isHorz=this.isHorz,s.container.name="line-"+n,s.preRender(),this.lines.push(s)}}render(){return ro(this,void 0,void 0,function*(){for(const n of this.lines)yield n.render(),this.container.addChild(n.container)})}destroy(){this.lines.forEach(n=>{n.destroy()}),this.container.destroy({children:!1})}}var Qc=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class td{constructor(n,e,r,s){this.iterateElements=[],this.paragraphs=[],this.container=new Ri,this.json=n,this.ctx=e,this.parentGlobalPos=s,this.iterateType=r,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+n.position.x,y:this.parentGlobalPos.y+n.position.y},this.container.position.x=n.position.x,this.container.position.y=n.position.y,this.container.scale.x=n.scale.x,this.container.scale.y=n.scale.y;const u=new ps;u.drawRect(0,0,n.width,n.height),this.container.addChild(u)}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(n,e){return n==="paragraph"?this.paragraphs[e[0]]:null}getIterateEntry(n,e){return this.iterateElements[n]?this.iterateElements[n]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(n=>{n.destroy()})}preRender(){var n;for(let e=0,r=this.json.paragraphs.length;e<r;e++){const s=this.json.paragraphs[e],u=new tf(s,this.ctx,this.global);u.isHorz=(n=this.json.isHorz)===null||n===void 0||n,u.preRender(),this.iterateElements=this.iterateElements.concat(u.getIterateElements()),u.container.name="\u6BB5\u843D-"+e,this.paragraphs.push(u)}}render(){return Qc(this,void 0,void 0,function*(){for(const e of this.paragraphs)yield e.render(),this.container.addChild(e.container);const{width:n}=this.container;this.container.scale.x<0&&(this.container.x+=-1*n)})}}var ip=S(19),ed=S.n(ip),$a=S(20),ef=S.n($a);const nd={Reflection:class extends ko{constructor(o){super(ed.a,ef.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uStartAlpha:o.startAlpha,uEndAlpha:o.endAlpha,uBlur:0}),this.json=o}}};var io=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};const ou={pivot:{x:0,y:0},width:0,height:0};class Tl extends Hh{constructor(n,e,r){var s,u,h;super(n,e,r),this.renderContainer=new Ri,this.bgTextureId="",this.bgSprite=new Nr,this.backgroundMaskTextureId="",this.filterAreaJustifies=[],this.backgroundMask=new Nr,this.pathStrokeTextureId="",this.pathSprite=new Nr,this.pathMask=new Nr,this.pathMaskTextureId="",this.fillColorFilter=new Uu,this.strokeColorFilter=new Uu,this.id="",this.arrowList=[],this.fill=new iu(this),this.stroke=new ri(this),this.updateFilterArea=()=>{const f=this.renderContainer.getBounds(!1),y=this.filterAreaJustifies.map(j=>j(f)),b=y.map(j=>j.width),T=y.map(j=>j.height),P=new dr(f.x,f.y,Math.max(...b),Math.max(...T));this.renderContainer.filterArea=P,this.renderContainer.filters.forEach(j=>{j.uniforms.uShapeFilterArea=new Float32Array(4),j.uniforms.uShapeFilterArea[0]=P.x,j.uniforms.uShapeFilterArea[1]=P.y,j.uniforms.uShapeFilterArea[2]=P.width,j.uniforms.uShapeFilterArea[3]=P.height})},this.json=n,this.id=n.id,this.container.name=n.id,this.renderContainer.name=n.id+"-render-container",this.fillStyle=n.fillStyle,this.lineStyle=n.lineStyle,this.geometry=n.geometry,this.ctx.timingTargets.addTarget(this.id,this),((s=this.fillStyle)===null||s===void 0?void 0:s.fillType)==="solidFill"&&(this.fillColorFilter.currentColor=this.fillStyle.color),((h=(u=this.lineStyle)===null||u===void 0?void 0:u.fill)===null||h===void 0?void 0:h.fillType)==="solidFill"&&(this.strokeColorFilter.currentColor=this.lineStyle.fill.color),this.pathSprite.name="path-fill",this.pathMask.name="path-mask",this.bgSprite.name="bg-fill",this.backgroundMask.name="bg-mask",this.updateTransform(this.json),n.textBody&&(this.text=new td(n.textBody,this.ctx,n.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new vc(1,1,this.json.width,this.json.height)}get interactiveContainer(){return this.renderContainer}get strokeActive(){var n,e;return((e=(n=this.pathSprite.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set strokeActive(n){var e,r;n?((r=(e=this.pathSprite.filters)===null||e===void 0?void 0:e.indexOf(this.strokeColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.pathSprite.filters=[this.strokeColorFilter]):this.pathSprite.filters=[]}get fillActive(){var n,e;return((e=(n=this.bgSprite.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set fillActive(n){var e,r;n?((r=(e=this.bgSprite.filters)===null||e===void 0?void 0:e.indexOf(this.fillColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.bgSprite.filters=[this.fillColorFilter]):this.bgSprite.filters=[]}getTextElement(n,e){var r,s;return(s=(r=this.text)===null||r===void 0?void 0:r.getTextElement(n,e))!==null&&s!==void 0?s:null}getBgElement(){return this}getIterateEntry(n,e,r){return n==="el"||e===0?this:this.text?this.text.getIterateEntry(e-1,r)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}createBackgroundMask(){return io(this,void 0,void 0,function*(){const n=this.ctx.graphicsTexture.getGraphicsData(this.backgroundMaskTextureId);n&&(this.backgroundMask.texture=n.texture,this.backgroundMask.pivot.x=n.pivot.x,this.backgroundMask.pivot.y=n.pivot.y)})}createBackground(){var n,e,r,s,u,h,f,y,b;const{pivot:T,width:P,height:j}=((n=this.geometry)===null||n===void 0?void 0:n.fillTransform)||ou;if(this.json.useBgFill&&this.ctx.bgTexture)return this.bgSprite.texture=this.ctx.bgTexture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.bgSprite.pivot.x=((e=this.json.position)===null||e===void 0?void 0:e.x)||0,void(this.bgSprite.pivot.y=((r=this.json.position)===null||r===void 0?void 0:r.y)||0);if(((s=this.fillStyle)===null||s===void 0?void 0:s.fillType)==="gifFill"){const G=this.ctx.fillTexture.getGifFrames(this.fillStyle.src),V=G.map((Tt,jt)=>({texture:Tt,time:this.fillStyle.delays[jt]||20}));this.bgSprite=new wl(V,!0),this.bgSprite.play();let K=1;const _t=this.fillStyle.loop;this.bgSprite.onLoop=()=>{K+=1,_t>0&&K>_t&&this.bgSprite.gotoAndStop(G.length-1)},this.bgSprite.height=j||this.designHeight,this.bgSprite.width=P||this.designWidth,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite)}else if(((u=this.fillStyle)===null||u===void 0?void 0:u.fillType)==="groupFill"){if(this.groupFillTextureId){const G=this.ctx.fillTexture.getTexture(this.groupFillTextureId);G.texture&&(this.bgSprite.texture=G.texture,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=-1*((f=(h=this.json.position)===null||h===void 0?void 0:h.x)!==null&&f!==void 0?f:0),this.bgSprite.y=-1*((b=(y=this.json.position)===null||y===void 0?void 0:y.y)!==null&&b!==void 0?b:0),this.container.addChild(this.bgSprite),this.container.addChild(this.backgroundMask))}}else{const G=this.ctx.fillTexture.getTexture(this.bgTextureId);G.texture&&(this.bgSprite.texture=G.texture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.bgSprite.pivot.x=G.pivot.x,this.bgSprite.pivot.y=G.pivot.y)}}createPathFill(){const n=this.ctx.fillTexture.getTexture(this.pathStrokeTextureId);n.texture&&(this.pathSprite.texture=n.texture,this.pathSprite.pivot.x=this.pathMask.pivot.x,this.pathSprite.pivot.y=this.pathMask.pivot.y,this.pathMask.pivot.x=0,this.pathMask.pivot.y=0,this.pathSprite.mask=this.pathMask,this.pathSprite.addChild(this.pathMask),this.container.addChild(this.pathSprite))}createPathMask(){return io(this,void 0,void 0,function*(){const n=this.ctx.graphicsTexture.getGraphicsData(this.pathMaskTextureId);if(n){const{texture:e,pivot:r}=n;this.pathMask.texture=e,this.pathMask.pivot.x=r.x,this.pathMask.pivot.y=r.y,this.pathMask.texture=e}})}createFilledPathMask(){var n,e;return io(this,void 0,void 0,function*(){const r=((e=(n=this.geometry)===null||n===void 0?void 0:n.paths)===null||e===void 0?void 0:e.filter(s=>s.fill!=="none"&&s.fill!=="norm"))||[];for(const s of r){const u=this.ctx.graphicsTexture.getGraphicsData(s.id);if(u){const h=new Nr(u.texture);h.pivot.x=u.pivot.x,h.pivot.y=u.pivot.y;const f=new Nr(this.bgSprite.texture);f.pivot.x=this.bgSprite.pivot.x,f.pivot.y=this.bgSprite.pivot.y,f.mask=h,f.filters=[ep[s.fill]],this.container.addChild(f),this.container.addChild(h)}}})}createBackgroundTexture(){var n,e,r,s,u;if(this.fillStyle&&this.fillStyle.fillType!=="gifFill"&&this.fillStyle.fillType!=="groupFill"){const h=((n=this.geometry)===null||n===void 0?void 0:n.fillTransform)||ou,f=(h==null?void 0:h.width)||this.designWidth,y=(h==null?void 0:h.height)||this.designHeight;this.bgTextureId=this.ctx.fillTexture.addFill(this.fillStyle,f+((r=(e=this.lineStyle)===null||e===void 0?void 0:e.width)!==null&&r!==void 0?r:0),y+((u=(s=this.lineStyle)===null||s===void 0?void 0:s.width)!==null&&u!==void 0?u:0))}}createPathFillTexture(){var n,e;if(((n=this.lineStyle)===null||n===void 0?void 0:n.fill)&&this.lineStyle.fill.fillType!=="gifFill"&&this.lineStyle.fill.fillType!=="groupFill"){const{width:r,height:s}=((e=this.geometry)===null||e===void 0?void 0:e.lineTransform)||ou,u=Object(W.isNumber)(this.lineStyle.width)?this.lineStyle.width:1;this.pathStrokeTextureId=this.ctx.fillTexture.addFill(this.lineStyle.fill,(r||this.designWidth)+u,(s||this.designHeight)+u)}}createArrowFillTexture(){var n;(n=this.json.lineArrowList)===null||n===void 0||n.forEach(e=>{var r,s,u,h;const f=new rp(Object.assign(Object.assign({},e),{fillStyle:(r=this.lineStyle)===null||r===void 0?void 0:r.fill,lineWidth:(u=(s=this.lineStyle)===null||s===void 0?void 0:s.width)!==null&&u!==void 0?u:0}));f.graphicsId=this.ctx.graphicsTexture.addGraphics((h=f.paths)!==null&&h!==void 0?h:[],f.hash,f.pivot||{x:0,y:0},f.width,f.height,void 0,!0),f.textureId=this.ctx.fillTexture.addFill(f.fillStyle,f.width,f.height),this.arrowList.push(f)})}createArrow(){this.arrowList.forEach(n=>{const e=this.ctx.graphicsTexture.getGraphicsData(n.graphicsId),r=this.ctx.fillTexture.getTexture(n.textureId);if(e&&r.texture){const{texture:s,pivot:u}=e,h=new Nr(s);h.pivot.x=u.x,h.pivot.y=u.y;const f=new Nr(r.texture);f.addChild(h),f.mask=h,f.position.x=n.position.x,f.position.y=n.position.y,f.pivot.x=n.pivot.x+r.pivot.x,f.pivot.y=n.pivot.y+r.pivot.y,f.rotation=n.rotate/180*Math.PI,n.sprite=f,this.container.addChild(f)}})}preRender(){var n,e,r,s,u,h,f,y,b,T;this.createBackgroundTexture(),this.createPathFillTexture(),this.createArrowFillTexture();const{width:P,height:j,pivot:G}=((n=this.geometry)===null||n===void 0?void 0:n.lineTransform)||ou,V=P||this.designWidth,K=j||this.designHeight;((e=this.geometry)===null||e===void 0?void 0:e.paths)&&this.geometry.paths.length>0&&(this.pathMaskTextureId=this.ctx.graphicsTexture.addGraphics((s=(r=this.geometry)===null||r===void 0?void 0:r.paths)!==null&&s!==void 0?s:[],this.geometry.hash,G||{x:0,y:0},V,K,this.lineStyle,!1),this.backgroundMaskTextureId=this.ctx.graphicsTexture.addGraphics((h=(u=this.geometry)===null||u===void 0?void 0:u.paths)!==null&&h!==void 0?h:[],this.geometry.hash,G||{x:0,y:0},V,K,this.lineStyle,!0));const _t=((y=(f=this.geometry)===null||f===void 0?void 0:f.paths)===null||y===void 0?void 0:y.filter(Tt=>Tt.fill!=="none"&&Tt.fill!=="norm"))||[];for(const Tt of _t)this.ctx.graphicsTexture.addGraphics([Tt],Tt.hash,(((b=this.geometry)===null||b===void 0?void 0:b.lineTransform)||ou).pivot,V,K,this.lineStyle,!0,Tt.id);(T=this.text)===null||T===void 0||T.preRender()}subClassRender(){return io(this,void 0,void 0,function*(){})}setupEffect(){const{effectList:n}=this.json;if(n&&n.length>0){const e=[];return n.forEach(r=>{r.type==="reflection"&&(this.filterAreaJustifies.push(s=>(s.height*=2,s)),e.push(new nd.Reflection(r)))}),this.ctx.ticker.add(this.updateFilterArea,void 0,-20),this.renderContainer.filters=e,!0}return!1}render(){var n,e,r,s,u,h;return io(this,void 0,void 0,function*(){if(yield this.createBackgroundMask(),yield this.createBackground(),yield this.subClassRender(),yield this.createFilledPathMask(),yield this.createPathMask(),yield this.createPathFill(),yield this.createArrow(),this.text&&(yield this.text.render()),((n=this.json.textBody)===null||n===void 0?void 0:n.iterateType)==="wd"||((e=this.json.textBody)===null||e===void 0?void 0:e.iterateType)==="lt")this.renderContainer.addChild(this.container),this.text&&(this.text.container.position.x=((s=(r=this.json.position)===null||r===void 0?void 0:r.x)!==null&&s!==void 0?s:0)+this.text.x,this.text.container.position.y=((h=(u=this.json.position)===null||u===void 0?void 0:u.y)!==null&&h!==void 0?h:0)+this.text.y,this.renderContainer.addChild(this.text.container));else{if(this.text){if(Object(W.isBoolean)(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const f=this.json.rotation||0;this.text.container.rotation=-f;const{width:y}=this.text;this.text.container.position.x=y}this.container.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.renderContainer.cacheAsBitmap=!!this.json.cacheAsBitMap,this.json.id==="background"){const f=Li.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:f}),this.ctx.bgTexture=f}})}destroy(){this.bgSprite.destroy(),this.backgroundMask.destroy(),this.pathSprite.destroy(),this.pathMask.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.arrowList.forEach(n=>{var e;(e=n.sprite)===null||e===void 0||e.destroy()})}}var c=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};function g(o,n){for(const e in n)o.style[e]=n[e]}class E{constructor(n){var e,r;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.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=s=>{s.stopPropagation();const u=s.offsetX/this.progress.clientWidth*this.duration;this.jumpToTime(u),this.medianIsEnd=!1,this.ctx.eventHub.emit(Pn.mediaSeek,{id:this.targetId,time:this.media.currentTime-this.start,isPlaying:this.media.isPlaying})},this.jumpToTime=(s=0)=>{const u=Math.floor(s)+this.start;this.media.currentTime!==u&&(this.media.currentTime=u,(this.media.paused||this.media.ended)&&this.ctx.clock.setTimeout(()=>{this.media.play().then(()=>this.media.pause())},16))},this.showController=s=>{s.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=E.formatTime(this.duration)},this.playMedia=()=>c(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(s=>{s()})}),this.pauseMedia=()=>c(this,void 0,void 0,function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()}),this.onMouseOut=s=>{s.stopPropagation(),this.mediaController.style.display="none"},this.mediaTimeUpdate=()=>c(this,void 0,void 0,function*(){const s=this.media.currentTime-this.start;this.duration>0&&(s>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=E.formatTime(s),this.currentProgress.style.flex=(s/this.duration).toString()}),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(s=>{s()})},this.playMediaFromCtrl=()=>{this.ctx.eventHub.emit(Pn.mediaPlay,{id:this.targetId,time:this.media.currentTime}),this.playMedia()},this.pauseMediaFromCtrl=()=>{this.ctx.eventHub.emit(Pn.mediaPause,{id:this.targetId,time:this.media.currentTime}),this.pauseMedia()},this.targetId=n.targetId,this.ctx=n.ctx,this.height=n.height,this.width=n.width,this.sprite=n.sprite,this.media=n.media,this.info=n.info,this.canvasElement=n.canvasElement,this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=(e=this.info.cut.start)!==null&&e!==void 0?e:0,this.end=(r=this.info.cut.end)!==null&&r!==void 0?r:0)}getMedianContainer(){var n;let e=(n=this.canvasElement.parentElement)===null||n===void 0?void 0:n.querySelector(".median-container");e||(e=document.createElement("div"),e.className="median-container",this.canvasElement.parentElement.appendChild(e)),this.container=e}static formatTime(n){let e="00:00";if(n){const r=Math.floor(n/60),s=String(r<0?0:r).padStart(2,"0"),u=Math.floor(n%60);e=`${s}:${String(u<0?0:u).padStart(2,"0")}`}return e}createButton(){const n={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};g(this.playButton,Object.assign(Object.assign({},n),{display:"block"}));const e=document.createElement("img");g(e,{height:"20px"}),e.src="https://convertcdn.netless.link/publicFiles/icon/play.png",this.playButton.appendChild(e),g(this.pauseButton,Object.assign(Object.assign({},n),{display:"none"}));const r=document.createElement("img");g(r,{height:"20px"}),r.src="https://convertcdn.netless.link/publicFiles/icon/pause.png",this.pauseButton.appendChild(r)}createTimer(){const n=document.createElement("div");g(n,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",n.append(this.currentTime,e,this.totalTime),n}createProgress(){g(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const n=document.createElement("div");g(n,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(n),g(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),n.appendChild(this.currentProgress)}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 n;const{sprite:e}=this,{stageWidth:r,stageHeight:s}=this.ctx,u=e.getGlobalPosition(),h=1/Number((n=this.container)===null||n===void 0?void 0:n.getAttribute("data-scale"));u.y=u.y+this.height-50,u.x=Math.max(u.x,0),u.x=Math.min(u.x,r-300*h),u.y=Math.max(u.y,0),u.y=Math.min(u.y,s-50),g(this.mediaController,{height:"50px",borderRadius:"25px",width:"300px",flexDirection:"row",alignItems:"center",position:"absolute",left:u.x+"px",top:u.y+"px",display:"none",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${h})`,transformOrigin:"0 100%"})}createMediaController(){this.setControllerPosition(),this.createButton();const n=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,n,this.progress),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(n){this.playCallBackList.push(n)}unbindEvent(){this.mediaController.removeEventListener("mouseover",this.showController,!1),this.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",()=>this.playMedia(),!1),this.pauseButton.removeEventListener("click",()=>this.pauseMedia(),!1),this.media.removeListener("durationchange",this.getMediaDuration,!1),this.media.removeListener("timeupdate",this.mediaTimeUpdate,!1),this.media.removeListener("pause",this.onPauseMedia,!1),this.media.removeListener("play",this.onPlayMedia,!1)}show(){this.setControllerPosition(),this.mediaController.style.display="flex"}hide(){this.mediaController.style.display="none"}destroy(){var n;this.unbindEvent(),this.playCallBackList=[],(n=this.container)===null||n===void 0||n.removeChild(this.mediaController)}}var N=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class q extends J.a{constructor(n){var e,r;super(),this.type="video",this.sprite=new Nr,this.isPlaying=!1,this.id=n.id,this.video=n.video,this.start=(e=n.video.cut)===null||e===void 0?void 0:e.start,this.end=(r=n.video.cut)===null||r===void 0?void 0:r.end,this.container=n.container,this.ctx=n.ctx,this.ctx.medias[this.id]=this,this.videoResource=new hl(this.video.src,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});const{video:s,width:u,height:h,sprite:f}=n;this.controller=new E({targetId:n.id,ctx:n.ctx,width:u,height:h,sprite:f,media:this,info:s,canvasElement:n.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=u,this.sprite.height=h,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const y=new Jn(null,{height:h,width:u});y.resource=this.videoResource,this.videoResource.bind(y),this.sprite=new Nr,this.sprite.visible=!1,this.sprite.texture=new qn(y),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",b=>{b.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",b=>{b.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(b=>{this.videoResource.source.addEventListener(b,()=>{b!=="timeupdate"||this.isPlaying||this.pause(),this.emit(b)})})}get currentTime(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.currentTime)!==null&&e!==void 0?e:0}set currentTime(n){this.videoResource.source&&(this.videoResource.source.currentTime=n)}get paused(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.paused)===null||e===void 0||e}get ended(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.ended)===null||e===void 0||e}get duration(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.duration)!==null&&e!==void 0?e:0}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){var n;return N(this,void 0,void 0,function*(){this.isPlaying=!0,yield this.load(),yield this.ctx.clock.waitUntil(()=>{const r=this.videoResource.source;return!!(r&&r.videoWidth>0)},3e3);const e=this.videoResource.source;e&&e.videoWidth<=0||(yield(n=this.videoResource.source)===null||n===void 0?void 0:n.play())})}load(){return this.videoResource.load()}pause(){var n;this.isPlaying=!1,(n=this.videoResource.source)===null||n===void 0||n.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(n){this.controller.jumpToTime(n)}destroy(){var n;this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),(n=this.videoResource)===null||n===void 0||n.destroy(),this.controller.destroy()}}var dt=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Mt extends J.a{constructor(n){super(),this.type="audio",this.isPlaying=!1,this.id=n.id,this.audio=n.audio,this.container=n.container,this.container=n.container,this.audioEl=document.createElement("audio"),this.audioEl.src=this.audio.src,n.audio.cut&&(this.start=n.audio.cut.start,this.end=n.audio.cut.end),this.ctx=n.ctx,this.ctx.medias[this.id]=this;const{width:e,height:r,sprite:s}=n;this.controller=new E({targetId:n.id,ctx:n.ctx,height:r,width:e,sprite:s,media:this,info:this.audio,canvasElement:n.canvasElement}),["durationchange","timeupdate","pause","play"].forEach(u=>{this.audioEl.addEventListener(u,()=>{this.emit(u)})})}get currentTime(){return this.audioEl.currentTime}set currentTime(n){this.audioEl.currentTime=n}get paused(){return this.audioEl.paused}get ended(){return this.audioEl.ended}get duration(){return this.audioEl.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return dt(this,void 0,void 0,function*(){this.isPlaying=!0;try{yield this.audioEl.play()}catch{console.debug("[PPT Player]: refuse to play()")}})}pause(){this.isPlaying=!1,this.audioEl.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(n){this.controller.jumpToTime(n)}destroy(){this.audioEl.pause(),this.controller.destroy()}}var Lt=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class qt extends Tl{constructor(n,e,r){super(Object.assign(Object.assign({},n),{type:"Shape",useBgFill:!1,textRotateWithShape:!0}),e,r),this.picTextureId="",this.picSprite=new Nr,this.picMask=new Nr,this.cmd=new yo(this),this.picFill=n.picFill,this.media=n==null?void 0:n.media}applyCommand(n,e){var r,s,u,h,f;if(e==="call")if(/playFrom\(([0-9.]+)\)/.test(n)){const y=n.match(/playFrom\(([0-9.]+)\)/),b=Number(y[1]||"0");(r=this.mediaPlayer)===null||r===void 0||r.play().then(()=>{var T;(T=this.mediaPlayer)===null||T===void 0||T.seek(b)})}else n==="custom-pause"?(s=this.mediaPlayer)===null||s===void 0||s.pause():n==="togglePause"?(u=this.mediaPlayer)===null||u===void 0||u.togglePause():n==="stop"&&((h=this.mediaPlayer)===null||h===void 0||h.pause(),(f=this.mediaPlayer)===null||f===void 0||f.seek(0))}renderPic(){var n,e,r;return Lt(this,void 0,void 0,function*(){const s=this.ctx.fillTexture.getTexture(this.picTextureId);s.texture&&(this.picSprite.texture=s.texture),this.picMask.texture=this.backgroundMask.texture,this.picSprite.mask=this.picMask,this.picSprite.width=this.designWidth,this.picSprite.height=this.designHeight,this.container.addChild(this.picSprite),this.container.addChild(this.picMask),((n=this.media)===null||n===void 0?void 0:n.type)==="video"?(this.mediaPlayer=new q({id:this.json.id+"-video",ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view}),((e=this.mediaPlayer)===null||e===void 0?void 0:e.sprite)&&(this.mediaPlayer.sprite.mask=this.picMask)):((r=this.media)===null||r===void 0?void 0:r.type)==="audio"&&(this.mediaPlayer=new Mt({id:this.json.id+"-audio",ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view})),this.mediaPlayer&&(this.picSprite.interactive=!0,this.picSprite.on("mouseover",()=>{this.mediaPlayer.showController()}),this.picSprite.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))})}preRender(){if(super.preRender(),this.picFill.fillType!=="gifFill")this.picTextureId=this.ctx.fillTexture.addFill(this.picFill,this.designWidth,this.designHeight);else{let n=1;const e=this.ctx.fillTexture.getGifFrames(this.picFill.src),r=e.map((u,h)=>({texture:u,time:this.picFill.delays[h]||20}));this.picSprite=new wl(r,!0),this.picSprite.play();const s=this.picFill.loop;this.picSprite.onLoop=()=>{n+=1,s>0&&n>s&&this.picSprite.gotoAndStop(e.length-1)}}}subClassRender(){return Lt(this,void 0,void 0,function*(){yield this.renderPic()})}destroy(){this.mediaPlayer&&(this.picSprite.interactive=!1,this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picSprite.destroy(),this.picMask.destroy()}}var Ee=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class me extends Hh{constructor(n,e,r){var s,u,h,f;super(n,e,r),this.children=[],this.cacheSprite=new Nr,this.json=n,this.container.name=n.id,this.ctx.timingTargets.addTarget(n.id,this);const y={x:(u=(s=n.position)===null||s===void 0?void 0:s.x)!==null&&u!==void 0?u:0,y:(f=(h=n.position)===null||h===void 0?void 0:h.y)!==null&&f!==void 0?f:0};n.children.forEach(b=>{let T=null;(b==null?void 0:b.type)==="Shape"?T=new Tl(b,this.ctx,y):(b==null?void 0:b.type)==="Picture"?T=new qt(b,this.ctx,y):(b==null?void 0:b.type)==="Container"&&(T=new me(b,this.ctx,y)),T&&this.children.push(T)}),this.updateTransform(this.json)}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(){if(this.json.fillStyle)if(this.json.fillStyle.fillType==="groupFill")this.fillTextureId=this.groupFillTextureId;else{const{fillStyle:n,width:e,height:r}=this.json;this.fillTextureId=this.ctx.fillTexture.addFill(n,e,r)}for(const n of this.children)n.groupFillTextureId=this.fillTextureId,n.preRender()}getBgElement(){return null}getIterateEntry(n,e,r){return e===0?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}getTextElement(){return null}render(){var n;return Ee(this,void 0,void 0,function*(){const e=new Ri;for(const r of this.children)yield r.render(),r.renderContainer&&e.addChild(r.renderContainer),(r.json.hlinkHover||r.json.hlinkClick)&&((n=r.hyperlink)===null||n===void 0||n.addProxy(this.container));this.container.addChild(e),this.json.cacheAsTexture&&(function(r,s,u,h){const f=r.getBounds(),y=Math.min(f.x,s.x,f.x+f.width,s.x+s.width),b=Math.max(f.x,s.x,f.x+f.width,s.x+s.width),T=Math.min(f.y,s.y,f.y+f.height,s.y+s.height),P=b-y,j=Math.max(f.y,s.y,f.y+f.height,s.y+s.height)-T,G=s.x-f.x>0?s.x-f.x:0,V=s.y-f.y>0?s.y-f.y:0,K=Li.create({width:P,height:j,resolution:Math.ceil(h.renderer.resolution)});r.position.x=G,r.position.y=V,h.renderer.render(r,{renderTexture:K}),u.texture=K,u.position.x=-G,u.position.y=-V}(e,new dr(this.designX,this.designY,this.designWidth,this.designHeight),this.cacheSprite,this.ctx),this.container.addChild(this.cacheSprite),e.position.x=0,e.position.y=0,e.visible=!1)})}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(n=>n.destroy()),this.container.destroy()}}class De extends J.a{constructor(n,e,r,s){super(),this.cond={},this.timeoutIds=[],this.condHandle=u=>{if(u)if(u.delay&&u.delay>0){const h=this.ctx.clock.setTimeout(()=>{u.event&&(this.cond[u.event]=!0,this.detectTrigger())},u.delay);this.timeoutIds.push(h)}else this.cond[u.event]=!0,this.detectTrigger();else this.detectTrigger()},this.id=n,this.ctx=s,this.eventHubs=r,e.forEach(u=>{this.addCond(u)})}setTriggerParams(n){this.triggerParams=n}addCond(n){const e=()=>this.condHandle(n);n.event&&(/^shape/.test(n.event)||/^time/.test(n.event)?(this.cond[n.event]=!1,this.eventHubs.global.addListener(n.event,e)):/^runtime/.test(n.event)?(this.cond[n.event]=!1,this.eventHubs.runtime.addListener(n.event,e)):/^self/.test(n.event)?n.delay&&n.delay>0&&(this.cond[n.event]=!1,this.eventHubs.runtime.addListener(n.event,e)):this.cond[n.event]=!1)}isTrigger(){return Object.keys(this.cond).every(n=>!!this.cond[n])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(n=>n!=="self").every(n=>!!this.cond[n])}detectTrigger(){if(Object.keys(this.cond).every(n=>!!this.cond[n])){Object.keys(this.cond).forEach(e=>{this.cond[e]=!1});const n=this.triggerParams;this.triggerParams=void 0,this.emit("active",n)}}reset(){Object.keys(this.cond).forEach(n=>{this.cond[n]=!1}),this.timeoutIds.forEach(n=>this.ctx.clock.clearTimeout(n))}}class gn extends J.a{constructor(n){super(),this.runtimeNodeEventHub=new J.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=()=>{var P,j,G,V,K,_t;this.hasPrev()||!this.isMainSeq?this.currentSeqState==="idle"?(this.decrSeqIndex(),(P=this.commonTimeNode.children[this.currentSeqIndex])===null||P===void 0||P.commonTimeNode.seekToStart(),(j=this.commonTimeNode.children[this.currentSeqIndex])===null||j===void 0||j.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.currentSeqState==="running"?((G=this.commonTimeNode.children[this.currentSeqIndex])===null||G===void 0||G.commonTimeNode.seekToStart(),(V=this.commonTimeNode.children[this.currentSeqIndex])===null||V===void 0||V.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.currentSeqState==="end"&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),(K=this.commonTimeNode.children[this.currentSeqIndex])===null||K===void 0||K.commonTimeNode.seekToStart(),(_t=this.commonTimeNode.children[this.currentSeqIndex])===null||_t===void 0||_t.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide")},this.handleNext=()=>{var P,j,G,V;this.hasNext()||!this.isMainSeq?this.currentSeqState==="idle"?(P=this.commonTimeNode.children[this.currentSeqIndex])===null||P===void 0||P.commonTimeNode.startTimeNodeForce():this.currentSeqState==="running"?((j=this.commonTimeNode.children[this.currentSeqIndex])===null||j===void 0||j.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),(G=this.commonTimeNode.children[this.currentSeqIndex])===null||G===void 0||G.commonTimeNode.startTimeNodeForce()):this.currentSeqState==="end"&&(this.incrSeqIndex(),(V=this.commonTimeNode.children[this.currentSeqIndex])===null||V===void 0||V.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide")};const{json:e,iterateType:r,isIterate:s,isSub:u,parent:h,ctx:f,eventHub:y,iterateIndex:b,iterateId:T}=n;this.isMainSeq=e.ctn.nodeType==="mainSeq",this.isInteractiveSeq=e.ctn.nodeType==="interactiveSeq",this.id=e.ctn.id,this.isIterate=s,this.json=e,this.ctx=f,this.globalEventHub=y,this.commonTimeNode=new Co({json:e.ctn,isSub:u,eventHubs:{global:y,runtime:this.runtimeNodeEventHub},ctx:f,parent:h,isIterate:!1,iterateType:r,iterateIndex:b,iterateId:T}),this.bindShapeEvent(),this.nextConds=new De("mainSeq",e.nextCondLst,{global:y,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new De("mainSeq",e.preCondLst,{global:y,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",P=>{const j=this.commonTimeNode.children.findIndex(G=>G.commonTimeNode.uuid===P.id);j>=0&&(this.currentSeqIndex=j),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit(Pn.mainSeqStepStart,j)}),this.commonTimeNode.on("childTimeNodeEnd",P=>{const j=this.commonTimeNode.children.findIndex(G=>G.commonTimeNode.uuid===P.id);j>=0&&(this.currentSeqIndex=j),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext()}),this.isMainSeq&&this.ctx.eventHub.emit(Pn.mainSeqStepEnd,j)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.commonTimeNode.resetForRepeat(),this.ctx.clock.setTimeout(()=>{this.currentSeqState="idle",this.currentSeqIndex=0})}),this.nextConds.on("active",()=>{if(this.isInteractiveSeq){const{mode:P}=this.ctx;P!=="interactive"&&P!=="sync"||this.ctx.eventHub.emit(Pn.interactiveSeqNext,this.json.ctn.id),P!=="sync"&&P!=="local"||this.handleNext()}else this.handleNext()}),this.prevConds.on("active",this.handlePrev)}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(n){this._currentSeqIndex=n,this.isMainSeq?this.ctx.eventHub.emit(Pn.mainSeqStepChange,n):this.isInteractiveSeq&&this.ctx.eventHub.emit(Pn.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:n,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(n){this._currentSeqState=n,this.isMainSeq?this.ctx.eventHub.emit(Pn.mainSeqStateChange,n):this.isInteractiveSeq&&this.ctx.eventHub.emit(Pn.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:n}})}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&&this.currentSeqState==="idle")}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&this.currentSeqState==="end")}bindShapeEvent(){this.json.ctn.nodeType==="interactiveSeq"&&this.json.nextCondLst.forEach(n=>{if(/^shape/.test(n.event)){const e=n.event.split(" ")[1];if(e){const r=this.ctx.timingTargets.getTargetById(e);r&&(r.interactiveContainer.interactive=!0,r.interactiveContainer.cursor="pointer",r.interactiveContainer.on("pointerdown",()=>{const s=`shape ${e} onClick`;this.globalEventHub.emit(s)}))}}})}setCurrentStep(n,e){let r=n;this.commonTimeNode.seekToStart();const{length:s}=this.commonTimeNode.children;if(r===-1&&(r=s-1),r>=0&&r<s)for(let u=0;u<=r;u++){const h=this.commonTimeNode.children[u];u!==r?h.commonTimeNode.seekToEnd(!1,!0):e==="start"?h.commonTimeNode.seekToStart():e==="end"&&h.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=r,this.currentSeqState=e==="start"?"idle":"end"}}function ln(o,n,e){const r=n.split(".");r.reduce((s,u,h)=>{if(s)return h!==r.length-1?s[u]:void(s[u]=e);console.warn(`${o} not support ${n}`)},o)}function An(o,n){return n?n.split(".").reduce((e,r)=>{if(e)return e[r];console.warn(`${o} not support ${n}`)},o):null}class ve{constructor(n){this.timingTarget=null,this.runtimeNodeEventHub=new J.a,this.onTimeLineStart=()=>{if(this.isConflict){const{target:P}=this.json.cBhvr;if(this.activeWhenConflict==="next"){let j=P.id;P.type==="shape"&&P.txEl&&(j=`${j}-txEl-${P.txEl.range[0]}`),this.commonTimeNode.isIterate&&(j=`${j}-iterate-${this.commonTimeNode.iterateIndex}`),this.ctx.conflictTimeNodeManager.addRunningTimeNode(j,this.modifyAttrKey,this.commonTimeNode)}else this.activeWhenConflict==="prev"&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:r,json:s,ctx:u,parent:h,eventHub:f,iterateType:y,iterateIndex:b,iterateId:T}=n;this.json=s,this.id=s.cBhvr.ctn.id,this.ctx=u,this.globalEventHub=f,this.commonTimeNode=new Co({json:s.cBhvr.ctn,isSub:r,eventHubs:{global:f,runtime:this.runtimeNodeEventHub},ctx:u,parent:h,isIterate:e,iterateType:y,iterateIndex:b,iterateId:T}),this.timingTarget=this.ctx.timingTargets.getTarget(s.cBhvr.target,e,{type:y,index:b,id:T}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.onTimeLineStart)}}class Xe extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=An(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const e=this.json.cBhvr.attrList[0];this.startVal!==null&&this.timingTarget&&ln(this.timingTarget,e,this.startVal)},this.onSeekToEnd=()=>{const e=this.json.cBhvr.attrList[0],r=this.json.cBhvr.to||this.json.to;r&&this.timingTarget&&ln(this.timingTarget,e,r)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:e,delta:r})=>{if(r/e>=1){const s=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const u=this.json.cBhvr.to||this.json.to;u&&this.timingTarget&&ln(this.timingTarget,s,u)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}class Un{constructor(n,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:r=>r/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:r=>r/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=n.val.value,this.time=n.time,n.fmla&&(this.fmla=this.parseFmla(n.fmla))}parseFmla(n){let e=n.replaceAll("#ppt_h",`(${this.timingTarget.design_ppt_h})`);return e=e.replaceAll("#ppt_w",`(${this.timingTarget.design_ppt_w})`),e=e.replaceAll("#ppt_x",`(${this.timingTarget.design_ppt_x})`),e=e.replaceAll("#ppt_y",`(${this.timingTarget.design_ppt_y})`),e=e.replaceAll("ppt_w","vars.ppt_w"),e=e.replaceAll("ppt_h","vars.ppt_h"),e=e.replaceAll("ppt_x","vars.ppt_x"),e=e.replaceAll("ppt_y","vars.ppt_y"),e=e.replaceAll("#","vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(r=>{const s=new RegExp(`([^a-z])${r}([^a-z])`,"g");e=e.replace(s,(u,h,f)=>`${h}math.${r}${f}`)}),new Function("vars","math","$","return "+e)}}class mn extends Un{constructor(n,e,r){super(n,e),this.value=n.val.value,r&&(this.fmla=this.parseFmla(r))}resolveValue(){return this.value}interpolationFrom(n,e,r){const s=n.resolveValue(r),u=s+(this.resolveValue()-s)*e;return n.fmla?n.fmla(r,this.math,u):u}}class Yn extends Un{constructor(n,e){var r;super(n,e),this.value=(r=n.val)===null||r===void 0?void 0:r.value}interpolationFrom(n,e,r){let s=n.resolveValue(r);return e>this.time&&(s=this.resolveValue()),s}resolveValue(){return this.value||""}}class wn extends Un{constructor(n,e){super(n,e),this.fn=this.parseFmla(this.val)}resolveValue(n){return this.fn(n,this.math,1)}interpolationFrom(n,e,r){const s=n.resolveValue(r),u=s+(this.resolveValue(r)-s)*e;return n.fmla?n.fmla(r,this.math,u):u}}class lr extends Un{constructor(n,e){super(n,e),this.value=n.val.value}interpolationFrom(n,e){return ku(n.resolveValue(),this.value,e)}resolveValue(){return this.value}}class In extends ve{constructor(n){super(n),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=An(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var e,r,s,u;((e=this.timingTarget)===null||e===void 0?void 0:e.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),((r=this.timingTarget)===null||r===void 0?void 0:r.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),((s=this.timingTarget)===null||s===void 0?void 0:s.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),((u=this.timingTarget)===null||u===void 0?void 0:u.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:e,delta:r})=>{const s=r/e,u=this.keyFrames.findIndex(j=>s<=j[0]),{attrList:h}=this.json.cBhvr;if(u<0){const j=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&h&&h[0]&&ln(this.timingTarget,h[0],j[1].resolveValue(this.vars)))}const f=u-1,y=this.keyFrames[u],b=this.keyFrames[f]||y,T=y[0]-b[0]==0?1:(s-b[0])/(y[0]-b[0]),P=y[1].interpolationFrom(b[1],T,this.vars);this.timingTarget&&h&&h[0]&&ln(this.timingTarget,h[0],P)},this.onSeekToStart=()=>{this.startVal!==null&&this.timingTarget&&ln(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 n;const{valueType:e}=this.json;if(this.json.tavLst.length<=0){if(this.json.to){if(this.json.from||this.startVal){const s={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(s,this.timingTarget);this.keyFrames.push([s.time,u])}}const r={time:1,val:{type:"string",value:this.json.to},fmla:""};if(e==="num"&&this.timingTarget){const s=new wn(r,this.timingTarget);this.keyFrames.push([r.time,s])}}else if(this.json.by){const r={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(r,this.timingTarget);this.keyFrames.push([r.time,u])}const s={time:1,val:{type:"string",value:(((n=r.val)===null||n===void 0?void 0:n.value)||"")+"+"+this.json.by},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(s,this.timingTarget);this.keyFrames.push([s.time,u])}}}if(this.json.tavLst.length>0){for(const r of this.json.tavLst)if(r.val&&this.timingTarget){let s=null;r.val.type==="string"?e==="num"?s=new wn(r,this.timingTarget):e==="str"&&(s=new Yn(r,this.timingTarget)):r.val.type==="number"?s=new mn(r,this.timingTarget):r.val.type==="color"?(this.isColorAnim=!0,s=new lr(r,this.timingTarget)):r.val.type==="boolean"&&console.warn("not implements"),s&&this.keyFrames.push([r.time,s])}}}}var jn=S(21),Ei=S.n(jn),xo=S(22),Ls=S.n(xo);class ki extends ko{constructor(){super(Ls.a,Ei.a,{percent:0,direction:1,transition:0})}set transition(n){this.uniforms.transition=n}set percent(n){this.uniforms.percent=n}set direction(n){this.uniforms.direction=n}}var Js=S(23),Ka=S.n(Js);class Qa extends ko{constructor(){super(void 0,Ka.a,{percent:0,transition:1})}set transition(n){this.uniforms.transition=Math.pow(n,n)}set percent(n){this.uniforms.percent=n}}class El extends ve{constructor(n){var e;super(n),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:u,delta:h})=>{const f=h/u;this.filter&&(this.filter.percent=f),f>=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 r=0;n.json.transition==="out"?r=-1:n.json.transition==="in"&&(r=1);const s=(e=n.json.filter)===null||e===void 0?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(s){const u=s[1],h=s[3];if(u==="wipe"){const f=new ki;h==="up"?f.direction=1:h==="down"?f.direction=2:h==="left"?f.direction=3:h==="right"&&(f.direction=4),this.filter=f,this.filterType=`${u}-${h}`}else if(u==="fade"){const f=new Qa;this.filter=f,this.filterType=""+u}this.filter&&(this.filter.transition=r)}}get modifyAttrKey(){return this.filterType}}var _a=S(5);class ya extends ve{constructor(n){super(n),this.isConflict=!0,this.activeWhenConflict="next",this.onTimeUpdate=({duration:e,delta:r})=>{var s;const u=r/e,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{var e,r,s;const u=(r=(e=this.commonTimeNode.json)===null||e===void 0?void 0:e.spd)!==null&&r!==void 0?r:1,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u>0?0:1);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+this.timingTarget.design_ppt_y)},this.onSeekToEnd=()=>{var e,r,s;const u=(r=(e=this.commonTimeNode.json)===null||e===void 0?void 0:e.spd)!==null&&r!==void 0?r:1,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u>0?1:0);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var n;const e=new _a.Path,r=(n=this.json.path)===null||n===void 0?void 0:n.match(/[MLCmlc][^MLCmlc]+/g);if(r)for(const s of r){const[u,...h]=s.trim().replace(/\s+/g," ").split(" ");if(u==="M"){const[f,y]=h.map(b=>Number(b));e.moveTo(f,y)}else if(u==="L"){const[f,y]=h.map(b=>Number(b));e.lineTo(f,y)}else if(u==="C"){const[f,y,b,T,P,j]=h.map(G=>Number(G));e.bezierCurveTo(f,y,b,T,P,j)}else if(u==="Z")e.closePath();else if(u==="E")console.warn("not implements");else if(u==="c"){const[f,y,b,T,P,j]=h.map(V=>Number(V)),G=e.currentPoint;e.bezierCurveTo(f+G.x,y+G.y,b+G.x,T+G.y,P+G.x,j+G.y)}else if(u==="l"){const f=e.currentPoint,[y,b]=h.map(T=>Number(T));e.lineTo(y+f.x,b+f.y)}else if(u==="m"){const f=e.currentPoint,[y,b]=h.map(T=>Number(T));e.moveTo(y+f.x,b+f.y)}}this.path=e}}class zu extends ve{constructor(n){super(n),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=e=>{e.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:e,delta:r})=>{var s,u,h,f,y;const b=r/e,T={x:1,y:1};if(this.to){const P=(s=this.from)!==null&&s!==void 0?s:{x:(h=(u=this.startVal)===null||u===void 0?void 0:u.x)!==null&&h!==void 0?h:1,y:(y=(f=this.startVal)===null||f===void 0?void 0:f.y)!==null&&y!==void 0?y:1};T.x=P.x+(this.to.x-P.x)*b,T.y=P.y+(this.to.y-P.y)*b}else if(this.by){const P={x:this.by.x,y:this.by.y};T.x=1+(P.x-1)*b,T.y=1+(P.y-1)*b}this.timingTarget&&(this.timingTarget.scale=T)},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=n.json.from,this.to=n.json.to,this.by=n.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 op extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=e=>{this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to),e.isReverse||this.updateCurrentValue();const[r]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,r+".on","true")},this.onTimeNodeEnd=()=>{if(this.json.cBhvr.ctn.fill==="remove"){const[e]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,e+".on","false")}},this.onSeekToStart=()=>{if(this.timingTarget){const[e]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,e+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const e=An(this.timingTarget,this.json.cBhvr.attrList[0]);e&&(this.startColorString=e)}},this.onTimeUpdate=({delta:e,duration:r})=>{const s=e/r;this.to.interpolationFrom(this.from,s,this.target),this.timingTarget&&ln(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1})},this.json.clrSpc==="rgb"?(this.from=new Sl(this.json.from),this.to=new Sl(this.json.to),this.by=new Sl(this.json.by),this.target=new Sl):(this.from=new Ps(this.json.from),this.to=new Ps(this.json.to),this.by=new Ps(this.json.by),this.target=new Ps),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 n=An(this.timingTarget,this.json.cBhvr.attrList[0]);n&&(this.currentColorString=n)}}}class su extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=e=>{this.lastVal=null,e.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:e,delta:r})=>{const s=r/e;let u=0,h=0;if(this.from!==void 0&&this.to!==void 0){u=this.from,h=this.to;const f=u+(h-u)*s;this.timingTarget&&(this.timingTarget.r=f)}else if(this.by!==void 0){this.lastVal||(this.lastVal=0);const f=this.by*s-this.lastVal;this.lastVal=this.by*s,this.timingTarget&&(this.timingTarget.r+=f)}},this.onTimeNodeStart=()=>{var e;Object(W.isNumber)((e=this.timingTarget)===null||e===void 0?void 0:e.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&this.startVal!==null&&(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 n;this.currentVal=(n=this.timingTarget)===null||n===void 0?void 0:n.r}}class Xh extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var e,r;const{cmd:s,cmdType:u}=this.json;!this.isApplied&&s&&u&&(this.isApplied=!0,(r=(e=this.timingTarget)===null||e===void 0?void 0:e.cmd)===null||r===void 0||r.applyCommand(s,u))},this.onSeekToStart=()=>{var e,r;(r=(e=this.timingTarget)===null||e===void 0?void 0:e.cmd)===null||r===void 0||r.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)}get modifyAttrKey(){var n,e,r,s;return((e=(n=this.json)===null||n===void 0?void 0:n.cmd)!==null&&e!==void 0?e:"")+((s=(r=this.json)===null||r===void 0?void 0:r.cmdType)!==null&&s!==void 0?s:"")}}var au=S(24);class tl{constructor(n){tl.useRtc||(this.howl=new au.Howl({src:[n]}))}play(){var n;(n=this.howl)===null||n===void 0||n.play()}pause(){var n;(n=this.howl)===null||n===void 0||n.pause()}stop(){var n;(n=this.howl)===null||n===void 0||n.stop()}destroy(){var n;(n=this.howl)===null||n===void 0||n.unload()}}tl.useRtc=!1;class nf{constructor(n){this.runtimeNodeEventHub=new J.a,this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy()};const{json:e,isIterate:r,isSub:s,eventHub:u,ctx:h,parent:f,iterateType:y,iterateIndex:b,iterateId:T}=n;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new Co({json:e.cMediaNode.ctn,isSub:s,eventHubs:{global:u,runtime:this.runtimeNodeEventHub},ctx:h,parent:f,isIterate:r,iterateType:y,iterateIndex:b,iterateId:T}),this.audio=new tl(e.cMediaNode.tgtEl),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)}}var qh=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Co extends J.a{constructor(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.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.timeDelta=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.dispose())},this.handleActive=(G=!0)=>{if(this.isActive=!0,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(this.json.restart==="never")return;this.json.restart!=="whenNotActive"&&this.json.restart!=="always"||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(G))}else this.startTimeLine(G)},this.updateTimeLine=G=>{const V=G/(Bt.TARGET_FPMS||.06);this.timeDelta+=V,this.duration-this.timeDelta<=V&&(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=(G=!1)=>{(this.isTimeNodeEnd()||G)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:e,isIterate:r,ctx:s,eventHubs:u,parent:h,json:f,iterateType:y,iterateId:b,iterateIndex:T}=n;this.isSub=e,this.isIterate=r,this.parentTimeNode=h,this.json=f,this.ctx=s,this.iterateIndex=T,this.eventHubs=u,this.iterateType=y,this.iterateId=b;const P=Number(this.json.dur),j=this.json.spd||1;this.isNegativeSpeed=j<0,Number.isNaN(P)||(this.duration=P/Math.abs(j)),this.uuid+="--"+this.json.id,this.setPreStyle(),f.childTnLst&&this.createChildren(f.childTnLst),this.startConds=new De(this.json.id||"",f.stCondLst,u,this.ctx),this.endConds=new De(this.json.id||"",f.endCondLst,u,this.ctx),f.endSync&&(this.endSync=new De(this.json.id||"",[f.endSync],u,this.ctx),this.endSync.on("active",()=>{var G;this.json.nodeType==="interactiveSeq"&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),(G=this.endSync)===null||G===void 0||G.reset())})),this.startConds.on("active",G=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(G))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(G=>G.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&this.json.masterRel==="nextClick"&&this.startConds.addCond({event:"shape slide onNext"}),this.json.iterate&&this.isIterate===!1&&this.createIterateShadow()}createIterateShadow(){const n=Is();let e=!0,r=0;const s=u=>{u===n&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",s))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",s);e;){const u=JSON.parse(JSON.stringify(this.json)),h=new Co({json:u,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:u.iterate.type,iterateIndex:r,iterateId:n});this.iterateShadows[r]=h,r+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(n){this.isReverse=n}createTimeNode(n,e){let r=null;const s={json:n,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId};return n.type==="seq"?r=new gn(s):n.type==="par"?r=new rd(s):n.type==="set"?r=new Xe(s):n.type==="anim"?r=new In(s):n.type==="animEffect"?r=new El(s):n.type==="animMotion"?r=new ya(s):n.type==="animScale"?r=new zu(s):n.type==="animClr"?r=new op(s):n.type==="animRot"?r=new su(s):n.type==="cmd"?r=new Xh(s):n.type==="audio"&&(r=new nf(s)),r}createSubList(n){this.subList=[],n.forEach(e=>{const r=this.createTimeNode(e,!0);r&&this.subList.push(r)})}bindCommonTimeNodeEvent(n){n.commonTimeNode.on("timeNodeStart",e=>{this.emit("childTimeNodeStart",e)}),n.commonTimeNode.on("timeNodeEnd",e=>{this.emit("childTimeNodeEnd",e),this.children.every(r=>r.commonTimeNode.isTimeNodeEnd())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(n){function e(r){return function(s){var u;return(u=s==null?void 0:s.cBhvr)===null||u===void 0?void 0:u.ctn}(r)?r.cBhvr.ctn.presetOrder:function(s){return s==null?void 0:s.ctn}(r)?r.ctn.presetOrder:function(s){return s==null?void 0:s.cMediaNode}(r)?r.cMediaNode.ctn.presetOrder:void 0}e(n[0])?[...n].sort((r,s)=>{var u,h;return((u=e(r))!==null&&u!==void 0?u:0)-((h=e(s))!==null&&h!==void 0?h:0)}).forEach(r=>{const s=n.findIndex(h=>e(h)===e(r)),u=this.createTimeNode(r,!1);u&&(this.bindCommonTimeNodeEvent(u),this.children[s]=u)}):n.forEach(r=>{const s=this.createTimeNode(r,!1);s&&(this.bindCommonTimeNodeEvent(s),this.children.push(s))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(n=>n.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.timeDelta=0,this.children.forEach(n=>n.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(n=>n.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.timeDelta=0;const n=1e3/this.ctx.ticker.maxFPS;this.duration<=n&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit(Pn.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>n&&(this.ctx.eventHub.emit(Pn.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(n=!0){if(n&&(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(Pn.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return qh(this,void 0,void 0,function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const n of this.iterateShadows){if(this.isIterateEnd)break;n.children.forEach(e=>{e.commonTimeNode.startTimeNode()}),n.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}})}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}setPreStyle(){if(!this.json.presetClass)return;const n=[],e=r=>{r.forEach(s=>{var u,h,f;s.cBhvr&&s.cBhvr.target&&n.findIndex(y=>y.id===s.cBhvr.target.id)<0&&n.push(s.cBhvr.target),((h=(u=s==null?void 0:s.cBhvr)===null||u===void 0?void 0:u.ctn)===null||h===void 0?void 0:h.childTnLst)&&s.cBhvr.ctn.childTnLst.length>0&&e(s.cBhvr.ctn.childTnLst),((f=s==null?void 0:s.ctn)===null||f===void 0?void 0:f.childTnLst)&&s.ctn.childTnLst.length>0&&e(s.ctn.childTnLst)})};e(this.json.childTnLst||[]),n.forEach(r=>{if(this.json.iterate){let s=0,u=!0;for(;u;){const h=this.ctx.timingTargets.getTarget(r,!0,{type:this.json.iterate.type,index:s,id:""});h&&(this.setPreStyleForTarget(h),s+=1),u=!!h}}else{const s=this.ctx.timingTargets.getTarget(r,!1);s&&this.setPreStyleForTarget(s)}})}setPreStyleForTarget(n){var e,r;if(n&&this.json.presetSubtype&&(n.presetSubType=this.json.presetSubtype),n&&!n.hasPreset)if(this.json.presetClass==="entr"){const s=(r=(e=this.json)===null||e===void 0?void 0:e.childTnLst)===null||r===void 0?void 0:r.filter(u=>u.type==="set"&&u.to==="visible");(s==null?void 0:s.length)&&(n.hasPreset=!0,n.style.visibility="hidden")}else(this.json.presetClass==="exit"||this.json.presetClass==="path")&&(n.hasPreset=!0,n.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(n=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(n);const e=this.json.stCondLst.filter(s=>/^self/.test(s.event||""))[0];e&&this.startConds.condHandle(e);const r=this.json.endCondLst.filter(s=>/^self/.test(s.event||""))[0];r&&this.endConds.condHandle(r),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(this.children.length===0||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(n=>n.commonTimeNode.destroy()),this.subList=[],this.children.forEach(n=>{n.commonTimeNode.clearSubList()})}seekToStart(n=!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(n));if(n)for(let e=this.subList.length-1;e>=0;e--){const r=this.subList[e];r==null||r.commonTimeNode.seekToStart()}for(let e=this.children.length-1;e>=0;e--){const r=this.children[e];r==null||r.commonTimeNode.seekToStart()}for(let e=this.children.length-1;e>=0;e--){const r=this.children[e];r==null||r.commonTimeNode.seekToStart()}}dispose(n=!1){this.isConflictDispose=n,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(Pn.animateEnd),this.ctx.ticker.remove(this.updateTimeLine),this.startConds.reset(),this.endConds.reset()}seekToEnd(n,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 r=this.json.autoRev||n;if(r?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(s=>s.seekToEnd(r,e));this.children.length===0&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(s=>s.commonTimeNode.seekToEnd(r,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(s=>s.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEnd(){let n=!0;return this.children.length>0&&(n=n&&this.children.every(e=>e.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(n=n&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(n=n&&!this.isReverse),n=n&&this.isNatureTimeEnd(),!!this.isConflictDispose||!(!this.isIterateEnd||!this.json.iterate)||n}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(n=>n.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(n=>n.commonTimeNode.destroy()),this.clearSubList()}}class rd extends J.a{constructor(n){super(),this.isRunning=!1,this.runtimeNodeEventHub=new J.a;const{json:e,iterateType:r,isIterate:s,isSub:u,parent:h,ctx:f,eventHub:y,iterateIndex:b,iterateId:T}=n;this.id=e.ctn.id,this.json=e,this.ctx=f,this.isIterate=s,this.globalEventHub=y,this.commonTimeNode=new Co({json:e.ctn,isSub:u,eventHubs:{global:y,runtime:this.runtimeNodeEventHub},ctx:f,parent:h,isIterate:!1,iterateType:r,iterateIndex:b,iterateId:T}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(P=>{P.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),P.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(P=>{P.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 yg=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class xg{constructor(n,e,r){this.json=n,this.ctx=r;const s=n.timeNodeList.find(u=>u.type==="par"&&u.ctn.nodeType==="tmRoot");s&&(this.tmRoot=new rd({json:s,isSub:!1,isIterate:!1,eventHub:e,ctx:r,parent:null,iterateType:"el",iterateIndex:0,iterateId:""}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(u=>{var h,f,y;return((h=u.json)===null||h===void 0?void 0:h.type)==="seq"&&((y=(f=u.json)===null||f===void 0?void 0:f.ctn)===null||y===void 0?void 0:y.nodeType)==="mainSeq"}))}findSeq(n){var e;return(e=this.tmRoot)===null||e===void 0?void 0:e.commonTimeNode.children.find(r=>{var s,u,h;return((s=r.json)===null||s===void 0?void 0:s.type)==="seq"&&((h=(u=r.json)===null||u===void 0?void 0:u.ctn)===null||h===void 0?void 0:h.id)===n})}start(){var n,e;return yg(this,void 0,void 0,function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),(n=this.mainSeq)===null||n===void 0||n.commonTimeNode.startTimeNode()):(e=this.mainSeq)===null||e===void 0||e.commonTimeNode.startTimeNode()})}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var n;(n=this.mainSeq)===null||n===void 0||n.commonTimeNode.collectStartValue()}setMainSeqStep(n,e){var r;n===-1&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),(r=this.mainSeq)===null||r===void 0||r.setCurrentStep(n,e)}destroy(){var n;(n=this.tmRoot)===null||n===void 0||n.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(n){const e=this.findSeq(n);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(n,e,r){const s=this.findSeq(n);s&&s.setCurrentStep(e,r)}applyInteractiveAction(n){const e=this.findSeq(n);e&&e.handleNext()}}var Lm=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class bg extends me{constructor(n,e,r){super({id:"stage",width:n.width,height:n.height,type:"Container",children:n.children},e,r),this.globalEventHub=new J.a,this.json=n,this.container.visible=!1,this.ctx=e,this.globalEventHub.on("c:prev slide",()=>{this.ctx.eventHub.emit(Pn.requestPrevSlide)}),this.globalEventHub.on("c:next slide",()=>{this.ctx.eventHub.emit(Pn.requestNextSlide)});const s=new ps;s.drawRect(0,0,n.width,n.height),this.container.addChild(s)}get interactiveContainer(){return this.container}render(){const n=Object.create(null,{render:{get:()=>super.render}});return Lm(this,void 0,void 0,function*(){yield n.render.call(this),this.ctx.eventHub.emit("StageRenderEnd")})}createTiming(){this.json.timing&&(this.timing=new xg(this.json.timing,this.globalEventHub,this.ctx))}startTiming(){var n;return((n=this.timing)===null||n===void 0?void 0:n.start())||Promise.resolve()}setMainSeqApplied(){var n;(n=this.timing)===null||n===void 0||n.setMainSeqApplied()}setMainSeqStep(n,e){var r;(r=this.timing)===null||r===void 0||r.setMainSeqStep(n,e)}collectMainSeqStartValue(){var n;(n=this.timing)===null||n===void 0||n.collectMainSeqStartValue()}hasTiming(){return!!this.timing}destroy(){var n;this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),this.ctx.fillTexture.destroy(),this.globalEventHub.removeAllListeners(),(n=this.timing)===null||n===void 0||n.destroy(),super.destroy()}mainSeqStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.currentMainSeqStep())!==null&&e!==void 0?e:0}mainSeqLength(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.currentMainSeqLength())!==null&&e!==void 0?e:0}mainSeqHasNextStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.mainSeqHasNextStep())!==null&&e!==void 0&&e}mainSeqHasPrevStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.mainSeqHasPrevStep())!==null&&e!==void 0&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(){var n;this.hasTiming()&&((n=this.timing)===null||n===void 0?void 0:n.hasMainSeq())?this.globalEventHub.emit("shape slide onNext"):this.ctx.eventHub.emit(Pn.requestNextSlide)}prevStep(){var n;this.hasTiming()&&((n=this.timing)===null||n===void 0?void 0:n.hasMainSeq())?this.globalEventHub.emit("shape slide onPrev"):this.ctx.eventHub.emit(Pn.requestPrevSlide)}applyInteractiveAction(n){var e;(e=this.timing)===null||e===void 0||e.applyInteractiveAction(n)}seekInteractiveSeqToEnd(n){var e;(e=this.timing)===null||e===void 0||e.seekInteractiveSeqToEnd(n)}setInteractiveSeqState(n,e,r){var s;(s=this.timing)===null||s===void 0||s.setInteractiveSeqState(n,e,r)}setMediaState(n,e){return Lm(this,void 0,void 0,function*(){const r=this.ctx.medias[n];r&&(e?yield r.play():yield r.pause())})}setMediaCurrentTime(n,e){const r=this.ctx.medias[n];r&&r.seek(e)}}const ts=134217729;function zf(o,n,e,r,s){let u,h,f,y,b=n[0],T=r[0],P=0,j=0;T>b==T>-b?(u=b,b=n[++P]):(u=T,T=r[++j]);let G=0;if(P<o&&j<e)for(T>b==T>-b?(h=b+u,f=u-(h-b),b=n[++P]):(h=T+u,f=u-(h-T),T=r[++j]),u=h,f!==0&&(s[G++]=f);P<o&&j<e;)T>b==T>-b?(h=u+b,y=h-u,f=u-(h-y)+(b-y),b=n[++P]):(h=u+T,y=h-u,f=u-(h-y)+(T-y),T=r[++j]),u=h,f!==0&&(s[G++]=f);for(;P<o;)h=u+b,y=h-u,f=u-(h-y)+(b-y),b=n[++P],u=h,f!==0&&(s[G++]=f);for(;j<e;)h=u+T,y=h-u,f=u-(h-y)+(T-y),T=r[++j],u=h,f!==0&&(s[G++]=f);return u===0&&G!==0||(s[G++]=u),G}function wg(o,n){let e=n[0];for(let r=1;r<o;r++)e+=n[r];return e}function Yh(o){return new Float64Array(o)}const id=Yh(4),Zh=Yh(8),Om=Yh(12),Mi=Yh(16),Po=Yh(4);function sp(o,n,e,r,s,u){const h=(n-u)*(e-s),f=(o-s)*(r-u),y=h-f;if(h===0||f===0||h>0!=f>0)return y;const b=Math.abs(h+f);return Math.abs(y)>=33306690738754716e-32*b?y:-function(T,P,j,G,V,K,_t){let Tt,jt,de,Ne,Nt,ue,$t,ie,Je,he,oe,Ae,nn,on,$n,nr,$e,Ue;const Cn=T-V,kn=j-V,wr=P-K,Ar=G-K;on=Cn*Ar,ue=ts*Cn,$t=ue-(ue-Cn),ie=Cn-$t,ue=ts*Ar,Je=ue-(ue-Ar),he=Ar-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=wr*kn,ue=ts*wr,$t=ue-(ue-wr),ie=wr-$t,ue=ts*kn,Je=ue-(ue-kn),he=kn-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,id[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,id[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,id[2]=Ae-(Ue-Nt)+(oe-Nt),id[3]=Ue;let Dr=wg(4,id),pi=22204460492503146e-32*_t;if(Dr>=pi||-Dr>=pi||(Nt=T-Cn,Tt=T-(Cn+Nt)+(Nt-V),Nt=j-kn,de=j-(kn+Nt)+(Nt-V),Nt=P-wr,jt=P-(wr+Nt)+(Nt-K),Nt=G-Ar,Ne=G-(Ar+Nt)+(Nt-K),Tt===0&&jt===0&&de===0&&Ne===0)||(pi=11093356479670487e-47*_t+33306690738754706e-32*Math.abs(Dr),Dr+=Cn*Ne+Ar*Tt-(wr*de+kn*jt),Dr>=pi||-Dr>=pi))return Dr;on=Tt*Ar,ue=ts*Tt,$t=ue-(ue-Tt),ie=Tt-$t,ue=ts*Ar,Je=ue-(ue-Ar),he=Ar-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=jt*kn,ue=ts*jt,$t=ue-(ue-jt),ie=jt-$t,ue=ts*kn,Je=ue-(ue-kn),he=kn-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Po[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Po[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Po[2]=Ae-(Ue-Nt)+(oe-Nt),Po[3]=Ue;const Ji=zf(4,id,4,Po,Zh);on=Cn*Ne,ue=ts*Cn,$t=ue-(ue-Cn),ie=Cn-$t,ue=ts*Ne,Je=ue-(ue-Ne),he=Ne-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=wr*de,ue=ts*wr,$t=ue-(ue-wr),ie=wr-$t,ue=ts*de,Je=ue-(ue-de),he=de-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Po[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Po[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Po[2]=Ae-(Ue-Nt)+(oe-Nt),Po[3]=Ue;const jr=zf(Ji,Zh,4,Po,Om);on=Tt*Ne,ue=ts*Tt,$t=ue-(ue-Tt),ie=Tt-$t,ue=ts*Ne,Je=ue-(ue-Ne),he=Ne-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=jt*de,ue=ts*jt,$t=ue-(ue-jt),ie=jt-$t,ue=ts*de,Je=ue-(ue-de),he=de-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Po[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Po[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Po[2]=Ae-(Ue-Nt)+(oe-Nt),Po[3]=Ue;const Zr=zf(jr,Om,4,Po,Mi);return Mi[Zr-1]}(o,n,e,r,s,u,b)}const ap=Math.pow(2,-52),Jh=new Uint32Array(512);class $h{static from(n,e=Nm,r=Fm){const s=n.length,u=new Float64Array(2*s);for(let h=0;h<s;h++){const f=n[h];u[2*h]=e(f),u[2*h+1]=r(f)}return new $h(u)}constructor(n){const e=n.length>>1;if(e>0&&typeof n[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=n;const r=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),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:n,_hullPrev:e,_hullNext:r,_hullTri:s,_hullHash:u}=this,h=n.length>>1;let f=1/0,y=1/0,b=-1/0,T=-1/0;for(let he=0;he<h;he++){const oe=n[2*he],Ae=n[2*he+1];oe<f&&(f=oe),Ae<y&&(y=Ae),oe>b&&(b=oe),Ae>T&&(T=Ae),this._ids[he]=he}const P=(f+b)/2,j=(y+T)/2;let G,V,K,_t=1/0;for(let he=0;he<h;he++){const oe=rf(P,j,n[2*he],n[2*he+1]);oe<_t&&(G=he,_t=oe)}const Tt=n[2*G],jt=n[2*G+1];_t=1/0;for(let he=0;he<h;he++){if(he===G)continue;const oe=rf(Tt,jt,n[2*he],n[2*he+1]);oe<_t&&oe>0&&(V=he,_t=oe)}let de=n[2*V],Ne=n[2*V+1],Nt=1/0;for(let he=0;he<h;he++){if(he===G||he===V)continue;const oe=lp(Tt,jt,de,Ne,n[2*he],n[2*he+1]);oe<Nt&&(K=he,Nt=oe)}let ue=n[2*K],$t=n[2*K+1];if(Nt===1/0){for(let Ae=0;Ae<h;Ae++)this._dists[Ae]=n[2*Ae]-n[0]||n[2*Ae+1]-n[1];ju(this._ids,this._dists,0,h-1);const he=new Uint32Array(h);let oe=0;for(let Ae=0,nn=-1/0;Ae<h;Ae++){const on=this._ids[Ae];this._dists[on]>nn&&(he[oe++]=on,nn=this._dists[on])}return this.hull=he.subarray(0,oe),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(sp(Tt,jt,de,Ne,ue,$t)<0){const he=V,oe=de,Ae=Ne;V=K,de=ue,Ne=$t,K=he,ue=oe,$t=Ae}const ie=function(he,oe,Ae,nn,on,$n){const nr=Ae-he,$e=nn-oe,Ue=on-he,Cn=$n-oe,kn=nr*nr+$e*$e,wr=Ue*Ue+Cn*Cn,Ar=.5/(nr*Cn-$e*Ue);return{x:he+(Cn*kn-$e*wr)*Ar,y:oe+(nr*wr-Ue*kn)*Ar}}(Tt,jt,de,Ne,ue,$t);this._cx=ie.x,this._cy=ie.y;for(let he=0;he<h;he++)this._dists[he]=rf(n[2*he],n[2*he+1],ie.x,ie.y);ju(this._ids,this._dists,0,h-1),this._hullStart=G;let Je=3;r[G]=e[K]=V,r[V]=e[G]=K,r[K]=e[V]=G,s[G]=0,s[V]=1,s[K]=2,u.fill(-1),u[this._hashKey(Tt,jt)]=G,u[this._hashKey(de,Ne)]=V,u[this._hashKey(ue,$t)]=K,this.trianglesLen=0,this._addTriangle(G,V,K,-1,-1,-1);for(let he,oe,Ae=0;Ae<this._ids.length;Ae++){const nn=this._ids[Ae],on=n[2*nn],$n=n[2*nn+1];if(Ae>0&&Math.abs(on-he)<=ap&&Math.abs($n-oe)<=ap||(he=on,oe=$n,nn===G||nn===V||nn===K))continue;let nr=0;for(let wr=0,Ar=this._hashKey(on,$n);wr<this._hashSize&&(nr=u[(Ar+wr)%this._hashSize],nr===-1||nr===r[nr]);wr++);nr=e[nr];let $e,Ue=nr;for(;$e=r[Ue],sp(on,$n,n[2*Ue],n[2*Ue+1],n[2*$e],n[2*$e+1])>=0;)if(Ue=$e,Ue===nr){Ue=-1;break}if(Ue===-1)continue;let Cn=this._addTriangle(Ue,nn,r[Ue],-1,-1,s[Ue]);s[nn]=this._legalize(Cn+2),s[Ue]=Cn,Je++;let kn=r[Ue];for(;$e=r[kn],sp(on,$n,n[2*kn],n[2*kn+1],n[2*$e],n[2*$e+1])<0;)Cn=this._addTriangle(kn,nn,$e,s[nn],-1,s[kn]),s[nn]=this._legalize(Cn+2),r[kn]=kn,Je--,kn=$e;if(Ue===nr)for(;$e=e[Ue],sp(on,$n,n[2*$e],n[2*$e+1],n[2*Ue],n[2*Ue+1])<0;)Cn=this._addTriangle($e,nn,Ue,-1,s[Ue],s[$e]),this._legalize(Cn+2),s[$e]=Cn,r[Ue]=Ue,Je--,Ue=$e;this._hullStart=e[nn]=Ue,r[Ue]=e[kn]=nn,r[nn]=kn,u[this._hashKey(on,$n)]=nn,u[this._hashKey(n[2*Ue],n[2*Ue+1])]=Ue}this.hull=new Uint32Array(Je);for(let he=0,oe=this._hullStart;he<Je;he++)this.hull[he]=oe,oe=r[oe];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(n,e){return Math.floor(function(r,s){const u=r/(Math.abs(r)+Math.abs(s));return(s>0?3-u:1+u)/4}(n-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(n){const{_triangles:e,_halfedges:r,coords:s}=this;let u=0,h=0;for(;;){const f=r[n],y=n-n%3;if(h=y+(n+2)%3,f===-1){if(u===0)break;n=Jh[--u];continue}const b=f-f%3,T=y+(n+1)%3,P=b+(f+2)%3,j=e[h],G=e[n],V=e[T],K=e[P];if(Dm(s[2*j],s[2*j+1],s[2*G],s[2*G+1],s[2*V],s[2*V+1],s[2*K],s[2*K+1])){e[n]=K,e[f]=j;const _t=r[P];if(_t===-1){let jt=this._hullStart;do{if(this._hullTri[jt]===P){this._hullTri[jt]=n;break}jt=this._hullPrev[jt]}while(jt!==this._hullStart)}this._link(n,_t),this._link(f,r[h]),this._link(h,P);const Tt=b+(f+1)%3;u<Jh.length&&(Jh[u++]=Tt)}else{if(u===0)break;n=Jh[--u]}}return h}_link(n,e){this._halfedges[n]=e,e!==-1&&(this._halfedges[e]=n)}_addTriangle(n,e,r,s,u,h){const f=this.trianglesLen;return this._triangles[f]=n,this._triangles[f+1]=e,this._triangles[f+2]=r,this._link(f,s),this._link(f+1,u),this._link(f+2,h),this.trianglesLen+=3,f}}function rf(o,n,e,r){const s=o-e,u=n-r;return s*s+u*u}function Dm(o,n,e,r,s,u,h,f){const y=o-h,b=n-f,T=e-h,P=r-f,j=s-h,G=u-f,V=T*T+P*P,K=j*j+G*G;return y*(P*K-V*G)-b*(T*K-V*j)+(y*y+b*b)*(T*G-P*j)<0}function lp(o,n,e,r,s,u){const h=e-o,f=r-n,y=s-o,b=u-n,T=h*h+f*f,P=y*y+b*b,j=.5/(h*b-f*y),G=(b*T-f*P)*j,V=(h*P-y*T)*j;return G*G+V*V}function ju(o,n,e,r){if(r-e<=20)for(let s=e+1;s<=r;s++){const u=o[s],h=n[u];let f=s-1;for(;f>=e&&n[o[f]]>h;)o[f+1]=o[f--];o[f+1]=u}else{let s=e+1,u=r;Os(o,e+r>>1,s),n[o[e]]>n[o[r]]&&Os(o,e,r),n[o[s]]>n[o[r]]&&Os(o,s,r),n[o[e]]>n[o[s]]&&Os(o,e,s);const h=o[s],f=n[h];for(;;){do s++;while(n[o[s]]<f);do u--;while(n[o[u]]>f);if(u<s)break;Os(o,s,u)}o[e+1]=o[u],o[u]=h,r-s+1>=u-e?(ju(o,n,s,r),ju(o,n,e,u-1)):(ju(o,n,e,u-1),ju(o,n,s,r))}}function Os(o,n,e){const r=o[n];o[n]=o[e],o[e]=r}function Nm(o){return o[0]}function Fm(o){return o[1]}function el(o,n,e){return o.fillType==="solidFill"?function(r,s,u){const h=new ps,[f,y]=Bu(r.color);return h.beginFill(f,y),h.drawRect(0,0,s,u),h.endFill(),h}(o,n,e):o.fillType==="gradientFill"?function(r,s,u){let h=null;const f=new Ri;if(r.stopList.sort((b,T)=>b.pos-T.pos),!r.stopList.find(b=>b.pos===0)){const b=r.stopList[0];r.stopList.unshift({pos:0,color:b.color})}if(!r.stopList.find(b=>b.pos===1)){const b=r.stopList[r.stopList.length-1];r.stopList.push({pos:1,color:b.color})}const y=b=>{const T=[];for(let P=0,j=b.length;P<j-1;P++){const G=b[P],V=b[P+1],K=G.pos+.5*(V.pos-G.pos),_t=ku(G.color,V.color,.5),Tt=2*P;T[Tt]=G,T[Tt+1]={color:_t,pos:K},T[Tt+2]=V}return T};if(r.stopList=y(r.stopList),r.stopList=y(r.stopList),h=r.line?Bm(r,s,u):r.path?function(b,T,P){var j,G,V;const K=[],_t={x:0,y:0};if(((j=b.path)===null||j===void 0?void 0:j.path)==="circle"||((G=b.path)===null||G===void 0?void 0:G.path)==="rect"||((V=b.path)===null||V===void 0?void 0:V.path)==="shape"){const Tt=T/2,jt=P/2,de=Math.sqrt(Tt*Tt+jt*jt);b.stopList.forEach(Ne=>{if(Ne.pos===0)K.push({point:{x:0,y:0},color:Ne.color});else{const Nt=de*Ne.pos,ue=new _a.Path;ue.absellipse(0,0,Nt,Nt,0,2*Math.PI,!1,0),ue.getPoints(50).forEach($t=>{K.push({point:{x:$t.x,y:$t.y},color:Ne.color})})}_t.x=Tt,_t.y=jt})}return{points:K,position:_t}}(r,s,u):Bm(r,s,u),h){const b=[],T=[],{position:P,points:j}=h,G=$h.from(j,jt=>jt.point.x,jt=>jt.point.y);for(let jt=0;jt<G.triangles.length;jt+=3)b.push(j[G.triangles[jt]].point.x,j[G.triangles[jt]].point.y),b.push(j[G.triangles[jt+1]].point.x,j[G.triangles[jt+1]].point.y),b.push(j[G.triangles[jt+2]].point.x,j[G.triangles[jt+2]].point.y),T.push(...Rs(j[G.triangles[jt]].color)),T.push(...Rs(j[G.triangles[jt+1]].color)),T.push(...Rs(j[G.triangles[jt+2]].color));const V=new ka;V.addAttribute("aVertexPosition",b,2),V.addAttribute("aColor",T,4);const K=Bo.from(`
|
|
5891
|
+
`,{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF"}set color(n){this.currentColor=n;const e=Rs(n);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const zh=new ai.ColorMatrixFilter;zh.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const jh=new ai.ColorMatrixFilter;jh.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const tp=new ai.ColorMatrixFilter;tp.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const Vh=new ai.ColorMatrixFilter;Vh.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const ep={darken:zh,darkenLess:jh,lightenLess:Vh,lighten:tp};var np=S(2),Gu=S.n(np);class rp{constructor(n){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=n.id,this.type=n.type,this.heightSize=n.heightSize,this.widthSize=n.widthSize,this.fillStyle=n.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=n.lineWidth||1,this.position=n.position||{x:0,y:0},this.rotate=n.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"arrow":case"stealth":case"triangle":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+Gu()(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 qc extends Hh{constructor(n,e,r){super({position:{x:n.x,y:n.y},width:n.width,height:n.height},e,r),this.fillColorFilter=new Uu,this.fill=new iu(this),this.json=n,this.ctx=e,this.parentGlobalPos=r,this.global={x:r.x+n.x,y:r.y+n.y},this.updateTransform({position:{x:n.x,y:n.y},width:n.width,height:n.height})}get fillActive(){var n,e;return((e=(n=this.container.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set fillActive(n){var e,r;n?((r=(e=this.container.filters)===null||e===void 0?void 0:e.indexOf(this.fillColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(n){const e=n*this.ctx.stageWidth-this.global.x,r=this.presetSubType===544?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*r}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(n){const e=n*this.ctx.stageHeight-this.global.y,r=this.presetSubType===544?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*r}get design_ppt_x(){return Cs(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return Cs(this.global.y/this.ctx.stageHeight)}}var Yc=S(9),no=S.n(Yc);function Is(){return Date.now().toString(32)+Math.random().toString(32).substring(2)}function Zc(o){const n=[],e=o.filter(y=>{const b=y.width<2048&&y.height<2048;return b||n.push(y),b}).sort((y,b)=>y.width*y.height-b.width*b.height);let r=e.length+1,s=2050,u=2050;const h=[];let f=null;for(;(s>2048||u>2048)&&e.length>0;)r-=1,f=no()(e.slice(0,r)),s=f.width,u=f.height;return f&&h.push(f),n.forEach(y=>{const b=no()([y]);h.push(b)}),r<e.length?h.concat(Zc(e.slice(r))):h}function Kp(o,n,e){let r,s,u=n,h=e;u===0&&(u=h/1e4),h===0&&(h=u/1e4);const f=o%360;if(f%180==0)r=Math.cos(f*(Math.PI/180))*u,s=0;else if(f%90==0)r=0,s=-Math.sin(f*(Math.PI/180))*h;else{const y=Math.tan(f*Math.PI/180);r=u*h/Math.sqrt(Math.pow(h,2)+Math.pow(u*y,2)),(f>90&&f<270||f<-90&&f>-270)&&(r=-r),s=-y*r}return{x:r,y:s}}function Hu(o,n,e,r,s,u,h){const f={x:0,y:0},y=-u,b=Kp((s=-s)/Math.PI*180,e,r),T=o.x-b.x,P=o.y-b.y;for(let j=0;j<51;j++){const G=Kp((s+j/50*y)/Math.PI*180,e,r);G.x+=T,G.y+=P,j/50==1&&(f.x=G.x,f.y=G.y),G.x=G.x/9525*n.x,G.y=G.y/9525*n.y,h.lineTo(G.x,G.y)}return f}class Jc{constructor(n,e,r,s){this.renderContainer=new Ri,this.ctx=n,this.type=e,this.lineWidth=r,this.width=s}createPaths(){if(this.type==="ww")return null;{const n=`M 0,0 L ${9525*this.width},0`;return{paths:[{id:Is(),path:n,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:Gu()(n)}],width:this.width,height:this.lineWidth}}}preRender(){const n=this.createPaths();if(n){const{paths:e,width:r,height:s}=n,u=e.reduce((h,f)=>h+f.hash,"");this.ghcTextureId=this.ctx.graphicsTexture.addGraphics(e,u,{x:0,y:0},r,s,{width:this.lineWidth},!1)}}render(){if(this.ghcTextureId){const n=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);n&&(this.sprite=new Nr,this.sprite.pivot.x=n.pivot.x,this.sprite.texture=n.texture)}}destroy(){console.log("")}}var Qp=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class $c extends qc{constructor(n,e,r){super(n,e,r),this.fillMaskSprite=new Nr,this.fillSprite=new Nr,this.strokeMaskSprite=new Nr,this.strokeSprite=new Nr,this.textureContainer=new Ri,this.underline=null;const{underLine:s,lineHeight:u,width:h}=this.json;s&&(this.underline=new Jc(e,s.type,u/16,h))}getIterateEntry(){return null}getBgElement(){return null}updateTransform(n){var e,r,s,u;const{isHorz:h}=this.json;n.position={x:h&&(r=(e=n.position)===null||e===void 0?void 0:e.x)!==null&&r!==void 0?r:0,y:h?0:(u=(s=n.position)===null||s===void 0?void 0:s.y)!==null&&u!==void 0?u:0},n.width=h?this.json.width:this.json.lineWidth,n.height=h?this.json.lineHeight:this.json.height,super.updateTransform(n)}preRender(){const{fill:n,stroke:e,lineWidth:r,lineHeight:s,content:u}=this.json;n&&(this.fillTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:n.key,filters:[{type:"changeBulletColor",args:["#000000","#FFA500"]}]},n.width,n.height,void 0,u==="\u25FE"),n.fill&&n.fill.fillType!=="noFill"&&(this.fillBgId=this.ctx.fillTexture.addFill(n.fill,r,s))),e&&(this.strokeTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:e.key,filters:[]},e.width,e.height),e.fill&&e.fill.fillType!=="noFill"&&(this.strokeBgId=this.ctx.fillTexture.addFill(e.fill,r,s))),this.underline&&this.underline.preRender()}render(){var n;return Qp(this,void 0,void 0,function*(){const{lineWidth:e,lineHeight:r,baseLine:s,isHorz:u,height:h,width:f,highlightColor:y,x:b,y:T,content:P}=this.json;if(y){const V=new ps,[K,_t]=Bu(y);V.beginFill(K,_t),V.drawRect(0,0,u?f:e,u?r:h),V.endFill(),this.textureContainer.addChild(V)}if(this.fillBgId&&this.fillTextureId){const V=this.ctx.fillTexture.getTexture(this.fillTextureId);(V==null?void 0:V.texture)&&(this.fillMaskSprite.texture=V.texture,this.fillMaskSprite.scale.x=.5,this.fillMaskSprite.scale.y=.5);const K=this.ctx.fillTexture.getTexture(this.fillBgId);K.texture&&(this.fillSprite.texture=K.texture,this.fillSprite.mask=this.fillMaskSprite,this.fillSprite.addChild(this.fillMaskSprite),u?this.fillSprite.position.y=T:this.fillSprite.position.x=b,this.textureContainer.addChild(this.fillSprite))}if(this.strokeBgId&&this.strokeTextureId){const V=this.ctx.fillTexture.getTexture(this.strokeTextureId);(V==null?void 0:V.texture)&&(this.strokeMaskSprite.texture=V.texture,this.strokeMaskSprite.scale.x=.5,this.strokeMaskSprite.scale.y=.5);const K=this.ctx.fillTexture.getTexture(this.strokeBgId);(K==null?void 0:K.texture)&&(this.strokeSprite.texture=K.texture,this.strokeSprite.mask=this.strokeMaskSprite,this.strokeSprite.addChild(this.strokeMaskSprite),u?this.strokeSprite.position.y=T:this.strokeSprite.position.x=b,this.textureContainer.addChild(this.strokeSprite))}if(this.underline&&(this.underline.render(),this.underline.sprite&&this.fillMaskSprite)){let V=null;this.fillBgId&&(V=this.ctx.fillTexture.getTexture(this.fillBgId)),this.underline.sprite.position.y=s,this.underline.sprite.position.x=0;const K=new Nr;K.texture=(n=V==null?void 0:V.texture)!==null&&n!==void 0?n:null,K.mask=this.underline.sprite,K.addChild(this.underline.sprite),this.textureContainer.addChild(K)}const j=Li.create({width:u?f:e,height:u?r:h,resolution:2});this.ctx.renderer.render(this.textureContainer,{renderTexture:j});const G=new Nr;G.texture=j,this.container.addChild(G),this.container.name=P})}destroy(){this.textureContainer.destroy({texture:!0}),this.container.destroy({children:!0,texture:!0})}}var Wh=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Kc extends qc{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(n,e,r){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}preRender(){for(let n=0,e=this.json.textUnits.length;n<e;n++){const r=this.json.textUnits[n];if(!r.content)continue;const{height:s,width:u,baseline:h}=this.json,f=new $c(Object.assign(Object.assign({},r),{lineHeight:s,lineWidth:u,baseLine:h,isHorz:this.isHorz}),this.ctx,this.global);f.preRender(),this.units.push(f)}}render(){return Wh(this,void 0,void 0,function*(){for(const n of this.units.reverse())yield n.render(),this.container.addChild(n.container)})}destroy(){this.units.forEach(n=>{n.destroy()}),this.container.destroy({children:!1})}}var ro=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class tf extends qc{constructor(){super(...arguments),this.iterateElements=[],this.lines=[],this.isHorz=!0}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const n=this.lines.reduce((e,r)=>e=e.concat(r.getIterateElements()),[]);return this.iterateElements=n,n}getIterateEntry(n,e,r){const s=this.getIterateElements();return s[e]?s[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}preRender(){for(let n=0,e=this.json.lines.length;n<e;n++){const r=this.json.lines[n],s=new Kc(r,this.ctx,this.global);s.isHorz=this.isHorz,s.container.name="line-"+n,s.preRender(),this.lines.push(s)}}render(){return ro(this,void 0,void 0,function*(){for(const n of this.lines)yield n.render(),this.container.addChild(n.container)})}destroy(){this.lines.forEach(n=>{n.destroy()}),this.container.destroy({children:!1})}}var Qc=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class td{constructor(n,e,r,s){this.iterateElements=[],this.paragraphs=[],this.container=new Ri,this.json=n,this.ctx=e,this.parentGlobalPos=s,this.iterateType=r,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+n.position.x,y:this.parentGlobalPos.y+n.position.y},this.container.position.x=n.position.x,this.container.position.y=n.position.y,this.container.scale.x=n.scale.x,this.container.scale.y=n.scale.y;const u=new ps;u.drawRect(0,0,n.width,n.height),this.container.addChild(u)}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(n,e){return n==="paragraph"?this.paragraphs[e[0]]:null}getIterateEntry(n,e){return this.iterateElements[n]?this.iterateElements[n]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(n=>{n.destroy()})}preRender(){var n;for(let e=0,r=this.json.paragraphs.length;e<r;e++){const s=this.json.paragraphs[e],u=new tf(s,this.ctx,this.global);u.isHorz=(n=this.json.isHorz)===null||n===void 0||n,u.preRender(),this.iterateElements=this.iterateElements.concat(u.getIterateElements()),u.container.name="\u6BB5\u843D-"+e,this.paragraphs.push(u)}}render(){return Qc(this,void 0,void 0,function*(){for(const e of this.paragraphs)yield e.render(),this.container.addChild(e.container);const{width:n}=this.container;this.container.scale.x<0&&(this.container.x+=-1*n)})}}var ip=S(19),ed=S.n(ip),$a=S(20),ef=S.n($a);const nd={Reflection:class extends ko{constructor(o){super(ed.a,ef.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uStartAlpha:o.startAlpha,uEndAlpha:o.endAlpha,uBlur:0}),this.json=o}}};var io=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};const ou={pivot:{x:0,y:0},width:0,height:0};class Tl extends Hh{constructor(n,e,r){var s,u,h;super(n,e,r),this.renderContainer=new Ri,this.bgTextureId="",this.bgSprite=new Nr,this.backgroundMaskTextureId="",this.filterAreaJustifies=[],this.backgroundMask=new Nr,this.pathStrokeTextureId="",this.pathSprite=new Nr,this.pathMask=new Nr,this.pathMaskTextureId="",this.fillColorFilter=new Uu,this.strokeColorFilter=new Uu,this.id="",this.arrowList=[],this.fill=new iu(this),this.stroke=new ri(this),this.updateFilterArea=()=>{const f=this.renderContainer.getBounds(!1),y=this.filterAreaJustifies.map(j=>j(f)),b=y.map(j=>j.width),T=y.map(j=>j.height),P=new dr(f.x,f.y,Math.max(...b),Math.max(...T));this.renderContainer.filterArea=P,this.renderContainer.filters.forEach(j=>{j.uniforms.uShapeFilterArea=new Float32Array(4),j.uniforms.uShapeFilterArea[0]=P.x,j.uniforms.uShapeFilterArea[1]=P.y,j.uniforms.uShapeFilterArea[2]=P.width,j.uniforms.uShapeFilterArea[3]=P.height})},this.json=n,this.id=n.id,this.container.name=n.id,this.renderContainer.name=n.id+"-render-container",this.fillStyle=n.fillStyle,this.lineStyle=n.lineStyle,this.geometry=n.geometry,this.ctx.timingTargets.addTarget(this.id,this),((s=this.fillStyle)===null||s===void 0?void 0:s.fillType)==="solidFill"&&(this.fillColorFilter.currentColor=this.fillStyle.color),((h=(u=this.lineStyle)===null||u===void 0?void 0:u.fill)===null||h===void 0?void 0:h.fillType)==="solidFill"&&(this.strokeColorFilter.currentColor=this.lineStyle.fill.color),this.pathSprite.name="path-fill",this.pathMask.name="path-mask",this.bgSprite.name="bg-fill",this.backgroundMask.name="bg-mask",this.updateTransform(this.json),n.textBody&&(this.text=new td(n.textBody,this.ctx,n.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new vc(1,1,this.json.width,this.json.height)}get interactiveContainer(){return this.renderContainer}get strokeActive(){var n,e;return((e=(n=this.pathSprite.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set strokeActive(n){var e,r;n?((r=(e=this.pathSprite.filters)===null||e===void 0?void 0:e.indexOf(this.strokeColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.pathSprite.filters=[this.strokeColorFilter]):this.pathSprite.filters=[]}get fillActive(){var n,e;return((e=(n=this.bgSprite.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set fillActive(n){var e,r;n?((r=(e=this.bgSprite.filters)===null||e===void 0?void 0:e.indexOf(this.fillColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.bgSprite.filters=[this.fillColorFilter]):this.bgSprite.filters=[]}getTextElement(n,e){var r,s;return(s=(r=this.text)===null||r===void 0?void 0:r.getTextElement(n,e))!==null&&s!==void 0?s:null}getBgElement(){return this}getIterateEntry(n,e,r){return n==="el"||e===0?this:this.text?this.text.getIterateEntry(e-1,r)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}createBackgroundMask(){return io(this,void 0,void 0,function*(){const n=this.ctx.graphicsTexture.getGraphicsData(this.backgroundMaskTextureId);n&&(this.backgroundMask.texture=n.texture,this.backgroundMask.pivot.x=n.pivot.x,this.backgroundMask.pivot.y=n.pivot.y)})}createBackground(){var n,e,r,s,u,h,f,y,b;const{pivot:T,width:P,height:j}=((n=this.geometry)===null||n===void 0?void 0:n.fillTransform)||ou;if(this.json.useBgFill&&this.ctx.bgTexture)return this.bgSprite.texture=this.ctx.bgTexture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.bgSprite.pivot.x=((e=this.json.position)===null||e===void 0?void 0:e.x)||0,void(this.bgSprite.pivot.y=((r=this.json.position)===null||r===void 0?void 0:r.y)||0);if(((s=this.fillStyle)===null||s===void 0?void 0:s.fillType)==="gifFill"){const G=this.ctx.fillTexture.getGifFrames(this.fillStyle.src),V=G.map((Tt,jt)=>({texture:Tt,time:this.fillStyle.delays[jt]||20}));this.bgSprite=new wl(V,!0),this.bgSprite.play();let K=1;const _t=this.fillStyle.loop;this.bgSprite.onLoop=()=>{K+=1,_t>0&&K>_t&&this.bgSprite.gotoAndStop(G.length-1)},this.bgSprite.height=j||this.designHeight,this.bgSprite.width=P||this.designWidth,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite)}else if(((u=this.fillStyle)===null||u===void 0?void 0:u.fillType)==="groupFill"){if(this.groupFillTextureId){const G=this.ctx.fillTexture.getTexture(this.groupFillTextureId);G.texture&&(this.bgSprite.texture=G.texture,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=-1*((f=(h=this.json.position)===null||h===void 0?void 0:h.x)!==null&&f!==void 0?f:0),this.bgSprite.y=-1*((b=(y=this.json.position)===null||y===void 0?void 0:y.y)!==null&&b!==void 0?b:0),this.container.addChild(this.bgSprite),this.container.addChild(this.backgroundMask))}}else{const G=this.ctx.fillTexture.getTexture(this.bgTextureId);G.texture&&(this.bgSprite.texture=G.texture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.bgSprite.pivot.x=G.pivot.x,this.bgSprite.pivot.y=G.pivot.y)}}createPathFill(){const n=this.ctx.fillTexture.getTexture(this.pathStrokeTextureId);n.texture&&(this.pathSprite.texture=n.texture,this.pathSprite.pivot.x=this.pathMask.pivot.x,this.pathSprite.pivot.y=this.pathMask.pivot.y,this.pathMask.pivot.x=0,this.pathMask.pivot.y=0,this.pathSprite.mask=this.pathMask,this.pathSprite.addChild(this.pathMask),this.container.addChild(this.pathSprite))}createPathMask(){return io(this,void 0,void 0,function*(){const n=this.ctx.graphicsTexture.getGraphicsData(this.pathMaskTextureId);if(n){const{texture:e,pivot:r}=n;this.pathMask.texture=e,this.pathMask.pivot.x=r.x,this.pathMask.pivot.y=r.y,this.pathMask.texture=e}})}createFilledPathMask(){var n,e;return io(this,void 0,void 0,function*(){const r=((e=(n=this.geometry)===null||n===void 0?void 0:n.paths)===null||e===void 0?void 0:e.filter(s=>s.fill!=="none"&&s.fill!=="norm"))||[];for(const s of r){const u=this.ctx.graphicsTexture.getGraphicsData(s.id);if(u){const h=new Nr(u.texture);h.pivot.x=u.pivot.x,h.pivot.y=u.pivot.y;const f=new Nr(this.bgSprite.texture);f.pivot.x=this.bgSprite.pivot.x,f.pivot.y=this.bgSprite.pivot.y,f.mask=h,f.filters=[ep[s.fill]],this.container.addChild(f),this.container.addChild(h)}}})}createBackgroundTexture(){var n,e,r,s,u;if(this.fillStyle&&this.fillStyle.fillType!=="gifFill"&&this.fillStyle.fillType!=="groupFill"){const h=((n=this.geometry)===null||n===void 0?void 0:n.fillTransform)||ou,f=(h==null?void 0:h.width)||this.designWidth,y=(h==null?void 0:h.height)||this.designHeight;this.bgTextureId=this.ctx.fillTexture.addFill(this.fillStyle,f+((r=(e=this.lineStyle)===null||e===void 0?void 0:e.width)!==null&&r!==void 0?r:0),y+((u=(s=this.lineStyle)===null||s===void 0?void 0:s.width)!==null&&u!==void 0?u:0))}}createPathFillTexture(){var n,e;if(((n=this.lineStyle)===null||n===void 0?void 0:n.fill)&&this.lineStyle.fill.fillType!=="gifFill"&&this.lineStyle.fill.fillType!=="groupFill"){const{width:r,height:s}=((e=this.geometry)===null||e===void 0?void 0:e.lineTransform)||ou,u=Object(W.isNumber)(this.lineStyle.width)?this.lineStyle.width:1;this.pathStrokeTextureId=this.ctx.fillTexture.addFill(this.lineStyle.fill,(r||this.designWidth)+u,(s||this.designHeight)+u)}}createArrowFillTexture(){var n;(n=this.json.lineArrowList)===null||n===void 0||n.forEach(e=>{var r,s,u,h;const f=new rp(Object.assign(Object.assign({},e),{fillStyle:(r=this.lineStyle)===null||r===void 0?void 0:r.fill,lineWidth:(u=(s=this.lineStyle)===null||s===void 0?void 0:s.width)!==null&&u!==void 0?u:0}));f.graphicsId=this.ctx.graphicsTexture.addGraphics((h=f.paths)!==null&&h!==void 0?h:[],f.hash,f.pivot||{x:0,y:0},f.width,f.height,void 0,!0),f.textureId=this.ctx.fillTexture.addFill(f.fillStyle,f.width,f.height),this.arrowList.push(f)})}createArrow(){this.arrowList.forEach(n=>{const e=this.ctx.graphicsTexture.getGraphicsData(n.graphicsId),r=this.ctx.fillTexture.getTexture(n.textureId);if(e&&r.texture){const{texture:s,pivot:u}=e,h=new Nr(s);h.pivot.x=u.x,h.pivot.y=u.y;const f=new Nr(r.texture);f.addChild(h),f.mask=h,f.position.x=n.position.x,f.position.y=n.position.y,f.pivot.x=n.pivot.x+r.pivot.x,f.pivot.y=n.pivot.y+r.pivot.y,f.rotation=n.rotate/180*Math.PI,n.sprite=f,this.container.addChild(f)}})}preRender(){var n,e,r,s,u,h,f,y,b,T;this.createBackgroundTexture(),this.createPathFillTexture(),this.createArrowFillTexture();const{width:P,height:j,pivot:G}=((n=this.geometry)===null||n===void 0?void 0:n.lineTransform)||ou,V=P||this.designWidth,K=j||this.designHeight;((e=this.geometry)===null||e===void 0?void 0:e.paths)&&this.geometry.paths.length>0&&(this.pathMaskTextureId=this.ctx.graphicsTexture.addGraphics((s=(r=this.geometry)===null||r===void 0?void 0:r.paths)!==null&&s!==void 0?s:[],this.geometry.hash,G||{x:0,y:0},V,K,this.lineStyle,!1),this.backgroundMaskTextureId=this.ctx.graphicsTexture.addGraphics((h=(u=this.geometry)===null||u===void 0?void 0:u.paths)!==null&&h!==void 0?h:[],this.geometry.hash,G||{x:0,y:0},V,K,this.lineStyle,!0));const _t=((y=(f=this.geometry)===null||f===void 0?void 0:f.paths)===null||y===void 0?void 0:y.filter(Tt=>Tt.fill!=="none"&&Tt.fill!=="norm"))||[];for(const Tt of _t)this.ctx.graphicsTexture.addGraphics([Tt],Tt.hash,(((b=this.geometry)===null||b===void 0?void 0:b.lineTransform)||ou).pivot,V,K,this.lineStyle,!0,Tt.id);(T=this.text)===null||T===void 0||T.preRender()}subClassRender(){return io(this,void 0,void 0,function*(){})}setupEffect(){const{effectList:n}=this.json;if(n&&n.length>0){const e=[];return n.forEach(r=>{r.type==="reflection"&&(this.filterAreaJustifies.push(s=>(s.height*=2,s)),e.push(new nd.Reflection(r)))}),this.ctx.ticker.add(this.updateFilterArea,void 0,-20),this.renderContainer.filters=e,!0}return!1}render(){var n,e,r,s,u,h;return io(this,void 0,void 0,function*(){if(yield this.createBackgroundMask(),yield this.createBackground(),yield this.subClassRender(),yield this.createFilledPathMask(),yield this.createPathMask(),yield this.createPathFill(),yield this.createArrow(),this.text&&(yield this.text.render()),((n=this.json.textBody)===null||n===void 0?void 0:n.iterateType)==="wd"||((e=this.json.textBody)===null||e===void 0?void 0:e.iterateType)==="lt")this.renderContainer.addChild(this.container),this.text&&(this.text.container.position.x=((s=(r=this.json.position)===null||r===void 0?void 0:r.x)!==null&&s!==void 0?s:0)+this.text.x,this.text.container.position.y=((h=(u=this.json.position)===null||u===void 0?void 0:u.y)!==null&&h!==void 0?h:0)+this.text.y,this.renderContainer.addChild(this.text.container));else{if(this.text){if(Object(W.isBoolean)(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const f=this.json.rotation||0;this.text.container.rotation=-f;const{width:y}=this.text;this.text.container.position.x=y}this.container.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.renderContainer.cacheAsBitmap=!!this.json.cacheAsBitMap,this.json.id==="background"){const f=Li.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:f}),this.ctx.bgTexture=f}})}destroy(){this.bgSprite.destroy(),this.backgroundMask.destroy(),this.pathSprite.destroy(),this.pathMask.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.arrowList.forEach(n=>{var e;(e=n.sprite)===null||e===void 0||e.destroy()})}}var c=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};function g(o,n){for(const e in n)o.style[e]=n[e]}class E{constructor(n){var e,r;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.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=s=>{s.stopPropagation();const u=s.offsetX/this.progress.clientWidth*this.duration;this.jumpToTime(u),this.medianIsEnd=!1,this.ctx.eventHub.emit(Pn.mediaSeek,{id:this.targetId,time:this.media.currentTime-this.start,isPlaying:this.media.isPlaying})},this.jumpToTime=(s=0)=>{const u=Math.floor(s)+this.start;this.media.currentTime!==u&&(this.media.currentTime=u,(this.media.paused||this.media.ended)&&this.ctx.clock.setTimeout(()=>{this.media.play().then(()=>this.media.pause())},16))},this.showController=s=>{s.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=E.formatTime(this.duration)},this.playMedia=()=>c(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(s=>{s()})}),this.pauseMedia=()=>c(this,void 0,void 0,function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()}),this.onMouseOut=s=>{s.stopPropagation(),this.mediaController.style.display="none"},this.mediaTimeUpdate=()=>c(this,void 0,void 0,function*(){const s=this.media.currentTime-this.start;this.duration>0&&(s>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=E.formatTime(s),this.currentProgress.style.flex=(s/this.duration).toString()}),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(s=>{s()})},this.playMediaFromCtrl=()=>{this.ctx.eventHub.emit(Pn.mediaPlay,{id:this.targetId,time:this.media.currentTime}),this.playMedia()},this.pauseMediaFromCtrl=()=>{this.ctx.eventHub.emit(Pn.mediaPause,{id:this.targetId,time:this.media.currentTime}),this.pauseMedia()},this.targetId=n.targetId,this.ctx=n.ctx,this.height=n.height,this.width=n.width,this.sprite=n.sprite,this.media=n.media,this.info=n.info,this.canvasElement=n.canvasElement,this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=(e=this.info.cut.start)!==null&&e!==void 0?e:0,this.end=(r=this.info.cut.end)!==null&&r!==void 0?r:0)}getMedianContainer(){var n;let e=(n=this.canvasElement.parentElement)===null||n===void 0?void 0:n.querySelector(".median-container");e||(e=document.createElement("div"),e.className="median-container",this.canvasElement.parentElement.appendChild(e)),this.container=e}static formatTime(n){let e="00:00";if(n){const r=Math.floor(n/60),s=String(r<0?0:r).padStart(2,"0"),u=Math.floor(n%60);e=`${s}:${String(u<0?0:u).padStart(2,"0")}`}return e}createButton(){const n={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};g(this.playButton,Object.assign(Object.assign({},n),{display:"block"}));const e=document.createElement("img");g(e,{height:"20px"}),e.src="https://convertcdn.netless.link/publicFiles/icon/play.png",this.playButton.appendChild(e),g(this.pauseButton,Object.assign(Object.assign({},n),{display:"none"}));const r=document.createElement("img");g(r,{height:"20px"}),r.src="https://convertcdn.netless.link/publicFiles/icon/pause.png",this.pauseButton.appendChild(r)}createTimer(){const n=document.createElement("div");g(n,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",n.append(this.currentTime,e,this.totalTime),n}createProgress(){g(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const n=document.createElement("div");g(n,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(n),g(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),n.appendChild(this.currentProgress)}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 n;const{sprite:e}=this,{stageWidth:r,stageHeight:s}=this.ctx,u=e.getGlobalPosition(),h=1/Number((n=this.container)===null||n===void 0?void 0:n.getAttribute("data-scale"));u.y=u.y+this.height-50,u.x=Math.max(u.x,0),u.x=Math.min(u.x,r-300*h),u.y=Math.max(u.y,0),u.y=Math.min(u.y,s-50),g(this.mediaController,{height:"50px",borderRadius:"25px",width:"300px",flexDirection:"row",alignItems:"center",position:"absolute",left:u.x+"px",top:u.y+"px",display:"none",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${h})`,transformOrigin:"0 100%"})}createMediaController(){this.setControllerPosition(),this.createButton();const n=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,n,this.progress),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(n){this.playCallBackList.push(n)}unbindEvent(){this.mediaController.removeEventListener("mouseover",this.showController,!1),this.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",()=>this.playMedia(),!1),this.pauseButton.removeEventListener("click",()=>this.pauseMedia(),!1),this.media.removeListener("durationchange",this.getMediaDuration,!1),this.media.removeListener("timeupdate",this.mediaTimeUpdate,!1),this.media.removeListener("pause",this.onPauseMedia,!1),this.media.removeListener("play",this.onPlayMedia,!1)}show(){this.setControllerPosition(),this.mediaController.style.display="flex"}hide(){this.mediaController.style.display="none"}destroy(){var n;this.unbindEvent(),this.playCallBackList=[],(n=this.container)===null||n===void 0||n.removeChild(this.mediaController)}}var N=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class q extends J.a{constructor(n){var e,r;super(),this.type="video",this.sprite=new Nr,this.isPlaying=!1,this.id=n.id,this.video=n.video,this.start=(e=n.video.cut)===null||e===void 0?void 0:e.start,this.end=(r=n.video.cut)===null||r===void 0?void 0:r.end,this.container=n.container,this.ctx=n.ctx,this.ctx.medias[this.id]=this,this.videoResource=new hl(this.video.src,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});const{video:s,width:u,height:h,sprite:f}=n;this.controller=new E({targetId:n.id,ctx:n.ctx,width:u,height:h,sprite:f,media:this,info:s,canvasElement:n.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=u,this.sprite.height=h,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const y=new Jn(null,{height:h,width:u});y.resource=this.videoResource,this.videoResource.bind(y),this.sprite=new Nr,this.sprite.visible=!1,this.sprite.texture=new qn(y),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",b=>{b.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",b=>{b.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(b=>{this.videoResource.source.addEventListener(b,()=>{b!=="timeupdate"||this.isPlaying||this.pause(),this.emit(b)})})}get currentTime(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.currentTime)!==null&&e!==void 0?e:0}set currentTime(n){this.videoResource.source&&(this.videoResource.source.currentTime=n)}get paused(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.paused)===null||e===void 0||e}get ended(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.ended)===null||e===void 0||e}get duration(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.duration)!==null&&e!==void 0?e:0}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){var n;return N(this,void 0,void 0,function*(){this.isPlaying=!0,yield this.load(),yield this.ctx.clock.waitUntil(()=>{const r=this.videoResource.source;return!!(r&&r.videoWidth>0)},3e3);const e=this.videoResource.source;e&&e.videoWidth<=0||(yield(n=this.videoResource.source)===null||n===void 0?void 0:n.play())})}load(){return this.videoResource.load()}pause(){var n;this.isPlaying=!1,(n=this.videoResource.source)===null||n===void 0||n.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(n){this.controller.jumpToTime(n)}destroy(){var n;this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),(n=this.videoResource)===null||n===void 0||n.destroy(),this.controller.destroy()}}var dt=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Mt extends J.a{constructor(n){super(),this.type="audio",this.isPlaying=!1,this.id=n.id,this.audio=n.audio,this.container=n.container,this.container=n.container,this.audioEl=document.createElement("audio"),this.audioEl.src=this.audio.src,n.audio.cut&&(this.start=n.audio.cut.start,this.end=n.audio.cut.end),this.ctx=n.ctx,this.ctx.medias[this.id]=this;const{width:e,height:r,sprite:s}=n;this.controller=new E({targetId:n.id,ctx:n.ctx,height:r,width:e,sprite:s,media:this,info:this.audio,canvasElement:n.canvasElement}),["durationchange","timeupdate","pause","play"].forEach(u=>{this.audioEl.addEventListener(u,()=>{this.emit(u)})})}get currentTime(){return this.audioEl.currentTime}set currentTime(n){this.audioEl.currentTime=n}get paused(){return this.audioEl.paused}get ended(){return this.audioEl.ended}get duration(){return this.audioEl.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return dt(this,void 0,void 0,function*(){this.isPlaying=!0;try{yield this.audioEl.play()}catch{console.debug("[PPT Player]: refuse to play()")}})}pause(){this.isPlaying=!1,this.audioEl.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(n){this.controller.jumpToTime(n)}destroy(){this.audioEl.pause(),this.controller.destroy()}}var Lt=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class qt extends Tl{constructor(n,e,r){super(Object.assign(Object.assign({},n),{type:"Shape",useBgFill:!1,textRotateWithShape:!0}),e,r),this.picTextureId="",this.picSprite=new Nr,this.picMask=new Nr,this.cmd=new yo(this),this.picFill=n.picFill,this.media=n==null?void 0:n.media}applyCommand(n,e){var r,s,u,h,f;if(e==="call")if(/playFrom\(([0-9.]+)\)/.test(n)){const y=n.match(/playFrom\(([0-9.]+)\)/),b=Number(y[1]||"0");(r=this.mediaPlayer)===null||r===void 0||r.play().then(()=>{var T;(T=this.mediaPlayer)===null||T===void 0||T.seek(b)})}else n==="custom-pause"?(s=this.mediaPlayer)===null||s===void 0||s.pause():n==="togglePause"?(u=this.mediaPlayer)===null||u===void 0||u.togglePause():n==="stop"&&((h=this.mediaPlayer)===null||h===void 0||h.pause(),(f=this.mediaPlayer)===null||f===void 0||f.seek(0))}renderPic(){var n,e,r;return Lt(this,void 0,void 0,function*(){const s=this.ctx.fillTexture.getTexture(this.picTextureId);s.texture&&(this.picSprite.texture=s.texture),this.picMask.texture=this.backgroundMask.texture,this.picSprite.mask=this.picMask,this.picSprite.width=this.designWidth,this.picSprite.height=this.designHeight,this.container.addChild(this.picSprite),this.container.addChild(this.picMask),((n=this.media)===null||n===void 0?void 0:n.type)==="video"&&this.media.src?(this.mediaPlayer=new q({id:this.json.id+"-video",ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view}),((e=this.mediaPlayer)===null||e===void 0?void 0:e.sprite)&&(this.mediaPlayer.sprite.mask=this.picMask)):((r=this.media)===null||r===void 0?void 0:r.type)==="audio"&&this.media.src&&(this.mediaPlayer=new Mt({id:this.json.id+"-audio",ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view})),this.mediaPlayer&&(this.picSprite.interactive=!0,this.picSprite.on("mouseover",()=>{this.mediaPlayer.showController()}),this.picSprite.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))})}preRender(){if(super.preRender(),this.picFill.fillType!=="gifFill")this.picTextureId=this.ctx.fillTexture.addFill(this.picFill,this.designWidth,this.designHeight);else{let n=1;const e=this.ctx.fillTexture.getGifFrames(this.picFill.src),r=e.map((u,h)=>({texture:u,time:this.picFill.delays[h]||20}));this.picSprite=new wl(r,!0),this.picSprite.play();const s=this.picFill.loop;this.picSprite.onLoop=()=>{n+=1,s>0&&n>s&&this.picSprite.gotoAndStop(e.length-1)}}}subClassRender(){return Lt(this,void 0,void 0,function*(){yield this.renderPic()})}destroy(){this.mediaPlayer&&(this.picSprite.interactive=!1,this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picSprite.destroy(),this.picMask.destroy()}}var Ee=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class me extends Hh{constructor(n,e,r){var s,u,h,f;super(n,e,r),this.children=[],this.cacheSprite=new Nr,this.json=n,this.container.name=n.id,this.ctx.timingTargets.addTarget(n.id,this);const y={x:(u=(s=n.position)===null||s===void 0?void 0:s.x)!==null&&u!==void 0?u:0,y:(f=(h=n.position)===null||h===void 0?void 0:h.y)!==null&&f!==void 0?f:0};n.children.forEach(b=>{let T=null;(b==null?void 0:b.type)==="Shape"?T=new Tl(b,this.ctx,y):(b==null?void 0:b.type)==="Picture"?T=new qt(b,this.ctx,y):(b==null?void 0:b.type)==="Container"&&(T=new me(b,this.ctx,y)),T&&this.children.push(T)}),this.updateTransform(this.json)}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(){if(this.json.fillStyle)if(this.json.fillStyle.fillType==="groupFill")this.fillTextureId=this.groupFillTextureId;else{const{fillStyle:n,width:e,height:r}=this.json;this.fillTextureId=this.ctx.fillTexture.addFill(n,e,r)}for(const n of this.children)n.groupFillTextureId=this.fillTextureId,n.preRender()}getBgElement(){return null}getIterateEntry(n,e,r){return e===0?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}getTextElement(){return null}render(){var n;return Ee(this,void 0,void 0,function*(){const e=new Ri;for(const r of this.children)yield r.render(),r.renderContainer&&e.addChild(r.renderContainer),(r.json.hlinkHover||r.json.hlinkClick)&&((n=r.hyperlink)===null||n===void 0||n.addProxy(this.container));this.container.addChild(e),this.json.cacheAsTexture&&(function(r,s,u,h){const f=r.getBounds(),y=Math.min(f.x,s.x,f.x+f.width,s.x+s.width),b=Math.max(f.x,s.x,f.x+f.width,s.x+s.width),T=Math.min(f.y,s.y,f.y+f.height,s.y+s.height),P=b-y,j=Math.max(f.y,s.y,f.y+f.height,s.y+s.height)-T,G=s.x-f.x>0?s.x-f.x:0,V=s.y-f.y>0?s.y-f.y:0,K=Li.create({width:P,height:j,resolution:Math.ceil(h.renderer.resolution)});r.position.x=G,r.position.y=V,h.renderer.render(r,{renderTexture:K}),u.texture=K,u.position.x=-G,u.position.y=-V}(e,new dr(this.designX,this.designY,this.designWidth,this.designHeight),this.cacheSprite,this.ctx),this.container.addChild(this.cacheSprite),e.position.x=0,e.position.y=0,e.visible=!1)})}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(n=>n.destroy()),this.container.destroy()}}class De extends J.a{constructor(n,e,r,s){super(),this.cond={},this.timeoutIds=[],this.condHandle=u=>{if(u)if(u.delay&&u.delay>0){const h=this.ctx.clock.setTimeout(()=>{u.event&&(this.cond[u.event]=!0,this.detectTrigger())},u.delay);this.timeoutIds.push(h)}else this.cond[u.event]=!0,this.detectTrigger();else this.detectTrigger()},this.id=n,this.ctx=s,this.eventHubs=r,e.forEach(u=>{this.addCond(u)})}setTriggerParams(n){this.triggerParams=n}addCond(n){const e=()=>this.condHandle(n);n.event&&(/^shape/.test(n.event)||/^time/.test(n.event)?(this.cond[n.event]=!1,this.eventHubs.global.addListener(n.event,e)):/^runtime/.test(n.event)?(this.cond[n.event]=!1,this.eventHubs.runtime.addListener(n.event,e)):/^self/.test(n.event)?n.delay&&n.delay>0&&(this.cond[n.event]=!1,this.eventHubs.runtime.addListener(n.event,e)):this.cond[n.event]=!1)}isTrigger(){return Object.keys(this.cond).every(n=>!!this.cond[n])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(n=>n!=="self").every(n=>!!this.cond[n])}detectTrigger(){if(Object.keys(this.cond).every(n=>!!this.cond[n])){Object.keys(this.cond).forEach(e=>{this.cond[e]=!1});const n=this.triggerParams;this.triggerParams=void 0,this.emit("active",n)}}reset(){Object.keys(this.cond).forEach(n=>{this.cond[n]=!1}),this.timeoutIds.forEach(n=>this.ctx.clock.clearTimeout(n))}}class gn extends J.a{constructor(n){super(),this.runtimeNodeEventHub=new J.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=()=>{var P,j,G,V,K,_t;this.hasPrev()||!this.isMainSeq?this.currentSeqState==="idle"?(this.decrSeqIndex(),(P=this.commonTimeNode.children[this.currentSeqIndex])===null||P===void 0||P.commonTimeNode.seekToStart(),(j=this.commonTimeNode.children[this.currentSeqIndex])===null||j===void 0||j.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.currentSeqState==="running"?((G=this.commonTimeNode.children[this.currentSeqIndex])===null||G===void 0||G.commonTimeNode.seekToStart(),(V=this.commonTimeNode.children[this.currentSeqIndex])===null||V===void 0||V.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.currentSeqState==="end"&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),(K=this.commonTimeNode.children[this.currentSeqIndex])===null||K===void 0||K.commonTimeNode.seekToStart(),(_t=this.commonTimeNode.children[this.currentSeqIndex])===null||_t===void 0||_t.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide")},this.handleNext=()=>{var P,j,G,V;this.hasNext()||!this.isMainSeq?this.currentSeqState==="idle"?(P=this.commonTimeNode.children[this.currentSeqIndex])===null||P===void 0||P.commonTimeNode.startTimeNodeForce():this.currentSeqState==="running"?((j=this.commonTimeNode.children[this.currentSeqIndex])===null||j===void 0||j.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),(G=this.commonTimeNode.children[this.currentSeqIndex])===null||G===void 0||G.commonTimeNode.startTimeNodeForce()):this.currentSeqState==="end"&&(this.incrSeqIndex(),(V=this.commonTimeNode.children[this.currentSeqIndex])===null||V===void 0||V.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide")};const{json:e,iterateType:r,isIterate:s,isSub:u,parent:h,ctx:f,eventHub:y,iterateIndex:b,iterateId:T}=n;this.isMainSeq=e.ctn.nodeType==="mainSeq",this.isInteractiveSeq=e.ctn.nodeType==="interactiveSeq",this.id=e.ctn.id,this.isIterate=s,this.json=e,this.ctx=f,this.globalEventHub=y,this.commonTimeNode=new Co({json:e.ctn,isSub:u,eventHubs:{global:y,runtime:this.runtimeNodeEventHub},ctx:f,parent:h,isIterate:!1,iterateType:r,iterateIndex:b,iterateId:T}),this.bindShapeEvent(),this.nextConds=new De("mainSeq",e.nextCondLst,{global:y,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new De("mainSeq",e.preCondLst,{global:y,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",P=>{const j=this.commonTimeNode.children.findIndex(G=>G.commonTimeNode.uuid===P.id);j>=0&&(this.currentSeqIndex=j),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit(Pn.mainSeqStepStart,j)}),this.commonTimeNode.on("childTimeNodeEnd",P=>{const j=this.commonTimeNode.children.findIndex(G=>G.commonTimeNode.uuid===P.id);j>=0&&(this.currentSeqIndex=j),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext()}),this.isMainSeq&&this.ctx.eventHub.emit(Pn.mainSeqStepEnd,j)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.commonTimeNode.resetForRepeat(),this.ctx.clock.setTimeout(()=>{this.currentSeqState="idle",this.currentSeqIndex=0})}),this.nextConds.on("active",()=>{if(this.isInteractiveSeq){const{mode:P}=this.ctx;P!=="interactive"&&P!=="sync"||this.ctx.eventHub.emit(Pn.interactiveSeqNext,this.json.ctn.id),P!=="sync"&&P!=="local"||this.handleNext()}else this.handleNext()}),this.prevConds.on("active",this.handlePrev)}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(n){this._currentSeqIndex=n,this.isMainSeq?this.ctx.eventHub.emit(Pn.mainSeqStepChange,n):this.isInteractiveSeq&&this.ctx.eventHub.emit(Pn.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:n,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(n){this._currentSeqState=n,this.isMainSeq?this.ctx.eventHub.emit(Pn.mainSeqStateChange,n):this.isInteractiveSeq&&this.ctx.eventHub.emit(Pn.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:n}})}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&&this.currentSeqState==="idle")}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&this.currentSeqState==="end")}bindShapeEvent(){this.json.ctn.nodeType==="interactiveSeq"&&this.json.nextCondLst.forEach(n=>{if(/^shape/.test(n.event)){const e=n.event.split(" ")[1];if(e){const r=this.ctx.timingTargets.getTargetById(e);r&&(r.interactiveContainer.interactive=!0,r.interactiveContainer.cursor="pointer",r.interactiveContainer.on("pointerdown",()=>{const s=`shape ${e} onClick`;this.globalEventHub.emit(s)}))}}})}setCurrentStep(n,e){let r=n;this.commonTimeNode.seekToStart();const{length:s}=this.commonTimeNode.children;if(r===-1&&(r=s-1),r>=0&&r<s)for(let u=0;u<=r;u++){const h=this.commonTimeNode.children[u];u!==r?h.commonTimeNode.seekToEnd(!1,!0):e==="start"?h.commonTimeNode.seekToStart():e==="end"&&h.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=r,this.currentSeqState=e==="start"?"idle":"end"}}function ln(o,n,e){const r=n.split(".");r.reduce((s,u,h)=>{if(s)return h!==r.length-1?s[u]:void(s[u]=e);console.warn(`${o} not support ${n}`)},o)}function An(o,n){return n?n.split(".").reduce((e,r)=>{if(e)return e[r];console.warn(`${o} not support ${n}`)},o):null}class ve{constructor(n){this.timingTarget=null,this.runtimeNodeEventHub=new J.a,this.onTimeLineStart=()=>{if(this.isConflict){const{target:P}=this.json.cBhvr;if(this.activeWhenConflict==="next"){let j=P.id;P.type==="shape"&&P.txEl&&(j=`${j}-txEl-${P.txEl.range[0]}`),this.commonTimeNode.isIterate&&(j=`${j}-iterate-${this.commonTimeNode.iterateIndex}`),this.ctx.conflictTimeNodeManager.addRunningTimeNode(j,this.modifyAttrKey,this.commonTimeNode)}else this.activeWhenConflict==="prev"&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:r,json:s,ctx:u,parent:h,eventHub:f,iterateType:y,iterateIndex:b,iterateId:T}=n;this.json=s,this.id=s.cBhvr.ctn.id,this.ctx=u,this.globalEventHub=f,this.commonTimeNode=new Co({json:s.cBhvr.ctn,isSub:r,eventHubs:{global:f,runtime:this.runtimeNodeEventHub},ctx:u,parent:h,isIterate:e,iterateType:y,iterateIndex:b,iterateId:T}),this.timingTarget=this.ctx.timingTargets.getTarget(s.cBhvr.target,e,{type:y,index:b,id:T}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.onTimeLineStart)}}class Xe extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=An(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const e=this.json.cBhvr.attrList[0];this.startVal!==null&&this.timingTarget&&ln(this.timingTarget,e,this.startVal)},this.onSeekToEnd=()=>{const e=this.json.cBhvr.attrList[0],r=this.json.cBhvr.to||this.json.to;r&&this.timingTarget&&ln(this.timingTarget,e,r)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:e,delta:r})=>{if(r/e>=1){const s=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const u=this.json.cBhvr.to||this.json.to;u&&this.timingTarget&&ln(this.timingTarget,s,u)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}class Un{constructor(n,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:r=>r/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:r=>r/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=n.val.value,this.time=n.time,n.fmla&&(this.fmla=this.parseFmla(n.fmla))}parseFmla(n){let e=n.replaceAll("#ppt_h",`(${this.timingTarget.design_ppt_h})`);return e=e.replaceAll("#ppt_w",`(${this.timingTarget.design_ppt_w})`),e=e.replaceAll("#ppt_x",`(${this.timingTarget.design_ppt_x})`),e=e.replaceAll("#ppt_y",`(${this.timingTarget.design_ppt_y})`),e=e.replaceAll("ppt_w","vars.ppt_w"),e=e.replaceAll("ppt_h","vars.ppt_h"),e=e.replaceAll("ppt_x","vars.ppt_x"),e=e.replaceAll("ppt_y","vars.ppt_y"),e=e.replaceAll("#","vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(r=>{const s=new RegExp(`([^a-z])${r}([^a-z])`,"g");e=e.replace(s,(u,h,f)=>`${h}math.${r}${f}`)}),new Function("vars","math","$","return "+e)}}class mn extends Un{constructor(n,e,r){super(n,e),this.value=n.val.value,r&&(this.fmla=this.parseFmla(r))}resolveValue(){return this.value}interpolationFrom(n,e,r){const s=n.resolveValue(r),u=s+(this.resolveValue()-s)*e;return n.fmla?n.fmla(r,this.math,u):u}}class Yn extends Un{constructor(n,e){var r;super(n,e),this.value=(r=n.val)===null||r===void 0?void 0:r.value}interpolationFrom(n,e,r){let s=n.resolveValue(r);return e>this.time&&(s=this.resolveValue()),s}resolveValue(){return this.value||""}}class wn extends Un{constructor(n,e){super(n,e),this.fn=this.parseFmla(this.val)}resolveValue(n){return this.fn(n,this.math,1)}interpolationFrom(n,e,r){const s=n.resolveValue(r),u=s+(this.resolveValue(r)-s)*e;return n.fmla?n.fmla(r,this.math,u):u}}class lr extends Un{constructor(n,e){super(n,e),this.value=n.val.value}interpolationFrom(n,e){return ku(n.resolveValue(),this.value,e)}resolveValue(){return this.value}}class In extends ve{constructor(n){super(n),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=An(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var e,r,s,u;((e=this.timingTarget)===null||e===void 0?void 0:e.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),((r=this.timingTarget)===null||r===void 0?void 0:r.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),((s=this.timingTarget)===null||s===void 0?void 0:s.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),((u=this.timingTarget)===null||u===void 0?void 0:u.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:e,delta:r})=>{const s=r/e,u=this.keyFrames.findIndex(j=>s<=j[0]),{attrList:h}=this.json.cBhvr;if(u<0){const j=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&h&&h[0]&&ln(this.timingTarget,h[0],j[1].resolveValue(this.vars)))}const f=u-1,y=this.keyFrames[u],b=this.keyFrames[f]||y,T=y[0]-b[0]==0?1:(s-b[0])/(y[0]-b[0]),P=y[1].interpolationFrom(b[1],T,this.vars);this.timingTarget&&h&&h[0]&&ln(this.timingTarget,h[0],P)},this.onSeekToStart=()=>{this.startVal!==null&&this.timingTarget&&ln(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 n;const{valueType:e}=this.json;if(this.json.tavLst.length<=0){if(this.json.to){if(this.json.from||this.startVal){const s={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(s,this.timingTarget);this.keyFrames.push([s.time,u])}}const r={time:1,val:{type:"string",value:this.json.to},fmla:""};if(e==="num"&&this.timingTarget){const s=new wn(r,this.timingTarget);this.keyFrames.push([r.time,s])}}else if(this.json.by){const r={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(r,this.timingTarget);this.keyFrames.push([r.time,u])}const s={time:1,val:{type:"string",value:(((n=r.val)===null||n===void 0?void 0:n.value)||"")+"+"+this.json.by},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(s,this.timingTarget);this.keyFrames.push([s.time,u])}}}if(this.json.tavLst.length>0){for(const r of this.json.tavLst)if(r.val&&this.timingTarget){let s=null;r.val.type==="string"?e==="num"?s=new wn(r,this.timingTarget):e==="str"&&(s=new Yn(r,this.timingTarget)):r.val.type==="number"?s=new mn(r,this.timingTarget):r.val.type==="color"?(this.isColorAnim=!0,s=new lr(r,this.timingTarget)):r.val.type==="boolean"&&console.warn("not implements"),s&&this.keyFrames.push([r.time,s])}}}}var jn=S(21),Ei=S.n(jn),xo=S(22),Ls=S.n(xo);class ki extends ko{constructor(){super(Ls.a,Ei.a,{percent:0,direction:1,transition:0})}set transition(n){this.uniforms.transition=n}set percent(n){this.uniforms.percent=n}set direction(n){this.uniforms.direction=n}}var Js=S(23),Ka=S.n(Js);class Qa extends ko{constructor(){super(void 0,Ka.a,{percent:0,transition:1})}set transition(n){this.uniforms.transition=Math.pow(n,n)}set percent(n){this.uniforms.percent=n}}class El extends ve{constructor(n){var e;super(n),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:u,delta:h})=>{const f=h/u;this.filter&&(this.filter.percent=f),f>=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 r=0;n.json.transition==="out"?r=-1:n.json.transition==="in"&&(r=1);const s=(e=n.json.filter)===null||e===void 0?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(s){const u=s[1],h=s[3];if(u==="wipe"){const f=new ki;h==="up"?f.direction=1:h==="down"?f.direction=2:h==="left"?f.direction=3:h==="right"&&(f.direction=4),this.filter=f,this.filterType=`${u}-${h}`}else if(u==="fade"){const f=new Qa;this.filter=f,this.filterType=""+u}this.filter&&(this.filter.transition=r)}}get modifyAttrKey(){return this.filterType}}var _a=S(5);class ya extends ve{constructor(n){super(n),this.isConflict=!0,this.activeWhenConflict="next",this.onTimeUpdate=({duration:e,delta:r})=>{var s;const u=r/e,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{var e,r,s;const u=(r=(e=this.commonTimeNode.json)===null||e===void 0?void 0:e.spd)!==null&&r!==void 0?r:1,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u>0?0:1);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+this.timingTarget.design_ppt_y)},this.onSeekToEnd=()=>{var e,r,s;const u=(r=(e=this.commonTimeNode.json)===null||e===void 0?void 0:e.spd)!==null&&r!==void 0?r:1,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u>0?1:0);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var n;const e=new _a.Path,r=(n=this.json.path)===null||n===void 0?void 0:n.match(/[MLCmlc][^MLCmlc]+/g);if(r)for(const s of r){const[u,...h]=s.trim().replace(/\s+/g," ").split(" ");if(u==="M"){const[f,y]=h.map(b=>Number(b));e.moveTo(f,y)}else if(u==="L"){const[f,y]=h.map(b=>Number(b));e.lineTo(f,y)}else if(u==="C"){const[f,y,b,T,P,j]=h.map(G=>Number(G));e.bezierCurveTo(f,y,b,T,P,j)}else if(u==="Z")e.closePath();else if(u==="E")console.warn("not implements");else if(u==="c"){const[f,y,b,T,P,j]=h.map(V=>Number(V)),G=e.currentPoint;e.bezierCurveTo(f+G.x,y+G.y,b+G.x,T+G.y,P+G.x,j+G.y)}else if(u==="l"){const f=e.currentPoint,[y,b]=h.map(T=>Number(T));e.lineTo(y+f.x,b+f.y)}else if(u==="m"){const f=e.currentPoint,[y,b]=h.map(T=>Number(T));e.moveTo(y+f.x,b+f.y)}}this.path=e}}class zu extends ve{constructor(n){super(n),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=e=>{e.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:e,delta:r})=>{var s,u,h,f,y;const b=r/e,T={x:1,y:1};if(this.to){const P=(s=this.from)!==null&&s!==void 0?s:{x:(h=(u=this.startVal)===null||u===void 0?void 0:u.x)!==null&&h!==void 0?h:1,y:(y=(f=this.startVal)===null||f===void 0?void 0:f.y)!==null&&y!==void 0?y:1};T.x=P.x+(this.to.x-P.x)*b,T.y=P.y+(this.to.y-P.y)*b}else if(this.by){const P={x:this.by.x,y:this.by.y};T.x=1+(P.x-1)*b,T.y=1+(P.y-1)*b}this.timingTarget&&(this.timingTarget.scale=T)},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=n.json.from,this.to=n.json.to,this.by=n.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 op extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=e=>{this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to),e.isReverse||this.updateCurrentValue();const[r]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,r+".on","true")},this.onTimeNodeEnd=()=>{if(this.json.cBhvr.ctn.fill==="remove"){const[e]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,e+".on","false")}},this.onSeekToStart=()=>{if(this.timingTarget){const[e]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,e+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const e=An(this.timingTarget,this.json.cBhvr.attrList[0]);e&&(this.startColorString=e)}},this.onTimeUpdate=({delta:e,duration:r})=>{const s=e/r;this.to.interpolationFrom(this.from,s,this.target),this.timingTarget&&ln(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1})},this.json.clrSpc==="rgb"?(this.from=new Sl(this.json.from),this.to=new Sl(this.json.to),this.by=new Sl(this.json.by),this.target=new Sl):(this.from=new Ps(this.json.from),this.to=new Ps(this.json.to),this.by=new Ps(this.json.by),this.target=new Ps),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 n=An(this.timingTarget,this.json.cBhvr.attrList[0]);n&&(this.currentColorString=n)}}}class su extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=e=>{this.lastVal=null,e.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:e,delta:r})=>{const s=r/e;let u=0,h=0;if(this.from!==void 0&&this.to!==void 0){u=this.from,h=this.to;const f=u+(h-u)*s;this.timingTarget&&(this.timingTarget.r=f)}else if(this.by!==void 0){this.lastVal||(this.lastVal=0);const f=this.by*s-this.lastVal;this.lastVal=this.by*s,this.timingTarget&&(this.timingTarget.r+=f)}},this.onTimeNodeStart=()=>{var e;Object(W.isNumber)((e=this.timingTarget)===null||e===void 0?void 0:e.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&this.startVal!==null&&(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 n;this.currentVal=(n=this.timingTarget)===null||n===void 0?void 0:n.r}}class Xh extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var e,r;const{cmd:s,cmdType:u}=this.json;!this.isApplied&&s&&u&&(this.isApplied=!0,(r=(e=this.timingTarget)===null||e===void 0?void 0:e.cmd)===null||r===void 0||r.applyCommand(s,u))},this.onSeekToStart=()=>{var e,r;(r=(e=this.timingTarget)===null||e===void 0?void 0:e.cmd)===null||r===void 0||r.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)}get modifyAttrKey(){var n,e,r,s;return((e=(n=this.json)===null||n===void 0?void 0:n.cmd)!==null&&e!==void 0?e:"")+((s=(r=this.json)===null||r===void 0?void 0:r.cmdType)!==null&&s!==void 0?s:"")}}var au=S(24);class tl{constructor(n){tl.useRtc||(this.howl=new au.Howl({src:[n]}))}play(){var n;(n=this.howl)===null||n===void 0||n.play()}pause(){var n;(n=this.howl)===null||n===void 0||n.pause()}stop(){var n;(n=this.howl)===null||n===void 0||n.stop()}destroy(){var n;(n=this.howl)===null||n===void 0||n.unload()}}tl.useRtc=!1;class nf{constructor(n){this.runtimeNodeEventHub=new J.a,this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy()};const{json:e,isIterate:r,isSub:s,eventHub:u,ctx:h,parent:f,iterateType:y,iterateIndex:b,iterateId:T}=n;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new Co({json:e.cMediaNode.ctn,isSub:s,eventHubs:{global:u,runtime:this.runtimeNodeEventHub},ctx:h,parent:f,isIterate:r,iterateType:y,iterateIndex:b,iterateId:T}),this.audio=new tl(e.cMediaNode.tgtEl),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)}}var qh=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Co extends J.a{constructor(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.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.timeDelta=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.dispose())},this.handleActive=(G=!0)=>{if(this.isActive=!0,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(this.json.restart==="never")return;this.json.restart!=="whenNotActive"&&this.json.restart!=="always"||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(G))}else this.startTimeLine(G)},this.updateTimeLine=G=>{const V=G/(Bt.TARGET_FPMS||.06);this.timeDelta+=V,this.duration-this.timeDelta<=V&&(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=(G=!1)=>{(this.isTimeNodeEnd()||G)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:e,isIterate:r,ctx:s,eventHubs:u,parent:h,json:f,iterateType:y,iterateId:b,iterateIndex:T}=n;this.isSub=e,this.isIterate=r,this.parentTimeNode=h,this.json=f,this.ctx=s,this.iterateIndex=T,this.eventHubs=u,this.iterateType=y,this.iterateId=b;const P=Number(this.json.dur),j=this.json.spd||1;this.isNegativeSpeed=j<0,Number.isNaN(P)||(this.duration=P/Math.abs(j)),this.uuid+="--"+this.json.id,this.setPreStyle(),f.childTnLst&&this.createChildren(f.childTnLst),this.startConds=new De(this.json.id||"",f.stCondLst,u,this.ctx),this.endConds=new De(this.json.id||"",f.endCondLst,u,this.ctx),f.endSync&&(this.endSync=new De(this.json.id||"",[f.endSync],u,this.ctx),this.endSync.on("active",()=>{var G;this.json.nodeType==="interactiveSeq"&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),(G=this.endSync)===null||G===void 0||G.reset())})),this.startConds.on("active",G=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(G))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(G=>G.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&this.json.masterRel==="nextClick"&&this.startConds.addCond({event:"shape slide onNext"}),this.json.iterate&&this.isIterate===!1&&this.createIterateShadow()}createIterateShadow(){const n=Is();let e=!0,r=0;const s=u=>{u===n&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",s))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",s);e;){const u=JSON.parse(JSON.stringify(this.json)),h=new Co({json:u,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:u.iterate.type,iterateIndex:r,iterateId:n});this.iterateShadows[r]=h,r+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(n){this.isReverse=n}createTimeNode(n,e){let r=null;const s={json:n,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId};return n.type==="seq"?r=new gn(s):n.type==="par"?r=new rd(s):n.type==="set"?r=new Xe(s):n.type==="anim"?r=new In(s):n.type==="animEffect"?r=new El(s):n.type==="animMotion"?r=new ya(s):n.type==="animScale"?r=new zu(s):n.type==="animClr"?r=new op(s):n.type==="animRot"?r=new su(s):n.type==="cmd"?r=new Xh(s):n.type==="audio"&&(r=new nf(s)),r}createSubList(n){this.subList=[],n.forEach(e=>{const r=this.createTimeNode(e,!0);r&&this.subList.push(r)})}bindCommonTimeNodeEvent(n){n.commonTimeNode.on("timeNodeStart",e=>{this.emit("childTimeNodeStart",e)}),n.commonTimeNode.on("timeNodeEnd",e=>{this.emit("childTimeNodeEnd",e),this.children.every(r=>r.commonTimeNode.isTimeNodeEnd())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(n){function e(r){return function(s){var u;return(u=s==null?void 0:s.cBhvr)===null||u===void 0?void 0:u.ctn}(r)?r.cBhvr.ctn.presetOrder:function(s){return s==null?void 0:s.ctn}(r)?r.ctn.presetOrder:function(s){return s==null?void 0:s.cMediaNode}(r)?r.cMediaNode.ctn.presetOrder:void 0}e(n[0])?[...n].sort((r,s)=>{var u,h;return((u=e(r))!==null&&u!==void 0?u:0)-((h=e(s))!==null&&h!==void 0?h:0)}).forEach(r=>{const s=n.findIndex(h=>e(h)===e(r)),u=this.createTimeNode(r,!1);u&&(this.bindCommonTimeNodeEvent(u),this.children[s]=u)}):n.forEach(r=>{const s=this.createTimeNode(r,!1);s&&(this.bindCommonTimeNodeEvent(s),this.children.push(s))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(n=>n.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.timeDelta=0,this.children.forEach(n=>n.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(n=>n.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.timeDelta=0;const n=1e3/this.ctx.ticker.maxFPS;this.duration<=n&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit(Pn.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>n&&(this.ctx.eventHub.emit(Pn.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(n=!0){if(n&&(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(Pn.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return qh(this,void 0,void 0,function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const n of this.iterateShadows){if(this.isIterateEnd)break;n.children.forEach(e=>{e.commonTimeNode.startTimeNode()}),n.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}})}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}setPreStyle(){if(!this.json.presetClass)return;const n=[],e=r=>{r.forEach(s=>{var u,h,f;s.cBhvr&&s.cBhvr.target&&n.findIndex(y=>y.id===s.cBhvr.target.id)<0&&n.push(s.cBhvr.target),((h=(u=s==null?void 0:s.cBhvr)===null||u===void 0?void 0:u.ctn)===null||h===void 0?void 0:h.childTnLst)&&s.cBhvr.ctn.childTnLst.length>0&&e(s.cBhvr.ctn.childTnLst),((f=s==null?void 0:s.ctn)===null||f===void 0?void 0:f.childTnLst)&&s.ctn.childTnLst.length>0&&e(s.ctn.childTnLst)})};e(this.json.childTnLst||[]),n.forEach(r=>{if(this.json.iterate){let s=0,u=!0;for(;u;){const h=this.ctx.timingTargets.getTarget(r,!0,{type:this.json.iterate.type,index:s,id:""});h&&(this.setPreStyleForTarget(h),s+=1),u=!!h}}else{const s=this.ctx.timingTargets.getTarget(r,!1);s&&this.setPreStyleForTarget(s)}})}setPreStyleForTarget(n){var e,r;if(n&&this.json.presetSubtype&&(n.presetSubType=this.json.presetSubtype),n&&!n.hasPreset)if(this.json.presetClass==="entr"){const s=(r=(e=this.json)===null||e===void 0?void 0:e.childTnLst)===null||r===void 0?void 0:r.filter(u=>u.type==="set"&&u.to==="visible");(s==null?void 0:s.length)&&(n.hasPreset=!0,n.style.visibility="hidden")}else(this.json.presetClass==="exit"||this.json.presetClass==="path")&&(n.hasPreset=!0,n.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(n=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(n);const e=this.json.stCondLst.filter(s=>/^self/.test(s.event||""))[0];e&&this.startConds.condHandle(e);const r=this.json.endCondLst.filter(s=>/^self/.test(s.event||""))[0];r&&this.endConds.condHandle(r),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(this.children.length===0||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(n=>n.commonTimeNode.destroy()),this.subList=[],this.children.forEach(n=>{n.commonTimeNode.clearSubList()})}seekToStart(n=!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(n));if(n)for(let e=this.subList.length-1;e>=0;e--){const r=this.subList[e];r==null||r.commonTimeNode.seekToStart()}for(let e=this.children.length-1;e>=0;e--){const r=this.children[e];r==null||r.commonTimeNode.seekToStart()}for(let e=this.children.length-1;e>=0;e--){const r=this.children[e];r==null||r.commonTimeNode.seekToStart()}}dispose(n=!1){this.isConflictDispose=n,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(Pn.animateEnd),this.ctx.ticker.remove(this.updateTimeLine),this.startConds.reset(),this.endConds.reset()}seekToEnd(n,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 r=this.json.autoRev||n;if(r?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(s=>s.seekToEnd(r,e));this.children.length===0&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(s=>s.commonTimeNode.seekToEnd(r,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(s=>s.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEnd(){let n=!0;return this.children.length>0&&(n=n&&this.children.every(e=>e.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(n=n&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(n=n&&!this.isReverse),n=n&&this.isNatureTimeEnd(),!!this.isConflictDispose||!(!this.isIterateEnd||!this.json.iterate)||n}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(n=>n.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(n=>n.commonTimeNode.destroy()),this.clearSubList()}}class rd extends J.a{constructor(n){super(),this.isRunning=!1,this.runtimeNodeEventHub=new J.a;const{json:e,iterateType:r,isIterate:s,isSub:u,parent:h,ctx:f,eventHub:y,iterateIndex:b,iterateId:T}=n;this.id=e.ctn.id,this.json=e,this.ctx=f,this.isIterate=s,this.globalEventHub=y,this.commonTimeNode=new Co({json:e.ctn,isSub:u,eventHubs:{global:y,runtime:this.runtimeNodeEventHub},ctx:f,parent:h,isIterate:!1,iterateType:r,iterateIndex:b,iterateId:T}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(P=>{P.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),P.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(P=>{P.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 yg=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class xg{constructor(n,e,r){this.json=n,this.ctx=r;const s=n.timeNodeList.find(u=>u.type==="par"&&u.ctn.nodeType==="tmRoot");s&&(this.tmRoot=new rd({json:s,isSub:!1,isIterate:!1,eventHub:e,ctx:r,parent:null,iterateType:"el",iterateIndex:0,iterateId:""}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(u=>{var h,f,y;return((h=u.json)===null||h===void 0?void 0:h.type)==="seq"&&((y=(f=u.json)===null||f===void 0?void 0:f.ctn)===null||y===void 0?void 0:y.nodeType)==="mainSeq"}))}findSeq(n){var e;return(e=this.tmRoot)===null||e===void 0?void 0:e.commonTimeNode.children.find(r=>{var s,u,h;return((s=r.json)===null||s===void 0?void 0:s.type)==="seq"&&((h=(u=r.json)===null||u===void 0?void 0:u.ctn)===null||h===void 0?void 0:h.id)===n})}start(){var n,e;return yg(this,void 0,void 0,function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),(n=this.mainSeq)===null||n===void 0||n.commonTimeNode.startTimeNode()):(e=this.mainSeq)===null||e===void 0||e.commonTimeNode.startTimeNode()})}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var n;(n=this.mainSeq)===null||n===void 0||n.commonTimeNode.collectStartValue()}setMainSeqStep(n,e){var r;n===-1&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),(r=this.mainSeq)===null||r===void 0||r.setCurrentStep(n,e)}destroy(){var n;(n=this.tmRoot)===null||n===void 0||n.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(n){const e=this.findSeq(n);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(n,e,r){const s=this.findSeq(n);s&&s.setCurrentStep(e,r)}applyInteractiveAction(n){const e=this.findSeq(n);e&&e.handleNext()}}var Lm=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class bg extends me{constructor(n,e,r){super({id:"stage",width:n.width,height:n.height,type:"Container",children:n.children},e,r),this.globalEventHub=new J.a,this.json=n,this.container.visible=!1,this.ctx=e,this.globalEventHub.on("c:prev slide",()=>{this.ctx.eventHub.emit(Pn.requestPrevSlide)}),this.globalEventHub.on("c:next slide",()=>{this.ctx.eventHub.emit(Pn.requestNextSlide)});const s=new ps;s.drawRect(0,0,n.width,n.height),this.container.addChild(s)}get interactiveContainer(){return this.container}render(){const n=Object.create(null,{render:{get:()=>super.render}});return Lm(this,void 0,void 0,function*(){yield n.render.call(this),this.ctx.eventHub.emit("StageRenderEnd")})}createTiming(){this.json.timing&&(this.timing=new xg(this.json.timing,this.globalEventHub,this.ctx))}startTiming(){var n;return((n=this.timing)===null||n===void 0?void 0:n.start())||Promise.resolve()}setMainSeqApplied(){var n;(n=this.timing)===null||n===void 0||n.setMainSeqApplied()}setMainSeqStep(n,e){var r;(r=this.timing)===null||r===void 0||r.setMainSeqStep(n,e)}collectMainSeqStartValue(){var n;(n=this.timing)===null||n===void 0||n.collectMainSeqStartValue()}hasTiming(){return!!this.timing}destroy(){var n;this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),this.ctx.fillTexture.destroy(),this.globalEventHub.removeAllListeners(),(n=this.timing)===null||n===void 0||n.destroy(),super.destroy()}mainSeqStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.currentMainSeqStep())!==null&&e!==void 0?e:0}mainSeqLength(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.currentMainSeqLength())!==null&&e!==void 0?e:0}mainSeqHasNextStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.mainSeqHasNextStep())!==null&&e!==void 0&&e}mainSeqHasPrevStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.mainSeqHasPrevStep())!==null&&e!==void 0&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(){var n;this.hasTiming()&&((n=this.timing)===null||n===void 0?void 0:n.hasMainSeq())?this.globalEventHub.emit("shape slide onNext"):this.ctx.eventHub.emit(Pn.requestNextSlide)}prevStep(){var n;this.hasTiming()&&((n=this.timing)===null||n===void 0?void 0:n.hasMainSeq())?this.globalEventHub.emit("shape slide onPrev"):this.ctx.eventHub.emit(Pn.requestPrevSlide)}applyInteractiveAction(n){var e;(e=this.timing)===null||e===void 0||e.applyInteractiveAction(n)}seekInteractiveSeqToEnd(n){var e;(e=this.timing)===null||e===void 0||e.seekInteractiveSeqToEnd(n)}setInteractiveSeqState(n,e,r){var s;(s=this.timing)===null||s===void 0||s.setInteractiveSeqState(n,e,r)}setMediaState(n,e){return Lm(this,void 0,void 0,function*(){const r=this.ctx.medias[n];r&&(e?yield r.play():yield r.pause())})}setMediaCurrentTime(n,e){const r=this.ctx.medias[n];r&&r.seek(e)}}const ts=134217729;function zf(o,n,e,r,s){let u,h,f,y,b=n[0],T=r[0],P=0,j=0;T>b==T>-b?(u=b,b=n[++P]):(u=T,T=r[++j]);let G=0;if(P<o&&j<e)for(T>b==T>-b?(h=b+u,f=u-(h-b),b=n[++P]):(h=T+u,f=u-(h-T),T=r[++j]),u=h,f!==0&&(s[G++]=f);P<o&&j<e;)T>b==T>-b?(h=u+b,y=h-u,f=u-(h-y)+(b-y),b=n[++P]):(h=u+T,y=h-u,f=u-(h-y)+(T-y),T=r[++j]),u=h,f!==0&&(s[G++]=f);for(;P<o;)h=u+b,y=h-u,f=u-(h-y)+(b-y),b=n[++P],u=h,f!==0&&(s[G++]=f);for(;j<e;)h=u+T,y=h-u,f=u-(h-y)+(T-y),T=r[++j],u=h,f!==0&&(s[G++]=f);return u===0&&G!==0||(s[G++]=u),G}function wg(o,n){let e=n[0];for(let r=1;r<o;r++)e+=n[r];return e}function Yh(o){return new Float64Array(o)}const id=Yh(4),Zh=Yh(8),Om=Yh(12),Mi=Yh(16),Po=Yh(4);function sp(o,n,e,r,s,u){const h=(n-u)*(e-s),f=(o-s)*(r-u),y=h-f;if(h===0||f===0||h>0!=f>0)return y;const b=Math.abs(h+f);return Math.abs(y)>=33306690738754716e-32*b?y:-function(T,P,j,G,V,K,_t){let Tt,jt,de,Ne,Nt,ue,$t,ie,Je,he,oe,Ae,nn,on,$n,nr,$e,Ue;const Cn=T-V,kn=j-V,wr=P-K,Ar=G-K;on=Cn*Ar,ue=ts*Cn,$t=ue-(ue-Cn),ie=Cn-$t,ue=ts*Ar,Je=ue-(ue-Ar),he=Ar-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=wr*kn,ue=ts*wr,$t=ue-(ue-wr),ie=wr-$t,ue=ts*kn,Je=ue-(ue-kn),he=kn-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,id[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,id[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,id[2]=Ae-(Ue-Nt)+(oe-Nt),id[3]=Ue;let Dr=wg(4,id),pi=22204460492503146e-32*_t;if(Dr>=pi||-Dr>=pi||(Nt=T-Cn,Tt=T-(Cn+Nt)+(Nt-V),Nt=j-kn,de=j-(kn+Nt)+(Nt-V),Nt=P-wr,jt=P-(wr+Nt)+(Nt-K),Nt=G-Ar,Ne=G-(Ar+Nt)+(Nt-K),Tt===0&&jt===0&&de===0&&Ne===0)||(pi=11093356479670487e-47*_t+33306690738754706e-32*Math.abs(Dr),Dr+=Cn*Ne+Ar*Tt-(wr*de+kn*jt),Dr>=pi||-Dr>=pi))return Dr;on=Tt*Ar,ue=ts*Tt,$t=ue-(ue-Tt),ie=Tt-$t,ue=ts*Ar,Je=ue-(ue-Ar),he=Ar-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=jt*kn,ue=ts*jt,$t=ue-(ue-jt),ie=jt-$t,ue=ts*kn,Je=ue-(ue-kn),he=kn-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Po[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Po[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Po[2]=Ae-(Ue-Nt)+(oe-Nt),Po[3]=Ue;const Ji=zf(4,id,4,Po,Zh);on=Cn*Ne,ue=ts*Cn,$t=ue-(ue-Cn),ie=Cn-$t,ue=ts*Ne,Je=ue-(ue-Ne),he=Ne-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=wr*de,ue=ts*wr,$t=ue-(ue-wr),ie=wr-$t,ue=ts*de,Je=ue-(ue-de),he=de-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Po[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Po[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Po[2]=Ae-(Ue-Nt)+(oe-Nt),Po[3]=Ue;const jr=zf(Ji,Zh,4,Po,Om);on=Tt*Ne,ue=ts*Tt,$t=ue-(ue-Tt),ie=Tt-$t,ue=ts*Ne,Je=ue-(ue-Ne),he=Ne-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=jt*de,ue=ts*jt,$t=ue-(ue-jt),ie=jt-$t,ue=ts*de,Je=ue-(ue-de),he=de-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Po[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Po[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Po[2]=Ae-(Ue-Nt)+(oe-Nt),Po[3]=Ue;const Zr=zf(jr,Om,4,Po,Mi);return Mi[Zr-1]}(o,n,e,r,s,u,b)}const ap=Math.pow(2,-52),Jh=new Uint32Array(512);class $h{static from(n,e=Nm,r=Fm){const s=n.length,u=new Float64Array(2*s);for(let h=0;h<s;h++){const f=n[h];u[2*h]=e(f),u[2*h+1]=r(f)}return new $h(u)}constructor(n){const e=n.length>>1;if(e>0&&typeof n[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=n;const r=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),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:n,_hullPrev:e,_hullNext:r,_hullTri:s,_hullHash:u}=this,h=n.length>>1;let f=1/0,y=1/0,b=-1/0,T=-1/0;for(let he=0;he<h;he++){const oe=n[2*he],Ae=n[2*he+1];oe<f&&(f=oe),Ae<y&&(y=Ae),oe>b&&(b=oe),Ae>T&&(T=Ae),this._ids[he]=he}const P=(f+b)/2,j=(y+T)/2;let G,V,K,_t=1/0;for(let he=0;he<h;he++){const oe=rf(P,j,n[2*he],n[2*he+1]);oe<_t&&(G=he,_t=oe)}const Tt=n[2*G],jt=n[2*G+1];_t=1/0;for(let he=0;he<h;he++){if(he===G)continue;const oe=rf(Tt,jt,n[2*he],n[2*he+1]);oe<_t&&oe>0&&(V=he,_t=oe)}let de=n[2*V],Ne=n[2*V+1],Nt=1/0;for(let he=0;he<h;he++){if(he===G||he===V)continue;const oe=lp(Tt,jt,de,Ne,n[2*he],n[2*he+1]);oe<Nt&&(K=he,Nt=oe)}let ue=n[2*K],$t=n[2*K+1];if(Nt===1/0){for(let Ae=0;Ae<h;Ae++)this._dists[Ae]=n[2*Ae]-n[0]||n[2*Ae+1]-n[1];ju(this._ids,this._dists,0,h-1);const he=new Uint32Array(h);let oe=0;for(let Ae=0,nn=-1/0;Ae<h;Ae++){const on=this._ids[Ae];this._dists[on]>nn&&(he[oe++]=on,nn=this._dists[on])}return this.hull=he.subarray(0,oe),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(sp(Tt,jt,de,Ne,ue,$t)<0){const he=V,oe=de,Ae=Ne;V=K,de=ue,Ne=$t,K=he,ue=oe,$t=Ae}const ie=function(he,oe,Ae,nn,on,$n){const nr=Ae-he,$e=nn-oe,Ue=on-he,Cn=$n-oe,kn=nr*nr+$e*$e,wr=Ue*Ue+Cn*Cn,Ar=.5/(nr*Cn-$e*Ue);return{x:he+(Cn*kn-$e*wr)*Ar,y:oe+(nr*wr-Ue*kn)*Ar}}(Tt,jt,de,Ne,ue,$t);this._cx=ie.x,this._cy=ie.y;for(let he=0;he<h;he++)this._dists[he]=rf(n[2*he],n[2*he+1],ie.x,ie.y);ju(this._ids,this._dists,0,h-1),this._hullStart=G;let Je=3;r[G]=e[K]=V,r[V]=e[G]=K,r[K]=e[V]=G,s[G]=0,s[V]=1,s[K]=2,u.fill(-1),u[this._hashKey(Tt,jt)]=G,u[this._hashKey(de,Ne)]=V,u[this._hashKey(ue,$t)]=K,this.trianglesLen=0,this._addTriangle(G,V,K,-1,-1,-1);for(let he,oe,Ae=0;Ae<this._ids.length;Ae++){const nn=this._ids[Ae],on=n[2*nn],$n=n[2*nn+1];if(Ae>0&&Math.abs(on-he)<=ap&&Math.abs($n-oe)<=ap||(he=on,oe=$n,nn===G||nn===V||nn===K))continue;let nr=0;for(let wr=0,Ar=this._hashKey(on,$n);wr<this._hashSize&&(nr=u[(Ar+wr)%this._hashSize],nr===-1||nr===r[nr]);wr++);nr=e[nr];let $e,Ue=nr;for(;$e=r[Ue],sp(on,$n,n[2*Ue],n[2*Ue+1],n[2*$e],n[2*$e+1])>=0;)if(Ue=$e,Ue===nr){Ue=-1;break}if(Ue===-1)continue;let Cn=this._addTriangle(Ue,nn,r[Ue],-1,-1,s[Ue]);s[nn]=this._legalize(Cn+2),s[Ue]=Cn,Je++;let kn=r[Ue];for(;$e=r[kn],sp(on,$n,n[2*kn],n[2*kn+1],n[2*$e],n[2*$e+1])<0;)Cn=this._addTriangle(kn,nn,$e,s[nn],-1,s[kn]),s[nn]=this._legalize(Cn+2),r[kn]=kn,Je--,kn=$e;if(Ue===nr)for(;$e=e[Ue],sp(on,$n,n[2*$e],n[2*$e+1],n[2*Ue],n[2*Ue+1])<0;)Cn=this._addTriangle($e,nn,Ue,-1,s[Ue],s[$e]),this._legalize(Cn+2),s[$e]=Cn,r[Ue]=Ue,Je--,Ue=$e;this._hullStart=e[nn]=Ue,r[Ue]=e[kn]=nn,r[nn]=kn,u[this._hashKey(on,$n)]=nn,u[this._hashKey(n[2*Ue],n[2*Ue+1])]=Ue}this.hull=new Uint32Array(Je);for(let he=0,oe=this._hullStart;he<Je;he++)this.hull[he]=oe,oe=r[oe];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(n,e){return Math.floor(function(r,s){const u=r/(Math.abs(r)+Math.abs(s));return(s>0?3-u:1+u)/4}(n-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(n){const{_triangles:e,_halfedges:r,coords:s}=this;let u=0,h=0;for(;;){const f=r[n],y=n-n%3;if(h=y+(n+2)%3,f===-1){if(u===0)break;n=Jh[--u];continue}const b=f-f%3,T=y+(n+1)%3,P=b+(f+2)%3,j=e[h],G=e[n],V=e[T],K=e[P];if(Dm(s[2*j],s[2*j+1],s[2*G],s[2*G+1],s[2*V],s[2*V+1],s[2*K],s[2*K+1])){e[n]=K,e[f]=j;const _t=r[P];if(_t===-1){let jt=this._hullStart;do{if(this._hullTri[jt]===P){this._hullTri[jt]=n;break}jt=this._hullPrev[jt]}while(jt!==this._hullStart)}this._link(n,_t),this._link(f,r[h]),this._link(h,P);const Tt=b+(f+1)%3;u<Jh.length&&(Jh[u++]=Tt)}else{if(u===0)break;n=Jh[--u]}}return h}_link(n,e){this._halfedges[n]=e,e!==-1&&(this._halfedges[e]=n)}_addTriangle(n,e,r,s,u,h){const f=this.trianglesLen;return this._triangles[f]=n,this._triangles[f+1]=e,this._triangles[f+2]=r,this._link(f,s),this._link(f+1,u),this._link(f+2,h),this.trianglesLen+=3,f}}function rf(o,n,e,r){const s=o-e,u=n-r;return s*s+u*u}function Dm(o,n,e,r,s,u,h,f){const y=o-h,b=n-f,T=e-h,P=r-f,j=s-h,G=u-f,V=T*T+P*P,K=j*j+G*G;return y*(P*K-V*G)-b*(T*K-V*j)+(y*y+b*b)*(T*G-P*j)<0}function lp(o,n,e,r,s,u){const h=e-o,f=r-n,y=s-o,b=u-n,T=h*h+f*f,P=y*y+b*b,j=.5/(h*b-f*y),G=(b*T-f*P)*j,V=(h*P-y*T)*j;return G*G+V*V}function ju(o,n,e,r){if(r-e<=20)for(let s=e+1;s<=r;s++){const u=o[s],h=n[u];let f=s-1;for(;f>=e&&n[o[f]]>h;)o[f+1]=o[f--];o[f+1]=u}else{let s=e+1,u=r;Os(o,e+r>>1,s),n[o[e]]>n[o[r]]&&Os(o,e,r),n[o[s]]>n[o[r]]&&Os(o,s,r),n[o[e]]>n[o[s]]&&Os(o,e,s);const h=o[s],f=n[h];for(;;){do s++;while(n[o[s]]<f);do u--;while(n[o[u]]>f);if(u<s)break;Os(o,s,u)}o[e+1]=o[u],o[u]=h,r-s+1>=u-e?(ju(o,n,s,r),ju(o,n,e,u-1)):(ju(o,n,e,u-1),ju(o,n,s,r))}}function Os(o,n,e){const r=o[n];o[n]=o[e],o[e]=r}function Nm(o){return o[0]}function Fm(o){return o[1]}function el(o,n,e){return o.fillType==="solidFill"?function(r,s,u){const h=new ps,[f,y]=Bu(r.color);return h.beginFill(f,y),h.drawRect(0,0,s,u),h.endFill(),h}(o,n,e):o.fillType==="gradientFill"?function(r,s,u){let h=null;const f=new Ri;if(r.stopList.sort((b,T)=>b.pos-T.pos),!r.stopList.find(b=>b.pos===0)){const b=r.stopList[0];r.stopList.unshift({pos:0,color:b.color})}if(!r.stopList.find(b=>b.pos===1)){const b=r.stopList[r.stopList.length-1];r.stopList.push({pos:1,color:b.color})}const y=b=>{const T=[];for(let P=0,j=b.length;P<j-1;P++){const G=b[P],V=b[P+1],K=G.pos+.5*(V.pos-G.pos),_t=ku(G.color,V.color,.5),Tt=2*P;T[Tt]=G,T[Tt+1]={color:_t,pos:K},T[Tt+2]=V}return T};if(r.stopList=y(r.stopList),r.stopList=y(r.stopList),h=r.line?Bm(r,s,u):r.path?function(b,T,P){var j,G,V;const K=[],_t={x:0,y:0};if(((j=b.path)===null||j===void 0?void 0:j.path)==="circle"||((G=b.path)===null||G===void 0?void 0:G.path)==="rect"||((V=b.path)===null||V===void 0?void 0:V.path)==="shape"){const Tt=T/2,jt=P/2,de=Math.sqrt(Tt*Tt+jt*jt);b.stopList.forEach(Ne=>{if(Ne.pos===0)K.push({point:{x:0,y:0},color:Ne.color});else{const Nt=de*Ne.pos,ue=new _a.Path;ue.absellipse(0,0,Nt,Nt,0,2*Math.PI,!1,0),ue.getPoints(50).forEach($t=>{K.push({point:{x:$t.x,y:$t.y},color:Ne.color})})}_t.x=Tt,_t.y=jt})}return{points:K,position:_t}}(r,s,u):Bm(r,s,u),h){const b=[],T=[],{position:P,points:j}=h,G=$h.from(j,jt=>jt.point.x,jt=>jt.point.y);for(let jt=0;jt<G.triangles.length;jt+=3)b.push(j[G.triangles[jt]].point.x,j[G.triangles[jt]].point.y),b.push(j[G.triangles[jt+1]].point.x,j[G.triangles[jt+1]].point.y),b.push(j[G.triangles[jt+2]].point.x,j[G.triangles[jt+2]].point.y),T.push(...Rs(j[G.triangles[jt]].color)),T.push(...Rs(j[G.triangles[jt+1]].color)),T.push(...Rs(j[G.triangles[jt+2]].color));const V=new ka;V.addAttribute("aVertexPosition",b,2),V.addAttribute("aColor",T,4);const K=Bo.from(`
|
|
5892
5892
|
precision mediump float;
|
|
5893
5893
|
attribute vec2 aVertexPosition;
|
|
5894
5894
|
attribute vec4 aColor;
|