@iebh/tera-fy 1.13.2 → 1.13.3
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 +2 -0
- package/api.md +267 -278
- package/dist/terafy.es2019.js +2 -2
- package/dist/terafy.js +2 -2
- package/lib/terafy.client.js +19 -17
- package/lib/terafy.proxy.js +1 -1
- package/lib/terafy.server.js +7 -26
- package/package.json +1 -1
package/dist/terafy.es2019.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 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: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 Fo="[object Symbol]";function Co(t){return typeof t=="symbol"||S(t)&&I(t)==Fo}var K=Co;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]",Do="[object Function]",Uo="[object GeneratorFunction]",zo="[object Proxy]";function Ko(t){if(!j(t))return!1;var e=I(t);return e==Do||e==Uo||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 qo(t){if(t!=null){try{return Ho.call(t)}catch{}try{return t+""}catch{}}return""}var F=qo;var Vo=/[\\^$.*+?()[\]{}|]/g,Yo=/^\[object .+?Constructor\]$/,Zo=Function.prototype,Jo=Object.prototype,Xo=Zo.toString,Qo=Jo.hasOwnProperty,ta=RegExp("^"+Xo.call(Qo).replace(Vo,"\\$&").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(F(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 Fa(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ea;return t===r}var q=Fa;function Ca(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ve=Ca;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")},V=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,Da=Pe&&Pe.exports===Oe,Ae=Da?g.Buffer:void 0,Ua=Ae?Ae.isBuffer:void 0,za=Ua||Te,vt=za;var Ka="[object Arguments]",Ga="[object Array]",Wa="[object Boolean]",$a="[object Date]",Ha="[object Error]",qa="[object Function]",Va="[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[qa]=h[Va]=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{}}(),C=hi;var Ie=C&&C.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&&V(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(!q(t))return Ee(t);var e=[];for(var r in Object(t))Pi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Fe=Ai;function Oi(t){return bt(t)?wt(t):Fe(t)}var Z=Oi;function ji(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ce=ji;var Si=Object.prototype,Ii=Si.hasOwnProperty;function _i(t){if(!j(t))return Ce(t);var e=q(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 Fi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ci=/^\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:Ci.test(t)||!Fi.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,Di=ki.hasOwnProperty;function Ui(t){var e=this.__data__;if(M){var r=e[t];return r===Bi?void 0:r}return Di.call(e,t)?e[t]:void 0}var Be=Ui;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 De=$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=De;var Nt=X;function Hi(){this.__data__=[],this.size=0}var Ue=Hi;function qi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var N=qi;var Vi=Array.prototype,Yi=Vi.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=Ue;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 qe=as;function is(t){return k(this,t).get(t)}var Ve=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=qe;tt.prototype.get=Ve;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 D=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=D(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)||V(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 Fs(t,e){return t&&R(e,J(e),t)}var hr=Fs;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xr=br&&typeof module=="object"&&module&&!module.nodeType&&module,Cs=xr&&xr.exports===br,gr=Cs?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 Ds(t,e){return R(t,at(t),e)}var Pr=Ds;var Us=Object.getOwnPropertySymbols,zs=Us?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 qs=A(g,"Promise"),It=qs;var Vs=A(g,"Set"),_t=Vs;var Sr="[object Map]",Ys="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Fr="[object DataView]",Zs=F(St),Js=F(B),Xs=F(It),Qs=F(_t),tn=F(xt),z=I;(St&&z(new St(new ArrayBuffer(1)))!=Fr||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?F(r):"";if(o)switch(o){case Zs:return Fr;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 Cr=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 Fn(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 Dr=Fn;function Cn(t){return typeof t.constructor=="function"&&!q(t)?le(Pt(t)):{}}var Ur=Cn;var Mn="[object Map]";function Rn(t){return S(t)&&it(t)==Mn}var zr=Rn;var Kr=C&&C.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=C&&C.isSet,kn=$r?Y($r):Wr,Hr=kn;var Dn=1,Un=2,zn=4,qr="[object Arguments]",Kn="[object Array]",Gn="[object Boolean]",Wn="[object Date]",$n="[object Error]",Vr="[object Function]",Hn="[object GeneratorFunction]",qn="[object Map]",Vn="[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[qr]=c[Kn]=c[tf]=c[ef]=c[Gn]=c[Wn]=c[rf]=c[of]=c[af]=c[sf]=c[nf]=c[qn]=c[Vn]=c[Yr]=c[Yn]=c[Zn]=c[Jn]=c[Xn]=c[ff]=c[pf]=c[lf]=c[mf]=!0;c[$n]=c[Vr]=c[Qn]=!1;function Et(t,e,r,o,a,s){var n,i=e&Dn,f=e&Un,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=Cr(t),!i)return ue(t,n)}else{var v=it(t),O=v==Vr||v==Hn;if(vt(t))return vr(t,i);if(v==Yr||v==qr||O&&!a){if(n=f||O?{}:Ur(t),!i)return f?Ar(t,hr(n,t)):Pr(t,cr(n,t))}else{if(!c[v])return a?t:{};n=Dr(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=D(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)||V(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=D(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,D(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)}),Ft=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 Dt=(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",Ut="jedec",_f="object",fo=".",Ef="round",Ff="s",Cf="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,Ct=nt;x===Cf?(o=10,x=Ut):x===no||x===Ut?o=2:o===2?x=no:(o=10,x=Ut);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,Ct=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++),Ct=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,qt=Ht.length,mo=a-qt;l[0]=`${$t[0]}${ft}${Ht.padEnd(qt+mo,Bf)}`}return lo&&(l[1]=P[p]?P[p]:zt.fullform[x][p]+(e?Pf:Af)+(l[0]===1?nt:Ff)),v===Tf?l:v===_f?{value:l[0],symbol:l[1],exponent:p,unit:Ct}:l.join(f)}var U=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:\/\/tera-tools.com\/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.setProjectFile(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Ft(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Ft(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var Kt=class{constructor(e){d(this,"settings",{devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",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","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPageUrl","setPageTitle","uiAlert","uiConfirm","uiProgress","uiPrompt","uiTrhow","uiSplat","uiWindow"]);d(this,"plugins",[]);d(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Dt();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||Dt(),...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;let r=e.data;if(!(!r.TERA||!r.id))if(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);else{if((r==null?void 0:r.action)=="rpc")return 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()})});if((r==null?void 0:r.action)=="event")return 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?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}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)}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(()=>this.debug("INFO",4,"[0/6] Init",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=>{this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o}).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":this.debug("INFO",2,"Using TERA window parent");break;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
|
-
`),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){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);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.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)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new
|
|
1
|
+
var Io=Object.defineProperty;var _o=(t,e,r)=>e in t?Io(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var c=(t,e,r)=>_o(t,typeof e!="symbol"?e+"":e,r);function ne(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:u,basePathForRemoves:p,diffs:g}){var P=Object.keys(i),T=P.length,b=Object.keys(f),F=b.length,O,l=i.length-f.length;if(Fo(i,f)){for(var d=0;d<T;d++){var m=Array.isArray(i)?Number(P[d]):P[d];m in f||(O=p.concat(m),g.remove.push({op:"remove",path:r(O)}))}for(var d=0;d<F;d++){var m=Array.isArray(f)?Number(b[d]):b[d];n({key:m,obj1:i,obj2:f,path:u.concat(m),pathForRemoves:u.concat(m),diffs:g})}}else{for(var d=0;d<l;d++)O=p.concat(d),g.remove.push({op:"remove",path:r(O)});for(var C=i.slice(l),d=0;d<F;d++)n({key:d,obj1:C,obj2:f,path:u.concat(d),pathForRemoves:u.concat(d+l),diffs:g})}}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 n({key:i,obj1:f,obj2:u,path:p,pathForRemoves:g,diffs:P}){var T=f[i],b=u[i];if(!(i in f)&&i in u){var F=b;P.add.push({op:"add",path:r(p),value:F})}else T!==b&&(Object(T)!==T||Object(b)!==b||Eo(T,b)||!Object.keys(T).length&&!Object.keys(b).length&&String(T)!=String(b)?s(p,P,b):o({obj1:f[i],obj2:u[i],basePath:p,basePathForRemoves:g,diffs:P}))}function s(i,f,u){f.replace.push({op:"replace",path:r(i),value:u})}}function Eo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function Fo(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,n=0;n<e.length&&String(t[n])===String(e[n]);n++)o++;for(var s=e.length;s>0&&String(t[s+r])===String(e[s]);s--)a++;return o>=a}return!0}var Co=typeof global=="object"&&global&&global.Object===Object&&global,wt=Co;var Mo=typeof self=="object"&&self&&self.Object===Object&&self,Ro=wt||Mo||Function("return this")(),y=Ro;var No=y.Symbol,j=No;var se=Object.prototype,Lo=se.hasOwnProperty,Bo=se.toString,ht=j?j.toStringTag:void 0;function Do(t){var e=Lo.call(t,ht),r=t[ht];try{t[ht]=void 0;var o=!0}catch{}var a=Bo.call(t);return o&&(e?t[ht]=r:delete t[ht]),a}var fe=Do;var Uo=Object.prototype,ko=Uo.toString;function Go(t){return ko.call(t)}var pe=Go;var Ko="[object Null]",zo="[object Undefined]",le=j?j.toStringTag:void 0;function Wo(t){return t==null?t===void 0?zo:Ko:le&&le in Object(t)?fe(t):pe(t)}var I=Wo;function $o(t){return t!=null&&typeof t=="object"}var A=$o;var Ho="[object Symbol]";function Vo(t){return typeof t=="symbol"||A(t)&&I(t)==Ho}var V=Vo;function qo(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 me=qo;var Yo=Array.isArray,v=Yo;var Zo=1/0,ue=j?j.prototype:void 0,de=ue?ue.toString:void 0;function ce(t){if(typeof t=="string")return t;if(v(t))return me(t,ce)+"";if(V(t))return de?de.call(t):"";var e=t+"";return e=="0"&&1/t==-Zo?"-0":e}var he=ce;function Jo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var w=Jo;function Xo(t){return t}var Tt=Xo;var Qo="[object AsyncFunction]",ta="[object Function]",ea="[object GeneratorFunction]",ra="[object Proxy]";function oa(t){if(!w(t))return!1;var e=I(t);return e==ta||e==ea||e==Qo||e==ra}var q=oa;var aa=y["__core-js_shared__"],Ot=aa;var xe=function(){var t=/[^.]+$/.exec(Ot&&Ot.keys&&Ot.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function ia(t){return!!xe&&xe in t}var ge=ia;var na=Function.prototype,sa=na.toString;function fa(t){if(t!=null){try{return sa.call(t)}catch{}try{return t+""}catch{}}return""}var M=fa;var pa=/[\\^$.*+?()[\]{}|]/g,la=/^\[object .+?Constructor\]$/,ma=Function.prototype,ua=Object.prototype,da=ma.toString,ca=ua.hasOwnProperty,ha=RegExp("^"+da.call(ca).replace(pa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xa(t){if(!w(t)||ge(t))return!1;var e=q(t)?ha:la;return e.test(M(t))}var be=xa;function ga(t,e){return t==null?void 0:t[e]}var ye=ga;function ba(t,e){var r=ye(t,e);return be(r)?r:void 0}var S=ba;var ya=S(y,"WeakMap"),Pt=ya;var ve=Object.create,va=function(){function t(){}return function(e){if(!w(e))return{};if(ve)return ve(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),we=va;function wa(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 Te=wa;function Ta(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var At=Ta;var Oa=800,Pa=16,Aa=Date.now;function ja(t){var e=0,r=0;return function(){var o=Aa(),a=Pa-(o-r);if(r=o,a>0){if(++e>=Oa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Oe=ja;function Sa(t){return function(){return t}}var Pe=Sa;var Ia=function(){try{var t=S(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Y=Ia;var _a=Y?function(t,e){return Y(t,"toString",{configurable:!0,enumerable:!1,value:Pe(e),writable:!0})}:Tt,Ae=_a;var Ea=Oe(Ae),jt=Ea;function Fa(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var je=Fa;var Ca=9007199254740991,Ma=/^(?:0|[1-9]\d*)$/;function Ra(t,e){var r=typeof t;return e=e==null?Ca:e,!!e&&(r=="number"||r!="symbol"&&Ma.test(t))&&t>-1&&t%1==0&&t<e}var B=Ra;function Na(t,e,r){e=="__proto__"&&Y?Y(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Z=Na;function La(t,e){return t===e||t!==t&&e!==e}var D=La;var Ba=Object.prototype,Da=Ba.hasOwnProperty;function Ua(t,e,r){var o=t[e];(!(Da.call(t,e)&&D(o,r))||r===void 0&&!(e in t))&&Z(t,e,r)}var J=Ua;function ka(t,e,r,o){var a=!r;r||(r={});for(var n=-1,s=e.length;++n<s;){var i=e[n],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?Z(r,i,f):J(r,i,f)}return r}var _=ka;var Se=Math.max;function Ga(t,e,r){return e=Se(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,n=Se(o.length-e,0),s=Array(n);++a<n;)s[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(s),Te(t,this,i)}}var St=Ga;function Ka(t,e){return jt(St(t,e,Tt),t+"")}var Ie=Ka;var za=9007199254740991;function Wa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=za}var X=Wa;function $a(t){return t!=null&&X(t.length)&&!q(t)}var U=$a;function Ha(t,e,r){if(!w(r))return!1;var o=typeof e;return(o=="number"?U(r)&&B(e,r.length):o=="string"&&e in r)?D(r[e],t):!1}var _e=Ha;function Va(t){return Ie(function(e,r){var o=-1,a=r.length,n=a>1?r[a-1]:void 0,s=a>2?r[2]:void 0;for(n=t.length>3&&typeof n=="function"?(a--,n):void 0,s&&_e(r[0],r[1],s)&&(n=a<3?void 0:n,a=1),e=Object(e);++o<a;){var i=r[o];i&&t(e,i,o,n)}return e})}var Ee=Va;var qa=Object.prototype;function Ya(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||qa;return t===r}var Q=Ya;function Za(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Fe=Za;var Ja="[object Arguments]";function Xa(t){return A(t)&&I(t)==Ja}var Wt=Xa;var Ce=Object.prototype,Qa=Ce.hasOwnProperty,ti=Ce.propertyIsEnumerable,ei=Wt(function(){return arguments}())?Wt:function(t){return A(t)&&Qa.call(t,"callee")&&!ti.call(t,"callee")},R=ei;function ri(){return!1}var Me=ri;var Le=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Re=Le&&typeof module=="object"&&module&&!module.nodeType&&module,oi=Re&&Re.exports===Le,Ne=oi?y.Buffer:void 0,ai=Ne?Ne.isBuffer:void 0,ii=ai||Me,tt=ii;var ni="[object Arguments]",si="[object Array]",fi="[object Boolean]",pi="[object Date]",li="[object Error]",mi="[object Function]",ui="[object Map]",di="[object Number]",ci="[object Object]",hi="[object RegExp]",xi="[object Set]",gi="[object String]",bi="[object WeakMap]",yi="[object ArrayBuffer]",vi="[object DataView]",wi="[object Float32Array]",Ti="[object Float64Array]",Oi="[object Int8Array]",Pi="[object Int16Array]",Ai="[object Int32Array]",ji="[object Uint8Array]",Si="[object Uint8ClampedArray]",Ii="[object Uint16Array]",_i="[object Uint32Array]",x={};x[wi]=x[Ti]=x[Oi]=x[Pi]=x[Ai]=x[ji]=x[Si]=x[Ii]=x[_i]=!0;x[ni]=x[si]=x[yi]=x[fi]=x[vi]=x[pi]=x[li]=x[mi]=x[ui]=x[di]=x[ci]=x[hi]=x[xi]=x[gi]=x[bi]=!1;function Ei(t){return A(t)&&X(t.length)&&!!x[I(t)]}var Be=Ei;function Fi(t){return function(e){return t(e)}}var et=Fi;var De=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xt=De&&typeof module=="object"&&module&&!module.nodeType&&module,Ci=xt&&xt.exports===De,$t=Ci&&wt.process,Mi=function(){try{var t=xt&&xt.require&&xt.require("util").types;return t||$t&&$t.binding&&$t.binding("util")}catch{}}(),N=Mi;var Ue=N&&N.isTypedArray,Ri=Ue?et(Ue):Be,It=Ri;var Ni=Object.prototype,Li=Ni.hasOwnProperty;function Bi(t,e){var r=v(t),o=!r&&R(t),a=!r&&!o&&tt(t),n=!r&&!o&&!a&&It(t),s=r||o||a||n,i=s?Fe(t.length,String):[],f=i.length;for(var u in t)(e||Li.call(t,u))&&!(s&&(u=="length"||a&&(u=="offset"||u=="parent")||n&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||B(u,f)))&&i.push(u);return i}var _t=Bi;function Di(t,e){return function(r){return t(e(r))}}var Et=Di;var Ui=Et(Object.keys,Object),ke=Ui;var ki=Object.prototype,Gi=ki.hasOwnProperty;function Ki(t){if(!Q(t))return ke(t);var e=[];for(var r in Object(t))Gi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ge=Ki;function zi(t){return U(t)?_t(t):Ge(t)}var rt=zi;function Wi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ke=Wi;var $i=Object.prototype,Hi=$i.hasOwnProperty;function Vi(t){if(!w(t))return Ke(t);var e=Q(t),r=[];for(var o in t)o=="constructor"&&(e||!Hi.call(t,o))||r.push(o);return r}var ze=Vi;function qi(t){return U(t)?_t(t,!0):ze(t)}var E=qi;var Yi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Zi=/^\w*$/;function Ji(t,e){if(v(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||V(t)?!0:Zi.test(t)||!Yi.test(t)||e!=null&&t in Object(e)}var We=Ji;var Xi=S(Object,"create"),L=Xi;function Qi(){this.__data__=L?L(null):{},this.size=0}var $e=Qi;function tn(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var He=tn;var en="__lodash_hash_undefined__",rn=Object.prototype,on=rn.hasOwnProperty;function an(t){var e=this.__data__;if(L){var r=e[t];return r===en?void 0:r}return on.call(e,t)?e[t]:void 0}var Ve=an;var nn=Object.prototype,sn=nn.hasOwnProperty;function fn(t){var e=this.__data__;return L?e[t]!==void 0:sn.call(e,t)}var qe=fn;var pn="__lodash_hash_undefined__";function ln(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=L&&e===void 0?pn:e,this}var Ye=ln;function ot(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])}}ot.prototype.clear=$e;ot.prototype.delete=He;ot.prototype.get=Ve;ot.prototype.has=qe;ot.prototype.set=Ye;var Ht=ot;function mn(){this.__data__=[],this.size=0}var Ze=mn;function un(t,e){for(var r=t.length;r--;)if(D(t[r][0],e))return r;return-1}var k=un;var dn=Array.prototype,cn=dn.splice;function hn(t){var e=this.__data__,r=k(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():cn.call(e,r,1),--this.size,!0}var Je=hn;function xn(t){var e=this.__data__,r=k(e,t);return r<0?void 0:e[r][1]}var Xe=xn;function gn(t){return k(this.__data__,t)>-1}var Qe=gn;function bn(t,e){var r=this.__data__,o=k(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var tr=bn;function at(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])}}at.prototype.clear=Ze;at.prototype.delete=Je;at.prototype.get=Xe;at.prototype.has=Qe;at.prototype.set=tr;var G=at;var yn=S(y,"Map"),K=yn;function vn(){this.size=0,this.__data__={hash:new Ht,map:new(K||G),string:new Ht}}var er=vn;function wn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var rr=wn;function Tn(t,e){var r=t.__data__;return rr(e)?r[typeof e=="string"?"string":"hash"]:r.map}var z=Tn;function On(t){var e=z(this,t).delete(t);return this.size-=e?1:0,e}var or=On;function Pn(t){return z(this,t).get(t)}var ar=Pn;function An(t){return z(this,t).has(t)}var ir=An;function jn(t,e){var r=z(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var nr=jn;function it(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])}}it.prototype.clear=er;it.prototype.delete=or;it.prototype.get=ar;it.prototype.has=ir;it.prototype.set=nr;var gt=it;var Sn="Expected a function";function Vt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Sn);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],n=r.cache;if(n.has(a))return n.get(a);var s=t.apply(this,o);return r.cache=n.set(a,s)||n,s};return r.cache=new(Vt.Cache||gt),r}Vt.Cache=gt;var sr=Vt;var In=500;function _n(t){var e=sr(t,function(o){return r.size===In&&r.clear(),o}),r=e.cache;return e}var fr=_n;var En=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Fn=/\\(\\)?/g,Cn=fr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(En,function(r,o,a,n){e.push(a?n.replace(Fn,"$1"):o||r)}),e}),pr=Cn;function Mn(t){return t==null?"":he(t)}var lr=Mn;function Rn(t,e){return v(t)?t:We(t,e)?[t]:pr(lr(t))}var W=Rn;var Nn=1/0;function Ln(t){if(typeof t=="string"||V(t))return t;var e=t+"";return e=="0"&&1/t==-Nn?"-0":e}var nt=Ln;function Bn(t,e){e=W(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[nt(e[r++])];return r&&r==o?t:void 0}var mr=Bn;function Dn(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var st=Dn;var ur=j?j.isConcatSpreadable:void 0;function Un(t){return v(t)||R(t)||!!(ur&&t&&t[ur])}var dr=Un;function cr(t,e,r,o,a){var n=-1,s=t.length;for(r||(r=dr),a||(a=[]);++n<s;){var i=t[n];e>0&&r(i)?e>1?cr(i,e-1,r,o,a):st(a,i):o||(a[a.length]=i)}return a}var hr=cr;function kn(t){var e=t==null?0:t.length;return e?hr(t,1):[]}var xr=kn;function Gn(t){return jt(St(t,void 0,xr),t+"")}var gr=Gn;var Kn=Et(Object.getPrototypeOf,Object),ft=Kn;var zn="[object Object]",Wn=Function.prototype,$n=Object.prototype,br=Wn.toString,Hn=$n.hasOwnProperty,Vn=br.call(Object);function qn(t){if(!A(t)||I(t)!=zn)return!1;var e=ft(t);if(e===null)return!0;var r=Hn.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&br.call(r)==Vn}var yr=qn;function Yn(){this.__data__=new G,this.size=0}var vr=Yn;function Zn(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var wr=Zn;function Jn(t){return this.__data__.get(t)}var Tr=Jn;function Xn(t){return this.__data__.has(t)}var Or=Xn;var Qn=200;function ts(t,e){var r=this.__data__;if(r instanceof G){var o=r.__data__;if(!K||o.length<Qn-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new gt(o)}return r.set(t,e),this.size=r.size,this}var Pr=ts;function pt(t){var e=this.__data__=new G(t);this.size=e.size}pt.prototype.clear=vr;pt.prototype.delete=wr;pt.prototype.get=Tr;pt.prototype.has=Or;pt.prototype.set=Pr;var Ft=pt;function es(t,e){return t&&_(e,rt(e),t)}var Ar=es;function rs(t,e){return t&&_(e,E(e),t)}var jr=rs;var Er=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Sr=Er&&typeof module=="object"&&module&&!module.nodeType&&module,os=Sr&&Sr.exports===Er,Ir=os?y.Buffer:void 0,_r=Ir?Ir.allocUnsafe:void 0;function as(t,e){if(e)return t.slice();var r=t.length,o=_r?_r(r):new t.constructor(r);return t.copy(o),o}var Ct=as;function is(t,e){for(var r=-1,o=t==null?0:t.length,a=0,n=[];++r<o;){var s=t[r];e(s,r,t)&&(n[a++]=s)}return n}var Fr=is;function ns(){return[]}var Mt=ns;var ss=Object.prototype,fs=ss.propertyIsEnumerable,Cr=Object.getOwnPropertySymbols,ps=Cr?function(t){return t==null?[]:(t=Object(t),Fr(Cr(t),function(e){return fs.call(t,e)}))}:Mt,lt=ps;function ls(t,e){return _(t,lt(t),e)}var Mr=ls;var ms=Object.getOwnPropertySymbols,us=ms?function(t){for(var e=[];t;)st(e,lt(t)),t=ft(t);return e}:Mt,Rt=us;function ds(t,e){return _(t,Rt(t),e)}var Rr=ds;function cs(t,e,r){var o=e(t);return v(t)?o:st(o,r(t))}var Nt=cs;function hs(t){return Nt(t,rt,lt)}var Nr=hs;function xs(t){return Nt(t,E,Rt)}var Lr=xs;var gs=S(y,"DataView"),Lt=gs;var bs=S(y,"Promise"),Bt=bs;var ys=S(y,"Set"),Dt=ys;var Br="[object Map]",vs="[object Object]",Dr="[object Promise]",Ur="[object Set]",kr="[object WeakMap]",Gr="[object DataView]",ws=M(Lt),Ts=M(K),Os=M(Bt),Ps=M(Dt),As=M(Pt),H=I;(Lt&&H(new Lt(new ArrayBuffer(1)))!=Gr||K&&H(new K)!=Br||Bt&&H(Bt.resolve())!=Dr||Dt&&H(new Dt)!=Ur||Pt&&H(new Pt)!=kr)&&(H=function(t){var e=I(t),r=e==vs?t.constructor:void 0,o=r?M(r):"";if(o)switch(o){case ws:return Gr;case Ts:return Br;case Os:return Dr;case Ps:return Ur;case As:return kr}return e});var mt=H;var js=Object.prototype,Ss=js.hasOwnProperty;function Is(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Ss.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Kr=Is;var _s=y.Uint8Array,qt=_s;function Es(t){var e=new t.constructor(t.byteLength);return new qt(e).set(new qt(t)),e}var ut=Es;function Fs(t,e){var r=e?ut(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var zr=Fs;var Cs=/\w*$/;function Ms(t){var e=new t.constructor(t.source,Cs.exec(t));return e.lastIndex=t.lastIndex,e}var Wr=Ms;var $r=j?j.prototype:void 0,Hr=$r?$r.valueOf:void 0;function Rs(t){return Hr?Object(Hr.call(t)):{}}var Vr=Rs;function Ns(t,e){var r=e?ut(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Ut=Ns;var Ls="[object Boolean]",Bs="[object Date]",Ds="[object Map]",Us="[object Number]",ks="[object RegExp]",Gs="[object Set]",Ks="[object String]",zs="[object Symbol]",Ws="[object ArrayBuffer]",$s="[object DataView]",Hs="[object Float32Array]",Vs="[object Float64Array]",qs="[object Int8Array]",Ys="[object Int16Array]",Zs="[object Int32Array]",Js="[object Uint8Array]",Xs="[object Uint8ClampedArray]",Qs="[object Uint16Array]",tf="[object Uint32Array]";function ef(t,e,r){var o=t.constructor;switch(e){case Ws:return ut(t);case Ls:case Bs:return new o(+t);case $s:return zr(t,r);case Hs:case Vs:case qs:case Ys:case Zs:case Js:case Xs:case Qs:case tf:return Ut(t,r);case Ds:return new o;case Us:case Ks:return new o(t);case ks:return Wr(t);case Gs:return new o;case zs:return Vr(t)}}var qr=ef;function rf(t){return typeof t.constructor=="function"&&!Q(t)?we(ft(t)):{}}var kt=rf;var of="[object Map]";function af(t){return A(t)&&mt(t)==of}var Yr=af;var Zr=N&&N.isMap,nf=Zr?et(Zr):Yr,Jr=nf;var sf="[object Set]";function ff(t){return A(t)&&mt(t)==sf}var Xr=ff;var Qr=N&&N.isSet,pf=Qr?et(Qr):Xr,to=pf;var lf=1,mf=2,uf=4,eo="[object Arguments]",df="[object Array]",cf="[object Boolean]",hf="[object Date]",xf="[object Error]",ro="[object Function]",gf="[object GeneratorFunction]",bf="[object Map]",yf="[object Number]",oo="[object Object]",vf="[object RegExp]",wf="[object Set]",Tf="[object String]",Of="[object Symbol]",Pf="[object WeakMap]",Af="[object ArrayBuffer]",jf="[object DataView]",Sf="[object Float32Array]",If="[object Float64Array]",_f="[object Int8Array]",Ef="[object Int16Array]",Ff="[object Int32Array]",Cf="[object Uint8Array]",Mf="[object Uint8ClampedArray]",Rf="[object Uint16Array]",Nf="[object Uint32Array]",h={};h[eo]=h[df]=h[Af]=h[jf]=h[cf]=h[hf]=h[Sf]=h[If]=h[_f]=h[Ef]=h[Ff]=h[bf]=h[yf]=h[oo]=h[vf]=h[wf]=h[Tf]=h[Of]=h[Cf]=h[Mf]=h[Rf]=h[Nf]=!0;h[xf]=h[ro]=h[Pf]=!1;function Gt(t,e,r,o,a,n){var s,i=e&lf,f=e&mf,u=e&uf;if(r&&(s=a?r(t,o,a,n):r(t)),s!==void 0)return s;if(!w(t))return t;var p=v(t);if(p){if(s=Kr(t),!i)return At(t,s)}else{var g=mt(t),P=g==ro||g==gf;if(tt(t))return Ct(t,i);if(g==oo||g==eo||P&&!a){if(s=f||P?{}:kt(t),!i)return f?Rr(t,jr(s,t)):Mr(t,Ar(s,t))}else{if(!h[g])return a?t:{};s=qr(t,g,i)}}n||(n=new Ft);var T=n.get(t);if(T)return T;n.set(t,s),to(t)?t.forEach(function(O){s.add(Gt(O,e,r,O,t,n))}):Jr(t)&&t.forEach(function(O,l){s.set(l,Gt(O,e,r,l,t,n))});var b=u?f?Lr:Nr:f?E:rt,F=p?void 0:b(t);return je(F||t,function(O,l){F&&(l=O,O=t[l]),J(s,l,Gt(O,e,r,l,t,n))}),s}var ao=Gt;var Lf=1,Bf=4;function Df(t){return ao(t,Lf|Bf)}var Yt=Df;function Uf(t,e){return t!=null&&e in Object(t)}var io=Uf;function kf(t,e,r){e=W(e,t);for(var o=-1,a=e.length,n=!1;++o<a;){var s=nt(e[o]);if(!(n=t!=null&&r(t,s)))break;t=t[s]}return n||++o!=a?n:(a=t==null?0:t.length,!!a&&X(a)&&B(s,a)&&(v(t)||R(t)))}var no=kf;function Gf(t,e){return t!=null&&no(t,e,io)}var so=Gf;function Kf(t){return function(e,r,o){for(var a=-1,n=Object(e),s=o(e),i=s.length;i--;){var f=s[t?i:++a];if(r(n[f],f,n)===!1)break}return e}}var fo=Kf;var zf=fo(),po=zf;function Wf(t,e,r){(r!==void 0&&!D(t[e],r)||r===void 0&&!(e in t))&&Z(t,e,r)}var bt=Wf;function $f(t){return A(t)&&U(t)}var lo=$f;function Hf(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var yt=Hf;function Vf(t){return _(t,E(t))}var mo=Vf;function qf(t,e,r,o,a,n,s){var i=yt(t,r),f=yt(e,r),u=s.get(f);if(u){bt(t,r,u);return}var p=n?n(i,f,r+"",t,e,s):void 0,g=p===void 0;if(g){var P=v(f),T=!P&&tt(f),b=!P&&!T&&It(f);p=f,P||T||b?v(i)?p=i:lo(i)?p=At(i):T?(g=!1,p=Ct(f,!0)):b?(g=!1,p=Ut(f,!0)):p=[]:yr(f)||R(f)?(p=i,R(i)?p=mo(i):(!w(i)||q(i))&&(p=kt(f))):g=!1}g&&(s.set(f,p),a(p,f,o,n,s),s.delete(f)),bt(t,r,p)}var uo=qf;function co(t,e,r,o,a){t!==e&&po(e,function(n,s){if(a||(a=new Ft),w(n))uo(t,e,s,r,co,o,a);else{var i=o?o(yt(t,s),n,s+"",t,e,a):void 0;i===void 0&&(i=n),bt(t,s,i)}},E)}var ho=co;var Yf=Ee(function(t,e,r){ho(t,e,r)}),Zt=Yf;function Zf(t,e,r,o){if(!w(t))return t;e=W(e,t);for(var a=-1,n=e.length,s=n-1,i=t;i!=null&&++a<n;){var f=nt(e[a]),u=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=s){var p=i[f];u=o?o(p,f,i):void 0,u===void 0&&(u=w(p)?p:B(e[a+1])?[]:{})}J(i,f,u),i=i[f]}return t}var xo=Zf;function Jf(t,e,r){for(var o=-1,a=e.length,n={};++o<a;){var s=e[o],i=mr(t,s);r(i,s)&&xo(n,W(s,t),i)}return n}var go=Jf;function Xf(t,e){return go(t,e,function(r,o){return so(t,o)})}var bo=Xf;var Qf=gr(function(t,e){return t==null?{}:bo(t,e)}),Kt=Qf;function yo(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 vo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Jt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=vo[r[t]&63];return e};var tp="array",ep="bit",wo="bits",rp="byte",To="bytes",dt="",op="exponent",ap="function",Oo="iec",ip="Invalid number",np="Invalid rounding method",Xt="jedec",sp="object",Po=".",fp="round",pp="s",lp="si",mp="kbit",up="kB",dp=" ",cp="string",hp="0",Qt={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 Ao(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:n=dt,localeOptions:s={},separator:i=dt,spacer:f=dp,symbols:u={},standard:p=dt,output:g=cp,fullform:P=!1,fullforms:T=[],exponent:b=-1,roundingMethod:F=fp,precision:O=0}={}){let l=b,d=Number(t),m=[],C=0,zt=dt;p===lp?(o=10,p=Xt):p===Oo||p===Xt?o=2:o===2?p=Oo:(o=10,p=Xt);let vt=o===10?1e3:1024,jo=P===!0,ee=d<0,re=Math[F];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(ip);if(typeof re!==ap)throw new TypeError(np);if(ee&&(d=-d),(l===-1||isNaN(l))&&(l=Math.floor(Math.log(d)/Math.log(vt)),l<0&&(l=0)),l>8&&(O>0&&(O+=8-l),l=8),g===op)return l;if(d===0)m[0]=0,zt=m[1]=Qt.symbol[p][e?wo:To][l];else{C=d/(o===2?Math.pow(2,l*10):Math.pow(1e3,l)),e&&(C=C*8,C>=vt&&l<8&&(C=C/vt,l++));let ct=Math.pow(10,l>0?a:0);m[0]=re(C*ct)/ct,m[0]===vt&&l<8&&b===-1&&(m[0]=1,l++),zt=m[1]=o===10&&l===1?e?mp:up:Qt.symbol[p][e?wo:To][l]}if(ee&&(m[0]=-m[0]),O>0&&(m[0]=m[0].toPrecision(O)),m[1]=u[m[1]]||m[1],n===!0?m[0]=m[0].toLocaleString():n.length>0?m[0]=m[0].toLocaleString(n,s):i.length>0&&(m[0]=m[0].toString().replace(Po,i)),r&&Number.isInteger(m[0])===!1&&a>0){let ct=i||Po,oe=m[0].toString().split(ct),ae=oe[1]||dt,ie=ae.length,So=a-ie;m[0]=`${oe[0]}${ct}${ae.padEnd(ie+So,hp)}`}return jo&&(m[1]=T[l]?T[l]:Qt.fullform[p][l]+(e?ep:rp)+(m[0]===1?dt:pp)),g===tp?m:g===sp?{value:m[0],symbol:m[1],exponent:l,unit:zt}:m.join(f)}var $=class t{constructor(e){c(this,"_tera");c(this,"id");c(this,"name");c(this,"icon");c(this,"path");c(this,"url");c(this,"teraUrl");c(this,"parsedName");c(this,"created");c(this,"createdFormatted");c(this,"modified");c(this,"modifiedFormatted");c(this,"accessed");c(this,"accessedFormatted");c(this,"size");c(this,"sizeFormatted");c(this,"mime");c(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:\/\/tera-tools.com\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=Ao(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.setProjectFile(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Kt(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Kt(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var te=class{constructor(e){c(this,"settings",{devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child:{siteUrl:"https://dev.tera-tools.com/embed",restrictOrigin:"*"}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"https://tera-tools.com",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});c(this,"events",yo());c(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});c(this,"methods",["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiProgress","uiPrompt","uiTrhow","uiSplat","uiWindow"]);c(this,"plugins",[]);c(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Jt();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||Jt(),...Yt(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;let r=e.data;if(!(!r.TERA||!r.id))if(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);else{if((r==null?void 0:r.action)=="rpc")return 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()})});if((r==null?void 0:r.action)=="event")return 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?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}createProjectStatePatch(e,r){let o=ne(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)}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(()=>this.debug("INFO",4,"[0/6] Init",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=>{this.debug("INFO",4,"[1/6] Setting client mode to",o),Zt(this.settings,{mode:o,...this.settings.modeOverrides[o]})}).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":this.debug("INFO",2,"Using TERA window parent");break;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 n=0,s,i=setTimeout(()=>{clearTimeout(s),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++n),clearTimeout(s),s=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(s)}).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
|
+
`),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){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);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.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)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new $({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new $({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new $({tera:this,...r}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new $({tera:this,...r}))}};export{te as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
|
5
5
|
lodash-es/lodash.js:
|
package/dist/terafy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
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:h,diffs:b}){var A=Object.keys(i),T=A.length,g=Object.keys(f),I=g.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(g[u]):g[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],g=m[i];if(!(i in f)&&i in m){var I=g;A.add.push({op:"add",path:r(h),value:I})}else T!==g&&(Object(T)!==T||Object(g)!==g||mo(T,g)||!Object.keys(T).length&&!Object.keys(g).length&&String(T)!=String(g)?n(h,A,g):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,xo=ut||ho||Function("return this")(),x=xo;var go=x.Symbol,w=go;var Vt=Object.prototype,yo=Vt.hasOwnProperty,bo=Vt.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 Fo=Array.isArray,v=Fo;var Co=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==-Co?"-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 Do(t){if(!O(t))return!1;var e=S(t);return e==Lo||e==Bo||e==No||e==ko}var dt=Do;var Uo=x["__core-js_shared__"],ct=Uo;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\]$/,qo=Function.prototype,Vo=Object.prototype,Yo=qo.toString,Zo=Vo.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(x,"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 xe=da;var ca=9007199254740991,ha=/^(?:0|[1-9]\d*)$/;function xa(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=xa;function ga(t,e,r){e=="__proto__"&&K?K(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var xt=ga;function ya(t,e){return t===e||t!==t&&e!==e}var gt=ya;var ba=Object.prototype,va=ba.hasOwnProperty;function wa(t,e,r){var o=t[e];(!(va.call(t,e)&>(o,r))||r===void 0&&!(e in t))&&xt(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?xt(r,i,f):W(r,i,f)}return r}var M=Ta;var ge=Math.max;function Pa(t,e,r){return e=ge(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=ge(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 Fa(t){return j(t)&&S(t)==Ea}var Ct=Fa;var ve=Object.prototype,Ca=ve.hasOwnProperty,Ma=ve.propertyIsEnumerable,Ra=Ct(function(){return arguments}())?Ct:function(t){return j(t)&&Ca.call(t,"callee")&&!Ma.call(t,"callee")},q=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?x.Buffer:void 0,Ba=Pe?Pe.isBuffer:void 0,ka=Ba||we,bt=ka;var Da="[object Arguments]",Ua="[object Array]",za="[object Boolean]",Ka="[object Date]",Ga="[object Error]",Wa="[object Function]",$a="[object Map]",Ha="[object Number]",qa="[object Object]",Va="[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[Da]=c[Ua]=c[Xa]=c[za]=c[Qa]=c[Ka]=c[Ga]=c[Wa]=c[$a]=c[Ha]=c[qa]=c[Va]=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 V=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{}}(),F=ui;var Se=F&&F.isTypedArray,di=Se?V(Se):Oe,Ie=di;var ci=Object.prototype,hi=ci.hasOwnProperty;function xi(t,e){var r=v(t),o=!r&&q(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=xi;function gi(t,e){return function(r){return t(e(r))}}var wt=gi;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 Fe=Pi;var Ai=Object.prototype,Oi=Ai.hasOwnProperty;function ji(t){if(!O(t))return Fe(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Oi.call(t,o))||r.push(o);return r}var Ce=ji;function Si(t){return yt(t)?vt(t,!0):Ce(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 Fi=P(Object,"create"),C=Fi;function Ci(){this.__data__=C?C(null):{},this.size=0}var Re=Ci;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(C){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,Di=ki.hasOwnProperty;function Ui(t){var e=this.__data__;return C?e[t]!==void 0:Di.call(e,t)}var Be=Ui;var zi="__lodash_hash_undefined__";function Ki(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=C&&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 De=Gi;function Wi(t,e){for(var r=t.length;r--;)if(gt(t[r][0],e))return r;return-1}var R=Wi;var $i=Array.prototype,Hi=$i.splice;function qi(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 Ue=qi;function Vi(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var ze=Vi;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=De;X.prototype.delete=Ue;X.prototype.get=ze;X.prototype.has=Ke;X.prototype.set=Ge;var N=X;var Ji=P(x,"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 qe=rs;function os(t){return B(this,t).has(t)}var Ve=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=qe;Q.prototype.has=Ve;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 xs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var et=xs;var er=w?w.isConcatSpreadable:void 0;function gs(t){return v(t)||q(t)||!!(er&&t&&t[er])}var rr=gs;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,xr=_s?x.Buffer:void 0,gr=xr?xr.allocUnsafe:void 0;function Es(t,e){if(e)return t.slice();var r=t.length,o=gr?gr(r):new t.constructor(r);return t.copy(o),o}var br=Es;function Fs(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=Fs;function Cs(){return[]}var Pt=Cs;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 Ds(t,e){return M(t,At(t),e)}var Pr=Ds;function Us(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var Ot=Us;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(x,"DataView"),jt=Gs;var Ws=P(x,"Promise"),St=Ws;var $s=P(x,"Set"),It=$s;var jr="[object Map]",Hs="[object Object]",Sr="[object Promise]",Ir="[object Set]",_r="[object WeakMap]",Er="[object DataView]",qs=E(jt),Vs=E(L),Ys=E(St),Zs=E(It),Js=E(ht),U=S;(jt&&U(new jt(new ArrayBuffer(1)))!=Er||L&&U(new L)!=jr||St&&U(St.resolve())!=Sr||It&&U(new It)!=Ir||ht&&U(new ht)!=_r)&&(U=function(t){var e=S(t),r=e==Hs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case qs:return Er;case Vs:return jr;case Ys:return Sr;case Zs:return Ir;case Js:return _r}return e});var at=U;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 Fr=tn;var en=x.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 Cr=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]",xn="[object Symbol]",gn="[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 gn:return it(t);case pn:case ln:return new o(+t);case yn:return Cr(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 xn:return Lr(t)}}var kr=In;function _n(t){return typeof t.constructor=="function"&&!H(t)?pe(Tt(t)):{}}var Dr=_n;var En="[object Map]";function Fn(t){return j(t)&&at(t)==En}var Ur=Fn;var zr=F&&F.isMap,Cn=zr?V(zr):Ur,Kr=Cn;var Mn="[object Set]";function Rn(t){return j(t)&&at(t)==Mn}var Gr=Rn;var Wr=F&&F.isSet,Nn=Wr?V(Wr):Gr,$r=Nn;var Ln=1,Bn=2,kn=4,Hr="[object Arguments]",Dn="[object Array]",Un="[object Boolean]",zn="[object Date]",Kn="[object Error]",qr="[object Function]",Gn="[object GeneratorFunction]",Wn="[object Map]",$n="[object Number]",Vr="[object Object]",Hn="[object RegExp]",qn="[object Set]",Vn="[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[Dn]=d[Jn]=d[Xn]=d[Un]=d[zn]=d[Qn]=d[tf]=d[ef]=d[rf]=d[of]=d[Wn]=d[$n]=d[Vr]=d[Hn]=d[qn]=d[Vn]=d[Yn]=d[af]=d[sf]=d[nf]=d[ff]=!0;d[Kn]=d[qr]=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=Fr(t),!i)return me(t,n)}else{var b=at(t),A=b==qr||b==Gn;if(bt(t))return br(t,i);if(b==Vr||b==Hr||A&&!a){if(n=f||A?{}:Dr(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 g=m?f?Or:Ar:f?Z:Y,I=h?void 0:g(t);return xe(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)||q(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 xf(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=xf;function gf(t,e){return to(t,e,function(r,o){return Xr(t,o)})}var eo=gf;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",Dt="jedec",jf="object",no=".",Sf="round",If="s",_f="si",Ef="kbit",Ff="kB",Cf=" ",Mf="string",Rf="0",Ut={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=Cf,symbols:m={},standard:h=st,output:b=Mf,fullform:A=!1,fullforms:T=[],exponent:g=-1,roundingMethod:I=Sf,precision:y=0}={}){let p=g,u=Number(t),l=[],_=0,Ft=st;h===_f?(o=10,h=Dt):h===so||h===Dt?o=2:o===2?h=so:(o=10,h=Dt);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,Ft=l[1]=Ut.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&&g===-1&&(l[0]=1,p++),Ft=l[1]=o===10&&p===1?e?Ef:Ff:Ut.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]:Ut.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:Ft}:l.join(f)}var D=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:\/\/tera-tools.com\/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.setProjectFile(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={devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",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","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPageUrl","setPageTitle","uiAlert","uiConfirm","uiProgress","uiPrompt","uiTrhow","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;let r=e.data;if(!(!r.TERA||!r.id))if(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);else{if(r?.action=="rpc")return 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()})});if(r?.action=="event")return 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?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}acceptPostboxes={};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)}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.debug("INFO",4,"[0/6] Init",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=>{this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o}).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":this.debug("INFO",2,"Using TERA window parent");break;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
|
-
`),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){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);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.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)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new
|
|
1
|
+
function ie(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:u,basePathForRemoves:p,diffs:g}){var O=Object.keys(i),w=O.length,x=Object.keys(f),E=x.length,T,l=i.length-f.length;if(Io(i,f)){for(var d=0;d<w;d++){var m=Array.isArray(i)?Number(O[d]):O[d];m in f||(T=p.concat(m),g.remove.push({op:"remove",path:r(T)}))}for(var d=0;d<E;d++){var m=Array.isArray(f)?Number(x[d]):x[d];s({key:m,obj1:i,obj2:f,path:u.concat(m),pathForRemoves:u.concat(m),diffs:g})}}else{for(var d=0;d<l;d++)T=p.concat(d),g.remove.push({op:"remove",path:r(T)});for(var F=i.slice(l),d=0;d<E;d++)s({key:d,obj1:F,obj2:f,path:u.concat(d),pathForRemoves:u.concat(d+l),diffs:g})}}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:u,path:p,pathForRemoves:g,diffs:O}){var w=f[i],x=u[i];if(!(i in f)&&i in u){var E=x;O.add.push({op:"add",path:r(p),value:E})}else w!==x&&(Object(w)!==w||Object(x)!==x||So(w,x)||!Object.keys(w).length&&!Object.keys(x).length&&String(w)!=String(x)?n(p,O,x):o({obj1:f[i],obj2:u[i],basePath:p,basePathForRemoves:g,diffs:O}))}function n(i,f,u){f.replace.push({op:"replace",path:r(i),value:u})}}function So(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function Io(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 _o=typeof global=="object"&&global&&global.Object===Object&&global,vt=_o;var Eo=typeof self=="object"&&self&&self.Object===Object&&self,Fo=vt||Eo||Function("return this")(),b=Fo;var Co=b.Symbol,A=Co;var se=Object.prototype,Mo=se.hasOwnProperty,Ro=se.toString,ct=A?A.toStringTag:void 0;function No(t){var e=Mo.call(t,ct),r=t[ct];try{t[ct]=void 0;var o=!0}catch{}var a=Ro.call(t);return o&&(e?t[ct]=r:delete t[ct]),a}var ne=No;var Lo=Object.prototype,Bo=Lo.toString;function Do(t){return Bo.call(t)}var fe=Do;var Uo="[object Null]",ko="[object Undefined]",pe=A?A.toStringTag:void 0;function Go(t){return t==null?t===void 0?ko:Uo:pe&&pe in Object(t)?ne(t):fe(t)}var S=Go;function Ko(t){return t!=null&&typeof t=="object"}var P=Ko;var zo="[object Symbol]";function Wo(t){return typeof t=="symbol"||P(t)&&S(t)==zo}var H=Wo;function $o(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 le=$o;var Ho=Array.isArray,y=Ho;var Vo=1/0,me=A?A.prototype:void 0,ue=me?me.toString:void 0;function de(t){if(typeof t=="string")return t;if(y(t))return le(t,de)+"";if(H(t))return ue?ue.call(t):"";var e=t+"";return e=="0"&&1/t==-Vo?"-0":e}var ce=de;function qo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var v=qo;function Yo(t){return t}var wt=Yo;var Zo="[object AsyncFunction]",Jo="[object Function]",Xo="[object GeneratorFunction]",Qo="[object Proxy]";function ta(t){if(!v(t))return!1;var e=S(t);return e==Jo||e==Xo||e==Zo||e==Qo}var V=ta;var ea=b["__core-js_shared__"],Tt=ea;var he=function(){var t=/[^.]+$/.exec(Tt&&Tt.keys&&Tt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function ra(t){return!!he&&he in t}var ge=ra;var oa=Function.prototype,aa=oa.toString;function ia(t){if(t!=null){try{return aa.call(t)}catch{}try{return t+""}catch{}}return""}var C=ia;var sa=/[\\^$.*+?()[\]{}|]/g,na=/^\[object .+?Constructor\]$/,fa=Function.prototype,pa=Object.prototype,la=fa.toString,ma=pa.hasOwnProperty,ua=RegExp("^"+la.call(ma).replace(sa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function da(t){if(!v(t)||ge(t))return!1;var e=V(t)?ua:na;return e.test(C(t))}var xe=da;function ca(t,e){return t?.[e]}var be=ca;function ha(t,e){var r=be(t,e);return xe(r)?r:void 0}var j=ha;var ga=j(b,"WeakMap"),Ot=ga;var ye=Object.create,xa=function(){function t(){}return function(e){if(!v(e))return{};if(ye)return ye(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ve=xa;function ba(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 we=ba;function ya(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var Pt=ya;var va=800,wa=16,Ta=Date.now;function Oa(t){var e=0,r=0;return function(){var o=Ta(),a=wa-(o-r);if(r=o,a>0){if(++e>=va)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Te=Oa;function Pa(t){return function(){return t}}var Oe=Pa;var Aa=function(){try{var t=j(Object,"defineProperty");return t({},"",{}),t}catch{}}(),q=Aa;var ja=q?function(t,e){return q(t,"toString",{configurable:!0,enumerable:!1,value:Oe(e),writable:!0})}:wt,Pe=ja;var Sa=Te(Pe),At=Sa;function Ia(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Ae=Ia;var _a=9007199254740991,Ea=/^(?:0|[1-9]\d*)$/;function Fa(t,e){var r=typeof t;return e=e??_a,!!e&&(r=="number"||r!="symbol"&&Ea.test(t))&&t>-1&&t%1==0&&t<e}var L=Fa;function Ca(t,e,r){e=="__proto__"&&q?q(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Y=Ca;function Ma(t,e){return t===e||t!==t&&e!==e}var B=Ma;var Ra=Object.prototype,Na=Ra.hasOwnProperty;function La(t,e,r){var o=t[e];(!(Na.call(t,e)&&B(o,r))||r===void 0&&!(e in t))&&Y(t,e,r)}var Z=La;function Ba(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?Y(r,i,f):Z(r,i,f)}return r}var I=Ba;var je=Math.max;function Da(t,e,r){return e=je(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=je(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),we(t,this,i)}}var jt=Da;function Ua(t,e){return At(jt(t,e,wt),t+"")}var Se=Ua;var ka=9007199254740991;function Ga(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ka}var J=Ga;function Ka(t){return t!=null&&J(t.length)&&!V(t)}var D=Ka;function za(t,e,r){if(!v(r))return!1;var o=typeof e;return(o=="number"?D(r)&&L(e,r.length):o=="string"&&e in r)?B(r[e],t):!1}var Ie=za;function Wa(t){return Se(function(e,r){var o=-1,a=r.length,s=a>1?r[a-1]:void 0,n=a>2?r[2]:void 0;for(s=t.length>3&&typeof s=="function"?(a--,s):void 0,n&&Ie(r[0],r[1],n)&&(s=a<3?void 0:s,a=1),e=Object(e);++o<a;){var i=r[o];i&&t(e,i,o,s)}return e})}var _e=Wa;var $a=Object.prototype;function Ha(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||$a;return t===r}var X=Ha;function Va(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Ee=Va;var qa="[object Arguments]";function Ya(t){return P(t)&&S(t)==qa}var zt=Ya;var Fe=Object.prototype,Za=Fe.hasOwnProperty,Ja=Fe.propertyIsEnumerable,Xa=zt(function(){return arguments}())?zt:function(t){return P(t)&&Za.call(t,"callee")&&!Ja.call(t,"callee")},M=Xa;function Qa(){return!1}var Ce=Qa;var Ne=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Me=Ne&&typeof module=="object"&&module&&!module.nodeType&&module,ti=Me&&Me.exports===Ne,Re=ti?b.Buffer:void 0,ei=Re?Re.isBuffer:void 0,ri=ei||Ce,Q=ri;var oi="[object Arguments]",ai="[object Array]",ii="[object Boolean]",si="[object Date]",ni="[object Error]",fi="[object Function]",pi="[object Map]",li="[object Number]",mi="[object Object]",ui="[object RegExp]",di="[object Set]",ci="[object String]",hi="[object WeakMap]",gi="[object ArrayBuffer]",xi="[object DataView]",bi="[object Float32Array]",yi="[object Float64Array]",vi="[object Int8Array]",wi="[object Int16Array]",Ti="[object Int32Array]",Oi="[object Uint8Array]",Pi="[object Uint8ClampedArray]",Ai="[object Uint16Array]",ji="[object Uint32Array]",h={};h[bi]=h[yi]=h[vi]=h[wi]=h[Ti]=h[Oi]=h[Pi]=h[Ai]=h[ji]=!0;h[oi]=h[ai]=h[gi]=h[ii]=h[xi]=h[si]=h[ni]=h[fi]=h[pi]=h[li]=h[mi]=h[ui]=h[di]=h[ci]=h[hi]=!1;function Si(t){return P(t)&&J(t.length)&&!!h[S(t)]}var Le=Si;function Ii(t){return function(e){return t(e)}}var tt=Ii;var Be=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ht=Be&&typeof module=="object"&&module&&!module.nodeType&&module,_i=ht&&ht.exports===Be,Wt=_i&&vt.process,Ei=function(){try{var t=ht&&ht.require&&ht.require("util").types;return t||Wt&&Wt.binding&&Wt.binding("util")}catch{}}(),R=Ei;var De=R&&R.isTypedArray,Fi=De?tt(De):Le,St=Fi;var Ci=Object.prototype,Mi=Ci.hasOwnProperty;function Ri(t,e){var r=y(t),o=!r&&M(t),a=!r&&!o&&Q(t),s=!r&&!o&&!a&&St(t),n=r||o||a||s,i=n?Ee(t.length,String):[],f=i.length;for(var u in t)(e||Mi.call(t,u))&&!(n&&(u=="length"||a&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||L(u,f)))&&i.push(u);return i}var It=Ri;function Ni(t,e){return function(r){return t(e(r))}}var _t=Ni;var Li=_t(Object.keys,Object),Ue=Li;var Bi=Object.prototype,Di=Bi.hasOwnProperty;function Ui(t){if(!X(t))return Ue(t);var e=[];for(var r in Object(t))Di.call(t,r)&&r!="constructor"&&e.push(r);return e}var ke=Ui;function ki(t){return D(t)?It(t):ke(t)}var et=ki;function Gi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ge=Gi;var Ki=Object.prototype,zi=Ki.hasOwnProperty;function Wi(t){if(!v(t))return Ge(t);var e=X(t),r=[];for(var o in t)o=="constructor"&&(e||!zi.call(t,o))||r.push(o);return r}var Ke=Wi;function $i(t){return D(t)?It(t,!0):Ke(t)}var _=$i;var Hi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vi=/^\w*$/;function qi(t,e){if(y(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||H(t)?!0:Vi.test(t)||!Hi.test(t)||e!=null&&t in Object(e)}var ze=qi;var Yi=j(Object,"create"),N=Yi;function Zi(){this.__data__=N?N(null):{},this.size=0}var We=Zi;function Ji(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var $e=Ji;var Xi="__lodash_hash_undefined__",Qi=Object.prototype,ts=Qi.hasOwnProperty;function es(t){var e=this.__data__;if(N){var r=e[t];return r===Xi?void 0:r}return ts.call(e,t)?e[t]:void 0}var He=es;var rs=Object.prototype,os=rs.hasOwnProperty;function as(t){var e=this.__data__;return N?e[t]!==void 0:os.call(e,t)}var Ve=as;var is="__lodash_hash_undefined__";function ss(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=N&&e===void 0?is:e,this}var qe=ss;function rt(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])}}rt.prototype.clear=We;rt.prototype.delete=$e;rt.prototype.get=He;rt.prototype.has=Ve;rt.prototype.set=qe;var $t=rt;function ns(){this.__data__=[],this.size=0}var Ye=ns;function fs(t,e){for(var r=t.length;r--;)if(B(t[r][0],e))return r;return-1}var U=fs;var ps=Array.prototype,ls=ps.splice;function ms(t){var e=this.__data__,r=U(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():ls.call(e,r,1),--this.size,!0}var Ze=ms;function us(t){var e=this.__data__,r=U(e,t);return r<0?void 0:e[r][1]}var Je=us;function ds(t){return U(this.__data__,t)>-1}var Xe=ds;function cs(t,e){var r=this.__data__,o=U(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Qe=cs;function ot(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])}}ot.prototype.clear=Ye;ot.prototype.delete=Ze;ot.prototype.get=Je;ot.prototype.has=Xe;ot.prototype.set=Qe;var k=ot;var hs=j(b,"Map"),G=hs;function gs(){this.size=0,this.__data__={hash:new $t,map:new(G||k),string:new $t}}var tr=gs;function xs(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var er=xs;function bs(t,e){var r=t.__data__;return er(e)?r[typeof e=="string"?"string":"hash"]:r.map}var K=bs;function ys(t){var e=K(this,t).delete(t);return this.size-=e?1:0,e}var rr=ys;function vs(t){return K(this,t).get(t)}var or=vs;function ws(t){return K(this,t).has(t)}var ar=ws;function Ts(t,e){var r=K(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var ir=Ts;function at(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])}}at.prototype.clear=tr;at.prototype.delete=rr;at.prototype.get=or;at.prototype.has=ar;at.prototype.set=ir;var gt=at;var Os="Expected a function";function Ht(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Os);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(Ht.Cache||gt),r}Ht.Cache=gt;var sr=Ht;var Ps=500;function As(t){var e=sr(t,function(o){return r.size===Ps&&r.clear(),o}),r=e.cache;return e}var nr=As;var js=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ss=/\\(\\)?/g,Is=nr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(js,function(r,o,a,s){e.push(a?s.replace(Ss,"$1"):o||r)}),e}),fr=Is;function _s(t){return t==null?"":ce(t)}var pr=_s;function Es(t,e){return y(t)?t:ze(t,e)?[t]:fr(pr(t))}var z=Es;var Fs=1/0;function Cs(t){if(typeof t=="string"||H(t))return t;var e=t+"";return e=="0"&&1/t==-Fs?"-0":e}var it=Cs;function Ms(t,e){e=z(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[it(e[r++])];return r&&r==o?t:void 0}var lr=Ms;function Rs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var st=Rs;var mr=A?A.isConcatSpreadable:void 0;function Ns(t){return y(t)||M(t)||!!(mr&&t&&t[mr])}var ur=Ns;function dr(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=ur),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?dr(i,e-1,r,o,a):st(a,i):o||(a[a.length]=i)}return a}var cr=dr;function Ls(t){var e=t==null?0:t.length;return e?cr(t,1):[]}var hr=Ls;function Bs(t){return At(jt(t,void 0,hr),t+"")}var gr=Bs;var Ds=_t(Object.getPrototypeOf,Object),nt=Ds;var Us="[object Object]",ks=Function.prototype,Gs=Object.prototype,xr=ks.toString,Ks=Gs.hasOwnProperty,zs=xr.call(Object);function Ws(t){if(!P(t)||S(t)!=Us)return!1;var e=nt(t);if(e===null)return!0;var r=Ks.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&xr.call(r)==zs}var br=Ws;function $s(){this.__data__=new k,this.size=0}var yr=$s;function Hs(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var vr=Hs;function Vs(t){return this.__data__.get(t)}var wr=Vs;function qs(t){return this.__data__.has(t)}var Tr=qs;var Ys=200;function Zs(t,e){var r=this.__data__;if(r instanceof k){var o=r.__data__;if(!G||o.length<Ys-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new gt(o)}return r.set(t,e),this.size=r.size,this}var Or=Zs;function ft(t){var e=this.__data__=new k(t);this.size=e.size}ft.prototype.clear=yr;ft.prototype.delete=vr;ft.prototype.get=wr;ft.prototype.has=Tr;ft.prototype.set=Or;var Et=ft;function Js(t,e){return t&&I(e,et(e),t)}var Pr=Js;function Xs(t,e){return t&&I(e,_(e),t)}var Ar=Xs;var _r=typeof exports=="object"&&exports&&!exports.nodeType&&exports,jr=_r&&typeof module=="object"&&module&&!module.nodeType&&module,Qs=jr&&jr.exports===_r,Sr=Qs?b.Buffer:void 0,Ir=Sr?Sr.allocUnsafe:void 0;function tn(t,e){if(e)return t.slice();var r=t.length,o=Ir?Ir(r):new t.constructor(r);return t.copy(o),o}var Ft=tn;function en(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 Er=en;function rn(){return[]}var Ct=rn;var on=Object.prototype,an=on.propertyIsEnumerable,Fr=Object.getOwnPropertySymbols,sn=Fr?function(t){return t==null?[]:(t=Object(t),Er(Fr(t),function(e){return an.call(t,e)}))}:Ct,pt=sn;function nn(t,e){return I(t,pt(t),e)}var Cr=nn;var fn=Object.getOwnPropertySymbols,pn=fn?function(t){for(var e=[];t;)st(e,pt(t)),t=nt(t);return e}:Ct,Mt=pn;function ln(t,e){return I(t,Mt(t),e)}var Mr=ln;function mn(t,e,r){var o=e(t);return y(t)?o:st(o,r(t))}var Rt=mn;function un(t){return Rt(t,et,pt)}var Rr=un;function dn(t){return Rt(t,_,Mt)}var Nr=dn;var cn=j(b,"DataView"),Nt=cn;var hn=j(b,"Promise"),Lt=hn;var gn=j(b,"Set"),Bt=gn;var Lr="[object Map]",xn="[object Object]",Br="[object Promise]",Dr="[object Set]",Ur="[object WeakMap]",kr="[object DataView]",bn=C(Nt),yn=C(G),vn=C(Lt),wn=C(Bt),Tn=C(Ot),$=S;(Nt&&$(new Nt(new ArrayBuffer(1)))!=kr||G&&$(new G)!=Lr||Lt&&$(Lt.resolve())!=Br||Bt&&$(new Bt)!=Dr||Ot&&$(new Ot)!=Ur)&&($=function(t){var e=S(t),r=e==xn?t.constructor:void 0,o=r?C(r):"";if(o)switch(o){case bn:return kr;case yn:return Lr;case vn:return Br;case wn:return Dr;case Tn:return Ur}return e});var lt=$;var On=Object.prototype,Pn=On.hasOwnProperty;function An(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Pn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Gr=An;var jn=b.Uint8Array,Vt=jn;function Sn(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}var mt=Sn;function In(t,e){var r=e?mt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Kr=In;var _n=/\w*$/;function En(t){var e=new t.constructor(t.source,_n.exec(t));return e.lastIndex=t.lastIndex,e}var zr=En;var Wr=A?A.prototype:void 0,$r=Wr?Wr.valueOf:void 0;function Fn(t){return $r?Object($r.call(t)):{}}var Hr=Fn;function Cn(t,e){var r=e?mt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Dt=Cn;var Mn="[object Boolean]",Rn="[object Date]",Nn="[object Map]",Ln="[object Number]",Bn="[object RegExp]",Dn="[object Set]",Un="[object String]",kn="[object Symbol]",Gn="[object ArrayBuffer]",Kn="[object DataView]",zn="[object Float32Array]",Wn="[object Float64Array]",$n="[object Int8Array]",Hn="[object Int16Array]",Vn="[object Int32Array]",qn="[object Uint8Array]",Yn="[object Uint8ClampedArray]",Zn="[object Uint16Array]",Jn="[object Uint32Array]";function Xn(t,e,r){var o=t.constructor;switch(e){case Gn:return mt(t);case Mn:case Rn:return new o(+t);case Kn:return Kr(t,r);case zn:case Wn:case $n:case Hn:case Vn:case qn:case Yn:case Zn:case Jn:return Dt(t,r);case Nn:return new o;case Ln:case Un:return new o(t);case Bn:return zr(t);case Dn:return new o;case kn:return Hr(t)}}var Vr=Xn;function Qn(t){return typeof t.constructor=="function"&&!X(t)?ve(nt(t)):{}}var Ut=Qn;var tf="[object Map]";function ef(t){return P(t)&<(t)==tf}var qr=ef;var Yr=R&&R.isMap,rf=Yr?tt(Yr):qr,Zr=rf;var of="[object Set]";function af(t){return P(t)&<(t)==of}var Jr=af;var Xr=R&&R.isSet,sf=Xr?tt(Xr):Jr,Qr=sf;var nf=1,ff=2,pf=4,to="[object Arguments]",lf="[object Array]",mf="[object Boolean]",uf="[object Date]",df="[object Error]",eo="[object Function]",cf="[object GeneratorFunction]",hf="[object Map]",gf="[object Number]",ro="[object Object]",xf="[object RegExp]",bf="[object Set]",yf="[object String]",vf="[object Symbol]",wf="[object WeakMap]",Tf="[object ArrayBuffer]",Of="[object DataView]",Pf="[object Float32Array]",Af="[object Float64Array]",jf="[object Int8Array]",Sf="[object Int16Array]",If="[object Int32Array]",_f="[object Uint8Array]",Ef="[object Uint8ClampedArray]",Ff="[object Uint16Array]",Cf="[object Uint32Array]",c={};c[to]=c[lf]=c[Tf]=c[Of]=c[mf]=c[uf]=c[Pf]=c[Af]=c[jf]=c[Sf]=c[If]=c[hf]=c[gf]=c[ro]=c[xf]=c[bf]=c[yf]=c[vf]=c[_f]=c[Ef]=c[Ff]=c[Cf]=!0;c[df]=c[eo]=c[wf]=!1;function kt(t,e,r,o,a,s){var n,i=e&nf,f=e&ff,u=e&pf;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!v(t))return t;var p=y(t);if(p){if(n=Gr(t),!i)return Pt(t,n)}else{var g=lt(t),O=g==eo||g==cf;if(Q(t))return Ft(t,i);if(g==ro||g==to||O&&!a){if(n=f||O?{}:Ut(t),!i)return f?Mr(t,Ar(n,t)):Cr(t,Pr(n,t))}else{if(!c[g])return a?t:{};n=Vr(t,g,i)}}s||(s=new Et);var w=s.get(t);if(w)return w;s.set(t,n),Qr(t)?t.forEach(function(T){n.add(kt(T,e,r,T,t,s))}):Zr(t)&&t.forEach(function(T,l){n.set(l,kt(T,e,r,l,t,s))});var x=u?f?Nr:Rr:f?_:et,E=p?void 0:x(t);return Ae(E||t,function(T,l){E&&(l=T,T=t[l]),Z(n,l,kt(T,e,r,l,t,s))}),n}var oo=kt;var Mf=1,Rf=4;function Nf(t){return oo(t,Mf|Rf)}var qt=Nf;function Lf(t,e){return t!=null&&e in Object(t)}var ao=Lf;function Bf(t,e,r){e=z(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=it(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&&J(a)&&L(n,a)&&(y(t)||M(t)))}var io=Bf;function Df(t,e){return t!=null&&io(t,e,ao)}var so=Df;function Uf(t){return function(e,r,o){for(var a=-1,s=Object(e),n=o(e),i=n.length;i--;){var f=n[t?i:++a];if(r(s[f],f,s)===!1)break}return e}}var no=Uf;var kf=no(),fo=kf;function Gf(t,e,r){(r!==void 0&&!B(t[e],r)||r===void 0&&!(e in t))&&Y(t,e,r)}var xt=Gf;function Kf(t){return P(t)&&D(t)}var po=Kf;function zf(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var bt=zf;function Wf(t){return I(t,_(t))}var lo=Wf;function $f(t,e,r,o,a,s,n){var i=bt(t,r),f=bt(e,r),u=n.get(f);if(u){xt(t,r,u);return}var p=s?s(i,f,r+"",t,e,n):void 0,g=p===void 0;if(g){var O=y(f),w=!O&&Q(f),x=!O&&!w&&St(f);p=f,O||w||x?y(i)?p=i:po(i)?p=Pt(i):w?(g=!1,p=Ft(f,!0)):x?(g=!1,p=Dt(f,!0)):p=[]:br(f)||M(f)?(p=i,M(i)?p=lo(i):(!v(i)||V(i))&&(p=Ut(f))):g=!1}g&&(n.set(f,p),a(p,f,o,s,n),n.delete(f)),xt(t,r,p)}var mo=$f;function uo(t,e,r,o,a){t!==e&&fo(e,function(s,n){if(a||(a=new Et),v(s))mo(t,e,n,r,uo,o,a);else{var i=o?o(bt(t,n),s,n+"",t,e,a):void 0;i===void 0&&(i=s),xt(t,n,i)}},_)}var co=uo;var Hf=_e(function(t,e,r){co(t,e,r)}),Yt=Hf;function Vf(t,e,r,o){if(!v(t))return t;e=z(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=it(e[a]),u=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var p=i[f];u=o?o(p,f,i):void 0,u===void 0&&(u=v(p)?p:L(e[a+1])?[]:{})}Z(i,f,u),i=i[f]}return t}var ho=Vf;function qf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=lr(t,n);r(i,n)&&ho(s,z(n,t),i)}return s}var go=qf;function Yf(t,e){return go(t,e,function(r,o){return so(t,o)})}var xo=Yf;var Zf=gr(function(t,e){return t==null?{}:xo(t,e)}),Gt=Zf;function bo(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 yo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Zt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=yo[r[t]&63];return e};var Jf="array",Xf="bit",vo="bits",Qf="byte",wo="bytes",ut="",tp="exponent",ep="function",To="iec",rp="Invalid number",op="Invalid rounding method",Jt="jedec",ap="object",Oo=".",ip="round",sp="s",np="si",fp="kbit",pp="kB",lp=" ",mp="string",up="0",Xt={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=ut,localeOptions:n={},separator:i=ut,spacer:f=lp,symbols:u={},standard:p=ut,output:g=mp,fullform:O=!1,fullforms:w=[],exponent:x=-1,roundingMethod:E=ip,precision:T=0}={}){let l=x,d=Number(t),m=[],F=0,Kt=ut;p===np?(o=10,p=Jt):p===To||p===Jt?o=2:o===2?p=To:(o=10,p=Jt);let yt=o===10?1e3:1024,Ao=O===!0,te=d<0,ee=Math[E];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(rp);if(typeof ee!==ep)throw new TypeError(op);if(te&&(d=-d),(l===-1||isNaN(l))&&(l=Math.floor(Math.log(d)/Math.log(yt)),l<0&&(l=0)),l>8&&(T>0&&(T+=8-l),l=8),g===tp)return l;if(d===0)m[0]=0,Kt=m[1]=Xt.symbol[p][e?vo:wo][l];else{F=d/(o===2?Math.pow(2,l*10):Math.pow(1e3,l)),e&&(F=F*8,F>=yt&&l<8&&(F=F/yt,l++));let dt=Math.pow(10,l>0?a:0);m[0]=ee(F*dt)/dt,m[0]===yt&&l<8&&x===-1&&(m[0]=1,l++),Kt=m[1]=o===10&&l===1?e?fp:pp:Xt.symbol[p][e?vo:wo][l]}if(te&&(m[0]=-m[0]),T>0&&(m[0]=m[0].toPrecision(T)),m[1]=u[m[1]]||m[1],s===!0?m[0]=m[0].toLocaleString():s.length>0?m[0]=m[0].toLocaleString(s,n):i.length>0&&(m[0]=m[0].toString().replace(Oo,i)),r&&Number.isInteger(m[0])===!1&&a>0){let dt=i||Oo,re=m[0].toString().split(dt),oe=re[1]||ut,ae=oe.length,jo=a-ae;m[0]=`${re[0]}${dt}${oe.padEnd(ae+jo,up)}`}return Ao&&(m[1]=w[l]?w[l]:Xt.fullform[p][l]+(e?Xf:Qf)+(m[0]===1?ut:sp)),g===Jf?m:g===ap?{value:m[0],symbol:m[1],exponent:l,unit:Kt}:m.join(f)}var W=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:\/\/tera-tools.com\/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.setProjectFile(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Gt(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Gt(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var Qt=class{settings={devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child:{siteUrl:"https://dev.tera-tools.com/embed",restrictOrigin:"*"}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"https://tera-tools.com",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=bo();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","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiProgress","uiPrompt","uiTrhow","uiSplat","uiWindow"];plugins=[];send(e){let r=Zt();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||Zt(),...qt(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;let r=e.data;if(!(!r.TERA||!r.id))if(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);else{if(r?.action=="rpc")return 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()})});if(r?.action=="event")return 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?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}acceptPostboxes={};createProjectStatePatch(e,r){let o=ie(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)}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.debug("INFO",4,"[0/6] Init",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=>{this.debug("INFO",4,"[1/6] Setting client mode to",o),Yt(this.settings,{mode:o,...this.settings.modeOverrides[o]})}).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":this.debug("INFO",2,"Using TERA window parent");break;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
|
+
`),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){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);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.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)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new W({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new W({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new W({tera:this,...r}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new W({tera:this,...r}))}};export{Qt as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
|
5
5
|
lodash-es/lodash.js:
|
package/lib/terafy.client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {diff} from 'just-diff';
|
|
2
|
-
import {cloneDeep} from 'lodash-es';
|
|
2
|
+
import {cloneDeep, merge} from 'lodash-es';
|
|
3
3
|
import Mitt from 'mitt';
|
|
4
4
|
import {nanoid} from 'nanoid';
|
|
5
5
|
import ProjectFile from './projectFile.js';
|
|
@@ -17,10 +17,11 @@ export default class TeraFy {
|
|
|
17
17
|
* Various settings to configure behaviour
|
|
18
18
|
*
|
|
19
19
|
* @type {Object}
|
|
20
|
-
* @property {Boolean} devMode Operate in
|
|
20
|
+
* @property {Boolean} devMode Operate in Dev-Mode - i.e. force outer refresh when encountering an existing TeraFy instance
|
|
21
21
|
* @property {Number} verbosity Verbosity level, the higher the more chatty TeraFY will be. Set to zero to disable all `debug()` call output
|
|
22
22
|
* @property {'detect'|'parent'|'child'|'popup'} mode How to communicate with TERA. 'parent' assumes that the parent of the current document is TERA, 'child' spawns an iFrame and uses TERA there, 'detect' tries parent and switches to `modeFallback` if communication fails
|
|
23
23
|
* @property {String} modeFallback Method to use when all method detection fails
|
|
24
|
+
* @property {Object<Object<Object>>} modeOverrides Settings to merge when in specific, named modes
|
|
24
25
|
* @property {Number} modeTimeout How long entities have in 'detect' mode to identify themselves
|
|
25
26
|
* @property {String} siteUrl The TERA URL to connect to
|
|
26
27
|
* @property {String} restrictOrigin URL to restrict communications to
|
|
@@ -35,8 +36,14 @@ export default class TeraFy {
|
|
|
35
36
|
mode: 'detect',
|
|
36
37
|
modeTimeout: 300,
|
|
37
38
|
modeFallback: 'child', // ENUM: 'child' (use iframes), 'popup' (use popup windows)
|
|
39
|
+
modeOverrides: {
|
|
40
|
+
child: { // When we're in child mode assume a local dev environment and use the dev.tera-tools.com site instead to work around CORS restrictions
|
|
41
|
+
siteUrl: 'https://dev.tera-tools.com/embed',
|
|
42
|
+
restrictOrigin: '*',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
38
45
|
siteUrl: 'https://tera-tools.com/embed',
|
|
39
|
-
restrictOrigin: '
|
|
46
|
+
restrictOrigin: 'https://tera-tools.com',
|
|
40
47
|
frameSandbox: [
|
|
41
48
|
'allow-forms',
|
|
42
49
|
'allow-modals',
|
|
@@ -131,8 +138,7 @@ export default class TeraFy {
|
|
|
131
138
|
'projectLog',
|
|
132
139
|
|
|
133
140
|
// Webpages
|
|
134
|
-
'
|
|
135
|
-
'setPageTitle',
|
|
141
|
+
'setPage',
|
|
136
142
|
|
|
137
143
|
// UI
|
|
138
144
|
'uiAlert',
|
|
@@ -382,7 +388,10 @@ export default class TeraFy {
|
|
|
382
388
|
.then(()=> this.detectMode())
|
|
383
389
|
.then(mode => {
|
|
384
390
|
this.debug('INFO', 4, '[1/6] Setting client mode to', mode);
|
|
385
|
-
this.settings
|
|
391
|
+
merge(this.settings, {
|
|
392
|
+
mode,
|
|
393
|
+
...this.settings.modeOverrides[mode], // Merge specific modeOverrides over the top of settings
|
|
394
|
+
});
|
|
386
395
|
})
|
|
387
396
|
.then(()=> this.debug('INFO', 4, '[2/6] Injecting comms + styles + methods'))
|
|
388
397
|
.then(()=> Promise.all([
|
|
@@ -1275,21 +1284,14 @@ export default class TeraFy {
|
|
|
1275
1284
|
*/
|
|
1276
1285
|
|
|
1277
1286
|
|
|
1278
|
-
/**
|
|
1279
|
-
* Set an active tools URL so that it survives a refresh
|
|
1280
|
-
* This only really makes a difference to tools within the tera-tools.com site where the tool is working as an embed
|
|
1281
|
-
*
|
|
1282
|
-
* @function setPageUrl
|
|
1283
|
-
* @param {String} url The URL to restore on next refresh
|
|
1284
|
-
*/
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
1287
|
/**
|
|
1288
1288
|
* Set the active page title
|
|
1289
1289
|
* This is usually called by a tool nested within the tera-tools.com embed
|
|
1290
1290
|
*
|
|
1291
|
-
* @function
|
|
1292
|
-
* @param {String}
|
|
1291
|
+
* @function setPage
|
|
1292
|
+
* @param {Object|String} options Context information about the page, if this is a string, its assumed to popupate `url`
|
|
1293
|
+
* @param {String} [options.url] The URL to restore on next refresh
|
|
1294
|
+
* @param {String} [options.title] The page title associated with the path
|
|
1293
1295
|
*/
|
|
1294
1296
|
|
|
1295
1297
|
|
package/lib/terafy.proxy.js
CHANGED
package/lib/terafy.server.js
CHANGED
|
@@ -1380,36 +1380,17 @@ export default class TeraFyServer {
|
|
|
1380
1380
|
}
|
|
1381
1381
|
// }}}
|
|
1382
1382
|
|
|
1383
|
-
// Webpages -
|
|
1384
|
-
|
|
1383
|
+
// Webpages - setPage() {{{
|
|
1385
1384
|
/**
|
|
1386
|
-
* Set an active tools URL
|
|
1385
|
+
* Set an active tools URL or other context information so that it survives a refresh
|
|
1387
1386
|
* This only really makes a difference to tools within the tera-tools.com site where the tool is working as an embed
|
|
1388
1387
|
*
|
|
1389
|
-
* @param {String}
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
if (!url.startsWith('/')) throw new Error('All pageURLs must be a relative path starting with a slash');
|
|
1393
|
-
|
|
1394
|
-
let $routeMatched = app.service('$route').matched[0];
|
|
1395
|
-
if (!$routeMatched?.name) throw new Error('No active route');
|
|
1396
|
-
if ($routeMatched?.path == '/embed') return this.debug('INFO', 2, 'Ignoring setPageUrl(', url, ') on when in embed mode');
|
|
1397
|
-
if (!$routeMatched?.path.endsWith('/:toolPath(.*)?')) return this.debug('INFO', 2, 'Ignoring setPageUrl(', url, ') - no active tool anyway');
|
|
1398
|
-
|
|
1399
|
-
app.router.push({
|
|
1400
|
-
path: $routeMatched.path.replace(/\/:toolPath\(\.\*\)\?$/, url),
|
|
1401
|
-
});
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
/**
|
|
1406
|
-
* Set the active page title
|
|
1407
|
-
* This is usually called by a tool nested within the tera-tools.com embed
|
|
1408
|
-
*
|
|
1409
|
-
* @param {String} [title] The current page title. Set to a falsy value to revert back to the default page title
|
|
1388
|
+
* @param {Object|String} options Context information about the page, if this is a string, its assumed to popupate `url`
|
|
1389
|
+
* @param {String} [options.url] The URL to restore on next refresh
|
|
1390
|
+
* @param {String} [options.title] The page title associated with the path
|
|
1410
1391
|
*/
|
|
1411
|
-
|
|
1412
|
-
app.
|
|
1392
|
+
setPage(options) {
|
|
1393
|
+
app.service('$projects').setPage(options);
|
|
1413
1394
|
}
|
|
1414
1395
|
// }}}
|
|
1415
1396
|
|
package/package.json
CHANGED