@coveo/atomic 3.35.0-pre.b3e173655a → 3.35.0-pre.c86b349898

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 (742) hide show
  1. package/dist/atomic/_atomic.esm.js +1 -1
  2. package/dist/atomic/atomic.esm.js.map +1 -1
  3. package/dist/atomic/components/_index.d.ts +0 -2
  4. package/dist/atomic/components/_index.js +0 -1
  5. package/dist/atomic/components/atomic-category-facet.js +1 -1
  6. package/dist/atomic/components/atomic-citation.js +1 -1
  7. package/dist/atomic/components/atomic-facet-manager.js +1 -1
  8. package/dist/atomic/components/atomic-facet.js +1 -1
  9. package/dist/atomic/components/atomic-format-currency.js +1 -1
  10. package/dist/atomic/components/atomic-format-number.js +1 -1
  11. package/dist/atomic/components/atomic-format-unit.js +1 -1
  12. package/dist/atomic/components/atomic-generated-answer-feedback-modal.js +1 -1
  13. package/dist/atomic/components/atomic-html2.js +1 -1
  14. package/dist/atomic/components/atomic-insight-edit-toggle.js +1 -1
  15. package/dist/atomic/components/atomic-insight-facet.js +1 -1
  16. package/dist/atomic/components/atomic-insight-folded-result-list.js +1 -1
  17. package/dist/atomic/components/atomic-insight-full-search-button.js +1 -1
  18. package/dist/atomic/components/atomic-insight-history-toggle.js +1 -1
  19. package/dist/atomic/components/atomic-insight-layout.js +82 -1
  20. package/dist/atomic/components/atomic-insight-layout.js.map +1 -1
  21. package/dist/atomic/components/atomic-insight-no-results.js +1 -1
  22. package/dist/atomic/components/atomic-insight-numeric-facet.js +1 -1
  23. package/dist/atomic/components/atomic-insight-pager.js +3 -3
  24. package/dist/atomic/components/atomic-insight-query-error.js +1 -1
  25. package/dist/atomic/components/atomic-insight-refine-modal2.js +2 -2
  26. package/dist/atomic/components/atomic-insight-refine-toggle.js +1 -1
  27. package/dist/atomic/components/atomic-insight-result-action.js +1 -1
  28. package/dist/atomic/components/atomic-insight-result-attach-to-case-action.js +1 -1
  29. package/dist/atomic/components/atomic-insight-result-attach-to-case-indicator.js +1 -1
  30. package/dist/atomic/components/atomic-insight-result-children.js +1 -1
  31. package/dist/atomic/components/atomic-insight-result-list.js +1 -1
  32. package/dist/atomic/components/atomic-insight-result-quickview-action.js +1 -1
  33. package/dist/atomic/components/atomic-insight-result2.js +1 -1
  34. package/dist/atomic/components/atomic-insight-search-box.js +2 -2
  35. package/dist/atomic/components/atomic-insight-smart-snippet-feedback-modal2.js +2 -2
  36. package/dist/atomic/components/atomic-insight-tabs.js +1 -1
  37. package/dist/atomic/components/atomic-insight-user-actions-session2.js +1 -1
  38. package/dist/atomic/components/atomic-insight-user-actions-toggle.js +1 -1
  39. package/dist/atomic/components/atomic-ipx-body2.js +2 -2
  40. package/dist/atomic/components/atomic-ipx-button.js +2 -2
  41. package/dist/atomic/components/atomic-ipx-embedded.js +1 -1
  42. package/dist/atomic/components/atomic-ipx-modal.js +2 -2
  43. package/dist/atomic/components/atomic-ipx-recs-list.js +1 -1
  44. package/dist/atomic/components/atomic-ipx-refine-modal2.js +1 -1
  45. package/dist/atomic/components/atomic-ipx-refine-toggle.js +1 -1
  46. package/dist/atomic/components/atomic-ipx-result-link.js +1 -1
  47. package/dist/atomic/components/atomic-ipx-tabs.js +1 -1
  48. package/dist/atomic/components/atomic-load-more-results.js +1 -1
  49. package/dist/atomic/components/atomic-no-results.js +1 -1
  50. package/dist/atomic/components/atomic-numeric-facet.js +1 -1
  51. package/dist/atomic/components/atomic-query-error.js +1 -1
  52. package/dist/atomic/components/atomic-quickview-modal2.js +1 -1
  53. package/dist/atomic/components/atomic-quickview.js +1 -1
  54. package/dist/atomic/components/atomic-recs-error.js +1 -1
  55. package/dist/atomic/components/atomic-recs-interface.js +2915 -3
  56. package/dist/atomic/components/atomic-recs-interface.js.map +1 -1
  57. package/dist/atomic/components/atomic-recs-list.js +1 -1
  58. package/dist/atomic/components/atomic-refine-modal2.js +1 -1
  59. package/dist/atomic/components/atomic-refine-toggle.js +1 -1
  60. package/dist/atomic/components/atomic-result-children.js +1 -1
  61. package/dist/atomic/components/atomic-result-fields-list.js +1 -1
  62. package/dist/atomic/components/atomic-result-link.js +1 -1
  63. package/dist/atomic/components/atomic-result-list.js +1 -1
  64. package/dist/atomic/components/atomic-result-placeholder2.js +2 -2
  65. package/dist/atomic/components/atomic-result-table-placeholder2.js +1 -1
  66. package/dist/atomic/components/atomic-search-box-instant-results.js +1 -1
  67. package/dist/atomic/components/atomic-search-box-query-suggestions2.js +1 -1
  68. package/dist/atomic/components/atomic-search-box.js +7 -3
  69. package/dist/atomic/components/atomic-search-box.js.map +1 -1
  70. package/dist/atomic/components/atomic-smart-snippet-answer2.js +1 -1
  71. package/dist/atomic/components/atomic-smart-snippet-collapse-wrapper2.js +2 -2
  72. package/dist/atomic/components/atomic-smart-snippet-expandable-answer2.js +1 -1
  73. package/dist/atomic/components/atomic-smart-snippet-feedback-modal2.js +2 -2
  74. package/dist/atomic/components/atomic-smart-snippet-source2.js +1 -1
  75. package/dist/atomic/components/atomic-sort-dropdown.js +2 -2
  76. package/dist/atomic/components/atomic-sort-expression.js +1 -1
  77. package/dist/atomic/components/atomic-stencil-facet-date-input.js +3 -3
  78. package/dist/atomic/components/atomic-suggestion-renderer2.js +1 -1
  79. package/dist/atomic/components/atomic-tab-manager.js +1 -1
  80. package/dist/atomic/components/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.js +3 -1
  81. package/dist/atomic/components/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.js +5 -0
  82. package/dist/atomic/components/components/commerce/atomic-commerce-search-box-recent-queries/atomic-commerce-search-box-recent-queries.js +3 -0
  83. package/dist/atomic/components/components/common/breadbox/breadcrumb-button.js +6 -1
  84. package/dist/atomic/components/components/common/search-box/text-area-clear-button.js +1 -1
  85. package/dist/atomic/components/components/insight/atomic-insight-interface/analytics-config.js +31 -0
  86. package/dist/atomic/components/components/insight/atomic-insight-interface/atomic-insight-interface.js +258 -0
  87. package/dist/atomic/components/components/insight/index.js +2 -1
  88. package/dist/atomic/components/components/insight/lazy-index.js +3 -1
  89. package/dist/atomic/components/facet-number-input.js +2 -2
  90. package/dist/atomic/components/global/environment.js +1 -1
  91. package/dist/atomic/components/index.js.map +1 -1
  92. package/dist/atomic/components/item-section-utils.js +1 -1
  93. package/dist/atomic/components/replace-breakpoint-utils.js +1 -1
  94. package/dist/atomic/components/replace-breakpoint-utils.js.map +1 -1
  95. package/dist/atomic/components/stencil-suggestion-manager.js +1 -1
  96. package/dist/atomic/components/stencil-suggestion-manager.js.map +1 -1
  97. package/dist/atomic/components/store.js +2 -30
  98. package/dist/atomic/components/store.js.map +1 -1
  99. package/dist/atomic/components/tab-button.js +1 -1
  100. package/dist/atomic/components/tab-popover.js +1 -1
  101. package/dist/atomic/components/utils.js +1 -17
  102. package/dist/atomic/components/utils.js.map +1 -1
  103. package/dist/atomic/lang/cs.json +1 -1
  104. package/dist/atomic/lang/da.json +1 -1
  105. package/dist/atomic/lang/de.json +1 -1
  106. package/dist/atomic/lang/dev.json +1 -1
  107. package/dist/atomic/lang/el.json +1 -1
  108. package/dist/atomic/lang/en.json +1 -1
  109. package/dist/atomic/lang/es.json +1 -1
  110. package/dist/atomic/lang/fi.json +1 -1
  111. package/dist/atomic/lang/fr.json +1 -1
  112. package/dist/atomic/lang/hu.json +1 -1
  113. package/dist/atomic/lang/id.json +1 -1
  114. package/dist/atomic/lang/it.json +1 -1
  115. package/dist/atomic/lang/ja.json +1 -1
  116. package/dist/atomic/lang/ko.json +1 -1
  117. package/dist/atomic/lang/nl.json +1 -1
  118. package/dist/atomic/lang/no.json +1 -1
  119. package/dist/atomic/lang/pl.json +1 -1
  120. package/dist/atomic/lang/pt-BR.json +1 -1
  121. package/dist/atomic/lang/pt.json +1 -1
  122. package/dist/atomic/lang/ru.json +1 -1
  123. package/dist/atomic/lang/sv.json +1 -1
  124. package/dist/atomic/lang/th.json +1 -1
  125. package/dist/atomic/lang/tr.json +1 -1
  126. package/dist/atomic/lang/zh-CN.json +1 -1
  127. package/dist/atomic/lang/zh-TW.json +1 -1
  128. package/dist/atomic/lang/zh.json +1 -1
  129. package/dist/atomic/{p-27cf779a.js → p-025a346a.js} +2 -2
  130. package/dist/atomic/{p-7e971d15.entry.js → p-044de1f9.entry.js} +2 -2
  131. package/dist/atomic/{p-fe59fb2d.entry.js → p-0535b93d.entry.js} +2 -2
  132. package/dist/atomic/{p-31a13850.js → p-0580b866.js} +2 -2
  133. package/dist/atomic/{p-0edea6f9.entry.js → p-05f1ff6f.entry.js} +2 -2
  134. package/dist/atomic/{p-3e9db2b5.entry.js → p-088d634c.entry.js} +2 -2
  135. package/dist/atomic/{p-4bdc6d5a.entry.js → p-0ee7cab8.entry.js} +2 -2
  136. package/dist/atomic/{p-0f449e9d.entry.js → p-14bad769.entry.js} +2 -2
  137. package/dist/atomic/{p-01511388.entry.js → p-15547bd5.entry.js} +2 -2
  138. package/dist/atomic/{p-b313058c.entry.js → p-182f9112.entry.js} +2 -2
  139. package/dist/atomic/{p-00069a4b.entry.js → p-1910eb7f.entry.js} +2 -2
  140. package/dist/atomic/{p-85145c88.entry.js → p-1c8bcadf.entry.js} +2 -2
  141. package/dist/atomic/p-1fca38e1.js +2 -0
  142. package/dist/atomic/{p-26598ee0.js.map → p-1fca38e1.js.map} +1 -1
  143. package/dist/atomic/{p-cafa4083.entry.js → p-21ab7750.entry.js} +2 -2
  144. package/dist/atomic/{p-9a6ec803.entry.js → p-229018fa.entry.js} +2 -2
  145. package/dist/atomic/{p-89d8bb0d.entry.js → p-22b76c96.entry.js} +2 -2
  146. package/dist/atomic/p-2559747d.js +2 -0
  147. package/dist/atomic/p-2559747d.js.map +1 -0
  148. package/dist/atomic/{p-36f63642.entry.js → p-26e0c1f8.entry.js} +2 -2
  149. package/dist/atomic/{p-c4fb6426.entry.js → p-2e13e2c0.entry.js} +2 -2
  150. package/dist/atomic/{p-6098b906.entry.js → p-2f437b47.entry.js} +2 -2
  151. package/dist/atomic/{p-998393ec.entry.js → p-2f517a54.entry.js} +2 -2
  152. package/dist/atomic/{p-06284430.entry.js → p-318c96f5.entry.js} +2 -2
  153. package/dist/atomic/{p-0ed76e65.entry.js → p-3272a04b.entry.js} +2 -2
  154. package/dist/atomic/{p-d211a422.entry.js → p-3291adda.entry.js} +2 -2
  155. package/dist/atomic/{p-dbc0ce5c.entry.js → p-33245038.entry.js} +2 -2
  156. package/dist/atomic/{p-fa658ef2.entry.js → p-35c2ee5f.entry.js} +2 -2
  157. package/dist/atomic/p-36270a85.entry.js +2 -0
  158. package/dist/atomic/p-36270a85.entry.js.map +1 -0
  159. package/dist/atomic/{p-3d55fce6.entry.js → p-36e2c945.entry.js} +2 -2
  160. package/dist/atomic/{p-af1b4924.entry.js → p-3bd8469f.entry.js} +2 -2
  161. package/dist/atomic/{p-e62fc40e.js → p-3ef52afa.js} +2 -2
  162. package/dist/atomic/{p-170c7da6.entry.js → p-400c28b6.entry.js} +2 -2
  163. package/dist/atomic/{p-fafd5042.entry.js → p-448091f7.entry.js} +2 -2
  164. package/dist/atomic/{p-fe3cd55b.entry.js → p-44d96103.entry.js} +2 -2
  165. package/dist/atomic/{p-da845e35.entry.js → p-463336ca.entry.js} +2 -2
  166. package/dist/atomic/{p-f9dd14b2.entry.js → p-479cb38a.entry.js} +2 -2
  167. package/dist/atomic/{p-a9383817.entry.js → p-47b41b27.entry.js} +2 -2
  168. package/dist/atomic/{p-be2a43f4.entry.js → p-48bab1a6.entry.js} +2 -2
  169. package/dist/atomic/{p-0c8e7d5f.entry.js → p-4cb91ee7.entry.js} +2 -2
  170. package/dist/atomic/{p-23d4dc54.entry.js → p-558f2191.entry.js} +2 -2
  171. package/dist/atomic/{p-8572a953.entry.js → p-55c41e00.entry.js} +2 -2
  172. package/dist/atomic/p-567b2841.entry.js +2 -0
  173. package/dist/atomic/{p-a1522fe5.entry.js.map → p-567b2841.entry.js.map} +1 -1
  174. package/dist/atomic/{p-2e4628bb.entry.js → p-57049cd2.entry.js} +2 -2
  175. package/dist/atomic/{p-edd4d5f7.js → p-5a2ef889.js} +2 -2
  176. package/dist/atomic/{p-dc128135.entry.js → p-5a83b7e5.entry.js} +2 -2
  177. package/dist/atomic/{p-10b5e0f3.entry.js → p-5b8cc4bc.entry.js} +2 -2
  178. package/dist/atomic/{p-87f69e53.entry.js → p-5cab535b.entry.js} +2 -2
  179. package/dist/atomic/p-5d0fc7e2.js +2 -0
  180. package/dist/atomic/{p-740cd5bc.entry.js → p-6439156c.entry.js} +2 -2
  181. package/dist/atomic/{p-7e9a1a1a.entry.js → p-66166975.entry.js} +2 -2
  182. package/dist/atomic/{p-97538903.entry.js → p-6698d5e9.entry.js} +2 -2
  183. package/dist/atomic/{p-0610b3e7.entry.js → p-6819f12c.entry.js} +2 -2
  184. package/dist/atomic/p-6b3429d3.js +2 -0
  185. package/dist/atomic/{p-6078667f.entry.js → p-7045745d.entry.js} +2 -2
  186. package/dist/atomic/{p-a130b00b.entry.js → p-70747efa.entry.js} +2 -2
  187. package/dist/atomic/{p-4830b9bb.entry.js → p-7242b46e.entry.js} +2 -2
  188. package/dist/atomic/{p-3af2fca0.js → p-7427daa3.js} +2 -2
  189. package/dist/atomic/{p-b320f270.entry.js → p-76c14d82.entry.js} +2 -2
  190. package/dist/atomic/{p-1435fb6f.entry.js → p-7741124a.entry.js} +2 -2
  191. package/dist/atomic/{p-cdeb5f2a.entry.js → p-77d00da1.entry.js} +2 -2
  192. package/dist/atomic/{p-519d9abd.entry.js → p-7fd58269.entry.js} +2 -2
  193. package/dist/atomic/p-7fe23afc.entry.js +2 -0
  194. package/dist/atomic/{p-c7af4b9e.entry.js.map → p-7fe23afc.entry.js.map} +1 -1
  195. package/dist/atomic/{p-f76b7ac3.entry.js → p-80290dd3.entry.js} +2 -2
  196. package/dist/atomic/{p-b6ae0244.entry.js → p-81bdbd07.entry.js} +2 -2
  197. package/dist/atomic/{p-dc28ee14.js → p-828ab4ff.js} +2 -2
  198. package/dist/atomic/{p-723f76a1.entry.js → p-82cd6398.entry.js} +2 -2
  199. package/dist/atomic/{p-fdcd187d.entry.js → p-851b9735.entry.js} +2 -2
  200. package/dist/atomic/{p-40c1dfcb.entry.js → p-874f0a4c.entry.js} +2 -2
  201. package/dist/atomic/{p-373448df.entry.js → p-8b0cf1d4.entry.js} +2 -2
  202. package/dist/atomic/{p-36112c34.entry.js → p-8b0d881e.entry.js} +2 -2
  203. package/dist/atomic/{p-ee957926.entry.js → p-8d5228da.entry.js} +2 -2
  204. package/dist/atomic/{p-c25f1437.entry.js → p-955092ed.entry.js} +2 -2
  205. package/dist/atomic/{p-47ab6c9f.entry.js → p-99d4c4bf.entry.js} +2 -2
  206. package/dist/atomic/{p-edede7d1.entry.js → p-9aad555a.entry.js} +2 -2
  207. package/dist/atomic/{p-2250f505.js → p-9ae68e86.js} +2 -2
  208. package/dist/atomic/{p-83d3857f.entry.js → p-9e6462cf.entry.js} +2 -2
  209. package/dist/atomic/p-9e6462cf.entry.js.map +1 -0
  210. package/dist/atomic/{p-00a6ab8c.entry.js → p-a0ebbbdf.entry.js} +2 -2
  211. package/dist/atomic/{p-7fd5b6ac.entry.js → p-a1798150.entry.js} +2 -2
  212. package/dist/atomic/{p-9239be63.entry.js → p-a54f3f24.entry.js} +2 -2
  213. package/dist/atomic/{p-24fd7df6.entry.js → p-a6dde0f6.entry.js} +2 -2
  214. package/dist/atomic/{p-a1e5f767.entry.js → p-a78cbb80.entry.js} +2 -2
  215. package/dist/atomic/p-aaa5a853.js +2 -0
  216. package/dist/atomic/p-aaa5a853.js.map +1 -0
  217. package/dist/atomic/{p-59b15bd6.entry.js → p-ae69f519.entry.js} +2 -2
  218. package/dist/atomic/{p-98dd6df1.entry.js → p-b06de6f8.entry.js} +2 -2
  219. package/dist/atomic/{p-fdd0aa42.entry.js → p-b1b583a0.entry.js} +2 -2
  220. package/dist/atomic/{p-3c9289b5.js → p-b29d121c.js} +2 -2
  221. package/dist/atomic/p-b628ed03.entry.js +2 -0
  222. package/dist/atomic/{p-a1ee594f.entry.js.map → p-b628ed03.entry.js.map} +1 -1
  223. package/dist/atomic/{p-cb3fd0f4.entry.js → p-b84108f3.entry.js} +2 -2
  224. package/dist/atomic/{p-fb1a1e2e.entry.js → p-b85c2c46.entry.js} +2 -2
  225. package/dist/atomic/{p-9260dd7d.entry.js → p-b9eeac20.entry.js} +2 -2
  226. package/dist/atomic/{p-b2b9e83f.entry.js → p-bc43df67.entry.js} +2 -2
  227. package/dist/atomic/{p-93601dc0.entry.js → p-bd01acd5.entry.js} +2 -2
  228. package/dist/atomic/{p-416d088e.entry.js → p-be011bd1.entry.js} +2 -2
  229. package/dist/atomic/{p-4f4c9a03.entry.js → p-c2a5dac0.entry.js} +2 -2
  230. package/dist/atomic/{p-93f1d551.entry.js → p-c5164dbf.entry.js} +2 -2
  231. package/dist/atomic/{p-3622ed6c.js → p-c619df9b.js} +2 -2
  232. package/dist/atomic/{p-1bbaf206.entry.js → p-c8190eb9.entry.js} +2 -2
  233. package/dist/atomic/{p-5ca21deb.js → p-ca37969c.js} +2 -2
  234. package/dist/atomic/{p-7cced247.entry.js → p-d0ab0125.entry.js} +2 -2
  235. package/dist/atomic/{p-2fb49fe8.entry.js → p-d8caa4d8.entry.js} +2 -2
  236. package/dist/atomic/{p-62e85c20.entry.js → p-da87ef51.entry.js} +2 -2
  237. package/dist/atomic/{p-367ec37d.entry.js → p-db2d92c5.entry.js} +2 -2
  238. package/dist/atomic/{p-dbf0c5a3.entry.js → p-db3b11ca.entry.js} +2 -2
  239. package/dist/atomic/p-dd0aac4c.entry.js +2 -0
  240. package/dist/atomic/p-dd0aac4c.entry.js.map +1 -0
  241. package/dist/atomic/{p-20b33c18.entry.js → p-dd24c66a.entry.js} +2 -2
  242. package/dist/atomic/{p-0f39889d.entry.js → p-dea22a8d.entry.js} +2 -2
  243. package/dist/atomic/{p-bbfe727a.entry.js → p-df8d38ca.entry.js} +2 -2
  244. package/dist/atomic/{p-f9608731.entry.js → p-e276c7e0.entry.js} +2 -2
  245. package/dist/atomic/{p-ce5b896e.entry.js → p-e455330c.entry.js} +2 -2
  246. package/dist/atomic/{p-59f043a0.entry.js → p-e49ad083.entry.js} +2 -2
  247. package/dist/atomic/{p-30c09377.entry.js → p-e6871a3f.entry.js} +2 -2
  248. package/dist/atomic/{p-c9f1790d.entry.js → p-e6dc9de7.entry.js} +2 -2
  249. package/dist/atomic/{p-6f1bffa2.entry.js → p-e8176ac8.entry.js} +2 -2
  250. package/dist/atomic/{p-52d5461a.entry.js → p-ed413091.entry.js} +2 -2
  251. package/dist/atomic/p-ef8f2239.entry.js +2 -0
  252. package/dist/atomic/{p-345c425d.entry.js.map → p-ef8f2239.entry.js.map} +1 -1
  253. package/dist/atomic/{p-3549a469.entry.js → p-f0c657f4.entry.js} +2 -2
  254. package/dist/atomic/{p-f936f55e.entry.js → p-f1241140.entry.js} +2 -2
  255. package/dist/atomic/p-f37dea9e.entry.js +2 -0
  256. package/dist/atomic/{p-b6415814.entry.js.map → p-f37dea9e.entry.js.map} +1 -1
  257. package/dist/atomic/p-f4818e53.entry.js +2 -0
  258. package/dist/atomic/p-f537c5af.js +2 -0
  259. package/dist/atomic/p-f537c5af.js.map +1 -0
  260. package/dist/atomic/{p-dd35e7ad.entry.js → p-f65ca329.entry.js} +2 -2
  261. package/dist/atomic/{p-6f34dd3a.entry.js → p-f800678c.entry.js} +2 -2
  262. package/dist/atomic/{p-e7a25b00.entry.js → p-fb517fba.entry.js} +2 -2
  263. package/dist/atomic/{p-97829295.entry.js → p-fc71835d.entry.js} +2 -2
  264. package/dist/atomic/{p-a5f66ecd.entry.js → p-fd1ef9e3.entry.js} +2 -2
  265. package/dist/cjs/_loader.cjs.js +1 -1
  266. package/dist/cjs/atomic-automatic-facet_2.cjs.entry.js +3 -3
  267. package/dist/cjs/atomic-breadbox.cjs.entry.js +2 -2
  268. package/dist/cjs/atomic-category-facet.cjs.entry.js +4 -4
  269. package/dist/cjs/atomic-citation.cjs.entry.js +1 -1
  270. package/dist/cjs/atomic-color-facet.cjs.entry.js +3 -3
  271. package/dist/cjs/atomic-facet-manager.cjs.entry.js +1 -1
  272. package/dist/cjs/atomic-facet-number-input.cjs.entry.js +2 -2
  273. package/dist/cjs/atomic-facet.cjs.entry.js +6 -6
  274. package/dist/cjs/atomic-field-condition.cjs.entry.js +4 -4
  275. package/dist/cjs/atomic-focus-trap.cjs.entry.js +2 -2
  276. package/dist/cjs/atomic-folded-result-list.cjs.entry.js +8 -8
  277. package/dist/cjs/atomic-format-currency.cjs.entry.js +1 -1
  278. package/dist/cjs/atomic-format-number.cjs.entry.js +1 -1
  279. package/dist/cjs/atomic-format-unit.cjs.entry.js +1 -1
  280. package/dist/cjs/atomic-generated-answer-feedback-modal.cjs.entry.js +3 -3
  281. package/dist/cjs/atomic-generated-answer.cjs.entry.js +3 -3
  282. package/dist/cjs/atomic-html.cjs.entry.js +1 -1
  283. package/dist/cjs/atomic-insight-edit-toggle.cjs.entry.js +1 -1
  284. package/dist/cjs/atomic-insight-facet.cjs.entry.js +5 -5
  285. package/dist/cjs/atomic-insight-folded-result-list.cjs.entry.js +8 -8
  286. package/dist/cjs/atomic-insight-full-search-button.cjs.entry.js +1 -1
  287. package/dist/cjs/atomic-insight-generated-answer.cjs.entry.js +2 -2
  288. package/dist/cjs/atomic-insight-history-toggle.cjs.entry.js +1 -1
  289. package/dist/cjs/atomic-insight-layout.cjs.entry.js +85 -5
  290. package/dist/cjs/atomic-insight-layout.cjs.entry.js.map +1 -1
  291. package/dist/cjs/atomic-insight-no-results.cjs.entry.js +3 -3
  292. package/dist/cjs/atomic-insight-numeric-facet.cjs.entry.js +6 -6
  293. package/dist/cjs/atomic-insight-pager.cjs.entry.js +4 -4
  294. package/dist/cjs/atomic-insight-query-error.cjs.entry.js +3 -3
  295. package/dist/cjs/atomic-insight-query-summary.cjs.entry.js +2 -2
  296. package/dist/cjs/atomic-insight-refine-modal.cjs.entry.js +4 -5
  297. package/dist/cjs/atomic-insight-refine-modal.cjs.entry.js.map +1 -1
  298. package/dist/cjs/atomic-insight-refine-toggle.cjs.entry.js +1 -1
  299. package/dist/cjs/atomic-insight-result-action-bar.cjs.entry.js +2 -2
  300. package/dist/cjs/atomic-insight-result-action.cjs.entry.js +1 -1
  301. package/dist/cjs/atomic-insight-result-attach-to-case-action.cjs.entry.js +1 -1
  302. package/dist/cjs/atomic-insight-result-attach-to-case-indicator.cjs.entry.js +1 -1
  303. package/dist/cjs/atomic-insight-result-children-template.cjs.entry.js +4 -4
  304. package/dist/cjs/atomic-insight-result-children.cjs.entry.js +2 -2
  305. package/dist/cjs/atomic-insight-result-list.cjs.entry.js +8 -8
  306. package/dist/cjs/atomic-insight-result-quickview-action.cjs.entry.js +3 -3
  307. package/dist/cjs/atomic-insight-result-template.cjs.entry.js +4 -4
  308. package/dist/cjs/atomic-insight-result.cjs.entry.js +7 -7
  309. package/dist/cjs/atomic-insight-search-box.cjs.entry.js +5 -5
  310. package/dist/cjs/atomic-insight-smart-snippet-feedback-modal.cjs.entry.js +4 -4
  311. package/dist/cjs/atomic-insight-smart-snippet-suggestions.cjs.entry.js +1 -1
  312. package/dist/cjs/atomic-insight-smart-snippet.cjs.entry.js +1 -1
  313. package/dist/cjs/atomic-insight-tab.cjs.entry.js +2 -2
  314. package/dist/cjs/atomic-insight-tabs.cjs.entry.js +1 -1
  315. package/dist/cjs/atomic-insight-timeframe-facet.cjs.entry.js +4 -4
  316. package/dist/cjs/atomic-insight-user-actions-session_2.cjs.entry.js +1 -1
  317. package/dist/cjs/atomic-insight-user-actions-toggle.cjs.entry.js +1 -1
  318. package/dist/cjs/atomic-ipx-body.cjs.entry.js +4 -4
  319. package/dist/cjs/atomic-ipx-button.cjs.entry.js +2 -2
  320. package/dist/cjs/atomic-ipx-embedded.cjs.entry.js +3 -3
  321. package/dist/cjs/atomic-ipx-modal.cjs.entry.js +4 -4
  322. package/dist/cjs/atomic-ipx-recs-list.cjs.entry.js +8 -8
  323. package/dist/cjs/atomic-ipx-refine-modal.cjs.entry.js +3 -4
  324. package/dist/cjs/atomic-ipx-refine-modal.cjs.entry.js.map +1 -1
  325. package/dist/cjs/atomic-ipx-refine-toggle.cjs.entry.js +1 -1
  326. package/dist/cjs/atomic-ipx-result-link.cjs.entry.js +1 -1
  327. package/dist/cjs/atomic-ipx-tab.cjs.entry.js +1 -2
  328. package/dist/cjs/atomic-ipx-tab.cjs.entry.js.map +1 -1
  329. package/dist/cjs/atomic-ipx-tabs.cjs.entry.js +1 -1
  330. package/dist/cjs/atomic-load-more-results.cjs.entry.js +2 -3
  331. package/dist/cjs/atomic-load-more-results.cjs.entry.js.map +1 -1
  332. package/dist/cjs/atomic-no-results.cjs.entry.js +3 -3
  333. package/dist/cjs/atomic-notifications.cjs.entry.js +2 -2
  334. package/dist/cjs/atomic-numeric-facet.cjs.entry.js +6 -6
  335. package/dist/cjs/atomic-query-error.cjs.entry.js +3 -3
  336. package/dist/cjs/atomic-quickview-modal.cjs.entry.js +1 -1
  337. package/dist/cjs/atomic-quickview.cjs.entry.js +3 -3
  338. package/dist/cjs/atomic-rating-facet.cjs.entry.js +4 -4
  339. package/dist/cjs/atomic-rating-range-facet.cjs.entry.js +3 -3
  340. package/dist/cjs/atomic-recs-error.cjs.entry.js +3 -3
  341. package/dist/cjs/atomic-recs-interface.cjs.entry.js +2927 -18
  342. package/dist/cjs/atomic-recs-interface.cjs.entry.js.map +1 -1
  343. package/dist/cjs/atomic-recs-list.cjs.entry.js +8 -8
  344. package/dist/cjs/atomic-recs-result-template.cjs.entry.js +4 -4
  345. package/dist/cjs/atomic-recs-result.cjs.entry.js +6 -6
  346. package/dist/cjs/atomic-refine-modal.cjs.entry.js +3 -3
  347. package/dist/cjs/atomic-refine-toggle.cjs.entry.js +1 -1
  348. package/dist/cjs/atomic-result-children-template.cjs.entry.js +4 -4
  349. package/dist/cjs/atomic-result-children.cjs.entry.js +2 -2
  350. package/dist/cjs/atomic-result-fields-list.cjs.entry.js +1 -1
  351. package/dist/cjs/atomic-result-icon.cjs.entry.js +1 -1
  352. package/dist/cjs/atomic-result-link.cjs.entry.js +1 -1
  353. package/dist/cjs/atomic-result-list.cjs.entry.js +9 -9
  354. package/dist/cjs/atomic-result-localized-text.cjs.entry.js +2 -2
  355. package/dist/cjs/atomic-result-multi-value-text.cjs.entry.js +1 -1
  356. package/dist/cjs/atomic-result-placeholder_8.cjs.entry.js +7 -7
  357. package/dist/cjs/atomic-result-printable-uri.cjs.entry.js +2 -2
  358. package/dist/cjs/atomic-result-section-children.cjs.entry.js +2 -2
  359. package/dist/cjs/atomic-result-section-emphasized.cjs.entry.js +2 -2
  360. package/dist/cjs/atomic-result-section-title-metadata.cjs.entry.js +2 -2
  361. package/dist/cjs/atomic-result-template.cjs.entry.js +4 -4
  362. package/dist/cjs/atomic-result.cjs.entry.js +6 -6
  363. package/dist/cjs/atomic-search-box-instant-results.cjs.entry.js +1 -1
  364. package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js +1 -1
  365. package/dist/cjs/atomic-search-box.cjs.entry.js +11 -7
  366. package/dist/cjs/atomic-search-box.cjs.entry.js.map +1 -1
  367. package/dist/cjs/atomic-segmented-facet.cjs.entry.js +2 -2
  368. package/dist/cjs/atomic-smart-snippet-answer_2.cjs.entry.js +3 -3
  369. package/dist/cjs/atomic-smart-snippet-collapse-wrapper_2.cjs.entry.js +3 -3
  370. package/dist/cjs/atomic-smart-snippet-feedback-modal.cjs.entry.js +4 -4
  371. package/dist/cjs/atomic-smart-snippet-suggestions.cjs.entry.js +1 -1
  372. package/dist/cjs/atomic-smart-snippet.cjs.entry.js +2 -2
  373. package/dist/cjs/atomic-sort-dropdown.cjs.entry.js +3 -3
  374. package/dist/cjs/atomic-sort-expression.cjs.entry.js +3 -3
  375. package/dist/cjs/atomic-stencil-facet-date-input.cjs.entry.js +3 -3
  376. package/dist/cjs/atomic-suggestion-renderer.cjs.entry.js +1 -1
  377. package/dist/cjs/atomic-tab-bar_2.cjs.entry.js +1 -1
  378. package/dist/cjs/atomic-tab-button.cjs.entry.js +1 -1
  379. package/dist/cjs/atomic-tab-manager.cjs.entry.js +1 -1
  380. package/dist/cjs/atomic-timeframe-facet.cjs.entry.js +4 -4
  381. package/dist/cjs/atomic.cjs.js +1 -1
  382. package/dist/cjs/{cloned-facet-elements-70cd1601.js → cloned-facet-elements-3c7ea837.js} +2 -2
  383. package/dist/cjs/{cloned-facet-elements-70cd1601.js.map → cloned-facet-elements-3c7ea837.js.map} +1 -1
  384. package/dist/cjs/{display-options-69531e8d.js → display-options-10f84088.js} +2 -2
  385. package/dist/cjs/{display-options-69531e8d.js.map → display-options-10f84088.js.map} +1 -1
  386. package/dist/cjs/index-757bc886.js +0 -4
  387. package/dist/cjs/{item-layout-sections-b09ba4b3.js → item-layout-sections-73e27d24.js} +2 -2
  388. package/dist/cjs/{item-layout-sections-b09ba4b3.js.map → item-layout-sections-73e27d24.js.map} +1 -1
  389. package/dist/cjs/{item-section-utils-8579462c.js → item-section-utils-37848715.js} +2 -2
  390. package/dist/cjs/{item-section-utils-8579462c.js.map → item-section-utils-37848715.js.map} +1 -1
  391. package/dist/cjs/{props-utils-1e4ba1b0.js → props-utils-15a042f3.js} +2 -2
  392. package/dist/cjs/{props-utils-1e4ba1b0.js.map → props-utils-15a042f3.js.map} +1 -1
  393. package/dist/cjs/{replace-breakpoint-utils-7a084f54.js → replace-breakpoint-utils-47f2eaa4.js} +1 -2
  394. package/dist/cjs/replace-breakpoint-utils-47f2eaa4.js.map +1 -0
  395. package/dist/cjs/{result-template-common-84bd4057.js → result-template-common-bc03b2ad.js} +3 -3
  396. package/dist/cjs/{result-template-common-84bd4057.js.map → result-template-common-bc03b2ad.js.map} +1 -1
  397. package/dist/cjs/{stencil-accessibility-utils-aa4c9f6c.js → stencil-accessibility-utils-86cc7071.js} +2 -2
  398. package/dist/cjs/{stencil-accessibility-utils-aa4c9f6c.js.map → stencil-accessibility-utils-86cc7071.js.map} +1 -1
  399. package/dist/cjs/{stencil-facet-value-e67c9332.js → stencil-facet-value-5957b403.js} +2 -2
  400. package/dist/cjs/{stencil-facet-value-e67c9332.js.map → stencil-facet-value-5957b403.js.map} +1 -1
  401. package/dist/cjs/{stencil-facet-value-checkbox-62f07459.js → stencil-facet-value-checkbox-fed178ad.js} +2 -2
  402. package/dist/cjs/{stencil-facet-value-checkbox-62f07459.js.map → stencil-facet-value-checkbox-fed178ad.js.map} +1 -1
  403. package/dist/cjs/{stencil-item-list-common-17bd1046.js → stencil-item-list-common-b08abf21.js} +4 -4
  404. package/dist/cjs/{stencil-item-list-common-17bd1046.js.map → stencil-item-list-common-b08abf21.js.map} +1 -1
  405. package/dist/cjs/{stencil-suggestion-manager-2cba6d69.js → stencil-suggestion-manager-88cb88f2.js} +2 -2
  406. package/dist/cjs/stencil-suggestion-manager-88cb88f2.js.map +1 -0
  407. package/dist/cjs/{stencil-values-container-9f50ec1a.js → stencil-values-container-d20f9b28.js} +2 -2
  408. package/dist/cjs/{stencil-values-container-9f50ec1a.js.map → stencil-values-container-d20f9b28.js.map} +1 -1
  409. package/dist/cjs/{store-82abd941.js → store-7927ea61.js} +2 -33
  410. package/dist/cjs/store-7927ea61.js.map +1 -0
  411. package/dist/cjs/{timeframe-facet-common-b5535cca.js → timeframe-facet-common-4ea96ccb.js} +2 -2
  412. package/dist/cjs/{timeframe-facet-common-b5535cca.js.map → timeframe-facet-common-4ea96ccb.js.map} +1 -1
  413. package/dist/cjs/{utils-7153ae6b.js → utils-12b49e87.js} +1 -18
  414. package/dist/cjs/utils-12b49e87.js.map +1 -0
  415. package/dist/cjs/version.cjs.js +1 -1
  416. package/dist/esm/_loader.js +1 -1
  417. package/dist/esm/atomic-automatic-facet_2.entry.js +3 -3
  418. package/dist/esm/atomic-breadbox.entry.js +2 -2
  419. package/dist/esm/atomic-category-facet.entry.js +4 -4
  420. package/dist/esm/atomic-citation.entry.js +1 -1
  421. package/dist/esm/atomic-color-facet.entry.js +3 -3
  422. package/dist/esm/atomic-facet-manager.entry.js +1 -1
  423. package/dist/esm/atomic-facet-number-input.entry.js +2 -2
  424. package/dist/esm/atomic-facet.entry.js +6 -6
  425. package/dist/esm/atomic-field-condition.entry.js +4 -4
  426. package/dist/esm/atomic-focus-trap.entry.js +2 -2
  427. package/dist/esm/atomic-folded-result-list.entry.js +8 -8
  428. package/dist/esm/atomic-format-currency.entry.js +1 -1
  429. package/dist/esm/atomic-format-number.entry.js +1 -1
  430. package/dist/esm/atomic-format-unit.entry.js +1 -1
  431. package/dist/esm/atomic-generated-answer-feedback-modal.entry.js +3 -3
  432. package/dist/esm/atomic-generated-answer.entry.js +3 -3
  433. package/dist/esm/atomic-html.entry.js +1 -1
  434. package/dist/esm/atomic-insight-edit-toggle.entry.js +1 -1
  435. package/dist/esm/atomic-insight-facet.entry.js +5 -5
  436. package/dist/esm/atomic-insight-folded-result-list.entry.js +8 -8
  437. package/dist/esm/atomic-insight-full-search-button.entry.js +1 -1
  438. package/dist/esm/atomic-insight-generated-answer.entry.js +2 -2
  439. package/dist/esm/atomic-insight-history-toggle.entry.js +1 -1
  440. package/dist/esm/atomic-insight-layout.entry.js +83 -3
  441. package/dist/esm/atomic-insight-layout.entry.js.map +1 -1
  442. package/dist/esm/atomic-insight-no-results.entry.js +3 -3
  443. package/dist/esm/atomic-insight-numeric-facet.entry.js +6 -6
  444. package/dist/esm/atomic-insight-pager.entry.js +4 -4
  445. package/dist/esm/atomic-insight-query-error.entry.js +3 -3
  446. package/dist/esm/atomic-insight-query-summary.entry.js +2 -2
  447. package/dist/esm/atomic-insight-refine-modal.entry.js +4 -5
  448. package/dist/esm/atomic-insight-refine-modal.entry.js.map +1 -1
  449. package/dist/esm/atomic-insight-refine-toggle.entry.js +1 -1
  450. package/dist/esm/atomic-insight-result-action-bar.entry.js +2 -2
  451. package/dist/esm/atomic-insight-result-action.entry.js +1 -1
  452. package/dist/esm/atomic-insight-result-attach-to-case-action.entry.js +1 -1
  453. package/dist/esm/atomic-insight-result-attach-to-case-indicator.entry.js +1 -1
  454. package/dist/esm/atomic-insight-result-children-template.entry.js +4 -4
  455. package/dist/esm/atomic-insight-result-children.entry.js +2 -2
  456. package/dist/esm/atomic-insight-result-list.entry.js +8 -8
  457. package/dist/esm/atomic-insight-result-quickview-action.entry.js +3 -3
  458. package/dist/esm/atomic-insight-result-template.entry.js +4 -4
  459. package/dist/esm/atomic-insight-result.entry.js +7 -7
  460. package/dist/esm/atomic-insight-search-box.entry.js +5 -5
  461. package/dist/esm/atomic-insight-smart-snippet-feedback-modal.entry.js +4 -4
  462. package/dist/esm/atomic-insight-smart-snippet-suggestions.entry.js +1 -1
  463. package/dist/esm/atomic-insight-smart-snippet.entry.js +1 -1
  464. package/dist/esm/atomic-insight-tab.entry.js +2 -2
  465. package/dist/esm/atomic-insight-tabs.entry.js +1 -1
  466. package/dist/esm/atomic-insight-timeframe-facet.entry.js +4 -4
  467. package/dist/esm/atomic-insight-user-actions-session_2.entry.js +1 -1
  468. package/dist/esm/atomic-insight-user-actions-toggle.entry.js +1 -1
  469. package/dist/esm/atomic-ipx-body.entry.js +4 -4
  470. package/dist/esm/atomic-ipx-button.entry.js +2 -2
  471. package/dist/esm/atomic-ipx-embedded.entry.js +3 -3
  472. package/dist/esm/atomic-ipx-modal.entry.js +4 -4
  473. package/dist/esm/atomic-ipx-recs-list.entry.js +8 -8
  474. package/dist/esm/atomic-ipx-refine-modal.entry.js +3 -4
  475. package/dist/esm/atomic-ipx-refine-modal.entry.js.map +1 -1
  476. package/dist/esm/atomic-ipx-refine-toggle.entry.js +1 -1
  477. package/dist/esm/atomic-ipx-result-link.entry.js +1 -1
  478. package/dist/esm/atomic-ipx-tab.entry.js +1 -2
  479. package/dist/esm/atomic-ipx-tab.entry.js.map +1 -1
  480. package/dist/esm/atomic-ipx-tabs.entry.js +1 -1
  481. package/dist/esm/atomic-load-more-results.entry.js +2 -3
  482. package/dist/esm/atomic-load-more-results.entry.js.map +1 -1
  483. package/dist/esm/atomic-no-results.entry.js +3 -3
  484. package/dist/esm/atomic-notifications.entry.js +2 -2
  485. package/dist/esm/atomic-numeric-facet.entry.js +6 -6
  486. package/dist/esm/atomic-query-error.entry.js +3 -3
  487. package/dist/esm/atomic-quickview-modal.entry.js +1 -1
  488. package/dist/esm/atomic-quickview.entry.js +3 -3
  489. package/dist/esm/atomic-rating-facet.entry.js +4 -4
  490. package/dist/esm/atomic-rating-range-facet.entry.js +3 -3
  491. package/dist/esm/atomic-recs-error.entry.js +3 -3
  492. package/dist/esm/atomic-recs-interface.entry.js +2919 -10
  493. package/dist/esm/atomic-recs-interface.entry.js.map +1 -1
  494. package/dist/esm/atomic-recs-list.entry.js +8 -8
  495. package/dist/esm/atomic-recs-result-template.entry.js +4 -4
  496. package/dist/esm/atomic-recs-result.entry.js +6 -6
  497. package/dist/esm/atomic-refine-modal.entry.js +3 -3
  498. package/dist/esm/atomic-refine-toggle.entry.js +1 -1
  499. package/dist/esm/atomic-result-children-template.entry.js +4 -4
  500. package/dist/esm/atomic-result-children.entry.js +2 -2
  501. package/dist/esm/atomic-result-fields-list.entry.js +1 -1
  502. package/dist/esm/atomic-result-icon.entry.js +1 -1
  503. package/dist/esm/atomic-result-link.entry.js +1 -1
  504. package/dist/esm/atomic-result-list.entry.js +9 -9
  505. package/dist/esm/atomic-result-localized-text.entry.js +2 -2
  506. package/dist/esm/atomic-result-multi-value-text.entry.js +1 -1
  507. package/dist/esm/atomic-result-placeholder_8.entry.js +7 -7
  508. package/dist/esm/atomic-result-printable-uri.entry.js +2 -2
  509. package/dist/esm/atomic-result-section-children.entry.js +2 -2
  510. package/dist/esm/atomic-result-section-emphasized.entry.js +2 -2
  511. package/dist/esm/atomic-result-section-title-metadata.entry.js +2 -2
  512. package/dist/esm/atomic-result-template.entry.js +4 -4
  513. package/dist/esm/atomic-result.entry.js +6 -6
  514. package/dist/esm/atomic-search-box-instant-results.entry.js +1 -1
  515. package/dist/esm/atomic-search-box-query-suggestions.entry.js +1 -1
  516. package/dist/esm/atomic-search-box.entry.js +11 -7
  517. package/dist/esm/atomic-search-box.entry.js.map +1 -1
  518. package/dist/esm/atomic-segmented-facet.entry.js +2 -2
  519. package/dist/esm/atomic-smart-snippet-answer_2.entry.js +3 -3
  520. package/dist/esm/atomic-smart-snippet-collapse-wrapper_2.entry.js +3 -3
  521. package/dist/esm/atomic-smart-snippet-feedback-modal.entry.js +4 -4
  522. package/dist/esm/atomic-smart-snippet-suggestions.entry.js +1 -1
  523. package/dist/esm/atomic-smart-snippet.entry.js +2 -2
  524. package/dist/esm/atomic-sort-dropdown.entry.js +3 -3
  525. package/dist/esm/atomic-sort-expression.entry.js +3 -3
  526. package/dist/esm/atomic-stencil-facet-date-input.entry.js +3 -3
  527. package/dist/esm/atomic-suggestion-renderer.entry.js +1 -1
  528. package/dist/esm/atomic-tab-bar_2.entry.js +1 -1
  529. package/dist/esm/atomic-tab-button.entry.js +1 -1
  530. package/dist/esm/atomic-tab-manager.entry.js +1 -1
  531. package/dist/esm/atomic-timeframe-facet.entry.js +4 -4
  532. package/dist/esm/atomic.js +1 -1
  533. package/dist/esm/{cloned-facet-elements-807b566b.js → cloned-facet-elements-82071d0c.js} +2 -2
  534. package/dist/esm/{cloned-facet-elements-807b566b.js.map → cloned-facet-elements-82071d0c.js.map} +1 -1
  535. package/dist/esm/{display-options-1199eed5.js → display-options-b7c33617.js} +2 -2
  536. package/dist/esm/{display-options-1199eed5.js.map → display-options-b7c33617.js.map} +1 -1
  537. package/dist/esm/index-3f35faca.js +0 -4
  538. package/dist/esm/{item-layout-sections-8afb5049.js → item-layout-sections-26123790.js} +2 -2
  539. package/dist/esm/{item-layout-sections-8afb5049.js.map → item-layout-sections-26123790.js.map} +1 -1
  540. package/dist/esm/{item-section-utils-46828f30.js → item-section-utils-d8aa24b7.js} +2 -2
  541. package/dist/esm/{item-section-utils-46828f30.js.map → item-section-utils-d8aa24b7.js.map} +1 -1
  542. package/dist/esm/{props-utils-e97ad6bd.js → props-utils-6040b5d2.js} +2 -2
  543. package/dist/esm/{props-utils-e97ad6bd.js.map → props-utils-6040b5d2.js.map} +1 -1
  544. package/dist/esm/{replace-breakpoint-utils-7a336631.js → replace-breakpoint-utils-13ff9ca5.js} +2 -2
  545. package/dist/esm/replace-breakpoint-utils-13ff9ca5.js.map +1 -0
  546. package/dist/esm/{result-template-common-995b94f8.js → result-template-common-47799c7c.js} +3 -3
  547. package/dist/esm/{result-template-common-995b94f8.js.map → result-template-common-47799c7c.js.map} +1 -1
  548. package/dist/esm/{stencil-accessibility-utils-196a08f3.js → stencil-accessibility-utils-ae75044b.js} +2 -2
  549. package/dist/esm/{stencil-accessibility-utils-196a08f3.js.map → stencil-accessibility-utils-ae75044b.js.map} +1 -1
  550. package/dist/esm/{stencil-facet-value-30dc9b6c.js → stencil-facet-value-9deafe8e.js} +2 -2
  551. package/dist/esm/{stencil-facet-value-30dc9b6c.js.map → stencil-facet-value-9deafe8e.js.map} +1 -1
  552. package/dist/esm/{stencil-facet-value-checkbox-0637f7f8.js → stencil-facet-value-checkbox-c0df7c4e.js} +2 -2
  553. package/dist/esm/{stencil-facet-value-checkbox-0637f7f8.js.map → stencil-facet-value-checkbox-c0df7c4e.js.map} +1 -1
  554. package/dist/esm/{stencil-item-list-common-fc95e16b.js → stencil-item-list-common-d2833d51.js} +4 -4
  555. package/dist/esm/{stencil-item-list-common-fc95e16b.js.map → stencil-item-list-common-d2833d51.js.map} +1 -1
  556. package/dist/esm/{stencil-suggestion-manager-376f83e8.js → stencil-suggestion-manager-1f4ed8d0.js} +2 -2
  557. package/dist/esm/stencil-suggestion-manager-1f4ed8d0.js.map +1 -0
  558. package/dist/esm/{stencil-values-container-55a7e816.js → stencil-values-container-9b9cd73f.js} +2 -2
  559. package/dist/esm/{stencil-values-container-55a7e816.js.map → stencil-values-container-9b9cd73f.js.map} +1 -1
  560. package/dist/esm/{store-015afa83.js → store-7d2c2a8c.js} +3 -31
  561. package/dist/esm/store-7d2c2a8c.js.map +1 -0
  562. package/dist/esm/{timeframe-facet-common-eb1016d2.js → timeframe-facet-common-55fc72f3.js} +2 -2
  563. package/dist/esm/{timeframe-facet-common-eb1016d2.js.map → timeframe-facet-common-55fc72f3.js.map} +1 -1
  564. package/dist/esm/{utils-7161486d.js → utils-6400ebde.js} +2 -18
  565. package/dist/esm/utils-6400ebde.js.map +1 -0
  566. package/dist/esm/version.js +1 -1
  567. package/dist/types/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.d.ts +2 -0
  568. package/dist/types/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.d.ts +1 -0
  569. package/dist/types/components/commerce/atomic-commerce-search-box-recent-queries/atomic-commerce-search-box-recent-queries.d.ts +2 -0
  570. package/dist/types/components/common/breadbox/breadcrumb-button.d.ts +2 -0
  571. package/dist/types/components/insight/atomic-insight-interface/atomic-insight-interface.d.ts +35 -42
  572. package/dist/types/components/insight/index.d.ts +1 -1
  573. package/dist/types/components/search/atomic-search-box/atomic-search-box.d.ts +1 -0
  574. package/dist/types/components.d.ts +4 -113
  575. package/dist/types/directives/hierarchical-path.d.ts +1 -1
  576. package/docs/atomic-docs.json +6 -421
  577. package/package.json +1 -1
  578. package/dist/atomic/components/analytics-config.js +0 -2918
  579. package/dist/atomic/components/analytics-config.js.map +0 -1
  580. package/dist/atomic/components/atomic-insight-interface.d.ts +0 -11
  581. package/dist/atomic/components/atomic-insight-interface.js +0 -332
  582. package/dist/atomic/components/atomic-insight-interface.js.map +0 -1
  583. package/dist/atomic/components/insight-layout.js +0 -87
  584. package/dist/atomic/components/insight-layout.js.map +0 -1
  585. package/dist/atomic/p-0e62bdd6.js +0 -2
  586. package/dist/atomic/p-0e62bdd6.js.map +0 -1
  587. package/dist/atomic/p-16f4ce98.js +0 -2
  588. package/dist/atomic/p-16f4ce98.js.map +0 -1
  589. package/dist/atomic/p-26598ee0.js +0 -2
  590. package/dist/atomic/p-28e882e8.js +0 -2
  591. package/dist/atomic/p-2e721bf7.entry.js +0 -2
  592. package/dist/atomic/p-2e721bf7.entry.js.map +0 -1
  593. package/dist/atomic/p-345c425d.entry.js +0 -2
  594. package/dist/atomic/p-4913eb5c.js +0 -2
  595. package/dist/atomic/p-4913eb5c.js.map +0 -1
  596. package/dist/atomic/p-5387f396.entry.js +0 -2
  597. package/dist/atomic/p-5387f396.entry.js.map +0 -1
  598. package/dist/atomic/p-56c97c3e.js +0 -2
  599. package/dist/atomic/p-768b172e.entry.js +0 -2
  600. package/dist/atomic/p-768b172e.entry.js.map +0 -1
  601. package/dist/atomic/p-83d3857f.entry.js.map +0 -1
  602. package/dist/atomic/p-a12e1c59.js +0 -2
  603. package/dist/atomic/p-a12e1c59.js.map +0 -1
  604. package/dist/atomic/p-a1522fe5.entry.js +0 -2
  605. package/dist/atomic/p-a1ee594f.entry.js +0 -2
  606. package/dist/atomic/p-b6415814.entry.js +0 -2
  607. package/dist/atomic/p-c2b4b401.entry.js +0 -2
  608. package/dist/atomic/p-c7af4b9e.entry.js +0 -2
  609. package/dist/atomic/p-cc0bf58b.js +0 -2
  610. package/dist/atomic/p-cc0bf58b.js.map +0 -1
  611. package/dist/cjs/analytics-config-c215586d.js +0 -2927
  612. package/dist/cjs/analytics-config-c215586d.js.map +0 -1
  613. package/dist/cjs/atomic-insight-interface.cjs.entry.js +0 -307
  614. package/dist/cjs/atomic-insight-interface.cjs.entry.js.map +0 -1
  615. package/dist/cjs/insight-layout-b6ff92fd.js +0 -90
  616. package/dist/cjs/insight-layout-b6ff92fd.js.map +0 -1
  617. package/dist/cjs/replace-breakpoint-utils-7a084f54.js.map +0 -1
  618. package/dist/cjs/stencil-suggestion-manager-2cba6d69.js.map +0 -1
  619. package/dist/cjs/store-82abd941.js.map +0 -1
  620. package/dist/cjs/utils-7153ae6b.js.map +0 -1
  621. package/dist/esm/analytics-config-f3ba6c2b.js +0 -2918
  622. package/dist/esm/analytics-config-f3ba6c2b.js.map +0 -1
  623. package/dist/esm/atomic-insight-interface.entry.js +0 -303
  624. package/dist/esm/atomic-insight-interface.entry.js.map +0 -1
  625. package/dist/esm/insight-layout-a1e4b795.js +0 -87
  626. package/dist/esm/insight-layout-a1e4b795.js.map +0 -1
  627. package/dist/esm/replace-breakpoint-utils-7a336631.js.map +0 -1
  628. package/dist/esm/stencil-suggestion-manager-376f83e8.js.map +0 -1
  629. package/dist/esm/store-015afa83.js.map +0 -1
  630. package/dist/esm/utils-7161486d.js.map +0 -1
  631. /package/dist/atomic/{p-27cf779a.js.map → p-025a346a.js.map} +0 -0
  632. /package/dist/atomic/{p-7e971d15.entry.js.map → p-044de1f9.entry.js.map} +0 -0
  633. /package/dist/atomic/{p-fe59fb2d.entry.js.map → p-0535b93d.entry.js.map} +0 -0
  634. /package/dist/atomic/{p-31a13850.js.map → p-0580b866.js.map} +0 -0
  635. /package/dist/atomic/{p-0edea6f9.entry.js.map → p-05f1ff6f.entry.js.map} +0 -0
  636. /package/dist/atomic/{p-3e9db2b5.entry.js.map → p-088d634c.entry.js.map} +0 -0
  637. /package/dist/atomic/{p-4bdc6d5a.entry.js.map → p-0ee7cab8.entry.js.map} +0 -0
  638. /package/dist/atomic/{p-0f449e9d.entry.js.map → p-14bad769.entry.js.map} +0 -0
  639. /package/dist/atomic/{p-01511388.entry.js.map → p-15547bd5.entry.js.map} +0 -0
  640. /package/dist/atomic/{p-b313058c.entry.js.map → p-182f9112.entry.js.map} +0 -0
  641. /package/dist/atomic/{p-00069a4b.entry.js.map → p-1910eb7f.entry.js.map} +0 -0
  642. /package/dist/atomic/{p-85145c88.entry.js.map → p-1c8bcadf.entry.js.map} +0 -0
  643. /package/dist/atomic/{p-cafa4083.entry.js.map → p-21ab7750.entry.js.map} +0 -0
  644. /package/dist/atomic/{p-9a6ec803.entry.js.map → p-229018fa.entry.js.map} +0 -0
  645. /package/dist/atomic/{p-89d8bb0d.entry.js.map → p-22b76c96.entry.js.map} +0 -0
  646. /package/dist/atomic/{p-36f63642.entry.js.map → p-26e0c1f8.entry.js.map} +0 -0
  647. /package/dist/atomic/{p-c4fb6426.entry.js.map → p-2e13e2c0.entry.js.map} +0 -0
  648. /package/dist/atomic/{p-6098b906.entry.js.map → p-2f437b47.entry.js.map} +0 -0
  649. /package/dist/atomic/{p-998393ec.entry.js.map → p-2f517a54.entry.js.map} +0 -0
  650. /package/dist/atomic/{p-06284430.entry.js.map → p-318c96f5.entry.js.map} +0 -0
  651. /package/dist/atomic/{p-0ed76e65.entry.js.map → p-3272a04b.entry.js.map} +0 -0
  652. /package/dist/atomic/{p-d211a422.entry.js.map → p-3291adda.entry.js.map} +0 -0
  653. /package/dist/atomic/{p-dbc0ce5c.entry.js.map → p-33245038.entry.js.map} +0 -0
  654. /package/dist/atomic/{p-fa658ef2.entry.js.map → p-35c2ee5f.entry.js.map} +0 -0
  655. /package/dist/atomic/{p-3d55fce6.entry.js.map → p-36e2c945.entry.js.map} +0 -0
  656. /package/dist/atomic/{p-af1b4924.entry.js.map → p-3bd8469f.entry.js.map} +0 -0
  657. /package/dist/atomic/{p-e62fc40e.js.map → p-3ef52afa.js.map} +0 -0
  658. /package/dist/atomic/{p-170c7da6.entry.js.map → p-400c28b6.entry.js.map} +0 -0
  659. /package/dist/atomic/{p-fafd5042.entry.js.map → p-448091f7.entry.js.map} +0 -0
  660. /package/dist/atomic/{p-fe3cd55b.entry.js.map → p-44d96103.entry.js.map} +0 -0
  661. /package/dist/atomic/{p-da845e35.entry.js.map → p-463336ca.entry.js.map} +0 -0
  662. /package/dist/atomic/{p-f9dd14b2.entry.js.map → p-479cb38a.entry.js.map} +0 -0
  663. /package/dist/atomic/{p-a9383817.entry.js.map → p-47b41b27.entry.js.map} +0 -0
  664. /package/dist/atomic/{p-be2a43f4.entry.js.map → p-48bab1a6.entry.js.map} +0 -0
  665. /package/dist/atomic/{p-0c8e7d5f.entry.js.map → p-4cb91ee7.entry.js.map} +0 -0
  666. /package/dist/atomic/{p-23d4dc54.entry.js.map → p-558f2191.entry.js.map} +0 -0
  667. /package/dist/atomic/{p-8572a953.entry.js.map → p-55c41e00.entry.js.map} +0 -0
  668. /package/dist/atomic/{p-2e4628bb.entry.js.map → p-57049cd2.entry.js.map} +0 -0
  669. /package/dist/atomic/{p-edd4d5f7.js.map → p-5a2ef889.js.map} +0 -0
  670. /package/dist/atomic/{p-dc128135.entry.js.map → p-5a83b7e5.entry.js.map} +0 -0
  671. /package/dist/atomic/{p-10b5e0f3.entry.js.map → p-5b8cc4bc.entry.js.map} +0 -0
  672. /package/dist/atomic/{p-87f69e53.entry.js.map → p-5cab535b.entry.js.map} +0 -0
  673. /package/dist/atomic/{p-56c97c3e.js.map → p-5d0fc7e2.js.map} +0 -0
  674. /package/dist/atomic/{p-740cd5bc.entry.js.map → p-6439156c.entry.js.map} +0 -0
  675. /package/dist/atomic/{p-7e9a1a1a.entry.js.map → p-66166975.entry.js.map} +0 -0
  676. /package/dist/atomic/{p-97538903.entry.js.map → p-6698d5e9.entry.js.map} +0 -0
  677. /package/dist/atomic/{p-0610b3e7.entry.js.map → p-6819f12c.entry.js.map} +0 -0
  678. /package/dist/atomic/{p-28e882e8.js.map → p-6b3429d3.js.map} +0 -0
  679. /package/dist/atomic/{p-6078667f.entry.js.map → p-7045745d.entry.js.map} +0 -0
  680. /package/dist/atomic/{p-a130b00b.entry.js.map → p-70747efa.entry.js.map} +0 -0
  681. /package/dist/atomic/{p-4830b9bb.entry.js.map → p-7242b46e.entry.js.map} +0 -0
  682. /package/dist/atomic/{p-3af2fca0.js.map → p-7427daa3.js.map} +0 -0
  683. /package/dist/atomic/{p-b320f270.entry.js.map → p-76c14d82.entry.js.map} +0 -0
  684. /package/dist/atomic/{p-1435fb6f.entry.js.map → p-7741124a.entry.js.map} +0 -0
  685. /package/dist/atomic/{p-cdeb5f2a.entry.js.map → p-77d00da1.entry.js.map} +0 -0
  686. /package/dist/atomic/{p-519d9abd.entry.js.map → p-7fd58269.entry.js.map} +0 -0
  687. /package/dist/atomic/{p-f76b7ac3.entry.js.map → p-80290dd3.entry.js.map} +0 -0
  688. /package/dist/atomic/{p-b6ae0244.entry.js.map → p-81bdbd07.entry.js.map} +0 -0
  689. /package/dist/atomic/{p-dc28ee14.js.map → p-828ab4ff.js.map} +0 -0
  690. /package/dist/atomic/{p-723f76a1.entry.js.map → p-82cd6398.entry.js.map} +0 -0
  691. /package/dist/atomic/{p-fdcd187d.entry.js.map → p-851b9735.entry.js.map} +0 -0
  692. /package/dist/atomic/{p-40c1dfcb.entry.js.map → p-874f0a4c.entry.js.map} +0 -0
  693. /package/dist/atomic/{p-373448df.entry.js.map → p-8b0cf1d4.entry.js.map} +0 -0
  694. /package/dist/atomic/{p-36112c34.entry.js.map → p-8b0d881e.entry.js.map} +0 -0
  695. /package/dist/atomic/{p-ee957926.entry.js.map → p-8d5228da.entry.js.map} +0 -0
  696. /package/dist/atomic/{p-c25f1437.entry.js.map → p-955092ed.entry.js.map} +0 -0
  697. /package/dist/atomic/{p-47ab6c9f.entry.js.map → p-99d4c4bf.entry.js.map} +0 -0
  698. /package/dist/atomic/{p-edede7d1.entry.js.map → p-9aad555a.entry.js.map} +0 -0
  699. /package/dist/atomic/{p-2250f505.js.map → p-9ae68e86.js.map} +0 -0
  700. /package/dist/atomic/{p-00a6ab8c.entry.js.map → p-a0ebbbdf.entry.js.map} +0 -0
  701. /package/dist/atomic/{p-7fd5b6ac.entry.js.map → p-a1798150.entry.js.map} +0 -0
  702. /package/dist/atomic/{p-9239be63.entry.js.map → p-a54f3f24.entry.js.map} +0 -0
  703. /package/dist/atomic/{p-24fd7df6.entry.js.map → p-a6dde0f6.entry.js.map} +0 -0
  704. /package/dist/atomic/{p-a1e5f767.entry.js.map → p-a78cbb80.entry.js.map} +0 -0
  705. /package/dist/atomic/{p-59b15bd6.entry.js.map → p-ae69f519.entry.js.map} +0 -0
  706. /package/dist/atomic/{p-98dd6df1.entry.js.map → p-b06de6f8.entry.js.map} +0 -0
  707. /package/dist/atomic/{p-fdd0aa42.entry.js.map → p-b1b583a0.entry.js.map} +0 -0
  708. /package/dist/atomic/{p-3c9289b5.js.map → p-b29d121c.js.map} +0 -0
  709. /package/dist/atomic/{p-cb3fd0f4.entry.js.map → p-b84108f3.entry.js.map} +0 -0
  710. /package/dist/atomic/{p-fb1a1e2e.entry.js.map → p-b85c2c46.entry.js.map} +0 -0
  711. /package/dist/atomic/{p-9260dd7d.entry.js.map → p-b9eeac20.entry.js.map} +0 -0
  712. /package/dist/atomic/{p-b2b9e83f.entry.js.map → p-bc43df67.entry.js.map} +0 -0
  713. /package/dist/atomic/{p-93601dc0.entry.js.map → p-bd01acd5.entry.js.map} +0 -0
  714. /package/dist/atomic/{p-416d088e.entry.js.map → p-be011bd1.entry.js.map} +0 -0
  715. /package/dist/atomic/{p-4f4c9a03.entry.js.map → p-c2a5dac0.entry.js.map} +0 -0
  716. /package/dist/atomic/{p-93f1d551.entry.js.map → p-c5164dbf.entry.js.map} +0 -0
  717. /package/dist/atomic/{p-3622ed6c.js.map → p-c619df9b.js.map} +0 -0
  718. /package/dist/atomic/{p-1bbaf206.entry.js.map → p-c8190eb9.entry.js.map} +0 -0
  719. /package/dist/atomic/{p-5ca21deb.js.map → p-ca37969c.js.map} +0 -0
  720. /package/dist/atomic/{p-7cced247.entry.js.map → p-d0ab0125.entry.js.map} +0 -0
  721. /package/dist/atomic/{p-2fb49fe8.entry.js.map → p-d8caa4d8.entry.js.map} +0 -0
  722. /package/dist/atomic/{p-62e85c20.entry.js.map → p-da87ef51.entry.js.map} +0 -0
  723. /package/dist/atomic/{p-367ec37d.entry.js.map → p-db2d92c5.entry.js.map} +0 -0
  724. /package/dist/atomic/{p-dbf0c5a3.entry.js.map → p-db3b11ca.entry.js.map} +0 -0
  725. /package/dist/atomic/{p-20b33c18.entry.js.map → p-dd24c66a.entry.js.map} +0 -0
  726. /package/dist/atomic/{p-0f39889d.entry.js.map → p-dea22a8d.entry.js.map} +0 -0
  727. /package/dist/atomic/{p-bbfe727a.entry.js.map → p-df8d38ca.entry.js.map} +0 -0
  728. /package/dist/atomic/{p-f9608731.entry.js.map → p-e276c7e0.entry.js.map} +0 -0
  729. /package/dist/atomic/{p-ce5b896e.entry.js.map → p-e455330c.entry.js.map} +0 -0
  730. /package/dist/atomic/{p-59f043a0.entry.js.map → p-e49ad083.entry.js.map} +0 -0
  731. /package/dist/atomic/{p-30c09377.entry.js.map → p-e6871a3f.entry.js.map} +0 -0
  732. /package/dist/atomic/{p-c9f1790d.entry.js.map → p-e6dc9de7.entry.js.map} +0 -0
  733. /package/dist/atomic/{p-6f1bffa2.entry.js.map → p-e8176ac8.entry.js.map} +0 -0
  734. /package/dist/atomic/{p-52d5461a.entry.js.map → p-ed413091.entry.js.map} +0 -0
  735. /package/dist/atomic/{p-3549a469.entry.js.map → p-f0c657f4.entry.js.map} +0 -0
  736. /package/dist/atomic/{p-f936f55e.entry.js.map → p-f1241140.entry.js.map} +0 -0
  737. /package/dist/atomic/{p-c2b4b401.entry.js.map → p-f4818e53.entry.js.map} +0 -0
  738. /package/dist/atomic/{p-dd35e7ad.entry.js.map → p-f65ca329.entry.js.map} +0 -0
  739. /package/dist/atomic/{p-6f34dd3a.entry.js.map → p-f800678c.entry.js.map} +0 -0
  740. /package/dist/atomic/{p-e7a25b00.entry.js.map → p-fb517fba.entry.js.map} +0 -0
  741. /package/dist/atomic/{p-97829295.entry.js.map → p-fc71835d.entry.js.map} +0 -0
  742. /package/dist/atomic/{p-a5f66ecd.entry.js.map → p-fd1ef9e3.entry.js.map} +0 -0
