generaltranslation 6.3.1 โ†’ 6.3.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Content, JsxChildren, JsxTranslationResult, ContentTranslationResult, TranslationError, IcuTranslationResult, Metadata } from './types';
1
+ import { Content, JsxChildren, JsxTranslationResult, ContentTranslationResult, TranslationError, IcuTranslationResult, Metadata, CustomMapping } from './types';
2
2
  import { LocaleProperties } from './locales/getLocaleProperties';
3
- import { CustomMapping } from './locales/customLocaleMapping';
3
+ import { FullCustomMapping } from './locales/customLocaleMapping';
4
4
  /**
5
5
  * Type representing the constructor parameters for the GT class.
6
6
  */
@@ -10,7 +10,7 @@ type GTConstructorParams = {
10
10
  sourceLocale?: string;
11
11
  projectId?: string;
12
12
  baseUrl?: string;
13
- customMapping?: Record<string, LocaleProperties | string>;
13
+ customMapping?: CustomMapping;
14
14
  };
15
15
  /**
16
16
  * GT is the core driver for the General Translation library.
@@ -21,7 +21,7 @@ declare class GT {
21
21
  sourceLocale: string;
22
22
  projectId: string;
23
23
  baseUrl: string;
24
- customMapping: Record<string, LocaleProperties | string>;
24
+ customMapping: CustomMapping;
25
25
  /**
26
26
  * Constructs an instance of the GT class.
27
27
  *
@@ -125,10 +125,10 @@ export declare function getLocaleDirection(locale: string): 'ltr' | 'rtl';
125
125
  *
126
126
  * @param {string} locale - A BCP-47 locale code.
127
127
  * @param {string} [defaultLocale = 'en'] - The locale for display names.
128
- * @param {CustomMapping} [customMapping] - Optional custom mapping of locale codes to names.
128
+ * @param {FullCustomMapping} [customMapping] - Optional custom mapping of locale codes to names.
129
129
  * @returns {string} The display name corresponding to the code.
130
130
  */
131
- export declare function getLocaleName(locale: string, defaultLocale?: string, customMapping?: CustomMapping): string;
131
+ export declare function getLocaleName(locale: string, defaultLocale?: string, customMapping?: FullCustomMapping): string;
132
132
  /**
133
133
  * Generates linguistic details for a given locale code.
134
134
  *
@@ -138,7 +138,7 @@ export declare function getLocaleName(locale: string, defaultLocale?: string, cu
138
138
  *
139
139
  * @param {string} locale - The locale code to get properties for (e.g., "de-AT").
140
140
  * @param {string} [defaultLocale=libraryDefaultLocale] - The default locale code for display names.
141
- * @param {CustomMapping} [customMapping] - Optional custom mapping of locale codes to properties.
141
+ * @param {FullCustomMapping} [customMapping] - Optional custom mapping of locale codes to properties.
142
142
  * @returns {LocaleProperties} - An object containing detailed information about the locale.
143
143
  *
144
144
  * @property {string} code - The full locale code, e.g., "de-AT".
@@ -163,7 +163,7 @@ export declare function getLocaleName(locale: string, defaultLocale?: string, cu
163
163
  * @property {string} nativeMinimizedName - Minimized language name in the native language, e.g., "ร–sterreichisches Deutsch".
164
164
  * @property {string} emoji - The emoji associated with the locale's region, if applicable.
165
165
  */
