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E,eAyCuB1B,EAAQ2B,YAAc,IACrD,EAjB6E,EAxBzE,WAyCuB3B,EAAQ4B,QAAU,IAC7C,EAlB6E,EAvBrE,cAyCuB5B,EAAQ6B,WAAa,IAlByB,IAoB5EnD,QAAQ,WAAY,MACpBoD,MACT,GI1DMC,EHGiB,SAAC5C,G,OAAkB,W,IAoBK,EARd6C,EACnBC,EACAC,EACAC,EAf6BC,EAAS,UAATA,OAAAA,QAAAA,IAAAA,UAAAA,GAAAA,UAAAA,GAAS,EAE1CC,EADqBlD,IACiBmD,gBAAkB,CAAC,EACzDC,GAAkBH,GAAUA,EAAS,GAAKC,EAC1CA,EAAiBG,iBACjBH,EAAiBI,mBAPK,WAoBtBC,EAA+BlC,EAAW+B,EAAeI,SAASzD,GAClEqD,GANIN,GADmBD,EAQHO,GAPKK,YAAY,KAAO,EACxCV,EAAOF,EAAOa,MAAM,EAAGZ,GACvBE,EAAOH,EAAOa,MAAMZ,GACnB,GAAWE,OAARD,EAAK,KAAQ,OAALC,KAclB,EAVuC,KA3B1B,mBAMU,KAgCvB,EAXuC,EAWtCjD,EAAsCmD,EAAiBS,kBAAoB,IAC5E,EAZuC,EAzBvB,sBAqCwBT,EAAiBU,mBAAqB,IAZvC,IAcrCC,EAAoBC,IAAaP,EAA6BhE,QAtCxD,IAsC8F,IAAK0D,EAAQ,CACnHc,iBAAiB,IAClBxE,QArCwB,IAqCQ2D,EAAiBc,gBAQ9CC,EAAoBV,EAA6BW,QAhD3C,KAiDZ,OAAOD,GAAqB,EACtB,GAAmDlE,OAAhD8D,EAAkBH,MAAM,EAAGO,IAAoDJ,OAlD5E,KAkDuH,OAA3CA,EAAkBH,MAAMO,IAC1GJ,CACV,C,CGnDqCM,CAAenE,E","sources":["webpack://@pb/react/./node_modules/@pb/components/node_modules/@pb/utils/dist/esm/formatters/getLocaleFile.js","webpack://@pb/react/./node_modules/@pb/components/node_modules/@pb/utils/dist/esm/common/replaceAll.js","webpack://@pb/react/./node_modules/@pb/components/node_modules/@pb/utils/dist/esm/formatters/formatAddress.js","webpack://@pb/react/./node_modules/@pb/components/node_modules/@pb/utils/dist/esm/formatters/formatCurrency.js","webpack://@pb/react/./node_modules/@pb/components/node_modules/@pb/utils/dist/esm/formatters/formatName.js","webpack://@pb/react/./node_modules/@pb/components/node_modules/@pb/utils/dist/esm/formatters/getFormatters.js","webpack://@pb/react/./node_modules/@pb/components/node_modules/@pb/utils/dist/esm/formatters/index.js"],"sourcesContent":["import { __awaiter } from \"tslib\";\nimport { getLocale } from '../locale';\nconst importLocale = (locale) => import(\n/* Exclude locale file internals */\n/* webpackMode: \"lazy\", webpackChunkName: \"utils/date-fns-locale-[index]\", webpackExclude: /_lib/ */\n`date-fns/locale/${locale}/index.js`).catch(() => null);\nlet localeFile;\nexport const initLocaleFile = () => __awaiter(void 0, void 0, void 0, function* () {\n var _a;\n const localeParts = getLocale().split('_');\n const localeVariations = [\n `${localeParts[0]}-${(_a = localeParts[1]) === null || _a === void 0 ? void 0 : _a.toUpperCase()}`,\n localeParts[0],\n 'en-GB',\n ];\n // bug in eslint, have to use eslint-disable there\n // eslint-disable-next-line no-unused-vars\n for (const localeVariation of localeVariations) {\n // eslint-disable-next-line no-await-in-loop\n const possibleLocaleFile = yield importLocale(localeVariation);\n // @ts-ignore\n if (possibleLocaleFile === null || possibleLocaleFile === void 0 ? void 0 : possibleLocaleFile.localize) {\n localeFile = possibleLocaleFile;\n return;\n }\n }\n});\nconst getLocaleFile = () => localeFile;\nexport default getLocaleFile;\n// Used only in tests\nexport const clearLocaleFile = () => {\n localeFile = undefined;\n};\n//# sourceMappingURL=getLocaleFile.js.map","const replaceAll = (str, mapObj) => str.replace(new RegExp(Object.keys(mapObj).join('|'), 'g'), (match) => mapObj[match]);\nexport default replaceAll;\n//# sourceMappingURL=replaceAll.js.map","import { isEmpty } from 'ramda';\nimport replaceAll from '../common/replaceAll';\nconst ADDRESS_PATTERNS = {\n TITLE: '{title}',\n FIRST_NAME: '{firstName}',\n MIDDLE_NAME: '{middleName}',\n LAST_NAME: '{lastName}',\n ALTERNATIVE_FIRST_NAME: '{alternativeFirstName}',\n ALTERNATIVE_LAST_NAME: '{alternativeLastName}',\n LINE1: '{line1}',\n LINE2: '{line2}',\n PROVINCE: '{province}',\n POSTAL_CODE: '{postalCode}',\n TOWN: '{town}',\n COUNTRY: '{country}',\n DISTRICT: '{district}',\n BUILDING: '{building}',\n CARE_OF: '{careOf}',\n PREFECTURE: '{prefecture}',\n PREFIX: '{prefix}',\n CELL_PHONE: '{cellPhone}',\n NEW_LINE: '[newLine]',\n};\nconst DEFAULT_ADDRESS_FORMAT = `${ADDRESS_PATTERNS.LINE1}${ADDRESS_PATTERNS.NEW_LINE}${ADDRESS_PATTERNS.LINE2}${ADDRESS_PATTERNS.NEW_LINE}${ADDRESS_PATTERNS.POSTAL_CODE} ${ADDRESS_PATTERNS.TOWN}`;\nconst formatAddress = (getFormatters) => (address, pattern = 'fullAddress') => {\n const isAddressEmpty = isEmpty(address) || JSON.stringify(address) === '{}';\n if (!address || isAddressEmpty) {\n return null;\n }\n // Currently the only provided formatting pattern is fullAddress\n const formattingPatterns = getFormatters();\n const addressPatterns = formattingPatterns.addressFormatter;\n const addressFormat = (addressPatterns && addressPatterns[pattern]) || DEFAULT_ADDRESS_FORMAT;\n const getAddressCountryName = () => {\n const { country } = address;\n if (!country) {\n return '';\n }\n if (typeof country === 'string') {\n return country;\n }\n return country.name;\n };\n return replaceAll(addressFormat.replace(new RegExp('\\\\[newLine\\\\]', 'g'), '\\n'), {\n [ADDRESS_PATTERNS.TITLE]: address.title || '',\n [ADDRESS_PATTERNS.FIRST_NAME]: address.firstName || '',\n [ADDRESS_PATTERNS.MIDDLE_NAME]: address.middleName || '',\n [ADDRESS_PATTERNS.LAST_NAME]: address.lastName || '',\n [ADDRESS_PATTERNS.ALTERNATIVE_FIRST_NAME]: address.alternativeFirstName || '',\n [ADDRESS_PATTERNS.ALTERNATIVE_LAST_NAME]: address.alternativeLastName || '',\n [ADDRESS_PATTERNS.LINE1]: address.line1 || '',\n [ADDRESS_PATTERNS.LINE2]: address.line2 || '',\n [ADDRESS_PATTERNS.PROVINCE]: address.adprovince || address.ADProvince || address.province || '',\n [ADDRESS_PATTERNS.TOWN]: address.town || '',\n [ADDRESS_PATTERNS.POSTAL_CODE]: address.postalCode || '',\n [ADDRESS_PATTERNS.COUNTRY]: getAddressCountryName(),\n [ADDRESS_PATTERNS.DISTRICT]: address.district || '',\n [ADDRESS_PATTERNS.BUILDING]: address.building || '',\n [ADDRESS_PATTERNS.CARE_OF]: address.careOf || '',\n [ADDRESS_PATTERNS.PREFECTURE]: address.prefecture || '',\n [ADDRESS_PATTERNS.PREFIX]: address.prefix || '',\n [ADDRESS_PATTERNS.CELL_PHONE]: address.cellPhone || '',\n })\n .replace(/\\n\\s*\\n/g, '\\n')\n .trim();\n};\nexport default formatAddress;\n//# sourceMappingURL=formatAddress.js.map","import numberFormat from 'number-format.js/lib/format.es5';\nimport replaceAll from '../common/replaceAll';\nconst CURRENCY_PATTERNS = {\n CURRENCY_SYMBOL: '{currencySymbol}',\n DECIMAL_SEPARATOR: '{decimalSeparator}',\n GROUPING_SEPARATOR: '{groupingSeparator}',\n MINUS_SIGN: '-',\n};\nconst DEFAULT_CURRENCY_FORMAT = '#,##0.00';\nconst UNIQUE_CURRENCY_SYMBOL = '¤';\nconst formatCurrency = (getFormatters) => (amount = 0) => {\n const formattingPatterns = getFormatters();\n const currencyPatterns = formattingPatterns.priceFormatter || {};\n const currencyFormat = (amount && amount < 0 && currencyPatterns\n ? currencyPatterns.patternNegatives\n : currencyPatterns.patternPositives) || DEFAULT_CURRENCY_FORMAT;\n /*\n When only one symbol is supplied, the numberFormat library will always treat that symbol\n as a decimal separator. If there is no decimal separator in the priceFormatter pattern,\n a symbol (e.g. \".\") has to be added after the last zero to instruct the library to\n round the amount (if needed) and display it without any decimals.\n */\n const addDotAfterLastZero = (string) => {\n const dotPosition = string.lastIndexOf('0') + 1;\n const head = string.slice(0, dotPosition);\n const tail = string.slice(dotPosition);\n return `${head}.${tail}`;\n };\n const currencyFormatWithSeparators = replaceAll(currencyFormat.includes(CURRENCY_PATTERNS.DECIMAL_SEPARATOR)\n ? currencyFormat\n : addDotAfterLastZero(currencyFormat), {\n /*\n * numberFormat :: https://github.com/Mottie/javascript-number-formatter\n * - \"The prefix or suffix can not include any numbers (0-9), dashes (-), or plus signs (+).\"\n *\n * The numberFormat library don't support numbers as prefix or suffix and the russian\n * currency руб will not work as expected.\n *\n * We exchange the currency symbol with a unique symbol before the numberFormat and add it back to the result.\n * */\n [CURRENCY_PATTERNS.CURRENCY_SYMBOL]: UNIQUE_CURRENCY_SYMBOL,\n [CURRENCY_PATTERNS.DECIMAL_SEPARATOR]: currencyPatterns.decimalSeparator || '',\n [CURRENCY_PATTERNS.GROUPING_SEPARATOR]: currencyPatterns.groupingSeparator || '',\n });\n const formattedCurrency = numberFormat(currencyFormatWithSeparators.replace(CURRENCY_PATTERNS.MINUS_SIGN, ''), amount, {\n enforceMaskSign: true,\n }).replace(UNIQUE_CURRENCY_SYMBOL, currencyPatterns.currencySymbol);\n /*\n The numberFormat library doesn't handle the scenario when the currency symbol is positioned\n as prefix but after the minus sign, i.e. the pattern doesn't start or end with the currency symbol.\n Example: -{currencySymbol} #{groupingSeparator}##0\n By removing the minus sign before formatting and then re-adding it at the correct position\n after formatting, it will work correctly.\n */\n const minusSignPosition = currencyFormatWithSeparators.indexOf(CURRENCY_PATTERNS.MINUS_SIGN);\n return minusSignPosition >= 0\n ? `${formattedCurrency.slice(0, minusSignPosition)}${CURRENCY_PATTERNS.MINUS_SIGN}${formattedCurrency.slice(minusSignPosition)}`\n : formattedCurrency;\n};\nexport default formatCurrency;\n//# sourceMappingURL=formatCurrency.js.map","import { __awaiter } from \"tslib\";\nimport replaceAll from '../common/replaceAll';\nconst NAME_STYLES = {\n SHORT: 'short',\n FORMAL: 'formal',\n};\nconst NAME_PATTERNS = {\n TITLE: '{title}',\n FIRST_NAME: '{firstName}',\n MIDDLE_NAME: '{middleName}',\n LAST_NAME: '{lastName}',\n ALTERNATIVE_FIRST_NAME: '{alternativeFirstName}',\n ALTERNATIVE_LAST_NAME: '{alternativeLastName}',\n};\nconst DEFAULT_NAME_FORMAT = NAME_PATTERNS.FIRST_NAME;\nconst formatName = (getFormatters) => (name, nameStyle = NAME_STYLES.SHORT) => __awaiter(void 0, void 0, void 0, function* () {\n const formattingPatterns = getFormatters();\n const namePatterns = formattingPatterns.nameFormatter || {};\n const nameFormat = (nameStyle === NAME_STYLES.FORMAL && namePatterns\n ? namePatterns.formalName\n : namePatterns.salutationName) || DEFAULT_NAME_FORMAT;\n return replaceAll(nameFormat, {\n [NAME_PATTERNS.TITLE]: name.title || '',\n [NAME_PATTERNS.FIRST_NAME]: name.firstName || '',\n [NAME_PATTERNS.MIDDLE_NAME]: name.middleName || '',\n [NAME_PATTERNS.LAST_NAME]: name.lastName || '',\n [NAME_PATTERNS.ALTERNATIVE_FIRST_NAME]: name.alternativeFirstName || '',\n [NAME_PATTERNS.ALTERNATIVE_LAST_NAME]: name.alternativeLastName || '',\n });\n});\nexport default formatName;\n//# sourceMappingURL=formatName.js.map","import consoleEvents from '../consoleEvents';\nimport { IS_CLIENT } from '../constants';\nimport { getLocale } from '../locale';\nconst getFormatters = () => {\n const locale = getLocale();\n const formattersKey = `hmUtilsFormatters-${locale}`;\n const formattersFromStorage = IS_CLIENT && window.sessionStorage.getItem(formattersKey);\n if (!formattersFromStorage) {\n consoleEvents.warn('You are probably using formatter function without calling formatters.init() previously. Please fix');\n }\n const cachedFormatters = formattersFromStorage || '{}';\n return JSON.parse(cachedFormatters);\n};\nexport default getFormatters;\n//# sourceMappingURL=getFormatters.js.map","import formatAddress from './formatAddress';\nimport formatCurrency from './formatCurrency';\nimport formatDate from './formatDate';\nimport formatName from './formatName';\nimport getFormatters from './getFormatters';\nimport init from './init';\nconst formatAddressWithFormatters = formatAddress(getFormatters);\nconst formatCurrencyWithFormatters = formatCurrency(getFormatters);\nconst formatDateWithFormatters = formatDate(getFormatters);\nconst formatNameWithFormatters = formatName(getFormatters);\nexport { init, formatAddressWithFormatters as formatAddress, formatCurrencyWithFormatters as formatCurrency, formatDateWithFormatters as formatDate, formatNameWithFormatters as formatName, getFormatters, };\n//# sourceMappingURL=index.js.map"],"names":["localeFile","initLocaleFile","__awaiter","_a","localeParts","localeVariations","possibleLocaleFile","getLocale","split","toUpperCase","locale","catch","localize","str","mapObj","replace","RegExp","Object","keys","join","match","ADDRESS_PATTERNS","DEFAULT_ADDRESS_FORMAT","CURRENCY_PATTERNS","getFormatters","formattersKey","formattersFromStorage","IS_CLIENT","window","sessionStorage","getItem","consoleEvents","warn","cachedFormatters","JSON","parse","formatAddressWithFormatters","address","pattern","isAddressEmpty","isEmpty","stringify","addressPatterns","addressFormatter","addressFormat","replaceAll","title","firstName","middleName","lastName","alternativeFirstName","alternativeLastName","line1","line2","adprovince","ADProvince","province","town","postalCode","country","name","district","building","careOf","prefecture","prefix","cellPhone","trim","formatCurrencyWithFormatters","string","dotPosition","head","tail","amount","currencyPatterns","priceFormatter","currencyFormat","patternNegatives","patternPositives","currencyFormatWithSeparators","includes","lastIndexOf","slice","decimalSeparator","groupingSeparator","formattedCurrency","numberFormat","enforceMaskSign","currencySymbol","minusSignPosition","indexOf","formatCurrency"],"sourceRoot":""}