@designcombo/state 0.1.32 → 0.1.34
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/events.d.ts +69 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1911 -1759
- package/dist/index.umd.js +2 -2
- package/dist/state.d.ts +1 -0
- package/dist/utils/find-track.d.ts +6 -0
- package/dist/utils/load-item.d.ts +143 -141
- package/dist/utils/math.d.ts +8 -0
- package/package.json +5 -5
- package/dist/utils/validateColision.d.ts +0 -3
package/dist/index.umd.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
(function(
|
1
|
+
(function(y,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("@designcombo/events")):typeof define=="function"&&define.amd?define(["exports","@designcombo/events"],O):(y=typeof globalThis<"u"?globalThis:y||self,O(y.events={},y.events))})(this,function(y,O){"use strict";var Ys=Object.defineProperty;var Gs=(y,O,Mt)=>O in y?Ys(y,O,{enumerable:!0,configurable:!0,writable:!0,value:Mt}):y[O]=Mt;var Zt=(y,O,Mt)=>Gs(y,typeof O!="symbol"?O+"":O,Mt);var Mt=function(t,r){return Mt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},Mt(t,r)};function pe(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");Mt(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}function br(t){var r=typeof Symbol=="function"&&Symbol.iterator,n=r&&t[r],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function Er(t,r){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),s,c=[],d;try{for(;(r===void 0||r-- >0)&&!(s=i.next()).done;)c.push(s.value)}catch(_){d={error:_}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(d)throw d.error}}return c}function vr(t,r,n){if(n||arguments.length===2)for(var i=0,s=r.length,c;i<s;i++)(c||!(i in r))&&(c||(c=Array.prototype.slice.call(r,0,i)),c[i]=r[i]);return t.concat(c||Array.prototype.slice.call(r))}typeof SuppressedError=="function"&&SuppressedError;function Tt(t){return typeof t=="function"}function jn(t){var r=function(i){Error.call(i),i.stack=new Error().stack},n=t(r);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Sr=jn(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
|
2
2
|
`+n.map(function(i,s){return s+1+") "+i.toString()}).join(`
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=n}});function hr(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var Ae=function(){function t(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var r,n,i,s,c;if(!this.closed){this.closed=!0;var h=this._parentage;if(h)if(this._parentage=null,Array.isArray(h))try{for(var m=lr(h),D=m.next();!D.done;D=m.next()){var F=D.value;F.remove(this)}}catch(p){r={error:p}}finally{try{D&&!D.done&&(n=m.return)&&n.call(m)}finally{if(r)throw r.error}}else h.remove(this);var T=this.initialTeardown;if(_t(T))try{T()}catch(p){c=p instanceof pr?p.errors:[p]}var G=this._finalizers;if(G){this._finalizers=null;try{for(var b=lr(G),d=b.next();!d.done;d=b.next()){var l=d.value;try{Pn(l)}catch(p){c=c??[],p instanceof pr?c=dr(dr([],fr(c)),fr(p.errors)):c.push(p)}}}catch(p){i={error:p}}finally{try{d&&!d.done&&(s=b.return)&&s.call(b)}finally{if(i)throw i.error}}}if(c)throw new pr(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)Pn(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(r)}},t.prototype._hasParent=function(r){var n=this._parentage;return n===r||Array.isArray(n)&&n.includes(r)},t.prototype._addParent=function(r){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(r),n):n?[n,r]:r},t.prototype._removeParent=function(r){var n=this._parentage;n===r?this._parentage=null:Array.isArray(n)&&hr(n,r)},t.prototype.remove=function(r){var n=this._finalizers;n&&hr(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=function(){var r=new t;return r.closed=!0,r}(),t}(),xn=Ae.EMPTY;function Dn(t){return t instanceof Ae||t&&"closed"in t&&_t(t.remove)&&_t(t.add)&&_t(t.unsubscribe)}function Pn(t){_t(t)?t():t.unsubscribe()}var Cn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},jn={setTimeout:function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,dr([t,r],fr(n)))},clearTimeout:function(t){var r=jn.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function di(t){jn.setTimeout(function(){throw t})}function Rn(){}function Oe(t){t()}var Fn=function(t){pt(r,t);function r(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,Dn(n)&&n.add(i)):i.destination=yi,i}return r.create=function(n,i,s){return new yr(n,i,s)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(Ae),pi=Function.prototype.bind;function mr(t,r){return pi.call(t,r)}var hi=function(){function t(r){this.partialObserver=r}return t.prototype.next=function(r){var n=this.partialObserver;if(n.next)try{n.next(r)}catch(i){xe(i)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(i){xe(i)}else xe(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){xe(n)}},t}(),yr=function(t){pt(r,t);function r(n,i,s){var c=t.call(this)||this,h;if(_t(n)||!n)h={next:n??void 0,error:i??void 0,complete:s??void 0};else{var m;c&&Cn.useDeprecatedNextContext?(m=Object.create(n),m.unsubscribe=function(){return c.unsubscribe()},h={next:n.next&&mr(n.next,m),error:n.error&&mr(n.error,m),complete:n.complete&&mr(n.complete,m)}):h=n}return c.destination=new hi(h),c}return r}(Fn);function xe(t){di(t)}function mi(t){throw t}var yi={closed:!0,next:Rn,error:mi,complete:Rn},bi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function gi(t){return t}function _i(t){return t.length===0?gi:t.length===1?t[0]:function(n){return t.reduce(function(i,s){return s(i)},n)}}var zn=function(){function t(r){r&&(this._subscribe=r)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(r,n,i){var s=this,c=vi(r)?r:new yr(r,n,i);return Oe(function(){var h=s,m=h.operator,D=h.source;c.add(m?m.call(c,D):D?s._subscribe(c):s._trySubscribe(c))}),c},t.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(n){r.error(n)}},t.prototype.forEach=function(r,n){var i=this;return n=Hn(n),new n(function(s,c){var h=new yr({next:function(m){try{r(m)}catch(D){c(D),h.unsubscribe()}},error:c,complete:s});i.subscribe(h)})},t.prototype._subscribe=function(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)},t.prototype[bi]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return _i(r)(this)},t.prototype.toPromise=function(r){var n=this;return r=Hn(r),new r(function(i,s){var c;n.subscribe(function(h){return c=h},function(h){return s(h)},function(){return i(c)})})},t.create=function(r){return new t(r)},t}();function Hn(t){var r;return(r=t??Cn.Promise)!==null&&r!==void 0?r:Promise}function Ii(t){return t&&_t(t.next)&&_t(t.error)&&_t(t.complete)}function vi(t){return t&&t instanceof Fn||Ii(t)&&Dn(t)}var Si=On(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Nn=function(t){pt(r,t);function r(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return r.prototype.lift=function(n){var i=new Ln(this,this);return i.operator=n,i},r.prototype._throwIfClosed=function(){if(this.closed)throw new Si},r.prototype.next=function(n){var i=this;Oe(function(){var s,c;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var h=lr(i.currentObservers),m=h.next();!m.done;m=h.next()){var D=m.value;D.next(n)}}catch(F){s={error:F}}finally{try{m&&!m.done&&(c=h.return)&&c.call(h)}finally{if(s)throw s.error}}}})},r.prototype.error=function(n){var i=this;Oe(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var s=i.observers;s.length;)s.shift().error(n)}})},r.prototype.complete=function(){var n=this;Oe(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},r.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},r.prototype._innerSubscribe=function(n){var i=this,s=this,c=s.hasError,h=s.isStopped,m=s.observers;return c||h?xn:(this.currentObservers=null,m.push(n),new Ae(function(){i.currentObservers=null,hr(m,n)}))},r.prototype._checkFinalizedStatuses=function(n){var i=this,s=i.hasError,c=i.thrownError,h=i.isStopped;s?n.error(c):h&&n.complete()},r.prototype.asObservable=function(){var n=new zn;return n.source=this,n},r.create=function(n,i){return new Ln(n,i)},r}(zn),Ln=function(t){pt(r,t);function r(n,i){var s=t.call(this)||this;return s.destination=n,s.source=i,s}return r.prototype.next=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,n)},r.prototype.error=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,n)},r.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},r.prototype._subscribe=function(n){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&s!==void 0?s:xn},r}(Nn),Un=function(t){pt(r,t);function r(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},r.prototype.getValue=function(){var n=this,i=n.hasError,s=n.thrownError,c=n._value;if(i)throw s;return this._throwIfClosed(),c},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(Nn),ot=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function br(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var De={exports:{}};De.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=1,c=2,h=9007199254740991,m="[object Arguments]",D="[object Array]",F="[object AsyncFunction]",T="[object Boolean]",G="[object Date]",b="[object Error]",d="[object Function]",l="[object GeneratorFunction]",p="[object Map]",g="[object Number]",v="[object Null]",_="[object Object]",y="[object Promise]",f="[object Proxy]",O="[object RegExp]",E="[object Set]",I="[object String]",P="[object Symbol]",S="[object Undefined]",x="[object WeakMap]",w="[object ArrayBuffer]",M="[object DataView]",z="[object Float32Array]",R="[object Float64Array]",H="[object Int8Array]",j="[object Int16Array]",Wt="[object Int32Array]",Tt="[object Uint8Array]",ht="[object Uint8ClampedArray]",U="[object Uint16Array]",ce="[object Uint32Array]",Nr=/[\\^$.*+?()[\]{}|]/g,ut=/^\[object .+?Constructor\]$/,Ne=/^(?:0|[1-9]\d*)$/,B={};B[z]=B[R]=B[H]=B[j]=B[Wt]=B[Tt]=B[ht]=B[U]=B[ce]=!0,B[m]=B[D]=B[w]=B[T]=B[M]=B[G]=B[b]=B[d]=B[p]=B[g]=B[_]=B[O]=B[E]=B[I]=B[x]=!1;var Le=typeof ot=="object"&&ot&&ot.Object===Object&&ot,Lr=typeof self=="object"&&self&&self.Object===Object&&self,lt=Le||Lr||Function("return this")(),Ue=r&&!r.nodeType&&r,We=Ue&&!0&&t&&!t.nodeType&&t,ue=We&&We.exports===Ue,le=ue&&Le.process,Ge=function(){try{return le&&le.binding&&le.binding("util")}catch{}}(),fe=Ge&&Ge.isTypedArray;function Be(e,a){for(var o=-1,u=e==null?0:e.length,C=0,k=[];++o<u;){var L=e[o];a(L,o,e)&&(k[C++]=L)}return k}function de(e,a){for(var o=-1,u=a.length,C=e.length;++o<u;)e[C+o]=a[o];return e}function $e(e,a){for(var o=-1,u=e==null?0:e.length;++o<u;)if(a(e[o],o,e))return!0;return!1}function Ur(e,a){for(var o=-1,u=Array(e);++o<e;)u[o]=a(o);return u}function Wr(e){return function(a){return e(a)}}function Gt(e,a){return e.has(a)}function pe(e,a){return e==null?void 0:e[a]}function Ke(e){var a=-1,o=Array(e.size);return e.forEach(function(u,C){o[++a]=[C,u]}),o}function Ye(e,a){return function(o){return e(a(o))}}function mt(e){var a=-1,o=Array(e.size);return e.forEach(function(u){o[++a]=u}),o}var Bt=Array.prototype,Gr=Function.prototype,Ct=Object.prototype,$t=lt["__core-js_shared__"],he=Gr.toString,ct=Ct.hasOwnProperty,Ve=function(){var e=/[^.]+$/.exec($t&&$t.keys&&$t.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Xe=Ct.toString,Br=RegExp("^"+he.call(ct).replace(Nr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),me=ue?lt.Buffer:void 0,Kt=lt.Symbol,qe=lt.Uint8Array,Yt=Ct.propertyIsEnumerable,jt=Bt.splice,ft=Kt?Kt.toStringTag:void 0,Vt=Object.getOwnPropertySymbols,ye=me?me.isBuffer:void 0,Rt=Ye(Object.keys,Object),be=vt(lt,"DataView"),Ft=vt(lt,"Map"),ge=vt(lt,"Promise"),_e=vt(lt,"Set"),Ie=vt(lt,"WeakMap"),Et=vt(Object,"create"),Ze=et(be),It=et(Ft),$r=et(ge),Kr=et(_e),Yr=et(Ie),Je=Kt?Kt.prototype:void 0,ve=Je?Je.valueOf:void 0;function X(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Vr(){this.__data__=Et?Et(null):{},this.size=0}function Xr(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a}function qr(e){var a=this.__data__;if(Et){var o=a[e];return o===i?void 0:o}return ct.call(a,e)?a[e]:void 0}function Zr(e){var a=this.__data__;return Et?a[e]!==void 0:ct.call(a,e)}function Jr(e,a){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Et&&a===void 0?i:a,this}X.prototype.clear=Vr,X.prototype.delete=Xr,X.prototype.get=qr,X.prototype.has=Zr,X.prototype.set=Jr;function Z(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Qr(){this.__data__=[],this.size=0}function tn(e){var a=this.__data__,o=Zt(a,e);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():jt.call(a,o,1),--this.size,!0}function en(e){var a=this.__data__,o=Zt(a,e);return o<0?void 0:a[o][1]}function rn(e){return Zt(this.__data__,e)>-1}function nn(e,a){var o=this.__data__,u=Zt(o,e);return u<0?(++this.size,o.push([e,a])):o[u][1]=a,this}Z.prototype.clear=Qr,Z.prototype.delete=tn,Z.prototype.get=en,Z.prototype.has=rn,Z.prototype.set=nn;function rt(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function an(){this.size=0,this.__data__={hash:new X,map:new(Ft||Z),string:new X}}function sn(e){var a=dt(this,e).delete(e);return this.size-=a?1:0,a}function on(e){return dt(this,e).get(e)}function cn(e){return dt(this,e).has(e)}function un(e,a){var o=dt(this,e),u=o.size;return o.set(e,a),this.size+=o.size==u?0:1,this}rt.prototype.clear=an,rt.prototype.delete=sn,rt.prototype.get=on,rt.prototype.has=cn,rt.prototype.set=un;function Xt(e){var a=-1,o=e==null?0:e.length;for(this.__data__=new rt;++a<o;)this.add(e[a])}function Qe(e){return this.__data__.set(e,i),this}function qt(e){return this.__data__.has(e)}Xt.prototype.add=Xt.prototype.push=Qe,Xt.prototype.has=qt;function yt(e){var a=this.__data__=new Z(e);this.size=a.size}function Se(){this.__data__=new Z,this.size=0}function ln(e){var a=this.__data__,o=a.delete(e);return this.size=a.size,o}function fn(e){return this.__data__.get(e)}function dn(e){return this.__data__.has(e)}function pn(e,a){var o=this.__data__;if(o instanceof Z){var u=o.__data__;if(!Ft||u.length<n-1)return u.push([e,a]),this.size=++o.size,this;o=this.__data__=new rt(u)}return o.set(e,a),this.size=o.size,this}yt.prototype.clear=Se,yt.prototype.delete=ln,yt.prototype.get=fn,yt.prototype.has=dn,yt.prototype.set=pn;function hn(e,a){var o=Jt(e),u=!o&&ir(e),C=!o&&!u&&Qt(e),k=!o&&!u&&!C&&or(e),L=o||u||C||k,N=L?Ur(e.length,String):[],$=N.length;for(var W in e)ct.call(e,W)&&!(L&&(W=="length"||C&&(W=="offset"||W=="parent")||k&&(W=="buffer"||W=="byteLength"||W=="byteOffset")||Sn(W,$)))&&N.push(W);return N}function Zt(e,a){for(var o=e.length;o--;)if(nr(e[o][0],a))return o;return-1}function we(e,a,o){var u=a(e);return Jt(e)?u:de(u,o(e))}function zt(e){return e==null?e===void 0?S:v:ft&&ft in Object(e)?St(e):rr(e)}function tr(e){return gt(e)&&zt(e)==m}function er(e,a,o,u,C){return e===a?!0:e==null||a==null||!gt(e)&&!gt(a)?e!==e&&a!==a:mn(e,a,o,u,er,C)}function mn(e,a,o,u,C,k){var L=Jt(e),N=Jt(a),$=L?D:bt(e),W=N?D:bt(a);$=$==m?_:$,W=W==m?_:W;var J=$==_,nt=W==_,V=$==W;if(V&&Qt(e)){if(!Qt(a))return!1;L=!0,J=!1}if(V&&!J)return k||(k=new yt),L||or(e)?ke(e,a,o,u,C,k):_n(e,a,$,o,u,C,k);if(!(o&s)){var Q=J&&ct.call(e,"__wrapped__"),q=nt&&ct.call(a,"__wrapped__");if(Q||q){var Mt=Q?e.value():e,wt=q?a.value():a;return k||(k=new yt),C(Mt,wt,o,u,k)}}return V?(k||(k=new yt),In(e,a,o,u,C,k)):!1}function yn(e){if(!sr(e)||kn(e))return!1;var a=ar(e)?Br:ut;return a.test(et(e))}function bn(e){return gt(e)&&Ee(e.length)&&!!B[zt(e)]}function gn(e){if(!Tn(e))return Rt(e);var a=[];for(var o in Object(e))ct.call(e,o)&&o!="constructor"&&a.push(o);return a}function ke(e,a,o,u,C,k){var L=o&s,N=e.length,$=a.length;if(N!=$&&!(L&&$>N))return!1;var W=k.get(e);if(W&&k.get(a))return W==a;var J=-1,nt=!0,V=o&c?new Xt:void 0;for(k.set(e,a),k.set(a,e);++J<N;){var Q=e[J],q=a[J];if(u)var Mt=L?u(q,Q,J,a,e,k):u(Q,q,J,e,a,k);if(Mt!==void 0){if(Mt)continue;nt=!1;break}if(V){if(!$e(a,function(wt,Nt){if(!Gt(V,Nt)&&(Q===wt||C(Q,wt,o,u,k)))return V.push(Nt)})){nt=!1;break}}else if(!(Q===q||C(Q,q,o,u,k))){nt=!1;break}}return k.delete(e),k.delete(a),nt}function _n(e,a,o,u,C,k,L){switch(o){case M:if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case w:return!(e.byteLength!=a.byteLength||!k(new qe(e),new qe(a)));case T:case G:case g:return nr(+e,+a);case b:return e.name==a.name&&e.message==a.message;case O:case I:return e==a+"";case p:var N=Ke;case E:var $=u&s;if(N||(N=mt),e.size!=a.size&&!$)return!1;var W=L.get(e);if(W)return W==a;u|=c,L.set(e,a);var J=ke(N(e),N(a),u,C,k,L);return L.delete(e),J;case P:if(ve)return ve.call(e)==ve.call(a)}return!1}function In(e,a,o,u,C,k){var L=o&s,N=Ht(e),$=N.length,W=Ht(a),J=W.length;if($!=J&&!L)return!1;for(var nt=$;nt--;){var V=N[nt];if(!(L?V in a:ct.call(a,V)))return!1}var Q=k.get(e);if(Q&&k.get(a))return Q==a;var q=!0;k.set(e,a),k.set(a,e);for(var Mt=L;++nt<$;){V=N[nt];var wt=e[V],Nt=a[V];if(u)var fi=L?u(Nt,wt,V,a,e,k):u(wt,Nt,V,e,a,k);if(!(fi===void 0?wt===Nt||C(wt,Nt,o,u,k):fi)){q=!1;break}Mt||(Mt=V=="constructor")}if(q&&!Mt){var cr=e.constructor,ur=a.constructor;cr!=ur&&"constructor"in e&&"constructor"in a&&!(typeof cr=="function"&&cr instanceof cr&&typeof ur=="function"&&ur instanceof ur)&&(q=!1)}return k.delete(e),k.delete(a),q}function Ht(e){return we(e,Me,vn)}function dt(e,a){var o=e.__data__;return wn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function vt(e,a){var o=pe(e,a);return yn(o)?o:void 0}function St(e){var a=ct.call(e,ft),o=e[ft];try{e[ft]=void 0;var u=!0}catch{}var C=Xe.call(e);return u&&(a?e[ft]=o:delete e[ft]),C}var vn=Vt?function(e){return e==null?[]:(e=Object(e),Be(Vt(e),function(a){return Yt.call(e,a)}))}:Mn,bt=zt;(be&&bt(new be(new ArrayBuffer(1)))!=M||Ft&&bt(new Ft)!=p||ge&&bt(ge.resolve())!=y||_e&&bt(new _e)!=E||Ie&&bt(new Ie)!=x)&&(bt=function(e){var a=zt(e),o=a==_?e.constructor:void 0,u=o?et(o):"";if(u)switch(u){case Ze:return M;case It:return p;case $r:return y;case Kr:return E;case Yr:return x}return a});function Sn(e,a){return a=a??h,!!a&&(typeof e=="number"||Ne.test(e))&&e>-1&&e%1==0&&e<a}function wn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function kn(e){return!!Ve&&Ve in e}function Tn(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||Ct;return e===o}function rr(e){return Xe.call(e)}function et(e){if(e!=null){try{return he.call(e)}catch{}try{return e+""}catch{}}return""}function nr(e,a){return e===a||e!==e&&a!==a}var ir=tr(function(){return arguments}())?tr:function(e){return gt(e)&&ct.call(e,"callee")&&!Yt.call(e,"callee")},Jt=Array.isArray;function Te(e){return e!=null&&Ee(e.length)&&!ar(e)}var Qt=ye||An;function En(e,a){return er(e,a)}function ar(e){if(!sr(e))return!1;var a=zt(e);return a==d||a==l||a==F||a==f}function Ee(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=h}function sr(e){var a=typeof e;return e!=null&&(a=="object"||a=="function")}function gt(e){return e!=null&&typeof e=="object"}var or=fe?Wr(fe):bn;function Me(e){return Te(e)?hn(e):gn(e)}function Mn(){return[]}function An(){return!1}t.exports=En}(De,De.exports);var wi=De.exports;const it=br(wi);var Pe={exports:{}};Pe.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,c="[object Arguments]",h="[object Array]",m="[object Boolean]",D="[object Date]",F="[object Error]",T="[object Function]",G="[object GeneratorFunction]",b="[object Map]",d="[object Number]",l="[object Object]",p="[object Promise]",g="[object RegExp]",v="[object Set]",_="[object String]",y="[object Symbol]",f="[object WeakMap]",O="[object ArrayBuffer]",E="[object DataView]",I="[object Float32Array]",P="[object Float64Array]",S="[object Int8Array]",x="[object Int16Array]",w="[object Int32Array]",M="[object Uint8Array]",z="[object Uint8ClampedArray]",R="[object Uint16Array]",H="[object Uint32Array]",j=/[\\^$.*+?()[\]{}|]/g,Wt=/\w*$/,Tt=/^\[object .+?Constructor\]$/,ht=/^(?:0|[1-9]\d*)$/,U={};U[c]=U[h]=U[O]=U[E]=U[m]=U[D]=U[I]=U[P]=U[S]=U[x]=U[w]=U[b]=U[d]=U[l]=U[g]=U[v]=U[_]=U[y]=U[M]=U[z]=U[R]=U[H]=!0,U[F]=U[T]=U[f]=!1;var ce=typeof ot=="object"&&ot&&ot.Object===Object&&ot,Nr=typeof self=="object"&&self&&self.Object===Object&&self,ut=ce||Nr||Function("return this")(),Ne=r&&!r.nodeType&&r,B=Ne&&!0&&t&&!t.nodeType&&t,Le=B&&B.exports===Ne;function Lr(e,a){return e.set(a[0],a[1]),e}function lt(e,a){return e.add(a),e}function Ue(e,a){for(var o=-1,u=e?e.length:0;++o<u&&a(e[o],o,e)!==!1;);return e}function We(e,a){for(var o=-1,u=a.length,C=e.length;++o<u;)e[C+o]=a[o];return e}function ue(e,a,o,u){for(var C=-1,k=e?e.length:0;++C<k;)o=a(o,e[C],C,e);return o}function le(e,a){for(var o=-1,u=Array(e);++o<e;)u[o]=a(o);return u}function Ge(e,a){return e==null?void 0:e[a]}function fe(e){var a=!1;if(e!=null&&typeof e.toString!="function")try{a=!!(e+"")}catch{}return a}function Be(e){var a=-1,o=Array(e.size);return e.forEach(function(u,C){o[++a]=[C,u]}),o}function de(e,a){return function(o){return e(a(o))}}function $e(e){var a=-1,o=Array(e.size);return e.forEach(function(u){o[++a]=u}),o}var Ur=Array.prototype,Wr=Function.prototype,Gt=Object.prototype,pe=ut["__core-js_shared__"],Ke=function(){var e=/[^.]+$/.exec(pe&&pe.keys&&pe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ye=Wr.toString,mt=Gt.hasOwnProperty,Bt=Gt.toString,Gr=RegExp("^"+Ye.call(mt).replace(j,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ct=Le?ut.Buffer:void 0,$t=ut.Symbol,he=ut.Uint8Array,ct=de(Object.getPrototypeOf,Object),Ve=Object.create,Xe=Gt.propertyIsEnumerable,Br=Ur.splice,me=Object.getOwnPropertySymbols,Kt=Ct?Ct.isBuffer:void 0,qe=de(Object.keys,Object),Yt=dt(ut,"DataView"),jt=dt(ut,"Map"),ft=dt(ut,"Promise"),Vt=dt(ut,"Set"),ye=dt(ut,"WeakMap"),Rt=dt(Object,"create"),be=et(Yt),Ft=et(jt),ge=et(ft),_e=et(Vt),Ie=et(ye),Et=$t?$t.prototype:void 0,Ze=Et?Et.valueOf:void 0;function It(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function $r(){this.__data__=Rt?Rt(null):{}}function Kr(e){return this.has(e)&&delete this.__data__[e]}function Yr(e){var a=this.__data__;if(Rt){var o=a[e];return o===i?void 0:o}return mt.call(a,e)?a[e]:void 0}function Je(e){var a=this.__data__;return Rt?a[e]!==void 0:mt.call(a,e)}function ve(e,a){var o=this.__data__;return o[e]=Rt&&a===void 0?i:a,this}It.prototype.clear=$r,It.prototype.delete=Kr,It.prototype.get=Yr,It.prototype.has=Je,It.prototype.set=ve;function X(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Vr(){this.__data__=[]}function Xr(e){var a=this.__data__,o=qt(a,e);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():Br.call(a,o,1),!0}function qr(e){var a=this.__data__,o=qt(a,e);return o<0?void 0:a[o][1]}function Zr(e){return qt(this.__data__,e)>-1}function Jr(e,a){var o=this.__data__,u=qt(o,e);return u<0?o.push([e,a]):o[u][1]=a,this}X.prototype.clear=Vr,X.prototype.delete=Xr,X.prototype.get=qr,X.prototype.has=Zr,X.prototype.set=Jr;function Z(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Qr(){this.__data__={hash:new It,map:new(jt||X),string:new It}}function tn(e){return Ht(this,e).delete(e)}function en(e){return Ht(this,e).get(e)}function rn(e){return Ht(this,e).has(e)}function nn(e,a){return Ht(this,e).set(e,a),this}Z.prototype.clear=Qr,Z.prototype.delete=tn,Z.prototype.get=en,Z.prototype.has=rn,Z.prototype.set=nn;function rt(e){this.__data__=new X(e)}function an(){this.__data__=new X}function sn(e){return this.__data__.delete(e)}function on(e){return this.__data__.get(e)}function cn(e){return this.__data__.has(e)}function un(e,a){var o=this.__data__;if(o instanceof X){var u=o.__data__;if(!jt||u.length<n-1)return u.push([e,a]),this;o=this.__data__=new Z(u)}return o.set(e,a),this}rt.prototype.clear=an,rt.prototype.delete=sn,rt.prototype.get=on,rt.prototype.has=cn,rt.prototype.set=un;function Xt(e,a){var o=Te(e)||Jt(e)?le(e.length,String):[],u=o.length,C=!!u;for(var k in e)mt.call(e,k)&&!(C&&(k=="length"||wn(k,u)))&&o.push(k);return o}function Qe(e,a,o){var u=e[a];(!(mt.call(e,a)&&ir(u,o))||o===void 0&&!(a in e))&&(e[a]=o)}function qt(e,a){for(var o=e.length;o--;)if(ir(e[o][0],a))return o;return-1}function yt(e,a){return e&&ke(a,Me(a),e)}function Se(e,a,o,u,C,k,L){var N;if(u&&(N=k?u(e,C,k,L):u(e)),N!==void 0)return N;if(!gt(e))return e;var $=Te(e);if($){if(N=vn(e),!a)return gn(e,N)}else{var W=St(e),J=W==T||W==G;if(ar(e))return Zt(e,a);if(W==l||W==c||J&&!k){if(fe(e))return k?e:{};if(N=bt(J?{}:e),!a)return _n(e,yt(N,e))}else{if(!U[W])return k?e:{};N=Sn(e,W,Se,a)}}L||(L=new rt);var nt=L.get(e);if(nt)return nt;if(L.set(e,N),!$)var V=o?In(e):Me(e);return Ue(V||e,function(Q,q){V&&(q=Q,Q=e[q]),Qe(N,q,Se(Q,a,o,u,q,e,L))}),N}function ln(e){return gt(e)?Ve(e):{}}function fn(e,a,o){var u=a(e);return Te(e)?u:We(u,o(e))}function dn(e){return Bt.call(e)}function pn(e){if(!gt(e)||Tn(e))return!1;var a=Ee(e)||fe(e)?Gr:Tt;return a.test(et(e))}function hn(e){if(!rr(e))return qe(e);var a=[];for(var o in Object(e))mt.call(e,o)&&o!="constructor"&&a.push(o);return a}function Zt(e,a){if(a)return e.slice();var o=new e.constructor(e.length);return e.copy(o),o}function we(e){var a=new e.constructor(e.byteLength);return new he(a).set(new he(e)),a}function zt(e,a){var o=a?we(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function tr(e,a,o){var u=a?o(Be(e),!0):Be(e);return ue(u,Lr,new e.constructor)}function er(e){var a=new e.constructor(e.source,Wt.exec(e));return a.lastIndex=e.lastIndex,a}function mn(e,a,o){var u=a?o($e(e),!0):$e(e);return ue(u,lt,new e.constructor)}function yn(e){return Ze?Object(Ze.call(e)):{}}function bn(e,a){var o=a?we(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function gn(e,a){var o=-1,u=e.length;for(a||(a=Array(u));++o<u;)a[o]=e[o];return a}function ke(e,a,o,u){o||(o={});for(var C=-1,k=a.length;++C<k;){var L=a[C],N=void 0;Qe(o,L,N===void 0?e[L]:N)}return o}function _n(e,a){return ke(e,vt(e),a)}function In(e){return fn(e,Me,vt)}function Ht(e,a){var o=e.__data__;return kn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function dt(e,a){var o=Ge(e,a);return pn(o)?o:void 0}var vt=me?de(me,Object):Mn,St=dn;(Yt&&St(new Yt(new ArrayBuffer(1)))!=E||jt&&St(new jt)!=b||ft&&St(ft.resolve())!=p||Vt&&St(new Vt)!=v||ye&&St(new ye)!=f)&&(St=function(e){var a=Bt.call(e),o=a==l?e.constructor:void 0,u=o?et(o):void 0;if(u)switch(u){case be:return E;case Ft:return b;case ge:return p;case _e:return v;case Ie:return f}return a});function vn(e){var a=e.length,o=e.constructor(a);return a&&typeof e[0]=="string"&&mt.call(e,"index")&&(o.index=e.index,o.input=e.input),o}function bt(e){return typeof e.constructor=="function"&&!rr(e)?ln(ct(e)):{}}function Sn(e,a,o,u){var C=e.constructor;switch(a){case O:return we(e);case m:case D:return new C(+e);case E:return zt(e,u);case I:case P:case S:case x:case w:case M:case z:case R:case H:return bn(e,u);case b:return tr(e,u,o);case d:case _:return new C(e);case g:return er(e);case v:return mn(e,u,o);case y:return yn(e)}}function wn(e,a){return a=a??s,!!a&&(typeof e=="number"||ht.test(e))&&e>-1&&e%1==0&&e<a}function kn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function Tn(e){return!!Ke&&Ke in e}function rr(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||Gt;return e===o}function et(e){if(e!=null){try{return Ye.call(e)}catch{}try{return e+""}catch{}}return""}function nr(e){return Se(e,!0,!0)}function ir(e,a){return e===a||e!==e&&a!==a}function Jt(e){return En(e)&&mt.call(e,"callee")&&(!Xe.call(e,"callee")||Bt.call(e)==c)}var Te=Array.isArray;function Qt(e){return e!=null&&sr(e.length)&&!Ee(e)}function En(e){return or(e)&&Qt(e)}var ar=Kt||An;function Ee(e){var a=gt(e)?Bt.call(e):"";return a==T||a==G}function sr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=s}function gt(e){var a=typeof e;return!!e&&(a=="object"||a=="function")}function or(e){return!!e&&typeof e=="object"}function Me(e){return Qt(e)?Xt(e):hn(e)}function Mn(){return[]}function An(){return!1}t.exports=nr}(Pe,Pe.exports);var ki=Pe.exports;const K=br(ki),Wn=t=>new Promise((r,n)=>{const i=new Image;console.warn("update cdn config for cors?"),i.onload=()=>{const s=i.width,c=i.height;r({width:s,height:c})},i.onerror=s=>{n(s)},i.crossOrigin="anonymous",i.src=t}),Ti=t=>new Promise((r,n)=>{const i=new Audio;i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3;r({duration:s})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.crossOrigin="anonymous",i.load()}),Gn=t=>new Promise((r,n)=>{const i=document.createElement("video");i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3,c=i.videoWidth,h=i.videoHeight;r({duration:s,width:c,height:h})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.load()}),Bn=(t,r)=>{const n=document.createElement("div");Object.keys(r).forEach(s=>{s!=="height"&&(n.style[s]=r[s])}),document.body.appendChild(n),n.textContent=t,n.style.whiteSpace="normal",n.style.position="absolute",n.style.visibility="hidden",n.style.display="inline-block",n.style.width=r.width+"px",n.style.fontSize=r.fontSize+"px";const i=getComputedStyle(n).height;return document.body.removeChild(n),parseFloat(i)},gr=t=>{const r=t.map(n=>new FontFace(n.fontFamily,`url(${n.url})`).load().catch(i=>i));return r.length===0?Promise.resolve(!0):new Promise((n,i)=>{Promise.all(r).then(s=>{s.forEach(c=>{c&&c.family&&(document.fonts.add(c),n(!0))})}).catch(s=>i(s))})},Ce={color:"#000000",x:0,y:0,blur:0},te=(t,r)=>{let n=r!=null&&r.trim?r.trim.to-r.trim.from:(r==null?void 0:r.duration)||5e3;const i={from:0,to:n};if(!t)return i;if(t.from<0)return console.error("'from' must be a non-negative number. Returning default display."),i;if(t.from!==void 0&&t.to===void 0)return{from:t.from,to:t.from+n};if(t.to!==void 0){if(t.to<0)return console.error("'to' must be a non-negative number. Returning default display."),i;if(t.to<t.from)return console.error("'to' must be greater than or equal to 'from'. Returning default display."),i}return t},$n=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function je(t,r){const n={x:t.size.width/2,y:t.size.height/2},i={x:r.width/2,y:r.height/2},s=Math.min(t.size.width/r.width,t.size.height/r.height),c=n.x-i.x;return{top:`${n.y-i.y}px`,left:`${c}px`,transform:`scale(${s})`}}const _r=async(t,r)=>{const n=t.details.src,i=await Gn(n),s=je(r,{...i}),c=$n(t.trim,{duration:i.duration}),h={width:i.width,height:i.height,opacity:100,src:n,volume:t.details.volume??100,borderRadius:t.details.borderRadius??0,borderWidth:t.details.borderWidth??0,borderColor:t.details.borderColor||"#000000",boxShadow:t.details.boxShadow||Ce,top:t.details.top||s.top||"0px",left:t.details.left||s.left||"0px",transform:t.details.transform||s.transform,blur:t.details.blur||0,brightness:t.details.brightness||100,flipX:t.details.flipX||!1,flipY:t.details.flipY||!1,rotate:t.details.rotate||"0deg",visibility:t.details.visibility||"visible",mediaWidth:t.details.mediaWidth||i.width||100,mediaHeight:t.details.mediaHeight||i.height||100};return{...t,trim:c,type:"video",name:"video",details:h,playbackRate:t.playbackRate||1,display:te(t.display,{duration:i.duration,trim:c}),duration:i.duration}},Ir=async t=>{console.log({payload:t});const r=t.id,n=t.details,i=await Ti(n.src);console.log({audioData:i});const s=i.duration,c=$n(t.trim,{duration:s});return{id:r,name:"",type:"audio",display:te(t.display,{duration:s,trim:c}),trim:c,playbackRate:t.playbackRate||1,details:{src:n.src,volume:n.volume??100},metadata:{...t.metadata},duration:s}},Ei=async(t,r)=>{const n=t.trackItemsIds,i=t.size,s=Math.min(r.size.width/i.width,r.size.height/i.height),c=t.rotate||0,h=t.position,m=t.display,D=t.trim||t.display;let F=1/0,T=0;const G=n.map(d=>{const l=t.trackItemsMap[d],p=t.trackItemsDetails[d];if(l.display.from<F&&(F=l.display.from),l.display.to>T&&(T=l.display.to),l.type==="text")return wr({...l,details:p.details},{size:i});if(l.type==="image")return vr({...l,details:p.details},{size:i});if(l.type==="video")return _r({...l,details:p.details},{size:i});if(l.type==="audio")return Ir({...l,details:p.details});if(l.type==="caption")return Sr({...l,details:p.details},{size:i})}),b=await Promise.all(G);return{id:t.id,details:b,size:i,position:{top:h.top||0,left:h.left||0},trim:D,scale:s,display:m||{from:F,to:T},rotate:c,activeEdit:!1}},vr=async(t,r)=>{const n=t.details,i=await Wn(n.src),s=je(r,i);return{id:t.id,type:"image",name:"image",display:te(t.display),playbackRate:t.playbackRate||1,details:{src:n.src||"",width:n.width||i.width||100,height:n.height||i.height||100,opacity:n.opacity??100,transform:n.transform||s.transform,border:n.border||"none",borderRadius:n.borderRadius||0,boxShadow:n.boxShadow||Ce,top:n.top||s.top||"0px",left:n.left||s.left||"0px",borderWidth:n.borderWidth??0,borderColor:n.borderColor||"#000000",blur:n.blur||0,brightness:n.brightness||100,flipX:n.flipX||!1,flipY:n.flipY||!1,rotate:n.rotate||"0deg",visibility:n.visibility||"visible",mediaWidth:n.mediaWidth||n.width||i.width||100,mediaHeight:n.mediaHeight||n.height||i.height||100},metadata:t.metadata||{}}},Sr=async(t,r)=>{const n=t;n.details.fontUrl&&await gr([{fontFamily:n.details.fontFamily,url:n.details.fontUrl}]);const i=n.id,s=n.details,c=Kn(s),h=Bn(n.details.text,c),m=je(r,{width:c.width,height:h});return{id:i,name:"caption",type:"caption",display:te(n.display),details:{...c,text:s.text||"",height:h,fontUrl:s.fontUrl,top:c.top||m.top,left:c.left||m.left,borderWidth:s.borderWidth||0,borderColor:s.borderColor||"#000000",boxShadow:s.boxShadow||Ce,words:s.words||[]},metadata:{}}},wr=async(t,r)=>{t.details.fontUrl&&await gr([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const n=t.id,i=t.details,s=Kn(i),c=Bn(t.details.text,s),h=je(r,{width:s.width,height:c});return{id:n,name:"text",type:"text",display:te(t.display),details:{...s,text:i.text||"",height:c,fontUrl:i.fontUrl,top:s.top||h.top,left:s.left||h.left,borderWidth:i.borderWidth||0,borderColor:i.borderColor||"#000000",boxShadow:i.boxShadow||Ce},metadata:{}}},Kn=t=>({fontFamily:t.fontFamily||"Arial",fontSize:t.fontSize||"16px",fontWeight:t.fontWeight||"normal",fontStyle:t.fontStyle||"normal",textDecoration:t.textDecoration||"none",textAlign:t.textAlign||"left",lineHeight:t.lineHeight||"normal",letterSpacing:t.letterSpacing||"normal",wordSpacing:t.wordSpacing||"normal",color:t.color||"#ffffff",backgroundColor:t.backgroundColor||"transparent",border:t.border||"none",textShadow:t.textShadow||"none",text:t.text||"",opacity:t.opacity??100,width:t.width||300,wordWrap:t.wordWrap||"normal",wordBreak:t.wordBreak||"normal",WebkitTextStrokeColor:t.WebkitTextStrokeColor||"#ffffff",WebkitTextStrokeWidth:t.WebkitTextStrokeWidth||"0px",top:t.top,left:t.left,textTransform:t.textTransform||"none",transform:t.transform||"none"}),Mi="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Re=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=Mi[n[t]&63];return r};function Ai(t,r){return t.filter(i=>{if(r.forEach(s=>{i.items.includes(s)&&(i.items=i.items.filter(c=>c!==s))}),i.items.length!==0)return i})}function kr(t=16){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=r.charAt(Math.floor(Math.random()*r.length));let i=Re(t-1);return i=i.replace(/[^a-zA-Z0-9]/g,"").slice(0,t-1),n+i}const Ut=t=>Object.keys(t).reduce((r,n)=>{const{display:i,playbackRate:s}=t[n];return Math.max(r,i.to/(s||1))},0),Oi=(t,r,n,i,s)=>{let c=!1;return t.forEach(h=>{const m=n[h],D=m.display.from,F=m.display.to;if(i!==void 0||s!==void 0){const T=r.find((b,d)=>{if(i!==void 0&&b.id===i)return b;if(s!==void 0&&d===s)return b});if(!T)return c=!0,!0;c=T.items.map(b=>n[b]).some(b=>{const d=b.display.from,l=b.display.to;return d<=D&&l>=F})}}),c};function xi(t){const r=A.subject.pipe(A.filter(({key:d})=>d.startsWith(A.DESIGN_PREFIX))),n=A.subject.pipe(A.filter(({key:d})=>d.startsWith(A.ADD_PREFIX))),i=A.subject.pipe(A.filter(({key:d})=>d.startsWith(A.LAYER_PREFIX))),s=A.subject.pipe(A.filter(({key:d})=>d.startsWith(A.HISTORY_PREFIX))),c=A.subject.pipe(A.filter(({key:d})=>d.startsWith(A.ACTIVE_PREFIX))),h=A.subject.pipe(A.filter(({key:d})=>d.startsWith(A.EDIT_PREFIX))),m=r.subscribe(async d=>{var l,p;if(d.key===A.DESIGN_LOAD){const g=(l=d.value)==null?void 0:l.payload,v=g.size,_=g.trackItemIds,y=g.trackItemsMap,f=g.trackItemDetailsMap;console.warn("IMPROVE FONTS LOADING");const O=_.map(async I=>{var P;try{const S=f[I],x=y[I];if(S.type==="image"){const w=await vr({id:I,details:S.details,...x},{size:v}),{details:M,...z}=w;f[I]={type:"image",details:M},y[I]=z}else if(S.type==="video"){const w=K((P=d.value)==null?void 0:P.payload.trackItemsMap[I]),M=await _r({...S,...w,...x},{size:v}),{details:z,...R}=M;f[I]={type:"video",details:z},y[I]=R}else if(S.type==="audio"){const w=await Ir({id:I,details:S.details,...x}),{details:M,...z}=w;f[I]={type:"audio",details:M},y[I]=z}else if(S.type==="caption"){const w=await Sr({id:I,details:S.details,...x},{size:v}),{details:M,...z}=w;f[I]={type:"caption",details:M},y[I]=z}else if(S.type==="text"){const w=await wr({id:I,details:S.details,...x},{size:v}),{details:M,...z}=w;f[I]={type:"text",details:M},y[I]=z}return!0}catch{return!1}});await Promise.all(O);const E=Ut(y);t.updateState({...g,trackItemsMap:y,duration:E})}if(d.key===A.DESIGN_RESIZE){const g=(p=d.value)==null?void 0:p.payload;t.updateState({size:g})}}),D=s.subscribe(d=>{if(d.key===A.HISTORY_UNDO)return t.undo();if(d.key===A.HISTORY_REDO)return t.redo()}),F=i.subscribe(d=>{var g,v,_,y;const l=[],p=[];if((g=d.value)!=null&&g.payload.trackItemIds&&(l.push((v=d.value)==null?void 0:v.payload.trackItemIds),t.updateState({activeIds:l})),d.key===A.LAYER_DELETE){const f=(_=d.value)==null?void 0:_.payload.trackItemIds,O=K(t.getState()),E=f&&f.length?f:O.activeIds,I=O.trackItemIds,P=O.trackItemDetailsMap,S=I.filter(R=>!E.includes(R)),x=Object.fromEntries(Object.entries(P).filter(([R])=>!E.includes(R))),w=Ai(O.tracks,E),M=Object.fromEntries(Object.entries(O.trackItemsMap).filter(([R])=>!E.includes(R))),z=Ut(M);t.updateState({trackItemIds:S,trackItemDetailsMap:x,activeIds:[],trackItemsMap:M,tracks:w,duration:z},{updateHistory:!0,kind:"remove"})}if(d.key===A.LAYER_CLONE){const f=K(t.getState()),O=((y=d.value)==null?void 0:y.payload.trackItemIds)||f.activeIds;if(O.length===0)return;O.forEach(I=>{const P=f.trackItemsMap[I],S=f.trackItemDetailsMap[I],x=kr();p.push(x),f.trackItemsMap={...f.trackItemsMap,[x]:{...K(P),id:x}},f.trackItemDetailsMap={...f.trackItemDetailsMap,[x]:{...K(S)}},f.trackItemIds.push(x)});const E=[];f.tracks.forEach(I=>{const P={...I,items:[],id:Re()};I.items.forEach(S=>{if(O.includes(S)){const x=O.indexOf(S);P.items.push(p[x])}}),E.push(P)}),E.forEach(I=>{I.items.length!==0&&f.tracks.unshift(I)}),t.updateState({trackItemDetailsMap:f.trackItemDetailsMap,tracks:f.tracks,trackItemIds:f.trackItemIds,trackItemsMap:f.trackItemsMap},{updateHistory:!0,kind:"update"})}}),T=n.subscribe(async d=>{var f,O,E,I,P,S,x,w,M,z;const l=K(t.getState());let p=[],g="text";const v=(O=(f=d.value)==null?void 0:f.options)==null?void 0:O.trackId;let _=(I=(E=d.value)==null?void 0:E.options)==null?void 0:I.trackIndex;if(d.key===A.ADD_CAPTION){g="caption";const R=(P=d.value)==null?void 0:P.payload,H=[];for(const Tt of R){const ht=Sr(Tt,{size:l.size});H.push(ht)}const j=await Promise.all(H),Wt=[];for(const Tt of j){const ht=Tt.id;Wt.push(ht);const{details:U,...ce}=Tt;l.trackItemDetailsMap[ht]={type:g,details:U},l.trackItemsMap[ht]=ce,l.trackItemIds.push(ht)}p=Wt}if(d.key===A.ADD_TEXT){g="text";const R=await wr((S=d.value)==null?void 0:S.payload,{size:l.size}),{details:H,...j}=R;l.trackItemDetailsMap[j.id]={type:g,details:H},l.trackItemsMap[j.id]=j,l.trackItemIds.push(j.id),p=[j.id]}if(d.key===A.ADD_TEMPLATE){g="template";const R=await Ei((x=d.value)==null?void 0:x.payload,{size:l.size}),{details:H,...j}=R;l.trackItemsMap[R.id]={...j,type:"template"},l.trackItemIds.push(j.id),l.trackItemDetailsMap[j.id]={type:"template",details:H},p=[j.id]}if(d.key===A.ADD_IMAGE){g="image";const R=await vr((w=d.value)==null?void 0:w.payload,{size:l.size}),{details:H,...j}=R;l.trackItemDetailsMap[j.id]={type:g,details:H},l.trackItemsMap[j.id]=j,l.trackItemIds.push(j.id),p=[j.id]}if(d.key===A.ADD_AUDIO){g="audio";const R=await Ir((M=d.value)==null?void 0:M.payload),{details:H,...j}=R;l.trackItemDetailsMap[j.id]={type:g,details:H},l.trackItemsMap[j.id]=j,l.trackItemIds.push(j.id),p=[j.id]}if(d.key===A.ADD_VIDEO){g="video";const R=await _r((z=d.value)==null?void 0:z.payload,{size:l.size}),{details:H,...j}=R;l.trackItemDetailsMap[j.id]={type:g,details:H},l.trackItemsMap[j.id]=j,l.trackItemIds.push(j.id),p=[j.id]}_<0?_=0:_>l.tracks.length&&(_=l.tracks.length);const y=Oi(p,l.tracks,l.trackItemsMap,v,_);if(l.tracks.length>0&&v!==void 0&&v!=="main"&&!y)l.tracks.map(H=>H.id).includes(v)&&(l.tracks=l.tracks.map(H=>(H.id===v&&H.items.push(...p),H)));else if(l.tracks.length>0&&_!==void 0&&!y)l.tracks=l.tracks.map((R,H)=>(H===_&&R.items.push(...p),R));else{const R={id:Re(),accepts:["text","audio","helper","video","image","caption"],type:g,items:p,magnetic:!1,static:!1};_>0?l.tracks.push(R):l.tracks.unshift(R)}l.duration=Ut(l.trackItemsMap),t.updateState({trackItemIds:l.trackItemIds,trackItemDetailsMap:l.trackItemDetailsMap,trackItemsMap:l.trackItemsMap,tracks:l.tracks,duration:l.duration},{updateHistory:!0,kind:"add"})}),G=c.subscribe(async d=>{var l;if(d.key===A.ACTIVE_SPLIT){const p=K(t.getState()),g=(l=d.value)==null?void 0:l.options.time;if(p.activeIds.length===1){const v=p.activeIds[0],_=p.trackItemsMap[v];if(g>=_.display.to||g<=_.display.from)return;const y=p.trackItemDetailsMap[v],f=kr(),O={..._,id:f,display:{from:g,to:_.display.to},trim:{from:g,to:_.display.to}};p.trackItemsMap[v].display.to=g,p.trackItemsMap[f]=O,p.trackItemIds.push(f),p.trackItemDetailsMap[f]=y,p.tracks.forEach(E=>{E.items.includes(v)&&E.items.push(f)}),t.updateState({trackItemDetailsMap:p.trackItemDetailsMap,tracks:p.tracks,trackItemIds:p.trackItemIds,trackItemsMap:p.trackItemsMap},{updateHistory:!0,kind:"update"})}return}if(d.key===A.ACTIVE_CLONE){const p=K(t.getState());if(p.activeIds.length){const g=p.activeIds,v=[],_={activeIds:g,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};g.forEach(f=>{_.trackItemDetailsMap[f]=p.trackItemDetailsMap[f],_.trackItemsMap[f]=p.trackItemsMap[f],v.push(p.tracks.find(O=>O.items.includes(f)))});const y=new Set;v.filter(f=>y.has(f.id)?!1:(y.add(f),!0)),_.tracks=Array.from(y.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(_))}}if(d.key===A.ACTIVE_PASTE){const p=localStorage.getItem("DesignComboTemp");if(!p)return;const g=K(t.getState()),v=JSON.parse(p),_={},y=v.trackItemsMap,f=v.trackItemDetailsMap,O=v.tracks,E=[],I=v.activeIds.map(async P=>{const S=f[P];(S.type==="caption"||S.type==="text")&&S.details.fontUrl&&await gr([{fontFamily:S.details.fontFamily,url:S.details.fontUrl}]);const x=kr();return _[P]=x,g.trackItemsMap[x]={...y[P],id:x},g.trackItemDetailsMap[x]=S,g.trackItemIds.push(x),!0});await Promise.all(I),O.forEach(P=>{const S=P.items.map(w=>_[w]),x={...P,items:S,id:Re()};E.push(x)}),g.tracks=[...g.tracks,...E],t.updateState({trackItemDetailsMap:g.trackItemDetailsMap,tracks:g.tracks,trackItemIds:g.trackItemIds,trackItemsMap:g.trackItemsMap},{updateHistory:!0,kind:"update"})}}),b=h.subscribe(async d=>{var l,p,g,v;if(d.key===A.DELETE_TEMPLATE_ITEM){const _=K(t.getState()),[y]=(l=d.value)==null?void 0:l.payload.trackItemIds,f=_.trackItemDetailsMap;_.trackItemIds.forEach(E=>{const I=f[E];if(I.type==="template"&&I.details.map(S=>S.id).includes(y)){const S=I.details.filter(x=>x.id!==y);I.details=S}}),t.updateState({trackItemDetailsMap:{...f}},{updateHistory:!0,kind:"update"})}if(d.key===A.EDIT_OBJECT){const _=K(t.getState()),y=_.trackItemDetailsMap,f=_.trackItemsMap,O=Object.keys((p=d.value)==null?void 0:p.payload);if(!O.length)return;const E=(g=d.value)==null?void 0:g.payload;O.forEach(P=>{const S=E[P];S.details?y[P].details={...y[P].details,...S.details}:E[P].playbackRate?f[P].playbackRate=E[P].playbackRate:y[P].type==="template"&&(f[P]={...f[P],...E[P]})});const I=Ut(f);t.updateState({trackItemDetailsMap:{...y},trackItemsMap:{...f},duration:I},{updateHistory:!0,kind:"update:details"})}if(d.key===A.EDIT_TEMPLATE_ITEM){const _=(v=d.value)==null?void 0:v.payload,y=Object.keys(_)[0],f=Object.values(_)[0],O=K(t.getState());for(const E of O.trackItemIds)if(O.trackItemsMap[E].type==="template"){const I=O.trackItemDetailsMap[E];if(I.details.map(S=>S.id).includes(y)){for(let S of I.details)if(S.id===y){if(f.details){if(f.type==="image"&&f.details.src){const w=await Wn(f.details.src),M=S.details.width,z=S.details.height;let R=w.width,H=w.height;const j=w.width/w.height;M/z>j?(R=M,H=M/j):(H=z,R=z*j),f.details.mediaWidth=R,f.details.mediaHeight=H}if(f.type==="video"&&f.details.src){const w=await Gn(f.details.src),M=S.details.width,z=S.details.height;let R=w.width,H=w.height;const j=w.width/w.height;M/z>j?(R=M,H=M/j):(H=z,R=z*j),f.details.mediaWidth=R,f.details.mediaHeight=H}const x=S.details;S.details={...x,...f.details},f.details=S.details}S={...S,...f},O.trackItemDetailsMap[E].details=I.details.map(x=>x.id===y?S:x)}}}t.updateState({trackItemDetailsMap:{...O.trackItemDetailsMap}},{updateHistory:!0,kind:"update:details"})}if(d.key===A.CLOSE_EDIT_TEMPLATE){const _=K(t.getState());_.trackItemIds.forEach(y=>{const f=_.trackItemsMap[y];f.type==="template"&&(f.activeEdit=!1,t.updateState({trackItemsMap:{..._.trackItemsMap,[y]:f},activeIds:[]}))})}});return{unsubscribe:()=>{T.unsubscribe(),G.unsubscribe(),b.unsubscribe(),D.unsubscribe(),F.unsubscribe(),m.unsubscribe()}}}const Di={Date:!0,RegExp:!0,String:!0,Number:!0};function Yn(t,r,n={cyclesFix:!0},i=[]){var m,D;let s=[];const c=Array.isArray(t);for(const F in t){const T=t[F],G=c?+F:F;if(!(F in r)){s.push({type:"REMOVE",path:[G],oldValue:t[F]});continue}const b=r[F],d=typeof T=="object"&&typeof b=="object"&&Array.isArray(T)===Array.isArray(b);if(T&&b&&d&&!Di[(D=(m=Object.getPrototypeOf(T))==null?void 0:m.constructor)==null?void 0:D.name]&&(!n.cyclesFix||!i.includes(T))){const l=Yn(T,b,n,n.cyclesFix?i.concat([T]):[]);s.push.apply(s,l.map(p=>(p.path.unshift(G),p)))}else T!==b&&!(Number.isNaN(T)&&Number.isNaN(b))&&!(d&&(isNaN(T)?T+""==b+"":+T==+b))&&s.push({path:[G],type:"CHANGE",value:b,oldValue:T})}const h=Array.isArray(r);for(const F in r)F in t||s.push({type:"CREATE",path:[h?+F:F],value:r[F]});return s}var Tr=Symbol.for("immer-nothing"),ee=Symbol.for("immer-draftable"),at=Symbol.for("immer-state"),Vn=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function Y(t,...r){if(process.env.NODE_ENV!=="production"){const n=Vn[t],i=typeof n=="function"?n.apply(null,r):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var At=Object.getPrototypeOf;function Ot(t){return!!t&&!!t[at]}function kt(t){var r;return t?Xn(t)||Array.isArray(t)||!!t[ee]||!!((r=t.constructor)!=null&&r[ee])||ie(t)||ae(t):!1}var Pi=Object.prototype.constructor.toString();function Xn(t){if(!t||typeof t!="object")return!1;const r=At(t);if(r===null)return!0;const n=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Pi}function re(t,r){xt(t)===0?Reflect.ownKeys(t).forEach(n=>{r(n,t[n],t)}):t.forEach((n,i)=>r(i,n,t))}function xt(t){const r=t[at];return r?r.type_:Array.isArray(t)?1:ie(t)?2:ae(t)?3:0}function ne(t,r){return xt(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function Er(t,r){return xt(t)===2?t.get(r):t[r]}function qn(t,r,n){const i=xt(t);i===2?t.set(r,n):i===3?t.add(n):t[r]=n}function Ci(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function ie(t){return t instanceof Map}function ae(t){return t instanceof Set}function Dt(t){return t.copy_||t.base_}function Mr(t,r){if(ie(t))return new Map(t);if(ae(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Xn(t);if(r===!0||r==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[at];let s=Reflect.ownKeys(i);for(let c=0;c<s.length;c++){const h=s[c],m=i[h];m.writable===!1&&(m.writable=!0,m.configurable=!0),(m.get||m.set)&&(i[h]={configurable:!0,writable:!0,enumerable:m.enumerable,value:t[h]})}return Object.create(At(t),i)}else{const i=At(t);if(i!==null&&n)return{...t};const s=Object.create(i);return Object.assign(s,t)}}function Ar(t,r=!1){return Fe(t)||Ot(t)||!kt(t)||(xt(t)>1&&(t.set=t.add=t.clear=t.delete=ji),Object.freeze(t),r&&Object.entries(t).forEach(([n,i])=>Ar(i,!0))),t}function ji(){Y(2)}function Fe(t){return Object.isFrozen(t)}var Or={};function Pt(t){const r=Or[t];return r||Y(0,t),r}function Ri(t,r){Or[t]||(Or[t]=r)}var se;function Zn(){return se}function Fi(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Jn(t,r){r&&(Pt("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function xr(t){Dr(t),t.drafts_.forEach(zi),t.drafts_=null}function Dr(t){t===se&&(se=t.parent_)}function Qn(t){return se=Fi(se,t)}function zi(t){const r=t[at];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function ti(t,r){r.unfinalizedDrafts_=r.drafts_.length;const n=r.drafts_[0];return t!==void 0&&t!==n?(n[at].modified_&&(xr(r),Y(4)),kt(t)&&(t=ze(r,t),r.parent_||He(r,t)),r.patches_&&Pt("Patches").generateReplacementPatches_(n[at].base_,t,r.patches_,r.inversePatches_)):t=ze(r,n,[]),xr(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==Tr?t:void 0}function ze(t,r,n){if(Fe(r))return r;const i=r[at];if(!i)return re(r,(s,c)=>ei(t,i,r,s,c,n)),r;if(i.scope_!==t)return r;if(!i.modified_)return He(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let c=s,h=!1;i.type_===3&&(c=new Set(s),s.clear(),h=!0),re(c,(m,D)=>ei(t,i,s,m,D,n,h)),He(t,s,!1),n&&t.patches_&&Pt("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function ei(t,r,n,i,s,c,h){if(process.env.NODE_ENV!=="production"&&s===n&&Y(5),Ot(s)){const m=c&&r&&r.type_!==3&&!ne(r.assigned_,i)?c.concat(i):void 0,D=ze(t,s,m);if(qn(n,i,D),Ot(D))t.canAutoFreeze_=!1;else return}else h&&n.add(s);if(kt(s)&&!Fe(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;ze(t,s),(!r||!r.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&He(t,s)}}function He(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Ar(r,n)}function Hi(t,r){const n=Array.isArray(t),i={type_:n?1:0,scope_:r?r.scope_:Zn(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=i,c=Pr;n&&(s=[i],c=oe);const{revoke:h,proxy:m}=Proxy.revocable(s,c);return i.draft_=m,i.revoke_=h,m}var Pr={get(t,r){if(r===at)return t;const n=Dt(t);if(!ne(n,r))return Ni(t,n,r);const i=n[r];return t.finalized_||!kt(i)?i:i===Cr(t.base_,r)?(Rr(t),t.copy_[r]=Fr(i,t)):i},has(t,r){return r in Dt(t)},ownKeys(t){return Reflect.ownKeys(Dt(t))},set(t,r,n){const i=ri(Dt(t),r);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const s=Cr(Dt(t),r),c=s==null?void 0:s[at];if(c&&c.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(Ci(n,s)&&(n!==void 0||ne(t.base_,r)))return!0;Rr(t),jr(t)}return t.copy_[r]===n&&(n!==void 0||r in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[r])||(t.copy_[r]=n,t.assigned_[r]=!0),!0},deleteProperty(t,r){return Cr(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,Rr(t),jr(t)):delete t.assigned_[r],t.copy_&&delete t.copy_[r],!0},getOwnPropertyDescriptor(t,r){const n=Dt(t),i=Reflect.getOwnPropertyDescriptor(n,r);return i&&{writable:!0,configurable:t.type_!==1||r!=="length",enumerable:i.enumerable,value:n[r]}},defineProperty(){Y(11)},getPrototypeOf(t){return At(t.base_)},setPrototypeOf(){Y(12)}},oe={};re(Pr,(t,r)=>{oe[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),oe.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&Y(13),oe.set.call(this,t,r,void 0)},oe.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&Y(14),Pr.set.call(this,t[0],r,n,t[0])};function Cr(t,r){const n=t[at];return(n?Dt(n):t)[r]}function Ni(t,r,n){var s;const i=ri(r,n);return i?"value"in i?i.value:(s=i.get)==null?void 0:s.call(t.draft_):void 0}function ri(t,r){if(!(r in t))return;let n=At(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,r);if(i)return i;n=At(n)}}function jr(t){t.modified_||(t.modified_=!0,t.parent_&&jr(t.parent_))}function Rr(t){t.copy_||(t.copy_=Mr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Li=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(r,n,i)=>{if(typeof r=="function"&&typeof n!="function"){const c=n;n=r;const h=this;return function(D=c,...F){return h.produce(D,T=>n.call(this,T,...F))}}typeof n!="function"&&Y(6),i!==void 0&&typeof i!="function"&&Y(7);let s;if(kt(r)){const c=Qn(this),h=Fr(r,void 0);let m=!0;try{s=n(h),m=!1}finally{m?xr(c):Dr(c)}return Jn(c,i),ti(s,c)}else if(!r||typeof r!="object"){if(s=n(r),s===void 0&&(s=r),s===Tr&&(s=void 0),this.autoFreeze_&&Ar(s,!0),i){const c=[],h=[];Pt("Patches").generateReplacementPatches_(r,s,c,h),i(c,h)}return s}else Y(1,r)},this.produceWithPatches=(r,n)=>{if(typeof r=="function")return(h,...m)=>this.produceWithPatches(h,D=>r(D,...m));let i,s;return[this.produce(r,n,(h,m)=>{i=h,s=m}),i,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){kt(t)||Y(8),Ot(t)&&(t=Ui(t));const r=Qn(this),n=Fr(t,void 0);return n[at].isManual_=!0,Dr(r),n}finishDraft(t,r){const n=t&&t[at];(!n||!n.isManual_)&&Y(9);const{scope_:i}=n;return Jn(i,r),ti(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const s=r[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(r=r.slice(n+1));const i=Pt("Patches").applyPatches_;return Ot(t)?i(t,r):this.produce(t,s=>i(s,r))}};function Fr(t,r){const n=ie(t)?Pt("MapSet").proxyMap_(t,r):ae(t)?Pt("MapSet").proxySet_(t,r):Hi(t,r);return(r?r.scope_:Zn()).drafts_.push(n),n}function Ui(t){return Ot(t)||Y(10,t),ni(t)}function ni(t){if(!kt(t)||Fe(t))return t;const r=t[at];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Mr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=Mr(t,!0);return re(n,(i,s)=>{qn(n,i,ni(s))}),r&&(r.finalized_=!1),n}function ii(){process.env.NODE_ENV!=="production"&&Vn.push('Sets cannot have "replace" patches.',function(b){return"Unsupported patch operation: "+b},function(b){return"Cannot apply patch, path doesn't resolve: "+b},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",i="remove";function s(b,d,l,p){switch(b.type_){case 0:case 2:return h(b,d,l,p);case 1:return c(b,d,l,p);case 3:return m(b,d,l,p)}}function c(b,d,l,p){let{base_:g,assigned_:v}=b,_=b.copy_;_.length<g.length&&([g,_]=[_,g],[l,p]=[p,l]);for(let y=0;y<g.length;y++)if(v[y]&&_[y]!==g[y]){const f=d.concat([y]);l.push({op:r,path:f,value:G(_[y])}),p.push({op:r,path:f,value:G(g[y])})}for(let y=g.length;y<_.length;y++){const f=d.concat([y]);l.push({op:n,path:f,value:G(_[y])})}for(let y=_.length-1;g.length<=y;--y){const f=d.concat([y]);p.push({op:i,path:f})}}function h(b,d,l,p){const{base_:g,copy_:v}=b;re(b.assigned_,(_,y)=>{const f=Er(g,_),O=Er(v,_),E=y?ne(g,_)?r:n:i;if(f===O&&E===r)return;const I=d.concat(_);l.push(E===i?{op:E,path:I}:{op:E,path:I,value:O}),p.push(E===n?{op:i,path:I}:E===i?{op:n,path:I,value:G(f)}:{op:r,path:I,value:G(f)})})}function m(b,d,l,p){let{base_:g,copy_:v}=b,_=0;g.forEach(y=>{if(!v.has(y)){const f=d.concat([_]);l.push({op:i,path:f,value:y}),p.unshift({op:n,path:f,value:y})}_++}),_=0,v.forEach(y=>{if(!g.has(y)){const f=d.concat([_]);l.push({op:n,path:f,value:y}),p.unshift({op:i,path:f,value:y})}_++})}function D(b,d,l,p){l.push({op:r,path:[],value:d===Tr?void 0:d}),p.push({op:r,path:[],value:b})}function F(b,d){return d.forEach(l=>{const{path:p,op:g}=l;let v=b;for(let O=0;O<p.length-1;O++){const E=xt(v);let I=p[O];typeof I!="string"&&typeof I!="number"&&(I=""+I),(E===0||E===1)&&(I==="__proto__"||I==="constructor")&&Y(19),typeof v=="function"&&I==="prototype"&&Y(19),v=Er(v,I),typeof v!="object"&&Y(18,p.join("/"))}const _=xt(v),y=T(l.value),f=p[p.length-1];switch(g){case r:switch(_){case 2:return v.set(f,y);case 3:Y(16);default:return v[f]=y}case n:switch(_){case 1:return f==="-"?v.push(y):v.splice(f,0,y);case 2:return v.set(f,y);case 3:return v.add(y);default:return v[f]=y}case i:switch(_){case 1:return v.splice(f,1);case 2:return v.delete(f);case 3:return v.delete(l.value);default:return delete v[f]}default:Y(17,g)}}),b}function T(b){if(!kt(b))return b;if(Array.isArray(b))return b.map(T);if(ie(b))return new Map(Array.from(b.entries()).map(([l,p])=>[l,T(p)]));if(ae(b))return new Set(Array.from(b).map(T));const d=Object.create(At(b));for(const l in b)d[l]=T(b[l]);return ne(b,ee)&&(d[ee]=b[ee]),d}function G(b){return Ot(b)?T(b):b}Ri("Patches",{applyPatches_:F,generatePatches_:s,generateReplacementPatches_:D})}var st=new Li,Wi=st.produce;st.produceWithPatches.bind(st),st.setAutoFreeze.bind(st),st.setUseStrictShallowCopy.bind(st);var Gi=st.applyPatches.bind(st);st.createDraft.bind(st),st.finishDraft.bind(st);var Bi=1/0,$i=9007199254740991,Ki="[object Arguments]",Yi="[object Function]",Vi="[object GeneratorFunction]",Xi="[object Symbol]",qi=typeof ot=="object"&&ot&&ot.Object===Object&&ot,Zi=typeof self=="object"&&self&&self.Object===Object&&self,Ji=qi||Zi||Function("return this")();function Qi(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}function ta(t,r){for(var n=-1,i=t?t.length:0,s=Array(i);++n<i;)s[n]=r(t[n],n,t);return s}function ea(t,r){for(var n=-1,i=r.length,s=t.length;++n<i;)t[s+n]=r[n];return t}var zr=Object.prototype,ra=zr.hasOwnProperty,Hr=zr.toString,ai=Ji.Symbol,na=zr.propertyIsEnumerable,si=ai?ai.isConcatSpreadable:void 0,oi=Math.max;function ia(t,r,n,i,s){var c=-1,h=t.length;for(n||(n=ca),s||(s=[]);++c<h;){var m=t[c];n(m)?ea(s,m):s[s.length]=m}return s}function aa(t,r){return t=Object(t),sa(t,r,function(n,i){return i in t})}function sa(t,r,n){for(var i=-1,s=r.length,c={};++i<s;){var h=r[i],m=t[h];n(m,h)&&(c[h]=m)}return c}function oa(t,r){return r=oi(r===void 0?t.length-1:r,0),function(){for(var n=arguments,i=-1,s=oi(n.length-r,0),c=Array(s);++i<s;)c[i]=n[r+i];i=-1;for(var h=Array(r+1);++i<r;)h[i]=n[i];return h[r]=c,Qi(t,this,h)}}function ca(t){return fa(t)||la(t)||!!(si&&t&&t[si])}function ua(t){if(typeof t=="string"||ba(t))return t;var r=t+"";return r=="0"&&1/t==-Bi?"-0":r}function la(t){return pa(t)&&ra.call(t,"callee")&&(!na.call(t,"callee")||Hr.call(t)==Ki)}var fa=Array.isArray;function da(t){return t!=null&&ma(t.length)&&!ha(t)}function pa(t){return ci(t)&&da(t)}function ha(t){var r=ya(t)?Hr.call(t):"";return r==Yi||r==Vi}function ma(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=$i}function ya(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function ci(t){return!!t&&typeof t=="object"}function ba(t){return typeof t=="symbol"||ci(t)&&Hr.call(t)==Xi}var ga=oa(function(t,r){return t==null?{}:aa(t,ta(ia(r),ua))}),_a=ga;const ui=br(_a),Ia={size:{width:1080,height:1920},tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1,index:1},duration:0,activeIds:[],trackItemDetailsMap:{}},li=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds"];class va{constructor(r){Lt(this,"stateSubject");Lt(this,"stateHistorySubject");Lt(this,"prevState");Lt(this,"undos",[]);Lt(this,"redos",[]);Lt(this,"listener");const n=r||Ia;this.stateSubject=new Un(n),this.stateHistorySubject=new Un({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){xi(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const i=ui(r,li),s=ui(this.getState(),li),c=Yn(s,i);c.length&&(this.undos.push({undos:c,type:n}),this.redos=[])}getStateHistory(){return this.stateHistorySubject.getValue()}subscribeHistory(r){return this.stateHistorySubject.subscribe(r)}getState(){return this.stateSubject.getValue()}subscribe(r){return this.stateSubject.subscribe(r)}updateState(r,n={updateHistory:!1}){const i=this.getState(),s={...i,...r};it(i,s)||(n.updateHistory&&this.updateHistory(s,n.kind),this.prevState=i,this.stateSubject.next(s))}subscribeToSize(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.size,this.prevState.size)||r({size:n.size})})}subscribeToScale(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.scale,this.prevState.scale)||r({scale:n.scale})})}subscribeToUpdateTrackItem(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemsMap,this.prevState.trackItemsMap)||r({trackItemsMap:n.trackItemsMap})})}subscribeToUpdateItemDetails(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||r({trackItemDetailsMap:n.trackItemDetailsMap})})}subscribeToDuration(r){return this.stateSubject.asObservable().subscribe(n=>{n.duration!==this.prevState.duration&&r({duration:n.duration})})}subscribeToHistory(r){return this.stateHistorySubject.asObservable().subscribe(n=>{if(n.handleRedo){const i=this.undos[this.undos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}if(n.handleUndo){const i=this.redos[this.redos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}})}subscribeToAddOrRemoveItems(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemIds,this.prevState.trackItemIds)||r({trackItemIds:n.trackItemIds})})}subscribeToActiveIds(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.activeIds,this.prevState.activeIds)||r({activeIds:n.activeIds})})}subscribeToTracks(r){return this.stateSubject.asObservable().subscribe(n=>{(!it(n.tracks,this.prevState.tracks)||!it(n.trackItemIds,this.prevState.trackItemIds)||!it(n.trackItemsMap,this.prevState.trackItemsMap)||!it(n.transitionIds,this.prevState.transitionIds)||!it(n.transitionsMap,this.prevState.transitionsMap)||!it(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap))&&r({tracks:n.tracks,trackItemIds:n.trackItemIds,trackItemsMap:n.trackItemsMap,transitionIds:n.transitionIds,transitionsMap:n.transitionsMap,trackItemDetailsMap:n.trackItemDetailsMap})})}undo(){const r=this.undos.pop(),n=r==null?void 0:r.undos,i=r==null?void 0:r.type;if(!n||!i)return;ii();const{trackItemDetailsMap:s,trackItemIds:c,tracks:h,transitionIds:m,transitionsMap:D,trackItemsMap:F}=this.getState(),T=K({trackItemDetailsMap:s,trackItemIds:c,tracks:h,transitionIds:m,transitionsMap:D,trackItemsMap:F}),G=[],b=[],d=[],l=[],p=[],g=[];n.forEach(w=>{let M;const z=w.path.slice(1);w.type==="CREATE"?M={path:z,op:"remove",value:w.value}:w.type==="CHANGE"?M={path:z,op:"replace",value:w.oldValue}:M={path:z,op:"add",value:w.oldValue},w.path.includes("trackItemIds")?d.push(M):w.path.includes("transitionIds")?b.push(M):w.path.includes("trackItemsMap")?p.push(M):w.path.includes("transitionsMap")?l.push(M):w.path.includes("tracks")?G.push(M):w.path.includes("trackItemDetailsMap")&&g.push(M)});const v=this.applyPatch(T.tracks,G),_=this.applyPatch(T.transitionIds,b),y=this.applyPatch(T.trackItemIds,d),f=this.applyPatch(T.transitionsMap,l),O=this.applyPatch(T.trackItemsMap,p),E=this.applyPatch(T.trackItemDetailsMap,g),I=K({tracks:v,transitionIds:_,trackItemIds:y,transitionsMap:f,trackItemsMap:O,trackItemDetailsMap:E}),P=K(this.getState()),S={...P,...I};this.prevState=P,this.redos.push({redos:n,type:i});const x=Ut(S.trackItemsMap);this.stateSubject.next({...S,duration:x}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((i,s)=>Wi(i,c=>{Gi(c,[s])}),r)}redo(){const r=this.redos.pop(),n=r==null?void 0:r.redos,i=r==null?void 0:r.type;if(!n||!i)return;ii();const{trackItemDetailsMap:s,trackItemIds:c,tracks:h,transitionIds:m,transitionsMap:D,trackItemsMap:F}=this.getState(),T=K({trackItemDetailsMap:s,trackItemIds:c,tracks:h,transitionIds:m,transitionsMap:D,trackItemsMap:F}),G=[],b=[],d=[],l=[],p=[],g=[];n.forEach(w=>{let M;const z=w.path.slice(1);w.type==="CREATE"?M={path:z,op:"add",value:w.value}:w.type==="CHANGE"?M={path:z,op:"replace",value:w.value}:M={path:z,op:"remove",value:w.oldValue},w.path.includes("trackItemIds")?d.push(M):w.path.includes("transitionIds")?b.push(M):w.path.includes("trackItemsMap")?p.push(M):w.path.includes("transitionsMap")?l.push(M):w.path.includes("trackItemDetailsMap")?g.push(M):G.push(M)});const v=this.applyPatch(T.tracks,G),_=this.applyPatch(T.transitionIds,b),y=this.applyPatch(T.trackItemIds,d),f=this.applyPatch(T.transitionsMap,l),O=this.applyPatch(T.trackItemsMap,p),E=this.applyPatch(T.trackItemDetailsMap,g),I=K({tracks:v,transitionIds:_,trackItemIds:y,transitionsMap:f,trackItemsMap:O,trackItemDetailsMap:E}),P=K(this.getState()),S={...P,...I};this.prevState=P,this.undos.push({undos:n,type:i});const x=Ut(S.trackItemsMap);this.stateSubject.next({...S,duration:x}),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}}return va});
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}});function Tr(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var Ye=function(){function t(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var r,n,i,s,c;if(!this.closed){this.closed=!0;var d=this._parentage;if(d)if(this._parentage=null,Array.isArray(d))try{for(var _=br(d),D=_.next();!D.done;D=_.next()){var F=D.value;F.remove(this)}}catch(p){r={error:p}}finally{try{D&&!D.done&&(n=_.return)&&n.call(_)}finally{if(r)throw r.error}}else d.remove(this);var A=this.initialTeardown;if(Tt(A))try{A()}catch(p){c=p instanceof Sr?p.errors:[p]}var z=this._finalizers;if(z){this._finalizers=null;try{for(var I=br(z),f=I.next();!f.done;f=I.next()){var l=f.value;try{Yn(l)}catch(p){c=c??[],p instanceof Sr?c=vr(vr([],Er(c)),Er(p.errors)):c.push(p)}}}catch(p){i={error:p}}finally{try{f&&!f.done&&(s=I.return)&&s.call(I)}finally{if(i)throw i.error}}}if(c)throw new Sr(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)Yn(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(r)}},t.prototype._hasParent=function(r){var n=this._parentage;return n===r||Array.isArray(n)&&n.includes(r)},t.prototype._addParent=function(r){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(r),n):n?[n,r]:r},t.prototype._removeParent=function(r){var n=this._parentage;n===r?this._parentage=null:Array.isArray(n)&&Tr(n,r)},t.prototype.remove=function(r){var n=this._finalizers;n&&Tr(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=function(){var r=new t;return r.closed=!0,r}(),t}(),$n=Ye.EMPTY;function zn(t){return t instanceof Ye||t&&"closed"in t&&Tt(t.remove)&&Tt(t.add)&&Tt(t.unsubscribe)}function Yn(t){Tt(t)?t():t.unsubscribe()}var Gn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Un={setTimeout:function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,vr([t,r],Er(n)))},clearTimeout:function(t){var r=Un.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Di(t){Un.setTimeout(function(){throw t})}function Xn(){}function Ge(t){t()}var Wn=function(t){pe(r,t);function r(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,zn(n)&&n.add(i)):i.destination=Ri,i}return r.create=function(n,i,s){return new wr(n,i,s)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(Ye),Mi=Function.prototype.bind;function Ar(t,r){return Mi.call(t,r)}var Oi=function(){function t(r){this.partialObserver=r}return t.prototype.next=function(r){var n=this.partialObserver;if(n.next)try{n.next(r)}catch(i){Ue(i)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(i){Ue(i)}else Ue(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){Ue(n)}},t}(),wr=function(t){pe(r,t);function r(n,i,s){var c=t.call(this)||this,d;if(Tt(n)||!n)d={next:n??void 0,error:i??void 0,complete:s??void 0};else{var _;c&&Gn.useDeprecatedNextContext?(_=Object.create(n),_.unsubscribe=function(){return c.unsubscribe()},d={next:n.next&&Ar(n.next,_),error:n.error&&Ar(n.error,_),complete:n.complete&&Ar(n.complete,_)}):d=n}return c.destination=new Oi(d),c}return r}(Wn);function Ue(t){Di(t)}function Pi(t){throw t}var Ri={closed:!0,next:Xn,error:Pi,complete:Xn},Ci=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Li(t){return t}function xi(t){return t.length===0?Li:t.length===1?t[0]:function(n){return t.reduce(function(i,s){return s(i)},n)}}var Kn=function(){function t(r){r&&(this._subscribe=r)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(r,n,i){var s=this,c=Fi(r)?r:new wr(r,n,i);return Ge(function(){var d=s,_=d.operator,D=d.source;c.add(_?_.call(c,D):D?s._subscribe(c):s._trySubscribe(c))}),c},t.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(n){r.error(n)}},t.prototype.forEach=function(r,n){var i=this;return n=Bn(n),new n(function(s,c){var d=new wr({next:function(_){try{r(_)}catch(D){c(D),d.unsubscribe()}},error:c,complete:s});i.subscribe(d)})},t.prototype._subscribe=function(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)},t.prototype[Ci]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return xi(r)(this)},t.prototype.toPromise=function(r){var n=this;return r=Bn(r),new r(function(i,s){var c;n.subscribe(function(d){return c=d},function(d){return s(d)},function(){return i(c)})})},t.create=function(r){return new t(r)},t}();function Bn(t){var r;return(r=t??Gn.Promise)!==null&&r!==void 0?r:Promise}function Ni(t){return t&&Tt(t.next)&&Tt(t.error)&&Tt(t.complete)}function Fi(t){return t&&t instanceof Wn||Ni(t)&&zn(t)}var Hi=jn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Vn=function(t){pe(r,t);function r(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return r.prototype.lift=function(n){var i=new Zn(this,this);return i.operator=n,i},r.prototype._throwIfClosed=function(){if(this.closed)throw new Hi},r.prototype.next=function(n){var i=this;Ge(function(){var s,c;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var d=br(i.currentObservers),_=d.next();!_.done;_=d.next()){var D=_.value;D.next(n)}}catch(F){s={error:F}}finally{try{_&&!_.done&&(c=d.return)&&c.call(d)}finally{if(s)throw s.error}}}})},r.prototype.error=function(n){var i=this;Ge(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var s=i.observers;s.length;)s.shift().error(n)}})},r.prototype.complete=function(){var n=this;Ge(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},r.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},r.prototype._innerSubscribe=function(n){var i=this,s=this,c=s.hasError,d=s.isStopped,_=s.observers;return c||d?$n:(this.currentObservers=null,_.push(n),new Ye(function(){i.currentObservers=null,Tr(_,n)}))},r.prototype._checkFinalizedStatuses=function(n){var i=this,s=i.hasError,c=i.thrownError,d=i.isStopped;s?n.error(c):d&&n.complete()},r.prototype.asObservable=function(){var n=new Kn;return n.source=this,n},r.create=function(n,i){return new Zn(n,i)},r}(Kn),Zn=function(t){pe(r,t);function r(n,i){var s=t.call(this)||this;return s.destination=n,s.source=i,s}return r.prototype.next=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,n)},r.prototype.error=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,n)},r.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},r.prototype._subscribe=function(n){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&s!==void 0?s:$n},r}(Vn),Jn=function(t){pe(r,t);function r(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},r.prototype.getValue=function(){var n=this,i=n.hasError,s=n.thrownError,c=n._value;if(i)throw s;return this._throwIfClosed(),c},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(Vn),pt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xe={exports:{}};Xe.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=1,c=2,d=9007199254740991,_="[object Arguments]",D="[object Array]",F="[object AsyncFunction]",A="[object Boolean]",z="[object Date]",I="[object Error]",f="[object Function]",l="[object GeneratorFunction]",p="[object Map]",g="[object Number]",v="[object Null]",E="[object Object]",h="[object Promise]",m="[object Proxy]",w="[object RegExp]",P="[object Set]",b="[object String]",C="[object Symbol]",M="[object Undefined]",R="[object WeakMap]",T="[object ArrayBuffer]",k="[object DataView]",H="[object Float32Array]",at="[object Float64Array]",zt="[object Int8Array]",qt="[object Int16Array]",Qt="[object Int32Array]",te="[object Uint8Array]",ee="[object Uint8ClampedArray]",Y="[object Uint16Array]",U="[object Uint32Array]",W=/[\\^$.*+?()[\]{}|]/g,x=/^\[object .+?Constructor\]$/,dt=/^(?:0|[1-9]\d*)$/,N={};N[H]=N[at]=N[zt]=N[qt]=N[Qt]=N[te]=N[ee]=N[Y]=N[U]=!0,N[_]=N[D]=N[T]=N[A]=N[k]=N[z]=N[I]=N[f]=N[p]=N[g]=N[E]=N[w]=N[P]=N[b]=N[R]=!1;var X=typeof pt=="object"&&pt&&pt.Object===Object&&pt,It=typeof self=="object"&&self&&self.Object===Object&&self,ot=X||It||Function("return this")(),J=r&&!r.nodeType&&r,gt=J&&!0&&t&&!t.nodeType&&t,Yt=gt&>.exports===J,Te=Yt&&X.process,Qe=function(){try{return Te&&Te.binding&&Te.binding("util")}catch{}}(),Ae=Qe&&Qe.isTypedArray;function tr(e,a){for(var o=-1,u=e==null?0:e.length,L=0,S=[];++o<u;){var $=e[o];a($,o,e)&&(S[L++]=$)}return S}function we(e,a){for(var o=-1,u=a.length,L=e.length;++o<u;)e[L+o]=a[o];return e}function er(e,a){for(var o=-1,u=e==null?0:e.length;++o<u;)if(a(e[o],o,e))return!0;return!1}function Jr(e,a){for(var o=-1,u=Array(e);++o<e;)u[o]=a(o);return u}function qr(e){return function(a){return e(a)}}function re(e,a){return e.has(a)}function ke(e,a){return e==null?void 0:e[a]}function rr(e){var a=-1,o=Array(e.size);return e.forEach(function(u,L){o[++a]=[L,u]}),o}function nr(e,a){return function(o){return e(a(o))}}function bt(e){var a=-1,o=Array(e.size);return e.forEach(function(u){o[++a]=u}),o}var ne=Array.prototype,Qr=Function.prototype,Gt=Object.prototype,ie=ot["__core-js_shared__"],De=Qr.toString,mt=Gt.hasOwnProperty,ir=function(){var e=/[^.]+$/.exec(ie&&ie.keys&&ie.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ar=Gt.toString,tn=RegExp("^"+De.call(mt).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Me=Yt?ot.Buffer:void 0,ae=ot.Symbol,sr=ot.Uint8Array,se=Gt.propertyIsEnumerable,Ut=ne.splice,yt=ae?ae.toStringTag:void 0,oe=Object.getOwnPropertySymbols,Oe=Me?Me.isBuffer:void 0,Xt=nr(Object.keys,Object),Pe=wt(ot,"DataView"),Wt=wt(ot,"Map"),Re=wt(ot,"Promise"),Ce=wt(ot,"Set"),Le=wt(ot,"WeakMap"),Pt=wt(Object,"create"),or=st(Pe),At=st(Wt),en=st(Re),rn=st(Ce),nn=st(Le),cr=ae?ae.prototype:void 0,xe=cr?cr.valueOf:void 0;function q(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function an(){this.__data__=Pt?Pt(null):{},this.size=0}function sn(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a}function on(e){var a=this.__data__;if(Pt){var o=a[e];return o===i?void 0:o}return mt.call(a,e)?a[e]:void 0}function cn(e){var a=this.__data__;return Pt?a[e]!==void 0:mt.call(a,e)}function un(e,a){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Pt&&a===void 0?i:a,this}q.prototype.clear=an,q.prototype.delete=sn,q.prototype.get=on,q.prototype.has=cn,q.prototype.set=un;function tt(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function ln(){this.__data__=[],this.size=0}function fn(e){var a=this.__data__,o=le(a,e);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():Ut.call(a,o,1),--this.size,!0}function dn(e){var a=this.__data__,o=le(a,e);return o<0?void 0:a[o][1]}function pn(e){return le(this.__data__,e)>-1}function hn(e,a){var o=this.__data__,u=le(o,e);return u<0?(++this.size,o.push([e,a])):o[u][1]=a,this}tt.prototype.clear=ln,tt.prototype.delete=fn,tt.prototype.get=dn,tt.prototype.has=pn,tt.prototype.set=hn;function ct(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function mn(){this.size=0,this.__data__={hash:new q,map:new(Wt||tt),string:new q}}function yn(e){var a=_t(this,e).delete(e);return this.size-=a?1:0,a}function _n(e){return _t(this,e).get(e)}function In(e){return _t(this,e).has(e)}function gn(e,a){var o=_t(this,e),u=o.size;return o.set(e,a),this.size+=o.size==u?0:1,this}ct.prototype.clear=mn,ct.prototype.delete=yn,ct.prototype.get=_n,ct.prototype.has=In,ct.prototype.set=gn;function ce(e){var a=-1,o=e==null?0:e.length;for(this.__data__=new ct;++a<o;)this.add(e[a])}function ur(e){return this.__data__.set(e,i),this}function ue(e){return this.__data__.has(e)}ce.prototype.add=ce.prototype.push=ur,ce.prototype.has=ue;function Et(e){var a=this.__data__=new tt(e);this.size=a.size}function Ne(){this.__data__=new tt,this.size=0}function bn(e){var a=this.__data__,o=a.delete(e);return this.size=a.size,o}function En(e){return this.__data__.get(e)}function vn(e){return this.__data__.has(e)}function Sn(e,a){var o=this.__data__;if(o instanceof tt){var u=o.__data__;if(!Wt||u.length<n-1)return u.push([e,a]),this.size=++o.size,this;o=this.__data__=new ct(u)}return o.set(e,a),this.size=o.size,this}Et.prototype.clear=Ne,Et.prototype.delete=bn,Et.prototype.get=En,Et.prototype.has=vn,Et.prototype.set=Sn;function Tn(e,a){var o=fe(e),u=!o&&hr(e),L=!o&&!u&&de(e),S=!o&&!u&&!L&&_r(e),$=o||u||L||S,j=$?Jr(e.length,String):[],K=j.length;for(var G in e)mt.call(e,G)&&!($&&(G=="length"||L&&(G=="offset"||G=="parent")||S&&(G=="buffer"||G=="byteLength"||G=="byteOffset")||Rn(G,K)))&&j.push(G);return j}function le(e,a){for(var o=e.length;o--;)if(pr(e[o][0],a))return o;return-1}function Fe(e,a,o){var u=a(e);return fe(e)?u:we(u,o(e))}function Kt(e){return e==null?e===void 0?M:v:yt&&yt in Object(e)?kt(e):dr(e)}function lr(e){return St(e)&&Kt(e)==_}function fr(e,a,o,u,L){return e===a?!0:e==null||a==null||!St(e)&&!St(a)?e!==e&&a!==a:An(e,a,o,u,fr,L)}function An(e,a,o,u,L,S){var $=fe(e),j=fe(a),K=$?D:vt(e),G=j?D:vt(a);K=K==_?E:K,G=G==_?E:G;var et=K==E,ut=G==E,V=K==G;if(V&&de(e)){if(!de(a))return!1;$=!0,et=!1}if(V&&!et)return S||(S=new Et),$||_r(e)?He(e,a,o,u,L,S):Mn(e,a,K,o,u,L,S);if(!(o&s)){var rt=et&&mt.call(e,"__wrapped__"),Q=ut&&mt.call(a,"__wrapped__");if(rt||Q){var Rt=rt?e.value():e,Dt=Q?a.value():a;return S||(S=new Et),L(Rt,Dt,o,u,S)}}return V?(S||(S=new Et),On(e,a,o,u,L,S)):!1}function wn(e){if(!yr(e)||Ln(e))return!1;var a=mr(e)?tn:x;return a.test(st(e))}function kn(e){return St(e)&&$e(e.length)&&!!N[Kt(e)]}function Dn(e){if(!xn(e))return Xt(e);var a=[];for(var o in Object(e))mt.call(e,o)&&o!="constructor"&&a.push(o);return a}function He(e,a,o,u,L,S){var $=o&s,j=e.length,K=a.length;if(j!=K&&!($&&K>j))return!1;var G=S.get(e);if(G&&S.get(a))return G==a;var et=-1,ut=!0,V=o&c?new ce:void 0;for(S.set(e,a),S.set(a,e);++et<j;){var rt=e[et],Q=a[et];if(u)var Rt=$?u(Q,rt,et,a,e,S):u(rt,Q,et,e,a,S);if(Rt!==void 0){if(Rt)continue;ut=!1;break}if(V){if(!er(a,function(Dt,Vt){if(!re(V,Vt)&&(rt===Dt||L(rt,Dt,o,u,S)))return V.push(Vt)})){ut=!1;break}}else if(!(rt===Q||L(rt,Q,o,u,S))){ut=!1;break}}return S.delete(e),S.delete(a),ut}function Mn(e,a,o,u,L,S,$){switch(o){case k:if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case T:return!(e.byteLength!=a.byteLength||!S(new sr(e),new sr(a)));case A:case z:case g:return pr(+e,+a);case I:return e.name==a.name&&e.message==a.message;case w:case b:return e==a+"";case p:var j=rr;case P:var K=u&s;if(j||(j=bt),e.size!=a.size&&!K)return!1;var G=$.get(e);if(G)return G==a;u|=c,$.set(e,a);var et=He(j(e),j(a),u,L,S,$);return $.delete(e),et;case C:if(xe)return xe.call(e)==xe.call(a)}return!1}function On(e,a,o,u,L,S){var $=o&s,j=Bt(e),K=j.length,G=Bt(a),et=G.length;if(K!=et&&!$)return!1;for(var ut=K;ut--;){var V=j[ut];if(!($?V in a:mt.call(a,V)))return!1}var rt=S.get(e);if(rt&&S.get(a))return rt==a;var Q=!0;S.set(e,a),S.set(a,e);for(var Rt=$;++ut<K;){V=j[ut];var Dt=e[V],Vt=a[V];if(u)var ki=$?u(Vt,Dt,V,a,e,S):u(Dt,Vt,V,e,a,S);if(!(ki===void 0?Dt===Vt||L(Dt,Vt,o,u,S):ki)){Q=!1;break}Rt||(Rt=V=="constructor")}if(Q&&!Rt){var Ir=e.constructor,gr=a.constructor;Ir!=gr&&"constructor"in e&&"constructor"in a&&!(typeof Ir=="function"&&Ir instanceof Ir&&typeof gr=="function"&&gr instanceof gr)&&(Q=!1)}return S.delete(e),S.delete(a),Q}function Bt(e){return Fe(e,ze,Pn)}function _t(e,a){var o=e.__data__;return Cn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function wt(e,a){var o=ke(e,a);return wn(o)?o:void 0}function kt(e){var a=mt.call(e,yt),o=e[yt];try{e[yt]=void 0;var u=!0}catch{}var L=ar.call(e);return u&&(a?e[yt]=o:delete e[yt]),L}var Pn=oe?function(e){return e==null?[]:(e=Object(e),tr(oe(e),function(a){return se.call(e,a)}))}:Fn,vt=Kt;(Pe&&vt(new Pe(new ArrayBuffer(1)))!=k||Wt&&vt(new Wt)!=p||Re&&vt(Re.resolve())!=h||Ce&&vt(new Ce)!=P||Le&&vt(new Le)!=R)&&(vt=function(e){var a=Kt(e),o=a==E?e.constructor:void 0,u=o?st(o):"";if(u)switch(u){case or:return k;case At:return p;case en:return h;case rn:return P;case nn:return R}return a});function Rn(e,a){return a=a??d,!!a&&(typeof e=="number"||dt.test(e))&&e>-1&&e%1==0&&e<a}function Cn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function Ln(e){return!!ir&&ir in e}function xn(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||Gt;return e===o}function dr(e){return ar.call(e)}function st(e){if(e!=null){try{return De.call(e)}catch{}try{return e+""}catch{}}return""}function pr(e,a){return e===a||e!==e&&a!==a}var hr=lr(function(){return arguments}())?lr:function(e){return St(e)&&mt.call(e,"callee")&&!se.call(e,"callee")},fe=Array.isArray;function je(e){return e!=null&&$e(e.length)&&!mr(e)}var de=Oe||Hn;function Nn(e,a){return fr(e,a)}function mr(e){if(!yr(e))return!1;var a=Kt(e);return a==f||a==l||a==F||a==m}function $e(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=d}function yr(e){var a=typeof e;return e!=null&&(a=="object"||a=="function")}function St(e){return e!=null&&typeof e=="object"}var _r=Ae?qr(Ae):kn;function ze(e){return je(e)?Tn(e):Dn(e)}function Fn(){return[]}function Hn(){return!1}t.exports=Nn}(Xe,Xe.exports);var ji=Xe.exports;const nt=kr(ji);var We={exports:{}};We.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,c="[object Arguments]",d="[object Array]",_="[object Boolean]",D="[object Date]",F="[object Error]",A="[object Function]",z="[object GeneratorFunction]",I="[object Map]",f="[object Number]",l="[object Object]",p="[object Promise]",g="[object RegExp]",v="[object Set]",E="[object String]",h="[object Symbol]",m="[object WeakMap]",w="[object ArrayBuffer]",P="[object DataView]",b="[object Float32Array]",C="[object Float64Array]",M="[object Int8Array]",R="[object Int16Array]",T="[object Int32Array]",k="[object Uint8Array]",H="[object Uint8ClampedArray]",at="[object Uint16Array]",zt="[object Uint32Array]",qt=/[\\^$.*+?()[\]{}|]/g,Qt=/\w*$/,te=/^\[object .+?Constructor\]$/,ee=/^(?:0|[1-9]\d*)$/,Y={};Y[c]=Y[d]=Y[w]=Y[P]=Y[_]=Y[D]=Y[b]=Y[C]=Y[M]=Y[R]=Y[T]=Y[I]=Y[f]=Y[l]=Y[g]=Y[v]=Y[E]=Y[h]=Y[k]=Y[H]=Y[at]=Y[zt]=!0,Y[F]=Y[A]=Y[m]=!1;var U=typeof pt=="object"&&pt&&pt.Object===Object&&pt,W=typeof self=="object"&&self&&self.Object===Object&&self,x=U||W||Function("return this")(),dt=r&&!r.nodeType&&r,N=dt&&!0&&t&&!t.nodeType&&t,X=N&&N.exports===dt;function It(e,a){return e.set(a[0],a[1]),e}function ot(e,a){return e.add(a),e}function J(e,a){for(var o=-1,u=e?e.length:0;++o<u&&a(e[o],o,e)!==!1;);return e}function gt(e,a){for(var o=-1,u=a.length,L=e.length;++o<u;)e[L+o]=a[o];return e}function Yt(e,a,o,u){for(var L=-1,S=e?e.length:0;++L<S;)o=a(o,e[L],L,e);return o}function Te(e,a){for(var o=-1,u=Array(e);++o<e;)u[o]=a(o);return u}function Qe(e,a){return e==null?void 0:e[a]}function Ae(e){var a=!1;if(e!=null&&typeof e.toString!="function")try{a=!!(e+"")}catch{}return a}function tr(e){var a=-1,o=Array(e.size);return e.forEach(function(u,L){o[++a]=[L,u]}),o}function we(e,a){return function(o){return e(a(o))}}function er(e){var a=-1,o=Array(e.size);return e.forEach(function(u){o[++a]=u}),o}var Jr=Array.prototype,qr=Function.prototype,re=Object.prototype,ke=x["__core-js_shared__"],rr=function(){var e=/[^.]+$/.exec(ke&&ke.keys&&ke.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),nr=qr.toString,bt=re.hasOwnProperty,ne=re.toString,Qr=RegExp("^"+nr.call(bt).replace(qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Gt=X?x.Buffer:void 0,ie=x.Symbol,De=x.Uint8Array,mt=we(Object.getPrototypeOf,Object),ir=Object.create,ar=re.propertyIsEnumerable,tn=Jr.splice,Me=Object.getOwnPropertySymbols,ae=Gt?Gt.isBuffer:void 0,sr=we(Object.keys,Object),se=_t(x,"DataView"),Ut=_t(x,"Map"),yt=_t(x,"Promise"),oe=_t(x,"Set"),Oe=_t(x,"WeakMap"),Xt=_t(Object,"create"),Pe=st(se),Wt=st(Ut),Re=st(yt),Ce=st(oe),Le=st(Oe),Pt=ie?ie.prototype:void 0,or=Pt?Pt.valueOf:void 0;function At(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function en(){this.__data__=Xt?Xt(null):{}}function rn(e){return this.has(e)&&delete this.__data__[e]}function nn(e){var a=this.__data__;if(Xt){var o=a[e];return o===i?void 0:o}return bt.call(a,e)?a[e]:void 0}function cr(e){var a=this.__data__;return Xt?a[e]!==void 0:bt.call(a,e)}function xe(e,a){var o=this.__data__;return o[e]=Xt&&a===void 0?i:a,this}At.prototype.clear=en,At.prototype.delete=rn,At.prototype.get=nn,At.prototype.has=cr,At.prototype.set=xe;function q(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function an(){this.__data__=[]}function sn(e){var a=this.__data__,o=ue(a,e);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():tn.call(a,o,1),!0}function on(e){var a=this.__data__,o=ue(a,e);return o<0?void 0:a[o][1]}function cn(e){return ue(this.__data__,e)>-1}function un(e,a){var o=this.__data__,u=ue(o,e);return u<0?o.push([e,a]):o[u][1]=a,this}q.prototype.clear=an,q.prototype.delete=sn,q.prototype.get=on,q.prototype.has=cn,q.prototype.set=un;function tt(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function ln(){this.__data__={hash:new At,map:new(Ut||q),string:new At}}function fn(e){return Bt(this,e).delete(e)}function dn(e){return Bt(this,e).get(e)}function pn(e){return Bt(this,e).has(e)}function hn(e,a){return Bt(this,e).set(e,a),this}tt.prototype.clear=ln,tt.prototype.delete=fn,tt.prototype.get=dn,tt.prototype.has=pn,tt.prototype.set=hn;function ct(e){this.__data__=new q(e)}function mn(){this.__data__=new q}function yn(e){return this.__data__.delete(e)}function _n(e){return this.__data__.get(e)}function In(e){return this.__data__.has(e)}function gn(e,a){var o=this.__data__;if(o instanceof q){var u=o.__data__;if(!Ut||u.length<n-1)return u.push([e,a]),this;o=this.__data__=new tt(u)}return o.set(e,a),this}ct.prototype.clear=mn,ct.prototype.delete=yn,ct.prototype.get=_n,ct.prototype.has=In,ct.prototype.set=gn;function ce(e,a){var o=je(e)||fe(e)?Te(e.length,String):[],u=o.length,L=!!u;for(var S in e)bt.call(e,S)&&!(L&&(S=="length"||Cn(S,u)))&&o.push(S);return o}function ur(e,a,o){var u=e[a];(!(bt.call(e,a)&&hr(u,o))||o===void 0&&!(a in e))&&(e[a]=o)}function ue(e,a){for(var o=e.length;o--;)if(hr(e[o][0],a))return o;return-1}function Et(e,a){return e&&He(a,ze(a),e)}function Ne(e,a,o,u,L,S,$){var j;if(u&&(j=S?u(e,L,S,$):u(e)),j!==void 0)return j;if(!St(e))return e;var K=je(e);if(K){if(j=Pn(e),!a)return Dn(e,j)}else{var G=kt(e),et=G==A||G==z;if(mr(e))return le(e,a);if(G==l||G==c||et&&!S){if(Ae(e))return S?e:{};if(j=vt(et?{}:e),!a)return Mn(e,Et(j,e))}else{if(!Y[G])return S?e:{};j=Rn(e,G,Ne,a)}}$||($=new ct);var ut=$.get(e);if(ut)return ut;if($.set(e,j),!K)var V=o?On(e):ze(e);return J(V||e,function(rt,Q){V&&(Q=rt,rt=e[Q]),ur(j,Q,Ne(rt,a,o,u,Q,e,$))}),j}function bn(e){return St(e)?ir(e):{}}function En(e,a,o){var u=a(e);return je(e)?u:gt(u,o(e))}function vn(e){return ne.call(e)}function Sn(e){if(!St(e)||xn(e))return!1;var a=$e(e)||Ae(e)?Qr:te;return a.test(st(e))}function Tn(e){if(!dr(e))return sr(e);var a=[];for(var o in Object(e))bt.call(e,o)&&o!="constructor"&&a.push(o);return a}function le(e,a){if(a)return e.slice();var o=new e.constructor(e.length);return e.copy(o),o}function Fe(e){var a=new e.constructor(e.byteLength);return new De(a).set(new De(e)),a}function Kt(e,a){var o=a?Fe(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function lr(e,a,o){var u=a?o(tr(e),!0):tr(e);return Yt(u,It,new e.constructor)}function fr(e){var a=new e.constructor(e.source,Qt.exec(e));return a.lastIndex=e.lastIndex,a}function An(e,a,o){var u=a?o(er(e),!0):er(e);return Yt(u,ot,new e.constructor)}function wn(e){return or?Object(or.call(e)):{}}function kn(e,a){var o=a?Fe(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function Dn(e,a){var o=-1,u=e.length;for(a||(a=Array(u));++o<u;)a[o]=e[o];return a}function He(e,a,o,u){o||(o={});for(var L=-1,S=a.length;++L<S;){var $=a[L],j=void 0;ur(o,$,j===void 0?e[$]:j)}return o}function Mn(e,a){return He(e,wt(e),a)}function On(e){return En(e,ze,wt)}function Bt(e,a){var o=e.__data__;return Ln(a)?o[typeof a=="string"?"string":"hash"]:o.map}function _t(e,a){var o=Qe(e,a);return Sn(o)?o:void 0}var wt=Me?we(Me,Object):Fn,kt=vn;(se&&kt(new se(new ArrayBuffer(1)))!=P||Ut&&kt(new Ut)!=I||yt&&kt(yt.resolve())!=p||oe&&kt(new oe)!=v||Oe&&kt(new Oe)!=m)&&(kt=function(e){var a=ne.call(e),o=a==l?e.constructor:void 0,u=o?st(o):void 0;if(u)switch(u){case Pe:return P;case Wt:return I;case Re:return p;case Ce:return v;case Le:return m}return a});function Pn(e){var a=e.length,o=e.constructor(a);return a&&typeof e[0]=="string"&&bt.call(e,"index")&&(o.index=e.index,o.input=e.input),o}function vt(e){return typeof e.constructor=="function"&&!dr(e)?bn(mt(e)):{}}function Rn(e,a,o,u){var L=e.constructor;switch(a){case w:return Fe(e);case _:case D:return new L(+e);case P:return Kt(e,u);case b:case C:case M:case R:case T:case k:case H:case at:case zt:return kn(e,u);case I:return lr(e,u,o);case f:case E:return new L(e);case g:return fr(e);case v:return An(e,u,o);case h:return wn(e)}}function Cn(e,a){return a=a??s,!!a&&(typeof e=="number"||ee.test(e))&&e>-1&&e%1==0&&e<a}function Ln(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function xn(e){return!!rr&&rr in e}function dr(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||re;return e===o}function st(e){if(e!=null){try{return nr.call(e)}catch{}try{return e+""}catch{}}return""}function pr(e){return Ne(e,!0,!0)}function hr(e,a){return e===a||e!==e&&a!==a}function fe(e){return Nn(e)&&bt.call(e,"callee")&&(!ar.call(e,"callee")||ne.call(e)==c)}var je=Array.isArray;function de(e){return e!=null&&yr(e.length)&&!$e(e)}function Nn(e){return _r(e)&&de(e)}var mr=ae||Hn;function $e(e){var a=St(e)?ne.call(e):"";return a==A||a==z}function yr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=s}function St(e){var a=typeof e;return!!e&&(a=="object"||a=="function")}function _r(e){return!!e&&typeof e=="object"}function ze(e){return de(e)?ce(e):Tn(e)}function Fn(){return[]}function Hn(){return!1}t.exports=pr}(We,We.exports);var $i=We.exports;const Z=kr($i),qn=t=>new Promise((r,n)=>{const i=new Image;console.warn("update cdn config for cors?"),i.onload=()=>{const s=i.width,c=i.height;r({width:s,height:c})},i.onerror=s=>{n(s)},i.crossOrigin="anonymous",i.src=t}),zi=t=>new Promise((r,n)=>{const i=new Audio;i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3;r({duration:s})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.crossOrigin="anonymous",i.load()}),Qn=t=>new Promise((r,n)=>{const i=document.createElement("video");i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3,c=i.videoWidth,d=i.videoHeight;r({duration:s,width:c,height:d})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.load()}),ti=(t,r)=>{const n=document.createElement("div");Object.keys(r).forEach(s=>{s!=="height"&&(n.style[s]=r[s])}),document.body.appendChild(n),n.textContent=t,n.style.whiteSpace="normal",n.style.position="absolute",n.style.visibility="hidden",n.style.display="inline-block",n.style.width=r.width+"px",n.style.fontSize=r.fontSize+"px";const i=getComputedStyle(n).height;return document.body.removeChild(n),parseFloat(i)},Dr=t=>{const r=t.map(n=>new FontFace(n.fontFamily,`url(${n.url})`).load().catch(i=>i));return r.length===0?Promise.resolve(!0):new Promise((n,i)=>{Promise.all(r).then(s=>{s.forEach(c=>{c&&c.family&&(document.fonts.add(c),n(!0))})}).catch(s=>i(s))})},Yi="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let he=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=Yi[n[t]&63];return r};function me(t=16){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=r.charAt(Math.floor(Math.random()*r.length));let i=he(t-1);return i=i.replace(/[^a-zA-Z0-9]/g,"").slice(0,t-1),n+i}const Ke={color:"#000000",x:0,y:0,blur:0},ye=(t,r)=>{let n=r!=null&&r.trim?r.trim.to-r.trim.from:(r==null?void 0:r.duration)||5e3;const i={from:0,to:n};if(!t)return i;if(t.from<0)return console.error("'from' must be a non-negative number. Returning default display."),i;if(t.from!==void 0&&t.to===void 0)return{from:t.from,to:t.from+n};if(t.to!==void 0){if(t.to<0)return console.error("'to' must be a non-negative number. Returning default display."),i;if(t.to<t.from)return console.error("'to' must be greater than or equal to 'from'. Returning default display."),i}return t},ei=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function Be(t,r){const n={x:t.size.width/2,y:t.size.height/2},i={x:r.width/2,y:r.height/2},s=Math.min(t.size.width/r.width,t.size.height/r.height),c=n.x-i.x;return{top:`${n.y-i.y}px`,left:`${c}px`,transform:`scale(${s})`}}const Mr=async(t,r)=>{const n=t.details.src,i=await Qn(n),s=Be(r,{...i}),c=ei(t.trim,{duration:i.duration}),d={width:i.width,height:i.height,opacity:100,src:n,volume:t.details.volume??100,borderRadius:t.details.borderRadius??0,borderWidth:t.details.borderWidth??0,borderColor:t.details.borderColor||"#000000",boxShadow:t.details.boxShadow||Ke,top:t.details.top||s.top||"0px",left:t.details.left||s.left||"0px",transform:t.details.transform||s.transform,blur:t.details.blur||0,brightness:t.details.brightness||100,flipX:t.details.flipX||!1,flipY:t.details.flipY||!1,rotate:t.details.rotate||"0deg",visibility:t.details.visibility||"visible",mediaWidth:t.details.mediaWidth||i.width||100,mediaHeight:t.details.mediaHeight||i.height||100};return{...t,trim:c,type:"video",name:"video",details:d,playbackRate:t.playbackRate||1,display:ye(t.display,{duration:i.duration,trim:c}),duration:i.duration}},Or=async t=>{const r=t.id,n=t.details,s=(await zi(n.src)).duration,c=ei(t.trim,{duration:s});return{id:r,name:"",type:"audio",display:ye(t.display,{duration:s,trim:c}),trim:c,playbackRate:t.playbackRate||1,details:{src:n.src,volume:n.volume??100},metadata:{...t.metadata},duration:s}},Gi=async(t,r)=>{const n=t.trackItemsIds,i={width:t.details.width,height:t.details.height},s=Math.min(r.size.width/i.width,r.size.height/i.height),c=t.details.rotate||0,d={top:t.details.top,left:t.details.left},_=t.display,D=t.trim||t.display;let F=1/0,A=0;return n.forEach(z=>{const I=t.trackItemsMap[z];I.display.from<F&&(F=I.display.from),I.display.to>A&&(A=I.display.to)}),{id:t.id,details:{...i,top:d.top||0,left:d.left||0,scale:s,rotate:c},trim:D,display:_||{from:F,to:A},activeEdit:!1}},Pr=async(t,r)=>{const n=t.details,i=await qn(n.src),s=Be(r,i);return{id:t.id,type:"image",name:"image",display:ye(t.display),playbackRate:t.playbackRate||1,details:{src:n.src||"",width:n.width||i.width||100,height:n.height||i.height||100,opacity:n.opacity??100,transform:n.transform||s.transform,border:n.border||"none",borderRadius:n.borderRadius||0,boxShadow:n.boxShadow||Ke,top:n.top||s.top||"0px",left:n.left||s.left||"0px",borderWidth:n.borderWidth??0,borderColor:n.borderColor||"#000000",blur:n.blur||0,brightness:n.brightness||100,flipX:n.flipX||!1,flipY:n.flipY||!1,rotate:n.rotate||"0deg",visibility:n.visibility||"visible",mediaWidth:n.mediaWidth||n.width||i.width||100,mediaHeight:n.mediaHeight||n.height||i.height||100},metadata:t.metadata||{}}},Rr=async(t,r)=>{const n=t;n.details.fontUrl&&await Dr([{fontFamily:n.details.fontFamily,url:n.details.fontUrl}]);const i=n.id,s=n.details,c=ri(s),d=ti(n.details.text,c),_=Be(r,{width:c.width,height:d});return{id:i,name:"caption",type:"caption",display:ye(n.display),details:{...c,text:s.text||"",height:d,fontUrl:s.fontUrl,top:c.top||_.top,left:c.left||_.left,borderWidth:s.borderWidth||0,borderColor:s.borderColor||"#000000",boxShadow:s.boxShadow||Ke,words:s.words||[]},metadata:{}}},Cr=async(t,r)=>{t.details.fontUrl&&await Dr([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const n=t.id,i=t.details,s=ri(i),c=ti(t.details.text,s),d=Be(r,{width:s.width,height:c});return{id:n,name:"text",type:"text",display:ye(t.display),details:{...s,text:i.text||"",height:c,fontUrl:i.fontUrl,top:s.top||d.top,left:s.left||d.left,borderWidth:i.borderWidth||0,borderColor:i.borderColor||"#000000",boxShadow:i.boxShadow||Ke},metadata:{}}},ri=t=>({fontFamily:t.fontFamily||"Arial",fontSize:t.fontSize||"16px",fontWeight:t.fontWeight||"normal",fontStyle:t.fontStyle||"normal",textDecoration:t.textDecoration||"none",textAlign:t.textAlign||"left",lineHeight:t.lineHeight||"normal",letterSpacing:t.letterSpacing||"normal",wordSpacing:t.wordSpacing||"normal",color:t.color||"#ffffff",backgroundColor:t.backgroundColor||"transparent",border:t.border||"none",textShadow:t.textShadow||"none",text:t.text||"",opacity:t.opacity??100,width:t.width||300,wordWrap:t.wordWrap||"normal",wordBreak:t.wordBreak||"normal",WebkitTextStrokeColor:t.WebkitTextStrokeColor||"#ffffff",WebkitTextStrokeWidth:t.WebkitTextStrokeWidth||"0px",top:t.top,left:t.left,textTransform:t.textTransform||"none",transform:t.transform||"none"}),Ui=async(t,r)=>{switch(t.type){case"video":return Mr(t,r||{});case"audio":return Or(t);case"image":return Pr(t,r||{});case"text":return Cr(t,r||{});case"caption":return Rr(t,r||{});default:throw new Error("Unsupported track item")}};function Xi(t,r){return r.some(n=>t.some(i=>i.id===n.id))}const Wi=(t=[],r=[])=>t.length===0?r.map(i=>({id:me(),items:[i.id],type:i.type,accepts:["text","image","video","audio","caption","template"]})):t.map(n=>({...n,items:n.items||[],accepts:["audio","video","image","text","caption","template"],type:n.type||"text",magnetic:n.magnetic||!1,static:n.static||!1,id:n.id||me()}));function Ki(t,r){return t.filter(i=>{if(r.forEach(s=>{i.items.includes(s)&&(i.items=i.items.filter(c=>c!==s))}),i.items.length!==0)return i})}const Ct=t=>Object.keys(t).reduce((r,n)=>{const{display:i,playbackRate:s}=t[n];return Math.max(r,i.to/(s||1))},0);function Lr(t,r,n){return Math.min(Math.max(t,r),n)}const Bi=(t,r,n,i,s)=>{if(i===void 0&&s===void 0)return{trackId:void 0,trackIndex:void 0};const c=s!==void 0?r[Lr(s,0,r.length)]:r.find(D=>D.id===i);if(!c)return{trackId:void 0,trackIndex:s!==void 0?Lr(s,0,r.length):void 0};const d=c.items.map(D=>n[D]),_=t.map(D=>n[D]);for(const D of d){const F=D.display.from,A=D.display.to;for(const z of _){const I=z.display.from;if(!(z.display.to<=F||I>=A))return{trackId:void 0,trackIndex:r.indexOf(c)}}}return{trackId:c.id,trackIndex:r.indexOf(c)}};function Vi(t){const r=O.subject.pipe(O.filter(({key:f})=>f.startsWith(O.DESIGN_PREFIX))),n=O.subject.pipe(O.filter(({key:f})=>f.startsWith(O.ADD_PREFIX))),i=O.subject.pipe(O.filter(({key:f})=>f.startsWith(O.LAYER_PREFIX))),s=O.subject.pipe(O.filter(({key:f})=>f.startsWith(O.HISTORY_PREFIX))),c=O.subject.pipe(O.filter(({key:f})=>f.startsWith(O.ACTIVE_PREFIX))),d=O.subject.pipe(O.filter(({key:f})=>f.startsWith(O.EDIT_PREFIX))),_=r.subscribe(async f=>{var l,p;if(f.key===O.DESIGN_LOAD){const g=(l=f.value)==null?void 0:l.payload,v=g.size,E=g.trackItemIds,h=g.trackItemsMap,m=g.trackItemDetailsMap;console.warn("IMPROVE FONTS LOADING");const w=E.map(async b=>{var C;try{const M=m[b],R=h[b];if(M.type==="image"){const T=await Pr({id:b,details:M.details,...R},{size:v}),{details:k,...H}=T;m[b]={type:"image",details:k},h[b]=H}else if(M.type==="video"){const T=Z((C=f.value)==null?void 0:C.payload.trackItemsMap[b]),k=await Mr({...M,...T,...R},{size:v}),{details:H,...at}=k;m[b]={type:"video",details:H},h[b]=at}else if(M.type==="audio"){const T=await Or({id:b,details:M.details,...R}),{details:k,...H}=T;m[b]={type:"audio",details:k},h[b]=H}else if(M.type==="caption"){const T=await Rr({id:b,details:M.details,...R},{size:v}),{details:k,...H}=T;m[b]={type:"caption",details:k},h[b]=H}else if(M.type==="text"){const T=await Cr({id:b,details:M.details,...R},{size:v}),{details:k,...H}=T;m[b]={type:"text",details:k},h[b]=H}return!0}catch{return!1}});await Promise.all(w);const P=Ct(h);t.updateState({...g,trackItemsMap:h,duration:P})}if(f.key===O.DESIGN_RESIZE){const g=(p=f.value)==null?void 0:p.payload;t.updateState({size:g})}}),D=s.subscribe(f=>{if(f.key===O.HISTORY_UNDO)return t.undo();if(f.key===O.HISTORY_REDO)return t.redo()}),F=i.subscribe(f=>{var g,v,E,h;const l=[],p=[];if((g=f.value)!=null&&g.payload.trackItemIds&&(l.push((v=f.value)==null?void 0:v.payload.trackItemIds),t.updateState({activeIds:l})),f.key===O.LAYER_DELETE){const m=(E=f.value)==null?void 0:E.payload.trackItemIds,w=Z(t.getState()),P=m&&m.length?m:w.activeIds,b=w.trackItemIds,C=w.trackItemDetailsMap,M=b.filter(at=>!P.includes(at)),R=Object.fromEntries(Object.entries(C).filter(([at])=>!P.includes(at))),T=Ki(w.tracks,P),k=Object.fromEntries(Object.entries(w.trackItemsMap).filter(([at])=>!P.includes(at))),H=Ct(k);t.updateState({trackItemIds:M,trackItemDetailsMap:R,activeIds:[],trackItemsMap:k,tracks:T,duration:H},{updateHistory:!0,kind:"remove"})}if(f.key===O.LAYER_CLONE){const m=Z(t.getState()),w=((h=f.value)==null?void 0:h.payload.trackItemIds)||m.activeIds;if(w.length===0)return;w.forEach(b=>{const C=m.trackItemsMap[b],M=m.trackItemDetailsMap[b],R=me();p.push(R),m.trackItemsMap={...m.trackItemsMap,[R]:{...Z(C),id:R}},m.trackItemDetailsMap={...m.trackItemDetailsMap,[R]:{...Z(M)}},m.trackItemIds.push(R)});const P=[];m.tracks.forEach(b=>{const C={...b,items:[],id:he()};b.items.forEach(M=>{if(w.includes(M)){const R=w.indexOf(M);C.items.push(p[R])}}),P.push(C)}),P.forEach(b=>{b.items.length!==0&&m.tracks.unshift(b)}),t.updateState({trackItemDetailsMap:m.trackItemDetailsMap,tracks:m.tracks,trackItemIds:m.trackItemIds,trackItemsMap:m.trackItemsMap},{updateHistory:!0,kind:"update"})}}),A=n.subscribe(async f=>{var m,w,P,b,C,M,R,T,k,H,at,zt,qt,Qt,te,ee,Y;const l=Z(t.getState());let p=[],g="text";const v=(w=(m=f.value)==null?void 0:m.options)==null?void 0:w.trackId;let E=(b=(P=f.value)==null?void 0:P.options)==null?void 0:b.trackIndex;if(f.key===Ti){const U=(C=f.value)==null?void 0:C.payload,W=U.trackItems.map(J=>Ui(J,{size:l.size})),x=await Promise.all(W),dt=Wi(U.tracks,U.trackItems),N=[],X={},It={};if(x.forEach(J=>{const{details:gt,...Yt}=J;N.push(J.id),X[J.id]={type:J.type,details:gt},It[J.id]=Yt}),Xi(l.tracks,dt))l.tracks.forEach(J=>{dt.forEach(gt=>{J.id===gt.id&&J.items.push(...N)})});else{const J=((R=(M=f.value)==null?void 0:M.options)==null?void 0:R.trackIndex)||0,gt=Lr(J,0,l.tracks.length);l.tracks.splice(gt,0,...dt)}l.trackItemDetailsMap={...l.trackItemDetailsMap,...X},l.trackItemsMap={...l.trackItemsMap,...It},l.trackItemIds=[...l.trackItemIds,...N],l.duration=Ct(l.trackItemsMap),t.updateState({trackItemIds:l.trackItemIds,trackItemDetailsMap:l.trackItemDetailsMap,trackItemsMap:l.trackItemsMap,tracks:l.tracks,duration:l.duration},{updateHistory:!0,kind:"add"});return}if(f.key===O.ADD_CAPTION){g="caption";const U=(T=f.value)==null?void 0:T.payload,W=[];for(const N of U){const X=Rr(N,{size:l.size});W.push(X)}const x=await Promise.all(W),dt=[];for(const N of x){const X=N.id;dt.push(X);const{details:It,...ot}=N;l.trackItemDetailsMap[X]={type:g,details:It},l.trackItemsMap[X]=ot,l.trackItemIds.push(X)}p=dt}if(f.key===O.ADD_TEXT){g="text";const U=await Cr((k=f.value)==null?void 0:k.payload,{size:l.size}),{details:W,...x}=U;l.trackItemDetailsMap[x.id]={type:g,details:W},l.trackItemsMap[x.id]=x,l.trackItemIds.push(x.id),p=[x.id]}if(f.key===O.ADD_TEMPLATE){g="template";const U=(H=f.value)==null?void 0:H.payload.trackItemsMap,W=(at=f.value)==null?void 0:at.payload.trackItemsDetails,x=(zt=f.value)==null?void 0:zt.payload.transitionsMap,dt=(qt=f.value)==null?void 0:qt.payload.trackItemsIds,{details:N,...X}=await Gi((Qt=f.value)==null?void 0:Qt.payload,{size:l.size}),It={id:X.id,items:dt};l.trackItemDetailsMap[X.id]={type:g,details:N},l.trackItemsMap[X.id]=X,l.trackItemIds.push(X.id),p=[X.id],l.trackItemsMap={...l.trackItemsMap,...U,[X.id]:{type:"template",...X}},l.trackItemDetailsMap={...l.trackItemDetailsMap,...W,[X.id]:{type:"template",details:N}},l.transitionsMap={...l.transitionsMap,...x},l.structure=[...l.structure,It]}if(f.key===O.ADD_IMAGE){g="image";const U=await Pr((te=f.value)==null?void 0:te.payload,{size:l.size}),{details:W,...x}=U;l.trackItemDetailsMap[x.id]={type:g,details:W},l.trackItemsMap[x.id]=x,l.trackItemIds.push(x.id),p=[x.id]}if(f.key===O.ADD_AUDIO){g="audio";const U=await Or((ee=f.value)==null?void 0:ee.payload),{details:W,...x}=U;l.trackItemDetailsMap[x.id]={type:g,details:W},l.trackItemsMap[x.id]=x,l.trackItemIds.push(x.id),p=[x.id]}if(f.key===O.ADD_VIDEO){g="video";const U=await Mr((Y=f.value)==null?void 0:Y.payload,{size:l.size}),{details:W,...x}=U;l.trackItemDetailsMap[x.id]={type:g,details:W},l.trackItemsMap[x.id]=x,l.trackItemIds.push(x.id),p=[x.id]}const h=Bi(p,l.tracks,l.trackItemsMap,v,E);if(h.trackId){const U=l.tracks.find(W=>W.id===h.trackId);U&&U.items.push(...p)}else if(h.trackIndex!==void 0){const U={id:he(),accepts:["text","audio","helper","video","image","caption","template"],type:g,items:p,magnetic:!1,static:!1};l.tracks.splice(h.trackIndex,0,U)}else l.tracks.unshift({id:he(),accepts:["text","audio","helper","video","image","caption","template"],type:g,items:p,magnetic:!1,static:!1});l.duration=Ct(l.trackItemsMap),t.updateState({trackItemIds:l.trackItemIds,trackItemDetailsMap:l.trackItemDetailsMap,trackItemsMap:l.trackItemsMap,tracks:l.tracks,duration:l.duration,structure:l.structure},{updateHistory:!0,kind:"add"})}),z=c.subscribe(async f=>{var l;if(f.key===O.ACTIVE_SPLIT){const p=Z(t.getState()),g=(l=f.value)==null?void 0:l.options.time;if(p.activeIds.length===1){const v=p.activeIds[0],E=p.trackItemsMap[v];if(g>=E.display.to||g<=E.display.from)return;const h=p.trackItemDetailsMap[v],m=me(),w={...E,id:m,display:{from:g,to:E.display.to},trim:{from:g,to:E.display.to}};p.trackItemsMap[v].display.to=g,p.trackItemsMap[m]=w,p.trackItemIds.push(m),p.trackItemDetailsMap[m]=h,p.tracks.forEach(P=>{P.items.includes(v)&&P.items.push(m)}),t.updateState({trackItemDetailsMap:p.trackItemDetailsMap,tracks:p.tracks,trackItemIds:p.trackItemIds,trackItemsMap:p.trackItemsMap},{updateHistory:!0,kind:"update"})}return}if(f.key===O.ACTIVE_CLONE){const p=Z(t.getState());if(p.activeIds.length){const g=p.activeIds,v=[],E={activeIds:g,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};g.forEach(m=>{E.trackItemDetailsMap[m]=p.trackItemDetailsMap[m],E.trackItemsMap[m]=p.trackItemsMap[m],v.push(p.tracks.find(w=>w.items.includes(m)))});const h=new Set;v.filter(m=>h.has(m.id)?!1:(h.add(m),!0)),E.tracks=Array.from(h.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(E))}}if(f.key===O.ACTIVE_PASTE){const p=localStorage.getItem("DesignComboTemp");if(!p)return;const g=Z(t.getState()),v=JSON.parse(p),E={},h=v.trackItemsMap,m=v.trackItemDetailsMap,w=v.tracks,P=[],b=v.activeIds.map(async C=>{const M=m[C];(M.type==="caption"||M.type==="text")&&M.details.fontUrl&&await Dr([{fontFamily:M.details.fontFamily,url:M.details.fontUrl}]);const R=me();return E[C]=R,g.trackItemsMap[R]={...h[C],id:R},g.trackItemDetailsMap[R]=M,g.trackItemIds.push(R),!0});await Promise.all(b),w.forEach(C=>{const M=C.items.map(T=>E[T]),R={...C,items:M,id:he()};P.push(R)}),g.tracks=[...g.tracks,...P],t.updateState({trackItemDetailsMap:g.trackItemDetailsMap,tracks:g.tracks,trackItemIds:g.trackItemIds,trackItemsMap:g.trackItemsMap},{updateHistory:!0,kind:"update"})}}),I=d.subscribe(async f=>{var l,p,g;if(f.key===O.EDIT_OBJECT){const v=Z(t.getState()),E=v.trackItemDetailsMap,h=v.trackItemsMap,m=Object.keys((l=f.value)==null?void 0:l.payload);if(!m.length)return;const w=(p=f.value)==null?void 0:p.payload;m.forEach(b=>{const C=w[b];C.details?E[b].details={...E[b].details,...C.details}:w[b].playbackRate?h[b].playbackRate=w[b].playbackRate:E[b].type==="template"&&(h[b]={...h[b],...w[b]})});const P=Ct(h);t.updateState({trackItemDetailsMap:{...E},trackItemsMap:{...h},duration:P},{updateHistory:!0,kind:"update:details"})}if(f.key===O.REPLACE_MEDIA){const v=(g=f.value)==null?void 0:g.payload,E=Object.keys(v)[0],h=Object.values(v)[0],m=Z(t.getState()),w=m.trackItemDetailsMap[E];if(h.details){if(h.type==="image"&&h.details.src){const C=await qn(h.details.src),M=w.details.width||0,R=w.details.height||0;let T=C.width,k=C.height;const H=C.width/C.height;M/R>H?(T=M,k=M/H):(k=R,T=R*H),h.details.mediaWidth=T,h.details.mediaHeight=k}if(h.type==="video"&&h.details.src){const C=await Qn(h.details.src),M=w.details.width||0,R=w.details.height||0;let T=C.width,k=C.height;const H=C.width/C.height;M/R>H?(T=M,k=M/H):(k=R,T=R*H),h.details.mediaWidth=T,h.details.mediaHeight=k}const b=w.details;w.details={...b,...h.details},h.details=w.details}const P={...w,...h};m.trackItemDetailsMap[E]=P,m.trackItemsMap[E]={...m.trackItemsMap[E],type:h.type},t.updateState({trackItemDetailsMap:{...m.trackItemDetailsMap},trackItemsMap:{...m.trackItemsMap}},{updateHistory:!0,kind:"update:details"})}});return{unsubscribe:()=>{A.unsubscribe(),z.unsubscribe(),I.unsubscribe(),D.unsubscribe(),F.unsubscribe(),_.unsubscribe()}}}const Zi={Date:!0,RegExp:!0,String:!0,Number:!0};function ni(t,r,n={cyclesFix:!0},i=[]){var _,D;let s=[];const c=Array.isArray(t);for(const F in t){const A=t[F],z=c?+F:F;if(!(F in r)){s.push({type:"REMOVE",path:[z],oldValue:t[F]});continue}const I=r[F],f=typeof A=="object"&&typeof I=="object"&&Array.isArray(A)===Array.isArray(I);if(A&&I&&f&&!Zi[(D=(_=Object.getPrototypeOf(A))==null?void 0:_.constructor)==null?void 0:D.name]&&(!n.cyclesFix||!i.includes(A))){const l=ni(A,I,n,n.cyclesFix?i.concat([A]):[]);s.push.apply(s,l.map(p=>(p.path.unshift(z),p)))}else A!==I&&!(Number.isNaN(A)&&Number.isNaN(I))&&!(f&&(isNaN(A)?A+""==I+"":+A==+I))&&s.push({path:[z],type:"CHANGE",value:I,oldValue:A})}const d=Array.isArray(r);for(const F in r)F in t||s.push({type:"CREATE",path:[d?+F:F],value:r[F]});return s}var xr=Symbol.for("immer-nothing"),_e=Symbol.for("immer-draftable"),lt=Symbol.for("immer-state"),ii=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function B(t,...r){if(process.env.NODE_ENV!=="production"){const n=ii[t],i=typeof n=="function"?n.apply(null,r):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Lt=Object.getPrototypeOf;function xt(t){return!!t&&!!t[lt]}function Ot(t){var r;return t?ai(t)||Array.isArray(t)||!!t[_e]||!!((r=t.constructor)!=null&&r[_e])||be(t)||Ee(t):!1}var Ji=Object.prototype.constructor.toString();function ai(t){if(!t||typeof t!="object")return!1;const r=Lt(t);if(r===null)return!0;const n=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Ji}function Ie(t,r){Nt(t)===0?Reflect.ownKeys(t).forEach(n=>{r(n,t[n],t)}):t.forEach((n,i)=>r(i,n,t))}function Nt(t){const r=t[lt];return r?r.type_:Array.isArray(t)?1:be(t)?2:Ee(t)?3:0}function ge(t,r){return Nt(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function Nr(t,r){return Nt(t)===2?t.get(r):t[r]}function si(t,r,n){const i=Nt(t);i===2?t.set(r,n):i===3?t.add(n):t[r]=n}function qi(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function be(t){return t instanceof Map}function Ee(t){return t instanceof Set}function Ft(t){return t.copy_||t.base_}function Fr(t,r){if(be(t))return new Map(t);if(Ee(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=ai(t);if(r===!0||r==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[lt];let s=Reflect.ownKeys(i);for(let c=0;c<s.length;c++){const d=s[c],_=i[d];_.writable===!1&&(_.writable=!0,_.configurable=!0),(_.get||_.set)&&(i[d]={configurable:!0,writable:!0,enumerable:_.enumerable,value:t[d]})}return Object.create(Lt(t),i)}else{const i=Lt(t);if(i!==null&&n)return{...t};const s=Object.create(i);return Object.assign(s,t)}}function Hr(t,r=!1){return Ve(t)||xt(t)||!Ot(t)||(Nt(t)>1&&(t.set=t.add=t.clear=t.delete=Qi),Object.freeze(t),r&&Object.entries(t).forEach(([n,i])=>Hr(i,!0))),t}function Qi(){B(2)}function Ve(t){return Object.isFrozen(t)}var jr={};function Ht(t){const r=jr[t];return r||B(0,t),r}function ta(t,r){jr[t]||(jr[t]=r)}var ve;function oi(){return ve}function ea(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ci(t,r){r&&(Ht("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function $r(t){zr(t),t.drafts_.forEach(ra),t.drafts_=null}function zr(t){t===ve&&(ve=t.parent_)}function ui(t){return ve=ea(ve,t)}function ra(t){const r=t[lt];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function li(t,r){r.unfinalizedDrafts_=r.drafts_.length;const n=r.drafts_[0];return t!==void 0&&t!==n?(n[lt].modified_&&($r(r),B(4)),Ot(t)&&(t=Ze(r,t),r.parent_||Je(r,t)),r.patches_&&Ht("Patches").generateReplacementPatches_(n[lt].base_,t,r.patches_,r.inversePatches_)):t=Ze(r,n,[]),$r(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==xr?t:void 0}function Ze(t,r,n){if(Ve(r))return r;const i=r[lt];if(!i)return Ie(r,(s,c)=>fi(t,i,r,s,c,n)),r;if(i.scope_!==t)return r;if(!i.modified_)return Je(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let c=s,d=!1;i.type_===3&&(c=new Set(s),s.clear(),d=!0),Ie(c,(_,D)=>fi(t,i,s,_,D,n,d)),Je(t,s,!1),n&&t.patches_&&Ht("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function fi(t,r,n,i,s,c,d){if(process.env.NODE_ENV!=="production"&&s===n&&B(5),xt(s)){const _=c&&r&&r.type_!==3&&!ge(r.assigned_,i)?c.concat(i):void 0,D=Ze(t,s,_);if(si(n,i,D),xt(D))t.canAutoFreeze_=!1;else return}else d&&n.add(s);if(Ot(s)&&!Ve(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;Ze(t,s),(!r||!r.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&Je(t,s)}}function Je(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Hr(r,n)}function na(t,r){const n=Array.isArray(t),i={type_:n?1:0,scope_:r?r.scope_:oi(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=i,c=Yr;n&&(s=[i],c=Se);const{revoke:d,proxy:_}=Proxy.revocable(s,c);return i.draft_=_,i.revoke_=d,_}var Yr={get(t,r){if(r===lt)return t;const n=Ft(t);if(!ge(n,r))return ia(t,n,r);const i=n[r];return t.finalized_||!Ot(i)?i:i===Gr(t.base_,r)?(Xr(t),t.copy_[r]=Wr(i,t)):i},has(t,r){return r in Ft(t)},ownKeys(t){return Reflect.ownKeys(Ft(t))},set(t,r,n){const i=di(Ft(t),r);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const s=Gr(Ft(t),r),c=s==null?void 0:s[lt];if(c&&c.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(qi(n,s)&&(n!==void 0||ge(t.base_,r)))return!0;Xr(t),Ur(t)}return t.copy_[r]===n&&(n!==void 0||r in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[r])||(t.copy_[r]=n,t.assigned_[r]=!0),!0},deleteProperty(t,r){return Gr(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,Xr(t),Ur(t)):delete t.assigned_[r],t.copy_&&delete t.copy_[r],!0},getOwnPropertyDescriptor(t,r){const n=Ft(t),i=Reflect.getOwnPropertyDescriptor(n,r);return i&&{writable:!0,configurable:t.type_!==1||r!=="length",enumerable:i.enumerable,value:n[r]}},defineProperty(){B(11)},getPrototypeOf(t){return Lt(t.base_)},setPrototypeOf(){B(12)}},Se={};Ie(Yr,(t,r)=>{Se[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),Se.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&B(13),Se.set.call(this,t,r,void 0)},Se.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&B(14),Yr.set.call(this,t[0],r,n,t[0])};function Gr(t,r){const n=t[lt];return(n?Ft(n):t)[r]}function ia(t,r,n){var s;const i=di(r,n);return i?"value"in i?i.value:(s=i.get)==null?void 0:s.call(t.draft_):void 0}function di(t,r){if(!(r in t))return;let n=Lt(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,r);if(i)return i;n=Lt(n)}}function Ur(t){t.modified_||(t.modified_=!0,t.parent_&&Ur(t.parent_))}function Xr(t){t.copy_||(t.copy_=Fr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var aa=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(r,n,i)=>{if(typeof r=="function"&&typeof n!="function"){const c=n;n=r;const d=this;return function(D=c,...F){return d.produce(D,A=>n.call(this,A,...F))}}typeof n!="function"&&B(6),i!==void 0&&typeof i!="function"&&B(7);let s;if(Ot(r)){const c=ui(this),d=Wr(r,void 0);let _=!0;try{s=n(d),_=!1}finally{_?$r(c):zr(c)}return ci(c,i),li(s,c)}else if(!r||typeof r!="object"){if(s=n(r),s===void 0&&(s=r),s===xr&&(s=void 0),this.autoFreeze_&&Hr(s,!0),i){const c=[],d=[];Ht("Patches").generateReplacementPatches_(r,s,c,d),i(c,d)}return s}else B(1,r)},this.produceWithPatches=(r,n)=>{if(typeof r=="function")return(d,..._)=>this.produceWithPatches(d,D=>r(D,..._));let i,s;return[this.produce(r,n,(d,_)=>{i=d,s=_}),i,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Ot(t)||B(8),xt(t)&&(t=sa(t));const r=ui(this),n=Wr(t,void 0);return n[lt].isManual_=!0,zr(r),n}finishDraft(t,r){const n=t&&t[lt];(!n||!n.isManual_)&&B(9);const{scope_:i}=n;return ci(i,r),li(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const s=r[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(r=r.slice(n+1));const i=Ht("Patches").applyPatches_;return xt(t)?i(t,r):this.produce(t,s=>i(s,r))}};function Wr(t,r){const n=be(t)?Ht("MapSet").proxyMap_(t,r):Ee(t)?Ht("MapSet").proxySet_(t,r):na(t,r);return(r?r.scope_:oi()).drafts_.push(n),n}function sa(t){return xt(t)||B(10,t),pi(t)}function pi(t){if(!Ot(t)||Ve(t))return t;const r=t[lt];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Fr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=Fr(t,!0);return Ie(n,(i,s)=>{si(n,i,pi(s))}),r&&(r.finalized_=!1),n}function hi(){process.env.NODE_ENV!=="production"&&ii.push('Sets cannot have "replace" patches.',function(I){return"Unsupported patch operation: "+I},function(I){return"Cannot apply patch, path doesn't resolve: "+I},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",i="remove";function s(I,f,l,p){switch(I.type_){case 0:case 2:return d(I,f,l,p);case 1:return c(I,f,l,p);case 3:return _(I,f,l,p)}}function c(I,f,l,p){let{base_:g,assigned_:v}=I,E=I.copy_;E.length<g.length&&([g,E]=[E,g],[l,p]=[p,l]);for(let h=0;h<g.length;h++)if(v[h]&&E[h]!==g[h]){const m=f.concat([h]);l.push({op:r,path:m,value:z(E[h])}),p.push({op:r,path:m,value:z(g[h])})}for(let h=g.length;h<E.length;h++){const m=f.concat([h]);l.push({op:n,path:m,value:z(E[h])})}for(let h=E.length-1;g.length<=h;--h){const m=f.concat([h]);p.push({op:i,path:m})}}function d(I,f,l,p){const{base_:g,copy_:v}=I;Ie(I.assigned_,(E,h)=>{const m=Nr(g,E),w=Nr(v,E),P=h?ge(g,E)?r:n:i;if(m===w&&P===r)return;const b=f.concat(E);l.push(P===i?{op:P,path:b}:{op:P,path:b,value:w}),p.push(P===n?{op:i,path:b}:P===i?{op:n,path:b,value:z(m)}:{op:r,path:b,value:z(m)})})}function _(I,f,l,p){let{base_:g,copy_:v}=I,E=0;g.forEach(h=>{if(!v.has(h)){const m=f.concat([E]);l.push({op:i,path:m,value:h}),p.unshift({op:n,path:m,value:h})}E++}),E=0,v.forEach(h=>{if(!g.has(h)){const m=f.concat([E]);l.push({op:n,path:m,value:h}),p.unshift({op:i,path:m,value:h})}E++})}function D(I,f,l,p){l.push({op:r,path:[],value:f===xr?void 0:f}),p.push({op:r,path:[],value:I})}function F(I,f){return f.forEach(l=>{const{path:p,op:g}=l;let v=I;for(let w=0;w<p.length-1;w++){const P=Nt(v);let b=p[w];typeof b!="string"&&typeof b!="number"&&(b=""+b),(P===0||P===1)&&(b==="__proto__"||b==="constructor")&&B(19),typeof v=="function"&&b==="prototype"&&B(19),v=Nr(v,b),typeof v!="object"&&B(18,p.join("/"))}const E=Nt(v),h=A(l.value),m=p[p.length-1];switch(g){case r:switch(E){case 2:return v.set(m,h);case 3:B(16);default:return v[m]=h}case n:switch(E){case 1:return m==="-"?v.push(h):v.splice(m,0,h);case 2:return v.set(m,h);case 3:return v.add(h);default:return v[m]=h}case i:switch(E){case 1:return v.splice(m,1);case 2:return v.delete(m);case 3:return v.delete(l.value);default:return delete v[m]}default:B(17,g)}}),I}function A(I){if(!Ot(I))return I;if(Array.isArray(I))return I.map(A);if(be(I))return new Map(Array.from(I.entries()).map(([l,p])=>[l,A(p)]));if(Ee(I))return new Set(Array.from(I).map(A));const f=Object.create(Lt(I));for(const l in I)f[l]=A(I[l]);return ge(I,_e)&&(f[_e]=I[_e]),f}function z(I){return xt(I)?A(I):I}ta("Patches",{applyPatches_:F,generatePatches_:s,generateReplacementPatches_:D})}var ft=new aa,oa=ft.produce;ft.produceWithPatches.bind(ft),ft.setAutoFreeze.bind(ft),ft.setUseStrictShallowCopy.bind(ft);var ca=ft.applyPatches.bind(ft);ft.createDraft.bind(ft),ft.finishDraft.bind(ft);var ua=1/0,la=9007199254740991,fa="[object Arguments]",da="[object Function]",pa="[object GeneratorFunction]",ha="[object Symbol]",ma=typeof pt=="object"&&pt&&pt.Object===Object&&pt,ya=typeof self=="object"&&self&&self.Object===Object&&self,_a=ma||ya||Function("return this")();function Ia(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}function ga(t,r){for(var n=-1,i=t?t.length:0,s=Array(i);++n<i;)s[n]=r(t[n],n,t);return s}function ba(t,r){for(var n=-1,i=r.length,s=t.length;++n<i;)t[s+n]=r[n];return t}var Kr=Object.prototype,Ea=Kr.hasOwnProperty,Br=Kr.toString,mi=_a.Symbol,va=Kr.propertyIsEnumerable,yi=mi?mi.isConcatSpreadable:void 0,_i=Math.max;function Sa(t,r,n,i,s){var c=-1,d=t.length;for(n||(n=ka),s||(s=[]);++c<d;){var _=t[c];n(_)?ba(s,_):s[s.length]=_}return s}function Ta(t,r){return t=Object(t),Aa(t,r,function(n,i){return i in t})}function Aa(t,r,n){for(var i=-1,s=r.length,c={};++i<s;){var d=r[i],_=t[d];n(_,d)&&(c[d]=_)}return c}function wa(t,r){return r=_i(r===void 0?t.length-1:r,0),function(){for(var n=arguments,i=-1,s=_i(n.length-r,0),c=Array(s);++i<s;)c[i]=n[r+i];i=-1;for(var d=Array(r+1);++i<r;)d[i]=n[i];return d[r]=c,Ia(t,this,d)}}function ka(t){return Oa(t)||Ma(t)||!!(yi&&t&&t[yi])}function Da(t){if(typeof t=="string"||Na(t))return t;var r=t+"";return r=="0"&&1/t==-ua?"-0":r}function Ma(t){return Ra(t)&&Ea.call(t,"callee")&&(!va.call(t,"callee")||Br.call(t)==fa)}var Oa=Array.isArray;function Pa(t){return t!=null&&La(t.length)&&!Ca(t)}function Ra(t){return Ii(t)&&Pa(t)}function Ca(t){var r=xa(t)?Br.call(t):"";return r==da||r==pa}function La(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=la}function xa(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function Ii(t){return!!t&&typeof t=="object"}function Na(t){return typeof t=="symbol"||Ii(t)&&Br.call(t)==ha}var Fa=wa(function(t,r){return t==null?{}:Ta(t,ga(Sa(r),Da))}),Ha=Fa;const gi=kr(Ha),ja={size:{width:1080,height:1920},tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1,index:1},duration:0,activeIds:[],trackItemDetailsMap:{},structure:[]},bi=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds"];class $a{constructor(r){Zt(this,"stateSubject");Zt(this,"stateHistorySubject");Zt(this,"prevState");Zt(this,"undos",[]);Zt(this,"redos",[]);Zt(this,"listener");const n=r||ja;this.stateSubject=new Jn(n),this.stateHistorySubject=new Jn({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){Vi(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const i=gi(r,bi),s=gi(this.getState(),bi),c=ni(s,i);c.length&&(this.undos.push({undos:c,type:n}),this.redos=[])}getStateHistory(){return this.stateHistorySubject.getValue()}subscribeHistory(r){return this.stateHistorySubject.subscribe(r)}getState(){return this.stateSubject.getValue()}subscribe(r){return this.stateSubject.subscribe(r)}updateState(r,n={updateHistory:!1}){const i=this.getState(),s={...i,...r};nt(i,s)||(n.updateHistory&&this.updateHistory(s,n.kind),this.prevState=i,this.stateSubject.next(s))}subscribeToSize(r){return this.stateSubject.asObservable().subscribe(n=>{nt(n.size,this.prevState.size)||r({size:n.size})})}subscribeToScale(r){return this.stateSubject.asObservable().subscribe(n=>{nt(n.scale,this.prevState.scale)||r({scale:n.scale})})}subscribeToUpdateTrackItem(r){return this.stateSubject.asObservable().subscribe(n=>{nt(n.trackItemsMap,this.prevState.trackItemsMap)||r({trackItemsMap:n.trackItemsMap})})}subscribeToUpdateItemDetails(r){return this.stateSubject.asObservable().subscribe(n=>{nt(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||r({trackItemDetailsMap:n.trackItemDetailsMap})})}subscribeToDuration(r){return this.stateSubject.asObservable().subscribe(n=>{n.duration!==this.prevState.duration&&r({duration:n.duration})})}subscribeToHistory(r){return this.stateHistorySubject.asObservable().subscribe(n=>{if(n.handleRedo){const i=this.undos[this.undos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}if(n.handleUndo){const i=this.redos[this.redos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}})}subscribeToAddOrRemoveItems(r){return this.stateSubject.asObservable().subscribe(n=>{(!nt(n.trackItemIds,this.prevState.trackItemIds)||!nt(n.tracks,this.prevState.tracks))&&r({trackItemIds:n.trackItemIds})})}subscribeToActiveIds(r){return this.stateSubject.asObservable().subscribe(n=>{nt(n.activeIds,this.prevState.activeIds)||r({activeIds:n.activeIds})})}subscribeToTracks(r){return this.stateSubject.asObservable().subscribe(n=>{(!nt(n.tracks,this.prevState.tracks)||!nt(n.trackItemIds,this.prevState.trackItemIds)||!nt(n.trackItemsMap,this.prevState.trackItemsMap)||!nt(n.transitionIds,this.prevState.transitionIds)||!nt(n.transitionsMap,this.prevState.transitionsMap)||!nt(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||!nt(n.structure,this.prevState.structure))&&r({tracks:n.tracks,trackItemIds:n.trackItemIds,trackItemsMap:n.trackItemsMap,transitionIds:n.transitionIds,transitionsMap:n.transitionsMap,trackItemDetailsMap:n.trackItemDetailsMap,structure:n.structure})})}undo(){const r=this.undos.pop(),n=r==null?void 0:r.undos,i=r==null?void 0:r.type;if(!n||!i)return;hi();const{trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:_,transitionsMap:D,trackItemsMap:F}=this.getState(),A=Z({trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:_,transitionsMap:D,trackItemsMap:F}),z=[],I=[],f=[],l=[],p=[],g=[];n.forEach(T=>{let k;const H=T.path.slice(1);T.type==="CREATE"?k={path:H,op:"remove",value:T.value}:T.type==="CHANGE"?k={path:H,op:"replace",value:T.oldValue}:k={path:H,op:"add",value:T.oldValue},T.path.includes("trackItemIds")?f.push(k):T.path.includes("transitionIds")?I.push(k):T.path.includes("trackItemsMap")?p.push(k):T.path.includes("transitionsMap")?l.push(k):T.path.includes("tracks")?z.push(k):T.path.includes("trackItemDetailsMap")&&g.push(k)});const v=this.applyPatch(A.tracks,z),E=this.applyPatch(A.transitionIds,I),h=this.applyPatch(A.trackItemIds,f),m=this.applyPatch(A.transitionsMap,l),w=this.applyPatch(A.trackItemsMap,p),P=this.applyPatch(A.trackItemDetailsMap,g),b=Z({tracks:v,transitionIds:E,trackItemIds:h,transitionsMap:m,trackItemsMap:w,trackItemDetailsMap:P}),C=Z(this.getState()),M={...C,...b};this.prevState=C,this.redos.push({redos:n,type:i});const R=Ct(M.trackItemsMap);this.stateSubject.next({...M,duration:R}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((i,s)=>oa(i,c=>{ca(c,[s])}),r)}redo(){const r=this.redos.pop(),n=r==null?void 0:r.redos,i=r==null?void 0:r.type;if(!n||!i)return;hi();const{trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:_,transitionsMap:D,trackItemsMap:F}=this.getState(),A=Z({trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:_,transitionsMap:D,trackItemsMap:F}),z=[],I=[],f=[],l=[],p=[],g=[];n.forEach(T=>{let k;const H=T.path.slice(1);T.type==="CREATE"?k={path:H,op:"add",value:T.value}:T.type==="CHANGE"?k={path:H,op:"replace",value:T.value}:k={path:H,op:"remove",value:T.oldValue},T.path.includes("trackItemIds")?f.push(k):T.path.includes("transitionIds")?I.push(k):T.path.includes("trackItemsMap")?p.push(k):T.path.includes("transitionsMap")?l.push(k):T.path.includes("trackItemDetailsMap")?g.push(k):z.push(k)});const v=this.applyPatch(A.tracks,z),E=this.applyPatch(A.transitionIds,I),h=this.applyPatch(A.trackItemIds,f),m=this.applyPatch(A.transitionsMap,l),w=this.applyPatch(A.trackItemsMap,p),P=this.applyPatch(A.trackItemDetailsMap,g),b=Z({tracks:v,transitionIds:E,trackItemIds:h,transitionsMap:m,trackItemsMap:w,trackItemDetailsMap:P}),C=Z(this.getState()),M={...C,...b};this.prevState=C,this.undos.push({undos:n,type:i});const R=Ct(M.trackItemsMap);this.stateSubject.next({...M,duration:R}),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}}const za="add",Ei="track",vi="trackItems",Ya=`${Ei}:changed`,Ga=`${vi}:changed`,Si="state",Ua=`${Si}:changed`,Vr="design",Xa=`${Vr}:load`,Wa=`${Vr}:resize`,ht="add",Ka=`${ht}:text`,Ba=`${ht}:video`,Va=`${ht}:audio`,Za=`${ht}:placeholder`,Ja=`${ht}:image`,qa=`${ht}:mask`,Ti=`${ht}:items`,Qa=`${ht}:transition`,ts=`${ht}:animation`,es=`${ht}:caption`,rs=`${ht}:template`,jt="edit",ns=`${jt}:object`,is=`${jt}:text`,as=`${jt}:shape`,ss=`${jt}:templateItem`,os=`${jt}:closeTemplate`,cs=`${jt}:deleteTemplateItem`,us="enterEditMode",$t="player",ls=`${$t}:play`,fs=`${$t}:pause`,ds=`${$t}:seek`,ps=`${$t}:seekTo`,hs=`${$t}:seekBy`,ms=`${$t}:togglePlay`,Jt="active",ys=`${Jt}:set`,_s=`${Jt}:delete`,Is=`${Jt}:paste`,gs=`${Jt}:clone`,bs=`${Jt}:split`,it="layer",Es=`${it}:locked`,vs=`${it}:hidden`,Ss=`${it}:move`,Ts=`${it}:select`,As=`${it}:selection`,ws=`${it}:sendTo`,ks=`${it}:rename`,Ds=`${it}:editingName`,Ms=`${it}:copy`,Os=`${it}:paste`,Ps=`${it}:clone`,Rs=`${it}:split`,Cs=`${it}:cut`,Ls=`${it}:delete`,qe="history",xs=`${qe}:undo`,Ns=`${qe}:redo`,Fs=`${qe}:reset`,Ai="scale",Hs=`${Ai}:changed`,Zr="drag",js=`${Zr}:start`,$s=`${Zr}:end`,wi="timeline",zs=`${wi}:boundingChanged`;y.ACTIVE_CLONE=gs,y.ACTIVE_DELETE=_s,y.ACTIVE_PASTE=Is,y.ACTIVE_PREFIX=Jt,y.ACTIVE_SET=ys,y.ACTIVE_SPLIT=bs,y.ADD_ANIMATION=ts,y.ADD_AUDIO=Va,y.ADD_CAPTION=es,y.ADD_IMAGE=Ja,y.ADD_ITEMS=Ti,y.ADD_MASK=qa,y.ADD_PLACEHOLDER=Za,y.ADD_PREFIX=ht,y.ADD_SUFFIX=za,y.ADD_TEMPLATE=rs,y.ADD_TEXT=Ka,y.ADD_TRANSITION=Qa,y.ADD_VIDEO=Ba,y.CLOSE_EDIT_TEMPLATE=os,y.DELETE_TEMPLATE_ITEM=cs,y.DESIGN_LOAD=Xa,y.DESIGN_PREFIX=Vr,y.DESIGN_RESIZE=Wa,y.DRAG_END=$s,y.DRAG_PREFIX=Zr,y.DRAG_START=js,y.EDIT_OBJECT=ns,y.EDIT_PREFIX=jt,y.EDIT_SHAPE=as,y.EDIT_TEMPLATE_ITEM=ss,y.EDIT_TEXT=is,y.ENTER_EDIT_MODE=us,y.HISTORY_PREFIX=qe,y.HISTORY_REDO=Ns,y.HISTORY_RESET=Fs,y.HISTORY_UNDO=xs,y.LAYER_CLONE=Ps,y.LAYER_COPY=Ms,y.LAYER_CUT=Cs,y.LAYER_DELETE=Ls,y.LAYER_EDITING_NAME=Ds,y.LAYER_HIDDEN=vs,y.LAYER_LOCKED=Es,y.LAYER_MOVE=Ss,y.LAYER_PASTE=Os,y.LAYER_PREFIX=it,y.LAYER_RENAME=ks,y.LAYER_SELECT=Ts,y.LAYER_SELECTION=As,y.LAYER_SEND_TO=ws,y.LAYER_SPLIT=Rs,y.PLAYER_PAUSE=fs,y.PLAYER_PLAY=ls,y.PLAYER_PREFIX=$t,y.PLAYER_SEEK=ds,y.PLAYER_SEEK_BY=hs,y.PLAYER_SEEK_TO=ps,y.PLAYER_TOGGLE_PLAY=ms,y.STATE_CHANGED=Ua,y.STATE_PREFIX=Si,y.TIMELINE_BOUNDING_CHANGED=zs,y.TIMELINE_PREFIX=wi,y.TIMELINE_SCALE_CHANGED=Hs,y.TIMELINE_SCALE_PREFIX=Ai,y.TRACKS_CHANGED=Ya,y.TRACK_ITEMS_CHANGED=Ga,y.TRACK_ITEMS_PREFIX=vi,y.TRACK_PREFIX=Ei,y.default=$a,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/state.d.ts
CHANGED
@@ -66,6 +66,7 @@ declare class StateManager implements IStateManager {
|
|
66
66
|
transitionIds: State["transitionIds"];
|
67
67
|
transitionsMap: State["transitionsMap"];
|
68
68
|
trackItemDetailsMap: State["trackItemDetailsMap"];
|
69
|
+
structure: State["structure"];
|
69
70
|
}) => void): import('rxjs').Subscription;
|
70
71
|
undo(): void;
|
71
72
|
applyPatch(json: any, patches: Patch[]): any;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { ITrack, ITrackItem } from '@designcombo/types';
|
2
|
+
|
3
|
+
export declare const findTargetTrack: (trackItemIds: string[], tracks: ITrack[], trackItemsMap: Record<string, ITrackItem>, trackId?: string, trackIndex?: number) => {
|
4
|
+
trackId: string | undefined;
|
5
|
+
trackIndex: number | undefined;
|
6
|
+
};
|