@@ -1,2927 +0,0 @@
1
- 'use strict';
2
-
3
- const dayjs_min = require('./dayjs.min-8b80e6d1.js');
4
- const headless = require('@coveo/headless');
5
- const index = require('./index-757bc886.js');
6
- const purify = require('./purify-85b542e2.js');
7
-
8
- const isString = obj => typeof obj === 'string';
9
- const defer = () => {
10
- let res;
11
- let rej;
12
- const promise = new Promise((resolve, reject) => {
13
- res = resolve;
14
- rej = reject;
15
- });
16
- promise.resolve = res;
17
- promise.reject = rej;
18
- return promise;
19
- };
20
- const makeString = object => {
21
- if (object == null) return '';
22
- return '' + object;
23
- };
24
- const copy = (a, s, t) => {
25
- a.forEach(m => {
26
- if (s[m]) t[m] = s[m];
27
- });
28
- };
29
- const lastOfPathSeparatorRegExp = /###/g;
30
- const cleanKey = key => key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
31
- const canNotTraverseDeeper = object => !object || isString(object);
32
- const getLastOfPath = (object, path, Empty) => {
33
- const stack = !isString(path) ? path : path.split('.');
34
- let stackIndex = 0;
35
- while (stackIndex < stack.length - 1) {
36
- if (canNotTraverseDeeper(object)) return {};
37
- const key = cleanKey(stack[stackIndex]);
38
- if (!object[key] && Empty) object[key] = new Empty();
39
- if (Object.prototype.hasOwnProperty.call(object, key)) {
40
- object = object[key];
41
- } else {
42
- object = {};
43
- }
44
- ++stackIndex;
45
- }
46
- if (canNotTraverseDeeper(object)) return {};
47
- return {
48
- obj: object,
49
- k: cleanKey(stack[stackIndex])
50
- };
51
- };
52
- const setPath = (object, path, newValue) => {
53
- const {
54
- obj,
55
- k
56
- } = getLastOfPath(object, path, Object);
57
- if (obj !== undefined || path.length === 1) {
58
- obj[k] = newValue;
59
- return;
60
- }
61
- let e = path[path.length - 1];
62
- let p = path.slice(0, path.length - 1);
63
- let last = getLastOfPath(object, p, Object);
64
- while (last.obj === undefined && p.length) {
65
- e = `${p[p.length - 1]}.${e}`;
66
- p = p.slice(0, p.length - 1);
67
- last = getLastOfPath(object, p, Object);
68
- if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== 'undefined') {
69
- last.obj = undefined;
70
- }
71
- }
72
- last.obj[`${last.k}.${e}`] = newValue;
73
- };
74
- const pushPath = (object, path, newValue, concat) => {
75
- const {
76
- obj,
77
- k
78
- } = getLastOfPath(object, path, Object);
79
- obj[k] = obj[k] || [];
80
- obj[k].push(newValue);
81
- };
82
- const getPath = (object, path) => {
83
- const {
84
- obj,
85
- k
86
- } = getLastOfPath(object, path);
87
- if (!obj) return undefined;
88
- if (!Object.prototype.hasOwnProperty.call(obj, k)) return undefined;
89
- return obj[k];
90
- };
91
- const getPathWithDefaults = (data, defaultData, key) => {
92
- const value = getPath(data, key);
93
- if (value !== undefined) {
94
- return value;
95
- }
96
- return getPath(defaultData, key);
97
- };
98
- const deepExtend = (target, source, overwrite) => {
99
- for (const prop in source) {
100
- if (prop !== '__proto__' && prop !== 'constructor') {
101
- if (prop in target) {
102
- if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
103
- if (overwrite) target[prop] = source[prop];
104
- } else {
105
- deepExtend(target[prop], source[prop], overwrite);
106
- }
107
- } else {
108
- target[prop] = source[prop];
109
- }
110
- }
111
- }
112
- return target;
113
- };
114
- const regexEscape = str => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
115
- var _entityMap = {
116
- '&': '&amp;',
117
- '<': '&lt;',
118
- '>': '&gt;',
119
- '"': '&quot;',
120
- "'": '&#39;',
121
- '/': '&#x2F;'
122
- };
123
- const escape = data => {
124
- if (isString(data)) {
125
- return data.replace(/[&<>"'\/]/g, s => _entityMap[s]);
126
- }
127
- return data;
128
- };
129
- class RegExpCache {
130
- constructor(capacity) {
131
- this.capacity = capacity;
132
- this.regExpMap = new Map();
133
- this.regExpQueue = [];
134
- }
135
- getRegExp(pattern) {
136
- const regExpFromCache = this.regExpMap.get(pattern);
137
- if (regExpFromCache !== undefined) {
138
- return regExpFromCache;
139
- }
140
- const regExpNew = new RegExp(pattern);
141
- if (this.regExpQueue.length === this.capacity) {
142
- this.regExpMap.delete(this.regExpQueue.shift());
143
- }
144
- this.regExpMap.set(pattern, regExpNew);
145
- this.regExpQueue.push(pattern);
146
- return regExpNew;
147
- }
148
- }
149
- const chars = [' ', ',', '?', '!', ';'];
150
- const looksLikeObjectPathRegExpCache = new RegExpCache(20);
151
- const looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
152
- nsSeparator = nsSeparator || '';
153
- keySeparator = keySeparator || '';
154
- const possibleChars = chars.filter(c => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
155
- if (possibleChars.length === 0) return true;
156
- const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map(c => c === '?' ? '\\?' : c).join('|')})`);
157
- let matched = !r.test(key);
158
- if (!matched) {
159
- const ki = key.indexOf(keySeparator);
160
- if (ki > 0 && !r.test(key.substring(0, ki))) {
161
- matched = true;
162
- }
163
- }
164
- return matched;
165
- };
166
- const deepFind = (obj, path, keySeparator = '.') => {
167
- if (!obj) return undefined;
168
- if (obj[path]) {
169
- if (!Object.prototype.hasOwnProperty.call(obj, path)) return undefined;
170
- return obj[path];
171
- }
172
- const tokens = path.split(keySeparator);
173
- let current = obj;
174
- for (let i = 0; i < tokens.length;) {
175
- if (!current || typeof current !== 'object') {
176
- return undefined;
177
- }
178
- let next;
179
- let nextPath = '';
180
- for (let j = i; j < tokens.length; ++j) {
181
- if (j !== i) {
182
- nextPath += keySeparator;
183
- }
184
- nextPath += tokens[j];
185
- next = current[nextPath];
186
- if (next !== undefined) {
187
- if (['string', 'number', 'boolean'].indexOf(typeof next) > -1 && j < tokens.length - 1) {
188
- continue;
189
- }
190
- i += j - i + 1;
191
- break;
192
- }
193
- }
194
- current = next;
195
- }
196
- return current;
197
- };
198
- const getCleanedCode = code => code?.replace('_', '-');
199
-
200
- const consoleLogger = {
201
- type: 'logger',
202
- log(args) {
203
- this.output('log', args);
204
- },
205
- warn(args) {
206
- this.output('warn', args);
207
- },
208
- error(args) {
209
- this.output('error', args);
210
- },
211
- output(type, args) {
212
- console?.[type]?.apply?.(console, args);
213
- }
214
- };
215
- class Logger {
216
- constructor(concreteLogger, options = {}) {
217
- this.init(concreteLogger, options);
218
- }
219
- init(concreteLogger, options = {}) {
220
- this.prefix = options.prefix || 'i18next:';
221
- this.logger = concreteLogger || consoleLogger;
222
- this.options = options;
223
- this.debug = options.debug;
224
- }
225
- log(...args) {
226
- return this.forward(args, 'log', '', true);
227
- }
228
- warn(...args) {
229
- return this.forward(args, 'warn', '', true);
230
- }
231
- error(...args) {
232
- return this.forward(args, 'error', '');
233
- }
234
- deprecate(...args) {
235
- return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
236
- }
237
- forward(args, lvl, prefix, debugOnly) {
238
- if (debugOnly && !this.debug) return null;
239
- if (isString(args[0])) args[0] = `${prefix}${this.prefix} ${args[0]}`;
240
- return this.logger[lvl](args);
241
- }
242
- create(moduleName) {
243
- return new Logger(this.logger, {
244
- ...{
245
- prefix: `${this.prefix}:${moduleName}:`
246
- },
247
- ...this.options
248
- });
249
- }
250
- clone(options) {
251
- options = options || this.options;
252
- options.prefix = options.prefix || this.prefix;
253
- return new Logger(this.logger, options);
254
- }
255
- }
256
- var baseLogger = new Logger();
257
-
258
- class EventEmitter {
259
- constructor() {
260
- this.observers = {};
261
- }
262
- on(events, listener) {
263
- events.split(' ').forEach(event => {
264
- if (!this.observers[event]) this.observers[event] = new Map();
265
- const numListeners = this.observers[event].get(listener) || 0;
266
- this.observers[event].set(listener, numListeners + 1);
267
- });
268
- return this;
269
- }
270
- off(event, listener) {
271
- if (!this.observers[event]) return;
272
- if (!listener) {
273
- delete this.observers[event];
274
- return;
275
- }
276
- this.observers[event].delete(listener);
277
- }
278
- emit(event, ...args) {
279
- if (this.observers[event]) {
280
- const cloned = Array.from(this.observers[event].entries());
281
- cloned.forEach(([observer, numTimesAdded]) => {
282
- for (let i = 0; i < numTimesAdded; i++) {
283
- observer(...args);
284
- }
285
- });
286
- }
287
- if (this.observers['*']) {
288
- const cloned = Array.from(this.observers['*'].entries());
289
- cloned.forEach(([observer, numTimesAdded]) => {
290
- for (let i = 0; i < numTimesAdded; i++) {
291
- observer.apply(observer, [event, ...args]);
292
- }
293
- });
294
- }
295
- }
296
- }
297
-
298
- class ResourceStore extends EventEmitter {
299
- constructor(data, options = {
300
- ns: ['translation'],
301
- defaultNS: 'translation'
302
- }) {
303
- super();
304
- this.data = data || {};
305
- this.options = options;
306
- if (this.options.keySeparator === undefined) {
307
- this.options.keySeparator = '.';
308
- }
309
- if (this.options.ignoreJSONStructure === undefined) {
310
- this.options.ignoreJSONStructure = true;
311
- }
312
- }
313
- addNamespaces(ns) {
314
- if (this.options.ns.indexOf(ns) < 0) {
315
- this.options.ns.push(ns);
316
- }
317
- }
318
- removeNamespaces(ns) {
319
- const index = this.options.ns.indexOf(ns);
320
- if (index > -1) {
321
- this.options.ns.splice(index, 1);
322
- }
323
- }
324
- getResource(lng, ns, key, options = {}) {
325
- const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
326
- const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
327
- let path;
328
- if (lng.indexOf('.') > -1) {
329
- path = lng.split('.');
330
- } else {
331
- path = [lng, ns];
332
- if (key) {
333
- if (Array.isArray(key)) {
334
- path.push(...key);
335
- } else if (isString(key) && keySeparator) {
336
- path.push(...key.split(keySeparator));
337
- } else {
338
- path.push(key);
339
- }
340
- }
341
- }
342
- const result = getPath(this.data, path);
343
- if (!result && !ns && !key && lng.indexOf('.') > -1) {
344
- lng = path[0];
345
- ns = path[1];
346
- key = path.slice(2).join('.');
347
- }
348
- if (result || !ignoreJSONStructure || !isString(key)) return result;
349
- return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
350
- }
351
- addResource(lng, ns, key, value, options = {
352
- silent: false
353
- }) {
354
- const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
355
- let path = [lng, ns];
356
- if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
357
- if (lng.indexOf('.') > -1) {
358
- path = lng.split('.');
359
- value = ns;
360
- ns = path[1];
361
- }
362
- this.addNamespaces(ns);
363
- setPath(this.data, path, value);
364
- if (!options.silent) this.emit('added', lng, ns, key, value);
365
- }
366
- addResources(lng, ns, resources, options = {
367
- silent: false
368
- }) {
369
- for (const m in resources) {
370
- if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], {
371
- silent: true
372
- });
373
- }
374
- if (!options.silent) this.emit('added', lng, ns, resources);
375
- }
376
- addResourceBundle(lng, ns, resources, deep, overwrite, options = {
377
- silent: false,
378
- skipCopy: false
379
- }) {
380
- let path = [lng, ns];
381
- if (lng.indexOf('.') > -1) {
382
- path = lng.split('.');
383
- deep = resources;
384
- resources = ns;
385
- ns = path[1];
386
- }
387
- this.addNamespaces(ns);
388
- let pack = getPath(this.data, path) || {};
389
- if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
390
- if (deep) {
391
- deepExtend(pack, resources, overwrite);
392
- } else {
393
- pack = {
394
- ...pack,
395
- ...resources
396
- };
397
- }
398
- setPath(this.data, path, pack);
399
- if (!options.silent) this.emit('added', lng, ns, resources);
400
- }
401
- removeResourceBundle(lng, ns) {
402
- if (this.hasResourceBundle(lng, ns)) {
403
- delete this.data[lng][ns];
404
- }
405
- this.removeNamespaces(ns);
406
- this.emit('removed', lng, ns);
407
- }
408
- hasResourceBundle(lng, ns) {
409
- return this.getResource(lng, ns) !== undefined;
410
- }
411
- getResourceBundle(lng, ns) {
412
- if (!ns) ns = this.options.defaultNS;
413
- return this.getResource(lng, ns);
414
- }
415
- getDataByLanguage(lng) {
416
- return this.data[lng];
417
- }
418
- hasLanguageSomeTranslations(lng) {
419
- const data = this.getDataByLanguage(lng);
420
- const n = data && Object.keys(data) || [];
421
- return !!n.find(v => data[v] && Object.keys(data[v]).length > 0);
422
- }
423
- toJSON() {
424
- return this.data;
425
- }
426
- }
427
-
428
- var postProcessor = {
429
- processors: {},
430
- addPostProcessor(module) {
431
- this.processors[module.name] = module;
432
- },
433
- handle(processors, value, key, options, translator) {
434
- processors.forEach(processor => {
435
- value = this.processors[processor]?.process(value, key, options, translator) ?? value;
436
- });
437
- return value;
438
- }
439
- };
440
-
441
- const checkedLoadedFor = {};
442
- const shouldHandleAsObject = res => !isString(res) && typeof res !== 'boolean' && typeof res !== 'number';
443
- class Translator extends EventEmitter {
444
- constructor(services, options = {}) {
445
- super();
446
- copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, this);
447
- this.options = options;
448
- if (this.options.keySeparator === undefined) {
449
- this.options.keySeparator = '.';
450
- }
451
- this.logger = baseLogger.create('translator');
452
- }
453
- changeLanguage(lng) {
454
- if (lng) this.language = lng;
455
- }
456
- exists(key, o = {
457
- interpolation: {}
458
- }) {
459
- const opt = {
460
- ...o
461
- };
462
- if (key == null) return false;
463
- const resolved = this.resolve(key, opt);
464
- return resolved?.res !== undefined;
465
- }
466
- extractFromKey(key, opt) {
467
- let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
468
- if (nsSeparator === undefined) nsSeparator = ':';
469
- const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
470
- let namespaces = opt.ns || this.options.defaultNS || [];
471
- const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
472
- const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
473
- if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
474
- const m = key.match(this.interpolator.nestingRegexp);
475
- if (m && m.length > 0) {
476
- return {
477
- key,
478
- namespaces: isString(namespaces) ? [namespaces] : namespaces
479
- };
480
- }
481
- const parts = key.split(nsSeparator);
482
- if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
483
- key = parts.join(keySeparator);
484
- }
485
- return {
486
- key,
487
- namespaces: isString(namespaces) ? [namespaces] : namespaces
488
- };
489
- }
490
- translate(keys, o, lastKey) {
491
- let opt = typeof o === 'object' ? {
492
- ...o
493
- } : o;
494
- if (typeof opt !== 'object' && this.options.overloadTranslationOptionHandler) {
495
- opt = this.options.overloadTranslationOptionHandler(arguments);
496
- }
497
- if (typeof options === 'object') opt = {
498
- ...opt
499
- };
500
- if (!opt) opt = {};
501
- if (keys == null) return '';
502
- if (!Array.isArray(keys)) keys = [String(keys)];
503
- const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
504
- const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
505
- const {
506
- key,
507
- namespaces
508
- } = this.extractFromKey(keys[keys.length - 1], opt);
509
- const namespace = namespaces[namespaces.length - 1];
510
- let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
511
- if (nsSeparator === undefined) nsSeparator = ':';
512
- const lng = opt.lng || this.language;
513
- const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
514
- if (lng?.toLowerCase() === 'cimode') {
515
- if (appendNamespaceToCIMode) {
516
- if (returnDetails) {
517
- return {
518
- res: `${namespace}${nsSeparator}${key}`,
519
- usedKey: key,
520
- exactUsedKey: key,
521
- usedLng: lng,
522
- usedNS: namespace,
523
- usedParams: this.getUsedParamsDetails(opt)
524
- };
525
- }
526
- return `${namespace}${nsSeparator}${key}`;
527
- }
528
- if (returnDetails) {
529
- return {
530
- res: key,
531
- usedKey: key,
532
- exactUsedKey: key,
533
- usedLng: lng,
534
- usedNS: namespace,
535
- usedParams: this.getUsedParamsDetails(opt)
536
- };
537
- }
538
- return key;
539
- }
540
- const resolved = this.resolve(keys, opt);
541
- let res = resolved?.res;
542
- const resUsedKey = resolved?.usedKey || key;
543
- const resExactUsedKey = resolved?.exactUsedKey || key;
544
- const noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
545
- const joinArrays = opt.joinArrays !== undefined ? opt.joinArrays : this.options.joinArrays;
546
- const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
547
- const needsPluralHandling = opt.count !== undefined && !isString(opt.count);
548
- const hasDefaultValue = Translator.hasDefaultValue(opt);
549
- const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : '';
550
- const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, {
551
- ordinal: false
552
- }) : '';
553
- const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
554
- const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
555
- let resForObjHndl = res;
556
- if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
557
- resForObjHndl = defaultValue;
558
- }
559
- const handleAsObject = shouldHandleAsObject(resForObjHndl);
560
- const resType = Object.prototype.toString.apply(resForObjHndl);
561
- if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
562
- if (!opt.returnObjects && !this.options.returnObjects) {
563
- if (!this.options.returnedObjectHandler) {
564
- this.logger.warn('accessing an object - but returnObjects options is not enabled!');
565
- }
566
- const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
567
- ...opt,
568
- ns: namespaces
569
- }) : `key '${key} (${this.language})' returned an object instead of string.`;
570
- if (returnDetails) {
571
- resolved.res = r;
572
- resolved.usedParams = this.getUsedParamsDetails(opt);
573
- return resolved;
574
- }
575
- return r;
576
- }
577
- if (keySeparator) {
578
- const resTypeIsArray = Array.isArray(resForObjHndl);
579
- const copy = resTypeIsArray ? [] : {};
580
- const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
581
- for (const m in resForObjHndl) {
582
- if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) {
583
- const deepKey = `${newKeyToUse}${keySeparator}${m}`;
584
- if (hasDefaultValue && !res) {
585
- copy[m] = this.translate(deepKey, {
586
- ...opt,
587
- defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : undefined,
588
- ...{
589
- joinArrays: false,
590
- ns: namespaces
591
- }
592
- });
593
- } else {
594
- copy[m] = this.translate(deepKey, {
595
- ...opt,
596
- ...{
597
- joinArrays: false,
598
- ns: namespaces
599
- }
600
- });
601
- }
602
- if (copy[m] === deepKey) copy[m] = resForObjHndl[m];
603
- }
604
- }
605
- res = copy;
606
- }
607
- } else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
608
- res = res.join(joinArrays);
609
- if (res) res = this.extendTranslation(res, keys, opt, lastKey);
610
- } else {
611
- let usedDefault = false;
612
- let usedKey = false;
613
- if (!this.isValidLookup(res) && hasDefaultValue) {
614
- usedDefault = true;
615
- res = defaultValue;
616
- }
617
- if (!this.isValidLookup(res)) {
618
- usedKey = true;
619
- res = key;
620
- }
621
- const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
622
- const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
623
- const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
624
- if (usedKey || usedDefault || updateMissing) {
625
- this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
626
- if (keySeparator) {
627
- const fk = this.resolve(key, {
628
- ...opt,
629
- keySeparator: false
630
- });
631
- 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.');
632
- }
633
- let lngs = [];
634
- const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);
635
- if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
636
- for (let i = 0; i < fallbackLngs.length; i++) {
637
- lngs.push(fallbackLngs[i]);
638
- }
639
- } else if (this.options.saveMissingTo === 'all') {
640
- lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);
641
- } else {
642
- lngs.push(opt.lng || this.language);
643
- }
644
- const send = (l, k, specificDefaultValue) => {
645
- const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
646
- if (this.options.missingKeyHandler) {
647
- this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);
648
- } else if (this.backendConnector?.saveMissing) {
649
- this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);
650
- }
651
- this.emit('missingKey', l, namespace, k, res);
652
- };
653
- if (this.options.saveMissing) {
654
- if (this.options.saveMissingPlurals && needsPluralHandling) {
655
- lngs.forEach(language => {
656
- const suffixes = this.pluralResolver.getSuffixes(language, opt);
657
- if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
658
- suffixes.push(`${this.options.pluralSeparator}zero`);
659
- }
660
- suffixes.forEach(suffix => {
661
- send([language], key + suffix, opt[`defaultValue${suffix}`] || defaultValue);
662
- });
663
- });
664
- } else {
665
- send(lngs, key, defaultValue);
666
- }
667
- }
668
- }
669
- res = this.extendTranslation(res, keys, opt, resolved, lastKey);
670
- if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
671
- res = `${namespace}${nsSeparator}${key}`;
672
- }
673
- if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
674
- res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : undefined, opt);
675
- }
676
- }
677
- if (returnDetails) {
678
- resolved.res = res;
679
- resolved.usedParams = this.getUsedParamsDetails(opt);
680
- return resolved;
681
- }
682
- return res;
683
- }
684
- extendTranslation(res, key, opt, resolved, lastKey) {
685
- if (this.i18nFormat?.parse) {
686
- res = this.i18nFormat.parse(res, {
687
- ...this.options.interpolation.defaultVariables,
688
- ...opt
689
- }, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {
690
- resolved
691
- });
692
- } else if (!opt.skipInterpolation) {
693
- if (opt.interpolation) this.interpolator.init({
694
- ...opt,
695
- ...{
696
- interpolation: {
697
- ...this.options.interpolation,
698
- ...opt.interpolation
699
- }
700
- }
701
- });
702
- const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== undefined ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
703
- let nestBef;
704
- if (skipOnVariables) {
705
- const nb = res.match(this.interpolator.nestingRegexp);
706
- nestBef = nb && nb.length;
707
- }
708
- let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
709
- if (this.options.interpolation.defaultVariables) data = {
710
- ...this.options.interpolation.defaultVariables,
711
- ...data
712
- };
713
- res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
714
- if (skipOnVariables) {
715
- const na = res.match(this.interpolator.nestingRegexp);
716
- const nestAft = na && na.length;
717
- if (nestBef < nestAft) opt.nest = false;
718
- }
719
- if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
720
- if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {
721
- if (lastKey?.[0] === args[0] && !opt.context) {
722
- this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
723
- return null;
724
- }
725
- return this.translate(...args, key);
726
- }, opt);
727
- if (opt.interpolation) this.interpolator.reset();
728
- }
729
- const postProcess = opt.postProcess || this.options.postProcess;
730
- const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
731
- if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) {
732
- res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
733
- i18nResolved: {
734
- ...resolved,
735
- usedParams: this.getUsedParamsDetails(opt)
736
- },
737
- ...opt
738
- } : opt, this);
739
- }
740
- return res;
741
- }
742
- resolve(keys, opt = {}) {
743
- let found;
744
- let usedKey;
745
- let exactUsedKey;
746
- let usedLng;
747
- let usedNS;
748
- if (isString(keys)) keys = [keys];
749
- keys.forEach(k => {
750
- if (this.isValidLookup(found)) return;
751
- const extracted = this.extractFromKey(k, opt);
752
- const key = extracted.key;
753
- usedKey = key;
754
- let namespaces = extracted.namespaces;
755
- if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
756
- const needsPluralHandling = opt.count !== undefined && !isString(opt.count);
757
- const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
758
- const needsContextHandling = opt.context !== undefined && (isString(opt.context) || typeof opt.context === 'number') && opt.context !== '';
759
- const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);
760
- namespaces.forEach(ns => {
761
- if (this.isValidLookup(found)) return;
762
- usedNS = ns;
763
- if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
764
- checkedLoadedFor[`${codes[0]}-${ns}`] = true;
765
- 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!!!');
766
- }
767
- codes.forEach(code => {
768
- if (this.isValidLookup(found)) return;
769
- usedLng = code;
770
- const finalKeys = [key];
771
- if (this.i18nFormat?.addLookupKeys) {
772
- this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt);
773
- } else {
774
- let pluralSuffix;
775
- if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);
776
- const zeroSuffix = `${this.options.pluralSeparator}zero`;
777
- const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
778
- if (needsPluralHandling) {
779
- finalKeys.push(key + pluralSuffix);
780
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
781
- finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
782
- }
783
- if (needsZeroSuffixLookup) {
784
- finalKeys.push(key + zeroSuffix);
785
- }
786
- }
787
- if (needsContextHandling) {
788
- const contextKey = `${key}${this.options.contextSeparator}${opt.context}`;
789
- finalKeys.push(contextKey);
790
- if (needsPluralHandling) {
791
- finalKeys.push(contextKey + pluralSuffix);
792
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
793
- finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
794
- }
795
- if (needsZeroSuffixLookup) {
796
- finalKeys.push(contextKey + zeroSuffix);
797
- }
798
- }
799
- }
800
- }
801
- let possibleKey;
802
- while (possibleKey = finalKeys.pop()) {
803
- if (!this.isValidLookup(found)) {
804
- exactUsedKey = possibleKey;
805
- found = this.getResource(code, ns, possibleKey, opt);
806
- }
807
- }
808
- });
809
- });
810
- });
811
- return {
812
- res: found,
813
- usedKey,
814
- exactUsedKey,
815
- usedLng,
816
- usedNS
817
- };
818
- }
819
- isValidLookup(res) {
820
- return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
821
- }
822
- getResource(code, ns, key, options = {}) {
823
- if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
824
- return this.resourceStore.getResource(code, ns, key, options);
825
- }
826
- getUsedParamsDetails(options = {}) {
827
- const optionsKeys = ['defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation'];
828
- const useOptionsReplaceForData = options.replace && !isString(options.replace);
829
- let data = useOptionsReplaceForData ? options.replace : options;
830
- if (useOptionsReplaceForData && typeof options.count !== 'undefined') {
831
- data.count = options.count;
832
- }
833
- if (this.options.interpolation.defaultVariables) {
834
- data = {
835
- ...this.options.interpolation.defaultVariables,
836
- ...data
837
- };
838
- }
839
- if (!useOptionsReplaceForData) {
840
- data = {
841
- ...data
842
- };
843
- for (const key of optionsKeys) {
844
- delete data[key];
845
- }
846
- }
847
- return data;
848
- }
849
- static hasDefaultValue(options) {
850
- const prefix = 'defaultValue';
851
- for (const option in options) {
852
- if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
853
- return true;
854
- }
855
- }
856
- return false;
857
- }
858
- }
859
-
860
- class LanguageUtil {
861
- constructor(options) {
862
- this.options = options;
863
- this.supportedLngs = this.options.supportedLngs || false;
864
- this.logger = baseLogger.create('languageUtils');
865
- }
866
- getScriptPartFromCode(code) {
867
- code = getCleanedCode(code);
868
- if (!code || code.indexOf('-') < 0) return null;
869
- const p = code.split('-');
870
- if (p.length === 2) return null;
871
- p.pop();
872
- if (p[p.length - 1].toLowerCase() === 'x') return null;
873
- return this.formatLanguageCode(p.join('-'));
874
- }
875
- getLanguagePartFromCode(code) {
876
- code = getCleanedCode(code);
877
- if (!code || code.indexOf('-') < 0) return code;
878
- const p = code.split('-');
879
- return this.formatLanguageCode(p[0]);
880
- }
881
- formatLanguageCode(code) {
882
- if (isString(code) && code.indexOf('-') > -1) {
883
- let formattedCode;
884
- try {
885
- formattedCode = Intl.getCanonicalLocales(code)[0];
886
- } catch (e) {}
887
- if (formattedCode && this.options.lowerCaseLng) {
888
- formattedCode = formattedCode.toLowerCase();
889
- }
890
- if (formattedCode) return formattedCode;
891
- if (this.options.lowerCaseLng) {
892
- return code.toLowerCase();
893
- }
894
- return code;
895
- }
896
- return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
897
- }
898
- isSupportedCode(code) {
899
- if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
900
- code = this.getLanguagePartFromCode(code);
901
- }
902
- return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
903
- }
904
- getBestMatchFromCodes(codes) {
905
- if (!codes) return null;
906
- let found;
907
- codes.forEach(code => {
908
- if (found) return;
909
- const cleanedLng = this.formatLanguageCode(code);
910
- if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;
911
- });
912
- if (!found && this.options.supportedLngs) {
913
- codes.forEach(code => {
914
- if (found) return;
915
- const lngScOnly = this.getScriptPartFromCode(code);
916
- if (this.isSupportedCode(lngScOnly)) return found = lngScOnly;
917
- const lngOnly = this.getLanguagePartFromCode(code);
918
- if (this.isSupportedCode(lngOnly)) return found = lngOnly;
919
- found = this.options.supportedLngs.find(supportedLng => {
920
- if (supportedLng === lngOnly) return supportedLng;
921
- if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
922
- if (supportedLng.indexOf('-') > 0 && lngOnly.indexOf('-') < 0 && supportedLng.substring(0, supportedLng.indexOf('-')) === lngOnly) return supportedLng;
923
- if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
924
- });
925
- });
926
- }
927
- if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
928
- return found;
929
- }
930
- getFallbackCodes(fallbacks, code) {
931
- if (!fallbacks) return [];
932
- if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
933
- if (isString(fallbacks)) fallbacks = [fallbacks];
934
- if (Array.isArray(fallbacks)) return fallbacks;
935
- if (!code) return fallbacks.default || [];
936
- let found = fallbacks[code];
937
- if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
938
- if (!found) found = fallbacks[this.formatLanguageCode(code)];
939
- if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
940
- if (!found) found = fallbacks.default;
941
- return found || [];
942
- }
943
- toResolveHierarchy(code, fallbackCode) {
944
- const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
945
- const codes = [];
946
- const addCode = c => {
947
- if (!c) return;
948
- if (this.isSupportedCode(c)) {
949
- codes.push(c);
950
- } else {
951
- this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
952
- }
953
- };
954
- if (isString(code) && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {
955
- if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
956
- if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
957
- if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
958
- } else if (isString(code)) {
959
- addCode(this.formatLanguageCode(code));
960
- }
961
- fallbackCodes.forEach(fc => {
962
- if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
963
- });
964
- return codes;
965
- }
966
- }
967
-
968
- const suffixesOrder = {
969
- zero: 0,
970
- one: 1,
971
- two: 2,
972
- few: 3,
973
- many: 4,
974
- other: 5
975
- };
976
- const dummyRule = {
977
- select: count => count === 1 ? 'one' : 'other',
978
- resolvedOptions: () => ({
979
- pluralCategories: ['one', 'other']
980
- })
981
- };
982
- class PluralResolver {
983
- constructor(languageUtils, options = {}) {
984
- this.languageUtils = languageUtils;
985
- this.options = options;
986
- this.logger = baseLogger.create('pluralResolver');
987
- this.pluralRulesCache = {};
988
- }
989
- addRule(lng, obj) {
990
- this.rules[lng] = obj;
991
- }
992
- clearCache() {
993
- this.pluralRulesCache = {};
994
- }
995
- getRule(code, options = {}) {
996
- const cleanedCode = getCleanedCode(code === 'dev' ? 'en' : code);
997
- const type = options.ordinal ? 'ordinal' : 'cardinal';
998
- const cacheKey = JSON.stringify({
999
- cleanedCode,
1000
- type
1001
- });
1002
- if (cacheKey in this.pluralRulesCache) {
1003
- return this.pluralRulesCache[cacheKey];
1004
- }
1005
- let rule;
1006
- try {
1007
- rule = new Intl.PluralRules(cleanedCode, {
1008
- type
1009
- });
1010
- } catch (err) {
1011
- if (!Intl) {
1012
- this.logger.error('No Intl support, please use an Intl polyfill!');
1013
- return dummyRule;
1014
- }
1015
- if (!code.match(/-|_/)) return dummyRule;
1016
- const lngPart = this.languageUtils.getLanguagePartFromCode(code);
1017
- rule = this.getRule(lngPart, options);
1018
- }
1019
- this.pluralRulesCache[cacheKey] = rule;
1020
- return rule;
1021
- }
1022
- needsPlural(code, options = {}) {
1023
- let rule = this.getRule(code, options);
1024
- if (!rule) rule = this.getRule('dev', options);
1025
- return rule?.resolvedOptions().pluralCategories.length > 1;
1026
- }
1027
- getPluralFormsOfKey(code, key, options = {}) {
1028
- return this.getSuffixes(code, options).map(suffix => `${key}${suffix}`);
1029
- }
1030
- getSuffixes(code, options = {}) {
1031
- let rule = this.getRule(code, options);
1032
- if (!rule) rule = this.getRule('dev', options);
1033
- if (!rule) return [];
1034
- return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map(pluralCategory => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${pluralCategory}`);
1035
- }
1036
- getSuffix(code, count, options = {}) {
1037
- const rule = this.getRule(code, options);
1038
- if (rule) {
1039
- return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${rule.select(count)}`;
1040
- }
1041
- this.logger.warn(`no plural rule found for: ${code}`);
1042
- return this.getSuffix('dev', count, options);
1043
- }
1044
- }
1045
-
1046
- const deepFindWithDefaults = (data, defaultData, key, keySeparator = '.', ignoreJSONStructure = true) => {
1047
- let path = getPathWithDefaults(data, defaultData, key);
1048
- if (!path && ignoreJSONStructure && isString(key)) {
1049
- path = deepFind(data, key, keySeparator);
1050
- if (path === undefined) path = deepFind(defaultData, key, keySeparator);
1051
- }
1052
- return path;
1053
- };
1054
- const regexSafe = val => val.replace(/\$/g, '$$$$');
1055
- class Interpolator {
1056
- constructor(options = {}) {
1057
- this.logger = baseLogger.create('interpolator');
1058
- this.options = options;
1059
- this.format = options?.interpolation?.format || (value => value);
1060
- this.init(options);
1061
- }
1062
- init(options = {}) {
1063
- if (!options.interpolation) options.interpolation = {
1064
- escapeValue: true
1065
- };
1066
- const {
1067
- escape: escape$1,
1068
- escapeValue,
1069
- useRawValueToEscape,
1070
- prefix,
1071
- prefixEscaped,
1072
- suffix,
1073
- suffixEscaped,
1074
- formatSeparator,
1075
- unescapeSuffix,
1076
- unescapePrefix,
1077
- nestingPrefix,
1078
- nestingPrefixEscaped,
1079
- nestingSuffix,
1080
- nestingSuffixEscaped,
1081
- nestingOptionsSeparator,
1082
- maxReplaces,
1083
- alwaysFormat
1084
- } = options.interpolation;
1085
- this.escape = escape$1 !== undefined ? escape$1 : escape;
1086
- this.escapeValue = escapeValue !== undefined ? escapeValue : true;
1087
- this.useRawValueToEscape = useRawValueToEscape !== undefined ? useRawValueToEscape : false;
1088
- this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || '{{';
1089
- this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || '}}';
1090
- this.formatSeparator = formatSeparator || ',';
1091
- this.unescapePrefix = unescapeSuffix ? '' : unescapePrefix || '-';
1092
- this.unescapeSuffix = this.unescapePrefix ? '' : unescapeSuffix || '';
1093
- this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape('$t(');
1094
- this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(')');
1095
- this.nestingOptionsSeparator = nestingOptionsSeparator || ',';
1096
- this.maxReplaces = maxReplaces || 1000;
1097
- this.alwaysFormat = alwaysFormat !== undefined ? alwaysFormat : false;
1098
- this.resetRegExp();
1099
- }
1100
- reset() {
1101
- if (this.options) this.init(this.options);
1102
- }
1103
- resetRegExp() {
1104
- const getOrResetRegExp = (existingRegExp, pattern) => {
1105
- if (existingRegExp?.source === pattern) {
1106
- existingRegExp.lastIndex = 0;
1107
- return existingRegExp;
1108
- }
1109
- return new RegExp(pattern, 'g');
1110
- };
1111
- this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
1112
- this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
1113
- this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
1114
- }
1115
- interpolate(str, data, lng, options) {
1116
- let match;
1117
- let value;
1118
- let replaces;
1119
- const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
1120
- const handleFormat = key => {
1121
- if (key.indexOf(this.formatSeparator) < 0) {
1122
- const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
1123
- return this.alwaysFormat ? this.format(path, undefined, lng, {
1124
- ...options,
1125
- ...data,
1126
- interpolationkey: key
1127
- }) : path;
1128
- }
1129
- const p = key.split(this.formatSeparator);
1130
- const k = p.shift().trim();
1131
- const f = p.join(this.formatSeparator).trim();
1132
- return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
1133
- ...options,
1134
- ...data,
1135
- interpolationkey: k
1136
- });
1137
- };
1138
- this.resetRegExp();
1139
- const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
1140
- const skipOnVariables = options?.interpolation?.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
1141
- const todos = [{
1142
- regex: this.regexpUnescape,
1143
- safeValue: val => regexSafe(val)
1144
- }, {
1145
- regex: this.regexp,
1146
- safeValue: val => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)
1147
- }];
1148
- todos.forEach(todo => {
1149
- replaces = 0;
1150
- while (match = todo.regex.exec(str)) {
1151
- const matchedVar = match[1].trim();
1152
- value = handleFormat(matchedVar);
1153
- if (value === undefined) {
1154
- if (typeof missingInterpolationHandler === 'function') {
1155
- const temp = missingInterpolationHandler(str, match, options);
1156
- value = isString(temp) ? temp : '';
1157
- } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
1158
- value = '';
1159
- } else if (skipOnVariables) {
1160
- value = match[0];
1161
- continue;
1162
- } else {
1163
- this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
1164
- value = '';
1165
- }
1166
- } else if (!isString(value) && !this.useRawValueToEscape) {
1167
- value = makeString(value);
1168
- }
1169
- const safeValue = todo.safeValue(value);
1170
- str = str.replace(match[0], safeValue);
1171
- if (skipOnVariables) {
1172
- todo.regex.lastIndex += value.length;
1173
- todo.regex.lastIndex -= match[0].length;
1174
- } else {
1175
- todo.regex.lastIndex = 0;
1176
- }
1177
- replaces++;
1178
- if (replaces >= this.maxReplaces) {
1179
- break;
1180
- }
1181
- }
1182
- });
1183
- return str;
1184
- }
1185
- nest(str, fc, options = {}) {
1186
- let match;
1187
- let value;
1188
- let clonedOptions;
1189
- const handleHasOptions = (key, inheritedOptions) => {
1190
- const sep = this.nestingOptionsSeparator;
1191
- if (key.indexOf(sep) < 0) return key;
1192
- const c = key.split(new RegExp(`${sep}[ ]*{`));
1193
- let optionsString = `{${c[1]}`;
1194
- key = c[0];
1195
- optionsString = this.interpolate(optionsString, clonedOptions);
1196
- const matchedSingleQuotes = optionsString.match(/'/g);
1197
- const matchedDoubleQuotes = optionsString.match(/"/g);
1198
- if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
1199
- optionsString = optionsString.replace(/'/g, '"');
1200
- }
1201
- try {
1202
- clonedOptions = JSON.parse(optionsString);
1203
- if (inheritedOptions) clonedOptions = {
1204
- ...inheritedOptions,
1205
- ...clonedOptions
1206
- };
1207
- } catch (e) {
1208
- this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
1209
- return `${key}${sep}${optionsString}`;
1210
- }
1211
- if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
1212
- return key;
1213
- };
1214
- while (match = this.nestingRegexp.exec(str)) {
1215
- let formatters = [];
1216
- clonedOptions = {
1217
- ...options
1218
- };
1219
- clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
1220
- clonedOptions.applyPostProcessor = false;
1221
- delete clonedOptions.defaultValue;
1222
- const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf('}') + 1 : match[1].indexOf(this.formatSeparator);
1223
- if (keyEndIndex !== -1) {
1224
- formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map(elem => elem.trim()).filter(Boolean);
1225
- match[1] = match[1].slice(0, keyEndIndex);
1226
- }
1227
- value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
1228
- if (value && match[0] === str && !isString(value)) return value;
1229
- if (!isString(value)) value = makeString(value);
1230
- if (!value) {
1231
- this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
1232
- value = '';
1233
- }
1234
- if (formatters.length) {
1235
- value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
1236
- ...options,
1237
- interpolationkey: match[1].trim()
1238
- }), value.trim());
1239
- }
1240
- str = str.replace(match[0], value);
1241
- this.regexp.lastIndex = 0;
1242
- }
1243
- return str;
1244
- }
1245
- }
1246
-
1247
- const parseFormatStr = formatStr => {
1248
- let formatName = formatStr.toLowerCase().trim();
1249
- const formatOptions = {};
1250
- if (formatStr.indexOf('(') > -1) {
1251
- const p = formatStr.split('(');
1252
- formatName = p[0].toLowerCase().trim();
1253
- const optStr = p[1].substring(0, p[1].length - 1);
1254
- if (formatName === 'currency' && optStr.indexOf(':') < 0) {
1255
- if (!formatOptions.currency) formatOptions.currency = optStr.trim();
1256
- } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
1257
- if (!formatOptions.range) formatOptions.range = optStr.trim();
1258
- } else {
1259
- const opts = optStr.split(';');
1260
- opts.forEach(opt => {
1261
- if (opt) {
1262
- const [key, ...rest] = opt.split(':');
1263
- const val = rest.join(':').trim().replace(/^'+|'+$/g, '');
1264
- const trimmedKey = key.trim();
1265
- if (!formatOptions[trimmedKey]) formatOptions[trimmedKey] = val;
1266
- if (val === 'false') formatOptions[trimmedKey] = false;
1267
- if (val === 'true') formatOptions[trimmedKey] = true;
1268
- if (!isNaN(val)) formatOptions[trimmedKey] = parseInt(val, 10);
1269
- }
1270
- });
1271
- }
1272
- }
1273
- return {
1274
- formatName,
1275
- formatOptions
1276
- };
1277
- };
1278
- const createCachedFormatter = fn => {
1279
- const cache = {};
1280
- return (v, l, o) => {
1281
- let optForCache = o;
1282
- if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
1283
- optForCache = {
1284
- ...optForCache,
1285
- [o.interpolationkey]: undefined
1286
- };
1287
- }
1288
- const key = l + JSON.stringify(optForCache);
1289
- let frm = cache[key];
1290
- if (!frm) {
1291
- frm = fn(getCleanedCode(l), o);
1292
- cache[key] = frm;
1293
- }
1294
- return frm(v);
1295
- };
1296
- };
1297
- const createNonCachedFormatter = fn => (v, l, o) => fn(getCleanedCode(l), o)(v);
1298
- class Formatter {
1299
- constructor(options = {}) {
1300
- this.logger = baseLogger.create('formatter');
1301
- this.options = options;
1302
- this.init(options);
1303
- }
1304
- init(services, options = {
1305
- interpolation: {}
1306
- }) {
1307
- this.formatSeparator = options.interpolation.formatSeparator || ',';
1308
- const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
1309
- this.formats = {
1310
- number: cf((lng, opt) => {
1311
- const formatter = new Intl.NumberFormat(lng, {
1312
- ...opt
1313
- });
1314
- return val => formatter.format(val);
1315
- }),
1316
- currency: cf((lng, opt) => {
1317
- const formatter = new Intl.NumberFormat(lng, {
1318
- ...opt,
1319
- style: 'currency'
1320
- });
1321
- return val => formatter.format(val);
1322
- }),
1323
- datetime: cf((lng, opt) => {
1324
- const formatter = new Intl.DateTimeFormat(lng, {
1325
- ...opt
1326
- });
1327
- return val => formatter.format(val);
1328
- }),
1329
- relativetime: cf((lng, opt) => {
1330
- const formatter = new Intl.RelativeTimeFormat(lng, {
1331
- ...opt
1332
- });
1333
- return val => formatter.format(val, opt.range || 'day');
1334
- }),
1335
- list: cf((lng, opt) => {
1336
- const formatter = new Intl.ListFormat(lng, {
1337
- ...opt
1338
- });
1339
- return val => formatter.format(val);
1340
- })
1341
- };
1342
- }
1343
- add(name, fc) {
1344
- this.formats[name.toLowerCase().trim()] = fc;
1345
- }
1346
- addCached(name, fc) {
1347
- this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
1348
- }
1349
- format(value, format, lng, options = {}) {
1350
- const formats = format.split(this.formatSeparator);
1351
- if (formats.length > 1 && formats[0].indexOf('(') > 1 && formats[0].indexOf(')') < 0 && formats.find(f => f.indexOf(')') > -1)) {
1352
- const lastIndex = formats.findIndex(f => f.indexOf(')') > -1);
1353
- formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
1354
- }
1355
- const result = formats.reduce((mem, f) => {
1356
- const {
1357
- formatName,
1358
- formatOptions
1359
- } = parseFormatStr(f);
1360
- if (this.formats[formatName]) {
1361
- let formatted = mem;
1362
- try {
1363
- const valOptions = options?.formatParams?.[options.interpolationkey] || {};
1364
- const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1365
- formatted = this.formats[formatName](mem, l, {
1366
- ...formatOptions,
1367
- ...options,
1368
- ...valOptions
1369
- });
1370
- } catch (error) {
1371
- this.logger.warn(error);
1372
- }
1373
- return formatted;
1374
- } else {
1375
- this.logger.warn(`there was no format function for ${formatName}`);
1376
- }
1377
- return mem;
1378
- }, value);
1379
- return result;
1380
- }
1381
- }
1382
-
1383
- const removePending = (q, name) => {
1384
- if (q.pending[name] !== undefined) {
1385
- delete q.pending[name];
1386
- q.pendingCount--;
1387
- }
1388
- };
1389
- class Connector extends EventEmitter {
1390
- constructor(backend, store, services, options = {}) {
1391
- super();
1392
- this.backend = backend;
1393
- this.store = store;
1394
- this.services = services;
1395
- this.languageUtils = services.languageUtils;
1396
- this.options = options;
1397
- this.logger = baseLogger.create('backendConnector');
1398
- this.waitingReads = [];
1399
- this.maxParallelReads = options.maxParallelReads || 10;
1400
- this.readingCalls = 0;
1401
- this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
1402
- this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
1403
- this.state = {};
1404
- this.queue = [];
1405
- this.backend?.init?.(services, options.backend, options);
1406
- }
1407
- queueLoad(languages, namespaces, options, callback) {
1408
- const toLoad = {};
1409
- const pending = {};
1410
- const toLoadLanguages = {};
1411
- const toLoadNamespaces = {};
1412
- languages.forEach(lng => {
1413
- let hasAllNamespaces = true;
1414
- namespaces.forEach(ns => {
1415
- const name = `${lng}|${ns}`;
1416
- if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
1417
- this.state[name] = 2;
1418
- } else if (this.state[name] < 0) ; else if (this.state[name] === 1) {
1419
- if (pending[name] === undefined) pending[name] = true;
1420
- } else {
1421
- this.state[name] = 1;
1422
- hasAllNamespaces = false;
1423
- if (pending[name] === undefined) pending[name] = true;
1424
- if (toLoad[name] === undefined) toLoad[name] = true;
1425
- if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
1426
- }
1427
- });
1428
- if (!hasAllNamespaces) toLoadLanguages[lng] = true;
1429
- });
1430
- if (Object.keys(toLoad).length || Object.keys(pending).length) {
1431
- this.queue.push({
1432
- pending,
1433
- pendingCount: Object.keys(pending).length,
1434
- loaded: {},
1435
- errors: [],
1436
- callback
1437
- });
1438
- }
1439
- return {
1440
- toLoad: Object.keys(toLoad),
1441
- pending: Object.keys(pending),
1442
- toLoadLanguages: Object.keys(toLoadLanguages),
1443
- toLoadNamespaces: Object.keys(toLoadNamespaces)
1444
- };
1445
- }
1446
- loaded(name, err, data) {
1447
- const s = name.split('|');
1448
- const lng = s[0];
1449
- const ns = s[1];
1450
- if (err) this.emit('failedLoading', lng, ns, err);
1451
- if (!err && data) {
1452
- this.store.addResourceBundle(lng, ns, data, undefined, undefined, {
1453
- skipCopy: true
1454
- });
1455
- }
1456
- this.state[name] = err ? -1 : 2;
1457
- if (err && data) this.state[name] = 0;
1458
- const loaded = {};
1459
- this.queue.forEach(q => {
1460
- pushPath(q.loaded, [lng], ns);
1461
- removePending(q, name);
1462
- if (err) q.errors.push(err);
1463
- if (q.pendingCount === 0 && !q.done) {
1464
- Object.keys(q.loaded).forEach(l => {
1465
- if (!loaded[l]) loaded[l] = {};
1466
- const loadedKeys = q.loaded[l];
1467
- if (loadedKeys.length) {
1468
- loadedKeys.forEach(n => {
1469
- if (loaded[l][n] === undefined) loaded[l][n] = true;
1470
- });
1471
- }
1472
- });
1473
- q.done = true;
1474
- if (q.errors.length) {
1475
- q.callback(q.errors);
1476
- } else {
1477
- q.callback();
1478
- }
1479
- }
1480
- });
1481
- this.emit('loaded', loaded);
1482
- this.queue = this.queue.filter(q => !q.done);
1483
- }
1484
- read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
1485
- if (!lng.length) return callback(null, {});
1486
- if (this.readingCalls >= this.maxParallelReads) {
1487
- this.waitingReads.push({
1488
- lng,
1489
- ns,
1490
- fcName,
1491
- tried,
1492
- wait,
1493
- callback
1494
- });
1495
- return;
1496
- }
1497
- this.readingCalls++;
1498
- const resolver = (err, data) => {
1499
- this.readingCalls--;
1500
- if (this.waitingReads.length > 0) {
1501
- const next = this.waitingReads.shift();
1502
- this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
1503
- }
1504
- if (err && data && tried < this.maxRetries) {
1505
- setTimeout(() => {
1506
- this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
1507
- }, wait);
1508
- return;
1509
- }
1510
- callback(err, data);
1511
- };
1512
- const fc = this.backend[fcName].bind(this.backend);
1513
- if (fc.length === 2) {
1514
- try {
1515
- const r = fc(lng, ns);
1516
- if (r && typeof r.then === 'function') {
1517
- r.then(data => resolver(null, data)).catch(resolver);
1518
- } else {
1519
- resolver(null, r);
1520
- }
1521
- } catch (err) {
1522
- resolver(err);
1523
- }
1524
- return;
1525
- }
1526
- return fc(lng, ns, resolver);
1527
- }
1528
- prepareLoading(languages, namespaces, options = {}, callback) {
1529
- if (!this.backend) {
1530
- this.logger.warn('No backend was added via i18next.use. Will not load resources.');
1531
- return callback && callback();
1532
- }
1533
- if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
1534
- if (isString(namespaces)) namespaces = [namespaces];
1535
- const toLoad = this.queueLoad(languages, namespaces, options, callback);
1536
- if (!toLoad.toLoad.length) {
1537
- if (!toLoad.pending.length) callback();
1538
- return null;
1539
- }
1540
- toLoad.toLoad.forEach(name => {
1541
- this.loadOne(name);
1542
- });
1543
- }
1544
- load(languages, namespaces, callback) {
1545
- this.prepareLoading(languages, namespaces, {}, callback);
1546
- }
1547
- reload(languages, namespaces, callback) {
1548
- this.prepareLoading(languages, namespaces, {
1549
- reload: true
1550
- }, callback);
1551
- }
1552
- loadOne(name, prefix = '') {
1553
- const s = name.split('|');
1554
- const lng = s[0];
1555
- const ns = s[1];
1556
- this.read(lng, ns, 'read', undefined, undefined, (err, data) => {
1557
- if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
1558
- if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
1559
- this.loaded(name, err, data);
1560
- });
1561
- }
1562
- saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {
1563
- if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
1564
- 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!!!');
1565
- return;
1566
- }
1567
- if (key === undefined || key === null || key === '') return;
1568
- if (this.backend?.create) {
1569
- const opts = {
1570
- ...options,
1571
- isUpdate
1572
- };
1573
- const fc = this.backend.create.bind(this.backend);
1574
- if (fc.length < 6) {
1575
- try {
1576
- let r;
1577
- if (fc.length === 5) {
1578
- r = fc(languages, namespace, key, fallbackValue, opts);
1579
- } else {
1580
- r = fc(languages, namespace, key, fallbackValue);
1581
- }
1582
- if (r && typeof r.then === 'function') {
1583
- r.then(data => clb(null, data)).catch(clb);
1584
- } else {
1585
- clb(null, r);
1586
- }
1587
- } catch (err) {
1588
- clb(err);
1589
- }
1590
- } else {
1591
- fc(languages, namespace, key, fallbackValue, clb, opts);
1592
- }
1593
- }
1594
- if (!languages || !languages[0]) return;
1595
- this.store.addResource(languages[0], namespace, key, fallbackValue);
1596
- }
1597
- }
1598
-
1599
- const get = () => ({
1600
- debug: false,
1601
- initAsync: true,
1602
- ns: ['translation'],
1603
- defaultNS: ['translation'],
1604
- fallbackLng: ['dev'],
1605
- fallbackNS: false,
1606
- supportedLngs: false,
1607
- nonExplicitSupportedLngs: false,
1608
- load: 'all',
1609
- preload: false,
1610
- simplifyPluralSuffix: true,
1611
- keySeparator: '.',
1612
- nsSeparator: ':',
1613
- pluralSeparator: '_',
1614
- contextSeparator: '_',
1615
- partialBundledLanguages: false,
1616
- saveMissing: false,
1617
- updateMissing: false,
1618
- saveMissingTo: 'fallback',
1619
- saveMissingPlurals: true,
1620
- missingKeyHandler: false,
1621
- missingInterpolationHandler: false,
1622
- postProcess: false,
1623
- postProcessPassResolved: false,
1624
- returnNull: false,
1625
- returnEmptyString: true,
1626
- returnObjects: false,
1627
- joinArrays: false,
1628
- returnedObjectHandler: false,
1629
- parseMissingKeyHandler: false,
1630
- appendNamespaceToMissingKey: false,
1631
- appendNamespaceToCIMode: false,
1632
- overloadTranslationOptionHandler: args => {
1633
- let ret = {};
1634
- if (typeof args[1] === 'object') ret = args[1];
1635
- if (isString(args[1])) ret.defaultValue = args[1];
1636
- if (isString(args[2])) ret.tDescription = args[2];
1637
- if (typeof args[2] === 'object' || typeof args[3] === 'object') {
1638
- const options = args[3] || args[2];
1639
- Object.keys(options).forEach(key => {
1640
- ret[key] = options[key];
1641
- });
1642
- }
1643
- return ret;
1644
- },
1645
- interpolation: {
1646
- escapeValue: true,
1647
- format: value => value,
1648
- prefix: '{{',
1649
- suffix: '}}',
1650
- formatSeparator: ',',
1651
- unescapePrefix: '-',
1652
- nestingPrefix: '$t(',
1653
- nestingSuffix: ')',
1654
- nestingOptionsSeparator: ',',
1655
- maxReplaces: 1000,
1656
- skipOnVariables: true
1657
- },
1658
- cacheInBuiltFormats: true
1659
- });
1660
- const transformOptions = options => {
1661
- if (isString(options.ns)) options.ns = [options.ns];
1662
- if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
1663
- if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
1664
- if (options.supportedLngs?.indexOf?.('cimode') < 0) {
1665
- options.supportedLngs = options.supportedLngs.concat(['cimode']);
1666
- }
1667
- if (typeof options.initImmediate === 'boolean') options.initAsync = options.initImmediate;
1668
- return options;
1669
- };
1670
-
1671
- const noop = () => {};
1672
- const bindMemberFunctions = inst => {
1673
- const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
1674
- mems.forEach(mem => {
1675
- if (typeof inst[mem] === 'function') {
1676
- inst[mem] = inst[mem].bind(inst);
1677
- }
1678
- });
1679
- };
1680
- class I18n extends EventEmitter {
1681
- constructor(options = {}, callback) {
1682
- super();
1683
- this.options = transformOptions(options);
1684
- this.services = {};
1685
- this.logger = baseLogger;
1686
- this.modules = {
1687
- external: []
1688
- };
1689
- bindMemberFunctions(this);
1690
- if (callback && !this.isInitialized && !options.isClone) {
1691
- if (!this.options.initAsync) {
1692
- this.init(options, callback);
1693
- return this;
1694
- }
1695
- setTimeout(() => {
1696
- this.init(options, callback);
1697
- }, 0);
1698
- }
1699
- }
1700
- init(options = {}, callback) {
1701
- this.isInitializing = true;
1702
- if (typeof options === 'function') {
1703
- callback = options;
1704
- options = {};
1705
- }
1706
- if (options.defaultNS == null && options.ns) {
1707
- if (isString(options.ns)) {
1708
- options.defaultNS = options.ns;
1709
- } else if (options.ns.indexOf('translation') < 0) {
1710
- options.defaultNS = options.ns[0];
1711
- }
1712
- }
1713
- const defOpts = get();
1714
- this.options = {
1715
- ...defOpts,
1716
- ...this.options,
1717
- ...transformOptions(options)
1718
- };
1719
- this.options.interpolation = {
1720
- ...defOpts.interpolation,
1721
- ...this.options.interpolation
1722
- };
1723
- if (options.keySeparator !== undefined) {
1724
- this.options.userDefinedKeySeparator = options.keySeparator;
1725
- }
1726
- if (options.nsSeparator !== undefined) {
1727
- this.options.userDefinedNsSeparator = options.nsSeparator;
1728
- }
1729
- const createClassOnDemand = ClassOrObject => {
1730
- if (!ClassOrObject) return null;
1731
- if (typeof ClassOrObject === 'function') return new ClassOrObject();
1732
- return ClassOrObject;
1733
- };
1734
- if (!this.options.isClone) {
1735
- if (this.modules.logger) {
1736
- baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
1737
- } else {
1738
- baseLogger.init(null, this.options);
1739
- }
1740
- let formatter;
1741
- if (this.modules.formatter) {
1742
- formatter = this.modules.formatter;
1743
- } else {
1744
- formatter = Formatter;
1745
- }
1746
- const lu = new LanguageUtil(this.options);
1747
- this.store = new ResourceStore(this.options.resources, this.options);
1748
- const s = this.services;
1749
- s.logger = baseLogger;
1750
- s.resourceStore = this.store;
1751
- s.languageUtils = lu;
1752
- s.pluralResolver = new PluralResolver(lu, {
1753
- prepend: this.options.pluralSeparator,
1754
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1755
- });
1756
- const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
1757
- if (usingLegacyFormatFunction) {
1758
- this.logger.warn(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
1759
- }
1760
- if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
1761
- s.formatter = createClassOnDemand(formatter);
1762
- if (s.formatter.init) s.formatter.init(s, this.options);
1763
- this.options.interpolation.format = s.formatter.format.bind(s.formatter);
1764
- }
1765
- s.interpolator = new Interpolator(this.options);
1766
- s.utils = {
1767
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1768
- };
1769
- s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
1770
- s.backendConnector.on('*', (event, ...args) => {
1771
- this.emit(event, ...args);
1772
- });
1773
- if (this.modules.languageDetector) {
1774
- s.languageDetector = createClassOnDemand(this.modules.languageDetector);
1775
- if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
1776
- }
1777
- if (this.modules.i18nFormat) {
1778
- s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
1779
- if (s.i18nFormat.init) s.i18nFormat.init(this);
1780
- }
1781
- this.translator = new Translator(this.services, this.options);
1782
- this.translator.on('*', (event, ...args) => {
1783
- this.emit(event, ...args);
1784
- });
1785
- this.modules.external.forEach(m => {
1786
- if (m.init) m.init(this);
1787
- });
1788
- }
1789
- this.format = this.options.interpolation.format;
1790
- if (!callback) callback = noop;
1791
- if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1792
- const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1793
- if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
1794
- }
1795
- if (!this.services.languageDetector && !this.options.lng) {
1796
- this.logger.warn('init: no languageDetector is used and no lng is defined');
1797
- }
1798
- const storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
1799
- storeApi.forEach(fcName => {
1800
- this[fcName] = (...args) => this.store[fcName](...args);
1801
- });
1802
- const storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
1803
- storeApiChained.forEach(fcName => {
1804
- this[fcName] = (...args) => {
1805
- this.store[fcName](...args);
1806
- return this;
1807
- };
1808
- });
1809
- const deferred = defer();
1810
- const load = () => {
1811
- const finish = (err, t) => {
1812
- this.isInitializing = false;
1813
- if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn('init: i18next is already initialized. You should call init just once!');
1814
- this.isInitialized = true;
1815
- if (!this.options.isClone) this.logger.log('initialized', this.options);
1816
- this.emit('initialized', this.options);
1817
- deferred.resolve(t);
1818
- callback(err, t);
1819
- };
1820
- if (this.languages && !this.isInitialized) return finish(null, this.t.bind(this));
1821
- this.changeLanguage(this.options.lng, finish);
1822
- };
1823
- if (this.options.resources || !this.options.initAsync) {
1824
- load();
1825
- } else {
1826
- setTimeout(load, 0);
1827
- }
1828
- return deferred;
1829
- }
1830
- loadResources(language, callback = noop) {
1831
- let usedCallback = callback;
1832
- const usedLng = isString(language) ? language : this.language;
1833
- if (typeof language === 'function') usedCallback = language;
1834
- if (!this.options.resources || this.options.partialBundledLanguages) {
1835
- if (usedLng?.toLowerCase() === 'cimode' && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
1836
- const toLoad = [];
1837
- const append = lng => {
1838
- if (!lng) return;
1839
- if (lng === 'cimode') return;
1840
- const lngs = this.services.languageUtils.toResolveHierarchy(lng);
1841
- lngs.forEach(l => {
1842
- if (l === 'cimode') return;
1843
- if (toLoad.indexOf(l) < 0) toLoad.push(l);
1844
- });
1845
- };
1846
- if (!usedLng) {
1847
- const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1848
- fallbacks.forEach(l => append(l));
1849
- } else {
1850
- append(usedLng);
1851
- }
1852
- this.options.preload?.forEach?.(l => append(l));
1853
- this.services.backendConnector.load(toLoad, this.options.ns, e => {
1854
- if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
1855
- usedCallback(e);
1856
- });
1857
- } else {
1858
- usedCallback(null);
1859
- }
1860
- }
1861
- reloadResources(lngs, ns, callback) {
1862
- const deferred = defer();
1863
- if (typeof lngs === 'function') {
1864
- callback = lngs;
1865
- lngs = undefined;
1866
- }
1867
- if (typeof ns === 'function') {
1868
- callback = ns;
1869
- ns = undefined;
1870
- }
1871
- if (!lngs) lngs = this.languages;
1872
- if (!ns) ns = this.options.ns;
1873
- if (!callback) callback = noop;
1874
- this.services.backendConnector.reload(lngs, ns, err => {
1875
- deferred.resolve();
1876
- callback(err);
1877
- });
1878
- return deferred;
1879
- }
1880
- use(module) {
1881
- if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
1882
- if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
1883
- if (module.type === 'backend') {
1884
- this.modules.backend = module;
1885
- }
1886
- if (module.type === 'logger' || module.log && module.warn && module.error) {
1887
- this.modules.logger = module;
1888
- }
1889
- if (module.type === 'languageDetector') {
1890
- this.modules.languageDetector = module;
1891
- }
1892
- if (module.type === 'i18nFormat') {
1893
- this.modules.i18nFormat = module;
1894
- }
1895
- if (module.type === 'postProcessor') {
1896
- postProcessor.addPostProcessor(module);
1897
- }
1898
- if (module.type === 'formatter') {
1899
- this.modules.formatter = module;
1900
- }
1901
- if (module.type === '3rdParty') {
1902
- this.modules.external.push(module);
1903
- }
1904
- return this;
1905
- }
1906
- setResolvedLanguage(l) {
1907
- if (!l || !this.languages) return;
1908
- if (['cimode', 'dev'].indexOf(l) > -1) return;
1909
- for (let li = 0; li < this.languages.length; li++) {
1910
- const lngInLngs = this.languages[li];
1911
- if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
1912
- if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
1913
- this.resolvedLanguage = lngInLngs;
1914
- break;
1915
- }
1916
- }
1917
- if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
1918
- this.resolvedLanguage = l;
1919
- this.languages.unshift(l);
1920
- }
1921
- }
1922
- changeLanguage(lng, callback) {
1923
- this.isLanguageChangingTo = lng;
1924
- const deferred = defer();
1925
- this.emit('languageChanging', lng);
1926
- const setLngProps = l => {
1927
- this.language = l;
1928
- this.languages = this.services.languageUtils.toResolveHierarchy(l);
1929
- this.resolvedLanguage = undefined;
1930
- this.setResolvedLanguage(l);
1931
- };
1932
- const done = (err, l) => {
1933
- if (l) {
1934
- if (this.isLanguageChangingTo === lng) {
1935
- setLngProps(l);
1936
- this.translator.changeLanguage(l);
1937
- this.isLanguageChangingTo = undefined;
1938
- this.emit('languageChanged', l);
1939
- this.logger.log('languageChanged', l);
1940
- }
1941
- } else {
1942
- this.isLanguageChangingTo = undefined;
1943
- }
1944
- deferred.resolve((...args) => this.t(...args));
1945
- if (callback) callback(err, (...args) => this.t(...args));
1946
- };
1947
- const setLng = lngs => {
1948
- if (!lng && !lngs && this.services.languageDetector) lngs = [];
1949
- const fl = isString(lngs) ? lngs : lngs && lngs[0];
1950
- const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
1951
- if (l) {
1952
- if (!this.language) {
1953
- setLngProps(l);
1954
- }
1955
- if (!this.translator.language) this.translator.changeLanguage(l);
1956
- this.services.languageDetector?.cacheUserLanguage?.(l);
1957
- }
1958
- this.loadResources(l, err => {
1959
- done(err, l);
1960
- });
1961
- };
1962
- if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
1963
- setLng(this.services.languageDetector.detect());
1964
- } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
1965
- if (this.services.languageDetector.detect.length === 0) {
1966
- this.services.languageDetector.detect().then(setLng);
1967
- } else {
1968
- this.services.languageDetector.detect(setLng);
1969
- }
1970
- } else {
1971
- setLng(lng);
1972
- }
1973
- return deferred;
1974
- }
1975
- getFixedT(lng, ns, keyPrefix) {
1976
- const fixedT = (key, opts, ...rest) => {
1977
- let o;
1978
- if (typeof opts !== 'object') {
1979
- o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
1980
- } else {
1981
- o = {
1982
- ...opts
1983
- };
1984
- }
1985
- o.lng = o.lng || fixedT.lng;
1986
- o.lngs = o.lngs || fixedT.lngs;
1987
- o.ns = o.ns || fixedT.ns;
1988
- if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
1989
- const keySeparator = this.options.keySeparator || '.';
1990
- let resultKey;
1991
- if (o.keyPrefix && Array.isArray(key)) {
1992
- resultKey = key.map(k => `${o.keyPrefix}${keySeparator}${k}`);
1993
- } else {
1994
- resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
1995
- }
1996
- return this.t(resultKey, o);
1997
- };
1998
- if (isString(lng)) {
1999
- fixedT.lng = lng;
2000
- } else {
2001
- fixedT.lngs = lng;
2002
- }
2003
- fixedT.ns = ns;
2004
- fixedT.keyPrefix = keyPrefix;
2005
- return fixedT;
2006
- }
2007
- t(...args) {
2008
- return this.translator?.translate(...args);
2009
- }
2010
- exists(...args) {
2011
- return this.translator?.exists(...args);
2012
- }
2013
- setDefaultNamespace(ns) {
2014
- this.options.defaultNS = ns;
2015
- }
2016
- hasLoadedNamespace(ns, options = {}) {
2017
- if (!this.isInitialized) {
2018
- this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
2019
- return false;
2020
- }
2021
- if (!this.languages || !this.languages.length) {
2022
- this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
2023
- return false;
2024
- }
2025
- const lng = options.lng || this.resolvedLanguage || this.languages[0];
2026
- const fallbackLng = this.options ? this.options.fallbackLng : false;
2027
- const lastLng = this.languages[this.languages.length - 1];
2028
- if (lng.toLowerCase() === 'cimode') return true;
2029
- const loadNotPending = (l, n) => {
2030
- const loadState = this.services.backendConnector.state[`${l}|${n}`];
2031
- return loadState === -1 || loadState === 0 || loadState === 2;
2032
- };
2033
- if (options.precheck) {
2034
- const preResult = options.precheck(this, loadNotPending);
2035
- if (preResult !== undefined) return preResult;
2036
- }
2037
- if (this.hasResourceBundle(lng, ns)) return true;
2038
- if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
2039
- if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
2040
- return false;
2041
- }
2042
- loadNamespaces(ns, callback) {
2043
- const deferred = defer();
2044
- if (!this.options.ns) {
2045
- if (callback) callback();
2046
- return Promise.resolve();
2047
- }
2048
- if (isString(ns)) ns = [ns];
2049
- ns.forEach(n => {
2050
- if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
2051
- });
2052
- this.loadResources(err => {
2053
- deferred.resolve();
2054
- if (callback) callback(err);
2055
- });
2056
- return deferred;
2057
- }
2058
- loadLanguages(lngs, callback) {
2059
- const deferred = defer();
2060
- if (isString(lngs)) lngs = [lngs];
2061
- const preloaded = this.options.preload || [];
2062
- const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
2063
- if (!newLngs.length) {
2064
- if (callback) callback();
2065
- return Promise.resolve();
2066
- }
2067
- this.options.preload = preloaded.concat(newLngs);
2068
- this.loadResources(err => {
2069
- deferred.resolve();
2070
- if (callback) callback(err);
2071
- });
2072
- return deferred;
2073
- }
2074
- dir(lng) {
2075
- if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
2076
- if (!lng) return 'rtl';
2077
- try {
2078
- const l = new Intl.Locale(lng);
2079
- if (l && l.getTextInfo) {
2080
- const ti = l.getTextInfo();
2081
- if (ti && ti.direction) return ti.direction;
2082
- }
2083
- } catch (e) {}
2084
- 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'];
2085
- const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
2086
- if (lng.toLowerCase().indexOf('-latn') > 1) return 'ltr';
2087
- return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
2088
- }
2089
- static createInstance(options = {}, callback) {
2090
- return new I18n(options, callback);
2091
- }
2092
- cloneInstance(options = {}, callback = noop) {
2093
- const forkResourceStore = options.forkResourceStore;
2094
- if (forkResourceStore) delete options.forkResourceStore;
2095
- const mergedOptions = {
2096
- ...this.options,
2097
- ...options,
2098
- ...{
2099
- isClone: true
2100
- }
2101
- };
2102
- const clone = new I18n(mergedOptions);
2103
- if (options.debug !== undefined || options.prefix !== undefined) {
2104
- clone.logger = clone.logger.clone(options);
2105
- }
2106
- const membersToCopy = ['store', 'services', 'language'];
2107
- membersToCopy.forEach(m => {
2108
- clone[m] = this[m];
2109
- });
2110
- clone.services = {
2111
- ...this.services
2112
- };
2113
- clone.services.utils = {
2114
- hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2115
- };
2116
- if (forkResourceStore) {
2117
- const clonedData = Object.keys(this.store.data).reduce((prev, l) => {
2118
- prev[l] = {
2119
- ...this.store.data[l]
2120
- };
2121
- prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
2122
- acc[n] = {
2123
- ...prev[l][n]
2124
- };
2125
- return acc;
2126
- }, prev[l]);
2127
- return prev;
2128
- }, {});
2129
- clone.store = new ResourceStore(clonedData, mergedOptions);
2130
- clone.services.resourceStore = clone.store;
2131
- }
2132
- clone.translator = new Translator(clone.services, mergedOptions);
2133
- clone.translator.on('*', (event, ...args) => {
2134
- clone.emit(event, ...args);
2135
- });
2136
- clone.init(mergedOptions, callback);
2137
- clone.translator.options = mergedOptions;
2138
- clone.translator.backendConnector.services.utils = {
2139
- hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2140
- };
2141
- return clone;
2142
- }
2143
- toJSON() {
2144
- return {
2145
- options: this.options,
2146
- store: this.store,
2147
- language: this.language,
2148
- languages: this.languages,
2149
- resolvedLanguage: this.resolvedLanguage
2150
- };
2151
- }
2152
- }
2153
- const instance = I18n.createInstance();
2154
- instance.createInstance = I18n.createInstance;
2155
-
2156
- function getWindow() {
2157
- return window;
2158
- }
2159
- function getAtomicEnvironment(headlessVersion) {
2160
- return {
2161
- version: "3.35.0-pre.b3e173655a",
2162
- headlessVersion,
2163
- };
2164
- }
2165
- function getAtomicVersion() {
2166
- return getAtomicEnvironment('').version;
2167
- }
2168
- function setCoveoGlobal(globalVariableName, headlessVersion) {
2169
- if (getWindow()[globalVariableName]) {
2170
- return;
2171
- }
2172
- getWindow()[globalVariableName] = getAtomicEnvironment(headlessVersion);
2173
- }
2174
-
2175
- const locales = {
2176
- af: () => Promise.resolve().then(function () { return require('./af-3cb14af3.js'); }).then(function (n) { return n.af; }),
2177
- am: () => Promise.resolve().then(function () { return require('./am-510642ea.js'); }).then(function (n) { return n.am; }),
2178
- 'ar-DZ': () => Promise.resolve().then(function () { return require('./ar-dz-9f84b9ec.js'); }).then(function (n) { return n.arDz; }),
2179
- 'ar-IQ': () => Promise.resolve().then(function () { return require('./ar-iq-82749a7b.js'); }).then(function (n) { return n.arIq; }),
2180
- 'ar-KW': () => Promise.resolve().then(function () { return require('./ar-kw-e6d3ff65.js'); }).then(function (n) { return n.arKw; }),
2181
- 'ar-LY': () => Promise.resolve().then(function () { return require('./ar-ly-4b4d7e0e.js'); }).then(function (n) { return n.arLy; }),
2182
- 'ar-MA': () => Promise.resolve().then(function () { return require('./ar-ma-29c6bdb4.js'); }).then(function (n) { return n.arMa; }),
2183
- 'ar-SA': () => Promise.resolve().then(function () { return require('./ar-sa-c224f9a4.js'); }).then(function (n) { return n.arSa; }),
2184
- 'ar-TN': () => Promise.resolve().then(function () { return require('./ar-tn-c1ce01e3.js'); }).then(function (n) { return n.arTn; }),
2185
- ar: () => Promise.resolve().then(function () { return require('./ar-86e1aad6.js'); }).then(function (n) { return n.ar; }),
2186
- az: () => Promise.resolve().then(function () { return require('./az-7bcdad3d.js'); }).then(function (n) { return n.az; }),
2187
- be: () => Promise.resolve().then(function () { return require('./be-9da1ff48.js'); }).then(function (n) { return n.be; }),
2188
- bg: () => Promise.resolve().then(function () { return require('./bg-1780c400.js'); }).then(function (n) { return n.bg; }),
2189
- bi: () => Promise.resolve().then(function () { return require('./bi-63811d4b.js'); }).then(function (n) { return n.bi; }),
2190
- bm: () => Promise.resolve().then(function () { return require('./bm-11d33058.js'); }).then(function (n) { return n.bm; }),
2191
- 'bn-BD': () => Promise.resolve().then(function () { return require('./bn-bd-4acb433e.js'); }).then(function (n) { return n.bnBd; }),
2192
- bn: () => Promise.resolve().then(function () { return require('./bn-2cff4366.js'); }).then(function (n) { return n.bn; }),
2193
- bo: () => Promise.resolve().then(function () { return require('./bo-bd8d86ce.js'); }).then(function (n) { return n.bo; }),
2194
- br: () => Promise.resolve().then(function () { return require('./br-ecbedea3.js'); }).then(function (n) { return n.br; }),
2195
- bs: () => Promise.resolve().then(function () { return require('./bs-c81d4a45.js'); }).then(function (n) { return n.bs; }),
2196
- ca: () => Promise.resolve().then(function () { return require('./ca-4c562cd2.js'); }).then(function (n) { return n.ca; }),
2197
- cs: () => Promise.resolve().then(function () { return require('./cs-c31a9767.js'); }).then(function (n) { return n.cs; }),
2198
- cv: () => Promise.resolve().then(function () { return require('./cv-60097186.js'); }).then(function (n) { return n.cv; }),
2199
- cy: () => Promise.resolve().then(function () { return require('./cy-1e7cc646.js'); }).then(function (n) { return n.cy; }),
2200
- 'de-AT': () => Promise.resolve().then(function () { return require('./de-at-153c9ef4.js'); }).then(function (n) { return n.deAt; }),
2201
- da: () => Promise.resolve().then(function () { return require('./da-eb7eb148.js'); }).then(function (n) { return n.da; }),
2202
- 'de-CH': () => Promise.resolve().then(function () { return require('./de-ch-2876802d.js'); }).then(function (n) { return n.deCh; }),
2203
- de: () => Promise.resolve().then(function () { return require('./de-ecdc4de7.js'); }).then(function (n) { return n.de; }),
2204
- dv: () => Promise.resolve().then(function () { return require('./dv-9ed5298e.js'); }).then(function (n) { return n.dv; }),
2205
- el: () => Promise.resolve().then(function () { return require('./el-554a10d4.js'); }).then(function (n) { return n.el; }),
2206
- 'en-AU': () => Promise.resolve().then(function () { return require('./en-au-ae506a50.js'); }).then(function (n) { return n.enAu; }),
2207
- 'en-CA': () => Promise.resolve().then(function () { return require('./en-ca-77cff63e.js'); }).then(function (n) { return n.enCa; }),
2208
- 'en-GB': () => Promise.resolve().then(function () { return require('./en-gb-839656cd.js'); }).then(function (n) { return n.enGb; }),
2209
- 'en-IE': () => Promise.resolve().then(function () { return require('./en-ie-a6e4b063.js'); }).then(function (n) { return n.enIe; }),
2210
- 'en-IL': () => Promise.resolve().then(function () { return require('./en-il-b7fe83df.js'); }).then(function (n) { return n.enIl; }),
2211
- 'en-IN': () => Promise.resolve().then(function () { return require('./en-in-c75ae3bb.js'); }).then(function (n) { return n.enIn; }),
2212
- 'en-NZ': () => Promise.resolve().then(function () { return require('./en-nz-beb1260b.js'); }).then(function (n) { return n.enNz; }),
2213
- 'en-SG': () => Promise.resolve().then(function () { return require('./en-sg-711fb5a9.js'); }).then(function (n) { return n.enSg; }),
2214
- 'en-TT': () => Promise.resolve().then(function () { return require('./en-tt-6df63ce2.js'); }).then(function (n) { return n.enTt; }),
2215
- eo: () => Promise.resolve().then(function () { return require('./eo-cf619487.js'); }).then(function (n) { return n.eo; }),
2216
- en: () => Promise.resolve().then(function () { return require('./en-d5fc11ea.js'); }).then(function (n) { return n.en; }),
2217
- 'es-DO': () => Promise.resolve().then(function () { return require('./es-do-da7561fe.js'); }).then(function (n) { return n.esDo; }),
2218
- 'es-MX': () => Promise.resolve().then(function () { return require('./es-mx-b86c5ced.js'); }).then(function (n) { return n.esMx; }),
2219
- 'es-PR': () => Promise.resolve().then(function () { return require('./es-pr-c64c4b1f.js'); }).then(function (n) { return n.esPr; }),
2220
- 'es-US': () => Promise.resolve().then(function () { return require('./es-us-eafcfe70.js'); }).then(function (n) { return n.esUs; }),
2221
- et: () => Promise.resolve().then(function () { return require('./et-2014946e.js'); }).then(function (n) { return n.et; }),
2222
- es: () => Promise.resolve().then(function () { return require('./es-ec9ef939.js'); }).then(function (n) { return n.es; }),
2223
- eu: () => Promise.resolve().then(function () { return require('./eu-2704a941.js'); }).then(function (n) { return n.eu; }),
2224
- fa: () => Promise.resolve().then(function () { return require('./fa-b4ce0828.js'); }).then(function (n) { return n.fa; }),
2225
- fo: () => Promise.resolve().then(function () { return require('./fo-847a4b87.js'); }).then(function (n) { return n.fo; }),
2226
- fi: () => Promise.resolve().then(function () { return require('./fi-418b62b3.js'); }).then(function (n) { return n.fi; }),
2227
- 'fr-CA': () => Promise.resolve().then(function () { return require('./fr-ca-683eb84d.js'); }).then(function (n) { return n.frCa; }),
2228
- 'fr-CH': () => Promise.resolve().then(function () { return require('./fr-ch-64ad6883.js'); }).then(function (n) { return n.frCh; }),
2229
- fr: () => Promise.resolve().then(function () { return require('./fr-02ad9e84.js'); }).then(function (n) { return n.fr; }),
2230
- fy: () => Promise.resolve().then(function () { return require('./fy-2bbc1932.js'); }).then(function (n) { return n.fy; }),
2231
- ga: () => Promise.resolve().then(function () { return require('./ga-7a270266.js'); }).then(function (n) { return n.ga; }),
2232
- gd: () => Promise.resolve().then(function () { return require('./gd-baafa243.js'); }).then(function (n) { return n.gd; }),
2233
- 'gom-LATN': () => Promise.resolve().then(function () { return require('./gom-latn-e8f97b3c.js'); }).then(function (n) { return n.gomLatn; }),
2234
- gl: () => Promise.resolve().then(function () { return require('./gl-7386ddb5.js'); }).then(function (n) { return n.gl; }),
2235
- gu: () => Promise.resolve().then(function () { return require('./gu-7effa611.js'); }).then(function (n) { return n.gu; }),
2236
- he: () => Promise.resolve().then(function () { return require('./he-f1c0bf01.js'); }).then(function (n) { return n.he; }),
2237
- hi: () => Promise.resolve().then(function () { return require('./hi-b27c247c.js'); }).then(function (n) { return n.hi; }),
2238
- hr: () => Promise.resolve().then(function () { return require('./hr-2a5465eb.js'); }).then(function (n) { return n.hr; }),
2239
- hu: () => Promise.resolve().then(function () { return require('./hu-b67baba1.js'); }).then(function (n) { return n.hu; }),
2240
- ht: () => Promise.resolve().then(function () { return require('./ht-95dbca9a.js'); }).then(function (n) { return n.ht; }),
2241
- 'hy-AM': () => Promise.resolve().then(function () { return require('./hy-am-1056024b.js'); }).then(function (n) { return n.hyAm; }),
2242
- id: () => Promise.resolve().then(function () { return require('./id-8d9d1934.js'); }).then(function (n) { return n.id; }),
2243
- is: () => Promise.resolve().then(function () { return require('./is-f2bfcd99.js'); }).then(function (n) { return n.is; }),
2244
- 'it-CH': () => Promise.resolve().then(function () { return require('./it-ch-aae915b1.js'); }).then(function (n) { return n.itCh; }),
2245
- it: () => Promise.resolve().then(function () { return require('./it-35cc21b8.js'); }).then(function (n) { return n.it; }),
2246
- ja: () => Promise.resolve().then(function () { return require('./ja-7bb6e892.js'); }).then(function (n) { return n.ja; }),
2247
- jv: () => Promise.resolve().then(function () { return require('./jv-9cde1ffe.js'); }).then(function (n) { return n.jv; }),
2248
- ka: () => Promise.resolve().then(function () { return require('./ka-7f526005.js'); }).then(function (n) { return n.ka; }),
2249
- kk: () => Promise.resolve().then(function () { return require('./kk-a594eeaa.js'); }).then(function (n) { return n.kk; }),
2250
- km: () => Promise.resolve().then(function () { return require('./km-5f37f151.js'); }).then(function (n) { return n.km; }),
2251
- kn: () => Promise.resolve().then(function () { return require('./kn-84a55197.js'); }).then(function (n) { return n.kn; }),
2252
- ko: () => Promise.resolve().then(function () { return require('./ko-d261b948.js'); }).then(function (n) { return n.ko; }),
2253
- ku: () => Promise.resolve().then(function () { return require('./ku-b2336eec.js'); }).then(function (n) { return n.ku; }),
2254
- ky: () => Promise.resolve().then(function () { return require('./ky-763fe4c8.js'); }).then(function (n) { return n.ky; }),
2255
- lb: () => Promise.resolve().then(function () { return require('./lb-6ca5b888.js'); }).then(function (n) { return n.lb; }),
2256
- lo: () => Promise.resolve().then(function () { return require('./lo-9bc2e80e.js'); }).then(function (n) { return n.lo; }),
2257
- lt: () => Promise.resolve().then(function () { return require('./lt-5f2d24f6.js'); }).then(function (n) { return n.lt; }),
2258
- lv: () => Promise.resolve().then(function () { return require('./lv-d556d12c.js'); }).then(function (n) { return n.lv; }),
2259
- me: () => Promise.resolve().then(function () { return require('./me-df56afb1.js'); }).then(function (n) { return n.me; }),
2260
- mi: () => Promise.resolve().then(function () { return require('./mi-f0b520a2.js'); }).then(function (n) { return n.mi; }),
2261
- mk: () => Promise.resolve().then(function () { return require('./mk-3187bb9b.js'); }).then(function (n) { return n.mk; }),
2262
- ml: () => Promise.resolve().then(function () { return require('./ml-260d4b1c.js'); }).then(function (n) { return n.ml; }),
2263
- mn: () => Promise.resolve().then(function () { return require('./mn-e636b053.js'); }).then(function (n) { return n.mn; }),
2264
- mr: () => Promise.resolve().then(function () { return require('./mr-d7ab5382.js'); }).then(function (n) { return n.mr; }),
2265
- 'ms-MY': () => Promise.resolve().then(function () { return require('./ms-my-c78cdffc.js'); }).then(function (n) { return n.msMy; }),
2266
- ms: () => Promise.resolve().then(function () { return require('./ms-ad12de06.js'); }).then(function (n) { return n.ms; }),
2267
- mt: () => Promise.resolve().then(function () { return require('./mt-51cb46e8.js'); }).then(function (n) { return n.mt; }),
2268
- my: () => Promise.resolve().then(function () { return require('./my-15440c7b.js'); }).then(function (n) { return n.my; }),
2269
- nb: () => Promise.resolve().then(function () { return require('./nb-88f0d23f.js'); }).then(function (n) { return n.nb; }),
2270
- ne: () => Promise.resolve().then(function () { return require('./ne-25d07cb0.js'); }).then(function (n) { return n.ne; }),
2271
- 'nl-BE': () => Promise.resolve().then(function () { return require('./nl-be-71bdf208.js'); }).then(function (n) { return n.nlBe; }),
2272
- nl: () => Promise.resolve().then(function () { return require('./nl-823d03bb.js'); }).then(function (n) { return n.nl; }),
2273
- pl: () => Promise.resolve().then(function () { return require('./pl-7b9e540b.js'); }).then(function (n) { return n.pl; }),
2274
- 'pt-BR': () => Promise.resolve().then(function () { return require('./pt-br-50134f1a.js'); }).then(function (n) { return n.ptBr; }),
2275
- pt: () => Promise.resolve().then(function () { return require('./pt-94c03016.js'); }).then(function (n) { return n.pt; }),
2276
- rn: () => Promise.resolve().then(function () { return require('./rn-bbc51301.js'); }).then(function (n) { return n.rn; }),
2277
- ro: () => Promise.resolve().then(function () { return require('./ro-6513dd0a.js'); }).then(function (n) { return n.ro; }),
2278
- ru: () => Promise.resolve().then(function () { return require('./ru-8cedefa3.js'); }).then(function (n) { return n.ru; }),
2279
- rw: () => Promise.resolve().then(function () { return require('./rw-20d11af0.js'); }).then(function (n) { return n.rw; }),
2280
- sd: () => Promise.resolve().then(function () { return require('./sd-56538a3c.js'); }).then(function (n) { return n.sd; }),
2281
- se: () => Promise.resolve().then(function () { return require('./se-e97faaf3.js'); }).then(function (n) { return n.se; }),
2282
- si: () => Promise.resolve().then(function () { return require('./si-f07356e4.js'); }).then(function (n) { return n.si; }),
2283
- sk: () => Promise.resolve().then(function () { return require('./sk-afb11dce.js'); }).then(function (n) { return n.sk; }),
2284
- sl: () => Promise.resolve().then(function () { return require('./sl-78defe5b.js'); }).then(function (n) { return n.sl; }),
2285
- sq: () => Promise.resolve().then(function () { return require('./sq-e0f08a12.js'); }).then(function (n) { return n.sq; }),
2286
- 'sr-CYRL': () => Promise.resolve().then(function () { return require('./sr-cyrl-21f60f73.js'); }).then(function (n) { return n.srCyrl; }),
2287
- ss: () => Promise.resolve().then(function () { return require('./ss-91e94d39.js'); }).then(function (n) { return n.ss; }),
2288
- 'sv-FI': () => Promise.resolve().then(function () { return require('./sv-fi-6958e268.js'); }).then(function (n) { return n.svFi; }),
2289
- sr: () => Promise.resolve().then(function () { return require('./sr-97a3e823.js'); }).then(function (n) { return n.sr; }),
2290
- sv: () => Promise.resolve().then(function () { return require('./sv-55b70625.js'); }).then(function (n) { return n.sv; }),
2291
- sw: () => Promise.resolve().then(function () { return require('./sw-dfa19fe5.js'); }).then(function (n) { return n.sw; }),
2292
- ta: () => Promise.resolve().then(function () { return require('./ta-32d249cc.js'); }).then(function (n) { return n.ta; }),
2293
- te: () => Promise.resolve().then(function () { return require('./te-6f7364a2.js'); }).then(function (n) { return n.te; }),
2294
- tet: () => Promise.resolve().then(function () { return require('./tet-3765fd11.js'); }).then(function (n) { return n.tet; }),
2295
- tg: () => Promise.resolve().then(function () { return require('./tg-3810a776.js'); }).then(function (n) { return n.tg; }),
2296
- th: () => Promise.resolve().then(function () { return require('./th-044656c6.js'); }).then(function (n) { return n.th; }),
2297
- tk: () => Promise.resolve().then(function () { return require('./tk-62196c48.js'); }).then(function (n) { return n.tk; }),
2298
- 'tl-PH': () => Promise.resolve().then(function () { return require('./tl-ph-427b3456.js'); }).then(function (n) { return n.tlPh; }),
2299
- tlh: () => Promise.resolve().then(function () { return require('./tlh-713bea77.js'); }).then(function (n) { return n.tlh; }),
2300
- tr: () => Promise.resolve().then(function () { return require('./tr-ba983dc9.js'); }).then(function (n) { return n.tr; }),
2301
- tzl: () => Promise.resolve().then(function () { return require('./tzl-8161bdec.js'); }).then(function (n) { return n.tzl; }),
2302
- 'tzm-LATN': () => Promise.resolve().then(function () { return require('./tzm-latn-091fa71f.js'); }).then(function (n) { return n.tzmLatn; }),
2303
- tzm: () => Promise.resolve().then(function () { return require('./tzm-ade56748.js'); }).then(function (n) { return n.tzm; }),
2304
- 'ug-CN': () => Promise.resolve().then(function () { return require('./ug-cn-182958d3.js'); }).then(function (n) { return n.ugCn; }),
2305
- uk: () => Promise.resolve().then(function () { return require('./uk-7158ef87.js'); }).then(function (n) { return n.uk; }),
2306
- ur: () => Promise.resolve().then(function () { return require('./ur-7feb599f.js'); }).then(function (n) { return n.ur; }),
2307
- 'uz-LATN': () => Promise.resolve().then(function () { return require('./uz-latn-b800ffa4.js'); }).then(function (n) { return n.uzLatn; }),
2308
- uz: () => Promise.resolve().then(function () { return require('./uz-2fe37acb.js'); }).then(function (n) { return n.uz; }),
2309
- vi: () => Promise.resolve().then(function () { return require('./vi-d94f5810.js'); }).then(function (n) { return n.vi; }),
2310
- 'x-PSEUDO': () => Promise.resolve().then(function () { return require('./x-pseudo-5ecae8d8.js'); }).then(function (n) { return n.xPseudo; }),
2311
- yo: () => Promise.resolve().then(function () { return require('./yo-17cefd48.js'); }).then(function (n) { return n.yo; }),
2312
- 'zh-CN': () => Promise.resolve().then(function () { return require('./zh-cn-47409213.js'); }).then(function (n) { return n.zhCn; }),
2313
- 'zh-HK': () => Promise.resolve().then(function () { return require('./zh-hk-fc2c8cb3.js'); }).then(function (n) { return n.zhHk; }),
2314
- 'zh-TW': () => Promise.resolve().then(function () { return require('./zh-tw-04831c3c.js'); }).then(function (n) { return n.zhTw; }),
2315
- zh: () => Promise.resolve().then(function () { return require('./zh-8200043a.js'); }).then(function (n) { return n.zh; }),
2316
- 'oc-LNC': () => Promise.resolve().then(function () { return require('./oc-lnc-f82a10b4.js'); }).then(function (n) { return n.ocLnc; }),
2317
- nn: () => Promise.resolve().then(function () { return require('./nn-b1177787.js'); }).then(function (n) { return n.nn; }),
2318
- 'pa-IN': () => Promise.resolve().then(function () { return require('./pa-in-74c30512.js'); }).then(function (n) { return n.paIn; }),
2319
- };
2320
-
2321
- const warn = (language) => console.warn(`Cannot load dayjs locale file for "${language}"`);
2322
- const resolveLanguage = (languageInput) => {
2323
- if (locales[languageInput]) {
2324
- return languageInput;
2325
- }
2326
- if (languageInput.includes('-')) {
2327
- const regionlessLanguage = languageInput.split('-')[0];
2328
- if (locales[regionlessLanguage]) {
2329
- return regionlessLanguage;
2330
- }
2331
- }
2332
- return languageInput;
2333
- };
2334
- function loadDayjsLocale(languageInput) {
2335
- const language = resolveLanguage(languageInput);
2336
- if (!locales[language]) {
2337
- warn(language);
2338
- return;
2339
- }
2340
- try {
2341
- locales[language]().then(() => dayjs_min.dayjs.locale(language));
2342
- }
2343
- catch (_) {
2344
- warn(language);
2345
- }
2346
- }
2347
-
2348
- function _typeof$2(o) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$2(o); }
2349
- function hasXMLHttpRequest() {
2350
- return typeof XMLHttpRequest === 'function' || (typeof XMLHttpRequest === "undefined" ? "undefined" : _typeof$2(XMLHttpRequest)) === 'object';
2351
- }
2352
- function isPromise(maybePromise) {
2353
- return !!maybePromise && typeof maybePromise.then === 'function';
2354
- }
2355
- function makePromise(maybePromise) {
2356
- if (isPromise(maybePromise)) {
2357
- return maybePromise;
2358
- }
2359
- return Promise.resolve(maybePromise);
2360
- }
2361
-
2362
- function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2363
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2364
- function _defineProperty$1(e, r, t) { return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2365
- function _toPropertyKey$1(t) { var i = _toPrimitive$1(t, "string"); return "symbol" == _typeof$1(i) ? i : i + ""; }
2366
- function _toPrimitive$1(t, r) { if ("object" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$1(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
2367
- function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$1(o); }
2368
- var fetchApi = typeof fetch === 'function' ? fetch : undefined;
2369
- if (typeof global !== 'undefined' && global.fetch) {
2370
- fetchApi = global.fetch;
2371
- } else if (typeof window !== 'undefined' && window.fetch) {
2372
- fetchApi = window.fetch;
2373
- }
2374
- var XmlHttpRequestApi;
2375
- if (hasXMLHttpRequest()) {
2376
- if (typeof global !== 'undefined' && global.XMLHttpRequest) {
2377
- XmlHttpRequestApi = global.XMLHttpRequest;
2378
- } else if (typeof window !== 'undefined' && window.XMLHttpRequest) {
2379
- XmlHttpRequestApi = window.XMLHttpRequest;
2380
- }
2381
- }
2382
- var ActiveXObjectApi;
2383
- if (typeof ActiveXObject === 'function') {
2384
- if (typeof global !== 'undefined' && global.ActiveXObject) {
2385
- ActiveXObjectApi = global.ActiveXObject;
2386
- } else if (typeof window !== 'undefined' && window.ActiveXObject) {
2387
- ActiveXObjectApi = window.ActiveXObject;
2388
- }
2389
- }
2390
- if (typeof fetchApi !== 'function') fetchApi = undefined;
2391
- if (!fetchApi && !XmlHttpRequestApi && !ActiveXObjectApi) {
2392
- try {
2393
- Promise.resolve().then(function () { return require('./browser-ponyfill-b5a441f7.js'); }).then(function (n) { return n.browserPonyfill; }).then(function (mod) {
2394
- fetchApi = mod.default;
2395
- }).catch(function () {});
2396
- } catch (e) {}
2397
- }
2398
- var addQueryString = function addQueryString(url, params) {
2399
- if (params && _typeof$1(params) === 'object') {
2400
- var queryString = '';
2401
- for (var paramName in params) {
2402
- queryString += '&' + encodeURIComponent(paramName) + '=' + encodeURIComponent(params[paramName]);
2403
- }
2404
- if (!queryString) return url;
2405
- url = url + (url.indexOf('?') !== -1 ? '&' : '?') + queryString.slice(1);
2406
- }
2407
- return url;
2408
- };
2409
- var fetchIt = function fetchIt(url, fetchOptions, callback, altFetch) {
2410
- var resolver = function resolver(response) {
2411
- if (!response.ok) return callback(response.statusText || 'Error', {
2412
- status: response.status
2413
- });
2414
- response.text().then(function (data) {
2415
- callback(null, {
2416
- status: response.status,
2417
- data: data
2418
- });
2419
- }).catch(callback);
2420
- };
2421
- if (altFetch) {
2422
- var altResponse = altFetch(url, fetchOptions);
2423
- if (altResponse instanceof Promise) {
2424
- altResponse.then(resolver).catch(callback);
2425
- return;
2426
- }
2427
- }
2428
- if (typeof fetch === 'function') {
2429
- fetch(url, fetchOptions).then(resolver).catch(callback);
2430
- } else {
2431
- fetchApi(url, fetchOptions).then(resolver).catch(callback);
2432
- }
2433
- };
2434
- var omitFetchOptions = false;
2435
- var requestWithFetch = function requestWithFetch(options, url, payload, callback) {
2436
- if (options.queryStringParams) {
2437
- url = addQueryString(url, options.queryStringParams);
2438
- }
2439
- var headers = _objectSpread$1({}, typeof options.customHeaders === 'function' ? options.customHeaders() : options.customHeaders);
2440
- if (typeof window === 'undefined' && typeof global !== 'undefined' && typeof global.process !== 'undefined' && global.process.versions && global.process.versions.node) {
2441
- headers['User-Agent'] = "i18next-http-backend (node/".concat(global.process.version, "; ").concat(global.process.platform, " ").concat(global.process.arch, ")");
2442
- }
2443
- if (payload) headers['Content-Type'] = 'application/json';
2444
- var reqOptions = typeof options.requestOptions === 'function' ? options.requestOptions(payload) : options.requestOptions;
2445
- var fetchOptions = _objectSpread$1({
2446
- method: payload ? 'POST' : 'GET',
2447
- body: payload ? options.stringify(payload) : undefined,
2448
- headers: headers
2449
- }, omitFetchOptions ? {} : reqOptions);
2450
- var altFetch = typeof options.alternateFetch === 'function' && options.alternateFetch.length >= 1 ? options.alternateFetch : undefined;
2451
- try {
2452
- fetchIt(url, fetchOptions, callback, altFetch);
2453
- } catch (e) {
2454
- if (!reqOptions || Object.keys(reqOptions).length === 0 || !e.message || e.message.indexOf('not implemented') < 0) {
2455
- return callback(e);
2456
- }
2457
- try {
2458
- Object.keys(reqOptions).forEach(function (opt) {
2459
- delete fetchOptions[opt];
2460
- });
2461
- fetchIt(url, fetchOptions, callback, altFetch);
2462
- omitFetchOptions = true;
2463
- } catch (err) {
2464
- callback(err);
2465
- }
2466
- }
2467
- };
2468
- var requestWithXmlHttpRequest = function requestWithXmlHttpRequest(options, url, payload, callback) {
2469
- if (payload && _typeof$1(payload) === 'object') {
2470
- payload = addQueryString('', payload).slice(1);
2471
- }
2472
- if (options.queryStringParams) {
2473
- url = addQueryString(url, options.queryStringParams);
2474
- }
2475
- try {
2476
- var x = XmlHttpRequestApi ? new XmlHttpRequestApi() : new ActiveXObjectApi('MSXML2.XMLHTTP.3.0');
2477
- x.open(payload ? 'POST' : 'GET', url, 1);
2478
- if (!options.crossDomain) {
2479
- x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
2480
- }
2481
- x.withCredentials = !!options.withCredentials;
2482
- if (payload) {
2483
- x.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
2484
- }
2485
- if (x.overrideMimeType) {
2486
- x.overrideMimeType('application/json');
2487
- }
2488
- var h = options.customHeaders;
2489
- h = typeof h === 'function' ? h() : h;
2490
- if (h) {
2491
- for (var i in h) {
2492
- x.setRequestHeader(i, h[i]);
2493
- }
2494
- }
2495
- x.onreadystatechange = function () {
2496
- x.readyState > 3 && callback(x.status >= 400 ? x.statusText : null, {
2497
- status: x.status,
2498
- data: x.responseText
2499
- });
2500
- };
2501
- x.send(payload);
2502
- } catch (e) {
2503
- console && console.log(e);
2504
- }
2505
- };
2506
- var request = function request(options, url, payload, callback) {
2507
- if (typeof payload === 'function') {
2508
- callback = payload;
2509
- payload = undefined;
2510
- }
2511
- callback = callback || function () {};
2512
- if (fetchApi && url.indexOf('file:') !== 0) {
2513
- return requestWithFetch(options, url, payload, callback);
2514
- }
2515
- if (hasXMLHttpRequest() || typeof ActiveXObject === 'function') {
2516
- return requestWithXmlHttpRequest(options, url, payload, callback);
2517
- }
2518
- callback(new Error('No fetch and no xhr implementation found!'));
2519
- };
2520
-
2521
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2522
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2523
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2524
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
2525
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
2526
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
2527
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2528
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
2529
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
2530
- var getDefaults = function getDefaults() {
2531
- return {
2532
- loadPath: '/locales/{{lng}}/{{ns}}.json',
2533
- addPath: '/locales/add/{{lng}}/{{ns}}',
2534
- parse: function parse(data) {
2535
- return JSON.parse(data);
2536
- },
2537
- stringify: JSON.stringify,
2538
- parsePayload: function parsePayload(namespace, key, fallbackValue) {
2539
- return _defineProperty({}, key, fallbackValue || '');
2540
- },
2541
- parseLoadPayload: function parseLoadPayload(languages, namespaces) {
2542
- return undefined;
2543
- },
2544
- request: request,
2545
- reloadInterval: typeof window !== 'undefined' ? false : 60 * 60 * 1000,
2546
- customHeaders: {},
2547
- queryStringParams: {},
2548
- crossDomain: false,
2549
- withCredentials: false,
2550
- overrideMimeType: false,
2551
- requestOptions: {
2552
- mode: 'cors',
2553
- credentials: 'same-origin',
2554
- cache: 'default'
2555
- }
2556
- };
2557
- };
2558
- var Backend = function () {
2559
- function Backend(services) {
2560
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2561
- var allOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2562
- _classCallCheck(this, Backend);
2563
- this.services = services;
2564
- this.options = options;
2565
- this.allOptions = allOptions;
2566
- this.type = 'backend';
2567
- this.init(services, options, allOptions);
2568
- }
2569
- return _createClass(Backend, [{
2570
- key: "init",
2571
- value: function init(services) {
2572
- var _this = this;
2573
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2574
- var allOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2575
- this.services = services;
2576
- this.options = _objectSpread(_objectSpread(_objectSpread({}, getDefaults()), this.options || {}), options);
2577
- this.allOptions = allOptions;
2578
- if (this.services && this.options.reloadInterval) {
2579
- var timer = setInterval(function () {
2580
- return _this.reload();
2581
- }, this.options.reloadInterval);
2582
- if (_typeof(timer) === 'object' && typeof timer.unref === 'function') timer.unref();
2583
- }
2584
- }
2585
- }, {
2586
- key: "readMulti",
2587
- value: function readMulti(languages, namespaces, callback) {
2588
- this._readAny(languages, languages, namespaces, namespaces, callback);
2589
- }
2590
- }, {
2591
- key: "read",
2592
- value: function read(language, namespace, callback) {
2593
- this._readAny([language], language, [namespace], namespace, callback);
2594
- }
2595
- }, {
2596
- key: "_readAny",
2597
- value: function _readAny(languages, loadUrlLanguages, namespaces, loadUrlNamespaces, callback) {
2598
- var _this2 = this;
2599
- var loadPath = this.options.loadPath;
2600
- if (typeof this.options.loadPath === 'function') {
2601
- loadPath = this.options.loadPath(languages, namespaces);
2602
- }
2603
- loadPath = makePromise(loadPath);
2604
- loadPath.then(function (resolvedLoadPath) {
2605
- if (!resolvedLoadPath) return callback(null, {});
2606
- var url = _this2.services.interpolator.interpolate(resolvedLoadPath, {
2607
- lng: languages.join('+'),
2608
- ns: namespaces.join('+')
2609
- });
2610
- _this2.loadUrl(url, callback, loadUrlLanguages, loadUrlNamespaces);
2611
- });
2612
- }
2613
- }, {
2614
- key: "loadUrl",
2615
- value: function loadUrl(url, callback, languages, namespaces) {
2616
- var _this3 = this;
2617
- var lng = typeof languages === 'string' ? [languages] : languages;
2618
- var ns = typeof namespaces === 'string' ? [namespaces] : namespaces;
2619
- var payload = this.options.parseLoadPayload(lng, ns);
2620
- this.options.request(this.options, url, payload, function (err, res) {
2621
- if (res && (res.status >= 500 && res.status < 600 || !res.status)) return callback('failed loading ' + url + '; status code: ' + res.status, true);
2622
- if (res && res.status >= 400 && res.status < 500) return callback('failed loading ' + url + '; status code: ' + res.status, false);
2623
- if (!res && err && err.message) {
2624
- var errorMessage = err.message.toLowerCase();
2625
- var isNetworkError = ['failed', 'fetch', 'network', 'load'].find(function (term) {
2626
- return errorMessage.indexOf(term) > -1;
2627
- });
2628
- if (isNetworkError) {
2629
- return callback('failed loading ' + url + ': ' + err.message, true);
2630
- }
2631
- }
2632
- if (err) return callback(err, false);
2633
- var ret, parseErr;
2634
- try {
2635
- if (typeof res.data === 'string') {
2636
- ret = _this3.options.parse(res.data, languages, namespaces);
2637
- } else {
2638
- ret = res.data;
2639
- }
2640
- } catch (e) {
2641
- parseErr = 'failed parsing ' + url + ' to json';
2642
- }
2643
- if (parseErr) return callback(parseErr, false);
2644
- callback(null, ret);
2645
- });
2646
- }
2647
- }, {
2648
- key: "create",
2649
- value: function create(languages, namespace, key, fallbackValue, callback) {
2650
- var _this4 = this;
2651
- if (!this.options.addPath) return;
2652
- if (typeof languages === 'string') languages = [languages];
2653
- var payload = this.options.parsePayload(namespace, key, fallbackValue);
2654
- var finished = 0;
2655
- var dataArray = [];
2656
- var resArray = [];
2657
- languages.forEach(function (lng) {
2658
- var addPath = _this4.options.addPath;
2659
- if (typeof _this4.options.addPath === 'function') {
2660
- addPath = _this4.options.addPath(lng, namespace);
2661
- }
2662
- var url = _this4.services.interpolator.interpolate(addPath, {
2663
- lng: lng,
2664
- ns: namespace
2665
- });
2666
- _this4.options.request(_this4.options, url, payload, function (data, res) {
2667
- finished += 1;
2668
- dataArray.push(data);
2669
- resArray.push(res);
2670
- if (finished === languages.length) {
2671
- if (typeof callback === 'function') callback(dataArray, resArray);
2672
- }
2673
- });
2674
- });
2675
- }
2676
- }, {
2677
- key: "reload",
2678
- value: function reload() {
2679
- var _this5 = this;
2680
- var _this$services = this.services,
2681
- backendConnector = _this$services.backendConnector,
2682
- languageUtils = _this$services.languageUtils,
2683
- logger = _this$services.logger;
2684
- var currentLanguage = backendConnector.language;
2685
- if (currentLanguage && currentLanguage.toLowerCase() === 'cimode') return;
2686
- var toLoad = [];
2687
- var append = function append(lng) {
2688
- var lngs = languageUtils.toResolveHierarchy(lng);
2689
- lngs.forEach(function (l) {
2690
- if (toLoad.indexOf(l) < 0) toLoad.push(l);
2691
- });
2692
- };
2693
- append(currentLanguage);
2694
- if (this.allOptions.preload) this.allOptions.preload.forEach(function (l) {
2695
- return append(l);
2696
- });
2697
- toLoad.forEach(function (lng) {
2698
- _this5.allOptions.ns.forEach(function (ns) {
2699
- backendConnector.read(lng, ns, 'read', null, null, function (err, data) {
2700
- if (err) logger.warn("loading namespace ".concat(ns, " for language ").concat(lng, " failed"), err);
2701
- if (!err && data) logger.log("loaded namespace ".concat(ns, " for language ").concat(lng), data);
2702
- backendConnector.loaded("".concat(lng, "|").concat(ns), err, data);
2703
- });
2704
- });
2705
- });
2706
- }
2707
- }]);
2708
- }();
2709
- Backend.type = 'backend';
2710
-
2711
- function getAssetPath(path) {
2712
- const baseUrl = new URL('./', window.document.baseURI).href;
2713
- const assetUrl = new URL(path, baseUrl);
2714
- return assetUrl.origin !== window.location.origin
2715
- ? assetUrl.href
2716
- : assetUrl.pathname;
2717
- }
2718
-
2719
- const availableLocales = [
2720
- "dev",
2721
- "en",
2722
- "fr",
2723
- "cs",
2724
- "da",
2725
- "de",
2726
- "el",
2727
- "es",
2728
- "fi",
2729
- "hu",
2730
- "id",
2731
- "it",
2732
- "ja",
2733
- "ko",
2734
- "nl",
2735
- "no",
2736
- "pl",
2737
- "pt",
2738
- "pt-br",
2739
- "ru",
2740
- "sv",
2741
- "th",
2742
- "tr",
2743
- "zh",
2744
- "zh-cn",
2745
- "zh-tw",
2746
- "zn",
2747
- "es-es"
2748
- ];
2749
-
2750
- const i18nTranslationNamespace = 'translation';
2751
- function isI18nLocaleAvailable(locale) {
2752
- return availableLocales.includes(locale.toLowerCase());
2753
- }
2754
- function i18nBackendOptions(atomicInterface) {
2755
- return {
2756
- loadPath: `${getAssetPath(atomicInterface.languageAssetsPath)}/{{lng}}.json?lng={{lng}}&ns={{ns}}`,
2757
- request: async (_options, url, _payload, callback) => {
2758
- try {
2759
- const [fetchUrl, searchParams] = url.split('?');
2760
- const urlParams = new URLSearchParams(searchParams);
2761
- const lng = urlParams.get('lng');
2762
- const ns = urlParams.get('ns');
2763
- if (!isI18nLocaleAvailable(lng)) {
2764
- throw new Error(`Unsupported locale "${lng}"`);
2765
- }
2766
- if (ns !== i18nTranslationNamespace) {
2767
- throw new Error(`Unsupported namespace "${ns}"`);
2768
- }
2769
- const response = await fetch(fetchUrl);
2770
- if (response.status !== 200 && response.status !== 304) {
2771
- throw new Error(`Unsuccessful request returned status "${response.status}"`);
2772
- }
2773
- callback(null, {
2774
- status: response.status,
2775
- data: await response.json(),
2776
- });
2777
- }
2778
- catch (error) {
2779
- callback(error, { status: 404, data: '' });
2780
- }
2781
- },
2782
- };
2783
- }
2784
- function init18n(atomicInterface) {
2785
- return atomicInterface.i18n.use(Backend).init({
2786
- debug: atomicInterface.logLevel === 'debug',
2787
- lng: atomicInterface.language,
2788
- nsSeparator: '___',
2789
- fallbackLng: 'en',
2790
- backend: i18nBackendOptions(atomicInterface),
2791
- interpolation: {
2792
- escape: (str) => purify.DOMPurify.sanitize(str),
2793
- },
2794
- compatibilityJSON: 'v4',
2795
- });
2796
- }
2797
-
2798
- const mismatchedInterfaceAndEnginePropError = (interfaceKind, configurationName) => `A ${configurationName} is configured on the ${interfaceKind} interface element, but the ${interfaceKind} interface was initialized with an engine. You should only configure the ${configurationName} in the target engine.`;
2799
- class CommonAtomicInterfaceHelper {
2800
- constructor(atomicInterface, globalVariableName) {
2801
- this.atomicInterface = atomicInterface;
2802
- this.hangingComponentsInitialization = [];
2803
- setCoveoGlobal(headless.VERSION, globalVariableName);
2804
- const { connectedCallback: originalConnectedCallback, render: originalRender, } = atomicInterface;
2805
- atomicInterface.connectedCallback = () => {
2806
- this.i18nPromise = init18n(atomicInterface);
2807
- return (originalConnectedCallback &&
2808
- originalConnectedCallback.call(atomicInterface));
2809
- };
2810
- atomicInterface.render = () => {
2811
- if (atomicInterface.error) {
2812
- return (index.h("atomic-component-error", { element: atomicInterface.host, error: atomicInterface.error }));
2813
- }
2814
- return originalRender && originalRender.call(atomicInterface);
2815
- };
2816
- }
2817
- onComponentInitializing(event) {
2818
- event.preventDefault();
2819
- event.stopPropagation();
2820
- if (this.atomicInterface.engine) {
2821
- event.detail(this.atomicInterface.bindings);
2822
- return;
2823
- }
2824
- this.hangingComponentsInitialization.push(event);
2825
- }
2826
- async onInitialization(initEngine) {
2827
- if (this.atomicInterface.engine) {
2828
- this.atomicInterface.engine.logger.warn(`The ${this.interfaceTagname} component "initialize" has already been called.`, this.atomicInterface.host);
2829
- return;
2830
- }
2831
- this.atomicInterface.updateIconAssetsPath();
2832
- initEngine();
2833
- if (this.atomicInterface.registerFieldsToInclude) {
2834
- this.atomicInterface.registerFieldsToInclude();
2835
- }
2836
- loadDayjsLocale(this.language);
2837
- await this.i18nPromise;
2838
- this.initComponents();
2839
- }
2840
- onAnalyticsChange() {
2841
- const { engine, analytics } = this.atomicInterface;
2842
- if (!this.engineIsCreated(engine)) {
2843
- return;
2844
- }
2845
- if (!analytics) {
2846
- engine.disableAnalytics();
2847
- return;
2848
- }
2849
- engine.enableAnalytics();
2850
- }
2851
- onLanguageChange() {
2852
- const { i18n, language } = this.atomicInterface;
2853
- loadDayjsLocale(this.language);
2854
- const { resolve, promise } = Promise.withResolvers();
2855
- new Backend(i18n.services, i18nBackendOptions(this.atomicInterface)).read(this.language, i18nTranslationNamespace, async (_, data) => {
2856
- i18n.addResourceBundle(this.language, i18nTranslationNamespace, data, true, false);
2857
- await i18n.changeLanguage(language);
2858
- resolve();
2859
- });
2860
- return promise;
2861
- }
2862
- engineIsCreated(engine) {
2863
- if (!engine) {
2864
- console.error(`You have to call "initialize" on the ${this.interfaceTagname} component before modifying the props or calling other public methods.`, this.atomicInterface.host);
2865
- return false;
2866
- }
2867
- return true;
2868
- }
2869
- get interfaceTagname() {
2870
- return this.atomicInterface.host.tagName.toLowerCase();
2871
- }
2872
- initComponents() {
2873
- this.hangingComponentsInitialization.forEach((event) => event.detail(this.atomicInterface.bindings));
2874
- }
2875
- get language() {
2876
- return this.atomicInterface.language || 'en';
2877
- }
2878
- }
2879
-
2880
- function augmentWithExternalMiddleware(event, payload, config) {
2881
- if (config.analytics?.analyticsClientMiddleware) {
2882
- return config.analytics.analyticsClientMiddleware(event, payload);
2883
- }
2884
- return payload;
2885
- }
2886
- function augmentAnalyticsWithAtomicVersion(payload) {
2887
- if (payload.customData) {
2888
- payload.customData.coveoAtomicVersion = getAtomicVersion();
2889
- }
2890
- return payload;
2891
- }
2892
- function augmentAnalyticsConfigWithDocument() {
2893
- return {
2894
- documentLocation: document.location.href,
2895
- ...(document.referrer && { originLevel3: document.referrer }),
2896
- };
2897
- }
2898
- const versionMatcher = /^(\d+\.\d+\.\d+)/;
2899
- function augmentAnalyticsConfigWithAtomicVersion() {
2900
- return {
2901
- source: {
2902
- '@coveo/atomic': versionMatcher.exec(getAtomicVersion())?.[0] || '0.0.0',
2903
- },
2904
- };
2905
- }
2906
- function getNextAnalyticsConfig(searchEngineConfig, enabled) {
2907
- const configuration = {
2908
- enabled,
2909
- documentLocation: document.location.href,
2910
- ...(document.referrer && { originLevel3: document.referrer }),
2911
- };
2912
- const analyticsConfiguration = searchEngineConfig.analytics ?? {};
2913
- Object.assign(analyticsConfiguration, augmentAnalyticsConfigWithAtomicVersion());
2914
- Object.assign(configuration, analyticsConfiguration);
2915
- return configuration;
2916
- }
2917
-
2918
- exports.CommonAtomicInterfaceHelper = CommonAtomicInterfaceHelper;
2919
- exports.augmentAnalyticsConfigWithAtomicVersion = augmentAnalyticsConfigWithAtomicVersion;
2920
- exports.augmentAnalyticsConfigWithDocument = augmentAnalyticsConfigWithDocument;
2921
- exports.augmentAnalyticsWithAtomicVersion = augmentAnalyticsWithAtomicVersion;
2922
- exports.augmentWithExternalMiddleware = augmentWithExternalMiddleware;
2923
- exports.getNextAnalyticsConfig = getNextAnalyticsConfig;
2924
- exports.instance = instance;
2925
- exports.mismatchedInterfaceAndEnginePropError = mismatchedInterfaceAndEnginePropError;
2926
-
2927
- //# sourceMappingURL=analytics-config-c215586d.js.map