166
- export declare function getLocaleProperties(locale: string, defaultLocale?: string, customMapping?: CustomMapping): {
166
+ export declare function getLocaleProperties(locale: string, defaultLocale?: string, customMapping?: FullCustomMapping): {
167
167
  code: string;
168
168
  name: string;
169
169
  nativeName: string;
@@ -194,7 +194,7 @@ export declare function getLocaleProperties(locale: string, defaultLocale?: stri
194
194
  * @param customMapping - An optional custom mapping of locale codes to emojis.
195
195
  * @returns The emoji representing the locale or its region, or a default emoji if no specific match is found.
196
196
  */
197
- export declare function getLocaleEmoji(locale: string, customMapping?: CustomMapping): string;
197
+ export declare function getLocaleEmoji(locale: string, customMapping?: FullCustomMapping): string;
198
198
  /**
199
199
  * Checks if a given BCP 47 locale code is valid.
200
200
  * @param {string} locale - The BCP 47 locale code to validate.
@@ -339,4 +339,4 @@ export declare function determineLocale(locales: string | string[], approvedLoca
339
339
  * @returns {boolean} - Returns `true` if translation is required, otherwise `false`.
340
340
  */
341
341
  export declare function requiresTranslation(sourceLocale: string, targetLocale: string, approvedLocales?: string[]): boolean;
342
- export default GT;
342
+ export { GT };
@@ -1,2 +1,2 @@
1
- var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function u(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}l((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(l){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,l])}}}"function"==typeof SuppressedError&&SuppressedError;var r=new(function(){function e(){this.cache=new Map}return e.prototype._generateKey=function(e,t,n){void 0===n&&(n={});var r=Array.isArray(t)?t.join(","):t,o=n?JSON.stringify(n,Object.keys(n).sort()):"{}";return"".concat(e,":").concat(r,":").concat(o)},e.prototype.get=function(e,t,n){void 0===n&&(n={});var r=this._generateKey(e,t,n);if(!this.cache.has(r)){var o=new Intl[e](t,n);this.cache.set(r,o)}return this.cache.get(r)},e}()),o="en",i=6e4,a=["Cham","Jamo","Kawi","Lisu","Toto","Thai"],u=function(e){try{var t=r.get("Locale",e),n=t.language,i=t.region,u=t.script;if(e.split("-").length!==(l=1,i&&(l+=1),u&&(l+=1),l))return!1;if(r.get("DisplayNames",[o],{type:"language"}).of(n)===n&&!function(e){return e>="qaa"&&e<="qtz"}(n))return!1;if(i)if(r.get("DisplayNames",[o],{type:"region"}).of(i)===i)return!1;if(u)if(r.get("DisplayNames",[o],{type:"script"}).of(u)===u&&!a.includes(u))return!1;return!0}catch(e){return!1}var l},l=function(e){try{return Intl.getCanonicalLocales(e)[0]}catch(t){return e}};function c(){for(var e,t,n,o,i,a,u,c,s,v,d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];try{for(var p=d.flat().map(l),g=0;g<p.length;g++)for(var m=g+1;m<p.length;m++)if(e=p[g],t=p[m],n=void 0,o=void 0,i=void 0,a=void 0,u=void 0,c=void 0,s=void 0,v=void 0,n=r.get("Locale",e),o=n.language,i=n.region,a=n.script,u=r.get("Locale",t),c=u.language,s=u.region,v=u.script,o!==c||i&&s&&i!==s||a&&v&&a!==v)return!1;return!0}catch(e){return console.error(e),!1}}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{var n=e.flat().map((function(e){return r.get("Locale",e).language}));return n.every((function(e){return e===n[0]}))}catch(e){return console.error(e),!1}}function v(r,o,a,u){return t(this,void 0,void 0,(function(){var t,l,c,s,v,d,f,p;return n(this,(function(n){switch(n.label){case 0:t=new AbortController,l=t.signal,(c=Math.min((null==u?void 0:u.timeout)||i,i))&&setTimeout((function(){return t.abort()}),c),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,fetch("".concat(r.baseUrl).concat("/v1/translate/content"),{method:"POST",headers:e(e({"Content-Type":"application/json"},r.apiKey&&{"x-gt-api-key":r.apiKey}),r.devApiKey&&{"x-gt-dev-api-key":r.devApiKey}),body:JSON.stringify({source:o,targetLocale:a,metadata:u}),signal:l})];case 2:return s=n.sent(),[3,4];case 3:if("AbortError"===(null==(v=n.sent())?void 0:v.name))throw new Error("Translation request timed out. This has either occured due to the translation of an unusually large request or a translation failure in the API.");throw v;case 4:return s.ok?[3,6]:(d=Error.bind,p=(f="".concat(s.status,": ")).concat,[4,s.text()]);case 5:throw new(d.apply(Error,[void 0,p.apply(f,[n.sent()])]));case 6:return[4,s.json()];case 7:return[2,n.sent()]}}))}))}function d(r,o,a,u){return t(this,void 0,void 0,(function(){var t,l,c,s,v,d,f,p;return n(this,(function(n){switch(n.label){case 0:t=new AbortController,l=t.signal,(c=Math.min((null==u?void 0:u.timeout)||i,i))&&setTimeout((function(){return t.abort()}),c),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,fetch("".concat(r.baseUrl).concat("/v1/translate/react"),{method:"POST",headers:e(e({"Content-Type":"application/json"},r.apiKey&&{"x-gt-api-key":r.apiKey}),r.devApiKey&&{"x-gt-dev-api-key":r.devApiKey}),body:JSON.stringify({source:o,targetLocale:a,metadata:u}),signal:l})];case 2:return s=n.sent(),[3,4];case 3:if("AbortError"===(null==(v=n.sent())?void 0:v.name))throw new Error("Translation request timed out. This has either occured due to the translation of an unusually large request or a translation failure in the API.");throw v;case 4:return s.ok?[3,6]:(d=Error.bind,p=(f="".concat(s.status,": ")).concat,[4,s.text()]);case 5:throw new(d.apply(Error,[void 0,p.apply(f,[n.sent()])]));case 6:return[4,s.json()];case 7:return[2,n.sent()]}}))}))}function f(r,o,a,u){return t(this,void 0,void 0,(function(){var t,l,c,s,v,d,f,p;return n(this,(function(n){switch(n.label){case 0:t=new AbortController,l=t.signal,(c=Math.min((null==u?void 0:u.timeout)||i,i))&&setTimeout((function(){return t.abort()}),c),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,fetch("".concat(r.baseUrl).concat("/v1/translate/icu"),{method:"POST",headers:e(e({"Content-Type":"application/json"},r.apiKey&&{"x-gt-api-key":r.apiKey}),r.devApiKey&&{"x-gt-dev-api-key":r.devApiKey}),body:JSON.stringify({source:o,targetLocale:a,metadata:u}),signal:l})];case 2:return s=n.sent(),[3,4];case 3:if("AbortError"===(null==(v=n.sent())?void 0:v.name))throw new Error("Translation request timed out. This has either occured due to the translation of an unusually large request or a translation failure in the API.");throw v;case 4:return s.ok?[3,6]:(d=Error.bind,p=(f="".concat(s.status,": ")).concat,[4,s.text()]);case 5:throw new(d.apply(Error,[void 0,p.apply(f,[n.sent()])]));case 6:return[4,s.json()];case 7:return[2,n.sent()]}}))}))}var p=function(e,t,n){if(null==e?void 0:e[t])return"string"==typeof e[t]?"name"===n?e[t]:void 0:e[t][n]};function g(e,t){try{var n=l(e),o=r.get("Locale",n),i=o.language,a=o.region;if(t)for(var u=0,c=[e,n,i];u<c.length;u++){var s=p(t,c[u],"emoji");if(s)return s}if(a&&N[a])return N[a];var v=o.maximize(),d=v.region||"";return h[v.language]||N[d]||y}catch(e){return y}}var m="๐ŸŒ",y=m,h={ca:m,eu:m,ku:m,bo:"๐ŸŒ",ug:"๐ŸŒ",gd:"๐Ÿด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ",cy:"๐Ÿด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ",gv:"๐Ÿ‡ฎ๐Ÿ‡ฒ",grc:"๐Ÿบ"},N={AF:"๐Ÿ‡ฆ๐Ÿ‡ซ",AX:"๐Ÿ‡ฆ๐Ÿ‡ฝ",AL:"๐Ÿ‡ฆ๐Ÿ‡ฑ",DZ:"๐Ÿ‡ฉ๐Ÿ‡ฟ",AS:"๐Ÿ‡ฆ๐Ÿ‡ธ",AD:"๐Ÿ‡ฆ๐Ÿ‡ฉ",AO:"๐Ÿ‡ฆ๐Ÿ‡ด",AI:"๐Ÿ‡ฆ๐Ÿ‡ฎ",AQ:"๐Ÿ‡ฆ๐Ÿ‡ถ",AG:"๐Ÿ‡ฆ๐Ÿ‡ฌ",AR:"๐Ÿ‡ฆ๐Ÿ‡ท",AM:"๐Ÿ‡ฆ๐Ÿ‡ฒ",AW:"๐Ÿ‡ฆ๐Ÿ‡ผ",AU:"๐Ÿ‡ฆ๐Ÿ‡บ",AT:"๐Ÿ‡ฆ๐Ÿ‡น",AZ:"๐Ÿ‡ฆ๐Ÿ‡ฟ",BS:"๐Ÿ‡ง๐Ÿ‡ธ",BH:"๐Ÿ‡ง๐Ÿ‡ญ",BD:"๐Ÿ‡ง๐Ÿ‡ฉ",BB:"๐Ÿ‡ง๐Ÿ‡ง",BY:"๐Ÿ‡ง๐Ÿ‡พ",BE:"๐Ÿ‡ง๐Ÿ‡ช",BZ:"๐Ÿ‡ง๐Ÿ‡ฟ",BJ:"๐Ÿ‡ง๐Ÿ‡ฏ",BM:"๐Ÿ‡ง๐Ÿ‡ฒ",BT:"๐Ÿ‡ง๐Ÿ‡น",BO:"๐Ÿ‡ง๐Ÿ‡ด",BQ:"๐Ÿ‡ง๐Ÿ‡ถ",BA:"๐Ÿ‡ง๐Ÿ‡ฆ",BW:"๐Ÿ‡ง๐Ÿ‡ผ",BV:"๐Ÿ‡ง๐Ÿ‡ป",BR:"๐Ÿ‡ง๐Ÿ‡ท",IO:"๐Ÿ‡ฎ๐Ÿ‡ด",BN:"๐Ÿ‡ง๐Ÿ‡ณ",BG:"๐Ÿ‡ง๐Ÿ‡ฌ",BF:"๐Ÿ‡ง๐Ÿ‡ซ",BI:"๐Ÿ‡ง๐Ÿ‡ฎ",CV:"๐Ÿ‡จ๐Ÿ‡ป",KH:"๐Ÿ‡ฐ๐Ÿ‡ญ",CM:"๐Ÿ‡จ๐Ÿ‡ฒ",CA:"๐Ÿ‡จ๐Ÿ‡ฆ",KY:"๐Ÿ‡ฐ๐Ÿ‡พ",CF:"๐Ÿ‡จ๐Ÿ‡ซ",TD:"๐Ÿ‡น๐Ÿ‡ฉ",CL:"๐Ÿ‡จ๐Ÿ‡ฑ",CN:"๐Ÿ‡จ๐Ÿ‡ณ",CX:"๐Ÿ‡จ๐Ÿ‡ฝ",CC:"๐Ÿ‡จ๐Ÿ‡จ",CO:"๐Ÿ‡จ๐Ÿ‡ด",KM:"๐Ÿ‡ฐ๐Ÿ‡ฒ",CD:"๐Ÿ‡จ๐Ÿ‡ฉ",CG:"๐Ÿ‡จ๐Ÿ‡ฌ",CK:"๐Ÿ‡จ๐Ÿ‡ฐ",CR:"๐Ÿ‡จ๐Ÿ‡ท",CI:"๐Ÿ‡จ๐Ÿ‡ฎ",HR:"๐Ÿ‡ญ๐Ÿ‡ท",CU:"๐Ÿ‡จ๐Ÿ‡บ",CW:"๐Ÿ‡จ๐Ÿ‡ผ",CY:"๐Ÿ‡จ๐Ÿ‡พ",CZ:"๐Ÿ‡จ๐Ÿ‡ฟ",DK:"๐Ÿ‡ฉ๐Ÿ‡ฐ",DJ:"๐Ÿ‡ฉ๐Ÿ‡ฏ",DM:"๐Ÿ‡ฉ๐Ÿ‡ฒ",DO:"๐Ÿ‡ฉ๐Ÿ‡ด",EC:"๐Ÿ‡ช๐Ÿ‡จ",EG:"๐Ÿ‡ช๐Ÿ‡ฌ",SV:"๐Ÿ‡ธ๐Ÿ‡ป",GQ:"๐Ÿ‡ฌ๐Ÿ‡ถ",ER:"๐Ÿ‡ช๐Ÿ‡ท",EE:"๐Ÿ‡ช๐Ÿ‡ช",SZ:"๐Ÿ‡ธ๐Ÿ‡ฟ",ET:"๐Ÿ‡ช๐Ÿ‡น",FK:"๐Ÿ‡ซ๐Ÿ‡ฐ",FO:"๐Ÿ‡ซ๐Ÿ‡ด",FJ:"๐Ÿ‡ซ๐Ÿ‡ฏ",FI:"๐Ÿ‡ซ๐Ÿ‡ฎ",FR:"๐Ÿ‡ซ๐Ÿ‡ท",GF:"๐Ÿ‡ฌ๐Ÿ‡ซ",PF:"๐Ÿ‡ต๐Ÿ‡ซ",TF:"๐Ÿ‡น๐Ÿ‡ซ",GA:"๐Ÿ‡ฌ๐Ÿ‡ฆ",GM:"๐Ÿ‡ฌ๐Ÿ‡ฒ",GE:"๐Ÿ‡ฌ๐Ÿ‡ช",DE:"๐Ÿ‡ฉ๐Ÿ‡ช",GH:"๐Ÿ‡ฌ๐Ÿ‡ญ",GI:"๐Ÿ‡ฌ๐Ÿ‡ฎ",GR:"๐Ÿ‡ฌ๐Ÿ‡ท",GL:"๐Ÿ‡ฌ๐Ÿ‡ฑ",GD:"๐Ÿ‡ฌ๐Ÿ‡ฉ",GP:"๐Ÿ‡ฌ๐Ÿ‡ต",GU:"๐Ÿ‡ฌ๐Ÿ‡บ",GT:"๐Ÿ‡ฌ๐Ÿ‡น",GG:"๐Ÿ‡ฌ๐Ÿ‡ฌ",GN:"๐Ÿ‡ฌ๐Ÿ‡ณ",GW:"๐Ÿ‡ฌ๐Ÿ‡ผ",GY:"๐Ÿ‡ฌ๐Ÿ‡พ",HT:"๐Ÿ‡ญ๐Ÿ‡น",HM:"๐Ÿ‡ญ๐Ÿ‡ฒ",VA:"๐Ÿ‡ป๐Ÿ‡ฆ",HN:"๐Ÿ‡ญ๐Ÿ‡ณ",HK:"๐Ÿ‡ญ๐Ÿ‡ฐ",HU:"๐Ÿ‡ญ๐Ÿ‡บ",IS:"๐Ÿ‡ฎ๐Ÿ‡ธ",IN:"๐Ÿ‡ฎ๐Ÿ‡ณ",ID:"๐Ÿ‡ฎ๐Ÿ‡ฉ",IR:"๐Ÿ‡ฎ๐Ÿ‡ท",IQ:"๐Ÿ‡ฎ๐Ÿ‡ถ",IE:"๐Ÿ‡ฎ๐Ÿ‡ช",IM:"๐Ÿ‡ฎ๐Ÿ‡ฒ",IL:"๐Ÿ‡ฎ๐Ÿ‡ฑ",IT:"๐Ÿ‡ฎ๐Ÿ‡น",JM:"๐Ÿ‡ฏ๐Ÿ‡ฒ",JP:"๐Ÿ‡ฏ๐Ÿ‡ต",JE:"๐Ÿ‡ฏ๐Ÿ‡ช",JO:"๐Ÿ‡ฏ๐Ÿ‡ด",KZ:"๐Ÿ‡ฐ๐Ÿ‡ฟ",KE:"๐Ÿ‡ฐ๐Ÿ‡ช",KI:"๐Ÿ‡ฐ๐Ÿ‡ฎ",KP:"๐Ÿ‡ฐ๐Ÿ‡ต",KR:"๐Ÿ‡ฐ๐Ÿ‡ท",KW:"๐Ÿ‡ฐ๐Ÿ‡ผ",KG:"๐Ÿ‡ฐ๐Ÿ‡ฌ",LA:"๐Ÿ‡ฑ๐Ÿ‡ฆ",LV:"๐Ÿ‡ฑ๐Ÿ‡ป",LB:"๐Ÿ‡ฑ๐Ÿ‡ง",LS:"๐Ÿ‡ฑ๐Ÿ‡ธ",LR:"๐Ÿ‡ฑ๐Ÿ‡ท",LY:"๐Ÿ‡ฑ๐Ÿ‡พ",LI:"๐Ÿ‡ฑ๐Ÿ‡ฎ",LT:"๐Ÿ‡ฑ๐Ÿ‡น",LU:"๐Ÿ‡ฑ๐Ÿ‡บ",MO:"๐Ÿ‡ฒ๐Ÿ‡ด",MG:"๐Ÿ‡ฒ๐Ÿ‡ฌ",MW:"๐Ÿ‡ฒ๐Ÿ‡ผ",MY:"๐Ÿ‡ฒ๐Ÿ‡พ",MV:"๐Ÿ‡ฒ๐Ÿ‡ป",ML:"๐Ÿ‡ฒ๐Ÿ‡ฑ",MT:"๐Ÿ‡ฒ๐Ÿ‡น",MH:"๐Ÿ‡ฒ๐Ÿ‡ญ",MQ:"๐Ÿ‡ฒ๐Ÿ‡ถ",MR:"๐Ÿ‡ฒ๐Ÿ‡ท",MU:"๐Ÿ‡ฒ๐Ÿ‡บ",YT:"๐Ÿ‡พ๐Ÿ‡น",MX:"๐Ÿ‡ฒ๐Ÿ‡ฝ",FM:"๐Ÿ‡ซ๐Ÿ‡ฒ",MD:"๐Ÿ‡ฒ๐Ÿ‡ฉ",MC:"๐Ÿ‡ฒ๐Ÿ‡จ",MN:"๐Ÿ‡ฒ๐Ÿ‡ณ",ME:"๐Ÿ‡ฒ๐Ÿ‡ช",MS:"๐Ÿ‡ฒ๐Ÿ‡ธ",MA:"๐Ÿ‡ฒ๐Ÿ‡ฆ",MZ:"๐Ÿ‡ฒ๐Ÿ‡ฟ",MM:"๐Ÿ‡ฒ๐Ÿ‡ฒ",NA:"๐Ÿ‡ณ๐Ÿ‡ฆ",NR:"๐Ÿ‡ณ๐Ÿ‡ท",NP:"๐Ÿ‡ณ๐Ÿ‡ต",NL:"๐Ÿ‡ณ๐Ÿ‡ฑ",NC:"๐Ÿ‡ณ๐Ÿ‡จ",NZ:"๐Ÿ‡ณ๐Ÿ‡ฟ",NI:"๐Ÿ‡ณ๐Ÿ‡ฎ",NE:"๐Ÿ‡ณ๐Ÿ‡ช",NG:"๐Ÿ‡ณ๐Ÿ‡ฌ",NU:"๐Ÿ‡ณ๐Ÿ‡บ",NF:"๐Ÿ‡ณ๐Ÿ‡ซ",MK:"๐Ÿ‡ฒ๐Ÿ‡ฐ",MP:"๐Ÿ‡ฒ๐Ÿ‡ต",NO:"๐Ÿ‡ณ๐Ÿ‡ด",OM:"๐Ÿ‡ด๐Ÿ‡ฒ",PK:"๐Ÿ‡ต๐Ÿ‡ฐ",PW:"๐Ÿ‡ต๐Ÿ‡ผ",PS:"๐Ÿ‡ต๐Ÿ‡ธ",PA:"๐Ÿ‡ต๐Ÿ‡ฆ",PG:"๐Ÿ‡ต๐Ÿ‡ฌ",PY:"๐Ÿ‡ต๐Ÿ‡พ",PE:"๐Ÿ‡ต๐Ÿ‡ช",PH:"๐Ÿ‡ต๐Ÿ‡ญ",PN:"๐Ÿ‡ต๐Ÿ‡ณ",PL:"๐Ÿ‡ต๐Ÿ‡ฑ",PT:"๐Ÿ‡ต๐Ÿ‡น",PR:"๐Ÿ‡ต๐Ÿ‡ท",QA:"๐Ÿ‡ถ๐Ÿ‡ฆ",RE:"๐Ÿ‡ท๐Ÿ‡ช",RO:"๐Ÿ‡ท๐Ÿ‡ด",RU:"๐Ÿ‡ท๐Ÿ‡บ",RW:"๐Ÿ‡ท๐Ÿ‡ผ",BL:"๐Ÿ‡ง๐Ÿ‡ฑ",SH:"๐Ÿ‡ธ๐Ÿ‡ญ",KN:"๐Ÿ‡ฐ๐Ÿ‡ณ",LC:"๐Ÿ‡ฑ๐Ÿ‡จ",MF:"๐Ÿ‡ฒ๐Ÿ‡ซ",PM:"๐Ÿ‡ต๐Ÿ‡ฒ",VC:"๐Ÿ‡ป๐Ÿ‡จ",WS:"๐Ÿ‡ผ๐Ÿ‡ธ",SM:"๐Ÿ‡ธ๐Ÿ‡ฒ",ST:"๐Ÿ‡ธ๐Ÿ‡น",SA:"๐Ÿ‡ธ๐Ÿ‡ฆ",SN:"๐Ÿ‡ธ๐Ÿ‡ณ",RS:"๐Ÿ‡ท๐Ÿ‡ธ",SC:"๐Ÿ‡ธ๐Ÿ‡จ",SL:"๐Ÿ‡ธ๐Ÿ‡ฑ",SG:"๐Ÿ‡ธ๐Ÿ‡ฌ",SX:"๐Ÿ‡ธ๐Ÿ‡ฝ",SK:"๐Ÿ‡ธ๐Ÿ‡ฐ",SI:"๐Ÿ‡ธ๐Ÿ‡ฎ",SB:"๐Ÿ‡ธ๐Ÿ‡ง",SO:"๐Ÿ‡ธ๐Ÿ‡ด",ZA:"๐Ÿ‡ฟ๐Ÿ‡ฆ",GS:"๐Ÿ‡ฌ๐Ÿ‡ธ",SS:"๐Ÿ‡ธ๐Ÿ‡ธ",ES:"๐Ÿ‡ช๐Ÿ‡ธ",LK:"๐Ÿ‡ฑ๐Ÿ‡ฐ",SD:"๐Ÿ‡ธ๐Ÿ‡ฉ",SR:"๐Ÿ‡ธ๐Ÿ‡ท",SJ:"๐Ÿ‡ธ๐Ÿ‡ฏ",SE:"๐Ÿ‡ธ๐Ÿ‡ช",CH:"๐Ÿ‡จ๐Ÿ‡ญ",SY:"๐Ÿ‡ธ๐Ÿ‡พ",TW:"๐Ÿ‡น๐Ÿ‡ผ",TJ:"๐Ÿ‡น๐Ÿ‡ฏ",TZ:"๐Ÿ‡น๐Ÿ‡ฟ",TH:"๐Ÿ‡น๐Ÿ‡ญ",TL:"๐Ÿ‡น๐Ÿ‡ฑ",TG:"๐Ÿ‡น๐Ÿ‡ฌ",TK:"๐Ÿ‡น๐Ÿ‡ฐ",TO:"๐Ÿ‡น๐Ÿ‡ด",TT:"๐Ÿ‡น๐Ÿ‡น",TN:"๐Ÿ‡น๐Ÿ‡ณ",TR:"๐Ÿ‡น๐Ÿ‡ท",TM:"๐Ÿ‡น๐Ÿ‡ฒ",TC:"๐Ÿ‡น๐Ÿ‡จ",TV:"๐Ÿ‡น๐Ÿ‡ป",UG:"๐Ÿ‡บ๐Ÿ‡ฌ",UA:"๐Ÿ‡บ๐Ÿ‡ฆ",AE:"๐Ÿ‡ฆ๐Ÿ‡ช",GB:"๐Ÿ‡ฌ๐Ÿ‡ง",US:"๐Ÿ‡บ๐Ÿ‡ธ",UM:"๐Ÿ‡บ๐Ÿ‡ฒ",UY:"๐Ÿ‡บ๐Ÿ‡พ",UZ:"๐Ÿ‡บ๐Ÿ‡ฟ",VU:"๐Ÿ‡ป๐Ÿ‡บ",VE:"๐Ÿ‡ป๐Ÿ‡ช",VN:"๐Ÿ‡ป๐Ÿ‡ณ",VG:"๐Ÿ‡ป๐Ÿ‡ฌ",VI:"๐Ÿ‡ป๐Ÿ‡ฎ",WF:"๐Ÿ‡ผ๐Ÿ‡ซ",EH:"๐Ÿ‡ช๐Ÿ‡ญ",YE:"๐Ÿ‡พ๐Ÿ‡ช",ZM:"๐Ÿ‡ฟ๐Ÿ‡ฒ",ZW:"๐Ÿ‡ฟ๐Ÿ‡ผ",EU:"๐Ÿ‡ช๐Ÿ‡บ"};function b(e,t){if(t){for(var n={},r=0,o=e;r<o.length;r++){var i=t[o[r]];"string"==typeof i?n.name=i:i&&Object.assign(n,i)}return n}}function C(e,t,n){void 0===t&&(t=o),t||(t=o);try{var i=l(e),a=r.get("Locale",e),c=b([e,i,W=a.language],n),s=a.region,v=a.maximize(),d=v.toString(),f=a.region||(null==c?void 0:c.regionCode)||v.region||"",p=a.script||(null==c?void 0:c.scriptCode)||v.script||"",m=a.minimize().toString(),h=[t,e,o],N=[e,t,o],C=r.get("DisplayNames",h,{type:"language"}),S=r.get("DisplayNames",N,{type:"language"}),M=null==c?void 0:c.name,L=(null==c?void 0:c.nativeName)||(null==c?void 0:c.name),T=M||C.of(e)||e,A=L||S.of(e)||e,w=(null==c?void 0:c.maximizedName)||M||C.of(d)||e,E=(null==c?void 0:c.nativeMaximizedName)||L||S.of(d)||e,K=(null==c?void 0:c.minimizedName)||M||C.of(m)||e,O=(null==c?void 0:c.nativeMinimizedName)||L||S.of(m)||e,G=(null==c?void 0:c.languageName)||M||C.of(W)||e,x=(null==c?void 0:c.nativeLanguageName)||L||S.of(W)||e,I=s?"".concat(G," (").concat(s,")"):G,P=(s?"".concat(x," (").concat(s,")"):x)||I,R=r.get("DisplayNames",h,{type:"region"}),j=r.get("DisplayNames",N,{type:"region"}),D=(null==c?void 0:c.regionName)||(f?R.of(f):"")||"",z=(null==c?void 0:c.nativeRegionName)||(f?j.of(f):"")||"",k=r.get("DisplayNames",h,{type:"script"}),B=r.get("DisplayNames",N,{type:"script"});return{code:i,name:T,nativeName:A,maximizedCode:d,maximizedName:w,nativeMaximizedName:E,minimizedCode:m,minimizedName:K,nativeMinimizedName:O,languageCode:W,languageName:G,nativeLanguageName:x,nameWithRegionCode:I,nativeNameWithRegionCode:P,regionCode:f,regionName:D,nativeRegionName:z,scriptCode:p,scriptName:J=(null==c?void 0:c.scriptName)||(p?k.of(p):"")||"",nativeScriptName:H=(null==c?void 0:c.nativeScriptName)||(p?B.of(p):"")||"",emoji:(null==c?void 0:c.emoji)||g(i,n)}}catch(t){var U=u(e)?l(e):e,F=null==U?void 0:U.split("-"),W=(null==F?void 0:F[0])||U||"";f=F.length>2?null==F?void 0:F[2]:(null==F?void 0:F[1])||"",p=(null==F?void 0:F[3])||"";U=(null==(c=b([U,W],n))?void 0:c.code)||U;T=(null==c?void 0:c.name)||U,A=(null==c?void 0:c.nativeName)||T,d=(null==c?void 0:c.maximizedCode)||U,w=(null==c?void 0:c.maximizedName)||T,E=(null==c?void 0:c.nativeMaximizedName)||A,m=(null==c?void 0:c.minimizedCode)||U,K=(null==c?void 0:c.minimizedName)||T,O=(null==c?void 0:c.nativeMinimizedName)||A;W=(null==c?void 0:c.languageCode)||W;G=(null==c?void 0:c.languageName)||T,x=(null==c?void 0:c.nativeLanguageName)||A;f=(null==c?void 0:c.regionCode)||f;D=(null==c?void 0:c.regionName)||"",z=(null==c?void 0:c.nativeRegionName)||"";p=(null==c?void 0:c.scriptCode)||p;var J=(null==c?void 0:c.scriptName)||"",H=(null==c?void 0:c.nativeScriptName)||"";return{code:U,name:T,nativeName:A,maximizedCode:d,maximizedName:w,nativeMaximizedName:E,minimizedCode:m,minimizedName:K,nativeMinimizedName:O,languageCode:W,languageName:G,nativeLanguageName:x,nameWithRegionCode:I=(null==c?void 0:c.nameWithRegionCode)||(D?"".concat(T," (").concat(D,")"):T),nativeNameWithRegionCode:P=(null==c?void 0:c.nativeNameWithRegionCode)||(z?"".concat(A," (").concat(z,")"):A),regionCode:f,regionName:D,nativeRegionName:z,scriptCode:p,scriptName:J,nativeScriptName:H,emoji:(null==c?void 0:c.emoji)||y}}}function S(t,n){"string"==typeof t&&(t=[t]),t=t.filter(u).map(l),n=n.filter(u).map(l);for(var r=function(t){var r=n.filter((function(e){return s(t,e)})),o=function(e){for(var t=e.locale,n=e.languageCode,o=e.minimizedCode,i=e.regionCode,a=e.scriptCode,u=0,l=[t,"".concat(n,"-").concat(i),"".concat(n,"-").concat(a),o];u<l.length;u++){var c=l[u];if(r.includes(c))return c}return null},i=C(t),a=i.languageCode,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(i,["languageCode"]),l=o(e({locale:t,languageCode:a},u))||o(e({locale:a},C(a)));if(l)return{value:l}},o=0,i=t;o<i.length;o++){var a=r(i[o]);if("object"==typeof a)return a.value}}function M(t){var n=t.value,i=t.locales,a=void 0===i?[o]:i,u=t.options,l=void 0===u?{}:u;return r.get("NumberFormat",a,e({numberingSystem:"latn"},l)).format(n)}function L(t){var n=t.value,i=t.locales,a=void 0===i?[o]:i,u=t.options,l=void 0===u?{}:u;return r.get("DateTimeFormat",a,e({calendar:"gregory",numberingSystem:"latn"},l)).format(n)}function T(t){var n=t.value,i=t.locales,a=void 0===i?[o]:i,u=t.currency,l=void 0===u?"USD":u,c=t.options,s=void 0===c?{}:c;return r.get("NumberFormat",a,e({style:"currency",currency:l,numberingSystem:"latn"},s)).format(n)}function A(t){var n=t.value,i=t.locales,a=void 0===i?[o]:i,u=t.options,l=void 0===u?{}:u;return r.get("ListFormat",a,e({type:"conjunction",style:"long"},l)).format(n)}var w={var:"variable",num:"number",datetime:"datetime",currency:"currency"};function E(t){if("string"!=typeof t)throw new Error("splitStringToContent: ".concat(t," is not a string!"));for(var n,r=[],o=/{([^}]+)}/g,i=0;null!==(n=o.exec(t));){var a=n[0],u=n[1],l=n.index;if("^"!==t[l-1]){l>i&&r.push(t.slice(i,l));var c=u.split(",").map((function(e){return e.trim()})),s=c[0],v=c[1]?w[c[1]]:void 0,d=e({key:s},v&&{variable:v});r.push(d),i=l+a.length}else l-1>i&&r.push(t.slice(i,l-1)),r.push(a),i=l+a.length}return i<t.length&&r.push(t.slice(i)),r}function K(e,t,n){void 0===t&&(t=o),t||(t=o);try{var i=l(e);if(n)for(var a=0,u=[e,i,r.get("Locale",i).language];a<u.length;a++){var c=p(n,u[a],"name");if(c)return c}return r.get("DisplayNames",[t,i,o],{type:"language"}).of(i)||""}catch(e){return""}}var O=function(){function r(e){var t=void 0===e?{}:e,n=t.apiKey,r=void 0===n?"":n,o=t.devApiKey,i=void 0===o?"":o,a=t.sourceLocale,u=void 0===a?"":a,c=t.projectId,s=void 0===c?"":c,v=t.baseUrl,d=void 0===v?"https://api.gtx.dev":v,f=t.customMapping,p=void 0===f?{}:f;this.apiKey=r||process.env.GT_API_KEY||"",this.devApiKey=i||process.env.GT_DEV_API_KEY||"",this.projectId=s||process.env.GT_PROJECT_ID||"",this.sourceLocale=l(u)||"",this.baseUrl=d,this.customMapping=p}return r.prototype.translate=function(r,o,i){return t(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,v(this,r,o,e({sourceLocale:this.sourceLocale},i))];case 1:return[2,t.sent()]}}))}))},r.prototype.translateJsx=function(r,o,i){return t(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,d(this,r,o,e({sourceLocale:this.sourceLocale},i))];case 1:return[2,t.sent()]}}))}))},r.prototype.translateIcu=function(r,o,i){return t(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,f(this,r,o,e({sourceLocale:this.sourceLocale},i))];case 1:return[2,t.sent()]}}))}))},r.prototype.getLocaleName=function(e){return K(e,this.sourceLocale,this.customMapping)},r.prototype.getLocaleEmoji=function(e){return g(e,this.customMapping)},r.prototype.getLocaleProperties=function(e){return C(e,this.sourceLocale,this.customMapping)},r}();function G(e){return function(e){var t;try{var n=r.get("Locale",e);return"rtl"===(null===(t=null==n?void 0:n.textInfo)||void 0===t?void 0:t.direction)?"rtl":"ltr"}catch(e){return"ltr"}}(e)}function x(e,t,n){return void 0===t&&(t=o),K(e,t,n)}function I(e,t,n){return C(e,t,n)}function P(e,t){return g(e,t)}function R(e){return u(e)}function j(e){return l(e)}function D(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return c.apply(void 0,e)}function z(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.apply(void 0,e)}function k(e,t){return function(e,t){try{var n=r.get("Locale",l(e)),o=n.language,i=n.region,a=n.script,u=r.get("Locale",l(t)),c=u.language,s=u.region,v=u.script;return!(o!==c||i&&i!==s||a&&a!==v)}catch(e){return console.error(e),!1}}(e,t)}function B(e,t){return M({value:e,locales:null==t?void 0:t.locales,options:t})}function U(e,t){return L({value:e,locales:null==t?void 0:t.locales,options:t})}function F(e,t,n){return T({value:e,currency:t,locales:null==n?void 0:n.locales,options:n})}function W(e,t){return A({value:e,locales:null==t?void 0:t.locales,options:t})}function J(t,n,i){return function(t){var n=t.value,i=t.unit,a=t.locales,u=void 0===a?[o]:a,l=t.options,c=void 0===l?{}:l;return r.get("RelativeTimeFormat",u,e({style:"long",numeric:"auto"},c)).format(n,i)}({value:t,unit:n,locales:null==i?void 0:i.locales,options:i})}function H(e){return E(e)}function V(t,n,r,i){return function(t,n,r,i){if(void 0===n&&(n=o),void 0===r&&(r={}),void 0===i&&(i={}),"string"==typeof t&&(t=E(t)),"string"==typeof t)return t;if(!Array.isArray(t))throw new Error("renderContentToString: content ".concat(t," is invalid"));return t.map((function(t){var o;if("string"==typeof t)return t;if("object"==typeof t){var a=r[t.key];return t.variable?"number"===t.variable?M({value:a,locales:n,options:i[t.key]}):"currency"===t.variable?T(e(e({value:a,locales:n},i[t.key]&&{options:i[t.key]}),(null===(o=i[t.key])||void 0===o?void 0:o.currency)&&{currency:i[t.key].currency})):"datetime"===t.variable?L(e({value:a,locales:n},i[t.key]&&{options:i[t.key]})):"list"===t.variable?A(e({value:a,locales:n},i[t.key]&&{options:i[t.key]})):a:a}})).join("")}(t,n,r,i)}function Y(e,t){return S(e,t)}function Z(e,t,n){return function(e,t,n){return!(!u(e)||!u(t)||n&&n.some((function(e){return!u(e)}))||c(e,t)||n&&!n.some((function(e){return s(t,e)})))}(e,t,n)}export{O as default,Y as determineLocale,F as formatCurrency,U as formatDateTime,W as formatList,B as formatNum,J as formatRelativeTime,G as getLocaleDirection,P as getLocaleEmoji,x as getLocaleName,I as getLocaleProperties,D as isSameDialect,z as isSameLanguage,k as isSupersetLocale,R as isValidLocale,V as renderContentToString,Z as requiresTranslation,H as splitStringToContent,j as standardizeLocale};
1
+ var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function u(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}l((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(l){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,l])}}}"function"==typeof SuppressedError&&SuppressedError;var r=new(function(){function e(){this.cache=new Map}return e.prototype._generateKey=function(e,t,n){void 0===n&&(n={});var r=Array.isArray(t)?t.join(","):t,o=n?JSON.stringify(n,Object.keys(n).sort()):"{}";return"".concat(e,":").concat(r,":").concat(o)},e.prototype.get=function(e,t,n){void 0===n&&(n={});var r=this._generateKey(e,t,n);if(!this.cache.has(r)){var o=new Intl[e](t,n);this.cache.set(r,o)}return this.cache.get(r)},e}()),o="en",i=6e4,a=["Cham","Jamo","Kawi","Lisu","Toto","Thai"],u=function(e){try{var t=r.get("Locale",e),n=t.language,i=t.region,u=t.script;if(e.split("-").length!==(l=1,i&&(l+=1),u&&(l+=1),l))return!1;if(r.get("DisplayNames",[o],{type:"language"}).of(n)===n&&!function(e){return e>="qaa"&&e<="qtz"}(n))return!1;if(i)if(r.get("DisplayNames",[o],{type:"region"}).of(i)===i)return!1;if(u)if(r.get("DisplayNames",[o],{type:"script"}).of(u)===u&&!a.includes(u))return!1;return!0}catch(e){return!1}var l},l=function(e){try{return Intl.getCanonicalLocales(e)[0]}catch(t){return e}};function c(){for(var e,t,n,o,i,a,u,c,s,v,d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];try{for(var p=d.flat().map(l),g=0;g<p.length;g++)for(var m=g+1;m<p.length;m++)if(e=p[g],t=p[m],n=void 0,o=void 0,i=void 0,a=void 0,u=void 0,c=void 0,s=void 0,v=void 0,n=r.get("Locale",e),o=n.language,i=n.region,a=n.script,u=r.get("Locale",t),c=u.language,s=u.region,v=u.script,o!==c||i&&s&&i!==s||a&&v&&a!==v)return!1;return!0}catch(e){return console.error(e),!1}}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{var n=e.flat().map((function(e){return r.get("Locale",e).language}));return n.every((function(e){return e===n[0]}))}catch(e){return console.error(e),!1}}function v(r,o,a,u){return t(this,void 0,void 0,(function(){var t,l,c,s,v,d,f,p;return n(this,(function(n){switch(n.label){case 0:t=new AbortController,l=t.signal,(c=Math.min((null==u?void 0:u.timeout)||i,i))&&setTimeout((function(){return t.abort()}),c),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,fetch("".concat(r.baseUrl).concat("/v1/translate/content"),{method:"POST",headers:e(e({"Content-Type":"application/json"},r.apiKey&&{"x-gt-api-key":r.apiKey}),r.devApiKey&&{"x-gt-dev-api-key":r.devApiKey}),body:JSON.stringify({source:o,targetLocale:a,metadata:u}),signal:l})];case 2:return s=n.sent(),[3,4];case 3:if("AbortError"===(null==(v=n.sent())?void 0:v.name))throw new Error("Translation request timed out. This has either occured due to the translation of an unusually large request or a translation failure in the API.");throw v;case 4:return s.ok?[3,6]:(d=Error.bind,p=(f="".concat(s.status,": ")).concat,[4,s.text()]);case 5:throw new(d.apply(Error,[void 0,p.apply(f,[n.sent()])]));case 6:return[4,s.json()];case 7:return[2,n.sent()]}}))}))}function d(r,o,a,u){return t(this,void 0,void 0,(function(){var t,l,c,s,v,d,f,p;return n(this,(function(n){switch(n.label){case 0:t=new AbortController,l=t.signal,(c=Math.min((null==u?void 0:u.timeout)||i,i))&&setTimeout((function(){return t.abort()}),c),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,fetch("".concat(r.baseUrl).concat("/v1/translate/react"),{method:"POST",headers:e(e({"Content-Type":"application/json"},r.apiKey&&{"x-gt-api-key":r.apiKey}),r.devApiKey&&{"x-gt-dev-api-key":r.devApiKey}),body:JSON.stringify({source:o,targetLocale:a,metadata:u}),signal:l})];case 2:return s=n.sent(),[3,4];case 3:if("AbortError"===(null==(v=n.sent())?void 0:v.name))throw new Error("Translation request timed out. This has either occured due to the translation of an unusually large request or a translation failure in the API.");throw v;case 4:return s.ok?[3,6]:(d=Error.bind,p=(f="".concat(s.status,": ")).concat,[4,s.text()]);case 5:throw new(d.apply(Error,[void 0,p.apply(f,[n.sent()])]));case 6:return[4,s.json()];case 7:return[2,n.sent()]}}))}))}function f(r,o,a,u){return t(this,void 0,void 0,(function(){var t,l,c,s,v,d,f,p;return n(this,(function(n){switch(n.label){case 0:t=new AbortController,l=t.signal,(c=Math.min((null==u?void 0:u.timeout)||i,i))&&setTimeout((function(){return t.abort()}),c),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,fetch("".concat(r.baseUrl).concat("/v1/translate/icu"),{method:"POST",headers:e(e({"Content-Type":"application/json"},r.apiKey&&{"x-gt-api-key":r.apiKey}),r.devApiKey&&{"x-gt-dev-api-key":r.devApiKey}),body:JSON.stringify({source:o,targetLocale:a,metadata:u}),signal:l})];case 2:return s=n.sent(),[3,4];case 3:if("AbortError"===(null==(v=n.sent())?void 0:v.name))throw new Error("Translation request timed out. This has either occured due to the translation of an unusually large request or a translation failure in the API.");throw v;case 4:return s.ok?[3,6]:(d=Error.bind,p=(f="".concat(s.status,": ")).concat,[4,s.text()]);case 5:throw new(d.apply(Error,[void 0,p.apply(f,[n.sent()])]));case 6:return[4,s.json()];case 7:return[2,n.sent()]}}))}))}var p=function(e,t,n){if(null==e?void 0:e[t])return"string"==typeof e[t]?"name"===n?e[t]:void 0:e[t][n]};function g(e,t){try{var n=l(e),o=r.get("Locale",n),i=o.language,a=o.region;if(t)for(var u=0,c=[e,n,i];u<c.length;u++){var s=p(t,c[u],"emoji");if(s)return s}if(a&&N[a])return N[a];var v=o.maximize(),d=v.region||"";return h[v.language]||N[d]||y}catch(e){return y}}var m="๐ŸŒ",y=m,h={ca:m,eu:m,ku:m,bo:"๐ŸŒ",ug:"๐ŸŒ",gd:"๐Ÿด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ",cy:"๐Ÿด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ",gv:"๐Ÿ‡ฎ๐Ÿ‡ฒ",grc:"๐Ÿบ"},N={AF:"๐Ÿ‡ฆ๐Ÿ‡ซ",AX:"๐Ÿ‡ฆ๐Ÿ‡ฝ",AL:"๐Ÿ‡ฆ๐Ÿ‡ฑ",DZ:"๐Ÿ‡ฉ๐Ÿ‡ฟ",AS:"๐Ÿ‡ฆ๐Ÿ‡ธ",AD:"๐Ÿ‡ฆ๐Ÿ‡ฉ",AO:"๐Ÿ‡ฆ๐Ÿ‡ด",AI:"๐Ÿ‡ฆ๐Ÿ‡ฎ",AQ:"๐Ÿ‡ฆ๐Ÿ‡ถ",AG:"๐Ÿ‡ฆ๐Ÿ‡ฌ",AR:"๐Ÿ‡ฆ๐Ÿ‡ท",AM:"๐Ÿ‡ฆ๐Ÿ‡ฒ",AW:"๐Ÿ‡ฆ๐Ÿ‡ผ",AU:"๐Ÿ‡ฆ๐Ÿ‡บ",AT:"๐Ÿ‡ฆ๐Ÿ‡น",AZ:"๐Ÿ‡ฆ๐Ÿ‡ฟ",BS:"๐Ÿ‡ง๐Ÿ‡ธ",BH:"๐Ÿ‡ง๐Ÿ‡ญ",BD:"๐Ÿ‡ง๐Ÿ‡ฉ",BB:"๐Ÿ‡ง๐Ÿ‡ง",BY:"๐Ÿ‡ง๐Ÿ‡พ",BE:"๐Ÿ‡ง๐Ÿ‡ช",BZ:"๐Ÿ‡ง๐Ÿ‡ฟ",BJ:"๐Ÿ‡ง๐Ÿ‡ฏ",BM:"๐Ÿ‡ง๐Ÿ‡ฒ",BT:"๐Ÿ‡ง๐Ÿ‡น",BO:"๐Ÿ‡ง๐Ÿ‡ด",BQ:"๐Ÿ‡ง๐Ÿ‡ถ",BA:"๐Ÿ‡ง๐Ÿ‡ฆ",BW:"๐Ÿ‡ง๐Ÿ‡ผ",BV:"๐Ÿ‡ง๐Ÿ‡ป",BR:"๐Ÿ‡ง๐Ÿ‡ท",IO:"๐Ÿ‡ฎ๐Ÿ‡ด",BN:"๐Ÿ‡ง๐Ÿ‡ณ",BG:"๐Ÿ‡ง๐Ÿ‡ฌ",BF:"๐Ÿ‡ง๐Ÿ‡ซ",BI:"๐Ÿ‡ง๐Ÿ‡ฎ",CV:"๐Ÿ‡จ๐Ÿ‡ป",KH:"๐Ÿ‡ฐ๐Ÿ‡ญ",CM:"๐Ÿ‡จ๐Ÿ‡ฒ",CA:"๐Ÿ‡จ๐Ÿ‡ฆ",KY:"๐Ÿ‡ฐ๐Ÿ‡พ",CF:"๐Ÿ‡จ๐Ÿ‡ซ",TD:"๐Ÿ‡น๐Ÿ‡ฉ",CL:"๐Ÿ‡จ๐Ÿ‡ฑ",CN:"๐Ÿ‡จ๐Ÿ‡ณ",CX:"๐Ÿ‡จ๐Ÿ‡ฝ",CC:"๐Ÿ‡จ๐Ÿ‡จ",CO:"๐Ÿ‡จ๐Ÿ‡ด",KM:"๐Ÿ‡ฐ๐Ÿ‡ฒ",CD:"๐Ÿ‡จ๐Ÿ‡ฉ",CG:"๐Ÿ‡จ๐Ÿ‡ฌ",CK:"๐Ÿ‡จ๐Ÿ‡ฐ",CR:"๐Ÿ‡จ๐Ÿ‡ท",CI:"๐Ÿ‡จ๐Ÿ‡ฎ",HR:"๐Ÿ‡ญ๐Ÿ‡ท",CU:"๐Ÿ‡จ๐Ÿ‡บ",CW:"๐Ÿ‡จ๐Ÿ‡ผ",CY:"๐Ÿ‡จ๐Ÿ‡พ",CZ:"๐Ÿ‡จ๐Ÿ‡ฟ",DK:"๐Ÿ‡ฉ๐Ÿ‡ฐ",DJ:"๐Ÿ‡ฉ๐Ÿ‡ฏ",DM:"๐Ÿ‡ฉ๐Ÿ‡ฒ",DO:"๐Ÿ‡ฉ๐Ÿ‡ด",EC:"๐Ÿ‡ช๐Ÿ‡จ",EG:"๐Ÿ‡ช๐Ÿ‡ฌ",SV:"๐Ÿ‡ธ๐Ÿ‡ป",GQ:"๐Ÿ‡ฌ๐Ÿ‡ถ",ER:"๐Ÿ‡ช๐Ÿ‡ท",EE:"๐Ÿ‡ช๐Ÿ‡ช",SZ:"๐Ÿ‡ธ๐Ÿ‡ฟ",ET:"๐Ÿ‡ช๐Ÿ‡น",FK:"๐Ÿ‡ซ๐Ÿ‡ฐ",FO:"๐Ÿ‡ซ๐Ÿ‡ด",FJ:"๐Ÿ‡ซ๐Ÿ‡ฏ",FI:"๐Ÿ‡ซ๐Ÿ‡ฎ",FR:"๐Ÿ‡ซ๐Ÿ‡ท",GF:"๐Ÿ‡ฌ๐Ÿ‡ซ",PF:"๐Ÿ‡ต๐Ÿ‡ซ",TF:"๐Ÿ‡น๐Ÿ‡ซ",GA:"๐Ÿ‡ฌ๐Ÿ‡ฆ",GM:"๐Ÿ‡ฌ๐Ÿ‡ฒ",GE:"๐Ÿ‡ฌ๐Ÿ‡ช",DE:"๐Ÿ‡ฉ๐Ÿ‡ช",GH:"๐Ÿ‡ฌ๐Ÿ‡ญ",GI:"๐Ÿ‡ฌ๐Ÿ‡ฎ",GR:"๐Ÿ‡ฌ๐Ÿ‡ท",GL:"๐Ÿ‡ฌ๐Ÿ‡ฑ",GD:"๐Ÿ‡ฌ๐Ÿ‡ฉ",GP:"๐Ÿ‡ฌ๐Ÿ‡ต",GU:"๐Ÿ‡ฌ๐Ÿ‡บ",GT:"๐Ÿ‡ฌ๐Ÿ‡น",GG:"๐Ÿ‡ฌ๐Ÿ‡ฌ",GN:"๐Ÿ‡ฌ๐Ÿ‡ณ",GW:"๐Ÿ‡ฌ๐Ÿ‡ผ",GY:"๐Ÿ‡ฌ๐Ÿ‡พ",HT:"๐Ÿ‡ญ๐Ÿ‡น",HM:"๐Ÿ‡ญ๐Ÿ‡ฒ",VA:"๐Ÿ‡ป๐Ÿ‡ฆ",HN:"๐Ÿ‡ญ๐Ÿ‡ณ",HK:"๐Ÿ‡ญ๐Ÿ‡ฐ",HU:"๐Ÿ‡ญ๐Ÿ‡บ",IS:"๐Ÿ‡ฎ๐Ÿ‡ธ",IN:"๐Ÿ‡ฎ๐Ÿ‡ณ",ID:"๐Ÿ‡ฎ๐Ÿ‡ฉ",IR:"๐Ÿ‡ฎ๐Ÿ‡ท",IQ:"๐Ÿ‡ฎ๐Ÿ‡ถ",IE:"๐Ÿ‡ฎ๐Ÿ‡ช",IM:"๐Ÿ‡ฎ๐Ÿ‡ฒ",IL:"๐Ÿ‡ฎ๐Ÿ‡ฑ",IT:"๐Ÿ‡ฎ๐Ÿ‡น",JM:"๐Ÿ‡ฏ๐Ÿ‡ฒ",JP:"๐Ÿ‡ฏ๐Ÿ‡ต",JE:"๐Ÿ‡ฏ๐Ÿ‡ช",JO:"๐Ÿ‡ฏ๐Ÿ‡ด",KZ:"๐Ÿ‡ฐ๐Ÿ‡ฟ",KE:"๐Ÿ‡ฐ๐Ÿ‡ช",KI:"๐Ÿ‡ฐ๐Ÿ‡ฎ",KP:"๐Ÿ‡ฐ๐Ÿ‡ต",KR:"๐Ÿ‡ฐ๐Ÿ‡ท",KW:"๐Ÿ‡ฐ๐Ÿ‡ผ",KG:"๐Ÿ‡ฐ๐Ÿ‡ฌ",LA:"๐Ÿ‡ฑ๐Ÿ‡ฆ",LV:"๐Ÿ‡ฑ๐Ÿ‡ป",LB:"๐Ÿ‡ฑ๐Ÿ‡ง",LS:"๐Ÿ‡ฑ๐Ÿ‡ธ",LR:"๐Ÿ‡ฑ๐Ÿ‡ท",LY:"๐Ÿ‡ฑ๐Ÿ‡พ",LI:"๐Ÿ‡ฑ๐Ÿ‡ฎ",LT:"๐Ÿ‡ฑ๐Ÿ‡น",LU:"๐Ÿ‡ฑ๐Ÿ‡บ",MO:"๐Ÿ‡ฒ๐Ÿ‡ด",MG:"๐Ÿ‡ฒ๐Ÿ‡ฌ",MW:"๐Ÿ‡ฒ๐Ÿ‡ผ",MY:"๐Ÿ‡ฒ๐Ÿ‡พ",MV:"๐Ÿ‡ฒ๐Ÿ‡ป",ML:"๐Ÿ‡ฒ๐Ÿ‡ฑ",MT:"๐Ÿ‡ฒ๐Ÿ‡น",MH:"๐Ÿ‡ฒ๐Ÿ‡ญ",MQ:"๐Ÿ‡ฒ๐Ÿ‡ถ",MR:"๐Ÿ‡ฒ๐Ÿ‡ท",MU:"๐Ÿ‡ฒ๐Ÿ‡บ",YT:"๐Ÿ‡พ๐Ÿ‡น",MX:"๐Ÿ‡ฒ๐Ÿ‡ฝ",FM:"๐Ÿ‡ซ๐Ÿ‡ฒ",MD:"๐Ÿ‡ฒ๐Ÿ‡ฉ",MC:"๐Ÿ‡ฒ๐Ÿ‡จ",MN:"๐Ÿ‡ฒ๐Ÿ‡ณ",ME:"๐Ÿ‡ฒ๐Ÿ‡ช",MS:"๐Ÿ‡ฒ๐Ÿ‡ธ",MA:"๐Ÿ‡ฒ๐Ÿ‡ฆ",MZ:"๐Ÿ‡ฒ๐Ÿ‡ฟ",MM:"๐Ÿ‡ฒ๐Ÿ‡ฒ",NA:"๐Ÿ‡ณ๐Ÿ‡ฆ",NR:"๐Ÿ‡ณ๐Ÿ‡ท",NP:"๐Ÿ‡ณ๐Ÿ‡ต",NL:"๐Ÿ‡ณ๐Ÿ‡ฑ",NC:"๐Ÿ‡ณ๐Ÿ‡จ",NZ:"๐Ÿ‡ณ๐Ÿ‡ฟ",NI:"๐Ÿ‡ณ๐Ÿ‡ฎ",NE:"๐Ÿ‡ณ๐Ÿ‡ช",NG:"๐Ÿ‡ณ๐Ÿ‡ฌ",NU:"๐Ÿ‡ณ๐Ÿ‡บ",NF:"๐Ÿ‡ณ๐Ÿ‡ซ",MK:"๐Ÿ‡ฒ๐Ÿ‡ฐ",MP:"๐Ÿ‡ฒ๐Ÿ‡ต",NO:"๐Ÿ‡ณ๐Ÿ‡ด",OM:"๐Ÿ‡ด๐Ÿ‡ฒ",PK:"๐Ÿ‡ต๐Ÿ‡ฐ",PW:"๐Ÿ‡ต๐Ÿ‡ผ",PS:"๐Ÿ‡ต๐Ÿ‡ธ",PA:"๐Ÿ‡ต๐Ÿ‡ฆ",PG:"๐Ÿ‡ต๐Ÿ‡ฌ",PY:"๐Ÿ‡ต๐Ÿ‡พ",PE:"๐Ÿ‡ต๐Ÿ‡ช",PH:"๐Ÿ‡ต๐Ÿ‡ญ",PN:"๐Ÿ‡ต๐Ÿ‡ณ",PL:"๐Ÿ‡ต๐Ÿ‡ฑ",PT:"๐Ÿ‡ต๐Ÿ‡น",PR:"๐Ÿ‡ต๐Ÿ‡ท",QA:"๐Ÿ‡ถ๐Ÿ‡ฆ",RE:"๐Ÿ‡ท๐Ÿ‡ช",RO:"๐Ÿ‡ท๐Ÿ‡ด",RU:"๐Ÿ‡ท๐Ÿ‡บ",RW:"๐Ÿ‡ท๐Ÿ‡ผ",BL:"๐Ÿ‡ง๐Ÿ‡ฑ",SH:"๐Ÿ‡ธ๐Ÿ‡ญ",KN:"๐Ÿ‡ฐ๐Ÿ‡ณ",LC:"๐Ÿ‡ฑ๐Ÿ‡จ",MF:"๐Ÿ‡ฒ๐Ÿ‡ซ",PM:"๐Ÿ‡ต๐Ÿ‡ฒ",VC:"๐Ÿ‡ป๐Ÿ‡จ",WS:"๐Ÿ‡ผ๐Ÿ‡ธ",SM:"๐Ÿ‡ธ๐Ÿ‡ฒ",ST:"๐Ÿ‡ธ๐Ÿ‡น",SA:"๐Ÿ‡ธ๐Ÿ‡ฆ",SN:"๐Ÿ‡ธ๐Ÿ‡ณ",RS:"๐Ÿ‡ท๐Ÿ‡ธ",SC:"๐Ÿ‡ธ๐Ÿ‡จ",SL:"๐Ÿ‡ธ๐Ÿ‡ฑ",SG:"๐Ÿ‡ธ๐Ÿ‡ฌ",SX:"๐Ÿ‡ธ๐Ÿ‡ฝ",SK:"๐Ÿ‡ธ๐Ÿ‡ฐ",SI:"๐Ÿ‡ธ๐Ÿ‡ฎ",SB:"๐Ÿ‡ธ๐Ÿ‡ง",SO:"๐Ÿ‡ธ๐Ÿ‡ด",ZA:"๐Ÿ‡ฟ๐Ÿ‡ฆ",GS:"๐Ÿ‡ฌ๐Ÿ‡ธ",SS:"๐Ÿ‡ธ๐Ÿ‡ธ",ES:"๐Ÿ‡ช๐Ÿ‡ธ",LK:"๐Ÿ‡ฑ๐Ÿ‡ฐ",SD:"๐Ÿ‡ธ๐Ÿ‡ฉ",SR:"๐Ÿ‡ธ๐Ÿ‡ท",SJ:"๐Ÿ‡ธ๐Ÿ‡ฏ",SE:"๐Ÿ‡ธ๐Ÿ‡ช",CH:"๐Ÿ‡จ๐Ÿ‡ญ",SY:"๐Ÿ‡ธ๐Ÿ‡พ",TW:"๐Ÿ‡น๐Ÿ‡ผ",TJ:"๐Ÿ‡น๐Ÿ‡ฏ",TZ:"๐Ÿ‡น๐Ÿ‡ฟ",TH:"๐Ÿ‡น๐Ÿ‡ญ",TL:"๐Ÿ‡น๐Ÿ‡ฑ",TG:"๐Ÿ‡น๐Ÿ‡ฌ",TK:"๐Ÿ‡น๐Ÿ‡ฐ",TO:"๐Ÿ‡น๐Ÿ‡ด",TT:"๐Ÿ‡น๐Ÿ‡น",TN:"๐Ÿ‡น๐Ÿ‡ณ",TR:"๐Ÿ‡น๐Ÿ‡ท",TM:"๐Ÿ‡น๐Ÿ‡ฒ",TC:"๐Ÿ‡น๐Ÿ‡จ",TV:"๐Ÿ‡น๐Ÿ‡ป",UG:"๐Ÿ‡บ๐Ÿ‡ฌ",UA:"๐Ÿ‡บ๐Ÿ‡ฆ",AE:"๐Ÿ‡ฆ๐Ÿ‡ช",GB:"๐Ÿ‡ฌ๐Ÿ‡ง",US:"๐Ÿ‡บ๐Ÿ‡ธ",UM:"๐Ÿ‡บ๐Ÿ‡ฒ",UY:"๐Ÿ‡บ๐Ÿ‡พ",UZ:"๐Ÿ‡บ๐Ÿ‡ฟ",VU:"๐Ÿ‡ป๐Ÿ‡บ",VE:"๐Ÿ‡ป๐Ÿ‡ช",VN:"๐Ÿ‡ป๐Ÿ‡ณ",VG:"๐Ÿ‡ป๐Ÿ‡ฌ",VI:"๐Ÿ‡ป๐Ÿ‡ฎ",WF:"๐Ÿ‡ผ๐Ÿ‡ซ",EH:"๐Ÿ‡ช๐Ÿ‡ญ",YE:"๐Ÿ‡พ๐Ÿ‡ช",ZM:"๐Ÿ‡ฟ๐Ÿ‡ฒ",ZW:"๐Ÿ‡ฟ๐Ÿ‡ผ",EU:"๐Ÿ‡ช๐Ÿ‡บ"};function b(t,n){if(n){for(var r={},o=0,i=t;o<i.length;o++){var a=n[i[o]];a&&("string"==typeof a?r.name||(r.name=a):a&&(r=e(e({},a),r)))}return r}}function C(e,t,n){void 0===t&&(t=o),t||(t=o);try{var i=l(e),a=r.get("Locale",e),c=b([e,i,W=a.language],n),s=a.region,v=a.maximize(),d=v.toString(),f=a.region||(null==c?void 0:c.regionCode)||v.region||"",p=a.script||(null==c?void 0:c.scriptCode)||v.script||"",m=a.minimize().toString(),h=[t,e,o],N=[e,t,o],C=r.get("DisplayNames",h,{type:"language"}),S=r.get("DisplayNames",N,{type:"language"}),M=null==c?void 0:c.name,L=(null==c?void 0:c.nativeName)||(null==c?void 0:c.name),T=M||C.of(e)||e,A=L||S.of(e)||e,w=(null==c?void 0:c.maximizedName)||M||C.of(d)||e,E=(null==c?void 0:c.nativeMaximizedName)||L||S.of(d)||e,K=(null==c?void 0:c.minimizedName)||M||C.of(m)||e,G=(null==c?void 0:c.nativeMinimizedName)||L||S.of(m)||e,O=(null==c?void 0:c.languageName)||M||C.of(W)||e,x=(null==c?void 0:c.nativeLanguageName)||L||S.of(W)||e,I=(null==c?void 0:c.nameWithRegionCode)||s?"".concat(O," (").concat(s,")"):O,P=(null==c?void 0:c.nativeNameWithRegionCode)||(s?"".concat(x," (").concat(s,")"):x)||I,R=r.get("DisplayNames",h,{type:"region"}),j=r.get("DisplayNames",N,{type:"region"}),D=(null==c?void 0:c.regionName)||(f?R.of(f):"")||"",z=(null==c?void 0:c.nativeRegionName)||(f?j.of(f):"")||"",k=r.get("DisplayNames",h,{type:"script"}),B=r.get("DisplayNames",N,{type:"script"});return{code:i,name:T,nativeName:A,maximizedCode:d,maximizedName:w,nativeMaximizedName:E,minimizedCode:m,minimizedName:K,nativeMinimizedName:G,languageCode:W,languageName:O,nativeLanguageName:x,nameWithRegionCode:I,nativeNameWithRegionCode:P,regionCode:f,regionName:D,nativeRegionName:z,scriptCode:p,scriptName:J=(null==c?void 0:c.scriptName)||(p?k.of(p):"")||"",nativeScriptName:H=(null==c?void 0:c.nativeScriptName)||(p?B.of(p):"")||"",emoji:(null==c?void 0:c.emoji)||g(i,n)}}catch(t){var U=u(e)?l(e):e,F=null==U?void 0:U.split("-"),W=(null==F?void 0:F[0])||U||"";f=F.length>2?null==F?void 0:F[2]:(null==F?void 0:F[1])||"",p=(null==F?void 0:F[3])||"";U=(null==(c=b([U,W],n))?void 0:c.code)||U;T=(null==c?void 0:c.name)||U,A=(null==c?void 0:c.nativeName)||T,d=(null==c?void 0:c.maximizedCode)||U,w=(null==c?void 0:c.maximizedName)||T,E=(null==c?void 0:c.nativeMaximizedName)||A,m=(null==c?void 0:c.minimizedCode)||U,K=(null==c?void 0:c.minimizedName)||T,G=(null==c?void 0:c.nativeMinimizedName)||A;W=(null==c?void 0:c.languageCode)||W;O=(null==c?void 0:c.languageName)||T,x=(null==c?void 0:c.nativeLanguageName)||A;f=(null==c?void 0:c.regionCode)||f;D=(null==c?void 0:c.regionName)||"",z=(null==c?void 0:c.nativeRegionName)||"";p=(null==c?void 0:c.scriptCode)||p;var J=(null==c?void 0:c.scriptName)||"",H=(null==c?void 0:c.nativeScriptName)||"";return{code:U,name:T,nativeName:A,maximizedCode:d,maximizedName:w,nativeMaximizedName:E,minimizedCode:m,minimizedName:K,nativeMinimizedName:G,languageCode:W,languageName:O,nativeLanguageName:x,nameWithRegionCode:I=(null==c?void 0:c.nameWithRegionCode)||(D?"".concat(T," (").concat(D,")"):T),nativeNameWithRegionCode:P=(null==c?void 0:c.nativeNameWithRegionCode)||(z?"".concat(A," (").concat(z,")"):A),regionCode:f,regionName:D,nativeRegionName:z,scriptCode:p,scriptName:J,nativeScriptName:H,emoji:(null==c?void 0:c.emoji)||y}}}function S(t,n){"string"==typeof t&&(t=[t]),t=t.filter(u).map(l),n=n.filter(u).map(l);for(var r=function(t){var r=n.filter((function(e){return s(t,e)})),o=function(e){for(var t=e.locale,n=e.languageCode,o=e.minimizedCode,i=e.regionCode,a=e.scriptCode,u=0,l=[t,"".concat(n,"-").concat(i),"".concat(n,"-").concat(a),o];u<l.length;u++){var c=l[u];if(r.includes(c))return c}return null},i=C(t),a=i.languageCode,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(i,["languageCode"]),l=o(e({locale:t,languageCode:a},u))||o(e({locale:a},C(a)));if(l)return{value:l}},o=0,i=t;o<i.length;o++){var a=r(i[o]);if("object"==typeof a)return a.value}}function M(t){var n=t.value,i=t.locales,a=void 0===i?[o]:i,u=t.options,l=void 0===u?{}:u;return r.get("NumberFormat",a,e({numberingSystem:"latn"},l)).format(n)}function L(t){var n=t.value,i=t.locales,a=void 0===i?[o]:i,u=t.options,l=void 0===u?{}:u;return r.get("DateTimeFormat",a,e({calendar:"gregory",numberingSystem:"latn"},l)).format(n)}function T(t){var n=t.value,i=t.locales,a=void 0===i?[o]:i,u=t.currency,l=void 0===u?"USD":u,c=t.options,s=void 0===c?{}:c;return r.get("NumberFormat",a,e({style:"currency",currency:l,numberingSystem:"latn"},s)).format(n)}function A(t){var n=t.value,i=t.locales,a=void 0===i?[o]:i,u=t.options,l=void 0===u?{}:u;return r.get("ListFormat",a,e({type:"conjunction",style:"long"},l)).format(n)}var w={var:"variable",num:"number",datetime:"datetime",currency:"currency"};function E(t){if("string"!=typeof t)throw new Error("splitStringToContent: ".concat(t," is not a string!"));for(var n,r=[],o=/{([^}]+)}/g,i=0;null!==(n=o.exec(t));){var a=n[0],u=n[1],l=n.index;if("^"!==t[l-1]){l>i&&r.push(t.slice(i,l));var c=u.split(",").map((function(e){return e.trim()})),s=c[0],v=c[1]?w[c[1]]:void 0,d=e({key:s},v&&{variable:v});r.push(d),i=l+a.length}else l-1>i&&r.push(t.slice(i,l-1)),r.push(a),i=l+a.length}return i<t.length&&r.push(t.slice(i)),r}function K(e,t,n){void 0===t&&(t=o),t||(t=o);try{var i=l(e);if(n)for(var a=0,u=[e,i,r.get("Locale",i).language];a<u.length;a++){var c=p(n,u[a],"name");if(c)return c}return r.get("DisplayNames",[t,i,o],{type:"language"}).of(i)||""}catch(e){return""}}var G=function(){function r(e){var t=void 0===e?{}:e,n=t.apiKey,r=void 0===n?"":n,o=t.devApiKey,i=void 0===o?"":o,a=t.sourceLocale,u=void 0===a?"":a,c=t.projectId,s=void 0===c?"":c,v=t.baseUrl,d=void 0===v?"https://api.gtx.dev":v,f=t.customMapping,p=void 0===f?{}:f,g="undefined"!=typeof process;this.apiKey=r||g&&process.env.GT_API_KEY||"",this.devApiKey=i||g&&process.env.GT_DEV_API_KEY||"",this.projectId=s||g&&process.env.GT_PROJECT_ID||"",this.sourceLocale=l(u)||"",this.baseUrl=d,this.customMapping=p}return r.prototype.translate=function(r,o,i){return t(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,v(this,r,o,e({sourceLocale:this.sourceLocale},i))];case 1:return[2,t.sent()]}}))}))},r.prototype.translateJsx=function(r,o,i){return t(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,d(this,r,o,e({sourceLocale:this.sourceLocale},i))];case 1:return[2,t.sent()]}}))}))},r.prototype.translateIcu=function(r,o,i){return t(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,f(this,r,o,e({sourceLocale:this.sourceLocale},i))];case 1:return[2,t.sent()]}}))}))},r.prototype.getLocaleName=function(e){return K(e,this.sourceLocale,this.customMapping)},r.prototype.getLocaleEmoji=function(e){return g(e,this.customMapping)},r.prototype.getLocaleProperties=function(e){return C(e,this.sourceLocale,this.customMapping)},r}();function O(e){return function(e){var t;try{var n=r.get("Locale",e);return"rtl"===(null===(t=null==n?void 0:n.textInfo)||void 0===t?void 0:t.direction)?"rtl":"ltr"}catch(e){return"ltr"}}(e)}function x(e,t,n){return void 0===t&&(t=o),K(e,t,n)}function I(e,t,n){return C(e,t,n)}function P(e,t){return g(e,t)}function R(e){return u(e)}function j(e){return l(e)}function D(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return c.apply(void 0,e)}function z(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.apply(void 0,e)}function k(e,t){return function(e,t){try{var n=r.get("Locale",l(e)),o=n.language,i=n.region,a=n.script,u=r.get("Locale",l(t)),c=u.language,s=u.region,v=u.script;return!(o!==c||i&&i!==s||a&&a!==v)}catch(e){return console.error(e),!1}}(e,t)}function B(e,t){return M({value:e,locales:null==t?void 0:t.locales,options:t})}function U(e,t){return L({value:e,locales:null==t?void 0:t.locales,options:t})}function F(e,t,n){return T({value:e,currency:t,locales:null==n?void 0:n.locales,options:n})}function W(e,t){return A({value:e,locales:null==t?void 0:t.locales,options:t})}function J(t,n,i){return function(t){var n=t.value,i=t.unit,a=t.locales,u=void 0===a?[o]:a,l=t.options,c=void 0===l?{}:l;return r.get("RelativeTimeFormat",u,e({style:"long",numeric:"auto"},c)).format(n,i)}({value:t,unit:n,locales:null==i?void 0:i.locales,options:i})}function H(e){return E(e)}function V(t,n,r,i){return function(t,n,r,i){if(void 0===n&&(n=o),void 0===r&&(r={}),void 0===i&&(i={}),"string"==typeof t&&(t=E(t)),"string"==typeof t)return t;if(!Array.isArray(t))throw new Error("renderContentToString: content ".concat(t," is invalid"));return t.map((function(t){var o;if("string"==typeof t)return t;if("object"==typeof t){var a=r[t.key];return t.variable?"number"===t.variable?M({value:a,locales:n,options:i[t.key]}):"currency"===t.variable?T(e(e({value:a,locales:n},i[t.key]&&{options:i[t.key]}),(null===(o=i[t.key])||void 0===o?void 0:o.currency)&&{currency:i[t.key].currency})):"datetime"===t.variable?L(e({value:a,locales:n},i[t.key]&&{options:i[t.key]})):"list"===t.variable?A(e({value:a,locales:n},i[t.key]&&{options:i[t.key]})):a:a}})).join("")}(t,n,r,i)}function Y(e,t){return S(e,t)}function Z(e,t,n){return function(e,t,n){return!(!u(e)||!u(t)||n&&n.some((function(e){return!u(e)}))||c(e,t)||n&&!n.some((function(e){return s(t,e)})))}(e,t,n)}export{G as GT,Y as determineLocale,F as formatCurrency,U as formatDateTime,W as formatList,B as formatNum,J as formatRelativeTime,O as getLocaleDirection,P as getLocaleEmoji,x as getLocaleName,I as getLocaleProperties,D as isSameDialect,z as isSameLanguage,k as isSupersetLocale,R as isValidLocale,V as renderContentToString,Z as requiresTranslation,H as splitStringToContent,j as standardizeLocale};
2
2
  //# sourceMappingURL=index.esm.min.mjs.map