@iebh/tera-fy 1.15.1 → 1.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.15.2](https://github.com/IEBH/TERA-fy/compare/v1.15.1...v1.15.2) (2024-11-18)
4
+
5
+
6
+ ### devops
7
+
8
+ * Build step for bootstrapper ([7fd53fd](https://github.com/IEBH/TERA-fy/commit/7fd53fd34052e7ba21c7b0b444cb35be7472b43b))
9
+
10
+ ### docs
11
+
12
+ * Various docs fixups ([df14fac](https://github.com/IEBH/TERA-fy/commit/df14face922bdfff9cbfcb7056c4c66d7bae8b4e))
13
+
14
+ ### feat
15
+
16
+ * Initial build of the bootstrapper component ([f334645](https://github.com/IEBH/TERA-fy/commit/f334645c47b4c4416bc45f7c670e1d2f11a2b829))
17
+ * Prep for .use(url:String) being supported in future ([463c3d9](https://github.com/IEBH/TERA-fy/commit/463c3d96efd9368e9b61d8ab37b4ca5593e31142))
18
+
19
+ ### fix
20
+
21
+ * Dont expect the DOM element always being present ([0f97dc4](https://github.com/IEBH/TERA-fy/commit/0f97dc4bba70eba6b069ece70cf7b291c9707fde))
22
+ * Error in IIF ([6b84c69](https://github.com/IEBH/TERA-fy/commit/6b84c698368f5d021504e6acb945d06818c4ef0f))
23
+ * Misspelling ([2950e57](https://github.com/IEBH/TERA-fy/commit/2950e57ca7d58b795876f0e7cae0fae43d4ff04a))
24
+ * Removed pointles registry setting ([66291f2](https://github.com/IEBH/TERA-fy/commit/66291f2c5b6c341cc20972bae3c767fe929e27b8))
25
+
26
+ ### task
27
+
28
+ * Rebuild lock ([bfe1ba0](https://github.com/IEBH/TERA-fy/commit/bfe1ba00eb27372ac44d6926d289d1d505078ac5))
29
+
3
30
  ## [1.15.1](https://github.com/IEBH/TERA-fy/compare/v1.15.0...v1.15.1) (2024-11-14)
4
31
 
5
32
 
package/api.md CHANGED
@@ -568,7 +568,7 @@ Include a TeraFy client plugin
568
568
 
569
569
  #### Parameters
570
570
 
571
- * `mod` **[Object][155]** The module function to include. Invoked as `(teraClient:TeraFy, options:Object)`
571
+ * `source` **([Object][155] | [String][154])** Either the JS module function to include or the URL to fetch it from. Eventually invoked as `(teraClient:TeraFy, options:Object)`
572
572
  * `options` **[Object][155]?** Additional options to mutate behaviour during construction (pass options to init() to intialize later options)
573
573
 
574
574
  Returns **[TeraFy][30]** This chainable terafy instance
@@ -0,0 +1,17 @@
1
+ var Pe=Object.defineProperty;var Ee=(t,e,r)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Z=(t,e,r)=>Ee(t,typeof e!="symbol"?e+"":e,r);var Me=typeof global=="object"&&global&&global.Object===Object&&global,N=Me;var De=typeof self=="object"&&self&&self.Object===Object&&self,Re=N||De||Function("return this")(),d=Re;var Be=d.Symbol,_=Be;var st=Object.prototype,Le=st.hasOwnProperty,Fe=st.toString,M=_?_.toStringTag:void 0;function Ne(t){var e=Le.call(t,M),r=t[M];try{t[M]=void 0;var o=!0}catch{}var a=Fe.call(t);return o&&(e?t[M]=r:delete t[M]),a}var pt=Ne;var ze=Object.prototype,We=ze.toString;function Ue(t){return We.call(t)}var it=Ue;var Ge="[object Null]",He="[object Undefined]",nt=_?_.toStringTag:void 0;function qe(t){return t==null?t===void 0?He:Ge:nt&&nt in Object(t)?pt(t):it(t)}var h=qe;function $e(t){return t!=null&&typeof t=="object"}var x=$e;var Ke=Array.isArray,D=Ke;function Ve(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var u=Ve;function ke(t){return t}var z=ke;var Ye="[object AsyncFunction]",Je="[object Function]",Xe="[object GeneratorFunction]",Ze="[object Proxy]";function Qe(t){if(!u(t))return!1;var e=h(t);return e==Je||e==Xe||e==Ye||e==Ze}var O=Qe;var tr=d["__core-js_shared__"],W=tr;var ut=function(){var t=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function er(t){return!!ut&&ut in t}var lt=er;var rr=Function.prototype,or=rr.toString;function ar(t){if(t!=null){try{return or.call(t)}catch{}try{return t+""}catch{}}return""}var mt=ar;var fr=/[\\^$.*+?()[\]{}|]/g,sr=/^\[object .+?Constructor\]$/,pr=Function.prototype,ir=Object.prototype,nr=pr.toString,ur=ir.hasOwnProperty,lr=RegExp("^"+nr.call(ur).replace(fr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function mr(t){if(!u(t)||lt(t))return!1;var e=O(t)?lr:sr;return e.test(mt(t))}var dt=mr;function dr(t,e){return t==null?void 0:t[e]}var xt=dr;function xr(t,e){var r=xt(t,e);return dt(r)?r:void 0}var T=xr;var ct=Object.create,cr=function(){function t(){}return function(e){if(!u(e))return{};if(ct)return ct(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ht=cr;function hr(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 gt=hr;function gr(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var yt=gr;var yr=800,br=16,vr=Date.now;function _r(t){var e=0,r=0;return function(){var o=vr(),a=br-(o-r);if(r=o,a>0){if(++e>=yr)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var bt=_r;function Or(t){return function(){return t}}var vt=Or;var Tr=function(){try{var t=T(Object,"defineProperty");return t({},"",{}),t}catch{}}(),j=Tr;var jr=j?function(t,e){return j(t,"toString",{configurable:!0,enumerable:!1,value:vt(e),writable:!0})}:z,_t=jr;var wr=bt(_t),Ot=wr;var Ar=9007199254740991,Ir=/^(?:0|[1-9]\d*)$/;function Cr(t,e){var r=typeof t;return e=e==null?Ar:e,!!e&&(r=="number"||r!="symbol"&&Ir.test(t))&&t>-1&&t%1==0&&t<e}var U=Cr;function Sr(t,e,r){e=="__proto__"&&j?j(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var w=Sr;function Pr(t,e){return t===e||t!==t&&e!==e}var g=Pr;var Er=Object.prototype,Mr=Er.hasOwnProperty;function Dr(t,e,r){var o=t[e];(!(Mr.call(t,e)&&g(o,r))||r===void 0&&!(e in t))&&w(t,e,r)}var Tt=Dr;function Rr(t,e,r,o){var a=!r;r||(r={});for(var s=-1,p=e.length;++s<p;){var f=e[s],n=o?o(r[f],t[f],f,r,t):void 0;n===void 0&&(n=t[f]),a?w(r,f,n):Tt(r,f,n)}return r}var jt=Rr;var wt=Math.max;function Br(t,e,r){return e=wt(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=wt(o.length-e,0),p=Array(s);++a<s;)p[a]=o[e+a];a=-1;for(var f=Array(e+1);++a<e;)f[a]=o[a];return f[e]=r(p),gt(t,this,f)}}var At=Br;function Lr(t,e){return Ot(At(t,e,z),t+"")}var It=Lr;var Fr=9007199254740991;function Nr(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Fr}var G=Nr;function zr(t){return t!=null&&G(t.length)&&!O(t)}var A=zr;function Wr(t,e,r){if(!u(r))return!1;var o=typeof e;return(o=="number"?A(r)&&U(e,r.length):o=="string"&&e in r)?g(r[e],t):!1}var Ct=Wr;function Ur(t){return It(function(e,r){var o=-1,a=r.length,s=a>1?r[a-1]:void 0,p=a>2?r[2]:void 0;for(s=t.length>3&&typeof s=="function"?(a--,s):void 0,p&&Ct(r[0],r[1],p)&&(s=a<3?void 0:s,a=1),e=Object(e);++o<a;){var f=r[o];f&&t(e,f,o,s)}return e})}var St=Ur;var Gr=Object.prototype;function Hr(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Gr;return t===r}var H=Hr;function qr(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Pt=qr;var $r="[object Arguments]";function Kr(t){return x(t)&&h(t)==$r}var Q=Kr;var Et=Object.prototype,Vr=Et.hasOwnProperty,kr=Et.propertyIsEnumerable,Yr=Q(function(){return arguments}())?Q:function(t){return x(t)&&Vr.call(t,"callee")&&!kr.call(t,"callee")},R=Yr;function Jr(){return!1}var Mt=Jr;var Bt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dt=Bt&&typeof module=="object"&&module&&!module.nodeType&&module,Xr=Dt&&Dt.exports===Bt,Rt=Xr?d.Buffer:void 0,Zr=Rt?Rt.isBuffer:void 0,Qr=Zr||Mt,q=Qr;var to="[object Arguments]",eo="[object Array]",ro="[object Boolean]",oo="[object Date]",ao="[object Error]",fo="[object Function]",so="[object Map]",po="[object Number]",io="[object Object]",no="[object RegExp]",uo="[object Set]",lo="[object String]",mo="[object WeakMap]",xo="[object ArrayBuffer]",co="[object DataView]",ho="[object Float32Array]",go="[object Float64Array]",yo="[object Int8Array]",bo="[object Int16Array]",vo="[object Int32Array]",_o="[object Uint8Array]",Oo="[object Uint8ClampedArray]",To="[object Uint16Array]",jo="[object Uint32Array]",i={};i[ho]=i[go]=i[yo]=i[bo]=i[vo]=i[_o]=i[Oo]=i[To]=i[jo]=!0;i[to]=i[eo]=i[xo]=i[ro]=i[co]=i[oo]=i[ao]=i[fo]=i[so]=i[po]=i[io]=i[no]=i[uo]=i[lo]=i[mo]=!1;function wo(t){return x(t)&&G(t.length)&&!!i[h(t)]}var Lt=wo;function Ao(t){return function(e){return t(e)}}var Ft=Ao;var Nt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,B=Nt&&typeof module=="object"&&module&&!module.nodeType&&module,Io=B&&B.exports===Nt,tt=Io&&N.process,Co=function(){try{var t=B&&B.require&&B.require("util").types;return t||tt&&tt.binding&&tt.binding("util")}catch{}}(),et=Co;var zt=et&&et.isTypedArray,So=zt?Ft(zt):Lt,$=So;var Po=Object.prototype,Eo=Po.hasOwnProperty;function Mo(t,e){var r=D(t),o=!r&&R(t),a=!r&&!o&&q(t),s=!r&&!o&&!a&&$(t),p=r||o||a||s,f=p?Pt(t.length,String):[],n=f.length;for(var m in t)(e||Eo.call(t,m))&&!(p&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||U(m,n)))&&f.push(m);return f}var Wt=Mo;function Do(t,e){return function(r){return t(e(r))}}var Ut=Do;function Ro(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Gt=Ro;var Bo=Object.prototype,Lo=Bo.hasOwnProperty;function Fo(t){if(!u(t))return Gt(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Lo.call(t,o))||r.push(o);return r}var Ht=Fo;function No(t){return A(t)?Wt(t,!0):Ht(t)}var K=No;var zo=T(Object,"create"),c=zo;function Wo(){this.__data__=c?c(null):{},this.size=0}var qt=Wo;function Uo(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var $t=Uo;var Go="__lodash_hash_undefined__",Ho=Object.prototype,qo=Ho.hasOwnProperty;function $o(t){var e=this.__data__;if(c){var r=e[t];return r===Go?void 0:r}return qo.call(e,t)?e[t]:void 0}var Kt=$o;var Ko=Object.prototype,Vo=Ko.hasOwnProperty;function ko(t){var e=this.__data__;return c?e[t]!==void 0:Vo.call(e,t)}var Vt=ko;var Yo="__lodash_hash_undefined__";function Jo(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=c&&e===void 0?Yo:e,this}var kt=Jo;function I(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])}}I.prototype.clear=qt;I.prototype.delete=$t;I.prototype.get=Kt;I.prototype.has=Vt;I.prototype.set=kt;var rt=I;function Xo(){this.__data__=[],this.size=0}var Yt=Xo;function Zo(t,e){for(var r=t.length;r--;)if(g(t[r][0],e))return r;return-1}var y=Zo;var Qo=Array.prototype,ta=Qo.splice;function ea(t){var e=this.__data__,r=y(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():ta.call(e,r,1),--this.size,!0}var Jt=ea;function ra(t){var e=this.__data__,r=y(e,t);return r<0?void 0:e[r][1]}var Xt=ra;function oa(t){return y(this.__data__,t)>-1}var Zt=oa;function aa(t,e){var r=this.__data__,o=y(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Qt=aa;function C(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])}}C.prototype.clear=Yt;C.prototype.delete=Jt;C.prototype.get=Xt;C.prototype.has=Zt;C.prototype.set=Qt;var b=C;var fa=T(d,"Map"),V=fa;function sa(){this.size=0,this.__data__={hash:new rt,map:new(V||b),string:new rt}}var te=sa;function pa(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ee=pa;function ia(t,e){var r=t.__data__;return ee(e)?r[typeof e=="string"?"string":"hash"]:r.map}var v=ia;function na(t){var e=v(this,t).delete(t);return this.size-=e?1:0,e}var re=na;function ua(t){return v(this,t).get(t)}var oe=ua;function la(t){return v(this,t).has(t)}var ae=la;function ma(t,e){var r=v(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var fe=ma;function S(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])}}S.prototype.clear=te;S.prototype.delete=re;S.prototype.get=oe;S.prototype.has=ae;S.prototype.set=fe;var se=S;var da=Ut(Object.getPrototypeOf,Object),k=da;var xa="[object Object]",ca=Function.prototype,ha=Object.prototype,pe=ca.toString,ga=ha.hasOwnProperty,ya=pe.call(Object);function ba(t){if(!x(t)||h(t)!=xa)return!1;var e=k(t);if(e===null)return!0;var r=ga.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&pe.call(r)==ya}var ie=ba;function va(){this.__data__=new b,this.size=0}var ne=va;function _a(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var ue=_a;function Oa(t){return this.__data__.get(t)}var le=Oa;function Ta(t){return this.__data__.has(t)}var me=Ta;var ja=200;function wa(t,e){var r=this.__data__;if(r instanceof b){var o=r.__data__;if(!V||o.length<ja-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new se(o)}return r.set(t,e),this.size=r.size,this}var de=wa;function P(t){var e=this.__data__=new b(t);this.size=e.size}P.prototype.clear=ne;P.prototype.delete=ue;P.prototype.get=le;P.prototype.has=me;P.prototype.set=de;var xe=P;var ye=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ce=ye&&typeof module=="object"&&module&&!module.nodeType&&module,Aa=ce&&ce.exports===ye,he=Aa?d.Buffer:void 0,ge=he?he.allocUnsafe:void 0;function Ia(t,e){if(e)return t.slice();var r=t.length,o=ge?ge(r):new t.constructor(r);return t.copy(o),o}var be=Ia;var Ca=d.Uint8Array,ot=Ca;function Sa(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}var ve=Sa;function Pa(t,e){var r=e?ve(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var _e=Pa;function Ea(t){return typeof t.constructor=="function"&&!H(t)?ht(k(t)):{}}var Oe=Ea;function Ma(t){return function(e,r,o){for(var a=-1,s=Object(e),p=o(e),f=p.length;f--;){var n=p[t?f:++a];if(r(s[n],n,s)===!1)break}return e}}var Te=Ma;var Da=Te(),je=Da;function Ra(t,e,r){(r!==void 0&&!g(t[e],r)||r===void 0&&!(e in t))&&w(t,e,r)}var L=Ra;function Ba(t){return x(t)&&A(t)}var we=Ba;function La(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var F=La;function Fa(t){return jt(t,K(t))}var Ae=Fa;function Na(t,e,r,o,a,s,p){var f=F(t,r),n=F(e,r),m=p.get(n);if(m){L(t,r,m);return}var l=s?s(f,n,r+"",t,e,p):void 0,E=l===void 0;if(E){var J=D(n),X=!J&&q(n),ft=!J&&!X&&$(n);l=n,J||X||ft?D(f)?l=f:we(f)?l=yt(f):X?(E=!1,l=be(n,!0)):ft?(E=!1,l=_e(n,!0)):l=[]:ie(n)||R(n)?(l=f,R(f)?l=Ae(f):(!u(f)||O(f))&&(l=Oe(n))):E=!1}E&&(p.set(n,l),a(l,n,o,s,p),p.delete(n)),L(t,r,l)}var Ie=Na;function Ce(t,e,r,o,a){t!==e&&je(e,function(s,p){if(a||(a=new xe),u(s))Ie(t,e,p,r,Ce,o,a);else{var f=o?o(F(t,p),s,p+"",t,e,a):void 0;f===void 0&&(f=s),L(t,p,f)}},K)}var Se=Ce;var za=St(function(t,e,r){Se(t,e,r)}),Y=za;var at=class{constructor(e){Z(this,"settings",{client:"tera-fy",clientType:"esm"});Z(this,"bootstrapperDeferredMethods",[]);e&&Y(this.settings,e),["set","setIfDev","use"].forEach(r=>{this[r]=(...o)=>(this.bootstrapperDeferredMethods.push({method:r,args:o}),this)})}init(e){let r=o=>`https://dev.tera-tools.com/api/tera-fy/${o}.js`;return Promise.resolve().then(()=>this.settings.clientType=="esm"?this.bootstrapperImport(r(this.settings.client)).then(o=>typeof o=="function"?o:Promise.reject("Tera-fy import didn't return a class")):Promise.reject(`Unsupported TERA-fy clientType "${this.settings.clientType}"`)).then(o=>{let a=new o;if(!a.mixin)throw new Error("TERA-fy client doesnt expose a mixin() method");a.mixin(this,a),Y(this.settings,a.settings,this.settings)}).then(()=>{if(console.log("IAM",this),!this.init||typeof this.init!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a init() method");if(!this.detectMode||typeof this.detectMode!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a detectMode() method")}).then(()=>this.bootstrapperDeferredMethods.reduce((o,a)=>a.method=="use"&&typeof a.args[0]=="string"?(console.log("TERA-FY DEFERRED-USE",a.args[0]),this.bootstrapperImport(r(a.args[0])).then(s=>typeof s=="function"?s:Promise.reject("Tera-fy plugin import didn't return a class")).then(s=>this.use(s,...a.args.slice(1)))):(console.log("TERA-FY DEFERRED-METHOD",a),this[a.method].apply(this,a.args))),Promise.resolve()).then(()=>delete this.bootstrapperDeferredMethods).then(()=>console.log("TYBS","Init")).then(()=>this.init.call(this,e))}bootstrapperImport(e){return new Promise((r,o)=>{let a=`installTFyBS${Math.random().toString(36).slice(2)}`,s=document.createElement("script");s.type="module",s.textContent=`
2
+ import mod from '${e}';
3
+ window['installMod${a}'](mod);
4
+ `;let p=()=>console.warn("CLEANUP",a);window[`installMod${a}`]=f=>{console.log("Accept module from",e,"=",f),r(f),p()},s.onerror=f=>{console.log("post onerror",window[a]),o(new Error(`Failed to load module from ${e}`)),p()},document.head.appendChild(s)})}};export{at as default};
5
+ /*! Bundled license information:
6
+
7
+ lodash-es/lodash.js:
8
+ (**
9
+ * @license
10
+ * Lodash (Custom Build) <https://lodash.com/>
11
+ * Build: `lodash modularize exports="es" -o ./`
12
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
13
+ * Released under MIT license <https://lodash.com/license>
14
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
15
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
16
+ *)
17
+ */
@@ -0,0 +1,17 @@
1
+ var Se=typeof global=="object"&&global&&global.Object===Object&&global,N=Se;var Pe=typeof self=="object"&&self&&self.Object===Object&&self,Ee=N||Pe||Function("return this")(),d=Ee;var Me=d.Symbol,_=Me;var ft=Object.prototype,De=ft.hasOwnProperty,Re=ft.toString,M=_?_.toStringTag:void 0;function Be(t){var e=De.call(t,M),r=t[M];try{t[M]=void 0;var o=!0}catch{}var a=Re.call(t);return o&&(e?t[M]=r:delete t[M]),a}var st=Be;var Le=Object.prototype,Fe=Le.toString;function Ne(t){return Fe.call(t)}var pt=Ne;var ze="[object Null]",We="[object Undefined]",it=_?_.toStringTag:void 0;function Ue(t){return t==null?t===void 0?We:ze:it&&it in Object(t)?st(t):pt(t)}var h=Ue;function Ge(t){return t!=null&&typeof t=="object"}var x=Ge;var He=Array.isArray,D=He;function qe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var u=qe;function $e(t){return t}var z=$e;var Ke="[object AsyncFunction]",Ve="[object Function]",ke="[object GeneratorFunction]",Ye="[object Proxy]";function Je(t){if(!u(t))return!1;var e=h(t);return e==Ve||e==ke||e==Ke||e==Ye}var O=Je;var Xe=d["__core-js_shared__"],W=Xe;var nt=function(){var t=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Ze(t){return!!nt&&nt in t}var ut=Ze;var Qe=Function.prototype,tr=Qe.toString;function er(t){if(t!=null){try{return tr.call(t)}catch{}try{return t+""}catch{}}return""}var lt=er;var rr=/[\\^$.*+?()[\]{}|]/g,or=/^\[object .+?Constructor\]$/,ar=Function.prototype,fr=Object.prototype,sr=ar.toString,pr=fr.hasOwnProperty,ir=RegExp("^"+sr.call(pr).replace(rr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function nr(t){if(!u(t)||ut(t))return!1;var e=O(t)?ir:or;return e.test(lt(t))}var mt=nr;function ur(t,e){return t?.[e]}var dt=ur;function lr(t,e){var r=dt(t,e);return mt(r)?r:void 0}var T=lr;var xt=Object.create,mr=function(){function t(){}return function(e){if(!u(e))return{};if(xt)return xt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ct=mr;function dr(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 ht=dr;function xr(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var gt=xr;var cr=800,hr=16,gr=Date.now;function yr(t){var e=0,r=0;return function(){var o=gr(),a=hr-(o-r);if(r=o,a>0){if(++e>=cr)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var yt=yr;function br(t){return function(){return t}}var bt=br;var vr=function(){try{var t=T(Object,"defineProperty");return t({},"",{}),t}catch{}}(),j=vr;var _r=j?function(t,e){return j(t,"toString",{configurable:!0,enumerable:!1,value:bt(e),writable:!0})}:z,vt=_r;var Or=yt(vt),_t=Or;var Tr=9007199254740991,jr=/^(?:0|[1-9]\d*)$/;function wr(t,e){var r=typeof t;return e=e??Tr,!!e&&(r=="number"||r!="symbol"&&jr.test(t))&&t>-1&&t%1==0&&t<e}var U=wr;function Ar(t,e,r){e=="__proto__"&&j?j(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var w=Ar;function Ir(t,e){return t===e||t!==t&&e!==e}var g=Ir;var Cr=Object.prototype,Sr=Cr.hasOwnProperty;function Pr(t,e,r){var o=t[e];(!(Sr.call(t,e)&&g(o,r))||r===void 0&&!(e in t))&&w(t,e,r)}var Ot=Pr;function Er(t,e,r,o){var a=!r;r||(r={});for(var s=-1,p=e.length;++s<p;){var f=e[s],n=o?o(r[f],t[f],f,r,t):void 0;n===void 0&&(n=t[f]),a?w(r,f,n):Ot(r,f,n)}return r}var Tt=Er;var jt=Math.max;function Mr(t,e,r){return e=jt(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=jt(o.length-e,0),p=Array(s);++a<s;)p[a]=o[e+a];a=-1;for(var f=Array(e+1);++a<e;)f[a]=o[a];return f[e]=r(p),ht(t,this,f)}}var wt=Mr;function Dr(t,e){return _t(wt(t,e,z),t+"")}var At=Dr;var Rr=9007199254740991;function Br(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Rr}var G=Br;function Lr(t){return t!=null&&G(t.length)&&!O(t)}var A=Lr;function Fr(t,e,r){if(!u(r))return!1;var o=typeof e;return(o=="number"?A(r)&&U(e,r.length):o=="string"&&e in r)?g(r[e],t):!1}var It=Fr;function Nr(t){return At(function(e,r){var o=-1,a=r.length,s=a>1?r[a-1]:void 0,p=a>2?r[2]:void 0;for(s=t.length>3&&typeof s=="function"?(a--,s):void 0,p&&It(r[0],r[1],p)&&(s=a<3?void 0:s,a=1),e=Object(e);++o<a;){var f=r[o];f&&t(e,f,o,s)}return e})}var Ct=Nr;var zr=Object.prototype;function Wr(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||zr;return t===r}var H=Wr;function Ur(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var St=Ur;var Gr="[object Arguments]";function Hr(t){return x(t)&&h(t)==Gr}var Z=Hr;var Pt=Object.prototype,qr=Pt.hasOwnProperty,$r=Pt.propertyIsEnumerable,Kr=Z(function(){return arguments}())?Z:function(t){return x(t)&&qr.call(t,"callee")&&!$r.call(t,"callee")},R=Kr;function Vr(){return!1}var Et=Vr;var Rt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mt=Rt&&typeof module=="object"&&module&&!module.nodeType&&module,kr=Mt&&Mt.exports===Rt,Dt=kr?d.Buffer:void 0,Yr=Dt?Dt.isBuffer:void 0,Jr=Yr||Et,q=Jr;var Xr="[object Arguments]",Zr="[object Array]",Qr="[object Boolean]",to="[object Date]",eo="[object Error]",ro="[object Function]",oo="[object Map]",ao="[object Number]",fo="[object Object]",so="[object RegExp]",po="[object Set]",io="[object String]",no="[object WeakMap]",uo="[object ArrayBuffer]",lo="[object DataView]",mo="[object Float32Array]",xo="[object Float64Array]",co="[object Int8Array]",ho="[object Int16Array]",go="[object Int32Array]",yo="[object Uint8Array]",bo="[object Uint8ClampedArray]",vo="[object Uint16Array]",_o="[object Uint32Array]",i={};i[mo]=i[xo]=i[co]=i[ho]=i[go]=i[yo]=i[bo]=i[vo]=i[_o]=!0;i[Xr]=i[Zr]=i[uo]=i[Qr]=i[lo]=i[to]=i[eo]=i[ro]=i[oo]=i[ao]=i[fo]=i[so]=i[po]=i[io]=i[no]=!1;function Oo(t){return x(t)&&G(t.length)&&!!i[h(t)]}var Bt=Oo;function To(t){return function(e){return t(e)}}var Lt=To;var Ft=typeof exports=="object"&&exports&&!exports.nodeType&&exports,B=Ft&&typeof module=="object"&&module&&!module.nodeType&&module,jo=B&&B.exports===Ft,Q=jo&&N.process,wo=function(){try{var t=B&&B.require&&B.require("util").types;return t||Q&&Q.binding&&Q.binding("util")}catch{}}(),tt=wo;var Nt=tt&&tt.isTypedArray,Ao=Nt?Lt(Nt):Bt,$=Ao;var Io=Object.prototype,Co=Io.hasOwnProperty;function So(t,e){var r=D(t),o=!r&&R(t),a=!r&&!o&&q(t),s=!r&&!o&&!a&&$(t),p=r||o||a||s,f=p?St(t.length,String):[],n=f.length;for(var m in t)(e||Co.call(t,m))&&!(p&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||U(m,n)))&&f.push(m);return f}var zt=So;function Po(t,e){return function(r){return t(e(r))}}var Wt=Po;function Eo(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ut=Eo;var Mo=Object.prototype,Do=Mo.hasOwnProperty;function Ro(t){if(!u(t))return Ut(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Do.call(t,o))||r.push(o);return r}var Gt=Ro;function Bo(t){return A(t)?zt(t,!0):Gt(t)}var K=Bo;var Lo=T(Object,"create"),c=Lo;function Fo(){this.__data__=c?c(null):{},this.size=0}var Ht=Fo;function No(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var qt=No;var zo="__lodash_hash_undefined__",Wo=Object.prototype,Uo=Wo.hasOwnProperty;function Go(t){var e=this.__data__;if(c){var r=e[t];return r===zo?void 0:r}return Uo.call(e,t)?e[t]:void 0}var $t=Go;var Ho=Object.prototype,qo=Ho.hasOwnProperty;function $o(t){var e=this.__data__;return c?e[t]!==void 0:qo.call(e,t)}var Kt=$o;var Ko="__lodash_hash_undefined__";function Vo(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=c&&e===void 0?Ko:e,this}var Vt=Vo;function I(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])}}I.prototype.clear=Ht;I.prototype.delete=qt;I.prototype.get=$t;I.prototype.has=Kt;I.prototype.set=Vt;var et=I;function ko(){this.__data__=[],this.size=0}var kt=ko;function Yo(t,e){for(var r=t.length;r--;)if(g(t[r][0],e))return r;return-1}var y=Yo;var Jo=Array.prototype,Xo=Jo.splice;function Zo(t){var e=this.__data__,r=y(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Xo.call(e,r,1),--this.size,!0}var Yt=Zo;function Qo(t){var e=this.__data__,r=y(e,t);return r<0?void 0:e[r][1]}var Jt=Qo;function ta(t){return y(this.__data__,t)>-1}var Xt=ta;function ea(t,e){var r=this.__data__,o=y(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Zt=ea;function C(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])}}C.prototype.clear=kt;C.prototype.delete=Yt;C.prototype.get=Jt;C.prototype.has=Xt;C.prototype.set=Zt;var b=C;var ra=T(d,"Map"),V=ra;function oa(){this.size=0,this.__data__={hash:new et,map:new(V||b),string:new et}}var Qt=oa;function aa(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var te=aa;function fa(t,e){var r=t.__data__;return te(e)?r[typeof e=="string"?"string":"hash"]:r.map}var v=fa;function sa(t){var e=v(this,t).delete(t);return this.size-=e?1:0,e}var ee=sa;function pa(t){return v(this,t).get(t)}var re=pa;function ia(t){return v(this,t).has(t)}var oe=ia;function na(t,e){var r=v(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var ae=na;function S(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])}}S.prototype.clear=Qt;S.prototype.delete=ee;S.prototype.get=re;S.prototype.has=oe;S.prototype.set=ae;var fe=S;var ua=Wt(Object.getPrototypeOf,Object),k=ua;var la="[object Object]",ma=Function.prototype,da=Object.prototype,se=ma.toString,xa=da.hasOwnProperty,ca=se.call(Object);function ha(t){if(!x(t)||h(t)!=la)return!1;var e=k(t);if(e===null)return!0;var r=xa.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&se.call(r)==ca}var pe=ha;function ga(){this.__data__=new b,this.size=0}var ie=ga;function ya(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var ne=ya;function ba(t){return this.__data__.get(t)}var ue=ba;function va(t){return this.__data__.has(t)}var le=va;var _a=200;function Oa(t,e){var r=this.__data__;if(r instanceof b){var o=r.__data__;if(!V||o.length<_a-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new fe(o)}return r.set(t,e),this.size=r.size,this}var me=Oa;function P(t){var e=this.__data__=new b(t);this.size=e.size}P.prototype.clear=ie;P.prototype.delete=ne;P.prototype.get=ue;P.prototype.has=le;P.prototype.set=me;var de=P;var ge=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xe=ge&&typeof module=="object"&&module&&!module.nodeType&&module,Ta=xe&&xe.exports===ge,ce=Ta?d.Buffer:void 0,he=ce?ce.allocUnsafe:void 0;function ja(t,e){if(e)return t.slice();var r=t.length,o=he?he(r):new t.constructor(r);return t.copy(o),o}var ye=ja;var wa=d.Uint8Array,rt=wa;function Aa(t){var e=new t.constructor(t.byteLength);return new rt(e).set(new rt(t)),e}var be=Aa;function Ia(t,e){var r=e?be(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var ve=Ia;function Ca(t){return typeof t.constructor=="function"&&!H(t)?ct(k(t)):{}}var _e=Ca;function Sa(t){return function(e,r,o){for(var a=-1,s=Object(e),p=o(e),f=p.length;f--;){var n=p[t?f:++a];if(r(s[n],n,s)===!1)break}return e}}var Oe=Sa;var Pa=Oe(),Te=Pa;function Ea(t,e,r){(r!==void 0&&!g(t[e],r)||r===void 0&&!(e in t))&&w(t,e,r)}var L=Ea;function Ma(t){return x(t)&&A(t)}var je=Ma;function Da(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var F=Da;function Ra(t){return Tt(t,K(t))}var we=Ra;function Ba(t,e,r,o,a,s,p){var f=F(t,r),n=F(e,r),m=p.get(n);if(m){L(t,r,m);return}var l=s?s(f,n,r+"",t,e,p):void 0,E=l===void 0;if(E){var J=D(n),X=!J&&q(n),at=!J&&!X&&$(n);l=n,J||X||at?D(f)?l=f:je(f)?l=gt(f):X?(E=!1,l=ye(n,!0)):at?(E=!1,l=ve(n,!0)):l=[]:pe(n)||R(n)?(l=f,R(f)?l=we(f):(!u(f)||O(f))&&(l=_e(n))):E=!1}E&&(p.set(n,l),a(l,n,o,s,p),p.delete(n)),L(t,r,l)}var Ae=Ba;function Ie(t,e,r,o,a){t!==e&&Te(e,function(s,p){if(a||(a=new de),u(s))Ae(t,e,p,r,Ie,o,a);else{var f=o?o(F(t,p),s,p+"",t,e,a):void 0;f===void 0&&(f=s),L(t,p,f)}},K)}var Ce=Ie;var La=Ct(function(t,e,r){Ce(t,e,r)}),Y=La;var ot=class{settings={client:"tera-fy",clientType:"esm"};init(e){let r=o=>`https://dev.tera-tools.com/api/tera-fy/${o}.js`;return Promise.resolve().then(()=>this.settings.clientType=="esm"?this.bootstrapperImport(r(this.settings.client)).then(o=>typeof o=="function"?o:Promise.reject("Tera-fy import didn't return a class")):Promise.reject(`Unsupported TERA-fy clientType "${this.settings.clientType}"`)).then(o=>{let a=new o;if(!a.mixin)throw new Error("TERA-fy client doesnt expose a mixin() method");a.mixin(this,a),Y(this.settings,a.settings,this.settings)}).then(()=>{if(console.log("IAM",this),!this.init||typeof this.init!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a init() method");if(!this.detectMode||typeof this.detectMode!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a detectMode() method")}).then(()=>this.bootstrapperDeferredMethods.reduce((o,a)=>a.method=="use"&&typeof a.args[0]=="string"?(console.log("TERA-FY DEFERRED-USE",a.args[0]),this.bootstrapperImport(r(a.args[0])).then(s=>typeof s=="function"?s:Promise.reject("Tera-fy plugin import didn't return a class")).then(s=>this.use(s,...a.args.slice(1)))):(console.log("TERA-FY DEFERRED-METHOD",a),this[a.method].apply(this,a.args))),Promise.resolve()).then(()=>delete this.bootstrapperDeferredMethods).then(()=>console.log("TYBS","Init")).then(()=>this.init.call(this,e))}bootstrapperDeferredMethods=[];bootstrapperImport(e){return new Promise((r,o)=>{let a=`installTFyBS${Math.random().toString(36).slice(2)}`,s=document.createElement("script");s.type="module",s.textContent=`
2
+ import mod from '${e}';
3
+ window['installMod${a}'](mod);
4
+ `;let p=()=>console.warn("CLEANUP",a);window[`installMod${a}`]=f=>{console.log("Accept module from",e,"=",f),r(f),p()},s.onerror=f=>{console.log("post onerror",window[a]),o(new Error(`Failed to load module from ${e}`)),p()},document.head.appendChild(s)})}constructor(e){e&&Y(this.settings,e),["set","setIfDev","use"].forEach(r=>{this[r]=(...o)=>(this.bootstrapperDeferredMethods.push({method:r,args:o}),this)})}};export{ot as default};
5
+ /*! Bundled license information:
6
+
7
+ lodash-es/lodash.js:
8
+ (**
9
+ * @license
10
+ * Lodash (Custom Build) <https://lodash.com/>
11
+ * Build: `lodash modularize exports="es" -o ./`
12
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
13
+ * Released under MIT license <https://lodash.com/license>
14
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
15
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
16
+ *)
17
+ */
@@ -1,5 +1,5 @@
1
1
  var uo=Object.defineProperty;var co=(t,e,r)=>e in t?uo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e,r)=>co(t,typeof e!="symbol"?e+"":e,r);function qt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:x,diffs:v}){var P=Object.keys(i),O=P.length,y=Object.keys(f),_=y.length,b,p=i.length-f.length;if(xo(i,f)){for(var u=0;u<O;u++){var l=Array.isArray(i)?Number(P[u]):P[u];l in f||(b=x.concat(l),v.remove.push({op:"remove",path:r(b)}))}for(var u=0;u<_;u++){var l=Array.isArray(f)?Number(y[u]):y[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:v})}}else{for(var u=0;u<p;u++)b=x.concat(u),v.remove.push({op:"remove",path:r(b)});for(var E=i.slice(p),u=0;u<_;u++)s({key:u,obj1:E,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:v})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:x,pathForRemoves:v,diffs:P}){var O=f[i],y=m[i];if(!(i in f)&&i in m){var _=y;P.add.push({op:"add",path:r(x),value:_})}else O!==y&&(Object(O)!==O||Object(y)!==y||ho(O,y)||!Object.keys(O).length&&!Object.keys(y).length&&String(O)!=String(y)?n(x,P,y):o({obj1:f[i],obj2:m[i],basePath:x,basePathForRemoves:v,diffs:P}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function ho(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function xo(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var go=typeof global=="object"&&global&&global.Object===Object&&global,dt=go;var yo=typeof self=="object"&&self&&self.Object===Object&&self,bo=dt||yo||Function("return this")(),g=bo;var vo=g.Symbol,T=vo;var Yt=Object.prototype,wo=Yt.hasOwnProperty,To=Yt.toString,pt=T?T.toStringTag:void 0;function Oo(t){var e=wo.call(t,pt),r=t[pt];try{t[pt]=void 0;var o=!0}catch{}var a=To.call(t);return o&&(e?t[pt]=r:delete t[pt]),a}var Zt=Oo;var Ao=Object.prototype,Po=Ao.toString;function jo(t){return Po.call(t)}var Jt=jo;var So="[object Null]",Io="[object Undefined]",Xt=T?T.toStringTag:void 0;function _o(t){return t==null?t===void 0?Io:So:Xt&&Xt in Object(t)?Zt(t):Jt(t)}var I=_o;function Eo(t){return t!=null&&typeof t=="object"}var S=Eo;var Co="[object Symbol]";function Fo(t){return typeof t=="symbol"||S(t)&&I(t)==Co}var K=Fo;function Mo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var Qt=Mo;var Ro=Array.isArray,w=Ro;var No=1/0,te=T?T.prototype:void 0,ee=te?te.toString:void 0;function re(t){if(typeof t=="string")return t;if(w(t))return Qt(t,re)+"";if(K(t))return ee?ee.call(t):"";var e=t+"";return e=="0"&&1/t==-No?"-0":e}var oe=re;function Lo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var j=Lo;function Bo(t){return t}var ae=Bo;var ko="[object AsyncFunction]",Uo="[object Function]",Do="[object GeneratorFunction]",zo="[object Proxy]";function Ko(t){if(!j(t))return!1;var e=I(t);return e==Uo||e==Do||e==ko||e==zo}var ct=Ko;var Go=g["__core-js_shared__"],ht=Go;var ie=function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Wo(t){return!!ie&&ie in t}var se=Wo;var $o=Function.prototype,Ho=$o.toString;function Vo(t){if(t!=null){try{return Ho.call(t)}catch{}try{return t+""}catch{}}return""}var C=Vo;var qo=/[\\^$.*+?()[\]{}|]/g,Yo=/^\[object .+?Constructor\]$/,Zo=Function.prototype,Jo=Object.prototype,Xo=Zo.toString,Qo=Jo.hasOwnProperty,ta=RegExp("^"+Xo.call(Qo).replace(qo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ea(t){if(!j(t)||se(t))return!1;var e=ct(t)?ta:Yo;return e.test(C(t))}var ne=ea;function ra(t,e){return t==null?void 0:t[e]}var fe=ra;function oa(t,e){var r=fe(t,e);return ne(r)?r:void 0}var A=oa;var aa=A(g,"WeakMap"),xt=aa;var pe=Object.create,ia=function(){function t(){}return function(e){if(!j(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),le=ia;function sa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var me=sa;function na(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ue=na;var fa=800,pa=16,la=Date.now;function ma(t){var e=0,r=0;return function(){var o=la(),a=pa-(o-r);if(r=o,a>0){if(++e>=fa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var de=ma;function ua(t){return function(){return t}}var ce=ua;var da=function(){try{var t=A(Object,"defineProperty");return t({},"",{}),t}catch{}}(),G=da;var ca=G?function(t,e){return G(t,"toString",{configurable:!0,enumerable:!1,value:ce(e),writable:!0})}:ae,he=ca;var ha=de(he),xe=ha;function xa(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=xa;var ga=9007199254740991,ya=/^(?:0|[1-9]\d*)$/;function ba(t,e){var r=typeof t;return e=e==null?ga:e,!!e&&(r=="number"||r!="symbol"&&ya.test(t))&&t>-1&&t%1==0&&t<e}var W=ba;function va(t,e,r){e=="__proto__"&&G?G(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=va;function wa(t,e){return t===e||t!==t&&e!==e}var yt=wa;var Ta=Object.prototype,Oa=Ta.hasOwnProperty;function Aa(t,e,r){var o=t[e];(!(Oa.call(t,e)&&yt(o,r))||r===void 0&&!(e in t))&&gt(t,e,r)}var $=Aa;function Pa(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?gt(r,i,f):$(r,i,f)}return r}var R=Pa;var ye=Math.max;function ja(t,e,r){return e=ye(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=ye(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),me(t,this,i)}}var be=ja;var Sa=9007199254740991;function Ia(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Sa}var H=Ia;function _a(t){return t!=null&&H(t.length)&&!ct(t)}var bt=_a;var Ea=Object.prototype;function Ca(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ea;return t===r}var V=Ca;function Fa(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ve=Fa;var Ma="[object Arguments]";function Ra(t){return S(t)&&I(t)==Ma}var Mt=Ra;var we=Object.prototype,Na=we.hasOwnProperty,La=we.propertyIsEnumerable,Ba=Mt(function(){return arguments}())?Mt:function(t){return S(t)&&Na.call(t,"callee")&&!La.call(t,"callee")},q=Ba;function ka(){return!1}var Te=ka;var Pe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=Pe&&typeof module=="object"&&module&&!module.nodeType&&module,Ua=Oe&&Oe.exports===Pe,Ae=Ua?g.Buffer:void 0,Da=Ae?Ae.isBuffer:void 0,za=Da||Te,vt=za;var Ka="[object Arguments]",Ga="[object Array]",Wa="[object Boolean]",$a="[object Date]",Ha="[object Error]",Va="[object Function]",qa="[object Map]",Ya="[object Number]",Za="[object Object]",Ja="[object RegExp]",Xa="[object Set]",Qa="[object String]",ti="[object WeakMap]",ei="[object ArrayBuffer]",ri="[object DataView]",oi="[object Float32Array]",ai="[object Float64Array]",ii="[object Int8Array]",si="[object Int16Array]",ni="[object Int32Array]",fi="[object Uint8Array]",pi="[object Uint8ClampedArray]",li="[object Uint16Array]",mi="[object Uint32Array]",h={};h[oi]=h[ai]=h[ii]=h[si]=h[ni]=h[fi]=h[pi]=h[li]=h[mi]=!0;h[Ka]=h[Ga]=h[ei]=h[Wa]=h[ri]=h[$a]=h[Ha]=h[Va]=h[qa]=h[Ya]=h[Za]=h[Ja]=h[Xa]=h[Qa]=h[ti]=!1;function ui(t){return S(t)&&H(t.length)&&!!h[I(t)]}var je=ui;function di(t){return function(e){return t(e)}}var Y=di;var Se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lt=Se&&typeof module=="object"&&module&&!module.nodeType&&module,ci=lt&&lt.exports===Se,Rt=ci&&dt.process,hi=function(){try{var t=lt&&lt.require&&lt.require("util").types;return t||Rt&&Rt.binding&&Rt.binding("util")}catch{}}(),F=hi;var Ie=F&&F.isTypedArray,xi=Ie?Y(Ie):je,_e=xi;var gi=Object.prototype,yi=gi.hasOwnProperty;function bi(t,e){var r=w(t),o=!r&&q(t),a=!r&&!o&&vt(t),s=!r&&!o&&!a&&_e(t),n=r||o||a||s,i=n?ve(t.length,String):[],f=i.length;for(var m in t)(e||yi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||W(m,f)))&&i.push(m);return i}var wt=bi;function vi(t,e){return function(r){return t(e(r))}}var Tt=vi;var wi=Tt(Object.keys,Object),Ee=wi;var Ti=Object.prototype,Oi=Ti.hasOwnProperty;function Ai(t){if(!V(t))return Ee(t);var e=[];for(var r in Object(t))Oi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ce=Ai;function Pi(t){return bt(t)?wt(t):Ce(t)}var Z=Pi;function ji(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Fe=ji;var Si=Object.prototype,Ii=Si.hasOwnProperty;function _i(t){if(!j(t))return Fe(t);var e=V(t),r=[];for(var o in t)o=="constructor"&&(e||!Ii.call(t,o))||r.push(o);return r}var Me=_i;function Ei(t){return bt(t)?wt(t,!0):Me(t)}var J=Ei;var Ci=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fi=/^\w*$/;function Mi(t,e){if(w(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||K(t)?!0:Fi.test(t)||!Ci.test(t)||e!=null&&t in Object(e)}var Re=Mi;var Ri=A(Object,"create"),M=Ri;function Ni(){this.__data__=M?M(null):{},this.size=0}var Ne=Ni;function Li(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Le=Li;var Bi="__lodash_hash_undefined__",ki=Object.prototype,Ui=ki.hasOwnProperty;function Di(t){var e=this.__data__;if(M){var r=e[t];return r===Bi?void 0:r}return Ui.call(e,t)?e[t]:void 0}var Be=Di;var zi=Object.prototype,Ki=zi.hasOwnProperty;function Gi(t){var e=this.__data__;return M?e[t]!==void 0:Ki.call(e,t)}var ke=Gi;var Wi="__lodash_hash_undefined__";function $i(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=M&&e===void 0?Wi:e,this}var Ue=$i;function X(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}X.prototype.clear=Ne;X.prototype.delete=Le;X.prototype.get=Be;X.prototype.has=ke;X.prototype.set=Ue;var Nt=X;function Hi(){this.__data__=[],this.size=0}var De=Hi;function Vi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var N=Vi;var qi=Array.prototype,Yi=qi.splice;function Zi(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Yi.call(e,r,1),--this.size,!0}var ze=Zi;function Ji(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}var Ke=Ji;function Xi(t){return N(this.__data__,t)>-1}var Ge=Xi;function Qi(t,e){var r=this.__data__,o=N(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var We=Qi;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=De;Q.prototype.delete=ze;Q.prototype.get=Ke;Q.prototype.has=Ge;Q.prototype.set=We;var L=Q;var ts=A(g,"Map"),B=ts;function es(){this.size=0,this.__data__={hash:new Nt,map:new(B||L),string:new Nt}}var $e=es;function rs(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var He=rs;function os(t,e){var r=t.__data__;return He(e)?r[typeof e=="string"?"string":"hash"]:r.map}var k=os;function as(t){var e=k(this,t).delete(t);return this.size-=e?1:0,e}var Ve=as;function is(t){return k(this,t).get(t)}var qe=is;function ss(t){return k(this,t).has(t)}var Ye=ss;function ns(t,e){var r=k(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ze=ns;function tt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}tt.prototype.clear=$e;tt.prototype.delete=Ve;tt.prototype.get=qe;tt.prototype.has=Ye;tt.prototype.set=Ze;var mt=tt;var fs="Expected a function";function Lt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(fs);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Lt.Cache||mt),r}Lt.Cache=mt;var Je=Lt;var ps=500;function ls(t){var e=Je(t,function(o){return r.size===ps&&r.clear(),o}),r=e.cache;return e}var Xe=ls;var ms=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,us=/\\(\\)?/g,ds=Xe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ms,function(r,o,a,s){e.push(a?s.replace(us,"$1"):o||r)}),e}),Qe=ds;function cs(t){return t==null?"":oe(t)}var tr=cs;function hs(t,e){return w(t)?t:Re(t,e)?[t]:Qe(tr(t))}var U=hs;var xs=1/0;function gs(t){if(typeof t=="string"||K(t))return t;var e=t+"";return e=="0"&&1/t==-xs?"-0":e}var et=gs;function ys(t,e){e=U(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[et(e[r++])];return r&&r==o?t:void 0}var er=ys;function bs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var rt=bs;var rr=T?T.isConcatSpreadable:void 0;function vs(t){return w(t)||q(t)||!!(rr&&t&&t[rr])}var or=vs;function ar(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=or),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?ar(i,e-1,r,o,a):rt(a,i):o||(a[a.length]=i)}return a}var ir=ar;function ws(t){var e=t==null?0:t.length;return e?ir(t,1):[]}var sr=ws;function Ts(t){return xe(be(t,void 0,sr),t+"")}var nr=Ts;var Os=Tt(Object.getPrototypeOf,Object),Ot=Os;function As(){this.__data__=new L,this.size=0}var fr=As;function Ps(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var pr=Ps;function js(t){return this.__data__.get(t)}var lr=js;function Ss(t){return this.__data__.has(t)}var mr=Ss;var Is=200;function _s(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!B||o.length<Is-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new mt(o)}return r.set(t,e),this.size=r.size,this}var ur=_s;function ot(t){var e=this.__data__=new L(t);this.size=e.size}ot.prototype.clear=fr;ot.prototype.delete=pr;ot.prototype.get=lr;ot.prototype.has=mr;ot.prototype.set=ur;var dr=ot;function Es(t,e){return t&&R(e,Z(e),t)}var cr=Es;function Cs(t,e){return t&&R(e,J(e),t)}var hr=Cs;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xr=br&&typeof module=="object"&&module&&!module.nodeType&&module,Fs=xr&&xr.exports===br,gr=Fs?g.Buffer:void 0,yr=gr?gr.allocUnsafe:void 0;function Ms(t,e){if(e)return t.slice();var r=t.length,o=yr?yr(r):new t.constructor(r);return t.copy(o),o}var vr=Ms;function Rs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var wr=Rs;function Ns(){return[]}var At=Ns;var Ls=Object.prototype,Bs=Ls.propertyIsEnumerable,Tr=Object.getOwnPropertySymbols,ks=Tr?function(t){return t==null?[]:(t=Object(t),wr(Tr(t),function(e){return Bs.call(t,e)}))}:At,at=ks;function Us(t,e){return R(t,at(t),e)}var Or=Us;var Ds=Object.getOwnPropertySymbols,zs=Ds?function(t){for(var e=[];t;)rt(e,at(t)),t=Ot(t);return e}:At,Pt=zs;function Ks(t,e){return R(t,Pt(t),e)}var Ar=Ks;function Gs(t,e,r){var o=e(t);return w(t)?o:rt(o,r(t))}var jt=Gs;function Ws(t){return jt(t,Z,at)}var Pr=Ws;function $s(t){return jt(t,J,Pt)}var jr=$s;var Hs=A(g,"DataView"),St=Hs;var Vs=A(g,"Promise"),It=Vs;var qs=A(g,"Set"),_t=qs;var Sr="[object Map]",Ys="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Cr="[object DataView]",Zs=C(St),Js=C(B),Xs=C(It),Qs=C(_t),tn=C(xt),z=I;(St&&z(new St(new ArrayBuffer(1)))!=Cr||B&&z(new B)!=Sr||It&&z(It.resolve())!=Ir||_t&&z(new _t)!=_r||xt&&z(new xt)!=Er)&&(z=function(t){var e=I(t),r=e==Ys?t.constructor:void 0,o=r?C(r):"";if(o)switch(o){case Zs:return Cr;case Js:return Sr;case Xs:return Ir;case Qs:return _r;case tn:return Er}return e});var it=z;var en=Object.prototype,rn=en.hasOwnProperty;function on(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&rn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Fr=on;var an=g.Uint8Array,Bt=an;function sn(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}var st=sn;function nn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Mr=nn;var fn=/\w*$/;function pn(t){var e=new t.constructor(t.source,fn.exec(t));return e.lastIndex=t.lastIndex,e}var Rr=pn;var Nr=T?T.prototype:void 0,Lr=Nr?Nr.valueOf:void 0;function ln(t){return Lr?Object(Lr.call(t)):{}}var Br=ln;function mn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var kr=mn;var un="[object Boolean]",dn="[object Date]",cn="[object Map]",hn="[object Number]",xn="[object RegExp]",gn="[object Set]",yn="[object String]",bn="[object Symbol]",vn="[object ArrayBuffer]",wn="[object DataView]",Tn="[object Float32Array]",On="[object Float64Array]",An="[object Int8Array]",Pn="[object Int16Array]",jn="[object Int32Array]",Sn="[object Uint8Array]",In="[object Uint8ClampedArray]",_n="[object Uint16Array]",En="[object Uint32Array]";function Cn(t,e,r){var o=t.constructor;switch(e){case vn:return st(t);case un:case dn:return new o(+t);case wn:return Mr(t,r);case Tn:case On:case An:case Pn:case jn:case Sn:case In:case _n:case En:return kr(t,r);case cn:return new o;case hn:case yn:return new o(t);case xn:return Rr(t);case gn:return new o;case bn:return Br(t)}}var Ur=Cn;function Fn(t){return typeof t.constructor=="function"&&!V(t)?le(Ot(t)):{}}var Dr=Fn;var Mn="[object Map]";function Rn(t){return S(t)&&it(t)==Mn}var zr=Rn;var Kr=F&&F.isMap,Nn=Kr?Y(Kr):zr,Gr=Nn;var Ln="[object Set]";function Bn(t){return S(t)&&it(t)==Ln}var Wr=Bn;var $r=F&&F.isSet,kn=$r?Y($r):Wr,Hr=kn;var Un=1,Dn=2,zn=4,Vr="[object Arguments]",Kn="[object Array]",Gn="[object Boolean]",Wn="[object Date]",$n="[object Error]",qr="[object Function]",Hn="[object GeneratorFunction]",Vn="[object Map]",qn="[object Number]",Yr="[object Object]",Yn="[object RegExp]",Zn="[object Set]",Jn="[object String]",Xn="[object Symbol]",Qn="[object WeakMap]",tf="[object ArrayBuffer]",ef="[object DataView]",rf="[object Float32Array]",of="[object Float64Array]",af="[object Int8Array]",sf="[object Int16Array]",nf="[object Int32Array]",ff="[object Uint8Array]",pf="[object Uint8ClampedArray]",lf="[object Uint16Array]",mf="[object Uint32Array]",c={};c[Vr]=c[Kn]=c[tf]=c[ef]=c[Gn]=c[Wn]=c[rf]=c[of]=c[af]=c[sf]=c[nf]=c[Vn]=c[qn]=c[Yr]=c[Yn]=c[Zn]=c[Jn]=c[Xn]=c[ff]=c[pf]=c[lf]=c[mf]=!0;c[$n]=c[qr]=c[Qn]=!1;function Et(t,e,r,o,a,s){var n,i=e&Un,f=e&Dn,m=e&zn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!j(t))return t;var x=w(t);if(x){if(n=Fr(t),!i)return ue(t,n)}else{var v=it(t),P=v==qr||v==Hn;if(vt(t))return vr(t,i);if(v==Yr||v==Vr||P&&!a){if(n=f||P?{}:Dr(t),!i)return f?Ar(t,hr(n,t)):Or(t,cr(n,t))}else{if(!c[v])return a?t:{};n=Ur(t,v,i)}}s||(s=new dr);var O=s.get(t);if(O)return O;s.set(t,n),Hr(t)?t.forEach(function(b){n.add(Et(b,e,r,b,t,s))}):Gr(t)&&t.forEach(function(b,p){n.set(p,Et(b,e,r,p,t,s))});var y=m?f?jr:Pr:f?J:Z,_=x?void 0:y(t);return ge(_||t,function(b,p){_&&(p=b,b=t[p]),$(n,p,Et(b,e,r,p,t,s))}),n}var Zr=Et;var uf=1,df=4;function cf(t){return Zr(t,uf|df)}var kt=cf;function hf(t,e){return t!=null&&e in Object(t)}var Jr=hf;function xf(t,e,r){e=U(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=et(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&H(a)&&W(n,a)&&(w(t)||q(t)))}var Xr=xf;function gf(t,e){return t!=null&&Xr(t,e,Jr)}var Qr=gf;function yf(t,e,r,o){if(!j(t))return t;e=U(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=et(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var x=i[f];m=o?o(x,f,i):void 0,m===void 0&&(m=j(x)?x:W(e[a+1])?[]:{})}$(i,f,m),i=i[f]}return t}var to=yf;function bf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=er(t,n);r(i,n)&&to(s,U(n,t),i)}return s}var eo=bf;function vf(t,e){return eo(t,e,function(r,o){return Qr(t,o)})}var ro=vf;var wf=nr(function(t,e){return t==null?{}:ro(t,e)}),Ct=wf;function oo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var ao="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ut=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=ao[r[t]&63];return e};var Tf="array",Of="bit",io="bits",Af="byte",so="bytes",nt="",Pf="exponent",jf="function",no="iec",Sf="Invalid number",If="Invalid rounding method",Dt="jedec",_f="object",fo=".",Ef="round",Cf="s",Ff="si",Mf="kbit",Rf="kB",Nf=" ",Lf="string",Bf="0",zt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function po(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=nt,localeOptions:n={},separator:i=nt,spacer:f=Nf,symbols:m={},standard:x=nt,output:v=Lf,fullform:P=!1,fullforms:O=[],exponent:y=-1,roundingMethod:_=Ef,precision:b=0}={}){let p=y,u=Number(t),l=[],E=0,Ft=nt;x===Ff?(o=10,x=Dt):x===no||x===Dt?o=2:o===2?x=no:(o=10,x=Dt);let ut=o===10?1e3:1024,lo=P===!0,Gt=u<0,Wt=Math[_];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Sf);if(typeof Wt!==jf)throw new TypeError(If);if(Gt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(ut)),p<0&&(p=0)),p>8&&(b>0&&(b+=8-p),p=8),v===Pf)return p;if(u===0)l[0]=0,Ft=l[1]=zt.symbol[x][e?io:so][p];else{E=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(E=E*8,E>=ut&&p<8&&(E=E/ut,p++));let ft=Math.pow(10,p>0?a:0);l[0]=Wt(E*ft)/ft,l[0]===ut&&p<8&&y===-1&&(l[0]=1,p++),Ft=l[1]=o===10&&p===1?e?Mf:Rf:zt.symbol[x][e?io:so][p]}if(Gt&&(l[0]=-l[0]),b>0&&(l[0]=l[0].toPrecision(b)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(fo,i)),r&&Number.isInteger(l[0])===!1&&a>0){let ft=i||fo,$t=l[0].toString().split(ft),Ht=$t[1]||nt,Vt=Ht.length,mo=a-Vt;l[0]=`${$t[0]}${ft}${Ht.padEnd(Vt+mo,Bf)}`}return lo&&(l[1]=O[p]?O[p]:zt.fullform[x][p]+(e?Of:Af)+(l[0]===1?nt:Cf)),v===Tf?l:v===_f?{value:l[0],symbol:l[1],exponent:p,unit:Ft}:l.join(f)}var D=class t{constructor(e){d(this,"_tera");d(this,"id");d(this,"name");d(this,"icon");d(this,"path");d(this,"url");d(this,"teraUrl");d(this,"parsedName");d(this,"created");d(this,"createdFormatted");d(this,"modified");d(this,"modifiedFormatted");d(this,"accessed");d(this,"accessedFormatted");d(this,"size");d(this,"sizeFormatted");d(this,"mime");d(this,"meta",{});if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=po(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Ct(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Ct(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var Kt=class{constructor(e){d(this,"settings",{session:null,devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"?Object.assign(e,{siteUrl:"https://dev.tera-tools.com/embed",restrictOrigin:"https://dev.tera-tools.com"}):e.restrictOrigin="*"}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"https://tera-tools.com",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null});d(this,"events",oo());d(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});d(this,"methods",["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"]);d(this,"plugins",[]);d(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Ut();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Ut(),...kt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return;let r=e.data;if(!(!r.TERA||!r.id))if(this.debug("INFO",3,"Recieved message",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id])r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response);else{if((r==null?void 0:r.action)=="rpc")return Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})});if((r==null?void 0:r.action)=="event")return Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o});r!=null&&r.id?this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}createProjectStatePatch(e,r){let o=qt(r,e);return this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatch(e){if(this.settings.devMode&&this.settings.debugPaths){if(!Array.isArray(this.settings.debugPaths))throw new Error("teraFyClient.settings.debugPaths should be either null or an Array<String>");let r=e.filter(o=>this.settings.debugPaths.some(a=>o.path.join(".").slice(0,a.length)==a)).map(o=>o.path.join("."));if(r.length>0){console.info("Detected writes to",r,"- entering debugging mode");debugger}}return this.rpc("applyProjectStatePatch",e,{session:this.settings.session})}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>{var o;return(o=this.settings).session||(o.session="tfy-"+this.getEntropicString(16))}).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths=this.settings.debugPaths?Array.isArray(this.settings.debugPaths)?this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):(()=>{throw new Error("Unknown terafyClient.settings.debugPaths type")})():null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[6/6] Init complete")).catch(o=>this.debug("WARN",0,"Init process fault",o))}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let s=0,n,i=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
2
- `),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}toggleDevMode(e="toggle"){return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.dom.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCharCode(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new D({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new D({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new D({tera:this,...r}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new D({tera:this,...r}))}};export{Kt as default};
2
+ `),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof o=="object"?o:typeof o=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initalizer")})(),a=new o(this,r);return this.mixin(this,a),this.plugins.push(a),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}toggleDevMode(e="toggle"){var r;return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,(r=this.dom)!=null&&r.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCharCode(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new D({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new D({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new D({tera:this,...r}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new D({tera:this,...r}))}};export{Kt as default};
3
3
  /*! Bundled license information:
4
4
 
5
5
  lodash-es/lodash.js:
package/dist/terafy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  function Vt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:h,diffs:b}){var A=Object.keys(i),T=A.length,x=Object.keys(f),I=x.length,y,p=i.length-f.length;if(uo(i,f)){for(var u=0;u<T;u++){var l=Array.isArray(i)?Number(A[u]):A[u];l in f||(y=h.concat(l),b.remove.push({op:"remove",path:r(y)}))}for(var u=0;u<I;u++){var l=Array.isArray(f)?Number(x[u]):x[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:b})}}else{for(var u=0;u<p;u++)y=h.concat(u),b.remove.push({op:"remove",path:r(y)});for(var _=i.slice(p),u=0;u<I;u++)s({key:u,obj1:_,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:b})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:h,pathForRemoves:b,diffs:A}){var T=f[i],x=m[i];if(!(i in f)&&i in m){var I=x;A.add.push({op:"add",path:r(h),value:I})}else T!==x&&(Object(T)!==T||Object(x)!==x||mo(T,x)||!Object.keys(T).length&&!Object.keys(x).length&&String(T)!=String(x)?n(h,A,x):o({obj1:f[i],obj2:m[i],basePath:h,basePathForRemoves:b,diffs:A}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function mo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function uo(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var co=typeof global=="object"&&global&&global.Object===Object&&global,ut=co;var ho=typeof self=="object"&&self&&self.Object===Object&&self,go=ut||ho||Function("return this")(),g=go;var xo=g.Symbol,w=xo;var qt=Object.prototype,yo=qt.hasOwnProperty,bo=qt.toString,ft=w?w.toStringTag:void 0;function vo(t){var e=yo.call(t,ft),r=t[ft];try{t[ft]=void 0;var o=!0}catch{}var a=bo.call(t);return o&&(e?t[ft]=r:delete t[ft]),a}var Yt=vo;var wo=Object.prototype,To=wo.toString;function Oo(t){return To.call(t)}var Zt=Oo;var Ao="[object Null]",Po="[object Undefined]",Jt=w?w.toStringTag:void 0;function jo(t){return t==null?t===void 0?Po:Ao:Jt&&Jt in Object(t)?Yt(t):Zt(t)}var S=jo;function So(t){return t!=null&&typeof t=="object"}var j=So;var Io="[object Symbol]";function _o(t){return typeof t=="symbol"||j(t)&&S(t)==Io}var z=_o;function Eo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var Xt=Eo;var Co=Array.isArray,v=Co;var Fo=1/0,Qt=w?w.prototype:void 0,te=Qt?Qt.toString:void 0;function ee(t){if(typeof t=="string")return t;if(v(t))return Xt(t,ee)+"";if(z(t))return te?te.call(t):"";var e=t+"";return e=="0"&&1/t==-Fo?"-0":e}var re=ee;function Mo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var P=Mo;function Ro(t){return t}var oe=Ro;var No="[object AsyncFunction]",Lo="[object Function]",Bo="[object GeneratorFunction]",ko="[object Proxy]";function Uo(t){if(!P(t))return!1;var e=S(t);return e==Lo||e==Bo||e==No||e==ko}var dt=Uo;var Do=g["__core-js_shared__"],ct=Do;var ae=function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function zo(t){return!!ae&&ae in t}var ie=zo;var Ko=Function.prototype,Go=Ko.toString;function Wo(t){if(t!=null){try{return Go.call(t)}catch{}try{return t+""}catch{}}return""}var E=Wo;var $o=/[\\^$.*+?()[\]{}|]/g,Ho=/^\[object .+?Constructor\]$/,Vo=Function.prototype,qo=Object.prototype,Yo=Vo.toString,Zo=qo.hasOwnProperty,Jo=RegExp("^"+Yo.call(Zo).replace($o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Xo(t){if(!P(t)||ie(t))return!1;var e=dt(t)?Jo:Ho;return e.test(E(t))}var se=Xo;function Qo(t,e){return t?.[e]}var ne=Qo;function ta(t,e){var r=ne(t,e);return se(r)?r:void 0}var O=ta;var ea=O(g,"WeakMap"),ht=ea;var fe=Object.create,ra=function(){function t(){}return function(e){if(!P(e))return{};if(fe)return fe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),pe=ra;function oa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var le=oa;function aa(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var me=aa;var ia=800,sa=16,na=Date.now;function fa(t){var e=0,r=0;return function(){var o=na(),a=sa-(o-r);if(r=o,a>0){if(++e>=ia)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ue=fa;function pa(t){return function(){return t}}var de=pa;var la=function(){try{var t=O(Object,"defineProperty");return t({},"",{}),t}catch{}}(),K=la;var ma=K?function(t,e){return K(t,"toString",{configurable:!0,enumerable:!1,value:de(e),writable:!0})}:oe,ce=ma;var ua=ue(ce),he=ua;function da(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=da;var ca=9007199254740991,ha=/^(?:0|[1-9]\d*)$/;function ga(t,e){var r=typeof t;return e=e??ca,!!e&&(r=="number"||r!="symbol"&&ha.test(t))&&t>-1&&t%1==0&&t<e}var G=ga;function xa(t,e,r){e=="__proto__"&&K?K(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=xa;function ya(t,e){return t===e||t!==t&&e!==e}var xt=ya;var ba=Object.prototype,va=ba.hasOwnProperty;function wa(t,e,r){var o=t[e];(!(va.call(t,e)&&xt(o,r))||r===void 0&&!(e in t))&&gt(t,e,r)}var W=wa;function Ta(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?gt(r,i,f):W(r,i,f)}return r}var M=Ta;var xe=Math.max;function Oa(t,e,r){return e=xe(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=xe(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),le(t,this,i)}}var ye=Oa;var Aa=9007199254740991;function Pa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Aa}var $=Pa;function ja(t){return t!=null&&$(t.length)&&!dt(t)}var yt=ja;var Sa=Object.prototype;function Ia(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Sa;return t===r}var H=Ia;function _a(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var be=_a;var Ea="[object Arguments]";function Ca(t){return j(t)&&S(t)==Ea}var Ft=Ca;var ve=Object.prototype,Fa=ve.hasOwnProperty,Ma=ve.propertyIsEnumerable,Ra=Ft(function(){return arguments}())?Ft:function(t){return j(t)&&Fa.call(t,"callee")&&!Ma.call(t,"callee")},V=Ra;function Na(){return!1}var we=Na;var Ae=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Te=Ae&&typeof module=="object"&&module&&!module.nodeType&&module,La=Te&&Te.exports===Ae,Oe=La?g.Buffer:void 0,Ba=Oe?Oe.isBuffer:void 0,ka=Ba||we,bt=ka;var Ua="[object Arguments]",Da="[object Array]",za="[object Boolean]",Ka="[object Date]",Ga="[object Error]",Wa="[object Function]",$a="[object Map]",Ha="[object Number]",Va="[object Object]",qa="[object RegExp]",Ya="[object Set]",Za="[object String]",Ja="[object WeakMap]",Xa="[object ArrayBuffer]",Qa="[object DataView]",ti="[object Float32Array]",ei="[object Float64Array]",ri="[object Int8Array]",oi="[object Int16Array]",ai="[object Int32Array]",ii="[object Uint8Array]",si="[object Uint8ClampedArray]",ni="[object Uint16Array]",fi="[object Uint32Array]",c={};c[ti]=c[ei]=c[ri]=c[oi]=c[ai]=c[ii]=c[si]=c[ni]=c[fi]=!0;c[Ua]=c[Da]=c[Xa]=c[za]=c[Qa]=c[Ka]=c[Ga]=c[Wa]=c[$a]=c[Ha]=c[Va]=c[qa]=c[Ya]=c[Za]=c[Ja]=!1;function pi(t){return j(t)&&$(t.length)&&!!c[S(t)]}var Pe=pi;function li(t){return function(e){return t(e)}}var q=li;var je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pt=je&&typeof module=="object"&&module&&!module.nodeType&&module,mi=pt&&pt.exports===je,Mt=mi&&ut.process,ui=function(){try{var t=pt&&pt.require&&pt.require("util").types;return t||Mt&&Mt.binding&&Mt.binding("util")}catch{}}(),C=ui;var Se=C&&C.isTypedArray,di=Se?q(Se):Pe,Ie=di;var ci=Object.prototype,hi=ci.hasOwnProperty;function gi(t,e){var r=v(t),o=!r&&V(t),a=!r&&!o&&bt(t),s=!r&&!o&&!a&&Ie(t),n=r||o||a||s,i=n?be(t.length,String):[],f=i.length;for(var m in t)(e||hi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||G(m,f)))&&i.push(m);return i}var vt=gi;function xi(t,e){return function(r){return t(e(r))}}var wt=xi;var yi=wt(Object.keys,Object),_e=yi;var bi=Object.prototype,vi=bi.hasOwnProperty;function wi(t){if(!H(t))return _e(t);var e=[];for(var r in Object(t))vi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ee=wi;function Ti(t){return yt(t)?vt(t):Ee(t)}var Y=Ti;function Oi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ce=Oi;var Ai=Object.prototype,Pi=Ai.hasOwnProperty;function ji(t){if(!P(t))return Ce(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Pi.call(t,o))||r.push(o);return r}var Fe=ji;function Si(t){return yt(t)?vt(t,!0):Fe(t)}var Z=Si;var Ii=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_i=/^\w*$/;function Ei(t,e){if(v(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||z(t)?!0:_i.test(t)||!Ii.test(t)||e!=null&&t in Object(e)}var Me=Ei;var Ci=O(Object,"create"),F=Ci;function Fi(){this.__data__=F?F(null):{},this.size=0}var Re=Fi;function Mi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ne=Mi;var Ri="__lodash_hash_undefined__",Ni=Object.prototype,Li=Ni.hasOwnProperty;function Bi(t){var e=this.__data__;if(F){var r=e[t];return r===Ri?void 0:r}return Li.call(e,t)?e[t]:void 0}var Le=Bi;var ki=Object.prototype,Ui=ki.hasOwnProperty;function Di(t){var e=this.__data__;return F?e[t]!==void 0:Ui.call(e,t)}var Be=Di;var zi="__lodash_hash_undefined__";function Ki(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=F&&e===void 0?zi:e,this}var ke=Ki;function J(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}J.prototype.clear=Re;J.prototype.delete=Ne;J.prototype.get=Le;J.prototype.has=Be;J.prototype.set=ke;var Rt=J;function Gi(){this.__data__=[],this.size=0}var Ue=Gi;function Wi(t,e){for(var r=t.length;r--;)if(xt(t[r][0],e))return r;return-1}var R=Wi;var $i=Array.prototype,Hi=$i.splice;function Vi(t){var e=this.__data__,r=R(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Hi.call(e,r,1),--this.size,!0}var De=Vi;function qi(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var ze=qi;function Yi(t){return R(this.__data__,t)>-1}var Ke=Yi;function Zi(t,e){var r=this.__data__,o=R(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Ge=Zi;function X(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}X.prototype.clear=Ue;X.prototype.delete=De;X.prototype.get=ze;X.prototype.has=Ke;X.prototype.set=Ge;var N=X;var Ji=O(g,"Map"),L=Ji;function Xi(){this.size=0,this.__data__={hash:new Rt,map:new(L||N),string:new Rt}}var We=Xi;function Qi(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var $e=Qi;function ts(t,e){var r=t.__data__;return $e(e)?r[typeof e=="string"?"string":"hash"]:r.map}var B=ts;function es(t){var e=B(this,t).delete(t);return this.size-=e?1:0,e}var He=es;function rs(t){return B(this,t).get(t)}var Ve=rs;function os(t){return B(this,t).has(t)}var qe=os;function as(t,e){var r=B(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ye=as;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=We;Q.prototype.delete=He;Q.prototype.get=Ve;Q.prototype.has=qe;Q.prototype.set=Ye;var lt=Q;var is="Expected a function";function Nt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(is);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Nt.Cache||lt),r}Nt.Cache=lt;var Ze=Nt;var ss=500;function ns(t){var e=Ze(t,function(o){return r.size===ss&&r.clear(),o}),r=e.cache;return e}var Je=ns;var fs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ps=/\\(\\)?/g,ls=Je(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(fs,function(r,o,a,s){e.push(a?s.replace(ps,"$1"):o||r)}),e}),Xe=ls;function ms(t){return t==null?"":re(t)}var Qe=ms;function us(t,e){return v(t)?t:Me(t,e)?[t]:Xe(Qe(t))}var k=us;var ds=1/0;function cs(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-ds?"-0":e}var tt=cs;function hs(t,e){e=k(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[tt(e[r++])];return r&&r==o?t:void 0}var tr=hs;function gs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var et=gs;var er=w?w.isConcatSpreadable:void 0;function xs(t){return v(t)||V(t)||!!(er&&t&&t[er])}var rr=xs;function or(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=rr),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?or(i,e-1,r,o,a):et(a,i):o||(a[a.length]=i)}return a}var ar=or;function ys(t){var e=t==null?0:t.length;return e?ar(t,1):[]}var ir=ys;function bs(t){return he(ye(t,void 0,ir),t+"")}var sr=bs;var vs=wt(Object.getPrototypeOf,Object),Tt=vs;function ws(){this.__data__=new N,this.size=0}var nr=ws;function Ts(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var fr=Ts;function Os(t){return this.__data__.get(t)}var pr=Os;function As(t){return this.__data__.has(t)}var lr=As;var Ps=200;function js(t,e){var r=this.__data__;if(r instanceof N){var o=r.__data__;if(!L||o.length<Ps-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new lt(o)}return r.set(t,e),this.size=r.size,this}var mr=js;function rt(t){var e=this.__data__=new N(t);this.size=e.size}rt.prototype.clear=nr;rt.prototype.delete=fr;rt.prototype.get=pr;rt.prototype.has=lr;rt.prototype.set=mr;var ur=rt;function Ss(t,e){return t&&M(e,Y(e),t)}var dr=Ss;function Is(t,e){return t&&M(e,Z(e),t)}var cr=Is;var yr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,hr=yr&&typeof module=="object"&&module&&!module.nodeType&&module,_s=hr&&hr.exports===yr,gr=_s?g.Buffer:void 0,xr=gr?gr.allocUnsafe:void 0;function Es(t,e){if(e)return t.slice();var r=t.length,o=xr?xr(r):new t.constructor(r);return t.copy(o),o}var br=Es;function Cs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var vr=Cs;function Fs(){return[]}var Ot=Fs;var Ms=Object.prototype,Rs=Ms.propertyIsEnumerable,wr=Object.getOwnPropertySymbols,Ns=wr?function(t){return t==null?[]:(t=Object(t),vr(wr(t),function(e){return Rs.call(t,e)}))}:Ot,ot=Ns;function Ls(t,e){return M(t,ot(t),e)}var Tr=Ls;var Bs=Object.getOwnPropertySymbols,ks=Bs?function(t){for(var e=[];t;)et(e,ot(t)),t=Tt(t);return e}:Ot,At=ks;function Us(t,e){return M(t,At(t),e)}var Or=Us;function Ds(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var Pt=Ds;function zs(t){return Pt(t,Y,ot)}var Ar=zs;function Ks(t){return Pt(t,Z,At)}var Pr=Ks;var Gs=O(g,"DataView"),jt=Gs;var Ws=O(g,"Promise"),St=Ws;var $s=O(g,"Set"),It=$s;var jr="[object Map]",Hs="[object Object]",Sr="[object Promise]",Ir="[object Set]",_r="[object WeakMap]",Er="[object DataView]",Vs=E(jt),qs=E(L),Ys=E(St),Zs=E(It),Js=E(ht),D=S;(jt&&D(new jt(new ArrayBuffer(1)))!=Er||L&&D(new L)!=jr||St&&D(St.resolve())!=Sr||It&&D(new It)!=Ir||ht&&D(new ht)!=_r)&&(D=function(t){var e=S(t),r=e==Hs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case Vs:return Er;case qs:return jr;case Ys:return Sr;case Zs:return Ir;case Js:return _r}return e});var at=D;var Xs=Object.prototype,Qs=Xs.hasOwnProperty;function tn(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Qs.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Cr=tn;var en=g.Uint8Array,Lt=en;function rn(t){var e=new t.constructor(t.byteLength);return new Lt(e).set(new Lt(t)),e}var it=rn;function on(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Fr=on;var an=/\w*$/;function sn(t){var e=new t.constructor(t.source,an.exec(t));return e.lastIndex=t.lastIndex,e}var Mr=sn;var Rr=w?w.prototype:void 0,Nr=Rr?Rr.valueOf:void 0;function nn(t){return Nr?Object(Nr.call(t)):{}}var Lr=nn;function fn(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Br=fn;var pn="[object Boolean]",ln="[object Date]",mn="[object Map]",un="[object Number]",dn="[object RegExp]",cn="[object Set]",hn="[object String]",gn="[object Symbol]",xn="[object ArrayBuffer]",yn="[object DataView]",bn="[object Float32Array]",vn="[object Float64Array]",wn="[object Int8Array]",Tn="[object Int16Array]",On="[object Int32Array]",An="[object Uint8Array]",Pn="[object Uint8ClampedArray]",jn="[object Uint16Array]",Sn="[object Uint32Array]";function In(t,e,r){var o=t.constructor;switch(e){case xn:return it(t);case pn:case ln:return new o(+t);case yn:return Fr(t,r);case bn:case vn:case wn:case Tn:case On:case An:case Pn:case jn:case Sn:return Br(t,r);case mn:return new o;case un:case hn:return new o(t);case dn:return Mr(t);case cn:return new o;case gn:return Lr(t)}}var kr=In;function _n(t){return typeof t.constructor=="function"&&!H(t)?pe(Tt(t)):{}}var Ur=_n;var En="[object Map]";function Cn(t){return j(t)&&at(t)==En}var Dr=Cn;var zr=C&&C.isMap,Fn=zr?q(zr):Dr,Kr=Fn;var Mn="[object Set]";function Rn(t){return j(t)&&at(t)==Mn}var Gr=Rn;var Wr=C&&C.isSet,Nn=Wr?q(Wr):Gr,$r=Nn;var Ln=1,Bn=2,kn=4,Hr="[object Arguments]",Un="[object Array]",Dn="[object Boolean]",zn="[object Date]",Kn="[object Error]",Vr="[object Function]",Gn="[object GeneratorFunction]",Wn="[object Map]",$n="[object Number]",qr="[object Object]",Hn="[object RegExp]",Vn="[object Set]",qn="[object String]",Yn="[object Symbol]",Zn="[object WeakMap]",Jn="[object ArrayBuffer]",Xn="[object DataView]",Qn="[object Float32Array]",tf="[object Float64Array]",ef="[object Int8Array]",rf="[object Int16Array]",of="[object Int32Array]",af="[object Uint8Array]",sf="[object Uint8ClampedArray]",nf="[object Uint16Array]",ff="[object Uint32Array]",d={};d[Hr]=d[Un]=d[Jn]=d[Xn]=d[Dn]=d[zn]=d[Qn]=d[tf]=d[ef]=d[rf]=d[of]=d[Wn]=d[$n]=d[qr]=d[Hn]=d[Vn]=d[qn]=d[Yn]=d[af]=d[sf]=d[nf]=d[ff]=!0;d[Kn]=d[Vr]=d[Zn]=!1;function _t(t,e,r,o,a,s){var n,i=e&Ln,f=e&Bn,m=e&kn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!P(t))return t;var h=v(t);if(h){if(n=Cr(t),!i)return me(t,n)}else{var b=at(t),A=b==Vr||b==Gn;if(bt(t))return br(t,i);if(b==qr||b==Hr||A&&!a){if(n=f||A?{}:Ur(t),!i)return f?Or(t,cr(n,t)):Tr(t,dr(n,t))}else{if(!d[b])return a?t:{};n=kr(t,b,i)}}s||(s=new ur);var T=s.get(t);if(T)return T;s.set(t,n),$r(t)?t.forEach(function(y){n.add(_t(y,e,r,y,t,s))}):Kr(t)&&t.forEach(function(y,p){n.set(p,_t(y,e,r,p,t,s))});var x=m?f?Pr:Ar:f?Z:Y,I=h?void 0:x(t);return ge(I||t,function(y,p){I&&(p=y,y=t[p]),W(n,p,_t(y,e,r,p,t,s))}),n}var Yr=_t;var pf=1,lf=4;function mf(t){return Yr(t,pf|lf)}var Bt=mf;function uf(t,e){return t!=null&&e in Object(t)}var Zr=uf;function df(t,e,r){e=k(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=tt(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&$(a)&&G(n,a)&&(v(t)||V(t)))}var Jr=df;function cf(t,e){return t!=null&&Jr(t,e,Zr)}var Xr=cf;function hf(t,e,r,o){if(!P(t))return t;e=k(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=tt(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var h=i[f];m=o?o(h,f,i):void 0,m===void 0&&(m=P(h)?h:G(e[a+1])?[]:{})}W(i,f,m),i=i[f]}return t}var Qr=hf;function gf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=tr(t,n);r(i,n)&&Qr(s,k(n,t),i)}return s}var to=gf;function xf(t,e){return to(t,e,function(r,o){return Xr(t,o)})}var eo=xf;var yf=sr(function(t,e){return t==null?{}:eo(t,e)}),Et=yf;function ro(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var oo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var kt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=oo[r[t]&63];return e};var bf="array",vf="bit",ao="bits",wf="byte",io="bytes",st="",Tf="exponent",Of="function",so="iec",Af="Invalid number",Pf="Invalid rounding method",Ut="jedec",jf="object",no=".",Sf="round",If="s",_f="si",Ef="kbit",Cf="kB",Ff=" ",Mf="string",Rf="0",Dt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function fo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=st,localeOptions:n={},separator:i=st,spacer:f=Ff,symbols:m={},standard:h=st,output:b=Mf,fullform:A=!1,fullforms:T=[],exponent:x=-1,roundingMethod:I=Sf,precision:y=0}={}){let p=x,u=Number(t),l=[],_=0,Ct=st;h===_f?(o=10,h=Ut):h===so||h===Ut?o=2:o===2?h=so:(o=10,h=Ut);let mt=o===10?1e3:1024,po=A===!0,Kt=u<0,Gt=Math[I];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Af);if(typeof Gt!==Of)throw new TypeError(Pf);if(Kt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(mt)),p<0&&(p=0)),p>8&&(y>0&&(y+=8-p),p=8),b===Tf)return p;if(u===0)l[0]=0,Ct=l[1]=Dt.symbol[h][e?ao:io][p];else{_=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(_=_*8,_>=mt&&p<8&&(_=_/mt,p++));let nt=Math.pow(10,p>0?a:0);l[0]=Gt(_*nt)/nt,l[0]===mt&&p<8&&x===-1&&(l[0]=1,p++),Ct=l[1]=o===10&&p===1?e?Ef:Cf:Dt.symbol[h][e?ao:io][p]}if(Kt&&(l[0]=-l[0]),y>0&&(l[0]=l[0].toPrecision(y)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(no,i)),r&&Number.isInteger(l[0])===!1&&a>0){let nt=i||no,Wt=l[0].toString().split(nt),$t=Wt[1]||st,Ht=$t.length,lo=a-Ht;l[0]=`${Wt[0]}${nt}${$t.padEnd(Ht+lo,Rf)}`}return po&&(l[1]=T[p]?T[p]:Dt.fullform[h][p]+(e?vf:wf)+(l[0]===1?st:If)),b===bf?l:b===jf?{value:l[0],symbol:l[1],exponent:p,unit:Ct}:l.join(f)}var U=class t{_tera;id;name;icon;path;url;teraUrl;parsedName;created;createdFormatted;modified;modifiedFormatted;accessed;accessedFormatted;size;sizeFormatted;mime;meta={};constructor(e){if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=fo(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Et(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Et(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var zt=class{settings={session:null,devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"?Object.assign(e,{siteUrl:"https://dev.tera-tools.com/embed",restrictOrigin:"https://dev.tera-tools.com"}):e.restrictOrigin="*"}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"https://tera-tools.com",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};events=ro();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];plugins=[];send(e){let r=kt();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||kt(),...Bt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return;let r=e.data;if(!(!r.TERA||!r.id))if(this.debug("INFO",3,"Recieved message",r),r?.action=="response"&&this.acceptPostboxes[r.id])r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response);else{if(r?.action=="rpc")return Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})});if(r?.action=="event")return Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o});r?.id?this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}acceptPostboxes={};createProjectStatePatch(e,r){let o=Vt(r,e);return this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatch(e){if(this.settings.devMode&&this.settings.debugPaths){if(!Array.isArray(this.settings.debugPaths))throw new Error("teraFyClient.settings.debugPaths should be either null or an Array<String>");let r=e.filter(o=>this.settings.debugPaths.some(a=>o.path.join(".").slice(0,a.length)==a)).map(o=>o.path.join("."));if(r.length>0){console.info("Detected writes to",r,"- entering debugging mode");debugger}}return this.rpc("applyProjectStatePatch",e,{session:this.settings.session})}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}constructor(e){e&&this.set(e)}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.settings.session||="tfy-"+this.getEntropicString(16)).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths=this.settings.debugPaths?Array.isArray(this.settings.debugPaths)?this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):(()=>{throw new Error("Unknown terafyClient.settings.debugPaths type")})():null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[6/6] Init complete")).catch(o=>this.debug("WARN",0,"Init process fault",o))}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let s=0,n,i=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
2
- `),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}toggleDevMode(e="toggle"){return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.dom.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCharCode(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new U({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new U({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new U({tera:this,...r}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new U({tera:this,...r}))}};export{zt as default};
2
+ `),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof o=="object"?o:typeof o=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initalizer")})(),a=new o(this,r);return this.mixin(this,a),this.plugins.push(a),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}toggleDevMode(e="toggle"){return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.dom?.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCharCode(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new U({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new U({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new U({tera:this,...r}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new U({tera:this,...r}))}};export{zt as default};
3
3
  /*! Bundled license information:
4
4
 
5
5
  lodash-es/lodash.js:
@@ -0,0 +1,138 @@
1
+ import {merge} from 'lodash-es';
2
+
3
+ /**
4
+ * Tera-Fy Bootstrapper Client
5
+ * This class loads the "real" Tera-Fy from remote and mutates into it
6
+ *
7
+ * @class TeraFy
8
+ */
9
+ export default class TeraFy {
10
+ settings = {
11
+ client: 'tera-fy', // Client name within https://tera-tools.com/api/tera-fy/<NAME>.js to load
12
+ clientType: 'esm',
13
+ };
14
+
15
+
16
+ /**
17
+ * Download the remote TERA-fy client, initalize it and mix it in with this class instance
18
+ *
19
+ * @param {Object} [options] Additional options to merge into `settings` via `set`
20
+ * @returns {Promise<TeraFy>} An eventual promise which will resovle with this terafy instance
21
+ */
22
+ init(options) {
23
+ // FIXME: Note this needs to point at the live site
24
+ let getUrl = client => `https://dev.tera-tools.com/api/tera-fy/${client}.js`;
25
+
26
+ return Promise.resolve()
27
+ .then(()=>
28
+ this.settings.clientType == 'esm' ?
29
+ this.bootstrapperImport(getUrl(this.settings.client))
30
+ .then(exported => typeof exported == 'function' ? exported : Promise.reject("Tera-fy import didn't return a class"))
31
+ : Promise.reject(`Unsupported TERA-fy clientType "${this.settings.clientType}"`)
32
+ )
33
+ .then(TeraClient => {
34
+ let tc = new TeraClient();
35
+ if (!tc.mixin) throw new Error('TERA-fy client doesnt expose a mixin() method');
36
+
37
+ tc.mixin(this, tc);
38
+
39
+ // Merge settings object
40
+ merge(this.settings, tc.settings, this.settings);
41
+ })
42
+ .then(()=> { // Sanity checks
43
+ console.log('IAM', this);
44
+ if (!this.init || typeof this.init != 'function') throw new Error('Newly mixed-in TERA-fy client doesnt expose a init() method');
45
+ if (!this.detectMode || typeof this.detectMode != 'function') throw new Error('Newly mixed-in TERA-fy client doesnt expose a detectMode() method');
46
+ })
47
+ .then(()=> this.bootstrapperDeferredMethods.reduce((chain, dm) => { // Run all deferred methods as an sequencial promise chain
48
+ if (dm.method == 'use' && typeof dm.args[0] == 'string') { // Wrap `use(pluginClient:String,options:Object)` method to fetch plugin from remote
49
+ console.log('TERA-FY DEFERRED-USE', dm.args[0]);
50
+ return this.bootstrapperImport(getUrl(dm.args[0]))
51
+ .then(exported => typeof exported == 'function' ? exported : Promise.reject("Tera-fy plugin import didn't return a class"))
52
+ .then(mod => this.use(mod, ...dm.args.slice(1)));
53
+ } else {
54
+ console.log('TERA-FY DEFERRED-METHOD', dm);
55
+ return this[dm.method].apply(this, dm.args)
56
+ }
57
+ }), Promise.resolve())
58
+ .then(()=> delete this.bootstrapperDeferredMethods)
59
+ .then(()=> console.log('TYBS', 'Init'))
60
+ .then(()=> this.init.call(this, options))
61
+ }
62
+
63
+
64
+ /**
65
+ * Methods to call post-init when the main TeraFyClient has loaded
66
+ * These are setup during construction
67
+ *
68
+ * @type {Array<Object>}
69
+ */
70
+ bootstrapperDeferredMethods = [];
71
+
72
+
73
+ /**
74
+ * Go fetch a remote URL, inject it as a <script> element and resolve to the exported default
75
+ * This is a fix for the fact that regular import() can't accept URLs
76
+ *
77
+ * @param {String} url The URL to import
78
+ * @returns {*} The default, single export of the module
79
+ */
80
+ bootstrapperImport(url) {
81
+ return new Promise((resolve, reject) => {
82
+ // Create a unique module ID
83
+ const moduleId = `installTFyBS${Math.random().toString(36).slice(2)}`;
84
+
85
+ // Add a wrapper module that will expose the class
86
+ const script = document.createElement('script');
87
+ script.type = 'module';
88
+ script.textContent = `
89
+ import mod from '${url}';
90
+ window['installMod${moduleId}'](mod);
91
+ `;
92
+
93
+ // Create cleanup function
94
+ let cleanup = () => {
95
+ return console.warn('CLEANUP', moduleId);
96
+ delete window[moduleId];
97
+ document.head.removeChild(script);
98
+ }
99
+
100
+ // Create stub function to accept payload + quit
101
+ window[`installMod${moduleId}`] = payload => {
102
+ console.log('Accept module from', url, '=', payload);
103
+ resolve(payload);
104
+ cleanup();
105
+ };
106
+
107
+
108
+ // FIXME: Not sure if this is actually detecting errors? addEventListener instead maybe?
109
+ script.onerror = (error) => {
110
+ console.log('post onerror', window[moduleId]);
111
+ reject(new Error(`Failed to load module from ${url}`));
112
+ cleanup();
113
+ };
114
+
115
+ // Append stub script element and quit
116
+ document.head.appendChild(script);
117
+ });
118
+ }
119
+
120
+
121
+ /**
122
+ * TeraFyBootstrapper constructor
123
+ *
124
+ * @param {String} [options] Optional settings to merge
125
+ */
126
+ constructor(options) {
127
+ // Merge options if provided
128
+ if (options) merge(this.settings, options);
129
+
130
+ // Map various methods to a deferred process so we execute these after init() has grabbed the actual TeraFyClient
131
+ ['set', 'setIfDev', 'use'].forEach(m => {
132
+ this[m] = (...args) => {
133
+ this.bootstrapperDeferredMethods.push({method: m, args});
134
+ return this;
135
+ }
136
+ });
137
+ }
138
+ }
@@ -33,6 +33,8 @@ export default class TeraFy {
33
33
  */
34
34
  settings = {
35
35
  session: null,
36
+ // client: 'tera-fy', // Reserved by terafy.bootstrapper.js
37
+ // clientType: 'esm', // Reserved by terafy.bootstrapper.js
36
38
  devMode: true,
37
39
  verbosity: 1,
38
40
  mode: 'detect',
@@ -718,7 +720,7 @@ export default class TeraFy {
718
720
  }
719
721
  // }}}
720
722
 
721
- // Utility - debug(), use(), mixin(), toggleDevMode(), toggleFocus() {{{
723
+ // Utility - debug(), set(), setIfDev(), use(), mixin(), toggleDevMode(), toggleFocus(), getEntropicString() {{{
722
724
 
723
725
  /* eslint-disable jsdoc/check-param-names */
724
726
  /**
@@ -803,13 +805,16 @@ export default class TeraFy {
803
805
  /**
804
806
  * Include a TeraFy client plugin
805
807
  *
806
- * @param {Object} mod The module function to include. Invoked as `(teraClient:TeraFy, options:Object)`
808
+ * @param {Object|String} source Either the JS module function to include or the URL to fetch it from. Eventually invoked as `(teraClient:TeraFy, options:Object)`
807
809
  * @param {Object} [options] Additional options to mutate behaviour during construction (pass options to init() to intialize later options)
808
810
  *
809
811
  * @returns {TeraFy} This chainable terafy instance
810
812
  */
811
- use(mod, options) {
812
- if (typeof mod != 'function') throw new Error('Expected use() call to be provided with a class initalizer');
813
+ use(source, options) {
814
+ let mod =
815
+ typeof mod == 'object' ? mod
816
+ : typeof mod == 'string' ? (()=> { throw new Error('use(String) is not yet supported') })()
817
+ : (()=> { throw new Error('Expected use() call to be provided with a class initalizer') })();
813
818
 
814
819
  let singleton = new mod(this, options);
815
820
  this.mixin(this, singleton);
@@ -866,7 +871,7 @@ export default class TeraFy {
866
871
  this.settings.devMode = !! devModeEnabled;
867
872
  }
868
873
 
869
- if (this.dom.el) // Have we actually set up yet?
874
+ if (this.dom?.el) // Have we actually set up yet?
870
875
  this.dom.el.classList.toggle('dev-mode', this.settings.devMode);
871
876
 
872
877
  return this;
@@ -1626,9 +1626,19 @@ export default class TeraFyServer {
1626
1626
  body: settings.body,
1627
1627
  bodyHtml: settings.bodyHtml,
1628
1628
  placeholder: settings.placeholder,
1629
- value: settings.valuie,
1629
+ value: settings.value,
1630
1630
  },
1631
- buttons: ['ok', 'cancel'],
1631
+ buttons: [
1632
+ {
1633
+ class: 'btn btn-success',
1634
+ icon: 'fas fa-check',
1635
+ title: 'Ok',
1636
+ click(e) {
1637
+ return this.$prompt.close(true, this.newValue);
1638
+ },
1639
+ },
1640
+ 'cancel',
1641
+ ],
1632
1642
  })
1633
1643
  )
1634
1644
  .then(answer => {
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@iebh/tera-fy",
3
- "version": "1.15.1",
3
+ "version": "1.15.2",
4
4
  "description": "TERA website worker",
5
5
  "scripts": {
6
6
  "dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.js --outfile=dist/terafy.js --minify --serve --servedir=.",
7
7
  "build": "concurrently 'npm:build:*'",
8
8
  "build:client": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.js --outfile=dist/terafy.js --minify",
9
9
  "build:client:es2019": "esbuild --platform=browser --format=esm --target=es2019 --bundle lib/terafy.client.js --outfile=dist/terafy.es2019.js --minify",
10
+ "build:bootstrapper": "esbuild --platform=browser --format=esm --bundle lib/terafy.bootstrapper.js --outfile=dist/terafy.bootstrapper.js --minify",
11
+ "build:bootstrapper:es2019": "esbuild --platform=browser --format=esm --target=es2019 --bundle lib/terafy.bootstrapper.js --outfile=dist/terafy.bootstrapper.es2019.js --minify",
10
12
  "build:plugins:vue2:es2019": "esbuild --platform=browser --format=esm --target=es2019 --bundle plugins/vue2.js --outfile=dist/plugin.vue2.es2019.js --minify",
11
13
  "build:docs:api": "documentation build lib/terafy.client.js lib/projectFile.js --format html --config documentation.yml --output docs/",
12
14
  "build:docs:markdown": "documentation build lib/terafy.client.js lib/projectFile.js --format md --markdown-toc --output api.md",
@@ -26,6 +28,7 @@
26
28
  "require": "./dist/terafy.js",
27
29
  "default": "./dist/terafy.js"
28
30
  },
31
+ "./bootstrap": "./lib/terafy.bootstrap.js",
29
32
  "./dist/*": "./dist/*",
30
33
  "./projectFile": "./lib/projectFile.js",
31
34
  "./proxy": "./lib/terafy.proxy.js",
@@ -84,7 +87,8 @@
84
87
  "concurrently": "^8.2.2",
85
88
  "documentation": "^14.0.3",
86
89
  "esbuild": "^0.23.0",
87
- "eslint": "^9.7.0"
90
+ "eslint": "^9.7.0",
91
+ "nodemon": "^3.1.7"
88
92
  },
89
93
  "peerDependencies": {
90
94
  "vue": "^3.0.0"