@iebh/tera-fy 1.15.7 → 1.15.9
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/CHANGELOG.md +19 -0
- package/dist/plugin.vue2.es2019.js +1 -1
- package/dist/terafy.es2019.js +1 -1
- package/dist/terafy.js +1 -1
- package/eslint.config.js +5 -0
- package/lib/terafy.client.js +9 -2
- package/lib/terafy.server.js +5 -1
- package/package.json +3 -3
- package/plugins/base.js +2 -3
- package/plugins/vue2.js +6 -2
- package/plugins/vue3.js +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.15.9](https://github.com/IEBH/TERA-fy/compare/v1.15.8...v1.15.9) (2025-01-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### fix
|
|
7
|
+
|
|
8
|
+
* Better handling for empty state patches ([93c59f6](https://github.com/IEBH/TERA-fy/commit/93c59f60f2635b8f6696bd597e5091a76d35d320))
|
|
9
|
+
* Flatten Vue2/3 state content when preping server patches ([ade2b76](https://github.com/IEBH/TERA-fy/commit/ade2b76f8470ebadfc2cbc04f1434bec57f31354))
|
|
10
|
+
|
|
11
|
+
### task
|
|
12
|
+
|
|
13
|
+
* Bump eslint + ruleset to latest ([8471a1f](https://github.com/IEBH/TERA-fy/commit/8471a1f476f02402150ce2fbd50914a9cf12354d))
|
|
14
|
+
|
|
15
|
+
## [1.15.8](https://github.com/IEBH/TERA-fy/compare/v1.15.7...v1.15.8) (2025-01-16)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### fix
|
|
19
|
+
|
|
20
|
+
* Debugging artefact ([c6cac8a](https://github.com/IEBH/TERA-fy/commit/c6cac8a0b763786a9259bc55f7f5713130f62d48))
|
|
21
|
+
|
|
3
22
|
## [1.15.7](https://github.com/IEBH/TERA-fy/compare/v1.15.6...v1.15.7) (2025-01-09)
|
|
4
23
|
|
|
5
24
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Tr=Object.defineProperty;var Or=(t,e,r)=>e in t?Tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Q=(t,e,r)=>Or(t,typeof e!="symbol"?e+"":e,r);var Ar=typeof global=="object"&&global&&global.Object===Object&&global,tt=Ar;var _r=typeof self=="object"&&self&&self.Object===Object&&self,Sr=tt||_r||Function("return this")(),m=Sr;var Ir=m.Symbol,j=Ir;var Nt=Object.prototype,wr=Nt.hasOwnProperty,Pr=Nt.toString,J=j?j.toStringTag:void 0;function Cr(t){var e=wr.call(t,J),r=t[J];try{t[J]=void 0;var o=!0}catch{}var a=Pr.call(t);return o&&(e?t[J]=r:delete t[J]),a}var Ft=Cr;var Er=Object.prototype,Lr=Er.toString;function Br(t){return Lr.call(t)}var Dt=Br;var Mr="[object Null]",Nr="[object Undefined]",Rt=j?j.toStringTag:void 0;function Fr(t){return t==null?t===void 0?Nr:Mr:Rt&&Rt in Object(t)?Ft(t):Dt(t)}var h=Fr;function Dr(t){return t!=null&&typeof t=="object"}var x=Dr;var Rr="[object Symbol]";function Wr(t){return typeof t=="symbol"||x(t)&&h(t)==Rr}var Wt=Wr;var Ur=Array.isArray,M=Ur;var Gr=/\s/;function Vr(t){for(var e=t.length;e--&&Gr.test(t.charAt(e)););return e}var Ut=Vr;var Kr=/^\s+/;function kr(t){return t&&t.slice(0,Ut(t)+1).replace(Kr,"")}var Gt=kr;function zr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var c=zr;var Vt=NaN,qr=/^[-+]0x[0-9a-f]+$/i,Hr=/^0b[01]+$/i,$r=/^0o[0-7]+$/i,Jr=parseInt;function Xr(t){if(typeof t=="number")return t;if(Wt(t))return Vt;if(c(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=c(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Gt(t);var r=Hr.test(t);return r||$r.test(t)?Jr(t.slice(2),r?2:8):qr.test(t)?Vt:+t}var At=Xr;var Yr="[object AsyncFunction]",Zr="[object Function]",Qr="[object GeneratorFunction]",to="[object Proxy]";function eo(t){if(!c(t))return!1;var e=h(t);return e==Zr||e==Qr||e==Yr||e==to}var et=eo;var ro=m["__core-js_shared__"],rt=ro;var Kt=function(){var t=/[^.]+$/.exec(rt&&rt.keys&&rt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function oo(t){return!!Kt&&Kt in t}var kt=oo;var ao=Function.prototype,fo=ao.toString;function so(t){if(t!=null){try{return fo.call(t)}catch{}try{return t+""}catch{}}return""}var T=so;var io=/[\\^$.*+?()[\]{}|]/g,no=/^\[object .+?Constructor\]$/,po=Function.prototype,uo=Object.prototype,mo=po.toString,lo=uo.hasOwnProperty,co=RegExp("^"+mo.call(lo).replace(io,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xo(t){if(!c(t)||kt(t))return!1;var e=et(t)?co:no;return e.test(T(t))}var zt=xo;function go(t,e){return t==null?void 0:t[e]}var qt=go;function ho(t,e){var r=qt(t,e);return zt(r)?r:void 0}var g=ho;var bo=g(m,"WeakMap"),ot=bo;var Ht=Object.create,yo=function(){function t(){}return function(e){if(!c(e))return{};if(Ht)return Ht(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),$t=yo;function vo(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var Jt=vo;var jo=function(){try{var t=g(Object,"defineProperty");return t({},"",{}),t}catch{}}(),_t=jo;function To(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Xt=To;var Oo=9007199254740991,Ao=/^(?:0|[1-9]\d*)$/;function _o(t,e){var r=typeof t;return e=e==null?Oo:e,!!e&&(r=="number"||r!="symbol"&&Ao.test(t))&&t>-1&&t%1==0&&t<e}var Yt=_o;function So(t,e,r){e=="__proto__"&&_t?_t(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var at=So;function Io(t,e){return t===e||t!==t&&e!==e}var ft=Io;var wo=Object.prototype,Po=wo.hasOwnProperty;function Co(t,e,r){var o=t[e];(!(Po.call(t,e)&&ft(o,r))||r===void 0&&!(e in t))&&at(t,e,r)}var st=Co;function Eo(t,e,r,o){var a=!r;r||(r={});for(var f=-1,s=e.length;++f<s;){var i=e[f],u=o?o(r[i],t[i],i,r,t):void 0;u===void 0&&(u=t[i]),a?at(r,i,u):st(r,i,u)}return r}var S=Eo;var Lo=9007199254740991;function Bo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Lo}var it=Bo;function Mo(t){return t!=null&&it(t.length)&&!et(t)}var nt=Mo;var No=Object.prototype;function Fo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||No;return t===r}var N=Fo;function Do(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Zt=Do;var Ro="[object Arguments]";function Wo(t){return x(t)&&h(t)==Ro}var St=Wo;var Qt=Object.prototype,Uo=Qt.hasOwnProperty,Go=Qt.propertyIsEnumerable,Vo=St(function(){return arguments}())?St:function(t){return x(t)&&Uo.call(t,"callee")&&!Go.call(t,"callee")},te=Vo;function Ko(){return!1}var ee=Ko;var ae=typeof exports=="object"&&exports&&!exports.nodeType&&exports,re=ae&&typeof module=="object"&&module&&!module.nodeType&&module,ko=re&&re.exports===ae,oe=ko?m.Buffer:void 0,zo=oe?oe.isBuffer:void 0,qo=zo||ee,pt=qo;var Ho="[object Arguments]",$o="[object Array]",Jo="[object Boolean]",Xo="[object Date]",Yo="[object Error]",Zo="[object Function]",Qo="[object Map]",ta="[object Number]",ea="[object Object]",ra="[object RegExp]",oa="[object Set]",aa="[object String]",fa="[object WeakMap]",sa="[object ArrayBuffer]",ia="[object DataView]",na="[object Float32Array]",pa="[object Float64Array]",ua="[object Int8Array]",ma="[object Int16Array]",la="[object Int32Array]",da="[object Uint8Array]",ca="[object Uint8ClampedArray]",xa="[object Uint16Array]",ga="[object Uint32Array]",p={};p[na]=p[pa]=p[ua]=p[ma]=p[la]=p[da]=p[ca]=p[xa]=p[ga]=!0;p[Ho]=p[$o]=p[sa]=p[Jo]=p[ia]=p[Xo]=p[Yo]=p[Zo]=p[Qo]=p[ta]=p[ea]=p[ra]=p[oa]=p[aa]=p[fa]=!1;function ha(t){return x(t)&&it(t.length)&&!!p[h(t)]}var fe=ha;function ba(t){return function(e){return t(e)}}var F=ba;var se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,X=se&&typeof module=="object"&&module&&!module.nodeType&&module,ya=X&&X.exports===se,It=ya&&tt.process,va=function(){try{var t=X&&X.require&&X.require("util").types;return t||It&&It.binding&&It.binding("util")}catch{}}(),O=va;var ie=O&&O.isTypedArray,ja=ie?F(ie):fe,ne=ja;var Ta=Object.prototype,Oa=Ta.hasOwnProperty;function Aa(t,e){var r=M(t),o=!r&&te(t),a=!r&&!o&&pt(t),f=!r&&!o&&!a&&ne(t),s=r||o||a||f,i=s?Zt(t.length,String):[],u=i.length;for(var d in t)(e||Oa.call(t,d))&&!(s&&(d=="length"||a&&(d=="offset"||d=="parent")||f&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Yt(d,u)))&&i.push(d);return i}var ut=Aa;function _a(t,e){return function(r){return t(e(r))}}var mt=_a;var Sa=mt(Object.keys,Object),pe=Sa;var Ia=Object.prototype,wa=Ia.hasOwnProperty;function Pa(t){if(!N(t))return pe(t);var e=[];for(var r in Object(t))wa.call(t,r)&&r!="constructor"&&e.push(r);return e}var ue=Pa;function Ca(t){return nt(t)?ut(t):ue(t)}var D=Ca;function Ea(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var me=Ea;var La=Object.prototype,Ba=La.hasOwnProperty;function Ma(t){if(!c(t))return me(t);var e=N(t),r=[];for(var o in t)o=="constructor"&&(e||!Ba.call(t,o))||r.push(o);return r}var le=Ma;function Na(t){return nt(t)?ut(t,!0):le(t)}var R=Na;var Fa=g(Object,"create"),A=Fa;function Da(){this.__data__=A?A(null):{},this.size=0}var de=Da;function Ra(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ce=Ra;var Wa="__lodash_hash_undefined__",Ua=Object.prototype,Ga=Ua.hasOwnProperty;function Va(t){var e=this.__data__;if(A){var r=e[t];return r===Wa?void 0:r}return Ga.call(e,t)?e[t]:void 0}var xe=Va;var Ka=Object.prototype,ka=Ka.hasOwnProperty;function za(t){var e=this.__data__;return A?e[t]!==void 0:ka.call(e,t)}var ge=za;var qa="__lodash_hash_undefined__";function Ha(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=A&&e===void 0?qa:e,this}var he=Ha;function W(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}W.prototype.clear=de;W.prototype.delete=ce;W.prototype.get=xe;W.prototype.has=ge;W.prototype.set=he;var wt=W;function $a(){this.__data__=[],this.size=0}var be=$a;function Ja(t,e){for(var r=t.length;r--;)if(ft(t[r][0],e))return r;return-1}var I=Ja;var Xa=Array.prototype,Ya=Xa.splice;function Za(t){var e=this.__data__,r=I(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Ya.call(e,r,1),--this.size,!0}var ye=Za;function Qa(t){var e=this.__data__,r=I(e,t);return r<0?void 0:e[r][1]}var ve=Qa;function tf(t){return I(this.__data__,t)>-1}var je=tf;function ef(t,e){var r=this.__data__,o=I(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Te=ef;function U(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}U.prototype.clear=be;U.prototype.delete=ye;U.prototype.get=ve;U.prototype.has=je;U.prototype.set=Te;var w=U;var rf=g(m,"Map"),P=rf;function of(){this.size=0,this.__data__={hash:new wt,map:new(P||w),string:new wt}}var Oe=of;function af(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ae=af;function ff(t,e){var r=t.__data__;return Ae(e)?r[typeof e=="string"?"string":"hash"]:r.map}var C=ff;function sf(t){var e=C(this,t).delete(t);return this.size-=e?1:0,e}var _e=sf;function nf(t){return C(this,t).get(t)}var Se=nf;function pf(t){return C(this,t).has(t)}var Ie=pf;function uf(t,e){var r=C(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var we=uf;function G(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}G.prototype.clear=Oe;G.prototype.delete=_e;G.prototype.get=Se;G.prototype.has=Ie;G.prototype.set=we;var Pe=G;function mf(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var lt=mf;var lf=mt(Object.getPrototypeOf,Object),V=lf;var df="[object Object]",cf=Function.prototype,xf=Object.prototype,Ce=cf.toString,gf=xf.hasOwnProperty,hf=Ce.call(Object);function bf(t){if(!x(t)||h(t)!=df)return!1;var e=V(t);if(e===null)return!0;var r=gf.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Ce.call(r)==hf}var Pt=bf;function yf(){this.__data__=new w,this.size=0}var Ee=yf;function vf(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Le=vf;function jf(t){return this.__data__.get(t)}var Be=jf;function Tf(t){return this.__data__.has(t)}var Me=Tf;var Of=200;function Af(t,e){var r=this.__data__;if(r instanceof w){var o=r.__data__;if(!P||o.length<Of-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new Pe(o)}return r.set(t,e),this.size=r.size,this}var Ne=Af;function K(t){var e=this.__data__=new w(t);this.size=e.size}K.prototype.clear=Ee;K.prototype.delete=Le;K.prototype.get=Be;K.prototype.has=Me;K.prototype.set=Ne;var Fe=K;function _f(t,e){return t&&S(e,D(e),t)}var De=_f;function Sf(t,e){return t&&S(e,R(e),t)}var Re=Sf;var Ve=typeof exports=="object"&&exports&&!exports.nodeType&&exports,We=Ve&&typeof module=="object"&&module&&!module.nodeType&&module,If=We&&We.exports===Ve,Ue=If?m.Buffer:void 0,Ge=Ue?Ue.allocUnsafe:void 0;function wf(t,e){if(e)return t.slice();var r=t.length,o=Ge?Ge(r):new t.constructor(r);return t.copy(o),o}var Ke=wf;function Pf(t,e){for(var r=-1,o=t==null?0:t.length,a=0,f=[];++r<o;){var s=t[r];e(s,r,t)&&(f[a++]=s)}return f}var ke=Pf;function Cf(){return[]}var dt=Cf;var Ef=Object.prototype,Lf=Ef.propertyIsEnumerable,ze=Object.getOwnPropertySymbols,Bf=ze?function(t){return t==null?[]:(t=Object(t),ke(ze(t),function(e){return Lf.call(t,e)}))}:dt,k=Bf;function Mf(t,e){return S(t,k(t),e)}var qe=Mf;var Nf=Object.getOwnPropertySymbols,Ff=Nf?function(t){for(var e=[];t;)lt(e,k(t)),t=V(t);return e}:dt,ct=Ff;function Df(t,e){return S(t,ct(t),e)}var He=Df;function Rf(t,e,r){var o=e(t);return M(t)?o:lt(o,r(t))}var xt=Rf;function Wf(t){return xt(t,D,k)}var $e=Wf;function Uf(t){return xt(t,R,ct)}var Je=Uf;var Gf=g(m,"DataView"),gt=Gf;var Vf=g(m,"Promise"),ht=Vf;var Kf=g(m,"Set"),bt=Kf;var Xe="[object Map]",kf="[object Object]",Ye="[object Promise]",Ze="[object Set]",Qe="[object WeakMap]",tr="[object DataView]",zf=T(gt),qf=T(P),Hf=T(ht),$f=T(bt),Jf=T(ot),E=h;(gt&&E(new gt(new ArrayBuffer(1)))!=tr||P&&E(new P)!=Xe||ht&&E(ht.resolve())!=Ye||bt&&E(new bt)!=Ze||ot&&E(new ot)!=Qe)&&(E=function(t){var e=h(t),r=e==kf?t.constructor:void 0,o=r?T(r):"";if(o)switch(o){case zf:return tr;case qf:return Xe;case Hf:return Ye;case $f:return Ze;case Jf:return Qe}return e});var z=E;var Xf=Object.prototype,Yf=Xf.hasOwnProperty;function Zf(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Yf.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var er=Zf;var Qf=m.Uint8Array,Ct=Qf;function ts(t){var e=new t.constructor(t.byteLength);return new Ct(e).set(new Ct(t)),e}var q=ts;function es(t,e){var r=e?q(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var rr=es;var rs=/\w*$/;function os(t){var e=new t.constructor(t.source,rs.exec(t));return e.lastIndex=t.lastIndex,e}var or=os;var ar=j?j.prototype:void 0,fr=ar?ar.valueOf:void 0;function as(t){return fr?Object(fr.call(t)):{}}var sr=as;function fs(t,e){var r=e?q(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var ir=fs;var ss="[object Boolean]",is="[object Date]",ns="[object Map]",ps="[object Number]",us="[object RegExp]",ms="[object Set]",ls="[object String]",ds="[object Symbol]",cs="[object ArrayBuffer]",xs="[object DataView]",gs="[object Float32Array]",hs="[object Float64Array]",bs="[object Int8Array]",ys="[object Int16Array]",vs="[object Int32Array]",js="[object Uint8Array]",Ts="[object Uint8ClampedArray]",Os="[object Uint16Array]",As="[object Uint32Array]";function _s(t,e,r){var o=t.constructor;switch(e){case cs:return q(t);case ss:case is:return new o(+t);case xs:return rr(t,r);case gs:case hs:case bs:case ys:case vs:case js:case Ts:case Os:case As:return ir(t,r);case ns:return new o;case ps:case ls:return new o(t);case us:return or(t);case ms:return new o;case ds:return sr(t)}}var nr=_s;function Ss(t){return typeof t.constructor=="function"&&!N(t)?$t(V(t)):{}}var pr=Ss;var Is="[object Map]";function ws(t){return x(t)&&z(t)==Is}var ur=ws;var mr=O&&O.isMap,Ps=mr?F(mr):ur,lr=Ps;var Cs="[object Set]";function Es(t){return x(t)&&z(t)==Cs}var dr=Es;var cr=O&&O.isSet,Ls=cr?F(cr):dr,xr=Ls;var Bs=1,Ms=2,Ns=4,gr="[object Arguments]",Fs="[object Array]",Ds="[object Boolean]",Rs="[object Date]",Ws="[object Error]",hr="[object Function]",Us="[object GeneratorFunction]",Gs="[object Map]",Vs="[object Number]",br="[object Object]",Ks="[object RegExp]",ks="[object Set]",zs="[object String]",qs="[object Symbol]",Hs="[object WeakMap]",$s="[object ArrayBuffer]",Js="[object DataView]",Xs="[object Float32Array]",Ys="[object Float64Array]",Zs="[object Int8Array]",Qs="[object Int16Array]",ti="[object Int32Array]",ei="[object Uint8Array]",ri="[object Uint8ClampedArray]",oi="[object Uint16Array]",ai="[object Uint32Array]",n={};n[gr]=n[Fs]=n[$s]=n[Js]=n[Ds]=n[Rs]=n[Xs]=n[Ys]=n[Zs]=n[Qs]=n[ti]=n[Gs]=n[Vs]=n[br]=n[Ks]=n[ks]=n[zs]=n[qs]=n[ei]=n[ri]=n[oi]=n[ai]=!0;n[Ws]=n[hr]=n[Hs]=!1;function yt(t,e,r,o,a,f){var s,i=e&Bs,u=e&Ms,d=e&Ns;if(r&&(s=a?r(t,o,a,f):r(t)),s!==void 0)return s;if(!c(t))return t;var H=M(t);if(H){if(s=er(t),!i)return Jt(t,s)}else{var b=z(t),L=b==hr||b==Us;if(pt(t))return Ke(t,i);if(b==br||b==gr||L&&!a){if(s=u||L?{}:pr(t),!i)return u?He(t,Re(s,t)):qe(t,De(s,t))}else{if(!n[b])return a?t:{};s=nr(t,b,i)}}f||(f=new Fe);var B=f.get(t);if(B)return B;f.set(t,s),xr(t)?t.forEach(function(v){s.add(yt(v,e,r,v,t,f))}):lr(t)&&t.forEach(function(v,y){s.set(y,yt(v,e,r,y,t,f))});var Tt=d?u?Je:$e:u?R:D,Z=H?void 0:Tt(t);return Xt(Z||t,function(v,y){Z&&(y=v,v=t[y]),st(s,y,yt(v,e,r,y,t,f))}),s}var yr=yt;var fi=1,si=4;function ii(t){return yr(t,fi|si)}var vt=ii;var ni=function(){return m.Date.now()},jt=ni;var pi="Expected a function",ui=Math.max,mi=Math.min;function li(t,e,r){var o,a,f,s,i,u,d=0,H=!1,b=!1,L=!0;if(typeof t!="function")throw new TypeError(pi);e=At(e)||0,c(r)&&(H=!!r.leading,b="maxWait"in r,f=b?ui(At(r.maxWait)||0,e):f,L="trailing"in r?!!r.trailing:L);function B(l){var _=o,$=a;return o=a=void 0,d=l,s=t.apply($,_),s}function Tt(l){return d=l,i=setTimeout(y,e),H?B(l):s}function Z(l){var _=l-u,$=l-d,Mt=e-_;return b?mi(Mt,f-$):Mt}function v(l){var _=l-u,$=l-d;return u===void 0||_>=e||_<0||b&&$>=f}function y(){var l=jt();if(v(l))return Bt(l);i=setTimeout(y,Z(l))}function Bt(l){return i=void 0,L&&o?B(l):(o=a=void 0,s)}function vr(){i!==void 0&&clearTimeout(i),d=0,o=u=a=i=void 0}function jr(){return i===void 0?s:Bt(jt())}function Ot(){var l=jt(),_=v(l);if(o=arguments,a=this,u=l,_){if(i===void 0)return Tt(u);if(b)return clearTimeout(i),i=setTimeout(y,e),B(u)}return i===void 0&&(i=setTimeout(y,e)),s}return Ot.cancel=vr,Ot.flush=jr,Ot}var Et=li;var Y=class{init(){}constructor(e,r){}};var Lt=class extends Y{constructor(){super(...arguments);Q(this,"Vue");Q(this,"projects");Q(this,"state",null)}bindProjectState(r){let o={component:null,componentKey:null,autoRequire:!0,read:!0,write:!0,throttle:{wait:200,maxWait:2e3,leading:!1,trailing:!0},...r};return Promise.resolve().then(()=>Promise.all([this.getProjectState({autoRequire:o.autoRequire}),(()=>{if(!o.componentKey){for(let a=0;a<50;a++){let f=`terafy_${a}`;if(!Object.hasOwnProperty(o.component,f)){o.componentKey=f;return}}throw new Error("Unable to find unique key to allocate against Vue2 component")}})()])).then(([a])=>{this.debug("INFO",2,"Got project snapshot",a);let f=this.Vue.observable(a);if(o.component[o.componentKey]=f,o.read&&this.events.on(`update:projects/${f.id}`,s=>{var i;(i=s==null?void 0:s.lastPatch)!=null&&i.session&&s.lastPatch.session==this.settings.session||(this.debug("INFO",5,"Update Vue2 Remote->Local",{new:s,old:f}),this.merge(f,s))}),o.write){if(!o.component)throw new Error("bindProjectState requires a VueComponent specified as `component`");let s=vt(a),i=u=>{this.debug("INFO",5,"Update Vue2 Local->Remote",{new:u,old:s}),this.createProjectStatePatch(u,s),s=vt(a)};o.component.$watch(o.componentKey,o.throttle?Et(i,o.throttle.wait,o.throttle):i,{deep:!0})}return f})}merge(r,...o){return o.forEach(a=>Object.keys(a).forEach(f=>{Pt(a[f])?(f in r||this.Vue.set(r,f,{}),this.merge(r[f],a[f])):this.Vue.set(r,f,a[f])})),r}init(r){let o={app:null,Vue:null,globalName:"$tera",requireProject:!0,subscribeState:!0,subscribeProjects:!0,stateOptions:{read:!0,write:!0},...r};if(!o.Vue)throw new Error("Vue instance to use must be specified in init options as `Vue`");if(this.Vue=r.Vue,!this.settings.app)throw new Error("Need to specify the root level Vue2 app during init");return o.stateOptions.app=this.settings.app,this.projects=this.Vue.observable([]),o.globalName&&(this.Vue.prototype[o.globalName]=this),this.state=null,Promise.resolve().then(()=>o.requireProject&&this.requireProject()).then(()=>Promise.all([o.subscribeState&&this.bindProjectState({...o.stateOptions,component:this.settings.app.$root}).then(a=>this.state=a).then(()=>this.debug("INFO",1,"Loaded initial project state",this.state)),o.subscribeProjects&&this.getProjects().then(a=>this.projects=this.Vue.observable(a)).then(()=>this.debug("INFO",2,"Loaded project list",this.projects))])).then(()=>this.debug("INFO",1,"Ready"))}};export{Lt as default};
|
|
1
|
+
var Tr=Object.defineProperty;var Or=(t,e,r)=>e in t?Tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Q=(t,e,r)=>Or(t,typeof e!="symbol"?e+"":e,r);var Ar=typeof global=="object"&&global&&global.Object===Object&&global,tt=Ar;var _r=typeof self=="object"&&self&&self.Object===Object&&self,Sr=tt||_r||Function("return this")(),m=Sr;var wr=m.Symbol,j=wr;var Nt=Object.prototype,Ir=Nt.hasOwnProperty,Pr=Nt.toString,J=j?j.toStringTag:void 0;function Cr(t){var e=Ir.call(t,J),r=t[J];try{t[J]=void 0;var o=!0}catch{}var a=Pr.call(t);return o&&(e?t[J]=r:delete t[J]),a}var Ft=Cr;var Er=Object.prototype,Lr=Er.toString;function Br(t){return Lr.call(t)}var Dt=Br;var Mr="[object Null]",Nr="[object Undefined]",Rt=j?j.toStringTag:void 0;function Fr(t){return t==null?t===void 0?Nr:Mr:Rt&&Rt in Object(t)?Ft(t):Dt(t)}var h=Fr;function Dr(t){return t!=null&&typeof t=="object"}var x=Dr;var Rr="[object Symbol]";function Wr(t){return typeof t=="symbol"||x(t)&&h(t)==Rr}var Wt=Wr;var Ur=Array.isArray,M=Ur;var Vr=/\s/;function Gr(t){for(var e=t.length;e--&&Vr.test(t.charAt(e)););return e}var Ut=Gr;var Kr=/^\s+/;function kr(t){return t&&t.slice(0,Ut(t)+1).replace(Kr,"")}var Vt=kr;function zr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var c=zr;var Gt=NaN,qr=/^[-+]0x[0-9a-f]+$/i,Hr=/^0b[01]+$/i,$r=/^0o[0-7]+$/i,Jr=parseInt;function Xr(t){if(typeof t=="number")return t;if(Wt(t))return Gt;if(c(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=c(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Vt(t);var r=Hr.test(t);return r||$r.test(t)?Jr(t.slice(2),r?2:8):qr.test(t)?Gt:+t}var At=Xr;var Yr="[object AsyncFunction]",Zr="[object Function]",Qr="[object GeneratorFunction]",to="[object Proxy]";function eo(t){if(!c(t))return!1;var e=h(t);return e==Zr||e==Qr||e==Yr||e==to}var et=eo;var ro=m["__core-js_shared__"],rt=ro;var Kt=function(){var t=/[^.]+$/.exec(rt&&rt.keys&&rt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function oo(t){return!!Kt&&Kt in t}var kt=oo;var ao=Function.prototype,fo=ao.toString;function so(t){if(t!=null){try{return fo.call(t)}catch{}try{return t+""}catch{}}return""}var T=so;var io=/[\\^$.*+?()[\]{}|]/g,no=/^\[object .+?Constructor\]$/,po=Function.prototype,uo=Object.prototype,mo=po.toString,lo=uo.hasOwnProperty,co=RegExp("^"+mo.call(lo).replace(io,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xo(t){if(!c(t)||kt(t))return!1;var e=et(t)?co:no;return e.test(T(t))}var zt=xo;function go(t,e){return t==null?void 0:t[e]}var qt=go;function ho(t,e){var r=qt(t,e);return zt(r)?r:void 0}var g=ho;var bo=g(m,"WeakMap"),ot=bo;var Ht=Object.create,yo=function(){function t(){}return function(e){if(!c(e))return{};if(Ht)return Ht(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),$t=yo;function vo(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var Jt=vo;var jo=function(){try{var t=g(Object,"defineProperty");return t({},"",{}),t}catch{}}(),_t=jo;function To(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Xt=To;var Oo=9007199254740991,Ao=/^(?:0|[1-9]\d*)$/;function _o(t,e){var r=typeof t;return e=e==null?Oo:e,!!e&&(r=="number"||r!="symbol"&&Ao.test(t))&&t>-1&&t%1==0&&t<e}var Yt=_o;function So(t,e,r){e=="__proto__"&&_t?_t(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var at=So;function wo(t,e){return t===e||t!==t&&e!==e}var ft=wo;var Io=Object.prototype,Po=Io.hasOwnProperty;function Co(t,e,r){var o=t[e];(!(Po.call(t,e)&&ft(o,r))||r===void 0&&!(e in t))&&at(t,e,r)}var st=Co;function Eo(t,e,r,o){var a=!r;r||(r={});for(var f=-1,s=e.length;++f<s;){var i=e[f],u=o?o(r[i],t[i],i,r,t):void 0;u===void 0&&(u=t[i]),a?at(r,i,u):st(r,i,u)}return r}var S=Eo;var Lo=9007199254740991;function Bo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Lo}var it=Bo;function Mo(t){return t!=null&&it(t.length)&&!et(t)}var nt=Mo;var No=Object.prototype;function Fo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||No;return t===r}var N=Fo;function Do(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Zt=Do;var Ro="[object Arguments]";function Wo(t){return x(t)&&h(t)==Ro}var St=Wo;var Qt=Object.prototype,Uo=Qt.hasOwnProperty,Vo=Qt.propertyIsEnumerable,Go=St(function(){return arguments}())?St:function(t){return x(t)&&Uo.call(t,"callee")&&!Vo.call(t,"callee")},te=Go;function Ko(){return!1}var ee=Ko;var ae=typeof exports=="object"&&exports&&!exports.nodeType&&exports,re=ae&&typeof module=="object"&&module&&!module.nodeType&&module,ko=re&&re.exports===ae,oe=ko?m.Buffer:void 0,zo=oe?oe.isBuffer:void 0,qo=zo||ee,pt=qo;var Ho="[object Arguments]",$o="[object Array]",Jo="[object Boolean]",Xo="[object Date]",Yo="[object Error]",Zo="[object Function]",Qo="[object Map]",ta="[object Number]",ea="[object Object]",ra="[object RegExp]",oa="[object Set]",aa="[object String]",fa="[object WeakMap]",sa="[object ArrayBuffer]",ia="[object DataView]",na="[object Float32Array]",pa="[object Float64Array]",ua="[object Int8Array]",ma="[object Int16Array]",la="[object Int32Array]",da="[object Uint8Array]",ca="[object Uint8ClampedArray]",xa="[object Uint16Array]",ga="[object Uint32Array]",p={};p[na]=p[pa]=p[ua]=p[ma]=p[la]=p[da]=p[ca]=p[xa]=p[ga]=!0;p[Ho]=p[$o]=p[sa]=p[Jo]=p[ia]=p[Xo]=p[Yo]=p[Zo]=p[Qo]=p[ta]=p[ea]=p[ra]=p[oa]=p[aa]=p[fa]=!1;function ha(t){return x(t)&&it(t.length)&&!!p[h(t)]}var fe=ha;function ba(t){return function(e){return t(e)}}var F=ba;var se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,X=se&&typeof module=="object"&&module&&!module.nodeType&&module,ya=X&&X.exports===se,wt=ya&&tt.process,va=function(){try{var t=X&&X.require&&X.require("util").types;return t||wt&&wt.binding&&wt.binding("util")}catch{}}(),O=va;var ie=O&&O.isTypedArray,ja=ie?F(ie):fe,ne=ja;var Ta=Object.prototype,Oa=Ta.hasOwnProperty;function Aa(t,e){var r=M(t),o=!r&&te(t),a=!r&&!o&&pt(t),f=!r&&!o&&!a&&ne(t),s=r||o||a||f,i=s?Zt(t.length,String):[],u=i.length;for(var d in t)(e||Oa.call(t,d))&&!(s&&(d=="length"||a&&(d=="offset"||d=="parent")||f&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Yt(d,u)))&&i.push(d);return i}var ut=Aa;function _a(t,e){return function(r){return t(e(r))}}var mt=_a;var Sa=mt(Object.keys,Object),pe=Sa;var wa=Object.prototype,Ia=wa.hasOwnProperty;function Pa(t){if(!N(t))return pe(t);var e=[];for(var r in Object(t))Ia.call(t,r)&&r!="constructor"&&e.push(r);return e}var ue=Pa;function Ca(t){return nt(t)?ut(t):ue(t)}var D=Ca;function Ea(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var me=Ea;var La=Object.prototype,Ba=La.hasOwnProperty;function Ma(t){if(!c(t))return me(t);var e=N(t),r=[];for(var o in t)o=="constructor"&&(e||!Ba.call(t,o))||r.push(o);return r}var le=Ma;function Na(t){return nt(t)?ut(t,!0):le(t)}var R=Na;var Fa=g(Object,"create"),A=Fa;function Da(){this.__data__=A?A(null):{},this.size=0}var de=Da;function Ra(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ce=Ra;var Wa="__lodash_hash_undefined__",Ua=Object.prototype,Va=Ua.hasOwnProperty;function Ga(t){var e=this.__data__;if(A){var r=e[t];return r===Wa?void 0:r}return Va.call(e,t)?e[t]:void 0}var xe=Ga;var Ka=Object.prototype,ka=Ka.hasOwnProperty;function za(t){var e=this.__data__;return A?e[t]!==void 0:ka.call(e,t)}var ge=za;var qa="__lodash_hash_undefined__";function Ha(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=A&&e===void 0?qa:e,this}var he=Ha;function W(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}W.prototype.clear=de;W.prototype.delete=ce;W.prototype.get=xe;W.prototype.has=ge;W.prototype.set=he;var It=W;function $a(){this.__data__=[],this.size=0}var be=$a;function Ja(t,e){for(var r=t.length;r--;)if(ft(t[r][0],e))return r;return-1}var w=Ja;var Xa=Array.prototype,Ya=Xa.splice;function Za(t){var e=this.__data__,r=w(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Ya.call(e,r,1),--this.size,!0}var ye=Za;function Qa(t){var e=this.__data__,r=w(e,t);return r<0?void 0:e[r][1]}var ve=Qa;function tf(t){return w(this.__data__,t)>-1}var je=tf;function ef(t,e){var r=this.__data__,o=w(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Te=ef;function U(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}U.prototype.clear=be;U.prototype.delete=ye;U.prototype.get=ve;U.prototype.has=je;U.prototype.set=Te;var I=U;var rf=g(m,"Map"),P=rf;function of(){this.size=0,this.__data__={hash:new It,map:new(P||I),string:new It}}var Oe=of;function af(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ae=af;function ff(t,e){var r=t.__data__;return Ae(e)?r[typeof e=="string"?"string":"hash"]:r.map}var C=ff;function sf(t){var e=C(this,t).delete(t);return this.size-=e?1:0,e}var _e=sf;function nf(t){return C(this,t).get(t)}var Se=nf;function pf(t){return C(this,t).has(t)}var we=pf;function uf(t,e){var r=C(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ie=uf;function V(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}V.prototype.clear=Oe;V.prototype.delete=_e;V.prototype.get=Se;V.prototype.has=we;V.prototype.set=Ie;var Pe=V;function mf(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var lt=mf;var lf=mt(Object.getPrototypeOf,Object),G=lf;var df="[object Object]",cf=Function.prototype,xf=Object.prototype,Ce=cf.toString,gf=xf.hasOwnProperty,hf=Ce.call(Object);function bf(t){if(!x(t)||h(t)!=df)return!1;var e=G(t);if(e===null)return!0;var r=gf.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Ce.call(r)==hf}var Pt=bf;function yf(){this.__data__=new I,this.size=0}var Ee=yf;function vf(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Le=vf;function jf(t){return this.__data__.get(t)}var Be=jf;function Tf(t){return this.__data__.has(t)}var Me=Tf;var Of=200;function Af(t,e){var r=this.__data__;if(r instanceof I){var o=r.__data__;if(!P||o.length<Of-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new Pe(o)}return r.set(t,e),this.size=r.size,this}var Ne=Af;function K(t){var e=this.__data__=new I(t);this.size=e.size}K.prototype.clear=Ee;K.prototype.delete=Le;K.prototype.get=Be;K.prototype.has=Me;K.prototype.set=Ne;var Fe=K;function _f(t,e){return t&&S(e,D(e),t)}var De=_f;function Sf(t,e){return t&&S(e,R(e),t)}var Re=Sf;var Ge=typeof exports=="object"&&exports&&!exports.nodeType&&exports,We=Ge&&typeof module=="object"&&module&&!module.nodeType&&module,wf=We&&We.exports===Ge,Ue=wf?m.Buffer:void 0,Ve=Ue?Ue.allocUnsafe:void 0;function If(t,e){if(e)return t.slice();var r=t.length,o=Ve?Ve(r):new t.constructor(r);return t.copy(o),o}var Ke=If;function Pf(t,e){for(var r=-1,o=t==null?0:t.length,a=0,f=[];++r<o;){var s=t[r];e(s,r,t)&&(f[a++]=s)}return f}var ke=Pf;function Cf(){return[]}var dt=Cf;var Ef=Object.prototype,Lf=Ef.propertyIsEnumerable,ze=Object.getOwnPropertySymbols,Bf=ze?function(t){return t==null?[]:(t=Object(t),ke(ze(t),function(e){return Lf.call(t,e)}))}:dt,k=Bf;function Mf(t,e){return S(t,k(t),e)}var qe=Mf;var Nf=Object.getOwnPropertySymbols,Ff=Nf?function(t){for(var e=[];t;)lt(e,k(t)),t=G(t);return e}:dt,ct=Ff;function Df(t,e){return S(t,ct(t),e)}var He=Df;function Rf(t,e,r){var o=e(t);return M(t)?o:lt(o,r(t))}var xt=Rf;function Wf(t){return xt(t,D,k)}var $e=Wf;function Uf(t){return xt(t,R,ct)}var Je=Uf;var Vf=g(m,"DataView"),gt=Vf;var Gf=g(m,"Promise"),ht=Gf;var Kf=g(m,"Set"),bt=Kf;var Xe="[object Map]",kf="[object Object]",Ye="[object Promise]",Ze="[object Set]",Qe="[object WeakMap]",tr="[object DataView]",zf=T(gt),qf=T(P),Hf=T(ht),$f=T(bt),Jf=T(ot),E=h;(gt&&E(new gt(new ArrayBuffer(1)))!=tr||P&&E(new P)!=Xe||ht&&E(ht.resolve())!=Ye||bt&&E(new bt)!=Ze||ot&&E(new ot)!=Qe)&&(E=function(t){var e=h(t),r=e==kf?t.constructor:void 0,o=r?T(r):"";if(o)switch(o){case zf:return tr;case qf:return Xe;case Hf:return Ye;case $f:return Ze;case Jf:return Qe}return e});var z=E;var Xf=Object.prototype,Yf=Xf.hasOwnProperty;function Zf(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Yf.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var er=Zf;var Qf=m.Uint8Array,Ct=Qf;function ts(t){var e=new t.constructor(t.byteLength);return new Ct(e).set(new Ct(t)),e}var q=ts;function es(t,e){var r=e?q(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var rr=es;var rs=/\w*$/;function os(t){var e=new t.constructor(t.source,rs.exec(t));return e.lastIndex=t.lastIndex,e}var or=os;var ar=j?j.prototype:void 0,fr=ar?ar.valueOf:void 0;function as(t){return fr?Object(fr.call(t)):{}}var sr=as;function fs(t,e){var r=e?q(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var ir=fs;var ss="[object Boolean]",is="[object Date]",ns="[object Map]",ps="[object Number]",us="[object RegExp]",ms="[object Set]",ls="[object String]",ds="[object Symbol]",cs="[object ArrayBuffer]",xs="[object DataView]",gs="[object Float32Array]",hs="[object Float64Array]",bs="[object Int8Array]",ys="[object Int16Array]",vs="[object Int32Array]",js="[object Uint8Array]",Ts="[object Uint8ClampedArray]",Os="[object Uint16Array]",As="[object Uint32Array]";function _s(t,e,r){var o=t.constructor;switch(e){case cs:return q(t);case ss:case is:return new o(+t);case xs:return rr(t,r);case gs:case hs:case bs:case ys:case vs:case js:case Ts:case Os:case As:return ir(t,r);case ns:return new o;case ps:case ls:return new o(t);case us:return or(t);case ms:return new o;case ds:return sr(t)}}var nr=_s;function Ss(t){return typeof t.constructor=="function"&&!N(t)?$t(G(t)):{}}var pr=Ss;var ws="[object Map]";function Is(t){return x(t)&&z(t)==ws}var ur=Is;var mr=O&&O.isMap,Ps=mr?F(mr):ur,lr=Ps;var Cs="[object Set]";function Es(t){return x(t)&&z(t)==Cs}var dr=Es;var cr=O&&O.isSet,Ls=cr?F(cr):dr,xr=Ls;var Bs=1,Ms=2,Ns=4,gr="[object Arguments]",Fs="[object Array]",Ds="[object Boolean]",Rs="[object Date]",Ws="[object Error]",hr="[object Function]",Us="[object GeneratorFunction]",Vs="[object Map]",Gs="[object Number]",br="[object Object]",Ks="[object RegExp]",ks="[object Set]",zs="[object String]",qs="[object Symbol]",Hs="[object WeakMap]",$s="[object ArrayBuffer]",Js="[object DataView]",Xs="[object Float32Array]",Ys="[object Float64Array]",Zs="[object Int8Array]",Qs="[object Int16Array]",ti="[object Int32Array]",ei="[object Uint8Array]",ri="[object Uint8ClampedArray]",oi="[object Uint16Array]",ai="[object Uint32Array]",n={};n[gr]=n[Fs]=n[$s]=n[Js]=n[Ds]=n[Rs]=n[Xs]=n[Ys]=n[Zs]=n[Qs]=n[ti]=n[Vs]=n[Gs]=n[br]=n[Ks]=n[ks]=n[zs]=n[qs]=n[ei]=n[ri]=n[oi]=n[ai]=!0;n[Ws]=n[hr]=n[Hs]=!1;function yt(t,e,r,o,a,f){var s,i=e&Bs,u=e&Ms,d=e&Ns;if(r&&(s=a?r(t,o,a,f):r(t)),s!==void 0)return s;if(!c(t))return t;var H=M(t);if(H){if(s=er(t),!i)return Jt(t,s)}else{var b=z(t),L=b==hr||b==Us;if(pt(t))return Ke(t,i);if(b==br||b==gr||L&&!a){if(s=u||L?{}:pr(t),!i)return u?He(t,Re(s,t)):qe(t,De(s,t))}else{if(!n[b])return a?t:{};s=nr(t,b,i)}}f||(f=new Fe);var B=f.get(t);if(B)return B;f.set(t,s),xr(t)?t.forEach(function(v){s.add(yt(v,e,r,v,t,f))}):lr(t)&&t.forEach(function(v,y){s.set(y,yt(v,e,r,y,t,f))});var Tt=d?u?Je:$e:u?R:D,Z=H?void 0:Tt(t);return Xt(Z||t,function(v,y){Z&&(y=v,v=t[y]),st(s,y,yt(v,e,r,y,t,f))}),s}var yr=yt;var fi=1,si=4;function ii(t){return yr(t,fi|si)}var vt=ii;var ni=function(){return m.Date.now()},jt=ni;var pi="Expected a function",ui=Math.max,mi=Math.min;function li(t,e,r){var o,a,f,s,i,u,d=0,H=!1,b=!1,L=!0;if(typeof t!="function")throw new TypeError(pi);e=At(e)||0,c(r)&&(H=!!r.leading,b="maxWait"in r,f=b?ui(At(r.maxWait)||0,e):f,L="trailing"in r?!!r.trailing:L);function B(l){var _=o,$=a;return o=a=void 0,d=l,s=t.apply($,_),s}function Tt(l){return d=l,i=setTimeout(y,e),H?B(l):s}function Z(l){var _=l-u,$=l-d,Mt=e-_;return b?mi(Mt,f-$):Mt}function v(l){var _=l-u,$=l-d;return u===void 0||_>=e||_<0||b&&$>=f}function y(){var l=jt();if(v(l))return Bt(l);i=setTimeout(y,Z(l))}function Bt(l){return i=void 0,L&&o?B(l):(o=a=void 0,s)}function vr(){i!==void 0&&clearTimeout(i),d=0,o=u=a=i=void 0}function jr(){return i===void 0?s:Bt(jt())}function Ot(){var l=jt(),_=v(l);if(o=arguments,a=this,u=l,_){if(i===void 0)return Tt(u);if(b)return clearTimeout(i),i=setTimeout(y,e),B(u)}return i===void 0&&(i=setTimeout(y,e)),s}return Ot.cancel=vr,Ot.flush=jr,Ot}var Et=li;var Y=class{init(){}constructor(e,r){}};var Lt=class extends Y{constructor(){super(...arguments);Q(this,"Vue");Q(this,"projects");Q(this,"state",null)}bindProjectState(r){let o={component:null,componentKey:null,autoRequire:!0,read:!0,write:!0,throttle:{wait:200,maxWait:2e3,leading:!1,trailing:!0},...r};return Promise.resolve().then(()=>Promise.all([this.getProjectState({autoRequire:o.autoRequire}),(()=>{if(!o.componentKey){for(let a=0;a<50;a++){let f=`terafy_${a}`;if(!Object.hasOwnProperty(o.component,f)){o.componentKey=f;return}}throw new Error("Unable to find unique key to allocate against Vue2 component")}})()])).then(([a])=>{this.debug("INFO",2,"Got project snapshot",a);let f=this.Vue.observable(a);if(o.component[o.componentKey]=f,o.read&&this.events.on(`update:projects/${f.id}`,s=>{var i;(i=s==null?void 0:s.lastPatch)!=null&&i.session&&s.lastPatch.session==this.settings.session||(this.debug("INFO",5,"Update Vue2 Remote->Local",{new:s,old:f}),this.merge(f,s))}),o.write){if(!o.component)throw new Error("bindProjectState requires a VueComponent specified as `component`");let s=vt(a),i=()=>{let u=vt(a);this.debug("INFO",5,"Update Vue2 Local->Remote",{new:u,old:s}),this.createProjectStatePatch(u,s),s=u};o.component.$watch(o.componentKey,o.throttle?Et(i,o.throttle.wait,o.throttle):i,{deep:!0})}return f})}merge(r,...o){return o.forEach(a=>Object.keys(a).forEach(f=>{Pt(a[f])?(f in r||this.Vue.set(r,f,{}),this.merge(r[f],a[f])):this.Vue.set(r,f,a[f])})),r}init(r){let o={app:null,Vue:null,globalName:"$tera",requireProject:!0,subscribeState:!0,subscribeProjects:!0,stateOptions:{read:!0,write:!0},...r};if(!o.Vue)throw new Error("Vue instance to use must be specified in init options as `Vue`");if(this.Vue=r.Vue,!this.settings.app)throw new Error("Need to specify the root level Vue2 app during init");return o.stateOptions.app=this.settings.app,this.projects=this.Vue.observable([]),o.globalName&&(this.Vue.prototype[o.globalName]=this),this.state=null,Promise.resolve().then(()=>o.requireProject&&this.requireProject()).then(()=>Promise.all([o.subscribeState&&this.bindProjectState({...o.stateOptions,component:this.settings.app.$root}).then(a=>this.state=a).then(()=>this.debug("INFO",1,"Loaded initial project state",this.state)),o.subscribeProjects&&this.getProjects().then(a=>this.projects=this.Vue.observable(a)).then(()=>this.debug("INFO",2,"Loaded project list",this.projects))])).then(()=>this.debug("INFO",1,"Ready"))}};export{Lt as default};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
lodash-es/lodash.js:
|
package/dist/terafy.es2019.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var uo=Object.defineProperty;var co=(t,e,r)=>e in t?uo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e,r)=>co(t,typeof e!="symbol"?e+"":e,r);function qt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:x,diffs:v}){var O=Object.keys(i),P=O.length,y=Object.keys(f),_=y.length,b,p=i.length-f.length;if(xo(i,f)){for(var u=0;u<P;u++){var l=Array.isArray(i)?Number(O[u]):O[u];l in f||(b=x.concat(l),v.remove.push({op:"remove",path:r(b)}))}for(var u=0;u<_;u++){var l=Array.isArray(f)?Number(y[u]):y[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:v})}}else{for(var u=0;u<p;u++)b=x.concat(u),v.remove.push({op:"remove",path:r(b)});for(var E=i.slice(p),u=0;u<_;u++)s({key:u,obj1:E,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:v})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:x,pathForRemoves:v,diffs:O}){var P=f[i],y=m[i];if(!(i in f)&&i in m){var _=y;O.add.push({op:"add",path:r(x),value:_})}else P!==y&&(Object(P)!==P||Object(y)!==y||ho(P,y)||!Object.keys(P).length&&!Object.keys(y).length&&String(P)!=String(y)?n(x,O,y):o({obj1:f[i],obj2:m[i],basePath:x,basePathForRemoves:v,diffs:O}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function ho(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function xo(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var go=typeof global=="object"&&global&&global.Object===Object&&global,dt=go;var yo=typeof self=="object"&&self&&self.Object===Object&&self,bo=dt||yo||Function("return this")(),g=bo;var vo=g.Symbol,T=vo;var Yt=Object.prototype,wo=Yt.hasOwnProperty,To=Yt.toString,pt=T?T.toStringTag:void 0;function Po(t){var e=wo.call(t,pt),r=t[pt];try{t[pt]=void 0;var o=!0}catch{}var a=To.call(t);return o&&(e?t[pt]=r:delete t[pt]),a}var Zt=Po;var Ao=Object.prototype,Oo=Ao.toString;function jo(t){return Oo.call(t)}var Jt=jo;var So="[object Null]",Io="[object Undefined]",Xt=T?T.toStringTag:void 0;function _o(t){return t==null?t===void 0?Io:So:Xt&&Xt in Object(t)?Zt(t):Jt(t)}var I=_o;function Eo(t){return t!=null&&typeof t=="object"}var S=Eo;var Co="[object Symbol]";function Fo(t){return typeof t=="symbol"||S(t)&&I(t)==Co}var K=Fo;function Mo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var Qt=Mo;var Ro=Array.isArray,w=Ro;var No=1/0,te=T?T.prototype:void 0,ee=te?te.toString:void 0;function re(t){if(typeof t=="string")return t;if(w(t))return Qt(t,re)+"";if(K(t))return ee?ee.call(t):"";var e=t+"";return e=="0"&&1/t==-No?"-0":e}var oe=re;function Lo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var j=Lo;function Bo(t){return t}var ae=Bo;var ko="[object AsyncFunction]",Uo="[object Function]",Do="[object GeneratorFunction]",zo="[object Proxy]";function Ko(t){if(!j(t))return!1;var e=I(t);return e==Uo||e==Do||e==ko||e==zo}var ct=Ko;var Go=g["__core-js_shared__"],ht=Go;var ie=function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Wo(t){return!!ie&&ie in t}var se=Wo;var $o=Function.prototype,Ho=$o.toString;function Vo(t){if(t!=null){try{return Ho.call(t)}catch{}try{return t+""}catch{}}return""}var C=Vo;var qo=/[\\^$.*+?()[\]{}|]/g,Yo=/^\[object .+?Constructor\]$/,Zo=Function.prototype,Jo=Object.prototype,Xo=Zo.toString,Qo=Jo.hasOwnProperty,ta=RegExp("^"+Xo.call(Qo).replace(qo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ea(t){if(!j(t)||se(t))return!1;var e=ct(t)?ta:Yo;return e.test(C(t))}var ne=ea;function ra(t,e){return t==null?void 0:t[e]}var fe=ra;function oa(t,e){var r=fe(t,e);return ne(r)?r:void 0}var A=oa;var aa=A(g,"WeakMap"),xt=aa;var pe=Object.create,ia=function(){function t(){}return function(e){if(!j(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),le=ia;function sa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var me=sa;function na(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ue=na;var fa=800,pa=16,la=Date.now;function ma(t){var e=0,r=0;return function(){var o=la(),a=pa-(o-r);if(r=o,a>0){if(++e>=fa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var de=ma;function ua(t){return function(){return t}}var ce=ua;var da=function(){try{var t=A(Object,"defineProperty");return t({},"",{}),t}catch{}}(),G=da;var ca=G?function(t,e){return G(t,"toString",{configurable:!0,enumerable:!1,value:ce(e),writable:!0})}:ae,he=ca;var ha=de(he),xe=ha;function xa(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=xa;var ga=9007199254740991,ya=/^(?:0|[1-9]\d*)$/;function ba(t,e){var r=typeof t;return e=e==null?ga:e,!!e&&(r=="number"||r!="symbol"&&ya.test(t))&&t>-1&&t%1==0&&t<e}var W=ba;function va(t,e,r){e=="__proto__"&&G?G(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=va;function wa(t,e){return t===e||t!==t&&e!==e}var yt=wa;var Ta=Object.prototype,Pa=Ta.hasOwnProperty;function Aa(t,e,r){var o=t[e];(!(Pa.call(t,e)&&yt(o,r))||r===void 0&&!(e in t))&>(t,e,r)}var $=Aa;function Oa(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?gt(r,i,f):$(r,i,f)}return r}var R=Oa;var ye=Math.max;function ja(t,e,r){return e=ye(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=ye(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),me(t,this,i)}}var be=ja;var Sa=9007199254740991;function Ia(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Sa}var H=Ia;function _a(t){return t!=null&&H(t.length)&&!ct(t)}var bt=_a;var Ea=Object.prototype;function Ca(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ea;return t===r}var V=Ca;function Fa(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ve=Fa;var Ma="[object Arguments]";function Ra(t){return S(t)&&I(t)==Ma}var Mt=Ra;var we=Object.prototype,Na=we.hasOwnProperty,La=we.propertyIsEnumerable,Ba=Mt(function(){return arguments}())?Mt:function(t){return S(t)&&Na.call(t,"callee")&&!La.call(t,"callee")},q=Ba;function ka(){return!1}var Te=ka;var Oe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pe=Oe&&typeof module=="object"&&module&&!module.nodeType&&module,Ua=Pe&&Pe.exports===Oe,Ae=Ua?g.Buffer:void 0,Da=Ae?Ae.isBuffer:void 0,za=Da||Te,vt=za;var Ka="[object Arguments]",Ga="[object Array]",Wa="[object Boolean]",$a="[object Date]",Ha="[object Error]",Va="[object Function]",qa="[object Map]",Ya="[object Number]",Za="[object Object]",Ja="[object RegExp]",Xa="[object Set]",Qa="[object String]",ti="[object WeakMap]",ei="[object ArrayBuffer]",ri="[object DataView]",oi="[object Float32Array]",ai="[object Float64Array]",ii="[object Int8Array]",si="[object Int16Array]",ni="[object Int32Array]",fi="[object Uint8Array]",pi="[object Uint8ClampedArray]",li="[object Uint16Array]",mi="[object Uint32Array]",h={};h[oi]=h[ai]=h[ii]=h[si]=h[ni]=h[fi]=h[pi]=h[li]=h[mi]=!0;h[Ka]=h[Ga]=h[ei]=h[Wa]=h[ri]=h[$a]=h[Ha]=h[Va]=h[qa]=h[Ya]=h[Za]=h[Ja]=h[Xa]=h[Qa]=h[ti]=!1;function ui(t){return S(t)&&H(t.length)&&!!h[I(t)]}var je=ui;function di(t){return function(e){return t(e)}}var Y=di;var Se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lt=Se&&typeof module=="object"&&module&&!module.nodeType&&module,ci=lt&<.exports===Se,Rt=ci&&dt.process,hi=function(){try{var t=lt&<.require&<.require("util").types;return t||Rt&&Rt.binding&&Rt.binding("util")}catch{}}(),F=hi;var Ie=F&&F.isTypedArray,xi=Ie?Y(Ie):je,_e=xi;var gi=Object.prototype,yi=gi.hasOwnProperty;function bi(t,e){var r=w(t),o=!r&&q(t),a=!r&&!o&&vt(t),s=!r&&!o&&!a&&_e(t),n=r||o||a||s,i=n?ve(t.length,String):[],f=i.length;for(var m in t)(e||yi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||W(m,f)))&&i.push(m);return i}var wt=bi;function vi(t,e){return function(r){return t(e(r))}}var Tt=vi;var wi=Tt(Object.keys,Object),Ee=wi;var Ti=Object.prototype,Pi=Ti.hasOwnProperty;function Ai(t){if(!V(t))return Ee(t);var e=[];for(var r in Object(t))Pi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ce=Ai;function Oi(t){return bt(t)?wt(t):Ce(t)}var Z=Oi;function ji(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Fe=ji;var Si=Object.prototype,Ii=Si.hasOwnProperty;function _i(t){if(!j(t))return Fe(t);var e=V(t),r=[];for(var o in t)o=="constructor"&&(e||!Ii.call(t,o))||r.push(o);return r}var Me=_i;function Ei(t){return bt(t)?wt(t,!0):Me(t)}var J=Ei;var Ci=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fi=/^\w*$/;function Mi(t,e){if(w(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||K(t)?!0:Fi.test(t)||!Ci.test(t)||e!=null&&t in Object(e)}var Re=Mi;var Ri=A(Object,"create"),M=Ri;function Ni(){this.__data__=M?M(null):{},this.size=0}var Ne=Ni;function Li(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Le=Li;var Bi="__lodash_hash_undefined__",ki=Object.prototype,Ui=ki.hasOwnProperty;function Di(t){var e=this.__data__;if(M){var r=e[t];return r===Bi?void 0:r}return Ui.call(e,t)?e[t]:void 0}var Be=Di;var zi=Object.prototype,Ki=zi.hasOwnProperty;function Gi(t){var e=this.__data__;return M?e[t]!==void 0:Ki.call(e,t)}var ke=Gi;var Wi="__lodash_hash_undefined__";function $i(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=M&&e===void 0?Wi:e,this}var Ue=$i;function X(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}X.prototype.clear=Ne;X.prototype.delete=Le;X.prototype.get=Be;X.prototype.has=ke;X.prototype.set=Ue;var Nt=X;function Hi(){this.__data__=[],this.size=0}var De=Hi;function Vi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var N=Vi;var qi=Array.prototype,Yi=qi.splice;function Zi(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Yi.call(e,r,1),--this.size,!0}var ze=Zi;function Ji(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}var Ke=Ji;function Xi(t){return N(this.__data__,t)>-1}var Ge=Xi;function Qi(t,e){var r=this.__data__,o=N(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var We=Qi;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=De;Q.prototype.delete=ze;Q.prototype.get=Ke;Q.prototype.has=Ge;Q.prototype.set=We;var L=Q;var ts=A(g,"Map"),B=ts;function es(){this.size=0,this.__data__={hash:new Nt,map:new(B||L),string:new Nt}}var $e=es;function rs(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var He=rs;function os(t,e){var r=t.__data__;return He(e)?r[typeof e=="string"?"string":"hash"]:r.map}var k=os;function as(t){var e=k(this,t).delete(t);return this.size-=e?1:0,e}var Ve=as;function is(t){return k(this,t).get(t)}var qe=is;function ss(t){return k(this,t).has(t)}var Ye=ss;function ns(t,e){var r=k(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ze=ns;function tt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}tt.prototype.clear=$e;tt.prototype.delete=Ve;tt.prototype.get=qe;tt.prototype.has=Ye;tt.prototype.set=Ze;var mt=tt;var fs="Expected a function";function Lt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(fs);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Lt.Cache||mt),r}Lt.Cache=mt;var Je=Lt;var ps=500;function ls(t){var e=Je(t,function(o){return r.size===ps&&r.clear(),o}),r=e.cache;return e}var Xe=ls;var ms=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,us=/\\(\\)?/g,ds=Xe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ms,function(r,o,a,s){e.push(a?s.replace(us,"$1"):o||r)}),e}),Qe=ds;function cs(t){return t==null?"":oe(t)}var tr=cs;function hs(t,e){return w(t)?t:Re(t,e)?[t]:Qe(tr(t))}var U=hs;var xs=1/0;function gs(t){if(typeof t=="string"||K(t))return t;var e=t+"";return e=="0"&&1/t==-xs?"-0":e}var et=gs;function ys(t,e){e=U(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[et(e[r++])];return r&&r==o?t:void 0}var er=ys;function bs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var rt=bs;var rr=T?T.isConcatSpreadable:void 0;function vs(t){return w(t)||q(t)||!!(rr&&t&&t[rr])}var or=vs;function ar(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=or),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?ar(i,e-1,r,o,a):rt(a,i):o||(a[a.length]=i)}return a}var ir=ar;function ws(t){var e=t==null?0:t.length;return e?ir(t,1):[]}var sr=ws;function Ts(t){return xe(be(t,void 0,sr),t+"")}var nr=Ts;var Ps=Tt(Object.getPrototypeOf,Object),Pt=Ps;function As(){this.__data__=new L,this.size=0}var fr=As;function Os(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var pr=Os;function js(t){return this.__data__.get(t)}var lr=js;function Ss(t){return this.__data__.has(t)}var mr=Ss;var Is=200;function _s(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!B||o.length<Is-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new mt(o)}return r.set(t,e),this.size=r.size,this}var ur=_s;function ot(t){var e=this.__data__=new L(t);this.size=e.size}ot.prototype.clear=fr;ot.prototype.delete=pr;ot.prototype.get=lr;ot.prototype.has=mr;ot.prototype.set=ur;var dr=ot;function Es(t,e){return t&&R(e,Z(e),t)}var cr=Es;function Cs(t,e){return t&&R(e,J(e),t)}var hr=Cs;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xr=br&&typeof module=="object"&&module&&!module.nodeType&&module,Fs=xr&&xr.exports===br,gr=Fs?g.Buffer:void 0,yr=gr?gr.allocUnsafe:void 0;function Ms(t,e){if(e)return t.slice();var r=t.length,o=yr?yr(r):new t.constructor(r);return t.copy(o),o}var vr=Ms;function Rs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var wr=Rs;function Ns(){return[]}var At=Ns;var Ls=Object.prototype,Bs=Ls.propertyIsEnumerable,Tr=Object.getOwnPropertySymbols,ks=Tr?function(t){return t==null?[]:(t=Object(t),wr(Tr(t),function(e){return Bs.call(t,e)}))}:At,at=ks;function Us(t,e){return R(t,at(t),e)}var Pr=Us;var Ds=Object.getOwnPropertySymbols,zs=Ds?function(t){for(var e=[];t;)rt(e,at(t)),t=Pt(t);return e}:At,Ot=zs;function Ks(t,e){return R(t,Ot(t),e)}var Ar=Ks;function Gs(t,e,r){var o=e(t);return w(t)?o:rt(o,r(t))}var jt=Gs;function Ws(t){return jt(t,Z,at)}var Or=Ws;function $s(t){return jt(t,J,Ot)}var jr=$s;var Hs=A(g,"DataView"),St=Hs;var Vs=A(g,"Promise"),It=Vs;var qs=A(g,"Set"),_t=qs;var Sr="[object Map]",Ys="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Cr="[object DataView]",Zs=C(St),Js=C(B),Xs=C(It),Qs=C(_t),tn=C(xt),z=I;(St&&z(new St(new ArrayBuffer(1)))!=Cr||B&&z(new B)!=Sr||It&&z(It.resolve())!=Ir||_t&&z(new _t)!=_r||xt&&z(new xt)!=Er)&&(z=function(t){var e=I(t),r=e==Ys?t.constructor:void 0,o=r?C(r):"";if(o)switch(o){case Zs:return Cr;case Js:return Sr;case Xs:return Ir;case Qs:return _r;case tn:return Er}return e});var it=z;var en=Object.prototype,rn=en.hasOwnProperty;function on(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&rn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Fr=on;var an=g.Uint8Array,Bt=an;function sn(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}var st=sn;function nn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Mr=nn;var fn=/\w*$/;function pn(t){var e=new t.constructor(t.source,fn.exec(t));return e.lastIndex=t.lastIndex,e}var Rr=pn;var Nr=T?T.prototype:void 0,Lr=Nr?Nr.valueOf:void 0;function ln(t){return Lr?Object(Lr.call(t)):{}}var Br=ln;function mn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var kr=mn;var un="[object Boolean]",dn="[object Date]",cn="[object Map]",hn="[object Number]",xn="[object RegExp]",gn="[object Set]",yn="[object String]",bn="[object Symbol]",vn="[object ArrayBuffer]",wn="[object DataView]",Tn="[object Float32Array]",Pn="[object Float64Array]",An="[object Int8Array]",On="[object Int16Array]",jn="[object Int32Array]",Sn="[object Uint8Array]",In="[object Uint8ClampedArray]",_n="[object Uint16Array]",En="[object Uint32Array]";function Cn(t,e,r){var o=t.constructor;switch(e){case vn:return st(t);case un:case dn:return new o(+t);case wn:return Mr(t,r);case Tn:case Pn:case An:case On:case jn:case Sn:case In:case _n:case En:return kr(t,r);case cn:return new o;case hn:case yn:return new o(t);case xn:return Rr(t);case gn:return new o;case bn:return Br(t)}}var Ur=Cn;function Fn(t){return typeof t.constructor=="function"&&!V(t)?le(Pt(t)):{}}var Dr=Fn;var Mn="[object Map]";function Rn(t){return S(t)&&it(t)==Mn}var zr=Rn;var Kr=F&&F.isMap,Nn=Kr?Y(Kr):zr,Gr=Nn;var Ln="[object Set]";function Bn(t){return S(t)&&it(t)==Ln}var Wr=Bn;var $r=F&&F.isSet,kn=$r?Y($r):Wr,Hr=kn;var Un=1,Dn=2,zn=4,Vr="[object Arguments]",Kn="[object Array]",Gn="[object Boolean]",Wn="[object Date]",$n="[object Error]",qr="[object Function]",Hn="[object GeneratorFunction]",Vn="[object Map]",qn="[object Number]",Yr="[object Object]",Yn="[object RegExp]",Zn="[object Set]",Jn="[object String]",Xn="[object Symbol]",Qn="[object WeakMap]",tf="[object ArrayBuffer]",ef="[object DataView]",rf="[object Float32Array]",of="[object Float64Array]",af="[object Int8Array]",sf="[object Int16Array]",nf="[object Int32Array]",ff="[object Uint8Array]",pf="[object Uint8ClampedArray]",lf="[object Uint16Array]",mf="[object Uint32Array]",c={};c[Vr]=c[Kn]=c[tf]=c[ef]=c[Gn]=c[Wn]=c[rf]=c[of]=c[af]=c[sf]=c[nf]=c[Vn]=c[qn]=c[Yr]=c[Yn]=c[Zn]=c[Jn]=c[Xn]=c[ff]=c[pf]=c[lf]=c[mf]=!0;c[$n]=c[qr]=c[Qn]=!1;function Et(t,e,r,o,a,s){var n,i=e&Un,f=e&Dn,m=e&zn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!j(t))return t;var x=w(t);if(x){if(n=Fr(t),!i)return ue(t,n)}else{var v=it(t),O=v==qr||v==Hn;if(vt(t))return vr(t,i);if(v==Yr||v==Vr||O&&!a){if(n=f||O?{}:Dr(t),!i)return f?Ar(t,hr(n,t)):Pr(t,cr(n,t))}else{if(!c[v])return a?t:{};n=Ur(t,v,i)}}s||(s=new dr);var P=s.get(t);if(P)return P;s.set(t,n),Hr(t)?t.forEach(function(b){n.add(Et(b,e,r,b,t,s))}):Gr(t)&&t.forEach(function(b,p){n.set(p,Et(b,e,r,p,t,s))});var y=m?f?jr:Or:f?J:Z,_=x?void 0:y(t);return ge(_||t,function(b,p){_&&(p=b,b=t[p]),$(n,p,Et(b,e,r,p,t,s))}),n}var Zr=Et;var uf=1,df=4;function cf(t){return Zr(t,uf|df)}var kt=cf;function hf(t,e){return t!=null&&e in Object(t)}var Jr=hf;function xf(t,e,r){e=U(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=et(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&H(a)&&W(n,a)&&(w(t)||q(t)))}var Xr=xf;function gf(t,e){return t!=null&&Xr(t,e,Jr)}var Qr=gf;function yf(t,e,r,o){if(!j(t))return t;e=U(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=et(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var x=i[f];m=o?o(x,f,i):void 0,m===void 0&&(m=j(x)?x:W(e[a+1])?[]:{})}$(i,f,m),i=i[f]}return t}var to=yf;function bf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=er(t,n);r(i,n)&&to(s,U(n,t),i)}return s}var eo=bf;function vf(t,e){return eo(t,e,function(r,o){return Qr(t,o)})}var ro=vf;var wf=nr(function(t,e){return t==null?{}:ro(t,e)}),Ct=wf;function oo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var ao="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ut=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=ao[r[t]&63];return e};var Tf="array",Pf="bit",io="bits",Af="byte",so="bytes",nt="",Of="exponent",jf="function",no="iec",Sf="Invalid number",If="Invalid rounding method",Dt="jedec",_f="object",fo=".",Ef="round",Cf="s",Ff="si",Mf="kbit",Rf="kB",Nf=" ",Lf="string",Bf="0",zt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function po(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=nt,localeOptions:n={},separator:i=nt,spacer:f=Nf,symbols:m={},standard:x=nt,output:v=Lf,fullform:O=!1,fullforms:P=[],exponent:y=-1,roundingMethod:_=Ef,precision:b=0}={}){let p=y,u=Number(t),l=[],E=0,Ft=nt;x===Ff?(o=10,x=Dt):x===no||x===Dt?o=2:o===2?x=no:(o=10,x=Dt);let ut=o===10?1e3:1024,lo=O===!0,Gt=u<0,Wt=Math[_];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Sf);if(typeof Wt!==jf)throw new TypeError(If);if(Gt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(ut)),p<0&&(p=0)),p>8&&(b>0&&(b+=8-p),p=8),v===Of)return p;if(u===0)l[0]=0,Ft=l[1]=zt.symbol[x][e?io:so][p];else{E=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(E=E*8,E>=ut&&p<8&&(E=E/ut,p++));let ft=Math.pow(10,p>0?a:0);l[0]=Wt(E*ft)/ft,l[0]===ut&&p<8&&y===-1&&(l[0]=1,p++),Ft=l[1]=o===10&&p===1?e?Mf:Rf:zt.symbol[x][e?io:so][p]}if(Gt&&(l[0]=-l[0]),b>0&&(l[0]=l[0].toPrecision(b)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(fo,i)),r&&Number.isInteger(l[0])===!1&&a>0){let ft=i||fo,$t=l[0].toString().split(ft),Ht=$t[1]||nt,Vt=Ht.length,mo=a-Vt;l[0]=`${$t[0]}${ft}${Ht.padEnd(Vt+mo,Bf)}`}return lo&&(l[1]=P[p]?P[p]:zt.fullform[x][p]+(e?Pf:Af)+(l[0]===1?nt:Cf)),v===Tf?l:v===_f?{value:l[0],symbol:l[1],exponent:p,unit:Ft}:l.join(f)}var D=class t{constructor(e){d(this,"_tera");d(this,"id");d(this,"name");d(this,"icon");d(this,"path");d(this,"url");d(this,"teraUrl");d(this,"parsedName");d(this,"created");d(this,"createdFormatted");d(this,"modified");d(this,"modifiedFormatted");d(this,"accessed");d(this,"accessedFormatted");d(this,"size");d(this,"sizeFormatted");d(this,"mime");d(this,"meta",{});if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=po(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Ct(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Ct(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var Kt=class{constructor(e){d(this,"settings",{session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null});d(this,"events",oo());d(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});d(this,"methods",["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"]);d(this,"plugins",[]);d(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Ut();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Ut(),...kt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Recieved message",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):(r==null?void 0:r.action)=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):(r==null?void 0:r.action)=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r!=null&&r.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}createProjectStatePatch(e,r){let o=qt(r,e);return this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatch(e){if(this.settings.devMode&&this.settings.debugPaths){if(!Array.isArray(this.settings.debugPaths))throw new Error("teraFyClient.settings.debugPaths should be either null or an Array<String>");let r=e.filter(o=>this.settings.debugPaths.some(a=>o.path.join(".").slice(0,a.length)==a)).map(o=>o.path.join("."));if(r.length>0){console.info("Detected writes to",r,"- entering debugging mode");debugger}}return this.rpc("applyProjectStatePatch",e,{session:this.settings.session})}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>{var o;return(o=this.settings).session||(o.session="tfy-"+this.getEntropicString(16))}).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths=this.settings.debugPaths?Array.isArray(this.settings.debugPaths)?this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):(()=>{throw new Error("Unknown terafyClient.settings.debugPaths type")})():null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[6/6] Init complete")).catch(o=>this.debug("WARN",0,"Init process fault",o))}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let s=0,n,i=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
1
|
+
var uo=Object.defineProperty;var co=(t,e,r)=>e in t?uo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e,r)=>co(t,typeof e!="symbol"?e+"":e,r);function qt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:g,diffs:v}){var O=Object.keys(i),P=O.length,y=Object.keys(f),_=y.length,b,p=i.length-f.length;if(go(i,f)){for(var u=0;u<P;u++){var l=Array.isArray(i)?Number(O[u]):O[u];l in f||(b=g.concat(l),v.remove.push({op:"remove",path:r(b)}))}for(var u=0;u<_;u++){var l=Array.isArray(f)?Number(y[u]):y[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:v})}}else{for(var u=0;u<p;u++)b=g.concat(u),v.remove.push({op:"remove",path:r(b)});for(var E=i.slice(p),u=0;u<_;u++)s({key:u,obj1:E,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:v})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:g,pathForRemoves:v,diffs:O}){var P=f[i],y=m[i];if(!(i in f)&&i in m){var _=y;O.add.push({op:"add",path:r(g),value:_})}else P!==y&&(Object(P)!==P||Object(y)!==y||ho(P,y)||!Object.keys(P).length&&!Object.keys(y).length&&String(P)!=String(y)?n(g,O,y):o({obj1:f[i],obj2:m[i],basePath:g,basePathForRemoves:v,diffs:O}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function ho(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function go(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var xo=typeof global=="object"&&global&&global.Object===Object&&global,dt=xo;var yo=typeof self=="object"&&self&&self.Object===Object&&self,bo=dt||yo||Function("return this")(),x=bo;var vo=x.Symbol,T=vo;var Yt=Object.prototype,wo=Yt.hasOwnProperty,To=Yt.toString,pt=T?T.toStringTag:void 0;function Po(t){var e=wo.call(t,pt),r=t[pt];try{t[pt]=void 0;var o=!0}catch{}var a=To.call(t);return o&&(e?t[pt]=r:delete t[pt]),a}var Zt=Po;var Ao=Object.prototype,Oo=Ao.toString;function jo(t){return Oo.call(t)}var Jt=jo;var So="[object Null]",Io="[object Undefined]",Xt=T?T.toStringTag:void 0;function _o(t){return t==null?t===void 0?Io:So:Xt&&Xt in Object(t)?Zt(t):Jt(t)}var I=_o;function Eo(t){return t!=null&&typeof t=="object"}var S=Eo;var Co="[object Symbol]";function Fo(t){return typeof t=="symbol"||S(t)&&I(t)==Co}var K=Fo;function Mo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var Qt=Mo;var No=Array.isArray,w=No;var Ro=1/0,te=T?T.prototype:void 0,ee=te?te.toString:void 0;function re(t){if(typeof t=="string")return t;if(w(t))return Qt(t,re)+"";if(K(t))return ee?ee.call(t):"";var e=t+"";return e=="0"&&1/t==-Ro?"-0":e}var oe=re;function Lo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var j=Lo;function Bo(t){return t}var ae=Bo;var ko="[object AsyncFunction]",Uo="[object Function]",Do="[object GeneratorFunction]",zo="[object Proxy]";function Ko(t){if(!j(t))return!1;var e=I(t);return e==Uo||e==Do||e==ko||e==zo}var ct=Ko;var Go=x["__core-js_shared__"],ht=Go;var ie=function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Wo(t){return!!ie&&ie in t}var se=Wo;var $o=Function.prototype,Ho=$o.toString;function Vo(t){if(t!=null){try{return Ho.call(t)}catch{}try{return t+""}catch{}}return""}var C=Vo;var qo=/[\\^$.*+?()[\]{}|]/g,Yo=/^\[object .+?Constructor\]$/,Zo=Function.prototype,Jo=Object.prototype,Xo=Zo.toString,Qo=Jo.hasOwnProperty,ta=RegExp("^"+Xo.call(Qo).replace(qo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ea(t){if(!j(t)||se(t))return!1;var e=ct(t)?ta:Yo;return e.test(C(t))}var ne=ea;function ra(t,e){return t==null?void 0:t[e]}var fe=ra;function oa(t,e){var r=fe(t,e);return ne(r)?r:void 0}var A=oa;var aa=A(x,"WeakMap"),gt=aa;var pe=Object.create,ia=function(){function t(){}return function(e){if(!j(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),le=ia;function sa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var me=sa;function na(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ue=na;var fa=800,pa=16,la=Date.now;function ma(t){var e=0,r=0;return function(){var o=la(),a=pa-(o-r);if(r=o,a>0){if(++e>=fa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var de=ma;function ua(t){return function(){return t}}var ce=ua;var da=function(){try{var t=A(Object,"defineProperty");return t({},"",{}),t}catch{}}(),G=da;var ca=G?function(t,e){return G(t,"toString",{configurable:!0,enumerable:!1,value:ce(e),writable:!0})}:ae,he=ca;var ha=de(he),ge=ha;function ga(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var xe=ga;var xa=9007199254740991,ya=/^(?:0|[1-9]\d*)$/;function ba(t,e){var r=typeof t;return e=e==null?xa:e,!!e&&(r=="number"||r!="symbol"&&ya.test(t))&&t>-1&&t%1==0&&t<e}var W=ba;function va(t,e,r){e=="__proto__"&&G?G(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var xt=va;function wa(t,e){return t===e||t!==t&&e!==e}var yt=wa;var Ta=Object.prototype,Pa=Ta.hasOwnProperty;function Aa(t,e,r){var o=t[e];(!(Pa.call(t,e)&&yt(o,r))||r===void 0&&!(e in t))&&xt(t,e,r)}var $=Aa;function Oa(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?xt(r,i,f):$(r,i,f)}return r}var N=Oa;var ye=Math.max;function ja(t,e,r){return e=ye(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=ye(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),me(t,this,i)}}var be=ja;var Sa=9007199254740991;function Ia(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Sa}var H=Ia;function _a(t){return t!=null&&H(t.length)&&!ct(t)}var bt=_a;var Ea=Object.prototype;function Ca(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ea;return t===r}var V=Ca;function Fa(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ve=Fa;var Ma="[object Arguments]";function Na(t){return S(t)&&I(t)==Ma}var Mt=Na;var we=Object.prototype,Ra=we.hasOwnProperty,La=we.propertyIsEnumerable,Ba=Mt(function(){return arguments}())?Mt:function(t){return S(t)&&Ra.call(t,"callee")&&!La.call(t,"callee")},q=Ba;function ka(){return!1}var Te=ka;var Oe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pe=Oe&&typeof module=="object"&&module&&!module.nodeType&&module,Ua=Pe&&Pe.exports===Oe,Ae=Ua?x.Buffer:void 0,Da=Ae?Ae.isBuffer:void 0,za=Da||Te,vt=za;var Ka="[object Arguments]",Ga="[object Array]",Wa="[object Boolean]",$a="[object Date]",Ha="[object Error]",Va="[object Function]",qa="[object Map]",Ya="[object Number]",Za="[object Object]",Ja="[object RegExp]",Xa="[object Set]",Qa="[object String]",ti="[object WeakMap]",ei="[object ArrayBuffer]",ri="[object DataView]",oi="[object Float32Array]",ai="[object Float64Array]",ii="[object Int8Array]",si="[object Int16Array]",ni="[object Int32Array]",fi="[object Uint8Array]",pi="[object Uint8ClampedArray]",li="[object Uint16Array]",mi="[object Uint32Array]",h={};h[oi]=h[ai]=h[ii]=h[si]=h[ni]=h[fi]=h[pi]=h[li]=h[mi]=!0;h[Ka]=h[Ga]=h[ei]=h[Wa]=h[ri]=h[$a]=h[Ha]=h[Va]=h[qa]=h[Ya]=h[Za]=h[Ja]=h[Xa]=h[Qa]=h[ti]=!1;function ui(t){return S(t)&&H(t.length)&&!!h[I(t)]}var je=ui;function di(t){return function(e){return t(e)}}var Y=di;var Se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lt=Se&&typeof module=="object"&&module&&!module.nodeType&&module,ci=lt&<.exports===Se,Nt=ci&&dt.process,hi=function(){try{var t=lt&<.require&<.require("util").types;return t||Nt&&Nt.binding&&Nt.binding("util")}catch{}}(),F=hi;var Ie=F&&F.isTypedArray,gi=Ie?Y(Ie):je,_e=gi;var xi=Object.prototype,yi=xi.hasOwnProperty;function bi(t,e){var r=w(t),o=!r&&q(t),a=!r&&!o&&vt(t),s=!r&&!o&&!a&&_e(t),n=r||o||a||s,i=n?ve(t.length,String):[],f=i.length;for(var m in t)(e||yi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||W(m,f)))&&i.push(m);return i}var wt=bi;function vi(t,e){return function(r){return t(e(r))}}var Tt=vi;var wi=Tt(Object.keys,Object),Ee=wi;var Ti=Object.prototype,Pi=Ti.hasOwnProperty;function Ai(t){if(!V(t))return Ee(t);var e=[];for(var r in Object(t))Pi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ce=Ai;function Oi(t){return bt(t)?wt(t):Ce(t)}var Z=Oi;function ji(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Fe=ji;var Si=Object.prototype,Ii=Si.hasOwnProperty;function _i(t){if(!j(t))return Fe(t);var e=V(t),r=[];for(var o in t)o=="constructor"&&(e||!Ii.call(t,o))||r.push(o);return r}var Me=_i;function Ei(t){return bt(t)?wt(t,!0):Me(t)}var J=Ei;var Ci=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fi=/^\w*$/;function Mi(t,e){if(w(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||K(t)?!0:Fi.test(t)||!Ci.test(t)||e!=null&&t in Object(e)}var Ne=Mi;var Ni=A(Object,"create"),M=Ni;function Ri(){this.__data__=M?M(null):{},this.size=0}var Re=Ri;function Li(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Le=Li;var Bi="__lodash_hash_undefined__",ki=Object.prototype,Ui=ki.hasOwnProperty;function Di(t){var e=this.__data__;if(M){var r=e[t];return r===Bi?void 0:r}return Ui.call(e,t)?e[t]:void 0}var Be=Di;var zi=Object.prototype,Ki=zi.hasOwnProperty;function Gi(t){var e=this.__data__;return M?e[t]!==void 0:Ki.call(e,t)}var ke=Gi;var Wi="__lodash_hash_undefined__";function $i(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=M&&e===void 0?Wi:e,this}var Ue=$i;function X(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}X.prototype.clear=Re;X.prototype.delete=Le;X.prototype.get=Be;X.prototype.has=ke;X.prototype.set=Ue;var Rt=X;function Hi(){this.__data__=[],this.size=0}var De=Hi;function Vi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var R=Vi;var qi=Array.prototype,Yi=qi.splice;function Zi(t){var e=this.__data__,r=R(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Yi.call(e,r,1),--this.size,!0}var ze=Zi;function Ji(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var Ke=Ji;function Xi(t){return R(this.__data__,t)>-1}var Ge=Xi;function Qi(t,e){var r=this.__data__,o=R(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var We=Qi;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=De;Q.prototype.delete=ze;Q.prototype.get=Ke;Q.prototype.has=Ge;Q.prototype.set=We;var L=Q;var ts=A(x,"Map"),B=ts;function es(){this.size=0,this.__data__={hash:new Rt,map:new(B||L),string:new Rt}}var $e=es;function rs(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var He=rs;function os(t,e){var r=t.__data__;return He(e)?r[typeof e=="string"?"string":"hash"]:r.map}var k=os;function as(t){var e=k(this,t).delete(t);return this.size-=e?1:0,e}var Ve=as;function is(t){return k(this,t).get(t)}var qe=is;function ss(t){return k(this,t).has(t)}var Ye=ss;function ns(t,e){var r=k(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ze=ns;function tt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}tt.prototype.clear=$e;tt.prototype.delete=Ve;tt.prototype.get=qe;tt.prototype.has=Ye;tt.prototype.set=Ze;var mt=tt;var fs="Expected a function";function Lt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(fs);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Lt.Cache||mt),r}Lt.Cache=mt;var Je=Lt;var ps=500;function ls(t){var e=Je(t,function(o){return r.size===ps&&r.clear(),o}),r=e.cache;return e}var Xe=ls;var ms=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,us=/\\(\\)?/g,ds=Xe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ms,function(r,o,a,s){e.push(a?s.replace(us,"$1"):o||r)}),e}),Qe=ds;function cs(t){return t==null?"":oe(t)}var tr=cs;function hs(t,e){return w(t)?t:Ne(t,e)?[t]:Qe(tr(t))}var U=hs;var gs=1/0;function xs(t){if(typeof t=="string"||K(t))return t;var e=t+"";return e=="0"&&1/t==-gs?"-0":e}var et=xs;function ys(t,e){e=U(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[et(e[r++])];return r&&r==o?t:void 0}var er=ys;function bs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var rt=bs;var rr=T?T.isConcatSpreadable:void 0;function vs(t){return w(t)||q(t)||!!(rr&&t&&t[rr])}var or=vs;function ar(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=or),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?ar(i,e-1,r,o,a):rt(a,i):o||(a[a.length]=i)}return a}var ir=ar;function ws(t){var e=t==null?0:t.length;return e?ir(t,1):[]}var sr=ws;function Ts(t){return ge(be(t,void 0,sr),t+"")}var nr=Ts;var Ps=Tt(Object.getPrototypeOf,Object),Pt=Ps;function As(){this.__data__=new L,this.size=0}var fr=As;function Os(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var pr=Os;function js(t){return this.__data__.get(t)}var lr=js;function Ss(t){return this.__data__.has(t)}var mr=Ss;var Is=200;function _s(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!B||o.length<Is-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new mt(o)}return r.set(t,e),this.size=r.size,this}var ur=_s;function ot(t){var e=this.__data__=new L(t);this.size=e.size}ot.prototype.clear=fr;ot.prototype.delete=pr;ot.prototype.get=lr;ot.prototype.has=mr;ot.prototype.set=ur;var dr=ot;function Es(t,e){return t&&N(e,Z(e),t)}var cr=Es;function Cs(t,e){return t&&N(e,J(e),t)}var hr=Cs;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gr=br&&typeof module=="object"&&module&&!module.nodeType&&module,Fs=gr&&gr.exports===br,xr=Fs?x.Buffer:void 0,yr=xr?xr.allocUnsafe:void 0;function Ms(t,e){if(e)return t.slice();var r=t.length,o=yr?yr(r):new t.constructor(r);return t.copy(o),o}var vr=Ms;function Ns(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var wr=Ns;function Rs(){return[]}var At=Rs;var Ls=Object.prototype,Bs=Ls.propertyIsEnumerable,Tr=Object.getOwnPropertySymbols,ks=Tr?function(t){return t==null?[]:(t=Object(t),wr(Tr(t),function(e){return Bs.call(t,e)}))}:At,at=ks;function Us(t,e){return N(t,at(t),e)}var Pr=Us;var Ds=Object.getOwnPropertySymbols,zs=Ds?function(t){for(var e=[];t;)rt(e,at(t)),t=Pt(t);return e}:At,Ot=zs;function Ks(t,e){return N(t,Ot(t),e)}var Ar=Ks;function Gs(t,e,r){var o=e(t);return w(t)?o:rt(o,r(t))}var jt=Gs;function Ws(t){return jt(t,Z,at)}var Or=Ws;function $s(t){return jt(t,J,Ot)}var jr=$s;var Hs=A(x,"DataView"),St=Hs;var Vs=A(x,"Promise"),It=Vs;var qs=A(x,"Set"),_t=qs;var Sr="[object Map]",Ys="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Cr="[object DataView]",Zs=C(St),Js=C(B),Xs=C(It),Qs=C(_t),tn=C(gt),z=I;(St&&z(new St(new ArrayBuffer(1)))!=Cr||B&&z(new B)!=Sr||It&&z(It.resolve())!=Ir||_t&&z(new _t)!=_r||gt&&z(new gt)!=Er)&&(z=function(t){var e=I(t),r=e==Ys?t.constructor:void 0,o=r?C(r):"";if(o)switch(o){case Zs:return Cr;case Js:return Sr;case Xs:return Ir;case Qs:return _r;case tn:return Er}return e});var it=z;var en=Object.prototype,rn=en.hasOwnProperty;function on(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&rn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Fr=on;var an=x.Uint8Array,Bt=an;function sn(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}var st=sn;function nn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Mr=nn;var fn=/\w*$/;function pn(t){var e=new t.constructor(t.source,fn.exec(t));return e.lastIndex=t.lastIndex,e}var Nr=pn;var Rr=T?T.prototype:void 0,Lr=Rr?Rr.valueOf:void 0;function ln(t){return Lr?Object(Lr.call(t)):{}}var Br=ln;function mn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var kr=mn;var un="[object Boolean]",dn="[object Date]",cn="[object Map]",hn="[object Number]",gn="[object RegExp]",xn="[object Set]",yn="[object String]",bn="[object Symbol]",vn="[object ArrayBuffer]",wn="[object DataView]",Tn="[object Float32Array]",Pn="[object Float64Array]",An="[object Int8Array]",On="[object Int16Array]",jn="[object Int32Array]",Sn="[object Uint8Array]",In="[object Uint8ClampedArray]",_n="[object Uint16Array]",En="[object Uint32Array]";function Cn(t,e,r){var o=t.constructor;switch(e){case vn:return st(t);case un:case dn:return new o(+t);case wn:return Mr(t,r);case Tn:case Pn:case An:case On:case jn:case Sn:case In:case _n:case En:return kr(t,r);case cn:return new o;case hn:case yn:return new o(t);case gn:return Nr(t);case xn:return new o;case bn:return Br(t)}}var Ur=Cn;function Fn(t){return typeof t.constructor=="function"&&!V(t)?le(Pt(t)):{}}var Dr=Fn;var Mn="[object Map]";function Nn(t){return S(t)&&it(t)==Mn}var zr=Nn;var Kr=F&&F.isMap,Rn=Kr?Y(Kr):zr,Gr=Rn;var Ln="[object Set]";function Bn(t){return S(t)&&it(t)==Ln}var Wr=Bn;var $r=F&&F.isSet,kn=$r?Y($r):Wr,Hr=kn;var Un=1,Dn=2,zn=4,Vr="[object Arguments]",Kn="[object Array]",Gn="[object Boolean]",Wn="[object Date]",$n="[object Error]",qr="[object Function]",Hn="[object GeneratorFunction]",Vn="[object Map]",qn="[object Number]",Yr="[object Object]",Yn="[object RegExp]",Zn="[object Set]",Jn="[object String]",Xn="[object Symbol]",Qn="[object WeakMap]",tf="[object ArrayBuffer]",ef="[object DataView]",rf="[object Float32Array]",of="[object Float64Array]",af="[object Int8Array]",sf="[object Int16Array]",nf="[object Int32Array]",ff="[object Uint8Array]",pf="[object Uint8ClampedArray]",lf="[object Uint16Array]",mf="[object Uint32Array]",c={};c[Vr]=c[Kn]=c[tf]=c[ef]=c[Gn]=c[Wn]=c[rf]=c[of]=c[af]=c[sf]=c[nf]=c[Vn]=c[qn]=c[Yr]=c[Yn]=c[Zn]=c[Jn]=c[Xn]=c[ff]=c[pf]=c[lf]=c[mf]=!0;c[$n]=c[qr]=c[Qn]=!1;function Et(t,e,r,o,a,s){var n,i=e&Un,f=e&Dn,m=e&zn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!j(t))return t;var g=w(t);if(g){if(n=Fr(t),!i)return ue(t,n)}else{var v=it(t),O=v==qr||v==Hn;if(vt(t))return vr(t,i);if(v==Yr||v==Vr||O&&!a){if(n=f||O?{}:Dr(t),!i)return f?Ar(t,hr(n,t)):Pr(t,cr(n,t))}else{if(!c[v])return a?t:{};n=Ur(t,v,i)}}s||(s=new dr);var P=s.get(t);if(P)return P;s.set(t,n),Hr(t)?t.forEach(function(b){n.add(Et(b,e,r,b,t,s))}):Gr(t)&&t.forEach(function(b,p){n.set(p,Et(b,e,r,p,t,s))});var y=m?f?jr:Or:f?J:Z,_=g?void 0:y(t);return xe(_||t,function(b,p){_&&(p=b,b=t[p]),$(n,p,Et(b,e,r,p,t,s))}),n}var Zr=Et;var uf=1,df=4;function cf(t){return Zr(t,uf|df)}var kt=cf;function hf(t,e){return t!=null&&e in Object(t)}var Jr=hf;function gf(t,e,r){e=U(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=et(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&H(a)&&W(n,a)&&(w(t)||q(t)))}var Xr=gf;function xf(t,e){return t!=null&&Xr(t,e,Jr)}var Qr=xf;function yf(t,e,r,o){if(!j(t))return t;e=U(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=et(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var g=i[f];m=o?o(g,f,i):void 0,m===void 0&&(m=j(g)?g:W(e[a+1])?[]:{})}$(i,f,m),i=i[f]}return t}var to=yf;function bf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=er(t,n);r(i,n)&&to(s,U(n,t),i)}return s}var eo=bf;function vf(t,e){return eo(t,e,function(r,o){return Qr(t,o)})}var ro=vf;var wf=nr(function(t,e){return t==null?{}:ro(t,e)}),Ct=wf;function oo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var ao="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ut=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=ao[r[t]&63];return e};var Tf="array",Pf="bit",io="bits",Af="byte",so="bytes",nt="",Of="exponent",jf="function",no="iec",Sf="Invalid number",If="Invalid rounding method",Dt="jedec",_f="object",fo=".",Ef="round",Cf="s",Ff="si",Mf="kbit",Nf="kB",Rf=" ",Lf="string",Bf="0",zt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function po(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=nt,localeOptions:n={},separator:i=nt,spacer:f=Rf,symbols:m={},standard:g=nt,output:v=Lf,fullform:O=!1,fullforms:P=[],exponent:y=-1,roundingMethod:_=Ef,precision:b=0}={}){let p=y,u=Number(t),l=[],E=0,Ft=nt;g===Ff?(o=10,g=Dt):g===no||g===Dt?o=2:o===2?g=no:(o=10,g=Dt);let ut=o===10?1e3:1024,lo=O===!0,Gt=u<0,Wt=Math[_];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Sf);if(typeof Wt!==jf)throw new TypeError(If);if(Gt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(ut)),p<0&&(p=0)),p>8&&(b>0&&(b+=8-p),p=8),v===Of)return p;if(u===0)l[0]=0,Ft=l[1]=zt.symbol[g][e?io:so][p];else{E=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(E=E*8,E>=ut&&p<8&&(E=E/ut,p++));let ft=Math.pow(10,p>0?a:0);l[0]=Wt(E*ft)/ft,l[0]===ut&&p<8&&y===-1&&(l[0]=1,p++),Ft=l[1]=o===10&&p===1?e?Mf:Nf:zt.symbol[g][e?io:so][p]}if(Gt&&(l[0]=-l[0]),b>0&&(l[0]=l[0].toPrecision(b)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(fo,i)),r&&Number.isInteger(l[0])===!1&&a>0){let ft=i||fo,$t=l[0].toString().split(ft),Ht=$t[1]||nt,Vt=Ht.length,mo=a-Vt;l[0]=`${$t[0]}${ft}${Ht.padEnd(Vt+mo,Bf)}`}return lo&&(l[1]=P[p]?P[p]:zt.fullform[g][p]+(e?Pf:Af)+(l[0]===1?nt:Cf)),v===Tf?l:v===_f?{value:l[0],symbol:l[1],exponent:p,unit:Ft}:l.join(f)}var D=class t{constructor(e){d(this,"_tera");d(this,"id");d(this,"name");d(this,"icon");d(this,"path");d(this,"url");d(this,"teraUrl");d(this,"parsedName");d(this,"created");d(this,"createdFormatted");d(this,"modified");d(this,"modifiedFormatted");d(this,"accessed");d(this,"accessedFormatted");d(this,"size");d(this,"sizeFormatted");d(this,"mime");d(this,"meta",{});if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=po(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Ct(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Ct(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var Kt=class{constructor(e){d(this,"settings",{session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null});d(this,"events",oo());d(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});d(this,"methods",["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"]);d(this,"plugins",[]);d(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Ut();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Ut(),...kt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Recieved message",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):(r==null?void 0:r.action)=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):(r==null?void 0:r.action)=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r!=null&&r.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}createProjectStatePatch(e,r){let o=qt(r,e);return o.length==0?(this.debug("INFO",4,"Skipping empty project patch",{patch:o,newState:e,oldState:r}),Promise.resolve()):(this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o))}applyProjectStatePatch(e){if(this.settings.devMode&&this.settings.debugPaths){if(!Array.isArray(this.settings.debugPaths))throw new Error("teraFyClient.settings.debugPaths should be either null or an Array<String>");let r=e.filter(o=>this.settings.debugPaths.some(a=>o.path.join(".").slice(0,a.length)==a)).map(o=>o.path.join("."));if(r.length>0){console.info("Detected writes to",r,"- entering debugging mode");debugger}}return this.rpc("applyProjectStatePatch",e,{session:this.settings.session})}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>{var o;return(o=this.settings).session||(o.session="tfy-"+this.getEntropicString(16))}).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths=this.settings.debugPaths?Array.isArray(this.settings.debugPaths)?this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):(()=>{throw new Error("Unknown terafyClient.settings.debugPaths type")})():null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[6/6] Init complete")).catch(o=>this.debug("WARN",0,"Init process fault",o))}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let s=0,n,i=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
2
2
|
`),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initalizer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}toggleDevMode(e="toggle"){var r;return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),(r=this.dom)!=null&&r.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCharCode(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new D({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new D({tera:this,...o})))}getProjectFile(e,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new D({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new D({tera:this,...r}))}};export{Kt as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
package/dist/terafy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function Vt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:h,diffs:b}){var A=Object.keys(i),T=A.length,x=Object.keys(f),I=x.length,y,p=i.length-f.length;if(uo(i,f)){for(var u=0;u<T;u++){var l=Array.isArray(i)?Number(A[u]):A[u];l in f||(y=h.concat(l),b.remove.push({op:"remove",path:r(y)}))}for(var u=0;u<I;u++){var l=Array.isArray(f)?Number(x[u]):x[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:b})}}else{for(var u=0;u<p;u++)y=h.concat(u),b.remove.push({op:"remove",path:r(y)});for(var _=i.slice(p),u=0;u<I;u++)s({key:u,obj1:_,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:b})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:h,pathForRemoves:b,diffs:A}){var T=f[i],x=m[i];if(!(i in f)&&i in m){var I=x;A.add.push({op:"add",path:r(h),value:I})}else T!==x&&(Object(T)!==T||Object(x)!==x||mo(T,x)||!Object.keys(T).length&&!Object.keys(x).length&&String(T)!=String(x)?n(h,A,x):o({obj1:f[i],obj2:m[i],basePath:h,basePathForRemoves:b,diffs:A}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function mo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function uo(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var co=typeof global=="object"&&global&&global.Object===Object&&global,ut=co;var ho=typeof self=="object"&&self&&self.Object===Object&&self,go=ut||ho||Function("return this")(),g=go;var xo=g.Symbol,w=xo;var qt=Object.prototype,yo=qt.hasOwnProperty,bo=qt.toString,ft=w?w.toStringTag:void 0;function vo(t){var e=yo.call(t,ft),r=t[ft];try{t[ft]=void 0;var o=!0}catch{}var a=bo.call(t);return o&&(e?t[ft]=r:delete t[ft]),a}var Yt=vo;var wo=Object.prototype,To=wo.toString;function Po(t){return To.call(t)}var Zt=Po;var Ao="[object Null]",Oo="[object Undefined]",Jt=w?w.toStringTag:void 0;function jo(t){return t==null?t===void 0?Oo:Ao:Jt&&Jt in Object(t)?Yt(t):Zt(t)}var S=jo;function So(t){return t!=null&&typeof t=="object"}var j=So;var Io="[object Symbol]";function _o(t){return typeof t=="symbol"||j(t)&&S(t)==Io}var z=_o;function Eo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var Xt=Eo;var Co=Array.isArray,v=Co;var Fo=1/0,Qt=w?w.prototype:void 0,te=Qt?Qt.toString:void 0;function ee(t){if(typeof t=="string")return t;if(v(t))return Xt(t,ee)+"";if(z(t))return te?te.call(t):"";var e=t+"";return e=="0"&&1/t==-Fo?"-0":e}var re=ee;function Mo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var O=Mo;function Ro(t){return t}var oe=Ro;var No="[object AsyncFunction]",Lo="[object Function]",Bo="[object GeneratorFunction]",ko="[object Proxy]";function Uo(t){if(!O(t))return!1;var e=S(t);return e==Lo||e==Bo||e==No||e==ko}var dt=Uo;var Do=g["__core-js_shared__"],ct=Do;var ae=function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function zo(t){return!!ae&&ae in t}var ie=zo;var Ko=Function.prototype,Go=Ko.toString;function Wo(t){if(t!=null){try{return Go.call(t)}catch{}try{return t+""}catch{}}return""}var E=Wo;var $o=/[\\^$.*+?()[\]{}|]/g,Ho=/^\[object .+?Constructor\]$/,Vo=Function.prototype,qo=Object.prototype,Yo=Vo.toString,Zo=qo.hasOwnProperty,Jo=RegExp("^"+Yo.call(Zo).replace($o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Xo(t){if(!O(t)||ie(t))return!1;var e=dt(t)?Jo:Ho;return e.test(E(t))}var se=Xo;function Qo(t,e){return t?.[e]}var ne=Qo;function ta(t,e){var r=ne(t,e);return se(r)?r:void 0}var P=ta;var ea=P(g,"WeakMap"),ht=ea;var fe=Object.create,ra=function(){function t(){}return function(e){if(!O(e))return{};if(fe)return fe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),pe=ra;function oa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var le=oa;function aa(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var me=aa;var ia=800,sa=16,na=Date.now;function fa(t){var e=0,r=0;return function(){var o=na(),a=sa-(o-r);if(r=o,a>0){if(++e>=ia)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ue=fa;function pa(t){return function(){return t}}var de=pa;var la=function(){try{var t=P(Object,"defineProperty");return t({},"",{}),t}catch{}}(),K=la;var ma=K?function(t,e){return K(t,"toString",{configurable:!0,enumerable:!1,value:de(e),writable:!0})}:oe,ce=ma;var ua=ue(ce),he=ua;function da(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=da;var ca=9007199254740991,ha=/^(?:0|[1-9]\d*)$/;function ga(t,e){var r=typeof t;return e=e??ca,!!e&&(r=="number"||r!="symbol"&&ha.test(t))&&t>-1&&t%1==0&&t<e}var G=ga;function xa(t,e,r){e=="__proto__"&&K?K(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=xa;function ya(t,e){return t===e||t!==t&&e!==e}var xt=ya;var ba=Object.prototype,va=ba.hasOwnProperty;function wa(t,e,r){var o=t[e];(!(va.call(t,e)&&xt(o,r))||r===void 0&&!(e in t))&>(t,e,r)}var W=wa;function Ta(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?gt(r,i,f):W(r,i,f)}return r}var M=Ta;var xe=Math.max;function Pa(t,e,r){return e=xe(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=xe(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),le(t,this,i)}}var ye=Pa;var Aa=9007199254740991;function Oa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Aa}var $=Oa;function ja(t){return t!=null&&$(t.length)&&!dt(t)}var yt=ja;var Sa=Object.prototype;function Ia(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Sa;return t===r}var H=Ia;function _a(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var be=_a;var Ea="[object Arguments]";function Ca(t){return j(t)&&S(t)==Ea}var Ft=Ca;var ve=Object.prototype,Fa=ve.hasOwnProperty,Ma=ve.propertyIsEnumerable,Ra=Ft(function(){return arguments}())?Ft:function(t){return j(t)&&Fa.call(t,"callee")&&!Ma.call(t,"callee")},V=Ra;function Na(){return!1}var we=Na;var Ae=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Te=Ae&&typeof module=="object"&&module&&!module.nodeType&&module,La=Te&&Te.exports===Ae,Pe=La?g.Buffer:void 0,Ba=Pe?Pe.isBuffer:void 0,ka=Ba||we,bt=ka;var Ua="[object Arguments]",Da="[object Array]",za="[object Boolean]",Ka="[object Date]",Ga="[object Error]",Wa="[object Function]",$a="[object Map]",Ha="[object Number]",Va="[object Object]",qa="[object RegExp]",Ya="[object Set]",Za="[object String]",Ja="[object WeakMap]",Xa="[object ArrayBuffer]",Qa="[object DataView]",ti="[object Float32Array]",ei="[object Float64Array]",ri="[object Int8Array]",oi="[object Int16Array]",ai="[object Int32Array]",ii="[object Uint8Array]",si="[object Uint8ClampedArray]",ni="[object Uint16Array]",fi="[object Uint32Array]",c={};c[ti]=c[ei]=c[ri]=c[oi]=c[ai]=c[ii]=c[si]=c[ni]=c[fi]=!0;c[Ua]=c[Da]=c[Xa]=c[za]=c[Qa]=c[Ka]=c[Ga]=c[Wa]=c[$a]=c[Ha]=c[Va]=c[qa]=c[Ya]=c[Za]=c[Ja]=!1;function pi(t){return j(t)&&$(t.length)&&!!c[S(t)]}var Oe=pi;function li(t){return function(e){return t(e)}}var q=li;var je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pt=je&&typeof module=="object"&&module&&!module.nodeType&&module,mi=pt&&pt.exports===je,Mt=mi&&ut.process,ui=function(){try{var t=pt&&pt.require&&pt.require("util").types;return t||Mt&&Mt.binding&&Mt.binding("util")}catch{}}(),C=ui;var Se=C&&C.isTypedArray,di=Se?q(Se):Oe,Ie=di;var ci=Object.prototype,hi=ci.hasOwnProperty;function gi(t,e){var r=v(t),o=!r&&V(t),a=!r&&!o&&bt(t),s=!r&&!o&&!a&&Ie(t),n=r||o||a||s,i=n?be(t.length,String):[],f=i.length;for(var m in t)(e||hi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||G(m,f)))&&i.push(m);return i}var vt=gi;function xi(t,e){return function(r){return t(e(r))}}var wt=xi;var yi=wt(Object.keys,Object),_e=yi;var bi=Object.prototype,vi=bi.hasOwnProperty;function wi(t){if(!H(t))return _e(t);var e=[];for(var r in Object(t))vi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ee=wi;function Ti(t){return yt(t)?vt(t):Ee(t)}var Y=Ti;function Pi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ce=Pi;var Ai=Object.prototype,Oi=Ai.hasOwnProperty;function ji(t){if(!O(t))return Ce(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Oi.call(t,o))||r.push(o);return r}var Fe=ji;function Si(t){return yt(t)?vt(t,!0):Fe(t)}var Z=Si;var Ii=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_i=/^\w*$/;function Ei(t,e){if(v(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||z(t)?!0:_i.test(t)||!Ii.test(t)||e!=null&&t in Object(e)}var Me=Ei;var Ci=P(Object,"create"),F=Ci;function Fi(){this.__data__=F?F(null):{},this.size=0}var Re=Fi;function Mi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ne=Mi;var Ri="__lodash_hash_undefined__",Ni=Object.prototype,Li=Ni.hasOwnProperty;function Bi(t){var e=this.__data__;if(F){var r=e[t];return r===Ri?void 0:r}return Li.call(e,t)?e[t]:void 0}var Le=Bi;var ki=Object.prototype,Ui=ki.hasOwnProperty;function Di(t){var e=this.__data__;return F?e[t]!==void 0:Ui.call(e,t)}var Be=Di;var zi="__lodash_hash_undefined__";function Ki(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=F&&e===void 0?zi:e,this}var ke=Ki;function J(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}J.prototype.clear=Re;J.prototype.delete=Ne;J.prototype.get=Le;J.prototype.has=Be;J.prototype.set=ke;var Rt=J;function Gi(){this.__data__=[],this.size=0}var Ue=Gi;function Wi(t,e){for(var r=t.length;r--;)if(xt(t[r][0],e))return r;return-1}var R=Wi;var $i=Array.prototype,Hi=$i.splice;function Vi(t){var e=this.__data__,r=R(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Hi.call(e,r,1),--this.size,!0}var De=Vi;function qi(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var ze=qi;function Yi(t){return R(this.__data__,t)>-1}var Ke=Yi;function Zi(t,e){var r=this.__data__,o=R(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Ge=Zi;function X(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}X.prototype.clear=Ue;X.prototype.delete=De;X.prototype.get=ze;X.prototype.has=Ke;X.prototype.set=Ge;var N=X;var Ji=P(g,"Map"),L=Ji;function Xi(){this.size=0,this.__data__={hash:new Rt,map:new(L||N),string:new Rt}}var We=Xi;function Qi(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var $e=Qi;function ts(t,e){var r=t.__data__;return $e(e)?r[typeof e=="string"?"string":"hash"]:r.map}var B=ts;function es(t){var e=B(this,t).delete(t);return this.size-=e?1:0,e}var He=es;function rs(t){return B(this,t).get(t)}var Ve=rs;function os(t){return B(this,t).has(t)}var qe=os;function as(t,e){var r=B(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ye=as;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=We;Q.prototype.delete=He;Q.prototype.get=Ve;Q.prototype.has=qe;Q.prototype.set=Ye;var lt=Q;var is="Expected a function";function Nt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(is);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Nt.Cache||lt),r}Nt.Cache=lt;var Ze=Nt;var ss=500;function ns(t){var e=Ze(t,function(o){return r.size===ss&&r.clear(),o}),r=e.cache;return e}var Je=ns;var fs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ps=/\\(\\)?/g,ls=Je(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(fs,function(r,o,a,s){e.push(a?s.replace(ps,"$1"):o||r)}),e}),Xe=ls;function ms(t){return t==null?"":re(t)}var Qe=ms;function us(t,e){return v(t)?t:Me(t,e)?[t]:Xe(Qe(t))}var k=us;var ds=1/0;function cs(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-ds?"-0":e}var tt=cs;function hs(t,e){e=k(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[tt(e[r++])];return r&&r==o?t:void 0}var tr=hs;function gs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var et=gs;var er=w?w.isConcatSpreadable:void 0;function xs(t){return v(t)||V(t)||!!(er&&t&&t[er])}var rr=xs;function or(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=rr),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?or(i,e-1,r,o,a):et(a,i):o||(a[a.length]=i)}return a}var ar=or;function ys(t){var e=t==null?0:t.length;return e?ar(t,1):[]}var ir=ys;function bs(t){return he(ye(t,void 0,ir),t+"")}var sr=bs;var vs=wt(Object.getPrototypeOf,Object),Tt=vs;function ws(){this.__data__=new N,this.size=0}var nr=ws;function Ts(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var fr=Ts;function Ps(t){return this.__data__.get(t)}var pr=Ps;function As(t){return this.__data__.has(t)}var lr=As;var Os=200;function js(t,e){var r=this.__data__;if(r instanceof N){var o=r.__data__;if(!L||o.length<Os-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new lt(o)}return r.set(t,e),this.size=r.size,this}var mr=js;function rt(t){var e=this.__data__=new N(t);this.size=e.size}rt.prototype.clear=nr;rt.prototype.delete=fr;rt.prototype.get=pr;rt.prototype.has=lr;rt.prototype.set=mr;var ur=rt;function Ss(t,e){return t&&M(e,Y(e),t)}var dr=Ss;function Is(t,e){return t&&M(e,Z(e),t)}var cr=Is;var yr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,hr=yr&&typeof module=="object"&&module&&!module.nodeType&&module,_s=hr&&hr.exports===yr,gr=_s?g.Buffer:void 0,xr=gr?gr.allocUnsafe:void 0;function Es(t,e){if(e)return t.slice();var r=t.length,o=xr?xr(r):new t.constructor(r);return t.copy(o),o}var br=Es;function Cs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var vr=Cs;function Fs(){return[]}var Pt=Fs;var Ms=Object.prototype,Rs=Ms.propertyIsEnumerable,wr=Object.getOwnPropertySymbols,Ns=wr?function(t){return t==null?[]:(t=Object(t),vr(wr(t),function(e){return Rs.call(t,e)}))}:Pt,ot=Ns;function Ls(t,e){return M(t,ot(t),e)}var Tr=Ls;var Bs=Object.getOwnPropertySymbols,ks=Bs?function(t){for(var e=[];t;)et(e,ot(t)),t=Tt(t);return e}:Pt,At=ks;function Us(t,e){return M(t,At(t),e)}var Pr=Us;function Ds(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var Ot=Ds;function zs(t){return Ot(t,Y,ot)}var Ar=zs;function Ks(t){return Ot(t,Z,At)}var Or=Ks;var Gs=P(g,"DataView"),jt=Gs;var Ws=P(g,"Promise"),St=Ws;var $s=P(g,"Set"),It=$s;var jr="[object Map]",Hs="[object Object]",Sr="[object Promise]",Ir="[object Set]",_r="[object WeakMap]",Er="[object DataView]",Vs=E(jt),qs=E(L),Ys=E(St),Zs=E(It),Js=E(ht),D=S;(jt&&D(new jt(new ArrayBuffer(1)))!=Er||L&&D(new L)!=jr||St&&D(St.resolve())!=Sr||It&&D(new It)!=Ir||ht&&D(new ht)!=_r)&&(D=function(t){var e=S(t),r=e==Hs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case Vs:return Er;case qs:return jr;case Ys:return Sr;case Zs:return Ir;case Js:return _r}return e});var at=D;var Xs=Object.prototype,Qs=Xs.hasOwnProperty;function tn(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Qs.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Cr=tn;var en=g.Uint8Array,Lt=en;function rn(t){var e=new t.constructor(t.byteLength);return new Lt(e).set(new Lt(t)),e}var it=rn;function on(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Fr=on;var an=/\w*$/;function sn(t){var e=new t.constructor(t.source,an.exec(t));return e.lastIndex=t.lastIndex,e}var Mr=sn;var Rr=w?w.prototype:void 0,Nr=Rr?Rr.valueOf:void 0;function nn(t){return Nr?Object(Nr.call(t)):{}}var Lr=nn;function fn(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Br=fn;var pn="[object Boolean]",ln="[object Date]",mn="[object Map]",un="[object Number]",dn="[object RegExp]",cn="[object Set]",hn="[object String]",gn="[object Symbol]",xn="[object ArrayBuffer]",yn="[object DataView]",bn="[object Float32Array]",vn="[object Float64Array]",wn="[object Int8Array]",Tn="[object Int16Array]",Pn="[object Int32Array]",An="[object Uint8Array]",On="[object Uint8ClampedArray]",jn="[object Uint16Array]",Sn="[object Uint32Array]";function In(t,e,r){var o=t.constructor;switch(e){case xn:return it(t);case pn:case ln:return new o(+t);case yn:return Fr(t,r);case bn:case vn:case wn:case Tn:case Pn:case An:case On:case jn:case Sn:return Br(t,r);case mn:return new o;case un:case hn:return new o(t);case dn:return Mr(t);case cn:return new o;case gn:return Lr(t)}}var kr=In;function _n(t){return typeof t.constructor=="function"&&!H(t)?pe(Tt(t)):{}}var Ur=_n;var En="[object Map]";function Cn(t){return j(t)&&at(t)==En}var Dr=Cn;var zr=C&&C.isMap,Fn=zr?q(zr):Dr,Kr=Fn;var Mn="[object Set]";function Rn(t){return j(t)&&at(t)==Mn}var Gr=Rn;var Wr=C&&C.isSet,Nn=Wr?q(Wr):Gr,$r=Nn;var Ln=1,Bn=2,kn=4,Hr="[object Arguments]",Un="[object Array]",Dn="[object Boolean]",zn="[object Date]",Kn="[object Error]",Vr="[object Function]",Gn="[object GeneratorFunction]",Wn="[object Map]",$n="[object Number]",qr="[object Object]",Hn="[object RegExp]",Vn="[object Set]",qn="[object String]",Yn="[object Symbol]",Zn="[object WeakMap]",Jn="[object ArrayBuffer]",Xn="[object DataView]",Qn="[object Float32Array]",tf="[object Float64Array]",ef="[object Int8Array]",rf="[object Int16Array]",of="[object Int32Array]",af="[object Uint8Array]",sf="[object Uint8ClampedArray]",nf="[object Uint16Array]",ff="[object Uint32Array]",d={};d[Hr]=d[Un]=d[Jn]=d[Xn]=d[Dn]=d[zn]=d[Qn]=d[tf]=d[ef]=d[rf]=d[of]=d[Wn]=d[$n]=d[qr]=d[Hn]=d[Vn]=d[qn]=d[Yn]=d[af]=d[sf]=d[nf]=d[ff]=!0;d[Kn]=d[Vr]=d[Zn]=!1;function _t(t,e,r,o,a,s){var n,i=e&Ln,f=e&Bn,m=e&kn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!O(t))return t;var h=v(t);if(h){if(n=Cr(t),!i)return me(t,n)}else{var b=at(t),A=b==Vr||b==Gn;if(bt(t))return br(t,i);if(b==qr||b==Hr||A&&!a){if(n=f||A?{}:Ur(t),!i)return f?Pr(t,cr(n,t)):Tr(t,dr(n,t))}else{if(!d[b])return a?t:{};n=kr(t,b,i)}}s||(s=new ur);var T=s.get(t);if(T)return T;s.set(t,n),$r(t)?t.forEach(function(y){n.add(_t(y,e,r,y,t,s))}):Kr(t)&&t.forEach(function(y,p){n.set(p,_t(y,e,r,p,t,s))});var x=m?f?Or:Ar:f?Z:Y,I=h?void 0:x(t);return ge(I||t,function(y,p){I&&(p=y,y=t[p]),W(n,p,_t(y,e,r,p,t,s))}),n}var Yr=_t;var pf=1,lf=4;function mf(t){return Yr(t,pf|lf)}var Bt=mf;function uf(t,e){return t!=null&&e in Object(t)}var Zr=uf;function df(t,e,r){e=k(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=tt(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&$(a)&&G(n,a)&&(v(t)||V(t)))}var Jr=df;function cf(t,e){return t!=null&&Jr(t,e,Zr)}var Xr=cf;function hf(t,e,r,o){if(!O(t))return t;e=k(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=tt(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var h=i[f];m=o?o(h,f,i):void 0,m===void 0&&(m=O(h)?h:G(e[a+1])?[]:{})}W(i,f,m),i=i[f]}return t}var Qr=hf;function gf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=tr(t,n);r(i,n)&&Qr(s,k(n,t),i)}return s}var to=gf;function xf(t,e){return to(t,e,function(r,o){return Xr(t,o)})}var eo=xf;var yf=sr(function(t,e){return t==null?{}:eo(t,e)}),Et=yf;function ro(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var oo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var kt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=oo[r[t]&63];return e};var bf="array",vf="bit",ao="bits",wf="byte",io="bytes",st="",Tf="exponent",Pf="function",so="iec",Af="Invalid number",Of="Invalid rounding method",Ut="jedec",jf="object",no=".",Sf="round",If="s",_f="si",Ef="kbit",Cf="kB",Ff=" ",Mf="string",Rf="0",Dt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function fo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=st,localeOptions:n={},separator:i=st,spacer:f=Ff,symbols:m={},standard:h=st,output:b=Mf,fullform:A=!1,fullforms:T=[],exponent:x=-1,roundingMethod:I=Sf,precision:y=0}={}){let p=x,u=Number(t),l=[],_=0,Ct=st;h===_f?(o=10,h=Ut):h===so||h===Ut?o=2:o===2?h=so:(o=10,h=Ut);let mt=o===10?1e3:1024,po=A===!0,Kt=u<0,Gt=Math[I];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Af);if(typeof Gt!==Pf)throw new TypeError(Of);if(Kt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(mt)),p<0&&(p=0)),p>8&&(y>0&&(y+=8-p),p=8),b===Tf)return p;if(u===0)l[0]=0,Ct=l[1]=Dt.symbol[h][e?ao:io][p];else{_=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(_=_*8,_>=mt&&p<8&&(_=_/mt,p++));let nt=Math.pow(10,p>0?a:0);l[0]=Gt(_*nt)/nt,l[0]===mt&&p<8&&x===-1&&(l[0]=1,p++),Ct=l[1]=o===10&&p===1?e?Ef:Cf:Dt.symbol[h][e?ao:io][p]}if(Kt&&(l[0]=-l[0]),y>0&&(l[0]=l[0].toPrecision(y)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(no,i)),r&&Number.isInteger(l[0])===!1&&a>0){let nt=i||no,Wt=l[0].toString().split(nt),$t=Wt[1]||st,Ht=$t.length,lo=a-Ht;l[0]=`${Wt[0]}${nt}${$t.padEnd(Ht+lo,Rf)}`}return po&&(l[1]=T[p]?T[p]:Dt.fullform[h][p]+(e?vf:wf)+(l[0]===1?st:If)),b===bf?l:b===jf?{value:l[0],symbol:l[1],exponent:p,unit:Ct}:l.join(f)}var U=class t{_tera;id;name;icon;path;url;teraUrl;parsedName;created;createdFormatted;modified;modifiedFormatted;accessed;accessedFormatted;size;sizeFormatted;mime;meta={};constructor(e){if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=fo(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Et(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Et(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var zt=class{settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};events=ro();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];plugins=[];send(e){let r=kt();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||kt(),...Bt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Recieved message",r),r?.action=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):r?.action=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):r?.action=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r?.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}acceptPostboxes={};createProjectStatePatch(e,r){let o=Vt(r,e);return this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatch(e){if(this.settings.devMode&&this.settings.debugPaths){if(!Array.isArray(this.settings.debugPaths))throw new Error("teraFyClient.settings.debugPaths should be either null or an Array<String>");let r=e.filter(o=>this.settings.debugPaths.some(a=>o.path.join(".").slice(0,a.length)==a)).map(o=>o.path.join("."));if(r.length>0){console.info("Detected writes to",r,"- entering debugging mode");debugger}}return this.rpc("applyProjectStatePatch",e,{session:this.settings.session})}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}constructor(e){e&&this.set(e)}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.settings.session||="tfy-"+this.getEntropicString(16)).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths=this.settings.debugPaths?Array.isArray(this.settings.debugPaths)?this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):(()=>{throw new Error("Unknown terafyClient.settings.debugPaths type")})():null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[6/6] Init complete")).catch(o=>this.debug("WARN",0,"Init process fault",o))}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let s=0,n,i=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
1
|
+
function Vt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:h,diffs:b}){var A=Object.keys(i),T=A.length,x=Object.keys(f),I=x.length,y,p=i.length-f.length;if(uo(i,f)){for(var u=0;u<T;u++){var l=Array.isArray(i)?Number(A[u]):A[u];l in f||(y=h.concat(l),b.remove.push({op:"remove",path:r(y)}))}for(var u=0;u<I;u++){var l=Array.isArray(f)?Number(x[u]):x[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:b})}}else{for(var u=0;u<p;u++)y=h.concat(u),b.remove.push({op:"remove",path:r(y)});for(var _=i.slice(p),u=0;u<I;u++)s({key:u,obj1:_,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:b})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:h,pathForRemoves:b,diffs:A}){var T=f[i],x=m[i];if(!(i in f)&&i in m){var I=x;A.add.push({op:"add",path:r(h),value:I})}else T!==x&&(Object(T)!==T||Object(x)!==x||mo(T,x)||!Object.keys(T).length&&!Object.keys(x).length&&String(T)!=String(x)?n(h,A,x):o({obj1:f[i],obj2:m[i],basePath:h,basePathForRemoves:b,diffs:A}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function mo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function uo(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var co=typeof global=="object"&&global&&global.Object===Object&&global,ut=co;var ho=typeof self=="object"&&self&&self.Object===Object&&self,go=ut||ho||Function("return this")(),g=go;var xo=g.Symbol,w=xo;var qt=Object.prototype,yo=qt.hasOwnProperty,bo=qt.toString,ft=w?w.toStringTag:void 0;function vo(t){var e=yo.call(t,ft),r=t[ft];try{t[ft]=void 0;var o=!0}catch{}var a=bo.call(t);return o&&(e?t[ft]=r:delete t[ft]),a}var Yt=vo;var wo=Object.prototype,To=wo.toString;function Po(t){return To.call(t)}var Zt=Po;var Ao="[object Null]",Oo="[object Undefined]",Jt=w?w.toStringTag:void 0;function jo(t){return t==null?t===void 0?Oo:Ao:Jt&&Jt in Object(t)?Yt(t):Zt(t)}var S=jo;function So(t){return t!=null&&typeof t=="object"}var j=So;var Io="[object Symbol]";function _o(t){return typeof t=="symbol"||j(t)&&S(t)==Io}var z=_o;function Eo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var Xt=Eo;var Co=Array.isArray,v=Co;var Fo=1/0,Qt=w?w.prototype:void 0,te=Qt?Qt.toString:void 0;function ee(t){if(typeof t=="string")return t;if(v(t))return Xt(t,ee)+"";if(z(t))return te?te.call(t):"";var e=t+"";return e=="0"&&1/t==-Fo?"-0":e}var re=ee;function Mo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var O=Mo;function No(t){return t}var oe=No;var Ro="[object AsyncFunction]",Lo="[object Function]",Bo="[object GeneratorFunction]",ko="[object Proxy]";function Uo(t){if(!O(t))return!1;var e=S(t);return e==Lo||e==Bo||e==Ro||e==ko}var dt=Uo;var Do=g["__core-js_shared__"],ct=Do;var ae=function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function zo(t){return!!ae&&ae in t}var ie=zo;var Ko=Function.prototype,Go=Ko.toString;function Wo(t){if(t!=null){try{return Go.call(t)}catch{}try{return t+""}catch{}}return""}var E=Wo;var $o=/[\\^$.*+?()[\]{}|]/g,Ho=/^\[object .+?Constructor\]$/,Vo=Function.prototype,qo=Object.prototype,Yo=Vo.toString,Zo=qo.hasOwnProperty,Jo=RegExp("^"+Yo.call(Zo).replace($o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Xo(t){if(!O(t)||ie(t))return!1;var e=dt(t)?Jo:Ho;return e.test(E(t))}var se=Xo;function Qo(t,e){return t?.[e]}var ne=Qo;function ta(t,e){var r=ne(t,e);return se(r)?r:void 0}var P=ta;var ea=P(g,"WeakMap"),ht=ea;var fe=Object.create,ra=function(){function t(){}return function(e){if(!O(e))return{};if(fe)return fe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),pe=ra;function oa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var le=oa;function aa(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var me=aa;var ia=800,sa=16,na=Date.now;function fa(t){var e=0,r=0;return function(){var o=na(),a=sa-(o-r);if(r=o,a>0){if(++e>=ia)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ue=fa;function pa(t){return function(){return t}}var de=pa;var la=function(){try{var t=P(Object,"defineProperty");return t({},"",{}),t}catch{}}(),K=la;var ma=K?function(t,e){return K(t,"toString",{configurable:!0,enumerable:!1,value:de(e),writable:!0})}:oe,ce=ma;var ua=ue(ce),he=ua;function da(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=da;var ca=9007199254740991,ha=/^(?:0|[1-9]\d*)$/;function ga(t,e){var r=typeof t;return e=e??ca,!!e&&(r=="number"||r!="symbol"&&ha.test(t))&&t>-1&&t%1==0&&t<e}var G=ga;function xa(t,e,r){e=="__proto__"&&K?K(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=xa;function ya(t,e){return t===e||t!==t&&e!==e}var xt=ya;var ba=Object.prototype,va=ba.hasOwnProperty;function wa(t,e,r){var o=t[e];(!(va.call(t,e)&&xt(o,r))||r===void 0&&!(e in t))&>(t,e,r)}var W=wa;function Ta(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?gt(r,i,f):W(r,i,f)}return r}var M=Ta;var xe=Math.max;function Pa(t,e,r){return e=xe(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=xe(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),le(t,this,i)}}var ye=Pa;var Aa=9007199254740991;function Oa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Aa}var $=Oa;function ja(t){return t!=null&&$(t.length)&&!dt(t)}var yt=ja;var Sa=Object.prototype;function Ia(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Sa;return t===r}var H=Ia;function _a(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var be=_a;var Ea="[object Arguments]";function Ca(t){return j(t)&&S(t)==Ea}var Ft=Ca;var ve=Object.prototype,Fa=ve.hasOwnProperty,Ma=ve.propertyIsEnumerable,Na=Ft(function(){return arguments}())?Ft:function(t){return j(t)&&Fa.call(t,"callee")&&!Ma.call(t,"callee")},V=Na;function Ra(){return!1}var we=Ra;var Ae=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Te=Ae&&typeof module=="object"&&module&&!module.nodeType&&module,La=Te&&Te.exports===Ae,Pe=La?g.Buffer:void 0,Ba=Pe?Pe.isBuffer:void 0,ka=Ba||we,bt=ka;var Ua="[object Arguments]",Da="[object Array]",za="[object Boolean]",Ka="[object Date]",Ga="[object Error]",Wa="[object Function]",$a="[object Map]",Ha="[object Number]",Va="[object Object]",qa="[object RegExp]",Ya="[object Set]",Za="[object String]",Ja="[object WeakMap]",Xa="[object ArrayBuffer]",Qa="[object DataView]",ti="[object Float32Array]",ei="[object Float64Array]",ri="[object Int8Array]",oi="[object Int16Array]",ai="[object Int32Array]",ii="[object Uint8Array]",si="[object Uint8ClampedArray]",ni="[object Uint16Array]",fi="[object Uint32Array]",c={};c[ti]=c[ei]=c[ri]=c[oi]=c[ai]=c[ii]=c[si]=c[ni]=c[fi]=!0;c[Ua]=c[Da]=c[Xa]=c[za]=c[Qa]=c[Ka]=c[Ga]=c[Wa]=c[$a]=c[Ha]=c[Va]=c[qa]=c[Ya]=c[Za]=c[Ja]=!1;function pi(t){return j(t)&&$(t.length)&&!!c[S(t)]}var Oe=pi;function li(t){return function(e){return t(e)}}var q=li;var je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pt=je&&typeof module=="object"&&module&&!module.nodeType&&module,mi=pt&&pt.exports===je,Mt=mi&&ut.process,ui=function(){try{var t=pt&&pt.require&&pt.require("util").types;return t||Mt&&Mt.binding&&Mt.binding("util")}catch{}}(),C=ui;var Se=C&&C.isTypedArray,di=Se?q(Se):Oe,Ie=di;var ci=Object.prototype,hi=ci.hasOwnProperty;function gi(t,e){var r=v(t),o=!r&&V(t),a=!r&&!o&&bt(t),s=!r&&!o&&!a&&Ie(t),n=r||o||a||s,i=n?be(t.length,String):[],f=i.length;for(var m in t)(e||hi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||G(m,f)))&&i.push(m);return i}var vt=gi;function xi(t,e){return function(r){return t(e(r))}}var wt=xi;var yi=wt(Object.keys,Object),_e=yi;var bi=Object.prototype,vi=bi.hasOwnProperty;function wi(t){if(!H(t))return _e(t);var e=[];for(var r in Object(t))vi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ee=wi;function Ti(t){return yt(t)?vt(t):Ee(t)}var Y=Ti;function Pi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ce=Pi;var Ai=Object.prototype,Oi=Ai.hasOwnProperty;function ji(t){if(!O(t))return Ce(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Oi.call(t,o))||r.push(o);return r}var Fe=ji;function Si(t){return yt(t)?vt(t,!0):Fe(t)}var Z=Si;var Ii=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_i=/^\w*$/;function Ei(t,e){if(v(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||z(t)?!0:_i.test(t)||!Ii.test(t)||e!=null&&t in Object(e)}var Me=Ei;var Ci=P(Object,"create"),F=Ci;function Fi(){this.__data__=F?F(null):{},this.size=0}var Ne=Fi;function Mi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Re=Mi;var Ni="__lodash_hash_undefined__",Ri=Object.prototype,Li=Ri.hasOwnProperty;function Bi(t){var e=this.__data__;if(F){var r=e[t];return r===Ni?void 0:r}return Li.call(e,t)?e[t]:void 0}var Le=Bi;var ki=Object.prototype,Ui=ki.hasOwnProperty;function Di(t){var e=this.__data__;return F?e[t]!==void 0:Ui.call(e,t)}var Be=Di;var zi="__lodash_hash_undefined__";function Ki(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=F&&e===void 0?zi:e,this}var ke=Ki;function J(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}J.prototype.clear=Ne;J.prototype.delete=Re;J.prototype.get=Le;J.prototype.has=Be;J.prototype.set=ke;var Nt=J;function Gi(){this.__data__=[],this.size=0}var Ue=Gi;function Wi(t,e){for(var r=t.length;r--;)if(xt(t[r][0],e))return r;return-1}var N=Wi;var $i=Array.prototype,Hi=$i.splice;function Vi(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Hi.call(e,r,1),--this.size,!0}var De=Vi;function qi(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}var ze=qi;function Yi(t){return N(this.__data__,t)>-1}var Ke=Yi;function Zi(t,e){var r=this.__data__,o=N(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Ge=Zi;function X(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}X.prototype.clear=Ue;X.prototype.delete=De;X.prototype.get=ze;X.prototype.has=Ke;X.prototype.set=Ge;var R=X;var Ji=P(g,"Map"),L=Ji;function Xi(){this.size=0,this.__data__={hash:new Nt,map:new(L||R),string:new Nt}}var We=Xi;function Qi(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var $e=Qi;function ts(t,e){var r=t.__data__;return $e(e)?r[typeof e=="string"?"string":"hash"]:r.map}var B=ts;function es(t){var e=B(this,t).delete(t);return this.size-=e?1:0,e}var He=es;function rs(t){return B(this,t).get(t)}var Ve=rs;function os(t){return B(this,t).has(t)}var qe=os;function as(t,e){var r=B(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ye=as;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=We;Q.prototype.delete=He;Q.prototype.get=Ve;Q.prototype.has=qe;Q.prototype.set=Ye;var lt=Q;var is="Expected a function";function Rt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(is);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Rt.Cache||lt),r}Rt.Cache=lt;var Ze=Rt;var ss=500;function ns(t){var e=Ze(t,function(o){return r.size===ss&&r.clear(),o}),r=e.cache;return e}var Je=ns;var fs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ps=/\\(\\)?/g,ls=Je(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(fs,function(r,o,a,s){e.push(a?s.replace(ps,"$1"):o||r)}),e}),Xe=ls;function ms(t){return t==null?"":re(t)}var Qe=ms;function us(t,e){return v(t)?t:Me(t,e)?[t]:Xe(Qe(t))}var k=us;var ds=1/0;function cs(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-ds?"-0":e}var tt=cs;function hs(t,e){e=k(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[tt(e[r++])];return r&&r==o?t:void 0}var tr=hs;function gs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var et=gs;var er=w?w.isConcatSpreadable:void 0;function xs(t){return v(t)||V(t)||!!(er&&t&&t[er])}var rr=xs;function or(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=rr),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?or(i,e-1,r,o,a):et(a,i):o||(a[a.length]=i)}return a}var ar=or;function ys(t){var e=t==null?0:t.length;return e?ar(t,1):[]}var ir=ys;function bs(t){return he(ye(t,void 0,ir),t+"")}var sr=bs;var vs=wt(Object.getPrototypeOf,Object),Tt=vs;function ws(){this.__data__=new R,this.size=0}var nr=ws;function Ts(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var fr=Ts;function Ps(t){return this.__data__.get(t)}var pr=Ps;function As(t){return this.__data__.has(t)}var lr=As;var Os=200;function js(t,e){var r=this.__data__;if(r instanceof R){var o=r.__data__;if(!L||o.length<Os-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new lt(o)}return r.set(t,e),this.size=r.size,this}var mr=js;function rt(t){var e=this.__data__=new R(t);this.size=e.size}rt.prototype.clear=nr;rt.prototype.delete=fr;rt.prototype.get=pr;rt.prototype.has=lr;rt.prototype.set=mr;var ur=rt;function Ss(t,e){return t&&M(e,Y(e),t)}var dr=Ss;function Is(t,e){return t&&M(e,Z(e),t)}var cr=Is;var yr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,hr=yr&&typeof module=="object"&&module&&!module.nodeType&&module,_s=hr&&hr.exports===yr,gr=_s?g.Buffer:void 0,xr=gr?gr.allocUnsafe:void 0;function Es(t,e){if(e)return t.slice();var r=t.length,o=xr?xr(r):new t.constructor(r);return t.copy(o),o}var br=Es;function Cs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var vr=Cs;function Fs(){return[]}var Pt=Fs;var Ms=Object.prototype,Ns=Ms.propertyIsEnumerable,wr=Object.getOwnPropertySymbols,Rs=wr?function(t){return t==null?[]:(t=Object(t),vr(wr(t),function(e){return Ns.call(t,e)}))}:Pt,ot=Rs;function Ls(t,e){return M(t,ot(t),e)}var Tr=Ls;var Bs=Object.getOwnPropertySymbols,ks=Bs?function(t){for(var e=[];t;)et(e,ot(t)),t=Tt(t);return e}:Pt,At=ks;function Us(t,e){return M(t,At(t),e)}var Pr=Us;function Ds(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var Ot=Ds;function zs(t){return Ot(t,Y,ot)}var Ar=zs;function Ks(t){return Ot(t,Z,At)}var Or=Ks;var Gs=P(g,"DataView"),jt=Gs;var Ws=P(g,"Promise"),St=Ws;var $s=P(g,"Set"),It=$s;var jr="[object Map]",Hs="[object Object]",Sr="[object Promise]",Ir="[object Set]",_r="[object WeakMap]",Er="[object DataView]",Vs=E(jt),qs=E(L),Ys=E(St),Zs=E(It),Js=E(ht),D=S;(jt&&D(new jt(new ArrayBuffer(1)))!=Er||L&&D(new L)!=jr||St&&D(St.resolve())!=Sr||It&&D(new It)!=Ir||ht&&D(new ht)!=_r)&&(D=function(t){var e=S(t),r=e==Hs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case Vs:return Er;case qs:return jr;case Ys:return Sr;case Zs:return Ir;case Js:return _r}return e});var at=D;var Xs=Object.prototype,Qs=Xs.hasOwnProperty;function tn(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Qs.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Cr=tn;var en=g.Uint8Array,Lt=en;function rn(t){var e=new t.constructor(t.byteLength);return new Lt(e).set(new Lt(t)),e}var it=rn;function on(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Fr=on;var an=/\w*$/;function sn(t){var e=new t.constructor(t.source,an.exec(t));return e.lastIndex=t.lastIndex,e}var Mr=sn;var Nr=w?w.prototype:void 0,Rr=Nr?Nr.valueOf:void 0;function nn(t){return Rr?Object(Rr.call(t)):{}}var Lr=nn;function fn(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Br=fn;var pn="[object Boolean]",ln="[object Date]",mn="[object Map]",un="[object Number]",dn="[object RegExp]",cn="[object Set]",hn="[object String]",gn="[object Symbol]",xn="[object ArrayBuffer]",yn="[object DataView]",bn="[object Float32Array]",vn="[object Float64Array]",wn="[object Int8Array]",Tn="[object Int16Array]",Pn="[object Int32Array]",An="[object Uint8Array]",On="[object Uint8ClampedArray]",jn="[object Uint16Array]",Sn="[object Uint32Array]";function In(t,e,r){var o=t.constructor;switch(e){case xn:return it(t);case pn:case ln:return new o(+t);case yn:return Fr(t,r);case bn:case vn:case wn:case Tn:case Pn:case An:case On:case jn:case Sn:return Br(t,r);case mn:return new o;case un:case hn:return new o(t);case dn:return Mr(t);case cn:return new o;case gn:return Lr(t)}}var kr=In;function _n(t){return typeof t.constructor=="function"&&!H(t)?pe(Tt(t)):{}}var Ur=_n;var En="[object Map]";function Cn(t){return j(t)&&at(t)==En}var Dr=Cn;var zr=C&&C.isMap,Fn=zr?q(zr):Dr,Kr=Fn;var Mn="[object Set]";function Nn(t){return j(t)&&at(t)==Mn}var Gr=Nn;var Wr=C&&C.isSet,Rn=Wr?q(Wr):Gr,$r=Rn;var Ln=1,Bn=2,kn=4,Hr="[object Arguments]",Un="[object Array]",Dn="[object Boolean]",zn="[object Date]",Kn="[object Error]",Vr="[object Function]",Gn="[object GeneratorFunction]",Wn="[object Map]",$n="[object Number]",qr="[object Object]",Hn="[object RegExp]",Vn="[object Set]",qn="[object String]",Yn="[object Symbol]",Zn="[object WeakMap]",Jn="[object ArrayBuffer]",Xn="[object DataView]",Qn="[object Float32Array]",tf="[object Float64Array]",ef="[object Int8Array]",rf="[object Int16Array]",of="[object Int32Array]",af="[object Uint8Array]",sf="[object Uint8ClampedArray]",nf="[object Uint16Array]",ff="[object Uint32Array]",d={};d[Hr]=d[Un]=d[Jn]=d[Xn]=d[Dn]=d[zn]=d[Qn]=d[tf]=d[ef]=d[rf]=d[of]=d[Wn]=d[$n]=d[qr]=d[Hn]=d[Vn]=d[qn]=d[Yn]=d[af]=d[sf]=d[nf]=d[ff]=!0;d[Kn]=d[Vr]=d[Zn]=!1;function _t(t,e,r,o,a,s){var n,i=e&Ln,f=e&Bn,m=e&kn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!O(t))return t;var h=v(t);if(h){if(n=Cr(t),!i)return me(t,n)}else{var b=at(t),A=b==Vr||b==Gn;if(bt(t))return br(t,i);if(b==qr||b==Hr||A&&!a){if(n=f||A?{}:Ur(t),!i)return f?Pr(t,cr(n,t)):Tr(t,dr(n,t))}else{if(!d[b])return a?t:{};n=kr(t,b,i)}}s||(s=new ur);var T=s.get(t);if(T)return T;s.set(t,n),$r(t)?t.forEach(function(y){n.add(_t(y,e,r,y,t,s))}):Kr(t)&&t.forEach(function(y,p){n.set(p,_t(y,e,r,p,t,s))});var x=m?f?Or:Ar:f?Z:Y,I=h?void 0:x(t);return ge(I||t,function(y,p){I&&(p=y,y=t[p]),W(n,p,_t(y,e,r,p,t,s))}),n}var Yr=_t;var pf=1,lf=4;function mf(t){return Yr(t,pf|lf)}var Bt=mf;function uf(t,e){return t!=null&&e in Object(t)}var Zr=uf;function df(t,e,r){e=k(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=tt(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&$(a)&&G(n,a)&&(v(t)||V(t)))}var Jr=df;function cf(t,e){return t!=null&&Jr(t,e,Zr)}var Xr=cf;function hf(t,e,r,o){if(!O(t))return t;e=k(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=tt(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var h=i[f];m=o?o(h,f,i):void 0,m===void 0&&(m=O(h)?h:G(e[a+1])?[]:{})}W(i,f,m),i=i[f]}return t}var Qr=hf;function gf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=tr(t,n);r(i,n)&&Qr(s,k(n,t),i)}return s}var to=gf;function xf(t,e){return to(t,e,function(r,o){return Xr(t,o)})}var eo=xf;var yf=sr(function(t,e){return t==null?{}:eo(t,e)}),Et=yf;function ro(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var oo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var kt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=oo[r[t]&63];return e};var bf="array",vf="bit",ao="bits",wf="byte",io="bytes",st="",Tf="exponent",Pf="function",so="iec",Af="Invalid number",Of="Invalid rounding method",Ut="jedec",jf="object",no=".",Sf="round",If="s",_f="si",Ef="kbit",Cf="kB",Ff=" ",Mf="string",Nf="0",Dt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function fo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=st,localeOptions:n={},separator:i=st,spacer:f=Ff,symbols:m={},standard:h=st,output:b=Mf,fullform:A=!1,fullforms:T=[],exponent:x=-1,roundingMethod:I=Sf,precision:y=0}={}){let p=x,u=Number(t),l=[],_=0,Ct=st;h===_f?(o=10,h=Ut):h===so||h===Ut?o=2:o===2?h=so:(o=10,h=Ut);let mt=o===10?1e3:1024,po=A===!0,Kt=u<0,Gt=Math[I];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Af);if(typeof Gt!==Pf)throw new TypeError(Of);if(Kt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(mt)),p<0&&(p=0)),p>8&&(y>0&&(y+=8-p),p=8),b===Tf)return p;if(u===0)l[0]=0,Ct=l[1]=Dt.symbol[h][e?ao:io][p];else{_=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(_=_*8,_>=mt&&p<8&&(_=_/mt,p++));let nt=Math.pow(10,p>0?a:0);l[0]=Gt(_*nt)/nt,l[0]===mt&&p<8&&x===-1&&(l[0]=1,p++),Ct=l[1]=o===10&&p===1?e?Ef:Cf:Dt.symbol[h][e?ao:io][p]}if(Kt&&(l[0]=-l[0]),y>0&&(l[0]=l[0].toPrecision(y)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(no,i)),r&&Number.isInteger(l[0])===!1&&a>0){let nt=i||no,Wt=l[0].toString().split(nt),$t=Wt[1]||st,Ht=$t.length,lo=a-Ht;l[0]=`${Wt[0]}${nt}${$t.padEnd(Ht+lo,Nf)}`}return po&&(l[1]=T[p]?T[p]:Dt.fullform[h][p]+(e?vf:wf)+(l[0]===1?st:If)),b===bf?l:b===jf?{value:l[0],symbol:l[1],exponent:p,unit:Ct}:l.join(f)}var U=class t{_tera;id;name;icon;path;url;teraUrl;parsedName;created;createdFormatted;modified;modifiedFormatted;accessed;accessedFormatted;size;sizeFormatted;mime;meta={};constructor(e){if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=fo(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Et(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Et(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var zt=class{settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};events=ro();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];plugins=[];send(e){let r=kt();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||kt(),...Bt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Recieved message",r),r?.action=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):r?.action=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):r?.action=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r?.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}acceptPostboxes={};createProjectStatePatch(e,r){let o=Vt(r,e);return o.length==0?(this.debug("INFO",4,"Skipping empty project patch",{patch:o,newState:e,oldState:r}),Promise.resolve()):(this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o))}applyProjectStatePatch(e){if(this.settings.devMode&&this.settings.debugPaths){if(!Array.isArray(this.settings.debugPaths))throw new Error("teraFyClient.settings.debugPaths should be either null or an Array<String>");let r=e.filter(o=>this.settings.debugPaths.some(a=>o.path.join(".").slice(0,a.length)==a)).map(o=>o.path.join("."));if(r.length>0){console.info("Detected writes to",r,"- entering debugging mode");debugger}}return this.rpc("applyProjectStatePatch",e,{session:this.settings.session})}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}constructor(e){e&&this.set(e)}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.settings.session||="tfy-"+this.getEntropicString(16)).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths=this.settings.debugPaths?Array.isArray(this.settings.debugPaths)?this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):(()=>{throw new Error("Unknown terafyClient.settings.debugPaths type")})():null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[6/6] Init complete")).catch(o=>this.debug("WARN",0,"Init process fault",o))}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let s=0,n,i=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
2
2
|
`),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initalizer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}toggleDevMode(e="toggle"){return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),this.dom?.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCharCode(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new U({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new U({tera:this,...o})))}getProjectFile(e,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new U({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new U({tera:this,...r}))}};export{zt as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
package/eslint.config.js
CHANGED
package/lib/terafy.client.js
CHANGED
|
@@ -316,8 +316,13 @@ export default class TeraFy {
|
|
|
316
316
|
*/
|
|
317
317
|
createProjectStatePatch(newState, oldState) {
|
|
318
318
|
let patch = diff(oldState, newState);
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
if (patch.length == 0) {
|
|
320
|
+
this.debug('INFO', 4, 'Skipping empty project patch', {patch, newState, oldState});
|
|
321
|
+
return Promise.resolve();
|
|
322
|
+
} else {
|
|
323
|
+
this.debug('INFO', 3, 'Created project patch', {patch, newState, oldState});
|
|
324
|
+
return this.applyProjectStatePatch(patch);
|
|
325
|
+
}
|
|
321
326
|
}
|
|
322
327
|
|
|
323
328
|
|
|
@@ -329,6 +334,7 @@ export default class TeraFy {
|
|
|
329
334
|
* @returns {Promise} A promise which resolves when the operation has completed
|
|
330
335
|
*/
|
|
331
336
|
applyProjectStatePatch(patch) {
|
|
337
|
+
// watchedPaths guards {{{
|
|
332
338
|
if (this.settings.devMode && this.settings.debugPaths) {
|
|
333
339
|
if (!Array.isArray(this.settings.debugPaths)) throw new Error('teraFyClient.settings.debugPaths should be either null or an Array<String>');
|
|
334
340
|
|
|
@@ -343,6 +349,7 @@ export default class TeraFy {
|
|
|
343
349
|
debugger; // eslint-disable-line no-debugger
|
|
344
350
|
}
|
|
345
351
|
}
|
|
352
|
+
// }}}
|
|
346
353
|
|
|
347
354
|
return this.rpc('applyProjectStatePatch', patch, {
|
|
348
355
|
session: this.settings.session,
|
package/lib/terafy.server.js
CHANGED
|
@@ -388,7 +388,6 @@ export default class TeraFyServer {
|
|
|
388
388
|
$subscriptions.promise(),
|
|
389
389
|
]))
|
|
390
390
|
.then(()=> {
|
|
391
|
-
debugger;
|
|
392
391
|
if (!$auth.isLoggedIn && settings.forceRetry)
|
|
393
392
|
return $auth.restoreLogin();
|
|
394
393
|
})
|
|
@@ -929,6 +928,11 @@ export default class TeraFyServer {
|
|
|
929
928
|
*/
|
|
930
929
|
applyProjectStatePatch(patch, options) {
|
|
931
930
|
if (!app.service('$projects').active) throw new Error('No active project to patch');
|
|
931
|
+
if (patch.length == 0) {
|
|
932
|
+
this.debug('INFO', 4, 'Skipping empty project state patch', patch);
|
|
933
|
+
return Promise.resolve();
|
|
934
|
+
}
|
|
935
|
+
|
|
932
936
|
this.debug('INFO', 1, 'Applying', patch.length, 'project state patch', patch);
|
|
933
937
|
|
|
934
938
|
let $projects = app.service('$projects');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iebh/tera-fy",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.9",
|
|
4
4
|
"description": "TERA website worker",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.js --outfile=dist/terafy.js --minify --serve --servedir=.",
|
|
@@ -82,12 +82,12 @@
|
|
|
82
82
|
"release-it": "^17.6.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@momsfriendlydevco/eslint-config": "^2.0
|
|
85
|
+
"@momsfriendlydevco/eslint-config": "^2.1.0",
|
|
86
86
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
87
87
|
"concurrently": "^8.2.2",
|
|
88
88
|
"documentation": "^14.0.3",
|
|
89
89
|
"esbuild": "^0.23.0",
|
|
90
|
-
"eslint": "^9.
|
|
90
|
+
"eslint": "^9.18.0",
|
|
91
91
|
"nodemon": "^3.1.7"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
package/plugins/base.js
CHANGED
|
@@ -9,8 +9,7 @@ export default class TeraFyPlugin {
|
|
|
9
9
|
/**
|
|
10
10
|
* Optional function to be included when the main TeraFyClient is initalized
|
|
11
11
|
*/
|
|
12
|
-
init() {
|
|
13
|
-
}
|
|
12
|
+
init() {}
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -19,6 +18,6 @@ export default class TeraFyPlugin {
|
|
|
19
18
|
* @param {TeraFy} terafy The TeraFy client this plugin is being initalized against
|
|
20
19
|
* @param {Object} [options] Additional options to mutate behaviour
|
|
21
20
|
*/
|
|
22
|
-
constructor(terafy, options) { // eslint-disable-line
|
|
21
|
+
constructor(terafy, options) { // eslint-disable-line no-unused-vars
|
|
23
22
|
}
|
|
24
23
|
}
|
package/plugins/vue2.js
CHANGED
|
@@ -123,10 +123,14 @@ export default class TeraFyPluginVue2 extends TeraFyPluginBase {
|
|
|
123
123
|
let oldVal = cloneDeep(snapshot);
|
|
124
124
|
|
|
125
125
|
// Function to handle the state update (can be debounced)
|
|
126
|
-
let watchHandle =
|
|
126
|
+
let watchHandle = ()=> {
|
|
127
|
+
let newVal = cloneDeep(snapshot);
|
|
128
|
+
|
|
127
129
|
this.debug('INFO', 5, 'Update Vue2 Local->Remote', {new: newVal, old: oldVal});
|
|
128
130
|
this.createProjectStatePatch(newVal, oldVal);
|
|
129
|
-
|
|
131
|
+
|
|
132
|
+
// Set oldVal to the deep clone we just made so we can track the diff
|
|
133
|
+
oldVal = newVal;
|
|
130
134
|
};
|
|
131
135
|
|
|
132
136
|
settings.component.$watch(
|
package/plugins/vue3.js
CHANGED
|
@@ -82,9 +82,14 @@ export default class TeraFyPluginVue extends TeraFyPluginBase {
|
|
|
82
82
|
let oldVal = cloneDeep(snapshot);
|
|
83
83
|
|
|
84
84
|
// Function to handle the state update (can be debounced)
|
|
85
|
-
let watchHandle =
|
|
85
|
+
let watchHandle = ()=> {
|
|
86
|
+
let newVal = cloneDeep(snapshot);
|
|
87
|
+
|
|
88
|
+
this.debug('INFO', 5, 'Update Vue3 Local->Remote', {new: newVal, old: oldVal});
|
|
86
89
|
this.createProjectStatePatch(newVal, oldVal);
|
|
87
|
-
|
|
90
|
+
|
|
91
|
+
// Set oldVal to the deep clone we just made so we can track the diff
|
|
92
|
+
oldVal = newVal;
|
|
88
93
|
};
|
|
89
94
|
|
|
90
95
|
watch(
|