PageSourceSearch

https://static.lightxeditor.com/web/2913.331cbcd521d20ee6.js

js lightxeditor.com collected 2026-10-01 11:32:49 UTC 79,869 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunklightx=self.webpackChunklightx||[]).push([[2913],{56751:(X,B,v)=>{v.d(B,{M:()=>et});var g=v(93552);class E{constructor(){this.type="timelineobject",this.objId=-1,this.refStartTime=0,this.endTime=0,this.duration=0,this.trimStart=0,this.trimEnd=-1}getViewObject(){return null}getVideoElement(){return null}setDefaultDuration(t){this.duration=t,this.trimEnd=t}}class R extends E{constructor(t,e,i,s){if(super(),this.document=s,this.type="videoobject",this._videoElement=null,this._videoObject=null,this._baseCanvas=null,this.videoUrl="",this.speedFactor=1,this.playBackRate=1,this.leftTrimThreshold=0,this.rightTrimThreshold=-1,this._baseCanvas=e,null===t)return;this._videoElement=this.document.createElement("video"),this._videoElement.src=t,this._videoElement.crossOrigin="anonymous",this.videoUrl=t;const n=this;this._videoElement.addEventListener("loadeddata",()=>{const a=n._videoElement.videoWidth,o=n._videoElement.videoHeight;let r,l;e.clipPath?(r=e.clipPath.width,l=e.clipPath.height):(r=e.width/e.viewportTransform[0],l=e.height/e.viewportTransform[3]);const d=a/r,b=o/l,p=1/(d>b?d:b);n._videoElement.width=a,n._videoElement.height=o,n.duration=n._videoElement.duration,n.trimEnd=n.duration,n._videoObject=new g.fabric.Image(n._videoElement,{left:(r-a*p)/2,top:(l-o*p)/2,angle:0,scaleX:p,scaleY:p,selectable:!1}),n._videoElement.currentTime=0,typeof i<"u"&&i()}),this._videoElement.addEventListener("timeupdate",()=>{const a=n._videoElement.currentTime;a<n.trimStart&&(n._videoElement.currentTime=n.trimStart),a>n.trimEnd&&(n._videoElement.currentTime=n.trimStart,n._videoElement.pause())})}configureObjectFrom(t){this._videoElement=t.getVideoElement();const e=this._videoElement.videoWidth,i=this._videoElement.videoHeight,s=e/this._baseCanvas.width,n=i/this._baseCanvas.height,o=1/(s>n?s:n);this.duration=this._videoElement.duration,this.trimStart=0,this.trimEnd=this.duration,this._videoObject=new g.fabric.Image(this._videoElement,{left:(this._baseCanvas.width-e*o)/2,top:(this._baseCanvas.height-i*o)/2,angle:0,scaleX:o,scaleY:o,selectable:!1})}pause(){}updatePlayState(t){}addAudio(){}playVideo(){this._videoElement.currentTime=this.trimStart,this._videoElement.play()}setTrimStartAndEndPosition(t,e){this.trimStart=t,this.trimEnd=e}setTrimStartPosition(t){this.trimStart=t}setTrimEndPosition(t){this.trimEnd=t}getViewObject(){return this._videoObject}getVideoElement(){return this._videoElement}getDuration(){return this.duration}getPlayBackRate(){return this.playBackRate}seek(t){}}class x{constructor(t,e,i,s,n){this._originalElement=t,this._baseObject=e,this.type="audiotimelineview",this._groupObject=null,this.waveFormObjectArray=[],this._leftTrim=0,this._rightTrim=0,this._audioWidth=0,this._audioVisibleWidth=0,this._audioLeft=-1,this._audioWidth=i,this._audioVisibleWidth=i,this._audioLeft=s;const a=i/this._baseObject.duration;this._leftTrim=a*this._baseObject.trimStart,this._rightTrim=a*this._baseObject.trimEnd,this.resetWaveFormView(),this._groupObject.set({left:s,top:n})}resetWaveFormView(){let e=this._originalElement;const i=e.width*e.scaleX,s=e.height*e.scaleX,n=Math.floor(this._audioWidth/i)+1;this.waveFormObjectArray=[];let a=0;const o=Math.floor(this._leftTrim/i),r=Math.floor(this._rightTrim/i);for(let l=0;l<n;l++){if(e=new g.fabric.Image(e.getElement(),{left:a,top:0,scaleX:e.scaleX,scaleY:e.scaleX}),l<o||l>r)e.visible=!1;else if(e.visible=!0,o===r)e.set({clipPath:new g.fabric.Rect({left:-i/2+(this._leftTrim-o*i),top:-s/2,width:this._rightTrim-this._leftTrim,height:s})});else{if(l===o&&this._leftTrim>0){const d=this._leftTrim-o*i;e.set({clipPath:new g.fabric.Rect({left:-i/2+d,top:-s/2,width:i-d,height:s})})}l===r&&e.set({clipPath:new g.fabric.Rect({left:-i/2,top:-s/2,width:this._rightTrim-r*i,height:s})})}this.waveFormObjectArray.push(e),a+=i}this._groupObject=new g.fabric.Group(this.waveFormObjectArray,{left:0,top:0,objectCaching:!1}),this._groupObject.selectable=!1}updateLeftTrimBy(t){const e=this._originalElement,i=e.width*e.scaleX,s=this._leftTrim+t,n=Math.floor(s/i),a=s-n*i;for(let o=0;o<this.waveFormObjectArray.length;o++){const r=this.waveFormObjectArray[o];if(o<n)r.visible=!1;else if(o===n){let d=e.width-a;this.waveFormObjectArray.length-1===n&&(d=this._rightTrim-a),r.set({clipPath:new g.fabric.Rect({left:-e.width/2+a,top:-e.height/2,width:d,height:e.height})})}}}updateRightTrimBy(t){const e=this._originalElement,i=e.width*e.scaleX,s=e.height*e.scaleX,n=this._rightTrim-t,a=Math.floor(n/i),o=Math.floor(this._leftTrim/i);for(let r=0;r<this.waveFormObjectArray.length;r++){const l=this.waveFormObjectArray[r];if(r>a)l.visible=!1;else if(r===a){let d=-i/2,b=n-a*i;if(o===a){const u=this._leftTrim-o*i;d+=u,b-=u}l.set({clipPath:new g.fabric.Rect({left:d,top:-s/2,width:b,height:s})})}}}
1moveObjectTo(t){this._audioLeft=t,this._groupObject.set({left:this._audioLeft-this._leftTrim})}moveObjectBy(t,e){this._audioLeft+=t,this._groupObject.set({left:this._groupObject.left+t,top:this._groupObject.top+e})}updateTimelineView(t,e,i,s){i.remove(this._groupObject);const n=t/e;this._audioWidth=n*this._baseObject.duration,this._leftTrim=n*this._baseObject.trimStart,this._rightTrim=n*this._baseObject.trimEnd,this._audioVisibleWidth=this._rightTrim-this._leftTrim;const a=this._groupObject.top;this._audioLeft=this._baseObject.refStartTime*n+s-this._leftTrim;for(let o=0;o<this.waveFormObjectArray.length;o++)this._groupObject.remove(this.waveFormObjectArray[o]);this._groupObject=null,this.waveFormObjectArray=[],this.resetWaveFormView(),i.add(this._groupObject),this._groupObject.set({left:this._audioLeft,top:a}),this._audioLeft+=this._leftTrim}getVisibleWidth(){return this._audioVisibleWidth}getVisibleLeft(){return-1===this._audioLeft?this._groupObject.left:this._audioLeft}getViewObject(){return this._groupObject}}class k extends g.fabric.Rect{constructor(t){super(t),this.type="outlinerect"}_render(t){const e=this.rx?Math.min(this.rx,this.width/2):0,i=this.ry?Math.min(this.ry,this.height/2):0,s=this.width,n=this.height,a=-this.width/2,o=-this.height/2,r=0!==e||0!==i,l=.4477152502;t.strokeStyle=this.stroke,t.beginPath(),t.moveTo(a+e,o),t.lineTo(a+s-e,o),r&&t.bezierCurveTo(a+s-l*e,o,a+s,o+l*i,a+s,o+i),t.lineTo(a+s,o+n-i),r&&t.bezierCurveTo(a+s,o+n-l*i,a+s-l*e,o+n,a+s-e,o+n),t.lineTo(a+e,o+n),r&&t.bezierCurveTo(a+l*e,o+n,a,o+n-l*i,a,o+n-i),t.lineTo(a,o+i),r&&t.bezierCurveTo(a,o+l*i,a+l*e,o,a+e,o),t.closePath(),t.stroke()}}class N extends g.fabric.Object{constructor(t){super(t),this.type="timelineDraw",this._numDivisons=0,this._widthStep=0,this._availableWidth=0}setDivisons(t,e){this._numDivisons=e,this._widthStep=t/this._numDivisons,this._availableWidth=t}setLeft(t){const e=t-this.width/2;this.left=e>-this.width/2?e:-this.width/2,this._currentDeltaX=e}_render(t){let e=0,i=0;const s=-this.width/2;if(this._currentDeltaX<s){const a=Math.abs(this._currentDeltaX-s);i=Math.ceil(a/this._widthStep),e=(i-a/this._widthStep)*this._widthStep}const n=this._availableWidth-i*this._widthStep+e;t.fillStyle=this.fill,t.fillRect(0,0,n<this.width?n:this.width,this.height),t.strokeStyle=this.stroke,t.font="10px Comic Sans MS",t.fillStyle="white",t.beginPath();for(let a=i;a<=this._numDivisons;a++)t.moveTo(e,0),t.lineTo(e,this.height/2),t.fillText(a.toString(),e+5,10),e+=this._widthStep;t.stroke()}}class D{constructor(t,e,i){this.document=i,this.type="thumbgenerator",this._videoElement=null,this._thumbCanvas=null,this._thumbs=[],this._videoLoaded=!1,this._scaleFactor=1,this._x=0,this._y=0,this._thumbCanvas=this.document.createElement("canvas"),this._thumbCanvas.width=e.width,this._thumbCanvas.height=e.height,this._videoElement=t,this._videoElement.setAttribute("muted","true"),this._videoElement.setAttribute("controls","true"),this._videoElement.style.display="none"}getSnaps(t=1){return new Promise((e,i)=>{if(t>this._videoElement.duration)return e(!0);const a=()=>{this._videoElement.removeEventListener("seeked",a),this._thumbCanvas.getContext("2d").drawImage(this._videoElement,this._x,this._y,this._thumbCanvas.width*this._scaleFactor,this._thumbCanvas.height*this._scaleFactor,0,0,this._thumbCanvas.width,this._thumbCanvas.height),this._thumbs.push(this._thumbCanvas.toDataURL()),e(!0)};return this._videoElement.addEventListener("seeked",a),this._videoElement.currentTime=Number(t),null})}getThumbs(t,e){const i=this,s=()=>(t.shift(),t.length?i.getSnaps(t[0]).then(s):e(i._thumbs));return i.getSnaps(t[0]).then(s)}generateThumbsSync(t,e){if(this._thumbs=[],!t.length)return e([]);if(this._videoLoaded)this.getThumbs(t,e);else{const i=this;this._videoElement.addEventListener("loadeddata",()=>{const s=i._videoElement.videoWidth,n=i._videoElement.videoHeight,a=i._thumbCanvas.width,o=i._thumbCanvas.height,r=s/a,l=n/o;i._scaleFactor=r<l?r:l,i._x=(s-a*i._scaleFactor)/2,i._y=(n-o*i._scaleFactor)/2,i._videoLoaded=!0;for(let d=0;d<t.length;d++){const b=()=>{i._videoElement.removeEventListener("seeked",b),i._thumbCanvas.getContext("2d").drawImage(i._videoElement,i._x,i._y,i._thumbCanvas.width*i._scaleFactor,i._thumbCanvas.height*i._scaleFactor,0,0,i._thumbCanvas.width,i._thumbCanvas.height),i._thumbs.push(i._thumbCanvas.toDataURL()),i._thumbs.length===t.length&&e(i._thumbs)};i._videoElement.addEventListener("seeked",b),i._videoElement.currentTime=Number(t[d])}})}}generateThumbs(t,e){if(this._thumbs=[],!t.length)return e([]);if(this._videoLoaded)this.getThumbs(t,e);else{const i=this._videoElement.videoWidth,s=this._videoElement.videoHeight,n=this._thumbCanvas.width,a=this._thumbCanvas.height,o=i/n,r=s/a;this._scaleFactor=o<r?o:r,this._x=(i-n*this._scaleFactor)/2,this._y=(s-a*this._scaleFactor)/2,this._videoLoaded=!0,this.getThumbs(t,e)}}
1generatePartialThumb(t,e){return new Promise((i,s)=>{const o=this.document.createElement("canvas");o.width=this._thumbCanvas.width*e,o.height=this._thumbCanvas.height;const r=this._videoElement.videoWidth,l=this._videoElement.videoHeight,d=r/o.width,b=l/o.height,u=d<b?d:b,p=(r-o.width*u)/2,w=(l-o.height*u)/2,j=()=>{this._videoElement.removeEventListener("seeked",j),o.getContext("2d").drawImage(this._videoElement,p,w,o.width*u,o.height*u,0,0,o.width,o.height),i(o.toDataURL())};return this._videoElement.addEventListener("seeked",j),this._videoElement.currentTime=Number(t),null})}}class I{constructor(t,e,i,s,n){this.type="overlapobjectview",this._groupObject=null,this._baseObject=null,this._rectObject=null,this._textObject=null,this._currentWidth=0,this._currentLeft=0,this._baseObject=t,this._rectObject=new g.fabric.Rect({left:0,top:0,width:e,height:i,fill:"yellow"}),this._textObject=new g.fabric.Text("Overlay",{left:0,top:0,fontSize:15,fill:"black"}),this._groupObject=new g.fabric.Group([this._rectObject,this._textObject],{left:s,top:n,objectCaching:!1}),this._groupObject.selectable=!1,this._currentWidth=e,this._currentLeft=s}setViewColorAndText(t,e){this._rectObject.set({fill:t}),this._textObject.set({text:e})}updateTimelineView(t,e,i){const s=t/e,n=this._baseObject.duration*s,a=this._baseObject.refStartTime*s+i;this._groupObject.item(0).set({width:n}),this._groupObject.set({left:a}),this._currentWidth=n,this._currentLeft=a}moveObjectTo(t){this._groupObject.set({left:t})}moveObjectBy(t,e){this._groupObject.set({left:this._groupObject.left+t,top:this._groupObject.top+e})}updateLeftTrimBy(t){this._groupObject.item(0).set({width:this._currentWidth+t}),this._groupObject.set({left:this._currentLeft+t})}updateRightTrimBy(t){this._groupObject.item(0).set({width:this._currentWidth-t})}getViewObject(){return this._groupObject}getVisibleWidth(){return this._groupObject.item(0).width}getVisibleLeft(){return this._groupObject.left}}class L{constructor(t,e,i){this.document=i,this.type="timelineobject",this._timelineCanvas=null,this._scaleFactor=1,this._thumbWidth=0,this._thumbHeight=0,this._thumbMap=null,this._thumbPositionMap=null,this._objectMap=new Map,this._selectedObjectId=-1,this._defaultObjectY=0,this._defaultObjectViewHeight=0,this._isObjectSelectionModeEnabled=!1,this.objectTrimmed=null,this.objectMoved=null,this.objectRemoved=null,this.objectAdded=null,this._videoPlaybackRateMap=null,this._generatorMap=null,this._timelineRect=null,this._initialDeltaX=0,this._initialDeltaY=0,this._timelineDrawView=null,this._timelineDrawLeft=0,this._selectionRectMap=null,this._transitionRectMap=null,this._selectedVideoId=-1,this.videoTrimmed=null,this.videoSelected=null,this.videosRearranged=null,this.videoRemoved=null,this._leftControlSelected=!1,this._scaleStarted=!1,this._initialMovePos=0,this._initialWidth=0,this._moveStarted=!1,this._timelineController=null,this._currentDeltaX=0,this._initialTrimStart=0,this._initialTrimEnd=0,this._initialLeftPos=0,this._objectThumbArray=[],this._selectedObjectIndex=0,this._initialObjectPosition=0,this._defaultTransitionWidth=0,this.previousDragDeltaX=0,this._timelineCanvas=t,this._timelineCanvas.selection=!1,typeof e<"u"&&(this._thumbWidth=e.thumbWidth,this._thumbHeight=e.thumbHeight)}setInitialX(t){this._initialDeltaX=t}setInitialY(t){this._initialDeltaY=t}setTimeLineController(t){this._timelineController=t}updateSelectionRectsAndTimeline(){for(const[i,s]of this._selectionRectMap.entries()){this._timelineCanvas.remove(s);const n=s.left,a=s.top;s.set({left:0,top:0}),this._timelineCanvas.add(s),s.set({left:n,top:a})}const t=this._timelineController.getTimelineObjectArray(),e=t[t.length-1];for(const[i,s]of this._transitionRectMap.entries()){if(i===e.objId)continue;this._timelineCanvas.remove(s);const n=s.left,a=s.top;s.set({left:0,top:0}),this._timelineCanvas.add(s),s.set({left:n,top:a})}this.reconfigureObjectViews(),this._timelineCanvas.remove(this._timelineDrawView),this._timelineCanvas.add(this._timelineDrawView),this._timelineCanvas.remove(this._timelineRect),this._timelineCanvas.add(this._timelineRect)}reconfigureAllThumbs(t){let e=t;const i=this._timelineController.getTimelineObjectArray(),s=this._timelineController.getObjectTransitionMap();let a=e,o=0;for(let r=0;r<i.length;r++){const l=i[r],d=l.objId,b=this._videoPlaybackRateMap.get(d),u=Math.ceil(l.duration/b/this._scaleFactor);let p=this._thumbMap.get(d),w=this._thumbPositionMap.get(d);const j=p.length,C=[],M=[],K=j/u,Q=(l.trimEnd-l.trimStart)/b/this._scaleFactor*this._thumbWidth,J=l.duration/b/this._scaleFactor*this._thumbWidth,$=l.trimStart/b/this._scaleFactor*this._thumbWidth,at=$+Q,q=Math.floor($/this._thumbWidth),it=Math.floor(at/this._thumbWidth),st=o/this._scaleFactor*this._thumbWidth,ht=o/this._scaleFactor;a=a-$-st;for(let F=0;F<j;F++)this._timelineCanvas.remove(p[F]);for(let F=0;F<u;F++){const lt=p[Math.floor(F*K)];this._timelineCanvas.remove(lt);const H=new g.fabric.Image(lt.getElement(),{left:0,top:this._initialDeltaY});if(H.selectable=!1,this._timelineCanvas.add(H),H.set({left:a}),F<q||F>it)H.set({opacity:0}
1);else if(H.set({opacity:1}),F<q+ht&&H.set({opacity:.5}),F===q){const tt=$-q*this._thumbWidth;H.set({clipPath:new g.fabric.Rect({left:-this._thumbWidth/2+tt,top:-this._thumbHeight/2,width:this._thumbWidth-tt,height:this._thumbHeight})})}else F===it&&H.set({clipPath:new g.fabric.Rect({left:-this._thumbWidth/2-1,top:-this._thumbHeight/2,width:at-it*this._thumbWidth+1,height:this._thumbHeight})});C.push(H),M.push(a),a+=this._thumbWidth}for(let F=0;F<j;F++)p[F].dispose();p=[],w=[],this._thumbMap.set(d,C),this._thumbPositionMap.set(d,M);const G=this._selectionRectMap.get(d);G.set({left:e-st,width:J,scaleX:Q/J}),o=s.get(d),e+=Q-st,a=e;const ot=this._transitionRectMap.get(d),rt=G.left+G.width*G.scaleX;let Y=o/this._scaleFactor*this._thumbWidth;0===Y?(Y=this._defaultTransitionWidth,ot.set({left:rt-Y/2,top:G.top,width:Y})):ot.set({left:rt-Y,top:G.top,width:Y})}this.updateTimelineSlider()}regenrateVisibleThumbs(){}setThumbDuration(t){const e=this.getThumbPlayheadPosition();this._scaleFactor=t,this.reconfigureAllThumbs(e)}regenerateThumbs(t){}reshuffleThumbs(t){for(const[e,i]of t.entries());}getThumbPlayheadPosition(){const e=this._timelineController.getTimelineObjectArray()[0],i=this._thumbMap.get(e.objId),s=e.trimStart/this._videoPlaybackRateMap.get(e.objId);return i[0].left+s/this._scaleFactor*this._thumbWidth}getTrimStartOffsetFromBase(){const e=this._timelineController.getTimelineObjectArray()[0];return this._thumbMap.get(e.objId),e.trimStart/this._scaleFactor*this._thumbWidth}moveThumbsAbsolutelyTo(t){for(const[i,s]of this._thumbMap.entries()){const n=this._thumbPositionMap.get(i);for(let o=0;o<s.length;o++)s[o].set({left:n[o]+t});this._selectionRectMap.get(i).set({left:n[0]+t})}const e=this._timelineController.getTimelineObjectArray();for(let i=0;i<e.length;i++){const s=e[i],n=this._selectionRectMap.get(i);n.set({left:n.left+s.trimStart/this._scaleFactor*this._thumbWidth})}this._currentDeltaX=t}moveThumbsBy(t){for(const[i,s]of this._thumbMap.entries()){const n=this._thumbPositionMap.get(i),a=this._selectionRectMap.get(i);a.set({left:a.left+t});const o=this._transitionRectMap.get(i);o.set({left:o.left+t});for(let r=0;r<s.length;r++)s[r].set({left:n[r]+t}),n[r]+=t}if(this._timelineDrawView.setLeft(this.getThumbPlayheadPosition()),null!=this._objectMap)for(const[i,s]of this._objectMap.entries()){s.moveObjectBy(t,0);const n=this._selectionRectMap.get(i);n.set({left:n.left+t})}}scrollViewsBy(t){if(null!=this._objectMap)for(const[e,i]of this._objectMap.entries()){i.moveObjectBy(0,t);const s=this._selectionRectMap.get(e);s.set({top:s.top+t})}}getAllViewWidth(){const t=this._timelineController.getTtimelineBaseDuration();let e=0;e=t/this._scaleFactor*this._thumbWidth;const i=this._timelineController.getTimelineTotalDuration();return i>t&&(e=e/t*i),e}addTimelineBar(){this._timelineRect=new g.fabric.Rect({left:this._initialDeltaX,top:0,width:2,height:this._timelineCanvas.height,fill:"red"}),this._timelineRect.selectable=!1,this._timelineCanvas.add(this._timelineRect)}reconfigureObjectViews(){const t=this._timelineController.getTimelineTotalDuration(),e=this.getAllViewWidth(),i=this._timelineController.getTimelineAudioObjectArray(),s=this.getThumbPlayheadPosition();for(let n=0;n<i.length;n++){const a=i[n],o=this._objectMap.get(a.objId);o instanceof x?o.updateTimelineView(e,t,this._timelineCanvas,s):o.updateTimelineView(e,t,s),this._selectionRectMap.get(a.objId).set({left:o.getVisibleLeft(),width:o.getVisibleWidth()})}}updateTimelineSliderForObject(){const t=this.getAllViewWidth(),e=this._timelineController.getTimelineTotalDuration();this._timelineDrawView.setDivisons(t,Math.floor(e))}setOverlapViewPosition(t,e){this._defaultObjectY=t,this._defaultObjectViewHeight=e}addOverlapObjectView(t,e,i,s,n){const a=t.getDuration(),o=this._timelineController.getTimelineTotalDuration(),l=this.getAllViewWidth()/o,d=l*a,b=this.getThumbPlayheadPosition(),p=new I(t,d,i,b+l*t.refStartTime,e);p.setViewColorAndText(n,s),null===this._objectMap&&(this._objectMap=new Map),this._objectMap.set(t.objId,p),this.addObjectToCanvas(t,p)}addObjectToCanvas(t,e){const i=e.getViewObject(),s=e.getVisibleLeft();i.set({left:0});const n=this._timelineCanvas.getIndexOf(this._timelineDrawView);this._timelineCanvas.insertAt(i,n,!1),i.set({left:s}),this._timelineCanvas.remove(this._timelineRect),this._timelineCanvas.add(this._timelineRect);const a=new k({left:0,top:i.top,width:i.width,height:i.height,stroke:"red",strokeWidth:4,objectCaching:!1});this._timelineCanvas.insertAt(a,n+1,!1),a.set({left:i.left,top:i.top}),a.visible=!1,a.hasControls=!1,a.lockMovementX=!0,a.lockMovementY=!0,this._selectionRectMap.set(t.objId,a),null!=this.objectAdded&&this.objectAdded(),this.updateTimelineSliderForObject()}addAudioObjectView(t,e,i){const n=this._timelineController.getTimelineAudioObjectArray(),a=n[n.length-1],o=a.getDuration(),r=this._timelineController.getTimelineTotalDuration(),d=this.getAllViewWidth()/r*o,b=this.getThumbPlayheadPosition(),u=new x(t,a,d,b,e);null===this._objectMap&&(this._objectMap=new Map),this._objectMap.set(a.objId,u),this.addObjectToCanvas(a,u)}updateAudioObjectView(){}addTimelineSlider(t,e){this._timelineDrawLeft=-this._timelineCanvas.width/2+this._initialDeltaX,this._timelineDrawView=new N({left:this._timelineDrawLeft,top:-t/2,width:this._timelineCanvas.width,height:t,fill:"gray",stroke:"black",objectCaching:!1});const i=this.getAllViewWidth();this._timelineDrawView.setDivisons(i,Math.floor(e)),this._timelineDrawView.setLeft(this._initialDeltaX),this._timelineCanvas.add(this._timelineDrawView),this._timelineDrawView.selectable=!1}addTransitionViews(){const t=this._timelineController.getTimelineObjectArray();this._defaultTransitionWidth=this._thumbWidth/4,null===this._transitionRectMap&&(this._transitionRectMap=new Map);for(let e=0;e<t.length;e++){const s=t[e].objId,n=this._selectionRectMap.get(s),a=n.left+n.width*n.scaleX,o=new g.fabric.Rect({width:this._defaultTransitionWidth,height:n.height,left:0,top:0,fill:"green",opacity:.5});this._transitionRectMap.set(s,o),e<t.length-1&&(this._timelineCanvas.add(o),o.set({left:a-this._defaultTransitionWidth/2,top:n.top}
1))}}updateTimelineSlider(){let t=0;const e=this._timelineController.getTimelineObjectArray();let i=0;const s=this._timelineController.getObjectTransitionMap();let n=0;for(let l=0;l<e.length;l++){const d=e[l],b=d.getVideoElement();t+=(d.trimEnd-d.trimStart)/b.playbackRate,0===l&&(i=this._thumbMap.get(d.objId)[0].left+d.trimStart/b.playbackRate/this._scaleFactor*this._thumbWidth),n+=s.get(d.objId)}t-=n;const a=this.getAllViewWidth();let o=0;const r=this._timelineController.getTimelineAudioObjectArray();for(let l=0;l<r.length;l++){const d=r[l],b=d.refStartTime+(d.trimEnd-d.trimStart);b>o&&(o=b)}o>t&&(t=o),this._timelineDrawView.setDivisons(a,Math.floor(t)),this._timelineDrawView.setLeft(i)}selectTimelineSlider(t,e){const s=this._timelineController.getTimelineObjectArray();let n=null,a=!1,o=!1;e>this._defaultObjectY&&e<this._defaultObjectY+this._defaultObjectViewHeight&&(o=!0);let r=[];for(let d=0;d<s.length;d++)r.push(s[d]);const l=this._timelineController.getTimelineAudioObjectArray();for(let d=0;d<l.length;d++)r.push(l[d]);for(let d=0;d<r.length;d++){const b=r[d],u=this._selectionRectMap.get(b.objId);u.visible&&(n=u),u.visible=!1,t>u.left+20&&t<u.left+u.width*u.scaleX-20&&e>u.top&&e<u.top+u.height*u.scaleY&&(u.visible=!0,a=!0,this._timelineCanvas.setActiveObject(u),!0===o?(this._isObjectSelectionModeEnabled=!0,this._selectedObjectId=b.objId,this._timelineController.fireObjectSelectedEvent(b)):(this._isObjectSelectionModeEnabled=!1,this._selectedVideoId=b.objId,null!==this.videoSelected&&(this.videoSelected(this._selectedVideoId),this._timelineController.fireObjectSelectedEvent(b))))}!1===a&&null!==n&&(n.visible=!0,this._timelineCanvas.setActiveObject(n)),r=[]}speedSelectedVideoBy(t){const e=this.getThumbPlayheadPosition();this._videoPlaybackRateMap.set(this._selectedVideoId,t),this.reconfigureAllThumbs(e)}updateTransitionDuration(t){this._transitionRectMap.get(this._selectedVideoId);const i=this.getThumbPlayheadPosition();this.reconfigureAllThumbs(i)}startDrag(t,e){let i=null,s=-1,n=0,a=null;this._scaleStarted=!1,this._moveStarted=!1,this._initialMovePos=t;let o=null;this._isObjectSelectionModeEnabled?(o=this._timelineController.getTimelineAudioObjectArray(),s=this._selectedObjectId):(o=this._timelineController.getTimelineObjectArray(),s=this._selectedVideoId);let r=[];const l=this._timelineController.getTimelineObjectArray();for(let j=0;j<l.length;j++)r.push(l[j]);const d=this._timelineController.getTimelineAudioObjectArray();for(let j=0;j<d.length;j++)r.push(d[j]);let b=!1;for(let j=0;j<r.length;j++){const M=this._selectionRectMap.get(r[j].objId);M.visible&&t>M.left&&t<M.left+M.width*M.scaleX&&e>M.top&&e<M.top+M.height*M.scaleY&&(b=!0)}if(!b)return;for(let j=0;j<o.length;j++)if(i=o[j],s===i.objId){n=j,a=this._selectionRectMap.get(s);break}if(null===a)return;const u=a.width*a.scaleX,p=Math.abs(t-a.left),w=Math.abs(t-a.left-u);p<this._thumbWidth/2||w<this._thumbWidth/2?this._scaleStarted=!0:this._moveStarted=!0,!0===this._scaleStarted&&(this._leftControlSelected=p<w,this._initialWidth=u,this._initialTrimStart=i.trimStart,this._initialTrimEnd=i.trimEnd,this._initialLeftPos=this._isObjectSelectionModeEnabled?a.left:this.getThumbPlayheadPosition()),!0===this._moveStarted&&(this._isObjectSelectionModeEnabled&&(this._initialLeftPos=a.left),this._isObjectSelectionModeEnabled||(a.hasBorders=!1,a.visible=!1,this.enableObjectRepresentation(!0,this._initialMovePos),this._initialObjectPosition=this._selectedObjectIndex))}dragObjectBy(t){const e=this.getThumbPlayheadPosition();if(this._moveStarted){let s=this._initialLeftPos+(t-this._initialMovePos);s<e&&(s=e);const n=this._objectMap.get(this._selectedObjectId);n.moveObjectTo(s),this._selectionRectMap.get(this._selectedObjectId).set({left:n.getVisibleLeft()})}if(this._scaleStarted){let i=t-this._initialMovePos;const s=this._initialLeftPos+i,n=this._objectMap.get(this._selectedObjectId);this._leftControlSelected?(n.updateLeftTrimBy(i),this._selectionRectMap.get(this._selectedObjectId).set({left:s,width:this._initialWidth-i})):(i=this._initialMovePos-t,n.updateRightTrimBy(i),this._selectionRectMap.get(this._selectedObjectId).set({width:this._initialWidth-i}))}}dragMouseBy(t){if(!this._scaleStarted&&!this._moveStarted){const e=t-this._initialMovePos;return this._initialMovePos=t,void this._timelineController.scrollTimeLine(e,0)}if(this._isObjectSelectionModeEnabled)this.dragObjectBy(t);else if(this._scaleStarted){const e=this._timelineController.getTimelineObjectArray();let i=null,s=null,n=0;for(let o=0;o<e.length;o++)if(i=e[o],this._selectedVideoId===i.objId){n=o,s=this._selectionRectMap.get(this._selectedVideoId);break}const a=t-this._initialMovePos;if(this._leftControlSelected?i.trimStart=this._initialTrimStart+a/s.width*i.duration:i.trimEnd=this._initialTrimEnd+a/s.width*i.duration,0!==n&&this._leftControlSelected)this.reconfigureAllThumbs(this._initialLeftPos+a);else{const o=this.getThumbPlayheadPosition();this.reconfigureAllThumbs(o)}}else this._moveStarted&&this.moveObjectPosition(this._initialMovePos,t-this._initialMovePos)}endObjectDrag(t){if(!this._scaleStarted&&!this._moveStarted)return;const e=this._objectMap.get(this._selectedObjectId),i=this._timelineController.getTimelineTotalDuration(),s=this.getAllViewWidth(),n=this.getThumbPlayheadPosition();if(this._moveStarted){let r=this._initialLeftPos+(t-this._initialMovePos);r<n&&(r=n),null!=this.objectMoved&&this.objectMoved(this._selectedObjectId,r)}if(this._scaleStarted){const o=t-this._initialMovePos,l=i/s;this._leftControlSelected?null!=this.objectTrimmed&&this.objectTrimmed(this._selectedObjectId,o*l,0):null!=this.objectTrimmed&&this.objectTrimmed(this._selectedObjectId,0,o*l)}e instanceof x?e.updateTimelineView(s,i,this._timelineCanvas,this.getThumbPlayheadPosition()):e.updateTimelineView(s,i,this.getThumbPlayheadPosition()),this._selectionRectMap.get(this._selectedObjectId).set({left:e.getVisibleLeft(),width:e.getVisibleWidth()}),this.updateTimelineSliderForObject()}endDrag(t){if(this._isObjectSelectionModeEnabled)this.endObjectDrag(t);else{if(this._scaleStarted){this._scaleStarted=!1;const e=this._timelineController.getTimelineObjectArray();for(let i=0;i<e.length;i++){const s=e[i];if(this._selectedVideoId===s.objId){const n=this._selectionRectMap.get(this._selectedVideoId),a=this._initialWidth-n.width*n.scaleX;this._leftControlSelected?s.trimStart=this._initialTrimStart+a/n.width*s.duration:s.trimEnd=this._initialTrimEnd-a/n.width*s.duration;const o=this.getThumbPlayheadPosition();this.reconfigureAllThumbs(o),this.videoTrimmed(this._selectedVideoId,0);break}}this.updateSelectionRectsAndTimeline()}if(this._moveStarted){this._moveStarted=!1,this._selectedObjectIndex!==this._initialObjectPosition?this.moveObjectFrom(this._initialObjectPosition,this._selectedObjectIndex):this.reconfigureAllThumbs(this.getThumbPlayheadPosition());const e=this._timelineController.getTimelineObjectArray();let i=null;for(let s=0;s<e.length;
1s++)if(this._selectedVideoId===e[s].objId){i=this._selectionRectMap.get(this._selectedVideoId);break}i.hasBorders=!0,i.visible=!0,this.enableObjectRepresentation(!1,0),this.updateSelectionRectsAndTimeline()}}}addSelectionRectEvents(t){this._selectionRectMap.get(t)}configureObjectRepresentation(){this._objectThumbArray=[];const t=this._timelineController.getTimelineObjectArray();for(let e=0;e<t.length;e++){const s=this._thumbMap.get(t[e].objId),n=Math.floor(s.length/2),o=new g.fabric.Image(s[n].getElement(),{left:0,top:this._initialDeltaY});o.selectable=!1,o.visible=!1,this._timelineCanvas.add(o),this._objectThumbArray.push(o)}}configureTimelineObject(t){const e=this._thumbMap.get(t.objId),i=Math.floor(e.length/2),n=new g.fabric.Image(e[i].getElement(),{left:0,top:this._initialDeltaY});n.selectable=!1,n.visible=!1,this._timelineCanvas.add(n),this._objectThumbArray.push(n),this.updateTimelineSliderForObject()}enableObjectRepresentation(t,e){const i=this._timelineController.getTimelineObjectArray();let s=0;for(let n=0;n<i.length;n++)if(this._selectedVideoId===i[n].objId){s=n;break}for(let n=0;n<i.length;n++){const o=this._thumbMap.get(i[n].objId);for(let l=0;l<o.length;l++)o[l].visible=!t;this._objectThumbArray[n].visible=t,this._objectThumbArray[n].set({left:e-this._thumbWidth/2+(n-s)*this._thumbWidth})}this._selectedObjectIndex=s}moveObjectPosition(t,e){this._objectThumbArray[this._selectedObjectIndex].set({left:t-this._thumbWidth/2+e});const s=Math.abs(e);if(1===Math.floor(s/this._thumbWidth))if(e>0){const a=this._selectedObjectIndex+1;if(a>=this._objectThumbArray.length)return;const o=this._objectThumbArray[a];o.set({left:o.left-this._thumbWidth}),this._initialMovePos=this._objectThumbArray[this._selectedObjectIndex].left+this._thumbWidth/2,this._objectThumbArray.splice(a,0,this._objectThumbArray.splice(this._selectedObjectIndex,1)[0]),this._selectedObjectIndex+=1}else{const a=this._selectedObjectIndex-1;if(a<0)return;const o=this._objectThumbArray[a];o.set({left:o.left+this._thumbWidth}),this._initialMovePos=this._objectThumbArray[this._selectedObjectIndex].left+this._thumbWidth/2,this._objectThumbArray.splice(a,0,this._objectThumbArray.splice(this._selectedObjectIndex,1)[0]),this._selectedObjectIndex-=1}}moveObjectFrom(t,e){const i=this.getThumbPlayheadPosition(),s=this._timelineController.getTimelineObjectArray();s.splice(e,0,s.splice(t,1)[0]),this.reconfigureAllThumbs(i),null!==this.videosRearranged&&this.videosRearranged(t,e)}deleteSelectedObject(){const t=this.getThumbPlayheadPosition(),e=this._timelineController.getTimelineObjectArray();let i=0;for(let o=0;o<e.length;o++)if(this._selectedVideoId===e[o].objId){i=o;break}let s=this._thumbMap.get(this._selectedVideoId),n=this._thumbPositionMap.get(this._selectedVideoId);for(let o=0;o<s.length;o++)this._timelineCanvas.remove(s[o]);s=[],n=[],e.splice(i,1);const a=this._selectionRectMap.get(this._selectedVideoId);this._timelineCanvas.remove(a),this.reconfigureAllThumbs(t),null!==this.videoRemoved&&this.videoRemoved()}deleteOverlay(){let t=-1;const e=this._timelineController.getTimelineAudioObjectArray();for(let i=0;i<e.length;i++)if(this._selectedObjectId===e[i].objId){t=i;break}if(t>=0){const i=this._objectMap.get(this._selectedObjectId);this._objectMap.delete(this._selectedObjectId),this._timelineCanvas.remove(i.getViewObject());const s=e[t];e.splice(t,1);const n=this._selectionRectMap.get(this._selectedObjectId);this._timelineCanvas.remove(n),this._selectionRectMap.delete(this._selectedObjectId),this._timelineController._fabricCanvas.remove(s.getViewObject()),this._timelineController.updateTimelineDurationAndWidth(),this.updateTimelineSliderForObject()}}addThumbsAndSelectionRectAtPosition(t,e){const i=t.objId;let s=this._initialDeltaX;const n=this._timelineController.getTimelineObjectArray();for(let u=0;u<e;u++){const p=n[u],w=p.getVideoElement();s+=(p.trimEnd-p.trimStart)/w.playbackRate/this._scaleFactor*this._thumbWidth}const o=(t.trimEnd-t.trimStart)/this._scaleFactor*this._thumbWidth;null===this._selectionRectMap&&(this._selectionRectMap=new Map);const r=this._thumbMap.get(i),l=this._thumbPositionMap.get(i),d=s;for(let u=0;u<r.length;u++){const p=r[u];if(this._timelineCanvas.add(p),p.set({left:s}),p.selectable=!1,l[u]=s,u===r.length-1){const w=o-(r.length-1)*this._thumbWidth;p.set({clipPath:new g.fabric.Rect({left:-this._thumbWidth/2-1,top:-this._thumbHe
1ight/2,width:w,height:this._thumbHeight}),opacity:1}),s+=w}else s+=this._thumbWidth}const b=new k({left:0,top:0,width:o,height:this._thumbHeight,stroke:"green",strokeWidth:4});this._timelineCanvas.add(b),b.set({left:d,top:r[0].top}),b.visible=!1,b.hasControls=!1,b.lockMovementX=!0,b.lockMovementY=!0,this._selectionRectMap.set(i,b),this.addSelectionRectEvents(i)}addImageTimelineThumb(t,e,i){null===this._thumbMap&&(this._thumbMap=new Map),null===this._thumbPositionMap&&(this._thumbPositionMap=new Map),null===this._videoPlaybackRateMap&&(this._videoPlaybackRateMap=new Map);const s=t.duration,n=[];let a=0;typeof i<"u"&&(this._scaleFactor=i);const o=s;for(;a<o;)n.push(a),a+=1/this._scaleFactor;const r=[],l=[];for(let d=0;d<n.length;d++){const b=new g.fabric.Image(e,{left:0,top:this._initialDeltaY});r.push(b),l.push(0)}this._thumbMap.set(t.objId,r),this._thumbPositionMap.set(t.objId,l),this._videoPlaybackRateMap.set(t.objId,1)}generateVideoThumbs(t,e){const i=this;null===this._generatorMap&&(this._generatorMap=new Map);let s=null;this._generatorMap.has(t.objId)?s=this._generatorMap.get(t.objId):(s=new D(t.getVideoElement(),{width:i._thumbWidth,height:i._thumbHeight},this.document),this._generatorMap.set(t.objId,s)),null===this._thumbMap&&(this._thumbMap=new Map),null===this._thumbPositionMap&&(this._thumbPositionMap=new Map),null===this._videoPlaybackRateMap&&(this._videoPlaybackRateMap=new Map);const a=[];let o=0;const r=t.duration;for(;o<r;)a.push(o),o+=1/this._scaleFactor;const l=[],d=[];s.generateThumbs(a,b=>{for(let u=0;u<b.length;u++){const p=new Image(i._thumbWidth,i._thumbHeight);p.src=b[u];const w=new g.fabric.Image(p,{left:0,top:i._initialDeltaY});l.push(w),d.push(0)}i._thumbMap.set(t.objId,l),i._thumbPositionMap.set(t.objId,d),i._videoPlaybackRateMap.set(t.objId,1),typeof e<"u"&&e()})}updateVideoThumbs(t,e){}deleteVideoThumbs(t){}}var A=v(87320);class _{constructor(){this.type="dummyvideo",this.playbackRate=1,this.duration=0,this.currentTime=0,this.paused=!1}play(){this.paused=!1}pause(){this.paused=!0}}class m extends E{constructor(t,e,i,s){super(),this.document=s,this.type="imageobject",this._imageObject=null,this._videoElement=null,this.speedFactor=1,this._thumbImage=null;const n=this;g.fabric.Image.fromURL(t,a=>{n._videoElement=new _,n._imageObject=a;const o=a.width,r=a.height;let l,d;e.clipPath?(l=e.clipPath.width,d=e.clipPath.height):(l=e.width/e.viewportTransform[0],d=e.height/e.viewportTransform[3]);const b=o/l,u=r/d,w=1/(b>u?b:u);n._imageObject.set({left:(l-o*w)/2,top:(d-r*w)/2,scaleX:w,scaleY:w}),typeof i<"u"&&i()},{crossOrigin:"anonymous"})}pause(){}updatePlayState(t){}addAudio(){}playVideo(){}setTrimStartAndEndPosition(t,e){this.trimStart=t,this.trimEnd=e}setTrimStartPosition(t){this.trimStart=t}setTrimEndPosition(t){this.trimEnd=t}getViewObject(){return this._imageObject}getVideoElement(){return this._videoElement}setDefaultDuration(t){this.duration=t,this.trimEnd=t,this._videoElement.duration=t}getDuration(){return this.duration}seek(t){}generateThumbImageElement(t){if(null===this._thumbImage){const e=this.document.createElement("canvas");e.width=t,e.height=t;const i=this._imageObject.getElement(),s=this._imageObject.width,n=this._imageObject.height,a=s/t,o=n/t,r=a<o?a:o,l=(s-t*r)/2,d=(n-t*r)/2;e.getContext("2d").drawImage(i,l,d,t*r,t*r,0,0,t,t);const u=e.toDataURL();this._thumbImage=new Image(t,t),this._thumbImage.src=u}return this._thumbImage}}var h=v(16135);class T{constructor(t,e,i){this.animationId=-1,this.category=1,this.animationType=1,this.duration=0,this.frequency=1,this.category=t,this.type=e,this.duration=i}}class f{constructor(){this.type="timelineanimationobject",this.inAnimationObject=null,this.overallAnimationObject=null,this.outAnimationObject=null,this.totalDuration=0,this._inTime=0,this._overallTime=0,this._outTime=0,this._animationTimeline=null,this._overallTimeline=null,this._baseCanvas=null,this._baseObject=null,this._isPaused=!0,this._baseX=0,this._baseY=0,this._baseScale=1,this._baseAngle=0}setBaseFabricObject(t,e){this._baseObject=t,this._baseCanvas=e}updateCanvas(t){this._baseCanvas=t}
1addUpdateAnimation(t,e,i){switch(t){case 1:this.inAnimationObject=new T(t,e,i);break;case 2:this.overallAnimationObject=new T(t,e,i);break;case 3:this.outAnimationObject=new T(t,e,i)}this._animationTimeline=null}configureInAnimation(t){const e=this.inAnimationObject.type;let i=this._baseObject.left,s=this._baseObject.top,n=this._baseObject.scaleX,a=this._baseObject.angle,o=this._baseObject.opacity,r=this._baseObject.width,l=this._baseObject.height,d=-r/2,b=-l/2,u=r,p=l,w=!1,j=new g.fabric.Rect({left:d,top:b,width:u,height:p});switch(e){case h.J.ANIMATION_IN_LEFT:i=-this._baseObject.width/2;break;case h.J.ANIMATION_IN_RIGHT:i=this._baseCanvas.width+this._baseObject.width/2;break;case h.J.ANIMATION_IN_TOP:s=-this._baseObject.height/2;break;case h.J.ANIMATION_IN_BOTTOM:s=this._baseCanvas.height+this._baseObject.height/2;break;case h.J.ANIMATION_IN_ZOOM:n=0;break;case h.J.ANIMATION_IN_BLINK:o=0;break;case h.J.ANIMATION_IN_ROTATE:a=-360;break;case h.J.ANIMATION_IN_SCALE_ROTATE:a=-360,n=0;break;case h.J.ANIMATION_IN_MASK_LEFT_OPEN:w=!0,u=0;break;case h.J.ANIMATION_IN_MASK_RIGHT_OPEN:w=!0,d=r/2;break;case h.J.ANIMATION_IN_MASK_TOP_OPEN:w=!0,p=0;break;case h.J.ANIMATION_IN_MASK_BOTTOM_OPEN:w=!0,b=l/2;break;case h.J.ANIMATION_IN_MASK_CENTER_HORIZONTAL_OPEN:w=!0,d=0,u=0;break;case h.J.ANIMATION_IN_MASK_CENTER_VERTICAL_OPEN:w=!0,b=0,p=0}let C=this;w?this._animationTimeline.from(j,{duration:t,left:d,top:b,width:u,height:p,onUpdate(){C._baseObject.clipPath=new g.fabric.Rect({left:j.left,top:j.top,width:j.width,height:j.height}),C._baseObject.set("dirty",!0)}},0):this._animationTimeline.from(this._baseObject,{duration:t,left:i,top:s,scaleX:n,scaleY:n,angle:a,opacity:o},0)}configureOverallAnimation(t){this._overallTimeline=null;const e=this.overallAnimationObject.duration,i=this.overallAnimationObject.type,s=Math.ceil(t/e);switch(this._overallTimeline=gsap.timeline({repeat:s}),i){case h.J.ANIMATION_OVERALL_BLINK:this._overallTimeline.to(this._baseObject,{duration:e/2,opacity:0}
1),this._overallTimeline.to(this._baseObject,{duration:e/2,opacity:1});break;case h.J.ANIMATION_OVERALL_SPIN_CW:this._overallTimeline.to(this._baseObject,{duration:e,angle:360});break;case h.J.ANIMATION_OVERALL_SPIN_CCW:this._overallTimeline.to(this._baseObject,{duration:e,angle:-360});break;case h.J.ANIMATION_OVERALL_SCALE_ZOOMIN_ZOOMOUT:this._overallTimeline.to(this._baseObject,{duration:e/2,scaleX:.5,scaleY:.5}),this._overallTimeline.to(this._baseObject,{duration:e/2,scaleX:1,scaleY:1});break;case h.J.ANIMATION_OVERALL_LEFT_RIGHT:const n=this._baseObject.left,o=n/this._baseCanvas.width*(e/2);this._overallTimeline.to(this._baseObject,{duration:o,left:0}),this._overallTimeline.to(this._baseObject,{duration:e/2,left:this._baseCanvas.width-this._baseObject.width/2}),this._overallTimeline.to(this._baseObject,{duration:e/2-o,left:n})}}configureOutAnimation(t,e){const i=this.outAnimationObject.type;let s=this._baseObject.left,n=this._baseObject.top,a=this._baseObject.scaleX,o=this._baseObject.angle,r=this._baseObject.opacity,l=this._baseObject.width,d=this._baseObject.height,b=-l/2,u=-d/2,p=l,w=d,j=!1,C=new g.fabric.Rect({left:b,top:u,width:p,height:w});switch(i){case h.J.ANIMATION_OUT_LEFT:s=-this._baseObject.width/2;break;case h.J.ANIMATION_OUT_RIGHT:s=this._baseCanvas.width+this._baseObject.width/2;break;case h.J.ANIMATION_OUT_TOP:n=-this._baseObject.height/2;break;case h.J.ANIMATION_OUT_BOTTOM:n=this._baseCanvas.height+this._baseObject.height/2;break;case h.J.ANIMATION_OUT_ZOOM:a=0;break;case h.J.ANIMATION_OUT_BLINK:r=0;break;case h.J.ANIMATION_OUT_SCALE_ROTATE:a=0,o=360;break;case h.J.ANIMATION_OUT_MASK_LEFT_CLOSE:j=!0,p=0;break;case h.J.ANIMATION_OUT_MASK_RIGHT_CLOSE:j=!0,b=l/2,p=0;break;case h.J.ANIMATION_OUT_MASK_TOP_CLOSE:j=!0,w=0;break;case h.J.ANIMATION_OUT_MASK_BOTTOM_CLOSE:j=!0,u=d/2,w=0;break;case h.J.ANIMATION_OUT_MASK_CENTER_VERTICAL_CLOSE:j=!0,w=0,u=0;break;case h.J.ANIMATION_OUT_MASK_CENTER_HORIZONTAL_CLOSE:j=!0,p=0,b=0}let M=this;j?this._animationTimeline.to(C,{duration:t,left:b,top:u,width:p,height:w,onUpdate(){M._baseObject.clipPath=new g.fabric.Rect({left:C.left,top:C.top,width:C.width,height:C.height}),M._baseObject.set("dirty",!0)}},e):this._animationTimeline.to(this._baseObject,{duration:t,left:s,top:n,scaleX:a,scaleY:a,angle:o,opacity:r},e)}configureAnimationTimeline(){this._animationTimeline=null,this._animationTimeline=gsap.timeline(),this._inTime=0,this._outTime=0,null!==this.inAnimationObject&&(this._inTime+=this.inAnimationObject.duration),null!==this.outAnimationObject&&(this._outTime+=this.outAnimationObject.duration),this._overallTime=this.totalDuration-this._inTime-this._outTime,null!==this.inAnimationObject&&this.configureInAnimation(this._inTime),null!==this.overallAnimationObject&&(this.configureOverallAnimation(this._overallTime),this._animationTimeline.add(this._overallTimeline)),null!==this.outAnimationObject&&this.configureOutAnimation(this._outTime,this.totalDuration-this._outTime)}play(t){this._isPaused&&(null===this._animationTimeline&&this.configureAnimationTimeline(),this._isPaused=!1,this._animationTimeline.seek(t),this._animationTimeline.play()),t>this._inTime+this._overallTime&&null!=this._overallTimeline&&this._overallTimeline.pause()}pause(){this._isPaused=!0,null!=this._animationTimeline&&this._animationTimeline.pause()}seekTo(t){null===this._animationTimeline&&this.configureAnimationTimeline(),this._animationTimeline.seek(t,!1),this._animationTimeline.pause()}reconfigureToBaseState(){this._baseObject.left=this._baseX,this._baseObject.top=this._baseY,this._baseObject.angle=this._baseAngle}setBaseAnimationState(){this._baseX=this._baseObject.left,this._baseY=this._baseObject.top,this._baseAngle=this._baseObject.angle,this._baseScale=this._baseObject.scaleX}setTotalDuration(t){this.totalDuration=t}}class c extends E{constructor(t,e){let i,s;super(),this.type="mixedtextoverlayobject",this.timelineAnimationObject=null,this._viewCanvas=null,this._baseObject=null,this._isAdded=!1,this._isPaused=!0,this._mixedGroupAnimation=null,this._viewCanvas=e,e.clipPath?(i=e.clipPath.width,s=e.clipPath.height):(i=e.width/e.viewportTransform[0],s=e.height/e.viewportTransform[3]),t.setPosition(i/2-t.baseContainer.width/2,s/2-t.baseContainer.height/2),this.timelineAnimationObject=ne
1w f,this._baseObject=t,t.onSelect=()=>{this.onSelect&&this.onSelect(this)}}updateBaseCanvas(t){this._viewCanvas=t,this.timelineAnimationObject.updateCanvas(t)}addAnimation(t,e,i){}setAnimation(t){this._mixedGroupAnimation=t}updatePlayState(t){t>this.refStartTime&&t<this.refStartTime+this.duration?this._isPaused&&(this._isPaused=!1,this._mixedGroupAnimation&&(this._mixedGroupAnimation.seek(t-this.refStartTime),this._mixedGroupAnimation.play())):(this._isPaused=!0,this._mixedGroupAnimation&&this._mixedGroupAnimation.pause())}pause(){this._isPaused=!0,this._mixedGroupAnimation&&this._mixedGroupAnimation.pause()}setBaseState(){}seek(t){t>=this.refStartTime&&t<this.refStartTime+this.duration&&this._mixedGroupAnimation&&(this._mixedGroupAnimation.seek(t-this.refStartTime),this._mixedGroupAnimation.pause())}getViewObject(){return null}addViewObjectToCanvas(){this._isAdded||(this._baseObject.addToCanvas(this._viewCanvas),this._isAdded=!0)}removeViewObjectFromCanvas(){this._isAdded&&(this._baseObject.removeFromCanvas(this._viewCanvas),this._isAdded=!1)}getVideoElement(){throw new Error("Method not implemented.")}getDuration(){return this.duration}setDuration(t){this.duration=t}}class O{constructor(t,e,i,s){this.document=s,this.type="timelinecontroller",this._fabricCanvas=null,this._timelineView=null,this._timelineCanvas=null,this._thumbWidth=100,this._thumbHeight=100,this._baseTimelineObjectArray=[],this._currentDuration=0,this._totalDuration=0,this._baseTimelineDuration=0,this._timelineWidthPixels=0,this._objectIndex=0,this._overlapObjectIndex=100,this._defaultStartPos=0,this._playStartTimeStamp=0,this._currentPlayingVideoId=0,this._updatedCurrentPosition=0,this._defaultTimelineObjectDuration=4,this.playerEnded=null,this._lastTimePosition=0,this._selectedVideoId=-1,this._isMouseDown=!1,this._isDragOn=!1,this._baseFilter=null,this._videoTransitionMap=null,this._currentTransitionCanvas=null,this._nextTransitionCanvas=null,this._transitionImageObject=null,this._otherObjectArray=[],this._timelineSliderHeight=25,this._overlapViewHeight=50,this._audioViewHeight=50,this._audioWaveFormObject=null,this._isTimelinePaused=!0,this.changedDurationAndWidth=null,this._backgroundColor="white",this._fabricCanvas=t,this._timelineCanvas=e,i&&(this._thumbWidth=i.thumb.width,this._thumbHeight=i.thumb.height);const n=this;this._timelineView=new L(e,{thumbWidth:this._thumbWidth,thumbHeight:this._thumbHeight},this.document),this._timelineCanvas.on("mouse:wheel",a=>{n.scrollTimeLine(-a.e.deltaX,-a.e.deltaY),a.e.preventDefault(),a.e.stopPropagation()}),this._timelineCanvas.on("mouse:down",a=>{n._isMouseDown=!0}),this._timelineCanvas.on("mouse:up",a=>{n._isMouseDown=!1,n._isDragOn?(n._isDragOn=!1,n._timelineView.endDrag(a.pointer.x)):n._timelineView.selectTimelineSlider(a.pointer.x,a.pointer.y)}),this._timelineCanvas.on("mouse:move",a=>{n._isMouseDown&&!n._isDragOn&&(n._isDragOn=!0,n._timelineView.startDrag(a.pointer.x,a.pointer.y)),n._isDragOn&&n._timelineView.dragMouseBy(a.pointer.x)}),this._defaultStartPos=this._timelineCanvas.width/2,this._currentDuration=0,this._timelineView.setInitialX(this._defaultStartPos),this._timelineView.setInitialY(this._timelineCanvas.height-this._thumbHeight),this._timelineView.videoTrimmed=(a,o)=>{n.updateTimelineDurationAndWidth();const r=n._timelineView.getThumbPlayheadPosition()-n._defaultStartPos;n._currentDuration=-r/n._timelineWidthPixels*n._totalDuration,n.moveVideoToCurrentPosition()},this._timelineView.videoSelected=a=>{n._selectedVideoId=a},this._timelineView.videosRearranged=(a,o)=>{n.updateVideoDurationAndPosition()},this._timelineView.videoRemoved=()=>{n.updateVideoDurationAndPosition()},this._timelineView.objectMoved=(a,o)=>{n.updateObjectDurationAndPosition(a,o)},this._timelineView.objectTrimmed=(a,o,r)=>
1{n.updateObjectTrimDuration(a,o,r)},this._timelineView.objectAdded=()=>{n.updateTimelineDurationAndWidth()},this._timelineView.setTimeLineController(this),this._timelineView.setOverlapViewPosition(this._timelineSliderHeight,this._overlapViewHeight+this._audioViewHeight),this.configureFilterBackend(),this._videoTransitionMap=new Map,this._currentTransitionCanvas=this.document.createElement("canvas"),this._currentTransitionCanvas.width=this._fabricCanvas.width,this._currentTransitionCanvas.height=this._fabricCanvas.height,this._nextTransitionCanvas=this.document.createElement("canvas"),this._nextTransitionCanvas.width=this._fabricCanvas.width,this._nextTransitionCanvas.height=this._fabricCanvas.height}setWidthHeight(t,e){this._defaultStartPos=t/2,this._timelineView.setInitialX(this._defaultStartPos),this._timelineView.setInitialY(e-this._thumbHeight)}configureFilterBackend(){g.fabric.filterBackend=g.fabric.initFilterBackend(),this._baseFilter=new g.fabric.Image.filters.Grayscale}scrollTimeLine(t,e){if(Math.abs(e)>Math.abs(t))return void this._timelineView.scrollViewsBy(e);const i=this._totalDuration,s=this._currentDuration;if(!(t>0&&s<=0||s>=i&&t<0)){const n=this._timelineWidthPixels/i;s*n<t&&(t=this._currentDuration*n);const a=-(i-s);a*n>t&&(t=a*n),this._timelineView.moveThumbsBy(t);const o=this._timelineView.getThumbPlayheadPosition()-this._defaultStartPos;this._currentDuration=-o/this._timelineWidthPixels*this._totalDuration,this._currentDuration>0&&this.moveVideoToCurrentPosition(),this._currentDuration<=0&&this.moveOverlayObjectsTo(0)}}updateVideoDurationAndPosition(){this.updateTimelineDurationAndWidth();const t=this._timelineView.getThumbPlayheadPosition()-this._defaultStartPos;this._currentDuration=-t/this._timelineWidthPixels*this._totalDuration,this.moveVideoToCurrentPosition()}updateObjectDurationAndPosition(t,e){const i=e-this._timelineView.getThumbPlayheadPosition(),s=this._totalDuration/this._timelineWidthPixels*i;for(let n=0;n<this._otherObjectArray.length;n++)if(this._otherObjectArray[n].objId===t){this._otherObjectArray[n].refStartTime=s;break}this.updateTimelineDurationAndWidth()}updateObjectTrimDuration(t,e,i){for(let s=0;s<this._otherObjectArray.length;s++)if(this._otherObjectArray[s].objId===t){this._otherObjectArray[s]instanceof A.Y?(this._otherObjectArray[s].trimStart+=e,this._otherObjectArray[s].trimEnd+=i):this._otherObjectArray[s].setDuration(this._otherObjectArray[s].duration-(e-i)),this._otherObjectArray[s].refStartTime+=e;break}this.updateTimelineDurationAndWidth()}loadVideosAndThumbsFromUrls(t){const e=this;return new Promise((i,s)=>{let n=0,a=0;const o=()=>{if(t.shift(),!t.length){let d=0;for(let b=0;b<e._baseTimelineObjectArray.length;b++){const u=e._baseTimelineObjectArray[b];e.bindViewsAndThumbs(u,b);const p=u.getVideoElement();p.onended=()=>{e.videoEnded(u.objId)},d+=p.duration,e._videoTransitionMap.set(u.objId,0)}e._timelineView.addTimelineSlider(e._timelineSliderHeight,d),e._timelineView.addTimelineBar(),e._timelineView.configureObjectRepresentation(),e._timelineView.addTransitionViews(),e.updateTimelineDurationAndWidth(),e.reconfigureThumbs(),e._timelineView.updateSelectionRectsAndTimeline(),i(!0)}n+=1;const l=new R(t[0],e._fabricCanvas,()=>{e._baseTimelineObjectArray.push(l),l.objId=e._objectIndex,e._objectIndex+=1,l.startFrameTime=a,l.endFrameTime=a+l.duration,a+=l.duration,e.loadObjectAndThumbs(l).then(o)},this.document)},r=new R(t[0],e._fabricCanvas,()=>{e._baseTimelineObjectArray.push(r),r.objId=e._objectIndex,e._objectIndex+=1,r.startFrameTime=a,r.endFrameTime=a+r.duration,a+=r.duration,e.loadObjectAndThumbs(r).then(o)},this.document)})}initializeTimelineViews(t){this._timelineView.addTimelineSlider(this._timelineSliderHeight,t),this._timelineView.addTimelineBar()}addVideoObjectToTimeline(t){const e=this,i=this._baseTimelineObjectArray.length;return 0===i?this.loadVideosAndThumbsFromUrls([t]):new Promise((s,n)=>{const a=new R(t,e._fabricCanvas,()=>{e._baseTimelineObjectArray.push(a),a.startFrameTime=0,a.endFrameTime=a.duration,a.objId=e._objectIndex,e._objectIndex+=1,e.loadObjectAndThumbs(a).then(()=>{e.bindViewsAndThumbs(a,i),e._videoTransitionMap.set(a.objId,0),1===e._baseTimelineObjectArray.length&&e.initializeTimelineViews(a.getDuration()),e.updateTimelineDurationAndWidth(),e._timelineView.configureTimelineObject(a),e._timelineView.addTransitionViews(),e.reconfigureThumbs(),e._timelineView.updateSelectionRectsAndTimeline(),s(!0)})},this.document)})}cutVideoAtCurrentCursorPosition(){let t=0;for(let e=0;e<this._baseTimelineObjectArray.length;e++){const i=this._baseTimelineObjectArray[e],s=i.getVideoElement(),n=(i.trimEnd-i.trimStart)/s.playbackRate;this._videoTransitionMap.get(i.objId);let o=0;e>0&&(o=this._videoTransitionMap.get(this._baseTimelineObjectArray[e-1].objId));const r=t;if(t+=n,t-=o,this._currentDuration<t){const l=this;return new Promise((d,b)=>{const u=new R(s.src,l._fabricCanvas,()=>{u.trimStart=i.trimStart+(l._currentDuration-r+o)*s.playbackRate,u.trimEnd=i.trimEnd,i.trimEnd=u.trimStart,u.startFrameTime=u.trimStart,u.endFrameTime=u.trimEnd,u.objId=l._objectIndex,l._objectIndex+=1,l._baseTimelineObjectArray.splice(e+1,0,u),l.loadObjectAndThumbs(u).then(()=>{l.bindViewsAndThumbs(u,e+1),l._videoTransitionMap.set(u.objId,0),l.updateTimelineDurationAndWidth(),l._timelineView.configureTimelineObject(u),l._timelineView.addTransitionViews(),l.reconfigureThumbs(),l._timelineView.updateSelectionRectsAndTimeline(),d(!0)})},this.document)})}}}addImageObjectToTimeline(t){const e=this,i=this._baseTimelineObjectArray.length;return new Promise((s,n)=>{const a=new m(t,e._fabricCanvas,()=>{e._baseTimelineObjectArray.push(a),a.objId=e._objectIndex,e._objectIndex+=1,a.setDefaultDuration(e._defaultTimelineObjectDuration);const o=a.generateThumbImageElement(e._thumbWidth);e._timelineView.addImageTimelineThumb(a,o,1),e.bindViewsAndThumbs(a,i),e._videoTransitionMap.set(a.objId,0),1===e._baseTimelineObjectArray.length&&e.initializeTimelineViews(a.getDuration()),e.updateTimelineDurationAndWidth(),e._timelineView.configureTimelineObject(a),e._timelineView.addTransitionViews(),e.reconfigureThumbs(),e._timelineView.updateSelectionRectsAndTimeline(),s(!0)},this.document)})}addAudioObject(t,e){const i=this;null===this._audioWaveFormObject?g.fabric.Image.fromURL(e,s=>{i._audioWaveFormObject=s;const a=i._audioViewHeight/s.height;i._audioWaveFormObject.set({scaleX:a,scaleY:a}),i._timelineView.addAudioObjectView(i._audioWaveFormObject,i._timelineSliderHeight+i._overlapViewHeight,i._audioViewHeight)}):this._timelineView.addAudioObjectView(this._audioWaveFormObject,this._timelineSliderHeight+this._overlapViewHeight,this._audioViewHeight)}addOverlayImageObject(t,e,i){t.objId=this._overlapObjectIndex,this._overlapObjectIndex+=1,t.getViewObject().set({left:this._fabricCanvas.width/2,top:this._fabricCanvas.height/2}),t.refStartTime=e,t.setDuration(i),t.setBaseState(),this._otherObjectArray.push(t),t.onSelect=this.getSelectEventHandler(),this._timelineView.addOverlapObjectView(t,this._timelineSliderHeight,this._overlapViewHeight,"Image","yellow")}addOverlayMixedTextObject(t,e,i){t.objId=this._overlapObjectIndex,this._overlapObjectIndex+=1,t.refStartTime=e,t.setDuration(i),t.setBaseState(),this._otherObjectArray.push(t),t.onSelect=this.getSelectEventHandler(),this._timelineView.addOverlapObjectView(t,this._timelineSliderHeight,this._overlapViewHeight,"Pre Animated Text","cyan")}addOverlayTextObject(t,e,i){t.objId=this._overlapObjectIndex,this._overlapObjectIndex+=1,t.getViewObject().set({left:this._fabricCanvas.width/2,top:this._fabricCanvas.height/2}),t.refStartTime=e,t.setDuration(i),t.setBaseState(),this._otherObjectArray.push(t),t.onSelect=this.getSelectEventHandler(),this._timelineView.addOverlapObjectView(t,this._timelineSliderHeight,this._overlapViewHeight,"Text","blue")}addOverlayStickerObject(t,e,i){t.objId=this._overlapObjectIndex,this._overlapObjectIndex+=1;const s=t.getViewObject();s.set({left:this._fabricCanvas.width/2,top:this._fabricCanvas.height/2}),s.scaleToWidth(this._fabricCanvas.width/4),t.refStartTime=e,t.setDuration(i),t.setBaseState(),this._otherObjectArray.push(t),t.onSelect=this.getSelectEventHandler(),this._timelineView.addOverlapObjectView(t,this._timelineSliderHeight,this._overlapViewHeight,"sticker","green")}loadObjectAndThumbs(t){return new Promise((e,i)=>(this._timelineView.generateVideoThumbs(t,()=>{e(!0)}),null))}bindViewsAndThumbs(t,e){const i=t.getVideoElement();0===e?(i.currentTime=0,this._fabricCanvas.add(t.getViewObject())):i.currentTime=0,this._timelineView.addThumbsAndSelectionRectAtPosition(t,e)}updateThumbScale(t){}
1updateViewAtFrame(t){}updateCurrentTime(t){}moveOverlayObjectsTo(t){for(let e=0;e<this._otherObjectArray.length;e++){const i=this._otherObjectArray[e];if(!(i instanceof A.Y)){const s=i.getViewObject();t>=i.refStartTime&&t<i.refStartTime+i.duration?(null!=s&&!this._fabricCanvas.contains(s)&&this._fabricCanvas.add(s),i instanceof c&&i.addViewObjectToCanvas(),i.seek(t)):(null!=s&&this._fabricCanvas.contains(s)&&this._fabricCanvas.remove(s),i instanceof c&&i.removeViewObjectFromCanvas())}}}moveVideoToCurrentPosition(){let t=0,e=0,i=-1;for(let s=0;s<this._baseTimelineObjectArray.length&&(i=this._fabricCanvas.getIndexOf(this._baseTimelineObjectArray[s].getViewObject()),!(i>-1));s++);for(let s=0;s<this._baseTimelineObjectArray.length;s++){e=s;const n=this._baseTimelineObjectArray[s],a=n.getVideoElement(),o=(n.trimEnd-n.trimStart)/a.playbackRate,r=this._videoTransitionMap.get(n.objId);let l=0;s>0&&(l=this._videoTransitionMap.get(this._baseTimelineObjectArray[s-1].objId));const d=t;if(t+=o,t-=l,this._currentDuration<t){a.currentTime=n.trimStart+(this._currentDuration-d+l)*a.playbackRate;const u=(this._currentDuration-(t-r))/r;if(s<this._baseTimelineObjectArray.length-1&&this._currentDuration>=t-r){const p=this._baseTimelineObjectArray[s+1],w=p.getVideoElement();if(w.currentTime=p.trimStart+(this._currentDuration-(t-r))*w.playbackRate,null===this._transitionImageObject){const j=n.getViewObject();this._currentTransitionCanvas.getContext("2d").drawImage(n.getVideoElement(),j.left,j.top,j.width*j.scaleX,j.height*j.scaleY);const M=this._currentTransitionCanvas.toDataURL();i=this._fabricCanvas.getIndexOf(n.getViewObject()),this._fabricCanvas.remove(n.getViewObject());const K=new Image;K.src=M,this._transitionImageObject=new g.fabric.Image(K,{left:0,top:0,width:this._fabricCanvas.width,height:this._fabricCanvas.height}),this._fabricCanvas.insertAt(this._transitionImageObject,i,!1),this.configureTransitionFilter(n.getViewObject(),p.getViewObject(),u)}else this.applyTransitionEffect(n.getViewObject(),p.getViewObject(),u)}else null!=this._transitionImageObject&&(i=this._fabricCanvas.getIndexOf(this._transitionImageObject),this._fabricCanvas.remove(this._transitionImageObject),this._transitionImageObject=null),this._fabricCanvas.contains(n.getViewObject())||(i>-1?this._fabricCanvas.insertAt(n.getViewObject(),i,!1):this._fabricCanvas.add(n.getViewObject()));break}this._fabricCanvas.contains(n.getViewObject())&&(i=this._fabricCanvas.getIndexOf(n.getViewObject()),this._fabricCanvas.remove(n.getViewObject()))}for(let s=e+1;s<this._baseTimelineObjectArray.length;s++){const n=this._baseTimelineObjectArray[s];this._fabricCanvas.contains(n.getViewObject())&&this._fabricCanvas.remove(n.getViewObject())}this.moveOverlayObjectsTo(this._currentDuration)}updateTimelineDurationAndWidth(){this._totalDuration=0;let t=0;for(let i=0;i<this._baseTimelineObjectArray.length;i++){const s=this._baseTimelineObjectArray[i],n=s.getVideoElement();this._totalDuration+=(s.trimEnd-s.trimStart)/n.playbackRate,null!==this._videoTransitionMap&&(t+=this._videoTransitionMap.get(s.objId))}this._totalDuration-=t,this._baseTimelineDuration=this._totalDuration;let e=0;for(let i=0;i<this._otherObjectArray.length;i++){const s=this._otherObjectArray[i],n=s.refStartTime+(s.trimEnd-s.trimStart);n>e&&(e=n)}e>this._totalDuration&&(this._totalDuration=e),this._timelineWidthPixels=this._timelineView.getAllViewWidth(),this.changedDurationAndWidth&&this.changedDurationAndWidth()}videoEnded(t){const e=t;let i=-1;const s=this._baseTimelineObjectArray.length;let n=-1;for(let a=0;a<s;a++){const o=this._baseTimelineObjectArray[a];if(e===o.objId&&a<s-1){i=this._baseTimelineObjectArray[a+1].objId,n=this._fabricCanvas.getIndexOf(o.getViewObject());break}}if(null!=this._transitionImageObject&&(this._fabricCanvas.getIndexOf(this._transitionImageObject)>=0&&this._fabricCanvas.remove(this._transitionImageObject),this._transitionImageObject=null),-1!==i)for(let a=0;a<this._baseTimelineObjectArray.length;a++){const o=this._baseTimelineObjectArray[a],r=o.getVideoElement();if(o.objId===e&&this._fabricCanvas.remove(o.getViewObject()),i===o.objId){this._fabricCanvas.insertAt(o.getViewObject(),n,!1);let l=0;a>0&&(l=this._videoTransitionMap.get(this._baseTimelineObjectArray[a-1].objId)),r.currentTime=o.trimStart+l*r.playbackRate,0===l&&r.play(),this._currentPlayingVideoId=i;break}r.pause(),r.currentTime=o.trimStart}}updateVideoThumbs(){if(this._isTimelinePaused)return;const e=Date.now()-this._playStartTimeStamp,i=this._currentDuration+e/1e3;for(let o=0;o<this._otherObjectArray.length;o++){const r=this._otherObjectArray[o].getViewObject(),l=this._otherObjectArray[o];i>=l.refStartTime&&i<l.refStartTime+l.duration?(null!=r&&!this._fabricCanvas.contains(r)&&this._fabricCanvas.add(r),l instanceof c&&l.addViewObjectToCanvas(),l.updatePlayState(i)):(null!=r&&this._fabricCanvas.contains(r)&&this._fabricCanvas.remove(r),l instanceof c&&l.removeViewObjectFromCanvas())}if(i>this._totalDuration){null!==this.playerEnded&&this.playerEnded();for(let o=0;o<this._otherObjectArray.length;o++)this._otherObjectArray[o].pause();return}this._updatedCurrentPosition=i;let s=0;for(let o=0;o<this._baseTimelineObjectArray.length;o++){const r=this._baseTimelineObjectArray[o],l=r.getVideoElement(),d=(r.trimEnd-r.trimStart)/l.playbackRate,b=this._videoTransitionMap.get(r.objId);let u=0;if(o>0&&(u=this._videoTransitionMap.get(this._baseTimelineObjectArray[o-1].objId)),s+=d,s-=u,r.objId===this._currentPlayingVideoId){if(i>=s){this.videoEnded(r.objId);break}const w=r.getVideoElement();if(w.paused&&(w.currentTime=r.trimStart+(i-(s-b))*l.playbackRate,r.getVideoElement().play()),o<this._baseTimelineObjectArray.length-1&&b>0&&i>=s-b){const C=(i-(s-b))/b,M=this._baseTimelineObjectArray[o+1],K=M.getVideoElement();if(K.paused&&(K.play(),K.currentTime=M.trimStart+(i-(s-b))*l.playbackRate),null===this._transitionImageObject){const U=r.getViewObject();this._currentTransitionCanvas.getContext("2d").drawImage(r.getVideoElement(),U.left,U.top,U.width*U.scaleX,U.height*U.scaleY);const nt=this._currentTransitionCanvas.toDataURL();this._fabricCanvas.remove(r.getViewObject());const J=new Image;
1J.src=nt,this._transitionImageObject=new g.fabric.Image(J,{left:0,top:0,width:this._fabricCanvas.width,height:this._fabricCanvas.height}),this._fabricCanvas.add(this._transitionImageObject),this.configureTransitionFilter(r.getViewObject(),M.getViewObject(),C)}else this.applyTransitionEffect(r.getViewObject(),M.getViewObject(),C)}else null!=this._transitionImageObject&&(this._fabricCanvas.remove(this._transitionImageObject),this._transitionImageObject=null),this._fabricCanvas.contains(r.getViewObject())||this._fabricCanvas.add(r.getViewObject());break}}this._timelineView.moveThumbsBy(-(i-this._lastTimePosition)/this._totalDuration*this._timelineWidthPixels),this._lastTimePosition=i}playTimeline(){this._isTimelinePaused=!1;let t=0;const e=this._timelineView.getThumbPlayheadPosition()-this._defaultStartPos;e>0&&(this._timelineView.moveThumbsBy(-e),this._currentDuration=0),this._lastTimePosition=this._currentDuration;for(let i=0;i<this._baseTimelineObjectArray.length;i++){const s=this._baseTimelineObjectArray[i],n=s.getVideoElement(),a=(s.trimEnd-s.trimStart)/n.playbackRate;if(this._currentDuration<t+a){n.currentTime=s.trimStart+(this._currentDuration-t)/n.playbackRate,n.play(),this._currentPlayingVideoId=s.objId,this._playStartTimeStamp=Date.now();break}t+=a}for(let i=0;i<this._otherObjectArray.length;i++)this._otherObjectArray[i].refStartTime<this._currentDuration&&this._otherObjectArray[i].updatePlayState(this._currentDuration)}pauseTimeline(){if(!this._isTimelinePaused){this._isTimelinePaused=!0;for(let t=0;t<this._baseTimelineObjectArray.length;t++)this._baseTimelineObjectArray[t].getVideoElement().pause();this._currentDuration=this._updatedCurrentPosition;for(let t=0;t<this._otherObjectArray.length;t++)this._otherObjectArray[t].pause()}}getTimelineObjectArray(){return this._baseTimelineObjectArray}getTimelineAudioObjectArray(){return this._otherObjectArray}getTtimelineBaseDuration(){return this._baseTimelineDuration}getTimelineTotalDuration(){return this._totalDuration}getObjectTransitionMap(){return this._videoTransitionMap}setPlaybackRate(t){for(let e=0;e<this._baseTimelineObjectArray.length;e++){const i=this._baseTimelineObjectArray[e];i.objId===this._selectedVideoId&&(i.getVideoElement().playbackRate=t,this._timelineView.speedSelectedVideoBy(t),this.updateVideoDurationAndPosition())}}resetPlaybackRate(t){for(let e=0;e<this._baseTimelineObjectArray.length;e++){const i=this._baseTimelineObjectArray[e];i.objId===this._selectedVideoId&&(i.getVideoElement().playbackRate=t,this._timelineView.speedSelectedVideoBy(t),this.updateVideoDurationAndPosition())}this._timelineView.updateSelectionRectsAndTimeline()}setZoomDuration(t){this._timelineView.setThumbDuration(t),this.updateVideoDurationAndPosition()}resetZoomDuration(t){this._timelineView.setThumbDuration(t),this.updateVideoDurationAndPosition(),this._timelineView.updateSelectionRectsAndTimeline()}setTransitionDuration(t){for(let e=0;e<this._baseTimelineObjectArray.length;e++){const i=this._baseTimelineObjectArray[e];if(i.objId===this._selectedVideoId){this._videoTransitionMap.set(i.objId,t),this._timelineView.updateTransitionDuration(t),this.updateVideoDurationAndPosition();break}}}resetTransitionDuration(t){this._timelineView.updateSelectionRectsAndTimeline(),this.updateVideoDurationAndPosition()}removeSelectedVideo(){this._timelineView.deleteSelectedObject()}applyFilter(t){const e=g.fabric.filterBackend;e&&e.evictCachesForKey&&(e.evictCachesForKey(t.cacheKey),e.evictCachesForKey(t.cacheKey+"_filtered")),t.applyFilters()}configureTransitionFilter(t,e,i){this._transitionImageObject.filters=[],this._transitionImageObject.filters[0]=new g.fabric.Image.filters.BlendImage({image:t,nextImage:e}),this._transitionImageObject.filters[0].mode="dissolve",this._transitionImageObject.filters[0].alpha=i,this._transitionImageObject.filters[0].startX=t.left/this._fabricCanvas.width,this._transitionImageObject.filters[0].startY=t.top/this._fabricCanvas.height,this._transitionImageObject.filters[0].endX=(t.left+t.width*t.scaleX)/this._fabricCanvas.width,this._transitionImageObject.filters[0].endY=(t.top+t.height*t.scaleY)/this._fabricCanvas.height,this._transitionImageObject.filters[0].nextStartX=e.left/this._fabricCanvas.width,this._transitionImageObject.filters[0].nextStartY=e.top/this._fabricCanvas.height,this._transitionImageObject.filters[0].nextEndX=(e.left+e.width*e.scaleX)/this._fabricCanvas.width,this._transitionImageObject.filters[0].nextEndY=(e.top+e.height*e.scaleY)/this._fabricCanvas.height}applyTransitionEffect(t,e,i){0===this._transitionImageObject.filters.length&&(this._transitionImageObject.filters[0]=new g.fabric.Image.filters.BlendImage({image:t,nextImage:e}),this._transitionImageObject.filters[0].mode="dissolve"),this._transitionImageObject.filters[0].alpha=i;const s=g.fabric.filterBackend;
1s&&s.evictCachesForKey&&(s.evictCachesForKey(t.cacheKey),s.evictCachesForKey(t.cacheKey+"_filtered"),s.evictCachesForKey(e.cacheKey)),this._transitionImageObject.applyFilters()}applyTransition(t,e,i){0===t.filters.length&&(t.filters[0]=new g.fabric.Image.filters.BlendImage({image:t,nextImage:e}),t.filters[0].mode="dissolve"),t.filters[0].alpha=i;const s=g.fabric.filterBackend;s&&s.evictCachesForKey&&(s.evictCachesForKey(t.cacheKey),s.evictCachesForKey(e.cacheKey)),t.applyFilters()}reconfigureThumbs(){this._timelineView.setThumbDuration(1)}setBackgroundColor(t){this._fabricCanvas.backgroundColor=t,this._backgroundColor=t}fireObjectSelectedEvent(t){this.objectSelected&&this.objectSelected(t)}getSelectEventHandler(){return t=>{this.fireObjectSelectedEvent(t)}}}var S=v(60177),y=v(54438),V=v(3781),W=v(28567);const z=["myCanvas"],Z=["timelineCanvas"];let et=(()=>{var P;class t{constructor(i,s,n){this.state=i,this.zoomService=s,this.document=n,this.minWidth=50,this.minHeight=50,this.isPlaying=!1}init(){this.state.mainCanvas=new g.fabric.Canvas("vmx-canvas"),this.state.mainCanvas.preserveObjectStacking=!0,this.state.timelineCanvas=new g.fabric.Canvas("timelineCanvas"),this.state.timelineCanvas.preserveObjectStacking=!0,this.state.timelineCanvas.selection=!0,this.canvasLayout&&(this.state.original.height=this.canvasLayout.width/this.canvasLayout.ratioWidth*this.canvasLayout.ratioHeight,this.state.original.width=this.canvasLayout.width),this.timelineController=new O(this.state.mainCanvas,this.state.timelineCanvas,{thumb:{width:80,height:80}},this.document),this.timelineController.playerEnded=()=>{this.timelineController.pauseTimeline()},this.timelineController._timelineView.videoSelected=s=>{},this.timelineController.setBackgroundColor(this.backgroundColor)}resize(i,s){this.state.mainCanvas.setWidth(i*this.zoomService.get()),this.state.mainCanvas.setHeight(s*this.zoomService.get()),this.state.original.width=i,this.state.original.height=s}}return(P=t).\u0275fac=function(i){return new(i||P)(y.rXU(V.X),y.rXU(W.n),y.rXU(S.qQ))},P.\u0275dir=y.FsC({type:P,viewQuery:function(i,s){if(1&i&&(y.GBs(z,7),y.GBs(Z,7)),2&i){let n;y.mGM(n=y.lsd())&&(s.myCanvasElement=n.first),y.mGM(n=y.lsd())&&(s.timelineCanvasElement=n.first)}}}),P.\u0275prov=y.jDH({token:P,factory:P.\u0275fac}),t})()},61053:(X,B,v)=>{v.d(B,{_:()=>N});var g=v(10467),E=v(87320),R=v(54438),x=v(95301),k=v(49159);let N=(()=>{var D;class I{constructor(A,_){this.dataService=A,this.videoEditorService=_}addAudio(A,_,m,h,T,f=null,c={}){var O=this;return new Promise((S,y)=>{T.inProgress=!0;const W=new E.Y([_],m,h,()=>{W.assetId=A,f&&(W.startTime=f.startTime,W.trackItemId=f.trackItemId,W.isReplace=!0),c&&c.startTime&&(W.startTime=c.startTime),c&&c.trimStart&&(W.trimStart=c.trimStart);let z=null;c&&c.trimEnd&&(W.trimEnd=c.trimEnd,z=c.trimEnd);let Z=!1;c&&c.isDetach&&(Z=c.isDetach),T.inProgress=!1,T.addAudioToProject(W,(0,g.A)(function*(){f&&W.startTime+(W.trimEnd-W.trimStart)>f.startTime+(f.trimEnd-f.trimStart)&&(W.trimEnd=f.trimEnd,W.trimStart=f.trimStart),O.videoEditorService.addTrackItemFn&&(yield O.videoEditorService.addTrackItemFn(W,c)),S(W)}),{trimEnd:z,isDetach:Z})},1)})}getAudio(A,_,m){this.dataService.getArrayBuffer(A,{}).subscribe(h=>{h&&"SUCCESS"===h.status?_(h):m(h)},h=>{m()})}deleteFromProject(A,_=!1){A.deleteAudioFromProject(_),this.videoEditorService.deleteAudioFn&&this.videoEditorService.deleteAudioFn()}duplicate(A){return new Promise((_,m)=>{const h=A.selectedAudioObject;A.inProgress=!0;const T=new E.Y([h.audioSrcArray[0]],h.format,h.name,()=>{T.assetId=h.assetId,T.startTime=h.startTime,T.volume=h.volume,T.trimStart=h.trimStart,T.loop=h.loop,T.trimEnd=h.trimEnd,T.isReplace=!1,A.inProgress=!1,A.addAudioToProject(T,(0,g.A)(function*(){_(T)}),{trimEnd:T.trimEnd})},h.speedFactor)})}}return(D=I).\u0275fac=function(A){return new(A||D)(R.KVO(x.u),R.KVO(k.M))},D.\u0275prov=R.jDH({token:D,factory:D.\u0275fac}),I})()},43779:(X,B,v)=>{v.d(B,{g:()=>D});var g=v(10467),E=v(54438),R=v(3408),x=v(32764),k=v(46549),N=v(49159);let D=(()=>{var I;class L{constructor(_,m,h,T){this.mixedGroupBuilder=_,this.templateService=m,this.textToolService=h,this.videoEditorService=T}addIllustration(_,m=null,h){var T=this;if(!h.inProgress){h.inProgress=!0;const f=_.aspect.split("-"),c=+f[0]/+f[1];this.mixedGroupBuilder.addIllustrationMixedGroup(_.imgUrl,h.getSelectedScene(),h.getCanvas(),c,_.pro,m).then(function(){var O=(0,g.A)(function*(S){T.videoEditorService.addTrackItemFn&&(yield T.videoEditorService.addTrackItemFn(S))});return function(S){return O.apply(this,arguments)}}()).finally(()=>h.inProgress=!1)}}replaceIllustration(_,m=null,h){var T=this;return new Promise((f,c)=>{if(h.inProgress)c();else{h.inProgress=!0;const O=_.aspect.split("-"),S=+O[0]/+O[1];this.mixedGroupBuilder.replaceIllustrationMixedGroup(_.imgUrl,h.getSelectedScene(),h.getCanvas(),S,_.pro,m).then(function(){var y=(0,g.A)(function*(V){V.isReplace=!0,T.videoEditorService.addTrackItemFn&&(yield T.videoEditorService.addTrackItemFn(V))});return function(V){return y.apply(this,arguments)}}()).finally(()=>{h.inProgress=!1,f()})}})}addShape(_,m=null,h){return new Promise((T,f)=>{h.inProgress?f():(h.inProgress=!0,this.templateService.getTemplateByContentUrl(_.contentUrl,c=>{const O=c;this.correctShapeJson(O),this.textToolService.addTextTemplate(O,_.pro,h,m,_.thumbUrl).then(()=>{h.inProgress=!1,T()}).catch(()=>{f()})},()=>{h.inProgress=!1}))})}
1correctShapeJson(_){_.shapeObjects.forEach(m=>{m.metaData.hasOwnProperty("hideOutline")?m.metaData.hideOutline=!0:(m.metaData.hideOutline=!0,m.metaData.outlineOpacity=1,m.metaData.outlineStroke=0,m.metaData.color1="#ffffff")}),_.canvasGlobalObjectArray.forEach(m=>{m.shapeObjects.forEach(h=>{h.metaData.hasOwnProperty("hideOutline")?h.metaData.hideOutline=!0:(h.metaData.hideOutline=!0,h.metaData.outlineOpacity=1,h.metaData.outlineStroke=0,h.metaData.color1="#ffffff")})})}}return(I=L).\u0275fac=function(_){return new(_||I)(E.KVO(R.I),E.KVO(x.I),E.KVO(k.n),E.KVO(N.M))},I.\u0275prov=E.jDH({token:I,factory:I.\u0275fac}),L})()},24593:(X,B,v)=>{v.d(B,{D:()=>N});var g=v(10467),E=v(50585),R=v(54438),x=v(3408),k=v(49159);let N=(()=>{var D;class I{constructor(A,_){this.mixedGroupBuilder=A,this.videoEditorService=_}addLottie(A,_=null,m,h=E.zs.LOTTIE_ILLUSTRATION){var T=this;m.inProgress||(m.inProgress=!0,this.mixedGroupBuilder.addlottie(A.imgUrl,m.getSelectedScene(),m.getCanvas(),A.aspect,A.pro,_,h).then(function(){var f=(0,g.A)(function*(c){T.videoEditorService.addTrackItemFn&&(yield T.videoEditorService.addTrackItemFn(c))});return function(c){return f.apply(this,arguments)}}()).finally(()=>m.inProgress=!1))}replaceLottie(A,_=null,m){var h=this;return new Promise((T,f)=>{m.inProgress?f():(m.inProgress=!0,this.mixedGroupBuilder.replaceIllustrationLottie(A.imgUrl,m.getSelectedScene(),m.getCanvas(),1,A.pro,_).then(function(){var c=(0,g.A)(function*(O){O.isReplace=!0,h.videoEditorService.addTrackItemFn&&(yield h.videoEditorService.addTrackItemFn(O))});return function(O){return c.apply(this,arguments)}}()).finally(()=>{m.inProgress=!1,T()}))})}addLottieSticker(A,_=null,m,h=E.zs.LOTTIE_STICKER){var T=this;m.inProgress||(m.inProgress=!0,this.mixedGroupBuilder.addlottie(A.imgUrl,m.getSelectedScene(),m.getCanvas(),1,A.pro,_,h).then(function(){var f=(0,g.A)(function*(c){T.videoEditorService.addTrackItemFn&&(yield T.videoEditorService.addTrackItemFn(c))});return function(c){return f.apply(this,arguments)}}()).finally(()=>m.inProgress=!1))}replaceaddLottieSticker(A,_=null,m){var h=this;return new Promise((T,f)=>{m.inProgress?f():(m.inProgress=!0,this.mixedGroupBuilder.replaceIllustrationLottie(A.imgUrl,m.getSelectedScene(),m.getCanvas(),1,A.pro,_).then(function(){var c=(0,g.A)(function*(O){O.isReplace=!0,h.videoEditorService.addTrackItemFn&&(yield h.videoEditorService.addTrackItemFn(O))});return function(O){return c.apply(this,arguments)}}()).finally(()=>{m.inProgress=!1,T()}))})}}return(D=I).\u0275fac=function(A){return new(A||D)(R.KVO(x.I),R.KVO(k.M))},D.\u0275prov=R.jDH({token:D,factory:D.\u0275fac}),I})()},33993:(X,B,v)=>{v.d(B,{r:()=>D});var g=v(10467),E=v(93552),x=v(54438),k=v(3408),N=v(49159);let D=(()=>{var I;class L{constructor(_,m){this.mixedGroupBuilder=_,this.videoEditorService=m}addSticker(_,m,h,T=null){var f=this;h.inProgress||(h.inProgress=!0,E.fabric.Image.fromURL(_,c=>{this.mixedGroupBuilder.addStickerMixedGroup(_,h.getSelectedScene(),h.getCanvas(),c.width,c.height,m,T).then(function(){var O=(0,g.A)(function*(S){f.videoEditorService.addTrackItemFn&&(yield f.videoEditorService.addTrackItemFn(S))});return function(S){return O.apply(this,arguments)}}()).finally(()=>h.inProgress=!1)},{crossOrigin:"anonymous"}))}replaceSticker(_,m,h,T=null){var f=this;return new Promise((c,O)=>{h.inProgress?O():(h.inProgress=!0,E.fabric.Image.fromURL(_,S=>{this.mixedGroupBuilder.replaceStickerMixedGroup(_,h.getSelectedScene(),h.getCanvas(),S.width,S.height,m,T).then(function(){var y=(0,g.A)(function*(V){V.isReplace=!0,f.videoEditorService.addTrackItemFn&&(yield f.videoEditorService.addTrackItemFn(V))});return function(V){return y.apply(this,arguments)}}()).finally(()=>{h.inProgress=!1,c()})},{crossOrigin:"anonymous"}))})}}return(I=L).\u0275fac=function(_){return new(_||I)(x.KVO(k.I),x.KVO(N.M))},I.\u0275prov=x.jDH({token:I,factory:I.\u0275fac}),L})()},46549:(X,B,v)=>{v.d(B,{n:()=>D});var g=v(10467),E=v(26381),R=v(54438),x=v(3408),k=v(21626),N=v(49159);let D=(()=>{var I;class L{constructor(_,m,h){this.mixedGroupBuilder=_,this.http=m,this.videoEditorService=h,this.duration=6}addTextTemplate(_,m,h,T="",f=""){var c=this;return new Promise((O,S)=>{h.inProgress?S():(h.inProgress=!0,this.correctTextOutlineJson(_),h.getSelectedScene().selectedDesignItem&&!h.getSelectedScene().selectedDesignItem.isLayerLocked()?this.mixedGroupBuilder.replaceAnimTextTemplate(_,h.getSelectedScene(),h.getCanvas(),m,T,f).then(function(){var y=(0,g.A)(function*(V){V.isReplace=!0,c.videoEditorService.addTrackItemFn&&(yield c.videoEditorService.addTrackItemFn(V)),h.inProgress=!1,O()});return function(V){return y.apply(this,arguments)}}()):this.mixedGroupBuilder.addAnimTextTemplate(_,h.getSelectedScene(),h.getCanvas(),.5,m,T,f).then(function(){var y=(0,g.A)(function*(V){c.videoEditorService.addTrackItemFn&&(yield c.videoEditorService.addTrackItemFn(V)),h.inProgress=!1,O()});return function(V){return y.apply(this,arguments)}}()))})}correctTextOutlineJson(_){_.canvasGlobalObjectArray.filter(m=>
1m.canvasType!==E.P.blank).forEach(m=>{m.canvasType===E.P.lineStyling?m.lineStyle.lineStyleArray.forEach(h=>{h.hasOwnProperty("hideOutline")||(h.outlineColor="#ffd000",h.outlineOpacity=1,h.outlineStroke=0,h.hideOutline=!0)}):(m.canvasType===E.P.wordStyling||m.canvasType===E.P.textPath)&&(m.wordStyle.defaultWordStyle.hasOwnProperty("hideOutline")||(m.wordStyle.defaultWordStyle.outlineColor="#ffd000",m.wordStyle.defaultWordStyle.outlineOpacity=1,m.wordStyle.defaultWordStyle.outlineStroke=0,m.wordStyle.defaultWordStyle.hideOutline=!0))})}addText(_,m){var h=this;if(!m.inProgress){m.inProgress=!0;let T="",f=0;"heading"===_?(T="assets/json/init/text_heading.json",f=.65):"subheading"===_?(T="assets/json/init/text_subHeading.json",f=.5):(T="assets/json/init/text_body.json",f=.35),this.http.get(T).subscribe(c=>{this.mixedGroupBuilder.addAnimTextTemplate(c,m.getSelectedScene(),m.getCanvas(),f).then(function(){var O=(0,g.A)(function*(S){h.videoEditorService.addTrackItemFn&&(yield h.videoEditorService.addTrackItemFn(S)),m.inProgress=!1});return function(S){return O.apply(this,arguments)}}())})}}setTextSize(_,m){return new Promise((h,T)=>{let f;const c=()=>{f=m.setFontSize(O,S),f&&(f=Math.round(f),h(f))};let O,S;_.newValue?(S=!1,O=_.newValue):(S=!0,O=_),O&&!Number.isNaN(O)?O>100?(O=100,setTimeout(c,0)):(O<1&&(O=1),setTimeout(c,0)):(O=1,setTimeout(c,0))})}setLetterSpacing(_,m){return new Promise((h,T)=>{const f=S=>{m.setCharSpacing(S,O);const y=Math.floor(m.getCharSpacing());h(y)};let c,O;_.newValue||0===_.newValue?(O=!1,c=_.newValue):(O=!0,c=_),!c&&0!==c||Number.isNaN(c)?(c=0,setTimeout(f,0)):c>100?(c=100,setTimeout(f,0,c)):(c<0&&(c=0),setTimeout(f,0,c))})}setLineSpace(_,m){return new Promise((h,T)=>{const f=()=>{m.setLineSpace(c,O);const y=m.getLineSpace();h(y)};let c,O;if(""===_||void 0===_)return c=null,O=!0,void f();if(_.newValue||0===_.newValue?(c=_.newValue,O=!1):(c=_,O=!0),(c||0===c)&&c>=0&&c<=10&&!Number.isNaN(c)){const y=(y=>Math.round(100*y)/100)(c),V=m.getLineSpace();if((c.toString().split(".")[1]||"").length>2)return void setTimeout(()=>{h(V)},0);y>10?(c=10,setTimeout(f,0)):y<0?(c=0,setTimeout(f,0)):(c=y,setTimeout(f,0)),c!==V?setTimeout(f,0):h(V)}else c=1,setTimeout(f,0)})}setLineSpaceForPathText(_,m){return new Promise((h,T)=>{const f=()=>{m.setLineSpaceForPathText(c,O);const S=m.getLineSpace();h(S)};let c,O;_.newValue||0===_.newValue?(c=_.newValue,O=!1):(c=_,O=!0),!c&&0!==c||Number.isNaN(c)?(c=0,setTimeout(f,0)):c>100?(c=100,setTimeout(f,0)):(c<-100&&(c=-100),setTimeout(f,0))})}setGlobalShapeOpcity(_,m){return new Promise((h,T)=>{const f=()=>{let y=m.setGlobalShapeOpcity(c/100,O);y*=100;const V=Math.round(10*y)/10;h(V)};let c,O;_.newValue?(c=_.newValue,O=!1):(c=_,O=!0),c>0?(c>100&&(c=100),setTimeout(f,0)):(c=1,setTimeout(f,0))})}changeTextInVideoEditorTimeline(_){this.videoEditorService.addTrackItemFn&&this.videoEditorService.addTrackItemFn(_)}}return(I=L).\u0275fac=function(_){return new(_||I)(R.KVO(x.I),R.KVO(k.Qq),R.KVO(N.M))},I.\u0275prov=R.jDH({token:I,factory:I.\u0275fac}),L})()},72913:(X,B,v)=>{v.d(B,{s:()=>A});var g=v(84341),E=v(56751),R=v(46549),x=v(33993),k=v(43779),N=v(61053),D=v(24593),I=v(77183),L=v(54438);let A=(()=>{var _;class m{}return(_=m).\u0275fac=function(T){return new(T||_)},_.\u0275mod=L.$C({type:_}),_.\u0275inj=L.G2t({providers:[E.M,R.n,x.r,k.g,N._,D.D],imports:[g.YN,g.X1,I.f]}),m})()}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.