@flickfyi/flkr 0.0.141 → 0.0.146

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 (494) hide show
  1. package/node_modules/@flickfyi/attestation/.turbo/turbo-build.log +7 -7
  2. package/node_modules/@flickfyi/biscuit/.turbo/turbo-build.log +7 -7
  3. package/node_modules/@flickfyi/core/.oxlintrc.json +2 -1
  4. package/node_modules/@flickfyi/core/.turbo/turbo-build.log +502 -95
  5. package/node_modules/@flickfyi/core/README.md +58 -4
  6. package/node_modules/@flickfyi/core/dist/index.cjs +1 -1
  7. package/node_modules/@flickfyi/core/dist/index.js +35 -24
  8. package/node_modules/@flickfyi/core/dist/kowalski/calculations.d.ts +17 -0
  9. package/node_modules/@flickfyi/core/dist/kowalski/calculator.d.ts +13 -0
  10. package/node_modules/@flickfyi/core/dist/kowalski/catalog.cjs +1 -0
  11. package/node_modules/@flickfyi/core/dist/kowalski/catalog.d.cts +962 -0
  12. package/node_modules/@flickfyi/core/dist/kowalski/catalog.d.ts +962 -0
  13. package/node_modules/@flickfyi/core/dist/kowalski/catalog.js +639 -0
  14. package/node_modules/@flickfyi/core/dist/kowalski/clocks.d.ts +4 -0
  15. package/node_modules/@flickfyi/core/dist/kowalski/date-time.d.ts +22 -0
  16. package/node_modules/@flickfyi/core/dist/kowalski/details.d.ts +7 -0
  17. package/node_modules/@flickfyi/core/dist/kowalski/everyday.d.ts +8 -0
  18. package/node_modules/@flickfyi/core/dist/kowalski/format.d.ts +4 -0
  19. package/node_modules/@flickfyi/core/dist/kowalski/frame.d.ts +161 -0
  20. package/node_modules/@flickfyi/core/dist/kowalski/index.cjs +21 -0
  21. package/node_modules/@flickfyi/core/dist/kowalski/index.d.cts +8 -0
  22. package/node_modules/@flickfyi/core/dist/kowalski/index.d.ts +8 -0
  23. package/node_modules/@flickfyi/core/dist/kowalski/index.js +7496 -0
  24. package/node_modules/@flickfyi/core/dist/kowalski/productivity.d.ts +5 -0
  25. package/node_modules/@flickfyi/core/dist/kowalski/recipe.d.ts +8 -0
  26. package/node_modules/@flickfyi/core/dist/kowalski/tools.d.ts +7 -0
  27. package/node_modules/@flickfyi/core/dist/kowalski/use-clock.d.ts +6 -0
  28. package/node_modules/@flickfyi/core/dist/kowalski/use-configured-feature.d.ts +19 -0
  29. package/node_modules/@flickfyi/core/dist/kowalski/use-feature-store.d.ts +15 -0
  30. package/node_modules/@flickfyi/core/dist/kowalski.css +506 -0
  31. package/node_modules/@flickfyi/core/dist/molecules/field/field.d.ts +8 -0
  32. package/node_modules/@flickfyi/core/dist/molecules/index.cjs +1 -1
  33. package/node_modules/@flickfyi/core/dist/molecules/index.d.cts +3 -0
  34. package/node_modules/@flickfyi/core/dist/molecules/index.d.ts +3 -0
  35. package/node_modules/@flickfyi/core/dist/molecules/index.js +88 -27
  36. package/node_modules/@flickfyi/core/dist/molecules/segmented/segmented.d.ts +10 -0
  37. package/node_modules/@flickfyi/core/dist/molecules/stepper/stepper.d.ts +10 -0
  38. package/node_modules/@flickfyi/core/dist/quantum/use-store.d.ts +7 -1
  39. package/node_modules/@flickfyi/core/dist/themes.css +2 -0
  40. package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.stories.tsx +15 -0
  41. package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.tsx +17 -0
  42. package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.stories.tsx +15 -0
  43. package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.tsx +23 -0
  44. package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.stories.tsx +15 -0
  45. package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.tsx +26 -0
  46. package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.stories.tsx +15 -0
  47. package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.tsx +24 -0
  48. package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.stories.tsx +15 -0
  49. package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.tsx +26 -0
  50. package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.stories.tsx +15 -0
  51. package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.tsx +22 -0
  52. package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.stories.tsx +15 -0
  53. package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.tsx +23 -0
  54. package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.stories.tsx +15 -0
  55. package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.tsx +23 -0
  56. package/node_modules/@flickfyi/core/examples/kowalski/event/event.stories.tsx +15 -0
  57. package/node_modules/@flickfyi/core/examples/kowalski/event/event.tsx +24 -0
  58. package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.stories.tsx +15 -0
  59. package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.tsx +23 -0
  60. package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.stories.tsx +15 -0
  61. package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.tsx +24 -0
  62. package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.stories.tsx +15 -0
  63. package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.tsx +23 -0
  64. package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.stories.tsx +15 -0
  65. package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.tsx +25 -0
  66. package/node_modules/@flickfyi/core/examples/kowalski/note/note.stories.tsx +15 -0
  67. package/node_modules/@flickfyi/core/examples/kowalski/note/note.tsx +22 -0
  68. package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.stories.tsx +15 -0
  69. package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.tsx +26 -0
  70. package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.stories.tsx +15 -0
  71. package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.tsx +23 -0
  72. package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.stories.tsx +15 -0
  73. package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.tsx +19 -0
  74. package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.stories.tsx +15 -0
  75. package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.tsx +120 -0
  76. package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.stories.tsx +15 -0
  77. package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.tsx +23 -0
  78. package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.stories.tsx +15 -0
  79. package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.tsx +27 -0
  80. package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.stories.tsx +15 -0
  81. package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.tsx +26 -0
  82. package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.stories.tsx +15 -0
  83. package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.tsx +27 -0
  84. package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.stories.tsx +15 -0
  85. package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.tsx +27 -0
  86. package/node_modules/@flickfyi/core/examples/kowalski/theme.ts +3 -0
  87. package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.stories.tsx +15 -0
  88. package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.tsx +22 -0
  89. package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.stories.tsx +15 -0
  90. package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.tsx +23 -0
  91. package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.stories.tsx +15 -0
  92. package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.tsx +26 -0
  93. package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.stories.tsx +15 -0
  94. package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.tsx +24 -0
  95. package/node_modules/@flickfyi/core/examples/parrott/calculator/calculator.stories.tsx +3 -1
  96. package/node_modules/@flickfyi/core/examples/parrott/checklist/checklist.stories.tsx +3 -1
  97. package/node_modules/@flickfyi/core/examples/parrott/countdown/countdown.stories.tsx +3 -1
  98. package/node_modules/@flickfyi/core/examples/parrott/counter/counter.stories.tsx +1 -0
  99. package/node_modules/@flickfyi/core/examples/parrott/fortune/fortune.stories.tsx +3 -1
  100. package/node_modules/@flickfyi/core/examples/parrott/grid/grid.stories.tsx +3 -1
  101. package/node_modules/@flickfyi/core/examples/parrott/kale-smoothie/kale-smoothie.stories.tsx +1 -0
  102. package/node_modules/@flickfyi/core/examples/parrott/list/list.stories.tsx +3 -1
  103. package/node_modules/@flickfyi/core/examples/parrott/log/log.stories.tsx +3 -1
  104. package/node_modules/@flickfyi/core/examples/parrott/timed-task/timed-task.stories.tsx +3 -1
  105. package/node_modules/@flickfyi/core/examples/parrott/timer/timer.stories.tsx +3 -1
  106. package/node_modules/@flickfyi/core/fixtures/native/host/project.yml +3 -0
  107. package/node_modules/@flickfyi/core/fixtures/native/src/catalog-features.tsx +88 -0
  108. package/node_modules/@flickfyi/core/package.json +35 -5
  109. package/node_modules/@flickfyi/core/package.tsgo.json +19 -1
  110. package/node_modules/@flickfyi/core/scripts/vite-globals.d.ts +2 -0
  111. package/node_modules/@flickfyi/core/src/generated-types.d.ts +1 -0
  112. package/node_modules/@flickfyi/core/src/kowalski/README.md +9 -0
  113. package/node_modules/@flickfyi/core/src/kowalski/calculations.ts +106 -0
  114. package/node_modules/@flickfyi/core/src/kowalski/calculator.ts +243 -0
  115. package/node_modules/@flickfyi/core/src/kowalski/catalog.ts +787 -0
  116. package/node_modules/@flickfyi/core/src/kowalski/clocks.tsx +464 -0
  117. package/node_modules/@flickfyi/core/src/kowalski/date-time.tsx +469 -0
  118. package/node_modules/@flickfyi/core/src/kowalski/details.tsx +1387 -0
  119. package/node_modules/@flickfyi/core/src/kowalski/everyday.tsx +652 -0
  120. package/node_modules/@flickfyi/core/src/kowalski/format.ts +48 -0
  121. package/node_modules/@flickfyi/core/src/kowalski/frame.tsx +351 -0
  122. package/node_modules/@flickfyi/core/src/kowalski/index.ts +23 -0
  123. package/node_modules/@flickfyi/core/src/kowalski/productivity.tsx +575 -0
  124. package/node_modules/@flickfyi/core/src/kowalski/recipe.tsx +555 -0
  125. package/node_modules/@flickfyi/core/src/kowalski/stories/composition.stories.tsx +47 -0
  126. package/node_modules/@flickfyi/core/src/kowalski/stories/composition.tsx +100 -0
  127. package/node_modules/@flickfyi/core/src/kowalski/tools.tsx +1213 -0
  128. package/node_modules/@flickfyi/core/src/kowalski/use-clock.ts +19 -0
  129. package/node_modules/@flickfyi/core/src/kowalski/use-configured-feature.ts +85 -0
  130. package/node_modules/@flickfyi/core/src/kowalski/use-feature-store.ts +119 -0
  131. package/node_modules/@flickfyi/core/src/molecules/field/field.tsx +34 -0
  132. package/node_modules/@flickfyi/core/src/molecules/index.ts +3 -0
  133. package/node_modules/@flickfyi/core/src/molecules/segmented/segmented.tsx +48 -0
  134. package/node_modules/@flickfyi/core/src/molecules/stepper/stepper.tsx +54 -0
  135. package/node_modules/@flickfyi/core/src/quantum/use-store.ts +41 -16
  136. package/node_modules/@flickfyi/core/tests/fly.test.ts +34 -7
  137. package/node_modules/@flickfyi/core/tests/kowalski-calculations.test.ts +60 -0
  138. package/node_modules/@flickfyi/core/tests/kowalski-calculator.test.ts +142 -0
  139. package/node_modules/@flickfyi/core/tests/kowalski-contracts.test.ts +223 -0
  140. package/node_modules/@flickfyi/core/tests/kowalski-date-time.test.tsx +462 -0
  141. package/node_modules/@flickfyi/core/tests/kowalski-features.test.tsx +2158 -0
  142. package/node_modules/@flickfyi/core/tests/kowalski-store.test.tsx +514 -0
  143. package/node_modules/@flickfyi/core/tests/preview-build.test.ts +1 -1
  144. package/node_modules/@flickfyi/core/tests/quantum-use-store.test.ts +53 -1
  145. package/node_modules/@flickfyi/core/tests/verify-tsgo-assets.test.ts +1 -1
  146. package/node_modules/@flickfyi/core/tsconfig.vite-dts.json +2 -1
  147. package/node_modules/@flickfyi/core/tsgo.bun.lock +111 -9
  148. package/node_modules/@flickfyi/core/tsgo.package.json +21 -3
  149. package/node_modules/@flickfyi/core/vite.config.ts +9 -5
  150. package/node_modules/@flickfyi/core/vitest.config.ts +1 -1
  151. package/node_modules/@flickfyi/http-message-sig/.turbo/turbo-build.log +7 -7
  152. package/node_modules/@flickfyi/identity/.turbo/turbo-build.log +8 -9
  153. package/node_modules/@flickfyi/lens/.turbo/turbo-build.log +7 -7
  154. package/node_modules/@flickfyi/photon/.turbo/turbo-build.log +10 -4
  155. package/node_modules/@flickfyi/photon/Sources/Photon/Components/Button.swift +29 -2
  156. package/node_modules/@flickfyi/photon/Sources/PhotonVersion/Resources/photon-version.json +1 -1
  157. package/node_modules/@flickfyi/photon/Tests/PhotonTests/Components/ButtonHostTests.swift +26 -0
  158. package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-features.styles.json +1 -0
  159. package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-native.styles.json +1 -1
  160. package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-scale.styles.json +1 -1
  161. package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-theme.styles.json +1 -1
  162. package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-typography.styles.json +1 -1
  163. package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/stylex-calculator.styles.json +1 -1
  164. package/node_modules/@flickfyi/photon/dist/globals.d.ts +5 -0
  165. package/node_modules/@flickfyi/photon/dist/version.cjs +1 -1
  166. package/node_modules/@flickfyi/photon/dist/version.js +1 -1
  167. package/node_modules/@flickfyi/photon/generated/react-swiftui.d.ts +1 -0
  168. package/node_modules/@flickfyi/photon/package.json +1 -1
  169. package/node_modules/@flickfyi/photon/src/globals.d.ts +5 -0
  170. package/node_modules/@flickfyi/rwsdk-extensions/.turbo/turbo-build.log +7 -7
  171. package/node_modules/@formatjs/fast-memoize/LICENSE.md +9 -0
  172. package/node_modules/@formatjs/fast-memoize/README.md +3 -0
  173. package/node_modules/@formatjs/fast-memoize/index.d.ts +35 -0
  174. package/node_modules/@formatjs/fast-memoize/index.js +69 -0
  175. package/node_modules/@formatjs/fast-memoize/index.js.map +1 -0
  176. package/node_modules/@formatjs/fast-memoize/package.json +25 -0
  177. package/node_modules/@formatjs/icu-messageformat-parser/LICENSE.md +9 -0
  178. package/node_modules/@formatjs/icu-messageformat-parser/README.md +38 -0
  179. package/node_modules/@formatjs/icu-messageformat-parser/index.d.ts +393 -0
  180. package/node_modules/@formatjs/icu-messageformat-parser/index.js +2187 -0
  181. package/node_modules/@formatjs/icu-messageformat-parser/index.js.map +1 -0
  182. package/node_modules/@formatjs/icu-messageformat-parser/manipulator.d.ts +175 -0
  183. package/node_modules/@formatjs/icu-messageformat-parser/manipulator.js +209 -0
  184. package/node_modules/@formatjs/icu-messageformat-parser/manipulator.js.map +1 -0
  185. package/node_modules/@formatjs/icu-messageformat-parser/no-parser.d.ts +183 -0
  186. package/node_modules/@formatjs/icu-messageformat-parser/no-parser.js +162 -0
  187. package/node_modules/@formatjs/icu-messageformat-parser/no-parser.js.map +1 -0
  188. package/node_modules/@formatjs/icu-messageformat-parser/package.json +21 -0
  189. package/node_modules/@formatjs/icu-messageformat-parser/printer.d.ts +154 -0
  190. package/node_modules/@formatjs/icu-messageformat-parser/printer.js +224 -0
  191. package/node_modules/@formatjs/icu-messageformat-parser/printer.js.map +1 -0
  192. package/node_modules/@formatjs/icu-skeleton-parser/LICENSE.md +9 -0
  193. package/node_modules/@formatjs/icu-skeleton-parser/README.md +1 -0
  194. package/node_modules/@formatjs/icu-skeleton-parser/index.d.ts +67 -0
  195. package/node_modules/@formatjs/icu-skeleton-parser/index.js +380 -0
  196. package/node_modules/@formatjs/icu-skeleton-parser/index.js.map +1 -0
  197. package/node_modules/@formatjs/icu-skeleton-parser/package.json +15 -0
  198. package/node_modules/@formatjs/intl/LICENSE.md +9 -0
  199. package/node_modules/@formatjs/intl/README.md +3 -0
  200. package/node_modules/@formatjs/intl/index.d.ts +499 -0
  201. package/node_modules/@formatjs/intl/index.js +595 -0
  202. package/node_modules/@formatjs/intl/index.js.map +1 -0
  203. package/node_modules/@formatjs/intl/package.json +37 -0
  204. package/node_modules/decimal.js/LICENCE.md +23 -0
  205. package/node_modules/decimal.js/README.md +246 -0
  206. package/node_modules/decimal.js/decimal.d.ts +301 -0
  207. package/node_modules/decimal.js/decimal.js +4951 -0
  208. package/node_modules/decimal.js/decimal.mjs +4914 -0
  209. package/node_modules/decimal.js/package.json +55 -0
  210. package/node_modules/format-quantity/LICENSE +21 -0
  211. package/node_modules/format-quantity/README.md +181 -0
  212. package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.d.ts +131 -0
  213. package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.js +214 -0
  214. package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.js.map +1 -0
  215. package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.d.ts +131 -0
  216. package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.js +2 -0
  217. package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.js.map +1 -0
  218. package/node_modules/format-quantity/dist/cjs/index.d.ts +1 -0
  219. package/node_modules/format-quantity/dist/cjs/index.js +6 -0
  220. package/node_modules/format-quantity/dist/format-quantity.d.mts +131 -0
  221. package/node_modules/format-quantity/dist/format-quantity.legacy-esm.d.ts +131 -0
  222. package/node_modules/format-quantity/dist/format-quantity.legacy-esm.js +268 -0
  223. package/node_modules/format-quantity/dist/format-quantity.legacy-esm.js.map +1 -0
  224. package/node_modules/format-quantity/dist/format-quantity.mjs +208 -0
  225. package/node_modules/format-quantity/dist/format-quantity.mjs.map +1 -0
  226. package/node_modules/format-quantity/dist/format-quantity.production.d.mts +131 -0
  227. package/node_modules/format-quantity/dist/format-quantity.production.mjs +2 -0
  228. package/node_modules/format-quantity/dist/format-quantity.production.mjs.map +1 -0
  229. package/node_modules/format-quantity/dist/format-quantity.umd.min.js +3 -0
  230. package/node_modules/format-quantity/dist/format-quantity.umd.min.js.map +1 -0
  231. package/node_modules/format-quantity/package.json +81 -0
  232. package/node_modules/intl-messageformat/LICENSE.md +33 -0
  233. package/node_modules/intl-messageformat/README.md +3 -0
  234. package/node_modules/intl-messageformat/index.d.ts +177 -0
  235. package/node_modules/intl-messageformat/index.js +327 -0
  236. package/node_modules/intl-messageformat/index.js.map +1 -0
  237. package/node_modules/intl-messageformat/intl-messageformat.iife.js +2819 -0
  238. package/node_modules/intl-messageformat/package.json +40 -0
  239. package/node_modules/numeric-quantity/LICENSE +21 -0
  240. package/node_modules/numeric-quantity/README.md +306 -0
  241. package/node_modules/numeric-quantity/dist/cjs/index.d.ts +1 -0
  242. package/node_modules/numeric-quantity/dist/cjs/index.js +6 -0
  243. package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.d.ts +293 -0
  244. package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.js +579 -0
  245. package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.js.map +1 -0
  246. package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.d.ts +293 -0
  247. package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.js +2 -0
  248. package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.js.map +1 -0
  249. package/node_modules/numeric-quantity/dist/numeric-quantity.d.mts +293 -0
  250. package/node_modules/numeric-quantity/dist/numeric-quantity.iife.umd.min.js +2 -0
  251. package/node_modules/numeric-quantity/dist/numeric-quantity.iife.umd.min.js.map +1 -0
  252. package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.d.ts +293 -0
  253. package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.js +622 -0
  254. package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.js.map +1 -0
  255. package/node_modules/numeric-quantity/dist/numeric-quantity.mjs +564 -0
  256. package/node_modules/numeric-quantity/dist/numeric-quantity.mjs.map +1 -0
  257. package/node_modules/numeric-quantity/dist/numeric-quantity.production.d.mts +293 -0
  258. package/node_modules/numeric-quantity/dist/numeric-quantity.production.mjs +2 -0
  259. package/node_modules/numeric-quantity/dist/numeric-quantity.production.mjs.map +1 -0
  260. package/node_modules/numeric-quantity/package.json +72 -0
  261. package/node_modules/validator/LICENSE +20 -0
  262. package/node_modules/validator/README.md +269 -0
  263. package/node_modules/validator/es/index.js +218 -0
  264. package/node_modules/validator/es/lib/alpha.js +151 -0
  265. package/node_modules/validator/es/lib/blacklist.js +5 -0
  266. package/node_modules/validator/es/lib/contains.js +15 -0
  267. package/node_modules/validator/es/lib/equals.js +5 -0
  268. package/node_modules/validator/es/lib/escape.js +5 -0
  269. package/node_modules/validator/es/lib/isAbaRouting.js +15 -0
  270. package/node_modules/validator/es/lib/isAfter.js +10 -0
  271. package/node_modules/validator/es/lib/isAlpha.js +23 -0
  272. package/node_modules/validator/es/lib/isAlphanumeric.js +23 -0
  273. package/node_modules/validator/es/lib/isAscii.js +10 -0
  274. package/node_modules/validator/es/lib/isBIC.js +16 -0
  275. package/node_modules/validator/es/lib/isBase32.js +15 -0
  276. package/node_modules/validator/es/lib/isBase58.js +8 -0
  277. package/node_modules/validator/es/lib/isBase64.js +23 -0
  278. package/node_modules/validator/es/lib/isBefore.js +10 -0
  279. package/node_modules/validator/es/lib/isBoolean.js +15 -0
  280. package/node_modules/validator/es/lib/isBtcAddress.js +7 -0
  281. package/node_modules/validator/es/lib/isByteLength.js +19 -0
  282. package/node_modules/validator/es/lib/isCreditCard.js +43 -0
  283. package/node_modules/validator/es/lib/isCurrency.js +74 -0
  284. package/node_modules/validator/es/lib/isDataURI.js +31 -0
  285. package/node_modules/validator/es/lib/isDate.js +93 -0
  286. package/node_modules/validator/es/lib/isDecimal.js +22 -0
  287. package/node_modules/validator/es/lib/isDivisibleBy.js +6 -0
  288. package/node_modules/validator/es/lib/isEAN.js +70 -0
  289. package/node_modules/validator/es/lib/isEmail.js +165 -0
  290. package/node_modules/validator/es/lib/isEmpty.js +10 -0
  291. package/node_modules/validator/es/lib/isEthereumAddress.js +6 -0
  292. package/node_modules/validator/es/lib/isFQDN.js +67 -0
  293. package/node_modules/validator/es/lib/isFloat.js +14 -0
  294. package/node_modules/validator/es/lib/isFullWidth.js +6 -0
  295. package/node_modules/validator/es/lib/isHSL.js +13 -0
  296. package/node_modules/validator/es/lib/isHalfWidth.js +6 -0
  297. package/node_modules/validator/es/lib/isHash.js +21 -0
  298. package/node_modules/validator/es/lib/isHexColor.js +13 -0
  299. package/node_modules/validator/es/lib/isHexadecimal.js +6 -0
  300. package/node_modules/validator/es/lib/isIBAN.js +171 -0
  301. package/node_modules/validator/es/lib/isIMEI.js +40 -0
  302. package/node_modules/validator/es/lib/isIP.js +58 -0
  303. package/node_modules/validator/es/lib/isIPRange.js +41 -0
  304. package/node_modules/validator/es/lib/isISBN.js +47 -0
  305. package/node_modules/validator/es/lib/isISIN.js +55 -0
  306. package/node_modules/validator/es/lib/isISO15924.js +9 -0
  307. package/node_modules/validator/es/lib/isISO31661Alpha2.js +21 -0
  308. package/node_modules/validator/es/lib/isISO31661Alpha3.js +20 -0
  309. package/node_modules/validator/es/lib/isISO31661Numeric.js +8 -0
  310. package/node_modules/validator/es/lib/isISO4217.js +9 -0
  311. package/node_modules/validator/es/lib/isISO6346.js +28 -0
  312. package/node_modules/validator/es/lib/isISO6391.js +6 -0
  313. package/node_modules/validator/es/lib/isISO8601.js +42 -0
  314. package/node_modules/validator/es/lib/isISRC.js +8 -0
  315. package/node_modules/validator/es/lib/isISSN.js +19 -0
  316. package/node_modules/validator/es/lib/isIdentityCard.js +407 -0
  317. package/node_modules/validator/es/lib/isIn.js +23 -0
  318. package/node_modules/validator/es/lib/isInt.js +19 -0
  319. package/node_modules/validator/es/lib/isJSON.js +26 -0
  320. package/node_modules/validator/es/lib/isJWT.js +15 -0
  321. package/node_modules/validator/es/lib/isLatLong.js +21 -0
  322. package/node_modules/validator/es/lib/isLength.js +27 -0
  323. package/node_modules/validator/es/lib/isLicensePlate.js +58 -0
  324. package/node_modules/validator/es/lib/isLocale.js +107 -0
  325. package/node_modules/validator/es/lib/isLowercase.js +5 -0
  326. package/node_modules/validator/es/lib/isLuhnNumber.js +25 -0
  327. package/node_modules/validator/es/lib/isMACAddress.js +36 -0
  328. package/node_modules/validator/es/lib/isMD5.js +6 -0
  329. package/node_modules/validator/es/lib/isMagnetURI.js +9 -0
  330. package/node_modules/validator/es/lib/isMailtoURI.js +75 -0
  331. package/node_modules/validator/es/lib/isMimeType.js +40 -0
  332. package/node_modules/validator/es/lib/isMobilePhone.js +212 -0
  333. package/node_modules/validator/es/lib/isMongoId.js +6 -0
  334. package/node_modules/validator/es/lib/isMultibyte.js +10 -0
  335. package/node_modules/validator/es/lib/isNumeric.js +10 -0
  336. package/node_modules/validator/es/lib/isOctal.js +6 -0
  337. package/node_modules/validator/es/lib/isPassportNumber.js +145 -0
  338. package/node_modules/validator/es/lib/isPort.js +8 -0
  339. package/node_modules/validator/es/lib/isPostalCode.js +100 -0
  340. package/node_modules/validator/es/lib/isRFC3339.js +21 -0
  341. package/node_modules/validator/es/lib/isRgbColor.js +34 -0
  342. package/node_modules/validator/es/lib/isSemVer.js +14 -0
  343. package/node_modules/validator/es/lib/isSlug.js +6 -0
  344. package/node_modules/validator/es/lib/isStrongPassword.js +90 -0
  345. package/node_modules/validator/es/lib/isSurrogatePair.js +6 -0
  346. package/node_modules/validator/es/lib/isTaxID.js +1407 -0
  347. package/node_modules/validator/es/lib/isTime.js +22 -0
  348. package/node_modules/validator/es/lib/isULID.js +5 -0
  349. package/node_modules/validator/es/lib/isURL.js +241 -0
  350. package/node_modules/validator/es/lib/isUUID.js +23 -0
  351. package/node_modules/validator/es/lib/isUppercase.js +5 -0
  352. package/node_modules/validator/es/lib/isVAT.js +264 -0
  353. package/node_modules/validator/es/lib/isVariableWidth.js +7 -0
  354. package/node_modules/validator/es/lib/isWhitelisted.js +10 -0
  355. package/node_modules/validator/es/lib/ltrim.js +7 -0
  356. package/node_modules/validator/es/lib/matches.js +8 -0
  357. package/node_modules/validator/es/lib/normalizeEmail.js +131 -0
  358. package/node_modules/validator/es/lib/rtrim.js +15 -0
  359. package/node_modules/validator/es/lib/stripLow.js +7 -0
  360. package/node_modules/validator/es/lib/toBoolean.js +8 -0
  361. package/node_modules/validator/es/lib/toDate.js +6 -0
  362. package/node_modules/validator/es/lib/toFloat.js +5 -0
  363. package/node_modules/validator/es/lib/toInt.js +5 -0
  364. package/node_modules/validator/es/lib/trim.js +5 -0
  365. package/node_modules/validator/es/lib/unescape.js +8 -0
  366. package/node_modules/validator/es/lib/util/algorithms.js +79 -0
  367. package/node_modules/validator/es/lib/util/assertString.js +4 -0
  368. package/node_modules/validator/es/lib/util/checkHost.js +12 -0
  369. package/node_modules/validator/es/lib/util/includesArray.js +6 -0
  370. package/node_modules/validator/es/lib/util/includesString.js +4 -0
  371. package/node_modules/validator/es/lib/util/merge.js +14 -0
  372. package/node_modules/validator/es/lib/util/multilineRegex.js +12 -0
  373. package/node_modules/validator/es/lib/util/nullUndefinedCheck.js +3 -0
  374. package/node_modules/validator/es/lib/util/toString.js +13 -0
  375. package/node_modules/validator/es/lib/util/typeOf.js +10 -0
  376. package/node_modules/validator/es/lib/whitelist.js +5 -0
  377. package/node_modules/validator/index.js +229 -0
  378. package/node_modules/validator/lib/alpha.js +157 -0
  379. package/node_modules/validator/lib/blacklist.js +14 -0
  380. package/node_modules/validator/lib/contains.js +24 -0
  381. package/node_modules/validator/lib/equals.js +14 -0
  382. package/node_modules/validator/lib/escape.js +14 -0
  383. package/node_modules/validator/lib/isAbaRouting.js +23 -0
  384. package/node_modules/validator/lib/isAfter.js +19 -0
  385. package/node_modules/validator/lib/isAlpha.js +31 -0
  386. package/node_modules/validator/lib/isAlphanumeric.js +31 -0
  387. package/node_modules/validator/lib/isAscii.js +18 -0
  388. package/node_modules/validator/lib/isBIC.js +24 -0
  389. package/node_modules/validator/lib/isBase32.js +24 -0
  390. package/node_modules/validator/lib/isBase58.js +16 -0
  391. package/node_modules/validator/lib/isBase64.js +32 -0
  392. package/node_modules/validator/lib/isBefore.js +19 -0
  393. package/node_modules/validator/lib/isBoolean.js +24 -0
  394. package/node_modules/validator/lib/isBtcAddress.js +16 -0
  395. package/node_modules/validator/lib/isByteLength.js +27 -0
  396. package/node_modules/validator/lib/isCreditCard.js +52 -0
  397. package/node_modules/validator/lib/isCurrency.js +83 -0
  398. package/node_modules/validator/lib/isDataURI.js +40 -0
  399. package/node_modules/validator/lib/isDate.js +102 -0
  400. package/node_modules/validator/lib/isDecimal.js +31 -0
  401. package/node_modules/validator/lib/isDivisibleBy.js +15 -0
  402. package/node_modules/validator/lib/isEAN.js +78 -0
  403. package/node_modules/validator/lib/isEmail.js +174 -0
  404. package/node_modules/validator/lib/isEmpty.js +19 -0
  405. package/node_modules/validator/lib/isEthereumAddress.js +15 -0
  406. package/node_modules/validator/lib/isFQDN.js +76 -0
  407. package/node_modules/validator/lib/isFloat.js +22 -0
  408. package/node_modules/validator/lib/isFullWidth.js +14 -0
  409. package/node_modules/validator/lib/isHSL.js +22 -0
  410. package/node_modules/validator/lib/isHalfWidth.js +14 -0
  411. package/node_modules/validator/lib/isHash.js +30 -0
  412. package/node_modules/validator/lib/isHexColor.js +22 -0
  413. package/node_modules/validator/lib/isHexadecimal.js +15 -0
  414. package/node_modules/validator/lib/isIBAN.js +178 -0
  415. package/node_modules/validator/lib/isIMEI.js +49 -0
  416. package/node_modules/validator/lib/isIP.js +67 -0
  417. package/node_modules/validator/lib/isIPRange.js +50 -0
  418. package/node_modules/validator/lib/isISBN.js +56 -0
  419. package/node_modules/validator/lib/isISIN.js +64 -0
  420. package/node_modules/validator/lib/isISO15924.js +16 -0
  421. package/node_modules/validator/lib/isISO31661Alpha2.js +28 -0
  422. package/node_modules/validator/lib/isISO31661Alpha3.js +28 -0
  423. package/node_modules/validator/lib/isISO31661Numeric.js +16 -0
  424. package/node_modules/validator/lib/isISO4217.js +16 -0
  425. package/node_modules/validator/lib/isISO6346.js +35 -0
  426. package/node_modules/validator/lib/isISO6391.js +15 -0
  427. package/node_modules/validator/lib/isISO8601.js +50 -0
  428. package/node_modules/validator/lib/isISRC.js +16 -0
  429. package/node_modules/validator/lib/isISSN.js +28 -0
  430. package/node_modules/validator/lib/isIdentityCard.js +416 -0
  431. package/node_modules/validator/lib/isIn.js +32 -0
  432. package/node_modules/validator/lib/isInt.js +28 -0
  433. package/node_modules/validator/lib/isJSON.js +35 -0
  434. package/node_modules/validator/lib/isJWT.js +24 -0
  435. package/node_modules/validator/lib/isLatLong.js +30 -0
  436. package/node_modules/validator/lib/isLength.js +35 -0
  437. package/node_modules/validator/lib/isLicensePlate.js +67 -0
  438. package/node_modules/validator/lib/isLocale.js +115 -0
  439. package/node_modules/validator/lib/isLowercase.js +14 -0
  440. package/node_modules/validator/lib/isLuhnNumber.js +34 -0
  441. package/node_modules/validator/lib/isMACAddress.js +45 -0
  442. package/node_modules/validator/lib/isMD5.js +15 -0
  443. package/node_modules/validator/lib/isMagnetURI.js +18 -0
  444. package/node_modules/validator/lib/isMailtoURI.js +84 -0
  445. package/node_modules/validator/lib/isMimeType.js +48 -0
  446. package/node_modules/validator/lib/isMobilePhone.js +219 -0
  447. package/node_modules/validator/lib/isMongoId.js +15 -0
  448. package/node_modules/validator/lib/isMultibyte.js +18 -0
  449. package/node_modules/validator/lib/isNumeric.js +19 -0
  450. package/node_modules/validator/lib/isOctal.js +15 -0
  451. package/node_modules/validator/lib/isPassportNumber.js +152 -0
  452. package/node_modules/validator/lib/isPort.js +17 -0
  453. package/node_modules/validator/lib/isPostalCode.js +107 -0
  454. package/node_modules/validator/lib/isRFC3339.js +29 -0
  455. package/node_modules/validator/lib/isRgbColor.js +42 -0
  456. package/node_modules/validator/lib/isSemVer.js +22 -0
  457. package/node_modules/validator/lib/isSlug.js +15 -0
  458. package/node_modules/validator/lib/isStrongPassword.js +99 -0
  459. package/node_modules/validator/lib/isSurrogatePair.js +15 -0
  460. package/node_modules/validator/lib/isTaxID.js +1417 -0
  461. package/node_modules/validator/lib/isTime.js +31 -0
  462. package/node_modules/validator/lib/isULID.js +14 -0
  463. package/node_modules/validator/lib/isURL.js +249 -0
  464. package/node_modules/validator/lib/isUUID.js +32 -0
  465. package/node_modules/validator/lib/isUppercase.js +14 -0
  466. package/node_modules/validator/lib/isVAT.js +274 -0
  467. package/node_modules/validator/lib/isVariableWidth.js +16 -0
  468. package/node_modules/validator/lib/isWhitelisted.js +19 -0
  469. package/node_modules/validator/lib/ltrim.js +16 -0
  470. package/node_modules/validator/lib/matches.js +17 -0
  471. package/node_modules/validator/lib/normalizeEmail.js +140 -0
  472. package/node_modules/validator/lib/rtrim.js +24 -0
  473. package/node_modules/validator/lib/stripLow.js +16 -0
  474. package/node_modules/validator/lib/toBoolean.js +17 -0
  475. package/node_modules/validator/lib/toDate.js +15 -0
  476. package/node_modules/validator/lib/toFloat.js +14 -0
  477. package/node_modules/validator/lib/toInt.js +14 -0
  478. package/node_modules/validator/lib/trim.js +14 -0
  479. package/node_modules/validator/lib/unescape.js +17 -0
  480. package/node_modules/validator/lib/util/algorithms.js +88 -0
  481. package/node_modules/validator/lib/util/assertString.js +12 -0
  482. package/node_modules/validator/lib/util/checkHost.js +20 -0
  483. package/node_modules/validator/lib/util/includesArray.js +14 -0
  484. package/node_modules/validator/lib/util/includesString.js +12 -0
  485. package/node_modules/validator/lib/util/merge.js +22 -0
  486. package/node_modules/validator/lib/util/multilineRegex.js +20 -0
  487. package/node_modules/validator/lib/util/nullUndefinedCheck.js +11 -0
  488. package/node_modules/validator/lib/util/toString.js +21 -0
  489. package/node_modules/validator/lib/util/typeOf.js +18 -0
  490. package/node_modules/validator/lib/whitelist.js +14 -0
  491. package/node_modules/validator/package.json +76 -0
  492. package/node_modules/validator/validator.js +5808 -0
  493. package/node_modules/validator/validator.min.js +23 -0
  494. package/package.json +3 -3
