@heartlandone/vega 2.76.0 → 2.77.0

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 (357) hide show
  1. package/dist/cjs/{app-globals-12b7d808.js → app-globals-04e7024b.js} +2 -2
  2. package/dist/cjs/aria-attributes-value-mapper-f58c73f8.js +136 -0
  3. package/dist/cjs/{child-nodes-event-prevent-slimmer-84435957.js → child-nodes-event-prevent-slimmer-cc6d2919.js} +1 -1
  4. package/dist/cjs/{design-token-41baf118.js → design-token-c49717c8.js} +1 -1
  5. package/dist/cjs/{element-appender-slimmer-34e4eb56.js → element-appender-slimmer-38583ca9.js} +2 -2
  6. package/dist/cjs/index.cjs.js +4 -4
  7. package/dist/cjs/legend-input-processor-1e53e5bc.js +2126 -0
  8. package/dist/cjs/loader.cjs.js +4 -4
  9. package/dist/cjs/{responsive-format-facade-ea59bdcd.js → responsive-format-facade-acc39a40.js} +1 -1
  10. package/dist/cjs/{style-formatter-0c3ced39.js → style-formatter-028af284.js} +1 -1
  11. package/dist/cjs/{token-extension-07cac85d.js → token-extension-ffcaeae0.js} +98 -77
  12. package/dist/cjs/vega-accordion.cjs.entry.js +5 -5
  13. package/dist/cjs/vega-app-header-button.cjs.entry.js +18 -143
  14. package/dist/cjs/vega-banner.cjs.entry.js +1 -1
  15. package/dist/cjs/vega-bar-chart.cjs.entry.js +2 -2
  16. package/dist/cjs/vega-box.cjs.entry.js +4 -4
  17. package/dist/cjs/vega-breadcrumb.cjs.entry.js +2 -2
  18. package/dist/cjs/vega-button-circle.cjs.entry.js +21 -6
  19. package/dist/cjs/vega-button-group_2.cjs.entry.js +2 -2
  20. package/dist/cjs/vega-button-link.cjs.entry.js +2 -2
  21. package/dist/cjs/vega-button.cjs.entry.js +3 -3
  22. package/dist/cjs/vega-calendar_4.cjs.entry.js +2 -2
  23. package/dist/cjs/vega-card.cjs.entry.js +3 -3
  24. package/dist/cjs/vega-carousel.cjs.entry.js +2 -2
  25. package/dist/cjs/vega-checkbox_2.cjs.entry.js +2 -2
  26. package/dist/cjs/vega-chip.cjs.entry.js +4 -4
  27. package/dist/cjs/vega-code-block.cjs.entry.js +2 -2
  28. package/dist/cjs/vega-combo-box.cjs.entry.js +2 -2
  29. package/dist/cjs/vega-date-picker_2.cjs.entry.js +29 -7
  30. package/dist/cjs/vega-dialog_2.cjs.entry.js +4 -4
  31. package/dist/cjs/vega-divider.cjs.entry.js +3 -3
  32. package/dist/cjs/vega-dropdown_5.cjs.entry.js +4 -4
  33. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  34. package/dist/cjs/vega-flag-icon.cjs.entry.js +3 -3
  35. package/dist/cjs/vega-flex.cjs.entry.js +4 -4
  36. package/dist/cjs/vega-font.cjs.entry.js +3 -3
  37. package/dist/cjs/vega-form.cjs.entry.js +2 -2
  38. package/dist/cjs/vega-grid.cjs.entry.js +3 -3
  39. package/dist/cjs/vega-icon.cjs.entry.js +3 -3
  40. package/dist/cjs/vega-image-uploader.cjs.entry.js +3 -3
  41. package/dist/cjs/vega-input-credit-card.cjs.entry.js +2 -2
  42. package/dist/cjs/vega-input-numeric.cjs.entry.js +2 -2
  43. package/dist/cjs/vega-input-passcode.cjs.entry.js +2 -2
  44. package/dist/cjs/vega-input-phone-number.cjs.entry.js +4753 -5585
  45. package/dist/cjs/vega-input-range.cjs.entry.js +2 -2
  46. package/dist/cjs/vega-input-select.cjs.entry.js +3 -3
  47. package/dist/cjs/vega-left-nav_5.cjs.entry.js +3 -3
  48. package/dist/cjs/vega-line-chart.cjs.entry.js +325 -23
  49. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +2 -2
  50. package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +2 -2
  51. package/dist/cjs/vega-pagination.cjs.entry.js +3 -3
  52. package/dist/cjs/vega-pie-chart.cjs.entry.js +5 -88
  53. package/dist/cjs/vega-popover_2.cjs.entry.js +4 -4
  54. package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +2 -2
  55. package/dist/cjs/vega-radio_2.cjs.entry.js +2 -2
  56. package/dist/cjs/vega-rich-text-content.cjs.entry.js +14 -0
  57. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +2 -2
  58. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +3 -3
  59. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +2 -2
  60. package/dist/cjs/vega-sidenav_3.cjs.entry.js +2 -2
  61. package/dist/cjs/vega-signature-capture.cjs.entry.js +3 -3
  62. package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
  63. package/dist/cjs/vega-tab-group_2.cjs.entry.js +2 -2
  64. package/dist/cjs/vega-table_11.cjs.entry.js +3 -3
  65. package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
  66. package/dist/cjs/vega-time-picker_2.cjs.entry.js +4 -4
  67. package/dist/cjs/vega-tooltip_2.cjs.entry.js +3 -3
  68. package/dist/cjs/vega.cjs.js +4 -4
  69. package/dist/cjs/y-axis-input-processor-54a26515.js +832 -0
  70. package/dist/collection/components/vega-accordion/slimmers/vega-accordion-renderer.js +1 -1
  71. package/dist/collection/components/vega-accordion/vega-accordion.css +5 -0
  72. package/dist/collection/components/vega-button-circle/vega-button-circle.js +17 -3
  73. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.js +16 -2
  74. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.css +184 -207
  75. package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.js +32 -0
  76. package/dist/collection/components/vega-input-phone-number/slimmers/controllers/country-select-controller.js +1 -1
  77. package/dist/collection/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.js +1 -1
  78. package/dist/collection/components/vega-input-phone-number/slimmers/renderers/country-select-renderer.js +1 -1
  79. package/dist/collection/components/vega-input-phone-number/slimmers/renderers/phone-number-input-renderer.js +1 -1
  80. package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.js +4 -4
  81. package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +15 -0
  82. package/dist/collection/components/vega-rich-text-editor/extensions/base-extension-renderer.js +11 -0
  83. package/dist/collection/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.js +15 -1
  84. package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +2 -0
  85. package/dist/collection/components/vega-rich-text-editor/extensions/functions/function-extension.js +0 -11
  86. package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.js +23 -23
  87. package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-extension.js +0 -10
  88. package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.js +7 -17
  89. package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-toolbar-button-renderer.js +12 -16
  90. package/dist/collection/components/vega-rich-text-editor/helpers/extension-context-manager.js +31 -0
  91. package/dist/collection/components/vega-rich-text-editor/helpers/extension-context-manager.test.js +19 -0
  92. package/dist/collection/components/vega-rich-text-editor/test/extensions/extension-test-utils.js +41 -0
  93. package/dist/collection/helpers/chart/input-processors/format-time-positions-input-processor.js +2 -2
  94. package/dist/collection/helpers/chart/input-processors/pie-chart-arc-path-input-processor.js +1 -1
  95. package/dist/collection/helpers/chart/input-processors/x-axis-input-processor.js +5 -3
  96. package/dist/collection/helpers/chart/input-processors/x-axis-label-formatter-input-processor.js +2 -1
  97. package/dist/collection/helpers/chart/input-processors/y-axis-input-processor.js +7 -5
  98. package/dist/collection/helpers/chart/interacting-entry-generator/arc-path-hover-generator.js +1 -1
  99. package/dist/collection/helpers/chart/interacting-entry-generator/pie-legend-hover-generator.js +1 -1
  100. package/dist/collection/helpers/chart/renderers/canvas-renderer.js +1 -1
  101. package/dist/collection/helpers/chart/renderers/svg-renderer.js +1 -1
  102. package/dist/collection/helpers/chart/test/drawers/arc-path-drawer.test.js +1 -1
  103. package/dist/collection/helpers/chart/test/input-processors/format-time-positions-input-processor.test.js +1 -1
  104. package/dist/collection/helpers/chart/test/input-processors/sort-positions-input-processor.test.js +1 -1
  105. package/dist/collection/helpers/chart/test/input-processors/x-axis-input-processor.test.js +39 -0
  106. package/dist/collection/helpers/chart/test/input-processors/x-axis-label-formatter-input-processor.test.js +61 -14
  107. package/dist/collection/helpers/chart/test/input-processors/y-axis-input-processor.coverage.test.js +39 -0
  108. package/dist/collection/helpers/chart/test/input-processors/y-axis-input-processor.test.js +14 -0
  109. package/dist/collection/helpers/chart/test/renderers/svg-renderer.test.js +1 -1
  110. package/dist/collection/helpers/common/test/wait-for-component-did-render.test.js +67 -0
  111. package/dist/collection/helpers/slimmers/mutation-observer/aria-attributes-value-mapper.js +4 -0
  112. package/dist/collection/helpers/slimmers/mutation-observer/test/aria-attributes-value-mapper.test.js +1 -1
  113. package/dist/collection/helpers/validator/rules/valid-phone-number-rule.js +1 -1
  114. package/dist/collection/helpers/validator/test/rules/valid-phone-number-rule.test.js +10 -0
  115. package/dist/collection/polyfill/d3/d3-array-polyfill.js +89 -0
  116. package/dist/collection/polyfill/d3/d3-axis-polyfill.js +195 -0
  117. package/dist/collection/polyfill/d3/d3-scale-polyfill.js +582 -0
  118. package/dist/collection/polyfill/d3/d3-selection-polyfill.js +274 -0
  119. package/dist/collection/polyfill/d3/d3-shape-polyfill.js +252 -0
  120. package/dist/collection/polyfill/d3/d3-time-format-polyfill.js +207 -0
  121. package/dist/collection/polyfill/d3/d3-time-polyfill.js +99 -0
  122. package/dist/collection/polyfill/d3/index.js +31 -0
  123. package/dist/collection/polyfill/d3/test/d3-array-polyfill.test.js +72 -0
  124. package/dist/collection/polyfill/d3/test/d3-axis-polyfill.test.js +171 -0
  125. package/dist/collection/polyfill/d3/test/d3-integration.test.js +137 -0
  126. package/dist/collection/polyfill/d3/test/d3-scale-polyfill.test.js +382 -0
  127. package/dist/collection/polyfill/d3/test/d3-selection-polyfill.test.js +239 -0
  128. package/dist/collection/polyfill/d3/test/d3-shape-polyfill.test.js +225 -0
  129. package/dist/collection/polyfill/d3/test/d3-time-format-polyfill.test.js +162 -0
  130. package/dist/collection/polyfill/d3/test/d3-time-polyfill.test.js +76 -0
  131. package/dist/collection/polyfill/d3/test/index.test.js +78 -0
  132. package/dist/collection/polyfill/libphonenumber/as-you-type.js +405 -0
  133. package/dist/collection/polyfill/libphonenumber/format-helpers.js +186 -0
  134. package/dist/collection/polyfill/libphonenumber/index.js +22 -0
  135. package/dist/collection/polyfill/libphonenumber/metadata.js +150 -0
  136. package/dist/collection/polyfill/libphonenumber/metadata.json.js +3900 -0
  137. package/dist/collection/polyfill/libphonenumber/parse-phone-number.js +127 -0
  138. package/dist/collection/polyfill/libphonenumber/phone-number.js +38 -0
  139. package/dist/collection/polyfill/libphonenumber/test/as-you-type.test.js +309 -0
  140. package/dist/collection/polyfill/libphonenumber/test/format-helpers.test.js +192 -0
  141. package/dist/collection/polyfill/libphonenumber/test/index.test.js +16 -0
  142. package/dist/collection/polyfill/libphonenumber/test/metadata.test.js +196 -0
  143. package/dist/collection/polyfill/libphonenumber/test/parse-phone-number.test.js +218 -0
  144. package/dist/collection/polyfill/libphonenumber/test/phone-number.test.js +56 -0
  145. package/dist/collection/polyfill/libphonenumber/types.js +23 -0
  146. package/dist/esm/{app-globals-c0676920.js → app-globals-32055795.js} +2 -2
  147. package/dist/esm/aria-attributes-value-mapper-d4fef46a.js +134 -0
  148. package/dist/esm/{child-nodes-event-prevent-slimmer-649b9d30.js → child-nodes-event-prevent-slimmer-331312b8.js} +1 -1
  149. package/dist/esm/{design-token-4aee1c56.js → design-token-5bc034e1.js} +1 -1
  150. package/dist/esm/{element-appender-slimmer-e4713a72.js → element-appender-slimmer-9ea377d0.js} +2 -2
  151. package/dist/esm/index.js +4 -4
  152. package/dist/esm/legend-input-processor-122008c5.js +2116 -0
  153. package/dist/esm/loader.js +4 -4
  154. package/dist/esm/{responsive-format-facade-7a071174.js → responsive-format-facade-aa705823.js} +1 -1
  155. package/dist/esm/{style-formatter-3d06b72d.js → style-formatter-28138f5c.js} +1 -1
  156. package/dist/esm/{token-extension-e33fd151.js → token-extension-73e4460a.js} +98 -77
  157. package/dist/esm/vega-accordion.entry.js +5 -5
  158. package/dist/esm/vega-app-header-button.entry.js +17 -142
  159. package/dist/esm/vega-banner.entry.js +1 -1
  160. package/dist/esm/vega-bar-chart.entry.js +2 -2
  161. package/dist/esm/vega-box.entry.js +4 -4
  162. package/dist/esm/vega-breadcrumb.entry.js +2 -2
  163. package/dist/esm/vega-button-circle.entry.js +21 -6
  164. package/dist/esm/vega-button-group_2.entry.js +2 -2
  165. package/dist/esm/vega-button-link.entry.js +2 -2
  166. package/dist/esm/vega-button.entry.js +3 -3
  167. package/dist/esm/vega-calendar_4.entry.js +2 -2
  168. package/dist/esm/vega-card.entry.js +3 -3
  169. package/dist/esm/vega-carousel.entry.js +2 -2
  170. package/dist/esm/vega-checkbox_2.entry.js +2 -2
  171. package/dist/esm/vega-chip.entry.js +4 -4
  172. package/dist/esm/vega-code-block.entry.js +2 -2
  173. package/dist/esm/vega-combo-box.entry.js +2 -2
  174. package/dist/esm/vega-date-picker_2.entry.js +29 -7
  175. package/dist/esm/vega-dialog_2.entry.js +4 -4
  176. package/dist/esm/vega-divider.entry.js +3 -3
  177. package/dist/esm/vega-dropdown_5.entry.js +4 -4
  178. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  179. package/dist/esm/vega-flag-icon.entry.js +3 -3
  180. package/dist/esm/vega-flex.entry.js +4 -4
  181. package/dist/esm/vega-font.entry.js +3 -3
  182. package/dist/esm/vega-form.entry.js +2 -2
  183. package/dist/esm/vega-grid.entry.js +3 -3
  184. package/dist/esm/vega-icon.entry.js +3 -3
  185. package/dist/esm/vega-image-uploader.entry.js +3 -3
  186. package/dist/esm/vega-input-credit-card.entry.js +2 -2
  187. package/dist/esm/vega-input-numeric.entry.js +2 -2
  188. package/dist/esm/vega-input-passcode.entry.js +2 -2
  189. package/dist/esm/vega-input-phone-number.entry.js +4753 -5585
  190. package/dist/esm/vega-input-range.entry.js +2 -2
  191. package/dist/esm/vega-input-select.entry.js +3 -3
  192. package/dist/esm/vega-left-nav_5.entry.js +3 -3
  193. package/dist/esm/vega-line-chart.entry.js +311 -9
  194. package/dist/esm/vega-loader-wrapper_2.entry.js +2 -2
  195. package/dist/esm/vega-pagination-page-selector-mobile.entry.js +2 -2
  196. package/dist/esm/vega-pagination.entry.js +3 -3
  197. package/dist/esm/vega-pie-chart.entry.js +5 -88
  198. package/dist/esm/vega-popover_2.entry.js +4 -4
  199. package/dist/esm/vega-progress-tracker_2.entry.js +2 -2
  200. package/dist/esm/vega-radio_2.entry.js +2 -2
  201. package/dist/esm/vega-rich-text-content.entry.js +14 -0
  202. package/dist/esm/vega-rich-text-editor_4.entry.js +2 -2
  203. package/dist/esm/vega-selection-chip_2.entry.js +3 -3
  204. package/dist/esm/vega-selection-tile_2.entry.js +2 -2
  205. package/dist/esm/vega-sidenav_3.entry.js +2 -2
  206. package/dist/esm/vega-signature-capture.entry.js +3 -3
  207. package/dist/esm/vega-stepper.entry.js +2 -2
  208. package/dist/esm/vega-tab-group_2.entry.js +2 -2
  209. package/dist/esm/vega-table_11.entry.js +3 -3
  210. package/dist/esm/vega-textarea.entry.js +2 -2
  211. package/dist/esm/vega-time-picker_2.entry.js +4 -4
  212. package/dist/esm/vega-tooltip_2.entry.js +3 -3
  213. package/dist/esm/vega.js +4 -4
  214. package/dist/esm/y-axis-input-processor-c7e05353.js +826 -0
  215. package/dist/sri/vega-sri-manifest.json +234 -230
  216. package/dist/types/components/vega-button-circle/vega-button-circle.d.ts +2 -0
  217. package/dist/types/components/vega-date-picker/types.d.ts +14 -0
  218. package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.d.ts +3 -0
  219. package/dist/types/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.d.ts +9 -1
  220. package/dist/types/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +6 -0
  221. package/dist/types/components/vega-rich-text-editor/extensions/base-extension-renderer.d.ts +9 -1
  222. package/dist/types/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.d.ts +9 -1
  223. package/dist/types/components/vega-rich-text-editor/extensions/functions/function-extension.d.ts +0 -7
  224. package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.d.ts +5 -10
  225. package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-extension.d.ts +1 -5
  226. package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.d.ts +3 -8
  227. package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-toolbar-button-renderer.d.ts +5 -9
  228. package/dist/types/components/vega-rich-text-editor/helpers/extension-context-manager.d.ts +26 -0
  229. package/dist/types/components/vega-rich-text-editor/helpers/extension-context-manager.test.d.ts +1 -0
  230. package/dist/types/components/vega-rich-text-editor/interface.d.ts +4 -0
  231. package/dist/types/components/vega-rich-text-editor/test/extensions/extension-test-utils.d.ts +21 -0
  232. package/dist/types/components.d.ts +11 -1
  233. package/dist/types/helpers/chart/test/input-processors/y-axis-input-processor.coverage.test.d.ts +1 -0
  234. package/dist/types/helpers/common/test/wait-for-component-did-render.test.d.ts +1 -0
  235. package/dist/types/polyfill/d3/d3-array-polyfill.d.ts +48 -0
  236. package/dist/types/polyfill/d3/d3-axis-polyfill.d.ts +53 -0
  237. package/dist/types/polyfill/d3/d3-scale-polyfill.d.ts +42 -0
  238. package/dist/types/polyfill/d3/d3-selection-polyfill.d.ts +173 -0
  239. package/dist/types/polyfill/d3/d3-shape-polyfill.d.ts +129 -0
  240. package/dist/types/polyfill/d3/d3-time-format-polyfill.d.ts +28 -0
  241. package/dist/types/polyfill/d3/d3-time-polyfill.d.ts +68 -0
  242. package/dist/types/polyfill/d3/index.d.ts +27 -0
  243. package/dist/types/polyfill/d3/test/d3-array-polyfill.test.d.ts +1 -0
  244. package/dist/types/polyfill/d3/test/d3-axis-polyfill.test.d.ts +1 -0
  245. package/dist/types/polyfill/d3/test/d3-integration.test.d.ts +1 -0
  246. package/dist/types/polyfill/d3/test/d3-scale-polyfill.test.d.ts +1 -0
  247. package/dist/types/polyfill/d3/test/d3-selection-polyfill.test.d.ts +1 -0
  248. package/dist/types/polyfill/d3/test/d3-shape-polyfill.test.d.ts +1 -0
  249. package/dist/types/polyfill/d3/test/d3-time-format-polyfill.test.d.ts +1 -0
  250. package/dist/types/polyfill/d3/test/d3-time-polyfill.test.d.ts +1 -0
  251. package/dist/types/polyfill/d3/test/index.test.d.ts +1 -0
  252. package/dist/types/polyfill/libphonenumber/as-you-type.d.ts +154 -0
  253. package/dist/types/polyfill/libphonenumber/format-helpers.d.ts +64 -0
  254. package/dist/types/polyfill/libphonenumber/index.d.ts +22 -0
  255. package/dist/types/polyfill/libphonenumber/metadata.d.ts +45 -0
  256. package/dist/types/polyfill/libphonenumber/metadata.json.d.ts +470 -0
  257. package/dist/types/polyfill/libphonenumber/parse-phone-number.d.ts +26 -0
  258. package/dist/types/polyfill/libphonenumber/phone-number.d.ts +24 -0
  259. package/dist/types/polyfill/libphonenumber/test/as-you-type.test.d.ts +1 -0
  260. package/dist/types/polyfill/libphonenumber/test/format-helpers.test.d.ts +1 -0
  261. package/dist/types/polyfill/libphonenumber/test/index.test.d.ts +1 -0
  262. package/dist/types/polyfill/libphonenumber/test/metadata.test.d.ts +1 -0
  263. package/dist/types/polyfill/libphonenumber/test/parse-phone-number.test.d.ts +1 -0
  264. package/dist/types/polyfill/libphonenumber/test/phone-number.test.d.ts +1 -0
  265. package/dist/types/polyfill/libphonenumber/types.d.ts +77 -0
  266. package/dist/types/types/components.type.d.ts +1 -0
  267. package/dist/types/types/flag.type.d.ts +255 -4
  268. package/dist/types/types/vega-chart.d.ts +10 -11
  269. package/dist/vega/index.esm.js +1 -1
  270. package/dist/vega/{p-d8fadcdc.entry.js → p-0037068c.entry.js} +1 -1
  271. package/dist/vega/{p-3d8122ab.entry.js → p-010ff53d.entry.js} +1 -1
  272. package/dist/vega/{p-bb5e0192.entry.js → p-03004a05.entry.js} +1 -1
  273. package/dist/vega/{p-f05b8f76.entry.js → p-0572c393.entry.js} +1 -1
  274. package/dist/vega/{p-02a7d60c.entry.js → p-0a3a285b.entry.js} +1 -1
  275. package/dist/vega/p-0d4cb1c7.entry.js +1 -0
  276. package/dist/vega/{p-a7a8a4eb.entry.js → p-100b44c3.entry.js} +1 -1
  277. package/dist/vega/{p-8dbdd609.entry.js → p-168bb296.entry.js} +1 -1
  278. package/dist/vega/{p-b136ebba.entry.js → p-1a011d47.entry.js} +1 -1
  279. package/dist/vega/{p-10734a00.js → p-1a51bf6f.js} +1 -1
  280. package/dist/vega/{p-6dcdb580.entry.js → p-1deedff2.entry.js} +1 -1
  281. package/dist/vega/{p-3244c605.entry.js → p-1fa0c7da.entry.js} +1 -1
  282. package/dist/vega/{p-dd3a94f4.entry.js → p-22056609.entry.js} +1 -1
  283. package/dist/vega/{p-c29068fb.entry.js → p-2b142818.entry.js} +1 -1
  284. package/dist/vega/{p-2ba78982.entry.js → p-34bcf4ed.entry.js} +1 -1
  285. package/dist/vega/{p-94a77fbe.entry.js → p-36a09524.entry.js} +1 -1
  286. package/dist/vega/{p-154f9cf7.entry.js → p-3c05abd9.entry.js} +1 -1
  287. package/dist/vega/{p-fd7ddd64.entry.js → p-3ce2b05c.entry.js} +1 -1
  288. package/dist/vega/{p-28ad1864.entry.js → p-43ff48c0.entry.js} +1 -1
  289. package/dist/vega/{p-ca5898dc.entry.js → p-4742feef.entry.js} +1 -1
  290. package/dist/vega/{p-eda988d5.entry.js → p-4aa52ed2.entry.js} +1 -1
  291. package/dist/vega/{p-d555f677.entry.js → p-4aa94940.entry.js} +1 -1
  292. package/dist/vega/p-4bee4202.entry.js +1 -0
  293. package/dist/vega/{p-01d58eb8.entry.js → p-50d074ed.entry.js} +1 -1
  294. package/dist/vega/{p-033c31d8.entry.js → p-5485c387.entry.js} +1 -1
  295. package/dist/vega/{p-f14a5eae.entry.js → p-560d2f48.entry.js} +1 -1
  296. package/dist/vega/{p-bebfbe95.entry.js → p-5833f33b.entry.js} +1 -1
  297. package/dist/vega/{p-b366deff.entry.js → p-592296d7.entry.js} +1 -1
  298. package/dist/vega/{p-5831d6d3.entry.js → p-5cfce62d.entry.js} +1 -1
  299. package/dist/vega/p-5f377954.js +1 -1
  300. package/dist/vega/{p-e1431c14.entry.js → p-60f77f5f.entry.js} +1 -1
  301. package/dist/vega/p-641cdb5c.entry.js +1 -0
  302. package/dist/vega/{p-32183637.entry.js → p-67745549.entry.js} +1 -1
  303. package/dist/vega/{p-087ea379.entry.js → p-70df91fb.entry.js} +1 -1
  304. package/dist/vega/{p-76181a70.entry.js → p-7425cedc.entry.js} +1 -1
  305. package/dist/vega/{p-89f2e16d.entry.js → p-857069a5.entry.js} +1 -1
  306. package/dist/vega/p-8e34b266.js +1 -0
  307. package/dist/vega/{p-32faa460.entry.js → p-9441f2ba.entry.js} +1 -1
  308. package/dist/vega/{p-2b49686d.entry.js → p-9fb877c1.entry.js} +1 -1
  309. package/dist/vega/p-a46e977b.entry.js +1 -0
  310. package/dist/vega/p-ac82b9f9.entry.js +1 -0
  311. package/dist/vega/p-b1773281.entry.js +1 -0
  312. package/dist/vega/{p-6d60b66a.entry.js → p-b54dc37c.entry.js} +1 -1
  313. package/dist/vega/{p-179aad4f.entry.js → p-b5f18f4b.entry.js} +1 -1
  314. package/dist/vega/{p-7181861a.js → p-bff57aa4.js} +1 -1
  315. package/dist/vega/{p-d7a78c5e.entry.js → p-c165232c.entry.js} +1 -1
  316. package/dist/vega/{p-8950987b.entry.js → p-c292ade4.entry.js} +1 -1
  317. package/dist/vega/p-c2d2faa0.js +1 -0
  318. package/dist/vega/{p-fc1fa345.js → p-cc5eaa1b.js} +1 -1
  319. package/dist/vega/p-cccd7648.entry.js +1 -0
  320. package/dist/vega/{p-7958614a.entry.js → p-cfecc1cb.entry.js} +1 -1
  321. package/dist/vega/{p-57927b10.entry.js → p-d07f5d5a.entry.js} +1 -1
  322. package/dist/vega/{p-9a137bab.entry.js → p-d1cfe972.entry.js} +1 -1
  323. package/dist/vega/{p-d6dbbe61.entry.js → p-d2ee5711.entry.js} +1 -1
  324. package/dist/vega/{p-b256b7a4.js → p-d78f6ede.js} +1 -1
  325. package/dist/vega/p-d8180e42.entry.js +1 -0
  326. package/dist/vega/{p-8b153acd.entry.js → p-daa60a59.entry.js} +1 -1
  327. package/dist/vega/{p-249df6d2.entry.js → p-db5fa164.entry.js} +1 -1
  328. package/dist/vega/p-de64f6e6.js +1 -0
  329. package/dist/vega/p-e4917e76.js +1 -0
  330. package/dist/vega/{p-2cc9d126.entry.js → p-e6cf2ace.entry.js} +1 -1
  331. package/dist/vega/p-e7fbef97.js +1 -0
  332. package/dist/vega/p-f3e6483c.js +1 -0
  333. package/dist/vega/{p-a560d8c5.entry.js → p-f428086c.entry.js} +1 -1
  334. package/dist/vega/{p-4e017458.entry.js → p-fc9ac6e9.entry.js} +1 -1
  335. package/dist/vega/{p-e2af0e24.entry.js → p-ffd48e37.entry.js} +1 -1
  336. package/dist/vega/vega.esm.js +1 -1
  337. package/package.json +2 -6
  338. package/dist/cjs/legend-input-processor-27c65353.js +0 -4759
  339. package/dist/cjs/y-axis-input-processor-9fbfd5e7.js +0 -2302
  340. package/dist/esm/legend-input-processor-5ecae3a7.js +0 -4742
  341. package/dist/esm/y-axis-input-processor-bc54314a.js +0 -2290
  342. package/dist/vega/p-1f5e35dc.entry.js +0 -1
  343. package/dist/vega/p-2e91295d.entry.js +0 -1
  344. package/dist/vega/p-32033e7a.js +0 -1
  345. package/dist/vega/p-46b077d9.js +0 -1
  346. package/dist/vega/p-4e4a0228.entry.js +0 -1
  347. package/dist/vega/p-644f701a.js +0 -1
  348. package/dist/vega/p-6a62e476.entry.js +0 -1
  349. package/dist/vega/p-a13a73fa.entry.js +0 -1
  350. package/dist/vega/p-be23bef2.js +0 -1
  351. package/dist/vega/p-c1d13eec.entry.js +0 -1
  352. package/dist/vega/p-e89e3ede.entry.js +0 -1
  353. package/dist/vega/p-f3d0f2dc.js +0 -1
  354. package/dist/vega/p-f5bafc45.entry.js +0 -1
  355. /package/dist/cjs/{feature-flag-controller-04cb1e69.js → feature-flag-controller-9129ef52.js} +0 -0
  356. /package/dist/esm/{feature-flag-controller-09ea7e87.js → feature-flag-controller-30f7b625.js} +0 -0
  357. /package/dist/vega/{p-07cb0243.js → p-18e8d9b7.js} +0 -0
