@localazy/cdn-client 1.1.2 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  "use strict";var t=Object.defineProperty,e=(e,r,n)=>(((e,r,n)=>{r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n})(e,"symbol"!=typeof r?r+"":r,n),n);
2
- /* @localazy/cdn-client@1.1.2
2
+ /* @localazy/cdn-client@1.2.1
3
3
  * (c) 2024 Localazy <team@localazy.com>
4
4
  * @license MIT */
5
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("axios");class n{constructor(t){e(this,"context"),this.context=t}async fetchLocale(t){const e={reference:t};if(this.context.cache.has(t))return new Promise((r=>{r({data:this.context.cache.get(t),config:e})}));const r=/\.(json|json5)$/.test(t.metafileFile.file)?"json":"text";return this.context.client.get(t.metafileLocale.uri,{...e,responseType:r})}async fetchMetafile(t){return this.context.client.get(this.context.metafile.params.jsonPath,t)}}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var o="object"==typeof a&&a&&a.Object===Object&&a,s=o,c="object"==typeof self&&self&&self.Object===Object&&self,u=s||c||Function("return this")(),l=u.Symbol,f=l,h=Object.prototype,p=h.hasOwnProperty,v=h.toString,d=f?f.toStringTag:void 0;var b=function(t){var e=p.call(t,d),r=t[d];try{t[d]=void 0;var n=!0}catch(t){}var a=v.call(t);return n&&(e?t[d]=r:delete t[d]),a},y=Object.prototype.toString;var g=b,m=function(t){return y.call(t)},j=l?l.toStringTag:void 0;var w=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":j&&j in Object(t)?g(t):m(t)};var _=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},x=w,O=_;var F=function(t){if(!O(t))return!1;var e=x(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e};const A=i(F);var L,M=u["__core-js_shared__"],S=(L=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+L:"";var R=function(t){return!!S&&S in t},E=Function.prototype.toString;var I=function(t){if(null!=t){try{return E.call(t)}catch(t){}try{return t+""}catch(t){}}return""},U=F,P=R,q=_,$=I,z=/^\[object .+?Constructor\]$/,C=Function.prototype,B=Object.prototype,T=C.toString,k=B.hasOwnProperty,D=RegExp("^"+T.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var N=function(t){return!(!q(t)||P(t))&&(U(t)?D:z).test($(t))},V=function(t,e){return null==t?void 0:t[e]};var W=function(t,e){var r=V(t,e);return N(r)?r:void 0},G=W(Object,"create"),H=G;var J=function(){this.__data__=H?H(null):{},this.size=0};var K=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Q=G,X=Object.prototype.hasOwnProperty;var Y=function(t){var e=this.__data__;if(Q){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return X.call(e,t)?e[t]:void 0},Z=G,tt=Object.prototype.hasOwnProperty;var et=G;var rt=J,nt=K,at=Y,it=function(t){var e=this.__data__;return Z?void 0!==e[t]:tt.call(e,t)},ot=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=et&&void 0===e?"__lodash_hash_undefined__":e,this};function st(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}st.prototype.clear=rt,st.prototype.delete=nt,st.prototype.get=at,st.prototype.has=it,st.prototype.set=ot;var ct=st;var ut=function(){this.__data__=[],this.size=0};var lt=function(t,e){return t===e||t!=t&&e!=e},ft=lt;var ht=function(t,e){for(var r=t.length;r--;)if(ft(t[r][0],e))return r;return-1},pt=ht,vt=Array.prototype.splice;var dt=ht;var bt=ht;var yt=ht;var gt=ut,mt=function(t){var e=this.__data__,r=pt(e,t);return!(r<0)&&(r==e.length-1?e.pop():vt.call(e,r,1),--this.size,!0)},jt=function(t){var e=this.__data__,r=dt(e,t);return r<0?void 0:e[r][1]},wt=function(t){return bt(this.__data__,t)>-1},_t=function(t,e){var r=this.__data__,n=yt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function xt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}xt.prototype.clear=gt,xt.prototype.delete=mt,xt.prototype.get=jt,xt.prototype.has=wt,xt.prototype.set=_t;var Ot=xt,Ft=W(u,"Map"),At=ct,Lt=Ot,Mt=Ft;var St=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Rt=function(t,e){var r=t.__data__;return St(e)?r["string"==typeof e?"string":"hash"]:r.map},Et=Rt;var It=Rt;var Ut=Rt;var Pt=Rt;var qt=function(){this.size=0,this.__data__={hash:new At,map:new(Mt||Lt),string:new At}},$t=function(t){var e=Et(this,t).delete(t);return this.size-=e?1:0,e},zt=function(t){return It(this,t).get(t)},Ct=function(t){return Ut(this,t).has(t)},Bt=function(t,e){var r=Pt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Tt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Tt.prototype.clear=qt,Tt.prototype.delete=$t,Tt.prototype.get=zt,Tt.prototype.has=Ct,Tt.prototype.set=Bt;var kt=Tt;var Dt=kt,Nt=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Vt=function(t){return this.__data__.has(t)};function Wt(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Dt;++e<r;)this.add(t[e])}Wt.prototype.add=Wt.prototype.push=Nt,Wt.prototype.has=Vt;var Gt=Wt;var Ht=function(t,e,r,n){for(var a=t.length,i=r+(n?1:-1);n?i--:++i<a;)if(e(t[i],i,t))return i;return-1};var Jt=Ht,Kt=function(t){return t!=t},Qt=function(t,e,r){for(var n=r-1,a=t.length;++n<a;)if(t[n]===e)return n;return-1};var Xt=function(t,e,r){return e==e?Qt(t,e,r):Jt(t,Kt,r)};var Yt=function(t,e){return!!(null==t?0:t.length)&&Xt(t,e,0)>-1};var Zt=function(t,e,r){for(var n=-1,a=null==t?0:t.length;++n<a;)if(r(e,t[n]))return!0;return!1};var te=function(t,e){return t.has(e)},ee=W(u,"Set");var re=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},ne=ee,ae=function(){},ie=ne&&1/re(new ne([,-0]))[1]==1/0?function(t){return new ne(t)}:ae,oe=Gt,se=Yt,ce=Zt,ue=te,le=ie,fe=re;var he=function(t,e,r){var n=-1,a=se,i=t.length,o=!0,s=[],c=s;if(r)o=!1,a=ce;else if(i>=200){var u=e?null:le(t);if(u)return fe(u);o=!1,a=ue,c=new oe}else c=e?[]:s;t:for(;++n<i;){var l=t[n],f=e?e(l):l;if(l=r||0!==l?l:0,o&&f==f){for(var h=c.length;h--;)if(c[h]===f)continue t;e&&c.push(f),s.push(l)}else a(c,f,r)||(c!==s&&c.push(f),s.push(l))}return s},pe=he;const ve=i((function(t){return t&&t.length?pe(t):[]}));class de{constructor(){e(this,"map"),this.map=new Map}get(t){return this.map.get(t)}has(t){return this.map.has(t)}set(t,e){this.map.set(t,e)}flush(){this.map=new Map}}class be{constructor(t){e(this,"context"),e(this,"cacheAdapter"),this.context=t,this.cacheAdapter=new de}setIfMissed(t){const{metafileFile:e,metafileLocale:r,data:n}=t,a=this.keyFromMetafile({metafileFile:e,metafileLocale:r});this.cacheAdapter.has(a)||this.cacheAdapter.set(a,n)}has(t){const e=this.keyFromMetafile(t);return this.cacheAdapter.has(e)}get(t){const e=this.keyFromMetafile(t);return this.cacheAdapter.get(e)}flush(){this.cacheAdapter.flush()}keyFromMetafile(t){const{metafileFile:e,metafileLocale:r}=t,n=[...ve(e.productFlavors)].sort().join("-");return[this.context.metafile.params.cdnId,e.id,e.file,e.path,e.library,e.module,e.buildType,n,r.locale,r.timestamp.toString()].filter((t=>""!==t)).join("-")}}var ye=Array.isArray;const ge=i(ye);var me=function(t){return null!=t&&"object"==typeof t},je=w,we=ye,_e=me;const xe=i((function(t){return"string"==typeof t||!we(t)&&_e(t)&&"[object String]"==je(t)}));class Oe{constructor(t){e(this,"context"),this.context=t}}class Fe extends Oe{constructor(){super(...arguments),e(this,"flush",(()=>{this.context.cache.flush()}))}}var Ae=Ot;var Le=Ot,Me=Ft,Se=kt;var Re=Ot,Ee=function(){this.__data__=new Ae,this.size=0},Ie=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Ue=function(t){return this.__data__.get(t)},Pe=function(t){return this.__data__.has(t)},qe=function(t,e){var r=this.__data__;if(r instanceof Le){var n=r.__data__;if(!Me||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Se(n)}return r.set(t,e),this.size=r.size,this};function $e(t){var e=this.__data__=new Re(t);this.size=e.size}$e.prototype.clear=Ee,$e.prototype.delete=Ie,$e.prototype.get=Ue,$e.prototype.has=Pe,$e.prototype.set=qe;var ze=$e;var Ce=Gt,Be=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1},Te=te;var ke=function(t,e,r,n,a,i){var o=1&r,s=t.length,c=e.length;if(s!=c&&!(o&&c>s))return!1;var u=i.get(t),l=i.get(e);if(u&&l)return u==e&&l==t;var f=-1,h=!0,p=2&r?new Ce:void 0;for(i.set(t,e),i.set(e,t);++f<s;){var v=t[f],d=e[f];if(n)var b=o?n(d,v,f,e,t,i):n(v,d,f,t,e,i);if(void 0!==b){if(b)continue;h=!1;break}if(p){if(!Be(e,(function(t,e){if(!Te(p,e)&&(v===t||a(v,t,r,n,i)))return p.push(e)}))){h=!1;break}}else if(v!==d&&!a(v,d,r,n,i)){h=!1;break}}return i.delete(t),i.delete(e),h},De=u.Uint8Array;var Ne=De,Ve=lt,We=ke,Ge=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r},He=re,Je=l?l.prototype:void 0,Ke=Je?Je.valueOf:void 0;var Qe=function(t,e,r,n,a,i,o){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new Ne(t),new Ne(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ve(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var s=Ge;case"[object Set]":var c=1&n;if(s||(s=He),t.size!=e.size&&!c)return!1;var u=o.get(t);if(u)return u==e;n|=2,o.set(t,e);var l=We(s(t),s(e),n,a,i,o);return o.delete(t),l;case"[object Symbol]":if(Ke)return Ke.call(t)==Ke.call(e)}return!1};var Xe=function(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t},Ye=Xe,Ze=ye;var tr=function(t,e,r){var n=e(t);return Ze(t)?n:Ye(n,r(t))};var er=function(t,e){for(var r=-1,n=null==t?0:t.length,a=0,i=[];++r<n;){var o=t[r];e(o,r,t)&&(i[a++]=o)}return i};var rr=function(){return[]},nr=er,ar=rr,ir=Object.prototype.propertyIsEnumerable,or=Object.getOwnPropertySymbols,sr=or?function(t){return null==t?[]:(t=Object(t),nr(or(t),(function(e){return ir.call(t,e)})))}:ar;var cr=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n},ur=w,lr=me;var fr,hr,pr,vr,dr,br,yr,gr,mr=function(t){return lr(t)&&"[object Arguments]"==ur(t)},jr=me,wr=Object.prototype,_r=wr.hasOwnProperty,xr=wr.propertyIsEnumerable,Or=mr(function(){return arguments}())?mr:function(t){return jr(t)&&_r.call(t,"callee")&&!xr.call(t,"callee")},Fr={exports:{}};fr=Fr,pr=u,vr=function(){return!1},dr=(hr=Fr.exports)&&!hr.nodeType&&hr,br=dr&&fr&&!fr.nodeType&&fr,yr=br&&br.exports===dr?pr.Buffer:void 0,gr=(yr?yr.isBuffer:void 0)||vr,fr.exports=gr;var Ar=Fr.exports,Lr=/^(?:0|[1-9]\d*)$/;var Mr=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Lr.test(t))&&t>-1&&t%1==0&&t<e};var Sr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Rr=w,Er=Sr,Ir=me,Ur={};Ur["[object Float32Array]"]=Ur["[object Float64Array]"]=Ur["[object Int8Array]"]=Ur["[object Int16Array]"]=Ur["[object Int32Array]"]=Ur["[object Uint8Array]"]=Ur["[object Uint8ClampedArray]"]=Ur["[object Uint16Array]"]=Ur["[object Uint32Array]"]=!0,Ur["[object Arguments]"]=Ur["[object Array]"]=Ur["[object ArrayBuffer]"]=Ur["[object Boolean]"]=Ur["[object DataView]"]=Ur["[object Date]"]=Ur["[object Error]"]=Ur["[object Function]"]=Ur["[object Map]"]=Ur["[object Number]"]=Ur["[object Object]"]=Ur["[object RegExp]"]=Ur["[object Set]"]=Ur["[object String]"]=Ur["[object WeakMap]"]=!1;var Pr=function(t){return Ir(t)&&Er(t.length)&&!!Ur[Rr(t)]};var qr=function(t){return function(e){return t(e)}},$r={exports:{}};!function(t,e){var r=o,n=e&&!e.nodeType&&e,a=n&&t&&!t.nodeType&&t,i=a&&a.exports===n&&r.process,s=function(){try{var t=a&&a.require&&a.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=s}($r,$r.exports);var zr=$r.exports,Cr=Pr,Br=qr,Tr=zr&&zr.isTypedArray,kr=Tr?Br(Tr):Cr,Dr=cr,Nr=Or,Vr=ye,Wr=Ar,Gr=Mr,Hr=kr,Jr=Object.prototype.hasOwnProperty;var Kr=function(t,e){var r=Vr(t),n=!r&&Nr(t),a=!r&&!n&&Wr(t),i=!r&&!n&&!a&&Hr(t),o=r||n||a||i,s=o?Dr(t.length,String):[],c=s.length;for(var u in t)!e&&!Jr.call(t,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Gr(u,c))||s.push(u);return s},Qr=Object.prototype;var Xr=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Qr)};var Yr=function(t,e){return function(r){return t(e(r))}},Zr=Yr(Object.keys,Object),tn=Xr,en=Zr,rn=Object.prototype.hasOwnProperty;var nn=F,an=Sr;var on=function(t){return null!=t&&an(t.length)&&!nn(t)},sn=Kr,cn=function(t){if(!tn(t))return en(t);var e=[];for(var r in Object(t))rn.call(t,r)&&"constructor"!=r&&e.push(r);return e},un=on;var ln=function(t){return un(t)?sn(t):cn(t)},fn=tr,hn=sr,pn=ln;var vn=function(t){return fn(t,pn,hn)},dn=vn,bn=Object.prototype.hasOwnProperty;var yn=function(t,e,r,n,a,i){var o=1&r,s=dn(t),c=s.length;if(c!=dn(e).length&&!o)return!1;for(var u=c;u--;){var l=s[u];if(!(o?l in e:bn.call(e,l)))return!1}var f=i.get(t),h=i.get(e);if(f&&h)return f==e&&h==t;var p=!0;i.set(t,e),i.set(e,t);for(var v=o;++u<c;){var d=t[l=s[u]],b=e[l];if(n)var y=o?n(b,d,l,e,t,i):n(d,b,l,t,e,i);if(!(void 0===y?d===b||a(d,b,r,n,i):y)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var g=t.constructor,m=e.constructor;g==m||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof m&&m instanceof m||(p=!1)}return i.delete(t),i.delete(e),p},gn=W(u,"DataView"),mn=Ft,jn=W(u,"Promise"),wn=ee,_n=W(u,"WeakMap"),xn=w,On=I,Fn="[object Map]",An="[object Promise]",Ln="[object Set]",Mn="[object WeakMap]",Sn="[object DataView]",Rn=On(gn),En=On(mn),In=On(jn),Un=On(wn),Pn=On(_n),qn=xn;(gn&&qn(new gn(new ArrayBuffer(1)))!=Sn||mn&&qn(new mn)!=Fn||jn&&qn(jn.resolve())!=An||wn&&qn(new wn)!=Ln||_n&&qn(new _n)!=Mn)&&(qn=function(t){var e=xn(t),r="[object Object]"==e?t.constructor:void 0,n=r?On(r):"";if(n)switch(n){case Rn:return Sn;case En:return Fn;case In:return An;case Un:return Ln;case Pn:return Mn}return e});var $n=qn,zn=ze,Cn=ke,Bn=Qe,Tn=yn,kn=$n,Dn=ye,Nn=Ar,Vn=kr,Wn="[object Arguments]",Gn="[object Array]",Hn="[object Object]",Jn=Object.prototype.hasOwnProperty;var Kn=function(t,e,r,n,a,i){var o=Dn(t),s=Dn(e),c=o?Gn:kn(t),u=s?Gn:kn(e),l=(c=c==Wn?Hn:c)==Hn,f=(u=u==Wn?Hn:u)==Hn,h=c==u;if(h&&Nn(t)){if(!Nn(e))return!1;o=!0,l=!1}if(h&&!l)return i||(i=new zn),o||Vn(t)?Cn(t,e,r,n,a,i):Bn(t,e,c,r,n,a,i);if(!(1&r)){var p=l&&Jn.call(t,"__wrapped__"),v=f&&Jn.call(e,"__wrapped__");if(p||v){var d=p?t.value():t,b=v?e.value():e;return i||(i=new zn),a(d,b,r,n,i)}}return!!h&&(i||(i=new zn),Tn(t,e,r,n,a,i))},Qn=me;var Xn=function t(e,r,n,a,i){return e===r||(null==e||null==r||!Qn(e)&&!Qn(r)?e!=e&&r!=r:Kn(e,r,n,a,t,i))},Yn=ze,Zn=Xn;var ta=_;var ea=function(t){return t==t&&!ta(t)},ra=ea,na=ln;var aa=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}},ia=function(t,e,r,n){var a=r.length,i=a,o=!n;if(null==t)return!i;for(t=Object(t);a--;){var s=r[a];if(o&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++a<i;){var c=(s=r[a])[0],u=t[c],l=s[1];if(o&&s[2]){if(void 0===u&&!(c in t))return!1}else{var f=new Yn;if(n)var h=n(u,l,c,t,e,f);if(!(void 0===h?Zn(l,u,3,n,f):h))return!1}}return!0},oa=function(t){for(var e=na(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,ra(a)]}return e},sa=aa;var ca=function(t){var e=oa(t);return 1==e.length&&e[0][2]?sa(e[0][0],e[0][1]):function(r){return r===t||ia(r,t,e)}},ua=w,la=me;var fa=function(t){return"symbol"==typeof t||la(t)&&"[object Symbol]"==ua(t)},ha=ye,pa=fa,va=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,da=/^\w*$/;var ba=function(t,e){if(ha(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!pa(t))||(da.test(t)||!va.test(t)||null!=e&&t in Object(e))},ya=kt;function ga(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,a=e?e.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=t.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(ga.Cache||ya),r}ga.Cache=ya;var ma=ga;var ja=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wa=/\\(\\)?/g,_a=function(t){var e=ma(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(ja,(function(t,r,n,a){e.push(n?a.replace(wa,"$1"):r||t)})),e}));var xa=function(t,e){for(var r=-1,n=null==t?0:t.length,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a},Oa=ye,Fa=fa,Aa=l?l.prototype:void 0,La=Aa?Aa.toString:void 0;var Ma=function t(e){if("string"==typeof e)return e;if(Oa(e))return xa(e,t)+"";if(Fa(e))return La?La.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r},Sa=Ma;var Ra=ye,Ea=ba,Ia=_a,Ua=function(t){return null==t?"":Sa(t)};var Pa=function(t,e){return Ra(t)?t:Ea(t,e)?[t]:Ia(Ua(t))},qa=fa;var $a=function(t){if("string"==typeof t||qa(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e},za=Pa,Ca=$a;var Ba=function(t,e){for(var r=0,n=(e=za(e,t)).length;null!=t&&r<n;)t=t[Ca(e[r++])];return r&&r==n?t:void 0},Ta=Ba;var ka=Pa,Da=Or,Na=ye,Va=Mr,Wa=Sr,Ga=$a;var Ha=function(t,e){return null!=t&&e in Object(t)},Ja=function(t,e,r){for(var n=-1,a=(e=ka(e,t)).length,i=!1;++n<a;){var o=Ga(e[n]);if(!(i=null!=t&&r(t,o)))break;t=t[o]}return i||++n!=a?i:!!(a=null==t?0:t.length)&&Wa(a)&&Va(o,a)&&(Na(t)||Da(t))};var Ka=Xn,Qa=function(t,e,r){var n=null==t?void 0:Ta(t,e);return void 0===n?r:n},Xa=function(t,e){return null!=t&&Ja(t,e,Ha)},Ya=ba,Za=ea,ti=aa,ei=$a;var ri=Ba;var ni=function(t){return function(e){return null==e?void 0:e[t]}},ai=function(t){return function(e){return ri(e,t)}},ii=ba,oi=$a;var si=ca,ci=function(t,e){return Ya(t)&&Za(e)?ti(ei(t),e):function(r){var n=Qa(r,t);return void 0===n&&n===e?Xa(r,t):Ka(e,n,3)}},ui=function(t){return t},li=ye,fi=function(t){return ii(t)?ni(oi(t)):ai(t)};var hi=function(t){return"function"==typeof t?t:null==t?ui:"object"==typeof t?li(t)?ci(t[0],t[1]):si(t):fi(t)},pi=hi,vi=he;const di=i((function(t,e){return t&&t.length?vi(t,pi(e)):[]}));class bi{constructor(t,r){e(this,"language"),e(this,"region"),e(this,"script"),e(this,"isRtl"),e(this,"name"),e(this,"localizedName"),e(this,"uri"),e(this,"timestamp"),e(this,"baseLocale"),this.language=t.language,this.region=t.region,this.script=t.script,this.isRtl=t.isRtl,this.name=t.name,this.localizedName=t.localizedName,this.uri=t.uri,this.timestamp=t.timestamp,this.baseLocale=r}get locale(){return this.language&&this.region&&this.script?`${this.language}_${this.region}#${this.script}`:this.language&&this.script?`${this.language}#${this.script}`:this.language&&this.region?`${this.language}_${this.region}`:this.language}get isBaseLocale(){return this.locale===this.baseLocale}toCdnLocale(){return{locale:this.locale,isBaseLocale:this.isBaseLocale,language:this.language,region:this.region,script:this.script,isRtl:this.isRtl,name:this.name,localizedName:this.localizedName}}}class yi{constructor(t){e(this,"id"),e(this,"file"),e(this,"path"),e(this,"library"),e(this,"module"),e(this,"buildType"),e(this,"timestamp"),e(this,"productFlavors"),e(this,"locales"),e(this,"baseUrl"),this.id=t.id,this.file=t.file,this.path=t.path,this.library=t.library,this.module=t.module,this.buildType=t.buildType,this.timestamp=t.timestamp,this.productFlavors=t.productFlavors,this.locales=t.locales,this.baseUrl=t.baseUrl}toCdnFile(){return{id:this.id,file:this.file,path:this.path,library:this.library,module:this.module,buildType:this.buildType,productFlavors:this.productFlavors,locales:this.locales.map((t=>({locale:t.locale,isBaseLocale:t.isBaseLocale,uri:`${this.baseUrl}${t.uri}`})))}}}class gi{constructor(t,r){e(this,"projectUrl"),e(this,"baseLocale"),e(this,"locales"),e(this,"timestamp"),e(this,"files"),e(this,"filesMap"),this.projectUrl=t.projectUrl,this.timestamp=t.timestamp,this.files=gi.filesFactory(t.files,t.baseLocale,r),this.filesMap=gi.filesMapFactory(this.files),this.locales=gi.localesFactory(this.files),this.baseLocale=this.locales.find((t=>t.isBaseLocale))}static createEmpty(t){return new gi({projectUrl:"",baseLocale:"",timestamp:0,files:{}},t)}static filesFactory(t,e,r){return Object.keys(t).reduce(((n,a)=>{const i=t[a].locales.map((t=>new bi(t,e)));return n.push(new yi({...t[a],id:a,locales:i,baseUrl:r.baseUrl})),n}),[])}static filesMapFactory(t){return t.reduce(((t,e)=>(t[e.id]=e,t)),{})}static localesFactory(t){const e=t.reduce(((t,e)=>(t.push(...e.locales.map((t=>t.toCdnLocale()))),t)),[]);return di(e,(t=>t.locale))}}class mi{constructor(t){e(this,"options"),this.options=mi.parseMetafileUrl(t)}get url(){return this.options.url}get baseUrl(){return this.options.baseUrl}get cdnId(){return this.options.cdnId}get jsonPath(){return this.options.jsonPath}static parseMetafileUrl(t){let e;try{e=new URL(t)}catch(t){throw new Error('Invalid param: "options.metafile" cannot be parsed as url.')}const r=e.pathname.match(/^\/(.*?)\/(.*?)\.(v2.json|js|ts)$/);if(null===r||4!==r.length)throw new Error('Invalid param: "options.metafile" contains invalid metafile url.');const n=r[1],a=r[2];return{url:t,baseUrl:e.origin,cdnId:n,jsonPath:`/${n}/${a}.v2.json`}}}class ji{constructor(t){e(this,"params"),e(this,"parsedData"),e(this,"data"),this.params=new mi(t.metafile),this.parsedData=null,this.data=gi.createEmpty(this.params)}setMetafile(t){this.parsedData=t,this.data=new gi(t,this.params)}}class wi{constructor(t){e(this,"context"),this.context=t}createCdnResponse(t){const{responses:e,hasSingleFileResponse:r,hasSingleLocaleResponse:n}=t;return 0===e.length?{}:(this.cacheResponses(e),r&&n?e[0].data:wi.transformResponsesToOutput(t))}cacheResponses(t){t.forEach((t=>{const{metafileFile:e,metafileLocale:r}=wi.extractReference(t);e&&r&&this.context.cache.setIfMissed({metafileFile:e,metafileLocale:r,data:t.data})}))}static transformResponsesToOutput(t){const{responses:e,hasSingleFileResponse:r}=t;return e.reduce(((t,e)=>{const{metafileFile:n,metafileLocale:a}=wi.extractReference(e);return n&&a&&(r?t[a.locale]=e.data:(t[n.id]||(t[n.id]={}),t[n.id][a.locale]=e.data)),t}),{})}static extractReference(t){var e,r;const n=null==(e=t.config.reference)?void 0:e.metafileFile,a=null==(r=t.config.reference)?void 0:r.metafileLocale,{data:i}=t;return{metafileFile:n,metafileLocale:a,data:i}}}class _i{constructor(t){e(this,"metafile"),e(this,"cdn"),e(this,"client"),e(this,"api"),e(this,"cache"),e(this,"responseFactory"),this.metafile=t.metafileContext,this.cdn=t.cdn,this.client=t.client,this.api=new n(this),this.cache=new be(this),this.responseFactory=new wi(this)}}var xi=function(t){return function(e,r,n){for(var a=-1,i=Object(e),o=n(e),s=o.length;s--;){var c=o[t?s:++a];if(!1===r(i[c],c,i))break}return e}}(),Oi=ln;var Fi=on;var Ai=function(t,e){return function(r,n){if(null==r)return r;if(!Fi(r))return t(r,n);for(var a=r.length,i=e?a:-1,o=Object(r);(e?i--:++i<a)&&!1!==n(o[i],i,o););return r}}((function(t,e){return t&&xi(t,e,Oi)}));var Li=er,Mi=function(t,e){var r=[];return Ai(t,(function(t,n,a){e(t,n,a)&&r.push(t)})),r},Si=hi,Ri=ye;const Ei=i((function(t,e){return(Ri(t)?Li:Mi)(t,Si(e))}));var Ii=hi,Ui=on,Pi=ln;var qi=function(t){return function(e,r,n){var a=Object(e);if(!Ui(e)){var i=Ii(r);e=Pi(e),r=function(t){return i(a[t],t,a)}}var o=t(e,r,n);return o>-1?a[i?e[o]:o]:void 0}},$i=/\s/;var zi=function(t){for(var e=t.length;e--&&$i.test(t.charAt(e)););return e},Ci=/^\s+/;var Bi=function(t){return t?t.slice(0,zi(t)+1).replace(Ci,""):t},Ti=_,ki=fa,Di=/^[-+]0x[0-9a-f]+$/i,Ni=/^0b[01]+$/i,Vi=/^0o[0-7]+$/i,Wi=parseInt;var Gi=function(t){if("number"==typeof t)return t;if(ki(t))return NaN;if(Ti(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ti(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Bi(t);var r=Ni.test(t);return r||Vi.test(t)?Wi(t.slice(2),r?2:8):Di.test(t)?NaN:+t},Hi=1/0;var Ji=function(t){return t?(t=Gi(t))===Hi||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var Ki=Ht,Qi=hi,Xi=function(t){var e=Ji(t),r=e%1;return e==e?r?e-r:e:0},Yi=Math.max;const Zi=i(qi((function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var a=null==r?0:Xi(r);return a<0&&(a=Yi(n+a,0)),Ki(t,Qi(e),a)})));var to=Yr(Object.getPrototypeOf,Object),eo=w,ro=to,no=me,ao=Function.prototype,io=Object.prototype,oo=ao.toString,so=io.hasOwnProperty,co=oo.call(Object);const uo=i((function(t){if(!no(t)||"[object Object]"!=eo(t))return!1;var e=ro(t);if(null===e)return!0;var r=so.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&oo.call(r)==co}));var lo=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t},fo=W,ho=function(){try{var t=fo(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var po=function(t,e,r){"__proto__"==e&&ho?ho(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},vo=po,bo=lt,yo=Object.prototype.hasOwnProperty;var go=function(t,e,r){var n=t[e];yo.call(t,e)&&bo(n,r)&&(void 0!==r||e in t)||vo(t,e,r)},mo=go,jo=po;var wo=function(t,e,r,n){var a=!r;r||(r={});for(var i=-1,o=e.length;++i<o;){var s=e[i],c=n?n(r[s],t[s],s,r,t):void 0;void 0===c&&(c=t[s]),a?jo(r,s,c):mo(r,s,c)}return r},_o=wo,xo=ln;var Oo=function(t,e){return t&&_o(e,xo(e),t)};var Fo=_,Ao=Xr,Lo=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e},Mo=Object.prototype.hasOwnProperty;var So=Kr,Ro=function(t){if(!Fo(t))return Lo(t);var e=Ao(t),r=[];for(var n in t)("constructor"!=n||!e&&Mo.call(t,n))&&r.push(n);return r},Eo=on;var Io=function(t){return Eo(t)?So(t,!0):Ro(t)},Uo=wo,Po=Io;var qo=function(t,e){return t&&Uo(e,Po(e),t)},$o={exports:{}};!function(t,e){var r=u,n=e&&!e.nodeType&&e,a=n&&t&&!t.nodeType&&t,i=a&&a.exports===n?r.Buffer:void 0,o=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=o?o(r):new t.constructor(r);return t.copy(n),n}}($o,$o.exports);var zo=$o.exports;var Co=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e},Bo=wo,To=sr;var ko=function(t,e){return Bo(t,To(t),e)},Do=Xe,No=to,Vo=sr,Wo=rr,Go=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Do(e,Vo(t)),t=No(t);return e}:Wo,Ho=wo,Jo=Go;var Ko=function(t,e){return Ho(t,Jo(t),e)},Qo=tr,Xo=Go,Yo=Io;var Zo=function(t){return Qo(t,Yo,Xo)},ts=Object.prototype.hasOwnProperty;var es=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&ts.call(t,"index")&&(r.index=t.index,r.input=t.input),r},rs=De;var ns=function(t){var e=new t.constructor(t.byteLength);return new rs(e).set(new rs(t)),e},as=ns;var is=function(t,e){var r=e?as(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)},os=/\w*$/;var ss=function(t){var e=new t.constructor(t.source,os.exec(t));return e.lastIndex=t.lastIndex,e},cs=l?l.prototype:void 0,us=cs?cs.valueOf:void 0;var ls=ns;var fs=ns,hs=is,ps=ss,vs=function(t){return us?Object(us.call(t)):{}},ds=function(t,e){var r=e?ls(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)};var bs=function(t,e,r){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return fs(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return hs(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ds(t,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return ps(t);case"[object Symbol]":return vs(t)}},ys=_,gs=Object.create,ms=function(){function t(){}return function(e){if(!ys(e))return{};if(gs)return gs(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),js=to,ws=Xr;var _s=function(t){return"function"!=typeof t.constructor||ws(t)?{}:ms(js(t))},xs=$n,Os=me;var Fs=function(t){return Os(t)&&"[object Map]"==xs(t)},As=qr,Ls=zr&&zr.isMap,Ms=Ls?As(Ls):Fs,Ss=$n,Rs=me;var Es=function(t){return Rs(t)&&"[object Set]"==Ss(t)},Is=qr,Us=zr&&zr.isSet,Ps=Us?Is(Us):Es,qs=ze,$s=lo,zs=go,Cs=Oo,Bs=qo,Ts=zo,ks=Co,Ds=ko,Ns=Ko,Vs=vn,Ws=Zo,Gs=$n,Hs=es,Js=bs,Ks=_s,Qs=ye,Xs=Ar,Ys=Ms,Zs=_,tc=Ps,ec=ln,rc=Io,nc="[object Arguments]",ac="[object Function]",ic="[object Object]",oc={};oc[nc]=oc["[object Array]"]=oc["[object ArrayBuffer]"]=oc["[object DataView]"]=oc["[object Boolean]"]=oc["[object Date]"]=oc["[object Float32Array]"]=oc["[object Float64Array]"]=oc["[object Int8Array]"]=oc["[object Int16Array]"]=oc["[object Int32Array]"]=oc["[object Map]"]=oc["[object Number]"]=oc[ic]=oc["[object RegExp]"]=oc["[object Set]"]=oc["[object String]"]=oc["[object Symbol]"]=oc["[object Uint8Array]"]=oc["[object Uint8ClampedArray]"]=oc["[object Uint16Array]"]=oc["[object Uint32Array]"]=!0,oc["[object Error]"]=oc[ac]=oc["[object WeakMap]"]=!1;var sc=function t(e,r,n,a,i,o){var s,c=1&r,u=2&r,l=4&r;if(n&&(s=i?n(e,a,i,o):n(e)),void 0!==s)return s;if(!Zs(e))return e;var f=Qs(e);if(f){if(s=Hs(e),!c)return ks(e,s)}else{var h=Gs(e),p=h==ac||"[object GeneratorFunction]"==h;if(Xs(e))return Ts(e,c);if(h==ic||h==nc||p&&!i){if(s=u||p?{}:Ks(e),!c)return u?Ns(e,Bs(s,e)):Ds(e,Cs(s,e))}else{if(!oc[h])return i?e:{};s=Js(e,h,c)}}o||(o=new qs);var v=o.get(e);if(v)return v;o.set(e,s),tc(e)?e.forEach((function(a){s.add(t(a,r,n,a,e,o))})):Ys(e)&&e.forEach((function(a,i){s.set(i,t(a,r,n,i,e,o))}));var d=f?void 0:(l?u?Ws:Vs:u?rc:ec)(e);return $s(d||e,(function(a,i){d&&(a=e[i=a]),zs(s,i,t(a,r,n,i,e,o))})),s},cc=sc,uc=ca;const lc=i((function(t){return uc(cc(t,1))})),fc=class t extends Oe{constructor(){super(...arguments),e(this,"list",(()=>t.transformFiles(this.context.metafile.data.files))),e(this,"filter",(e=>{if(!e)throw new Error('Invalid param: missing required "options" parameter.');if(!A(e)&&!uo(e))throw new Error('Invalid param: "options" must be function or object.');const r=t.transformFiles(this.context.metafile.data.files);return A(e)?r.filter(e):Ei(r,lc(e))})),e(this,"find",(e=>{if(!e)throw new Error('Invalid param: missing required "options" parameter.');if(!A(e)&&!uo(e))throw new Error('Invalid param: "options" must be function or object.');const r=t.transformFiles(this.context.metafile.data.files);return A(e)?r.find(e):Zi(r,lc(e))})),e(this,"first",(()=>{if(0===this.context.metafile.data.files.length)throw new Error("File is missing in downloaded metafile.");return t.transformFiles(this.context.metafile.data.files)[0]}))}};e(fc,"transformFiles",(t=>t.map((t=>t.toCdnFile()))));let hc=fc;class pc extends Oe{constructor(t){super(t),e(this,"files"),e(this,"locales",(t=>{const{excludeBaseLocale:e}=t||{},{locales:r}=this.context.metafile.data;return e?r.filter((t=>!t.isBaseLocale)):r})),e(this,"refresh",(async t=>{const e=await this.context.api.fetchMetafile(t);this.context.metafile.setMetafile(e.data)})),e(this,"switch",(async(t,e)=>{this.context.metafile.params=new mi(t.metafile),await this.refresh(e)})),this.files=new hc(t)}get projectUrl(){return this.context.metafile.data.projectUrl}get baseLocale(){return this.context.metafile.data.baseLocale}get url(){return this.context.metafile.params.url}}const vc=i((function(t){return void 0===t}));class dc{constructor(t){e(this,"data"),e(this,"context"),this.context=t.context,this.data=t.data||{}}}class bc{constructor(t){e(this,"files"),e(this,"localesMap"),e(this,"hasSingleFileResponse"),e(this,"hasSingleLocaleResponse"),e(this,"context"),this.files=[],this.localesMap=new dc({context:t}),this.hasSingleFileResponse=!1,this.hasSingleLocaleResponse=!1,this.context=t}async execute(){return this.context.responseFactory.createCdnResponse({responses:await Promise.all(this.getPromises()),localesMap:this.localesMap,hasSingleFileResponse:this.hasSingleFileResponse,hasSingleLocaleResponse:this.hasSingleLocaleResponse})}getPromises(){return this.files.reduce(((t,e)=>(this.localesMap.data[e.id]&&t.push(...this.localesMap.data[e.id].map((t=>this.context.api.fetchLocale({metafileFile:e,metafileLocale:t})))),t)),[])}}class yc{constructor(t){e(this,"context"),e(this,"request"),this.context=t,this.request=new bc(this.context)}addFiles(t){if(!(uo(t)||xe(t)||vc(t)||ge(t)))throw new Error('Invalid param: "request.files" must be object, array, string or undefined.');if(ge(t)&&t.forEach((t=>{if(!uo(t)&&!xe(t))throw new Error('Invalid param: array "request.files" must contain objects or strings.')})),xe(t)){this.request.hasSingleFileResponse=!0;const e=this.context.metafile.data.files.find((e=>e.id===t));if(!(e instanceof yi))throw new Error(`File not found: "${t}".`);this.request.files=[e]}else if(vc(t))this.request.files=[...this.context.metafile.data.files];else if(ge(t))this.request.files=t.map((t=>{let e;if(xe(t)){const r=this.context.metafile.data.files.find((e=>e.id===t));if(vc(r))throw new Error(`File not found: "${t}".`);e=r}else{const r=this.context.metafile.data.files.find((e=>e.id===t.id));if(vc(r))throw new Error(`File not found: "${t.id}".`);e=r}return e}));else if(uo(t)){this.request.hasSingleFileResponse=!0;const e=this.context.metafile.data.files.find((e=>e.id===t.id));if(vc(e))throw new Error(`File not found: "${t.id}".`);this.request.files=[e]}return this}addLocales(t,e){if(!(xe(t)||vc(t)||ge(t)))throw new Error('Invalid param: "request.locales" must be array, string or undefined.');return ge(t)&&t.forEach((t=>{if(!xe(t))throw new Error('Invalid param: array "request.locales" must contain strings.')})),xe(t)?(this.request.hasSingleLocaleResponse=!0,this.request.files.reduce(((e,r)=>(e.data[r.id]=r.locales.filter((e=>e.locale===t)),e)),this.request.localesMap)):vc(t)?this.request.files.reduce(((t,r)=>(t.data[r.id]=e?r.locales.filter((t=>!t.isBaseLocale)):r.locales,t)),this.request.localesMap):ge(t)&&this.request.files.reduce(((e,r)=>(e.data[r.id]=r.locales.filter((e=>t.includes(e.locale))),e)),this.request.localesMap),this}getCdnRequest(){const t=this.request;return this.request=new bc(this.context),t}}class gc{constructor(t,r){e(this,"client"),this.client=gc.clientFactory(t,r)}static clientFactory(t,e){const n={baseURL:t,...e};return r.create(n)}get(t,e){return this.client.get(t,e)}}class mc{constructor(t,r){e(this,"metafile"),e(this,"cache"),e(this,"context"),e(this,"fetch",(async t=>{const{files:e,locales:r,excludeBaseLocale:n}=t||{};return new yc(this.context).addFiles(e).addLocales(r,n).getCdnRequest().execute()}));const n=new ji(t),a=new gc(n.params.baseUrl,r);this.context=new _i({metafileContext:n,cdn:this,client:a}),this.metafile=new pc(this.context),this.cache=new Fe(this.context)}static async create(t,e){if(!t)throw new Error('Invalid param: missing required "options" parameter.');if(!xe(t.metafile))throw new Error('Invalid param: "options.metafile" must be string.');const r=new mc(t,e);return await r.metafile.refresh(e),r}}exports.Api=n,exports.AxiosHttpAdapter=gc,exports.CdnBase=Oe,exports.CdnCache=Fe,exports.CdnClient=mc,exports.CdnMetafile=pc,exports.CdnMetafileFiles=hc,exports.Context=_i,exports.LocalesCache=be,exports.LocalesMap=dc,exports.MemoryCacheAdapter=de,exports.MetafileContext=ji,exports.MetafileData=gi,exports.MetafileFile=yi,exports.MetafileLocale=bi,exports.MetafileParams=mi,exports.Request=bc,exports.RequestBuilder=yc,exports.ResponseFactory=wi;
5
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("isomorphic-fetch");class r{constructor(t){e(this,"context"),this.context=t}async fetchLocale(t){return this.context.cache.has(t)?new Promise((e=>{e(this.context.cache.get(t))})):this.context.client.get(t.metafileLocale.uri)}async fetchMetafile(){return await this.context.client.get(this.context.metafile.params.jsonPath)}}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i="object"==typeof n&&n&&n.Object===Object&&n,o=i,s="object"==typeof self&&self&&self.Object===Object&&self,c=o||s||Function("return this")(),u=c.Symbol,l=u,f=Object.prototype,h=f.hasOwnProperty,p=f.toString,v=l?l.toStringTag:void 0;var d=function(t){var e=h.call(t,v),r=t[v];try{t[v]=void 0;var n=!0}catch(t){}var a=p.call(t);return n&&(e?t[v]=r:delete t[v]),a},b=Object.prototype.toString;var y=d,g=function(t){return b.call(t)},m=u?u.toStringTag:void 0;var j=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":m&&m in Object(t)?y(t):g(t)};var w=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},_=j,x=w;var O=function(t){if(!x(t))return!1;var e=_(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e};const F=a(O);var A,M=c["__core-js_shared__"],L=(A=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+A:"";var S=function(t){return!!L&&L in t},E=Function.prototype.toString;var R=function(t){if(null!=t){try{return E.call(t)}catch(t){}try{return t+""}catch(t){}}return""},U=O,q=S,I=w,P=R,$=/^\[object .+?Constructor\]$/,z=Function.prototype,C=Object.prototype,B=z.toString,T=C.hasOwnProperty,k=RegExp("^"+B.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var D=function(t){return!(!I(t)||q(t))&&(U(t)?k:$).test(P(t))},N=function(t,e){return null==t?void 0:t[e]};var V=function(t,e){var r=N(t,e);return D(r)?r:void 0},W=V(Object,"create"),G=W;var H=function(){this.__data__=G?G(null):{},this.size=0};var J=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},K=W,Q=Object.prototype.hasOwnProperty;var X=function(t){var e=this.__data__;if(K){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Q.call(e,t)?e[t]:void 0},Y=W,Z=Object.prototype.hasOwnProperty;var tt=W;var et=H,rt=J,nt=X,at=function(t){var e=this.__data__;return Y?void 0!==e[t]:Z.call(e,t)},it=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=tt&&void 0===e?"__lodash_hash_undefined__":e,this};function ot(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ot.prototype.clear=et,ot.prototype.delete=rt,ot.prototype.get=nt,ot.prototype.has=at,ot.prototype.set=it;var st=ot;var ct=function(){this.__data__=[],this.size=0};var ut=function(t,e){return t===e||t!=t&&e!=e},lt=ut;var ft=function(t,e){for(var r=t.length;r--;)if(lt(t[r][0],e))return r;return-1},ht=ft,pt=Array.prototype.splice;var vt=ft;var dt=ft;var bt=ft;var yt=ct,gt=function(t){var e=this.__data__,r=ht(e,t);return!(r<0)&&(r==e.length-1?e.pop():pt.call(e,r,1),--this.size,!0)},mt=function(t){var e=this.__data__,r=vt(e,t);return r<0?void 0:e[r][1]},jt=function(t){return dt(this.__data__,t)>-1},wt=function(t,e){var r=this.__data__,n=bt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function _t(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}_t.prototype.clear=yt,_t.prototype.delete=gt,_t.prototype.get=mt,_t.prototype.has=jt,_t.prototype.set=wt;var xt=_t,Ot=V(c,"Map"),Ft=st,At=xt,Mt=Ot;var Lt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var St=function(t,e){var r=t.__data__;return Lt(e)?r["string"==typeof e?"string":"hash"]:r.map},Et=St;var Rt=St;var Ut=St;var qt=St;var It=function(){this.size=0,this.__data__={hash:new Ft,map:new(Mt||At),string:new Ft}},Pt=function(t){var e=Et(this,t).delete(t);return this.size-=e?1:0,e},$t=function(t){return Rt(this,t).get(t)},zt=function(t){return Ut(this,t).has(t)},Ct=function(t,e){var r=qt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Bt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Bt.prototype.clear=It,Bt.prototype.delete=Pt,Bt.prototype.get=$t,Bt.prototype.has=zt,Bt.prototype.set=Ct;var Tt=Bt;var kt=Tt,Dt=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Nt=function(t){return this.__data__.has(t)};function Vt(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new kt;++e<r;)this.add(t[e])}Vt.prototype.add=Vt.prototype.push=Dt,Vt.prototype.has=Nt;var Wt=Vt;var Gt=function(t,e,r,n){for(var a=t.length,i=r+(n?1:-1);n?i--:++i<a;)if(e(t[i],i,t))return i;return-1};var Ht=Gt,Jt=function(t){return t!=t},Kt=function(t,e,r){for(var n=r-1,a=t.length;++n<a;)if(t[n]===e)return n;return-1};var Qt=function(t,e,r){return e==e?Kt(t,e,r):Ht(t,Jt,r)};var Xt=function(t,e){return!!(null==t?0:t.length)&&Qt(t,e,0)>-1};var Yt=function(t,e,r){for(var n=-1,a=null==t?0:t.length;++n<a;)if(r(e,t[n]))return!0;return!1};var Zt=function(t,e){return t.has(e)},te=V(c,"Set");var ee=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},re=te,ne=function(){},ae=re&&1/ee(new re([,-0]))[1]==1/0?function(t){return new re(t)}:ne,ie=Wt,oe=Xt,se=Yt,ce=Zt,ue=ae,le=ee;var fe=function(t,e,r){var n=-1,a=oe,i=t.length,o=!0,s=[],c=s;if(r)o=!1,a=se;else if(i>=200){var u=e?null:ue(t);if(u)return le(u);o=!1,a=ce,c=new ie}else c=e?[]:s;t:for(;++n<i;){var l=t[n],f=e?e(l):l;if(l=r||0!==l?l:0,o&&f==f){for(var h=c.length;h--;)if(c[h]===f)continue t;e&&c.push(f),s.push(l)}else a(c,f,r)||(c!==s&&c.push(f),s.push(l))}return s},he=fe;const pe=a((function(t){return t&&t.length?he(t):[]}));class ve{constructor(){e(this,"map"),this.map=new Map}get(t){return this.map.get(t)}has(t){return this.map.has(t)}set(t,e){this.map.set(t,e)}flush(){this.map=new Map}}class de{constructor(t){e(this,"context"),e(this,"cacheAdapter"),this.context=t,this.cacheAdapter=new ve}setIfMissed(t){const{metafileFile:e,metafileLocale:r,data:n}=t,a=this.keyFromMetafile({metafileFile:e,metafileLocale:r});this.cacheAdapter.has(a)||this.cacheAdapter.set(a,n)}has(t){const e=this.keyFromMetafile(t);return this.cacheAdapter.has(e)}get(t){const e=this.keyFromMetafile(t);return this.cacheAdapter.get(e)}flush(){this.cacheAdapter.flush()}keyFromMetafile(t){const{metafileFile:e,metafileLocale:r}=t,n=[...pe(e.productFlavors)].sort().join("-");return[this.context.metafile.params.cdnId,e.id,e.file,e.path,e.library,e.module,e.buildType,n,r.locale,r.timestamp.toString()].filter((t=>""!==t)).join("-")}}var be=Array.isArray;const ye=a(be);var ge=function(t){return null!=t&&"object"==typeof t},me=j,je=be,we=ge;const _e=a((function(t){return"string"==typeof t||!je(t)&&we(t)&&"[object String]"==me(t)}));class xe{constructor(t){e(this,"context"),this.context=t}}class Oe extends xe{constructor(){super(...arguments),e(this,"flush",(()=>{this.context.cache.flush()}))}}var Fe=xt;var Ae=xt,Me=Ot,Le=Tt;var Se=xt,Ee=function(){this.__data__=new Fe,this.size=0},Re=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Ue=function(t){return this.__data__.get(t)},qe=function(t){return this.__data__.has(t)},Ie=function(t,e){var r=this.__data__;if(r instanceof Ae){var n=r.__data__;if(!Me||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Le(n)}return r.set(t,e),this.size=r.size,this};function Pe(t){var e=this.__data__=new Se(t);this.size=e.size}Pe.prototype.clear=Ee,Pe.prototype.delete=Re,Pe.prototype.get=Ue,Pe.prototype.has=qe,Pe.prototype.set=Ie;var $e=Pe;var ze=Wt,Ce=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1},Be=Zt;var Te=function(t,e,r,n,a,i){var o=1&r,s=t.length,c=e.length;if(s!=c&&!(o&&c>s))return!1;var u=i.get(t),l=i.get(e);if(u&&l)return u==e&&l==t;var f=-1,h=!0,p=2&r?new ze:void 0;for(i.set(t,e),i.set(e,t);++f<s;){var v=t[f],d=e[f];if(n)var b=o?n(d,v,f,e,t,i):n(v,d,f,t,e,i);if(void 0!==b){if(b)continue;h=!1;break}if(p){if(!Ce(e,(function(t,e){if(!Be(p,e)&&(v===t||a(v,t,r,n,i)))return p.push(e)}))){h=!1;break}}else if(v!==d&&!a(v,d,r,n,i)){h=!1;break}}return i.delete(t),i.delete(e),h},ke=c.Uint8Array;var De=ke,Ne=ut,Ve=Te,We=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r},Ge=ee,He=u?u.prototype:void 0,Je=He?He.valueOf:void 0;var Ke=function(t,e,r,n,a,i,o){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new De(t),new De(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ne(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var s=We;case"[object Set]":var c=1&n;if(s||(s=Ge),t.size!=e.size&&!c)return!1;var u=o.get(t);if(u)return u==e;n|=2,o.set(t,e);var l=Ve(s(t),s(e),n,a,i,o);return o.delete(t),l;case"[object Symbol]":if(Je)return Je.call(t)==Je.call(e)}return!1};var Qe=function(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t},Xe=Qe,Ye=be;var Ze=function(t,e,r){var n=e(t);return Ye(t)?n:Xe(n,r(t))};var tr=function(t,e){for(var r=-1,n=null==t?0:t.length,a=0,i=[];++r<n;){var o=t[r];e(o,r,t)&&(i[a++]=o)}return i};var er=function(){return[]},rr=tr,nr=er,ar=Object.prototype.propertyIsEnumerable,ir=Object.getOwnPropertySymbols,or=ir?function(t){return null==t?[]:(t=Object(t),rr(ir(t),(function(e){return ar.call(t,e)})))}:nr;var sr=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n},cr=j,ur=ge;var lr,fr,hr,pr,vr,dr,br,yr,gr=function(t){return ur(t)&&"[object Arguments]"==cr(t)},mr=ge,jr=Object.prototype,wr=jr.hasOwnProperty,_r=jr.propertyIsEnumerable,xr=gr(function(){return arguments}())?gr:function(t){return mr(t)&&wr.call(t,"callee")&&!_r.call(t,"callee")},Or={exports:{}};lr=Or,hr=c,pr=function(){return!1},vr=(fr=Or.exports)&&!fr.nodeType&&fr,dr=vr&&lr&&!lr.nodeType&&lr,br=dr&&dr.exports===vr?hr.Buffer:void 0,yr=(br?br.isBuffer:void 0)||pr,lr.exports=yr;var Fr=Or.exports,Ar=/^(?:0|[1-9]\d*)$/;var Mr=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Ar.test(t))&&t>-1&&t%1==0&&t<e};var Lr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Sr=j,Er=Lr,Rr=ge,Ur={};Ur["[object Float32Array]"]=Ur["[object Float64Array]"]=Ur["[object Int8Array]"]=Ur["[object Int16Array]"]=Ur["[object Int32Array]"]=Ur["[object Uint8Array]"]=Ur["[object Uint8ClampedArray]"]=Ur["[object Uint16Array]"]=Ur["[object Uint32Array]"]=!0,Ur["[object Arguments]"]=Ur["[object Array]"]=Ur["[object ArrayBuffer]"]=Ur["[object Boolean]"]=Ur["[object DataView]"]=Ur["[object Date]"]=Ur["[object Error]"]=Ur["[object Function]"]=Ur["[object Map]"]=Ur["[object Number]"]=Ur["[object Object]"]=Ur["[object RegExp]"]=Ur["[object Set]"]=Ur["[object String]"]=Ur["[object WeakMap]"]=!1;var qr=function(t){return Rr(t)&&Er(t.length)&&!!Ur[Sr(t)]};var Ir=function(t){return function(e){return t(e)}},Pr={exports:{}};!function(t,e){var r=i,n=e&&!e.nodeType&&e,a=n&&t&&!t.nodeType&&t,o=a&&a.exports===n&&r.process,s=function(){try{var t=a&&a.require&&a.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=s}(Pr,Pr.exports);var $r=Pr.exports,zr=qr,Cr=Ir,Br=$r&&$r.isTypedArray,Tr=Br?Cr(Br):zr,kr=sr,Dr=xr,Nr=be,Vr=Fr,Wr=Mr,Gr=Tr,Hr=Object.prototype.hasOwnProperty;var Jr=function(t,e){var r=Nr(t),n=!r&&Dr(t),a=!r&&!n&&Vr(t),i=!r&&!n&&!a&&Gr(t),o=r||n||a||i,s=o?kr(t.length,String):[],c=s.length;for(var u in t)!e&&!Hr.call(t,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Wr(u,c))||s.push(u);return s},Kr=Object.prototype;var Qr=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Kr)};var Xr=function(t,e){return function(r){return t(e(r))}},Yr=Xr(Object.keys,Object),Zr=Qr,tn=Yr,en=Object.prototype.hasOwnProperty;var rn=O,nn=Lr;var an=function(t){return null!=t&&nn(t.length)&&!rn(t)},on=Jr,sn=function(t){if(!Zr(t))return tn(t);var e=[];for(var r in Object(t))en.call(t,r)&&"constructor"!=r&&e.push(r);return e},cn=an;var un=function(t){return cn(t)?on(t):sn(t)},ln=Ze,fn=or,hn=un;var pn=function(t){return ln(t,hn,fn)},vn=pn,dn=Object.prototype.hasOwnProperty;var bn=function(t,e,r,n,a,i){var o=1&r,s=vn(t),c=s.length;if(c!=vn(e).length&&!o)return!1;for(var u=c;u--;){var l=s[u];if(!(o?l in e:dn.call(e,l)))return!1}var f=i.get(t),h=i.get(e);if(f&&h)return f==e&&h==t;var p=!0;i.set(t,e),i.set(e,t);for(var v=o;++u<c;){var d=t[l=s[u]],b=e[l];if(n)var y=o?n(b,d,l,e,t,i):n(d,b,l,t,e,i);if(!(void 0===y?d===b||a(d,b,r,n,i):y)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var g=t.constructor,m=e.constructor;g==m||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof m&&m instanceof m||(p=!1)}return i.delete(t),i.delete(e),p},yn=V(c,"DataView"),gn=Ot,mn=V(c,"Promise"),jn=te,wn=V(c,"WeakMap"),_n=j,xn=R,On="[object Map]",Fn="[object Promise]",An="[object Set]",Mn="[object WeakMap]",Ln="[object DataView]",Sn=xn(yn),En=xn(gn),Rn=xn(mn),Un=xn(jn),qn=xn(wn),In=_n;(yn&&In(new yn(new ArrayBuffer(1)))!=Ln||gn&&In(new gn)!=On||mn&&In(mn.resolve())!=Fn||jn&&In(new jn)!=An||wn&&In(new wn)!=Mn)&&(In=function(t){var e=_n(t),r="[object Object]"==e?t.constructor:void 0,n=r?xn(r):"";if(n)switch(n){case Sn:return Ln;case En:return On;case Rn:return Fn;case Un:return An;case qn:return Mn}return e});var Pn=In,$n=$e,zn=Te,Cn=Ke,Bn=bn,Tn=Pn,kn=be,Dn=Fr,Nn=Tr,Vn="[object Arguments]",Wn="[object Array]",Gn="[object Object]",Hn=Object.prototype.hasOwnProperty;var Jn=function(t,e,r,n,a,i){var o=kn(t),s=kn(e),c=o?Wn:Tn(t),u=s?Wn:Tn(e),l=(c=c==Vn?Gn:c)==Gn,f=(u=u==Vn?Gn:u)==Gn,h=c==u;if(h&&Dn(t)){if(!Dn(e))return!1;o=!0,l=!1}if(h&&!l)return i||(i=new $n),o||Nn(t)?zn(t,e,r,n,a,i):Cn(t,e,c,r,n,a,i);if(!(1&r)){var p=l&&Hn.call(t,"__wrapped__"),v=f&&Hn.call(e,"__wrapped__");if(p||v){var d=p?t.value():t,b=v?e.value():e;return i||(i=new $n),a(d,b,r,n,i)}}return!!h&&(i||(i=new $n),Bn(t,e,r,n,a,i))},Kn=ge;var Qn=function t(e,r,n,a,i){return e===r||(null==e||null==r||!Kn(e)&&!Kn(r)?e!=e&&r!=r:Jn(e,r,n,a,t,i))},Xn=$e,Yn=Qn;var Zn=w;var ta=function(t){return t==t&&!Zn(t)},ea=ta,ra=un;var na=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}},aa=function(t,e,r,n){var a=r.length,i=a,o=!n;if(null==t)return!i;for(t=Object(t);a--;){var s=r[a];if(o&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++a<i;){var c=(s=r[a])[0],u=t[c],l=s[1];if(o&&s[2]){if(void 0===u&&!(c in t))return!1}else{var f=new Xn;if(n)var h=n(u,l,c,t,e,f);if(!(void 0===h?Yn(l,u,3,n,f):h))return!1}}return!0},ia=function(t){for(var e=ra(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,ea(a)]}return e},oa=na;var sa=function(t){var e=ia(t);return 1==e.length&&e[0][2]?oa(e[0][0],e[0][1]):function(r){return r===t||aa(r,t,e)}},ca=j,ua=ge;var la=function(t){return"symbol"==typeof t||ua(t)&&"[object Symbol]"==ca(t)},fa=be,ha=la,pa=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,va=/^\w*$/;var da=function(t,e){if(fa(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!ha(t))||(va.test(t)||!pa.test(t)||null!=e&&t in Object(e))},ba=Tt;function ya(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,a=e?e.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=t.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(ya.Cache||ba),r}ya.Cache=ba;var ga=ya;var ma=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ja=/\\(\\)?/g,wa=function(t){var e=ga(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(ma,(function(t,r,n,a){e.push(n?a.replace(ja,"$1"):r||t)})),e}));var _a=function(t,e){for(var r=-1,n=null==t?0:t.length,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a},xa=be,Oa=la,Fa=u?u.prototype:void 0,Aa=Fa?Fa.toString:void 0;var Ma=function t(e){if("string"==typeof e)return e;if(xa(e))return _a(e,t)+"";if(Oa(e))return Aa?Aa.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r},La=Ma;var Sa=be,Ea=da,Ra=wa,Ua=function(t){return null==t?"":La(t)};var qa=function(t,e){return Sa(t)?t:Ea(t,e)?[t]:Ra(Ua(t))},Ia=la;var Pa=function(t){if("string"==typeof t||Ia(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e},$a=qa,za=Pa;var Ca=function(t,e){for(var r=0,n=(e=$a(e,t)).length;null!=t&&r<n;)t=t[za(e[r++])];return r&&r==n?t:void 0},Ba=Ca;var Ta=qa,ka=xr,Da=be,Na=Mr,Va=Lr,Wa=Pa;var Ga=function(t,e){return null!=t&&e in Object(t)},Ha=function(t,e,r){for(var n=-1,a=(e=Ta(e,t)).length,i=!1;++n<a;){var o=Wa(e[n]);if(!(i=null!=t&&r(t,o)))break;t=t[o]}return i||++n!=a?i:!!(a=null==t?0:t.length)&&Va(a)&&Na(o,a)&&(Da(t)||ka(t))};var Ja=Qn,Ka=function(t,e,r){var n=null==t?void 0:Ba(t,e);return void 0===n?r:n},Qa=function(t,e){return null!=t&&Ha(t,e,Ga)},Xa=da,Ya=ta,Za=na,ti=Pa;var ei=Ca;var ri=function(t){return function(e){return null==e?void 0:e[t]}},ni=function(t){return function(e){return ei(e,t)}},ai=da,ii=Pa;var oi=sa,si=function(t,e){return Xa(t)&&Ya(e)?Za(ti(t),e):function(r){var n=Ka(r,t);return void 0===n&&n===e?Qa(r,t):Ja(e,n,3)}},ci=function(t){return t},ui=be,li=function(t){return ai(t)?ri(ii(t)):ni(t)};var fi=function(t){return"function"==typeof t?t:null==t?ci:"object"==typeof t?ui(t)?si(t[0],t[1]):oi(t):li(t)},hi=fi,pi=fe;const vi=a((function(t,e){return t&&t.length?pi(t,hi(e)):[]}));class di{constructor(t,r){e(this,"language"),e(this,"region"),e(this,"script"),e(this,"isRtl"),e(this,"name"),e(this,"localizedName"),e(this,"uri"),e(this,"timestamp"),e(this,"baseLocale"),this.language=t.language,this.region=t.region,this.script=t.script,this.isRtl=t.isRtl,this.name=t.name,this.localizedName=t.localizedName,this.uri=t.uri,this.timestamp=t.timestamp,this.baseLocale=r}get locale(){return this.language&&this.region&&this.script?`${this.language}_${this.region}#${this.script}`:this.language&&this.script?`${this.language}#${this.script}`:this.language&&this.region?`${this.language}_${this.region}`:this.language}get isBaseLocale(){return this.locale===this.baseLocale}toCdnLocale(){return{locale:this.locale,isBaseLocale:this.isBaseLocale,language:this.language,region:this.region,script:this.script,isRtl:this.isRtl,name:this.name,localizedName:this.localizedName}}}class bi{constructor(t){e(this,"id"),e(this,"file"),e(this,"path"),e(this,"library"),e(this,"module"),e(this,"buildType"),e(this,"timestamp"),e(this,"productFlavors"),e(this,"locales"),e(this,"baseUrl"),this.id=t.id,this.file=t.file,this.path=t.path,this.library=t.library,this.module=t.module,this.buildType=t.buildType,this.timestamp=t.timestamp,this.productFlavors=t.productFlavors,this.locales=t.locales,this.baseUrl=t.baseUrl}toCdnFile(){return{id:this.id,file:this.file,path:this.path,library:this.library,module:this.module,buildType:this.buildType,productFlavors:this.productFlavors,locales:this.locales.map((t=>({locale:t.locale,isBaseLocale:t.isBaseLocale,uri:`${this.baseUrl}${t.uri}`})))}}}class yi{constructor(t,r){e(this,"projectUrl"),e(this,"baseLocale"),e(this,"locales"),e(this,"timestamp"),e(this,"files"),e(this,"filesMap"),this.projectUrl=t.projectUrl,this.timestamp=t.timestamp,this.files=yi.filesFactory(t.files,t.baseLocale,r),this.filesMap=yi.filesMapFactory(this.files),this.locales=yi.localesFactory(this.files),this.baseLocale=this.locales.find((t=>t.isBaseLocale))}static createEmpty(t){return new yi({projectUrl:"",baseLocale:"",timestamp:0,files:{}},t)}static filesFactory(t,e,r){return Object.keys(t).reduce(((n,a)=>{const i=t[a].locales.map((t=>new di(t,e)));return n.push(new bi({...t[a],id:a,locales:i,baseUrl:r.baseUrl})),n}),[])}static filesMapFactory(t){return t.reduce(((t,e)=>(t[e.id]=e,t)),{})}static localesFactory(t){const e=t.reduce(((t,e)=>(t.push(...e.locales.map((t=>t.toCdnLocale()))),t)),[]);return vi(e,(t=>t.locale))}}class gi{constructor(t){e(this,"options"),this.options=gi.parseMetafileUrl(t)}get url(){return this.options.url}get baseUrl(){return this.options.baseUrl}get cdnId(){return this.options.cdnId}get jsonPath(){return this.options.jsonPath}static parseMetafileUrl(t){let e;try{e=new URL(t)}catch(t){throw new Error('Invalid param: "options.metafile" cannot be parsed as url.')}const r=e.pathname.match(/^\/(.*?)\/(.*?)\.(v2.json|js|ts)$/);if(null===r||4!==r.length)throw new Error('Invalid param: "options.metafile" contains invalid metafile url.');const n=r[1],a=r[2];return{url:t,baseUrl:e.origin,cdnId:n,jsonPath:`/${n}/${a}.v2.json`}}}class mi{constructor(t){e(this,"params"),e(this,"parsedData"),e(this,"data"),this.params=new gi(t.metafile),this.parsedData=null,this.data=yi.createEmpty(this.params)}setMetafile(t){this.parsedData=t,this.data=new yi(t,this.params)}}class ji{constructor(t){e(this,"context"),this.context=t}createCdnResponse(t){const{requests:e,responses:r,hasSingleFileResponse:n,hasSingleLocaleResponse:a}=t;return 0===r.length?{}:(this.cacheResponses(e,r),n&&a?r[0]:ji.transformResponses(t))}cacheResponses(t,e){e.forEach(((e,r)=>{const{metafileFile:n,metafileLocale:a}=t[r];n&&a&&this.context.cache.setIfMissed({metafileFile:n,metafileLocale:a,data:e})}))}static transformResponses(t){const{requests:e,responses:r,hasSingleFileResponse:n}=t;return r.reduce(((t,r,a)=>{const{metafileFile:i,metafileLocale:o}=e[a];return i&&o&&(n?t[o.locale]=r:(t[i.id]||(t[i.id]={}),t[i.id][o.locale]=r)),t}),{})}}class wi{constructor(t){e(this,"metafile"),e(this,"cdn"),e(this,"client"),e(this,"api"),e(this,"cache"),e(this,"responseFactory"),this.metafile=t.metafileContext,this.cdn=t.cdn,this.client=t.client,this.api=new r(this),this.cache=new de(this),this.responseFactory=new ji(this)}}var _i=function(t){return function(e,r,n){for(var a=-1,i=Object(e),o=n(e),s=o.length;s--;){var c=o[t?s:++a];if(!1===r(i[c],c,i))break}return e}}(),xi=un;var Oi=an;var Fi=function(t,e){return function(r,n){if(null==r)return r;if(!Oi(r))return t(r,n);for(var a=r.length,i=e?a:-1,o=Object(r);(e?i--:++i<a)&&!1!==n(o[i],i,o););return r}}((function(t,e){return t&&_i(t,e,xi)}));var Ai=tr,Mi=function(t,e){var r=[];return Fi(t,(function(t,n,a){e(t,n,a)&&r.push(t)})),r},Li=fi,Si=be;const Ei=a((function(t,e){return(Si(t)?Ai:Mi)(t,Li(e))}));var Ri=fi,Ui=an,qi=un;var Ii=function(t){return function(e,r,n){var a=Object(e);if(!Ui(e)){var i=Ri(r);e=qi(e),r=function(t){return i(a[t],t,a)}}var o=t(e,r,n);return o>-1?a[i?e[o]:o]:void 0}},Pi=/\s/;var $i=function(t){for(var e=t.length;e--&&Pi.test(t.charAt(e)););return e},zi=/^\s+/;var Ci=function(t){return t?t.slice(0,$i(t)+1).replace(zi,""):t},Bi=w,Ti=la,ki=/^[-+]0x[0-9a-f]+$/i,Di=/^0b[01]+$/i,Ni=/^0o[0-7]+$/i,Vi=parseInt;var Wi=function(t){if("number"==typeof t)return t;if(Ti(t))return NaN;if(Bi(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Bi(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ci(t);var r=Di.test(t);return r||Ni.test(t)?Vi(t.slice(2),r?2:8):ki.test(t)?NaN:+t},Gi=1/0;var Hi=function(t){return t?(t=Wi(t))===Gi||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var Ji=Gt,Ki=fi,Qi=function(t){var e=Hi(t),r=e%1;return e==e?r?e-r:e:0},Xi=Math.max;const Yi=a(Ii((function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var a=null==r?0:Qi(r);return a<0&&(a=Xi(n+a,0)),Ji(t,Ki(e),a)})));var Zi=Xr(Object.getPrototypeOf,Object),to=j,eo=Zi,ro=ge,no=Function.prototype,ao=Object.prototype,io=no.toString,oo=ao.hasOwnProperty,so=io.call(Object);const co=a((function(t){if(!ro(t)||"[object Object]"!=to(t))return!1;var e=eo(t);if(null===e)return!0;var r=oo.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&io.call(r)==so}));var uo=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t},lo=V,fo=function(){try{var t=lo(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var ho=function(t,e,r){"__proto__"==e&&fo?fo(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},po=ho,vo=ut,bo=Object.prototype.hasOwnProperty;var yo=function(t,e,r){var n=t[e];bo.call(t,e)&&vo(n,r)&&(void 0!==r||e in t)||po(t,e,r)},go=yo,mo=ho;var jo=function(t,e,r,n){var a=!r;r||(r={});for(var i=-1,o=e.length;++i<o;){var s=e[i],c=n?n(r[s],t[s],s,r,t):void 0;void 0===c&&(c=t[s]),a?mo(r,s,c):go(r,s,c)}return r},wo=jo,_o=un;var xo=function(t,e){return t&&wo(e,_o(e),t)};var Oo=w,Fo=Qr,Ao=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e},Mo=Object.prototype.hasOwnProperty;var Lo=Jr,So=function(t){if(!Oo(t))return Ao(t);var e=Fo(t),r=[];for(var n in t)("constructor"!=n||!e&&Mo.call(t,n))&&r.push(n);return r},Eo=an;var Ro=function(t){return Eo(t)?Lo(t,!0):So(t)},Uo=jo,qo=Ro;var Io=function(t,e){return t&&Uo(e,qo(e),t)},Po={exports:{}};!function(t,e){var r=c,n=e&&!e.nodeType&&e,a=n&&t&&!t.nodeType&&t,i=a&&a.exports===n?r.Buffer:void 0,o=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=o?o(r):new t.constructor(r);return t.copy(n),n}}(Po,Po.exports);var $o=Po.exports;var zo=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e},Co=jo,Bo=or;var To=function(t,e){return Co(t,Bo(t),e)},ko=Qe,Do=Zi,No=or,Vo=er,Wo=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)ko(e,No(t)),t=Do(t);return e}:Vo,Go=jo,Ho=Wo;var Jo=function(t,e){return Go(t,Ho(t),e)},Ko=Ze,Qo=Wo,Xo=Ro;var Yo=function(t){return Ko(t,Xo,Qo)},Zo=Object.prototype.hasOwnProperty;var ts=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&Zo.call(t,"index")&&(r.index=t.index,r.input=t.input),r},es=ke;var rs=function(t){var e=new t.constructor(t.byteLength);return new es(e).set(new es(t)),e},ns=rs;var as=function(t,e){var r=e?ns(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)},is=/\w*$/;var os=function(t){var e=new t.constructor(t.source,is.exec(t));return e.lastIndex=t.lastIndex,e},ss=u?u.prototype:void 0,cs=ss?ss.valueOf:void 0;var us=rs;var ls=rs,fs=as,hs=os,ps=function(t){return cs?Object(cs.call(t)):{}},vs=function(t,e){var r=e?us(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)};var ds=function(t,e,r){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return ls(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return fs(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return vs(t,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return hs(t);case"[object Symbol]":return ps(t)}},bs=w,ys=Object.create,gs=function(){function t(){}return function(e){if(!bs(e))return{};if(ys)return ys(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ms=Zi,js=Qr;var ws=function(t){return"function"!=typeof t.constructor||js(t)?{}:gs(ms(t))},_s=Pn,xs=ge;var Os=function(t){return xs(t)&&"[object Map]"==_s(t)},Fs=Ir,As=$r&&$r.isMap,Ms=As?Fs(As):Os,Ls=Pn,Ss=ge;var Es=function(t){return Ss(t)&&"[object Set]"==Ls(t)},Rs=Ir,Us=$r&&$r.isSet,qs=Us?Rs(Us):Es,Is=$e,Ps=uo,$s=yo,zs=xo,Cs=Io,Bs=$o,Ts=zo,ks=To,Ds=Jo,Ns=pn,Vs=Yo,Ws=Pn,Gs=ts,Hs=ds,Js=ws,Ks=be,Qs=Fr,Xs=Ms,Ys=w,Zs=qs,tc=un,ec=Ro,rc="[object Arguments]",nc="[object Function]",ac="[object Object]",ic={};ic[rc]=ic["[object Array]"]=ic["[object ArrayBuffer]"]=ic["[object DataView]"]=ic["[object Boolean]"]=ic["[object Date]"]=ic["[object Float32Array]"]=ic["[object Float64Array]"]=ic["[object Int8Array]"]=ic["[object Int16Array]"]=ic["[object Int32Array]"]=ic["[object Map]"]=ic["[object Number]"]=ic[ac]=ic["[object RegExp]"]=ic["[object Set]"]=ic["[object String]"]=ic["[object Symbol]"]=ic["[object Uint8Array]"]=ic["[object Uint8ClampedArray]"]=ic["[object Uint16Array]"]=ic["[object Uint32Array]"]=!0,ic["[object Error]"]=ic[nc]=ic["[object WeakMap]"]=!1;var oc=function t(e,r,n,a,i,o){var s,c=1&r,u=2&r,l=4&r;if(n&&(s=i?n(e,a,i,o):n(e)),void 0!==s)return s;if(!Ys(e))return e;var f=Ks(e);if(f){if(s=Gs(e),!c)return Ts(e,s)}else{var h=Ws(e),p=h==nc||"[object GeneratorFunction]"==h;if(Qs(e))return Bs(e,c);if(h==ac||h==rc||p&&!i){if(s=u||p?{}:Js(e),!c)return u?Ds(e,Cs(s,e)):ks(e,zs(s,e))}else{if(!ic[h])return i?e:{};s=Hs(e,h,c)}}o||(o=new Is);var v=o.get(e);if(v)return v;o.set(e,s),Zs(e)?e.forEach((function(a){s.add(t(a,r,n,a,e,o))})):Xs(e)&&e.forEach((function(a,i){s.set(i,t(a,r,n,i,e,o))}));var d=f?void 0:(l?u?Vs:Ns:u?ec:tc)(e);return Ps(d||e,(function(a,i){d&&(a=e[i=a]),$s(s,i,t(a,r,n,i,e,o))})),s},sc=oc,cc=sa;const uc=a((function(t){return cc(sc(t,1))})),lc=class t extends xe{constructor(){super(...arguments),e(this,"list",(()=>t.transformFiles(this.context.metafile.data.files))),e(this,"filter",(e=>{if(!e)throw new Error('Invalid param: missing required "options" parameter.');if(!F(e)&&!co(e))throw new Error('Invalid param: "options" must be function or object.');const r=t.transformFiles(this.context.metafile.data.files);return F(e)?r.filter(e):Ei(r,uc(e))})),e(this,"find",(e=>{if(!e)throw new Error('Invalid param: missing required "options" parameter.');if(!F(e)&&!co(e))throw new Error('Invalid param: "options" must be function or object.');const r=t.transformFiles(this.context.metafile.data.files);return F(e)?r.find(e):Yi(r,uc(e))})),e(this,"first",(()=>{if(0===this.context.metafile.data.files.length)throw new Error("File is missing in downloaded metafile.");return t.transformFiles(this.context.metafile.data.files)[0]}))}};e(lc,"transformFiles",(t=>t.map((t=>t.toCdnFile()))));let fc=lc;class hc extends xe{constructor(t){super(t),e(this,"files"),e(this,"locales",(t=>{const{excludeBaseLocale:e}=t||{},{locales:r}=this.context.metafile.data;return e?r.filter((t=>!t.isBaseLocale)):r})),e(this,"refresh",(async()=>{const t=await this.context.api.fetchMetafile();this.context.metafile.setMetafile(t)})),e(this,"switch",(async t=>{this.context.metafile.params=new gi(t.metafile),await this.refresh()})),this.files=new fc(t)}get projectUrl(){return this.context.metafile.data.projectUrl}get baseLocale(){return this.context.metafile.data.baseLocale}get url(){return this.context.metafile.params.url}}const pc=a((function(t){return void 0===t}));class vc{constructor(t){e(this,"data"),e(this,"context"),this.context=t.context,this.data=t.data||{}}}class dc{constructor(t){e(this,"files"),e(this,"localesMap"),e(this,"hasSingleFileResponse"),e(this,"hasSingleLocaleResponse"),e(this,"context"),this.files=[],this.localesMap=new vc({context:t}),this.hasSingleFileResponse=!1,this.hasSingleLocaleResponse=!1,this.context=t}async execute(){const t=this.getPromises(),e=t.map((t=>t[0])),r=t.map((t=>t[1])),n=await Promise.all(e);return this.context.responseFactory.createCdnResponse({requests:r,responses:n,localesMap:this.localesMap,hasSingleFileResponse:this.hasSingleFileResponse,hasSingleLocaleResponse:this.hasSingleLocaleResponse})}getPromises(){return this.files.reduce(((t,e)=>(this.localesMap.data[e.id]&&t.push(...this.localesMap.data[e.id].map((t=>{const r={metafileFile:e,metafileLocale:t};return[this.context.api.fetchLocale(r),r]}))),t)),[])}}class bc{constructor(t){e(this,"context"),e(this,"request"),this.context=t,this.request=new dc(this.context)}addFiles(t){if(!(co(t)||_e(t)||pc(t)||ye(t)))throw new Error('Invalid param: "request.files" must be object, array, string or undefined.');if(ye(t)&&t.forEach((t=>{if(!co(t)&&!_e(t))throw new Error('Invalid param: array "request.files" must contain objects or strings.')})),_e(t)){this.request.hasSingleFileResponse=!0;const e=this.context.metafile.data.files.find((e=>e.id===t));if(!(e instanceof bi))throw new Error(`File not found: "${t}".`);this.request.files=[e]}else if(pc(t))this.request.files=[...this.context.metafile.data.files];else if(ye(t))this.request.files=t.map((t=>{let e;if(_e(t)){const r=this.context.metafile.data.files.find((e=>e.id===t));if(pc(r))throw new Error(`File not found: "${t}".`);e=r}else{const r=this.context.metafile.data.files.find((e=>e.id===t.id));if(pc(r))throw new Error(`File not found: "${t.id}".`);e=r}return e}));else if(co(t)){this.request.hasSingleFileResponse=!0;const e=this.context.metafile.data.files.find((e=>e.id===t.id));if(pc(e))throw new Error(`File not found: "${t.id}".`);this.request.files=[e]}return this}addLocales(t,e){if(!(_e(t)||pc(t)||ye(t)))throw new Error('Invalid param: "request.locales" must be array, string or undefined.');return ye(t)&&t.forEach((t=>{if(!_e(t))throw new Error('Invalid param: array "request.locales" must contain strings.')})),_e(t)?(this.request.hasSingleLocaleResponse=!0,this.request.files.reduce(((e,r)=>(e.data[r.id]=r.locales.filter((e=>e.locale===t)),e)),this.request.localesMap)):pc(t)?this.request.files.reduce(((t,r)=>(t.data[r.id]=e?r.locales.filter((t=>!t.isBaseLocale)):r.locales,t)),this.request.localesMap):ye(t)&&this.request.files.reduce(((e,r)=>(e.data[r.id]=r.locales.filter((e=>t.includes(e.locale))),e)),this.request.localesMap),this}getCdnRequest(){const t=this.request;return this.request=new dc(this.context),t}}class yc{constructor(t){e(this,"baseUrl"),this.baseUrl=t}async get(t){const e=await fetch(`${this.baseUrl}${t}`),r=e.headers.get("content-type")||"",n=["application/json5","application/json"].includes(r);if(e.status>=400)throw new Error(`Request failed with status code ${e.status}`);let a="";if(n)try{a=await e.json()}catch(t){a={}}else try{a=await e.text()}catch(t){a=""}return a}}class gc{constructor(t){e(this,"metafile"),e(this,"cache"),e(this,"context"),e(this,"fetch",(async t=>{const{files:e,locales:r,excludeBaseLocale:n}=t||{};return new bc(this.context).addFiles(e).addLocales(r,n).getCdnRequest().execute()}));const r=new mi(t),n=new yc(r.params.baseUrl);this.context=new wi({metafileContext:r,cdn:this,client:n}),this.metafile=new hc(this.context),this.cache=new Oe(this.context)}static async create(t){if(!t)throw new Error('Invalid param: missing required "options" parameter.');if(!_e(t.metafile))throw new Error('Invalid param: "options.metafile" must be string.');const e=new gc(t);return await e.metafile.refresh(),e}}exports.Api=r,exports.CdnBase=xe,exports.CdnCache=Oe,exports.CdnClient=gc,exports.CdnMetafile=hc,exports.CdnMetafileFiles=fc,exports.Context=wi,exports.FetchHttpAdapter=yc,exports.LocalesCache=de,exports.LocalesMap=vc,exports.MemoryCacheAdapter=ve,exports.MetafileContext=mi,exports.MetafileData=yi,exports.MetafileFile=bi,exports.MetafileLocale=di,exports.MetafileParams=gi,exports.Request=dc,exports.RequestBuilder=bc,exports.ResponseFactory=ji;
6
6
  //# sourceMappingURL=localazy-cdn-client.min.cjs.map