@iebh/tera-fy 1.13.4 → 1.14.0
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 +612 -131
- package/README.md +0 -1
- package/api.md +130 -130
- package/dist/terafy.es2019.js +1 -1
- package/dist/terafy.js +1 -1
- package/documentation.yml +58 -7
- package/lib/projectFile.js +2 -2
- package/lib/terafy.client.js +6 -3
- package/lib/terafy.server.js +2 -2
- package/package.json +2 -2
package/dist/terafy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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?:\/\/(?:.+?)\/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(`
|
|
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 C=i.slice(l),d=0;d<E;d++)s({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 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,Co=vt||Eo||Function("return this")(),b=Co;var Fo=b.Symbol,A=Fo;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 F=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(F(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 Ca(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=Ca;function Fa(t,e,r){e=="__proto__"&&q?q(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Y=Fa;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 Ce=Object.prototype,Za=Ce.hasOwnProperty,Ja=Ce.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 Fe=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||Fe,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,Ci=De?tt(De):Le,St=Ci;var Fi=Object.prototype,Mi=Fi.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 Cs=1/0;function Fs(t){if(typeof t=="string"||H(t))return t;var e=t+"";return e=="0"&&1/t==-Cs?"-0":e}var it=Fs;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 Ct=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 Ft=rn;var on=Object.prototype,an=on.propertyIsEnumerable,Cr=Object.getOwnPropertySymbols,sn=Cr?function(t){return t==null?[]:(t=Object(t),Er(Cr(t),function(e){return an.call(t,e)}))}:Ft,pt=sn;function nn(t,e){return I(t,pt(t),e)}var Fr=nn;var fn=Object.getOwnPropertySymbols,pn=fn?function(t){for(var e=[];t;)st(e,pt(t)),t=nt(t);return e}:Ft,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=F(Nt),yn=F(G),vn=F(Lt),wn=F(Bt),Tn=F(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?F(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 Cn(t){return $r?Object($r.call(t)):{}}var Hr=Cn;function Fn(t,e){var r=e?mt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Dt=Fn;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]",Cf="[object Uint16Array]",Ff="[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[Cf]=c[Ff]=!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 Ct(t,i);if(g==ro||g==to||O&&!a){if(n=f||O?{}:Ut(t),!i)return f?Mr(t,Ar(n,t)):Fr(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=Ct(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=[],C=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{C=d/(o===2?Math.pow(2,l*10):Math.pow(1e3,l)),e&&(C=C*8,C>=yt&&l<8&&(C=C/yt,l++));let dt=Math.pow(10,l>0?a:0);m[0]=ee(C*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?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=Po(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return 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","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiProgress","uiPrompt","uiThrow","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
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
|
|
package/documentation.yml
CHANGED
|
@@ -1,12 +1,63 @@
|
|
|
1
1
|
toc:
|
|
2
|
-
-
|
|
3
|
-
description: |
|
|
4
|
-
See [the TeraFy Playground](./playground.html) to expriment with the various TeraFy API calls.
|
|
2
|
+
- TeraFy
|
|
5
3
|
- name: Data entities
|
|
6
4
|
children:
|
|
7
|
-
-
|
|
5
|
+
- FileFilters
|
|
8
6
|
- Project
|
|
9
7
|
- ProjectFile
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
- User
|
|
9
|
+
- name: Messaging
|
|
10
|
+
children:
|
|
11
|
+
- handshake
|
|
12
|
+
- setServerVerbosity
|
|
13
|
+
- name: Sessions
|
|
14
|
+
children:
|
|
15
|
+
- getUser
|
|
16
|
+
- requireUser
|
|
17
|
+
- name: Projects
|
|
18
|
+
children:
|
|
19
|
+
- getProject
|
|
20
|
+
- getProjects
|
|
21
|
+
- requireProject
|
|
22
|
+
- selectProject
|
|
23
|
+
- setActiveProject
|
|
24
|
+
- name: Project State
|
|
25
|
+
children:
|
|
26
|
+
- applyProjectStatePatch
|
|
27
|
+
- getProjectState
|
|
28
|
+
- replaceProjectState
|
|
29
|
+
- saveProjectState
|
|
30
|
+
- setProjectState
|
|
31
|
+
- setProjectStateDefaults
|
|
32
|
+
- setProjectStateFlush
|
|
33
|
+
- setProjectStateRefresh
|
|
34
|
+
- subscribeProjectState
|
|
35
|
+
- name: Project files
|
|
36
|
+
children:
|
|
37
|
+
- createProjectFile
|
|
38
|
+
- deleteProjectFile
|
|
39
|
+
- getProjectFile
|
|
40
|
+
- getProjectFileContents
|
|
41
|
+
- getProjectFiles
|
|
42
|
+
- selectProjectFile
|
|
43
|
+
- setProjectFileContents
|
|
44
|
+
- name: Project Libraries
|
|
45
|
+
children:
|
|
46
|
+
- getProjectLibrary
|
|
47
|
+
- selectProjectLibrary
|
|
48
|
+
- setProjectLibrary
|
|
49
|
+
- name: Project Logging
|
|
50
|
+
children:
|
|
51
|
+
- projectLog
|
|
52
|
+
- name: Web pages
|
|
53
|
+
children:
|
|
54
|
+
- setPage
|
|
55
|
+
- name: UI
|
|
56
|
+
children:
|
|
57
|
+
- uiAlert
|
|
58
|
+
- uiConfirm
|
|
59
|
+
- uiProgress
|
|
60
|
+
- uiPrompt
|
|
61
|
+
- uiSplat
|
|
62
|
+
- uiThrow
|
|
63
|
+
- uiWindow
|
package/lib/projectFile.js
CHANGED
|
@@ -195,10 +195,10 @@ export default class ProjectFile {
|
|
|
195
195
|
*
|
|
196
196
|
* @returns {Promise} A promise which resolves when the operation has completed
|
|
197
197
|
*
|
|
198
|
-
* @see
|
|
198
|
+
* @see setProjectFileContents()
|
|
199
199
|
*/
|
|
200
200
|
setContents(contents) {
|
|
201
|
-
return this._tera.
|
|
201
|
+
return this._tera.setProjectFileContents(this.id, contents);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
|
package/lib/terafy.client.js
CHANGED
|
@@ -127,7 +127,7 @@ export default class TeraFy {
|
|
|
127
127
|
'getProjectFileContents',
|
|
128
128
|
// 'createProjectFile', - Handled below (requires return mapped to ProjectFile)
|
|
129
129
|
'deleteProjectFile',
|
|
130
|
-
'
|
|
130
|
+
'setProjectFileContents',
|
|
131
131
|
|
|
132
132
|
// Project Libraries
|
|
133
133
|
'selectProjectLibrary',
|
|
@@ -145,7 +145,7 @@ export default class TeraFy {
|
|
|
145
145
|
'uiConfirm',
|
|
146
146
|
'uiProgress',
|
|
147
147
|
'uiPrompt',
|
|
148
|
-
'
|
|
148
|
+
'uiThrow',
|
|
149
149
|
'uiSplat',
|
|
150
150
|
'uiWindow',
|
|
151
151
|
];
|
|
@@ -1128,6 +1128,7 @@ export default class TeraFy {
|
|
|
1128
1128
|
/**
|
|
1129
1129
|
* Fetch the files associated with a given project
|
|
1130
1130
|
*
|
|
1131
|
+
* @function getProjectFiles
|
|
1131
1132
|
* @param {Object} options Options which mutate behaviour
|
|
1132
1133
|
* @param {Boolean} [options.autoRequire=true] Run `requireProject()` automatically before continuing
|
|
1133
1134
|
* @param {Boolean} [options.lazy=true] If true, use the fastest method to retrieve the file list such as the cache. If false, force a refresh each time
|
|
@@ -1161,6 +1162,7 @@ export default class TeraFy {
|
|
|
1161
1162
|
/**
|
|
1162
1163
|
* Fetch a project file by its name
|
|
1163
1164
|
*
|
|
1165
|
+
* @function getProjectFile
|
|
1164
1166
|
* @param {String} id The name + relative directory path component
|
|
1165
1167
|
*
|
|
1166
1168
|
* @param {Object|String} [options] Additional options to mutate behaviour, if a string is given `options.subkey` is assumed
|
|
@@ -1185,6 +1187,7 @@ export default class TeraFy {
|
|
|
1185
1187
|
* Create a new file
|
|
1186
1188
|
* This creates an empty file which can then be written to
|
|
1187
1189
|
*
|
|
1190
|
+
* @function createProjectFile
|
|
1188
1191
|
* @param {String} name The name + relative directory path component
|
|
1189
1192
|
* @returns {Promise<ProjectFile>} The eventual ProjectFile created
|
|
1190
1193
|
*/
|
|
@@ -1213,7 +1216,7 @@ export default class TeraFy {
|
|
|
1213
1216
|
/**
|
|
1214
1217
|
* Replace a project files contents
|
|
1215
1218
|
*
|
|
1216
|
-
* @function
|
|
1219
|
+
* @function setProjectFileContents
|
|
1217
1220
|
* @param {String} id File to overwrite
|
|
1218
1221
|
* @param {File|Blob|FormData|Object|Array} contents The new file contents
|
|
1219
1222
|
* @returns {Promise} A promise which will resolve when the write operation has completed
|
package/lib/terafy.server.js
CHANGED
|
@@ -889,7 +889,7 @@ export default class TeraFyServer {
|
|
|
889
889
|
}
|
|
890
890
|
// }}}
|
|
891
891
|
|
|
892
|
-
// Project files - selectProjectFile(), getProjectFiles(), getProjectFile(), createProjectFile(), deleteProjectFile(),
|
|
892
|
+
// Project files - selectProjectFile(), getProjectFiles(), getProjectFile(), createProjectFile(), deleteProjectFile(), setProjectFileContents() {{{
|
|
893
893
|
|
|
894
894
|
/**
|
|
895
895
|
* Data structure for a project file
|
|
@@ -1131,7 +1131,7 @@ export default class TeraFyServer {
|
|
|
1131
1131
|
*
|
|
1132
1132
|
* @returns {Promise} A promise which will resolve when the write operation has completed
|
|
1133
1133
|
*/
|
|
1134
|
-
|
|
1134
|
+
setProjectFileContents(id, contents, options) {
|
|
1135
1135
|
// Argument mangling {{{
|
|
1136
1136
|
// TODO: Horrible kludge to detect ID is "not a JSON blob"
|
|
1137
1137
|
if (typeof id == 'string' && !id.startsWith('{') && contents && options) { // Called as `(id, contents, options)`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iebh/tera-fy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "TERA website worker",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.js --outfile=dist/terafy.js --minify --serve --servedir=.",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
},
|
|
113
113
|
"plugins": {
|
|
114
114
|
"@release-it/conventional-changelog": {
|
|
115
|
-
"preset": "
|
|
115
|
+
"preset": "eslint",
|
|
116
116
|
"infile": "CHANGELOG.md",
|
|
117
117
|
"header": "# Changelog"
|
|
118
118
|
}
|