@@ -0,0 +1,76 @@
1
+ /* eslint-disable @typescript-eslint/typedef */
2
+ /**
3
+ * D3 Time Polyfill Tests
4
+ *
5
+ * Tests for the d3-time-polyfill module: timeSecond, timeMinute, timeHour,
6
+ * timeDay, timeWeek, timeMonth, timeYear interval functions.
7
+ *
8
+ * @see VD-5022 - [Zero Dependencies] remove d3 dependency
9
+ */
10
+ import { timeSecond, timeMinute, timeHour, timeDay, timeWeek, timeMonth, timeYear, } from '../d3-time-polyfill';
11
+ // ─── Time Interval Tests ────────────────────────────────────────────
12
+ describe('D3 Time Polyfill', () => {
13
+ it('should floor to second', () => {
14
+ const date = new Date(2023, 0, 1, 12, 30, 45, 123);
15
+ const floored = timeSecond(date);
16
+ expect(floored.getMilliseconds()).toBe(0);
17
+ expect(floored.getSeconds()).toBe(45);
18
+ });
19
+ it('should floor to minute', () => {
20
+ const date = new Date(2023, 0, 1, 12, 30, 45, 123);
21
+ const floored = timeMinute(date);
22
+ expect(floored.getSeconds()).toBe(0);
23
+ expect(floored.getMilliseconds()).toBe(0);
24
+ expect(floored.getMinutes()).toBe(30);
25
+ });
26
+ it('should floor to hour', () => {
27
+ const date = new Date(2023, 0, 1, 12, 30, 45, 123);
28
+ const floored = timeHour(date);
29
+ expect(floored.getMinutes()).toBe(0);
30
+ expect(floored.getSeconds()).toBe(0);
31
+ expect(floored.getHours()).toBe(12);
32
+ });
33
+ it('should floor to day', () => {
34
+ const date = new Date(2023, 0, 1, 12, 30, 45, 123);
35
+ const floored = timeDay(date);
36
+ expect(floored.getHours()).toBe(0);
37
+ expect(floored.getMinutes()).toBe(0);
38
+ });
39
+ it('should floor to week (Sunday)', () => {
40
+ // Jan 4 2023 is a Wednesday
41
+ const date = new Date(2023, 0, 4, 12, 0, 0);
42
+ const floored = timeWeek(date);
43
+ expect(floored.getDay()).toBe(0); // Sunday
44
+ expect(floored.getDate()).toBe(1); // Jan 1 2023 is Sunday
45
+ });
46
+ it('should floor to month', () => {
47
+ const date = new Date(2023, 5, 15, 12, 30);
48
+ const floored = timeMonth(date);
49
+ expect(floored.getDate()).toBe(1);
50
+ expect(floored.getMonth()).toBe(5);
51
+ expect(floored.getHours()).toBe(0);
52
+ });
53
+ it('should floor to year', () => {
54
+ const date = new Date(2023, 5, 15, 12, 30);
55
+ const floored = timeYear(date);
56
+ expect(floored.getMonth()).toBe(0);
57
+ expect(floored.getDate()).toBe(1);
58
+ expect(floored.getFullYear()).toBe(2023);
59
+ });
60
+ it('should use time intervals for label formatter detection (Vega pattern)', () => {
61
+ // This is the exact pattern used in x-axis-label-formatter-input-processor.ts
62
+ const testDate = new Date('2023-03-02');
63
+ // Millisecond precision: timeSecond(date) < date
64
+ const msDate = new Date(testDate.valueOf() - 100);
65
+ expect(timeSecond(msDate).getTime()).toBeLessThan(msDate.getTime());
66
+ // Second precision: timeMinute(date) < date
67
+ const secDate = new Date(testDate.valueOf() + 59 * 1000);
68
+ expect(timeMinute(secDate).getTime()).toBeLessThan(secDate.getTime());
69
+ // Minute precision: timeHour(date) < date
70
+ const minDate = new Date(testDate.valueOf() + 2 * 60 * 1000);
71
+ expect(timeHour(minDate).getTime()).toBeLessThan(minDate.getTime());
72
+ // Hour precision: timeDay(date) < date
73
+ const hourDate = new Date(testDate.valueOf() + 60 * 60 * 1000);
74
+ expect(timeDay(hourDate).getTime()).toBeLessThan(hourDate.getTime());
75
+ });
76
+ });
@@ -0,0 +1,78 @@
1
+ /* eslint-disable @typescript-eslint/typedef */
2
+ /**
3
+ * D3 Barrel Export (index.ts) Tests
4
+ *
5
+ * Tests to verify all d3 polyfill modules are properly re-exported
6
+ * from the barrel export file.
7
+ *
8
+ * @see VD-5022 - [Zero Dependencies] remove d3 dependency
9
+ */
10
+ import * as d3Barrel from '../index';
11
+ // ─── Barrel Export (index.ts) Coverage ──────────────────────────────
12
+ describe('D3 Barrel Export (index.ts)', () => {
13
+ it('should re-export working selection functions', () => {
14
+ var _a;
15
+ const el = document.createElement('div');
16
+ const selection = d3Barrel.select(el);
17
+ expect(selection.node()).toBe(el);
18
+ expect(selection instanceof d3Barrel.D3SelectionPolyfill).toBe(true);
19
+ const textSelection = d3Barrel.create('svg:text');
20
+ expect((_a = textSelection.node()) === null || _a === void 0 ? void 0 : _a.tagName).toBe('text');
21
+ });
22
+ it('should re-export working shape functions', () => {
23
+ const pathData = d3Barrel
24
+ .line()
25
+ .x(d => d.x)
26
+ .y(d => d.y)([
27
+ { x: 0, y: 0 },
28
+ { x: 10, y: 20 },
29
+ ]);
30
+ expect(pathData).toBe('M0,0L10,20');
31
+ const arcPath = d3Barrel
32
+ .arc()
33
+ .innerRadius(0)
34
+ .outerRadius(50)({ startAngle: 0, endAngle: Math.PI / 2 });
35
+ expect(arcPath).toContain('A');
36
+ const arcs = d3Barrel.pie().value(d => d.value)([{ value: 50 }, { value: 50 }]);
37
+ expect(arcs.length).toBe(2);
38
+ });
39
+ it('should re-export working scale functions', () => {
40
+ expect(d3Barrel.scaleLinear().domain([0, 100]).range([0, 200])(50)).toBe(100);
41
+ const ts = d3Barrel.scaleTime();
42
+ expect(typeof ts).toBe('function');
43
+ const bandScale = d3Barrel.scaleBand(['A', 'B'], [0, 100]);
44
+ expect(bandScale('A')).toBeDefined();
45
+ });
46
+ it('should re-export working axis functions', () => {
47
+ const g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
48
+ const scale = d3Barrel.scaleLinear().domain([0, 100]).range([0, 300]);
49
+ d3Barrel.axisBottom(scale)(d3Barrel.select(g));
50
+ expect(g.querySelector('.domain')).not.toBeNull();
51
+ const g2 = document.createElementNS('http://www.w3.org/2000/svg', 'g');
52
+ d3Barrel.axisLeft(scale)(d3Barrel.select(g2));
53
+ expect(g2.querySelector('.domain')).not.toBeNull();
54
+ });
55
+ it('should re-export working array functions', () => {
56
+ expect(d3Barrel.min([3, 1, 4])).toBe(1);
57
+ expect(d3Barrel.max([3, 1, 4])).toBe(4);
58
+ expect(d3Barrel.extent([3, 1, 4])).toEqual([1, 4]);
59
+ expect(d3Barrel.map([1, 2], d => d * 2)).toEqual([2, 4]);
60
+ });
61
+ it('should re-export working time format functions', () => {
62
+ var _a;
63
+ const formatter = d3Barrel.timeFormat('%Y');
64
+ expect(formatter(new Date(2023, 0, 1))).toBe('2023');
65
+ const parse = d3Barrel.timeParse('%Y-%m-%d');
66
+ expect((_a = parse('2023-01-01')) === null || _a === void 0 ? void 0 : _a.getFullYear()).toBe(2023);
67
+ });
68
+ it('should re-export working time interval functions', () => {
69
+ const date = new Date(2023, 5, 15, 12, 30, 45, 123);
70
+ expect(d3Barrel.timeSecond(date).getMilliseconds()).toBe(0);
71
+ expect(d3Barrel.timeMinute(date).getSeconds()).toBe(0);
72
+ expect(d3Barrel.timeHour(date).getMinutes()).toBe(0);
73
+ expect(d3Barrel.timeDay(date).getHours()).toBe(0);
74
+ expect(d3Barrel.timeWeek(date).getDay()).toBe(0);
75
+ expect(d3Barrel.timeMonth(date).getDate()).toBe(1);
76
+ expect(d3Barrel.timeYear(date).getMonth()).toBe(0);
77
+ });
78
+ });
@@ -0,0 +1,405 @@
1
+ import { MIN_LEADING_DIGITS_LENGTH, DIGIT_PLACEHOLDER } from './types';
2
+ import { META, getCountryCallingCode, getFormats, detectCallingCode, getCountryByNationalNumber, } from './metadata';
3
+ import { isNonAlteringFormat, formatSuits, formatMatchesLeadingDigits, buildTemplate,
4
+ // eslint-disable-next-line spellcheck/spell-checker
5
+ cutAndStripNonPairedParens, applyInternationalSeparatorStyle, } from './format-helpers';
6
+ // ---------------------------------------------------------------------------
7
+ // formatIncompletePhoneNumber
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * Format a possibly-incomplete phone number for display.
11
+ *
12
+ * Internally uses AsYouType to produce correct progressive formatting.
13
+ *
14
+ * @param {string} number - the raw phone number string to format
15
+ * @param {VegaCountryCode} [country] - optional default country code
16
+ * @returns {string} the formatted incomplete phone number
17
+ * @example formatIncompletePhoneNumber('3023334444', 'US') // '(302) 333-4444'
18
+ * @example formatIncompletePhoneNumber('+13023334444') // '+1 302 333 4444'
19
+ */
20
+ export function formatIncompletePhoneNumber(number, country) {
21
+ if (!number)
22
+ return '';
23
+ const formatter = new AsYouType(country);
24
+ return formatter.input(number);
25
+ }
26
+ // ---------------------------------------------------------------------------
27
+ // AsYouType
28
+ // ---------------------------------------------------------------------------
29
+ /**
30
+ * Progressive phone number formatter.
31
+ *
32
+ * Internally uses template-based formatting matching libphonenumber-js.
33
+ */
34
+ export class AsYouType {
35
+ constructor(defaultCountry) {
36
+ this._allDigits = '';
37
+ this._hasPlus = false;
38
+ this._nationalNumber = '';
39
+ this._matchingFormats = [];
40
+ this._populatedPosition = -1;
41
+ /**
42
+ * Stores a complex prefix (e.g. national prefix captured groups) that was
43
+ * stripped from the national number. This prefix is re-prepended when
44
+ * producing output. Mirrors `complexPrefixBeforeNationalSignificantNumber`
45
+ * in the original library.
46
+ */
47
+ this._complexPrefix = '';
48
+ this._country = defaultCountry;
49
+ if (defaultCountry) {
50
+ this._callingCode = getCountryCallingCode(defaultCountry);
51
+ this.initFormats(defaultCountry);
52
+ }
53
+ }
54
+ /**
55
+ * The currently detected country.
56
+ *
57
+ * @returns {VegaCountryCode | undefined} the detected country code or undefined
58
+ */
59
+ get country() {
60
+ return this._country;
61
+ }
62
+ /**
63
+ * Feed characters into the formatter. Returns the formatted number so far.
64
+ *
65
+ * The original library processes one digit at a time, running narrow-down
66
+ * and format logic after each digit. This is critical because formats may
67
+ * be eliminated at intermediate digit counts, triggering national-prefix
68
+ * re-extraction that changes the output structure. We replicate that
69
+ * behavior here by looping over each digit individually.
70
+ *
71
+ * @param {string} text - the raw input characters to process
72
+ * @returns {string} the formatted phone number so far
73
+ */
74
+ input(text) {
75
+ let result = '';
76
+ for (let i = 0; i < text.length; i++) {
77
+ const char = text[i];
78
+ if (char === '+' && this._allDigits.length === 0 && !this._hasPlus) {
79
+ this._hasPlus = true;
80
+ result = '+';
81
+ continue;
82
+ }
83
+ if (char < '0' || char > '9')
84
+ continue;
85
+ this._allDigits += char;
86
+ this.updateState();
87
+ this.tryReExtractNationalPrefix();
88
+ this.narrowDownFormats();
89
+ const formattedNational = this.formatDigit(char);
90
+ if (formattedNational === undefined) {
91
+ result = this.getNonFormattedOutput();
92
+ }
93
+ else {
94
+ result = this.getFullOutput(formattedNational);
95
+ }
96
+ }
97
+ if (!result) {
98
+ if (this._hasPlus && this._allDigits.length === 0) {
99
+ return '+';
100
+ }
101
+ return this.getNonFormattedOutput();
102
+ }
103
+ return result;
104
+ }
105
+ // ------- Private methods -------
106
+ /**
107
+ * Update internal state after a new digit is added.
108
+ * Detects calling code and country for international numbers,
109
+ * or keeps the full digit string as the national number in national mode.
110
+ *
111
+ * @returns {void}
112
+ */
113
+ updateState() {
114
+ if (this._hasPlus) {
115
+ const detected = detectCallingCode(this._allDigits);
116
+ if (detected.callingCode) {
117
+ const prevCallingCode = this._callingCode;
118
+ this._callingCode = detected.callingCode;
119
+ this._nationalNumber = this._allDigits.substring(detected.callingCode.length);
120
+ if (detected.countries && detected.countries.length === 1) {
121
+ const newCountry = detected.countries[0];
122
+ if (newCountry !== this._country) {
123
+ this._country = newCountry;
124
+ this.initFormats(newCountry);
125
+ this.resetFormat();
126
+ }
127
+ }
128
+ else if (detected.countries && detected.countries.length > 1) {
129
+ const matched = getCountryByNationalNumber(detected.countries, this._nationalNumber);
130
+ this._country = matched;
131
+ if (prevCallingCode !== detected.callingCode) {
132
+ this.initFormats(detected.countries[0]);
133
+ this.resetFormat();
134
+ }
135
+ }
136
+ }
137
+ else {
138
+ this._nationalNumber = this._allDigits;
139
+ }
140
+ }
141
+ else {
142
+ // National mode — tryReExtractNationalPrefix handles prefix splitting.
143
+ this._nationalNumber = this._allDigits;
144
+ }
145
+ }
146
+ /**
147
+ * Initialize the list of candidate format rules for a given country.
148
+ * Filters out formats that alter the number or do not suit the current mode.
149
+ *
150
+ * @param {VegaCountryCode} country - the country whose formats to load
151
+ * @returns {void}
152
+ */
153
+ initFormats(country) {
154
+ const formats = getFormats(country);
155
+ if (formats) {
156
+ const international = this._hasPlus;
157
+ this._matchingFormats = formats.filter((formatRule) => isNonAlteringFormat(formatRule[1]) &&
158
+ formatSuits(formatRule, international, /* nationalPrefix */ false));
159
+ }
160
+ else {
161
+ this._matchingFormats = [];
162
+ }
163
+ }
164
+ /**
165
+ * Narrow down matching formats based on the leading digits of the national number.
166
+ * Removes formats that no longer match and resets the chosen format if it was eliminated.
167
+ *
168
+ * @returns {void}
169
+ */
170
+ narrowDownFormats() {
171
+ if (!this._nationalNumber)
172
+ return;
173
+ const leadingDigitsPatternIndex = Math.max(0, this._nationalNumber.length - MIN_LEADING_DIGITS_LENGTH);
174
+ this._matchingFormats = this._matchingFormats.filter((formatRule) => formatMatchesLeadingDigits(formatRule, this._nationalNumber, leadingDigitsPatternIndex));
175
+ if (this._chosenFormat && !this._matchingFormats.includes(this._chosenFormat)) {
176
+ this.resetFormat();
177
+ }
178
+ }
179
+ /**
180
+ * Attempt to format the national number after a new digit is added.
181
+ * Tries complete formatting first, then template-based, then chooses a new format.
182
+ *
183
+ * @param {string} newDigits - the newly added digit characters
184
+ * @returns {string | undefined} the formatted national number or undefined if no format applies
185
+ */
186
+ formatDigit(newDigits) {
187
+ if (!this._nationalNumber)
188
+ return undefined;
189
+ // 1. Try formatting as a complete number first
190
+ const completeFormatted = this.tryFormatComplete();
191
+ if (completeFormatted !== undefined) {
192
+ return completeFormatted;
193
+ }
194
+ // 2. Try using existing template
195
+ if (this._chosenFormat && this._populatedTemplate) {
196
+ const templateResult = this.formatNextDigits(newDigits);
197
+ if (templateResult !== undefined) {
198
+ return templateResult;
199
+ }
200
+ this.resetFormat();
201
+ }
202
+ // 3. Choose a new format and create a template
203
+ return this.chooseFormatAndApply();
204
+ }
205
+ /**
206
+ * Try to format the national number as a complete number using the matching format rules.
207
+ * Only attempts formatting when the number length is a possible length for the country.
208
+ *
209
+ * @returns {string | undefined} the formatted number if a complete match is found, or undefined
210
+ */
211
+ tryFormatComplete() {
212
+ const nationalDigits = this._nationalNumber;
213
+ // Only try complete formatting if the number length is a possible length
214
+ // for the country. This mirrors canFormatCompleteNumber from the original.
215
+ if (this._country) {
216
+ const entry = META.countries[this._country];
217
+ if (entry) {
218
+ const possibleLengths = entry[3];
219
+ if (possibleLengths && possibleLengths.includes(nationalDigits.length)) {
220
+ // length is valid, continue
221
+ }
222
+ else if (possibleLengths) {
223
+ return undefined;
224
+ }
225
+ }
226
+ }
227
+ for (const formatRule of this._matchingFormats) {
228
+ const [patternSrc, replacement] = [
229
+ formatRule[0],
230
+ formatRule[1],
231
+ ];
232
+ const fullPattern = new RegExp('^(?:' + patternSrc + ')$');
233
+ if (fullPattern.test(nationalDigits)) {
234
+ const formatted = nationalDigits.replace(new RegExp(patternSrc), replacement);
235
+ this.resetFormat();
236
+ this._chosenFormat = formatRule;
237
+ const template = buildTemplate(formatRule, nationalDigits.length);
238
+ if (template) {
239
+ const populatedResult = this.populateTemplateFull(template, nationalDigits);
240
+ if (populatedResult) {
241
+ this._populatedTemplate = populatedResult.filled;
242
+ this._populatedPosition = populatedResult.lastPosition;
243
+ }
244
+ }
245
+ return formatted;
246
+ }
247
+ }
248
+ return undefined;
249
+ }
250
+ /**
251
+ * Choose a new format from the remaining candidates and apply it to the national number.
252
+ * Builds a template for each candidate and returns the formatted result on first match.
253
+ *
254
+ * @returns {string | undefined} the formatted national number or undefined if no format matches
255
+ */
256
+ chooseFormatAndApply() {
257
+ for (const formatRule of this._matchingFormats) {
258
+ if (this._chosenFormat === formatRule)
259
+ break;
260
+ if (!isNonAlteringFormat(formatRule[1]))
261
+ continue;
262
+ const template = buildTemplate(formatRule, this._nationalNumber.length);
263
+ if (!template) {
264
+ this._matchingFormats = this._matchingFormats.filter((f) => f !== formatRule);
265
+ continue;
266
+ }
267
+ this._chosenFormat = formatRule;
268
+ this._populatedTemplate = template;
269
+ this._populatedPosition = -1;
270
+ return this.formatNextDigits(this._nationalNumber);
271
+ }
272
+ this.resetFormat();
273
+ return undefined;
274
+ }
275
+ /**
276
+ * Insert digits into the current populated template one at a time.
277
+ * Replaces placeholder characters with the actual digits.
278
+ *
279
+ * @param {string} digits - the digit characters to insert into the template
280
+ * @returns {string | undefined} the partially formatted string or undefined if the template is exhausted
281
+ */
282
+ formatNextDigits(digits) {
283
+ if (!this._populatedTemplate)
284
+ return undefined;
285
+ let template = this._populatedTemplate;
286
+ let position = this._populatedPosition;
287
+ for (const digit of digits) {
288
+ const searchFrom = position + 1;
289
+ const nextIndex = template.indexOf(DIGIT_PLACEHOLDER, searchFrom);
290
+ if (nextIndex === -1) {
291
+ return undefined;
292
+ }
293
+ template = template.substring(0, nextIndex) + digit + template.substring(nextIndex + 1);
294
+ position = nextIndex;
295
+ }
296
+ this._populatedTemplate = template;
297
+ this._populatedPosition = position;
298
+ // eslint-disable-next-line spellcheck/spell-checker
299
+ return cutAndStripNonPairedParens(template, position + 1);
300
+ }
301
+ /**
302
+ * Fill an entire template string with the given digits.
303
+ * Used to synchronize the template state after a complete format match.
304
+ *
305
+ * @param {string} template - the format template containing digit placeholders
306
+ * @param {string} digits - the digit characters to populate the template with
307
+ * @returns {PopulatedTemplateResult | undefined} the filled template and last position, or undefined if the template ran out of placeholders
308
+ */
309
+ populateTemplateFull(template, digits) {
310
+ let result = template;
311
+ let lastPosition = -1;
312
+ for (const digit of digits) {
313
+ const index = result.indexOf(DIGIT_PLACEHOLDER);
314
+ if (index === -1)
315
+ return undefined;
316
+ result = result.substring(0, index) + digit + result.substring(index + 1);
317
+ lastPosition = index;
318
+ }
319
+ return { filled: result, lastPosition: lastPosition };
320
+ }
321
+ /**
322
+ * Reset the chosen format, populated template, and position to their initial values.
323
+ *
324
+ * @returns {void}
325
+ */
326
+ resetFormat() {
327
+ this._chosenFormat = undefined;
328
+ this._populatedTemplate = undefined;
329
+ this._populatedPosition = -1;
330
+ }
331
+ /**
332
+ * Try to extract a national prefix from the current national number.
333
+ * Uses the country's `nationalPrefixForParsing` pattern (metadata index [7]).
334
+ *
335
+ * Called proactively on every digit input, mirroring the original library's
336
+ * `reExtractNationalSignificantNumber`. When extraction first succeeds
337
+ * (or the extracted prefix changes), formats are re-initialized so that
338
+ * only formats appropriate for the shorter national number remain.
339
+ *
340
+ * @returns {void}
341
+ */
342
+ tryReExtractNationalPrefix() {
343
+ if (!this._country || this._hasPlus)
344
+ return;
345
+ const entry = META.countries[this._country];
346
+ if (!entry)
347
+ return;
348
+ const prefixPattern = entry[7];
349
+ if (!prefixPattern || typeof prefixPattern !== 'string')
350
+ return;
351
+ const allDigits = this._allDigits;
352
+ const match = allDigits.match(new RegExp('^(?:' + prefixPattern + ')'));
353
+ if (!match || match[0].length === 0)
354
+ return;
355
+ const newPrefix = match[0];
356
+ const remaining = allDigits.substring(newPrefix.length);
357
+ // If the prefix hasn't changed, just re-apply the split and return.
358
+ if (this._complexPrefix === newPrefix) {
359
+ this._nationalNumber = remaining;
360
+ return;
361
+ }
362
+ // New or changed prefix extraction — update state and re-init formats.
363
+ this._complexPrefix = newPrefix;
364
+ this._nationalNumber = remaining;
365
+ this.resetFormat();
366
+ if (this._country) {
367
+ this.initFormats(this._country);
368
+ }
369
+ }
370
+ /**
371
+ * Build the full output string by prepending the calling code or complex prefix
372
+ * to the formatted national number.
373
+ *
374
+ * @param {string} formattedNational - the formatted national number portion
375
+ * @returns {string} the complete formatted phone number with prefix
376
+ */
377
+ getFullOutput(formattedNational) {
378
+ if (this._hasPlus && this._callingCode) {
379
+ if (formattedNational) {
380
+ const intlNational = applyInternationalSeparatorStyle(formattedNational);
381
+ return '+' + this._callingCode + ' ' + intlNational;
382
+ }
383
+ return '+' + this._callingCode;
384
+ }
385
+ if (this._complexPrefix) {
386
+ return this._complexPrefix + ' ' + formattedNational;
387
+ }
388
+ return formattedNational;
389
+ }
390
+ /**
391
+ * Produce a fallback output when no format template matches.
392
+ * Returns the raw digits with the plus sign or complex prefix if applicable.
393
+ *
394
+ * @returns {string} the non-formatted output string
395
+ */
396
+ getNonFormattedOutput() {
397
+ if (this._hasPlus) {
398
+ return '+' + this._allDigits;
399
+ }
400
+ if (this._complexPrefix && this._nationalNumber) {
401
+ return this._complexPrefix + ' ' + this._nationalNumber;
402
+ }
403
+ return this._allDigits;
404
+ }
405
+ }