@@ -0,0 +1,209 @@
1
+ //#region packages/icu-messageformat-parser/types.ts
2
+ let TYPE = /* @__PURE__ */ function(TYPE) {
3
+ /**
4
+ * Raw text
5
+ */
6
+ TYPE[TYPE["literal"] = 0] = "literal";
7
+ /**
8
+ * Variable w/o any format, e.g `var` in `this is a {var}`
9
+ */
10
+ TYPE[TYPE["argument"] = 1] = "argument";
11
+ /**
12
+ * Variable w/ number format
13
+ */
14
+ TYPE[TYPE["number"] = 2] = "number";
15
+ /**
16
+ * Variable w/ date format
17
+ */
18
+ TYPE[TYPE["date"] = 3] = "date";
19
+ /**
20
+ * Variable w/ time format
21
+ */
22
+ TYPE[TYPE["time"] = 4] = "time";
23
+ /**
24
+ * Variable w/ select format
25
+ */
26
+ TYPE[TYPE["select"] = 5] = "select";
27
+ /**
28
+ * Variable w/ plural format
29
+ */
30
+ TYPE[TYPE["plural"] = 6] = "plural";
31
+ /**
32
+ * Only possible within plural argument.
33
+ * This is the `#` symbol that will be substituted with the count.
34
+ */
35
+ TYPE[TYPE["pound"] = 7] = "pound";
36
+ /**
37
+ * XML-like tag
38
+ */
39
+ TYPE[TYPE["tag"] = 8] = "tag";
40
+ return TYPE;
41
+ }({});
42
+ function isArgumentElement(el) {
43
+ return el.type === 1;
44
+ }
45
+ function isNumberElement(el) {
46
+ return el.type === 2;
47
+ }
48
+ function isDateElement(el) {
49
+ return el.type === 3;
50
+ }
51
+ function isTimeElement(el) {
52
+ return el.type === 4;
53
+ }
54
+ function isSelectElement(el) {
55
+ return el.type === 5;
56
+ }
57
+ function isPluralElement(el) {
58
+ return el.type === 6;
59
+ }
60
+ function isPoundElement(el) {
61
+ return el.type === 7;
62
+ }
63
+ function isTagElement(el) {
64
+ return el.type === 8;
65
+ }
66
+ //#endregion
67
+ //#region packages/icu-messageformat-parser/manipulator.ts
68
+ function cloneDeep(obj) {
69
+ if (Array.isArray(obj)) return obj.map(cloneDeep);
70
+ if (obj !== null && typeof obj === "object") return Object.keys(obj).reduce((cloned, k) => {
71
+ cloned[k] = cloneDeep(obj[k]);
72
+ return cloned;
73
+ }, {});
74
+ return obj;
75
+ }
76
+ /**
77
+ * Replace pound elements with number elements referencing the given variable.
78
+ * This is needed when nesting plurals - the # in the outer plural should become
79
+ * an explicit variable reference when nested inside another plural.
80
+ * GH #4202
81
+ */
82
+ function replacePoundWithArgument(ast, variableName) {
83
+ return ast.map((el) => {
84
+ if (isPoundElement(el)) return {
85
+ type: 2,
86
+ value: variableName,
87
+ style: null,
88
+ location: el.location
89
+ };
90
+ if (isPluralElement(el) || isSelectElement(el)) {
91
+ const newOptions = {};
92
+ for (const key of Object.keys(el.options)) newOptions[key] = { value: replacePoundWithArgument(el.options[key].value, variableName) };
93
+ return {
94
+ ...el,
95
+ options: newOptions
96
+ };
97
+ }
98
+ if (isTagElement(el)) return {
99
+ ...el,
100
+ children: replacePoundWithArgument(el.children, variableName)
101
+ };
102
+ return el;
103
+ });
104
+ }
105
+ function hoistPluralOrSelectElement(ast, el, positionToInject) {
106
+ const cloned = cloneDeep(el);
107
+ const { options } = cloned;
108
+ const afterElements = ast.slice(positionToInject + 1);
109
+ const hasSubsequentPluralOrSelect = afterElements.some(isPluralOrSelectElement);
110
+ cloned.options = Object.keys(options).reduce((all, k) => {
111
+ let optionValue = options[k].value;
112
+ if (hasSubsequentPluralOrSelect && isPluralElement(el)) optionValue = replacePoundWithArgument(optionValue, el.value);
113
+ all[k] = { value: hoistSelectors([
114
+ ...ast.slice(0, positionToInject),
115
+ ...optionValue,
116
+ ...afterElements
117
+ ]) };
118
+ return all;
119
+ }, {});
120
+ return cloned;
121
+ }
122
+ function isPluralOrSelectElement(el) {
123
+ return isPluralElement(el) || isSelectElement(el);
124
+ }
125
+ function findPluralOrSelectElement(ast) {
126
+ return !!ast.find((el) => {
127
+ if (isPluralOrSelectElement(el)) return true;
128
+ if (isTagElement(el)) return findPluralOrSelectElement(el.children);
129
+ return false;
130
+ });
131
+ }
132
+ /**
133
+ * Hoist all selectors to the beginning of the AST & flatten the
134
+ * resulting options. E.g:
135
+ * "I have {count, plural, one{a dog} other{many dogs}}"
136
+ * becomes "{count, plural, one{I have a dog} other{I have many dogs}}".
137
+ * If there are multiple selectors, the order of which one is hoisted 1st
138
+ * is non-deterministic.
139
+ * The goal is to provide as many full sentences as possible since fragmented
140
+ * sentences are not translator-friendly
141
+ * @param ast AST
142
+ */
143
+ function hoistSelectors(ast) {
144
+ for (let i = 0; i < ast.length; i++) {
145
+ const el = ast[i];
146
+ if (isPluralOrSelectElement(el)) return [hoistPluralOrSelectElement(ast, el, i)];
147
+ if (isTagElement(el) && findPluralOrSelectElement([el])) throw new Error("Cannot hoist plural/select within a tag element. Please put the tag element inside each plural/select option");
148
+ }
149
+ return ast;
150
+ }
151
+ /**
152
+ * Collect all variables in an AST to Record<string, TYPE>
153
+ * @param ast AST to collect variables from
154
+ * @param vars Record of variable name to variable type
155
+ */
156
+ function collectVariables(ast, vars = /* @__PURE__ */ new Map()) {
157
+ ast.forEach((el) => {
158
+ if (isArgumentElement(el) || isDateElement(el) || isTimeElement(el) || isNumberElement(el)) {
159
+ if (vars.has(el.value)) {
160
+ const existingType = vars.get(el.value);
161
+ if (existingType !== el.type && existingType !== 6 && existingType !== 5) throw new Error(`Variable ${el.value} has conflicting types`);
162
+ } else vars.set(el.value, el.type);
163
+ }
164
+ if (isPluralElement(el) || isSelectElement(el)) {
165
+ vars.set(el.value, el.type);
166
+ Object.keys(el.options).forEach((k) => {
167
+ collectVariables(el.options[k].value, vars);
168
+ });
169
+ }
170
+ if (isTagElement(el)) {
171
+ vars.set(el.value, el.type);
172
+ collectVariables(el.children, vars);
173
+ }
174
+ });
175
+ }
176
+ /**
177
+ * Check if 2 ASTs are structurally the same. This primarily means that
178
+ * they have the same variables with the same type
179
+ * @param a
180
+ * @param b
181
+ * @returns
182
+ */
183
+ function isStructurallySame(a, b) {
184
+ const aVars = /* @__PURE__ */ new Map();
185
+ const bVars = /* @__PURE__ */ new Map();
186
+ collectVariables(a, aVars);
187
+ collectVariables(b, bVars);
188
+ if (aVars.size !== bVars.size) return {
189
+ success: false,
190
+ error: /* @__PURE__ */ new Error(`Different number of variables: [${Array.from(aVars.keys()).join(", ")}] vs [${Array.from(bVars.keys()).join(", ")}]`)
191
+ };
192
+ return Array.from(aVars.entries()).reduce((result, [key, type]) => {
193
+ if (!result.success) return result;
194
+ const bType = bVars.get(key);
195
+ if (bType == null) return {
196
+ success: false,
197
+ error: /* @__PURE__ */ new Error(`Missing variable ${key} in message`)
198
+ };
199
+ if (bType !== type) return {
200
+ success: false,
201
+ error: /* @__PURE__ */ new Error(`Variable ${key} has conflicting types: ${TYPE[type]} vs ${TYPE[bType]}`)
202
+ };
203
+ return result;
204
+ }, { success: true });
205
+ }
206
+ //#endregion
207
+ export { hoistSelectors, isStructurallySame };
208
+
209
+ //# sourceMappingURL=manipulator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manipulator.js","names":[],"sources":["../types.ts","../manipulator.ts"],"sourcesContent":["import type {NumberFormatOptions} from '#packages/ecma402-abstract/types/number.js'\nimport {type NumberSkeletonToken} from '@formatjs/icu-skeleton-parser'\n\nexport interface ExtendedNumberFormatOptions extends NumberFormatOptions {\n scale?: number\n}\n\nexport enum TYPE {\n /**\n * Raw text\n */\n literal,\n /**\n * Variable w/o any format, e.g `var` in `this is a {var}`\n */\n argument,\n /**\n * Variable w/ number format\n */\n number,\n /**\n * Variable w/ date format\n */\n date,\n /**\n * Variable w/ time format\n */\n time,\n /**\n * Variable w/ select format\n */\n select,\n /**\n * Variable w/ plural format\n */\n plural,\n /**\n * Only possible within plural argument.\n * This is the `#` symbol that will be substituted with the count.\n */\n pound,\n /**\n * XML-like tag\n */\n tag,\n}\n\nexport enum SKELETON_TYPE {\n number,\n dateTime,\n}\n\nexport interface LocationDetails {\n offset: number\n line: number\n column: number\n}\nexport interface Location {\n start: LocationDetails\n end: LocationDetails\n}\n\nexport interface BaseElement<T extends TYPE> {\n type: T\n value: string\n location?: Location\n}\n\nexport type LiteralElement = BaseElement<TYPE.literal>\nexport type ArgumentElement = BaseElement<TYPE.argument>\nexport interface TagElement extends BaseElement<TYPE.tag> {\n children: MessageFormatElement[]\n}\n\nexport interface SimpleFormatElement<\n T extends TYPE,\n S extends Skeleton,\n> extends BaseElement<T> {\n style?: string | S | null\n}\n\nexport type NumberElement = SimpleFormatElement<TYPE.number, NumberSkeleton>\nexport type DateElement = SimpleFormatElement<TYPE.date, DateTimeSkeleton>\nexport type TimeElement = SimpleFormatElement<TYPE.time, DateTimeSkeleton>\n\nexport type ValidPluralRule =\n | 'zero'\n | 'one'\n | 'two'\n | 'few'\n | 'many'\n | 'other'\n | string\n\nexport interface PluralOrSelectOption {\n value: MessageFormatElement[]\n location?: Location\n}\n\nexport interface SelectElement extends BaseElement<TYPE.select> {\n options: Record<string, PluralOrSelectOption>\n}\n\nexport interface PluralElement extends BaseElement<TYPE.plural> {\n options: Record<ValidPluralRule, PluralOrSelectOption>\n offset: number\n pluralType: Intl.PluralRulesOptions['type']\n}\n\nexport interface PoundElement {\n type: TYPE.pound\n location?: Location\n}\n\nexport type MessageFormatElement =\n | ArgumentElement\n | DateElement\n | LiteralElement\n | NumberElement\n | PluralElement\n | PoundElement\n | SelectElement\n | TagElement\n | TimeElement\n\nexport interface NumberSkeleton {\n type: SKELETON_TYPE.number\n tokens: NumberSkeletonToken[]\n location?: Location\n parsedOptions: ExtendedNumberFormatOptions\n}\n\nexport interface DateTimeSkeleton {\n type: SKELETON_TYPE.dateTime\n pattern: string\n location?: Location\n parsedOptions: Intl.DateTimeFormatOptions\n}\n\nexport type Skeleton = NumberSkeleton | DateTimeSkeleton\n\n/**\n * Type Guards\n */\nexport function isLiteralElement(\n el: MessageFormatElement\n): el is LiteralElement {\n return el.type === TYPE.literal\n}\nexport function isArgumentElement(\n el: MessageFormatElement\n): el is ArgumentElement {\n return el.type === TYPE.argument\n}\nexport function isNumberElement(el: MessageFormatElement): el is NumberElement {\n return el.type === TYPE.number\n}\nexport function isDateElement(el: MessageFormatElement): el is DateElement {\n return el.type === TYPE.date\n}\nexport function isTimeElement(el: MessageFormatElement): el is TimeElement {\n return el.type === TYPE.time\n}\nexport function isSelectElement(el: MessageFormatElement): el is SelectElement {\n return el.type === TYPE.select\n}\nexport function isPluralElement(el: MessageFormatElement): el is PluralElement {\n return el.type === TYPE.plural\n}\nexport function isPoundElement(el: MessageFormatElement): el is PoundElement {\n return el.type === TYPE.pound\n}\nexport function isTagElement(el: MessageFormatElement): el is TagElement {\n return el.type === TYPE.tag\n}\nexport function isNumberSkeleton(\n el: NumberElement['style'] | Skeleton\n): el is NumberSkeleton {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number)\n}\nexport function isDateTimeSkeleton(\n el?: DateElement['style'] | TimeElement['style'] | Skeleton\n): el is DateTimeSkeleton {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime)\n}\n\nexport function createLiteralElement(value: string): LiteralElement {\n return {\n type: TYPE.literal,\n value,\n }\n}\n\nexport function createNumberElement(\n value: string,\n style?: string | null\n): NumberElement {\n return {\n type: TYPE.number,\n value,\n style,\n }\n}\n","import {\n isArgumentElement,\n isDateElement,\n isNumberElement,\n isPluralElement,\n isPoundElement,\n isSelectElement,\n isTagElement,\n isTimeElement,\n type MessageFormatElement,\n type PluralElement,\n type PluralOrSelectOption,\n type SelectElement,\n TYPE,\n} from '#packages/icu-messageformat-parser/types.js'\n\nfunction cloneDeep<T>(obj: T): T {\n if (Array.isArray(obj)) {\n // @ts-expect-error meh\n return obj.map(cloneDeep)\n }\n if (obj !== null && typeof obj === 'object') {\n // @ts-expect-error meh\n return Object.keys(obj).reduce((cloned, k) => {\n // @ts-expect-error meh\n cloned[k] = cloneDeep(obj[k])\n return cloned\n }, {})\n }\n return obj\n}\n\n/**\n * Replace pound elements with number elements referencing the given variable.\n * This is needed when nesting plurals - the # in the outer plural should become\n * an explicit variable reference when nested inside another plural.\n * GH #4202\n */\nfunction replacePoundWithArgument(\n ast: MessageFormatElement[],\n variableName: string\n): MessageFormatElement[] {\n return ast.map(el => {\n if (isPoundElement(el)) {\n // Replace # with {variableName, number}\n return {\n type: TYPE.number,\n value: variableName,\n style: null,\n location: el.location,\n }\n }\n if (isPluralElement(el) || isSelectElement(el)) {\n // Recursively process options\n const newOptions: Record<string, PluralOrSelectOption> = {}\n for (const key of Object.keys(el.options)) {\n newOptions[key] = {\n value: replacePoundWithArgument(el.options[key].value, variableName),\n }\n }\n return {...el, options: newOptions}\n }\n if (isTagElement(el)) {\n return {\n ...el,\n children: replacePoundWithArgument(el.children, variableName),\n }\n }\n return el\n })\n}\n\nfunction hoistPluralOrSelectElement(\n ast: MessageFormatElement[],\n el: PluralElement | SelectElement,\n positionToInject: number\n) {\n // pull this out of the ast and move it to the top\n const cloned = cloneDeep(el)\n const {options} = cloned\n\n // GH #4202: Check if there are other plural/select elements after this one\n const afterElements = ast.slice(positionToInject + 1)\n const hasSubsequentPluralOrSelect = afterElements.some(\n isPluralOrSelectElement\n )\n\n cloned.options = Object.keys(options).reduce(\n (all: Record<string, PluralOrSelectOption>, k) => {\n let optionValue = options[k].value\n\n // GH #4202: If there are subsequent plurals/selects and this is a plural,\n // replace # with explicit variable reference to avoid ambiguity\n if (hasSubsequentPluralOrSelect && isPluralElement(el)) {\n optionValue = replacePoundWithArgument(optionValue, el.value)\n }\n\n const newValue = hoistSelectors([\n ...ast.slice(0, positionToInject),\n ...optionValue,\n ...afterElements,\n ])\n all[k] = {\n value: newValue,\n }\n return all\n },\n {}\n )\n return cloned\n}\n\nfunction isPluralOrSelectElement(\n el: MessageFormatElement\n): el is PluralElement | SelectElement {\n return isPluralElement(el) || isSelectElement(el)\n}\n\nfunction findPluralOrSelectElement(ast: MessageFormatElement[]): boolean {\n return !!ast.find(el => {\n if (isPluralOrSelectElement(el)) {\n return true\n }\n if (isTagElement(el)) {\n return findPluralOrSelectElement(el.children)\n }\n return false\n })\n}\n\n/**\n * Hoist all selectors to the beginning of the AST & flatten the\n * resulting options. E.g:\n * \"I have {count, plural, one{a dog} other{many dogs}}\"\n * becomes \"{count, plural, one{I have a dog} other{I have many dogs}}\".\n * If there are multiple selectors, the order of which one is hoisted 1st\n * is non-deterministic.\n * The goal is to provide as many full sentences as possible since fragmented\n * sentences are not translator-friendly\n * @param ast AST\n */\nexport function hoistSelectors(\n ast: MessageFormatElement[]\n): MessageFormatElement[] {\n for (let i = 0; i < ast.length; i++) {\n const el = ast[i]\n if (isPluralOrSelectElement(el)) {\n return [hoistPluralOrSelectElement(ast, el, i)]\n }\n if (isTagElement(el) && findPluralOrSelectElement([el])) {\n throw new Error(\n 'Cannot hoist plural/select within a tag element. Please put the tag element inside each plural/select option'\n )\n }\n }\n return ast\n}\n\n/**\n * Collect all variables in an AST to Record<string, TYPE>\n * @param ast AST to collect variables from\n * @param vars Record of variable name to variable type\n */\nfunction collectVariables(\n ast: MessageFormatElement[],\n vars: Map<string, TYPE> = new Map<string, TYPE>()\n): void {\n ast.forEach(el => {\n if (\n isArgumentElement(el) ||\n isDateElement(el) ||\n isTimeElement(el) ||\n isNumberElement(el)\n ) {\n // If the variable was already registered as a plural/select, it's normal\n // for it to also appear inside as number/date/time/argument — not a conflict.\n if (vars.has(el.value)) {\n const existingType = vars.get(el.value)!\n if (\n existingType !== el.type &&\n existingType !== TYPE.plural &&\n existingType !== TYPE.select\n ) {\n throw new Error(`Variable ${el.value} has conflicting types`)\n }\n } else {\n vars.set(el.value, el.type)\n }\n }\n\n if (isPluralElement(el) || isSelectElement(el)) {\n vars.set(el.value, el.type)\n Object.keys(el.options).forEach(k => {\n collectVariables(el.options[k].value, vars)\n })\n }\n\n if (isTagElement(el)) {\n vars.set(el.value, el.type)\n collectVariables(el.children, vars)\n }\n })\n}\n\ninterface IsStructurallySameResult {\n error?: Error\n success: boolean\n}\n\n/**\n * Check if 2 ASTs are structurally the same. This primarily means that\n * they have the same variables with the same type\n * @param a\n * @param b\n * @returns\n */\nexport function isStructurallySame(\n a: MessageFormatElement[],\n b: MessageFormatElement[]\n): IsStructurallySameResult {\n const aVars = new Map<string, TYPE>()\n const bVars = new Map<string, TYPE>()\n collectVariables(a, aVars)\n collectVariables(b, bVars)\n\n if (aVars.size !== bVars.size) {\n return {\n success: false,\n error: new Error(\n `Different number of variables: [${Array.from(aVars.keys()).join(', ')}] vs [${Array.from(bVars.keys()).join(', ')}]`\n ),\n }\n }\n\n return Array.from(aVars.entries()).reduce<IsStructurallySameResult>(\n (result, [key, type]) => {\n if (!result.success) {\n return result\n }\n const bType = bVars.get(key)\n if (bType == null) {\n return {\n success: false,\n error: new Error(`Missing variable ${key} in message`),\n }\n }\n if (bType !== type) {\n return {\n success: false,\n error: new Error(\n `Variable ${key} has conflicting types: ${TYPE[type]} vs ${TYPE[bType]}`\n ),\n }\n }\n return result\n },\n {success: true}\n )\n}\n"],"mappings":"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"}
@@ -0,0 +1,183 @@
1
+ import { NumberSkeletonToken } from "@formatjs/icu-skeleton-parser";
2
+ //#region packages/ecma402-abstract/types/number.d.ts
3
+ type NumberFormatNotation = "standard" | "scientific" | "engineering" | "compact";
4
+ type RoundingPriorityType = "auto" | "morePrecision" | "lessPrecision";
5
+ type RoundingModeType = "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven";
6
+ type UseGroupingType = "min2" | "auto" | "always" | boolean;
7
+ interface NumberFormatDigitOptions {
8
+ minimumIntegerDigits?: number;
9
+ minimumSignificantDigits?: number;
10
+ maximumSignificantDigits?: number;
11
+ minimumFractionDigits?: number;
12
+ maximumFractionDigits?: number;
13
+ roundingPriority?: RoundingPriorityType;
14
+ roundingIncrement?: number;
15
+ roundingMode?: RoundingModeType;
16
+ trailingZeroDisplay?: TrailingZeroDisplay;
17
+ }
18
+ type NumberFormatOptionsLocaleMatcher = "lookup" | "best fit";
19
+ type NumberFormatOptionsStyle = "decimal" | "percent" | "currency" | "unit";
20
+ type NumberFormatOptionsCompactDisplay = "short" | "long";
21
+ type NumberFormatOptionsCurrencyDisplay = "symbol" | "code" | "name" | "narrowSymbol";
22
+ type NumberFormatOptionsCurrencySign = "standard" | "accounting";
23
+ type NumberFormatOptionsNotation = NumberFormatNotation;
24
+ type NumberFormatOptionsSignDisplay = "auto" | "always" | "never" | "exceptZero" | "negative";
25
+ type NumberFormatOptionsUnitDisplay = "long" | "short" | "narrow";
26
+ type TrailingZeroDisplay = "auto" | "stripIfInteger";
27
+ type NumberFormatOptions = Omit<Intl.NumberFormatOptions, "signDisplay" | "useGrouping"> & NumberFormatDigitOptions & {
28
+ localeMatcher?: NumberFormatOptionsLocaleMatcher;
29
+ style?: NumberFormatOptionsStyle;
30
+ compactDisplay?: NumberFormatOptionsCompactDisplay;
31
+ currencyDisplay?: NumberFormatOptionsCurrencyDisplay;
32
+ currencySign?: NumberFormatOptionsCurrencySign;
33
+ notation?: NumberFormatOptionsNotation;
34
+ signDisplay?: NumberFormatOptionsSignDisplay;
35
+ unit?: string;
36
+ unitDisplay?: NumberFormatOptionsUnitDisplay;
37
+ numberingSystem?: string;
38
+ trailingZeroDisplay?: TrailingZeroDisplay;
39
+ roundingPriority?: RoundingPriorityType;
40
+ roundingIncrement?: number;
41
+ roundingMode?: RoundingModeType;
42
+ useGrouping?: UseGroupingType;
43
+ };
44
+ //#endregion
45
+ //#region packages/icu-messageformat-parser/types.d.ts
46
+ export interface ExtendedNumberFormatOptions extends NumberFormatOptions {
47
+ scale?: number;
48
+ }
49
+ export declare enum TYPE {
50
+ /**
51
+ * Raw text
52
+ */
53
+ literal = 0,
54
+ /**
55
+ * Variable w/o any format, e.g `var` in `this is a {var}`
56
+ */
57
+ argument = 1,
58
+ /**
59
+ * Variable w/ number format
60
+ */
61
+ number = 2,
62
+ /**
63
+ * Variable w/ date format
64
+ */
65
+ date = 3,
66
+ /**
67
+ * Variable w/ time format
68
+ */
69
+ time = 4,
70
+ /**
71
+ * Variable w/ select format
72
+ */
73
+ select = 5,
74
+ /**
75
+ * Variable w/ plural format
76
+ */
77
+ plural = 6,
78
+ /**
79
+ * Only possible within plural argument.
80
+ * This is the `#` symbol that will be substituted with the count.
81
+ */
82
+ pound = 7,
83
+ /**
84
+ * XML-like tag
85
+ */
86
+ tag = 8
87
+ }
88
+ export declare enum SKELETON_TYPE {
89
+ number = 0,
90
+ dateTime = 1
91
+ }
92
+ export interface LocationDetails {
93
+ offset: number;
94
+ line: number;
95
+ column: number;
96
+ }
97
+ export interface Location {
98
+ start: LocationDetails;
99
+ end: LocationDetails;
100
+ }
101
+ export interface BaseElement<T extends TYPE> {
102
+ type: T;
103
+ value: string;
104
+ location?: Location;
105
+ }
106
+ export type LiteralElement = BaseElement<TYPE.literal>;
107
+ export type ArgumentElement = BaseElement<TYPE.argument>;
108
+ export interface TagElement extends BaseElement<TYPE.tag> {
109
+ children: MessageFormatElement[];
110
+ }
111
+ export interface SimpleFormatElement<T extends TYPE, S extends Skeleton> extends BaseElement<T> {
112
+ style?: string | S | null;
113
+ }
114
+ export type NumberElement = SimpleFormatElement<TYPE.number, NumberSkeleton>;
115
+ export type DateElement = SimpleFormatElement<TYPE.date, DateTimeSkeleton>;
116
+ export type TimeElement = SimpleFormatElement<TYPE.time, DateTimeSkeleton>;
117
+ export type ValidPluralRule = "zero" | "one" | "two" | "few" | "many" | "other" | string;
118
+ export interface PluralOrSelectOption {
119
+ value: MessageFormatElement[];
120
+ location?: Location;
121
+ }
122
+ export interface SelectElement extends BaseElement<TYPE.select> {
123
+ options: Record<string, PluralOrSelectOption>;
124
+ }
125
+ export interface PluralElement extends BaseElement<TYPE.plural> {
126
+ options: Record<ValidPluralRule, PluralOrSelectOption>;
127
+ offset: number;
128
+ pluralType: Intl.PluralRulesOptions["type"];
129
+ }
130
+ export interface PoundElement {
131
+ type: TYPE.pound;
132
+ location?: Location;
133
+ }
134
+ export type MessageFormatElement = ArgumentElement | DateElement | LiteralElement | NumberElement | PluralElement | PoundElement | SelectElement | TagElement | TimeElement;
135
+ export interface NumberSkeleton {
136
+ type: SKELETON_TYPE.number;
137
+ tokens: NumberSkeletonToken[];
138
+ location?: Location;
139
+ parsedOptions: ExtendedNumberFormatOptions;
140
+ }
141
+ export interface DateTimeSkeleton {
142
+ type: SKELETON_TYPE.dateTime;
143
+ pattern: string;
144
+ location?: Location;
145
+ parsedOptions: Intl.DateTimeFormatOptions;
146
+ }
147
+ export type Skeleton = NumberSkeleton | DateTimeSkeleton;
148
+ /**
149
+ * Type Guards
150
+ */
151
+ export declare function isLiteralElement(el: MessageFormatElement): el is LiteralElement;
152
+ export declare function isArgumentElement(el: MessageFormatElement): el is ArgumentElement;
153
+ export declare function isNumberElement(el: MessageFormatElement): el is NumberElement;
154
+ export declare function isDateElement(el: MessageFormatElement): el is DateElement;
155
+ export declare function isTimeElement(el: MessageFormatElement): el is TimeElement;
156
+ export declare function isSelectElement(el: MessageFormatElement): el is SelectElement;
157
+ export declare function isPluralElement(el: MessageFormatElement): el is PluralElement;
158
+ export declare function isPoundElement(el: MessageFormatElement): el is PoundElement;
159
+ export declare function isTagElement(el: MessageFormatElement): el is TagElement;
160
+ export declare function isNumberSkeleton(el: NumberElement["style"] | Skeleton): el is NumberSkeleton;
161
+ export declare function isDateTimeSkeleton(el?: DateElement["style"] | TimeElement["style"] | Skeleton): el is DateTimeSkeleton;
162
+ export declare function createLiteralElement(value: string): LiteralElement;
163
+ export declare function createNumberElement(value: string, style?: string | null): NumberElement;
164
+ //#endregion
165
+ //#region packages/icu-messageformat-parser/manipulator.d.ts
166
+ interface IsStructurallySameResult {
167
+ error?: Error;
168
+ success: boolean;
169
+ }
170
+ /**
171
+ * Check if 2 ASTs are structurally the same. This primarily means that
172
+ * they have the same variables with the same type
173
+ * @param a
174
+ * @param b
175
+ * @returns
176
+ */
177
+ export declare function isStructurallySame(a: MessageFormatElement[], b: MessageFormatElement[]): IsStructurallySameResult;
178
+ //#endregion
179
+ //#region packages/icu-messageformat-parser/no-parser.d.ts
180
+ export declare function parse(): void;
181
+ export declare const _Parser: undefined;
182
+ //#endregion
183
+ //# sourceMappingURL=no-parser.d.ts.map
@@ -0,0 +1,162 @@
1
+ //#region packages/icu-messageformat-parser/types.ts
2
+ let TYPE = /* @__PURE__ */ function(TYPE) {
3
+ /**
4
+ * Raw text
5
+ */
6
+ TYPE[TYPE["literal"] = 0] = "literal";
7
+ /**
8
+ * Variable w/o any format, e.g `var` in `this is a {var}`
9
+ */
10
+ TYPE[TYPE["argument"] = 1] = "argument";
11
+ /**
12
+ * Variable w/ number format
13
+ */
14
+ TYPE[TYPE["number"] = 2] = "number";
15
+ /**
16
+ * Variable w/ date format
17
+ */
18
+ TYPE[TYPE["date"] = 3] = "date";
19
+ /**
20
+ * Variable w/ time format
21
+ */
22
+ TYPE[TYPE["time"] = 4] = "time";
23
+ /**
24
+ * Variable w/ select format
25
+ */
26
+ TYPE[TYPE["select"] = 5] = "select";
27
+ /**
28
+ * Variable w/ plural format
29
+ */
30
+ TYPE[TYPE["plural"] = 6] = "plural";
31
+ /**
32
+ * Only possible within plural argument.
33
+ * This is the `#` symbol that will be substituted with the count.
34
+ */
35
+ TYPE[TYPE["pound"] = 7] = "pound";
36
+ /**
37
+ * XML-like tag
38
+ */
39
+ TYPE[TYPE["tag"] = 8] = "tag";
40
+ return TYPE;
41
+ }({});
42
+ let SKELETON_TYPE = /* @__PURE__ */ function(SKELETON_TYPE) {
43
+ SKELETON_TYPE[SKELETON_TYPE["number"] = 0] = "number";
44
+ SKELETON_TYPE[SKELETON_TYPE["dateTime"] = 1] = "dateTime";
45
+ return SKELETON_TYPE;
46
+ }({});
47
+ /**
48
+ * Type Guards
49
+ */
50
+ function isLiteralElement(el) {
51
+ return el.type === 0;
52
+ }
53
+ function isArgumentElement(el) {
54
+ return el.type === 1;
55
+ }
56
+ function isNumberElement(el) {
57
+ return el.type === 2;
58
+ }
59
+ function isDateElement(el) {
60
+ return el.type === 3;
61
+ }
62
+ function isTimeElement(el) {
63
+ return el.type === 4;
64
+ }
65
+ function isSelectElement(el) {
66
+ return el.type === 5;
67
+ }
68
+ function isPluralElement(el) {
69
+ return el.type === 6;
70
+ }
71
+ function isPoundElement(el) {
72
+ return el.type === 7;
73
+ }
74
+ function isTagElement(el) {
75
+ return el.type === 8;
76
+ }
77
+ function isNumberSkeleton(el) {
78
+ return !!(el && typeof el === "object" && el.type === 0);
79
+ }
80
+ function isDateTimeSkeleton(el) {
81
+ return !!(el && typeof el === "object" && el.type === 1);
82
+ }
83
+ function createLiteralElement(value) {
84
+ return {
85
+ type: 0,
86
+ value
87
+ };
88
+ }
89
+ function createNumberElement(value, style) {
90
+ return {
91
+ type: 2,
92
+ value,
93
+ style
94
+ };
95
+ }
96
+ //#endregion
97
+ //#region packages/icu-messageformat-parser/manipulator.ts
98
+ /**
99
+ * Collect all variables in an AST to Record<string, TYPE>
100
+ * @param ast AST to collect variables from
101
+ * @param vars Record of variable name to variable type
102
+ */
103
+ function collectVariables(ast, vars = /* @__PURE__ */ new Map()) {
104
+ ast.forEach((el) => {
105
+ if (isArgumentElement(el) || isDateElement(el) || isTimeElement(el) || isNumberElement(el)) {
106
+ if (vars.has(el.value)) {
107
+ const existingType = vars.get(el.value);
108
+ if (existingType !== el.type && existingType !== 6 && existingType !== 5) throw new Error(`Variable ${el.value} has conflicting types`);
109
+ } else vars.set(el.value, el.type);
110
+ }
111
+ if (isPluralElement(el) || isSelectElement(el)) {
112
+ vars.set(el.value, el.type);
113
+ Object.keys(el.options).forEach((k) => {
114
+ collectVariables(el.options[k].value, vars);
115
+ });
116
+ }
117
+ if (isTagElement(el)) {
118
+ vars.set(el.value, el.type);
119
+ collectVariables(el.children, vars);
120
+ }
121
+ });
122
+ }
123
+ /**
124
+ * Check if 2 ASTs are structurally the same. This primarily means that
125
+ * they have the same variables with the same type
126
+ * @param a
127
+ * @param b
128
+ * @returns
129
+ */
130
+ function isStructurallySame(a, b) {
131
+ const aVars = /* @__PURE__ */ new Map();
132
+ const bVars = /* @__PURE__ */ new Map();
133
+ collectVariables(a, aVars);
134
+ collectVariables(b, bVars);
135
+ if (aVars.size !== bVars.size) return {
136
+ success: false,
137
+ error: /* @__PURE__ */ new Error(`Different number of variables: [${Array.from(aVars.keys()).join(", ")}] vs [${Array.from(bVars.keys()).join(", ")}]`)
138
+ };
139
+ return Array.from(aVars.entries()).reduce((result, [key, type]) => {
140
+ if (!result.success) return result;
141
+ const bType = bVars.get(key);
142
+ if (bType == null) return {
143
+ success: false,
144
+ error: /* @__PURE__ */ new Error(`Missing variable ${key} in message`)
145
+ };
146
+ if (bType !== type) return {
147
+ success: false,
148
+ error: /* @__PURE__ */ new Error(`Variable ${key} has conflicting types: ${TYPE[type]} vs ${TYPE[bType]}`)
149
+ };
150
+ return result;
151
+ }, { success: true });
152
+ }
153
+ //#endregion
154
+ //#region packages/icu-messageformat-parser/no-parser.ts
155
+ function parse() {
156
+ throw new Error("You're trying to format an uncompiled message with react-intl without parser, please import from 'react-intl' instead");
157
+ }
158
+ const _Parser = void 0;
159
+ //#endregion
160
+ export { SKELETON_TYPE, TYPE, _Parser, createLiteralElement, createNumberElement, isArgumentElement, isDateElement, isDateTimeSkeleton, isLiteralElement, isNumberElement, isNumberSkeleton, isPluralElement, isPoundElement, isSelectElement, isStructurallySame, isTagElement, isTimeElement, parse };
161
+
162
+ //# sourceMappingURL=no-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-parser.js","names":[],"sources":["../types.ts","../manipulator.ts","../no-parser.ts"],"sourcesContent":["import type {NumberFormatOptions} from '#packages/ecma402-abstract/types/number.js'\nimport {type NumberSkeletonToken} from '@formatjs/icu-skeleton-parser'\n\nexport interface ExtendedNumberFormatOptions extends NumberFormatOptions {\n scale?: number\n}\n\nexport enum TYPE {\n /**\n * Raw text\n */\n literal,\n /**\n * Variable w/o any format, e.g `var` in `this is a {var}`\n */\n argument,\n /**\n * Variable w/ number format\n */\n number,\n /**\n * Variable w/ date format\n */\n date,\n /**\n * Variable w/ time format\n */\n time,\n /**\n * Variable w/ select format\n */\n select,\n /**\n * Variable w/ plural format\n */\n plural,\n /**\n * Only possible within plural argument.\n * This is the `#` symbol that will be substituted with the count.\n */\n pound,\n /**\n * XML-like tag\n */\n tag,\n}\n\nexport enum SKELETON_TYPE {\n number,\n dateTime,\n}\n\nexport interface LocationDetails {\n offset: number\n line: number\n column: number\n}\nexport interface Location {\n start: LocationDetails\n end: LocationDetails\n}\n\nexport interface BaseElement<T extends TYPE> {\n type: T\n value: string\n location?: Location\n}\n\nexport type LiteralElement = BaseElement<TYPE.literal>\nexport type ArgumentElement = BaseElement<TYPE.argument>\nexport interface TagElement extends BaseElement<TYPE.tag> {\n children: MessageFormatElement[]\n}\n\nexport interface SimpleFormatElement<\n T extends TYPE,\n S extends Skeleton,\n> extends BaseElement<T> {\n style?: string | S | null\n}\n\nexport type NumberElement = SimpleFormatElement<TYPE.number, NumberSkeleton>\nexport type DateElement = SimpleFormatElement<TYPE.date, DateTimeSkeleton>\nexport type TimeElement = SimpleFormatElement<TYPE.time, DateTimeSkeleton>\n\nexport type ValidPluralRule =\n | 'zero'\n | 'one'\n | 'two'\n | 'few'\n | 'many'\n | 'other'\n | string\n\nexport interface PluralOrSelectOption {\n value: MessageFormatElement[]\n location?: Location\n}\n\nexport interface SelectElement extends BaseElement<TYPE.select> {\n options: Record<string, PluralOrSelectOption>\n}\n\nexport interface PluralElement extends BaseElement<TYPE.plural> {\n options: Record<ValidPluralRule, PluralOrSelectOption>\n offset: number\n pluralType: Intl.PluralRulesOptions['type']\n}\n\nexport interface PoundElement {\n type: TYPE.pound\n location?: Location\n}\n\nexport type MessageFormatElement =\n | ArgumentElement\n | DateElement\n | LiteralElement\n | NumberElement\n | PluralElement\n | PoundElement\n | SelectElement\n | TagElement\n | TimeElement\n\nexport interface NumberSkeleton {\n type: SKELETON_TYPE.number\n tokens: NumberSkeletonToken[]\n location?: Location\n parsedOptions: ExtendedNumberFormatOptions\n}\n\nexport interface DateTimeSkeleton {\n type: SKELETON_TYPE.dateTime\n pattern: string\n location?: Location\n parsedOptions: Intl.DateTimeFormatOptions\n}\n\nexport type Skeleton = NumberSkeleton | DateTimeSkeleton\n\n/**\n * Type Guards\n */\nexport function isLiteralElement(\n el: MessageFormatElement\n): el is LiteralElement {\n return el.type === TYPE.literal\n}\nexport function isArgumentElement(\n el: MessageFormatElement\n): el is ArgumentElement {\n return el.type === TYPE.argument\n}\nexport function isNumberElement(el: MessageFormatElement): el is NumberElement {\n return el.type === TYPE.number\n}\nexport function isDateElement(el: MessageFormatElement): el is DateElement {\n return el.type === TYPE.date\n}\nexport function isTimeElement(el: MessageFormatElement): el is TimeElement {\n return el.type === TYPE.time\n}\nexport function isSelectElement(el: MessageFormatElement): el is SelectElement {\n return el.type === TYPE.select\n}\nexport function isPluralElement(el: MessageFormatElement): el is PluralElement {\n return el.type === TYPE.plural\n}\nexport function isPoundElement(el: MessageFormatElement): el is PoundElement {\n return el.type === TYPE.pound\n}\nexport function isTagElement(el: MessageFormatElement): el is TagElement {\n return el.type === TYPE.tag\n}\nexport function isNumberSkeleton(\n el: NumberElement['style'] | Skeleton\n): el is NumberSkeleton {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number)\n}\nexport function isDateTimeSkeleton(\n el?: DateElement['style'] | TimeElement['style'] | Skeleton\n): el is DateTimeSkeleton {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime)\n}\n\nexport function createLiteralElement(value: string): LiteralElement {\n return {\n type: TYPE.literal,\n value,\n }\n}\n\nexport function createNumberElement(\n value: string,\n style?: string | null\n): NumberElement {\n return {\n type: TYPE.number,\n value,\n style,\n }\n}\n","import {\n isArgumentElement,\n isDateElement,\n isNumberElement,\n isPluralElement,\n isPoundElement,\n isSelectElement,\n isTagElement,\n isTimeElement,\n type MessageFormatElement,\n type PluralElement,\n type PluralOrSelectOption,\n type SelectElement,\n TYPE,\n} from '#packages/icu-messageformat-parser/types.js'\n\nfunction cloneDeep<T>(obj: T): T {\n if (Array.isArray(obj)) {\n // @ts-expect-error meh\n return obj.map(cloneDeep)\n }\n if (obj !== null && typeof obj === 'object') {\n // @ts-expect-error meh\n return Object.keys(obj).reduce((cloned, k) => {\n // @ts-expect-error meh\n cloned[k] = cloneDeep(obj[k])\n return cloned\n }, {})\n }\n return obj\n}\n\n/**\n * Replace pound elements with number elements referencing the given variable.\n * This is needed when nesting plurals - the # in the outer plural should become\n * an explicit variable reference when nested inside another plural.\n * GH #4202\n */\nfunction replacePoundWithArgument(\n ast: MessageFormatElement[],\n variableName: string\n): MessageFormatElement[] {\n return ast.map(el => {\n if (isPoundElement(el)) {\n // Replace # with {variableName, number}\n return {\n type: TYPE.number,\n value: variableName,\n style: null,\n location: el.location,\n }\n }\n if (isPluralElement(el) || isSelectElement(el)) {\n // Recursively process options\n const newOptions: Record<string, PluralOrSelectOption> = {}\n for (const key of Object.keys(el.options)) {\n newOptions[key] = {\n value: replacePoundWithArgument(el.options[key].value, variableName),\n }\n }\n return {...el, options: newOptions}\n }\n if (isTagElement(el)) {\n return {\n ...el,\n children: replacePoundWithArgument(el.children, variableName),\n }\n }\n return el\n })\n}\n\nfunction hoistPluralOrSelectElement(\n ast: MessageFormatElement[],\n el: PluralElement | SelectElement,\n positionToInject: number\n) {\n // pull this out of the ast and move it to the top\n const cloned = cloneDeep(el)\n const {options} = cloned\n\n // GH #4202: Check if there are other plural/select elements after this one\n const afterElements = ast.slice(positionToInject + 1)\n const hasSubsequentPluralOrSelect = afterElements.some(\n isPluralOrSelectElement\n )\n\n cloned.options = Object.keys(options).reduce(\n (all: Record<string, PluralOrSelectOption>, k) => {\n let optionValue = options[k].value\n\n // GH #4202: If there are subsequent plurals/selects and this is a plural,\n // replace # with explicit variable reference to avoid ambiguity\n if (hasSubsequentPluralOrSelect && isPluralElement(el)) {\n optionValue = replacePoundWithArgument(optionValue, el.value)\n }\n\n const newValue = hoistSelectors([\n ...ast.slice(0, positionToInject),\n ...optionValue,\n ...afterElements,\n ])\n all[k] = {\n value: newValue,\n }\n return all\n },\n {}\n )\n return cloned\n}\n\nfunction isPluralOrSelectElement(\n el: MessageFormatElement\n): el is PluralElement | SelectElement {\n return isPluralElement(el) || isSelectElement(el)\n}\n\nfunction findPluralOrSelectElement(ast: MessageFormatElement[]): boolean {\n return !!ast.find(el => {\n if (isPluralOrSelectElement(el)) {\n return true\n }\n if (isTagElement(el)) {\n return findPluralOrSelectElement(el.children)\n }\n return false\n })\n}\n\n/**\n * Hoist all selectors to the beginning of the AST & flatten the\n * resulting options. E.g:\n * \"I have {count, plural, one{a dog} other{many dogs}}\"\n * becomes \"{count, plural, one{I have a dog} other{I have many dogs}}\".\n * If there are multiple selectors, the order of which one is hoisted 1st\n * is non-deterministic.\n * The goal is to provide as many full sentences as possible since fragmented\n * sentences are not translator-friendly\n * @param ast AST\n */\nexport function hoistSelectors(\n ast: MessageFormatElement[]\n): MessageFormatElement[] {\n for (let i = 0; i < ast.length; i++) {\n const el = ast[i]\n if (isPluralOrSelectElement(el)) {\n return [hoistPluralOrSelectElement(ast, el, i)]\n }\n if (isTagElement(el) && findPluralOrSelectElement([el])) {\n throw new Error(\n 'Cannot hoist plural/select within a tag element. Please put the tag element inside each plural/select option'\n )\n }\n }\n return ast\n}\n\n/**\n * Collect all variables in an AST to Record<string, TYPE>\n * @param ast AST to collect variables from\n * @param vars Record of variable name to variable type\n */\nfunction collectVariables(\n ast: MessageFormatElement[],\n vars: Map<string, TYPE> = new Map<string, TYPE>()\n): void {\n ast.forEach(el => {\n if (\n isArgumentElement(el) ||\n isDateElement(el) ||\n isTimeElement(el) ||\n isNumberElement(el)\n ) {\n // If the variable was already registered as a plural/select, it's normal\n // for it to also appear inside as number/date/time/argument — not a conflict.\n if (vars.has(el.value)) {\n const existingType = vars.get(el.value)!\n if (\n existingType !== el.type &&\n existingType !== TYPE.plural &&\n existingType !== TYPE.select\n ) {\n throw new Error(`Variable ${el.value} has conflicting types`)\n }\n } else {\n vars.set(el.value, el.type)\n }\n }\n\n if (isPluralElement(el) || isSelectElement(el)) {\n vars.set(el.value, el.type)\n Object.keys(el.options).forEach(k => {\n collectVariables(el.options[k].value, vars)\n })\n }\n\n if (isTagElement(el)) {\n vars.set(el.value, el.type)\n collectVariables(el.children, vars)\n }\n })\n}\n\ninterface IsStructurallySameResult {\n error?: Error\n success: boolean\n}\n\n/**\n * Check if 2 ASTs are structurally the same. This primarily means that\n * they have the same variables with the same type\n * @param a\n * @param b\n * @returns\n */\nexport function isStructurallySame(\n a: MessageFormatElement[],\n b: MessageFormatElement[]\n): IsStructurallySameResult {\n const aVars = new Map<string, TYPE>()\n const bVars = new Map<string, TYPE>()\n collectVariables(a, aVars)\n collectVariables(b, bVars)\n\n if (aVars.size !== bVars.size) {\n return {\n success: false,\n error: new Error(\n `Different number of variables: [${Array.from(aVars.keys()).join(', ')}] vs [${Array.from(bVars.keys()).join(', ')}]`\n ),\n }\n }\n\n return Array.from(aVars.entries()).reduce<IsStructurallySameResult>(\n (result, [key, type]) => {\n if (!result.success) {\n return result\n }\n const bType = bVars.get(key)\n if (bType == null) {\n return {\n success: false,\n error: new Error(`Missing variable ${key} in message`),\n }\n }\n if (bType !== type) {\n return {\n success: false,\n error: new Error(\n `Variable ${key} has conflicting types: ${TYPE[type]} vs ${TYPE[bType]}`\n ),\n }\n }\n return result\n },\n {success: true}\n )\n}\n","export function parse(): void {\n throw new Error(\n \"You're trying to format an uncompiled message with react-intl without parser, please import from 'react-intl' instead\"\n )\n}\nexport * from '#packages/icu-messageformat-parser/types.js'\nexport const _Parser = undefined\nexport {isStructurallySame} from '#packages/icu-messageformat-parser/manipulator.js'\n"],"mappings":"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"}
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@formatjs/icu-messageformat-parser",
3
+ "version": "3.5.21",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/formatjs/formatjs.git",
8
+ "directory": "packages/icu-messageformat-parser"
9
+ },
10
+ "type": "module",
11
+ "types": "index.d.ts",
12
+ "exports": {
13
+ ".": "./index.js",
14
+ "./manipulator.js": "./manipulator.js",
15
+ "./no-parser.js": "./no-parser.js",
16
+ "./printer.js": "./printer.js"
17
+ },
18
+ "dependencies": {
19
+ "@formatjs/icu-skeleton-parser": "2.1.12"
20
+ }
21
+ }