@iebh/tera-fy 2.3.5 → 2.3.7

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.
@@ -1,5 +1,5 @@
1
- var xo=typeof global=="object"&&global&&global.Object===Object&&global,ut=xo;var yo=typeof self=="object"&&self&&self.Object===Object&&self,bo=ut||yo||Function("return this")(),d=bo;var vo=d.Symbol,x=vo;var Qt=Object.prototype,wo=Qt.hasOwnProperty,To=Qt.toString,it=x?x.toStringTag:void 0;function Po(t){var e=wo.call(t,it),r=t[it];try{t[it]=void 0;var o=!0}catch{}var a=To.call(t);return o&&(e?t[it]=r:delete t[it]),a}var te=Po;var jo=Object.prototype,Oo=jo.toString;function Ao(t){return Oo.call(t)}var ee=Ao;var Io="[object Null]",So="[object Undefined]",re=x?x.toStringTag:void 0;function _o(t){return t==null?t===void 0?So:Io:re&&re in Object(t)?te(t):ee(t)}var w=_o;function Eo(t){return t!=null&&typeof t=="object"}var y=Eo;var Fo="[object Symbol]";function Co(t){return typeof t=="symbol"||y(t)&&w(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 dt=Mo;var No=Array.isArray,g=No;var Ro=1/0,oe=x?x.prototype:void 0,ae=oe?oe.toString:void 0;function ie(t){if(typeof t=="string")return t;if(g(t))return dt(t,ie)+"";if(k(t))return ae?ae.call(t):"";var e=t+"";return e=="0"&&1/t==-Ro?"-0":e}var ne=ie;function Lo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var T=Lo;function Bo(t){return t}var se=Bo;var ko="[object AsyncFunction]",Do="[object Function]",Uo="[object GeneratorFunction]",Go="[object Proxy]";function zo(t){if(!T(t))return!1;var e=w(t);return e==Do||e==Uo||e==ko||e==Go}var ct=zo;var Ko=d["__core-js_shared__"],ht=Ko;var fe=(function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Wo(t){return!!fe&&fe in t}var pe=Wo;var Yo=Function.prototype,$o=Yo.toString;function Ho(t){if(t!=null){try{return $o.call(t)}catch{}try{return t+""}catch{}}return""}var A=Ho;var Vo=/[\\^$.*+?()[\]{}|]/g,qo=/^\[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(!T(t)||pe(t))return!1;var e=ct(t)?ta:qo;return e.test(A(t))}var le=ea;function ra(t,e){return t==null?void 0:t[e]}var me=ra;function oa(t,e){var r=me(t,e);return le(r)?r:void 0}var b=oa;var aa=b(d,"WeakMap"),gt=aa;var ue=Object.create,ia=(function(){function t(){}return function(e){if(!T(e))return{};if(ue)return ue(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),de=ia;function na(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 ce=na;function sa(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var he=sa;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 ge=ma;function ua(t){return function(){return t}}var xe=ua;var da=(function(){try{var t=b(Object,"defineProperty");return t({},"",{}),t}catch{}})(),D=da;var ca=D?function(t,e){return D(t,"toString",{configurable:!0,enumerable:!1,value:xe(e),writable:!0})}:se,ye=ca;var ha=ge(ye),be=ha;function ga(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ve=ga;var xa=9007199254740991,ya=/^(?:0|[1-9]\d*)$/;function ba(t,e){var r=typeof t;return e=e==null?xa:e,!!e&&(r=="number"||r!="symbol"&&ya.test(t))&&t>-1&&t%1==0&&t<e}var U=ba;function va(t,e,r){e=="__proto__"&&D?D(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var xt=va;function wa(t,e){return t===e||t!==t&&e!==e}var yt=wa;var Ta=Object.prototype,Pa=Ta.hasOwnProperty;function ja(t,e,r){var o=t[e];(!(Pa.call(t,e)&&yt(o,r))||r===void 0&&!(e in t))&&xt(t,e,r)}var G=ja;function Oa(t,e,r,o){var a=!r;r||(r={});for(var i=-1,n=e.length;++i<n;){var s=e[i],u=o?o(r[s],t[s],s,r,t):void 0;u===void 0&&(u=t[s]),a?xt(r,s,u):G(r,s,u)}return r}var O=Oa;var we=Math.max;function Aa(t,e,r){return e=we(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,i=we(o.length-e,0),n=Array(i);++a<i;)n[a]=o[e+a];a=-1;for(var s=Array(e+1);++a<e;)s[a]=o[a];return s[e]=r(n),ce(t,this,s)}}var Te=Aa;var Ia=9007199254740991;function Sa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ia}var z=Sa;function _a(t){return t!=null&&z(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 K=Fa;function Ca(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Pe=Ca;var Ma="[object Arguments]";function Na(t){return y(t)&&w(t)==Ma}var Lt=Na;var je=Object.prototype,Ra=je.hasOwnProperty,La=je.propertyIsEnumerable,Ba=Lt((function(){return arguments})())?Lt:function(t){return y(t)&&Ra.call(t,"callee")&&!La.call(t,"callee")},W=Ba;function ka(){return!1}var Oe=ka;var Se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ae=Se&&typeof module=="object"&&module&&!module.nodeType&&module,Da=Ae&&Ae.exports===Se,Ie=Da?d.Buffer:void 0,Ua=Ie?Ie.isBuffer:void 0,Ga=Ua||Oe,vt=Ga;var za="[object Arguments]",Ka="[object Array]",Wa="[object Boolean]",Ya="[object Date]",$a="[object Error]",Ha="[object Function]",Va="[object Map]",qa="[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]",ni="[object Int16Array]",si="[object Int32Array]",fi="[object Uint8Array]",pi="[object Uint8ClampedArray]",li="[object Uint16Array]",mi="[object Uint32Array]",m={};m[oi]=m[ai]=m[ii]=m[ni]=m[si]=m[fi]=m[pi]=m[li]=m[mi]=!0;m[za]=m[Ka]=m[ei]=m[Wa]=m[ri]=m[Ya]=m[$a]=m[Ha]=m[Va]=m[qa]=m[Za]=m[Ja]=m[Xa]=m[Qa]=m[ti]=!1;function ui(t){return y(t)&&z(t.length)&&!!m[w(t)]}var _e=ui;function di(t){return function(e){return t(e)}}var Y=di;var Ee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,nt=Ee&&typeof module=="object"&&module&&!module.nodeType&&module,ci=nt&&nt.exports===Ee,Bt=ci&&ut.process,hi=(function(){try{var t=nt&&nt.require&&nt.require("util").types;return t||Bt&&Bt.binding&&Bt.binding("util")}catch{}})(),I=hi;var Fe=I&&I.isTypedArray,gi=Fe?Y(Fe):_e,Ce=gi;var xi=Object.prototype,yi=xi.hasOwnProperty;function bi(t,e){var r=g(t),o=!r&&W(t),a=!r&&!o&&vt(t),i=!r&&!o&&!a&&Ce(t),n=r||o||a||i,s=n?Pe(t.length,String):[],u=s.length;for(var c in t)(e||yi.call(t,c))&&!(n&&(c=="length"||a&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||U(c,u)))&&s.push(c);return s}var wt=bi;function vi(t,e){return function(r){return t(e(r))}}var Tt=vi;var wi=Tt(Object.keys,Object),Me=wi;var Ti=Object.prototype,Pi=Ti.hasOwnProperty;function ji(t){if(!K(t))return Me(t);var e=[];for(var r in Object(t))Pi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ne=ji;function Oi(t){return bt(t)?wt(t):Ne(t)}var $=Oi;function Ai(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Re=Ai;var Ii=Object.prototype,Si=Ii.hasOwnProperty;function _i(t){if(!T(t))return Re(t);var e=K(t),r=[];for(var o in t)o=="constructor"&&(e||!Si.call(t,o))||r.push(o);return r}var Le=_i;function Ei(t){return bt(t)?wt(t,!0):Le(t)}var H=Ei;var Fi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ci=/^\w*$/;function Mi(t,e){if(g(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 Be=Mi;var Ni=b(Object,"create"),S=Ni;function Ri(){this.__data__=S?S(null):{},this.size=0}var ke=Ri;function Li(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var De=Li;var Bi="__lodash_hash_undefined__",ki=Object.prototype,Di=ki.hasOwnProperty;function Ui(t){var e=this.__data__;if(S){var r=e[t];return r===Bi?void 0:r}return Di.call(e,t)?e[t]:void 0}var Ue=Ui;var Gi=Object.prototype,zi=Gi.hasOwnProperty;function Ki(t){var e=this.__data__;return S?e[t]!==void 0:zi.call(e,t)}var Ge=Ki;var Wi="__lodash_hash_undefined__";function Yi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=S&&e===void 0?Wi:e,this}var ze=Yi;function V(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}V.prototype.clear=ke;V.prototype.delete=De;V.prototype.get=Ue;V.prototype.has=Ge;V.prototype.set=ze;var kt=V;function $i(){this.__data__=[],this.size=0}var Ke=$i;function Hi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var E=Hi;var Vi=Array.prototype,qi=Vi.splice;function Zi(t){var e=this.__data__,r=E(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():qi.call(e,r,1),--this.size,!0}var We=Zi;function Ji(t){var e=this.__data__,r=E(e,t);return r<0?void 0:e[r][1]}var Ye=Ji;function Xi(t){return E(this.__data__,t)>-1}var $e=Xi;function Qi(t,e){var r=this.__data__,o=E(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var He=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=Ke;q.prototype.delete=We;q.prototype.get=Ye;q.prototype.has=$e;q.prototype.set=He;var F=q;var tn=b(d,"Map"),C=tn;function en(){this.size=0,this.__data__={hash:new kt,map:new(C||F),string:new kt}}var Ve=en;function rn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var qe=rn;function on(t,e){var r=t.__data__;return qe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var M=on;function an(t){var e=M(this,t).delete(t);return this.size-=e?1:0,e}var Ze=an;function nn(t){return M(this,t).get(t)}var Je=nn;function sn(t){return M(this,t).has(t)}var Xe=sn;function fn(t,e){var r=M(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Qe=fn;function Z(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])}}Z.prototype.clear=Ve;Z.prototype.delete=Ze;Z.prototype.get=Je;Z.prototype.has=Xe;Z.prototype.set=Qe;var st=Z;var pn="Expected a function";function Dt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(pn);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],i=r.cache;if(i.has(a))return i.get(a);var n=t.apply(this,o);return r.cache=i.set(a,n)||i,n};return r.cache=new(Dt.Cache||st),r}Dt.Cache=st;var tr=Dt;var ln=500;function mn(t){var e=tr(t,function(o){return r.size===ln&&r.clear(),o}),r=e.cache;return e}var er=mn;var un=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dn=/\\(\\)?/g,cn=er(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(un,function(r,o,a,i){e.push(a?i.replace(dn,"$1"):o||r)}),e}),rr=cn;function hn(t){return t==null?"":ne(t)}var or=hn;function gn(t,e){return g(t)?t:Be(t,e)?[t]:rr(or(t))}var P=gn;var xn=1/0;function yn(t){if(typeof t=="string"||k(t))return t;var e=t+"";return e=="0"&&1/t==-xn?"-0":e}var N=yn;function bn(t,e){e=P(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[N(e[r++])];return r&&r==o?t:void 0}var Pt=bn;function vn(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var J=vn;var ar=x?x.isConcatSpreadable:void 0;function wn(t){return g(t)||W(t)||!!(ar&&t&&t[ar])}var ir=wn;function nr(t,e,r,o,a){var i=-1,n=t.length;for(r||(r=ir),a||(a=[]);++i<n;){var s=t[i];e>0&&r(s)?e>1?nr(s,e-1,r,o,a):J(a,s):o||(a[a.length]=s)}return a}var sr=nr;function Tn(t){var e=t==null?0:t.length;return e?sr(t,1):[]}var fr=Tn;function Pn(t){return be(Te(t,void 0,fr),t+"")}var jt=Pn;var jn=Tt(Object.getPrototypeOf,Object),X=jn;var On="[object Object]",An=Function.prototype,In=Object.prototype,pr=An.toString,Sn=In.hasOwnProperty,_n=pr.call(Object);function En(t){if(!y(t)||w(t)!=On)return!1;var e=X(t);if(e===null)return!0;var r=Sn.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&pr.call(r)==_n}var lr=En;function Fn(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(a);++o<a;)i[o]=t[o+e];return i}var mr=Fn;function Cn(){this.__data__=new F,this.size=0}var ur=Cn;function Mn(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var dr=Mn;function Nn(t){return this.__data__.get(t)}var cr=Nn;function Rn(t){return this.__data__.has(t)}var hr=Rn;var Ln=200;function Bn(t,e){var r=this.__data__;if(r instanceof F){var o=r.__data__;if(!C||o.length<Ln-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new st(o)}return r.set(t,e),this.size=r.size,this}var gr=Bn;function Q(t){var e=this.__data__=new F(t);this.size=e.size}Q.prototype.clear=ur;Q.prototype.delete=dr;Q.prototype.get=cr;Q.prototype.has=hr;Q.prototype.set=gr;var xr=Q;function kn(t,e){return t&&O(e,$(e),t)}var yr=kn;function Dn(t,e){return t&&O(e,H(e),t)}var br=Dn;var Pr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vr=Pr&&typeof module=="object"&&module&&!module.nodeType&&module,Un=vr&&vr.exports===Pr,wr=Un?d.Buffer:void 0,Tr=wr?wr.allocUnsafe:void 0;function Gn(t,e){if(e)return t.slice();var r=t.length,o=Tr?Tr(r):new t.constructor(r);return t.copy(o),o}var jr=Gn;function zn(t,e){for(var r=-1,o=t==null?0:t.length,a=0,i=[];++r<o;){var n=t[r];e(n,r,t)&&(i[a++]=n)}return i}var Or=zn;function Kn(){return[]}var Ot=Kn;var Wn=Object.prototype,Yn=Wn.propertyIsEnumerable,Ar=Object.getOwnPropertySymbols,$n=Ar?function(t){return t==null?[]:(t=Object(t),Or(Ar(t),function(e){return Yn.call(t,e)}))}:Ot,tt=$n;function Hn(t,e){return O(t,tt(t),e)}var Ir=Hn;var Vn=Object.getOwnPropertySymbols,qn=Vn?function(t){for(var e=[];t;)J(e,tt(t)),t=X(t);return e}:Ot,At=qn;function Zn(t,e){return O(t,At(t),e)}var Sr=Zn;function Jn(t,e,r){var o=e(t);return g(t)?o:J(o,r(t))}var It=Jn;function Xn(t){return It(t,$,tt)}var _r=Xn;function Qn(t){return It(t,H,At)}var St=Qn;var ts=b(d,"DataView"),_t=ts;var es=b(d,"Promise"),Et=es;var rs=b(d,"Set"),Ft=rs;var Er="[object Map]",os="[object Object]",Fr="[object Promise]",Cr="[object Set]",Mr="[object WeakMap]",Nr="[object DataView]",as=A(_t),is=A(C),ns=A(Et),ss=A(Ft),fs=A(gt),L=w;(_t&&L(new _t(new ArrayBuffer(1)))!=Nr||C&&L(new C)!=Er||Et&&L(Et.resolve())!=Fr||Ft&&L(new Ft)!=Cr||gt&&L(new gt)!=Mr)&&(L=function(t){var e=w(t),r=e==os?t.constructor:void 0,o=r?A(r):"";if(o)switch(o){case as:return Nr;case is:return Er;case ns:return Fr;case ss:return Cr;case fs:return Mr}return e});var et=L;var ps=Object.prototype,ls=ps.hasOwnProperty;function ms(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&ls.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Rr=ms;var us=d.Uint8Array,Ut=us;function ds(t){var e=new t.constructor(t.byteLength);return new Ut(e).set(new Ut(t)),e}var rt=ds;function cs(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Lr=cs;var hs=/\w*$/;function gs(t){var e=new t.constructor(t.source,hs.exec(t));return e.lastIndex=t.lastIndex,e}var Br=gs;var kr=x?x.prototype:void 0,Dr=kr?kr.valueOf:void 0;function xs(t){return Dr?Object(Dr.call(t)):{}}var Ur=xs;function ys(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Gr=ys;var bs="[object Boolean]",vs="[object Date]",ws="[object Map]",Ts="[object Number]",Ps="[object RegExp]",js="[object Set]",Os="[object String]",As="[object Symbol]",Is="[object ArrayBuffer]",Ss="[object DataView]",_s="[object Float32Array]",Es="[object Float64Array]",Fs="[object Int8Array]",Cs="[object Int16Array]",Ms="[object Int32Array]",Ns="[object Uint8Array]",Rs="[object Uint8ClampedArray]",Ls="[object Uint16Array]",Bs="[object Uint32Array]";function ks(t,e,r){var o=t.constructor;switch(e){case Is:return rt(t);case bs:case vs:return new o(+t);case Ss:return Lr(t,r);case _s:case Es:case Fs:case Cs:case Ms:case Ns:case Rs:case Ls:case Bs:return Gr(t,r);case ws:return new o;case Ts:case Os:return new o(t);case Ps:return Br(t);case js:return new o;case As:return Ur(t)}}var zr=ks;function Ds(t){return typeof t.constructor=="function"&&!K(t)?de(X(t)):{}}var Kr=Ds;var Us="[object Map]";function Gs(t){return y(t)&&et(t)==Us}var Wr=Gs;var Yr=I&&I.isMap,zs=Yr?Y(Yr):Wr,$r=zs;var Ks="[object Set]";function Ws(t){return y(t)&&et(t)==Ks}var Hr=Ws;var Vr=I&&I.isSet,Ys=Vr?Y(Vr):Hr,qr=Ys;var $s=1,Hs=2,Vs=4,Zr="[object Arguments]",qs="[object Array]",Zs="[object Boolean]",Js="[object Date]",Xs="[object Error]",Jr="[object Function]",Qs="[object GeneratorFunction]",tf="[object Map]",ef="[object Number]",Xr="[object Object]",rf="[object RegExp]",of="[object Set]",af="[object String]",nf="[object Symbol]",sf="[object WeakMap]",ff="[object ArrayBuffer]",pf="[object DataView]",lf="[object Float32Array]",mf="[object Float64Array]",uf="[object Int8Array]",df="[object Int16Array]",cf="[object Int32Array]",hf="[object Uint8Array]",gf="[object Uint8ClampedArray]",xf="[object Uint16Array]",yf="[object Uint32Array]",l={};l[Zr]=l[qs]=l[ff]=l[pf]=l[Zs]=l[Js]=l[lf]=l[mf]=l[uf]=l[df]=l[cf]=l[tf]=l[ef]=l[Xr]=l[rf]=l[of]=l[af]=l[nf]=l[hf]=l[gf]=l[xf]=l[yf]=!0;l[Xs]=l[Jr]=l[sf]=!1;function Ct(t,e,r,o,a,i){var n,s=e&$s,u=e&Hs,c=e&Vs;if(r&&(n=a?r(t,o,a,i):r(t)),n!==void 0)return n;if(!T(t))return t;var h=g(t);if(h){if(n=Rr(t),!s)return he(t,n)}else{var j=et(t),ft=j==Jr||j==Qs;if(vt(t))return jr(t,s);if(j==Xr||j==Zr||ft&&!a){if(n=u||ft?{}:Kr(t),!s)return u?Sr(t,br(n,t)):Ir(t,yr(n,t))}else{if(!l[j])return a?t:{};n=zr(t,j,s)}}i||(i=new xr);var ot=i.get(t);if(ot)return ot;i.set(t,n),qr(t)?t.forEach(function(v){n.add(Ct(v,e,r,v,t,i))}):$r(t)&&t.forEach(function(v,f){n.set(f,Ct(v,e,r,f,t,i))});var pt=c?u?St:_r:u?H:$,lt=h?void 0:pt(t);return ve(lt||t,function(v,f){lt&&(f=v,v=t[f]),G(n,f,Ct(v,e,r,f,t,i))}),n}var Mt=Ct;var bf=1,vf=4;function wf(t){return Mt(t,bf|vf)}var Gt=wf;function Tf(t,e){return t!=null&&e in Object(t)}var Qr=Tf;function Pf(t,e,r){e=P(e,t);for(var o=-1,a=e.length,i=!1;++o<a;){var n=N(e[o]);if(!(i=t!=null&&r(t,n)))break;t=t[n]}return i||++o!=a?i:(a=t==null?0:t.length,!!a&&z(a)&&U(n,a)&&(g(t)||W(t)))}var to=Pf;function jf(t,e){return t!=null&&to(t,e,Qr)}var eo=jf;function Of(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var ro=Of;function Af(t,e){return e.length<2?t:Pt(t,mr(e,0,-1))}var oo=Af;var If=Object.prototype,Sf=If.hasOwnProperty;function _f(t,e){e=P(e,t);var r=-1,o=e.length;if(!o)return!0;for(var a=t==null||typeof t!="object"&&typeof t!="function";++r<o;){var i=e[r];if(typeof i=="string"){if(i==="__proto__"&&!Sf.call(t,"__proto__"))return!1;if(i==="constructor"&&r+1<o&&typeof e[r+1]=="string"&&e[r+1]==="prototype"){if(a&&r===0)continue;return!1}}}var n=oo(t,e);return n==null||delete n[N(ro(e))]}var ao=_f;function Ef(t){return lr(t)?void 0:t}var io=Ef;var Ff=1,Cf=2,Mf=4,Nf=jt(function(t,e){var r={};if(t==null)return r;var o=!1;e=dt(e,function(i){return i=P(i,t),o||(o=i.length>1),i}),O(t,St(t),r),o&&(r=Mt(r,Ff|Cf|Mf,io));for(var a=e.length;a--;)ao(r,e[a]);return r}),zt=Nf;function Rf(t,e,r,o){if(!T(t))return t;e=P(e,t);for(var a=-1,i=e.length,n=i-1,s=t;s!=null&&++a<i;){var u=N(e[a]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(a!=n){var h=s[u];c=o?o(h,u,s):void 0,c===void 0&&(c=T(h)?h:U(e[a+1])?[]:{})}G(s,u,c),s=s[u]}return t}var no=Rf;function Lf(t,e,r){for(var o=-1,a=e.length,i={};++o<a;){var n=e[o],s=Pt(t,n);r(s,n)&&no(i,P(n,t),s)}return i}var so=Lf;function Bf(t,e){return so(t,e,function(r,o){return eo(t,o)})}var fo=Bf;var kf=jt(function(t,e){return t==null?{}:fo(t,e)}),Nt=kf;function po(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 lo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Kt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=lo[r[t]&63];return e};var Df="array";var mo="bits",Uf="byte",uo="bytes";var Gf="exponent",zf="function";var Kf="Invalid number",Wf="Invalid rounding method",Wt="jedec",Yf="object";var $f="round";var Hf="kbit";var Vf="string";var Yt={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 co(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:i="",localeOptions:n={},separator:s="",spacer:u=" ",symbols:c={},standard:h="",output:j=Vf,fullform:ft=!1,fullforms:ot=[],exponent:pt=-1,roundingMethod:lt=$f,precision:v=0}={}){let f=pt,B=Number(t),p=[],R=0,Rt="";h==="si"?(o=10,h=Wt):h==="iec"||h===Wt?o=2:o===2?h="iec":(o=10,h=Wt);let mt=o===10?1e3:1024,ho=ft===!0,Ht=B<0,Vt=Math[lt];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Kf);if(typeof Vt!==zf)throw new TypeError(Wf);if(Ht&&(B=-B),(f===-1||isNaN(f))&&(f=Math.floor(Math.log(B)/Math.log(mt)),f<0&&(f=0)),f>8&&(v>0&&(v+=8-f),f=8),j===Gf)return f;if(B===0)p[0]=0,Rt=p[1]=Yt.symbol[h][e?mo:uo][f];else{R=B/(o===2?Math.pow(2,f*10):Math.pow(1e3,f)),e&&(R=R*8,R>=mt&&f<8&&(R=R/mt,f++));let at=Math.pow(10,f>0?a:0);p[0]=Vt(R*at)/at,p[0]===mt&&f<8&&pt===-1&&(p[0]=1,f++),Rt=p[1]=o===10&&f===1?e?Hf:"kB":Yt.symbol[h][e?mo:uo][f]}if(Ht&&(p[0]=-p[0]),v>0&&(p[0]=p[0].toPrecision(v)),p[1]=c[p[1]]||p[1],i===!0?p[0]=p[0].toLocaleString():i.length>0?p[0]=p[0].toLocaleString(i,n):s.length>0&&(p[0]=p[0].toString().replace(".",s)),r&&a>0){let at=p[0].toString(),qt=s||(at.match(/(\D)/g)||[]).pop()||".",Zt=at.toString().split(qt),Jt=Zt[1]||"",Xt=Jt.length,go=a-Xt;p[0]=`${Zt[0]}${qt}${Jt.padEnd(Xt+go,"0")}`}return ho&&(p[1]=ot[f]?ot[f]:Yt.fullform[h][f]+(e?"bit":Uf)+(p[0]===1?"":"s")),j===Df?p:j===Yf?{value:p[0],symbol:p[1],exponent:f,unit:Rt}:p.join(u)}var _=class t{constructor(e){this.meta={};var o;if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,zt(e,"encodeIdFunction")),e.encodeIdFunction&&typeof e.encodeIdFunction=="function"&&(this.id=e.encodeIdFunction(this.id));let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.created&&typeof this.created=="string"&&(this.created=new Date(this.created)),this.modified&&typeof this.modified=="string"&&(this.modified=new Date(this.modified)),this.accessed&&typeof this.accessed=="string"&&(this.accessed=new Date(this.accessed)),this.isFolder&&(this.files=(o=this.files)==null?void 0:o.map(a=>{let i=a.path.split(/\//).slice(3).join("/"),n=this.url+"/"+a.name;return a.meta.reflib&&(n=n.replace(/\/project\/download\//,"/project/library/")),new t({tera:this._tera,...a,sbId:a.id,id:a.path,encodeIdFunction:e.encodeIdFunction,path:i,url:n})})),this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=co(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 Nt(this,["id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){let r=Nt(e,["tera","id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]);return new t(r)}};var $t=class{constructor(e){this.settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};this.events=po();this.dom={el:null,iframe:null,popup:null,stylesheet:null};this.methods=["handshake","setServerVerbosity","getUser","requireUser","getCredentials","getKindeToken","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getNamespace","setNamespace","listNamespaces","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateRefresh","getProjectFileContents","deleteProjectFile","setProjectFileContents","createProjectFolder","deleteProjectFolder","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiJson","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];this.plugins=[];this.namespaces={};this.acceptPostboxes={};this.initPromise=null;e&&this.set(e)}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(),...Gt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Received message",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):(r==null?void 0:r.action)=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):(r==null?void 0:r.action)=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r!=null&&r.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}mountNamespace(e){if(!/^[\w-]+$/.test(e))throw new Error("Namespaces must be alphanumeric + hyphens + underscores");return this.namespaces[e]?Promise.resolve(this.namespaces[e]):Promise.resolve().then(()=>this._mountNamespace(e)).then(()=>this.namespaces[e]||Promise.reject(`teraFy.mountNamespace('${e}') resolved but no namespace has been mounted`))}_mountNamespace(e){throw console.warn(`teraFy._mountNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`),new Error("teraFy._mountNamespace() is not supported")}unmountNamespace(e){return this.namespaces[e]?this._unmountNamespace(e):Promise.resolve()}_unmountNamespace(e){console.warn(`teraFy.unbindNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`)}init(e){if(e&&this.set(e),this.initPromise)return this.initPromise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.initPromise=Promise.resolve().then(()=>{var o;return(o=this.settings).session||(o.session="tfy-"+this.getEntropicString(16))}).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths?this.settings.debugPaths=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")})()):this.settings.debugPaths=null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw new Error(`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"),r)).catch(o=>{throw this.debug("WARN",0,"Init process fault",o),o}),this.initPromise}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("TIMEOUT"),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e()).catch(r)})).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,"Embedded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let i=0,n,s=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),u=()=>{this.debug("INFO",4,"Trying handshake",++i),clearTimeout(n),n=setTimeout(u,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(s),clearTimeout(n)}).then(()=>o()).catch(a)};u()})}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.append(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){return this.methods.forEach(e=>this[e]=this.rpc.bind(this,e)),Promise.resolve()}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initializer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){let o=[],a=r;do o.unshift(a);while(a=Object.getPrototypeOf(a));o.forEach(i=>Object.getOwnPropertyNames(i).filter(n=>!["constructor","init","prototype","name"].includes(n)&&!n.startsWith("__")).forEach(n=>{typeof r[n]=="function"?Object.defineProperty(e,n,{enumerable:!1,value:r[n].bind(e)}):e[n]=r[n]}))}toggleDevMode(e="toggle"){var r;return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),(r=this.dom)!=null&&r.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCodePoint(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(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,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new _({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new _({tera:this,...r}))}moveProjectFile(e,r,o){return this.rpc("moveProjectFile",e,r,o).then(a=>a?new _({tera:this,...a}):null)}};export{$t as default};
1
+ var Oo=typeof global=="object"&&global&&global.Object===Object&&global,mt=Oo;var jo=typeof self=="object"&&self&&self.Object===Object&&self,Ao=mt||jo||Function("return this")(),c=Ao;var So=c.Symbol,x=So;var Qt=Object.prototype,Io=Qt.hasOwnProperty,_o=Qt.toString,at=x?x.toStringTag:void 0;function Eo(t){var e=Io.call(t,at),r=t[at];try{t[at]=void 0;var o=!0}catch{}var a=_o.call(t);return o&&(e?t[at]=r:delete t[at]),a}var te=Eo;var Fo=Object.prototype,Co=Fo.toString;function Mo(t){return Co.call(t)}var ee=Mo;var No="[object Null]",Ro="[object Undefined]",re=x?x.toStringTag:void 0;function Lo(t){return t==null?t===void 0?Ro:No:re&&re in Object(t)?te(t):ee(t)}var w=Lo;function Bo(t){return t!=null&&typeof t=="object"}var v=Bo;var Do="[object Symbol]";function ko(t){return typeof t=="symbol"||v(t)&&w(t)==Do}var D=ko;function Uo(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 ut=Uo;var Go=Array.isArray,g=Go;var zo=1/0,oe=x?x.prototype:void 0,ae=oe?oe.toString:void 0;function ie(t){if(typeof t=="string")return t;if(g(t))return ut(t,ie)+"";if(D(t))return ae?ae.call(t):"";var e=t+"";return e=="0"&&1/t==-zo?"-0":e}var ne=ie;function Ko(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var P=Ko;function Wo(t){return t}var se=Wo;var Yo="[object AsyncFunction]",$o="[object Function]",Ho="[object GeneratorFunction]",Vo="[object Proxy]";function qo(t){if(!P(t))return!1;var e=w(t);return e==$o||e==Ho||e==Yo||e==Vo}var dt=qo;var Zo=c["__core-js_shared__"],ct=Zo;var fe=(function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Jo(t){return!!fe&&fe in t}var pe=Jo;var Xo=Function.prototype,Qo=Xo.toString;function ta(t){if(t!=null){try{return Qo.call(t)}catch{}try{return t+""}catch{}}return""}var A=ta;var ea=/[\\^$.*+?()[\]{}|]/g,ra=/^\[object .+?Constructor\]$/,oa=Function.prototype,aa=Object.prototype,ia=oa.toString,na=aa.hasOwnProperty,sa=RegExp("^"+ia.call(na).replace(ea,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fa(t){if(!P(t)||pe(t))return!1;var e=dt(t)?sa:ra;return e.test(A(t))}var le=fa;function pa(t,e){return t==null?void 0:t[e]}var me=pa;function la(t,e){var r=me(t,e);return le(r)?r:void 0}var T=la;var ma=T(c,"WeakMap"),ht=ma;var ue=Object.create,ua=(function(){function t(){}return function(e){if(!P(e))return{};if(ue)return ue(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),de=ua;function da(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 ce=da;function ca(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var he=ca;var ha=800,ga=16,xa=Date.now;function ya(t){var e=0,r=0;return function(){var o=xa(),a=ga-(o-r);if(r=o,a>0){if(++e>=ha)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ge=ya;function ba(t){return function(){return t}}var xe=ba;var va=(function(){try{var t=T(Object,"defineProperty");return t({},"",{}),t}catch{}})(),k=va;var Ta=k?function(t,e){return k(t,"toString",{configurable:!0,enumerable:!1,value:xe(e),writable:!0})}:se,ye=Ta;var wa=ge(ye),be=wa;function Pa(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ve=Pa;var Oa=9007199254740991,ja=/^(?:0|[1-9]\d*)$/;function Aa(t,e){var r=typeof t;return e=e==null?Oa:e,!!e&&(r=="number"||r!="symbol"&&ja.test(t))&&t>-1&&t%1==0&&t<e}var U=Aa;function Sa(t,e,r){e=="__proto__"&&k?k(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=Sa;function Ia(t,e){return t===e||t!==t&&e!==e}var xt=Ia;var _a=Object.prototype,Ea=_a.hasOwnProperty;function Fa(t,e,r){var o=t[e];(!(Ea.call(t,e)&&xt(o,r))||r===void 0&&!(e in t))&&gt(t,e,r)}var G=Fa;function Ca(t,e,r,o){var a=!r;r||(r={});for(var n=-1,i=e.length;++n<i;){var s=e[n],f=o?o(r[s],t[s],s,r,t):void 0;f===void 0&&(f=t[s]),a?gt(r,s,f):G(r,s,f)}return r}var j=Ca;var Te=Math.max;function Ma(t,e,r){return e=Te(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,n=Te(o.length-e,0),i=Array(n);++a<n;)i[a]=o[e+a];a=-1;for(var s=Array(e+1);++a<e;)s[a]=o[a];return s[e]=r(i),ce(t,this,s)}}var we=Ma;var Na=9007199254740991;function Ra(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Na}var z=Ra;function La(t){return t!=null&&z(t.length)&&!dt(t)}var yt=La;var Ba=Object.prototype;function Da(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ba;return t===r}var K=Da;function ka(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Pe=ka;var Ua="[object Arguments]";function Ga(t){return v(t)&&w(t)==Ua}var Ut=Ga;var Oe=Object.prototype,za=Oe.hasOwnProperty,Ka=Oe.propertyIsEnumerable,Wa=Ut((function(){return arguments})())?Ut:function(t){return v(t)&&za.call(t,"callee")&&!Ka.call(t,"callee")},W=Wa;function Ya(){return!1}var je=Ya;var Ie=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ae=Ie&&typeof module=="object"&&module&&!module.nodeType&&module,$a=Ae&&Ae.exports===Ie,Se=$a?c.Buffer:void 0,Ha=Se?Se.isBuffer:void 0,Va=Ha||je,bt=Va;var qa="[object Arguments]",Za="[object Array]",Ja="[object Boolean]",Xa="[object Date]",Qa="[object Error]",ti="[object Function]",ei="[object Map]",ri="[object Number]",oi="[object Object]",ai="[object RegExp]",ii="[object Set]",ni="[object String]",si="[object WeakMap]",fi="[object ArrayBuffer]",pi="[object DataView]",li="[object Float32Array]",mi="[object Float64Array]",ui="[object Int8Array]",di="[object Int16Array]",ci="[object Int32Array]",hi="[object Uint8Array]",gi="[object Uint8ClampedArray]",xi="[object Uint16Array]",yi="[object Uint32Array]",u={};u[li]=u[mi]=u[ui]=u[di]=u[ci]=u[hi]=u[gi]=u[xi]=u[yi]=!0;u[qa]=u[Za]=u[fi]=u[Ja]=u[pi]=u[Xa]=u[Qa]=u[ti]=u[ei]=u[ri]=u[oi]=u[ai]=u[ii]=u[ni]=u[si]=!1;function bi(t){return v(t)&&z(t.length)&&!!u[w(t)]}var _e=bi;function vi(t){return function(e){return t(e)}}var Y=vi;var Ee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,it=Ee&&typeof module=="object"&&module&&!module.nodeType&&module,Ti=it&&it.exports===Ee,Gt=Ti&&mt.process,wi=(function(){try{var t=it&&it.require&&it.require("util").types;return t||Gt&&Gt.binding&&Gt.binding("util")}catch{}})(),S=wi;var Fe=S&&S.isTypedArray,Pi=Fe?Y(Fe):_e,Ce=Pi;var Oi=Object.prototype,ji=Oi.hasOwnProperty;function Ai(t,e){var r=g(t),o=!r&&W(t),a=!r&&!o&&bt(t),n=!r&&!o&&!a&&Ce(t),i=r||o||a||n,s=i?Pe(t.length,String):[],f=s.length;for(var p in t)(e||ji.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||n&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||U(p,f)))&&s.push(p);return s}var vt=Ai;function Si(t,e){return function(r){return t(e(r))}}var Tt=Si;var Ii=Tt(Object.keys,Object),Me=Ii;var _i=Object.prototype,Ei=_i.hasOwnProperty;function Fi(t){if(!K(t))return Me(t);var e=[];for(var r in Object(t))Ei.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ne=Fi;function Ci(t){return yt(t)?vt(t):Ne(t)}var $=Ci;function Mi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Re=Mi;var Ni=Object.prototype,Ri=Ni.hasOwnProperty;function Li(t){if(!P(t))return Re(t);var e=K(t),r=[];for(var o in t)o=="constructor"&&(e||!Ri.call(t,o))||r.push(o);return r}var Le=Li;function Bi(t){return yt(t)?vt(t,!0):Le(t)}var H=Bi;var Di=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ki=/^\w*$/;function Ui(t,e){if(g(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||D(t)?!0:ki.test(t)||!Di.test(t)||e!=null&&t in Object(e)}var Be=Ui;var Gi=T(Object,"create"),I=Gi;function zi(){this.__data__=I?I(null):{},this.size=0}var De=zi;function Ki(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ke=Ki;var Wi="__lodash_hash_undefined__",Yi=Object.prototype,$i=Yi.hasOwnProperty;function Hi(t){var e=this.__data__;if(I){var r=e[t];return r===Wi?void 0:r}return $i.call(e,t)?e[t]:void 0}var Ue=Hi;var Vi=Object.prototype,qi=Vi.hasOwnProperty;function Zi(t){var e=this.__data__;return I?e[t]!==void 0:qi.call(e,t)}var Ge=Zi;var Ji="__lodash_hash_undefined__";function Xi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=I&&e===void 0?Ji:e,this}var ze=Xi;function V(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}V.prototype.clear=De;V.prototype.delete=ke;V.prototype.get=Ue;V.prototype.has=Ge;V.prototype.set=ze;var zt=V;function Qi(){this.__data__=[],this.size=0}var Ke=Qi;function tn(t,e){for(var r=t.length;r--;)if(xt(t[r][0],e))return r;return-1}var F=tn;var en=Array.prototype,rn=en.splice;function on(t){var e=this.__data__,r=F(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():rn.call(e,r,1),--this.size,!0}var We=on;function an(t){var e=this.__data__,r=F(e,t);return r<0?void 0:e[r][1]}var Ye=an;function nn(t){return F(this.__data__,t)>-1}var $e=nn;function sn(t,e){var r=this.__data__,o=F(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var He=sn;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=Ke;q.prototype.delete=We;q.prototype.get=Ye;q.prototype.has=$e;q.prototype.set=He;var C=q;var fn=T(c,"Map"),M=fn;function pn(){this.size=0,this.__data__={hash:new zt,map:new(M||C),string:new zt}}var Ve=pn;function ln(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var qe=ln;function mn(t,e){var r=t.__data__;return qe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var N=mn;function un(t){var e=N(this,t).delete(t);return this.size-=e?1:0,e}var Ze=un;function dn(t){return N(this,t).get(t)}var Je=dn;function cn(t){return N(this,t).has(t)}var Xe=cn;function hn(t,e){var r=N(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Qe=hn;function Z(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])}}Z.prototype.clear=Ve;Z.prototype.delete=Ze;Z.prototype.get=Je;Z.prototype.has=Xe;Z.prototype.set=Qe;var nt=Z;var gn="Expected a function";function Kt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(gn);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 i=t.apply(this,o);return r.cache=n.set(a,i)||n,i};return r.cache=new(Kt.Cache||nt),r}Kt.Cache=nt;var tr=Kt;var xn=500;function yn(t){var e=tr(t,function(o){return r.size===xn&&r.clear(),o}),r=e.cache;return e}var er=yn;var bn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vn=/\\(\\)?/g,Tn=er(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(bn,function(r,o,a,n){e.push(a?n.replace(vn,"$1"):o||r)}),e}),rr=Tn;function wn(t){return t==null?"":ne(t)}var or=wn;function Pn(t,e){return g(t)?t:Be(t,e)?[t]:rr(or(t))}var O=Pn;var On=1/0;function jn(t){if(typeof t=="string"||D(t))return t;var e=t+"";return e=="0"&&1/t==-On?"-0":e}var R=jn;function An(t,e){e=O(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[R(e[r++])];return r&&r==o?t:void 0}var wt=An;function Sn(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var J=Sn;var ar=x?x.isConcatSpreadable:void 0;function In(t){return g(t)||W(t)||!!(ar&&t&&t[ar])}var ir=In;function nr(t,e,r,o,a){var n=-1,i=t.length;for(r||(r=ir),a||(a=[]);++n<i;){var s=t[n];e>0&&r(s)?e>1?nr(s,e-1,r,o,a):J(a,s):o||(a[a.length]=s)}return a}var sr=nr;function _n(t){var e=t==null?0:t.length;return e?sr(t,1):[]}var fr=_n;function En(t){return be(we(t,void 0,fr),t+"")}var Pt=En;var Fn=Tt(Object.getPrototypeOf,Object),X=Fn;var Cn="[object Object]",Mn=Function.prototype,Nn=Object.prototype,pr=Mn.toString,Rn=Nn.hasOwnProperty,Ln=pr.call(Object);function Bn(t){if(!v(t)||w(t)!=Cn)return!1;var e=X(t);if(e===null)return!0;var r=Rn.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&pr.call(r)==Ln}var lr=Bn;function Dn(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var n=Array(a);++o<a;)n[o]=t[o+e];return n}var mr=Dn;function kn(){this.__data__=new C,this.size=0}var ur=kn;function Un(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var dr=Un;function Gn(t){return this.__data__.get(t)}var cr=Gn;function zn(t){return this.__data__.has(t)}var hr=zn;var Kn=200;function Wn(t,e){var r=this.__data__;if(r instanceof C){var o=r.__data__;if(!M||o.length<Kn-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new nt(o)}return r.set(t,e),this.size=r.size,this}var gr=Wn;function Q(t){var e=this.__data__=new C(t);this.size=e.size}Q.prototype.clear=ur;Q.prototype.delete=dr;Q.prototype.get=cr;Q.prototype.has=hr;Q.prototype.set=gr;var xr=Q;function Yn(t,e){return t&&j(e,$(e),t)}var yr=Yn;function $n(t,e){return t&&j(e,H(e),t)}var br=$n;var Pr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vr=Pr&&typeof module=="object"&&module&&!module.nodeType&&module,Hn=vr&&vr.exports===Pr,Tr=Hn?c.Buffer:void 0,wr=Tr?Tr.allocUnsafe:void 0;function Vn(t,e){if(e)return t.slice();var r=t.length,o=wr?wr(r):new t.constructor(r);return t.copy(o),o}var Or=Vn;function qn(t,e){for(var r=-1,o=t==null?0:t.length,a=0,n=[];++r<o;){var i=t[r];e(i,r,t)&&(n[a++]=i)}return n}var jr=qn;function Zn(){return[]}var Ot=Zn;var Jn=Object.prototype,Xn=Jn.propertyIsEnumerable,Ar=Object.getOwnPropertySymbols,Qn=Ar?function(t){return t==null?[]:(t=Object(t),jr(Ar(t),function(e){return Xn.call(t,e)}))}:Ot,tt=Qn;function ts(t,e){return j(t,tt(t),e)}var Sr=ts;var es=Object.getOwnPropertySymbols,rs=es?function(t){for(var e=[];t;)J(e,tt(t)),t=X(t);return e}:Ot,jt=rs;function os(t,e){return j(t,jt(t),e)}var Ir=os;function as(t,e,r){var o=e(t);return g(t)?o:J(o,r(t))}var At=as;function is(t){return At(t,$,tt)}var _r=is;function ns(t){return At(t,H,jt)}var St=ns;var ss=T(c,"DataView"),It=ss;var fs=T(c,"Promise"),_t=fs;var ps=T(c,"Set"),Et=ps;var Er="[object Map]",ls="[object Object]",Fr="[object Promise]",Cr="[object Set]",Mr="[object WeakMap]",Nr="[object DataView]",ms=A(It),us=A(M),ds=A(_t),cs=A(Et),hs=A(ht),L=w;(It&&L(new It(new ArrayBuffer(1)))!=Nr||M&&L(new M)!=Er||_t&&L(_t.resolve())!=Fr||Et&&L(new Et)!=Cr||ht&&L(new ht)!=Mr)&&(L=function(t){var e=w(t),r=e==ls?t.constructor:void 0,o=r?A(r):"";if(o)switch(o){case ms:return Nr;case us:return Er;case ds:return Fr;case cs:return Cr;case hs:return Mr}return e});var et=L;var gs=Object.prototype,xs=gs.hasOwnProperty;function ys(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&xs.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Rr=ys;var bs=c.Uint8Array,Wt=bs;function vs(t){var e=new t.constructor(t.byteLength);return new Wt(e).set(new Wt(t)),e}var rt=vs;function Ts(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Lr=Ts;var ws=/\w*$/;function Ps(t){var e=new t.constructor(t.source,ws.exec(t));return e.lastIndex=t.lastIndex,e}var Br=Ps;var Dr=x?x.prototype:void 0,kr=Dr?Dr.valueOf:void 0;function Os(t){return kr?Object(kr.call(t)):{}}var Ur=Os;function js(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Gr=js;var As="[object Boolean]",Ss="[object Date]",Is="[object Map]",_s="[object Number]",Es="[object RegExp]",Fs="[object Set]",Cs="[object String]",Ms="[object Symbol]",Ns="[object ArrayBuffer]",Rs="[object DataView]",Ls="[object Float32Array]",Bs="[object Float64Array]",Ds="[object Int8Array]",ks="[object Int16Array]",Us="[object Int32Array]",Gs="[object Uint8Array]",zs="[object Uint8ClampedArray]",Ks="[object Uint16Array]",Ws="[object Uint32Array]";function Ys(t,e,r){var o=t.constructor;switch(e){case Ns:return rt(t);case As:case Ss:return new o(+t);case Rs:return Lr(t,r);case Ls:case Bs:case Ds:case ks:case Us:case Gs:case zs:case Ks:case Ws:return Gr(t,r);case Is:return new o;case _s:case Cs:return new o(t);case Es:return Br(t);case Fs:return new o;case Ms:return Ur(t)}}var zr=Ys;function $s(t){return typeof t.constructor=="function"&&!K(t)?de(X(t)):{}}var Kr=$s;var Hs="[object Map]";function Vs(t){return v(t)&&et(t)==Hs}var Wr=Vs;var Yr=S&&S.isMap,qs=Yr?Y(Yr):Wr,$r=qs;var Zs="[object Set]";function Js(t){return v(t)&&et(t)==Zs}var Hr=Js;var Vr=S&&S.isSet,Xs=Vr?Y(Vr):Hr,qr=Xs;var Qs=1,tf=2,ef=4,Zr="[object Arguments]",rf="[object Array]",of="[object Boolean]",af="[object Date]",nf="[object Error]",Jr="[object Function]",sf="[object GeneratorFunction]",ff="[object Map]",pf="[object Number]",Xr="[object Object]",lf="[object RegExp]",mf="[object Set]",uf="[object String]",df="[object Symbol]",cf="[object WeakMap]",hf="[object ArrayBuffer]",gf="[object DataView]",xf="[object Float32Array]",yf="[object Float64Array]",bf="[object Int8Array]",vf="[object Int16Array]",Tf="[object Int32Array]",wf="[object Uint8Array]",Pf="[object Uint8ClampedArray]",Of="[object Uint16Array]",jf="[object Uint32Array]",m={};m[Zr]=m[rf]=m[hf]=m[gf]=m[of]=m[af]=m[xf]=m[yf]=m[bf]=m[vf]=m[Tf]=m[ff]=m[pf]=m[Xr]=m[lf]=m[mf]=m[uf]=m[df]=m[wf]=m[Pf]=m[Of]=m[jf]=!0;m[nf]=m[Jr]=m[cf]=!1;function Ft(t,e,r,o,a,n){var i,s=e&Qs,f=e&tf,p=e&ef;if(r&&(i=a?r(t,o,a,n):r(t)),i!==void 0)return i;if(!P(t))return t;var y=g(t);if(y){if(i=Rr(t),!s)return he(t,i)}else{var h=et(t),B=h==Jr||h==sf;if(bt(t))return Or(t,s);if(h==Xr||h==Zr||B&&!a){if(i=f||B?{}:Kr(t),!s)return f?Ir(t,br(i,t)):Sr(t,yr(i,t))}else{if(!m[h])return a?t:{};i=zr(t,h,s)}}n||(n=new xr);var ot=n.get(t);if(ot)return ot;n.set(t,i),qr(t)?t.forEach(function(b){i.add(Ft(b,e,r,b,t,n))}):$r(t)&&t.forEach(function(b,l){i.set(l,Ft(b,e,r,l,t,n))});var st=p?f?St:_r:f?H:$,ft=y?void 0:st(t);return ve(ft||t,function(b,l){ft&&(l=b,b=t[l]),G(i,l,Ft(b,e,r,l,t,n))}),i}var Ct=Ft;var Af=1,Sf=4;function If(t){return Ct(t,Af|Sf)}var Yt=If;function _f(t,e){return t!=null&&e in Object(t)}var Qr=_f;function Ef(t,e,r){e=O(e,t);for(var o=-1,a=e.length,n=!1;++o<a;){var i=R(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}return n||++o!=a?n:(a=t==null?0:t.length,!!a&&z(a)&&U(i,a)&&(g(t)||W(t)))}var to=Ef;function Ff(t,e){return t!=null&&to(t,e,Qr)}var eo=Ff;function Cf(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var ro=Cf;function Mf(t,e){return e.length<2?t:wt(t,mr(e,0,-1))}var oo=Mf;var Nf=Object.prototype,Rf=Nf.hasOwnProperty;function Lf(t,e){e=O(e,t);var r=-1,o=e.length;if(!o)return!0;for(var a=t==null||typeof t!="object"&&typeof t!="function";++r<o;){var n=e[r];if(typeof n=="string"){if(n==="__proto__"&&!Rf.call(t,"__proto__"))return!1;if(n==="constructor"&&r+1<o&&typeof e[r+1]=="string"&&e[r+1]==="prototype"){if(a&&r===0)continue;return!1}}}var i=oo(t,e);return i==null||delete i[R(ro(e))]}var ao=Lf;function Bf(t){return lr(t)?void 0:t}var io=Bf;var Df=1,kf=2,Uf=4,Gf=Pt(function(t,e){var r={};if(t==null)return r;var o=!1;e=ut(e,function(n){return n=O(n,t),o||(o=n.length>1),n}),j(t,St(t),r),o&&(r=Ct(r,Df|kf|Uf,io));for(var a=e.length;a--;)ao(r,e[a]);return r}),$t=Gf;function zf(t,e,r,o){if(!P(t))return t;e=O(e,t);for(var a=-1,n=e.length,i=n-1,s=t;s!=null&&++a<n;){var f=R(e[a]),p=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=i){var y=s[f];p=o?o(y,f,s):void 0,p===void 0&&(p=P(y)?y:U(e[a+1])?[]:{})}G(s,f,p),s=s[f]}return t}var no=zf;function Kf(t,e,r){for(var o=-1,a=e.length,n={};++o<a;){var i=e[o],s=wt(t,i);r(s,i)&&no(n,O(i,t),s)}return n}var so=Kf;function Wf(t,e){return so(t,e,function(r,o){return eo(t,o)})}var fo=Wf;var Yf=Pt(function(t,e){return t==null?{}:fo(t,e)}),Mt=Yf;function po(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 lo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ht=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=lo[r[t]&63];return e};var $f="Invalid number",Hf="Invalid rounding method";var Nt="jedec";var uo="bits",co="byte",ho="bytes",Vf="kbit";var go="array",qf="function",xo="object",Zf="string",yo="exponent",Jf="round";var Rt={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"]}},Xf=[1,1024,1048576,1073741824,1099511627776,0x4000000000000,1152921504606847e3,11805916207174113e5,12089258196146292e8],Qf=[1,1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24],tp=Math.log(1024),ep=Math.log(1e3),mo={si:{isDecimal:!0,ceil:1e3,actualStandard:Nt},iec:{isDecimal:!1,ceil:1024,actualStandard:"iec"},[Nt]:{isDecimal:!1,ceil:1024,actualStandard:Nt}};function rp(t,e){return mo[t]?mo[t]:e===2?{isDecimal:!1,ceil:1024,actualStandard:"iec"}:{isDecimal:!0,ceil:1e3,actualStandard:Nt}}function op(t,e,r,o,a,n,i,s){let f=[];f[0]=t>0?0 .toPrecision(t):0;let p=f[1]=Rt.symbol[e][r?uo:ho][0];return i===yo?0:(o[f[1]]&&(f[1]=o[f[1]]),a&&(f[1]=n[0]||Rt.fullform[e][0]+(r?"bit":co)),i===go?f:i===xo?{value:f[0],symbol:f[1],exponent:0,unit:p}:f.join(s))}function bo(t,e,r,o,a){let n=r?Qf[e]:Xf[e],i=t/n;return o&&(i*=8,i>=a&&e<8&&(i/=a,e++)),{result:i,e}}function ap(t,e,r,o,a,n,i,s,f){let p=t.toPrecision(e);if(p.includes("e")&&r<8){r++;let{result:y}=bo(o,r,a,n,i),h=f>0?Math.pow(10,f):1;p=(h===1?s(y):s(y*h)/h).toPrecision(e)}return{value:p,e:r}}function ip(t,e,r,o,a,n){let i=t;if(e===!0?i=i.toLocaleString():e.length>0?i=i.toLocaleString(e,r):o.length>0&&(i=i.toString().replace(".",o)),a&&n>0){let s=i.toString(),f=o||(s.match(/(\D)/g)||[]).pop()||".",p=s.split(f),y=p[1]||"",h=y.length,B=n-h;i=`${p[0]}${f}${y.padEnd(h+B,"0")}`}return i}function vo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:n="",localeOptions:i={},separator:s="",spacer:f=" ",symbols:p={},standard:y="",output:h=Zf,fullform:B=!1,fullforms:ot=[],exponent:st=-1,roundingMethod:ft=Jf,precision:b=0}={}){let l=st,E=Number(t),d=[],Lt=0,qt="",{isDecimal:pt,ceil:Bt,actualStandard:Dt}=rp(y,o),Zt=B===!0,Jt=E<0,lt=Math[ft];if(typeof t!="bigint"&&isNaN(t))throw new TypeError($f);if(typeof lt!==qf)throw new TypeError(Hf);if(Jt&&(E=-E),E===0)return op(b,Dt,e,p,Zt,ot,h,f);if((l===-1||isNaN(l))&&(l=Math.floor(pt?Math.log(E)/ep:Math.log(E)/tp),l<0&&(l=0)),l>8&&(b>0&&(b+=8-l),l=8),h===yo)return l;let{result:To,e:wo}=bo(E,l,pt,e,Bt);Lt=To,l=wo;let kt=l>0&&a>0?Math.pow(10,a):1;if(d[0]=kt===1?lt(Lt):lt(Lt*kt)/kt,d[0]===Bt&&l<8&&st===-1&&(d[0]=1,l++),b>0){let Xt=ap(d[0],b,l,E,pt,e,Bt,lt,a);d[0]=Xt.value,l=Xt.e}let Po=Rt.symbol[Dt][e?uo:ho];return qt=d[1]=pt&&l===1?e?Vf:"kB":Po[l],Jt&&(d[0]=-d[0]),p[d[1]]&&(d[1]=p[d[1]]),d[0]=ip(d[0],n,i,s,r,a),Zt&&(d[1]=ot[l]||Rt.fullform[Dt][l]+(e?"bit":co)+(d[0]===1?"":"s")),h===go?d:h===xo?{value:d[0],symbol:d[1],exponent:l,unit:qt}:f===" "?`${d[0]} ${d[1]}`:d.join(f)}var _=class t{constructor(e){this.meta={};var o;if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,$t(e,"encodeIdFunction")),e.encodeIdFunction&&typeof e.encodeIdFunction=="function"&&(this.id=e.encodeIdFunction(this.id));let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.created&&typeof this.created=="string"&&(this.created=new Date(this.created)),this.modified&&typeof this.modified=="string"&&(this.modified=new Date(this.modified)),this.accessed&&typeof this.accessed=="string"&&(this.accessed=new Date(this.accessed)),this.isFolder&&(this.files=(o=this.files)==null?void 0:o.map(a=>{let n=a.path.split(/\//).slice(3).join("/"),i=this.url+"/"+a.name;return a.meta.reflib&&(i=i.replace(/\/project\/download\//,"/project/library/")),new t({tera:this._tera,...a,sbId:a.id,id:a.path,encodeIdFunction:e.encodeIdFunction,path:n,url:i})})),this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=vo(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 Mt(this,["id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){let r=Mt(e,["tera","id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]);return new t(r)}};var Vt=class{constructor(e){this.settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};this.events=po();this.dom={el:null,iframe:null,popup:null,stylesheet:null};this.methods=["handshake","setServerVerbosity","getUser","requireUser","getCredentials","getKindeToken","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getNamespace","setNamespace","listNamespaces","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateRefresh","getProjectFileContents","deleteProjectFile","setProjectFileContents","createProjectFolder","deleteProjectFolder","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiJson","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];this.plugins=[];this.namespaces={};this.acceptPostboxes={};this.initPromise=null;e&&this.set(e)}send(e){let r=Ht();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||Ht(),...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 Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Received message",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):(r==null?void 0:r.action)=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):(r==null?void 0:r.action)=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r!=null&&r.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}mountNamespace(e){if(!/^[\w-]+$/.test(e))throw new Error("Namespaces must be alphanumeric + hyphens + underscores");return this.namespaces[e]?Promise.resolve(this.namespaces[e]):Promise.resolve().then(()=>this._mountNamespace(e)).then(()=>this.namespaces[e]||Promise.reject(`teraFy.mountNamespace('${e}') resolved but no namespace has been mounted`))}_mountNamespace(e){throw console.warn(`teraFy._mountNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`),new Error("teraFy._mountNamespace() is not supported")}unmountNamespace(e){return this.namespaces[e]?this._unmountNamespace(e):Promise.resolve()}_unmountNamespace(e){console.warn(`teraFy.unbindNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`)}init(e){if(e&&this.set(e),this.initPromise)return this.initPromise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.initPromise=Promise.resolve().then(()=>{var o;return(o=this.settings).session||(o.session="tfy-"+this.getEntropicString(16))}).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths?this.settings.debugPaths=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")})()):this.settings.debugPaths=null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw new Error(`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"),r)).catch(o=>{throw this.debug("WARN",0,"Init process fault",o),o}),this.initPromise}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("TIMEOUT"),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e()).catch(r)})).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,"Embedded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let n=0,i,s=setTimeout(()=>{clearTimeout(i),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++n),clearTimeout(i),i=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(s),clearTimeout(i)}).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.append(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){return this.methods.forEach(e=>this[e]=this.rpc.bind(this,e)),Promise.resolve()}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initializer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){let o=[],a=r;do o.unshift(a);while(a=Object.getPrototypeOf(a));o.forEach(n=>Object.getOwnPropertyNames(n).filter(i=>!["constructor","init","prototype","name"].includes(i)&&!i.startsWith("__")).forEach(i=>{typeof r[i]=="function"?Object.defineProperty(e,i,{enumerable:!1,value:r[i].bind(e)}):e[i]=r[i]}))}toggleDevMode(e="toggle"){var r;return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),(r=this.dom)!=null&&r.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCodePoint(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(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,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new _({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new _({tera:this,...r}))}moveProjectFile(e,r,o){return this.rpc("moveProjectFile",e,r,o).then(a=>a?new _({tera:this,...a}):null)}};export{Vt as default};
3
3
  /*! Bundled license information:
4
4
 
5
5
  lodash-es/lodash.js:
@@ -13,12 +13,12 @@ lodash-es/lodash.js:
13
13
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
14
14
  *)
15
15
 
16
- filesize/dist/filesize.esm.js:
16
+ filesize/dist/filesize.js:
17
17
  (**
18
18
  * filesize
19
19
  *
20
- * @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
20
+ * @copyright 2025 Jason Mulligan <jason.mulligan@avoidwork.com>
21
21
  * @license BSD-3-Clause
22
- * @version 10.1.6
22
+ * @version 11.0.13
23
23
  *)
24
24
  */
package/dist/terafy.js CHANGED
@@ -1,5 +1,5 @@
1
- var xo=typeof global=="object"&&global&&global.Object===Object&&global,ut=xo;var yo=typeof self=="object"&&self&&self.Object===Object&&self,bo=ut||yo||Function("return this")(),d=bo;var vo=d.Symbol,x=vo;var Qt=Object.prototype,wo=Qt.hasOwnProperty,To=Qt.toString,it=x?x.toStringTag:void 0;function Po(t){var e=wo.call(t,it),r=t[it];try{t[it]=void 0;var o=!0}catch{}var a=To.call(t);return o&&(e?t[it]=r:delete t[it]),a}var te=Po;var jo=Object.prototype,Oo=jo.toString;function Ao(t){return Oo.call(t)}var ee=Ao;var Io="[object Null]",So="[object Undefined]",re=x?x.toStringTag:void 0;function _o(t){return t==null?t===void 0?So:Io:re&&re in Object(t)?te(t):ee(t)}var w=_o;function Eo(t){return t!=null&&typeof t=="object"}var y=Eo;var Fo="[object Symbol]";function Co(t){return typeof t=="symbol"||y(t)&&w(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 dt=Mo;var No=Array.isArray,g=No;var Ro=1/0,oe=x?x.prototype:void 0,ae=oe?oe.toString:void 0;function ie(t){if(typeof t=="string")return t;if(g(t))return dt(t,ie)+"";if(k(t))return ae?ae.call(t):"";var e=t+"";return e=="0"&&1/t==-Ro?"-0":e}var se=ie;function Lo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var T=Lo;function Bo(t){return t}var ne=Bo;var ko="[object AsyncFunction]",Do="[object Function]",Uo="[object GeneratorFunction]",Go="[object Proxy]";function zo(t){if(!T(t))return!1;var e=w(t);return e==Do||e==Uo||e==ko||e==Go}var ct=zo;var Ko=d["__core-js_shared__"],ht=Ko;var fe=(function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Wo(t){return!!fe&&fe in t}var pe=Wo;var Yo=Function.prototype,$o=Yo.toString;function Ho(t){if(t!=null){try{return $o.call(t)}catch{}try{return t+""}catch{}}return""}var A=Ho;var Vo=/[\\^$.*+?()[\]{}|]/g,qo=/^\[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(!T(t)||pe(t))return!1;var e=ct(t)?ta:qo;return e.test(A(t))}var le=ea;function ra(t,e){return t?.[e]}var me=ra;function oa(t,e){var r=me(t,e);return le(r)?r:void 0}var b=oa;var aa=b(d,"WeakMap"),gt=aa;var ue=Object.create,ia=(function(){function t(){}return function(e){if(!T(e))return{};if(ue)return ue(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),de=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 ce=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 he=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 ge=ma;function ua(t){return function(){return t}}var xe=ua;var da=(function(){try{var t=b(Object,"defineProperty");return t({},"",{}),t}catch{}})(),D=da;var ca=D?function(t,e){return D(t,"toString",{configurable:!0,enumerable:!1,value:xe(e),writable:!0})}:ne,ye=ca;var ha=ge(ye),be=ha;function ga(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ve=ga;var xa=9007199254740991,ya=/^(?:0|[1-9]\d*)$/;function ba(t,e){var r=typeof t;return e=e??xa,!!e&&(r=="number"||r!="symbol"&&ya.test(t))&&t>-1&&t%1==0&&t<e}var U=ba;function va(t,e,r){e=="__proto__"&&D?D(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var xt=va;function wa(t,e){return t===e||t!==t&&e!==e}var yt=wa;var Ta=Object.prototype,Pa=Ta.hasOwnProperty;function ja(t,e,r){var o=t[e];(!(Pa.call(t,e)&&yt(o,r))||r===void 0&&!(e in t))&&xt(t,e,r)}var G=ja;function Oa(t,e,r,o){var a=!r;r||(r={});for(var i=-1,s=e.length;++i<s;){var n=e[i],u=o?o(r[n],t[n],n,r,t):void 0;u===void 0&&(u=t[n]),a?xt(r,n,u):G(r,n,u)}return r}var O=Oa;var we=Math.max;function Aa(t,e,r){return e=we(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,i=we(o.length-e,0),s=Array(i);++a<i;)s[a]=o[e+a];a=-1;for(var n=Array(e+1);++a<e;)n[a]=o[a];return n[e]=r(s),ce(t,this,n)}}var Te=Aa;var Ia=9007199254740991;function Sa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ia}var z=Sa;function _a(t){return t!=null&&z(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 K=Fa;function Ca(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Pe=Ca;var Ma="[object Arguments]";function Na(t){return y(t)&&w(t)==Ma}var Lt=Na;var je=Object.prototype,Ra=je.hasOwnProperty,La=je.propertyIsEnumerable,Ba=Lt((function(){return arguments})())?Lt:function(t){return y(t)&&Ra.call(t,"callee")&&!La.call(t,"callee")},W=Ba;function ka(){return!1}var Oe=ka;var Se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ae=Se&&typeof module=="object"&&module&&!module.nodeType&&module,Da=Ae&&Ae.exports===Se,Ie=Da?d.Buffer:void 0,Ua=Ie?Ie.isBuffer:void 0,Ga=Ua||Oe,vt=Ga;var za="[object Arguments]",Ka="[object Array]",Wa="[object Boolean]",Ya="[object Date]",$a="[object Error]",Ha="[object Function]",Va="[object Map]",qa="[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]",m={};m[oi]=m[ai]=m[ii]=m[si]=m[ni]=m[fi]=m[pi]=m[li]=m[mi]=!0;m[za]=m[Ka]=m[ei]=m[Wa]=m[ri]=m[Ya]=m[$a]=m[Ha]=m[Va]=m[qa]=m[Za]=m[Ja]=m[Xa]=m[Qa]=m[ti]=!1;function ui(t){return y(t)&&z(t.length)&&!!m[w(t)]}var _e=ui;function di(t){return function(e){return t(e)}}var Y=di;var Ee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,st=Ee&&typeof module=="object"&&module&&!module.nodeType&&module,ci=st&&st.exports===Ee,Bt=ci&&ut.process,hi=(function(){try{var t=st&&st.require&&st.require("util").types;return t||Bt&&Bt.binding&&Bt.binding("util")}catch{}})(),I=hi;var Fe=I&&I.isTypedArray,gi=Fe?Y(Fe):_e,Ce=gi;var xi=Object.prototype,yi=xi.hasOwnProperty;function bi(t,e){var r=g(t),o=!r&&W(t),a=!r&&!o&&vt(t),i=!r&&!o&&!a&&Ce(t),s=r||o||a||i,n=s?Pe(t.length,String):[],u=n.length;for(var c in t)(e||yi.call(t,c))&&!(s&&(c=="length"||a&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||U(c,u)))&&n.push(c);return n}var wt=bi;function vi(t,e){return function(r){return t(e(r))}}var Tt=vi;var wi=Tt(Object.keys,Object),Me=wi;var Ti=Object.prototype,Pi=Ti.hasOwnProperty;function ji(t){if(!K(t))return Me(t);var e=[];for(var r in Object(t))Pi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ne=ji;function Oi(t){return bt(t)?wt(t):Ne(t)}var $=Oi;function Ai(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Re=Ai;var Ii=Object.prototype,Si=Ii.hasOwnProperty;function _i(t){if(!T(t))return Re(t);var e=K(t),r=[];for(var o in t)o=="constructor"&&(e||!Si.call(t,o))||r.push(o);return r}var Le=_i;function Ei(t){return bt(t)?wt(t,!0):Le(t)}var H=Ei;var Fi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ci=/^\w*$/;function Mi(t,e){if(g(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 Be=Mi;var Ni=b(Object,"create"),S=Ni;function Ri(){this.__data__=S?S(null):{},this.size=0}var ke=Ri;function Li(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var De=Li;var Bi="__lodash_hash_undefined__",ki=Object.prototype,Di=ki.hasOwnProperty;function Ui(t){var e=this.__data__;if(S){var r=e[t];return r===Bi?void 0:r}return Di.call(e,t)?e[t]:void 0}var Ue=Ui;var Gi=Object.prototype,zi=Gi.hasOwnProperty;function Ki(t){var e=this.__data__;return S?e[t]!==void 0:zi.call(e,t)}var Ge=Ki;var Wi="__lodash_hash_undefined__";function Yi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=S&&e===void 0?Wi:e,this}var ze=Yi;function V(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}V.prototype.clear=ke;V.prototype.delete=De;V.prototype.get=Ue;V.prototype.has=Ge;V.prototype.set=ze;var kt=V;function $i(){this.__data__=[],this.size=0}var Ke=$i;function Hi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var E=Hi;var Vi=Array.prototype,qi=Vi.splice;function Zi(t){var e=this.__data__,r=E(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():qi.call(e,r,1),--this.size,!0}var We=Zi;function Ji(t){var e=this.__data__,r=E(e,t);return r<0?void 0:e[r][1]}var Ye=Ji;function Xi(t){return E(this.__data__,t)>-1}var $e=Xi;function Qi(t,e){var r=this.__data__,o=E(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var He=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=Ke;q.prototype.delete=We;q.prototype.get=Ye;q.prototype.has=$e;q.prototype.set=He;var F=q;var ts=b(d,"Map"),C=ts;function es(){this.size=0,this.__data__={hash:new kt,map:new(C||F),string:new kt}}var Ve=es;function rs(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var qe=rs;function os(t,e){var r=t.__data__;return qe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var M=os;function as(t){var e=M(this,t).delete(t);return this.size-=e?1:0,e}var Ze=as;function is(t){return M(this,t).get(t)}var Je=is;function ss(t){return M(this,t).has(t)}var Xe=ss;function ns(t,e){var r=M(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Qe=ns;function Z(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])}}Z.prototype.clear=Ve;Z.prototype.delete=Ze;Z.prototype.get=Je;Z.prototype.has=Xe;Z.prototype.set=Qe;var nt=Z;var fs="Expected a function";function Dt(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],i=r.cache;if(i.has(a))return i.get(a);var s=t.apply(this,o);return r.cache=i.set(a,s)||i,s};return r.cache=new(Dt.Cache||nt),r}Dt.Cache=nt;var tr=Dt;var ps=500;function ls(t){var e=tr(t,function(o){return r.size===ps&&r.clear(),o}),r=e.cache;return e}var er=ls;var ms=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,us=/\\(\\)?/g,ds=er(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ms,function(r,o,a,i){e.push(a?i.replace(us,"$1"):o||r)}),e}),rr=ds;function cs(t){return t==null?"":se(t)}var or=cs;function hs(t,e){return g(t)?t:Be(t,e)?[t]:rr(or(t))}var P=hs;var gs=1/0;function xs(t){if(typeof t=="string"||k(t))return t;var e=t+"";return e=="0"&&1/t==-gs?"-0":e}var N=xs;function ys(t,e){e=P(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[N(e[r++])];return r&&r==o?t:void 0}var Pt=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 J=bs;var ar=x?x.isConcatSpreadable:void 0;function vs(t){return g(t)||W(t)||!!(ar&&t&&t[ar])}var ir=vs;function sr(t,e,r,o,a){var i=-1,s=t.length;for(r||(r=ir),a||(a=[]);++i<s;){var n=t[i];e>0&&r(n)?e>1?sr(n,e-1,r,o,a):J(a,n):o||(a[a.length]=n)}return a}var nr=sr;function ws(t){var e=t==null?0:t.length;return e?nr(t,1):[]}var fr=ws;function Ts(t){return be(Te(t,void 0,fr),t+"")}var jt=Ts;var Ps=Tt(Object.getPrototypeOf,Object),X=Ps;var js="[object Object]",Os=Function.prototype,As=Object.prototype,pr=Os.toString,Is=As.hasOwnProperty,Ss=pr.call(Object);function _s(t){if(!y(t)||w(t)!=js)return!1;var e=X(t);if(e===null)return!0;var r=Is.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&pr.call(r)==Ss}var lr=_s;function Es(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(a);++o<a;)i[o]=t[o+e];return i}var mr=Es;function Fs(){this.__data__=new F,this.size=0}var ur=Fs;function Cs(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var dr=Cs;function Ms(t){return this.__data__.get(t)}var cr=Ms;function Ns(t){return this.__data__.has(t)}var hr=Ns;var Rs=200;function Ls(t,e){var r=this.__data__;if(r instanceof F){var o=r.__data__;if(!C||o.length<Rs-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new nt(o)}return r.set(t,e),this.size=r.size,this}var gr=Ls;function Q(t){var e=this.__data__=new F(t);this.size=e.size}Q.prototype.clear=ur;Q.prototype.delete=dr;Q.prototype.get=cr;Q.prototype.has=hr;Q.prototype.set=gr;var xr=Q;function Bs(t,e){return t&&O(e,$(e),t)}var yr=Bs;function ks(t,e){return t&&O(e,H(e),t)}var br=ks;var Pr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vr=Pr&&typeof module=="object"&&module&&!module.nodeType&&module,Ds=vr&&vr.exports===Pr,wr=Ds?d.Buffer:void 0,Tr=wr?wr.allocUnsafe:void 0;function Us(t,e){if(e)return t.slice();var r=t.length,o=Tr?Tr(r):new t.constructor(r);return t.copy(o),o}var jr=Us;function Gs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,i=[];++r<o;){var s=t[r];e(s,r,t)&&(i[a++]=s)}return i}var Or=Gs;function zs(){return[]}var Ot=zs;var Ks=Object.prototype,Ws=Ks.propertyIsEnumerable,Ar=Object.getOwnPropertySymbols,Ys=Ar?function(t){return t==null?[]:(t=Object(t),Or(Ar(t),function(e){return Ws.call(t,e)}))}:Ot,tt=Ys;function $s(t,e){return O(t,tt(t),e)}var Ir=$s;var Hs=Object.getOwnPropertySymbols,Vs=Hs?function(t){for(var e=[];t;)J(e,tt(t)),t=X(t);return e}:Ot,At=Vs;function qs(t,e){return O(t,At(t),e)}var Sr=qs;function Zs(t,e,r){var o=e(t);return g(t)?o:J(o,r(t))}var It=Zs;function Js(t){return It(t,$,tt)}var _r=Js;function Xs(t){return It(t,H,At)}var St=Xs;var Qs=b(d,"DataView"),_t=Qs;var tn=b(d,"Promise"),Et=tn;var en=b(d,"Set"),Ft=en;var Er="[object Map]",rn="[object Object]",Fr="[object Promise]",Cr="[object Set]",Mr="[object WeakMap]",Nr="[object DataView]",on=A(_t),an=A(C),sn=A(Et),nn=A(Ft),fn=A(gt),L=w;(_t&&L(new _t(new ArrayBuffer(1)))!=Nr||C&&L(new C)!=Er||Et&&L(Et.resolve())!=Fr||Ft&&L(new Ft)!=Cr||gt&&L(new gt)!=Mr)&&(L=function(t){var e=w(t),r=e==rn?t.constructor:void 0,o=r?A(r):"";if(o)switch(o){case on:return Nr;case an:return Er;case sn:return Fr;case nn:return Cr;case fn:return Mr}return e});var et=L;var pn=Object.prototype,ln=pn.hasOwnProperty;function mn(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&ln.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Rr=mn;var un=d.Uint8Array,Ut=un;function dn(t){var e=new t.constructor(t.byteLength);return new Ut(e).set(new Ut(t)),e}var rt=dn;function cn(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Lr=cn;var hn=/\w*$/;function gn(t){var e=new t.constructor(t.source,hn.exec(t));return e.lastIndex=t.lastIndex,e}var Br=gn;var kr=x?x.prototype:void 0,Dr=kr?kr.valueOf:void 0;function xn(t){return Dr?Object(Dr.call(t)):{}}var Ur=xn;function yn(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Gr=yn;var bn="[object Boolean]",vn="[object Date]",wn="[object Map]",Tn="[object Number]",Pn="[object RegExp]",jn="[object Set]",On="[object String]",An="[object Symbol]",In="[object ArrayBuffer]",Sn="[object DataView]",_n="[object Float32Array]",En="[object Float64Array]",Fn="[object Int8Array]",Cn="[object Int16Array]",Mn="[object Int32Array]",Nn="[object Uint8Array]",Rn="[object Uint8ClampedArray]",Ln="[object Uint16Array]",Bn="[object Uint32Array]";function kn(t,e,r){var o=t.constructor;switch(e){case In:return rt(t);case bn:case vn:return new o(+t);case Sn:return Lr(t,r);case _n:case En:case Fn:case Cn:case Mn:case Nn:case Rn:case Ln:case Bn:return Gr(t,r);case wn:return new o;case Tn:case On:return new o(t);case Pn:return Br(t);case jn:return new o;case An:return Ur(t)}}var zr=kn;function Dn(t){return typeof t.constructor=="function"&&!K(t)?de(X(t)):{}}var Kr=Dn;var Un="[object Map]";function Gn(t){return y(t)&&et(t)==Un}var Wr=Gn;var Yr=I&&I.isMap,zn=Yr?Y(Yr):Wr,$r=zn;var Kn="[object Set]";function Wn(t){return y(t)&&et(t)==Kn}var Hr=Wn;var Vr=I&&I.isSet,Yn=Vr?Y(Vr):Hr,qr=Yn;var $n=1,Hn=2,Vn=4,Zr="[object Arguments]",qn="[object Array]",Zn="[object Boolean]",Jn="[object Date]",Xn="[object Error]",Jr="[object Function]",Qn="[object GeneratorFunction]",tf="[object Map]",ef="[object Number]",Xr="[object Object]",rf="[object RegExp]",of="[object Set]",af="[object String]",sf="[object Symbol]",nf="[object WeakMap]",ff="[object ArrayBuffer]",pf="[object DataView]",lf="[object Float32Array]",mf="[object Float64Array]",uf="[object Int8Array]",df="[object Int16Array]",cf="[object Int32Array]",hf="[object Uint8Array]",gf="[object Uint8ClampedArray]",xf="[object Uint16Array]",yf="[object Uint32Array]",l={};l[Zr]=l[qn]=l[ff]=l[pf]=l[Zn]=l[Jn]=l[lf]=l[mf]=l[uf]=l[df]=l[cf]=l[tf]=l[ef]=l[Xr]=l[rf]=l[of]=l[af]=l[sf]=l[hf]=l[gf]=l[xf]=l[yf]=!0;l[Xn]=l[Jr]=l[nf]=!1;function Ct(t,e,r,o,a,i){var s,n=e&$n,u=e&Hn,c=e&Vn;if(r&&(s=a?r(t,o,a,i):r(t)),s!==void 0)return s;if(!T(t))return t;var h=g(t);if(h){if(s=Rr(t),!n)return he(t,s)}else{var j=et(t),ft=j==Jr||j==Qn;if(vt(t))return jr(t,n);if(j==Xr||j==Zr||ft&&!a){if(s=u||ft?{}:Kr(t),!n)return u?Sr(t,br(s,t)):Ir(t,yr(s,t))}else{if(!l[j])return a?t:{};s=zr(t,j,n)}}i||(i=new xr);var ot=i.get(t);if(ot)return ot;i.set(t,s),qr(t)?t.forEach(function(v){s.add(Ct(v,e,r,v,t,i))}):$r(t)&&t.forEach(function(v,f){s.set(f,Ct(v,e,r,f,t,i))});var pt=c?u?St:_r:u?H:$,lt=h?void 0:pt(t);return ve(lt||t,function(v,f){lt&&(f=v,v=t[f]),G(s,f,Ct(v,e,r,f,t,i))}),s}var Mt=Ct;var bf=1,vf=4;function wf(t){return Mt(t,bf|vf)}var Gt=wf;function Tf(t,e){return t!=null&&e in Object(t)}var Qr=Tf;function Pf(t,e,r){e=P(e,t);for(var o=-1,a=e.length,i=!1;++o<a;){var s=N(e[o]);if(!(i=t!=null&&r(t,s)))break;t=t[s]}return i||++o!=a?i:(a=t==null?0:t.length,!!a&&z(a)&&U(s,a)&&(g(t)||W(t)))}var to=Pf;function jf(t,e){return t!=null&&to(t,e,Qr)}var eo=jf;function Of(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var ro=Of;function Af(t,e){return e.length<2?t:Pt(t,mr(e,0,-1))}var oo=Af;var If=Object.prototype,Sf=If.hasOwnProperty;function _f(t,e){e=P(e,t);var r=-1,o=e.length;if(!o)return!0;for(var a=t==null||typeof t!="object"&&typeof t!="function";++r<o;){var i=e[r];if(typeof i=="string"){if(i==="__proto__"&&!Sf.call(t,"__proto__"))return!1;if(i==="constructor"&&r+1<o&&typeof e[r+1]=="string"&&e[r+1]==="prototype"){if(a&&r===0)continue;return!1}}}var s=oo(t,e);return s==null||delete s[N(ro(e))]}var ao=_f;function Ef(t){return lr(t)?void 0:t}var io=Ef;var Ff=1,Cf=2,Mf=4,Nf=jt(function(t,e){var r={};if(t==null)return r;var o=!1;e=dt(e,function(i){return i=P(i,t),o||(o=i.length>1),i}),O(t,St(t),r),o&&(r=Mt(r,Ff|Cf|Mf,io));for(var a=e.length;a--;)ao(r,e[a]);return r}),zt=Nf;function Rf(t,e,r,o){if(!T(t))return t;e=P(e,t);for(var a=-1,i=e.length,s=i-1,n=t;n!=null&&++a<i;){var u=N(e[a]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(a!=s){var h=n[u];c=o?o(h,u,n):void 0,c===void 0&&(c=T(h)?h:U(e[a+1])?[]:{})}G(n,u,c),n=n[u]}return t}var so=Rf;function Lf(t,e,r){for(var o=-1,a=e.length,i={};++o<a;){var s=e[o],n=Pt(t,s);r(n,s)&&so(i,P(s,t),n)}return i}var no=Lf;function Bf(t,e){return no(t,e,function(r,o){return eo(t,o)})}var fo=Bf;var kf=jt(function(t,e){return t==null?{}:fo(t,e)}),Nt=kf;function po(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 lo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Kt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=lo[r[t]&63];return e};var Df="array";var mo="bits",Uf="byte",uo="bytes";var Gf="exponent",zf="function";var Kf="Invalid number",Wf="Invalid rounding method",Wt="jedec",Yf="object";var $f="round";var Hf="kbit";var Vf="string";var Yt={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 co(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:i="",localeOptions:s={},separator:n="",spacer:u=" ",symbols:c={},standard:h="",output:j=Vf,fullform:ft=!1,fullforms:ot=[],exponent:pt=-1,roundingMethod:lt=$f,precision:v=0}={}){let f=pt,B=Number(t),p=[],R=0,Rt="";h==="si"?(o=10,h=Wt):h==="iec"||h===Wt?o=2:o===2?h="iec":(o=10,h=Wt);let mt=o===10?1e3:1024,ho=ft===!0,Ht=B<0,Vt=Math[lt];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Kf);if(typeof Vt!==zf)throw new TypeError(Wf);if(Ht&&(B=-B),(f===-1||isNaN(f))&&(f=Math.floor(Math.log(B)/Math.log(mt)),f<0&&(f=0)),f>8&&(v>0&&(v+=8-f),f=8),j===Gf)return f;if(B===0)p[0]=0,Rt=p[1]=Yt.symbol[h][e?mo:uo][f];else{R=B/(o===2?Math.pow(2,f*10):Math.pow(1e3,f)),e&&(R=R*8,R>=mt&&f<8&&(R=R/mt,f++));let at=Math.pow(10,f>0?a:0);p[0]=Vt(R*at)/at,p[0]===mt&&f<8&&pt===-1&&(p[0]=1,f++),Rt=p[1]=o===10&&f===1?e?Hf:"kB":Yt.symbol[h][e?mo:uo][f]}if(Ht&&(p[0]=-p[0]),v>0&&(p[0]=p[0].toPrecision(v)),p[1]=c[p[1]]||p[1],i===!0?p[0]=p[0].toLocaleString():i.length>0?p[0]=p[0].toLocaleString(i,s):n.length>0&&(p[0]=p[0].toString().replace(".",n)),r&&a>0){let at=p[0].toString(),qt=n||(at.match(/(\D)/g)||[]).pop()||".",Zt=at.toString().split(qt),Jt=Zt[1]||"",Xt=Jt.length,go=a-Xt;p[0]=`${Zt[0]}${qt}${Jt.padEnd(Xt+go,"0")}`}return ho&&(p[1]=ot[f]?ot[f]:Yt.fullform[h][f]+(e?"bit":Uf)+(p[0]===1?"":"s")),j===Df?p:j===Yf?{value:p[0],symbol:p[1],exponent:f,unit:Rt}:p.join(u)}var _=class t{constructor(e){this.meta={};if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,zt(e,"encodeIdFunction")),e.encodeIdFunction&&typeof e.encodeIdFunction=="function"&&(this.id=e.encodeIdFunction(this.id));let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.created&&typeof this.created=="string"&&(this.created=new Date(this.created)),this.modified&&typeof this.modified=="string"&&(this.modified=new Date(this.modified)),this.accessed&&typeof this.accessed=="string"&&(this.accessed=new Date(this.accessed)),this.isFolder&&(this.files=this.files?.map(o=>{let a=o.path.split(/\//).slice(3).join("/"),i=this.url+"/"+o.name;return o.meta.reflib&&(i=i.replace(/\/project\/download\//,"/project/library/")),new t({tera:this._tera,...o,sbId:o.id,id:o.path,encodeIdFunction:e.encodeIdFunction,path:a,url:i})})),this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=co(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 Nt(this,["id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){let r=Nt(e,["tera","id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]);return new t(r)}};var $t=class{constructor(e){this.settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};this.events=po();this.dom={el:null,iframe:null,popup:null,stylesheet:null};this.methods=["handshake","setServerVerbosity","getUser","requireUser","getCredentials","getKindeToken","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getNamespace","setNamespace","listNamespaces","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateRefresh","getProjectFileContents","deleteProjectFile","setProjectFileContents","createProjectFolder","deleteProjectFolder","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiJson","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];this.plugins=[];this.namespaces={};this.acceptPostboxes={};this.initPromise=null;e&&this.set(e)}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(),...Gt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Received message",r),r?.action=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):r?.action=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):r?.action=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r?.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}mountNamespace(e){if(!/^[\w-]+$/.test(e))throw new Error("Namespaces must be alphanumeric + hyphens + underscores");return this.namespaces[e]?Promise.resolve(this.namespaces[e]):Promise.resolve().then(()=>this._mountNamespace(e)).then(()=>this.namespaces[e]||Promise.reject(`teraFy.mountNamespace('${e}') resolved but no namespace has been mounted`))}_mountNamespace(e){throw console.warn(`teraFy._mountNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`),new Error("teraFy._mountNamespace() is not supported")}unmountNamespace(e){return this.namespaces[e]?this._unmountNamespace(e):Promise.resolve()}_unmountNamespace(e){console.warn(`teraFy.unbindNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`)}init(e){if(e&&this.set(e),this.initPromise)return this.initPromise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.initPromise=Promise.resolve().then(()=>this.settings.session||="tfy-"+this.getEntropicString(16)).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths?this.settings.debugPaths=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")})()):this.settings.debugPaths=null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw new Error(`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"),r)).catch(o=>{throw this.debug("WARN",0,"Init process fault",o),o}),this.initPromise}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("TIMEOUT"),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e()).catch(r)})).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,"Embedded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let i=0,s,n=setTimeout(()=>{clearTimeout(s),a("TIMEOUT")},r.handshakeTimeout),u=()=>{this.debug("INFO",4,"Trying handshake",++i),clearTimeout(s),s=setTimeout(u,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(n),clearTimeout(s)}).then(()=>o()).catch(a)};u()})}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.append(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){return this.methods.forEach(e=>this[e]=this.rpc.bind(this,e)),Promise.resolve()}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initializer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){let o=[],a=r;do o.unshift(a);while(a=Object.getPrototypeOf(a));o.forEach(i=>Object.getOwnPropertyNames(i).filter(s=>!["constructor","init","prototype","name"].includes(s)&&!s.startsWith("__")).forEach(s=>{typeof r[s]=="function"?Object.defineProperty(e,s,{enumerable:!1,value:r[s].bind(e)}):e[s]=r[s]}))}toggleDevMode(e="toggle"){return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),this.dom?.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCodePoint(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(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,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new _({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new _({tera:this,...r}))}moveProjectFile(e,r,o){return this.rpc("moveProjectFile",e,r,o).then(a=>a?new _({tera:this,...a}):null)}};export{$t as default};
1
+ var Oo=typeof global=="object"&&global&&global.Object===Object&&global,mt=Oo;var jo=typeof self=="object"&&self&&self.Object===Object&&self,Ao=mt||jo||Function("return this")(),c=Ao;var So=c.Symbol,x=So;var Qt=Object.prototype,Io=Qt.hasOwnProperty,_o=Qt.toString,at=x?x.toStringTag:void 0;function Eo(t){var e=Io.call(t,at),r=t[at];try{t[at]=void 0;var o=!0}catch{}var a=_o.call(t);return o&&(e?t[at]=r:delete t[at]),a}var te=Eo;var Fo=Object.prototype,Co=Fo.toString;function Mo(t){return Co.call(t)}var ee=Mo;var No="[object Null]",Ro="[object Undefined]",re=x?x.toStringTag:void 0;function Lo(t){return t==null?t===void 0?Ro:No:re&&re in Object(t)?te(t):ee(t)}var w=Lo;function Bo(t){return t!=null&&typeof t=="object"}var v=Bo;var Do="[object Symbol]";function ko(t){return typeof t=="symbol"||v(t)&&w(t)==Do}var D=ko;function Uo(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 ut=Uo;var Go=Array.isArray,g=Go;var zo=1/0,oe=x?x.prototype:void 0,ae=oe?oe.toString:void 0;function ie(t){if(typeof t=="string")return t;if(g(t))return ut(t,ie)+"";if(D(t))return ae?ae.call(t):"";var e=t+"";return e=="0"&&1/t==-zo?"-0":e}var ne=ie;function Ko(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var P=Ko;function Wo(t){return t}var se=Wo;var Yo="[object AsyncFunction]",$o="[object Function]",Ho="[object GeneratorFunction]",Vo="[object Proxy]";function qo(t){if(!P(t))return!1;var e=w(t);return e==$o||e==Ho||e==Yo||e==Vo}var dt=qo;var Zo=c["__core-js_shared__"],ct=Zo;var fe=(function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Jo(t){return!!fe&&fe in t}var pe=Jo;var Xo=Function.prototype,Qo=Xo.toString;function ta(t){if(t!=null){try{return Qo.call(t)}catch{}try{return t+""}catch{}}return""}var A=ta;var ea=/[\\^$.*+?()[\]{}|]/g,ra=/^\[object .+?Constructor\]$/,oa=Function.prototype,aa=Object.prototype,ia=oa.toString,na=aa.hasOwnProperty,sa=RegExp("^"+ia.call(na).replace(ea,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fa(t){if(!P(t)||pe(t))return!1;var e=dt(t)?sa:ra;return e.test(A(t))}var le=fa;function pa(t,e){return t?.[e]}var me=pa;function la(t,e){var r=me(t,e);return le(r)?r:void 0}var T=la;var ma=T(c,"WeakMap"),ht=ma;var ue=Object.create,ua=(function(){function t(){}return function(e){if(!P(e))return{};if(ue)return ue(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),de=ua;function da(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 ce=da;function ca(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var he=ca;var ha=800,ga=16,xa=Date.now;function ya(t){var e=0,r=0;return function(){var o=xa(),a=ga-(o-r);if(r=o,a>0){if(++e>=ha)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ge=ya;function ba(t){return function(){return t}}var xe=ba;var va=(function(){try{var t=T(Object,"defineProperty");return t({},"",{}),t}catch{}})(),k=va;var Ta=k?function(t,e){return k(t,"toString",{configurable:!0,enumerable:!1,value:xe(e),writable:!0})}:se,ye=Ta;var wa=ge(ye),be=wa;function Pa(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ve=Pa;var Oa=9007199254740991,ja=/^(?:0|[1-9]\d*)$/;function Aa(t,e){var r=typeof t;return e=e??Oa,!!e&&(r=="number"||r!="symbol"&&ja.test(t))&&t>-1&&t%1==0&&t<e}var U=Aa;function Sa(t,e,r){e=="__proto__"&&k?k(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=Sa;function Ia(t,e){return t===e||t!==t&&e!==e}var xt=Ia;var _a=Object.prototype,Ea=_a.hasOwnProperty;function Fa(t,e,r){var o=t[e];(!(Ea.call(t,e)&&xt(o,r))||r===void 0&&!(e in t))&&gt(t,e,r)}var G=Fa;function Ca(t,e,r,o){var a=!r;r||(r={});for(var n=-1,i=e.length;++n<i;){var s=e[n],f=o?o(r[s],t[s],s,r,t):void 0;f===void 0&&(f=t[s]),a?gt(r,s,f):G(r,s,f)}return r}var j=Ca;var Te=Math.max;function Ma(t,e,r){return e=Te(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,n=Te(o.length-e,0),i=Array(n);++a<n;)i[a]=o[e+a];a=-1;for(var s=Array(e+1);++a<e;)s[a]=o[a];return s[e]=r(i),ce(t,this,s)}}var we=Ma;var Na=9007199254740991;function Ra(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Na}var z=Ra;function La(t){return t!=null&&z(t.length)&&!dt(t)}var yt=La;var Ba=Object.prototype;function Da(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ba;return t===r}var K=Da;function ka(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Pe=ka;var Ua="[object Arguments]";function Ga(t){return v(t)&&w(t)==Ua}var Ut=Ga;var Oe=Object.prototype,za=Oe.hasOwnProperty,Ka=Oe.propertyIsEnumerable,Wa=Ut((function(){return arguments})())?Ut:function(t){return v(t)&&za.call(t,"callee")&&!Ka.call(t,"callee")},W=Wa;function Ya(){return!1}var je=Ya;var Ie=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ae=Ie&&typeof module=="object"&&module&&!module.nodeType&&module,$a=Ae&&Ae.exports===Ie,Se=$a?c.Buffer:void 0,Ha=Se?Se.isBuffer:void 0,Va=Ha||je,bt=Va;var qa="[object Arguments]",Za="[object Array]",Ja="[object Boolean]",Xa="[object Date]",Qa="[object Error]",ti="[object Function]",ei="[object Map]",ri="[object Number]",oi="[object Object]",ai="[object RegExp]",ii="[object Set]",ni="[object String]",si="[object WeakMap]",fi="[object ArrayBuffer]",pi="[object DataView]",li="[object Float32Array]",mi="[object Float64Array]",ui="[object Int8Array]",di="[object Int16Array]",ci="[object Int32Array]",hi="[object Uint8Array]",gi="[object Uint8ClampedArray]",xi="[object Uint16Array]",yi="[object Uint32Array]",u={};u[li]=u[mi]=u[ui]=u[di]=u[ci]=u[hi]=u[gi]=u[xi]=u[yi]=!0;u[qa]=u[Za]=u[fi]=u[Ja]=u[pi]=u[Xa]=u[Qa]=u[ti]=u[ei]=u[ri]=u[oi]=u[ai]=u[ii]=u[ni]=u[si]=!1;function bi(t){return v(t)&&z(t.length)&&!!u[w(t)]}var _e=bi;function vi(t){return function(e){return t(e)}}var Y=vi;var Ee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,it=Ee&&typeof module=="object"&&module&&!module.nodeType&&module,Ti=it&&it.exports===Ee,Gt=Ti&&mt.process,wi=(function(){try{var t=it&&it.require&&it.require("util").types;return t||Gt&&Gt.binding&&Gt.binding("util")}catch{}})(),S=wi;var Fe=S&&S.isTypedArray,Pi=Fe?Y(Fe):_e,Ce=Pi;var Oi=Object.prototype,ji=Oi.hasOwnProperty;function Ai(t,e){var r=g(t),o=!r&&W(t),a=!r&&!o&&bt(t),n=!r&&!o&&!a&&Ce(t),i=r||o||a||n,s=i?Pe(t.length,String):[],f=s.length;for(var p in t)(e||ji.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||n&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||U(p,f)))&&s.push(p);return s}var vt=Ai;function Si(t,e){return function(r){return t(e(r))}}var Tt=Si;var Ii=Tt(Object.keys,Object),Me=Ii;var _i=Object.prototype,Ei=_i.hasOwnProperty;function Fi(t){if(!K(t))return Me(t);var e=[];for(var r in Object(t))Ei.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ne=Fi;function Ci(t){return yt(t)?vt(t):Ne(t)}var $=Ci;function Mi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Re=Mi;var Ni=Object.prototype,Ri=Ni.hasOwnProperty;function Li(t){if(!P(t))return Re(t);var e=K(t),r=[];for(var o in t)o=="constructor"&&(e||!Ri.call(t,o))||r.push(o);return r}var Le=Li;function Bi(t){return yt(t)?vt(t,!0):Le(t)}var H=Bi;var Di=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ki=/^\w*$/;function Ui(t,e){if(g(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||D(t)?!0:ki.test(t)||!Di.test(t)||e!=null&&t in Object(e)}var Be=Ui;var Gi=T(Object,"create"),I=Gi;function zi(){this.__data__=I?I(null):{},this.size=0}var De=zi;function Ki(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ke=Ki;var Wi="__lodash_hash_undefined__",Yi=Object.prototype,$i=Yi.hasOwnProperty;function Hi(t){var e=this.__data__;if(I){var r=e[t];return r===Wi?void 0:r}return $i.call(e,t)?e[t]:void 0}var Ue=Hi;var Vi=Object.prototype,qi=Vi.hasOwnProperty;function Zi(t){var e=this.__data__;return I?e[t]!==void 0:qi.call(e,t)}var Ge=Zi;var Ji="__lodash_hash_undefined__";function Xi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=I&&e===void 0?Ji:e,this}var ze=Xi;function V(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}V.prototype.clear=De;V.prototype.delete=ke;V.prototype.get=Ue;V.prototype.has=Ge;V.prototype.set=ze;var zt=V;function Qi(){this.__data__=[],this.size=0}var Ke=Qi;function tn(t,e){for(var r=t.length;r--;)if(xt(t[r][0],e))return r;return-1}var F=tn;var en=Array.prototype,rn=en.splice;function on(t){var e=this.__data__,r=F(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():rn.call(e,r,1),--this.size,!0}var We=on;function an(t){var e=this.__data__,r=F(e,t);return r<0?void 0:e[r][1]}var Ye=an;function nn(t){return F(this.__data__,t)>-1}var $e=nn;function sn(t,e){var r=this.__data__,o=F(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var He=sn;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=Ke;q.prototype.delete=We;q.prototype.get=Ye;q.prototype.has=$e;q.prototype.set=He;var C=q;var fn=T(c,"Map"),M=fn;function pn(){this.size=0,this.__data__={hash:new zt,map:new(M||C),string:new zt}}var Ve=pn;function ln(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var qe=ln;function mn(t,e){var r=t.__data__;return qe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var N=mn;function un(t){var e=N(this,t).delete(t);return this.size-=e?1:0,e}var Ze=un;function dn(t){return N(this,t).get(t)}var Je=dn;function cn(t){return N(this,t).has(t)}var Xe=cn;function hn(t,e){var r=N(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Qe=hn;function Z(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])}}Z.prototype.clear=Ve;Z.prototype.delete=Ze;Z.prototype.get=Je;Z.prototype.has=Xe;Z.prototype.set=Qe;var nt=Z;var gn="Expected a function";function Kt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(gn);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 i=t.apply(this,o);return r.cache=n.set(a,i)||n,i};return r.cache=new(Kt.Cache||nt),r}Kt.Cache=nt;var tr=Kt;var xn=500;function yn(t){var e=tr(t,function(o){return r.size===xn&&r.clear(),o}),r=e.cache;return e}var er=yn;var bn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vn=/\\(\\)?/g,Tn=er(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(bn,function(r,o,a,n){e.push(a?n.replace(vn,"$1"):o||r)}),e}),rr=Tn;function wn(t){return t==null?"":ne(t)}var or=wn;function Pn(t,e){return g(t)?t:Be(t,e)?[t]:rr(or(t))}var O=Pn;var On=1/0;function jn(t){if(typeof t=="string"||D(t))return t;var e=t+"";return e=="0"&&1/t==-On?"-0":e}var R=jn;function An(t,e){e=O(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[R(e[r++])];return r&&r==o?t:void 0}var wt=An;function Sn(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var J=Sn;var ar=x?x.isConcatSpreadable:void 0;function In(t){return g(t)||W(t)||!!(ar&&t&&t[ar])}var ir=In;function nr(t,e,r,o,a){var n=-1,i=t.length;for(r||(r=ir),a||(a=[]);++n<i;){var s=t[n];e>0&&r(s)?e>1?nr(s,e-1,r,o,a):J(a,s):o||(a[a.length]=s)}return a}var sr=nr;function _n(t){var e=t==null?0:t.length;return e?sr(t,1):[]}var fr=_n;function En(t){return be(we(t,void 0,fr),t+"")}var Pt=En;var Fn=Tt(Object.getPrototypeOf,Object),X=Fn;var Cn="[object Object]",Mn=Function.prototype,Nn=Object.prototype,pr=Mn.toString,Rn=Nn.hasOwnProperty,Ln=pr.call(Object);function Bn(t){if(!v(t)||w(t)!=Cn)return!1;var e=X(t);if(e===null)return!0;var r=Rn.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&pr.call(r)==Ln}var lr=Bn;function Dn(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var n=Array(a);++o<a;)n[o]=t[o+e];return n}var mr=Dn;function kn(){this.__data__=new C,this.size=0}var ur=kn;function Un(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var dr=Un;function Gn(t){return this.__data__.get(t)}var cr=Gn;function zn(t){return this.__data__.has(t)}var hr=zn;var Kn=200;function Wn(t,e){var r=this.__data__;if(r instanceof C){var o=r.__data__;if(!M||o.length<Kn-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new nt(o)}return r.set(t,e),this.size=r.size,this}var gr=Wn;function Q(t){var e=this.__data__=new C(t);this.size=e.size}Q.prototype.clear=ur;Q.prototype.delete=dr;Q.prototype.get=cr;Q.prototype.has=hr;Q.prototype.set=gr;var xr=Q;function Yn(t,e){return t&&j(e,$(e),t)}var yr=Yn;function $n(t,e){return t&&j(e,H(e),t)}var br=$n;var Pr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vr=Pr&&typeof module=="object"&&module&&!module.nodeType&&module,Hn=vr&&vr.exports===Pr,Tr=Hn?c.Buffer:void 0,wr=Tr?Tr.allocUnsafe:void 0;function Vn(t,e){if(e)return t.slice();var r=t.length,o=wr?wr(r):new t.constructor(r);return t.copy(o),o}var Or=Vn;function qn(t,e){for(var r=-1,o=t==null?0:t.length,a=0,n=[];++r<o;){var i=t[r];e(i,r,t)&&(n[a++]=i)}return n}var jr=qn;function Zn(){return[]}var Ot=Zn;var Jn=Object.prototype,Xn=Jn.propertyIsEnumerable,Ar=Object.getOwnPropertySymbols,Qn=Ar?function(t){return t==null?[]:(t=Object(t),jr(Ar(t),function(e){return Xn.call(t,e)}))}:Ot,tt=Qn;function ts(t,e){return j(t,tt(t),e)}var Sr=ts;var es=Object.getOwnPropertySymbols,rs=es?function(t){for(var e=[];t;)J(e,tt(t)),t=X(t);return e}:Ot,jt=rs;function os(t,e){return j(t,jt(t),e)}var Ir=os;function as(t,e,r){var o=e(t);return g(t)?o:J(o,r(t))}var At=as;function is(t){return At(t,$,tt)}var _r=is;function ns(t){return At(t,H,jt)}var St=ns;var ss=T(c,"DataView"),It=ss;var fs=T(c,"Promise"),_t=fs;var ps=T(c,"Set"),Et=ps;var Er="[object Map]",ls="[object Object]",Fr="[object Promise]",Cr="[object Set]",Mr="[object WeakMap]",Nr="[object DataView]",ms=A(It),us=A(M),ds=A(_t),cs=A(Et),hs=A(ht),L=w;(It&&L(new It(new ArrayBuffer(1)))!=Nr||M&&L(new M)!=Er||_t&&L(_t.resolve())!=Fr||Et&&L(new Et)!=Cr||ht&&L(new ht)!=Mr)&&(L=function(t){var e=w(t),r=e==ls?t.constructor:void 0,o=r?A(r):"";if(o)switch(o){case ms:return Nr;case us:return Er;case ds:return Fr;case cs:return Cr;case hs:return Mr}return e});var et=L;var gs=Object.prototype,xs=gs.hasOwnProperty;function ys(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&xs.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Rr=ys;var bs=c.Uint8Array,Wt=bs;function vs(t){var e=new t.constructor(t.byteLength);return new Wt(e).set(new Wt(t)),e}var rt=vs;function Ts(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Lr=Ts;var ws=/\w*$/;function Ps(t){var e=new t.constructor(t.source,ws.exec(t));return e.lastIndex=t.lastIndex,e}var Br=Ps;var Dr=x?x.prototype:void 0,kr=Dr?Dr.valueOf:void 0;function Os(t){return kr?Object(kr.call(t)):{}}var Ur=Os;function js(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Gr=js;var As="[object Boolean]",Ss="[object Date]",Is="[object Map]",_s="[object Number]",Es="[object RegExp]",Fs="[object Set]",Cs="[object String]",Ms="[object Symbol]",Ns="[object ArrayBuffer]",Rs="[object DataView]",Ls="[object Float32Array]",Bs="[object Float64Array]",Ds="[object Int8Array]",ks="[object Int16Array]",Us="[object Int32Array]",Gs="[object Uint8Array]",zs="[object Uint8ClampedArray]",Ks="[object Uint16Array]",Ws="[object Uint32Array]";function Ys(t,e,r){var o=t.constructor;switch(e){case Ns:return rt(t);case As:case Ss:return new o(+t);case Rs:return Lr(t,r);case Ls:case Bs:case Ds:case ks:case Us:case Gs:case zs:case Ks:case Ws:return Gr(t,r);case Is:return new o;case _s:case Cs:return new o(t);case Es:return Br(t);case Fs:return new o;case Ms:return Ur(t)}}var zr=Ys;function $s(t){return typeof t.constructor=="function"&&!K(t)?de(X(t)):{}}var Kr=$s;var Hs="[object Map]";function Vs(t){return v(t)&&et(t)==Hs}var Wr=Vs;var Yr=S&&S.isMap,qs=Yr?Y(Yr):Wr,$r=qs;var Zs="[object Set]";function Js(t){return v(t)&&et(t)==Zs}var Hr=Js;var Vr=S&&S.isSet,Xs=Vr?Y(Vr):Hr,qr=Xs;var Qs=1,tf=2,ef=4,Zr="[object Arguments]",rf="[object Array]",of="[object Boolean]",af="[object Date]",nf="[object Error]",Jr="[object Function]",sf="[object GeneratorFunction]",ff="[object Map]",pf="[object Number]",Xr="[object Object]",lf="[object RegExp]",mf="[object Set]",uf="[object String]",df="[object Symbol]",cf="[object WeakMap]",hf="[object ArrayBuffer]",gf="[object DataView]",xf="[object Float32Array]",yf="[object Float64Array]",bf="[object Int8Array]",vf="[object Int16Array]",Tf="[object Int32Array]",wf="[object Uint8Array]",Pf="[object Uint8ClampedArray]",Of="[object Uint16Array]",jf="[object Uint32Array]",m={};m[Zr]=m[rf]=m[hf]=m[gf]=m[of]=m[af]=m[xf]=m[yf]=m[bf]=m[vf]=m[Tf]=m[ff]=m[pf]=m[Xr]=m[lf]=m[mf]=m[uf]=m[df]=m[wf]=m[Pf]=m[Of]=m[jf]=!0;m[nf]=m[Jr]=m[cf]=!1;function Ft(t,e,r,o,a,n){var i,s=e&Qs,f=e&tf,p=e&ef;if(r&&(i=a?r(t,o,a,n):r(t)),i!==void 0)return i;if(!P(t))return t;var y=g(t);if(y){if(i=Rr(t),!s)return he(t,i)}else{var h=et(t),B=h==Jr||h==sf;if(bt(t))return Or(t,s);if(h==Xr||h==Zr||B&&!a){if(i=f||B?{}:Kr(t),!s)return f?Ir(t,br(i,t)):Sr(t,yr(i,t))}else{if(!m[h])return a?t:{};i=zr(t,h,s)}}n||(n=new xr);var ot=n.get(t);if(ot)return ot;n.set(t,i),qr(t)?t.forEach(function(b){i.add(Ft(b,e,r,b,t,n))}):$r(t)&&t.forEach(function(b,l){i.set(l,Ft(b,e,r,l,t,n))});var st=p?f?St:_r:f?H:$,ft=y?void 0:st(t);return ve(ft||t,function(b,l){ft&&(l=b,b=t[l]),G(i,l,Ft(b,e,r,l,t,n))}),i}var Ct=Ft;var Af=1,Sf=4;function If(t){return Ct(t,Af|Sf)}var Yt=If;function _f(t,e){return t!=null&&e in Object(t)}var Qr=_f;function Ef(t,e,r){e=O(e,t);for(var o=-1,a=e.length,n=!1;++o<a;){var i=R(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}return n||++o!=a?n:(a=t==null?0:t.length,!!a&&z(a)&&U(i,a)&&(g(t)||W(t)))}var to=Ef;function Ff(t,e){return t!=null&&to(t,e,Qr)}var eo=Ff;function Cf(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var ro=Cf;function Mf(t,e){return e.length<2?t:wt(t,mr(e,0,-1))}var oo=Mf;var Nf=Object.prototype,Rf=Nf.hasOwnProperty;function Lf(t,e){e=O(e,t);var r=-1,o=e.length;if(!o)return!0;for(var a=t==null||typeof t!="object"&&typeof t!="function";++r<o;){var n=e[r];if(typeof n=="string"){if(n==="__proto__"&&!Rf.call(t,"__proto__"))return!1;if(n==="constructor"&&r+1<o&&typeof e[r+1]=="string"&&e[r+1]==="prototype"){if(a&&r===0)continue;return!1}}}var i=oo(t,e);return i==null||delete i[R(ro(e))]}var ao=Lf;function Bf(t){return lr(t)?void 0:t}var io=Bf;var Df=1,kf=2,Uf=4,Gf=Pt(function(t,e){var r={};if(t==null)return r;var o=!1;e=ut(e,function(n){return n=O(n,t),o||(o=n.length>1),n}),j(t,St(t),r),o&&(r=Ct(r,Df|kf|Uf,io));for(var a=e.length;a--;)ao(r,e[a]);return r}),$t=Gf;function zf(t,e,r,o){if(!P(t))return t;e=O(e,t);for(var a=-1,n=e.length,i=n-1,s=t;s!=null&&++a<n;){var f=R(e[a]),p=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=i){var y=s[f];p=o?o(y,f,s):void 0,p===void 0&&(p=P(y)?y:U(e[a+1])?[]:{})}G(s,f,p),s=s[f]}return t}var no=zf;function Kf(t,e,r){for(var o=-1,a=e.length,n={};++o<a;){var i=e[o],s=wt(t,i);r(s,i)&&no(n,O(i,t),s)}return n}var so=Kf;function Wf(t,e){return so(t,e,function(r,o){return eo(t,o)})}var fo=Wf;var Yf=Pt(function(t,e){return t==null?{}:fo(t,e)}),Mt=Yf;function po(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 lo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ht=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=lo[r[t]&63];return e};var $f="Invalid number",Hf="Invalid rounding method";var Nt="jedec";var uo="bits",co="byte",ho="bytes",Vf="kbit";var go="array",qf="function",xo="object",Zf="string",yo="exponent",Jf="round";var Rt={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"]}},Xf=[1,1024,1048576,1073741824,1099511627776,0x4000000000000,1152921504606847e3,11805916207174113e5,12089258196146292e8],Qf=[1,1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24],tp=Math.log(1024),ep=Math.log(1e3),mo={si:{isDecimal:!0,ceil:1e3,actualStandard:Nt},iec:{isDecimal:!1,ceil:1024,actualStandard:"iec"},[Nt]:{isDecimal:!1,ceil:1024,actualStandard:Nt}};function rp(t,e){return mo[t]?mo[t]:e===2?{isDecimal:!1,ceil:1024,actualStandard:"iec"}:{isDecimal:!0,ceil:1e3,actualStandard:Nt}}function op(t,e,r,o,a,n,i,s){let f=[];f[0]=t>0?0 .toPrecision(t):0;let p=f[1]=Rt.symbol[e][r?uo:ho][0];return i===yo?0:(o[f[1]]&&(f[1]=o[f[1]]),a&&(f[1]=n[0]||Rt.fullform[e][0]+(r?"bit":co)),i===go?f:i===xo?{value:f[0],symbol:f[1],exponent:0,unit:p}:f.join(s))}function bo(t,e,r,o,a){let n=r?Qf[e]:Xf[e],i=t/n;return o&&(i*=8,i>=a&&e<8&&(i/=a,e++)),{result:i,e}}function ap(t,e,r,o,a,n,i,s,f){let p=t.toPrecision(e);if(p.includes("e")&&r<8){r++;let{result:y}=bo(o,r,a,n,i),h=f>0?Math.pow(10,f):1;p=(h===1?s(y):s(y*h)/h).toPrecision(e)}return{value:p,e:r}}function ip(t,e,r,o,a,n){let i=t;if(e===!0?i=i.toLocaleString():e.length>0?i=i.toLocaleString(e,r):o.length>0&&(i=i.toString().replace(".",o)),a&&n>0){let s=i.toString(),f=o||(s.match(/(\D)/g)||[]).pop()||".",p=s.split(f),y=p[1]||"",h=y.length,B=n-h;i=`${p[0]}${f}${y.padEnd(h+B,"0")}`}return i}function vo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:n="",localeOptions:i={},separator:s="",spacer:f=" ",symbols:p={},standard:y="",output:h=Zf,fullform:B=!1,fullforms:ot=[],exponent:st=-1,roundingMethod:ft=Jf,precision:b=0}={}){let l=st,E=Number(t),d=[],Lt=0,qt="",{isDecimal:pt,ceil:Bt,actualStandard:Dt}=rp(y,o),Zt=B===!0,Jt=E<0,lt=Math[ft];if(typeof t!="bigint"&&isNaN(t))throw new TypeError($f);if(typeof lt!==qf)throw new TypeError(Hf);if(Jt&&(E=-E),E===0)return op(b,Dt,e,p,Zt,ot,h,f);if((l===-1||isNaN(l))&&(l=Math.floor(pt?Math.log(E)/ep:Math.log(E)/tp),l<0&&(l=0)),l>8&&(b>0&&(b+=8-l),l=8),h===yo)return l;let{result:To,e:wo}=bo(E,l,pt,e,Bt);Lt=To,l=wo;let kt=l>0&&a>0?Math.pow(10,a):1;if(d[0]=kt===1?lt(Lt):lt(Lt*kt)/kt,d[0]===Bt&&l<8&&st===-1&&(d[0]=1,l++),b>0){let Xt=ap(d[0],b,l,E,pt,e,Bt,lt,a);d[0]=Xt.value,l=Xt.e}let Po=Rt.symbol[Dt][e?uo:ho];return qt=d[1]=pt&&l===1?e?Vf:"kB":Po[l],Jt&&(d[0]=-d[0]),p[d[1]]&&(d[1]=p[d[1]]),d[0]=ip(d[0],n,i,s,r,a),Zt&&(d[1]=ot[l]||Rt.fullform[Dt][l]+(e?"bit":co)+(d[0]===1?"":"s")),h===go?d:h===xo?{value:d[0],symbol:d[1],exponent:l,unit:qt}:f===" "?`${d[0]} ${d[1]}`:d.join(f)}var _=class t{constructor(e){this.meta={};if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,$t(e,"encodeIdFunction")),e.encodeIdFunction&&typeof e.encodeIdFunction=="function"&&(this.id=e.encodeIdFunction(this.id));let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.created&&typeof this.created=="string"&&(this.created=new Date(this.created)),this.modified&&typeof this.modified=="string"&&(this.modified=new Date(this.modified)),this.accessed&&typeof this.accessed=="string"&&(this.accessed=new Date(this.accessed)),this.isFolder&&(this.files=this.files?.map(o=>{let a=o.path.split(/\//).slice(3).join("/"),n=this.url+"/"+o.name;return o.meta.reflib&&(n=n.replace(/\/project\/download\//,"/project/library/")),new t({tera:this._tera,...o,sbId:o.id,id:o.path,encodeIdFunction:e.encodeIdFunction,path:a,url:n})})),this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=vo(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 Mt(this,["id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){let r=Mt(e,["tera","id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]);return new t(r)}};var Vt=class{constructor(e){this.settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};this.events=po();this.dom={el:null,iframe:null,popup:null,stylesheet:null};this.methods=["handshake","setServerVerbosity","getUser","requireUser","getCredentials","getKindeToken","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getNamespace","setNamespace","listNamespaces","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateRefresh","getProjectFileContents","deleteProjectFile","setProjectFileContents","createProjectFolder","deleteProjectFolder","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiJson","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];this.plugins=[];this.namespaces={};this.acceptPostboxes={};this.initPromise=null;e&&this.set(e)}send(e){let r=Ht();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||Ht(),...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 Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Received message",r),r?.action=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):r?.action=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):r?.action=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r?.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}mountNamespace(e){if(!/^[\w-]+$/.test(e))throw new Error("Namespaces must be alphanumeric + hyphens + underscores");return this.namespaces[e]?Promise.resolve(this.namespaces[e]):Promise.resolve().then(()=>this._mountNamespace(e)).then(()=>this.namespaces[e]||Promise.reject(`teraFy.mountNamespace('${e}') resolved but no namespace has been mounted`))}_mountNamespace(e){throw console.warn(`teraFy._mountNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`),new Error("teraFy._mountNamespace() is not supported")}unmountNamespace(e){return this.namespaces[e]?this._unmountNamespace(e):Promise.resolve()}_unmountNamespace(e){console.warn(`teraFy.unbindNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`)}init(e){if(e&&this.set(e),this.initPromise)return this.initPromise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.initPromise=Promise.resolve().then(()=>this.settings.session||="tfy-"+this.getEntropicString(16)).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths?this.settings.debugPaths=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")})()):this.settings.debugPaths=null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw new Error(`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"),r)).catch(o=>{throw this.debug("WARN",0,"Init process fault",o),o}),this.initPromise}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("TIMEOUT"),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e()).catch(r)})).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,"Embedded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let n=0,i,s=setTimeout(()=>{clearTimeout(i),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++n),clearTimeout(i),i=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(s),clearTimeout(i)}).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.append(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){return this.methods.forEach(e=>this[e]=this.rpc.bind(this,e)),Promise.resolve()}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initializer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){let o=[],a=r;do o.unshift(a);while(a=Object.getPrototypeOf(a));o.forEach(n=>Object.getOwnPropertyNames(n).filter(i=>!["constructor","init","prototype","name"].includes(i)&&!i.startsWith("__")).forEach(i=>{typeof r[i]=="function"?Object.defineProperty(e,i,{enumerable:!1,value:r[i].bind(e)}):e[i]=r[i]}))}toggleDevMode(e="toggle"){return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),this.dom?.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCodePoint(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(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,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new _({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new _({tera:this,...r}))}moveProjectFile(e,r,o){return this.rpc("moveProjectFile",e,r,o).then(a=>a?new _({tera:this,...a}):null)}};export{Vt as default};
3
3
  /*! Bundled license information:
4
4
 
5
5
  lodash-es/lodash.js:
@@ -13,12 +13,12 @@ lodash-es/lodash.js:
13
13
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
14
14
  *)
15
15
 
16
- filesize/dist/filesize.esm.js:
16
+ filesize/dist/filesize.js:
17
17
  (**
18
18
  * filesize
19
19
  *
20
- * @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
20
+ * @copyright 2025 Jason Mulligan <jason.mulligan@avoidwork.com>
21
21
  * @license BSD-3-Clause
22
- * @version 10.1.6
22
+ * @version 11.0.13
23
23
  *)
24
24
  */
@@ -435,7 +435,7 @@ export default class TeraFyServer {
435
435
  * @property {String} id Unique identifier of the user
436
436
  * @property {String} email The email address of the current user
437
437
  * @property {String} name The provided full name of the user
438
- * @property {Boolean} isSubscribed Whether the active user has a TERA subscription
438
+ * @property {Boolean} isMember Whether the active user has a TERA Membership
439
439
  */
440
440
 
441
441
  /**
@@ -443,7 +443,7 @@ export default class TeraFyServer {
443
443
  *
444
444
  * @param {Object} [options] Additional options to mutate behaviour
445
445
  * @param {Boolean} [options.forceRetry=false] Forcabily try to refresh the user state
446
- * @param {Boolean} [options.waitPromises=true] Wait for $auth + $subscriptions to resolve before fetching the user (mainly internal use)
446
+ * @param {Boolean} [options.waitPromises=true] Wait for $auth + $membership to resolve before fetching the user (mainly internal use)
447
447
  *
448
448
  * @returns {Promise<User>} The current logged in user or null if none
449
449
  */
@@ -455,12 +455,12 @@ export default class TeraFyServer {
455
455
  };
456
456
 
457
457
  const $auth = app.service('$auth');
458
- const $subscriptions = app.service('$subscriptions');
458
+ const $membership = app.service('$membership');
459
459
 
460
460
  return Promise.resolve()
461
461
  .then(()=> settings.waitPromises && Promise.all([
462
462
  $auth.promise(),
463
- $subscriptions.promise(),
463
+ $membership.promise(),
464
464
  ]))
465
465
  .then(()=> {
466
466
  if (!$auth.isLoggedIn && settings.forceRetry)
@@ -474,7 +474,7 @@ export default class TeraFyServer {
474
474
  $auth.user.given_name,
475
475
  $auth.user.family_name,
476
476
  ].filter(Boolean).join(' '),
477
- isSubscribed: $subscriptions.isSubscribed,
477
+ isMember: $membership.isMember,
478
478
  credits: $auth.active?.credits ?? 0,
479
479
  }
480
480
  : null
@@ -1146,7 +1146,8 @@ export default class TeraFyServer {
1146
1146
  .then(()=> app.service('$projects').promise())
1147
1147
  .then(()=> settings.autoRequire && this.requireProject())
1148
1148
  .then(()=>
1149
- app.service('$projects').activeFiles.length == 0 // If we have no files in the cache
1149
+ !app.service('$projects').activeFiles // List of project files not ready yet
1150
+ || app.service('$projects').activeFiles.length == 0 // OR if we have no files in the cache
1150
1151
  || !settings.lazy // OR lazy/cache use is disabled
1151
1152
  ? app.service('$projects').refreshFiles({ // Go refresh files first
1152
1153
  lazy: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iebh/tera-fy",
3
- "version": "2.3.5",
3
+ "version": "2.3.7",
4
4
  "description": "TERA website worker",
5
5
  "scripts": {
6
6
  "dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.ts --outfile=dist/terafy.js --minify --serve --servedir=.",
@@ -117,7 +117,7 @@
117
117
  "uuid": "^13.0.0"
118
118
  },
119
119
  "devDependencies": {
120
- "@momsfriendlydevco/eslint-config": "^2.3.1",
120
+ "@momsfriendlydevco/eslint-config": "^2.4.1",
121
121
  "@release-it/conventional-changelog": "^10.0.5",
122
122
  "@types/detect-port": "^2.0.0",
123
123
  "@types/http-proxy": "^1.17.17",
@@ -130,7 +130,7 @@
130
130
  "conventional-changelog-eslint": "^6.1.0",
131
131
  "documentation": "^14.0.3",
132
132
  "esbuild": "^0.27.3",
133
- "eslint": "^10.0.3",
133
+ "eslint": "^10.1.0",
134
134
  "eslint-plugin": "^1.0.1",
135
135
  "globals": "^17.4.0",
136
136
  "nodemon": "^3.1.14",
@@ -140,7 +140,7 @@
140
140
  "peerDependencies": {
141
141
  "@iebh/reflib": "^2.5.4",
142
142
  "@supabase/supabase-js": "^2.48.1",
143
- "firebase": "^11.3.1",
143
+ "firebase": "^12.11.0",
144
144
  "vue": "^3.0.0"
145
145
  },
146
146
  "optionalDependencies": {