@aidc-toolkit/gs1 1.0.22-beta → 1.0.24-beta

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.
Files changed (133) hide show
  1. package/dist/index.cjs +4624 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +1588 -0
  4. package/dist/index.d.ts +1588 -36
  5. package/dist/index.js +4541 -19
  6. package/dist/index.js.map +1 -1
  7. package/package.json +4 -8
  8. package/src/character-set.ts +16 -1
  9. package/src/check.ts +2 -2
  10. package/src/gtin-creator.ts +4 -4
  11. package/src/gtin-validator.ts +6 -6
  12. package/src/identifier-creator.ts +3 -3
  13. package/src/identifier-validator.ts +4 -4
  14. package/src/index.ts +19 -19
  15. package/src/locale/en/{locale-strings.ts → locale-resources.ts} +1 -1
  16. package/src/locale/fr/{locale-strings.ts → locale-resources.ts} +2 -2
  17. package/src/locale/i18n.ts +6 -8
  18. package/src/locale/i18next.d.ts +4 -4
  19. package/src/non-gtin-numeric-identifier-creator.ts +4 -4
  20. package/src/non-gtin-numeric-identifier-validator.ts +3 -3
  21. package/src/non-numeric-identifier-creator.ts +6 -6
  22. package/src/non-numeric-identifier-validator.ts +6 -6
  23. package/src/numeric-identifier-creator.ts +3 -3
  24. package/src/numeric-identifier-validator.ts +5 -5
  25. package/src/prefix-manager.ts +36 -35
  26. package/src/prefix-provider.ts +1 -1
  27. package/src/prefix-validator.ts +2 -2
  28. package/src/serializable-numeric-identifier-creator.ts +4 -4
  29. package/src/serializable-numeric-identifier-validator.ts +5 -5
  30. package/test/creator.test.ts +3 -3
  31. package/test/gtin-creator.ts +1 -1
  32. package/test/gtin-validator.test.ts +1 -1
  33. package/test/identifier-creator.ts +4 -4
  34. package/test/non-gtin-numeric-identifier-creator.ts +1 -1
  35. package/test/non-gtin-numeric-identifier-validator.ts +1 -1
  36. package/test/non-numeric-identifier-validator.ts +2 -2
  37. package/test/numeric-identifier-creator.ts +1 -1
  38. package/test/numeric-identifier-validator.ts +1 -1
  39. package/test/prefix-manager.test.ts +1 -1
  40. package/test/serializable-numeric-identifier-creator.ts +1 -1
  41. package/test/serializable-numeric-identifier-validator.ts +2 -2
  42. package/test/validator.test.ts +4 -4
  43. package/tsup.config.ts +3 -0
  44. package/typedoc.json +1 -3
  45. package/dist/character-set.d.ts +0 -22
  46. package/dist/character-set.d.ts.map +0 -1
  47. package/dist/character-set.js +0 -36
  48. package/dist/character-set.js.map +0 -1
  49. package/dist/check.d.ts +0 -81
  50. package/dist/check.d.ts.map +0 -1
  51. package/dist/check.js +0 -218
  52. package/dist/check.js.map +0 -1
  53. package/dist/gtin-creator.d.ts +0 -68
  54. package/dist/gtin-creator.d.ts.map +0 -1
  55. package/dist/gtin-creator.js +0 -158
  56. package/dist/gtin-creator.js.map +0 -1
  57. package/dist/gtin-validator.d.ts +0 -202
  58. package/dist/gtin-validator.d.ts.map +0 -1
  59. package/dist/gtin-validator.js +0 -470
  60. package/dist/gtin-validator.js.map +0 -1
  61. package/dist/identifier-creator.d.ts +0 -72
  62. package/dist/identifier-creator.d.ts.map +0 -1
  63. package/dist/identifier-creator.js +0 -50
  64. package/dist/identifier-creator.js.map +0 -1
  65. package/dist/identifier-type.d.ts +0 -58
  66. package/dist/identifier-type.d.ts.map +0 -1
  67. package/dist/identifier-type.js +0 -54
  68. package/dist/identifier-type.js.map +0 -1
  69. package/dist/identifier-validator.d.ts +0 -174
  70. package/dist/identifier-validator.d.ts.map +0 -1
  71. package/dist/identifier-validator.js +0 -145
  72. package/dist/identifier-validator.js.map +0 -1
  73. package/dist/index.d.ts.map +0 -1
  74. package/dist/locale/en/locale-strings.d.ts +0 -42
  75. package/dist/locale/en/locale-strings.d.ts.map +0 -1
  76. package/dist/locale/en/locale-strings.js +0 -42
  77. package/dist/locale/en/locale-strings.js.map +0 -1
  78. package/dist/locale/fr/locale-strings.d.ts +0 -42
  79. package/dist/locale/fr/locale-strings.d.ts.map +0 -1
  80. package/dist/locale/fr/locale-strings.js +0 -42
  81. package/dist/locale/fr/locale-strings.js.map +0 -1
  82. package/dist/locale/i18n.d.ts +0 -27
  83. package/dist/locale/i18n.d.ts.map +0 -1
  84. package/dist/locale/i18n.js +0 -37
  85. package/dist/locale/i18n.js.map +0 -1
  86. package/dist/non-gtin-numeric-identifier-creator.d.ts +0 -30
  87. package/dist/non-gtin-numeric-identifier-creator.d.ts.map +0 -1
  88. package/dist/non-gtin-numeric-identifier-creator.js +0 -30
  89. package/dist/non-gtin-numeric-identifier-creator.js.map +0 -1
  90. package/dist/non-gtin-numeric-identifier-validator.d.ts +0 -41
  91. package/dist/non-gtin-numeric-identifier-validator.d.ts.map +0 -1
  92. package/dist/non-gtin-numeric-identifier-validator.js +0 -40
  93. package/dist/non-gtin-numeric-identifier-validator.js.map +0 -1
  94. package/dist/non-numeric-identifier-creator.d.ts +0 -55
  95. package/dist/non-numeric-identifier-creator.d.ts.map +0 -1
  96. package/dist/non-numeric-identifier-creator.js +0 -93
  97. package/dist/non-numeric-identifier-creator.js.map +0 -1
  98. package/dist/non-numeric-identifier-validator.d.ts +0 -78
  99. package/dist/non-numeric-identifier-validator.d.ts.map +0 -1
  100. package/dist/non-numeric-identifier-validator.js +0 -95
  101. package/dist/non-numeric-identifier-validator.js.map +0 -1
  102. package/dist/numeric-identifier-creator.d.ts +0 -121
  103. package/dist/numeric-identifier-creator.d.ts.map +0 -1
  104. package/dist/numeric-identifier-creator.js +0 -135
  105. package/dist/numeric-identifier-creator.js.map +0 -1
  106. package/dist/numeric-identifier-validator.d.ts +0 -76
  107. package/dist/numeric-identifier-validator.d.ts.map +0 -1
  108. package/dist/numeric-identifier-validator.js +0 -84
  109. package/dist/numeric-identifier-validator.js.map +0 -1
  110. package/dist/prefix-manager.d.ts +0 -224
  111. package/dist/prefix-manager.d.ts.map +0 -1
  112. package/dist/prefix-manager.js +0 -369
  113. package/dist/prefix-manager.js.map +0 -1
  114. package/dist/prefix-provider.d.ts +0 -27
  115. package/dist/prefix-provider.d.ts.map +0 -1
  116. package/dist/prefix-provider.js +0 -2
  117. package/dist/prefix-provider.js.map +0 -1
  118. package/dist/prefix-type.d.ts +0 -22
  119. package/dist/prefix-type.d.ts.map +0 -1
  120. package/dist/prefix-type.js +0 -18
  121. package/dist/prefix-type.js.map +0 -1
  122. package/dist/prefix-validator.d.ts +0 -58
  123. package/dist/prefix-validator.d.ts.map +0 -1
  124. package/dist/prefix-validator.js +0 -154
  125. package/dist/prefix-validator.js.map +0 -1
  126. package/dist/serializable-numeric-identifier-creator.d.ts +0 -86
  127. package/dist/serializable-numeric-identifier-creator.d.ts.map +0 -1
  128. package/dist/serializable-numeric-identifier-creator.js +0 -116
  129. package/dist/serializable-numeric-identifier-creator.js.map +0 -1
  130. package/dist/serializable-numeric-identifier-validator.d.ts +0 -79
  131. package/dist/serializable-numeric-identifier-validator.d.ts.map +0 -1
  132. package/dist/serializable-numeric-identifier-validator.js +0 -99
  133. package/dist/serializable-numeric-identifier-validator.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/locale/i18n.ts","../node_modules/i18next/dist/esm/i18next.js","../src/locale/en/locale-resources.ts","../src/locale/fr/locale-resources.ts","../src/character-set.ts","../src/check.ts","../src/prefix-type.ts","../src/prefix-validator.ts","../src/identifier-type.ts","../src/identifier-validator.ts","../src/numeric-identifier-validator.ts","../src/gtin-validator.ts","../src/non-gtin-numeric-identifier-validator.ts","../src/serializable-numeric-identifier-validator.ts","../src/non-numeric-identifier-validator.ts","../src/identifier-creator.ts","../src/numeric-identifier-creator.ts","../src/gtin-creator.ts","../src/non-gtin-numeric-identifier-creator.ts","../src/serializable-numeric-identifier-creator.ts","../src/non-numeric-identifier-creator.ts","../src/prefix-manager.ts"],"sourcesContent":["/*!\n * Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit\n * contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport * from \"./locale/i18n\";\nexport * from \"./character-set\";\nexport * from \"./check\";\nexport * from \"./prefix-type\";\nexport * from \"./prefix-validator\";\nexport * from \"./identifier-type\";\nexport * from \"./identifier-validator\";\nexport * from \"./numeric-identifier-validator\";\nexport * from \"./gtin-validator\";\nexport * from \"./non-gtin-numeric-identifier-validator\";\nexport * from \"./serializable-numeric-identifier-validator\";\nexport * from \"./non-numeric-identifier-validator\";\nexport * from \"./identifier-creator\";\nexport * from \"./numeric-identifier-creator\";\nexport * from \"./gtin-creator\";\nexport * from \"./non-gtin-numeric-identifier-creator\";\nexport * from \"./serializable-numeric-identifier-creator\";\nexport * from \"./non-numeric-identifier-creator\";\nexport * from \"./prefix-manager\";\n","import { i18nCoreInit, type I18nEnvironment } from \"@aidc-toolkit/core\";\nimport { i18nUtilityInit, utilityResources } from \"@aidc-toolkit/utility\";\nimport i18next, { type i18n, type Resource } from \"i18next\";\nimport enLocaleResources from \"./en/locale-resources\";\nimport frLocaleResources from \"./fr/locale-resources\";\n\nexport const gs1NS = \"aidct_gs1\";\n\n/**\n * Locale strings type is extracted from the English locale strings object.\n */\nexport type GS1LocaleResources = typeof enLocaleResources;\n\n/**\n * GS1 resources.\n */\nexport const gs1Resources: Resource = {\n en: {\n aidct_gs1: enLocaleResources\n },\n fr: {\n aidct_gs1: frLocaleResources\n }\n};\n\n// Explicit type is necessary to work around bug in type discovery with linked packages.\nexport const i18nextGS1: i18n = i18next.createInstance();\n\n/**\n * Initialize internationalization.\n *\n * @param environment\n * Environment in which the application is running.\n *\n * @param debug\n * Debug setting.\n *\n * @returns\n * Void promise.\n */\nexport async function i18nGS1Init(environment: I18nEnvironment, debug = false): Promise<void> {\n await i18nUtilityInit(environment, debug);\n await i18nCoreInit(i18nextGS1, environment, debug, gs1NS, utilityResources, gs1Resources);\n}\n","const isString = obj => typeof obj === 'string';\nconst defer = () => {\n let res;\n let rej;\n const promise = new Promise((resolve, reject) => {\n res = resolve;\n rej = reject;\n });\n promise.resolve = res;\n promise.reject = rej;\n return promise;\n};\nconst makeString = object => {\n if (object == null) return '';\n return '' + object;\n};\nconst copy = (a, s, t) => {\n a.forEach(m => {\n if (s[m]) t[m] = s[m];\n });\n};\nconst lastOfPathSeparatorRegExp = /###/g;\nconst cleanKey = key => key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;\nconst canNotTraverseDeeper = object => !object || isString(object);\nconst getLastOfPath = (object, path, Empty) => {\n const stack = !isString(path) ? path : path.split('.');\n let stackIndex = 0;\n while (stackIndex < stack.length - 1) {\n if (canNotTraverseDeeper(object)) return {};\n const key = cleanKey(stack[stackIndex]);\n if (!object[key] && Empty) object[key] = new Empty();\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n object = object[key];\n } else {\n object = {};\n }\n ++stackIndex;\n }\n if (canNotTraverseDeeper(object)) return {};\n return {\n obj: object,\n k: cleanKey(stack[stackIndex])\n };\n};\nconst setPath = (object, path, newValue) => {\n const {\n obj,\n k\n } = getLastOfPath(object, path, Object);\n if (obj !== undefined || path.length === 1) {\n obj[k] = newValue;\n return;\n }\n let e = path[path.length - 1];\n let p = path.slice(0, path.length - 1);\n let last = getLastOfPath(object, p, Object);\n while (last.obj === undefined && p.length) {\n e = `${p[p.length - 1]}.${e}`;\n p = p.slice(0, p.length - 1);\n last = getLastOfPath(object, p, Object);\n if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== 'undefined') {\n last.obj = undefined;\n }\n }\n last.obj[`${last.k}.${e}`] = newValue;\n};\nconst pushPath = (object, path, newValue, concat) => {\n const {\n obj,\n k\n } = getLastOfPath(object, path, Object);\n obj[k] = obj[k] || [];\n obj[k].push(newValue);\n};\nconst getPath = (object, path) => {\n const {\n obj,\n k\n } = getLastOfPath(object, path);\n if (!obj) return undefined;\n if (!Object.prototype.hasOwnProperty.call(obj, k)) return undefined;\n return obj[k];\n};\nconst getPathWithDefaults = (data, defaultData, key) => {\n const value = getPath(data, key);\n if (value !== undefined) {\n return value;\n }\n return getPath(defaultData, key);\n};\nconst deepExtend = (target, source, overwrite) => {\n for (const prop in source) {\n if (prop !== '__proto__' && prop !== 'constructor') {\n if (prop in target) {\n if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {\n if (overwrite) target[prop] = source[prop];\n } else {\n deepExtend(target[prop], source[prop], overwrite);\n }\n } else {\n target[prop] = source[prop];\n }\n }\n }\n return target;\n};\nconst regexEscape = str => str.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&');\nvar _entityMap = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#39;',\n '/': '&#x2F;'\n};\nconst escape = data => {\n if (isString(data)) {\n return data.replace(/[&<>\"'\\/]/g, s => _entityMap[s]);\n }\n return data;\n};\nclass RegExpCache {\n constructor(capacity) {\n this.capacity = capacity;\n this.regExpMap = new Map();\n this.regExpQueue = [];\n }\n getRegExp(pattern) {\n const regExpFromCache = this.regExpMap.get(pattern);\n if (regExpFromCache !== undefined) {\n return regExpFromCache;\n }\n const regExpNew = new RegExp(pattern);\n if (this.regExpQueue.length === this.capacity) {\n this.regExpMap.delete(this.regExpQueue.shift());\n }\n this.regExpMap.set(pattern, regExpNew);\n this.regExpQueue.push(pattern);\n return regExpNew;\n }\n}\nconst chars = [' ', ',', '?', '!', ';'];\nconst looksLikeObjectPathRegExpCache = new RegExpCache(20);\nconst looksLikeObjectPath = (key, nsSeparator, keySeparator) => {\n nsSeparator = nsSeparator || '';\n keySeparator = keySeparator || '';\n const possibleChars = chars.filter(c => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);\n if (possibleChars.length === 0) return true;\n const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map(c => c === '?' ? '\\\\?' : c).join('|')})`);\n let matched = !r.test(key);\n if (!matched) {\n const ki = key.indexOf(keySeparator);\n if (ki > 0 && !r.test(key.substring(0, ki))) {\n matched = true;\n }\n }\n return matched;\n};\nconst deepFind = (obj, path, keySeparator = '.') => {\n if (!obj) return undefined;\n if (obj[path]) {\n if (!Object.prototype.hasOwnProperty.call(obj, path)) return undefined;\n return obj[path];\n }\n const tokens = path.split(keySeparator);\n let current = obj;\n for (let i = 0; i < tokens.length;) {\n if (!current || typeof current !== 'object') {\n return undefined;\n }\n let next;\n let nextPath = '';\n for (let j = i; j < tokens.length; ++j) {\n if (j !== i) {\n nextPath += keySeparator;\n }\n nextPath += tokens[j];\n next = current[nextPath];\n if (next !== undefined) {\n if (['string', 'number', 'boolean'].indexOf(typeof next) > -1 && j < tokens.length - 1) {\n continue;\n }\n i += j - i + 1;\n break;\n }\n }\n current = next;\n }\n return current;\n};\nconst getCleanedCode = code => code?.replace('_', '-');\n\nconst consoleLogger = {\n type: 'logger',\n log(args) {\n this.output('log', args);\n },\n warn(args) {\n this.output('warn', args);\n },\n error(args) {\n this.output('error', args);\n },\n output(type, args) {\n console?.[type]?.apply?.(console, args);\n }\n};\nclass Logger {\n constructor(concreteLogger, options = {}) {\n this.init(concreteLogger, options);\n }\n init(concreteLogger, options = {}) {\n this.prefix = options.prefix || 'i18next:';\n this.logger = concreteLogger || consoleLogger;\n this.options = options;\n this.debug = options.debug;\n }\n log(...args) {\n return this.forward(args, 'log', '', true);\n }\n warn(...args) {\n return this.forward(args, 'warn', '', true);\n }\n error(...args) {\n return this.forward(args, 'error', '');\n }\n deprecate(...args) {\n return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);\n }\n forward(args, lvl, prefix, debugOnly) {\n if (debugOnly && !this.debug) return null;\n if (isString(args[0])) args[0] = `${prefix}${this.prefix} ${args[0]}`;\n return this.logger[lvl](args);\n }\n create(moduleName) {\n return new Logger(this.logger, {\n ...{\n prefix: `${this.prefix}:${moduleName}:`\n },\n ...this.options\n });\n }\n clone(options) {\n options = options || this.options;\n options.prefix = options.prefix || this.prefix;\n return new Logger(this.logger, options);\n }\n}\nvar baseLogger = new Logger();\n\nclass EventEmitter {\n constructor() {\n this.observers = {};\n }\n on(events, listener) {\n events.split(' ').forEach(event => {\n if (!this.observers[event]) this.observers[event] = new Map();\n const numListeners = this.observers[event].get(listener) || 0;\n this.observers[event].set(listener, numListeners + 1);\n });\n return this;\n }\n off(event, listener) {\n if (!this.observers[event]) return;\n if (!listener) {\n delete this.observers[event];\n return;\n }\n this.observers[event].delete(listener);\n }\n emit(event, ...args) {\n if (this.observers[event]) {\n const cloned = Array.from(this.observers[event].entries());\n cloned.forEach(([observer, numTimesAdded]) => {\n for (let i = 0; i < numTimesAdded; i++) {\n observer(...args);\n }\n });\n }\n if (this.observers['*']) {\n const cloned = Array.from(this.observers['*'].entries());\n cloned.forEach(([observer, numTimesAdded]) => {\n for (let i = 0; i < numTimesAdded; i++) {\n observer.apply(observer, [event, ...args]);\n }\n });\n }\n }\n}\n\nclass ResourceStore extends EventEmitter {\n constructor(data, options = {\n ns: ['translation'],\n defaultNS: 'translation'\n }) {\n super();\n this.data = data || {};\n this.options = options;\n if (this.options.keySeparator === undefined) {\n this.options.keySeparator = '.';\n }\n if (this.options.ignoreJSONStructure === undefined) {\n this.options.ignoreJSONStructure = true;\n }\n }\n addNamespaces(ns) {\n if (this.options.ns.indexOf(ns) < 0) {\n this.options.ns.push(ns);\n }\n }\n removeNamespaces(ns) {\n const index = this.options.ns.indexOf(ns);\n if (index > -1) {\n this.options.ns.splice(index, 1);\n }\n }\n getResource(lng, ns, key, options = {}) {\n const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;\n let path;\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n } else {\n path = [lng, ns];\n if (key) {\n if (Array.isArray(key)) {\n path.push(...key);\n } else if (isString(key) && keySeparator) {\n path.push(...key.split(keySeparator));\n } else {\n path.push(key);\n }\n }\n }\n const result = getPath(this.data, path);\n if (!result && !ns && !key && lng.indexOf('.') > -1) {\n lng = path[0];\n ns = path[1];\n key = path.slice(2).join('.');\n }\n if (result || !ignoreJSONStructure || !isString(key)) return result;\n return deepFind(this.data?.[lng]?.[ns], key, keySeparator);\n }\n addResource(lng, ns, key, value, options = {\n silent: false\n }) {\n const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n let path = [lng, ns];\n if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n value = ns;\n ns = path[1];\n }\n this.addNamespaces(ns);\n setPath(this.data, path, value);\n if (!options.silent) this.emit('added', lng, ns, key, value);\n }\n addResources(lng, ns, resources, options = {\n silent: false\n }) {\n for (const m in resources) {\n if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], {\n silent: true\n });\n }\n if (!options.silent) this.emit('added', lng, ns, resources);\n }\n addResourceBundle(lng, ns, resources, deep, overwrite, options = {\n silent: false,\n skipCopy: false\n }) {\n let path = [lng, ns];\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n deep = resources;\n resources = ns;\n ns = path[1];\n }\n this.addNamespaces(ns);\n let pack = getPath(this.data, path) || {};\n if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));\n if (deep) {\n deepExtend(pack, resources, overwrite);\n } else {\n pack = {\n ...pack,\n ...resources\n };\n }\n setPath(this.data, path, pack);\n if (!options.silent) this.emit('added', lng, ns, resources);\n }\n removeResourceBundle(lng, ns) {\n if (this.hasResourceBundle(lng, ns)) {\n delete this.data[lng][ns];\n }\n this.removeNamespaces(ns);\n this.emit('removed', lng, ns);\n }\n hasResourceBundle(lng, ns) {\n return this.getResource(lng, ns) !== undefined;\n }\n getResourceBundle(lng, ns) {\n if (!ns) ns = this.options.defaultNS;\n return this.getResource(lng, ns);\n }\n getDataByLanguage(lng) {\n return this.data[lng];\n }\n hasLanguageSomeTranslations(lng) {\n const data = this.getDataByLanguage(lng);\n const n = data && Object.keys(data) || [];\n return !!n.find(v => data[v] && Object.keys(data[v]).length > 0);\n }\n toJSON() {\n return this.data;\n }\n}\n\nvar postProcessor = {\n processors: {},\n addPostProcessor(module) {\n this.processors[module.name] = module;\n },\n handle(processors, value, key, options, translator) {\n processors.forEach(processor => {\n value = this.processors[processor]?.process(value, key, options, translator) ?? value;\n });\n return value;\n }\n};\n\nconst PATH_KEY = Symbol('i18next/PATH_KEY');\nfunction createProxy() {\n const state = [];\n const handler = Object.create(null);\n let proxy;\n handler.get = (target, key) => {\n proxy?.revoke?.();\n if (key === PATH_KEY) return state;\n state.push(key);\n proxy = Proxy.revocable(target, handler);\n return proxy.proxy;\n };\n return Proxy.revocable(Object.create(null), handler).proxy;\n}\nfunction keysFromSelector(selector, opts) {\n const {\n [PATH_KEY]: path\n } = selector(createProxy());\n return path.join(opts?.keySeparator ?? '.');\n}\n\nconst checkedLoadedFor = {};\nconst shouldHandleAsObject = res => !isString(res) && typeof res !== 'boolean' && typeof res !== 'number';\nclass Translator extends EventEmitter {\n constructor(services, options = {}) {\n super();\n copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, this);\n this.options = options;\n if (this.options.keySeparator === undefined) {\n this.options.keySeparator = '.';\n }\n this.logger = baseLogger.create('translator');\n }\n changeLanguage(lng) {\n if (lng) this.language = lng;\n }\n exists(key, o = {\n interpolation: {}\n }) {\n const opt = {\n ...o\n };\n if (key == null) return false;\n const resolved = this.resolve(key, opt);\n if (resolved?.res === undefined) return false;\n const isObject = shouldHandleAsObject(resolved.res);\n if (opt.returnObjects === false && isObject) {\n return false;\n }\n return true;\n }\n extractFromKey(key, opt) {\n let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;\n if (nsSeparator === undefined) nsSeparator = ':';\n const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;\n let namespaces = opt.ns || this.options.defaultNS || [];\n const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;\n const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);\n if (wouldCheckForNsInKey && !seemsNaturalLanguage) {\n const m = key.match(this.interpolator.nestingRegexp);\n if (m && m.length > 0) {\n return {\n key,\n namespaces: isString(namespaces) ? [namespaces] : namespaces\n };\n }\n const parts = key.split(nsSeparator);\n if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();\n key = parts.join(keySeparator);\n }\n return {\n key,\n namespaces: isString(namespaces) ? [namespaces] : namespaces\n };\n }\n translate(keys, o, lastKey) {\n let opt = typeof o === 'object' ? {\n ...o\n } : o;\n if (typeof opt !== 'object' && this.options.overloadTranslationOptionHandler) {\n opt = this.options.overloadTranslationOptionHandler(arguments);\n }\n if (typeof opt === 'object') opt = {\n ...opt\n };\n if (!opt) opt = {};\n if (keys == null) return '';\n if (typeof keys === 'function') keys = keysFromSelector(keys, {\n ...this.options,\n ...opt\n });\n if (!Array.isArray(keys)) keys = [String(keys)];\n const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;\n const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;\n const {\n key,\n namespaces\n } = this.extractFromKey(keys[keys.length - 1], opt);\n const namespace = namespaces[namespaces.length - 1];\n let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;\n if (nsSeparator === undefined) nsSeparator = ':';\n const lng = opt.lng || this.language;\n const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;\n if (lng?.toLowerCase() === 'cimode') {\n if (appendNamespaceToCIMode) {\n if (returnDetails) {\n return {\n res: `${namespace}${nsSeparator}${key}`,\n usedKey: key,\n exactUsedKey: key,\n usedLng: lng,\n usedNS: namespace,\n usedParams: this.getUsedParamsDetails(opt)\n };\n }\n return `${namespace}${nsSeparator}${key}`;\n }\n if (returnDetails) {\n return {\n res: key,\n usedKey: key,\n exactUsedKey: key,\n usedLng: lng,\n usedNS: namespace,\n usedParams: this.getUsedParamsDetails(opt)\n };\n }\n return key;\n }\n const resolved = this.resolve(keys, opt);\n let res = resolved?.res;\n const resUsedKey = resolved?.usedKey || key;\n const resExactUsedKey = resolved?.exactUsedKey || key;\n const noObject = ['[object Number]', '[object Function]', '[object RegExp]'];\n const joinArrays = opt.joinArrays !== undefined ? opt.joinArrays : this.options.joinArrays;\n const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;\n const needsPluralHandling = opt.count !== undefined && !isString(opt.count);\n const hasDefaultValue = Translator.hasDefaultValue(opt);\n const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : '';\n const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, {\n ordinal: false\n }) : '';\n const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;\n const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;\n let resForObjHndl = res;\n if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {\n resForObjHndl = defaultValue;\n }\n const handleAsObject = shouldHandleAsObject(resForObjHndl);\n const resType = Object.prototype.toString.apply(resForObjHndl);\n if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {\n if (!opt.returnObjects && !this.options.returnObjects) {\n if (!this.options.returnedObjectHandler) {\n this.logger.warn('accessing an object - but returnObjects options is not enabled!');\n }\n const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {\n ...opt,\n ns: namespaces\n }) : `key '${key} (${this.language})' returned an object instead of string.`;\n if (returnDetails) {\n resolved.res = r;\n resolved.usedParams = this.getUsedParamsDetails(opt);\n return resolved;\n }\n return r;\n }\n if (keySeparator) {\n const resTypeIsArray = Array.isArray(resForObjHndl);\n const copy = resTypeIsArray ? [] : {};\n const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;\n for (const m in resForObjHndl) {\n if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) {\n const deepKey = `${newKeyToUse}${keySeparator}${m}`;\n if (hasDefaultValue && !res) {\n copy[m] = this.translate(deepKey, {\n ...opt,\n defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : undefined,\n ...{\n joinArrays: false,\n ns: namespaces\n }\n });\n } else {\n copy[m] = this.translate(deepKey, {\n ...opt,\n ...{\n joinArrays: false,\n ns: namespaces\n }\n });\n }\n if (copy[m] === deepKey) copy[m] = resForObjHndl[m];\n }\n }\n res = copy;\n }\n } else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {\n res = res.join(joinArrays);\n if (res) res = this.extendTranslation(res, keys, opt, lastKey);\n } else {\n let usedDefault = false;\n let usedKey = false;\n if (!this.isValidLookup(res) && hasDefaultValue) {\n usedDefault = true;\n res = defaultValue;\n }\n if (!this.isValidLookup(res)) {\n usedKey = true;\n res = key;\n }\n const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;\n const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;\n const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;\n if (usedKey || usedDefault || updateMissing) {\n this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);\n if (keySeparator) {\n const fk = this.resolve(key, {\n ...opt,\n keySeparator: false\n });\n if (fk && fk.res) this.logger.warn('Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.');\n }\n let lngs = [];\n const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);\n if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {\n for (let i = 0; i < fallbackLngs.length; i++) {\n lngs.push(fallbackLngs[i]);\n }\n } else if (this.options.saveMissingTo === 'all') {\n lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);\n } else {\n lngs.push(opt.lng || this.language);\n }\n const send = (l, k, specificDefaultValue) => {\n const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;\n if (this.options.missingKeyHandler) {\n this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);\n } else if (this.backendConnector?.saveMissing) {\n this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);\n }\n this.emit('missingKey', l, namespace, k, res);\n };\n if (this.options.saveMissing) {\n if (this.options.saveMissingPlurals && needsPluralHandling) {\n lngs.forEach(language => {\n const suffixes = this.pluralResolver.getSuffixes(language, opt);\n if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {\n suffixes.push(`${this.options.pluralSeparator}zero`);\n }\n suffixes.forEach(suffix => {\n send([language], key + suffix, opt[`defaultValue${suffix}`] || defaultValue);\n });\n });\n } else {\n send(lngs, key, defaultValue);\n }\n }\n }\n res = this.extendTranslation(res, keys, opt, resolved, lastKey);\n if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {\n res = `${namespace}${nsSeparator}${key}`;\n }\n if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {\n res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : undefined, opt);\n }\n }\n if (returnDetails) {\n resolved.res = res;\n resolved.usedParams = this.getUsedParamsDetails(opt);\n return resolved;\n }\n return res;\n }\n extendTranslation(res, key, opt, resolved, lastKey) {\n if (this.i18nFormat?.parse) {\n res = this.i18nFormat.parse(res, {\n ...this.options.interpolation.defaultVariables,\n ...opt\n }, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {\n resolved\n });\n } else if (!opt.skipInterpolation) {\n if (opt.interpolation) this.interpolator.init({\n ...opt,\n ...{\n interpolation: {\n ...this.options.interpolation,\n ...opt.interpolation\n }\n }\n });\n const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== undefined ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);\n let nestBef;\n if (skipOnVariables) {\n const nb = res.match(this.interpolator.nestingRegexp);\n nestBef = nb && nb.length;\n }\n let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;\n if (this.options.interpolation.defaultVariables) data = {\n ...this.options.interpolation.defaultVariables,\n ...data\n };\n res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);\n if (skipOnVariables) {\n const na = res.match(this.interpolator.nestingRegexp);\n const nestAft = na && na.length;\n if (nestBef < nestAft) opt.nest = false;\n }\n if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;\n if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {\n if (lastKey?.[0] === args[0] && !opt.context) {\n this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);\n return null;\n }\n return this.translate(...args, key);\n }, opt);\n if (opt.interpolation) this.interpolator.reset();\n }\n const postProcess = opt.postProcess || this.options.postProcess;\n const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;\n if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) {\n res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {\n i18nResolved: {\n ...resolved,\n usedParams: this.getUsedParamsDetails(opt)\n },\n ...opt\n } : opt, this);\n }\n return res;\n }\n resolve(keys, opt = {}) {\n let found;\n let usedKey;\n let exactUsedKey;\n let usedLng;\n let usedNS;\n if (isString(keys)) keys = [keys];\n keys.forEach(k => {\n if (this.isValidLookup(found)) return;\n const extracted = this.extractFromKey(k, opt);\n const key = extracted.key;\n usedKey = key;\n let namespaces = extracted.namespaces;\n if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);\n const needsPluralHandling = opt.count !== undefined && !isString(opt.count);\n const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;\n const needsContextHandling = opt.context !== undefined && (isString(opt.context) || typeof opt.context === 'number') && opt.context !== '';\n const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);\n namespaces.forEach(ns => {\n if (this.isValidLookup(found)) return;\n usedNS = ns;\n if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {\n checkedLoadedFor[`${codes[0]}-${ns}`] = true;\n this.logger.warn(`key \"${usedKey}\" for languages \"${codes.join(', ')}\" won't get resolved as namespace \"${usedNS}\" was not yet loaded`, 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');\n }\n codes.forEach(code => {\n if (this.isValidLookup(found)) return;\n usedLng = code;\n const finalKeys = [key];\n if (this.i18nFormat?.addLookupKeys) {\n this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt);\n } else {\n let pluralSuffix;\n if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);\n const zeroSuffix = `${this.options.pluralSeparator}zero`;\n const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;\n if (needsPluralHandling) {\n if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {\n finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));\n }\n finalKeys.push(key + pluralSuffix);\n if (needsZeroSuffixLookup) {\n finalKeys.push(key + zeroSuffix);\n }\n }\n if (needsContextHandling) {\n const contextKey = `${key}${this.options.contextSeparator || '_'}${opt.context}`;\n finalKeys.push(contextKey);\n if (needsPluralHandling) {\n if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {\n finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));\n }\n finalKeys.push(contextKey + pluralSuffix);\n if (needsZeroSuffixLookup) {\n finalKeys.push(contextKey + zeroSuffix);\n }\n }\n }\n }\n let possibleKey;\n while (possibleKey = finalKeys.pop()) {\n if (!this.isValidLookup(found)) {\n exactUsedKey = possibleKey;\n found = this.getResource(code, ns, possibleKey, opt);\n }\n }\n });\n });\n });\n return {\n res: found,\n usedKey,\n exactUsedKey,\n usedLng,\n usedNS\n };\n }\n isValidLookup(res) {\n return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');\n }\n getResource(code, ns, key, options = {}) {\n if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);\n return this.resourceStore.getResource(code, ns, key, options);\n }\n getUsedParamsDetails(options = {}) {\n const optionsKeys = ['defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation'];\n const useOptionsReplaceForData = options.replace && !isString(options.replace);\n let data = useOptionsReplaceForData ? options.replace : options;\n if (useOptionsReplaceForData && typeof options.count !== 'undefined') {\n data.count = options.count;\n }\n if (this.options.interpolation.defaultVariables) {\n data = {\n ...this.options.interpolation.defaultVariables,\n ...data\n };\n }\n if (!useOptionsReplaceForData) {\n data = {\n ...data\n };\n for (const key of optionsKeys) {\n delete data[key];\n }\n }\n return data;\n }\n static hasDefaultValue(options) {\n const prefix = 'defaultValue';\n for (const option in options) {\n if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {\n return true;\n }\n }\n return false;\n }\n}\n\nclass LanguageUtil {\n constructor(options) {\n this.options = options;\n this.supportedLngs = this.options.supportedLngs || false;\n this.logger = baseLogger.create('languageUtils');\n }\n getScriptPartFromCode(code) {\n code = getCleanedCode(code);\n if (!code || code.indexOf('-') < 0) return null;\n const p = code.split('-');\n if (p.length === 2) return null;\n p.pop();\n if (p[p.length - 1].toLowerCase() === 'x') return null;\n return this.formatLanguageCode(p.join('-'));\n }\n getLanguagePartFromCode(code) {\n code = getCleanedCode(code);\n if (!code || code.indexOf('-') < 0) return code;\n const p = code.split('-');\n return this.formatLanguageCode(p[0]);\n }\n formatLanguageCode(code) {\n if (isString(code) && code.indexOf('-') > -1) {\n let formattedCode;\n try {\n formattedCode = Intl.getCanonicalLocales(code)[0];\n } catch (e) {}\n if (formattedCode && this.options.lowerCaseLng) {\n formattedCode = formattedCode.toLowerCase();\n }\n if (formattedCode) return formattedCode;\n if (this.options.lowerCaseLng) {\n return code.toLowerCase();\n }\n return code;\n }\n return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;\n }\n isSupportedCode(code) {\n if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {\n code = this.getLanguagePartFromCode(code);\n }\n return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;\n }\n getBestMatchFromCodes(codes) {\n if (!codes) return null;\n let found;\n codes.forEach(code => {\n if (found) return;\n const cleanedLng = this.formatLanguageCode(code);\n if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;\n });\n if (!found && this.options.supportedLngs) {\n codes.forEach(code => {\n if (found) return;\n const lngScOnly = this.getScriptPartFromCode(code);\n if (this.isSupportedCode(lngScOnly)) return found = lngScOnly;\n const lngOnly = this.getLanguagePartFromCode(code);\n if (this.isSupportedCode(lngOnly)) return found = lngOnly;\n found = this.options.supportedLngs.find(supportedLng => {\n if (supportedLng === lngOnly) return supportedLng;\n if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;\n if (supportedLng.indexOf('-') > 0 && lngOnly.indexOf('-') < 0 && supportedLng.substring(0, supportedLng.indexOf('-')) === lngOnly) return supportedLng;\n if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;\n });\n });\n }\n if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];\n return found;\n }\n getFallbackCodes(fallbacks, code) {\n if (!fallbacks) return [];\n if (typeof fallbacks === 'function') fallbacks = fallbacks(code);\n if (isString(fallbacks)) fallbacks = [fallbacks];\n if (Array.isArray(fallbacks)) return fallbacks;\n if (!code) return fallbacks.default || [];\n let found = fallbacks[code];\n if (!found) found = fallbacks[this.getScriptPartFromCode(code)];\n if (!found) found = fallbacks[this.formatLanguageCode(code)];\n if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];\n if (!found) found = fallbacks.default;\n return found || [];\n }\n toResolveHierarchy(code, fallbackCode) {\n const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);\n const codes = [];\n const addCode = c => {\n if (!c) return;\n if (this.isSupportedCode(c)) {\n codes.push(c);\n } else {\n this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);\n }\n };\n if (isString(code) && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {\n if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));\n if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));\n if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));\n } else if (isString(code)) {\n addCode(this.formatLanguageCode(code));\n }\n fallbackCodes.forEach(fc => {\n if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));\n });\n return codes;\n }\n}\n\nconst suffixesOrder = {\n zero: 0,\n one: 1,\n two: 2,\n few: 3,\n many: 4,\n other: 5\n};\nconst dummyRule = {\n select: count => count === 1 ? 'one' : 'other',\n resolvedOptions: () => ({\n pluralCategories: ['one', 'other']\n })\n};\nclass PluralResolver {\n constructor(languageUtils, options = {}) {\n this.languageUtils = languageUtils;\n this.options = options;\n this.logger = baseLogger.create('pluralResolver');\n this.pluralRulesCache = {};\n }\n addRule(lng, obj) {\n this.rules[lng] = obj;\n }\n clearCache() {\n this.pluralRulesCache = {};\n }\n getRule(code, options = {}) {\n const cleanedCode = getCleanedCode(code === 'dev' ? 'en' : code);\n const type = options.ordinal ? 'ordinal' : 'cardinal';\n const cacheKey = JSON.stringify({\n cleanedCode,\n type\n });\n if (cacheKey in this.pluralRulesCache) {\n return this.pluralRulesCache[cacheKey];\n }\n let rule;\n try {\n rule = new Intl.PluralRules(cleanedCode, {\n type\n });\n } catch (err) {\n if (!Intl) {\n this.logger.error('No Intl support, please use an Intl polyfill!');\n return dummyRule;\n }\n if (!code.match(/-|_/)) return dummyRule;\n const lngPart = this.languageUtils.getLanguagePartFromCode(code);\n rule = this.getRule(lngPart, options);\n }\n this.pluralRulesCache[cacheKey] = rule;\n return rule;\n }\n needsPlural(code, options = {}) {\n let rule = this.getRule(code, options);\n if (!rule) rule = this.getRule('dev', options);\n return rule?.resolvedOptions().pluralCategories.length > 1;\n }\n getPluralFormsOfKey(code, key, options = {}) {\n return this.getSuffixes(code, options).map(suffix => `${key}${suffix}`);\n }\n getSuffixes(code, options = {}) {\n let rule = this.getRule(code, options);\n if (!rule) rule = this.getRule('dev', options);\n if (!rule) return [];\n return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map(pluralCategory => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${pluralCategory}`);\n }\n getSuffix(code, count, options = {}) {\n const rule = this.getRule(code, options);\n if (rule) {\n return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${rule.select(count)}`;\n }\n this.logger.warn(`no plural rule found for: ${code}`);\n return this.getSuffix('dev', count, options);\n }\n}\n\nconst deepFindWithDefaults = (data, defaultData, key, keySeparator = '.', ignoreJSONStructure = true) => {\n let path = getPathWithDefaults(data, defaultData, key);\n if (!path && ignoreJSONStructure && isString(key)) {\n path = deepFind(data, key, keySeparator);\n if (path === undefined) path = deepFind(defaultData, key, keySeparator);\n }\n return path;\n};\nconst regexSafe = val => val.replace(/\\$/g, '$$$$');\nclass Interpolator {\n constructor(options = {}) {\n this.logger = baseLogger.create('interpolator');\n this.options = options;\n this.format = options?.interpolation?.format || (value => value);\n this.init(options);\n }\n init(options = {}) {\n if (!options.interpolation) options.interpolation = {\n escapeValue: true\n };\n const {\n escape: escape$1,\n escapeValue,\n useRawValueToEscape,\n prefix,\n prefixEscaped,\n suffix,\n suffixEscaped,\n formatSeparator,\n unescapeSuffix,\n unescapePrefix,\n nestingPrefix,\n nestingPrefixEscaped,\n nestingSuffix,\n nestingSuffixEscaped,\n nestingOptionsSeparator,\n maxReplaces,\n alwaysFormat\n } = options.interpolation;\n this.escape = escape$1 !== undefined ? escape$1 : escape;\n this.escapeValue = escapeValue !== undefined ? escapeValue : true;\n this.useRawValueToEscape = useRawValueToEscape !== undefined ? useRawValueToEscape : false;\n this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || '{{';\n this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || '}}';\n this.formatSeparator = formatSeparator || ',';\n this.unescapePrefix = unescapeSuffix ? '' : unescapePrefix || '-';\n this.unescapeSuffix = this.unescapePrefix ? '' : unescapeSuffix || '';\n this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape('$t(');\n this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(')');\n this.nestingOptionsSeparator = nestingOptionsSeparator || ',';\n this.maxReplaces = maxReplaces || 1000;\n this.alwaysFormat = alwaysFormat !== undefined ? alwaysFormat : false;\n this.resetRegExp();\n }\n reset() {\n if (this.options) this.init(this.options);\n }\n resetRegExp() {\n const getOrResetRegExp = (existingRegExp, pattern) => {\n if (existingRegExp?.source === pattern) {\n existingRegExp.lastIndex = 0;\n return existingRegExp;\n }\n return new RegExp(pattern, 'g');\n };\n this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);\n this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);\n this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()\"']+|\"[^\"]*\"|'[^']*'|\\\\((?:[^()]|\"[^\"]*\"|'[^']*')*\\\\))*?)${this.nestingSuffix}`);\n }\n interpolate(str, data, lng, options) {\n let match;\n let value;\n let replaces;\n const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};\n const handleFormat = key => {\n if (key.indexOf(this.formatSeparator) < 0) {\n const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);\n return this.alwaysFormat ? this.format(path, undefined, lng, {\n ...options,\n ...data,\n interpolationkey: key\n }) : path;\n }\n const p = key.split(this.formatSeparator);\n const k = p.shift().trim();\n const f = p.join(this.formatSeparator).trim();\n return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {\n ...options,\n ...data,\n interpolationkey: k\n });\n };\n this.resetRegExp();\n const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;\n const skipOnVariables = options?.interpolation?.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;\n const todos = [{\n regex: this.regexpUnescape,\n safeValue: val => regexSafe(val)\n }, {\n regex: this.regexp,\n safeValue: val => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)\n }];\n todos.forEach(todo => {\n replaces = 0;\n while (match = todo.regex.exec(str)) {\n const matchedVar = match[1].trim();\n value = handleFormat(matchedVar);\n if (value === undefined) {\n if (typeof missingInterpolationHandler === 'function') {\n const temp = missingInterpolationHandler(str, match, options);\n value = isString(temp) ? temp : '';\n } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {\n value = '';\n } else if (skipOnVariables) {\n value = match[0];\n continue;\n } else {\n this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);\n value = '';\n }\n } else if (!isString(value) && !this.useRawValueToEscape) {\n value = makeString(value);\n }\n const safeValue = todo.safeValue(value);\n str = str.replace(match[0], safeValue);\n if (skipOnVariables) {\n todo.regex.lastIndex += value.length;\n todo.regex.lastIndex -= match[0].length;\n } else {\n todo.regex.lastIndex = 0;\n }\n replaces++;\n if (replaces >= this.maxReplaces) {\n break;\n }\n }\n });\n return str;\n }\n nest(str, fc, options = {}) {\n let match;\n let value;\n let clonedOptions;\n const handleHasOptions = (key, inheritedOptions) => {\n const sep = this.nestingOptionsSeparator;\n if (key.indexOf(sep) < 0) return key;\n const c = key.split(new RegExp(`${sep}[ ]*{`));\n let optionsString = `{${c[1]}`;\n key = c[0];\n optionsString = this.interpolate(optionsString, clonedOptions);\n const matchedSingleQuotes = optionsString.match(/'/g);\n const matchedDoubleQuotes = optionsString.match(/\"/g);\n if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {\n optionsString = optionsString.replace(/'/g, '\"');\n }\n try {\n clonedOptions = JSON.parse(optionsString);\n if (inheritedOptions) clonedOptions = {\n ...inheritedOptions,\n ...clonedOptions\n };\n } catch (e) {\n this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);\n return `${key}${sep}${optionsString}`;\n }\n if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;\n return key;\n };\n while (match = this.nestingRegexp.exec(str)) {\n let formatters = [];\n clonedOptions = {\n ...options\n };\n clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;\n clonedOptions.applyPostProcessor = false;\n delete clonedOptions.defaultValue;\n const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf('}') + 1 : match[1].indexOf(this.formatSeparator);\n if (keyEndIndex !== -1) {\n formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map(elem => elem.trim()).filter(Boolean);\n match[1] = match[1].slice(0, keyEndIndex);\n }\n value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);\n if (value && match[0] === str && !isString(value)) return value;\n if (!isString(value)) value = makeString(value);\n if (!value) {\n this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);\n value = '';\n }\n if (formatters.length) {\n value = formatters.reduce((v, f) => this.format(v, f, options.lng, {\n ...options,\n interpolationkey: match[1].trim()\n }), value.trim());\n }\n str = str.replace(match[0], value);\n this.regexp.lastIndex = 0;\n }\n return str;\n }\n}\n\nconst parseFormatStr = formatStr => {\n let formatName = formatStr.toLowerCase().trim();\n const formatOptions = {};\n if (formatStr.indexOf('(') > -1) {\n const p = formatStr.split('(');\n formatName = p[0].toLowerCase().trim();\n const optStr = p[1].substring(0, p[1].length - 1);\n if (formatName === 'currency' && optStr.indexOf(':') < 0) {\n if (!formatOptions.currency) formatOptions.currency = optStr.trim();\n } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {\n if (!formatOptions.range) formatOptions.range = optStr.trim();\n } else {\n const opts = optStr.split(';');\n opts.forEach(opt => {\n if (opt) {\n const [key, ...rest] = opt.split(':');\n const val = rest.join(':').trim().replace(/^'+|'+$/g, '');\n const trimmedKey = key.trim();\n if (!formatOptions[trimmedKey]) formatOptions[trimmedKey] = val;\n if (val === 'false') formatOptions[trimmedKey] = false;\n if (val === 'true') formatOptions[trimmedKey] = true;\n if (!isNaN(val)) formatOptions[trimmedKey] = parseInt(val, 10);\n }\n });\n }\n }\n return {\n formatName,\n formatOptions\n };\n};\nconst createCachedFormatter = fn => {\n const cache = {};\n return (v, l, o) => {\n let optForCache = o;\n if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {\n optForCache = {\n ...optForCache,\n [o.interpolationkey]: undefined\n };\n }\n const key = l + JSON.stringify(optForCache);\n let frm = cache[key];\n if (!frm) {\n frm = fn(getCleanedCode(l), o);\n cache[key] = frm;\n }\n return frm(v);\n };\n};\nconst createNonCachedFormatter = fn => (v, l, o) => fn(getCleanedCode(l), o)(v);\nclass Formatter {\n constructor(options = {}) {\n this.logger = baseLogger.create('formatter');\n this.options = options;\n this.init(options);\n }\n init(services, options = {\n interpolation: {}\n }) {\n this.formatSeparator = options.interpolation.formatSeparator || ',';\n const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;\n this.formats = {\n number: cf((lng, opt) => {\n const formatter = new Intl.NumberFormat(lng, {\n ...opt\n });\n return val => formatter.format(val);\n }),\n currency: cf((lng, opt) => {\n const formatter = new Intl.NumberFormat(lng, {\n ...opt,\n style: 'currency'\n });\n return val => formatter.format(val);\n }),\n datetime: cf((lng, opt) => {\n const formatter = new Intl.DateTimeFormat(lng, {\n ...opt\n });\n return val => formatter.format(val);\n }),\n relativetime: cf((lng, opt) => {\n const formatter = new Intl.RelativeTimeFormat(lng, {\n ...opt\n });\n return val => formatter.format(val, opt.range || 'day');\n }),\n list: cf((lng, opt) => {\n const formatter = new Intl.ListFormat(lng, {\n ...opt\n });\n return val => formatter.format(val);\n })\n };\n }\n add(name, fc) {\n this.formats[name.toLowerCase().trim()] = fc;\n }\n addCached(name, fc) {\n this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);\n }\n format(value, format, lng, options = {}) {\n const formats = format.split(this.formatSeparator);\n if (formats.length > 1 && formats[0].indexOf('(') > 1 && formats[0].indexOf(')') < 0 && formats.find(f => f.indexOf(')') > -1)) {\n const lastIndex = formats.findIndex(f => f.indexOf(')') > -1);\n formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);\n }\n const result = formats.reduce((mem, f) => {\n const {\n formatName,\n formatOptions\n } = parseFormatStr(f);\n if (this.formats[formatName]) {\n let formatted = mem;\n try {\n const valOptions = options?.formatParams?.[options.interpolationkey] || {};\n const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;\n formatted = this.formats[formatName](mem, l, {\n ...formatOptions,\n ...options,\n ...valOptions\n });\n } catch (error) {\n this.logger.warn(error);\n }\n return formatted;\n } else {\n this.logger.warn(`there was no format function for ${formatName}`);\n }\n return mem;\n }, value);\n return result;\n }\n}\n\nconst removePending = (q, name) => {\n if (q.pending[name] !== undefined) {\n delete q.pending[name];\n q.pendingCount--;\n }\n};\nclass Connector extends EventEmitter {\n constructor(backend, store, services, options = {}) {\n super();\n this.backend = backend;\n this.store = store;\n this.services = services;\n this.languageUtils = services.languageUtils;\n this.options = options;\n this.logger = baseLogger.create('backendConnector');\n this.waitingReads = [];\n this.maxParallelReads = options.maxParallelReads || 10;\n this.readingCalls = 0;\n this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;\n this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;\n this.state = {};\n this.queue = [];\n this.backend?.init?.(services, options.backend, options);\n }\n queueLoad(languages, namespaces, options, callback) {\n const toLoad = {};\n const pending = {};\n const toLoadLanguages = {};\n const toLoadNamespaces = {};\n languages.forEach(lng => {\n let hasAllNamespaces = true;\n namespaces.forEach(ns => {\n const name = `${lng}|${ns}`;\n if (!options.reload && this.store.hasResourceBundle(lng, ns)) {\n this.state[name] = 2;\n } else if (this.state[name] < 0) ; else if (this.state[name] === 1) {\n if (pending[name] === undefined) pending[name] = true;\n } else {\n this.state[name] = 1;\n hasAllNamespaces = false;\n if (pending[name] === undefined) pending[name] = true;\n if (toLoad[name] === undefined) toLoad[name] = true;\n if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;\n }\n });\n if (!hasAllNamespaces) toLoadLanguages[lng] = true;\n });\n if (Object.keys(toLoad).length || Object.keys(pending).length) {\n this.queue.push({\n pending,\n pendingCount: Object.keys(pending).length,\n loaded: {},\n errors: [],\n callback\n });\n }\n return {\n toLoad: Object.keys(toLoad),\n pending: Object.keys(pending),\n toLoadLanguages: Object.keys(toLoadLanguages),\n toLoadNamespaces: Object.keys(toLoadNamespaces)\n };\n }\n loaded(name, err, data) {\n const s = name.split('|');\n const lng = s[0];\n const ns = s[1];\n if (err) this.emit('failedLoading', lng, ns, err);\n if (!err && data) {\n this.store.addResourceBundle(lng, ns, data, undefined, undefined, {\n skipCopy: true\n });\n }\n this.state[name] = err ? -1 : 2;\n if (err && data) this.state[name] = 0;\n const loaded = {};\n this.queue.forEach(q => {\n pushPath(q.loaded, [lng], ns);\n removePending(q, name);\n if (err) q.errors.push(err);\n if (q.pendingCount === 0 && !q.done) {\n Object.keys(q.loaded).forEach(l => {\n if (!loaded[l]) loaded[l] = {};\n const loadedKeys = q.loaded[l];\n if (loadedKeys.length) {\n loadedKeys.forEach(n => {\n if (loaded[l][n] === undefined) loaded[l][n] = true;\n });\n }\n });\n q.done = true;\n if (q.errors.length) {\n q.callback(q.errors);\n } else {\n q.callback();\n }\n }\n });\n this.emit('loaded', loaded);\n this.queue = this.queue.filter(q => !q.done);\n }\n read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {\n if (!lng.length) return callback(null, {});\n if (this.readingCalls >= this.maxParallelReads) {\n this.waitingReads.push({\n lng,\n ns,\n fcName,\n tried,\n wait,\n callback\n });\n return;\n }\n this.readingCalls++;\n const resolver = (err, data) => {\n this.readingCalls--;\n if (this.waitingReads.length > 0) {\n const next = this.waitingReads.shift();\n this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);\n }\n if (err && data && tried < this.maxRetries) {\n setTimeout(() => {\n this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);\n }, wait);\n return;\n }\n callback(err, data);\n };\n const fc = this.backend[fcName].bind(this.backend);\n if (fc.length === 2) {\n try {\n const r = fc(lng, ns);\n if (r && typeof r.then === 'function') {\n r.then(data => resolver(null, data)).catch(resolver);\n } else {\n resolver(null, r);\n }\n } catch (err) {\n resolver(err);\n }\n return;\n }\n return fc(lng, ns, resolver);\n }\n prepareLoading(languages, namespaces, options = {}, callback) {\n if (!this.backend) {\n this.logger.warn('No backend was added via i18next.use. Will not load resources.');\n return callback && callback();\n }\n if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);\n if (isString(namespaces)) namespaces = [namespaces];\n const toLoad = this.queueLoad(languages, namespaces, options, callback);\n if (!toLoad.toLoad.length) {\n if (!toLoad.pending.length) callback();\n return null;\n }\n toLoad.toLoad.forEach(name => {\n this.loadOne(name);\n });\n }\n load(languages, namespaces, callback) {\n this.prepareLoading(languages, namespaces, {}, callback);\n }\n reload(languages, namespaces, callback) {\n this.prepareLoading(languages, namespaces, {\n reload: true\n }, callback);\n }\n loadOne(name, prefix = '') {\n const s = name.split('|');\n const lng = s[0];\n const ns = s[1];\n this.read(lng, ns, 'read', undefined, undefined, (err, data) => {\n if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);\n if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);\n this.loaded(name, err, data);\n });\n }\n saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {\n if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {\n this.logger.warn(`did not save key \"${key}\" as the namespace \"${namespace}\" was not yet loaded`, 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');\n return;\n }\n if (key === undefined || key === null || key === '') return;\n if (this.backend?.create) {\n const opts = {\n ...options,\n isUpdate\n };\n const fc = this.backend.create.bind(this.backend);\n if (fc.length < 6) {\n try {\n let r;\n if (fc.length === 5) {\n r = fc(languages, namespace, key, fallbackValue, opts);\n } else {\n r = fc(languages, namespace, key, fallbackValue);\n }\n if (r && typeof r.then === 'function') {\n r.then(data => clb(null, data)).catch(clb);\n } else {\n clb(null, r);\n }\n } catch (err) {\n clb(err);\n }\n } else {\n fc(languages, namespace, key, fallbackValue, clb, opts);\n }\n }\n if (!languages || !languages[0]) return;\n this.store.addResource(languages[0], namespace, key, fallbackValue);\n }\n}\n\nconst get = () => ({\n debug: false,\n initAsync: true,\n ns: ['translation'],\n defaultNS: ['translation'],\n fallbackLng: ['dev'],\n fallbackNS: false,\n supportedLngs: false,\n nonExplicitSupportedLngs: false,\n load: 'all',\n preload: false,\n simplifyPluralSuffix: true,\n keySeparator: '.',\n nsSeparator: ':',\n pluralSeparator: '_',\n contextSeparator: '_',\n partialBundledLanguages: false,\n saveMissing: false,\n updateMissing: false,\n saveMissingTo: 'fallback',\n saveMissingPlurals: true,\n missingKeyHandler: false,\n missingInterpolationHandler: false,\n postProcess: false,\n postProcessPassResolved: false,\n returnNull: false,\n returnEmptyString: true,\n returnObjects: false,\n joinArrays: false,\n returnedObjectHandler: false,\n parseMissingKeyHandler: false,\n appendNamespaceToMissingKey: false,\n appendNamespaceToCIMode: false,\n overloadTranslationOptionHandler: args => {\n let ret = {};\n if (typeof args[1] === 'object') ret = args[1];\n if (isString(args[1])) ret.defaultValue = args[1];\n if (isString(args[2])) ret.tDescription = args[2];\n if (typeof args[2] === 'object' || typeof args[3] === 'object') {\n const options = args[3] || args[2];\n Object.keys(options).forEach(key => {\n ret[key] = options[key];\n });\n }\n return ret;\n },\n interpolation: {\n escapeValue: true,\n format: value => value,\n prefix: '{{',\n suffix: '}}',\n formatSeparator: ',',\n unescapePrefix: '-',\n nestingPrefix: '$t(',\n nestingSuffix: ')',\n nestingOptionsSeparator: ',',\n maxReplaces: 1000,\n skipOnVariables: true\n },\n cacheInBuiltFormats: true\n});\nconst transformOptions = options => {\n if (isString(options.ns)) options.ns = [options.ns];\n if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];\n if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];\n if (options.supportedLngs?.indexOf?.('cimode') < 0) {\n options.supportedLngs = options.supportedLngs.concat(['cimode']);\n }\n if (typeof options.initImmediate === 'boolean') options.initAsync = options.initImmediate;\n return options;\n};\n\nconst noop = () => {};\nconst bindMemberFunctions = inst => {\n const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));\n mems.forEach(mem => {\n if (typeof inst[mem] === 'function') {\n inst[mem] = inst[mem].bind(inst);\n }\n });\n};\nclass I18n extends EventEmitter {\n constructor(options = {}, callback) {\n super();\n this.options = transformOptions(options);\n this.services = {};\n this.logger = baseLogger;\n this.modules = {\n external: []\n };\n bindMemberFunctions(this);\n if (callback && !this.isInitialized && !options.isClone) {\n if (!this.options.initAsync) {\n this.init(options, callback);\n return this;\n }\n setTimeout(() => {\n this.init(options, callback);\n }, 0);\n }\n }\n init(options = {}, callback) {\n this.isInitializing = true;\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n if (options.defaultNS == null && options.ns) {\n if (isString(options.ns)) {\n options.defaultNS = options.ns;\n } else if (options.ns.indexOf('translation') < 0) {\n options.defaultNS = options.ns[0];\n }\n }\n const defOpts = get();\n this.options = {\n ...defOpts,\n ...this.options,\n ...transformOptions(options)\n };\n this.options.interpolation = {\n ...defOpts.interpolation,\n ...this.options.interpolation\n };\n if (options.keySeparator !== undefined) {\n this.options.userDefinedKeySeparator = options.keySeparator;\n }\n if (options.nsSeparator !== undefined) {\n this.options.userDefinedNsSeparator = options.nsSeparator;\n }\n const createClassOnDemand = ClassOrObject => {\n if (!ClassOrObject) return null;\n if (typeof ClassOrObject === 'function') return new ClassOrObject();\n return ClassOrObject;\n };\n if (!this.options.isClone) {\n if (this.modules.logger) {\n baseLogger.init(createClassOnDemand(this.modules.logger), this.options);\n } else {\n baseLogger.init(null, this.options);\n }\n let formatter;\n if (this.modules.formatter) {\n formatter = this.modules.formatter;\n } else {\n formatter = Formatter;\n }\n const lu = new LanguageUtil(this.options);\n this.store = new ResourceStore(this.options.resources, this.options);\n const s = this.services;\n s.logger = baseLogger;\n s.resourceStore = this.store;\n s.languageUtils = lu;\n s.pluralResolver = new PluralResolver(lu, {\n prepend: this.options.pluralSeparator,\n simplifyPluralSuffix: this.options.simplifyPluralSuffix\n });\n const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;\n if (usingLegacyFormatFunction) {\n this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);\n }\n if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {\n s.formatter = createClassOnDemand(formatter);\n if (s.formatter.init) s.formatter.init(s, this.options);\n this.options.interpolation.format = s.formatter.format.bind(s.formatter);\n }\n s.interpolator = new Interpolator(this.options);\n s.utils = {\n hasLoadedNamespace: this.hasLoadedNamespace.bind(this)\n };\n s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);\n s.backendConnector.on('*', (event, ...args) => {\n this.emit(event, ...args);\n });\n if (this.modules.languageDetector) {\n s.languageDetector = createClassOnDemand(this.modules.languageDetector);\n if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);\n }\n if (this.modules.i18nFormat) {\n s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);\n if (s.i18nFormat.init) s.i18nFormat.init(this);\n }\n this.translator = new Translator(this.services, this.options);\n this.translator.on('*', (event, ...args) => {\n this.emit(event, ...args);\n });\n this.modules.external.forEach(m => {\n if (m.init) m.init(this);\n });\n }\n this.format = this.options.interpolation.format;\n if (!callback) callback = noop;\n if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {\n const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);\n if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];\n }\n if (!this.services.languageDetector && !this.options.lng) {\n this.logger.warn('init: no languageDetector is used and no lng is defined');\n }\n const storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];\n storeApi.forEach(fcName => {\n this[fcName] = (...args) => this.store[fcName](...args);\n });\n const storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];\n storeApiChained.forEach(fcName => {\n this[fcName] = (...args) => {\n this.store[fcName](...args);\n return this;\n };\n });\n const deferred = defer();\n const load = () => {\n const finish = (err, t) => {\n this.isInitializing = false;\n if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn('init: i18next is already initialized. You should call init just once!');\n this.isInitialized = true;\n if (!this.options.isClone) this.logger.log('initialized', this.options);\n this.emit('initialized', this.options);\n deferred.resolve(t);\n callback(err, t);\n };\n if (this.languages && !this.isInitialized) return finish(null, this.t.bind(this));\n this.changeLanguage(this.options.lng, finish);\n };\n if (this.options.resources || !this.options.initAsync) {\n load();\n } else {\n setTimeout(load, 0);\n }\n return deferred;\n }\n loadResources(language, callback = noop) {\n let usedCallback = callback;\n const usedLng = isString(language) ? language : this.language;\n if (typeof language === 'function') usedCallback = language;\n if (!this.options.resources || this.options.partialBundledLanguages) {\n if (usedLng?.toLowerCase() === 'cimode' && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();\n const toLoad = [];\n const append = lng => {\n if (!lng) return;\n if (lng === 'cimode') return;\n const lngs = this.services.languageUtils.toResolveHierarchy(lng);\n lngs.forEach(l => {\n if (l === 'cimode') return;\n if (toLoad.indexOf(l) < 0) toLoad.push(l);\n });\n };\n if (!usedLng) {\n const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);\n fallbacks.forEach(l => append(l));\n } else {\n append(usedLng);\n }\n this.options.preload?.forEach?.(l => append(l));\n this.services.backendConnector.load(toLoad, this.options.ns, e => {\n if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);\n usedCallback(e);\n });\n } else {\n usedCallback(null);\n }\n }\n reloadResources(lngs, ns, callback) {\n const deferred = defer();\n if (typeof lngs === 'function') {\n callback = lngs;\n lngs = undefined;\n }\n if (typeof ns === 'function') {\n callback = ns;\n ns = undefined;\n }\n if (!lngs) lngs = this.languages;\n if (!ns) ns = this.options.ns;\n if (!callback) callback = noop;\n this.services.backendConnector.reload(lngs, ns, err => {\n deferred.resolve();\n callback(err);\n });\n return deferred;\n }\n use(module) {\n if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');\n if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');\n if (module.type === 'backend') {\n this.modules.backend = module;\n }\n if (module.type === 'logger' || module.log && module.warn && module.error) {\n this.modules.logger = module;\n }\n if (module.type === 'languageDetector') {\n this.modules.languageDetector = module;\n }\n if (module.type === 'i18nFormat') {\n this.modules.i18nFormat = module;\n }\n if (module.type === 'postProcessor') {\n postProcessor.addPostProcessor(module);\n }\n if (module.type === 'formatter') {\n this.modules.formatter = module;\n }\n if (module.type === '3rdParty') {\n this.modules.external.push(module);\n }\n return this;\n }\n setResolvedLanguage(l) {\n if (!l || !this.languages) return;\n if (['cimode', 'dev'].indexOf(l) > -1) return;\n for (let li = 0; li < this.languages.length; li++) {\n const lngInLngs = this.languages[li];\n if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;\n if (this.store.hasLanguageSomeTranslations(lngInLngs)) {\n this.resolvedLanguage = lngInLngs;\n break;\n }\n }\n if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {\n this.resolvedLanguage = l;\n this.languages.unshift(l);\n }\n }\n changeLanguage(lng, callback) {\n this.isLanguageChangingTo = lng;\n const deferred = defer();\n this.emit('languageChanging', lng);\n const setLngProps = l => {\n this.language = l;\n this.languages = this.services.languageUtils.toResolveHierarchy(l);\n this.resolvedLanguage = undefined;\n this.setResolvedLanguage(l);\n };\n const done = (err, l) => {\n if (l) {\n if (this.isLanguageChangingTo === lng) {\n setLngProps(l);\n this.translator.changeLanguage(l);\n this.isLanguageChangingTo = undefined;\n this.emit('languageChanged', l);\n this.logger.log('languageChanged', l);\n }\n } else {\n this.isLanguageChangingTo = undefined;\n }\n deferred.resolve((...args) => this.t(...args));\n if (callback) callback(err, (...args) => this.t(...args));\n };\n const setLng = lngs => {\n if (!lng && !lngs && this.services.languageDetector) lngs = [];\n const fl = isString(lngs) ? lngs : lngs && lngs[0];\n const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);\n if (l) {\n if (!this.language) {\n setLngProps(l);\n }\n if (!this.translator.language) this.translator.changeLanguage(l);\n this.services.languageDetector?.cacheUserLanguage?.(l);\n }\n this.loadResources(l, err => {\n done(err, l);\n });\n };\n if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {\n setLng(this.services.languageDetector.detect());\n } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {\n if (this.services.languageDetector.detect.length === 0) {\n this.services.languageDetector.detect().then(setLng);\n } else {\n this.services.languageDetector.detect(setLng);\n }\n } else {\n setLng(lng);\n }\n return deferred;\n }\n getFixedT(lng, ns, keyPrefix) {\n const fixedT = (key, opts, ...rest) => {\n let o;\n if (typeof opts !== 'object') {\n o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));\n } else {\n o = {\n ...opts\n };\n }\n o.lng = o.lng || fixedT.lng;\n o.lngs = o.lngs || fixedT.lngs;\n o.ns = o.ns || fixedT.ns;\n if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;\n const keySeparator = this.options.keySeparator || '.';\n let resultKey;\n if (o.keyPrefix && Array.isArray(key)) {\n resultKey = key.map(k => {\n if (typeof k === 'function') k = keysFromSelector(k, {\n ...this.options,\n ...opts\n });\n return `${o.keyPrefix}${keySeparator}${k}`;\n });\n } else {\n if (typeof key === 'function') key = keysFromSelector(key, {\n ...this.options,\n ...opts\n });\n resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;\n }\n return this.t(resultKey, o);\n };\n if (isString(lng)) {\n fixedT.lng = lng;\n } else {\n fixedT.lngs = lng;\n }\n fixedT.ns = ns;\n fixedT.keyPrefix = keyPrefix;\n return fixedT;\n }\n t(...args) {\n return this.translator?.translate(...args);\n }\n exists(...args) {\n return this.translator?.exists(...args);\n }\n setDefaultNamespace(ns) {\n this.options.defaultNS = ns;\n }\n hasLoadedNamespace(ns, options = {}) {\n if (!this.isInitialized) {\n this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);\n return false;\n }\n if (!this.languages || !this.languages.length) {\n this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);\n return false;\n }\n const lng = options.lng || this.resolvedLanguage || this.languages[0];\n const fallbackLng = this.options ? this.options.fallbackLng : false;\n const lastLng = this.languages[this.languages.length - 1];\n if (lng.toLowerCase() === 'cimode') return true;\n const loadNotPending = (l, n) => {\n const loadState = this.services.backendConnector.state[`${l}|${n}`];\n return loadState === -1 || loadState === 0 || loadState === 2;\n };\n if (options.precheck) {\n const preResult = options.precheck(this, loadNotPending);\n if (preResult !== undefined) return preResult;\n }\n if (this.hasResourceBundle(lng, ns)) return true;\n if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;\n if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;\n return false;\n }\n loadNamespaces(ns, callback) {\n const deferred = defer();\n if (!this.options.ns) {\n if (callback) callback();\n return Promise.resolve();\n }\n if (isString(ns)) ns = [ns];\n ns.forEach(n => {\n if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);\n });\n this.loadResources(err => {\n deferred.resolve();\n if (callback) callback(err);\n });\n return deferred;\n }\n loadLanguages(lngs, callback) {\n const deferred = defer();\n if (isString(lngs)) lngs = [lngs];\n const preloaded = this.options.preload || [];\n const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));\n if (!newLngs.length) {\n if (callback) callback();\n return Promise.resolve();\n }\n this.options.preload = preloaded.concat(newLngs);\n this.loadResources(err => {\n deferred.resolve();\n if (callback) callback(err);\n });\n return deferred;\n }\n dir(lng) {\n if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);\n if (!lng) return 'rtl';\n try {\n const l = new Intl.Locale(lng);\n if (l && l.getTextInfo) {\n const ti = l.getTextInfo();\n if (ti && ti.direction) return ti.direction;\n }\n } catch (e) {}\n const rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam', 'ckb'];\n const languageUtils = this.services?.languageUtils || new LanguageUtil(get());\n if (lng.toLowerCase().indexOf('-latn') > 1) return 'ltr';\n return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';\n }\n static createInstance(options = {}, callback) {\n const instance = new I18n(options, callback);\n instance.createInstance = I18n.createInstance;\n return instance;\n }\n cloneInstance(options = {}, callback = noop) {\n const forkResourceStore = options.forkResourceStore;\n if (forkResourceStore) delete options.forkResourceStore;\n const mergedOptions = {\n ...this.options,\n ...options,\n ...{\n isClone: true\n }\n };\n const clone = new I18n(mergedOptions);\n if (options.debug !== undefined || options.prefix !== undefined) {\n clone.logger = clone.logger.clone(options);\n }\n const membersToCopy = ['store', 'services', 'language'];\n membersToCopy.forEach(m => {\n clone[m] = this[m];\n });\n clone.services = {\n ...this.services\n };\n clone.services.utils = {\n hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)\n };\n if (forkResourceStore) {\n const clonedData = Object.keys(this.store.data).reduce((prev, l) => {\n prev[l] = {\n ...this.store.data[l]\n };\n prev[l] = Object.keys(prev[l]).reduce((acc, n) => {\n acc[n] = {\n ...prev[l][n]\n };\n return acc;\n }, prev[l]);\n return prev;\n }, {});\n clone.store = new ResourceStore(clonedData, mergedOptions);\n clone.services.resourceStore = clone.store;\n }\n if (options.interpolation) clone.services.interpolator = new Interpolator(mergedOptions);\n clone.translator = new Translator(clone.services, mergedOptions);\n clone.translator.on('*', (event, ...args) => {\n clone.emit(event, ...args);\n });\n clone.init(mergedOptions, callback);\n clone.translator.options = mergedOptions;\n clone.translator.backendConnector.services.utils = {\n hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)\n };\n return clone;\n }\n toJSON() {\n return {\n options: this.options,\n store: this.store,\n language: this.language,\n languages: this.languages,\n resolvedLanguage: this.resolvedLanguage\n };\n }\n}\nconst instance = I18n.createInstance();\n\nconst createInstance = instance.createInstance;\nconst dir = instance.dir;\nconst init = instance.init;\nconst loadResources = instance.loadResources;\nconst reloadResources = instance.reloadResources;\nconst use = instance.use;\nconst changeLanguage = instance.changeLanguage;\nconst getFixedT = instance.getFixedT;\nconst t = instance.t;\nconst exists = instance.exists;\nconst setDefaultNamespace = instance.setDefaultNamespace;\nconst hasLoadedNamespace = instance.hasLoadedNamespace;\nconst loadNamespaces = instance.loadNamespaces;\nconst loadLanguages = instance.loadLanguages;\n\nexport { changeLanguage, createInstance, instance as default, dir, exists, getFixedT, hasLoadedNamespace, init, keysFromSelector as keyFromSelector, loadLanguages, loadNamespaces, loadResources, reloadResources, setDefaultNamespace, t, use };\n","export default {\n Check: {\n lengthOfStringForPriceOrWeightMustBeExactly: \"Length {{length, number}} of string for price or weight must be 4 or 5\",\n priceOrWeightComponent: \"price or weight\",\n lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo: \"Length {{length, number}} of string for check character pair must be less than or equal to {{maximumLength, number}}\"\n },\n Identifier: {\n identifierTypeLength: \"{{identifierType}} must be {{length, number}} digits long\",\n invalidCheckDigit: \"Invalid check digit\",\n invalidGTINLength: \"GTIN must be 13, 12, 8, or 14 digits long\",\n invalidGTIN14Length: \"GTIN must be 14 digits long\",\n invalidZeroSuppressedGTIN12: \"Invalid zero-suppressed GTIN-12\",\n invalidZeroSuppressibleGTIN12: \"GTIN-12 not zero-suppressible\",\n invalidZeroSuppressedGTIN12AsGTIN13: \"Invalid zero-suppressed GTIN-12 as GTIN-13\",\n invalidZeroSuppressedGTIN12AsGTIN14: \"Invalid zero-suppressed GTIN-12 as GTIN-14\",\n invalidGTIN13AtRetail: \"GTIN-13 at retail consumer trade item level can't start with zero\",\n invalidGTINAtRetail: \"GTIN not supported at retail consumer trade item level\",\n invalidGTINAtOtherThanRetail: \"GTIN not supported at other than retail consumer trade item level\",\n invalidRCNLength: \"RCN length must match format length\",\n invalidVariableMeasureRCNFormat: \"Invalid variable measure RCN format\",\n invalidVariableMeasureRCNPrefix: \"Invalid variable measure RCN prefix\",\n invalidVariableMeasurePriceOrWeight: \"Invalid variable measure price or weight\",\n indicatorDigit: \"indicator digit\",\n serialComponent: \"serial component\",\n reference: \"reference\",\n referenceCantBeAllNumeric: \"Reference can't be all-numeric\",\n invalidCheckCharacterPair: \"Invalid check character pair\"\n },\n Prefix: {\n gs1CompanyPrefix: \"GS1 Company Prefix\",\n upcCompanyPrefix: \"U.P.C. Company Prefix\",\n gs18Prefix: \"GS1-8 Prefix\",\n invalidPrefixType: \"Invalid prefix type\",\n gs1CompanyPrefixCantStartWith0: \"GS1 Company Prefix can't start with \\\"0\\\"\",\n gs1CompanyPrefixCantStartWith00000: \"GS1 Company Prefix can't start with \\\"00000\\\"\",\n gs1CompanyPrefixCantStartWith000000: \"GS1 Company Prefix can't start with \\\"000000\\\"\",\n upcCompanyPrefixCantStartWith0000: \"U.P.C. Company Prefix can't start with \\\"0000\\\"\",\n gs18PrefixCantStartWith0: \"GS1-8 Prefix can't start with \\\"0\\\"\",\n identifierTypeNotSupportedByGS18Prefix: \"{{identifierType}} not supported by GS1-8 Prefix\"\n }\n} as const;\n","export default {\n Check: {\n lengthOfStringForPriceOrWeightMustBeExactly: \"La longueur {{length, number}} de la chaîne pour le prix ou le poids doit être 4 ou 5\",\n priceOrWeightComponent: \"prix ou poids\",\n lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo: \"La longueur {{length, number}} de la chaîne pour la paire de caractères de vérification doit être inférieure ou égale à {{maximumLength, number}}\"\n },\n Identifier: {\n identifierTypeLength: \"{{identifierType}} doit comporter {{length, number}} chiffres\",\n invalidCheckDigit: \"Chiffre de contrôle non valide\",\n invalidGTINLength: \"Le GTIN doit comporter 13, 12, 8 ou 14 chiffres\",\n invalidGTIN14Length: \"Le GTIN doit comporter 14 chiffres\",\n invalidZeroSuppressedGTIN12: \"Code GTIN-12 non valide avec zéro supprimé\",\n invalidZeroSuppressibleGTIN12: \"Le GTIN-12 ne peut pas être supprimé par zéro\",\n invalidZeroSuppressedGTIN12AsGTIN13: \"GTIN-12 non valide avec zéro supprimé en tant que GTIN-13\",\n invalidZeroSuppressedGTIN12AsGTIN14: \"GTIN-12 non valide avec zéro supprimé en tant que GTIN-14\",\n invalidGTIN13AtRetail: \"Le GTIN-13 au niveau des articles de consommation au détail ne peut pas commencer par zéro\",\n invalidGTINAtRetail: \"Le GTIN n'est pas pris en charge au niveau des articles de consommation au détail\",\n invalidGTINAtOtherThanRetail: \"Le GTIN n'est pas pris en charge à d'autres niveaux que ceux des articles de consommation au détail\",\n invalidRCNLength: \"La longueur du RCN doit correspondre à la longueur du format\",\n invalidVariableMeasureRCNFormat: \"Format RCN de mesure variable non valide\",\n invalidVariableMeasureRCNPrefix: \"Préfixe RCN de mesure variable non valide\",\n invalidVariableMeasurePriceOrWeight: \"Mesure variable invalide : prix ou poids\",\n indicatorDigit: \"chiffre indicateur\",\n serialComponent: \"composant série\",\n reference: \"référence\",\n referenceCantBeAllNumeric: \"La référence ne peut pas être entièrement numérique\",\n invalidCheckCharacterPair: \"Paire de caractères de contrôle non valide\"\n },\n Prefix: {\n gs1CompanyPrefix: \"Préfixe de l'entreprise GS1\",\n upcCompanyPrefix: \"Préfixe de l'entreprise U.P.C.\",\n gs18Prefix: \"Préfixe GS1-8\",\n invalidPrefixType: \"Type de préfixe invalide\",\n gs1CompanyPrefixCantStartWith0: \"Le préfixe de l'entreprise GS1 ne peut pas commencer par \\\"0\\\"\",\n gs1CompanyPrefixCantStartWith00000: \"Le préfixe de l'entreprise GS1 ne peut pas commencer par \\\"00000\\\"\",\n gs1CompanyPrefixCantStartWith000000: \"Le préfixe de l'entreprise GS1 ne peut pas commencer par \\\"000000\\\"\",\n upcCompanyPrefixCantStartWith0000: \"Le préfixe de l'entreprise U.P.C. ne peut pas commencer par \\\"0000\\\"\",\n gs18PrefixCantStartWith0: \"Le préfixe GS1-8 ne peut pas commencer par \\\"0\\\"\",\n identifierTypeNotSupportedByGS18Prefix: \"{{identifierType}} non pris en charge par le préfixe GS1-8\"\n }\n} as const;\n","import { CharacterSetCreator, CharacterSetValidator, Exclusions } from \"@aidc-toolkit/utility\";\n\n/**\n * GS1 AI encodable character set 82 creator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs | GS1\n * General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.\n */\nexport const AI82_CREATOR = new CharacterSetCreator([\n \"!\", \"\\\"\", \"%\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \"-\", \".\", \"/\",\n \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\",\n \":\", \";\", \"<\", \"=\", \">\", \"?\",\n \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\",\n \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\",\n \"_\",\n \"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\",\n \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"\n], Exclusions.AllNumeric);\n\n/**\n * GS1 AI encodable character set 82 validator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs |\n * GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.\n */\nexport const AI82_VALIDATOR = AI82_CREATOR as CharacterSetValidator;\n\n/**\n * GS1 AI encodable character set 39 creator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs | GS1\n * General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.\n */\nexport const AI39_CREATOR = new CharacterSetCreator([\n \"#\", \"-\", \"/\",\n \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\",\n \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\",\n \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\"\n], Exclusions.AllNumeric);\n\n/**\n * GS1 AI encodable character set 39 validator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs |\n * GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.\n */\nexport const AI39_VALIDATOR = AI39_CREATOR as CharacterSetValidator;\n\n/**\n * GS1 AI encodable character set 64 validator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs |\n * GS1 General Specifications}. Doesn't support any exclusions.\n */\nexport const AI64_VALIDATOR = new CharacterSetValidator([\n \"-\",\n \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\",\n \"=\",\n \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\",\n \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\",\n \"_\",\n \"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\",\n \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"\n]);\n","import { NUMERIC_CREATOR, utilityNS } from \"@aidc-toolkit/utility\";\nimport { AI82_CREATOR } from \"./character-set\";\nimport { i18nextGS1 } from \"./locale/i18n\";\n\n/**\n * Results of multiplying digits by 3.\n */\nconst THREE_WEIGHT_RESULTS: readonly number[] = [\n 0, 3, 6, 9, 12, 15, 18, 21, 24, 27\n];\n\n/**\n * Results of multiplying digits by 2, subtracting tens digit, and extracting units digit.\n */\nconst TWO_MINUS_WEIGHT_RESULTS: readonly number[] = [\n 0, 2, 4, 6, 8, 9, 1, 3, 5, 7\n];\n\n/**\n * Results of multiplying digits by 5, adding tens digit, and extracting units digit.\n */\nconst FIVE_PLUS_WEIGHT_RESULTS: readonly number[] = [\n 0, 5, 1, 6, 2, 7, 3, 8, 4, 9\n];\n\n/**\n * Results of multiplying digits by 5, subtracting tens digit, and extracting units digit.\n */\nconst FIVE_MINUS_WEIGHT_RESULTS: readonly number[] = [\n 0, 5, 9, 4, 8, 3, 7, 2, 6, 1\n];\n\n/**\n * Inverse mapping of FIVE_MINUS_WEIGHT_RESULTS.\n */\nconst INVERSE_FIVE_MINUS_WEIGHT_RESULTS: readonly number[] = [\n 0, 9, 7, 5, 3, 1, 8, 6, 4, 2\n];\n\n/**\n * Calculate the check digit sum for a numeric string as per section 7.9.1 of the {@link https://www.gs1.org/genspecs |\n * GS1 General Specifications}.\n *\n * @param exchangeWeights\n * If true, start the weights at 1 instead of 3 on the right.\n *\n * @param s\n * Numeric string.\n *\n * @returns\n * Accumulated sum of each digit multiplied by the weight at its position.\n */\nexport function checkDigitSum(exchangeWeights: boolean, s: string): number {\n // Initial setting will be the opposite of that used for first character because it gets flipped before being used.\n let weight3 = (s.length + Number(exchangeWeights)) % 2 === 0;\n\n // Calculate sum of each character value multiplied by the weight at its position.\n return NUMERIC_CREATOR.characterIndexes(s).reduce<number>((accumulator, characterIndex, index) => {\n if (characterIndex === undefined) {\n throw new RangeError(i18nextGS1.t(\"CharacterSetValidator.invalidCharacterAtPosition\", {\n ns: utilityNS,\n c: s.charAt(index),\n position: index + 1\n }));\n }\n\n weight3 = !weight3;\n\n return accumulator + (weight3 ? THREE_WEIGHT_RESULTS[characterIndex] : characterIndex);\n }, 0);\n}\n\n/**\n * Calculate the check digit for a numeric string as per section 7.9.1 of the {@link https://www.gs1.org/genspecs | GS1\n * General Specifications}.\n *\n * @param s\n * Numeric string.\n *\n * @returns\n * Check digit 0-9 as a string.\n */\nexport function checkDigit(s: string): string {\n // Check digit is the difference from the equal or next of multiple of 10.\n return NUMERIC_CREATOR.character(9 - (checkDigitSum(false, s) + 9) % 10);\n}\n\n/**\n * Determine if a numeric string has a valid check digit.\n *\n * @param s\n * Numeric string with check digit.\n *\n * @returns\n * True if the check digit is valid.\n */\nexport function hasValidCheckDigit(s: string): boolean {\n // Check digit is valid if the check digit sum with the weights exchanged is a multiple of 10.\n return checkDigitSum(true, s) % 10 === 0;\n}\n\n/**\n * Calculate the price or weight sum for a numeric string.\n *\n * @param weightsResults\n * Array of weight results arrays to apply to each digit.\n *\n * @param s\n * Numeric string the same length as the weightsResults array.\n *\n * @returns\n * Accumulated sum of the weight result for each digit at the digit's position.\n */\nfunction priceOrWeightSum(weightsResults: ReadonlyArray<readonly number[]>, s: string): number {\n // Calculate sum of each weight result for each digit at its position.\n return NUMERIC_CREATOR.characterIndexes(s).reduce<number>((accumulator, characterIndex, index) => {\n if (characterIndex === undefined) {\n throw new RangeError(i18nextGS1.t(\"CharacterSetValidator.invalidCharacterAtPositionOfComponent\", {\n ns: utilityNS,\n c: s.charAt(index),\n position: index + 1,\n component: i18nextGS1.t(\"Check.priceOrWeightComponent\")\n }));\n }\n\n // Add the weight result of the character index to the accumulator.\n return accumulator + weightsResults[index][characterIndex];\n }, 0);\n}\n\n/**\n * Calculate the price or weight check digit for a four-or five-digit numeric string as per section 7.9.3 of the {@link\n * https://www.gs1.org/genspecs | GS1 General Specifications}.\n *\n * @param s\n * Numeric string exactly four or five characters long.\n *\n * @returns\n * Check digit 0-9 as a string.\n */\nexport function priceOrWeightCheckDigit(s: string): string {\n let checkDigit: string;\n\n switch (s.length) {\n case 4:\n checkDigit = NUMERIC_CREATOR.character(priceOrWeightSum([TWO_MINUS_WEIGHT_RESULTS, TWO_MINUS_WEIGHT_RESULTS, THREE_WEIGHT_RESULTS, FIVE_MINUS_WEIGHT_RESULTS], s) * 3 % 10);\n break;\n\n case 5:\n checkDigit = NUMERIC_CREATOR.character(INVERSE_FIVE_MINUS_WEIGHT_RESULTS[9 - (priceOrWeightSum([FIVE_PLUS_WEIGHT_RESULTS, TWO_MINUS_WEIGHT_RESULTS, FIVE_MINUS_WEIGHT_RESULTS, FIVE_PLUS_WEIGHT_RESULTS, TWO_MINUS_WEIGHT_RESULTS], s) + 9) % 10]);\n break;\n\n default:\n throw new RangeError(i18nextGS1.t(\"Check.lengthOfStringForPriceOrWeightMustBeExactly\", {\n length: s.length\n }));\n }\n\n return checkDigit;\n}\n\n/**\n * Determine if a price or weight check digit is valid for numeric string.\n *\n * @param s\n * Numeric string exactly four or five characters long.\n *\n * @param checkDigit\n * Price or weight check digit.\n *\n * @returns\n * True if the check digit is valid.\n */\nexport function isValidPriceOrWeightCheckDigit(s: string, checkDigit: string): boolean {\n return priceOrWeightCheckDigit(s) === checkDigit;\n}\n\n/**\n * Weights for check character pair calculation.\n */\nconst CHECK_CHARACTER_WEIGHTS = [\n 107, 103, 101, 97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2\n];\n\n/**\n * Characters used to build check character pair.\n */\nconst CHECK_CHARACTERS = [\n \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\",\n \"J\", \"K\", \"L\", \"M\", \"N\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\"\n];\n\n/**\n * Calculate the check character for a GS1 AI encodable character set 82 string as per section 7.9.5 of the {@link\n * https://www.gs1.org/genspecs | GS1 General Specifications}.\n *\n * @param s\n * GS1 AI encodable character set 82 string.\n *\n * @returns\n * Check character pair.\n */\nexport function checkCharacterPair(s: string): string {\n // Weights are applied from right to left.\n const weightIndexStart = CHECK_CHARACTER_WEIGHTS.length - s.length;\n\n if (weightIndexStart < 0) {\n throw new RangeError(i18nextGS1.t(\"Check.lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo\", {\n length: s.length,\n maximumLength: CHECK_CHARACTER_WEIGHTS.length\n }));\n }\n\n // Calculate sum of each character value multiplied by the weight at its position, mod 1021.\n const checkCharacterPairSum = AI82_CREATOR.characterIndexes(s).reduce<number>((accumulator, characterIndex, index) => {\n if (characterIndex === undefined) {\n throw new RangeError(i18nextGS1.t(\"CharacterSetValidator.invalidCharacterAtPosition\", {\n ns: utilityNS,\n c: s.charAt(index),\n position: index + 1\n }));\n }\n\n return accumulator + characterIndex * CHECK_CHARACTER_WEIGHTS[weightIndexStart + index];\n }, 0) % 1021;\n\n const checkCharacterPairSumMod32 = checkCharacterPairSum % 32;\n\n // Check character pair is the concatenation of the character at position sum div 32 and the character at the position sum mod 32.\n return CHECK_CHARACTERS[(checkCharacterPairSum - checkCharacterPairSumMod32) / 32] + CHECK_CHARACTERS[checkCharacterPairSumMod32];\n}\n\n/**\n * Determine if a GS1 AI encodable character set 82 string has a valid check character pair.\n *\n * @param s\n * GS1 AI encodable character set 82 string with check character pair.\n *\n * @returns\n * True if the check character pair is valid.\n */\nexport function hasValidCheckCharacterPair(s: string): boolean {\n const checkCharacterPairIndex = s.length - 2;\n\n return checkCharacterPair(s.substring(0, checkCharacterPairIndex)) === s.substring(checkCharacterPairIndex);\n}\n","/**\n * Prefix types.\n */\nexport const PrefixTypes = {\n /**\n * GS1 Company Prefix.\n */\n GS1CompanyPrefix: \"GS1 Company Prefix\",\n\n /**\n * U.P.C. Company Prefix.\n */\n UPCCompanyPrefix: \"U.P.C. Company Prefix\",\n\n /**\n * GS1-8 Prefix.\n */\n GS18Prefix: \"GS1-8 Prefix\"\n} as const;\n\n/**\n * Prefix type.\n */\nexport type PrefixType = typeof PrefixTypes[keyof typeof PrefixTypes];\n","import { type CharacterSetValidation, NUMERIC_CREATOR } from \"@aidc-toolkit/utility\";\nimport { i18nextGS1 } from \"./locale/i18n\";\nimport { type PrefixType, PrefixTypes } from \"./prefix-type\";\n\n/**\n * Prefix validation parameters.\n */\nexport interface PrefixValidation extends CharacterSetValidation {\n /**\n * Minimum length.\n */\n minimumLength: number;\n\n /**\n * Maximum length.\n */\n maximumLength: number;\n\n /**\n * Callback to localized prefix type name.\n */\n component: () => string;\n}\n\n/**\n * GS1 Company Prefix minimum length.\n */\nconst GS1_COMPANY_PREFIX_MINIMUM_LENGTH = 4;\n\n/**\n * GS1 Company Prefix maximum length.\n */\nconst GS1_COMPANY_PREFIX_MAXIMUM_LENGTH = 12;\n\n/**\n * U.P.C. Company Prefix minimum length.\n */\nconst UPC_COMPANY_PREFIX_MINIMUM_LENGTH = 6;\n\n/**\n * U.P.C. Company Prefix maximum length.\n */\nconst UPC_COMPANY_PREFIX_MAXIMUM_LENGTH = 11;\n\n/**\n * GS1-8 Prefix minimum length.\n */\nconst GS1_8_PREFIX_MINIMUM_LENGTH = 2;\n\n/**\n * GS1-8 Prefix maximum length.\n */\nconst GS1_8_PREFIX_MAXIMUM_LENGTH = 7;\n\n/**\n * Validation parameters for GS1 Company Prefix.\n */\nconst GS1_COMPANY_PREFIX_VALIDATION: Readonly<PrefixValidation> = {\n minimumLength: GS1_COMPANY_PREFIX_MINIMUM_LENGTH,\n maximumLength: GS1_COMPANY_PREFIX_MAXIMUM_LENGTH,\n component: () => i18nextGS1.t(\"Prefix.gs1CompanyPrefix\")\n};\n\n/**\n * Validation parameters for U.P.C. Company Prefix expressed as GS1 Company Prefix.\n */\nconst UPC_COMPANY_PREFIX_AS_GS1_COMPANY_PREFIX_VALIDATION: Readonly<PrefixValidation> = {\n minimumLength: UPC_COMPANY_PREFIX_MINIMUM_LENGTH + 1,\n maximumLength: UPC_COMPANY_PREFIX_MAXIMUM_LENGTH + 1,\n component: () => i18nextGS1.t(\"Prefix.gs1CompanyPrefix\")\n};\n\n/**\n * Validation parameters for GS1-8 Prefix expressed as GS1 Company Prefix.\n */\nconst GS1_8_PREFIX_AS_GS1_COMPANY_PREFIX_VALIDATION: Readonly<PrefixValidation> = {\n minimumLength: GS1_8_PREFIX_MINIMUM_LENGTH + 5,\n maximumLength: GS1_8_PREFIX_MAXIMUM_LENGTH + 5,\n component: () => i18nextGS1.t(\"Prefix.gs1CompanyPrefix\")\n};\n\n/**\n * Validation parameters for U.P.C. Company Prefix.\n */\nconst UPC_COMPANY_PREFIX_VALIDATION: Readonly<PrefixValidation> = {\n minimumLength: UPC_COMPANY_PREFIX_MINIMUM_LENGTH,\n maximumLength: UPC_COMPANY_PREFIX_MAXIMUM_LENGTH,\n component: () => i18nextGS1.t(\"Prefix.upcCompanyPrefix\")\n};\n\n/**\n * Validation parameters for GS1-8 Prefix.\n */\nconst GS1_8_PREFIX_VALIDATION: Readonly<PrefixValidation> = {\n minimumLength: GS1_8_PREFIX_MINIMUM_LENGTH,\n maximumLength: GS1_8_PREFIX_MAXIMUM_LENGTH,\n component: () => i18nextGS1.t(\"Prefix.gs18Prefix\")\n};\n\n/**\n * Validate a prefix.\n *\n * @param prefixType\n * Prefix type.\n *\n * @param allowUPCCompanyPrefix\n * If true, a U.P.C. Company Prefix expressed as a GS1 Company Prefix is permitted.\n *\n * @param allowGS18Prefix\n * If true, a GS1-8 Prefix expressed as a GS1 Company Prefix is permitted.\n *\n * @param prefix\n * Prefix.\n *\n * @param isFromIdentifier\n * If true, the prefix is from an identifier and should be trimmed before its character set is validated.\n *\n * @param isNumericIdentifier\n * If true, the prefix is from a numeric identifier and its character set will be validated by the caller.\n *\n * @param positionOffset\n * Position offset within a larger string.\n */\nfunction validate(prefixType: PrefixType, allowUPCCompanyPrefix: boolean, allowGS18Prefix: boolean, prefix: string, isFromIdentifier = false, isNumericIdentifier = false, positionOffset?: number): void {\n let baseValidation: PrefixValidation;\n\n // Validate the prefix type and determine the prefix validation parameters.\n switch (prefixType) {\n case PrefixTypes.GS1CompanyPrefix:\n if (!prefix.startsWith(\"0\")) {\n baseValidation = GS1_COMPANY_PREFIX_VALIDATION;\n } else if (!prefix.startsWith(\"00000\")) {\n if (!allowUPCCompanyPrefix) {\n throw new RangeError(i18nextGS1.t(\"Prefix.gs1CompanyPrefixCantStartWith0\"));\n }\n\n baseValidation = UPC_COMPANY_PREFIX_AS_GS1_COMPANY_PREFIX_VALIDATION;\n } else if (!prefix.startsWith(\"000000\")) {\n if (!allowGS18Prefix) {\n throw new RangeError(i18nextGS1.t(\"Prefix.gs1CompanyPrefixCantStartWith00000\"));\n }\n\n baseValidation = GS1_8_PREFIX_AS_GS1_COMPANY_PREFIX_VALIDATION;\n } else {\n throw new RangeError(i18nextGS1.t(\"Prefix.gs1CompanyPrefixCantStartWith000000\"));\n }\n break;\n\n case PrefixTypes.UPCCompanyPrefix:\n if (prefix.startsWith(\"0000\")) {\n throw new RangeError(i18nextGS1.t(\"Prefix.upcCompanyPrefixCantStartWith0000\"));\n }\n\n baseValidation = UPC_COMPANY_PREFIX_VALIDATION;\n break;\n\n case PrefixTypes.GS18Prefix:\n if (prefix.startsWith(\"0\")) {\n throw new RangeError(i18nextGS1.t(\"Prefix.gs18PrefixCantStartWith0\"));\n }\n\n baseValidation = GS1_8_PREFIX_VALIDATION;\n break;\n }\n\n const mergedValidation: PrefixValidation = {\n ...baseValidation,\n positionOffset\n };\n\n // If from key and numeric, key validation will take care of character set validation.\n if (!isFromIdentifier) {\n NUMERIC_CREATOR.validate(prefix, mergedValidation);\n } else if (!isNumericIdentifier) {\n // Validate only the minimum length, allowing at least one character for the (possibly non-numeric) reference.\n NUMERIC_CREATOR.validate(prefix.substring(0, Math.min(mergedValidation.minimumLength, prefix.length - 1)), mergedValidation);\n }\n}\n\n/**\n * Prefix validator.\n */\nexport const PrefixValidator = {\n GS1_COMPANY_PREFIX_MINIMUM_LENGTH,\n GS1_COMPANY_PREFIX_MAXIMUM_LENGTH,\n UPC_COMPANY_PREFIX_MINIMUM_LENGTH,\n UPC_COMPANY_PREFIX_MAXIMUM_LENGTH,\n GS1_8_PREFIX_MINIMUM_LENGTH,\n GS1_8_PREFIX_MAXIMUM_LENGTH,\n validate\n} as const;\n","/**\n * Identifier types.\n */\nexport const IdentifierTypes = {\n /**\n * Global Trade Item Number.\n */\n GTIN: \"GTIN\",\n\n /**\n * Global Location Number.\n */\n GLN: \"GLN\",\n\n /**\n * Serial Shipping Container Code.\n */\n SSCC: \"SSCC\",\n\n /**\n * Global Returnable Asset Identifier.\n */\n GRAI: \"GRAI\",\n\n /**\n * Global Individual Asset Identifier.\n */\n GIAI: \"GIAI\",\n\n /**\n * Global Service Relation Number.\n */\n GSRN: \"GSRN\",\n\n /**\n * Global Document Type Identifier.\n */\n GDTI: \"GDTI\",\n\n /**\n * Global Identification Number for Consignment.\n */\n GINC: \"GINC\",\n\n /**\n * Global Shipment Identification Number.\n */\n GSIN: \"GSIN\",\n\n /**\n * Global Coupon Number.\n */\n GCN: \"GCN\",\n\n /**\n * Component/Part Identifier.\n */\n CPID: \"CPID\",\n\n /**\n * Global Model Number.\n */\n GMN: \"GMN\"\n} as const;\n\n/**\n * Identifier type.\n */\nexport type IdentifierType = typeof IdentifierTypes[keyof typeof IdentifierTypes];\n","import {\n type CharacterSetCreator,\n NUMERIC_CREATOR,\n type StringValidation,\n type StringValidator\n} from \"@aidc-toolkit/utility\";\nimport { AI39_CREATOR, AI82_CREATOR } from \"./character-set\";\nimport type { IdentifierType } from \"./identifier-type\";\nimport type { PrefixType } from \"./prefix-type\";\nimport { PrefixValidator } from \"./prefix-validator\";\n\n/**\n * Character sets supported by the reference portion of an identifier or the serial component of a numeric identifier.\n */\nexport const ContentCharacterSets = {\n /**\n * Numeric.\n */\n Numeric: \"Numeric\",\n\n /**\n * GS1 AI encodable character set 82.\n */\n AI82: \"AI82\",\n\n /**\n * GS1 AI encodable character set 39.\n */\n AI39: \"AI39\"\n} as const;\n\n/**\n * Content character set.\n */\nexport type ContentCharacterSet = typeof ContentCharacterSets[keyof typeof ContentCharacterSets];\n\n/**\n * Identifier validation parameters.\n */\nexport interface IdentifierValidation extends StringValidation {\n /**\n * Position offset within a larger string. Strings are sometimes composed of multiple substrings; this parameter\n * ensures that the error notes the proper position in the string.\n */\n positionOffset?: number | undefined;\n}\n\n/**\n * Identifier validator. Validates an identifier against its definition in section 3 of the {@link\n * https://www.gs1.org/genspecs | GS1 General Specifications}.\n *\n * @template TIdentifierValidation\n * Identifier validation type.\n */\nexport interface IdentifierValidator<TIdentifierValidation extends IdentifierValidation = IdentifierValidation> extends StringValidator<TIdentifierValidation> {\n /**\n * Get the identifier type. Per the GS1 General Specifications, the identifier type determines the remaining\n * properties.\n */\n get identifierType(): IdentifierType;\n\n /**\n * Get the prefix type supported by the identifier type. For all identifier types except the GTIN, this is\n * {@linkcode PrefixTypes.GS1CompanyPrefix}. For the GTIN, the prefix type determines the length.\n */\n get prefixType(): PrefixType;\n\n /**\n * Get the length. For numeric identifier types, the length is fixed; for alphanumeric identifier types, the length\n * is the maximum.\n */\n get length(): number;\n\n /**\n * Get the reference character set.\n */\n get referenceCharacterSet(): ContentCharacterSet;\n\n /**\n * Get the reference creator.\n */\n get referenceCreator(): CharacterSetCreator;\n\n /**\n * Validate an identifier and throw an error if validation fails.\n *\n * @param identifier\n * Identifier.\n *\n * @param validation\n * Identifier validation parameters.\n */\n validate: (identifier: string, validation?: TIdentifierValidation) => void;\n}\n\n/**\n * Abstract identifier validator. Implements common functionality for an identifier validator.\n */\nexport abstract class AbstractIdentifierValidator<TIdentifierValidation extends IdentifierValidation = IdentifierValidation> implements IdentifierValidator<TIdentifierValidation> {\n private static readonly CHARACTER_SET_CREATORS: Record<ContentCharacterSet, CharacterSetCreator> = {\n [ContentCharacterSets.Numeric]: NUMERIC_CREATOR,\n [ContentCharacterSets.AI82]: AI82_CREATOR,\n [ContentCharacterSets.AI39]: AI39_CREATOR\n };\n\n /**\n * Identifier type.\n */\n private readonly _identifierType: IdentifierType;\n\n /**\n * Prefix type.\n */\n private readonly _prefixType: PrefixType;\n\n /**\n * Length.\n */\n private readonly _length: number;\n\n /**\n * Reference character set.\n */\n private readonly _referenceCharacterSet: ContentCharacterSet;\n\n /**\n * Reference creator.\n */\n private readonly _referenceCreator: CharacterSetCreator;\n\n /**\n * Get the character set creator for a character set.\n *\n * @param characterSet\n * Character set.\n *\n * @returns\n * Character set creator.\n */\n protected static creatorFor(characterSet: ContentCharacterSet): CharacterSetCreator {\n return AbstractIdentifierValidator.CHARACTER_SET_CREATORS[characterSet];\n }\n\n /**\n * Constructor.\n *\n * @param identifierType\n * Identifier type.\n *\n * @param prefixType\n * Prefix type.\n *\n * @param length\n * Length.\n *\n * @param referenceCharacterSet\n * Reference character set.\n */\n protected constructor(identifierType: IdentifierType, prefixType: PrefixType, length: number, referenceCharacterSet: ContentCharacterSet) {\n this._identifierType = identifierType;\n this._prefixType = prefixType;\n this._length = length;\n this._referenceCharacterSet = referenceCharacterSet;\n this._referenceCreator = AbstractIdentifierValidator.creatorFor(referenceCharacterSet);\n }\n\n /**\n * @inheritDoc\n */\n get identifierType(): IdentifierType {\n return this._identifierType;\n }\n\n /**\n * @inheritDoc\n */\n get prefixType(): PrefixType {\n return this._prefixType;\n }\n\n /**\n * @inheritDoc\n */\n get length(): number {\n return this._length;\n }\n\n /**\n * @inheritDoc\n */\n get referenceCharacterSet(): ContentCharacterSet {\n return this._referenceCharacterSet;\n }\n\n /**\n * @inheritDoc\n */\n get referenceCreator(): CharacterSetCreator {\n return this._referenceCreator;\n }\n\n /**\n * Pad an identifier on the left with zero-value character for validation purposes. This is done to align an\n * identifier with a position offset for any error message that may be thrown by the reference validator.\n *\n * @param identifier\n * Identifier.\n *\n * @param validation\n * Identifier validation parameters.\n *\n * @returns\n * Padded identifier.\n */\n protected padIdentifier(identifier: string, validation: IdentifierValidation | undefined): string {\n // Identifier is returned as is if position offset is undefined.\n return validation?.positionOffset === undefined ? identifier : this.referenceCreator.character(0).repeat(validation.positionOffset).concat(identifier);\n }\n\n /**\n * Validate the prefix within an identifier.\n *\n * @param partialIdentifier\n * Partial identifier.\n *\n * @param positionOffset\n * Position offset within a larger string.\n */\n protected validatePrefix(partialIdentifier: string, positionOffset?: number): void {\n // Delegate to prefix validator with support for U.P.C. Company Prefix but not GS1-8 Prefix.\n PrefixValidator.validate(this.prefixType, true, false, partialIdentifier, true, this.referenceCharacterSet === ContentCharacterSets.Numeric, positionOffset);\n }\n\n abstract validate(identifier: string, validation?: TIdentifierValidation): void;\n}\n","import { hasValidCheckDigit } from \"./check\";\nimport type { IdentifierType, IdentifierTypes } from \"./identifier-type\";\nimport {\n AbstractIdentifierValidator,\n ContentCharacterSets,\n type IdentifierValidation,\n type IdentifierValidator\n} from \"./identifier-validator\";\nimport { i18nextGS1 } from \"./locale/i18n\";\nimport type { PrefixType } from \"./prefix-type\";\n\n/**\n * Numeric identifier type.\n */\nexport type NumericIdentifierType =\n typeof IdentifierTypes.GTIN |\n typeof IdentifierTypes.GLN |\n typeof IdentifierTypes.SSCC |\n typeof IdentifierTypes.GRAI |\n typeof IdentifierTypes.GSRN |\n typeof IdentifierTypes.GDTI |\n typeof IdentifierTypes.GSIN |\n typeof IdentifierTypes.GCN;\n\n/**\n * Leader type.\n */\nexport const LeaderTypes = {\n /**\n * No leader.\n */\n None: \"None\",\n\n /**\n * Indicator digit (GTIN only).\n */\n IndicatorDigit: \"Indicator digit\",\n\n /**\n * Extension digit (SSCC only).\n */\n ExtensionDigit: \"Extension digit\"\n};\n\n/**\n * Leader type.\n */\nexport type LeaderType = typeof LeaderTypes[keyof typeof LeaderTypes];\n\n/**\n * Numeric identifier validator. Validates a numeric identifier.\n */\nexport interface NumericIdentifierValidator extends IdentifierValidator {\n /**\n * Get the leader type.\n */\n get leaderType(): LeaderType;\n}\n\n/**\n * Abstract numeric identifier validator. Implements common functionality for a numeric identifier\n * validator.\n */\nexport abstract class AbstractNumericIdentifierValidator extends AbstractIdentifierValidator implements NumericIdentifierValidator {\n /**\n * Leader type.\n */\n private readonly _leaderType: LeaderType;\n\n /**\n * Prefix position, determined by the leader type.\n */\n private readonly _prefixPosition: number;\n\n /**\n * Constructor.\n *\n * @param identifierType\n * Identifier type.\n *\n * @param prefixType\n * Prefix type.\n *\n * @param length\n * Length.\n *\n * @param leaderType\n * Leader type.\n */\n protected constructor(identifierType: IdentifierType, prefixType: PrefixType, length: number, leaderType: LeaderType) {\n super(identifierType, prefixType, length, ContentCharacterSets.Numeric);\n\n this._leaderType = leaderType;\n this._prefixPosition = Number(this.leaderType === LeaderTypes.ExtensionDigit);\n }\n\n /**\n * @inheritDoc\n */\n get leaderType(): LeaderType {\n return this._leaderType;\n }\n\n /**\n * @inheritDoc\n */\n validate(identifier: string, validation?: IdentifierValidation): void {\n // Validate the prefix, with care taken for its position within the identifier.\n if (this._prefixPosition === 0) {\n super.validatePrefix(identifier, validation?.positionOffset);\n } else {\n super.validatePrefix(identifier.substring(this._prefixPosition), validation?.positionOffset === undefined ? this._prefixPosition : validation.positionOffset + this._prefixPosition);\n }\n\n // Validate the length.\n if (identifier.length !== this.length) {\n throw new RangeError(i18nextGS1.t(\"Identifier.identifierTypeLength\", {\n identifierType: this.identifierType,\n length: this.length\n }));\n }\n\n // Validating the check digit will also validate the characters.\n if (!hasValidCheckDigit(this.padIdentifier(identifier, validation))) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidCheckDigit\"));\n }\n }\n}\n","import { type CharacterSetValidation, NUMERIC_CREATOR } from \"@aidc-toolkit/utility\";\nimport { checkDigit, hasValidCheckDigit, isValidPriceOrWeightCheckDigit } from \"./check\";\nimport { IdentifierTypes } from \"./identifier-type\";\nimport { i18nextGS1 } from \"./locale/i18n\";\nimport { AbstractNumericIdentifierValidator, LeaderTypes } from \"./numeric-identifier-validator\";\nimport { type PrefixType, PrefixTypes } from \"./prefix-type\";\nimport { PrefixValidator } from \"./prefix-validator\";\n\n/**\n * GTIN types. The numeric values are equal to the lengths of the GTIN types.\n */\nexport const GTINTypes = {\n /**\n * GTIN-13.\n */\n GTIN13: 13,\n\n /**\n * GTIN-12.\n */\n GTIN12: 12,\n\n /**\n * GTIN-8.\n */\n GTIN8: 8,\n\n /**\n * GTIN-14.\n */\n GTIN14: 14\n} as const;\n\n/**\n * GTIN type.\n */\nexport type GTINType = typeof GTINTypes[keyof typeof GTINTypes];\n\n/**\n * Levels at which GTIN is to be validated.\n */\nexport const GTINLevels = {\n /**\n * Any level (level is ignored).\n */\n Any: 0,\n\n /**\n * Retail consumer trade item level, supporting GTIN-13, GTIN-12 (optionally zero-suppressed), and GTIN-8.\n */\n RetailConsumer: 1,\n\n /**\n * Other than retail consumer trade item level, supporting GTIN-13, GTIN-12 (not zero-suppressed), and GTIN-14.\n */\n OtherThanRetailConsumer: 2\n} as const;\n\n/**\n * GTIN level.\n */\nexport type GTINLevel = typeof GTINLevels[keyof typeof GTINLevels];\n\n/**\n * Restricted Circulation Number reference.\n */\nexport interface RCNReference {\n /**\n * Item reference.\n */\n itemReference: number;\n\n /**\n * Price or weight (whole number only).\n */\n priceOrWeight: number;\n}\n\n/**\n * GTIN validator.\n */\nexport class GTINValidator extends AbstractNumericIdentifierValidator {\n /**\n * Validation parameters for optional indicator digit.\n */\n private static readonly OPTIONAL_INDICATOR_DIGIT_VALIDATION: CharacterSetValidation = {\n minimumLength: 0,\n maximumLength: 1,\n component: () => i18nextGS1.t(\"Identifier.indicatorDigit\")\n };\n\n /**\n * Validation parameters for zero-suppressed GTIN-12.\n */\n private static readonly ZERO_SUPPRESSED_GTIN12_VALIDATION: CharacterSetValidation = {\n minimumLength: 8,\n maximumLength: 8\n };\n\n /**\n * Constructor.\n *\n * @param gtinType\n * GTIN type.\n */\n constructor(gtinType: GTINType) {\n let prefixType: PrefixType;\n\n // Determine the prefix type based on the GTIN type.\n switch (gtinType) {\n case GTINTypes.GTIN13:\n prefixType = PrefixTypes.GS1CompanyPrefix;\n break;\n\n case GTINTypes.GTIN12:\n prefixType = PrefixTypes.UPCCompanyPrefix;\n break;\n\n case GTINTypes.GTIN8:\n prefixType = PrefixTypes.GS18Prefix;\n break;\n\n default:\n // Should never get here.\n throw new Error(\"Not supported\");\n }\n\n super(IdentifierTypes.GTIN, prefixType, gtinType, LeaderTypes.IndicatorDigit);\n }\n\n /**\n * @inheritDoc\n */\n get gtinType(): GTINType {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Length maps to GTIN type.\n return this.length as GTINType;\n }\n\n /**\n * @inheritDoc\n */\n protected override validatePrefix(partialIdentifier: string, positionOffset?: number): void {\n // Delegate to prefix validator requiring exact match for prefix type.\n PrefixValidator.validate(this.prefixType, false, false, partialIdentifier, true, true, positionOffset);\n }\n\n /**\n * Zero suppress a GTIN-12.\n *\n * @param gtin12\n * GTIN-12.\n *\n * @returns\n * Zero-suppressed GTIN-12.\n */\n static zeroSuppress(gtin12: string): string {\n GTIN12_VALIDATOR.validate(gtin12);\n\n // Convert to individual digits.\n const d = Array.from(gtin12);\n\n let zeroSuppressedGTIN12: string | undefined;\n\n // All rules require that digits in positions 1, 5, and 6 be zero.\n if (d[0] === \"0\" && d[6] === \"0\" && d[7] === \"0\") {\n if (d[10] >= \"5\" && d[8] === \"0\" && d[9] === \"0\" && d[5] !== \"0\") {\n zeroSuppressedGTIN12 = `0${d[1]}${d[2]}${d[3]}${d[4]}${d[5]}${d[10]}${d[11]}`;\n } else if (d[5] === \"0\" && d[8] === \"0\" && d[9] === \"0\" && d[4] !== \"0\") {\n zeroSuppressedGTIN12 = `0${d[1]}${d[2]}${d[3]}${d[4]}${d[10]}4${d[11]}`;\n } else if (d[3] <= \"2\" && d[4] === \"0\" && d[5] === \"0\") {\n zeroSuppressedGTIN12 = `0${d[1]}${d[2]}${d[8]}${d[9]}${d[10]}${d[3]}${d[11]}`;\n } else if (d[3] >= \"3\" && d[4] === \"0\" && d[5] === \"0\" && d[8] === \"0\") {\n zeroSuppressedGTIN12 = `0${d[1]}${d[2]}${d[3]}${d[9]}${d[10]}3${d[11]}`;\n }\n }\n\n if (zeroSuppressedGTIN12 === undefined) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidZeroSuppressibleGTIN12\"));\n }\n\n return zeroSuppressedGTIN12;\n }\n\n /**\n * Zero expand a zero-suppressed GTIN-12.\n *\n * @param zeroSuppressedGTIN12\n * Zero-suppressed GTIN-12.\n *\n * @returns\n * GTIN-12.\n */\n static zeroExpand(zeroSuppressedGTIN12: string): string {\n NUMERIC_CREATOR.validate(zeroSuppressedGTIN12, GTINValidator.ZERO_SUPPRESSED_GTIN12_VALIDATION);\n\n // Convert to individual digits.\n const d = Array.from(zeroSuppressedGTIN12);\n\n let gtin12: string | undefined;\n\n // Zero-suppressed GTIN-12 always starts with 0.\n if (d[0] === \"0\") {\n if (d[6] >= \"5\" && d[5] !== \"0\") {\n gtin12 = `0${d[1]}${d[2]}${d[3]}${d[4]}${d[5]}0000${d[6]}${d[7]}`;\n } else if (d[6] === \"4\" && d[4] !== \"0\") {\n gtin12 = `0${d[1]}${d[2]}${d[3]}${d[4]}00000${d[5]}${d[7]}`;\n } else if (d[6] <= \"2\") {\n gtin12 = `0${d[1]}${d[2]}${d[6]}0000${d[3]}${d[4]}${d[5]}${d[7]}`;\n } else if (d[6] === \"3\" && d[3] >= \"3\") {\n gtin12 = `0${d[1]}${d[2]}${d[3]}00000${d[4]}${d[5]}${d[7]}`;\n }\n }\n\n if (gtin12 === undefined) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidZeroSuppressedGTIN12\"));\n }\n\n // Make sure that resulting GTIN-12 is valid.\n GTIN12_VALIDATOR.validate(gtin12);\n\n return gtin12;\n }\n\n /**\n * Convert a GTIN of any length to a GTIN-14 with an optional indicator digit.\n *\n * @param indicatorDigit\n * Indicator digit. If blank, assumes \"0\" if the GTIN is not already a GTIN-14.\n *\n * @param gtin\n * GTIN.\n *\n * @returns\n * GTIN-14.\n */\n static convertToGTIN14(indicatorDigit: string, gtin: string): string {\n GTINValidator.validateAny(gtin);\n\n NUMERIC_CREATOR.validate(indicatorDigit, GTINValidator.OPTIONAL_INDICATOR_DIGIT_VALIDATION);\n\n // Check digit doesn't change by prepending zeros.\n let gtin14 = gtin.padStart(GTINTypes.GTIN14, \"0\");\n\n // If indicator digit provided and is different, recalculate the check digit.\n if (indicatorDigit.length !== 0 && indicatorDigit !== gtin14.charAt(0)) {\n const partialGTIN14 = indicatorDigit + gtin14.substring(1, GTINTypes.GTIN14 - 1);\n\n gtin14 = partialGTIN14 + checkDigit(partialGTIN14);\n }\n\n return gtin14;\n }\n\n /**\n * Normalize a GTIN of any length.\n * - A GTIN-14 that starts with six zeros or a GTIN-13 that starts with five zeros is normalized to GTIN-8.\n * - A GTIN-14 that starts with two zeros or a GTIN-13 that starts with one zero is normalized to GTIN-12.\n * - A GTIN-14 that starts with one zero is normalized to GTIN-13.\n * - Otherwise, the GTIN is unchanged.\n *\n * @param gtin\n * GTIN.\n *\n * @returns\n * Normalized GTIN.\n */\n static normalize(gtin: string): string {\n const gtinLength = gtin.length;\n\n let normalizedGTIN: string;\n\n switch (gtinLength) {\n case GTINTypes.GTIN13 as number:\n if (!gtin.startsWith(\"0\")) {\n // GTIN is GTIN-13.\n normalizedGTIN = gtin;\n } else if (!gtin.startsWith(\"00000\")) {\n // GTIN is GTIN-12.\n normalizedGTIN = gtin.substring(1);\n } else if (!gtin.startsWith(\"000000\")) {\n // GTIN is GTIN-8.\n normalizedGTIN = gtin.substring(5);\n } else {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidZeroSuppressedGTIN12AsGTIN13\"));\n }\n break;\n\n case GTINTypes.GTIN12 as number:\n // GTIN is GTIN-12.\n normalizedGTIN = gtin;\n break;\n\n case GTINTypes.GTIN8 as number:\n if (!gtin.startsWith(\"0\")) {\n // GTIN is GTIN-8.\n normalizedGTIN = gtin;\n } else {\n // GTIN is zero-suppressed GTIN-12.\n normalizedGTIN = GTINValidator.zeroExpand(gtin);\n }\n break;\n\n case GTINTypes.GTIN14 as number:\n if (!gtin.startsWith(\"0\")) {\n // GTIN is GTIN-14.\n normalizedGTIN = gtin;\n } else if (!gtin.startsWith(\"00\")) {\n // GTIN is GTIN-13.\n normalizedGTIN = gtin.substring(1);\n } else if (!gtin.startsWith(\"000000\")) {\n // GTIN is GTIN-12.\n normalizedGTIN = gtin.substring(2);\n } else if (!gtin.startsWith(\"0000000\")) {\n // GTIN is GTIN-8.\n normalizedGTIN = gtin.substring(6);\n } else {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidZeroSuppressedGTIN12AsGTIN14\"));\n }\n break;\n\n default:\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidGTINLength\"));\n }\n\n // Validation applies to the normalized GTIN.\n GTINValidator.validateAny(normalizedGTIN);\n\n return normalizedGTIN;\n }\n\n /**\n * Validate any GTIN, optionally against a level.\n *\n * @param gtin\n * GTIN.\n *\n * @param gtinLevel\n * Level at which GTIN is to be validated.\n */\n static validateAny(gtin: string, gtinLevel: GTINLevel = GTINLevels.Any): void {\n // Assume length-validated GTIN is the GTIN (true for all except zero-suppressed GTIN-12).\n let lengthValidatedGTIN = gtin;\n\n let gtinLevelRestriction: GTINLevel;\n\n switch (gtin.length) {\n case GTINTypes.GTIN13 as number:\n if (gtin.startsWith(\"0\")) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidGTIN13AtRetail\"));\n }\n\n // Validate prefix requiring exact match for prefix type.\n PrefixValidator.validate(PrefixTypes.GS1CompanyPrefix, false, false, gtin, true, true);\n\n gtinLevelRestriction = GTINLevels.Any;\n break;\n\n case GTINTypes.GTIN12 as number:\n // Validate prefix requiring exact match for prefix type.\n PrefixValidator.validate(PrefixTypes.UPCCompanyPrefix, false, false, gtin, true, true);\n\n gtinLevelRestriction = GTINLevels.Any;\n break;\n\n case GTINTypes.GTIN8 as number:\n // Zero-suppressed GTIN-12 always starts with 0.\n if (!gtin.startsWith(\"0\")) {\n // Validate prefix requiring exact match for prefix type.\n PrefixValidator.validate(PrefixTypes.GS18Prefix, false, false, gtin, true, true);\n } else {\n lengthValidatedGTIN = GTINValidator.zeroExpand(gtin);\n }\n\n gtinLevelRestriction = GTINLevels.RetailConsumer;\n break;\n\n case GTINTypes.GTIN14 as number:\n // Validate prefix supporting any prefix type.\n PrefixValidator.validate(PrefixTypes.GS1CompanyPrefix, true, true, gtin.substring(1), true, true);\n\n gtinLevelRestriction = GTINLevels.OtherThanRetailConsumer;\n break;\n\n default:\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidGTINLength\"));\n }\n\n // Validating the check digit will also validate the characters.\n if (!hasValidCheckDigit(lengthValidatedGTIN)) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidCheckDigit\"));\n }\n\n // Validate against level if required.\n if (gtinLevel !== GTINLevels.Any && gtinLevelRestriction !== GTINLevels.Any && gtinLevelRestriction !== gtinLevel) {\n throw new RangeError(i18nextGS1.t(gtinLevel === GTINLevels.RetailConsumer ? \"Identifier.invalidGTINAtRetail\" : \"Identifier.invalidGTINAtOtherThanRetail\"));\n }\n }\n\n /**\n * Validate a GTIN-14.\n *\n * @param gtin14\n * GTIN-14.\n */\n static validateGTIN14(gtin14: string): void {\n if (gtin14.length !== GTINTypes.GTIN14) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidGTIN14Length\"));\n }\n\n GTINValidator.validateAny(gtin14);\n }\n\n /**\n * Parse a Restricted Circulation Number (RCN) using a variable measure trade item format. The format is a 12- or\n * 13-character string (for RCN-12 or RCN-13 respectively), containing the following:\n *\n * - '2' - The first character of the RCN.\n * - '0'-'9' - The second character of the RCN (RCN-13 only).\n * - 'I' - One or more, in sequence, for the item reference.\n * - 'P' - One or more, in sequence, for the price or weight.\n * - 'V' - Zero or one, for the price or weight check digit.\n * - 'C' - The check digit of the entire RCN.\n *\n * The 'I', 'P', and 'V' formats may be in any order.\n *\n * Some examples:\n *\n * - 2IIIIIVPPPPC - RCN-12 with a five-digit item reference, a price or weight check digit, and a four-digit price\n * or weight.\n * - 23IIIIVPPPPPC - RCN-13 with a four-digit item reference, a price or weight check digit, and a five-digit price\n * or weight.\n * - 2IIIIIIPPPPC - RCN-12 with a six-digit item reference and a four-digit price or eight.\n * - 29IIIIIPPPPPC - RCN-13 with a five-digit item reference and a five-digit price or weight.\n *\n * @param format\n * Format.\n *\n * @param rcn\n * RCN.\n *\n * @returns\n * RCN reference.\n */\n static parseVariableMeasureRCN(format: string, rcn: string): RCNReference {\n const formatLength = format.length;\n\n if (rcn.length !== formatLength) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidRCNLength\"));\n }\n\n let validFormat = formatLength === 12 || formatLength === 13;\n let validRCNPrefix = true;\n\n let buildingItemReference = false;\n let itemReference = \"\";\n\n let buildingPriceOrWeight = false;\n let priceOrWeight = \"\";\n\n let priceOrWeightCheckDigit = \"\";\n\n for (let index = 0; validFormat && index < formatLength; index++) {\n const formatChar = format.charAt(index);\n const rcnChar = rcn.charAt(index);\n\n if (index === 0) {\n validFormat = formatChar === \"2\";\n validRCNPrefix = rcnChar === \"2\";\n } else if (formatLength === 13 && index === 1) {\n validFormat = NUMERIC_CREATOR.characterIndex(formatChar) !== undefined;\n validRCNPrefix = rcnChar === formatChar;\n } else if (index === formatLength - 1) {\n validFormat = formatChar === \"C\";\n } else {\n switch (formatChar) {\n case \"I\":\n if (!buildingItemReference) {\n // Item reference can't appear more than once.\n validFormat = itemReference === \"\";\n\n buildingItemReference = true;\n buildingPriceOrWeight = false;\n }\n\n itemReference += rcnChar;\n break;\n\n case \"P\":\n if (!buildingPriceOrWeight) {\n // Price or weight can't appear more than once.\n validFormat = priceOrWeight === \"\";\n\n buildingPriceOrWeight = true;\n buildingItemReference = false;\n }\n\n priceOrWeight += rcnChar;\n break;\n\n case \"V\":\n // Price or weight check digit can't appear more than once.\n validFormat = priceOrWeightCheckDigit === \"\";\n\n buildingItemReference = false;\n buildingPriceOrWeight = false;\n\n priceOrWeightCheckDigit = rcnChar;\n break;\n\n default:\n validFormat = false;\n break;\n }\n }\n }\n\n validFormat &&= itemReference !== \"\" && priceOrWeight !== \"\";\n\n if (!validFormat) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidVariableMeasureRCNFormat\"));\n }\n\n if (!validRCNPrefix) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidVariableMeasureRCNPrefix\"));\n }\n\n if (priceOrWeightCheckDigit !== \"\" && !isValidPriceOrWeightCheckDigit(priceOrWeight, priceOrWeightCheckDigit)) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidVariableMeasurePriceOrWeight\"));\n }\n\n if (!hasValidCheckDigit(rcn)) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidCheckDigit\"));\n }\n\n return {\n itemReference: Number(itemReference),\n priceOrWeight: Number(priceOrWeight)\n };\n }\n}\n\n/**\n * GTIN-13 validator.\n */\nexport const GTIN13_VALIDATOR = new GTINValidator(GTINTypes.GTIN13);\n\n/**\n * GTIN-12 validator.\n */\nexport const GTIN12_VALIDATOR = new GTINValidator(GTINTypes.GTIN12);\n\n/**\n * GTIN-8 validator.\n */\nexport const GTIN8_VALIDATOR = new GTINValidator(GTINTypes.GTIN8);\n\n/**\n * GTIN validators indexed by prefix type.\n */\nexport const GTIN_VALIDATORS: Record<PrefixType, GTINValidator> = {\n [PrefixTypes.GS1CompanyPrefix]: GTIN13_VALIDATOR,\n [PrefixTypes.UPCCompanyPrefix]: GTIN12_VALIDATOR,\n [PrefixTypes.GS18Prefix]: GTIN8_VALIDATOR\n};\n","import { type IdentifierType, IdentifierTypes } from \"./identifier-type\";\nimport {\n AbstractNumericIdentifierValidator,\n type LeaderType,\n LeaderTypes,\n type NumericIdentifierType\n} from \"./numeric-identifier-validator\";\nimport { PrefixTypes } from \"./prefix-type\";\n\n/**\n * Non-GTIN numeric identifier type.\n */\nexport type NonGTINNumericIdentifierType = Exclude<NumericIdentifierType, typeof IdentifierTypes.GTIN>;\n\n/**\n * Non-GTIN numeric identifier validator.\n */\nexport class NonGTINNumericIdentifierValidator extends AbstractNumericIdentifierValidator {\n /**\n * Constructor.\n *\n * @param identifierType\n * Identifier type.\n *\n * @param length\n * Length.\n *\n * @param leaderType\n * Leader type.\n */\n constructor(identifierType: IdentifierType, length: number, leaderType: LeaderType = LeaderTypes.None) {\n super(identifierType, PrefixTypes.GS1CompanyPrefix, length, leaderType);\n }\n}\n\n/**\n * GLN validator.\n */\nexport const GLN_VALIDATOR = new NonGTINNumericIdentifierValidator(IdentifierTypes.GLN, 13);\n\n/**\n * SSCC validator.\n */\nexport const SSCC_VALIDATOR = new NonGTINNumericIdentifierValidator(IdentifierTypes.SSCC, 18, LeaderTypes.ExtensionDigit);\n\n/**\n * GSRN validator.\n */\nexport const GSRN_VALIDATOR = new NonGTINNumericIdentifierValidator(IdentifierTypes.GSRN, 18);\n\n/**\n * GSIN validator.\n */\nexport const GSIN_VALIDATOR = new NonGTINNumericIdentifierValidator(IdentifierTypes.GSIN, 17);\n","import type { CharacterSetCreator, CharacterSetValidation } from \"@aidc-toolkit/utility\";\nimport { type IdentifierType, IdentifierTypes } from \"./identifier-type\";\nimport { type ContentCharacterSet, ContentCharacterSets, type IdentifierValidation } from \"./identifier-validator\";\nimport { i18nextGS1 } from \"./locale/i18n\";\nimport {\n type NonGTINNumericIdentifierType,\n NonGTINNumericIdentifierValidator\n} from \"./non-gtin-numeric-identifier-validator\";\nimport { LeaderTypes } from \"./numeric-identifier-validator\";\n\n/**\n * Serializable numeric identifier type.\n */\nexport type SerializableNumericIdentifierType = Exclude<NonGTINNumericIdentifierType, typeof IdentifierTypes.GLN | typeof IdentifierTypes.SSCC | typeof IdentifierTypes.GSRN | typeof IdentifierTypes.GSIN>;\n\n/**\n * Serializable numeric identifier validator. Validates both serialized and non-serialized forms of\n * numeric identifiers that support serialization.\n */\nexport class SerializableNumericIdentifierValidator extends NonGTINNumericIdentifierValidator {\n /**\n * Serial component length.\n */\n private readonly _serialComponentLength: number;\n\n /**\n * Serial component character set.\n */\n private readonly _serialComponentCharacterSet: ContentCharacterSet;\n\n /**\n * Serial component validation parameters.\n */\n private readonly _serialComponentValidation: CharacterSetValidation;\n\n /**\n * Serial component creator.\n */\n private readonly _serialComponentCreator: CharacterSetCreator;\n\n /**\n * Constructor.\n *\n * @param identifierType\n * Identifier type.\n *\n * @param length\n * Length.\n *\n * @param serialComponentLength\n * Serial component length.\n *\n * @param serialComponentCharacterSet\n * Serial component character set.\n */\n constructor(identifierType: IdentifierType, length: number, serialComponentLength: number, serialComponentCharacterSet: ContentCharacterSet) {\n super(identifierType, length, LeaderTypes.None);\n\n this._serialComponentLength = serialComponentLength;\n this._serialComponentCharacterSet = serialComponentCharacterSet;\n\n this._serialComponentValidation = {\n minimumLength: 1,\n maximumLength: serialComponentLength,\n component: () => i18nextGS1.t(\"Identifier.serialComponent\")\n };\n\n this._serialComponentCreator = SerializableNumericIdentifierValidator.creatorFor(serialComponentCharacterSet);\n }\n\n /**\n * Get the serial component length.\n */\n get serialComponentLength(): number {\n return this._serialComponentLength;\n }\n\n /**\n * Get the serial component character set.\n */\n get serialComponentCharacterSet(): ContentCharacterSet {\n return this._serialComponentCharacterSet;\n }\n\n /**\n * Get the serial component validation parameters.\n */\n protected get serialComponentValidation(): CharacterSetValidation {\n return this._serialComponentValidation;\n }\n\n /**\n * Get the serial component creator.\n */\n get serialComponentCreator(): CharacterSetCreator {\n return this._serialComponentCreator;\n }\n\n /**\n * @inheritDoc\n */\n override validate(identifier: string, validation?: IdentifierValidation): void {\n super.validate(identifier.substring(0, this.length), validation);\n\n if (identifier.length > this.length) {\n this.serialComponentCreator.validate(identifier.substring(this.length), this._serialComponentValidation);\n }\n }\n}\n\n/**\n * GRAI validator.\n */\nexport const GRAI_VALIDATOR = new SerializableNumericIdentifierValidator(IdentifierTypes.GRAI, 13, 16, ContentCharacterSets.AI82);\n\n/**\n * GDTI validator.\n */\nexport const GDTI_VALIDATOR = new SerializableNumericIdentifierValidator(IdentifierTypes.GDTI, 13, 17, ContentCharacterSets.AI82);\n\n/**\n * GCN validator.\n */\nexport const GCN_VALIDATOR = new SerializableNumericIdentifierValidator(IdentifierTypes.GCN, 13, 12, ContentCharacterSets.Numeric);\n","import { Exclusions, RegExpValidator } from \"@aidc-toolkit/utility\";\nimport { hasValidCheckCharacterPair } from \"./check\";\nimport { type IdentifierType, IdentifierTypes } from \"./identifier-type\";\nimport {\n AbstractIdentifierValidator,\n type ContentCharacterSet,\n ContentCharacterSets,\n type IdentifierValidation\n} from \"./identifier-validator\";\nimport { i18nextGS1 } from \"./locale/i18n\";\nimport type { NumericIdentifierType } from \"./numeric-identifier-validator\";\nimport { PrefixTypes } from \"./prefix-type\";\n\n/**\n * Non-numeric identifier type.\n */\nexport type NonNumericIdentifierType = Exclude<IdentifierType, NumericIdentifierType>;\n\n/**\n * Non-numeric identifier validation parameters.\n */\nexport interface NonNumericIdentifierValidation extends IdentifierValidation {\n /**\n * Exclusion support for reference. Prevents non-numeric identifier from being mistaken for numeric\n * identifier.\n */\n exclusion?: typeof Exclusions.None | typeof Exclusions.AllNumeric | undefined;\n}\n\n/**\n * Non-numeric identifier validator.\n */\nexport class NonNumericIdentifierValidator extends AbstractIdentifierValidator<NonNumericIdentifierValidation> {\n /**\n * Validator to ensure that an identifier (minus check character pair) is not all numeric.\n */\n private static readonly NOT_ALL_NUMERIC_VALIDATOR = new class extends RegExpValidator {\n /**\n * @inheritDoc\n */\n protected override createErrorMessage(_s: string): string {\n return i18nextGS1.t(\"Identifier.referenceCantBeAllNumeric\");\n }\n }(/\\D/);\n\n /**\n * True if the identifier requires a check character pair.\n */\n private readonly _requiresCheckCharacterPair: boolean;\n\n /**\n * Constructor.\n *\n * @param identifierType\n * Identifier type.\n *\n * @param length\n * Length.\n *\n * @param referenceCharacterSet\n * Reference character set.\n *\n * @param requiresCheckCharacterPair\n * True if the identifier requires a check character pair.\n */\n constructor(identifierType: IdentifierType, length: number, referenceCharacterSet: ContentCharacterSet, requiresCheckCharacterPair = false) {\n super(identifierType, PrefixTypes.GS1CompanyPrefix, length, referenceCharacterSet);\n\n this._requiresCheckCharacterPair = requiresCheckCharacterPair;\n }\n\n /**\n * Determine if the identifier requires a check character pair.\n */\n get requiresCheckCharacterPair(): boolean {\n return this._requiresCheckCharacterPair;\n }\n\n /**\n * Validate a non-numeric identifier and throw an error if validation fails.\n *\n * @param identifier\n * Identifier.\n *\n * @param validation\n * Validation parameters.\n */\n validate(identifier: string, validation?: NonNumericIdentifierValidation): void {\n const partialIdentifier = this.requiresCheckCharacterPair ? identifier.substring(0, identifier.length - 2) : identifier;\n\n super.validatePrefix(partialIdentifier, validation?.positionOffset);\n\n if (!this.requiresCheckCharacterPair) {\n this.referenceCreator.validate(identifier, {\n maximumLength: this.length,\n positionOffset: validation?.positionOffset\n });\n // Validating the check character pair will also validate the characters.\n } else if (!hasValidCheckCharacterPair(this.padIdentifier(identifier, validation))) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidCheckCharacterPair\"));\n }\n\n // Check for all-numeric identifier (minus check character pair) if excluded.\n if (validation?.exclusion === Exclusions.AllNumeric) {\n NonNumericIdentifierValidator.NOT_ALL_NUMERIC_VALIDATOR.validate(partialIdentifier);\n }\n }\n}\n\n/**\n * GIAI validator.\n */\nexport const GIAI_VALIDATOR = new NonNumericIdentifierValidator(IdentifierTypes.GIAI, 30, ContentCharacterSets.AI82);\n\n/**\n * GINC validator.\n */\nexport const GINC_VALIDATOR = new NonNumericIdentifierValidator(IdentifierTypes.GINC, 30, ContentCharacterSets.AI82);\n\n/**\n * CPID validator.\n */\nexport const CPID_VALIDATOR = new NonNumericIdentifierValidator(IdentifierTypes.CPID, 30, ContentCharacterSets.AI39);\n\n/**\n * GMN validator.\n */\nexport const GMN_VALIDATOR = new NonNumericIdentifierValidator(IdentifierTypes.GMN, 25, ContentCharacterSets.AI82, true);\n","import type { CharacterSetCreator } from \"@aidc-toolkit/utility\";\nimport type { IdentifierType } from \"./identifier-type\";\nimport type { ContentCharacterSet, IdentifierValidation, IdentifierValidator } from \"./identifier-validator\";\nimport type { PrefixProvider } from \"./prefix-provider\";\nimport type { PrefixType } from \"./prefix-type\";\n\n/**\n * Identifier creator. Creates an identifier based on its definition in section 3 of the {@link\n * https://www.gs1.org/genspecs | GS1 General Specifications}.\n *\n * Keys are created based on a prefix defined in a prefix manager to which the identifier creator is bound.\n */\nexport interface IdentifierCreator extends IdentifierValidator {\n /**\n * Get the prefix provider to which this identifier creator is bound.\n */\n get prefixProvider(): PrefixProvider;\n\n /**\n * Get the prefix, equivalent to calling {@linkcode PrefixProvider.prefix | prefixProvider.prefix} for a GTIN or\n * {@linkcode PrefixProvider.gs1CompanyPrefix | prefixProvider.gs1CompanyPrefix} for all other identifier types.\n */\n get prefix(): string;\n\n /**\n * Get the reference length.\n */\n get referenceLength(): number;\n}\n\n/**\n * Abstract identifier creator. Implements common functionality for an identifier creator, bound to a\n * {@link PrefixProvider}.\n */\nexport abstract class AbstractIdentifierCreator implements IdentifierCreator {\n /**\n * Prefix provider.\n */\n private _prefixProvider!: PrefixProvider;\n\n /**\n * Reference length.\n */\n private _referenceLength!: number;\n\n /**\n * Initialize the prefix manager. This method is in lieu of a constructor due to the mixin architecture.\n *\n * @param prefixProvider\n * Prefix provider.\n *\n * @param prefix\n * Prefix within prefix manager to use to calculate reference length.\n *\n * @param checkAllowance\n * Number of characters to allow for check digit or check character pair.\n */\n protected init(prefixProvider: PrefixProvider, prefix: string, checkAllowance: number): void {\n this._prefixProvider = prefixProvider;\n\n // Reference length allows for prefix and optionally check digit or check character pair.\n this._referenceLength = this.length - prefix.length - checkAllowance;\n }\n\n abstract get identifierType(): IdentifierType;\n\n abstract get prefixType(): PrefixType;\n\n abstract get length(): number;\n\n abstract get referenceCharacterSet(): ContentCharacterSet;\n\n abstract get referenceCreator(): CharacterSetCreator;\n\n /**\n * @inheritDoc\n */\n get prefixProvider(): PrefixProvider {\n return this._prefixProvider;\n }\n\n /**\n * @inheritDoc\n */\n get prefix(): string {\n return this.prefixProvider.gs1CompanyPrefix;\n }\n\n /**\n * @inheritDoc\n */\n get referenceLength(): number {\n return this._referenceLength;\n }\n\n abstract validate(identifier: string, validation?: IdentifierValidation): void;\n}\n","import {\n CharacterSetCreator,\n Exclusions,\n NUMERIC_CREATOR,\n type TransformerInput,\n type TransformerOutput\n} from \"@aidc-toolkit/utility\";\nimport { checkDigit, checkDigitSum } from \"./check\";\nimport { AbstractIdentifierCreator, type IdentifierCreator } from \"./identifier-creator\";\nimport { type LeaderType, LeaderTypes, type NumericIdentifierValidator } from \"./numeric-identifier-validator\";\nimport type { PrefixProvider } from \"./prefix-provider\";\n\n/**\n * Numeric identifier creator. Creates one or many numeric identifiers.\n */\nexport interface NumericIdentifierCreator extends NumericIdentifierValidator, IdentifierCreator {\n /**\n * Get the capacity (`10**referenceLength`).\n */\n get capacity(): number;\n\n /**\n * Create identifier(s) with reference(s) based on numeric value(s). The value(s) is/are converted to\n * references of the appropriate length using {@linkcode NUMERIC_CREATOR}.\n *\n * @template TTransformerInput\n * Transformer input type.\n *\n * @param valueOrValues\n * Numeric value(s).\n *\n * @param sparse\n * If true, the value(s) are mapped to a sparse sequence resistant to discovery. Default is false.\n *\n * @returns\n * Identifier(s).\n */\n create: <TTransformerInput extends TransformerInput<number | bigint>>(valueOrValues: TTransformerInput, sparse?: boolean) => TransformerOutput<TTransformerInput, string>;\n\n /**\n * Create all identifiers for the prefix from `0` to `capacity - 1`.\n *\n * The implementation creates the strings only as needed using an internal generator function. Although the result\n * is equivalent to calling `creator.create(new Sequence(0, creator.capacity))`, this method is significantly\n * faster.\n *\n * @returns\n * All identifiers for the prefix.\n */\n createAll: () => Iterable<string>;\n}\n\n/**\n * Abstract numeric identifier creator. Implements common functionality for a numeric identifier\n * creator.\n */\nexport abstract class AbstractNumericIdentifierCreator extends AbstractIdentifierCreator implements NumericIdentifierCreator {\n /**\n * Capacity.\n */\n private _capacity!: number;\n\n /**\n * Tweak for sparse creation.\n */\n private _tweak = 0n;\n\n /**\n * Initialize the prefix provider. This method is in lieu of a constructor due to the mixin architecture.\n *\n * @param prefixProvider\n * Prefix provider.\n *\n * @param prefix\n * Prefix within prefix manager to use to calculate reference length.\n */\n protected override init(prefixProvider: PrefixProvider, prefix: string): void {\n super.init(prefixProvider, prefix, 1);\n\n // Capacity is always in number range.\n this._capacity = Number(CharacterSetCreator.powerOf10(this.referenceLength));\n }\n\n abstract get leaderType(): LeaderType;\n\n /**\n * @inheritDoc\n */\n get capacity(): number {\n return this._capacity;\n }\n\n /**\n * Get the tweak for sparse creation.\n */\n get tweak(): bigint {\n return this._tweak;\n }\n\n /**\n * Set the tweak for sparse creation.\n */\n set tweak(value: bigint) {\n this._tweak = value;\n }\n\n /**\n * Build an identifier from a reference by merging it with the prefix and adding the check digit.\n *\n * @param reference\n * Identifier reference.\n *\n * @returns\n * Identifier.\n */\n private buildIdentifier(reference: string): string {\n const partialIdentifier = this.leaderType === LeaderTypes.ExtensionDigit ? reference.substring(0, 1) + this.prefix + reference.substring(1) : this.prefix + reference;\n\n return partialIdentifier + checkDigit(partialIdentifier);\n }\n\n /**\n * @inheritDoc\n */\n create<TTransformerInput extends TransformerInput<number | bigint>>(valueOrValues: TTransformerInput, sparse = false): TransformerOutput<TTransformerInput, string> {\n return NUMERIC_CREATOR.create(this.referenceLength, valueOrValues, Exclusions.None, sparse ? this.tweak : undefined, reference => this.buildIdentifier(reference));\n }\n\n /**\n * Create all identifiers from a partial identifier. Call is recursive until remaining reference\n * length is 0.\n *\n * @param partialIdentifier\n * Partial identifier. Initial value is `this.prefix`.\n *\n * @param remainingReferenceLength\n * Remaining reference length. Initial value is `this.referenceLength`.\n *\n * @param extensionWeight\n * If this value is not zero, the identifier has an extension digit, this call is setting it, and this value\n * is applied to the calculation of the check digit.\n *\n * @param weight\n * If the extension weight is zero, this value is applied to the calculation of the check digit.\n *\n * @param partialCheckDigitSum\n * Partial check digit sum for the partial identifier.\n *\n * @yields\n * Identifier.\n */\n private static * createAllPartial(partialIdentifier: string, remainingReferenceLength: number, extensionWeight: number, weight: number, partialCheckDigitSum: number): Generator<string> {\n if (remainingReferenceLength === 0) {\n // Finalize check digit calculation and append.\n yield partialIdentifier + NUMERIC_CREATOR.character(9 - (partialCheckDigitSum + 9) % 10);\n } else {\n const nextRemainingReferenceLength = remainingReferenceLength - 1;\n\n let nextPartialCheckDigitSum = partialCheckDigitSum;\n\n if (extensionWeight !== 0) {\n // Apply every digit to the extension digit.\n for (const c of NUMERIC_CREATOR.characterSet) {\n yield * AbstractNumericIdentifierCreator.createAllPartial(c + partialIdentifier, nextRemainingReferenceLength, 0, weight, nextPartialCheckDigitSum);\n\n nextPartialCheckDigitSum += extensionWeight;\n }\n } else {\n const nextWeight = 4 - weight;\n\n // Apply every digit to the current character in the identifier.\n for (const c of NUMERIC_CREATOR.characterSet) {\n yield * AbstractNumericIdentifierCreator.createAllPartial(partialIdentifier + c, nextRemainingReferenceLength, 0, nextWeight, nextPartialCheckDigitSum);\n\n nextPartialCheckDigitSum += weight;\n }\n }\n }\n }\n\n /**\n * @inheritDoc\n */\n createAll(): Iterable<string> {\n const hasExtensionDigit = this.leaderType === LeaderTypes.ExtensionDigit;\n const prefix = this.prefix;\n const length = this.length;\n const referenceLength = this.referenceLength;\n\n // Start weight is for reference excluding extension digit, which has its weight calculated separately.\n const startWeight = 3 - 2 * ((referenceLength + 1 - Number(hasExtensionDigit)) % 2);\n\n // Returning separate Iterable object makes iteration repeatable.\n return {\n [Symbol.iterator]() {\n return AbstractNumericIdentifierCreator.createAllPartial(prefix, referenceLength, hasExtensionDigit ? 3 - 2 * length % 2 : 0, startWeight, checkDigitSum(startWeight === 3, prefix));\n }\n };\n }\n}\n","import {\n type CharacterSetValidation,\n Exclusions,\n NUMERIC_CREATOR,\n type TransformerInput,\n type TransformerOutput\n} from \"@aidc-toolkit/utility\";\nimport { Mixin } from \"ts-mixer\";\nimport { checkDigit, priceOrWeightCheckDigit } from \"./check\";\nimport { type GTINType, GTINTypes, GTINValidator } from \"./gtin-validator\";\nimport { i18nextGS1 } from \"./locale/i18n\";\nimport { AbstractNumericIdentifierCreator } from \"./numeric-identifier-creator\";\nimport type { PrefixProvider } from \"./prefix-provider\";\n\n/**\n * GTIN creator. Applicable to GTIN-13, GTIN-12, and GTIN-8 types; no applicable to GTIN-14 type.\n */\nexport class GTINCreator extends Mixin(GTINValidator, AbstractNumericIdentifierCreator) {\n /**\n * Validation parameters for required indicator digit.\n */\n private static readonly REQUIRED_INDICATOR_DIGIT_VALIDATION: CharacterSetValidation = {\n minimumLength: 1,\n maximumLength: 1,\n component: () => i18nextGS1.t(\"Identifier.indicatorDigit\")\n };\n\n /**\n * Constructor. Typically called internally by a prefix manager but may be called by other code with another prefix\n * provider type.\n *\n * @param prefixProvider\n * Prefix provider.\n *\n * @param gtinType\n * GTIN type.\n */\n constructor(prefixProvider: PrefixProvider, gtinType: GTINType) {\n super(gtinType);\n\n this.init(prefixProvider, prefixProvider.prefix);\n }\n\n /**\n * @inheritDoc\n */\n override get prefix(): string {\n return this.prefixProvider.prefix;\n }\n\n /**\n * Create GTIN-14(s) with an indicator digit and reference(s) based on numeric value(s). The value(s) is/are\n * converted to reference(s) of the appropriate length using {@linkcode NUMERIC_CREATOR}.\n *\n * @template TTransformerInput\n * Transformer input type.\n *\n * @param indicatorDigit\n * Indicator digit.\n *\n * @param valueOrValues\n * Numeric value(s).\n *\n * @param sparse\n * If true, the value(s) is/are mapped to a sparse sequence resistant to discovery. Default is false.\n *\n * @returns\n * GTIN-14(s).\n */\n createGTIN14<TTransformerInput extends TransformerInput<number | bigint>>(indicatorDigit: string, valueOrValues: TTransformerInput, sparse = false): TransformerOutput<TTransformerInput, string> {\n NUMERIC_CREATOR.validate(indicatorDigit, GTINCreator.REQUIRED_INDICATOR_DIGIT_VALIDATION);\n\n return NUMERIC_CREATOR.create(GTINTypes.GTIN13 - this.prefixProvider.gs1CompanyPrefix.length - 1, valueOrValues, Exclusions.None, sparse ? this.tweak : undefined, (reference) => {\n const partialIdentifier = indicatorDigit + this.prefixProvider.gs1CompanyPrefix + reference;\n\n return partialIdentifier + checkDigit(partialIdentifier);\n });\n }\n\n /**\n * Create a Restricted Circulation Number (RCN) using a variable measure trade item format. See {@linkcode\n * GTINValidator.parseVariableMeasureRCN} for format details.\n *\n * @param format\n * Format.\n *\n * @param itemReference\n * Item reference.\n *\n * @param priceOrWeight\n * Price or weight (whole number only).\n *\n * @returns\n * RCN-12 or RCN-13.\n */\n static createVariableMeasureRCN(format: string, itemReference: number, priceOrWeight: number): string {\n const formatLength = format.length;\n\n let validFormat = formatLength === 12 || formatLength === 13;\n\n let rcnPrefix = \"\";\n\n let buildingItemReference = false;\n let itemReferenceString = \"\";\n let itemReferenceLength = 0;\n\n let buildingPriceOrWeight = false;\n let priceOrWeightString = \"\";\n let priceOrWeightLength = 0;\n\n let calculatePriceOrWeightCheckDigit = false;\n\n // RCN may be built in almost any order, so defer to builders that will be in ordered array.\n const rcnPrefixBuilder = (partialRCN: string): string => partialRCN + rcnPrefix;\n const itemReferenceBuilder = (partialRCN: string): string => partialRCN + itemReferenceString;\n const priceOrWeightBuilder = (partialRCN: string): string => partialRCN + priceOrWeightString;\n const priceOrWeightCheckDigitBuilder = (partialRCN: string): string => partialRCN + priceOrWeightCheckDigit(priceOrWeightString);\n const checkDigitBuilder = (partialRCN: string): string => partialRCN + checkDigit(partialRCN);\n\n const rcnBuilders = [rcnPrefixBuilder];\n\n for (let index = 0; validFormat && index < formatLength; index++) {\n const formatChar = format.charAt(index);\n\n if (index === 0) {\n validFormat = formatChar === \"2\";\n rcnPrefix = formatChar;\n } else if (formatLength === 13 && index === 1) {\n validFormat = NUMERIC_CREATOR.characterIndex(formatChar) !== undefined;\n rcnPrefix += formatChar;\n } else if (index === formatLength - 1) {\n validFormat = formatChar === \"C\";\n } else {\n switch (formatChar) {\n case \"I\":\n if (!buildingItemReference) {\n // Item reference can't appear more than once.\n validFormat = itemReferenceLength === 0;\n\n buildingItemReference = true;\n buildingPriceOrWeight = false;\n\n rcnBuilders.push(itemReferenceBuilder);\n }\n\n itemReferenceLength++;\n break;\n\n case \"P\":\n if (!buildingPriceOrWeight) {\n // Price or weight can't appear more than once.\n validFormat = priceOrWeightLength === 0;\n\n buildingPriceOrWeight = true;\n buildingItemReference = false;\n\n rcnBuilders.push(priceOrWeightBuilder);\n }\n\n priceOrWeightLength++;\n break;\n\n case \"V\":\n // Price or weight check digit can't appear more than once.\n validFormat = !calculatePriceOrWeightCheckDigit;\n\n buildingItemReference = false;\n buildingPriceOrWeight = false;\n\n calculatePriceOrWeightCheckDigit = true;\n\n rcnBuilders.push(priceOrWeightCheckDigitBuilder);\n break;\n\n default:\n validFormat = false;\n break;\n }\n }\n }\n\n validFormat &&= itemReferenceLength !== 0 && priceOrWeightLength !== 0;\n\n if (!validFormat) {\n throw new RangeError(i18nextGS1.t(\"Identifier.invalidVariableMeasureRCNFormat\"));\n }\n\n itemReferenceString = NUMERIC_CREATOR.create(itemReferenceLength, itemReference);\n priceOrWeightString = NUMERIC_CREATOR.create(priceOrWeightLength, priceOrWeight);\n\n rcnBuilders.push(checkDigitBuilder);\n\n return rcnBuilders.reduce((partialRCN, rcnBuilder) => rcnBuilder(partialRCN), \"\");\n }\n}\n","import { Mixin } from \"ts-mixer\";\nimport type { IdentifierType } from \"./identifier-type\";\nimport { NonGTINNumericIdentifierValidator } from \"./non-gtin-numeric-identifier-validator\";\nimport { AbstractNumericIdentifierCreator } from \"./numeric-identifier-creator\";\nimport { type LeaderType, LeaderTypes } from \"./numeric-identifier-validator\";\nimport type { PrefixProvider } from \"./prefix-provider\";\n\n/**\n * Non-GTIN numeric identifier creator.\n */\nexport class NonGTINNumericIdentifierCreator extends Mixin(NonGTINNumericIdentifierValidator, AbstractNumericIdentifierCreator) {\n /**\n * Constructor. Typically called internally by a prefix manager but may be called by other code with another prefix\n * provider type.\n *\n * @param prefixProvider\n * Prefix provider.\n *\n * @param identifierType\n * Identifier type.\n *\n * @param length\n * Length.\n *\n * @param leaderType\n * Leader type.\n */\n constructor(prefixProvider: PrefixProvider, identifierType: IdentifierType, length: number, leaderType: LeaderType = LeaderTypes.None) {\n super(identifierType, length, leaderType);\n\n this.init(prefixProvider, prefixProvider.gs1CompanyPrefix);\n }\n}\n","import { mapIterable, type TransformerInput, type TransformerOutput } from \"@aidc-toolkit/utility\";\nimport { Mixin } from \"ts-mixer\";\nimport type { IdentifierType } from \"./identifier-type\";\nimport type { ContentCharacterSet } from \"./identifier-validator\";\nimport { AbstractNumericIdentifierCreator } from \"./numeric-identifier-creator\";\nimport type { PrefixProvider } from \"./prefix-provider\";\nimport { SerializableNumericIdentifierValidator } from \"./serializable-numeric-identifier-validator\";\n\n/**\n * Serializable numeric identifier creator.\n */\nexport class SerializableNumericIdentifierCreator extends Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator) {\n /**\n * Constructor. Typically called internally by a prefix manager but may be called by other code with another prefix\n * provider type.\n *\n * @param prefixProvider\n * Prefix provider.\n *\n * @param identifierType\n * Identifier type.\n *\n * @param length\n * Length.\n *\n * @param serialComponentLength\n * Serial component length.\n *\n * @param serialComponentCharacterSet\n * Serial component character set.\n */\n constructor(prefixProvider: PrefixProvider, identifierType: IdentifierType, length: number, serialComponentLength: number, serialComponentCharacterSet: ContentCharacterSet) {\n super(identifierType, length, serialComponentLength, serialComponentCharacterSet);\n\n this.init(prefixProvider, prefixProvider.gs1CompanyPrefix);\n }\n\n /**\n * Concatenate a validated base identifier with serial component(s).\n *\n * @template TTransformerInput\n * Transformer input type.\n *\n * @param baseIdentifier\n * Base identifier.\n *\n * @param serialComponentOrComponents\n * Serial component(s).\n *\n * @returns\n * Serialized identifier(s).\n */\n private concatenateValidated<TTransformerInput extends TransformerInput<string>>(baseIdentifier: string, serialComponentOrComponents: TTransformerInput): TransformerOutput<TTransformerInput, string> {\n // TODO Refactor type when https://github.com/microsoft/TypeScript/pull/56941 released.\n let result: string | Iterable<string>;\n\n const serialComponentCreator = this.serialComponentCreator;\n const serialComponentValidation = this.serialComponentValidation;\n\n /**\n * Validate a serial component and concatenate it to the base identifier.\n *\n * @param serialComponent\n * Serial component.\n *\n * @returns\n * Serialized identifier.\n */\n function validateAndConcatenate(serialComponent: string): string {\n serialComponentCreator.validate(serialComponent, serialComponentValidation);\n\n return baseIdentifier + serialComponent;\n }\n\n if (typeof serialComponentOrComponents !== \"object\") {\n result = validateAndConcatenate(serialComponentOrComponents);\n } else {\n result = mapIterable(serialComponentOrComponents, validateAndConcatenate);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type determination is handled above.\n return result as TransformerOutput<TTransformerInput, string>;\n }\n\n /**\n * Create serialized identifier(s) with a reference based on a numeric value concatenated with serial component(s).\n * The value is converted to a reference of the appropriate length using a numeric creator.\n *\n * @template TTransformerInput\n * Transformer input type.\n *\n * @param value\n * Numeric value of the reference.\n *\n * @param serialComponentOrComponents\n * Serial component(s).\n *\n * @param sparse\n * If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.\n *\n * @returns\n * Serialized identifiers.\n */\n createSerialized<TTransformerInput extends TransformerInput<string>>(value: number, serialComponentOrComponents: TTransformerInput, sparse?: boolean): TransformerOutput<TTransformerInput, string> {\n return this.concatenateValidated(this.create(value, sparse), serialComponentOrComponents);\n }\n\n /**\n * Concatenate a base identifier with serial component(s).\n *\n * @template TTransformerInput\n * Transformer input type.\n *\n * @param baseIdentifier\n * Base identifier.\n *\n * @param serialComponentOrComponents\n * Serial component(s).\n *\n * @returns\n * Serialized identifier(s).\n */\n concatenate<TTransformerInput extends TransformerInput<string>>(baseIdentifier: string, serialComponentOrComponents: TTransformerInput): TransformerOutput<TTransformerInput, string> {\n this.validate(baseIdentifier);\n\n return this.concatenateValidated(baseIdentifier, serialComponentOrComponents);\n }\n}\n","import {\n type CharacterSetValidation,\n mapIterable,\n type TransformerInput,\n type TransformerOutput\n} from \"@aidc-toolkit/utility\";\nimport { Mixin } from \"ts-mixer\";\nimport { checkCharacterPair } from \"./check\";\nimport { AbstractIdentifierCreator } from \"./identifier-creator\";\nimport type { IdentifierType } from \"./identifier-type\";\nimport type { ContentCharacterSet } from \"./identifier-validator\";\nimport { i18nextGS1 } from \"./locale/i18n\";\nimport { NonNumericIdentifierValidator } from \"./non-numeric-identifier-validator\";\nimport type { PrefixProvider } from \"./prefix-provider\";\n\n/**\n * Non-numeric identifier creator.\n */\nexport class NonNumericIdentifierCreator extends Mixin(NonNumericIdentifierValidator, AbstractIdentifierCreator) {\n /**\n * Reference validation parameters.\n */\n private readonly _referenceValidation: CharacterSetValidation;\n\n /**\n * Constructor. Typically called internally by a prefix manager but may be called by other code with another prefix\n * provider type.\n *\n * @param prefixProvider\n * Prefix provider.\n *\n * @param identifierType\n * Identifier type.\n *\n * @param length\n * Length.\n *\n * @param referenceCharacterSet\n * Reference character set.\n *\n * @param requiresCheckCharacterPair\n * True if the identifier requires a check character pair.\n */\n constructor(prefixProvider: PrefixProvider, identifierType: IdentifierType, length: number, referenceCharacterSet: ContentCharacterSet, requiresCheckCharacterPair = false) {\n super(identifierType, length, referenceCharacterSet, requiresCheckCharacterPair);\n\n this.init(prefixProvider, prefixProvider.gs1CompanyPrefix, 2 * Number(requiresCheckCharacterPair));\n\n this._referenceValidation = {\n minimumLength: 1,\n // Maximum reference length has to account for prefix and check character pair.\n maximumLength: this.referenceLength,\n component: () => i18nextGS1.t(\"Identifier.reference\")\n };\n }\n\n /**\n * Get the reference validation parameters.\n */\n protected get referenceValidation(): CharacterSetValidation {\n return this._referenceValidation;\n }\n\n /**\n * Create identifier(s) with reference(s).\n *\n * @template TTransformerInput\n * Transformer input type.\n *\n * @param referenceOrReferences\n * Reference(s).\n *\n * @returns\n * Identifier(s).\n */\n create<TTransformerInput extends TransformerInput<string>>(referenceOrReferences: TTransformerInput): TransformerOutput<TTransformerInput, string> {\n // TODO Refactor type when https://github.com/microsoft/TypeScript/pull/56941 released.\n let result: string | Iterable<string>;\n\n const referenceCreator = this.referenceCreator;\n const referenceValidation = this.referenceValidation;\n const prefix = this.prefix;\n const requiresCheckCharacterPair = this.requiresCheckCharacterPair;\n\n /**\n * Validate a reference and create an identifier.\n *\n * @param reference\n * Reference.\n *\n * @returns\n * Identifier.\n */\n function validateAndCreate(reference: string): string {\n referenceCreator.validate(reference, referenceValidation);\n\n const partialIdentifier = prefix + reference;\n\n return requiresCheckCharacterPair ? partialIdentifier + checkCharacterPair(partialIdentifier) : partialIdentifier;\n }\n\n if (typeof referenceOrReferences !== \"object\") {\n result = validateAndCreate(referenceOrReferences);\n } else {\n result = mapIterable(referenceOrReferences, validateAndCreate);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type determination is handled above.\n return result as TransformerOutput<TTransformerInput, string>;\n }\n}\n","import { GTINCreator } from \"./gtin-creator\";\nimport { type GTINType, GTINTypes } from \"./gtin-validator\";\nimport type { IdentifierCreator } from \"./identifier-creator\";\nimport { type IdentifierType, IdentifierTypes } from \"./identifier-type\";\nimport { i18nextGS1 } from \"./locale/i18n\";\nimport { NonGTINNumericIdentifierCreator } from \"./non-gtin-numeric-identifier-creator\";\nimport {\n GLN_VALIDATOR,\n GSIN_VALIDATOR,\n GSRN_VALIDATOR,\n type NonGTINNumericIdentifierValidator,\n SSCC_VALIDATOR\n} from \"./non-gtin-numeric-identifier-validator\";\nimport { NonNumericIdentifierCreator } from \"./non-numeric-identifier-creator\";\nimport {\n CPID_VALIDATOR,\n GIAI_VALIDATOR,\n GINC_VALIDATOR,\n GMN_VALIDATOR,\n type NonNumericIdentifierValidator\n} from \"./non-numeric-identifier-validator\";\nimport type { AbstractNumericIdentifierCreator } from \"./numeric-identifier-creator\";\nimport type { NumericIdentifierType } from \"./numeric-identifier-validator\";\nimport type { PrefixProvider } from \"./prefix-provider\";\nimport { type PrefixType, PrefixTypes } from \"./prefix-type\";\nimport { PrefixValidator } from \"./prefix-validator\";\nimport { SerializableNumericIdentifierCreator } from \"./serializable-numeric-identifier-creator\";\nimport {\n GCN_VALIDATOR,\n GDTI_VALIDATOR,\n GRAI_VALIDATOR,\n type SerializableNumericIdentifierValidator\n} from \"./serializable-numeric-identifier-validator\";\n\n/**\n * Prefix manager. This is the core class for identifier creation.\n *\n * A prefix manager may be created for any {@link PrefixType | prefix type}. As most applications work with a limited\n * number of prefixes for creating identifiers, prefix managers are cached in memory and may be reused.\n *\n * Prefix managers are keyed by GS1 Company Prefix, so the prefix type that is requested may not match the prefix type\n * of the returned prefix manager. For example, the prefix manager for GS1 Company Prefix 0614141 is identical to the\n * one for U.P.C. Company Prefix 614141, with the prefix type equal to {@link PrefixTypes.UPCCompanyPrefix} and the\n * prefix equal to \"614141\".\n *\n * To support the creation of sparse identifiers, a prefix manager maintains a {@link tweakFactor | tweak\n * factor} which is used, along with a type-specific multiplier, as the tweak when creating numeric identifiers.\n * The default tweak factor is the numeric value of the GS1 Company Prefix representation of the prefix preceded by '1'\n * to ensure uniqueness (i.e., so that prefixes 0 N1 N2 N3... and N1 N2 N3... produce different tweak factors). This is\n * usually sufficient for obfuscation, but as the sparse creation algorithm is reversible and as the GS1 Company Prefix\n * is discoverable via {@link https://www.gs1.org/services/verified-by-gs1 | Verified by GS1}, a user-defined tweak\n * factor should be used if a higher degree of obfuscation is required. When using a tweak factor other than the\n * default, care should be taken to restore it when resuming the application. A tweak factor of 0 creates a straight\n * sequence.\n */\nexport class PrefixManager implements PrefixProvider {\n /**\n * Cached prefix managers, keyed by GS1 Company Prefix.\n */\n private static readonly PREFIX_MANAGERS_MAP = new Map<string, PrefixManager>();\n\n /**\n * Creator tweak factors. Different numeric identifier types have different tweak factors so that sparse creation\n * generates different sequences for each.\n */\n private static readonly CREATOR_TWEAK_FACTORS: Readonly<Record<NumericIdentifierType, bigint>> = {\n GTIN: 1987n,\n GLN: 4241n,\n SSCC: 8087n,\n GRAI: 3221n,\n GSRN: 2341n,\n GDTI: 7333n,\n GSIN: 5623n,\n GCN: 6869n\n };\n\n /**\n * Normalized prefix type.\n */\n private readonly _prefixType: PrefixType;\n\n /**\n * Normalized prefix.\n */\n private readonly _prefix: string;\n\n /**\n * Prefix as GS1 Company Prefix.\n */\n private readonly _gs1CompanyPrefix: string;\n\n /**\n * U.P.C. Company Prefix if prefix type is {@link PrefixTypes.UPCCompanyPrefix}.\n */\n private readonly _upcCompanyPrefix: string | undefined;\n\n /**\n * GS1-8 Prefix if prefix type is {@link PrefixTypes.GS18Prefix}.\n */\n private readonly _gs18Prefix: string | undefined;\n\n /**\n * Default tweak factor.\n */\n private readonly _defaultTweakFactor: bigint;\n\n /**\n * Tweak factor.\n */\n private _tweakFactor = 0n;\n\n /**\n * Cached identifier creators.\n */\n private readonly _identifierCreators: Partial<Record<IdentifierType, IdentifierCreator>> = {};\n\n /**\n * Constructor.\n *\n * @param gs1CompanyPrefix\n * GS1 Company Prefix.\n */\n private constructor(gs1CompanyPrefix: string) {\n this._gs1CompanyPrefix = gs1CompanyPrefix;\n\n // Determine the prefix type and populate the remaining fields.\n if (!gs1CompanyPrefix.startsWith(\"0\")) {\n this._prefixType = PrefixTypes.GS1CompanyPrefix;\n this._prefix = this._gs1CompanyPrefix;\n } else if (!gs1CompanyPrefix.startsWith(\"00000\")) {\n this._prefixType = PrefixTypes.UPCCompanyPrefix;\n this._upcCompanyPrefix = gs1CompanyPrefix.substring(1);\n this._prefix = this._upcCompanyPrefix;\n } else {\n this._prefixType = PrefixTypes.GS18Prefix;\n this._gs18Prefix = gs1CompanyPrefix.substring(5);\n this._prefix = this._gs18Prefix;\n }\n\n // Default tweak factor is the numeric value of the GS1 Company Prefix preceded by '1'.\n this._defaultTweakFactor = BigInt(`1${this.gs1CompanyPrefix}`);\n\n this.resetTweakFactor();\n }\n\n /**\n * Get the prefix type.\n */\n get prefixType(): PrefixType {\n return this._prefixType;\n }\n\n /**\n * Get the prefix.\n */\n get prefix(): string {\n return this._prefix;\n }\n\n /**\n * Get the GS1 Company Prefix.\n */\n get gs1CompanyPrefix(): string {\n return this._gs1CompanyPrefix;\n }\n\n /**\n * Get the U.P.C. Company Prefix if prefix type is {@link PrefixTypes.UPCCompanyPrefix} or undefined if not.\n */\n get upcCompanyPrefix(): string | undefined {\n return this._upcCompanyPrefix;\n }\n\n /**\n * Get the GS1-8 Prefix if prefix type is {@link PrefixTypes.GS18Prefix} or undefined if not.\n */\n get gs18Prefix(): string | undefined {\n return this._gs18Prefix;\n }\n\n /**\n * Set the tweak for an identifier creator if it's a numeric identifier creator.\n *\n * @param creator\n * Identifier creator.\n */\n private setCreatorTweak(creator: IdentifierCreator): void {\n if (creator.identifierType in PrefixManager.CREATOR_TWEAK_FACTORS) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type is known by testing for presence in record.\n const creatorTweakFactor = PrefixManager.CREATOR_TWEAK_FACTORS[creator.identifierType as NumericIdentifierType];\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion,no-param-reassign -- Type is known by testing identifier type. Method purpose is to set the tweak.\n (creator as AbstractNumericIdentifierCreator).tweak = this.tweakFactor * creatorTweakFactor;\n }\n }\n\n /**\n * Get the tweak factor.\n */\n get tweakFactor(): bigint {\n return this._tweakFactor;\n }\n\n /**\n * Set the tweak factor.\n *\n * @param value\n * Tweak factor.\n */\n set tweakFactor(value: number | bigint) {\n const tweakFactor = BigInt(value);\n\n if (this._tweakFactor !== tweakFactor) {\n this._tweakFactor = tweakFactor;\n\n for (const creator of Object.values(this._identifierCreators)) {\n this.setCreatorTweak(creator);\n }\n }\n }\n\n /**\n * Reset the tweak factor to its default (numeric value of the GS1 Company Prefix preceded by '1').\n */\n resetTweakFactor(): void {\n this.tweakFactor = this._defaultTweakFactor;\n }\n\n /**\n * Get a prefix manager.\n *\n * @param prefixType\n * Prefix type.\n *\n * @param prefix\n * Prefix.\n *\n * @returns\n * Prefix manager with normalized prefix type and prefix.\n */\n static get(prefixType: PrefixType, prefix: string): PrefixManager {\n PrefixValidator.validate(prefixType, true, true, prefix);\n\n let gs1CompanyPrefix: string;\n\n switch (prefixType) {\n case PrefixTypes.GS1CompanyPrefix:\n gs1CompanyPrefix = prefix;\n break;\n\n case PrefixTypes.UPCCompanyPrefix:\n gs1CompanyPrefix = \"0\" + prefix;\n break;\n\n case PrefixTypes.GS18Prefix:\n gs1CompanyPrefix = \"00000\" + prefix;\n break;\n\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- Method may be called by unsafe means.\n default:\n throw new RangeError(i18nextGS1.t(\"Prefix.invalidPrefixType\"));\n }\n\n let prefixManager = PrefixManager.PREFIX_MANAGERS_MAP.get(gs1CompanyPrefix);\n\n if (prefixManager === undefined) {\n prefixManager = new PrefixManager(gs1CompanyPrefix);\n PrefixManager.PREFIX_MANAGERS_MAP.set(gs1CompanyPrefix, prefixManager);\n }\n\n return prefixManager;\n }\n\n /**\n * Get an identifier creator.\n *\n * @param identifierType\n * Identifier type.\n *\n * @param constructorCallback\n * Constructor callback.\n *\n * @returns\n * Identifier creator.\n */\n private getIdentifierCreator<TIdentifierCreator extends IdentifierCreator>(identifierType: IdentifierType, constructorCallback: () => TIdentifierCreator): TIdentifierCreator {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type is paired with constructor callback.\n let creator = this._identifierCreators[identifierType] as TIdentifierCreator | undefined;\n\n if (creator === undefined) {\n if (this.prefixType === PrefixTypes.GS18Prefix && identifierType !== IdentifierTypes.GTIN) {\n throw new RangeError(i18nextGS1.t(\"Prefix.identifierTypeNotSupportedByGS18Prefix\", {\n identifierType\n }));\n }\n\n creator = constructorCallback();\n\n this.setCreatorTweak(creator);\n\n this._identifierCreators[identifierType] = creator;\n }\n\n return creator;\n }\n\n /**\n * Get non-GTIN numeric identifier creator.\n *\n * @param validator\n * Validator on which identifier creator is based.\n *\n * @returns\n * Identifier creator.\n */\n private getNonGTINNumericIdentifierCreator(validator: NonGTINNumericIdentifierValidator): NonGTINNumericIdentifierCreator {\n return this.getIdentifierCreator(validator.identifierType, () => new NonGTINNumericIdentifierCreator(this, validator.identifierType, validator.length, validator.leaderType));\n }\n\n /**\n * Get serialized numeric identifier creator.\n *\n * @param validator\n * Validator on which identifier creator is based.\n *\n * @returns\n * Identifier creator.\n */\n private getSerializableNumericIdentifierCreator(validator: SerializableNumericIdentifierValidator): SerializableNumericIdentifierCreator {\n return this.getIdentifierCreator(validator.identifierType, () => new SerializableNumericIdentifierCreator(this, validator.identifierType, validator.length, validator.serialComponentLength, validator.serialComponentCharacterSet));\n }\n\n /**\n * Get non-numeric identifier creator.\n *\n * @param validator\n * Validator on which identifier creator is based.\n *\n * @returns\n * Identifier creator.\n */\n private getNonNumericIdentifierCreator(validator: NonNumericIdentifierValidator): NonNumericIdentifierCreator {\n return this.getIdentifierCreator(validator.identifierType, () => new NonNumericIdentifierCreator(this, validator.identifierType, validator.length, validator.referenceCharacterSet, validator.requiresCheckCharacterPair));\n }\n\n /**\n * Get GTIN creator.\n */\n get gtinCreator(): GTINCreator {\n return this.getIdentifierCreator(IdentifierTypes.GTIN, () => {\n let gtinType: GTINType;\n\n switch (this.prefixType) {\n case PrefixTypes.GS1CompanyPrefix:\n gtinType = GTINTypes.GTIN13;\n break;\n\n case PrefixTypes.UPCCompanyPrefix:\n gtinType = GTINTypes.GTIN12;\n break;\n\n case PrefixTypes.GS18Prefix:\n gtinType = GTINTypes.GTIN8;\n break;\n }\n\n return new GTINCreator(this, gtinType);\n });\n }\n\n /**\n * Get GLN creator.\n */\n get glnCreator(): NonGTINNumericIdentifierCreator {\n return this.getNonGTINNumericIdentifierCreator(GLN_VALIDATOR);\n }\n\n /**\n * Get SSCC creator.\n */\n get ssccCreator(): NonGTINNumericIdentifierCreator {\n return this.getNonGTINNumericIdentifierCreator(SSCC_VALIDATOR);\n }\n\n /**\n * Get GRAI creator.\n */\n get graiCreator(): SerializableNumericIdentifierCreator {\n return this.getSerializableNumericIdentifierCreator(GRAI_VALIDATOR);\n }\n\n /**\n * Get GIAI creator.\n */\n get giaiCreator(): NonNumericIdentifierCreator {\n return this.getNonNumericIdentifierCreator(GIAI_VALIDATOR);\n }\n\n /**\n * Get GSRN creator.\n */\n get gsrnCreator(): NonGTINNumericIdentifierCreator {\n return this.getNonGTINNumericIdentifierCreator(GSRN_VALIDATOR);\n }\n\n /**\n * Get GDTI creator.\n */\n get gdtiCreator(): SerializableNumericIdentifierCreator {\n return this.getSerializableNumericIdentifierCreator(GDTI_VALIDATOR);\n }\n\n /**\n * Get GINC creator.\n */\n get gincCreator(): NonNumericIdentifierCreator {\n return this.getNonNumericIdentifierCreator(GINC_VALIDATOR);\n }\n\n /**\n * Get GSIN creator.\n */\n get gsinCreator(): NonGTINNumericIdentifierCreator {\n return this.getNonGTINNumericIdentifierCreator(GSIN_VALIDATOR);\n }\n\n /**\n * Get GCN creator.\n */\n get gcnCreator(): SerializableNumericIdentifierCreator {\n return this.getSerializableNumericIdentifierCreator(GCN_VALIDATOR);\n }\n\n /**\n * Get CPID creator.\n */\n get cpidCreator(): NonNumericIdentifierCreator {\n return this.getNonNumericIdentifierCreator(CPID_VALIDATOR);\n }\n\n /**\n * Get GMN creator.\n */\n get gmnCreator(): NonNumericIdentifierCreator {\n return this.getNonNumericIdentifierCreator(GMN_VALIDATOR);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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,UAAU;AACrB;AAAA,QAEJ,KAAK,YAAY;AACb,qBAAW,UAAU;AACrB;AAAA,MACR;AAEA,aAAO,IAAI,YAAY,MAAM,QAAQ;AAAA,IACzC,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,aAA8C;AAC9C,WAAO,KAAK,mCAAmC,aAAa;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAA+C;AAC/C,WAAO,KAAK,mCAAmC,cAAc;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAAoD;AACpD,WAAO,KAAK,wCAAwC,cAAc;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAA2C;AAC3C,WAAO,KAAK,+BAA+B,cAAc;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAA+C;AAC/C,WAAO,KAAK,mCAAmC,cAAc;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAAoD;AACpD,WAAO,KAAK,wCAAwC,cAAc;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAA2C;AAC3C,WAAO,KAAK,+BAA+B,cAAc;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAA+C;AAC/C,WAAO,KAAK,mCAAmC,cAAc;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,aAAmD;AACnD,WAAO,KAAK,wCAAwC,aAAa;AAAA,EACrE;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAA2C;AAC3C,WAAO,KAAK,+BAA+B,cAAc;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,aAA0C;AAC1C,WAAO,KAAK,+BAA+B,aAAa;AAAA,EAC5D;AACJ;","names":["t","module","copy","instance","locale_resources_default","locale_resources_default","import_utility","import_utility","checkDigit","import_utility","import_utility","import_utility","priceOrWeightCheckDigit","import_utility","import_utility","import_utility","import_ts_mixer","import_utility","import_ts_mixer","import_utility","import_ts_mixer"]}