@designcombo/state 0.1.33 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/events.d.ts +69 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1605 -1526
- package/dist/index.umd.js +2 -2
- package/dist/state.d.ts +1 -0
- package/dist/utils/load-item.d.ts +142 -142
- package/package.json +6 -6
package/dist/index.umd.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(y,D){typeof exports=="object"&&typeof module<"u"?D(exports,require("@designcombo/events")):typeof define=="function"&&define.amd?define(["exports","@designcombo/events"],D):(y=typeof globalThis<"u"?globalThis:y||self,D(y.events={},y.events))})(this,function(y,D){"use strict";var zs=Object.defineProperty;var Gs=(y,D,Mt)=>D in y?zs(y,D,{enumerable:!0,configurable:!0,writable:!0,value:Mt}):y[D]=Mt;var Vt=(y,D,Mt)=>Gs(y,typeof D!="symbol"?D+"":D,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 me(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 Er(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 vr(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 Sr(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 Ln(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 Tr=Ln(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 Oe=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 y=lr(h),A=y.next();!A.done;A=y.next()){var F=A.value;F.remove(this)}}catch(p){r={error:p}}finally{try{A&&!A.done&&(n=y.return)&&n.call(y)}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 L=this._finalizers;if(L){this._finalizers=null;try{for(var g=lr(L),f=g.next();!f.done;f=g.next()){var d=f.value;try{Pn(d)}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{f&&!f.done&&(s=g.return)&&s.call(g)}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=Oe.EMPTY;function Dn(t){return t instanceof Oe||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 pi(t){jn.setTimeout(function(){throw t})}function Rn(){}function xe(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=bi,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}(Oe),hi=Function.prototype.bind;function mr(t,r){return hi.call(t,r)}var mi=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){De(i)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(i){De(i)}else De(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){De(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 y;c&&Cn.useDeprecatedNextContext?(y=Object.create(n),y.unsubscribe=function(){return c.unsubscribe()},h={next:n.next&&mr(n.next,y),error:n.error&&mr(n.error,y),complete:n.complete&&mr(n.complete,y)}):h=n}return c.destination=new mi(h),c}return r}(Fn);function De(t){pi(t)}function yi(t){throw t}var bi={closed:!0,next:Rn,error:yi,complete:Rn},gi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function _i(t){return t}function Ii(t){return t.length===0?_i: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=Si(r)?r:new yr(r,n,i);return xe(function(){var h=s,y=h.operator,A=h.source;c.add(y?y.call(c,A):A?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(y){try{r(y)}catch(A){c(A),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[gi]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return Ii(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 vi(t){return t&&_t(t.next)&&_t(t.error)&&_t(t.complete)}function Si(t){return t&&t instanceof Fn||vi(t)&&Dn(t)}var wi=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 wi},r.prototype.next=function(n){var i=this;xe(function(){var s,c;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var h=lr(i.currentObservers),y=h.next();!y.done;y=h.next()){var A=y.value;A.next(n)}}catch(F){s={error:F}}finally{try{y&&!y.done&&(c=h.return)&&c.call(h)}finally{if(s)throw s.error}}}})},r.prototype.error=function(n){var i=this;xe(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;xe(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,y=s.observers;return c||h?xn:(this.currentObservers=null,y.push(n),new Oe(function(){i.currentObservers=null,hr(y,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 Pe={exports:{}};Pe.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=1,c=2,h=9007199254740991,y="[object Arguments]",A="[object Array]",F="[object AsyncFunction]",T="[object Boolean]",L="[object Date]",g="[object Error]",f="[object Function]",d="[object GeneratorFunction]",p="[object Map]",b="[object Number]",v="[object Null]",_="[object Object]",m="[object Promise]",l="[object Proxy]",x="[object RegExp]",E="[object Set]",I="[object String]",P="[object Symbol]",S="[object Undefined]",D="[object WeakMap]",w="[object ArrayBuffer]",M="[object DataView]",z="[object Float32Array]",R="[object Float64Array]",B="[object Int8Array]",j="[object Int16Array]",Wt="[object Int32Array]",Tt="[object Uint8Array]",ht="[object Uint8ClampedArray]",U="[object Uint16Array]",ue="[object Uint32Array]",Nr=/[\\^$.*+?()[\]{}|]/g,ut=/^\[object .+?Constructor\]$/,Ne=/^(?:0|[1-9]\d*)$/,G={};G[z]=G[R]=G[B]=G[j]=G[Wt]=G[Tt]=G[ht]=G[U]=G[ue]=!0,G[y]=G[A]=G[w]=G[T]=G[M]=G[L]=G[g]=G[f]=G[p]=G[b]=G[_]=G[x]=G[E]=G[I]=G[D]=!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,le=We&&We.exports===Ue,fe=le&&Le.process,Ge=function(){try{return fe&&fe.binding&&fe.binding("util")}catch{}}(),de=Ge&&Ge.isTypedArray;function Be(e,a){for(var o=-1,u=e==null?0:e.length,C=0,k=[];++o<u;){var N=e[o];a(N,o,e)&&(k[C++]=N)}return k}function pe(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 he(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__"],me=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("^"+me.call(ct).replace(Nr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ye=le?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,be=ye?ye.isBuffer:void 0,Rt=Ye(Object.keys,Object),ge=vt(lt,"DataView"),Ft=vt(lt,"Map"),_e=vt(lt,"Promise"),Ie=vt(lt,"Set"),ve=vt(lt,"WeakMap"),Et=vt(Object,"create"),Ze=et(ge),It=et(Ft),$r=et(_e),Kr=et(Ie),Yr=et(ve),Je=Kt?Kt.prototype:void 0,Se=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 we(){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=we,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),N=o||u||C||k,H=N?Ur(e.length,String):[],$=H.length;for(var W in e)ct.call(e,W)&&!(N&&(W=="length"||C&&(W=="offset"||W=="parent")||k&&(W=="buffer"||W=="byteLength"||W=="byteOffset")||Sn(W,$)))&&H.push(W);return H}function Zt(e,a){for(var o=e.length;o--;)if(nr(e[o][0],a))return o;return-1}function ke(e,a,o){var u=a(e);return Jt(e)?u:pe(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)==y}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 N=Jt(e),H=Jt(a),$=N?A:bt(e),W=H?A:bt(a);$=$==y?_:$,W=W==y?_:W;var J=$==_,nt=W==_,V=$==W;if(V&&Qt(e)){if(!Qt(a))return!1;N=!0,J=!1}if(V&&!J)return k||(k=new yt),N||or(e)?Te(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)&&Me(e.length)&&!!G[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 Te(e,a,o,u,C,k){var N=o&s,H=e.length,$=a.length;if(H!=$&&!(N&&$>H))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<H;){var Q=e[J],q=a[J];if(u)var Mt=N?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,N){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 L:case b:return nr(+e,+a);case g:return e.name==a.name&&e.message==a.message;case x:case I:return e==a+"";case p:var H=Ke;case E:var $=u&s;if(H||(H=mt),e.size!=a.size&&!$)return!1;var W=N.get(e);if(W)return W==a;u|=c,N.set(e,a);var J=Te(H(e),H(a),u,C,k,N);return N.delete(e),J;case P:if(Se)return Se.call(e)==Se.call(a)}return!1}function In(e,a,o,u,C,k){var N=o&s,H=Ht(e),$=H.length,W=Ht(a),J=W.length;if($!=J&&!N)return!1;for(var nt=$;nt--;){var V=H[nt];if(!(N?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=N;++nt<$;){V=H[nt];var wt=e[V],Nt=a[V];if(u)var di=N?u(Nt,wt,V,a,e,k):u(wt,Nt,V,e,a,k);if(!(di===void 0?wt===Nt||C(wt,Nt,o,u,k):di)){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 ke(e,Ae,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=he(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;(ge&&bt(new ge(new ArrayBuffer(1)))!=M||Ft&&bt(new Ft)!=p||_e&&bt(_e.resolve())!=m||Ie&&bt(new Ie)!=E||ve&&bt(new ve)!=D)&&(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 m;case Kr:return E;case Yr:return D}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 me.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 Ee(e){return e!=null&&Me(e.length)&&!ar(e)}var Qt=be||An;function En(e,a){return er(e,a)}function ar(e){if(!sr(e))return!1;var a=zt(e);return a==f||a==d||a==F||a==l}function Me(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=de?Wr(de):bn;function Ae(e){return Ee(e)?hn(e):gn(e)}function Mn(){return[]}function An(){return!1}t.exports=En}(Pe,Pe.exports);var ki=Pe.exports;const it=br(ki);var Ce={exports:{}};Ce.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,c="[object Arguments]",h="[object Array]",y="[object Boolean]",A="[object Date]",F="[object Error]",T="[object Function]",L="[object GeneratorFunction]",g="[object Map]",f="[object Number]",d="[object Object]",p="[object Promise]",b="[object RegExp]",v="[object Set]",_="[object String]",m="[object Symbol]",l="[object WeakMap]",x="[object ArrayBuffer]",E="[object DataView]",I="[object Float32Array]",P="[object Float64Array]",S="[object Int8Array]",D="[object Int16Array]",w="[object Int32Array]",M="[object Uint8Array]",z="[object Uint8ClampedArray]",R="[object Uint16Array]",B="[object Uint32Array]",j=/[\\^$.*+?()[\]{}|]/g,Wt=/\w*$/,Tt=/^\[object .+?Constructor\]$/,ht=/^(?:0|[1-9]\d*)$/,U={};U[c]=U[h]=U[x]=U[E]=U[y]=U[A]=U[I]=U[P]=U[S]=U[D]=U[w]=U[g]=U[f]=U[d]=U[b]=U[v]=U[_]=U[m]=U[M]=U[z]=U[R]=U[B]=!0,U[F]=U[T]=U[l]=!1;var ue=typeof ot=="object"&&ot&&ot.Object===Object&&ot,Nr=typeof self=="object"&&self&&self.Object===Object&&self,ut=ue||Nr||Function("return this")(),Ne=r&&!r.nodeType&&r,G=Ne&&!0&&t&&!t.nodeType&&t,Le=G&&G.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 le(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 fe(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 de(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 pe(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,he=ut["__core-js_shared__"],Ke=function(){var e=/[^.]+$/.exec(he&&he.keys&&he.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,me=ut.Uint8Array,ct=pe(Object.getPrototypeOf,Object),Ve=Object.create,Xe=Gt.propertyIsEnumerable,Br=Ur.splice,ye=Object.getOwnPropertySymbols,Kt=Ct?Ct.isBuffer:void 0,qe=pe(Object.keys,Object),Yt=dt(ut,"DataView"),jt=dt(ut,"Map"),ft=dt(ut,"Promise"),Vt=dt(ut,"Set"),be=dt(ut,"WeakMap"),Rt=dt(Object,"create"),ge=et(Yt),Ft=et(jt),_e=et(ft),Ie=et(Vt),ve=et(be),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 Se(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=Se;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=Ee(e)||Jt(e)?fe(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&&Te(a,Ae(a),e)}function we(e,a,o,u,C,k,N){var H;if(u&&(H=k?u(e,C,k,N):u(e)),H!==void 0)return H;if(!gt(e))return e;var $=Ee(e);if($){if(H=vn(e),!a)return gn(e,H)}else{var W=St(e),J=W==T||W==L;if(ar(e))return Zt(e,a);if(W==d||W==c||J&&!k){if(de(e))return k?e:{};if(H=bt(J?{}:e),!a)return _n(e,yt(H,e))}else{if(!U[W])return k?e:{};H=Sn(e,W,we,a)}}N||(N=new rt);var nt=N.get(e);if(nt)return nt;if(N.set(e,H),!$)var V=o?In(e):Ae(e);return Ue(V||e,function(Q,q){V&&(q=Q,Q=e[q]),Qe(H,q,we(Q,a,o,u,q,e,N))}),H}function ln(e){return gt(e)?Ve(e):{}}function fn(e,a,o){var u=a(e);return Ee(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=Me(e)||de(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 ke(e){var a=new e.constructor(e.byteLength);return new me(a).set(new me(e)),a}function zt(e,a){var o=a?ke(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 le(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 le(u,lt,new e.constructor)}function yn(e){return Ze?Object(Ze.call(e)):{}}function bn(e,a){var o=a?ke(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 Te(e,a,o,u){o||(o={});for(var C=-1,k=a.length;++C<k;){var N=a[C],H=void 0;Qe(o,N,H===void 0?e[N]:H)}return o}function _n(e,a){return Te(e,vt(e),a)}function In(e){return fn(e,Ae,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=ye?pe(ye,Object):Mn,St=dn;(Yt&&St(new Yt(new ArrayBuffer(1)))!=E||jt&&St(new jt)!=g||ft&&St(ft.resolve())!=p||Vt&&St(new Vt)!=v||be&&St(new be)!=l)&&(St=function(e){var a=Bt.call(e),o=a==d?e.constructor:void 0,u=o?et(o):void 0;if(u)switch(u){case ge:return E;case Ft:return g;case _e:return p;case Ie:return v;case ve:return l}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 x:return ke(e);case y:case A:return new C(+e);case E:return zt(e,u);case I:case P:case S:case D:case w:case M:case z:case R:case B:return bn(e,u);case g:return tr(e,u,o);case f:case _:return new C(e);case b:return er(e);case v:return mn(e,u,o);case m: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 we(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 Ee=Array.isArray;function Qt(e){return e!=null&&sr(e.length)&&!Me(e)}function En(e){return or(e)&&Qt(e)}var ar=Kt||An;function Me(e){var a=gt(e)?Bt.call(e):"";return a==T||a==L}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 Ae(e){return Qt(e)?Xt(e):hn(e)}function Mn(){return[]}function An(){return!1}t.exports=nr}(Ce,Ce.exports);var Ti=Ce.exports;const K=br(Ti),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}),Ei=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))})},je={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 Re(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=Re(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||je,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 Ei(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}},Mi=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,y=t.display,A=t.trim||t.display;let F=1/0,T=0;const L=n.map(f=>{const d=t.trackItemsMap[f],p=t.trackItemsDetails[f];if(d.display.from<F&&(F=d.display.from),d.display.to>T&&(T=d.display.to),d.type==="text")return wr({...d,details:p.details},{size:i});if(d.type==="image")return vr({...d,details:p.details},{size:i});if(d.type==="video")return _r({...d,details:p.details},{size:i});if(d.type==="audio")return Ir({...d,details:p.details});if(d.type==="caption")return Sr({...d,details:p.details},{size:i})}),g=await Promise.all(L);return{id:t.id,details:g,size:i,position:{top:h.top||0,left:h.left||0},trim:A,scale:s,display:y||{from:F,to:T},rotate:c,activeEdit:!1}},vr=async(t,r)=>{const n=t.details,i=await Wn(n.src),s=Re(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||je,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),y=Re(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||y.top,left:c.left||y.left,borderWidth:s.borderWidth||0,borderColor:s.borderColor||"#000000",boxShadow:s.boxShadow||je,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=Re(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||je},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"}),Ai="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ee=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=Ai[n[t]&63];return r};function Oi(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=ee(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);function Yn(t,r,n){return Math.min(Math.max(t,r),n)}const xi=(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[Yn(s,0,r.length)]:r.find(A=>A.id===i);if(!c)return{trackId:void 0,trackIndex:s!==void 0?Yn(s,0,r.length):void 0};const h=c.items.map(A=>n[A]),y=t.map(A=>n[A]);for(const A of h){const F=A.display.from,T=A.display.to;for(const L of y){const g=L.display.from;if(!(L.display.to<=F||g>=T))return{trackId:void 0,trackIndex:r.indexOf(c)}}}return{trackId:c.id,trackIndex:r.indexOf(c)}};function Di(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))),h=O.subject.pipe(O.filter(({key:f})=>f.startsWith(O.EDIT_PREFIX))),y=r.subscribe(async f=>{var d,p;if(f.key===O.DESIGN_LOAD){const b=(d=f.value)==null?void 0:d.payload,v=b.size,_=b.trackItemIds,m=b.trackItemsMap,l=b.trackItemDetailsMap;console.warn("IMPROVE FONTS LOADING");const x=_.map(async I=>{var P;try{const S=l[I],D=m[I];if(S.type==="image"){const w=await vr({id:I,details:S.details,...D},{size:v}),{details:M,...z}=w;l[I]={type:"image",details:M},m[I]=z}else if(S.type==="video"){const w=K((P=f.value)==null?void 0:P.payload.trackItemsMap[I]),M=await _r({...S,...w,...D},{size:v}),{details:z,...R}=M;l[I]={type:"video",details:z},m[I]=R}else if(S.type==="audio"){const w=await Ir({id:I,details:S.details,...D}),{details:M,...z}=w;l[I]={type:"audio",details:M},m[I]=z}else if(S.type==="caption"){const w=await Sr({id:I,details:S.details,...D},{size:v}),{details:M,...z}=w;l[I]={type:"caption",details:M},m[I]=z}else if(S.type==="text"){const w=await wr({id:I,details:S.details,...D},{size:v}),{details:M,...z}=w;l[I]={type:"text",details:M},m[I]=z}return!0}catch{return!1}});await Promise.all(x);const E=Ut(m);t.updateState({...b,trackItemsMap:m,duration:E})}if(f.key===O.DESIGN_RESIZE){const b=(p=f.value)==null?void 0:p.payload;t.updateState({size:b})}}),A=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 b,v,_,m;const d=[],p=[];if((b=f.value)!=null&&b.payload.trackItemIds&&(d.push((v=f.value)==null?void 0:v.payload.trackItemIds),t.updateState({activeIds:d})),f.key===O.LAYER_DELETE){const l=(_=f.value)==null?void 0:_.payload.trackItemIds,x=K(t.getState()),E=l&&l.length?l:x.activeIds,I=x.trackItemIds,P=x.trackItemDetailsMap,S=I.filter(R=>!E.includes(R)),D=Object.fromEntries(Object.entries(P).filter(([R])=>!E.includes(R))),w=Oi(x.tracks,E),M=Object.fromEntries(Object.entries(x.trackItemsMap).filter(([R])=>!E.includes(R))),z=Ut(M);t.updateState({trackItemIds:S,trackItemDetailsMap:D,activeIds:[],trackItemsMap:M,tracks:w,duration:z},{updateHistory:!0,kind:"remove"})}if(f.key===O.LAYER_CLONE){const l=K(t.getState()),x=((m=f.value)==null?void 0:m.payload.trackItemIds)||l.activeIds;if(x.length===0)return;x.forEach(I=>{const P=l.trackItemsMap[I],S=l.trackItemDetailsMap[I],D=kr();p.push(D),l.trackItemsMap={...l.trackItemsMap,[D]:{...K(P),id:D}},l.trackItemDetailsMap={...l.trackItemDetailsMap,[D]:{...K(S)}},l.trackItemIds.push(D)});const E=[];l.tracks.forEach(I=>{const P={...I,items:[],id:ee()};I.items.forEach(S=>{if(x.includes(S)){const D=x.indexOf(S);P.items.push(p[D])}}),E.push(P)}),E.forEach(I=>{I.items.length!==0&&l.tracks.unshift(I)}),t.updateState({trackItemDetailsMap:l.trackItemDetailsMap,tracks:l.tracks,trackItemIds:l.trackItemIds,trackItemsMap:l.trackItemsMap},{updateHistory:!0,kind:"update"})}}),T=n.subscribe(async f=>{var l,x,E,I,P,S,D,w,M,z;const d=K(t.getState());let p=[],b="text";const v=(x=(l=f.value)==null?void 0:l.options)==null?void 0:x.trackId;let _=(I=(E=f.value)==null?void 0:E.options)==null?void 0:I.trackIndex;if(f.key===O.ADD_CAPTION){b="caption";const R=(P=f.value)==null?void 0:P.payload,B=[];for(const Tt of R){const ht=Sr(Tt,{size:d.size});B.push(ht)}const j=await Promise.all(B),Wt=[];for(const Tt of j){const ht=Tt.id;Wt.push(ht);const{details:U,...ue}=Tt;d.trackItemDetailsMap[ht]={type:b,details:U},d.trackItemsMap[ht]=ue,d.trackItemIds.push(ht)}p=Wt}if(f.key===O.ADD_TEXT){b="text";const R=await wr((S=f.value)==null?void 0:S.payload,{size:d.size}),{details:B,...j}=R;d.trackItemDetailsMap[j.id]={type:b,details:B},d.trackItemsMap[j.id]=j,d.trackItemIds.push(j.id),p=[j.id]}if(f.key===O.ADD_TEMPLATE){b="template";const R=await Mi((D=f.value)==null?void 0:D.payload,{size:d.size}),{details:B,...j}=R;d.trackItemsMap[R.id]={...j,type:"template"},d.trackItemIds.push(j.id),d.trackItemDetailsMap[j.id]={type:"template",details:B},p=[j.id]}if(f.key===O.ADD_IMAGE){b="image";const R=await vr((w=f.value)==null?void 0:w.payload,{size:d.size}),{details:B,...j}=R;d.trackItemDetailsMap[j.id]={type:b,details:B},d.trackItemsMap[j.id]=j,d.trackItemIds.push(j.id),p=[j.id]}if(f.key===O.ADD_AUDIO){b="audio";const R=await Ir((M=f.value)==null?void 0:M.payload),{details:B,...j}=R;d.trackItemDetailsMap[j.id]={type:b,details:B},d.trackItemsMap[j.id]=j,d.trackItemIds.push(j.id),p=[j.id]}if(f.key===O.ADD_VIDEO){b="video";const R=await _r((z=f.value)==null?void 0:z.payload,{size:d.size}),{details:B,...j}=R;d.trackItemDetailsMap[j.id]={type:b,details:B},d.trackItemsMap[j.id]=j,d.trackItemIds.push(j.id),p=[j.id]}const m=xi(p,d.tracks,d.trackItemsMap,v,_);if(m.trackId){const R=d.tracks.find(B=>B.id===m.trackId);R&&R.items.push(...p)}else if(m.trackIndex!==void 0){const R={id:ee(),accepts:["text","audio","helper","video","image","caption","template"],type:b,items:p,magnetic:!1,static:!1};d.tracks.splice(m.trackIndex,0,R)}else d.tracks.unshift({id:ee(),accepts:["text","audio","helper","video","image","caption","template"],type:b,items:p,magnetic:!1,static:!1});d.duration=Ut(d.trackItemsMap),t.updateState({trackItemIds:d.trackItemIds,trackItemDetailsMap:d.trackItemDetailsMap,trackItemsMap:d.trackItemsMap,tracks:d.tracks,duration:d.duration},{updateHistory:!0,kind:"add"})}),L=c.subscribe(async f=>{var d;if(f.key===O.ACTIVE_SPLIT){const p=K(t.getState()),b=(d=f.value)==null?void 0:d.options.time;if(p.activeIds.length===1){const v=p.activeIds[0],_=p.trackItemsMap[v];if(b>=_.display.to||b<=_.display.from)return;const m=p.trackItemDetailsMap[v],l=kr(),x={..._,id:l,display:{from:b,to:_.display.to},trim:{from:b,to:_.display.to}};p.trackItemsMap[v].display.to=b,p.trackItemsMap[l]=x,p.trackItemIds.push(l),p.trackItemDetailsMap[l]=m,p.tracks.forEach(E=>{E.items.includes(v)&&E.items.push(l)}),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=K(t.getState());if(p.activeIds.length){const b=p.activeIds,v=[],_={activeIds:b,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};b.forEach(l=>{_.trackItemDetailsMap[l]=p.trackItemDetailsMap[l],_.trackItemsMap[l]=p.trackItemsMap[l],v.push(p.tracks.find(x=>x.items.includes(l)))});const m=new Set;v.filter(l=>m.has(l.id)?!1:(m.add(l),!0)),_.tracks=Array.from(m.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(_))}}if(f.key===O.ACTIVE_PASTE){const p=localStorage.getItem("DesignComboTemp");if(!p)return;const b=K(t.getState()),v=JSON.parse(p),_={},m=v.trackItemsMap,l=v.trackItemDetailsMap,x=v.tracks,E=[],I=v.activeIds.map(async P=>{const S=l[P];(S.type==="caption"||S.type==="text")&&S.details.fontUrl&&await gr([{fontFamily:S.details.fontFamily,url:S.details.fontUrl}]);const D=kr();return _[P]=D,b.trackItemsMap[D]={...m[P],id:D},b.trackItemDetailsMap[D]=S,b.trackItemIds.push(D),!0});await Promise.all(I),x.forEach(P=>{const S=P.items.map(w=>_[w]),D={...P,items:S,id:ee()};E.push(D)}),b.tracks=[...b.tracks,...E],t.updateState({trackItemDetailsMap:b.trackItemDetailsMap,tracks:b.tracks,trackItemIds:b.trackItemIds,trackItemsMap:b.trackItemsMap},{updateHistory:!0,kind:"update"})}}),g=h.subscribe(async f=>{var d,p,b,v;if(f.key===O.DELETE_TEMPLATE_ITEM){const _=K(t.getState()),[m]=(d=f.value)==null?void 0:d.payload.trackItemIds,l=_.trackItemDetailsMap;_.trackItemIds.forEach(E=>{const I=l[E];if(I.type==="template"&&I.details.map(S=>S.id).includes(m)){const S=I.details.filter(D=>D.id!==m);I.details=S}}),t.updateState({trackItemDetailsMap:{...l}},{updateHistory:!0,kind:"update"})}if(f.key===O.EDIT_OBJECT){const _=K(t.getState()),m=_.trackItemDetailsMap,l=_.trackItemsMap,x=Object.keys((p=f.value)==null?void 0:p.payload);if(!x.length)return;const E=(b=f.value)==null?void 0:b.payload;x.forEach(P=>{const S=E[P];S.details?m[P].details={...m[P].details,...S.details}:E[P].playbackRate?l[P].playbackRate=E[P].playbackRate:m[P].type==="template"&&(l[P]={...l[P],...E[P]})});const I=Ut(l);t.updateState({trackItemDetailsMap:{...m},trackItemsMap:{...l},duration:I},{updateHistory:!0,kind:"update:details"})}if(f.key===O.EDIT_TEMPLATE_ITEM){const _=(v=f.value)==null?void 0:v.payload,m=Object.keys(_)[0],l=Object.values(_)[0],x=K(t.getState());for(const E of x.trackItemIds)if(x.trackItemsMap[E].type==="template"){const I=x.trackItemDetailsMap[E];if(I.details.map(S=>S.id).includes(m)){for(let S of I.details)if(S.id===m){if(l.details){if(l.type==="image"&&l.details.src){const w=await Wn(l.details.src),M=S.details.width,z=S.details.height;let R=w.width,B=w.height;const j=w.width/w.height;M/z>j?(R=M,B=M/j):(B=z,R=z*j),l.details.mediaWidth=R,l.details.mediaHeight=B}if(l.type==="video"&&l.details.src){const w=await Gn(l.details.src),M=S.details.width,z=S.details.height;let R=w.width,B=w.height;const j=w.width/w.height;M/z>j?(R=M,B=M/j):(B=z,R=z*j),l.details.mediaWidth=R,l.details.mediaHeight=B}const D=S.details;S.details={...D,...l.details},l.details=S.details}S={...S,...l},x.trackItemDetailsMap[E].details=I.details.map(D=>D.id===m?S:D)}}}t.updateState({trackItemDetailsMap:{...x.trackItemDetailsMap}},{updateHistory:!0,kind:"update:details"})}if(f.key===O.CLOSE_EDIT_TEMPLATE){const _=K(t.getState());_.trackItemIds.forEach(m=>{const l=_.trackItemsMap[m];l.type==="template"&&(l.activeEdit=!1,t.updateState({trackItemsMap:{..._.trackItemsMap,[m]:l},activeIds:[]}))})}});return{unsubscribe:()=>{T.unsubscribe(),L.unsubscribe(),g.unsubscribe(),A.unsubscribe(),F.unsubscribe(),y.unsubscribe()}}}const Pi={Date:!0,RegExp:!0,String:!0,Number:!0};function Vn(t,r,n={cyclesFix:!0},i=[]){var y,A;let s=[];const c=Array.isArray(t);for(const F in t){const T=t[F],L=c?+F:F;if(!(F in r)){s.push({type:"REMOVE",path:[L],oldValue:t[F]});continue}const g=r[F],f=typeof T=="object"&&typeof g=="object"&&Array.isArray(T)===Array.isArray(g);if(T&&g&&f&&!Pi[(A=(y=Object.getPrototypeOf(T))==null?void 0:y.constructor)==null?void 0:A.name]&&(!n.cyclesFix||!i.includes(T))){const d=Vn(T,g,n,n.cyclesFix?i.concat([T]):[]);s.push.apply(s,d.map(p=>(p.path.unshift(L),p)))}else T!==g&&!(Number.isNaN(T)&&Number.isNaN(g))&&!(f&&(isNaN(T)?T+""==g+"":+T==+g))&&s.push({path:[L],type:"CHANGE",value:g,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"),re=Symbol.for("immer-draftable"),at=Symbol.for("immer-state"),Xn=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=Xn[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?qn(t)||Array.isArray(t)||!!t[re]||!!((r=t.constructor)!=null&&r[re])||ae(t)||se(t):!1}var Ci=Object.prototype.constructor.toString();function qn(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)===Ci}function ne(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:ae(t)?2:se(t)?3:0}function ie(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 Zn(t,r,n){const i=xt(t);i===2?t.set(r,n):i===3?t.add(n):t[r]=n}function ji(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function ae(t){return t instanceof Map}function se(t){return t instanceof Set}function Dt(t){return t.copy_||t.base_}function Mr(t,r){if(ae(t))return new Map(t);if(se(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=qn(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],y=i[h];y.writable===!1&&(y.writable=!0,y.configurable=!0),(y.get||y.set)&&(i[h]={configurable:!0,writable:!0,enumerable:y.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=Ri),Object.freeze(t),r&&Object.entries(t).forEach(([n,i])=>Ar(i,!0))),t}function Ri(){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 Fi(t,r){Or[t]||(Or[t]=r)}var oe;function Jn(){return oe}function zi(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Qn(t,r){r&&(Pt("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function xr(t){Dr(t),t.drafts_.forEach(Hi),t.drafts_=null}function Dr(t){t===oe&&(oe=t.parent_)}function ti(t){return oe=zi(oe,t)}function Hi(t){const r=t[at];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function ei(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 ne(r,(s,c)=>ri(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),ne(c,(y,A)=>ri(t,i,s,y,A,n,h)),He(t,s,!1),n&&t.patches_&&Pt("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function ri(t,r,n,i,s,c,h){if(process.env.NODE_ENV!=="production"&&s===n&&Y(5),Ot(s)){const y=c&&r&&r.type_!==3&&!ie(r.assigned_,i)?c.concat(i):void 0,A=ze(t,s,y);if(Zn(n,i,A),Ot(A))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 Ni(t,r){const n=Array.isArray(t),i={type_:n?1:0,scope_:r?r.scope_:Jn(),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=ce);const{revoke:h,proxy:y}=Proxy.revocable(s,c);return i.draft_=y,i.revoke_=h,y}var Pr={get(t,r){if(r===at)return t;const n=Dt(t);if(!ie(n,r))return Li(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=ni(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(ji(n,s)&&(n!==void 0||ie(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)}},ce={};ne(Pr,(t,r)=>{ce[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),ce.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&Y(13),ce.set.call(this,t,r,void 0)},ce.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 Li(t,r,n){var s;const i=ni(r,n);return i?"value"in i?i.value:(s=i.get)==null?void 0:s.call(t.draft_):void 0}function ni(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 Ui=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(A=c,...F){return h.produce(A,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=ti(this),h=Fr(r,void 0);let y=!0;try{s=n(h),y=!1}finally{y?xr(c):Dr(c)}return Qn(c,i),ei(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,...y)=>this.produceWithPatches(h,A=>r(A,...y));let i,s;return[this.produce(r,n,(h,y)=>{i=h,s=y}),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=Wi(t));const r=ti(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 Qn(i,r),ei(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=ae(t)?Pt("MapSet").proxyMap_(t,r):se(t)?Pt("MapSet").proxySet_(t,r):Ni(t,r);return(r?r.scope_:Jn()).drafts_.push(n),n}function Wi(t){return Ot(t)||Y(10,t),ii(t)}function ii(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 ne(n,(i,s)=>{Zn(n,i,ii(s))}),r&&(r.finalized_=!1),n}function ai(){process.env.NODE_ENV!=="production"&&Xn.push('Sets cannot have "replace" patches.',function(g){return"Unsupported patch operation: "+g},function(g){return"Cannot apply patch, path doesn't resolve: "+g},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",i="remove";function s(g,f,d,p){switch(g.type_){case 0:case 2:return h(g,f,d,p);case 1:return c(g,f,d,p);case 3:return y(g,f,d,p)}}function c(g,f,d,p){let{base_:b,assigned_:v}=g,_=g.copy_;_.length<b.length&&([b,_]=[_,b],[d,p]=[p,d]);for(let m=0;m<b.length;m++)if(v[m]&&_[m]!==b[m]){const l=f.concat([m]);d.push({op:r,path:l,value:L(_[m])}),p.push({op:r,path:l,value:L(b[m])})}for(let m=b.length;m<_.length;m++){const l=f.concat([m]);d.push({op:n,path:l,value:L(_[m])})}for(let m=_.length-1;b.length<=m;--m){const l=f.concat([m]);p.push({op:i,path:l})}}function h(g,f,d,p){const{base_:b,copy_:v}=g;ne(g.assigned_,(_,m)=>{const l=Er(b,_),x=Er(v,_),E=m?ie(b,_)?r:n:i;if(l===x&&E===r)return;const I=f.concat(_);d.push(E===i?{op:E,path:I}:{op:E,path:I,value:x}),p.push(E===n?{op:i,path:I}:E===i?{op:n,path:I,value:L(l)}:{op:r,path:I,value:L(l)})})}function y(g,f,d,p){let{base_:b,copy_:v}=g,_=0;b.forEach(m=>{if(!v.has(m)){const l=f.concat([_]);d.push({op:i,path:l,value:m}),p.unshift({op:n,path:l,value:m})}_++}),_=0,v.forEach(m=>{if(!b.has(m)){const l=f.concat([_]);d.push({op:n,path:l,value:m}),p.unshift({op:i,path:l,value:m})}_++})}function A(g,f,d,p){d.push({op:r,path:[],value:f===Tr?void 0:f}),p.push({op:r,path:[],value:g})}function F(g,f){return f.forEach(d=>{const{path:p,op:b}=d;let v=g;for(let x=0;x<p.length-1;x++){const E=xt(v);let I=p[x];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),m=T(d.value),l=p[p.length-1];switch(b){case r:switch(_){case 2:return v.set(l,m);case 3:Y(16);default:return v[l]=m}case n:switch(_){case 1:return l==="-"?v.push(m):v.splice(l,0,m);case 2:return v.set(l,m);case 3:return v.add(m);default:return v[l]=m}case i:switch(_){case 1:return v.splice(l,1);case 2:return v.delete(l);case 3:return v.delete(d.value);default:return delete v[l]}default:Y(17,b)}}),g}function T(g){if(!kt(g))return g;if(Array.isArray(g))return g.map(T);if(ae(g))return new Map(Array.from(g.entries()).map(([d,p])=>[d,T(p)]));if(se(g))return new Set(Array.from(g).map(T));const f=Object.create(At(g));for(const d in g)f[d]=T(g[d]);return ie(g,re)&&(f[re]=g[re]),f}function L(g){return Ot(g)?T(g):g}Fi("Patches",{applyPatches_:F,generatePatches_:s,generateReplacementPatches_:A})}var st=new Ui,Gi=st.produce;st.produceWithPatches.bind(st),st.setAutoFreeze.bind(st),st.setUseStrictShallowCopy.bind(st);var Bi=st.applyPatches.bind(st);st.createDraft.bind(st),st.finishDraft.bind(st);var $i=1/0,Ki=9007199254740991,Yi="[object Arguments]",Vi="[object Function]",Xi="[object GeneratorFunction]",qi="[object Symbol]",Zi=typeof ot=="object"&&ot&&ot.Object===Object&&ot,Ji=typeof self=="object"&&self&&self.Object===Object&&self,Qi=Zi||Ji||Function("return this")();function ta(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 ea(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 ra(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,na=zr.hasOwnProperty,Hr=zr.toString,si=Qi.Symbol,ia=zr.propertyIsEnumerable,oi=si?si.isConcatSpreadable:void 0,ci=Math.max;function aa(t,r,n,i,s){var c=-1,h=t.length;for(n||(n=ua),s||(s=[]);++c<h;){var y=t[c];n(y)?ra(s,y):s[s.length]=y}return s}function sa(t,r){return t=Object(t),oa(t,r,function(n,i){return i in t})}function oa(t,r,n){for(var i=-1,s=r.length,c={};++i<s;){var h=r[i],y=t[h];n(y,h)&&(c[h]=y)}return c}function ca(t,r){return r=ci(r===void 0?t.length-1:r,0),function(){for(var n=arguments,i=-1,s=ci(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,ta(t,this,h)}}function ua(t){return da(t)||fa(t)||!!(oi&&t&&t[oi])}function la(t){if(typeof t=="string"||ga(t))return t;var r=t+"";return r=="0"&&1/t==-$i?"-0":r}function fa(t){return ha(t)&&na.call(t,"callee")&&(!ia.call(t,"callee")||Hr.call(t)==Yi)}var da=Array.isArray;function pa(t){return t!=null&&ya(t.length)&&!ma(t)}function ha(t){return ui(t)&&pa(t)}function ma(t){var r=ba(t)?Hr.call(t):"";return r==Vi||r==Xi}function ya(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ki}function ba(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function ui(t){return!!t&&typeof t=="object"}function ga(t){return typeof t=="symbol"||ui(t)&&Hr.call(t)==qi}var _a=ca(function(t,r){return t==null?{}:sa(t,ea(aa(r),la))}),Ia=_a;const li=br(Ia),va={size:{width:1080,height:1920},tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1,index:1},duration:0,activeIds:[],trackItemDetailsMap:{}},fi=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds"];class Sa{constructor(r){Lt(this,"stateSubject");Lt(this,"stateHistorySubject");Lt(this,"prevState");Lt(this,"undos",[]);Lt(this,"redos",[]);Lt(this,"listener");const n=r||va;this.stateSubject=new Un(n),this.stateHistorySubject=new Un({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){Di(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const i=li(r,fi),s=li(this.getState(),fi),c=Vn(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;ai();const{trackItemDetailsMap:s,trackItemIds:c,tracks:h,transitionIds:y,transitionsMap:A,trackItemsMap:F}=this.getState(),T=K({trackItemDetailsMap:s,trackItemIds:c,tracks:h,transitionIds:y,transitionsMap:A,trackItemsMap:F}),L=[],g=[],f=[],d=[],p=[],b=[];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")?f.push(M):w.path.includes("transitionIds")?g.push(M):w.path.includes("trackItemsMap")?p.push(M):w.path.includes("transitionsMap")?d.push(M):w.path.includes("tracks")?L.push(M):w.path.includes("trackItemDetailsMap")&&b.push(M)});const v=this.applyPatch(T.tracks,L),_=this.applyPatch(T.transitionIds,g),m=this.applyPatch(T.trackItemIds,f),l=this.applyPatch(T.transitionsMap,d),x=this.applyPatch(T.trackItemsMap,p),E=this.applyPatch(T.trackItemDetailsMap,b),I=K({tracks:v,transitionIds:_,trackItemIds:m,transitionsMap:l,trackItemsMap:x,trackItemDetailsMap:E}),P=K(this.getState()),S={...P,...I};this.prevState=P,this.redos.push({redos:n,type:i});const D=Ut(S.trackItemsMap);this.stateSubject.next({...S,duration:D}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((i,s)=>Gi(i,c=>{Bi(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;ai();const{trackItemDetailsMap:s,trackItemIds:c,tracks:h,transitionIds:y,transitionsMap:A,trackItemsMap:F}=this.getState(),T=K({trackItemDetailsMap:s,trackItemIds:c,tracks:h,transitionIds:y,transitionsMap:A,trackItemsMap:F}),L=[],g=[],f=[],d=[],p=[],b=[];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")?f.push(M):w.path.includes("transitionIds")?g.push(M):w.path.includes("trackItemsMap")?p.push(M):w.path.includes("transitionsMap")?d.push(M):w.path.includes("trackItemDetailsMap")?b.push(M):L.push(M)});const v=this.applyPatch(T.tracks,L),_=this.applyPatch(T.transitionIds,g),m=this.applyPatch(T.trackItemIds,f),l=this.applyPatch(T.transitionsMap,d),x=this.applyPatch(T.trackItemsMap,p),E=this.applyPatch(T.trackItemDetailsMap,b),I=K({tracks:v,transitionIds:_,trackItemIds:m,transitionsMap:l,trackItemsMap:x,trackItemDetailsMap:E}),P=K(this.getState()),S={...P,...I};this.prevState=P,this.undos.push({undos:n,type:i});const D=Ut(S.trackItemsMap);this.stateSubject.next({...S,duration:D}),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}}return Sa});
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}});function Ar(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var Ge=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 _=Er(d),w=_.next();!w.done;w=_.next()){var N=w.value;N.remove(this)}}catch(p){r={error:p}}finally{try{w&&!w.done&&(n=_.return)&&n.call(_)}finally{if(r)throw r.error}}else d.remove(this);var T=this.initialTeardown;if(Tt(T))try{T()}catch(p){c=p instanceof Tr?p.errors:[p]}var $=this._finalizers;if($){this._finalizers=null;try{for(var I=Er($),f=I.next();!f.done;f=I.next()){var l=f.value;try{Fn(l)}catch(p){c=c??[],p instanceof Tr?c=Sr(Sr([],vr(c)),vr(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 Tr(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)Fn(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)&&Ar(n,r)},t.prototype.remove=function(r){var n=this._finalizers;n&&Ar(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=function(){var r=new t;return r.closed=!0,r}(),t}(),xn=Ge.EMPTY;function Nn(t){return t instanceof Ge||t&&"closed"in t&&Tt(t.remove)&&Tt(t.add)&&Tt(t.unsubscribe)}function Fn(t){Tt(t)?t():t.unsubscribe()}var Hn={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,Sr([t,r],vr(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 $n(){}function Ue(t){t()}var Yn=function(t){me(r,t);function r(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,Nn(n)&&n.add(i)):i.destination=Ri,i}return r.create=function(n,i,s){return new kr(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}(Ge),Mi=Function.prototype.bind;function wr(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){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}(),kr=function(t){me(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&&Hn.useDeprecatedNextContext?(_=Object.create(n),_.unsubscribe=function(){return c.unsubscribe()},d={next:n.next&&wr(n.next,_),error:n.error&&wr(n.error,_),complete:n.complete&&wr(n.complete,_)}):d=n}return c.destination=new Oi(d),c}return r}(Yn);function Xe(t){Di(t)}function Pi(t){throw t}var Ri={closed:!0,next:$n,error:Pi,complete:$n},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 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=Fi(r)?r:new kr(r,n,i);return Ue(function(){var d=s,_=d.operator,w=d.source;c.add(_?_.call(c,w):w?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=Gn(n),new n(function(s,c){var d=new kr({next:function(_){try{r(_)}catch(w){c(w),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=Gn(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 Gn(t){var r;return(r=t??Hn.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 Yn||Ni(t)&&Nn(t)}var Hi=Ln(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Un=function(t){me(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 Xn(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;Ue(function(){var s,c;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var d=Er(i.currentObservers),_=d.next();!_.done;_=d.next()){var w=_.value;w.next(n)}}catch(N){s={error:N}}finally{try{_&&!_.done&&(c=d.return)&&c.call(d)}finally{if(s)throw s.error}}}})},r.prototype.error=function(n){var i=this;Ue(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;Ue(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?xn:(this.currentObservers=null,_.push(n),new Ge(function(){i.currentObservers=null,Ar(_,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 zn;return n.source=this,n},r.create=function(n,i){return new Xn(n,i)},r}(zn),Xn=function(t){me(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}(Un),Wn=function(t){me(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}(Un),pt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var We={exports:{}};We.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=1,c=2,d=9007199254740991,_="[object Arguments]",w="[object Array]",N="[object AsyncFunction]",T="[object Boolean]",$="[object Date]",I="[object Error]",f="[object Function]",l="[object GeneratorFunction]",p="[object Map]",g="[object Number]",E="[object Null]",b="[object Object]",m="[object Promise]",h="[object Proxy]",A="[object RegExp]",O="[object Set]",k="[object String]",C="[object Symbol]",x="[object Undefined]",L="[object WeakMap]",M="[object ArrayBuffer]",R="[object DataView]",G="[object Float32Array]",ft="[object Float64Array]",Yt="[object Int8Array]",Jt="[object Int16Array]",qt="[object Int32Array]",Qt="[object Uint8Array]",te="[object Uint8ClampedArray]",Y="[object Uint16Array]",ee="[object Uint32Array]",re=/[\\^$.*+?()[\]{}|]/g,H=/^\[object .+?Constructor\]$/,X=/^(?:0|[1-9]\d*)$/,v={};v[G]=v[ft]=v[Yt]=v[Jt]=v[qt]=v[Qt]=v[te]=v[Y]=v[ee]=!0,v[_]=v[w]=v[M]=v[T]=v[R]=v[$]=v[I]=v[f]=v[p]=v[g]=v[b]=v[A]=v[O]=v[k]=v[L]=!1;var dt=typeof pt=="object"&&pt&&pt.Object===Object&&pt,st=typeof self=="object"&&self&&self.Object===Object&&self,U=dt||st||Function("return this")(),mt=r&&!r.nodeType&&r,Z=mt&&!0&&t&&!t.nodeType&&t,W=Z&&Z.exports===mt,_t=W&&dt.process,ne=function(){try{return _t&&_t.binding&&_t.binding("util")}catch{}}(),we=ne&&ne.isTypedArray;function er(e,a){for(var o=-1,u=e==null?0:e.length,P=0,S=[];++o<u;){var j=e[o];a(j,o,e)&&(S[P++]=j)}return S}function ke(e,a){for(var o=-1,u=a.length,P=e.length;++o<u;)e[P+o]=a[o];return e}function rr(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 Wr(e,a){for(var o=-1,u=Array(e);++o<e;)u[o]=a(o);return u}function Kr(e){return function(a){return e(a)}}function ie(e,a){return e.has(a)}function De(e,a){return e==null?void 0:e[a]}function nr(e){var a=-1,o=Array(e.size);return e.forEach(function(u,P){o[++a]=[P,u]}),o}function ir(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 ae=Array.prototype,Br=Function.prototype,zt=Object.prototype,se=U["__core-js_shared__"],Me=Br.toString,yt=zt.hasOwnProperty,ar=function(){var e=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),sr=zt.toString,Vr=RegExp("^"+Me.call(yt).replace(re,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=W?U.Buffer:void 0,oe=U.Symbol,or=U.Uint8Array,ce=zt.propertyIsEnumerable,Gt=ae.splice,It=oe?oe.toStringTag:void 0,ue=Object.getOwnPropertySymbols,Pe=Oe?Oe.isBuffer:void 0,Ut=ir(Object.keys,Object),Re=wt(U,"DataView"),Xt=wt(U,"Map"),Ce=wt(U,"Promise"),Le=wt(U,"Set"),xe=wt(U,"WeakMap"),Pt=wt(Object,"create"),cr=at(Re),At=at(Xt),Zr=at(Ce),Jr=at(Le),qr=at(xe),ur=oe?oe.prototype:void 0,Ne=ur?ur.valueOf:void 0;function J(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__=Pt?Pt(null):{},this.size=0}function tn(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a}function en(e){var a=this.__data__;if(Pt){var o=a[e];return o===i?void 0:o}return yt.call(a,e)?a[e]:void 0}function rn(e){var a=this.__data__;return Pt?a[e]!==void 0:yt.call(a,e)}function nn(e,a){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Pt&&a===void 0?i:a,this}J.prototype.clear=Qr,J.prototype.delete=tn,J.prototype.get=en,J.prototype.has=rn,J.prototype.set=nn;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 an(){this.__data__=[],this.size=0}function sn(e){var a=this.__data__,o=de(a,e);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():Gt.call(a,o,1),--this.size,!0}function on(e){var a=this.__data__,o=de(a,e);return o<0?void 0:a[o][1]}function cn(e){return de(this.__data__,e)>-1}function un(e,a){var o=this.__data__,u=de(o,e);return u<0?(++this.size,o.push([e,a])):o[u][1]=a,this}tt.prototype.clear=an,tt.prototype.delete=sn,tt.prototype.get=on,tt.prototype.has=cn,tt.prototype.set=un;function ot(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.size=0,this.__data__={hash:new J,map:new(Xt||tt),string:new J}}function fn(e){var a=gt(this,e).delete(e);return this.size-=a?1:0,a}function dn(e){return gt(this,e).get(e)}function pn(e){return gt(this,e).has(e)}function hn(e,a){var o=gt(this,e),u=o.size;return o.set(e,a),this.size+=o.size==u?0:1,this}ot.prototype.clear=ln,ot.prototype.delete=fn,ot.prototype.get=dn,ot.prototype.has=pn,ot.prototype.set=hn;function le(e){var a=-1,o=e==null?0:e.length;for(this.__data__=new ot;++a<o;)this.add(e[a])}function lr(e){return this.__data__.set(e,i),this}function fe(e){return this.__data__.has(e)}le.prototype.add=le.prototype.push=lr,le.prototype.has=fe;function Et(e){var a=this.__data__=new tt(e);this.size=a.size}function Fe(){this.__data__=new tt,this.size=0}function mn(e){var a=this.__data__,o=a.delete(e);return this.size=a.size,o}function yn(e){return this.__data__.get(e)}function _n(e){return this.__data__.has(e)}function In(e,a){var o=this.__data__;if(o instanceof tt){var u=o.__data__;if(!Xt||u.length<n-1)return u.push([e,a]),this.size=++o.size,this;o=this.__data__=new ot(u)}return o.set(e,a),this.size=o.size,this}Et.prototype.clear=Fe,Et.prototype.delete=mn,Et.prototype.get=yn,Et.prototype.has=_n,Et.prototype.set=In;function gn(e,a){var o=pe(e),u=!o&&mr(e),P=!o&&!u&&he(e),S=!o&&!u&&!P&&Ir(e),j=o||u||P||S,F=j?Wr(e.length,String):[],K=F.length;for(var z in e)yt.call(e,z)&&!(j&&(z=="length"||P&&(z=="offset"||z=="parent")||S&&(z=="buffer"||z=="byteLength"||z=="byteOffset")||kn(z,K)))&&F.push(z);return F}function de(e,a){for(var o=e.length;o--;)if(hr(e[o][0],a))return o;return-1}function He(e,a,o){var u=a(e);return pe(e)?u:ke(u,o(e))}function Wt(e){return e==null?e===void 0?x:E:It&&It in Object(e)?kt(e):pr(e)}function fr(e){return St(e)&&Wt(e)==_}function dr(e,a,o,u,P){return e===a?!0:e==null||a==null||!St(e)&&!St(a)?e!==e&&a!==a:bn(e,a,o,u,dr,P)}function bn(e,a,o,u,P,S){var j=pe(e),F=pe(a),K=j?w:vt(e),z=F?w:vt(a);K=K==_?b:K,z=z==_?b:z;var et=K==b,ct=z==b,V=K==z;if(V&&he(e)){if(!he(a))return!1;j=!0,et=!1}if(V&&!et)return S||(S=new Et),j||Ir(e)?je(e,a,o,u,P,S):Tn(e,a,K,o,u,P,S);if(!(o&s)){var rt=et&&yt.call(e,"__wrapped__"),q=ct&&yt.call(a,"__wrapped__");if(rt||q){var Rt=rt?e.value():e,Dt=q?a.value():a;return S||(S=new Et),P(Rt,Dt,o,u,S)}}return V?(S||(S=new Et),An(e,a,o,u,P,S)):!1}function En(e){if(!_r(e)||Mn(e))return!1;var a=yr(e)?Vr:H;return a.test(at(e))}function vn(e){return St(e)&&Ye(e.length)&&!!v[Wt(e)]}function Sn(e){if(!On(e))return Ut(e);var a=[];for(var o in Object(e))yt.call(e,o)&&o!="constructor"&&a.push(o);return a}function je(e,a,o,u,P,S){var j=o&s,F=e.length,K=a.length;if(F!=K&&!(j&&K>F))return!1;var z=S.get(e);if(z&&S.get(a))return z==a;var et=-1,ct=!0,V=o&c?new le:void 0;for(S.set(e,a),S.set(a,e);++et<F;){var rt=e[et],q=a[et];if(u)var Rt=j?u(q,rt,et,a,e,S):u(rt,q,et,e,a,S);if(Rt!==void 0){if(Rt)continue;ct=!1;break}if(V){if(!rr(a,function(Dt,Bt){if(!ie(V,Bt)&&(rt===Dt||P(rt,Dt,o,u,S)))return V.push(Bt)})){ct=!1;break}}else if(!(rt===q||P(rt,q,o,u,S))){ct=!1;break}}return S.delete(e),S.delete(a),ct}function Tn(e,a,o,u,P,S,j){switch(o){case R:if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case M:return!(e.byteLength!=a.byteLength||!S(new or(e),new or(a)));case T:case $:case g:return hr(+e,+a);case I:return e.name==a.name&&e.message==a.message;case A:case k:return e==a+"";case p:var F=nr;case O:var K=u&s;if(F||(F=bt),e.size!=a.size&&!K)return!1;var z=j.get(e);if(z)return z==a;u|=c,j.set(e,a);var et=je(F(e),F(a),u,P,S,j);return j.delete(e),et;case C:if(Ne)return Ne.call(e)==Ne.call(a)}return!1}function An(e,a,o,u,P,S){var j=o&s,F=Kt(e),K=F.length,z=Kt(a),et=z.length;if(K!=et&&!j)return!1;for(var ct=K;ct--;){var V=F[ct];if(!(j?V in a:yt.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=j;++ct<K;){V=F[ct];var Dt=e[V],Bt=a[V];if(u)var ki=j?u(Bt,Dt,V,a,e,S):u(Dt,Bt,V,e,a,S);if(!(ki===void 0?Dt===Bt||P(Dt,Bt,o,u,S):ki)){q=!1;break}Rt||(Rt=V=="constructor")}if(q&&!Rt){var gr=e.constructor,br=a.constructor;gr!=br&&"constructor"in e&&"constructor"in a&&!(typeof gr=="function"&&gr instanceof gr&&typeof br=="function"&&br instanceof br)&&(q=!1)}return S.delete(e),S.delete(a),q}function Kt(e){return He(e,ze,wn)}function gt(e,a){var o=e.__data__;return Dn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function wt(e,a){var o=De(e,a);return En(o)?o:void 0}function kt(e){var a=yt.call(e,It),o=e[It];try{e[It]=void 0;var u=!0}catch{}var P=sr.call(e);return u&&(a?e[It]=o:delete e[It]),P}var wn=ue?function(e){return e==null?[]:(e=Object(e),er(ue(e),function(a){return ce.call(e,a)}))}:Rn,vt=Wt;(Re&&vt(new Re(new ArrayBuffer(1)))!=R||Xt&&vt(new Xt)!=p||Ce&&vt(Ce.resolve())!=m||Le&&vt(new Le)!=O||xe&&vt(new xe)!=L)&&(vt=function(e){var a=Wt(e),o=a==b?e.constructor:void 0,u=o?at(o):"";if(u)switch(u){case cr:return R;case At:return p;case Zr:return m;case Jr:return O;case qr:return L}return a});function kn(e,a){return a=a??d,!!a&&(typeof e=="number"||X.test(e))&&e>-1&&e%1==0&&e<a}function Dn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function Mn(e){return!!ar&&ar in e}function On(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||zt;return e===o}function pr(e){return sr.call(e)}function at(e){if(e!=null){try{return Me.call(e)}catch{}try{return e+""}catch{}}return""}function hr(e,a){return e===a||e!==e&&a!==a}var mr=fr(function(){return arguments}())?fr:function(e){return St(e)&&yt.call(e,"callee")&&!ce.call(e,"callee")},pe=Array.isArray;function $e(e){return e!=null&&Ye(e.length)&&!yr(e)}var he=Pe||Cn;function Pn(e,a){return dr(e,a)}function yr(e){if(!_r(e))return!1;var a=Wt(e);return a==f||a==l||a==N||a==h}function Ye(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=d}function _r(e){var a=typeof e;return e!=null&&(a=="object"||a=="function")}function St(e){return e!=null&&typeof e=="object"}var Ir=we?Kr(we):vn;function ze(e){return $e(e)?gn(e):Sn(e)}function Rn(){return[]}function Cn(){return!1}t.exports=Pn}(We,We.exports);var ji=We.exports;const nt=Dr(ji);var Ke={exports:{}};Ke.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,c="[object Arguments]",d="[object Array]",_="[object Boolean]",w="[object Date]",N="[object Error]",T="[object Function]",$="[object GeneratorFunction]",I="[object Map]",f="[object Number]",l="[object Object]",p="[object Promise]",g="[object RegExp]",E="[object Set]",b="[object String]",m="[object Symbol]",h="[object WeakMap]",A="[object ArrayBuffer]",O="[object DataView]",k="[object Float32Array]",C="[object Float64Array]",x="[object Int8Array]",L="[object Int16Array]",M="[object Int32Array]",R="[object Uint8Array]",G="[object Uint8ClampedArray]",ft="[object Uint16Array]",Yt="[object Uint32Array]",Jt=/[\\^$.*+?()[\]{}|]/g,qt=/\w*$/,Qt=/^\[object .+?Constructor\]$/,te=/^(?:0|[1-9]\d*)$/,Y={};Y[c]=Y[d]=Y[A]=Y[O]=Y[_]=Y[w]=Y[k]=Y[C]=Y[x]=Y[L]=Y[M]=Y[I]=Y[f]=Y[l]=Y[g]=Y[E]=Y[b]=Y[m]=Y[R]=Y[G]=Y[ft]=Y[Yt]=!0,Y[N]=Y[T]=Y[h]=!1;var ee=typeof pt=="object"&&pt&&pt.Object===Object&&pt,re=typeof self=="object"&&self&&self.Object===Object&&self,H=ee||re||Function("return this")(),X=r&&!r.nodeType&&r,v=X&&!0&&t&&!t.nodeType&&t,dt=v&&v.exports===X;function st(e,a){return e.set(a[0],a[1]),e}function U(e,a){return e.add(a),e}function mt(e,a){for(var o=-1,u=e?e.length:0;++o<u&&a(e[o],o,e)!==!1;);return e}function Z(e,a){for(var o=-1,u=a.length,P=e.length;++o<u;)e[P+o]=a[o];return e}function W(e,a,o,u){for(var P=-1,S=e?e.length:0;++P<S;)o=a(o,e[P],P,e);return o}function _t(e,a){for(var o=-1,u=Array(e);++o<e;)u[o]=a(o);return u}function ne(e,a){return e==null?void 0:e[a]}function we(e){var a=!1;if(e!=null&&typeof e.toString!="function")try{a=!!(e+"")}catch{}return a}function er(e){var a=-1,o=Array(e.size);return e.forEach(function(u,P){o[++a]=[P,u]}),o}function ke(e,a){return function(o){return e(a(o))}}function rr(e){var a=-1,o=Array(e.size);return e.forEach(function(u){o[++a]=u}),o}var Wr=Array.prototype,Kr=Function.prototype,ie=Object.prototype,De=H["__core-js_shared__"],nr=function(){var e=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ir=Kr.toString,bt=ie.hasOwnProperty,ae=ie.toString,Br=RegExp("^"+ir.call(bt).replace(Jt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),zt=dt?H.Buffer:void 0,se=H.Symbol,Me=H.Uint8Array,yt=ke(Object.getPrototypeOf,Object),ar=Object.create,sr=ie.propertyIsEnumerable,Vr=Wr.splice,Oe=Object.getOwnPropertySymbols,oe=zt?zt.isBuffer:void 0,or=ke(Object.keys,Object),ce=gt(H,"DataView"),Gt=gt(H,"Map"),It=gt(H,"Promise"),ue=gt(H,"Set"),Pe=gt(H,"WeakMap"),Ut=gt(Object,"create"),Re=at(ce),Xt=at(Gt),Ce=at(It),Le=at(ue),xe=at(Pe),Pt=se?se.prototype:void 0,cr=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 Zr(){this.__data__=Ut?Ut(null):{}}function Jr(e){return this.has(e)&&delete this.__data__[e]}function qr(e){var a=this.__data__;if(Ut){var o=a[e];return o===i?void 0:o}return bt.call(a,e)?a[e]:void 0}function ur(e){var a=this.__data__;return Ut?a[e]!==void 0:bt.call(a,e)}function Ne(e,a){var o=this.__data__;return o[e]=Ut&&a===void 0?i:a,this}At.prototype.clear=Zr,At.prototype.delete=Jr,At.prototype.get=qr,At.prototype.has=ur,At.prototype.set=Ne;function J(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__=[]}function tn(e){var a=this.__data__,o=fe(a,e);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():Vr.call(a,o,1),!0}function en(e){var a=this.__data__,o=fe(a,e);return o<0?void 0:a[o][1]}function rn(e){return fe(this.__data__,e)>-1}function nn(e,a){var o=this.__data__,u=fe(o,e);return u<0?o.push([e,a]):o[u][1]=a,this}J.prototype.clear=Qr,J.prototype.delete=tn,J.prototype.get=en,J.prototype.has=rn,J.prototype.set=nn;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 an(){this.__data__={hash:new At,map:new(Gt||J),string:new At}}function sn(e){return Kt(this,e).delete(e)}function on(e){return Kt(this,e).get(e)}function cn(e){return Kt(this,e).has(e)}function un(e,a){return Kt(this,e).set(e,a),this}tt.prototype.clear=an,tt.prototype.delete=sn,tt.prototype.get=on,tt.prototype.has=cn,tt.prototype.set=un;function ot(e){this.__data__=new J(e)}function ln(){this.__data__=new J}function fn(e){return this.__data__.delete(e)}function dn(e){return this.__data__.get(e)}function pn(e){return this.__data__.has(e)}function hn(e,a){var o=this.__data__;if(o instanceof J){var u=o.__data__;if(!Gt||u.length<n-1)return u.push([e,a]),this;o=this.__data__=new tt(u)}return o.set(e,a),this}ot.prototype.clear=ln,ot.prototype.delete=fn,ot.prototype.get=dn,ot.prototype.has=pn,ot.prototype.set=hn;function le(e,a){var o=$e(e)||pe(e)?_t(e.length,String):[],u=o.length,P=!!u;for(var S in e)bt.call(e,S)&&!(P&&(S=="length"||Dn(S,u)))&&o.push(S);return o}function lr(e,a,o){var u=e[a];(!(bt.call(e,a)&&mr(u,o))||o===void 0&&!(a in e))&&(e[a]=o)}function fe(e,a){for(var o=e.length;o--;)if(mr(e[o][0],a))return o;return-1}function Et(e,a){return e&&je(a,ze(a),e)}function Fe(e,a,o,u,P,S,j){var F;if(u&&(F=S?u(e,P,S,j):u(e)),F!==void 0)return F;if(!St(e))return e;var K=$e(e);if(K){if(F=wn(e),!a)return Sn(e,F)}else{var z=kt(e),et=z==T||z==$;if(yr(e))return de(e,a);if(z==l||z==c||et&&!S){if(we(e))return S?e:{};if(F=vt(et?{}:e),!a)return Tn(e,Et(F,e))}else{if(!Y[z])return S?e:{};F=kn(e,z,Fe,a)}}j||(j=new ot);var ct=j.get(e);if(ct)return ct;if(j.set(e,F),!K)var V=o?An(e):ze(e);return mt(V||e,function(rt,q){V&&(q=rt,rt=e[q]),lr(F,q,Fe(rt,a,o,u,q,e,j))}),F}function mn(e){return St(e)?ar(e):{}}function yn(e,a,o){var u=a(e);return $e(e)?u:Z(u,o(e))}function _n(e){return ae.call(e)}function In(e){if(!St(e)||On(e))return!1;var a=Ye(e)||we(e)?Br:Qt;return a.test(at(e))}function gn(e){if(!pr(e))return or(e);var a=[];for(var o in Object(e))bt.call(e,o)&&o!="constructor"&&a.push(o);return a}function de(e,a){if(a)return e.slice();var o=new e.constructor(e.length);return e.copy(o),o}function He(e){var a=new e.constructor(e.byteLength);return new Me(a).set(new Me(e)),a}function Wt(e,a){var o=a?He(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function fr(e,a,o){var u=a?o(er(e),!0):er(e);return W(u,st,new e.constructor)}function dr(e){var a=new e.constructor(e.source,qt.exec(e));return a.lastIndex=e.lastIndex,a}function bn(e,a,o){var u=a?o(rr(e),!0):rr(e);return W(u,U,new e.constructor)}function En(e){return cr?Object(cr.call(e)):{}}function vn(e,a){var o=a?He(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function Sn(e,a){var o=-1,u=e.length;for(a||(a=Array(u));++o<u;)a[o]=e[o];return a}function je(e,a,o,u){o||(o={});for(var P=-1,S=a.length;++P<S;){var j=a[P],F=void 0;lr(o,j,F===void 0?e[j]:F)}return o}function Tn(e,a){return je(e,wt(e),a)}function An(e){return yn(e,ze,wt)}function Kt(e,a){var o=e.__data__;return Mn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function gt(e,a){var o=ne(e,a);return In(o)?o:void 0}var wt=Oe?ke(Oe,Object):Rn,kt=_n;(ce&&kt(new ce(new ArrayBuffer(1)))!=O||Gt&&kt(new Gt)!=I||It&&kt(It.resolve())!=p||ue&&kt(new ue)!=E||Pe&&kt(new Pe)!=h)&&(kt=function(e){var a=ae.call(e),o=a==l?e.constructor:void 0,u=o?at(o):void 0;if(u)switch(u){case Re:return O;case Xt:return I;case Ce:return p;case Le:return E;case xe:return h}return a});function wn(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"&&!pr(e)?mn(yt(e)):{}}function kn(e,a,o,u){var P=e.constructor;switch(a){case A:return He(e);case _:case w:return new P(+e);case O:return Wt(e,u);case k:case C:case x:case L:case M:case R:case G:case ft:case Yt:return vn(e,u);case I:return fr(e,u,o);case f:case b:return new P(e);case g:return dr(e);case E:return bn(e,u,o);case m:return En(e)}}function Dn(e,a){return a=a??s,!!a&&(typeof e=="number"||te.test(e))&&e>-1&&e%1==0&&e<a}function Mn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function On(e){return!!nr&&nr in e}function pr(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||ie;return e===o}function at(e){if(e!=null){try{return ir.call(e)}catch{}try{return e+""}catch{}}return""}function hr(e){return Fe(e,!0,!0)}function mr(e,a){return e===a||e!==e&&a!==a}function pe(e){return Pn(e)&&bt.call(e,"callee")&&(!sr.call(e,"callee")||ae.call(e)==c)}var $e=Array.isArray;function he(e){return e!=null&&_r(e.length)&&!Ye(e)}function Pn(e){return Ir(e)&&he(e)}var yr=oe||Cn;function Ye(e){var a=St(e)?ae.call(e):"";return a==T||a==$}function _r(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 Ir(e){return!!e&&typeof e=="object"}function ze(e){return he(e)?le(e):gn(e)}function Rn(){return[]}function Cn(){return!1}t.exports=hr}(Ke,Ke.exports);var $i=Ke.exports;const Q=Dr($i),Kn=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}),Yi=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()}),Bn=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()}),Vn=(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)},Be=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))})},zi="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ye=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=zi[n[t]&63];return r};function _e(t=16){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=r.charAt(Math.floor(Math.random()*r.length));let i=ye(t-1);return i=i.replace(/[^a-zA-Z0-9]/g,"").slice(0,t-1),n+i}const Ve={color:"#000000",x:0,y:0,blur:0},Ie=(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},Zn=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function Ze(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 Jn=async(t,r)=>{const n=t.details.src,i=await Bn(n),s=Ze(r,{...i}),c=Zn(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||Ve,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:Ie(t.display,{duration:i.duration,trim:c}),duration:i.duration}},qn=async t=>{const r=t.id,n=t.details,s=(await Yi(n.src)).duration,c=Zn(t.trim,{duration:s});return{id:r,name:"",type:"audio",display:Ie(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.trackItemIds,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||0,left:t.details.left||0},_=t.display,w=t.trim||t.display;let N=1/0,T=0;return n.forEach($=>{const I=t.trackItemsMap[$];I.display.from<N&&(N=I.display.from),I.display.to>T&&(T=I.display.to)}),{id:t.id,details:{...i,top:d.top,left:d.left,scale:s,rotate:c},trim:w,display:_||{from:N,to:T},activeEdit:!1}},Qn=async(t,r)=>{const n=t.details,i=await Kn(n.src),s=Ze(r,i);return{id:t.id,type:"image",name:"image",display:Ie(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||Ve,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||{}}},ti=async(t,r)=>{const n=t;n.details.fontUrl&&await Be([{fontFamily:n.details.fontFamily,url:n.details.fontUrl}]);const i=n.id,s=n.details,c=ri(s),d=Vn(n.details.text,c),_=Ze(r,{width:c.width,height:d});return{id:i,name:"caption",type:"caption",display:Ie(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||Ve,words:s.words||[]},metadata:{}}},ei=async(t,r)=>{t.details.fontUrl&&await Be([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const n=t.id,i=t.details,s=ri(i),c=Vn(t.details.text,s),d=Ze(r,{width:s.width,height:c});return{id:n,name:"text",type:"text",display:Ie(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||Ve},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 Jn(t,r||{});case"audio":return qn(t);case"image":return Qn(t,r||{});case"text":return ei(t,r||{});case"caption":return ti(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:_e(),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||_e()}));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 Mr(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[Mr(s,0,r.length)]:r.find(w=>w.id===i);if(!c)return{trackId:void 0,trackIndex:s!==void 0?Mr(s,0,r.length):void 0};const d=c.items.map(w=>n[w]),_=t.map(w=>n[w]);for(const w of d){const N=w.display.from,T=w.display.to;for(const $ of _){const I=$.display.from;if(!($.display.to<=N||I>=T))return{trackId:void 0,trackIndex:r.indexOf(c)}}}return{trackId:c.id,trackIndex:r.indexOf(c)}};function Vi(t){const r=D.subject.pipe(D.filter(({key:f})=>f.startsWith(D.DESIGN_PREFIX))),n=D.subject.pipe(D.filter(({key:f})=>f.startsWith(D.ADD_PREFIX))),i=D.subject.pipe(D.filter(({key:f})=>f.startsWith(D.LAYER_PREFIX))),s=D.subject.pipe(D.filter(({key:f})=>f.startsWith(D.HISTORY_PREFIX))),c=D.subject.pipe(D.filter(({key:f})=>f.startsWith(D.ACTIVE_PREFIX))),d=D.subject.pipe(D.filter(({key:f})=>f.startsWith(D.EDIT_PREFIX))),_=r.subscribe(async f=>{var l,p;if(f.key===D.DESIGN_LOAD){const g=(l=f.value)==null?void 0:l.payload,E=g.trackItemsMap,b=g.trackItemDetailsMap;console.warn("IMPROVE FONTS LOADING");for(const h in b)if(b[h].type==="text"||b[h].type==="caption"){const A=b[h].details;await Be([{fontFamily:A.fontFamily,url:A.fontUrl}])}const m=Ct(E);t.updateState({...g,duration:m})}if(f.key===D.DESIGN_RESIZE){const g=(p=f.value)==null?void 0:p.payload;t.updateState({size:g})}}),w=s.subscribe(f=>{if(f.key===D.HISTORY_UNDO)return t.undo();if(f.key===D.HISTORY_REDO)return t.redo()}),N=i.subscribe(f=>{var g,E,b,m;const l=[],p=[];if((g=f.value)!=null&&g.payload.trackItemIds&&(l.push((E=f.value)==null?void 0:E.payload.trackItemIds),t.updateState({activeIds:l})),f.key===D.LAYER_DELETE){const h=(b=f.value)==null?void 0:b.payload.trackItemIds,A=Q(t.getState()),O=h&&h.length?h:A.activeIds,k=A.trackItemIds,C=A.trackItemDetailsMap,x=k.filter(ft=>!O.includes(ft)),L=Object.fromEntries(Object.entries(C).filter(([ft])=>!O.includes(ft))),M=Ki(A.tracks,O),R=Object.fromEntries(Object.entries(A.trackItemsMap).filter(([ft])=>!O.includes(ft))),G=Ct(R);t.updateState({trackItemIds:x,trackItemDetailsMap:L,activeIds:[],trackItemsMap:R,tracks:M,duration:G},{updateHistory:!0,kind:"remove"})}if(f.key===D.LAYER_CLONE){const h=Q(t.getState()),A=((m=f.value)==null?void 0:m.payload.trackItemIds)||h.activeIds;if(A.length===0)return;A.forEach(k=>{const C=h.trackItemsMap[k],x=h.trackItemDetailsMap[k],L=_e();p.push(L),h.trackItemsMap={...h.trackItemsMap,[L]:{...Q(C),id:L}},h.trackItemDetailsMap={...h.trackItemDetailsMap,[L]:{...Q(x)}},h.trackItemIds.push(L)});const O=[];h.tracks.forEach(k=>{const C={...k,items:[],id:ye()};k.items.forEach(x=>{if(A.includes(x)){const L=A.indexOf(x);C.items.push(p[L])}}),O.push(C)}),O.forEach(k=>{k.items.length!==0&&h.tracks.unshift(k)}),t.updateState({trackItemDetailsMap:h.trackItemDetailsMap,tracks:h.tracks,trackItemIds:h.trackItemIds,trackItemsMap:h.trackItemsMap},{updateHistory:!0,kind:"update"})}}),T=n.subscribe(async f=>{var h,A,O,k,C,x,L,M,R,G,ft,Yt,Jt,qt,Qt,te,Y,ee,re;const l=Q(t.getState());let p=[],g="text";const E=(A=(h=f.value)==null?void 0:h.options)==null?void 0:A.trackId;let b=(k=(O=f.value)==null?void 0:O.options)==null?void 0:k.trackIndex;if(f.key===Ti){const H=(C=f.value)==null?void 0:C.payload,X=H.trackItems.map(W=>Ui(W,{size:l.size})),v=await Promise.all(X),dt=Wi(H.tracks,H.trackItems),st=[],U={},mt={};if(v.forEach(W=>{const{details:_t,...ne}=W;st.push(W.id),U[W.id]={type:W.type,details:_t},mt[W.id]=ne}),Xi(l.tracks,dt))l.tracks.forEach(W=>{dt.forEach(_t=>{W.id===_t.id&&W.items.push(...st)})});else{const W=((L=(x=f.value)==null?void 0:x.options)==null?void 0:L.trackIndex)||0,_t=Mr(W,0,l.tracks.length);l.tracks.splice(_t,0,...dt)}l.trackItemDetailsMap={...l.trackItemDetailsMap,...U},l.trackItemsMap={...l.trackItemsMap,...mt},l.trackItemIds=[...l.trackItemIds,...st],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===D.ADD_CAPTION){g="caption";const H=(M=f.value)==null?void 0:M.payload,X=[];for(const st of H){const U=ti(st,{size:l.size});X.push(U)}const v=await Promise.all(X),dt=[];for(const st of v){const U=st.id;dt.push(U);const{details:mt,...Z}=st;l.trackItemDetailsMap[U]={type:g,details:mt},l.trackItemsMap[U]=Z,l.trackItemIds.push(U)}p=dt}if(f.key===D.ADD_TEXT){g="text";const H=await ei((R=f.value)==null?void 0:R.payload,{size:l.size}),{details:X,...v}=H;l.trackItemDetailsMap[v.id]={type:g,details:X},l.trackItemsMap[v.id]=v,l.trackItemIds.push(v.id),p=[v.id]}if(f.key===D.ADD_TEMPLATE){g="template";const H=(G=f.value)==null?void 0:G.payload.trackItemsMap,X=(ft=f.value)==null?void 0:ft.payload.trackItemDetailsMap,v=(Yt=f.value)==null?void 0:Yt.payload.transitionsMap,dt=((Jt=f.value)==null?void 0:Jt.payload.transitionIds)||[],st=(qt=f.value)==null?void 0:qt.payload.trackItemIds,U=((Qt=f.value)==null?void 0:Qt.payload.tracks)||[],{details:mt,...Z}=await Gi((te=f.value)==null?void 0:te.payload,{size:l.size}),W={id:Z.id,items:st,transitions:dt,tracks:U};l.trackItemDetailsMap[Z.id]={type:g,details:mt},l.trackItemsMap[Z.id]=Z,l.trackItemIds.push(Z.id),p=[Z.id],l.trackItemsMap={...l.trackItemsMap,...H,[Z.id]:{type:"template",...Z}},l.trackItemDetailsMap={...l.trackItemDetailsMap,...X,[Z.id]:{type:"template",details:mt}},l.transitionsMap={...l.transitionsMap,...v},l.structure=[...l.structure,W]}if(f.key===D.ADD_IMAGE){g="image";const H=await Qn((Y=f.value)==null?void 0:Y.payload,{size:l.size}),{details:X,...v}=H;l.trackItemDetailsMap[v.id]={type:g,details:X},l.trackItemsMap[v.id]=v,l.trackItemIds.push(v.id),p=[v.id]}if(f.key===D.ADD_AUDIO){g="audio";const H=await qn((ee=f.value)==null?void 0:ee.payload),{details:X,...v}=H;l.trackItemDetailsMap[v.id]={type:g,details:X},l.trackItemsMap[v.id]=v,l.trackItemIds.push(v.id),p=[v.id]}if(f.key===D.ADD_VIDEO){g="video";const H=await Jn((re=f.value)==null?void 0:re.payload,{size:l.size}),{details:X,...v}=H;l.trackItemDetailsMap[v.id]={type:g,details:X},l.trackItemsMap[v.id]=v,l.trackItemIds.push(v.id),p=[v.id]}const m=Bi(p,l.tracks,l.trackItemsMap,E,b);if(m.trackId){const H=l.tracks.find(X=>X.id===m.trackId);H&&H.items.push(...p)}else if(m.trackIndex!==void 0){const H={id:ye(),accepts:["text","audio","helper","video","image","caption","template"],type:g,items:p,magnetic:!1,static:!1};l.tracks.splice(m.trackIndex,0,H)}else l.tracks.unshift({id:ye(),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,transitionsMap:l.transitionsMap,tracks:l.tracks,duration:l.duration,structure:l.structure},{updateHistory:!0,kind:"add"})}),$=c.subscribe(async f=>{var l;if(f.key===D.ACTIVE_SPLIT){const p=Q(t.getState()),g=(l=f.value)==null?void 0:l.options.time;if(p.activeIds.length===1){const E=p.activeIds[0],b=p.trackItemsMap[E];if(g>=b.display.to||g<=b.display.from)return;const m=p.trackItemDetailsMap[E],h=_e(),A={...b,id:h,display:{from:g,to:b.display.to},trim:{from:g,to:b.display.to}};p.trackItemsMap[E].display.to=g,p.trackItemsMap[h]=A,p.trackItemIds.push(h),p.trackItemDetailsMap[h]=m,p.tracks.forEach(O=>{O.items.includes(E)&&O.items.push(h)}),t.updateState({trackItemDetailsMap:p.trackItemDetailsMap,tracks:p.tracks,trackItemIds:p.trackItemIds,trackItemsMap:p.trackItemsMap},{updateHistory:!0,kind:"update"})}return}if(f.key===D.ACTIVE_CLONE){const p=Q(t.getState());if(p.activeIds.length){const g=p.activeIds,E=[],b={activeIds:g,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};g.forEach(h=>{b.trackItemDetailsMap[h]=p.trackItemDetailsMap[h],b.trackItemsMap[h]=p.trackItemsMap[h],E.push(p.tracks.find(A=>A.items.includes(h)))});const m=new Set;E.filter(h=>m.has(h.id)?!1:(m.add(h),!0)),b.tracks=Array.from(m.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(b))}}if(f.key===D.ACTIVE_PASTE){const p=localStorage.getItem("DesignComboTemp");if(!p)return;const g=Q(t.getState()),E=JSON.parse(p),b={},m=E.trackItemsMap,h=E.trackItemDetailsMap,A=E.tracks,O=[],k=E.activeIds.map(async C=>{const x=h[C];(x.type==="caption"||x.type==="text")&&x.details.fontUrl&&await Be([{fontFamily:x.details.fontFamily,url:x.details.fontUrl}]);const L=_e();return b[C]=L,g.trackItemsMap[L]={...m[C],id:L},g.trackItemDetailsMap[L]=x,g.trackItemIds.push(L),!0});await Promise.all(k),A.forEach(C=>{const x=C.items.map(M=>b[M]),L={...C,items:x,id:ye()};O.push(L)}),g.tracks=[...g.tracks,...O],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===D.EDIT_OBJECT){const E=Q(t.getState()),b=E.trackItemDetailsMap,m=E.trackItemsMap,h=Object.keys((l=f.value)==null?void 0:l.payload);if(!h.length)return;const A=(p=f.value)==null?void 0:p.payload;h.forEach(k=>{const C=A[k];C.details?b[k].details={...b[k].details,...C.details}:A[k].playbackRate&&(m[k].playbackRate=A[k].playbackRate)});const O=Ct(m);t.updateState({trackItemDetailsMap:{...b},trackItemsMap:{...m},duration:O},{updateHistory:!0,kind:"update:details"})}if(f.key===D.REPLACE_MEDIA){const E=(g=f.value)==null?void 0:g.payload,b=Object.keys(E)[0],m=Object.values(E)[0],h=Q(t.getState()),A=h.trackItemDetailsMap[b];if(m.details){if(m.type==="image"&&m.details.src){const C=await Kn(m.details.src),x=A.details.width||0,L=A.details.height||0;let M=C.width,R=C.height;const G=C.width/C.height;x/L>G?(M=x,R=x/G):(R=L,M=L*G),m.details.mediaWidth=M,m.details.mediaHeight=R}if(m.type==="video"&&m.details.src){const C=await Bn(m.details.src),x=A.details.width||0,L=A.details.height||0;let M=C.width,R=C.height;const G=C.width/C.height;x/L>G?(M=x,R=x/G):(R=L,M=L*G),m.details.mediaWidth=M,m.details.mediaHeight=R}const k=A.details;A.details={...k,...m.details},m.details=A.details}const O={...A,...m};h.trackItemDetailsMap[b]=O,h.trackItemsMap[b]={...h.trackItemsMap[b],type:m.type},t.updateState({trackItemDetailsMap:{...h.trackItemDetailsMap},trackItemsMap:{...h.trackItemsMap}},{updateHistory:!0,kind:"update:details"})}});return{unsubscribe:()=>{T.unsubscribe(),$.unsubscribe(),I.unsubscribe(),w.unsubscribe(),N.unsubscribe(),_.unsubscribe()}}}const Zi={Date:!0,RegExp:!0,String:!0,Number:!0};function ni(t,r,n={cyclesFix:!0},i=[]){var _,w;let s=[];const c=Array.isArray(t);for(const N in t){const T=t[N],$=c?+N:N;if(!(N in r)){s.push({type:"REMOVE",path:[$],oldValue:t[N]});continue}const I=r[N],f=typeof T=="object"&&typeof I=="object"&&Array.isArray(T)===Array.isArray(I);if(T&&I&&f&&!Zi[(w=(_=Object.getPrototypeOf(T))==null?void 0:_.constructor)==null?void 0:w.name]&&(!n.cyclesFix||!i.includes(T))){const l=ni(T,I,n,n.cyclesFix?i.concat([T]):[]);s.push.apply(s,l.map(p=>(p.path.unshift($),p)))}else T!==I&&!(Number.isNaN(T)&&Number.isNaN(I))&&!(f&&(isNaN(T)?T+""==I+"":+T==+I))&&s.push({path:[$],type:"CHANGE",value:I,oldValue:T})}const d=Array.isArray(r);for(const N in r)N in t||s.push({type:"CREATE",path:[d?+N:N],value:r[N]});return s}var Or=Symbol.for("immer-nothing"),ge=Symbol.for("immer-draftable"),ut=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[ut]}function Ot(t){var r;return t?ai(t)||Array.isArray(t)||!!t[ge]||!!((r=t.constructor)!=null&&r[ge])||ve(t)||Se(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 be(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[ut];return r?r.type_:Array.isArray(t)?1:ve(t)?2:Se(t)?3:0}function Ee(t,r){return Nt(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function Pr(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 ve(t){return t instanceof Map}function Se(t){return t instanceof Set}function Ft(t){return t.copy_||t.base_}function Rr(t,r){if(ve(t))return new Map(t);if(Se(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[ut];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 Cr(t,r=!1){return Je(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])=>Cr(i,!0))),t}function Qi(){B(2)}function Je(t){return Object.isFrozen(t)}var Lr={};function Ht(t){const r=Lr[t];return r||B(0,t),r}function ta(t,r){Lr[t]||(Lr[t]=r)}var Te;function oi(){return Te}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 xr(t){Nr(t),t.drafts_.forEach(ra),t.drafts_=null}function Nr(t){t===Te&&(Te=t.parent_)}function ui(t){return Te=ea(Te,t)}function ra(t){const r=t[ut];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[ut].modified_&&(xr(r),B(4)),Ot(t)&&(t=qe(r,t),r.parent_||Qe(r,t)),r.patches_&&Ht("Patches").generateReplacementPatches_(n[ut].base_,t,r.patches_,r.inversePatches_)):t=qe(r,n,[]),xr(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==Or?t:void 0}function qe(t,r,n){if(Je(r))return r;const i=r[ut];if(!i)return be(r,(s,c)=>fi(t,i,r,s,c,n)),r;if(i.scope_!==t)return r;if(!i.modified_)return Qe(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),be(c,(_,w)=>fi(t,i,s,_,w,n,d)),Qe(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&&!Ee(r.assigned_,i)?c.concat(i):void 0,w=qe(t,s,_);if(si(n,i,w),xt(w))t.canAutoFreeze_=!1;else return}else d&&n.add(s);if(Ot(s)&&!Je(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;qe(t,s),(!r||!r.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&Qe(t,s)}}function Qe(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Cr(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=Fr;n&&(s=[i],c=Ae);const{revoke:d,proxy:_}=Proxy.revocable(s,c);return i.draft_=_,i.revoke_=d,_}var Fr={get(t,r){if(r===ut)return t;const n=Ft(t);if(!Ee(n,r))return ia(t,n,r);const i=n[r];return t.finalized_||!Ot(i)?i:i===Hr(t.base_,r)?($r(t),t.copy_[r]=Yr(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=Hr(Ft(t),r),c=s==null?void 0:s[ut];if(c&&c.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(qi(n,s)&&(n!==void 0||Ee(t.base_,r)))return!0;$r(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 Hr(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,$r(t),jr(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)}},Ae={};be(Fr,(t,r)=>{Ae[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),Ae.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&B(13),Ae.set.call(this,t,r,void 0)},Ae.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&B(14),Fr.set.call(this,t[0],r,n,t[0])};function Hr(t,r){const n=t[ut];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 jr(t){t.modified_||(t.modified_=!0,t.parent_&&jr(t.parent_))}function $r(t){t.copy_||(t.copy_=Rr(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(w=c,...N){return d.produce(w,T=>n.call(this,T,...N))}}typeof n!="function"&&B(6),i!==void 0&&typeof i!="function"&&B(7);let s;if(Ot(r)){const c=ui(this),d=Yr(r,void 0);let _=!0;try{s=n(d),_=!1}finally{_?xr(c):Nr(c)}return ci(c,i),li(s,c)}else if(!r||typeof r!="object"){if(s=n(r),s===void 0&&(s=r),s===Or&&(s=void 0),this.autoFreeze_&&Cr(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,w=>r(w,..._));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=Yr(t,void 0);return n[ut].isManual_=!0,Nr(r),n}finishDraft(t,r){const n=t&&t[ut];(!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 Yr(t,r){const n=ve(t)?Ht("MapSet").proxyMap_(t,r):Se(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)||Je(t))return t;const r=t[ut];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Rr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=Rr(t,!0);return be(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_:E}=I,b=I.copy_;b.length<g.length&&([g,b]=[b,g],[l,p]=[p,l]);for(let m=0;m<g.length;m++)if(E[m]&&b[m]!==g[m]){const h=f.concat([m]);l.push({op:r,path:h,value:$(b[m])}),p.push({op:r,path:h,value:$(g[m])})}for(let m=g.length;m<b.length;m++){const h=f.concat([m]);l.push({op:n,path:h,value:$(b[m])})}for(let m=b.length-1;g.length<=m;--m){const h=f.concat([m]);p.push({op:i,path:h})}}function d(I,f,l,p){const{base_:g,copy_:E}=I;be(I.assigned_,(b,m)=>{const h=Pr(g,b),A=Pr(E,b),O=m?Ee(g,b)?r:n:i;if(h===A&&O===r)return;const k=f.concat(b);l.push(O===i?{op:O,path:k}:{op:O,path:k,value:A}),p.push(O===n?{op:i,path:k}:O===i?{op:n,path:k,value:$(h)}:{op:r,path:k,value:$(h)})})}function _(I,f,l,p){let{base_:g,copy_:E}=I,b=0;g.forEach(m=>{if(!E.has(m)){const h=f.concat([b]);l.push({op:i,path:h,value:m}),p.unshift({op:n,path:h,value:m})}b++}),b=0,E.forEach(m=>{if(!g.has(m)){const h=f.concat([b]);l.push({op:n,path:h,value:m}),p.unshift({op:i,path:h,value:m})}b++})}function w(I,f,l,p){l.push({op:r,path:[],value:f===Or?void 0:f}),p.push({op:r,path:[],value:I})}function N(I,f){return f.forEach(l=>{const{path:p,op:g}=l;let E=I;for(let A=0;A<p.length-1;A++){const O=Nt(E);let k=p[A];typeof k!="string"&&typeof k!="number"&&(k=""+k),(O===0||O===1)&&(k==="__proto__"||k==="constructor")&&B(19),typeof E=="function"&&k==="prototype"&&B(19),E=Pr(E,k),typeof E!="object"&&B(18,p.join("/"))}const b=Nt(E),m=T(l.value),h=p[p.length-1];switch(g){case r:switch(b){case 2:return E.set(h,m);case 3:B(16);default:return E[h]=m}case n:switch(b){case 1:return h==="-"?E.push(m):E.splice(h,0,m);case 2:return E.set(h,m);case 3:return E.add(m);default:return E[h]=m}case i:switch(b){case 1:return E.splice(h,1);case 2:return E.delete(h);case 3:return E.delete(l.value);default:return delete E[h]}default:B(17,g)}}),I}function T(I){if(!Ot(I))return I;if(Array.isArray(I))return I.map(T);if(ve(I))return new Map(Array.from(I.entries()).map(([l,p])=>[l,T(p)]));if(Se(I))return new Set(Array.from(I).map(T));const f=Object.create(Lt(I));for(const l in I)f[l]=T(I[l]);return Ee(I,ge)&&(f[ge]=I[ge]),f}function $(I){return xt(I)?T(I):I}ta("Patches",{applyPatches_:N,generatePatches_:s,generateReplacementPatches_:w})}var lt=new aa,oa=lt.produce;lt.produceWithPatches.bind(lt),lt.setAutoFreeze.bind(lt),lt.setUseStrictShallowCopy.bind(lt);var ca=lt.applyPatches.bind(lt);lt.createDraft.bind(lt),lt.finishDraft.bind(lt);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 zr=Object.prototype,Ea=zr.hasOwnProperty,Gr=zr.toString,mi=_a.Symbol,va=zr.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")||Gr.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)?Gr.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)&&Gr.call(t)==ha}var Fa=wa(function(t,r){return t==null?{}:Ta(t,ga(Sa(r),Da))}),Ha=Fa;const gi=Dr(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){Vt(this,"stateSubject");Vt(this,"stateHistorySubject");Vt(this,"prevState");Vt(this,"undos",[]);Vt(this,"redos",[]);Vt(this,"listener");const n=r||ja;this.stateSubject=new Wn(n),this.stateHistorySubject=new Wn({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:w,trackItemsMap:N}=this.getState(),T=Q({trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:_,transitionsMap:w,trackItemsMap:N}),$=[],I=[],f=[],l=[],p=[],g=[];n.forEach(M=>{let R;const G=M.path.slice(1);M.type==="CREATE"?R={path:G,op:"remove",value:M.value}:M.type==="CHANGE"?R={path:G,op:"replace",value:M.oldValue}:R={path:G,op:"add",value:M.oldValue},M.path.includes("trackItemIds")?f.push(R):M.path.includes("transitionIds")?I.push(R):M.path.includes("trackItemsMap")?p.push(R):M.path.includes("transitionsMap")?l.push(R):M.path.includes("tracks")?$.push(R):M.path.includes("trackItemDetailsMap")&&g.push(R)});const E=this.applyPatch(T.tracks,$),b=this.applyPatch(T.transitionIds,I),m=this.applyPatch(T.trackItemIds,f),h=this.applyPatch(T.transitionsMap,l),A=this.applyPatch(T.trackItemsMap,p),O=this.applyPatch(T.trackItemDetailsMap,g),k=Q({tracks:E,transitionIds:b,trackItemIds:m,transitionsMap:h,trackItemsMap:A,trackItemDetailsMap:O}),C=Q(this.getState()),x={...C,...k};this.prevState=C,this.redos.push({redos:n,type:i});const L=Ct(x.trackItemsMap);this.stateSubject.next({...x,duration:L}),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:w,trackItemsMap:N}=this.getState(),T=Q({trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:_,transitionsMap:w,trackItemsMap:N}),$=[],I=[],f=[],l=[],p=[],g=[];n.forEach(M=>{let R;const G=M.path.slice(1);M.type==="CREATE"?R={path:G,op:"add",value:M.value}:M.type==="CHANGE"?R={path:G,op:"replace",value:M.value}:R={path:G,op:"remove",value:M.oldValue},M.path.includes("trackItemIds")?f.push(R):M.path.includes("transitionIds")?I.push(R):M.path.includes("trackItemsMap")?p.push(R):M.path.includes("transitionsMap")?l.push(R):M.path.includes("trackItemDetailsMap")?g.push(R):$.push(R)});const E=this.applyPatch(T.tracks,$),b=this.applyPatch(T.transitionIds,I),m=this.applyPatch(T.trackItemIds,f),h=this.applyPatch(T.transitionsMap,l),A=this.applyPatch(T.trackItemsMap,p),O=this.applyPatch(T.trackItemDetailsMap,g),k=Q({tracks:E,transitionIds:b,trackItemIds:m,transitionsMap:h,trackItemsMap:A,trackItemDetailsMap:O}),C=Q(this.getState()),x={...C,...k};this.prevState=C,this.undos.push({undos:n,type:i});const L=Ct(x.trackItemsMap);this.stateSubject.next({...x,duration:L}),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}}const Ya="add",Ei="track",vi="trackItems",za=`${Ei}:changed`,Ga=`${vi}:changed`,Si="state",Ua=`${Si}:changed`,Ur="design",Xa=`${Ur}:load`,Wa=`${Ur}: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`,Zt="active",ys=`${Zt}:set`,_s=`${Zt}:delete`,Is=`${Zt}:paste`,gs=`${Zt}:clone`,bs=`${Zt}: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`,tr="history",xs=`${tr}:undo`,Ns=`${tr}:redo`,Fs=`${tr}:reset`,Ai="scale",Hs=`${Ai}:changed`,Xr="drag",js=`${Xr}:start`,$s=`${Xr}:end`,wi="timeline",Ys=`${wi}:boundingChanged`;y.ACTIVE_CLONE=gs,y.ACTIVE_DELETE=_s,y.ACTIVE_PASTE=Is,y.ACTIVE_PREFIX=Zt,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=Ya,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=Ur,y.DESIGN_RESIZE=Wa,y.DRAG_END=$s,y.DRAG_PREFIX=Xr,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=tr,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=Ys,y.TIMELINE_PREFIX=wi,y.TIMELINE_SCALE_CHANGED=Hs,y.TIMELINE_SCALE_PREFIX=Ai,y.TRACKS_CHANGED=za,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;
|