gt-react 10.0.0-alpha.22 → 10.0.0-alpha.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var e=require("react");require("generaltranslation");var r=require("react/jsx-runtime");const t=e=>`Duplicate key found in dictionary: "${e}"`;function n(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]])}return t}"function"==typeof SuppressedError&&SuppressedError;var a="en",i=["singular","plural","dual","zero","one","two","few","many","other"];var o=new(function(){function e(){this.cache=new Map}return e.prototype._generateKey=function(e,r,t){void 0===t&&(t={});var n=Array.isArray(r)?r.join(","):r,a=t?JSON.stringify(t,Object.keys(t).sort()):"{}";return"".concat(e,":").concat(n,":").concat(a)},e.prototype.get=function(e,r,t){void 0===t&&(t={});var n=this._generateKey(e,r,t);if(!this.cache.has(n)){var a=new Intl[e](r,t);this.cache.set(n,a)}return this.cache.get(n)},e}());function l(e){var r=e;if(r&&"object"==typeof r&&"string"==typeof r.k){var t=Object.keys(r);if(1===t.length)return!0;if(2===t.length){if("number"==typeof r.i)return!0;if("string"==typeof r.v)return!0}if(3===t.length&&"string"==typeof r.v&&"number"==typeof r.i)return!0}return!1}var s={variable:"v",number:"n",datetime:"d",currency:"c"};function c(e){return s[e]}const u={variable:"value",number:"n",datetime:"date",currency:"cost"};function p(e={},r){var t;if(e.name)return e.name;return`_gt_${u[r]||"value"}_${null===(t=e["data-_gt"])||void 0===t?void 0:t.id}`}var d={pl:"placeholder",ti:"title",alt:"alt",arl:"aria-label",arb:"aria-labelledby",ard:"aria-describedby"};const f=e=>{var r;if(!e)return"";const{type:t,props:n}=e;if(t&&"function"==typeof t){if("displayName"in t&&"string"==typeof t.displayName&&t.displayName)return t.displayName;if("name"in t&&"string"==typeof t.name&&t.name)return t.name}return t&&"string"==typeof t?t:n.href?"a":(null===(r=n["data-_gt"])||void 0===r?void 0:r.id)?`C${n["data-_gt"].id}`:"function"},b=r=>{return t=r,e.isValidElement(t)?(e=>{const{props:r}=e,t={t:f(e)};if(r["data-_gt"]){const e=r["data-_gt"],n=e.transformation;if("variable"===n){const t=c(e.variableType||"variable");return{v:t,k:p(r,t),i:e.id}}t.i=e.id;let a=Object.entries(d).reduce(((e,[t,n])=>(r[n]&&(a[t]=r[n]),e)),{});if("plural"===n&&e.branches){const r={};Object.entries(e.branches).forEach((([e,t])=>{r[e]=y(t)})),a=Object.assign(Object.assign({},a),{b:r,t:"p"})}if("branch"===n&&e.branches){const r={};Object.entries(e.branches).forEach((([e,t])=>{r[e]=y(t)})),a=Object.assign(Object.assign({},a),{b:r,t:"b"})}t.d=a}return r.children&&(t.c=y(r.children)),t})(r):"number"==typeof r?r.toString():r;var t};function y(e){return Array.isArray(e)?e.map(b):b(e)}function v(e,r,t){let n="",a=null;return"number"==typeof e&&!a&&t&&(n=function(e,r,t){void 0===r&&(r=i),void 0===t&&(t=["en"]);var n=o.get("PluralRules",t).select(e),a=Math.abs(e);if(0===a&&r.includes("zero"))return"zero";if(1===a){if(r.includes("singular"))return"singular";if(r.includes("one"))return"one"}if("one"===n&&r.includes("singular"))return"singular";if(2===a){if(r.includes("dual"))return"dual";if(r.includes("two"))return"two"}return"two"===n&&r.includes("dual")?"dual":r.includes(n)?n:"two"===n&&r.includes("dual")?"dual":"two"===n&&r.includes("plural")?"plural":"two"===n&&r.includes("other")?"other":"few"===n&&r.includes("plural")?"plural":"few"===n&&r.includes("other")?"other":"many"===n&&r.includes("plural")?"plural":"many"===n&&r.includes("other")?"other":"other"===n&&r.includes("plural")?"plural":""}(e,Object.keys(t),r)),n&&!a&&(a=t[n]),a}function h(e){var r;return"object"==typeof e&&!!e&&"data-_gt"in e&&"object"==typeof e["data-_gt"]&&!!e["data-_gt"]&&"transformation"in e["data-_gt"]&&"variable"===(null===(r=e["data-_gt"])||void 0===r?void 0:r.transformation)}function g(e){var r;const t=(null===(r=e["data-_gt"])||void 0===r?void 0:r.variableType)||"variable";return{variableName:p(e,t),variableType:c(t),variableValue:void 0!==e.value?e.value:void 0!==e["data-_gt-unformatted-value"]?e["data-_gt-unformatted-value"]:void 0!==e.children?e.children:void 0,variableOptions:(()=>{const r=Object.assign(Object.assign({},void 0!==e.currency&&{currency:e.currency}),void 0!==e.options&&{options:e.options});return Object.keys(r).length?r:"string"==typeof e["data-_gt-variable-options"]?JSON.parse(e["data-_gt-variable-options"]):e["data-_gt-variable-options"]||void 0})()}}function m(e){return e&&e.props&&e.props["data-_gt"]?e.props["data-_gt"]:null}function O({children:r,defaultLocale:t=a,renderVariable:i}){const o=r=>e.isValidElement(r)?(r=>{const a=m(r);if(h(r.props)){const{variableType:e,variableValue:n,variableOptions:a}=g(r.props);return i({variableType:e,variableValue:n,variableOptions:a,locales:[t]})}if("plural"===(null==a?void 0:a.transformation)){const e=a.branches||{};return l(v(r.props.n,[t],e)||r.props.children)}if("branch"===(null==a?void 0:a.transformation)){let e=r.props,{children:t,name:i,branch:o,"data-_gt":s}=e,c=n(e,["children","name","branch","data-_gt"]);return c=a.branches||{},l(void 0!==c[o]?c[o]:t)}return"fragment"===(null==a?void 0:a.transformation)?e.createElement(r.type,{key:r.props.key,children:l(r.props.children)}):r.props.children?e.cloneElement(r,Object.assign(Object.assign({},r.props),{"data-_gt":void 0,children:l(r.props.children)})):e.cloneElement(r,Object.assign(Object.assign({},r.props),{"data-_gt":void 0}))})(r):r,l=r=>Array.isArray(r)?e.Children.map(r,o):o(r);return l(r)}function j({sourceElement:r,targetElement:t,locales:n=[a],renderVariable:i}){var o,l;const{props:s}=r,{props:c}=t,u=s["data-_gt"],p=null==u?void 0:u.transformation,f=c.d,b={};if(f&&Object.entries(d).forEach((([e,r])=>{f[e]&&(b[r]=f[e])})),"plural"===p){const e=r.props.n;return _({source:v(e,n,u.branches||{})||r.props.children,target:v(e,n,t.props.d.b||{})||t.props.c,locales:n,renderVariable:i})}if("branch"===p){const{branch:e,children:r}=s;return _({source:(u.branches||{})[e]||r,target:(t.props.d.b||{})[e]||t.props.c,locales:n,renderVariable:i})}return"fragment"===p&&(null===(o=t.props)||void 0===o?void 0:o.c)?e.createElement(r.type,{key:r.props.key,children:_({source:s.children,target:t.props.c,locales:n,renderVariable:i})}):(null==s?void 0:s.children)&&(null===(l=t.props)||void 0===l?void 0:l.c)?e.cloneElement(r,Object.assign(Object.assign(Object.assign({},s),b),{"data-_gt":void 0,children:_({source:s.children,target:t.props.c,locales:n,renderVariable:i})})):O({children:r,defaultLocale:n[0],renderVariable:i})}function _({source:t,target:n,locales:i=[a],renderVariable:o}){if(null==n&&t)return O({children:t,defaultLocale:i[0],renderVariable:o});if("string"==typeof n)return n;if(Array.isArray(n)&&!Array.isArray(t)&&t&&(t=[t]),Array.isArray(t)&&Array.isArray(n)){const a={},s={},c=t.filter((r=>{if(e.isValidElement(r)){if(!h(r.props))return!0;{const{variableName:e,variableValue:t,variableOptions:n}=g(r.props);a[e]=t,s[e]=n}}return!1})),u=e=>c.find((r=>{const t=m(r);if(void 0!==(null==t?void 0:t.id)){return t.id===e.i}return!1}))||c.shift();return n.map(((t,n)=>{if("string"==typeof t)return r.jsx(e.Fragment,{children:t},`string_${n}`);if(l(t))return r.jsx(e.Fragment,{children:o({variableType:t.v||"v",variableValue:a[t.k],variableOptions:s[t.k],locales:i})},`var_${n}`);const c=u(t);return c?r.jsx(e.Fragment,{children:j({sourceElement:c,targetElement:t,locales:i,renderVariable:o})},`element_${n}`):void 0}))}if(n&&"object"==typeof n&&!Array.isArray(n)){const r=l(n)?"variable":"element";if(e.isValidElement(t)){if("element"===r)return j({sourceElement:t,targetElement:n,locales:i,renderVariable:o});if(h(t.props)){const{variableValue:e,variableOptions:r,variableType:n}=g(t.props);return o({variableType:n,variableValue:e,variableOptions:r,locales:i})}}}return O({children:t,defaultLocale:i[0],renderVariable:o})}const E={method:"default",timeout:"undefined"!=typeof process&&"development"!==process.env.NODE_ENV?8e3:12e3};const w=e=>"string"==typeof e||Array.isArray(e),A=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);exports.addGTIdentifier=function r(t,a=0){let o=a;const l=e=>{const{type:t,props:a}=e;o+=1;const l={id:o};let s;try{s="function"==typeof t&&t.gtTransformation||""}catch(e){}if(s){const t=s.split("-");if("translate"===t[0])throw new Error((e=>{var r;return`General Translation: Nested <T> components. The inner <T> has the id: "${null===(r=null==e?void 0:e.props)||void 0===r?void 0:r.id}".`})(e));if("variable"===t[0]&&(l.variableType=(null==t?void 0:t[1])||"variable"),"plural"===t[0]){const e=Object.entries(a).reduce(((e,[t,n])=>{var a;return a=t,i.includes(a)&&(e[t]=r(n,o)),e}),{});Object.keys(e).length&&(l.branches=e)}if("branch"===t[0]){const{children:e,branch:t}=a,i=n(a,["children","branch"]),s=Object.entries(i).reduce(((e,[t,n])=>(e[t]=r(n,o),e)),{});Object.keys(s).length&&(l.branches=s)}l.transformation=t[0]}return l};function s(r){return e.isValidElement(r)?function(r){const{props:t}=r;if(t["data-_gt"])throw new Error((e=>`General Translation already in use on child with props: ${e.props}. This usually occurs when you nest <T> components within the same file. Remove one of the <T> components to continue.`)(r));const n=l(r),a=Object.assign(Object.assign({},t),{"data-_gt":n});return t.children&&!n.variableType&&(a.children=c(t.children)),r.type===e.Fragment&&(a["data-_gt"].transformation="fragment"),e.cloneElement(r,a)}(r):r}function c(r){return Array.isArray(r)?e.Children.map(r,s):s(r)}return c(t)},exports.defaultLocaleCookieName="generaltranslation.locale",exports.defaultRenderSettings=E,exports.flattenDictionary=function e(r,n=""){const a={};for(const i in r)if(r.hasOwnProperty(i)){const o=n?`${n}.${i}`:i;if("object"!=typeof r[i]||null===r[i]||Array.isArray(r[i])){if(a.hasOwnProperty(o))throw new Error(t(o));a[o]=r[i]}else{const n=e(r[i],o);for(const e in n){if(a.hasOwnProperty(e))throw new Error(t(e));a[e]=n[e]}}}return a},exports.getDictionaryEntry=function(r,t){let n=r;const a=t.split(".");for(const r of a){if("object"!=typeof n||Array.isArray(n)||e.isValidElement(n))return;n=n[r]}return n},exports.getEntryAndMetadata=function(e){if(Array.isArray(e)){if(1===e.length)return{entry:e[0]};if(2===e.length)return{entry:e[0],metadata:e[1]}}return{entry:e}},exports.getPluralBranch=v,exports.getVariableName=p,exports.getVariableProps=g,exports.isValidDictionaryEntry=function(e){if("string"==typeof e)return!0;if(Array.isArray(e)){if("string"!=typeof(null==e?void 0:e[0]))return!1;const r=null==e?void 0:e[1];if(void 0===r)return!0;if(r&&"object"==typeof r)return!0}return!1},exports.isVariableObject=function(e){const r=e;if(r&&"object"==typeof r&&"string"==typeof r.k){const e=Object.keys(r);if(1===e.length)return!0;if(2===e.length){if("number"==typeof r.i)return!0;if("string"==typeof r.v)return!0}if(3===e.length&&"string"==typeof r.v&&"number"==typeof r.i)return!0}return!1},exports.mergeDictionaries=function e(r,t){const n=Object.assign(Object.assign({},Object.fromEntries(Object.entries(r).filter((([,e])=>w(e))))),Object.fromEntries(Object.entries(t).filter((([,e])=>w(e))))),a=Object.entries(r).filter((([,e])=>A(e))).map((([e])=>e)),i=Object.entries(t).filter((([,e])=>A(e))).map((([e])=>e)),o=new Set([...a,...i]);for(const a of o)n[a]=e(r[a]||{},t[a]||{});return n},exports.renderDefaultChildren=O,exports.renderSkeleton=function(){return""},exports.renderTranslatedChildren=_,exports.writeChildrenAsObjects=y;
1
+ "use strict";var e=require("react");require("generaltranslation");var r=require("react/jsx-runtime");const t=e=>`Duplicate key found in dictionary: "${e}"`;function n(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]])}return t}"function"==typeof SuppressedError&&SuppressedError;var a="en",i=["singular","plural","dual","zero","one","two","few","many","other"];var o=new(function(){function e(){this.cache=new Map}return e.prototype._generateKey=function(e,r,t){void 0===t&&(t={});var n=Array.isArray(r)?r.join(","):r,a=t?JSON.stringify(t,Object.keys(t).sort()):"{}";return"".concat(e,":").concat(n,":").concat(a)},e.prototype.get=function(e,r,t){void 0===t&&(t={});var n=this._generateKey(e,r,t);if(!this.cache.has(n)){var a=new Intl[e](r,t);this.cache.set(n,a)}return this.cache.get(n)},e}());function l(e){var r=e;if(r&&"object"==typeof r&&"string"==typeof r.k){var t=Object.keys(r);if(1===t.length)return!0;if(2===t.length){if("number"==typeof r.i)return!0;if("string"==typeof r.v)return!0}if(3===t.length&&"string"==typeof r.v&&"number"==typeof r.i)return!0}return!1}var s={variable:"v",number:"n",datetime:"d",currency:"c"};function c(e){return s[e]}const u={variable:"value",number:"n",datetime:"date",currency:"cost"};function d(e={},r){var t;if(e.name)return e.name;return`_gt_${u[r]||"value"}_${null===(t=e["data-_gt"])||void 0===t?void 0:t.id}`}var p={pl:"placeholder",ti:"title",alt:"alt",arl:"aria-label",arb:"aria-labelledby",ard:"aria-describedby"};const f=e=>{var r;if(!e)return"";const{type:t,props:n}=e;if(t&&"function"==typeof t){if("displayName"in t&&"string"==typeof t.displayName&&t.displayName)return t.displayName;if("name"in t&&"string"==typeof t.name&&t.name)return t.name}return t&&"string"==typeof t?t:n.href?"a":(null===(r=n["data-_gt"])||void 0===r?void 0:r.id)?`C${n["data-_gt"].id}`:"function"},b=e=>{const{props:r}=e;console.log("getTagName",f(e),JSON.stringify(e.type,null,2));const t={t:f(e)};if(r["data-_gt"]){const e=r["data-_gt"],n=e.transformation;if("variable"===n){const t=c(e.variableType||"variable");return{v:t,k:d(r,t),i:e.id}}t.i=e.id,t.d=((e,r,t)=>{let n=Object.entries(p).reduce(((e,[t,n])=>(r[n]&&(e[t]=r[n]),e)),{});if("plural"===e&&t){const e={};Object.entries(t).forEach((([r,t])=>{e[r]=g(t)})),n=Object.assign(Object.assign({},n),{b:e,t:"p"})}if("branch"===e&&t){const e={};Object.entries(t).forEach((([r,t])=>{e[r]=g(t)})),n=Object.assign(Object.assign({},n),{b:e,t:"b"})}return Object.keys(n).length?n:void 0})(n,r,e.branches);let a=Object.entries(p).reduce(((e,[t,n])=>(r[n]&&(e[t]=r[n]),e)),{});if("plural"===n&&e.branches){const r={};Object.entries(e.branches).forEach((([e,t])=>{r[e]=g(t)})),a=Object.assign(Object.assign({},a),{b:r,t:"p"})}if("branch"===n&&e.branches){const r={};Object.entries(e.branches).forEach((([e,t])=>{r[e]=g(t)})),a=Object.assign(Object.assign({},a),{b:r,t:"b"})}t.d=Object.keys(a).length?a:void 0}return r.children&&(t.c=g(r.children)),t},y=r=>{return t=r,e.isValidElement(t)?b(r):"number"==typeof r?r.toString():r;var t};function g(e){const r=Array.isArray(e)?e.map(y):y(e);return console.log("result",JSON.stringify(r,null,2)),r}function v(e,r,t){let n="",a=null;return"number"==typeof e&&!a&&t&&(n=function(e,r,t){void 0===r&&(r=i),void 0===t&&(t=["en"]);var n=o.get("PluralRules",t).select(e),a=Math.abs(e);if(0===a&&r.includes("zero"))return"zero";if(1===a){if(r.includes("singular"))return"singular";if(r.includes("one"))return"one"}if("one"===n&&r.includes("singular"))return"singular";if(2===a){if(r.includes("dual"))return"dual";if(r.includes("two"))return"two"}return"two"===n&&r.includes("dual")?"dual":r.includes(n)?n:"two"===n&&r.includes("dual")?"dual":"two"===n&&r.includes("plural")?"plural":"two"===n&&r.includes("other")?"other":"few"===n&&r.includes("plural")?"plural":"few"===n&&r.includes("other")?"other":"many"===n&&r.includes("plural")?"plural":"many"===n&&r.includes("other")?"other":"other"===n&&r.includes("plural")?"plural":""}(e,Object.keys(t),r)),n&&!a&&(a=t[n]),a}function h(e){var r;return"object"==typeof e&&!!e&&"data-_gt"in e&&"object"==typeof e["data-_gt"]&&!!e["data-_gt"]&&"transformation"in e["data-_gt"]&&"variable"===(null===(r=e["data-_gt"])||void 0===r?void 0:r.transformation)}function m(e){var r;const t=(null===(r=e["data-_gt"])||void 0===r?void 0:r.variableType)||"variable";return{variableName:d(e,t),variableType:c(t),variableValue:void 0!==e.value?e.value:void 0!==e["data-_gt-unformatted-value"]?e["data-_gt-unformatted-value"]:void 0!==e.children?e.children:void 0,variableOptions:(()=>{const r=Object.assign(Object.assign({},void 0!==e.currency&&{currency:e.currency}),void 0!==e.options&&{options:e.options});return Object.keys(r).length?r:"string"==typeof e["data-_gt-variable-options"]?JSON.parse(e["data-_gt-variable-options"]):e["data-_gt-variable-options"]||void 0})()}}function O(e){return e&&e.props&&e.props["data-_gt"]?e.props["data-_gt"]:null}function j({children:r,defaultLocale:t=a,renderVariable:i}){const o=r=>e.isValidElement(r)?(r=>{const a=O(r);if(h(r.props)){const{variableType:e,variableValue:n,variableOptions:a}=m(r.props);return i({variableType:e,variableValue:n,variableOptions:a,locales:[t]})}if("plural"===(null==a?void 0:a.transformation)){const e=a.branches||{};return l(v(r.props.n,[t],e)||r.props.children)}if("branch"===(null==a?void 0:a.transformation)){let e=r.props,{children:t,branch:i,"data-_gt":o}=e,s=n(e,["children","branch","data-_gt"]);return s=a.branches||{},l(void 0!==s[i]?s[i]:t)}return"fragment"===(null==a?void 0:a.transformation)?e.createElement(r.type,{key:r.props.key,children:l(r.props.children)}):r.props.children?e.cloneElement(r,Object.assign(Object.assign({},r.props),{"data-_gt":void 0,children:l(r.props.children)})):e.cloneElement(r,Object.assign(Object.assign({},r.props),{"data-_gt":void 0}))})(r):r,l=r=>Array.isArray(r)?e.Children.map(r,o):o(r);return l(r)}function E({sourceElement:r,targetElement:t,locales:n=[a],renderVariable:i}){var o,l;const{props:s}=r,c=s["data-_gt"],u=null==c?void 0:c.transformation,d=t.d,f={};if(d&&Object.entries(p).forEach((([e,r])=>{d[e]&&(f[r]=d[e])})),"plural"===u){const e=r.props.n;return _({source:v(e,n,c.branches||{})||r.props.children,target:v(e,n,(null===(o=t.d)||void 0===o?void 0:o.b)||{})||t.c,locales:n,renderVariable:i})}if("branch"===u){const{branch:e,children:r}=s;return _({source:(c.branches||{})[e]||r,target:((null===(l=t.d)||void 0===l?void 0:l.b)||{})[e]||t.c,locales:n,renderVariable:i})}return"fragment"===u&&t.c?e.createElement(r.type,{key:r.props.key,children:_({source:s.children,target:t.c,locales:n,renderVariable:i})}):(null==s?void 0:s.children)&&(null==t?void 0:t.c)?e.cloneElement(r,Object.assign(Object.assign(Object.assign({},s),f),{"data-_gt":void 0,children:_({source:s.children,target:t.c,locales:n,renderVariable:i})})):j({children:r,defaultLocale:n[0],renderVariable:i})}function _({source:t,target:n,locales:i=[a],renderVariable:o}){if(null==n&&t)return j({children:t,defaultLocale:i[0],renderVariable:o});if("string"==typeof n)return n;if(Array.isArray(n)&&!Array.isArray(t)&&t&&(t=[t]),Array.isArray(t)&&Array.isArray(n)){const a={},s={},c=t.filter((r=>{if(e.isValidElement(r)){if(!h(r.props))return!0;{const{variableName:e,variableValue:t,variableOptions:n}=m(r.props);a[e]=t,s[e]=n}}return!1})),u=e=>c.find((r=>{const t=O(r);if(void 0!==(null==t?void 0:t.id)){return t.id===e.i}return!1}))||c.shift();return n.map(((t,n)=>{if("string"==typeof t)return r.jsx(e.Fragment,{children:t},`string_${n}`);if(l(t))return r.jsx(e.Fragment,{children:o({variableType:t.v||"v",variableValue:a[t.k],variableOptions:s[t.k],locales:i})},`var_${n}`);const c=u(t);return c?r.jsx(e.Fragment,{children:E({sourceElement:c,targetElement:t,locales:i,renderVariable:o})},`element_${n}`):void 0}))}if(n&&"object"==typeof n&&!Array.isArray(n)){const r=l(n)?"variable":"element";if(e.isValidElement(t)){if("element"===r)return E({sourceElement:t,targetElement:n,locales:i,renderVariable:o});if(h(t.props)){const{variableValue:e,variableOptions:r,variableType:n}=m(t.props);return o({variableType:n,variableValue:e,variableOptions:r,locales:i})}}}return j({children:t,defaultLocale:i[0],renderVariable:o})}const w={method:"default",timeout:"undefined"!=typeof process&&"development"!==process.env.NODE_ENV?8e3:12e3};const A=e=>"string"==typeof e||Array.isArray(e),V=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);exports.addGTIdentifier=function r(t,a=0){let o=a;const l=e=>{const{type:t,props:a}=e;o+=1;const l={id:o};let s;try{s="function"==typeof t&&t.gtTransformation||""}catch(e){}if(s){const t=s.split("-");if("translate"===t[0])throw new Error((e=>{var r;return`General Translation: Nested <T> components. The inner <T> has the id: "${null===(r=null==e?void 0:e.props)||void 0===r?void 0:r.id}".`})(e));if("variable"===t[0]&&(l.variableType=(null==t?void 0:t[1])||"variable"),"plural"===t[0]){const e=Object.entries(a).reduce(((e,[t,n])=>{var a;return a=t,i.includes(a)&&(e[t]=r(n,o)),e}),{});Object.keys(e).length&&(l.branches=e)}if("branch"===t[0]){const{children:e,branch:t}=a,i=n(a,["children","branch"]),s=Object.entries(i).reduce(((e,[t,n])=>(e[t]=r(n,o),e)),{});Object.keys(s).length&&(l.branches=s)}l.transformation=t[0]}return l};function s(r){return e.isValidElement(r)?function(r){const{props:t}=r;if(t["data-_gt"])throw new Error((e=>`General Translation already in use on child with props: ${e.props}. This usually occurs when you nest <T> components within the same file. Remove one of the <T> components to continue.`)(r));const n=l(r),a=Object.assign(Object.assign({},t),{"data-_gt":n});return t.children&&!n.variableType&&(a.children=c(t.children)),r.type===e.Fragment&&(a["data-_gt"].transformation="fragment"),e.cloneElement(r,a)}(r):r}function c(r){return Array.isArray(r)?e.Children.map(r,s):s(r)}return c(t)},exports.defaultLocaleCookieName="generaltranslation.locale",exports.defaultRenderSettings=w,exports.flattenDictionary=function e(r,n=""){const a={};for(const i in r)if(r.hasOwnProperty(i)){const o=n?`${n}.${i}`:i;if("object"!=typeof r[i]||null===r[i]||Array.isArray(r[i])){if(a.hasOwnProperty(o))throw new Error(t(o));a[o]=r[i]}else{const n=e(r[i],o);for(const e in n){if(a.hasOwnProperty(e))throw new Error(t(e));a[e]=n[e]}}}return a},exports.getDictionaryEntry=function(r,t){let n=r;const a=t.split(".");for(const r of a){if("object"!=typeof n||Array.isArray(n)||e.isValidElement(n))return;n=n[r]}return n},exports.getEntryAndMetadata=function(e){if(Array.isArray(e)){if(1===e.length)return{entry:e[0]};if(2===e.length)return{entry:e[0],metadata:e[1]}}return{entry:e}},exports.getPluralBranch=v,exports.getVariableName=d,exports.getVariableProps=m,exports.isValidDictionaryEntry=function(e){if("string"==typeof e)return!0;if(Array.isArray(e)){if("string"!=typeof(null==e?void 0:e[0]))return!1;const r=null==e?void 0:e[1];if(void 0===r)return!0;if(r&&"object"==typeof r)return!0}return!1},exports.isVariableObject=function(e){const r=e;if(r&&"object"==typeof r&&"string"==typeof r.k){const e=Object.keys(r);if(1===e.length)return!0;if(2===e.length){if("number"==typeof r.i)return!0;if("string"==typeof r.v)return!0}if(3===e.length&&"string"==typeof r.v&&"number"==typeof r.i)return!0}return!1},exports.mergeDictionaries=function e(r,t){const n=Object.assign(Object.assign({},Object.fromEntries(Object.entries(r).filter((([,e])=>A(e))))),Object.fromEntries(Object.entries(t).filter((([,e])=>A(e))))),a=Object.entries(r).filter((([,e])=>V(e))).map((([e])=>e)),i=Object.entries(t).filter((([,e])=>V(e))).map((([e])=>e)),o=new Set([...a,...i]);for(const a of o)n[a]=e(r[a]||{},t[a]||{});return n},exports.renderDefaultChildren=j,exports.renderSkeleton=function(){return""},exports.renderTranslatedChildren=_,exports.writeChildrenAsObjects=g;
@@ -1 +1 @@
1
- import e,{isValidElement as r}from"react";import"generaltranslation";import{jsx as t}from"react/jsx-runtime";const n=e=>`Duplicate key found in dictionary: "${e}"`;function a(e,r=""){const t={};for(const i in e)if(e.hasOwnProperty(i)){const o=r?`${r}.${i}`:i;if("object"!=typeof e[i]||null===e[i]||Array.isArray(e[i])){if(t.hasOwnProperty(o))throw new Error(n(o));t[o]=e[i]}else{const r=a(e[i],o);for(const e in r){if(t.hasOwnProperty(e))throw new Error(n(e));t[e]=r[e]}}}return t}function i(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]])}return t}"function"==typeof SuppressedError&&SuppressedError;var o="en",l=["singular","plural","dual","zero","one","two","few","many","other"];var s=new(function(){function e(){this.cache=new Map}return e.prototype._generateKey=function(e,r,t){void 0===t&&(t={});var n=Array.isArray(r)?r.join(","):r,a=t?JSON.stringify(t,Object.keys(t).sort()):"{}";return"".concat(e,":").concat(n,":").concat(a)},e.prototype.get=function(e,r,t){void 0===t&&(t={});var n=this._generateKey(e,r,t);if(!this.cache.has(n)){var a=new Intl[e](r,t);this.cache.set(n,a)}return this.cache.get(n)},e}());function c(e){var r=e;if(r&&"object"==typeof r&&"string"==typeof r.k){var t=Object.keys(r);if(1===t.length)return!0;if(2===t.length){if("number"==typeof r.i)return!0;if("string"==typeof r.v)return!0}if(3===t.length&&"string"==typeof r.v&&"number"==typeof r.i)return!0}return!1}var u={variable:"v",number:"n",datetime:"d",currency:"c"};function p(e){return u[e]}function d(t,n=0){let a=n;const o=e=>{const{type:r,props:t}=e;a+=1;const n={id:a};let o;try{o="function"==typeof r&&r.gtTransformation||""}catch(e){}if(o){const r=o.split("-");if("translate"===r[0])throw new Error((e=>{var r;return`General Translation: Nested <T> components. The inner <T> has the id: "${null===(r=null==e?void 0:e.props)||void 0===r?void 0:r.id}".`})(e));if("variable"===r[0]&&(n.variableType=(null==r?void 0:r[1])||"variable"),"plural"===r[0]){const e=Object.entries(t).reduce(((e,[r,t])=>{var n;return n=r,l.includes(n)&&(e[r]=d(t,a)),e}),{});Object.keys(e).length&&(n.branches=e)}if("branch"===r[0]){const{children:e,branch:r}=t,o=i(t,["children","branch"]),l=Object.entries(o).reduce(((e,[r,t])=>(e[r]=d(t,a),e)),{});Object.keys(l).length&&(n.branches=l)}n.transformation=r[0]}return n};function s(t){return r(t)?function(r){const{props:t}=r;if(t["data-_gt"])throw new Error((e=>`General Translation already in use on child with props: ${e.props}. This usually occurs when you nest <T> components within the same file. Remove one of the <T> components to continue.`)(r));const n=o(r),a=Object.assign(Object.assign({},t),{"data-_gt":n});return t.children&&!n.variableType&&(a.children=c(t.children)),r.type===e.Fragment&&(a["data-_gt"].transformation="fragment"),e.cloneElement(r,a)}(t):t}function c(r){return Array.isArray(r)?e.Children.map(r,s):s(r)}return c(t)}const f={variable:"value",number:"n",datetime:"date",currency:"cost"};function b(e={},r){var t;if(e.name)return e.name;return`_gt_${f[r]||"value"}_${null===(t=e["data-_gt"])||void 0===t?void 0:t.id}`}var y={pl:"placeholder",ti:"title",alt:"alt",arl:"aria-label",arb:"aria-labelledby",ard:"aria-describedby"};const v=e=>{var r;if(!e)return"";const{type:t,props:n}=e;if(t&&"function"==typeof t){if("displayName"in t&&"string"==typeof t.displayName&&t.displayName)return t.displayName;if("name"in t&&"string"==typeof t.name&&t.name)return t.name}return t&&"string"==typeof t?t:n.href?"a":(null===(r=n["data-_gt"])||void 0===r?void 0:r.id)?`C${n["data-_gt"].id}`:"function"},h=r=>{return t=r,e.isValidElement(t)?(e=>{const{props:r}=e,t={t:v(e)};if(r["data-_gt"]){const e=r["data-_gt"],n=e.transformation;if("variable"===n){const t=p(e.variableType||"variable");return{v:t,k:b(r,t),i:e.id}}t.i=e.id;let a=Object.entries(y).reduce(((e,[t,n])=>(r[n]&&(a[t]=r[n]),e)),{});if("plural"===n&&e.branches){const r={};Object.entries(e.branches).forEach((([e,t])=>{r[e]=g(t)})),a=Object.assign(Object.assign({},a),{b:r,t:"p"})}if("branch"===n&&e.branches){const r={};Object.entries(e.branches).forEach((([e,t])=>{r[e]=g(t)})),a=Object.assign(Object.assign({},a),{b:r,t:"b"})}t.d=a}return r.children&&(t.c=g(r.children)),t})(r):"number"==typeof r?r.toString():r;var t};function g(e){return Array.isArray(e)?e.map(h):h(e)}function m(e,r,t){let n="",a=null;return"number"==typeof e&&!a&&t&&(n=function(e,r,t){void 0===r&&(r=l),void 0===t&&(t=["en"]);var n=s.get("PluralRules",t).select(e),a=Math.abs(e);if(0===a&&r.includes("zero"))return"zero";if(1===a){if(r.includes("singular"))return"singular";if(r.includes("one"))return"one"}if("one"===n&&r.includes("singular"))return"singular";if(2===a){if(r.includes("dual"))return"dual";if(r.includes("two"))return"two"}return"two"===n&&r.includes("dual")?"dual":r.includes(n)?n:"two"===n&&r.includes("dual")?"dual":"two"===n&&r.includes("plural")?"plural":"two"===n&&r.includes("other")?"other":"few"===n&&r.includes("plural")?"plural":"few"===n&&r.includes("other")?"other":"many"===n&&r.includes("plural")?"plural":"many"===n&&r.includes("other")?"other":"other"===n&&r.includes("plural")?"plural":""}(e,Object.keys(t),r)),n&&!a&&(a=t[n]),a}function O(e){if("string"==typeof e)return!0;if(Array.isArray(e)){if("string"!=typeof(null==e?void 0:e[0]))return!1;const r=null==e?void 0:e[1];if(void 0===r)return!0;if(r&&"object"==typeof r)return!0}return!1}function j(r,t){let n=r;const a=t.split(".");for(const r of a){if("object"!=typeof n||Array.isArray(n)||e.isValidElement(n))return;n=n[r]}return n}function _(e){if(Array.isArray(e)){if(1===e.length)return{entry:e[0]};if(2===e.length)return{entry:e[0],metadata:e[1]}}return{entry:e}}function w(e){var r;return"object"==typeof e&&!!e&&"data-_gt"in e&&"object"==typeof e["data-_gt"]&&!!e["data-_gt"]&&"transformation"in e["data-_gt"]&&"variable"===(null===(r=e["data-_gt"])||void 0===r?void 0:r.transformation)}function E(e){var r;const t=(null===(r=e["data-_gt"])||void 0===r?void 0:r.variableType)||"variable";return{variableName:b(e,t),variableType:p(t),variableValue:void 0!==e.value?e.value:void 0!==e["data-_gt-unformatted-value"]?e["data-_gt-unformatted-value"]:void 0!==e.children?e.children:void 0,variableOptions:(()=>{const r=Object.assign(Object.assign({},void 0!==e.currency&&{currency:e.currency}),void 0!==e.options&&{options:e.options});return Object.keys(r).length?r:"string"==typeof e["data-_gt-variable-options"]?JSON.parse(e["data-_gt-variable-options"]):e["data-_gt-variable-options"]||void 0})()}}function A(e){const r=e;if(r&&"object"==typeof r&&"string"==typeof r.k){const e=Object.keys(r);if(1===e.length)return!0;if(2===e.length){if("number"==typeof r.i)return!0;if("string"==typeof r.v)return!0}if(3===e.length&&"string"==typeof r.v&&"number"==typeof r.i)return!0}return!1}function V(e){return e&&e.props&&e.props["data-_gt"]?e.props["data-_gt"]:null}function T({children:r,defaultLocale:t=o,renderVariable:n}){const a=r=>e.isValidElement(r)?(r=>{const a=V(r);if(w(r.props)){const{variableType:e,variableValue:a,variableOptions:i}=E(r.props);return n({variableType:e,variableValue:a,variableOptions:i,locales:[t]})}if("plural"===(null==a?void 0:a.transformation)){const e=a.branches||{};return l(m(r.props.n,[t],e)||r.props.children)}if("branch"===(null==a?void 0:a.transformation)){let e=r.props,{children:t,name:n,branch:o,"data-_gt":s}=e,c=i(e,["children","name","branch","data-_gt"]);return c=a.branches||{},l(void 0!==c[o]?c[o]:t)}return"fragment"===(null==a?void 0:a.transformation)?e.createElement(r.type,{key:r.props.key,children:l(r.props.children)}):r.props.children?e.cloneElement(r,Object.assign(Object.assign({},r.props),{"data-_gt":void 0,children:l(r.props.children)})):e.cloneElement(r,Object.assign(Object.assign({},r.props),{"data-_gt":void 0}))})(r):r,l=r=>Array.isArray(r)?e.Children.map(r,a):a(r);return l(r)}function k({sourceElement:r,targetElement:t,locales:n=[o],renderVariable:a}){var i,l;const{props:s}=r,{props:c}=t,u=s["data-_gt"],p=null==u?void 0:u.transformation,d=c.d,f={};if(d&&Object.entries(y).forEach((([e,r])=>{d[e]&&(f[r]=d[e])})),"plural"===p){const e=r.props.n;return N({source:m(e,n,u.branches||{})||r.props.children,target:m(e,n,t.props.d.b||{})||t.props.c,locales:n,renderVariable:a})}if("branch"===p){const{branch:e,children:r}=s;return N({source:(u.branches||{})[e]||r,target:(t.props.d.b||{})[e]||t.props.c,locales:n,renderVariable:a})}return"fragment"===p&&(null===(i=t.props)||void 0===i?void 0:i.c)?e.createElement(r.type,{key:r.props.key,children:N({source:s.children,target:t.props.c,locales:n,renderVariable:a})}):(null==s?void 0:s.children)&&(null===(l=t.props)||void 0===l?void 0:l.c)?e.cloneElement(r,Object.assign(Object.assign(Object.assign({},s),f),{"data-_gt":void 0,children:N({source:s.children,target:t.props.c,locales:n,renderVariable:a})})):T({children:r,defaultLocale:n[0],renderVariable:a})}function N({source:r,target:n,locales:a=[o],renderVariable:i}){if(null==n&&r)return T({children:r,defaultLocale:a[0],renderVariable:i});if("string"==typeof n)return n;if(Array.isArray(n)&&!Array.isArray(r)&&r&&(r=[r]),Array.isArray(r)&&Array.isArray(n)){const o={},l={},s=r.filter((r=>{if(e.isValidElement(r)){if(!w(r.props))return!0;{const{variableName:e,variableValue:t,variableOptions:n}=E(r.props);o[e]=t,l[e]=n}}return!1})),u=e=>s.find((r=>{const t=V(r);if(void 0!==(null==t?void 0:t.id)){return t.id===e.i}return!1}))||s.shift();return n.map(((r,n)=>{if("string"==typeof r)return t(e.Fragment,{children:r},`string_${n}`);if(c(r))return t(e.Fragment,{children:i({variableType:r.v||"v",variableValue:o[r.k],variableOptions:l[r.k],locales:a})},`var_${n}`);const s=u(r);return s?t(e.Fragment,{children:k({sourceElement:s,targetElement:r,locales:a,renderVariable:i})},`element_${n}`):void 0}))}if(n&&"object"==typeof n&&!Array.isArray(n)){const t=c(n)?"variable":"element";if(e.isValidElement(r)){if("element"===t)return k({sourceElement:r,targetElement:n,locales:a,renderVariable:i});if(w(r.props)){const{variableValue:e,variableOptions:t,variableType:n}=E(r.props);return i({variableType:n,variableValue:e,variableOptions:t,locales:a})}}}return T({children:r,defaultLocale:a[0],renderVariable:i})}const $={method:"default",timeout:"undefined"!=typeof process&&"development"!==process.env.NODE_ENV?8e3:12e3};function S(){return""}const P="generaltranslation.locale",x=e=>"string"==typeof e||Array.isArray(e),F=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);function L(e,r){const t=Object.assign(Object.assign({},Object.fromEntries(Object.entries(e).filter((([,e])=>x(e))))),Object.fromEntries(Object.entries(r).filter((([,e])=>x(e))))),n=Object.entries(e).filter((([,e])=>F(e))).map((([e])=>e)),a=Object.entries(r).filter((([,e])=>F(e))).map((([e])=>e)),i=new Set([...n,...a]);for(const n of i)t[n]=L(e[n]||{},r[n]||{});return t}export{d as addGTIdentifier,P as defaultLocaleCookieName,$ as defaultRenderSettings,a as flattenDictionary,j as getDictionaryEntry,_ as getEntryAndMetadata,m as getPluralBranch,b as getVariableName,E as getVariableProps,O as isValidDictionaryEntry,A as isVariableObject,L as mergeDictionaries,T as renderDefaultChildren,S as renderSkeleton,N as renderTranslatedChildren,g as writeChildrenAsObjects};
1
+ import e,{isValidElement as r}from"react";import"generaltranslation";import{jsx as t}from"react/jsx-runtime";const n=e=>`Duplicate key found in dictionary: "${e}"`;function a(e,r=""){const t={};for(const i in e)if(e.hasOwnProperty(i)){const o=r?`${r}.${i}`:i;if("object"!=typeof e[i]||null===e[i]||Array.isArray(e[i])){if(t.hasOwnProperty(o))throw new Error(n(o));t[o]=e[i]}else{const r=a(e[i],o);for(const e in r){if(t.hasOwnProperty(e))throw new Error(n(e));t[e]=r[e]}}}return t}function i(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]])}return t}"function"==typeof SuppressedError&&SuppressedError;var o="en",l=["singular","plural","dual","zero","one","two","few","many","other"];var s=new(function(){function e(){this.cache=new Map}return e.prototype._generateKey=function(e,r,t){void 0===t&&(t={});var n=Array.isArray(r)?r.join(","):r,a=t?JSON.stringify(t,Object.keys(t).sort()):"{}";return"".concat(e,":").concat(n,":").concat(a)},e.prototype.get=function(e,r,t){void 0===t&&(t={});var n=this._generateKey(e,r,t);if(!this.cache.has(n)){var a=new Intl[e](r,t);this.cache.set(n,a)}return this.cache.get(n)},e}());function c(e){var r=e;if(r&&"object"==typeof r&&"string"==typeof r.k){var t=Object.keys(r);if(1===t.length)return!0;if(2===t.length){if("number"==typeof r.i)return!0;if("string"==typeof r.v)return!0}if(3===t.length&&"string"==typeof r.v&&"number"==typeof r.i)return!0}return!1}var u={variable:"v",number:"n",datetime:"d",currency:"c"};function d(e){return u[e]}function f(t,n=0){let a=n;const o=e=>{const{type:r,props:t}=e;a+=1;const n={id:a};let o;try{o="function"==typeof r&&r.gtTransformation||""}catch(e){}if(o){const r=o.split("-");if("translate"===r[0])throw new Error((e=>{var r;return`General Translation: Nested <T> components. The inner <T> has the id: "${null===(r=null==e?void 0:e.props)||void 0===r?void 0:r.id}".`})(e));if("variable"===r[0]&&(n.variableType=(null==r?void 0:r[1])||"variable"),"plural"===r[0]){const e=Object.entries(t).reduce(((e,[r,t])=>{var n;return n=r,l.includes(n)&&(e[r]=f(t,a)),e}),{});Object.keys(e).length&&(n.branches=e)}if("branch"===r[0]){const{children:e,branch:r}=t,o=i(t,["children","branch"]),l=Object.entries(o).reduce(((e,[r,t])=>(e[r]=f(t,a),e)),{});Object.keys(l).length&&(n.branches=l)}n.transformation=r[0]}return n};function s(t){return r(t)?function(r){const{props:t}=r;if(t["data-_gt"])throw new Error((e=>`General Translation already in use on child with props: ${e.props}. This usually occurs when you nest <T> components within the same file. Remove one of the <T> components to continue.`)(r));const n=o(r),a=Object.assign(Object.assign({},t),{"data-_gt":n});return t.children&&!n.variableType&&(a.children=c(t.children)),r.type===e.Fragment&&(a["data-_gt"].transformation="fragment"),e.cloneElement(r,a)}(t):t}function c(r){return Array.isArray(r)?e.Children.map(r,s):s(r)}return c(t)}const p={variable:"value",number:"n",datetime:"date",currency:"cost"};function b(e={},r){var t;if(e.name)return e.name;return`_gt_${p[r]||"value"}_${null===(t=e["data-_gt"])||void 0===t?void 0:t.id}`}var y={pl:"placeholder",ti:"title",alt:"alt",arl:"aria-label",arb:"aria-labelledby",ard:"aria-describedby"};const v=e=>{var r;if(!e)return"";const{type:t,props:n}=e;if(t&&"function"==typeof t){if("displayName"in t&&"string"==typeof t.displayName&&t.displayName)return t.displayName;if("name"in t&&"string"==typeof t.name&&t.name)return t.name}return t&&"string"==typeof t?t:n.href?"a":(null===(r=n["data-_gt"])||void 0===r?void 0:r.id)?`C${n["data-_gt"].id}`:"function"},g=e=>{const{props:r}=e;console.log("getTagName",v(e),JSON.stringify(e.type,null,2));const t={t:v(e)};if(r["data-_gt"]){const e=r["data-_gt"],n=e.transformation;if("variable"===n){const t=d(e.variableType||"variable");return{v:t,k:b(r,t),i:e.id}}t.i=e.id,t.d=((e,r,t)=>{let n=Object.entries(y).reduce(((e,[t,n])=>(r[n]&&(e[t]=r[n]),e)),{});if("plural"===e&&t){const e={};Object.entries(t).forEach((([r,t])=>{e[r]=m(t)})),n=Object.assign(Object.assign({},n),{b:e,t:"p"})}if("branch"===e&&t){const e={};Object.entries(t).forEach((([r,t])=>{e[r]=m(t)})),n=Object.assign(Object.assign({},n),{b:e,t:"b"})}return Object.keys(n).length?n:void 0})(n,r,e.branches);let a=Object.entries(y).reduce(((e,[t,n])=>(r[n]&&(e[t]=r[n]),e)),{});if("plural"===n&&e.branches){const r={};Object.entries(e.branches).forEach((([e,t])=>{r[e]=m(t)})),a=Object.assign(Object.assign({},a),{b:r,t:"p"})}if("branch"===n&&e.branches){const r={};Object.entries(e.branches).forEach((([e,t])=>{r[e]=m(t)})),a=Object.assign(Object.assign({},a),{b:r,t:"b"})}t.d=Object.keys(a).length?a:void 0}return r.children&&(t.c=m(r.children)),t},h=r=>{return t=r,e.isValidElement(t)?g(r):"number"==typeof r?r.toString():r;var t};function m(e){const r=Array.isArray(e)?e.map(h):h(e);return console.log("result",JSON.stringify(r,null,2)),r}function O(e,r,t){let n="",a=null;return"number"==typeof e&&!a&&t&&(n=function(e,r,t){void 0===r&&(r=l),void 0===t&&(t=["en"]);var n=s.get("PluralRules",t).select(e),a=Math.abs(e);if(0===a&&r.includes("zero"))return"zero";if(1===a){if(r.includes("singular"))return"singular";if(r.includes("one"))return"one"}if("one"===n&&r.includes("singular"))return"singular";if(2===a){if(r.includes("dual"))return"dual";if(r.includes("two"))return"two"}return"two"===n&&r.includes("dual")?"dual":r.includes(n)?n:"two"===n&&r.includes("dual")?"dual":"two"===n&&r.includes("plural")?"plural":"two"===n&&r.includes("other")?"other":"few"===n&&r.includes("plural")?"plural":"few"===n&&r.includes("other")?"other":"many"===n&&r.includes("plural")?"plural":"many"===n&&r.includes("other")?"other":"other"===n&&r.includes("plural")?"plural":""}(e,Object.keys(t),r)),n&&!a&&(a=t[n]),a}function j(e){if("string"==typeof e)return!0;if(Array.isArray(e)){if("string"!=typeof(null==e?void 0:e[0]))return!1;const r=null==e?void 0:e[1];if(void 0===r)return!0;if(r&&"object"==typeof r)return!0}return!1}function _(r,t){let n=r;const a=t.split(".");for(const r of a){if("object"!=typeof n||Array.isArray(n)||e.isValidElement(n))return;n=n[r]}return n}function E(e){if(Array.isArray(e)){if(1===e.length)return{entry:e[0]};if(2===e.length)return{entry:e[0],metadata:e[1]}}return{entry:e}}function w(e){var r;return"object"==typeof e&&!!e&&"data-_gt"in e&&"object"==typeof e["data-_gt"]&&!!e["data-_gt"]&&"transformation"in e["data-_gt"]&&"variable"===(null===(r=e["data-_gt"])||void 0===r?void 0:r.transformation)}function A(e){var r;const t=(null===(r=e["data-_gt"])||void 0===r?void 0:r.variableType)||"variable";return{variableName:b(e,t),variableType:d(t),variableValue:void 0!==e.value?e.value:void 0!==e["data-_gt-unformatted-value"]?e["data-_gt-unformatted-value"]:void 0!==e.children?e.children:void 0,variableOptions:(()=>{const r=Object.assign(Object.assign({},void 0!==e.currency&&{currency:e.currency}),void 0!==e.options&&{options:e.options});return Object.keys(r).length?r:"string"==typeof e["data-_gt-variable-options"]?JSON.parse(e["data-_gt-variable-options"]):e["data-_gt-variable-options"]||void 0})()}}function V(e){const r=e;if(r&&"object"==typeof r&&"string"==typeof r.k){const e=Object.keys(r);if(1===e.length)return!0;if(2===e.length){if("number"==typeof r.i)return!0;if("string"==typeof r.v)return!0}if(3===e.length&&"string"==typeof r.v&&"number"==typeof r.i)return!0}return!1}function T(e){return e&&e.props&&e.props["data-_gt"]?e.props["data-_gt"]:null}function k({children:r,defaultLocale:t=o,renderVariable:n}){const a=r=>e.isValidElement(r)?(r=>{const a=T(r);if(w(r.props)){const{variableType:e,variableValue:a,variableOptions:i}=A(r.props);return n({variableType:e,variableValue:a,variableOptions:i,locales:[t]})}if("plural"===(null==a?void 0:a.transformation)){const e=a.branches||{};return l(O(r.props.n,[t],e)||r.props.children)}if("branch"===(null==a?void 0:a.transformation)){let e=r.props,{children:t,branch:n,"data-_gt":o}=e,s=i(e,["children","branch","data-_gt"]);return s=a.branches||{},l(void 0!==s[n]?s[n]:t)}return"fragment"===(null==a?void 0:a.transformation)?e.createElement(r.type,{key:r.props.key,children:l(r.props.children)}):r.props.children?e.cloneElement(r,Object.assign(Object.assign({},r.props),{"data-_gt":void 0,children:l(r.props.children)})):e.cloneElement(r,Object.assign(Object.assign({},r.props),{"data-_gt":void 0}))})(r):r,l=r=>Array.isArray(r)?e.Children.map(r,a):a(r);return l(r)}function N({sourceElement:r,targetElement:t,locales:n=[o],renderVariable:a}){var i,l;const{props:s}=r,c=s["data-_gt"],u=null==c?void 0:c.transformation,d=t.d,f={};if(d&&Object.entries(y).forEach((([e,r])=>{d[e]&&(f[r]=d[e])})),"plural"===u){const e=r.props.n;return $({source:O(e,n,c.branches||{})||r.props.children,target:O(e,n,(null===(i=t.d)||void 0===i?void 0:i.b)||{})||t.c,locales:n,renderVariable:a})}if("branch"===u){const{branch:e,children:r}=s;return $({source:(c.branches||{})[e]||r,target:((null===(l=t.d)||void 0===l?void 0:l.b)||{})[e]||t.c,locales:n,renderVariable:a})}return"fragment"===u&&t.c?e.createElement(r.type,{key:r.props.key,children:$({source:s.children,target:t.c,locales:n,renderVariable:a})}):(null==s?void 0:s.children)&&(null==t?void 0:t.c)?e.cloneElement(r,Object.assign(Object.assign(Object.assign({},s),f),{"data-_gt":void 0,children:$({source:s.children,target:t.c,locales:n,renderVariable:a})})):k({children:r,defaultLocale:n[0],renderVariable:a})}function $({source:r,target:n,locales:a=[o],renderVariable:i}){if(null==n&&r)return k({children:r,defaultLocale:a[0],renderVariable:i});if("string"==typeof n)return n;if(Array.isArray(n)&&!Array.isArray(r)&&r&&(r=[r]),Array.isArray(r)&&Array.isArray(n)){const o={},l={},s=r.filter((r=>{if(e.isValidElement(r)){if(!w(r.props))return!0;{const{variableName:e,variableValue:t,variableOptions:n}=A(r.props);o[e]=t,l[e]=n}}return!1})),u=e=>s.find((r=>{const t=T(r);if(void 0!==(null==t?void 0:t.id)){return t.id===e.i}return!1}))||s.shift();return n.map(((r,n)=>{if("string"==typeof r)return t(e.Fragment,{children:r},`string_${n}`);if(c(r))return t(e.Fragment,{children:i({variableType:r.v||"v",variableValue:o[r.k],variableOptions:l[r.k],locales:a})},`var_${n}`);const s=u(r);return s?t(e.Fragment,{children:N({sourceElement:s,targetElement:r,locales:a,renderVariable:i})},`element_${n}`):void 0}))}if(n&&"object"==typeof n&&!Array.isArray(n)){const t=c(n)?"variable":"element";if(e.isValidElement(r)){if("element"===t)return N({sourceElement:r,targetElement:n,locales:a,renderVariable:i});if(w(r.props)){const{variableValue:e,variableOptions:t,variableType:n}=A(r.props);return i({variableType:n,variableValue:e,variableOptions:t,locales:a})}}}return k({children:r,defaultLocale:a[0],renderVariable:i})}const S={method:"default",timeout:"undefined"!=typeof process&&"development"!==process.env.NODE_ENV?8e3:12e3};function P(){return""}const x="generaltranslation.locale",F=e=>"string"==typeof e||Array.isArray(e),J=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);function L(e,r){const t=Object.assign(Object.assign({},Object.fromEntries(Object.entries(e).filter((([,e])=>F(e))))),Object.fromEntries(Object.entries(r).filter((([,e])=>F(e))))),n=Object.entries(e).filter((([,e])=>J(e))).map((([e])=>e)),a=Object.entries(r).filter((([,e])=>J(e))).map((([e])=>e)),i=new Set([...n,...a]);for(const n of i)t[n]=L(e[n]||{},r[n]||{});return t}export{f as addGTIdentifier,x as defaultLocaleCookieName,S as defaultRenderSettings,a as flattenDictionary,_ as getDictionaryEntry,E as getEntryAndMetadata,O as getPluralBranch,b as getVariableName,A as getVariableProps,j as isValidDictionaryEntry,V as isVariableObject,L as mergeDictionaries,k as renderDefaultChildren,P as renderSkeleton,$ as renderTranslatedChildren,m as writeChildrenAsObjects};
@@ -0,0 +1,3 @@
1
+ import { TaggedElement, GTTag } from '../types/types';
2
+ export default function getGTTag(child: TaggedElement): GTTag | null;
3
+ //# sourceMappingURL=getGTTag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGTTag.d.ts","sourceRoot":"","sources":["../../src/rendering/getGTTag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,GAAG,IAAI,CAKnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderDefaultChildren.d.ts","sourceRoot":"","sources":["../../src/rendering/renderDefaultChildren.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,OAAO,EACL,cAAc,EAEd,cAAc,EAEf,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,QAAQ,EACR,aAAoC,EACpC,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,KAAK,CAAC,SAAS,CA0ElB"}
1
+ {"version":3,"file":"renderDefaultChildren.d.ts","sourceRoot":"","sources":["../../src/rendering/renderDefaultChildren.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,EACL,cAAc,EAEd,cAAc,EAEf,MAAM,gBAAgB,CAAC;AAGxB,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,QAAQ,EACR,aAAoC,EACpC,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,KAAK,CAAC,SAAS,CAqElB"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderTranslatedChildren.d.ts","sourceRoot":"","sources":["../../src/rendering/renderTranslatedChildren.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EACL,cAAc,EAEd,kBAAkB,EAClB,cAAc,EAEf,MAAM,gBAAgB,CAAC;AAkHxB,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,MAAM,EACN,MAAM,EACN,OAAgC,EAChC,cAAc,GACf,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,SAAS,CAgIZ"}
1
+ {"version":3,"file":"renderTranslatedChildren.d.ts","sourceRoot":"","sources":["../../src/rendering/renderTranslatedChildren.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EACL,cAAc,EAEd,kBAAkB,EAClB,cAAc,EAEf,MAAM,gBAAgB,CAAC;AAgHxB,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,MAAM,EACN,MAAM,EACN,OAAgC,EAChC,cAAc,GACf,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,SAAS,CAgIZ"}
@@ -1,4 +1,3 @@
1
- import { JsxChildren } from 'generaltranslation/internal';
2
1
  import { Variable, VariableTransformationSuffix, TransformationPrefix, GTProp, VariableType } from 'generaltranslation/types';
3
2
  import React from 'react';
4
3
  /**
@@ -7,7 +6,7 @@ import React from 'react';
7
6
  export type GTTag = {
8
7
  id: number;
9
8
  transformation?: TransformationPrefix;
10
- branches?: Record<string, JsxChildren>;
9
+ branches?: Record<string, TaggedChildren>;
11
10
  variableType?: VariableTransformationSuffix;
12
11
  };
13
12
  export type TaggedElementProps = Record<string, any> & {
@@ -35,11 +34,9 @@ export type FlattenedDictionary = {
35
34
  * Translated content types
36
35
  */
37
36
  export type TranslatedElement = {
38
- i: number;
39
- props: {
40
- d: GTProp;
41
- c?: TranslatedChildren;
42
- };
37
+ i?: number;
38
+ d?: GTProp;
39
+ c?: TranslatedChildren;
43
40
  };
44
41
  export type TranslatedChild = TranslatedElement | string | Variable;
45
42
  export type TranslatedChildren = TranslatedChild | TranslatedChild[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,oBAAoB,EACpB,MAAM,EACN,YAAY,EACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,4BAA4B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"description": "A React library for automatic internationalization.",
5
5
  "main": "./dist/index.cjs.min.cjs",
6
6
  "module": "./dist/index.esm.min.mjs",
@@ -14,14 +14,15 @@
14
14
  "react-dom": ">=16.8.0"
15
15
  },
16
16
  "dependencies": {
17
- "@generaltranslation/supported-locales": "^2.0.11-alpha.22",
18
- "generaltranslation": "^7.0.0-alpha.22"
17
+ "@generaltranslation/supported-locales": "^2.0.11-alpha.23",
18
+ "generaltranslation": "^7.0.0-alpha.23"
19
19
  },
20
20
  "scripts": {
21
21
  "patch": "npm version patch",
22
22
  "transpile": "tsc",
23
23
  "build": "rollup -c",
24
24
  "build:clean": "rm -rf dist; npm run build",
25
+ "build:release": "npm run build:clean",
25
26
  "release": "npm run build:clean && npm publish",
26
27
  "release:alpha": "npm run build:clean && npm publish --tag alpha",
27
28
  "release:beta": "npm run build:clean && npm publish --tag beta",
@@ -1,7 +0,0 @@
1
- import { ReactElement } from 'react';
2
- import { TranslatedElement } from '../types/types';
3
- export default function getGTProp(child: ReactElement<any> | TranslatedElement): {
4
- id: number;
5
- [key: string]: any;
6
- } | null;
7
- //# sourceMappingURL=getGTProp.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGTProp.d.ts","sourceRoot":"","sources":["../../src/rendering/getGTProp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,iBAAiB,GAC3C;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAK3C"}