gt-react 3.1.39 → 3.1.40
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/cjs/client/ClientProvider.d.ts +19 -0
- package/dist/cjs/client/ClientProvider.d.ts.map +1 -0
- package/dist/cjs/client/ClientProvider.js +29 -0
- package/dist/cjs/client/ClientProvider.js.map +1 -0
- package/dist/cjs/client/client-only/GTClientProvider.d.ts +13 -0
- package/dist/cjs/client/client-only/GTClientProvider.d.ts.map +1 -0
- package/dist/cjs/client/client-only/GTClientProvider.js +95 -0
- package/dist/cjs/client/client-only/GTClientProvider.js.map +1 -0
- package/dist/cjs/client/client-only/helpers/renderDictionary.d.ts +2 -0
- package/dist/cjs/client/client-only/helpers/renderDictionary.d.ts.map +1 -0
- package/dist/cjs/client/client-only/helpers/renderDictionary.js +117 -0
- package/dist/cjs/client/client-only/helpers/renderDictionary.js.map +1 -0
- package/dist/cjs/client/hooks/useBrowserLocale.d.ts +7 -0
- package/dist/cjs/client/hooks/useBrowserLocale.d.ts.map +1 -0
- package/dist/cjs/client/hooks/useBrowserLocale.js +41 -0
- package/dist/cjs/client/hooks/useBrowserLocale.js.map +1 -0
- package/dist/cjs/client/hooks/useDefaultLocale.d.ts +5 -0
- package/dist/cjs/client/hooks/useDefaultLocale.d.ts.map +1 -0
- package/dist/cjs/client/hooks/useDefaultLocale.js +13 -0
- package/dist/cjs/client/hooks/useDefaultLocale.js.map +1 -0
- package/dist/cjs/client/hooks/useGT.d.ts +10 -0
- package/dist/cjs/client/hooks/useGT.d.ts.map +1 -0
- package/dist/cjs/client/hooks/useGT.js +61 -0
- package/dist/cjs/client/hooks/useGT.js.map +1 -0
- package/dist/cjs/client/hooks/useLocale.d.ts +5 -0
- package/dist/cjs/client/hooks/useLocale.d.ts.map +1 -0
- package/dist/cjs/client/hooks/useLocale.js +13 -0
- package/dist/cjs/client/hooks/useLocale.js.map +1 -0
- package/dist/cjs/client/plural/ClientPlural.d.ts +28 -0
- package/dist/cjs/client/plural/ClientPlural.d.ts.map +1 -0
- package/dist/cjs/client/plural/ClientPlural.js +78 -0
- package/dist/cjs/client/plural/ClientPlural.js.map +1 -0
- package/dist/cjs/client/value/ClientValue.d.ts +16 -0
- package/dist/cjs/client/value/ClientValue.d.ts.map +1 -0
- package/dist/cjs/client/value/ClientValue.js +43 -0
- package/dist/cjs/client/value/ClientValue.js.map +1 -0
- package/dist/cjs/client/value/RenderClientVariable.d.ts +6 -0
- package/dist/cjs/client/value/RenderClientVariable.d.ts.map +1 -0
- package/dist/cjs/client/value/RenderClientVariable.js +106 -0
- package/dist/cjs/client/value/RenderClientVariable.js.map +1 -0
- package/dist/cjs/client/variables/ClientCurrency.d.ts +13 -0
- package/dist/cjs/client/variables/ClientCurrency.d.ts.map +1 -0
- package/dist/cjs/client/variables/ClientCurrency.js +31 -0
- package/dist/cjs/client/variables/ClientCurrency.js.map +1 -0
- package/dist/cjs/client/variables/ClientDateTime.d.ts +12 -0
- package/dist/cjs/client/variables/ClientDateTime.d.ts.map +1 -0
- package/dist/cjs/client/variables/ClientDateTime.js +45 -0
- package/dist/cjs/client/variables/ClientDateTime.js.map +1 -0
- package/dist/cjs/client/variables/ClientNum.d.ts +12 -0
- package/dist/cjs/client/variables/ClientNum.d.ts.map +1 -0
- package/dist/cjs/client/variables/ClientNum.js +29 -0
- package/dist/cjs/client/variables/ClientNum.js.map +1 -0
- package/dist/cjs/client/variables/ClientVar.d.ts +21 -0
- package/dist/cjs/client/variables/ClientVar.d.ts.map +1 -0
- package/dist/cjs/client/variables/ClientVar.js +26 -0
- package/dist/cjs/client/variables/ClientVar.js.map +1 -0
- package/dist/cjs/client.d.ts +12 -0
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/client.js +27 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/config/I18NConfiguration.d.ts +135 -0
- package/dist/cjs/config/I18NConfiguration.d.ts.map +1 -0
- package/dist/cjs/config/I18NConfiguration.js +343 -0
- package/dist/cjs/config/I18NConfiguration.js.map +1 -0
- package/dist/cjs/config/LocalDictionaryManager.d.ts +31 -0
- package/dist/cjs/config/LocalDictionaryManager.d.ts.map +1 -0
- package/dist/cjs/config/LocalDictionaryManager.js +95 -0
- package/dist/cjs/config/LocalDictionaryManager.js.map +1 -0
- package/dist/cjs/config/RemoteDictionaryManager.d.ts +59 -0
- package/dist/cjs/config/RemoteDictionaryManager.d.ts.map +1 -0
- package/dist/cjs/config/RemoteDictionaryManager.js +120 -0
- package/dist/cjs/config/RemoteDictionaryManager.js.map +1 -0
- package/dist/cjs/config/determineLocale.d.ts +2 -0
- package/dist/cjs/config/determineLocale.d.ts.map +1 -0
- package/dist/cjs/config/determineLocale.js +32 -0
- package/dist/cjs/config/determineLocale.js.map +1 -0
- package/dist/cjs/config/local/getDefaultFromEnv.d.ts +12 -0
- package/dist/cjs/config/local/getDefaultFromEnv.d.ts.map +1 -0
- package/dist/cjs/config/local/getDefaultFromEnv.js +21 -0
- package/dist/cjs/config/local/getDefaultFromEnv.js.map +1 -0
- package/dist/cjs/dictionary/createDictFunction.d.ts +3 -0
- package/dist/cjs/dictionary/createDictFunction.d.ts.map +1 -0
- package/dist/cjs/dictionary/createDictFunction.js +14 -0
- package/dist/cjs/dictionary/createDictFunction.js.map +1 -0
- package/dist/cjs/dictionary/createExecuteTFunction.d.ts +12 -0
- package/dist/cjs/dictionary/createExecuteTFunction.d.ts.map +1 -0
- package/dist/cjs/dictionary/createExecuteTFunction.js +94 -0
- package/dist/cjs/dictionary/createExecuteTFunction.js.map +1 -0
- package/dist/cjs/dictionary/createGetGTFunction.d.ts +3 -0
- package/dist/cjs/dictionary/createGetGTFunction.d.ts.map +1 -0
- package/dist/cjs/dictionary/createGetGTFunction.js +10 -0
- package/dist/cjs/dictionary/createGetGTFunction.js.map +1 -0
- package/dist/cjs/dictionary/getDictionaryEntry.d.ts +2 -0
- package/dist/cjs/dictionary/getDictionaryEntry.d.ts.map +1 -0
- package/dist/cjs/dictionary/getDictionaryEntry.js +14 -0
- package/dist/cjs/dictionary/getDictionaryEntry.js.map +1 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/intl/createIntlFunction.d.ts +6 -0
- package/dist/cjs/intl/createIntlFunction.d.ts.map +1 -0
- package/dist/cjs/intl/createIntlFunction.js +48 -0
- package/dist/cjs/intl/createIntlFunction.js.map +1 -0
- package/dist/cjs/middleware/cookieSettings.d.ts +2 -0
- package/dist/cjs/middleware/cookieSettings.d.ts.map +1 -0
- package/dist/cjs/middleware/cookieSettings.js +5 -0
- package/dist/cjs/middleware/cookieSettings.js.map +1 -0
- package/dist/cjs/middleware/createNextMiddleware.d.ts +10 -0
- package/dist/cjs/middleware/createNextMiddleware.d.ts.map +1 -0
- package/dist/cjs/middleware/createNextMiddleware.js +151 -0
- package/dist/cjs/middleware/createNextMiddleware.js.map +1 -0
- package/dist/cjs/middleware.d.ts +3 -0
- package/dist/cjs/middleware.d.ts.map +1 -0
- package/dist/cjs/middleware.js +9 -0
- package/dist/cjs/middleware.js.map +1 -0
- package/dist/cjs/next/imports/imports.d.ts +6 -0
- package/dist/cjs/next/imports/imports.d.ts.map +1 -0
- package/dist/cjs/next/imports/imports.js +84 -0
- package/dist/cjs/next/imports/imports.js.map +1 -0
- package/dist/cjs/next/requestFunctions.d.ts +21 -0
- package/dist/cjs/next/requestFunctions.d.ts.map +1 -0
- package/dist/cjs/next/requestFunctions.js +58 -0
- package/dist/cjs/next/requestFunctions.js.map +1 -0
- package/dist/cjs/next.d.ts +38 -0
- package/dist/cjs/next.d.ts.map +1 -0
- package/dist/cjs/next.js +58 -0
- package/dist/cjs/next.js.map +1 -0
- package/dist/cjs/primitives/calculateID.d.ts +2 -0
- package/dist/cjs/primitives/calculateID.d.ts.map +1 -0
- package/dist/cjs/primitives/calculateID.js +49 -0
- package/dist/cjs/primitives/calculateID.js.map +1 -0
- package/dist/cjs/primitives/createValues.d.ts +6 -0
- package/dist/cjs/primitives/createValues.d.ts.map +1 -0
- package/dist/cjs/primitives/createValues.js +16 -0
- package/dist/cjs/primitives/createValues.js.map +1 -0
- package/dist/cjs/primitives/defaultVariableNames.d.ts +3 -0
- package/dist/cjs/primitives/defaultVariableNames.d.ts.map +1 -0
- package/dist/cjs/primitives/defaultVariableNames.js +10 -0
- package/dist/cjs/primitives/defaultVariableNames.js.map +1 -0
- package/dist/cjs/primitives/flattenDictionary.d.ts +9 -0
- package/dist/cjs/primitives/flattenDictionary.d.ts.map +1 -0
- package/dist/cjs/primitives/flattenDictionary.js +29 -0
- package/dist/cjs/primitives/flattenDictionary.js.map +1 -0
- package/dist/cjs/primitives/getDictionaryReference.d.ts +8 -0
- package/dist/cjs/primitives/getDictionaryReference.d.ts.map +1 -0
- package/dist/cjs/primitives/getDictionaryReference.js +13 -0
- package/dist/cjs/primitives/getDictionaryReference.js.map +1 -0
- package/dist/cjs/primitives/getEntryMetadata.d.ts +5 -0
- package/dist/cjs/primitives/getEntryMetadata.d.ts.map +1 -0
- package/dist/cjs/primitives/getEntryMetadata.js +17 -0
- package/dist/cjs/primitives/getEntryMetadata.js.map +1 -0
- package/dist/cjs/primitives/getEntryTranslationType.d.ts +2 -0
- package/dist/cjs/primitives/getEntryTranslationType.d.ts.map +1 -0
- package/dist/cjs/primitives/getEntryTranslationType.js +31 -0
- package/dist/cjs/primitives/getEntryTranslationType.js.map +1 -0
- package/dist/cjs/primitives/getPluralBranch.d.ts +14 -0
- package/dist/cjs/primitives/getPluralBranch.d.ts.map +1 -0
- package/dist/cjs/primitives/getPluralBranch.js +88 -0
- package/dist/cjs/primitives/getPluralBranch.js.map +1 -0
- package/dist/cjs/primitives/getRenderAttributes.d.ts +5 -0
- package/dist/cjs/primitives/getRenderAttributes.d.ts.map +1 -0
- package/dist/cjs/primitives/getRenderAttributes.js +24 -0
- package/dist/cjs/primitives/getRenderAttributes.js.map +1 -0
- package/dist/cjs/primitives/getValueBranch.d.ts +9 -0
- package/dist/cjs/primitives/getValueBranch.d.ts.map +1 -0
- package/dist/cjs/primitives/getValueBranch.js +67 -0
- package/dist/cjs/primitives/getValueBranch.js.map +1 -0
- package/dist/cjs/primitives/hasTransformation.d.ts +3 -0
- package/dist/cjs/primitives/hasTransformation.d.ts.map +1 -0
- package/dist/cjs/primitives/hasTransformation.js +16 -0
- package/dist/cjs/primitives/hasTransformation.js.map +1 -0
- package/dist/cjs/primitives/isValidReactNode.d.ts +15 -0
- package/dist/cjs/primitives/isValidReactNode.d.ts.map +1 -0
- package/dist/cjs/primitives/isValidReactNode.js +27 -0
- package/dist/cjs/primitives/isValidReactNode.js.map +1 -0
- package/dist/cjs/server/T.d.ts +15 -0
- package/dist/cjs/server/T.d.ts.map +1 -0
- package/dist/cjs/server/T.js +98 -0
- package/dist/cjs/server/T.js.map +1 -0
- package/dist/cjs/server/createTComponent.d.ts +12 -0
- package/dist/cjs/server/createTComponent.d.ts.map +1 -0
- package/dist/cjs/server/createTComponent.js +31 -0
- package/dist/cjs/server/createTComponent.js.map +1 -0
- package/dist/cjs/server/helpers/Resolver.d.ts +5 -0
- package/dist/cjs/server/helpers/Resolver.d.ts.map +1 -0
- package/dist/cjs/server/helpers/Resolver.js +25 -0
- package/dist/cjs/server/helpers/Resolver.js.map +1 -0
- package/dist/cjs/server/helpers/addGTIdentifier.d.ts +11 -0
- package/dist/cjs/server/helpers/addGTIdentifier.d.ts.map +1 -0
- package/dist/cjs/server/helpers/addGTIdentifier.js +148 -0
- package/dist/cjs/server/helpers/addGTIdentifier.js.map +1 -0
- package/dist/cjs/server/helpers/writeChildrenAsObjects.d.ts +11 -0
- package/dist/cjs/server/helpers/writeChildrenAsObjects.d.ts.map +1 -0
- package/dist/cjs/server/helpers/writeChildrenAsObjects.js +116 -0
- package/dist/cjs/server/helpers/writeChildrenAsObjects.js.map +1 -0
- package/dist/cjs/server/plural/InnerPlural.d.ts +24 -0
- package/dist/cjs/server/plural/InnerPlural.d.ts.map +1 -0
- package/dist/cjs/server/plural/InnerPlural.js +35 -0
- package/dist/cjs/server/plural/InnerPlural.js.map +1 -0
- package/dist/cjs/server/plural/createPluralComponent.d.ts +12 -0
- package/dist/cjs/server/plural/createPluralComponent.d.ts.map +1 -0
- package/dist/cjs/server/plural/createPluralComponent.js +30 -0
- package/dist/cjs/server/plural/createPluralComponent.js.map +1 -0
- package/dist/cjs/server/provider/GTProvider.d.ts +13 -0
- package/dist/cjs/server/provider/GTProvider.d.ts.map +1 -0
- package/dist/cjs/server/provider/GTProvider.js +61 -0
- package/dist/cjs/server/provider/GTProvider.js.map +1 -0
- package/dist/cjs/server/provider/createGTProviderComponent.d.ts +10 -0
- package/dist/cjs/server/provider/createGTProviderComponent.d.ts.map +1 -0
- package/dist/cjs/server/provider/createGTProviderComponent.js +30 -0
- package/dist/cjs/server/provider/createGTProviderComponent.js.map +1 -0
- package/dist/cjs/server/renderChildren.d.ts +24 -0
- package/dist/cjs/server/renderChildren.d.ts.map +1 -0
- package/dist/cjs/server/renderChildren.js +177 -0
- package/dist/cjs/server/renderChildren.js.map +1 -0
- package/dist/cjs/server/value/InnerValue.d.ts +12 -0
- package/dist/cjs/server/value/InnerValue.d.ts.map +1 -0
- package/dist/cjs/server/value/InnerValue.js +30 -0
- package/dist/cjs/server/value/InnerValue.js.map +1 -0
- package/dist/cjs/server/value/createValueComponent.d.ts +13 -0
- package/dist/cjs/server/value/createValueComponent.d.ts.map +1 -0
- package/dist/cjs/server/value/createValueComponent.js +29 -0
- package/dist/cjs/server/value/createValueComponent.js.map +1 -0
- package/dist/cjs/server/value/renderVariable.d.ts +9 -0
- package/dist/cjs/server/value/renderVariable.d.ts.map +1 -0
- package/dist/cjs/server/value/renderVariable.js +66 -0
- package/dist/cjs/server/value/renderVariable.js.map +1 -0
- package/dist/cjs/server/variables/Currency/Currency.d.ts +15 -0
- package/dist/cjs/server/variables/Currency/Currency.d.ts.map +1 -0
- package/dist/cjs/server/variables/Currency/Currency.js +29 -0
- package/dist/cjs/server/variables/Currency/Currency.js.map +1 -0
- package/dist/cjs/server/variables/Currency/createCurrencyComponent.d.ts +8 -0
- package/dist/cjs/server/variables/Currency/createCurrencyComponent.d.ts.map +1 -0
- package/dist/cjs/server/variables/Currency/createCurrencyComponent.js +29 -0
- package/dist/cjs/server/variables/Currency/createCurrencyComponent.js.map +1 -0
- package/dist/cjs/server/variables/DateTime/DateTime.d.ts +13 -0
- package/dist/cjs/server/variables/DateTime/DateTime.d.ts.map +1 -0
- package/dist/cjs/server/variables/DateTime/DateTime.js +45 -0
- package/dist/cjs/server/variables/DateTime/DateTime.js.map +1 -0
- package/dist/cjs/server/variables/DateTime/createDateTimeComponent.d.ts +8 -0
- package/dist/cjs/server/variables/DateTime/createDateTimeComponent.d.ts.map +1 -0
- package/dist/cjs/server/variables/DateTime/createDateTimeComponent.js +29 -0
- package/dist/cjs/server/variables/DateTime/createDateTimeComponent.js.map +1 -0
- package/dist/cjs/server/variables/Num/Num.d.ts +14 -0
- package/dist/cjs/server/variables/Num/Num.d.ts.map +1 -0
- package/dist/cjs/server/variables/Num/Num.js +27 -0
- package/dist/cjs/server/variables/Num/Num.js.map +1 -0
- package/dist/cjs/server/variables/Num/createNumComponent.d.ts +8 -0
- package/dist/cjs/server/variables/Num/createNumComponent.d.ts.map +1 -0
- package/dist/cjs/server/variables/Num/createNumComponent.js +30 -0
- package/dist/cjs/server/variables/Num/createNumComponent.js.map +1 -0
- package/dist/cjs/server/variables/Var/Var.d.ts +12 -0
- package/dist/cjs/server/variables/Var/Var.d.ts.map +1 -0
- package/dist/cjs/server/variables/Var/Var.js +24 -0
- package/dist/cjs/server/variables/Var/Var.js.map +1 -0
- package/dist/cjs/server/variables/Var/createVarComponent.d.ts +7 -0
- package/dist/cjs/server/variables/Var/createVarComponent.d.ts.map +1 -0
- package/dist/cjs/server/variables/Var/createVarComponent.js +29 -0
- package/dist/cjs/server/variables/Var/createVarComponent.js.map +1 -0
- package/dist/cjs/server.d.ts +45 -0
- package/dist/cjs/server.d.ts.map +1 -0
- package/dist/cjs/server.js +149 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/cjs/types/CreateGTProps.d.ts +23 -0
- package/dist/cjs/types/CreateGTProps.d.ts.map +1 -0
- package/dist/cjs/types/CreateGTProps.js +3 -0
- package/dist/cjs/types/CreateGTProps.js.map +1 -0
- package/dist/cjs/types/GeneralTranslationInterface.d.ts +118 -0
- package/dist/cjs/types/GeneralTranslationInterface.d.ts.map +1 -0
- package/dist/cjs/types/GeneralTranslationInterface.js +3 -0
- package/dist/cjs/types/GeneralTranslationInterface.js.map +1 -0
- package/dist/cjs/types/Variables.d.ts +83 -0
- package/dist/cjs/types/Variables.d.ts.map +1 -0
- package/dist/cjs/types/Variables.js +3 -0
- package/dist/cjs/types/Variables.js.map +1 -0
- package/dist/cjs/types/defaultGTProps.d.ts +20 -0
- package/dist/cjs/types/defaultGTProps.d.ts.map +1 -0
- package/dist/cjs/types/defaultGTProps.js +31 -0
- package/dist/cjs/types/defaultGTProps.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = flattenDictionary;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
/**
|
|
9
|
+
* Flattens a nested dictionary by concatenating nested keys.
|
|
10
|
+
* @param {Record<string, any>} obj - The dictionary to flatten.
|
|
11
|
+
* @param {string} [prefix=''] - The prefix for nested keys.
|
|
12
|
+
* @returns {Record<string, React.ReactNode>} The flattened dictionary object.
|
|
13
|
+
*/
|
|
14
|
+
function flattenDictionary(obj, prefix = '') {
|
|
15
|
+
const flattened = {};
|
|
16
|
+
for (const key in obj) {
|
|
17
|
+
if (obj.hasOwnProperty(key)) {
|
|
18
|
+
const newKey = prefix ? `${prefix}.${key}` : key;
|
|
19
|
+
if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key]) && !(react_1.default.isValidElement(obj[key]))) {
|
|
20
|
+
Object.assign(flattened, flattenDictionary(obj[key], newKey));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
flattened[newKey] = obj[key];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return flattened;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=flattenDictionary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenDictionary.js","sourceRoot":"","sources":["../../../src/primitives/flattenDictionary.ts"],"names":[],"mappings":";;;;;AAQA,oCAgBC;AAxBD,kDAA0B;AAE1B;;;;;GAKG;AACH,SAAwB,iBAAiB,CAAC,GAAwB,EAAE,SAAiB,EAAE;IACnF,MAAM,SAAS,GAAoC,EAAE,CAAC;IAEtD,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACpB,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;YAEjD,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,eAAK,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrH,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;YAClE,CAAC;iBAAM,CAAC;gBACJ,SAAS,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACjC,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a dictionary reference string from locale and dictionary name.
|
|
3
|
+
* @param {string} locale - The locale of the dictionary.
|
|
4
|
+
* @param {string} dictionaryName - The name of the dictionary.
|
|
5
|
+
* @returns {string} The encoded dictionary reference.
|
|
6
|
+
*/
|
|
7
|
+
export default function getDictionaryReference(locale: string, dictionaryName: string): string;
|
|
8
|
+
//# sourceMappingURL=getDictionaryReference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDictionaryReference.d.ts","sourceRoot":"","sources":["../../../src/primitives/getDictionaryReference.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAE7F"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = getDictionaryReference;
|
|
4
|
+
/**
|
|
5
|
+
* Generates a dictionary reference string from locale and dictionary name.
|
|
6
|
+
* @param {string} locale - The locale of the dictionary.
|
|
7
|
+
* @param {string} dictionaryName - The name of the dictionary.
|
|
8
|
+
* @returns {string} The encoded dictionary reference.
|
|
9
|
+
*/
|
|
10
|
+
function getDictionaryReference(locale, dictionaryName) {
|
|
11
|
+
return `${encodeURIComponent(dictionaryName)}/${encodeURIComponent(locale)}`;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=getDictionaryReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDictionaryReference.js","sourceRoot":"","sources":["../../../src/primitives/getDictionaryReference.ts"],"names":[],"mappings":";;AAMA,yCAEC;AARD;;;;;GAKG;AACH,SAAwB,sBAAsB,CAAC,MAAc,EAAE,cAAsB;IACjF,OAAO,GAAG,kBAAkB,CAAC,cAAc,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntryMetadata.d.ts","sourceRoot":"","sources":["../../../src/primitives/getEntryMetadata.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG;IAClD,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACjC,CAWA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = getEntryMetadata;
|
|
4
|
+
// Extracts metadata if it has been included in the dictionary
|
|
5
|
+
function getEntryMetadata(entry) {
|
|
6
|
+
let metadata;
|
|
7
|
+
if (entry) {
|
|
8
|
+
if (Array.isArray(entry)) {
|
|
9
|
+
if (typeof (entry === null || entry === void 0 ? void 0 : entry[1]) === 'object') {
|
|
10
|
+
metadata = entry[1];
|
|
11
|
+
}
|
|
12
|
+
entry = entry[0];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return { entry, metadata };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=getEntryMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntryMetadata.js","sourceRoot":"","sources":["../../../src/primitives/getEntryMetadata.ts"],"names":[],"mappings":";;AAGA,mCAcC;AAfD,8DAA8D;AAC9D,SAAwB,gBAAgB,CAAC,KAAU;IAI/C,IAAI,QAAQ,CAAC;IACb,IAAI,KAAK,EAAE,CAAC;QACR,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACvB,IAAI,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,CAAA,KAAK,QAAQ,EAAE,CAAC;gBACjC,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC;YACD,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;IACL,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntryTranslationType.d.ts","sourceRoot":"","sources":["../../../src/primitives/getEntryTranslationType.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,GAAG,QAAQ,CAuB1E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = getEntryTranslationType;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const getEntryMetadata_1 = __importDefault(require("./getEntryMetadata"));
|
|
9
|
+
function getEntryTranslationType(entry) {
|
|
10
|
+
const { entry: entryContent, metadata } = (0, getEntryMetadata_1.default)(entry);
|
|
11
|
+
if (metadata) {
|
|
12
|
+
if (metadata.singular
|
|
13
|
+
|| metadata.plural
|
|
14
|
+
|| metadata.dual
|
|
15
|
+
|| metadata.zero
|
|
16
|
+
|| metadata.one
|
|
17
|
+
|| metadata.two
|
|
18
|
+
|| metadata.few
|
|
19
|
+
|| metadata.many
|
|
20
|
+
|| metadata.other)
|
|
21
|
+
return "plural";
|
|
22
|
+
}
|
|
23
|
+
if (!react_1.default.isValidElement(entryContent) && typeof entryContent === 'object') {
|
|
24
|
+
const entryKeys = Object.keys(entryContent);
|
|
25
|
+
if (entryKeys.every(key => ["singular", "plural", "dual", "zero", "one", "two", "few", "many", "other"].includes(key)))
|
|
26
|
+
return "plural";
|
|
27
|
+
return "t";
|
|
28
|
+
}
|
|
29
|
+
return "t";
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=getEntryTranslationType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntryTranslationType.js","sourceRoot":"","sources":["../../../src/primitives/getEntryTranslationType.ts"],"names":[],"mappings":";;;;;AAGA,0CAuBC;AA1BD,kDAA0B;AAC1B,0EAAkD;AAElD,SAAwB,uBAAuB,CAAC,KAAU;IACtD,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,IAAA,0BAAgB,EAAC,KAAK,CAAC,CAAC;IAClE,IAAI,QAAQ,EAAE,CAAC;QACX,IACG,QAAQ,CAAC,QAAQ;eACd,QAAQ,CAAC,MAAM;eACf,QAAQ,CAAC,IAAI;eACb,QAAQ,CAAC,IAAI;eACb,QAAQ,CAAC,GAAG;eACZ,QAAQ,CAAC,GAAG;eACZ,QAAQ,CAAC,GAAG;eACZ,QAAQ,CAAC,IAAI;eACb,QAAQ,CAAC,KAAK;YAClB,OAAO,QAAQ,CAAC;IACtB,CAAC;IACD,IAAI,CAAC,eAAK,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QAC1E,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CACtB,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAC7F;YAAE,OAAO,QAAQ,CAAC;QACnB,OAAO,GAAG,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Range = {
|
|
2
|
+
max: number;
|
|
3
|
+
min: number;
|
|
4
|
+
children: any;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Main function to get the appropriate branch based on the provided number and branches.
|
|
8
|
+
*
|
|
9
|
+
* @param {number} n - The number to determine the branch for.
|
|
10
|
+
* @param {any} branches - The object containing possible branches and their corresponding ranges and options.
|
|
11
|
+
* @returns {any} The determined branch.
|
|
12
|
+
*/
|
|
13
|
+
export default function getPluralBranch(n: number, locales: string[], branches: any): any;
|
|
14
|
+
//# sourceMappingURL=getPluralBranch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPluralBranch.d.ts","sourceRoot":"","sources":["../../../src/primitives/getPluralBranch.ts"],"names":[],"mappings":"AAsCA,MAAM,MAAM,KAAK,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,GAAG,CAAC;CACjB,CAAA;AAgBD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG,OAOlF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = getPluralBranch;
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to get the branch name from a number based on provided options.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} n - The number to determine the branch name for.
|
|
8
|
+
* @param {Record<string, any>} options - The options containing possible branch names.
|
|
9
|
+
* @returns {string} The determined branch name.
|
|
10
|
+
*/
|
|
11
|
+
function getBranchNameFromNumber(n, locales, options) {
|
|
12
|
+
const pluralRules = new Intl.PluralRules(locales);
|
|
13
|
+
const provisionalBranchName = pluralRules.select(n);
|
|
14
|
+
// aliases
|
|
15
|
+
// 0
|
|
16
|
+
if (n === 0 && options["zero"])
|
|
17
|
+
return "zero"; // override
|
|
18
|
+
// 1
|
|
19
|
+
if (Math.abs(n) === 1 && options["singular"])
|
|
20
|
+
return "singular"; // override
|
|
21
|
+
if (Math.abs(n) === 1 && options["one"])
|
|
22
|
+
return "one"; // override
|
|
23
|
+
if (provisionalBranchName === "one" && options["singular"])
|
|
24
|
+
return "singular";
|
|
25
|
+
// 2
|
|
26
|
+
if (Math.abs(n) === 2 && options["dual"])
|
|
27
|
+
return "dual"; // override
|
|
28
|
+
if (Math.abs(n) === 2 && options["two"])
|
|
29
|
+
return "two"; // override
|
|
30
|
+
if (provisionalBranchName === "two" && options["dual"])
|
|
31
|
+
return "dual";
|
|
32
|
+
if (provisionalBranchName === "two" && options["plural"])
|
|
33
|
+
return "plural";
|
|
34
|
+
if (provisionalBranchName === "two" && options["other"])
|
|
35
|
+
return "other";
|
|
36
|
+
// few
|
|
37
|
+
if (provisionalBranchName === "few" && options["paucal"])
|
|
38
|
+
return "paucal";
|
|
39
|
+
if (provisionalBranchName === "few" && options["other"])
|
|
40
|
+
return "other";
|
|
41
|
+
// many
|
|
42
|
+
if (provisionalBranchName === "many" && options["other"])
|
|
43
|
+
return "plural";
|
|
44
|
+
// default
|
|
45
|
+
if (options[provisionalBranchName])
|
|
46
|
+
return provisionalBranchName;
|
|
47
|
+
if (provisionalBranchName === "few" && options["plural"])
|
|
48
|
+
return "plural";
|
|
49
|
+
if (provisionalBranchName === "many" && options["plural"])
|
|
50
|
+
return "plural";
|
|
51
|
+
// other
|
|
52
|
+
if (provisionalBranchName === "other" && options["plural"])
|
|
53
|
+
return "plural";
|
|
54
|
+
return "";
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Helper function to get the branch from a list of ranges.
|
|
58
|
+
*
|
|
59
|
+
* @param {number} n - The number to determine the branch for.
|
|
60
|
+
* @param {Range[]} ranges - The list of ranges containing possible branches.
|
|
61
|
+
* @returns {any | undefined} The determined branch or undefined if no matching range is found.
|
|
62
|
+
*/
|
|
63
|
+
function getBranchFromRanges(n, ranges) {
|
|
64
|
+
for (const range of ranges) {
|
|
65
|
+
if (range.min <= n && range.max >= n)
|
|
66
|
+
return range.children;
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Main function to get the appropriate branch based on the provided number and branches.
|
|
72
|
+
*
|
|
73
|
+
* @param {number} n - The number to determine the branch for.
|
|
74
|
+
* @param {any} branches - The object containing possible branches and their corresponding ranges and options.
|
|
75
|
+
* @returns {any} The determined branch.
|
|
76
|
+
*/
|
|
77
|
+
function getPluralBranch(n, locales, branches) {
|
|
78
|
+
let branchName = '';
|
|
79
|
+
let branch = null;
|
|
80
|
+
if (typeof n === 'number' && (branches === null || branches === void 0 ? void 0 : branches.ranges))
|
|
81
|
+
branch = getBranchFromRanges(n, branches.ranges);
|
|
82
|
+
if (typeof n === 'number' && !branch && branches)
|
|
83
|
+
branchName = getBranchNameFromNumber(n, locales, branches);
|
|
84
|
+
if (branchName && !branch)
|
|
85
|
+
branch = branches[branchName];
|
|
86
|
+
return branch;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=getPluralBranch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPluralBranch.js","sourceRoot":"","sources":["../../../src/primitives/getPluralBranch.ts"],"names":[],"mappings":";;AAiEA,kCAOC;AAxED;;;;;;GAMG;AACH,SAAS,uBAAuB,CAAC,CAAS,EAAE,OAAiB,EAAE,OAA4B;IACvF,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,qBAAqB,GAAG,WAAW,CAAC,MAAM,CAA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AC,MAAM;QAAE,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRenderAttributes.d.ts","sourceRoot":"","sources":["../../../src/primitives/getRenderAttributes.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAC,MAAM,EAAE,GAAG,OAAO,EAAC,EAAE;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,OAKA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.default = getRenderAttributes;
|
|
15
|
+
const generaltranslation_1 = require("generaltranslation");
|
|
16
|
+
function getRenderAttributes(_a) {
|
|
17
|
+
var { locale } = _a, options = __rest(_a, ["locale"]);
|
|
18
|
+
let renderAttributes = {};
|
|
19
|
+
const dir = (0, generaltranslation_1.getLanguageDirection)(locale);
|
|
20
|
+
if (dir === 'rtl')
|
|
21
|
+
renderAttributes = Object.assign(Object.assign({}, renderAttributes), { dir });
|
|
22
|
+
return renderAttributes;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=getRenderAttributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRenderAttributes.js","sourceRoot":"","sources":["../../../src/primitives/getRenderAttributes.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,sCAQC;AAVD,2DAA0D;AAE1D,SAAwB,mBAAmB,CAAC,EAG3C;QAH2C,EAAC,MAAM,OAGlD,EAHuD,OAAO,cAAnB,UAAoB,CAAD;IAI3D,IAAI,gBAAgB,GAAQ,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAA,yCAAoB,EAAC,MAAM,CAAC,CAAC;IACzC,IAAI,GAAG,KAAK,KAAK;QAAE,gBAAgB,mCAAQ,gBAAgB,KAAE,GAAG,GAAE,CAAA;IAClE,OAAO,gBAAgB,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively navigates through a branch object based on the provided values and returns the matched React node.
|
|
3
|
+
*
|
|
4
|
+
* @param {Record<string, any>} values - An object containing key-value pairs used to navigate through the branches.
|
|
5
|
+
* @param {Record<string, any>} branches - An object representing the branches to be navigated based on the values.
|
|
6
|
+
* @returns {any} - Returns the matched React node or undefined if no match is found.
|
|
7
|
+
*/
|
|
8
|
+
export default function getValueBranch(values: Record<string, any>, branches: Record<string, any>): any;
|
|
9
|
+
//# sourceMappingURL=getValueBranch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getValueBranch.d.ts","sourceRoot":"","sources":["../../../src/primitives/getValueBranch.ts"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAiCtG"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = getValueBranch;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const isValidReactNode_1 = __importDefault(require("./isValidReactNode"));
|
|
9
|
+
/*
|
|
10
|
+
{
|
|
11
|
+
"gender": {
|
|
12
|
+
"male": {
|
|
13
|
+
"VIP": {
|
|
14
|
+
"true": <>Customer name is {{name}}. He is a valued customer.</>,
|
|
15
|
+
"false": "He is a customer."
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"female": {
|
|
19
|
+
"VIP": {
|
|
20
|
+
"true": <>Customer name is {{name}}. She is a valued customer.</>,
|
|
21
|
+
"false": "She is a customer."
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"other": "They are a customer."
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Recursively navigates through a branch object based on the provided values and returns the matched React node.
|
|
30
|
+
*
|
|
31
|
+
* @param {Record<string, any>} values - An object containing key-value pairs used to navigate through the branches.
|
|
32
|
+
* @param {Record<string, any>} branches - An object representing the branches to be navigated based on the values.
|
|
33
|
+
* @returns {any} - Returns the matched React node or undefined if no match is found.
|
|
34
|
+
*/
|
|
35
|
+
function getValueBranch(values, branches) {
|
|
36
|
+
let currentDefault = null;
|
|
37
|
+
/**
|
|
38
|
+
* Handles the navigation through a given branch object.
|
|
39
|
+
*
|
|
40
|
+
* @param {any} branch - The current branch object to navigate.
|
|
41
|
+
* @returns {any} - Returns the matched React node, the default value, or null if no match is found.
|
|
42
|
+
*/
|
|
43
|
+
const handleBranch = (branch) => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
currentDefault = (branch === null || branch === void 0 ? void 0 : branch["*"]) || currentDefault;
|
|
46
|
+
for (const key of Object.keys(branch)) {
|
|
47
|
+
let value = values[key];
|
|
48
|
+
if (value) {
|
|
49
|
+
// we already know branch[key] exists
|
|
50
|
+
if (branch[key][value]) {
|
|
51
|
+
if (typeof ((_b = (_a = branch[key][value].props) === null || _a === void 0 ? void 0 : _a['data-generaltranslation']) === null || _b === void 0 ? void 0 : _b.id) === 'number') {
|
|
52
|
+
return branch[key][value];
|
|
53
|
+
}
|
|
54
|
+
/* @ts-expect-error Lazy components are meant to return a promise */
|
|
55
|
+
if ((0, isValidReactNode_1.default)(branch[key][value]) || branch[key][value].$$typeof === react_1.default.lazy(() => { }).$$typeof) {
|
|
56
|
+
return branch[key][value];
|
|
57
|
+
}
|
|
58
|
+
return handleBranch(branch[key][value]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return currentDefault;
|
|
63
|
+
};
|
|
64
|
+
// Start the recursive navigation from the root branches
|
|
65
|
+
return handleBranch(branches);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=getValueBranch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getValueBranch.js","sourceRoot":"","sources":["../../../src/primitives/getValueBranch.ts"],"names":[],"mappings":";;;;;AA8BA,iCAiCC;AA/DD,kDAA0B;AAC1B,0EAAkD;AAElD;;;;;;;;;;;;;;;;;;EAkBE;AAEF;;;;;;GAMG;AACH,SAAwB,cAAc,CAAC,MAA2B,EAAE,QAA6B;IAE7F,IAAI,cAAc,GAAQ,IAAI,CAAC;IAE/B;;;;;OAKG;IACH,MAAM,YAAY,GAAG,CAAC,MAAW,EAAO,EAAE;;QACtC,cAAc,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,GAAG,CAAC,KAAI,cAAc,CAAC;QACjD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACpC,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YACxB,IAAI,KAAK,EAAE,CAAC;gBACR,qCAAqC;gBACrC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;oBACrB,IAAI,OAAO,CAAA,MAAA,MAAA,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,0CAAG,yBAAyB,CAAC,0CAAE,EAAE,CAAA,KAAK,QAAQ,EAAE,CAAC;wBAChF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;oBAC9B,CAAC;oBACD,oEAAoE;oBACpE,IAAI,IAAA,0BAAgB,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;wBACxG,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;oBAC9B,CAAC;oBACD,OAAO,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;gBAC3C,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,cAAc,CAAC;IAC1B,CAAC,CAAA;IAED,wDAAwD;IACxD,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasTransformation.d.ts","sourceRoot":"","sources":["../../../src/primitives/hasTransformation.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAOnE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = hasTransformation;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
function hasTransformation(entry) {
|
|
9
|
+
if (react_1.default.isValidElement(entry)) {
|
|
10
|
+
const { type } = entry;
|
|
11
|
+
const transformation = typeof type === 'function' ? ((type === null || type === void 0 ? void 0 : type.gtTransformation) || '') : '';
|
|
12
|
+
return transformation ? true : false;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=hasTransformation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasTransformation.js","sourceRoot":"","sources":["../../../src/primitives/hasTransformation.ts"],"names":[],"mappings":";;;;;AAEA,oCAOC;AATD,kDAAyC;AAEzC,SAAwB,iBAAiB,CAAC,KAAgB;IACtD,IAAI,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;QACvB,MAAM,cAAc,GAAW,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAY,aAAZ,IAAI,uBAAJ,IAAI,CAAU,gBAAgB,KAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzG,OAAO,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACzC,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Type guard to determine if a given node is a valid ReactNode. Excludes null and undefined nodes.
|
|
4
|
+
* A ReactNode can be:
|
|
5
|
+
* - string
|
|
6
|
+
* - number
|
|
7
|
+
* - boolean
|
|
8
|
+
* - a valid React element
|
|
9
|
+
* - an array of valid ReactNodes
|
|
10
|
+
*
|
|
11
|
+
* @param {any} node - The node to check.
|
|
12
|
+
* @returns {node is ReactNode} - True if the node is a valid ReactNode, false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
export default function isValidReactNode(node: any): node is ReactNode;
|
|
15
|
+
//# sourceMappingURL=isValidReactNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidReactNode.d.ts","sourceRoot":"","sources":["../../../src/primitives/isValidReactNode.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,SAAS,CAQrE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = isValidReactNode;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
/**
|
|
9
|
+
* Type guard to determine if a given node is a valid ReactNode. Excludes null and undefined nodes.
|
|
10
|
+
* A ReactNode can be:
|
|
11
|
+
* - string
|
|
12
|
+
* - number
|
|
13
|
+
* - boolean
|
|
14
|
+
* - a valid React element
|
|
15
|
+
* - an array of valid ReactNodes
|
|
16
|
+
*
|
|
17
|
+
* @param {any} node - The node to check.
|
|
18
|
+
* @returns {node is ReactNode} - True if the node is a valid ReactNode, false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
function isValidReactNode(node) {
|
|
21
|
+
return (typeof node === 'string' ||
|
|
22
|
+
typeof node === 'number' ||
|
|
23
|
+
typeof node === 'boolean' ||
|
|
24
|
+
react_1.default.isValidElement(node) ||
|
|
25
|
+
(Array.isArray(node) && node.every(isValidReactNode)));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=isValidReactNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidReactNode.js","sourceRoot":"","sources":["../../../src/primitives/isValidReactNode.ts"],"names":[],"mappings":";;;;;AAcA,mCAQC;AAtBD,kDAAyC;AAEzC;;;;;;;;;;;GAWG;AACH,SAAwB,gBAAgB,CAAC,IAAS;IAC9C,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ;QACxB,OAAO,IAAI,KAAK,QAAQ;QACxB,OAAO,IAAI,KAAK,SAAS;QACzB,eAAK,CAAC,cAAc,CAAC,IAAI,CAAC;QAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CACtD,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import I18NConfiguration from '../config/I18NConfiguration';
|
|
3
|
+
type ServerTProps = {
|
|
4
|
+
I18NConfig: I18NConfiguration;
|
|
5
|
+
children: any;
|
|
6
|
+
locale: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
declare const ServerT: {
|
|
11
|
+
({ I18NConfig, children, locale, ...props }: ServerTProps): Promise<ReactNode>;
|
|
12
|
+
gtTransformation: string;
|
|
13
|
+
};
|
|
14
|
+
export default ServerT;
|
|
15
|
+
//# sourceMappingURL=T.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"T.d.ts","sourceRoot":"","sources":["../../../src/server/T.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAKlD,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAK5D,KAAK,YAAY,GAAG;IAChB,UAAU,EAAE,iBAAiB,CAAA;IAC7B,QAAQ,EAAE,GAAG,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAA;AAED,QAAA,MAAM,OAAO;iDAEV,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC;;CAoGnC,CAAA;AAID,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
const react_1 = require("react");
|
|
28
|
+
const addGTIdentifier_1 = __importDefault(require("./helpers/addGTIdentifier"));
|
|
29
|
+
const writeChildrenAsObjects_1 = __importDefault(require("./helpers/writeChildrenAsObjects"));
|
|
30
|
+
const renderChildren_1 = __importDefault(require("./renderChildren"));
|
|
31
|
+
const Resolver_1 = __importDefault(require("./helpers/Resolver"));
|
|
32
|
+
const calculateID_1 = __importDefault(require("../primitives/calculateID"));
|
|
33
|
+
const getRenderAttributes_1 = __importDefault(require("../primitives/getRenderAttributes"));
|
|
34
|
+
const ServerT = (_a) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
var _b;
|
|
36
|
+
var { I18NConfig, children, locale } = _a, props = __rest(_a, ["I18NConfig", "children", "locale"]);
|
|
37
|
+
// Handle case where translation is not required, for example if the user's browser is in the default locale
|
|
38
|
+
const translationRequired = (children && I18NConfig.translationRequired(locale)) ? true : false;
|
|
39
|
+
if (!translationRequired) {
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
|
|
41
|
+
}
|
|
42
|
+
// Fetch translations promise
|
|
43
|
+
const translationsPromise = I18NConfig.getTranslations(locale, props.dictionaryName);
|
|
44
|
+
const defaultLocale = I18NConfig.getDefaultLocale();
|
|
45
|
+
const renderAttributes = (0, getRenderAttributes_1.default)(Object.assign({ locale }, props));
|
|
46
|
+
const taggedChildren = (0, addGTIdentifier_1.default)(children);
|
|
47
|
+
const childrenAsObjects = (0, writeChildrenAsObjects_1.default)(taggedChildren);
|
|
48
|
+
const key = yield (0, calculateID_1.default)(childrenAsObjects);
|
|
49
|
+
const id = props.id ? props.id : key;
|
|
50
|
+
const translations = yield translationsPromise;
|
|
51
|
+
const translation = yield I18NConfig.getTranslation(locale, key, id, (_b = props.dictionaryName) !== null && _b !== void 0 ? _b : undefined, translations);
|
|
52
|
+
// Check if a translation for this site already exists and return it if it does
|
|
53
|
+
const translationExists = translation ? true : false;
|
|
54
|
+
if (translationExists) {
|
|
55
|
+
const I18NChildren = (0, renderChildren_1.default)({ source: taggedChildren, target: translation, renderAttributes, locale, defaultLocale });
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: I18NChildren }));
|
|
57
|
+
}
|
|
58
|
+
// Check if a new translation for this site can be created
|
|
59
|
+
const renderSettings = I18NConfig.getRenderSettings();
|
|
60
|
+
if (!I18NConfig.automaticTranslationEnabled()) {
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
|
|
62
|
+
}
|
|
63
|
+
// Create a new translation for this site and render it
|
|
64
|
+
const I18NChildrenPromise = I18NConfig.translateChildren({ children: childrenAsObjects, targetLanguage: locale, metadata: Object.assign(Object.assign({}, props), { hash: key }) });
|
|
65
|
+
const renderMethod = (props === null || props === void 0 ? void 0 : props.renderMethod) || renderSettings.method;
|
|
66
|
+
let promise = I18NChildrenPromise.then(target => (0, renderChildren_1.default)({ source: taggedChildren, target, renderAttributes, locale, defaultLocale }));
|
|
67
|
+
// Render methods
|
|
68
|
+
let loadingFallback = children;
|
|
69
|
+
let errorFallback = children;
|
|
70
|
+
if (renderMethod === "skeleton") {
|
|
71
|
+
loadingFallback = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
72
|
+
errorFallback = children;
|
|
73
|
+
}
|
|
74
|
+
else if (renderMethod === "replace") {
|
|
75
|
+
loadingFallback = children;
|
|
76
|
+
errorFallback = loadingFallback;
|
|
77
|
+
}
|
|
78
|
+
if (renderMethod === "hang") {
|
|
79
|
+
// Wait until the site is translated to return
|
|
80
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: yield promise }));
|
|
81
|
+
}
|
|
82
|
+
if (renderSettings.renderPrevious && translations.remote && translations.remote[id] && translations.remote[id].k) {
|
|
83
|
+
// in case there's a previous translation on file
|
|
84
|
+
loadingFallback = (0, renderChildren_1.default)({ source: taggedChildren, target: translations.remote[id].t, renderAttributes, locale, defaultLocale });
|
|
85
|
+
errorFallback = loadingFallback;
|
|
86
|
+
}
|
|
87
|
+
if (renderMethod === "skeleton" || renderMethod === "replace") {
|
|
88
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: loadingFallback, children: (0, jsx_runtime_1.jsx)(Resolver_1.default, { fallback: errorFallback, children: promise }) }));
|
|
89
|
+
}
|
|
90
|
+
// If none of those
|
|
91
|
+
return (
|
|
92
|
+
// return the children, with no special rendering
|
|
93
|
+
// a translation may be available from a cached translation dictionary next time the component is loaded
|
|
94
|
+
(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: errorFallback }));
|
|
95
|
+
});
|
|
96
|
+
ServerT.gtTransformation = "translate";
|
|
97
|
+
exports.default = ServerT;
|
|
98
|
+
//# sourceMappingURL=T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"T.js","sourceRoot":"","sources":["../../../src/server/T.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAkD;AAClD,gFAAwD;AACxD,8FAAsE;AACtE,sEAA8C;AAG9C,kEAA0C;AAC1C,4EAAoD;AACpD,4FAAoE;AAUpE,MAAM,OAAO,GAAG,CAAO,EAER,EAAsB,EAAE;;QAFhB,EACnB,UAAU,EAAE,QAAQ,EAAE,MAAM,OACjB,EADsB,KAAK,cADnB,oCAEtB,CADyC;IAGtC,4GAA4G;IAC5G,MAAM,mBAAmB,GAAY,CAAC,QAAQ,IAAI,UAAU,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACzG,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvB,OAAO,CACH,2DACK,QAAQ,GACV,CACN,CAAA;IACL,CAAC;IAED,6BAA6B;IAC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AAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QACzI,aAAa,GAAG,eAAe,CAAC;IACpC,CAAC;IAED,IAAI,YAAY,KAAK,UAAU,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC5D,OAAO,CACH,uBAAC,gBAAQ,IAAC,QAAQ,EAAE,eAAe,YAE/B,uBAAC,kBAAQ,IAAC,QAAQ,EAAE,aAAa,YAAG,OAAO,GAAY,GAChD,CACd,CAAA;IACL,CAAC;IAED,oBAAoB;IAEpB,OAAO;IACH,iDAAiD;IACjD,wGAAwG;IACxG,2DACK,aAAa,GACf,CACN,CAAC;AAEN,CAAC,CAAA,CAAA;AAED,OAAO,CAAC,gBAAgB,GAAG,WAAW,CAAC;AAEvC,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import I18NConfiguration from "../config/I18NConfiguration";
|
|
2
|
+
export default function createTComponent({ I18NConfig, ...metadata }: {
|
|
3
|
+
I18NConfig: I18NConfiguration;
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}): {
|
|
6
|
+
({ children, ...props }: {
|
|
7
|
+
children?: any;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
gtTransformation: string;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=createTComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTComponent.d.ts","sourceRoot":"","sources":["../../../src/server/createTComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAE5D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACrC,UAAU,EAAE,GAAG,QAAQ,EAC1B,EAAE;IAAE,UAAU,EAAE,iBAAiB,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE;6BACR;QAAE,QAAQ,CAAC,EAAE,GAAG,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;;EAOrF"}
|