@lavalogic/scoria 0.40.28 → 0.40.30

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 (638) hide show
  1. package/dist/Components/AccordionGroup.svelte +1 -1
  2. package/dist/Components/AlertModal.svelte +3 -2
  3. package/dist/Components/Base/Pagination.svelte +20 -12
  4. package/dist/Components/Base/PaginationProps.d.ts +5 -0
  5. package/dist/Components/Base/Snippets.svelte +4 -3
  6. package/dist/Components/Button.svelte +9 -8
  7. package/dist/Components/Checkbox.svelte +2 -2
  8. package/dist/Components/ChipsInput.svelte +6 -6
  9. package/dist/Components/CollapsibleCard.svelte +3 -3
  10. package/dist/Components/ConditionBuilder/ConditionBuilder.svelte +7 -6
  11. package/dist/Components/Contexts/ContextMenu.svelte +3 -2
  12. package/dist/Components/Contexts/Toast.svelte +4 -3
  13. package/dist/Components/Contexts/ToastContainer.svelte +6 -5
  14. package/dist/Components/Contexts/Tooltip.svelte +2 -2
  15. package/dist/Components/DataMatrixIcon.svelte +4 -3
  16. package/dist/Components/DateInput.svelte +25 -26
  17. package/dist/Components/DesktopModal.svelte +1 -1
  18. package/dist/Components/DimensionInput.svelte +30 -31
  19. package/dist/Components/DragMenu/DragMenuHolder.svelte +6 -6
  20. package/dist/Components/DragMenu/DraggableCard.svelte +3 -3
  21. package/dist/Components/FileCard.svelte +3 -2
  22. package/dist/Components/FileUpload.svelte +24 -25
  23. package/dist/Components/GridInput.svelte +2 -2
  24. package/dist/Components/HorizontalTabGroup.svelte +1 -1
  25. package/dist/Components/Icon.svelte +8 -2
  26. package/dist/Components/IconProps.d.ts +7 -0
  27. package/dist/Components/Icons.js +365 -365
  28. package/dist/Components/LoadingAnimation.svelte +50 -30
  29. package/dist/Components/LoadingAnimation.svelte.d.ts +1 -1
  30. package/dist/Components/LoadingModal.svelte +3 -2
  31. package/dist/Components/Modal.svelte +9 -9
  32. package/dist/Components/MultiSelect.svelte +37 -18
  33. package/dist/Components/MultiSelectCommonProps.d.ts +15 -1
  34. package/dist/Components/Nav/Nav.svelte +13 -13
  35. package/dist/Components/Nav/ServiceMenuItem.svelte +2 -0
  36. package/dist/Components/Nav/ServicesNav.svelte +6 -6
  37. package/dist/Components/NumberInput.svelte +25 -26
  38. package/dist/Components/PasswordInput.svelte +25 -24
  39. package/dist/Components/PopoverButton.svelte +8 -8
  40. package/dist/Components/QuerySelect.svelte +33 -16
  41. package/dist/Components/QuerySelectProps.d.ts +10 -1
  42. package/dist/Components/ResourceCalendar/ResourceCalendar.svelte +23 -22
  43. package/dist/Components/SidebarPanel.svelte +1 -1
  44. package/dist/Components/SingleSelect.svelte +30 -15
  45. package/dist/Components/SingleSelectCommonProps.d.ts +10 -1
  46. package/dist/Components/StepForm.svelte +6 -5
  47. package/dist/Components/Switch.svelte +5 -5
  48. package/dist/Components/Table/Body/QuickSearchCell.svelte +363 -351
  49. package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +5 -6
  50. package/dist/Components/Table/Body/Rows/ColumnList.svelte +3 -2
  51. package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +7 -6
  52. package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +6 -7
  53. package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +8 -7
  54. package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +11 -9
  55. package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +7 -8
  56. package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +5 -5
  57. package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +3 -2
  58. package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +3 -3
  59. package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +5 -4
  60. package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +9 -6
  61. package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +4 -4
  62. package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +4 -4
  63. package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +3 -3
  64. package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +9 -7
  65. package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +7 -6
  66. package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +6 -7
  67. package/dist/Components/Table/Body/Rows/TableRow.svelte +6 -5
  68. package/dist/Components/Table/Body/TableBody.svelte +2 -2
  69. package/dist/Components/Table/Headers/HighlightAllHeader.svelte +3 -2
  70. package/dist/Components/Table/Headers/SelectAllHeader.svelte +4 -3
  71. package/dist/Components/Table/Headers/TableHead.svelte +6 -5
  72. package/dist/Components/Table/Misc/ColumnPanel.svelte +5 -4
  73. package/dist/Components/Table/Misc/ColumnPanelModal.svelte +5 -4
  74. package/dist/Components/Table/Misc/FilterInput.svelte +23 -14
  75. package/dist/Components/Table/Misc/FilterPanel.svelte +12 -11
  76. package/dist/Components/Table/Misc/FilterPanelModal.svelte +3 -2
  77. package/dist/Components/Table/Misc/ShareViewModal.svelte +25 -15
  78. package/dist/Components/Table/Misc/SidePanel.svelte +2 -2
  79. package/dist/Components/Table/Misc/TableConfigurationModal.svelte +50 -40
  80. package/dist/Components/Table/Misc/TableFooter.svelte +18 -12
  81. package/dist/Components/Table/Misc/TableHorizontalBar.svelte +8 -7
  82. package/dist/Components/Table/Misc/TableSidebar.svelte +8 -7
  83. package/dist/Components/Table/Misc/TableViewDropdown.svelte +6 -2
  84. package/dist/Components/Table/Misc/ToolboxPanel.svelte +8 -7
  85. package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +9 -8
  86. package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +23 -14
  87. package/dist/Components/Table/Misc/numberDateFilterTypes.d.ts +7 -4
  88. package/dist/Components/Table/Misc/numberDateFilterTypes.js +27 -15
  89. package/dist/Components/Table/Misc/stringFilterTypes.d.ts +7 -3
  90. package/dist/Components/Table/Misc/stringFilterTypes.js +26 -16
  91. package/dist/Components/Table/NestedTable.svelte +4 -0
  92. package/dist/Components/Table/Table.svelte +19 -18
  93. package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.js +2 -1
  94. package/dist/Components/Table/Types/Columns/Definitions/RowSelection/RowSelectionDef.svelte.js +2 -1
  95. package/dist/Components/Table/Types/Context/ClipboardState.svelte.js +3 -2
  96. package/dist/Components/Table/Types/Context/ViewState.svelte.js +5 -2
  97. package/dist/Components/Table/Types/DataRepository/IDataRepository.d.ts +6 -0
  98. package/dist/Components/Table/Types/DataRepository/TableDataRepository.svelte.d.ts +8 -0
  99. package/dist/Components/Table/Types/DataRepository/TableDataRepository.svelte.js +14 -0
  100. package/dist/Components/Table/Types/Public/CreateTableOptions.d.ts +3 -0
  101. package/dist/Components/Table/createTable.svelte.js +3 -0
  102. package/dist/Components/TextArea.svelte +24 -23
  103. package/dist/Components/TextInput.svelte +25 -26
  104. package/dist/Components/ThreeStateRadio.svelte +21 -16
  105. package/dist/Components/Touch/BoolCard.svelte +2 -2
  106. package/dist/Components/Touch/DateModal.svelte +5 -4
  107. package/dist/Components/Touch/EditCard.svelte +7 -7
  108. package/dist/Components/Touch/NumberKeyboard.svelte +3 -2
  109. package/dist/Components/Touch/NumberModal.svelte +4 -3
  110. package/dist/Components/Touch/PlusMinusCard.svelte +6 -5
  111. package/dist/Components/Touch/SelectModal.svelte +5 -4
  112. package/dist/Components/Touch/SummaryCard.svelte +9 -9
  113. package/dist/Components/Touch/TextAreaModal.svelte +4 -3
  114. package/dist/Components/Touch/TextModal.svelte +4 -3
  115. package/dist/Components/Touch/TouchCard.svelte +4 -3
  116. package/dist/Components/Touch/TouchModal.svelte +9 -8
  117. package/dist/Components/VerticalTabGroup.svelte +5 -4
  118. package/dist/Contexts/AlertContext.svelte.d.ts +8 -5
  119. package/dist/Contexts/AlertContext.svelte.js +10 -9
  120. package/dist/Helpers/Helpers.svelte.d.ts +23 -2
  121. package/dist/Helpers/Helpers.svelte.js +37 -9
  122. package/dist/Strings/locale.d.ts +19 -0
  123. package/dist/Strings/locale.js +27 -0
  124. package/dist/index.d.ts +1 -0
  125. package/dist/index.js +1 -0
  126. package/dist/paraglide/.prettierignore +3 -0
  127. package/dist/paraglide/README.md +162 -0
  128. package/dist/paraglide/messages/_index.d.ts +250 -0
  129. package/dist/paraglide/messages/_index.js +251 -0
  130. package/dist/paraglide/messages/package.json +4 -0
  131. package/dist/paraglide/messages/scoria_action_add_condition.d.ts +17 -0
  132. package/dist/paraglide/messages/scoria_action_add_condition.js +50 -0
  133. package/dist/paraglide/messages/scoria_action_add_group.d.ts +17 -0
  134. package/dist/paraglide/messages/scoria_action_add_group.js +50 -0
  135. package/dist/paraglide/messages/scoria_action_add_row.d.ts +17 -0
  136. package/dist/paraglide/messages/scoria_action_add_row.js +50 -0
  137. package/dist/paraglide/messages/scoria_action_advanced_filter.d.ts +17 -0
  138. package/dist/paraglide/messages/scoria_action_advanced_filter.js +50 -0
  139. package/dist/paraglide/messages/scoria_action_apply.d.ts +17 -0
  140. package/dist/paraglide/messages/scoria_action_apply.js +50 -0
  141. package/dist/paraglide/messages/scoria_action_cancel.d.ts +17 -0
  142. package/dist/paraglide/messages/scoria_action_cancel.js +50 -0
  143. package/dist/paraglide/messages/scoria_action_close.d.ts +17 -0
  144. package/dist/paraglide/messages/scoria_action_close.js +50 -0
  145. package/dist/paraglide/messages/scoria_action_close_modal_generic.d.ts +17 -0
  146. package/dist/paraglide/messages/scoria_action_close_modal_generic.js +50 -0
  147. package/dist/paraglide/messages/scoria_action_confirm.d.ts +17 -0
  148. package/dist/paraglide/messages/scoria_action_confirm.js +50 -0
  149. package/dist/paraglide/messages/scoria_action_copy_highlighted_rows.d.ts +17 -0
  150. package/dist/paraglide/messages/scoria_action_copy_highlighted_rows.js +50 -0
  151. package/dist/paraglide/messages/scoria_action_copy_selection.d.ts +17 -0
  152. package/dist/paraglide/messages/scoria_action_copy_selection.js +50 -0
  153. package/dist/paraglide/messages/scoria_action_copy_to_clipboard.d.ts +17 -0
  154. package/dist/paraglide/messages/scoria_action_copy_to_clipboard.js +50 -0
  155. package/dist/paraglide/messages/scoria_action_decrement.d.ts +17 -0
  156. package/dist/paraglide/messages/scoria_action_decrement.js +50 -0
  157. package/dist/paraglide/messages/scoria_action_delete.d.ts +17 -0
  158. package/dist/paraglide/messages/scoria_action_delete.js +50 -0
  159. package/dist/paraglide/messages/scoria_action_dismiss.d.ts +17 -0
  160. package/dist/paraglide/messages/scoria_action_dismiss.js +50 -0
  161. package/dist/paraglide/messages/scoria_action_expand_nested_table.d.ts +17 -0
  162. package/dist/paraglide/messages/scoria_action_expand_nested_table.js +50 -0
  163. package/dist/paraglide/messages/scoria_action_go_to_page.d.ts +19 -0
  164. package/dist/paraglide/messages/scoria_action_go_to_page.js +50 -0
  165. package/dist/paraglide/messages/scoria_action_highlight_all_rows.d.ts +17 -0
  166. package/dist/paraglide/messages/scoria_action_highlight_all_rows.js +50 -0
  167. package/dist/paraglide/messages/scoria_action_highlight_card.d.ts +17 -0
  168. package/dist/paraglide/messages/scoria_action_highlight_card.js +50 -0
  169. package/dist/paraglide/messages/scoria_action_increment.d.ts +17 -0
  170. package/dist/paraglide/messages/scoria_action_increment.js +50 -0
  171. package/dist/paraglide/messages/scoria_action_modify_columns.d.ts +17 -0
  172. package/dist/paraglide/messages/scoria_action_modify_columns.js +50 -0
  173. package/dist/paraglide/messages/scoria_action_move_column_down.d.ts +19 -0
  174. package/dist/paraglide/messages/scoria_action_move_column_down.js +50 -0
  175. package/dist/paraglide/messages/scoria_action_move_column_up.d.ts +19 -0
  176. package/dist/paraglide/messages/scoria_action_move_column_up.js +50 -0
  177. package/dist/paraglide/messages/scoria_action_next.d.ts +17 -0
  178. package/dist/paraglide/messages/scoria_action_next.js +50 -0
  179. package/dist/paraglide/messages/scoria_action_next_page.d.ts +17 -0
  180. package/dist/paraglide/messages/scoria_action_next_page.js +50 -0
  181. package/dist/paraglide/messages/scoria_action_no.d.ts +17 -0
  182. package/dist/paraglide/messages/scoria_action_no.js +50 -0
  183. package/dist/paraglide/messages/scoria_action_okay.d.ts +17 -0
  184. package/dist/paraglide/messages/scoria_action_okay.js +50 -0
  185. package/dist/paraglide/messages/scoria_action_open_related_table.d.ts +17 -0
  186. package/dist/paraglide/messages/scoria_action_open_related_table.js +50 -0
  187. package/dist/paraglide/messages/scoria_action_pin_left.d.ts +17 -0
  188. package/dist/paraglide/messages/scoria_action_pin_left.js +50 -0
  189. package/dist/paraglide/messages/scoria_action_pin_right.d.ts +17 -0
  190. package/dist/paraglide/messages/scoria_action_pin_right.js +50 -0
  191. package/dist/paraglide/messages/scoria_action_previous.d.ts +17 -0
  192. package/dist/paraglide/messages/scoria_action_previous.js +50 -0
  193. package/dist/paraglide/messages/scoria_action_previous_page.d.ts +17 -0
  194. package/dist/paraglide/messages/scoria_action_previous_page.js +50 -0
  195. package/dist/paraglide/messages/scoria_action_quick_filter.d.ts +17 -0
  196. package/dist/paraglide/messages/scoria_action_quick_filter.js +50 -0
  197. package/dist/paraglide/messages/scoria_action_refresh.d.ts +17 -0
  198. package/dist/paraglide/messages/scoria_action_refresh.js +50 -0
  199. package/dist/paraglide/messages/scoria_action_remove.d.ts +17 -0
  200. package/dist/paraglide/messages/scoria_action_remove.js +50 -0
  201. package/dist/paraglide/messages/scoria_action_remove_condition.d.ts +17 -0
  202. package/dist/paraglide/messages/scoria_action_remove_condition.js +50 -0
  203. package/dist/paraglide/messages/scoria_action_remove_group.d.ts +17 -0
  204. package/dist/paraglide/messages/scoria_action_remove_group.js +50 -0
  205. package/dist/paraglide/messages/scoria_action_retry_load.d.ts +17 -0
  206. package/dist/paraglide/messages/scoria_action_retry_load.js +50 -0
  207. package/dist/paraglide/messages/scoria_action_save.d.ts +17 -0
  208. package/dist/paraglide/messages/scoria_action_save.js +50 -0
  209. package/dist/paraglide/messages/scoria_action_save_current.d.ts +17 -0
  210. package/dist/paraglide/messages/scoria_action_save_current.js +50 -0
  211. package/dist/paraglide/messages/scoria_action_save_filter.d.ts +17 -0
  212. package/dist/paraglide/messages/scoria_action_save_filter.js +50 -0
  213. package/dist/paraglide/messages/scoria_action_save_layout.d.ts +17 -0
  214. package/dist/paraglide/messages/scoria_action_save_layout.js +50 -0
  215. package/dist/paraglide/messages/scoria_action_saving.d.ts +17 -0
  216. package/dist/paraglide/messages/scoria_action_saving.js +50 -0
  217. package/dist/paraglide/messages/scoria_action_share.d.ts +17 -0
  218. package/dist/paraglide/messages/scoria_action_share.js +50 -0
  219. package/dist/paraglide/messages/scoria_action_show_column.d.ts +19 -0
  220. package/dist/paraglide/messages/scoria_action_show_column.js +50 -0
  221. package/dist/paraglide/messages/scoria_action_subscribe.d.ts +17 -0
  222. package/dist/paraglide/messages/scoria_action_subscribe.js +50 -0
  223. package/dist/paraglide/messages/scoria_action_subscribe_additional.d.ts +17 -0
  224. package/dist/paraglide/messages/scoria_action_subscribe_additional.js +50 -0
  225. package/dist/paraglide/messages/scoria_action_table_configuration.d.ts +17 -0
  226. package/dist/paraglide/messages/scoria_action_table_configuration.js +50 -0
  227. package/dist/paraglide/messages/scoria_action_toolbox.d.ts +17 -0
  228. package/dist/paraglide/messages/scoria_action_toolbox.js +50 -0
  229. package/dist/paraglide/messages/scoria_action_unsubscribe.d.ts +17 -0
  230. package/dist/paraglide/messages/scoria_action_unsubscribe.js +50 -0
  231. package/dist/paraglide/messages/scoria_action_update_options.d.ts +17 -0
  232. package/dist/paraglide/messages/scoria_action_update_options.js +50 -0
  233. package/dist/paraglide/messages/scoria_action_upload.d.ts +17 -0
  234. package/dist/paraglide/messages/scoria_action_upload.js +50 -0
  235. package/dist/paraglide/messages/scoria_action_yes.d.ts +17 -0
  236. package/dist/paraglide/messages/scoria_action_yes.js +50 -0
  237. package/dist/paraglide/messages/scoria_label_actions.d.ts +17 -0
  238. package/dist/paraglide/messages/scoria_label_actions.js +50 -0
  239. package/dist/paraglide/messages/scoria_label_allow_system_decide.d.ts +17 -0
  240. package/dist/paraglide/messages/scoria_label_allow_system_decide.js +50 -0
  241. package/dist/paraglide/messages/scoria_label_alternate_row_colours.d.ts +17 -0
  242. package/dist/paraglide/messages/scoria_label_alternate_row_colours.js +50 -0
  243. package/dist/paraglide/messages/scoria_label_any.d.ts +17 -0
  244. package/dist/paraglide/messages/scoria_label_any.js +50 -0
  245. package/dist/paraglide/messages/scoria_label_any_date.d.ts +17 -0
  246. package/dist/paraglide/messages/scoria_label_any_date.js +50 -0
  247. package/dist/paraglide/messages/scoria_label_between_and.d.ts +17 -0
  248. package/dist/paraglide/messages/scoria_label_between_and.js +50 -0
  249. package/dist/paraglide/messages/scoria_label_change_colour_hover.d.ts +17 -0
  250. package/dist/paraglide/messages/scoria_label_change_colour_hover.js +50 -0
  251. package/dist/paraglide/messages/scoria_label_combinator_and.d.ts +17 -0
  252. package/dist/paraglide/messages/scoria_label_combinator_and.js +50 -0
  253. package/dist/paraglide/messages/scoria_label_combinator_or.d.ts +17 -0
  254. package/dist/paraglide/messages/scoria_label_combinator_or.js +50 -0
  255. package/dist/paraglide/messages/scoria_label_compact.d.ts +17 -0
  256. package/dist/paraglide/messages/scoria_label_compact.js +50 -0
  257. package/dist/paraglide/messages/scoria_label_confirmation.d.ts +17 -0
  258. package/dist/paraglide/messages/scoria_label_confirmation.js +50 -0
  259. package/dist/paraglide/messages/scoria_label_context_menu.d.ts +17 -0
  260. package/dist/paraglide/messages/scoria_label_context_menu.js +50 -0
  261. package/dist/paraglide/messages/scoria_label_copy_as_csv.d.ts +17 -0
  262. package/dist/paraglide/messages/scoria_label_copy_as_csv.js +50 -0
  263. package/dist/paraglide/messages/scoria_label_custom_unsaved.d.ts +17 -0
  264. package/dist/paraglide/messages/scoria_label_custom_unsaved.js +50 -0
  265. package/dist/paraglide/messages/scoria_label_day.d.ts +17 -0
  266. package/dist/paraglide/messages/scoria_label_day.js +50 -0
  267. package/dist/paraglide/messages/scoria_label_default_view.d.ts +17 -0
  268. package/dist/paraglide/messages/scoria_label_default_view.js +50 -0
  269. package/dist/paraglide/messages/scoria_label_dimensions.d.ts +17 -0
  270. package/dist/paraglide/messages/scoria_label_dimensions.js +50 -0
  271. package/dist/paraglide/messages/scoria_label_edit_barcode_value.d.ts +17 -0
  272. package/dist/paraglide/messages/scoria_label_edit_barcode_value.js +50 -0
  273. package/dist/paraglide/messages/scoria_label_edit_column.d.ts +19 -0
  274. package/dist/paraglide/messages/scoria_label_edit_column.js +50 -0
  275. package/dist/paraglide/messages/scoria_label_edit_date_from.d.ts +17 -0
  276. package/dist/paraglide/messages/scoria_label_edit_date_from.js +50 -0
  277. package/dist/paraglide/messages/scoria_label_edit_date_to.d.ts +17 -0
  278. package/dist/paraglide/messages/scoria_label_edit_date_to.js +50 -0
  279. package/dist/paraglide/messages/scoria_label_field.d.ts +17 -0
  280. package/dist/paraglide/messages/scoria_label_field.js +50 -0
  281. package/dist/paraglide/messages/scoria_label_filter_by.d.ts +17 -0
  282. package/dist/paraglide/messages/scoria_label_filter_by.js +50 -0
  283. package/dist/paraglide/messages/scoria_label_filter_date_from.d.ts +19 -0
  284. package/dist/paraglide/messages/scoria_label_filter_date_from.js +50 -0
  285. package/dist/paraglide/messages/scoria_label_filter_date_to.d.ts +19 -0
  286. package/dist/paraglide/messages/scoria_label_filter_date_to.js +50 -0
  287. package/dist/paraglide/messages/scoria_label_filter_is_empty.d.ts +17 -0
  288. package/dist/paraglide/messages/scoria_label_filter_is_empty.js +50 -0
  289. package/dist/paraglide/messages/scoria_label_filter_is_null.d.ts +17 -0
  290. package/dist/paraglide/messages/scoria_label_filter_is_null.js +50 -0
  291. package/dist/paraglide/messages/scoria_label_filter_name_placeholder.d.ts +17 -0
  292. package/dist/paraglide/messages/scoria_label_filter_name_placeholder.js +50 -0
  293. package/dist/paraglide/messages/scoria_label_filter_noun.d.ts +17 -0
  294. package/dist/paraglide/messages/scoria_label_filter_noun.js +50 -0
  295. package/dist/paraglide/messages/scoria_label_filter_placeholder.d.ts +17 -0
  296. package/dist/paraglide/messages/scoria_label_filter_placeholder.js +50 -0
  297. package/dist/paraglide/messages/scoria_label_filters_section.d.ts +17 -0
  298. package/dist/paraglide/messages/scoria_label_filters_section.js +50 -0
  299. package/dist/paraglide/messages/scoria_label_hide_password.d.ts +17 -0
  300. package/dist/paraglide/messages/scoria_label_hide_password.js +50 -0
  301. package/dist/paraglide/messages/scoria_label_include_headers_copying.d.ts +17 -0
  302. package/dist/paraglide/messages/scoria_label_include_headers_copying.js +50 -0
  303. package/dist/paraglide/messages/scoria_label_jump_to_page.d.ts +17 -0
  304. package/dist/paraglide/messages/scoria_label_jump_to_page.js +50 -0
  305. package/dist/paraglide/messages/scoria_label_layout_name_placeholder.d.ts +17 -0
  306. package/dist/paraglide/messages/scoria_label_layout_name_placeholder.js +50 -0
  307. package/dist/paraglide/messages/scoria_label_layout_noun.d.ts +17 -0
  308. package/dist/paraglide/messages/scoria_label_layout_noun.js +50 -0
  309. package/dist/paraglide/messages/scoria_label_layouts_section.d.ts +17 -0
  310. package/dist/paraglide/messages/scoria_label_layouts_section.js +50 -0
  311. package/dist/paraglide/messages/scoria_label_loading.d.ts +17 -0
  312. package/dist/paraglide/messages/scoria_label_loading.js +50 -0
  313. package/dist/paraglide/messages/scoria_label_max_placeholder.d.ts +17 -0
  314. package/dist/paraglide/messages/scoria_label_max_placeholder.js +50 -0
  315. package/dist/paraglide/messages/scoria_label_maximum.d.ts +17 -0
  316. package/dist/paraglide/messages/scoria_label_maximum.js +50 -0
  317. package/dist/paraglide/messages/scoria_label_min_placeholder.d.ts +17 -0
  318. package/dist/paraglide/messages/scoria_label_min_placeholder.js +50 -0
  319. package/dist/paraglide/messages/scoria_label_month.d.ts +17 -0
  320. package/dist/paraglide/messages/scoria_label_month.js +50 -0
  321. package/dist/paraglide/messages/scoria_label_my_filters.d.ts +17 -0
  322. package/dist/paraglide/messages/scoria_label_my_filters.js +50 -0
  323. package/dist/paraglide/messages/scoria_label_my_layouts.d.ts +17 -0
  324. package/dist/paraglide/messages/scoria_label_my_layouts.js +50 -0
  325. package/dist/paraglide/messages/scoria_label_name.d.ts +17 -0
  326. package/dist/paraglide/messages/scoria_label_name.js +50 -0
  327. package/dist/paraglide/messages/scoria_label_name_unsaved.d.ts +19 -0
  328. package/dist/paraglide/messages/scoria_label_name_unsaved.js +50 -0
  329. package/dist/paraglide/messages/scoria_label_not_selected.d.ts +17 -0
  330. package/dist/paraglide/messages/scoria_label_not_selected.js +50 -0
  331. package/dist/paraglide/messages/scoria_label_notifications.d.ts +17 -0
  332. package/dist/paraglide/messages/scoria_label_notifications.js +50 -0
  333. package/dist/paraglide/messages/scoria_label_operator.d.ts +17 -0
  334. package/dist/paraglide/messages/scoria_label_operator.js +50 -0
  335. package/dist/paraglide/messages/scoria_label_operator_between.d.ts +17 -0
  336. package/dist/paraglide/messages/scoria_label_operator_between.js +50 -0
  337. package/dist/paraglide/messages/scoria_label_operator_contains.d.ts +17 -0
  338. package/dist/paraglide/messages/scoria_label_operator_contains.js +50 -0
  339. package/dist/paraglide/messages/scoria_label_operator_empty.d.ts +17 -0
  340. package/dist/paraglide/messages/scoria_label_operator_empty.js +50 -0
  341. package/dist/paraglide/messages/scoria_label_operator_ends_with.d.ts +17 -0
  342. package/dist/paraglide/messages/scoria_label_operator_ends_with.js +50 -0
  343. package/dist/paraglide/messages/scoria_label_operator_equals.d.ts +17 -0
  344. package/dist/paraglide/messages/scoria_label_operator_equals.js +50 -0
  345. package/dist/paraglide/messages/scoria_label_operator_greater_equal.d.ts +17 -0
  346. package/dist/paraglide/messages/scoria_label_operator_greater_equal.js +50 -0
  347. package/dist/paraglide/messages/scoria_label_operator_greater_than.d.ts +17 -0
  348. package/dist/paraglide/messages/scoria_label_operator_greater_than.js +50 -0
  349. package/dist/paraglide/messages/scoria_label_operator_in.d.ts +17 -0
  350. package/dist/paraglide/messages/scoria_label_operator_in.js +50 -0
  351. package/dist/paraglide/messages/scoria_label_operator_is_null.d.ts +17 -0
  352. package/dist/paraglide/messages/scoria_label_operator_is_null.js +50 -0
  353. package/dist/paraglide/messages/scoria_label_operator_less_equal.d.ts +17 -0
  354. package/dist/paraglide/messages/scoria_label_operator_less_equal.js +50 -0
  355. package/dist/paraglide/messages/scoria_label_operator_less_than.d.ts +17 -0
  356. package/dist/paraglide/messages/scoria_label_operator_less_than.js +50 -0
  357. package/dist/paraglide/messages/scoria_label_operator_not_contains.d.ts +17 -0
  358. package/dist/paraglide/messages/scoria_label_operator_not_contains.js +50 -0
  359. package/dist/paraglide/messages/scoria_label_operator_not_ends_with.d.ts +17 -0
  360. package/dist/paraglide/messages/scoria_label_operator_not_ends_with.js +50 -0
  361. package/dist/paraglide/messages/scoria_label_operator_not_equals.d.ts +17 -0
  362. package/dist/paraglide/messages/scoria_label_operator_not_equals.js +50 -0
  363. package/dist/paraglide/messages/scoria_label_operator_not_in.d.ts +17 -0
  364. package/dist/paraglide/messages/scoria_label_operator_not_in.js +50 -0
  365. package/dist/paraglide/messages/scoria_label_operator_not_starts_with.d.ts +17 -0
  366. package/dist/paraglide/messages/scoria_label_operator_not_starts_with.js +50 -0
  367. package/dist/paraglide/messages/scoria_label_operator_starts_with.d.ts +17 -0
  368. package/dist/paraglide/messages/scoria_label_operator_starts_with.js +50 -0
  369. package/dist/paraglide/messages/scoria_label_optional.d.ts +17 -0
  370. package/dist/paraglide/messages/scoria_label_optional.js +50 -0
  371. package/dist/paraglide/messages/scoria_label_pagination.d.ts +17 -0
  372. package/dist/paraglide/messages/scoria_label_pagination.js +50 -0
  373. package/dist/paraglide/messages/scoria_label_please_select.d.ts +17 -0
  374. package/dist/paraglide/messages/scoria_label_please_select.js +50 -0
  375. package/dist/paraglide/messages/scoria_label_quick_find_filter.d.ts +17 -0
  376. package/dist/paraglide/messages/scoria_label_quick_find_filter.js +50 -0
  377. package/dist/paraglide/messages/scoria_label_records_per_page.d.ts +17 -0
  378. package/dist/paraglide/messages/scoria_label_records_per_page.js +50 -0
  379. package/dist/paraglide/messages/scoria_label_row_selected.d.ts +17 -0
  380. package/dist/paraglide/messages/scoria_label_row_selected.js +50 -0
  381. package/dist/paraglide/messages/scoria_label_save_new_filter.d.ts +17 -0
  382. package/dist/paraglide/messages/scoria_label_save_new_filter.js +50 -0
  383. package/dist/paraglide/messages/scoria_label_save_new_layout.d.ts +17 -0
  384. package/dist/paraglide/messages/scoria_label_save_new_layout.js +50 -0
  385. package/dist/paraglide/messages/scoria_label_scan_barcode.d.ts +17 -0
  386. package/dist/paraglide/messages/scoria_label_scan_barcode.js +50 -0
  387. package/dist/paraglide/messages/scoria_label_scan_barcode_override.d.ts +17 -0
  388. package/dist/paraglide/messages/scoria_label_scan_barcode_override.js +50 -0
  389. package/dist/paraglide/messages/scoria_label_search.d.ts +17 -0
  390. package/dist/paraglide/messages/scoria_label_search.js +50 -0
  391. package/dist/paraglide/messages/scoria_label_search_columns.d.ts +17 -0
  392. package/dist/paraglide/messages/scoria_label_search_columns.js +50 -0
  393. package/dist/paraglide/messages/scoria_label_select_a_named.d.ts +19 -0
  394. package/dist/paraglide/messages/scoria_label_select_a_named.js +50 -0
  395. package/dist/paraglide/messages/scoria_label_select_all_rows.d.ts +17 -0
  396. package/dist/paraglide/messages/scoria_label_select_all_rows.js +50 -0
  397. package/dist/paraglide/messages/scoria_label_select_an_named.d.ts +19 -0
  398. package/dist/paraglide/messages/scoria_label_select_an_named.js +50 -0
  399. package/dist/paraglide/messages/scoria_label_select_filter.d.ts +17 -0
  400. package/dist/paraglide/messages/scoria_label_select_filter.js +50 -0
  401. package/dist/paraglide/messages/scoria_label_select_filter_type.d.ts +17 -0
  402. package/dist/paraglide/messages/scoria_label_select_filter_type.js +50 -0
  403. package/dist/paraglide/messages/scoria_label_select_item.d.ts +17 -0
  404. package/dist/paraglide/messages/scoria_label_select_item.js +50 -0
  405. package/dist/paraglide/messages/scoria_label_select_layout.d.ts +17 -0
  406. package/dist/paraglide/messages/scoria_label_select_layout.js +50 -0
  407. package/dist/paraglide/messages/scoria_label_select_page_size.d.ts +17 -0
  408. package/dist/paraglide/messages/scoria_label_select_page_size.js +50 -0
  409. package/dist/paraglide/messages/scoria_label_select_user.d.ts +17 -0
  410. package/dist/paraglide/messages/scoria_label_select_user.js +50 -0
  411. package/dist/paraglide/messages/scoria_label_select_visibility.d.ts +17 -0
  412. package/dist/paraglide/messages/scoria_label_select_visibility.js +50 -0
  413. package/dist/paraglide/messages/scoria_label_selected.d.ts +17 -0
  414. package/dist/paraglide/messages/scoria_label_selected.js +50 -0
  415. package/dist/paraglide/messages/scoria_label_selected_files.d.ts +17 -0
  416. package/dist/paraglide/messages/scoria_label_selected_files.js +50 -0
  417. package/dist/paraglide/messages/scoria_label_services.d.ts +17 -0
  418. package/dist/paraglide/messages/scoria_label_services.js +50 -0
  419. package/dist/paraglide/messages/scoria_label_services_tabs.d.ts +17 -0
  420. package/dist/paraglide/messages/scoria_label_services_tabs.js +50 -0
  421. package/dist/paraglide/messages/scoria_label_settings.d.ts +17 -0
  422. package/dist/paraglide/messages/scoria_label_settings.js +50 -0
  423. package/dist/paraglide/messages/scoria_label_share_header.d.ts +19 -0
  424. package/dist/paraglide/messages/scoria_label_share_header.js +50 -0
  425. package/dist/paraglide/messages/scoria_label_shared_filters.d.ts +17 -0
  426. package/dist/paraglide/messages/scoria_label_shared_filters.js +50 -0
  427. package/dist/paraglide/messages/scoria_label_shared_layouts.d.ts +17 -0
  428. package/dist/paraglide/messages/scoria_label_shared_layouts.js +50 -0
  429. package/dist/paraglide/messages/scoria_label_show_password.d.ts +17 -0
  430. package/dist/paraglide/messages/scoria_label_show_password.js +50 -0
  431. package/dist/paraglide/messages/scoria_label_single_click_editing.d.ts +17 -0
  432. package/dist/paraglide/messages/scoria_label_single_click_editing.js +50 -0
  433. package/dist/paraglide/messages/scoria_label_subscriber.d.ts +17 -0
  434. package/dist/paraglide/messages/scoria_label_subscriber.js +50 -0
  435. package/dist/paraglide/messages/scoria_label_table_identifier.d.ts +19 -0
  436. package/dist/paraglide/messages/scoria_label_table_identifier.js +50 -0
  437. package/dist/paraglide/messages/scoria_label_table_settings.d.ts +17 -0
  438. package/dist/paraglide/messages/scoria_label_table_settings.js +50 -0
  439. package/dist/paraglide/messages/scoria_label_time.d.ts +17 -0
  440. package/dist/paraglide/messages/scoria_label_time.js +50 -0
  441. package/dist/paraglide/messages/scoria_label_today.d.ts +17 -0
  442. package/dist/paraglide/messages/scoria_label_today.js +50 -0
  443. package/dist/paraglide/messages/scoria_label_unpinned.d.ts +17 -0
  444. package/dist/paraglide/messages/scoria_label_unpinned.js +50 -0
  445. package/dist/paraglide/messages/scoria_label_update_options_header.d.ts +19 -0
  446. package/dist/paraglide/messages/scoria_label_update_options_header.js +50 -0
  447. package/dist/paraglide/messages/scoria_label_users.d.ts +17 -0
  448. package/dist/paraglide/messages/scoria_label_users.js +50 -0
  449. package/dist/paraglide/messages/scoria_label_visibility.d.ts +17 -0
  450. package/dist/paraglide/messages/scoria_label_visibility.js +50 -0
  451. package/dist/paraglide/messages/scoria_label_visibility_private.d.ts +17 -0
  452. package/dist/paraglide/messages/scoria_label_visibility_private.js +50 -0
  453. package/dist/paraglide/messages/scoria_label_visibility_public.d.ts +17 -0
  454. package/dist/paraglide/messages/scoria_label_visibility_public.js +50 -0
  455. package/dist/paraglide/messages/scoria_label_week.d.ts +17 -0
  456. package/dist/paraglide/messages/scoria_label_week.js +50 -0
  457. package/dist/paraglide/messages/scoria_message_cannot_copy_insecure.d.ts +17 -0
  458. package/dist/paraglide/messages/scoria_message_cannot_copy_insecure.js +50 -0
  459. package/dist/paraglide/messages/scoria_message_copied_to_clipboard.d.ts +17 -0
  460. package/dist/paraglide/messages/scoria_message_copied_to_clipboard.js +50 -0
  461. package/dist/paraglide/messages/scoria_message_delete_failed.d.ts +19 -0
  462. package/dist/paraglide/messages/scoria_message_delete_failed.js +50 -0
  463. package/dist/paraglide/messages/scoria_message_error_detail.d.ts +20 -0
  464. package/dist/paraglide/messages/scoria_message_error_detail.js +50 -0
  465. package/dist/paraglide/messages/scoria_message_load_public_views_failed.d.ts +17 -0
  466. package/dist/paraglide/messages/scoria_message_load_public_views_failed.js +50 -0
  467. package/dist/paraglide/messages/scoria_message_load_users_failed.d.ts +17 -0
  468. package/dist/paraglide/messages/scoria_message_load_users_failed.js +50 -0
  469. package/dist/paraglide/messages/scoria_message_loading_filters.d.ts +17 -0
  470. package/dist/paraglide/messages/scoria_message_loading_filters.js +50 -0
  471. package/dist/paraglide/messages/scoria_message_loading_layouts.d.ts +17 -0
  472. package/dist/paraglide/messages/scoria_message_loading_layouts.js +50 -0
  473. package/dist/paraglide/messages/scoria_message_loading_users.d.ts +17 -0
  474. package/dist/paraglide/messages/scoria_message_loading_users.js +50 -0
  475. package/dist/paraglide/messages/scoria_message_name_required.d.ts +17 -0
  476. package/dist/paraglide/messages/scoria_message_name_required.js +50 -0
  477. package/dist/paraglide/messages/scoria_message_remove_subscriber_failed.d.ts +17 -0
  478. package/dist/paraglide/messages/scoria_message_remove_subscriber_failed.js +50 -0
  479. package/dist/paraglide/messages/scoria_message_save_filter_failed.d.ts +17 -0
  480. package/dist/paraglide/messages/scoria_message_save_filter_failed.js +50 -0
  481. package/dist/paraglide/messages/scoria_message_save_into_failed.d.ts +19 -0
  482. package/dist/paraglide/messages/scoria_message_save_into_failed.js +50 -0
  483. package/dist/paraglide/messages/scoria_message_save_layout_failed.d.ts +17 -0
  484. package/dist/paraglide/messages/scoria_message_save_layout_failed.js +50 -0
  485. package/dist/paraglide/messages/scoria_message_sharing_unavailable.d.ts +17 -0
  486. package/dist/paraglide/messages/scoria_message_sharing_unavailable.js +50 -0
  487. package/dist/paraglide/messages/scoria_message_subscribe_failed.d.ts +19 -0
  488. package/dist/paraglide/messages/scoria_message_subscribe_failed.js +50 -0
  489. package/dist/paraglide/messages/scoria_message_unsubscribe_failed.d.ts +19 -0
  490. package/dist/paraglide/messages/scoria_message_unsubscribe_failed.js +50 -0
  491. package/dist/paraglide/messages/scoria_message_update_options_failed.d.ts +17 -0
  492. package/dist/paraglide/messages/scoria_message_update_options_failed.js +50 -0
  493. package/dist/paraglide/messages/scoria_message_update_sharing_failed.d.ts +17 -0
  494. package/dist/paraglide/messages/scoria_message_update_sharing_failed.js +50 -0
  495. package/dist/paraglide/messages/scoria_message_views_load_failed.d.ts +17 -0
  496. package/dist/paraglide/messages/scoria_message_views_load_failed.js +50 -0
  497. package/dist/paraglide/messages/scoria_prompt_clear_selection.d.ts +17 -0
  498. package/dist/paraglide/messages/scoria_prompt_clear_selection.js +50 -0
  499. package/dist/paraglide/messages/scoria_text_actioning_all.d.ts +17 -0
  500. package/dist/paraglide/messages/scoria_text_actioning_all.js +50 -0
  501. package/dist/paraglide/messages/scoria_text_actioning_loaded.d.ts +17 -0
  502. package/dist/paraglide/messages/scoria_text_actioning_loaded.js +50 -0
  503. package/dist/paraglide/messages/scoria_text_barcode_edit_hint.d.ts +19 -0
  504. package/dist/paraglide/messages/scoria_text_barcode_edit_hint.js +50 -0
  505. package/dist/paraglide/messages/scoria_text_bubble_overflow.d.ts +19 -0
  506. package/dist/paraglide/messages/scoria_text_bubble_overflow.js +50 -0
  507. package/dist/paraglide/messages/scoria_text_changes_apply_filter.d.ts +17 -0
  508. package/dist/paraglide/messages/scoria_text_changes_apply_filter.js +50 -0
  509. package/dist/paraglide/messages/scoria_text_changes_apply_layout.d.ts +17 -0
  510. package/dist/paraglide/messages/scoria_text_changes_apply_layout.js +50 -0
  511. package/dist/paraglide/messages/scoria_text_crate_label.d.ts +17 -0
  512. package/dist/paraglide/messages/scoria_text_crate_label.js +56 -0
  513. package/dist/paraglide/messages/scoria_text_dropzone_multiple.d.ts +17 -0
  514. package/dist/paraglide/messages/scoria_text_dropzone_multiple.js +50 -0
  515. package/dist/paraglide/messages/scoria_text_dropzone_single.d.ts +17 -0
  516. package/dist/paraglide/messages/scoria_text_dropzone_single.js +50 -0
  517. package/dist/paraglide/messages/scoria_text_error_fetching_data.d.ts +17 -0
  518. package/dist/paraglide/messages/scoria_text_error_fetching_data.js +50 -0
  519. package/dist/paraglide/messages/scoria_text_error_getting_value.d.ts +17 -0
  520. package/dist/paraglide/messages/scoria_text_error_getting_value.js +50 -0
  521. package/dist/paraglide/messages/scoria_text_error_loading_button.d.ts +17 -0
  522. package/dist/paraglide/messages/scoria_text_error_loading_button.js +50 -0
  523. package/dist/paraglide/messages/scoria_text_error_prefix.d.ts +19 -0
  524. package/dist/paraglide/messages/scoria_text_error_prefix.js +50 -0
  525. package/dist/paraglide/messages/scoria_text_error_reading_value.d.ts +17 -0
  526. package/dist/paraglide/messages/scoria_text_error_reading_value.js +50 -0
  527. package/dist/paraglide/messages/scoria_text_error_rendering_cell.d.ts +17 -0
  528. package/dist/paraglide/messages/scoria_text_error_rendering_cell.js +50 -0
  529. package/dist/paraglide/messages/scoria_text_error_retrieving_options.d.ts +19 -0
  530. package/dist/paraglide/messages/scoria_text_error_retrieving_options.js +50 -0
  531. package/dist/paraglide/messages/scoria_text_error_uuid.d.ts +19 -0
  532. package/dist/paraglide/messages/scoria_text_error_uuid.js +50 -0
  533. package/dist/paraglide/messages/scoria_text_item_count.d.ts +21 -0
  534. package/dist/paraglide/messages/scoria_text_item_count.js +64 -0
  535. package/dist/paraglide/messages/scoria_text_loader_almost_there.d.ts +17 -0
  536. package/dist/paraglide/messages/scoria_text_loader_almost_there.js +50 -0
  537. package/dist/paraglide/messages/scoria_text_loader_fresh_box.d.ts +17 -0
  538. package/dist/paraglide/messages/scoria_text_loader_fresh_box.js +50 -0
  539. package/dist/paraglide/messages/scoria_text_loader_good_things.d.ts +17 -0
  540. package/dist/paraglide/messages/scoria_text_loader_good_things.js +50 -0
  541. package/dist/paraglide/messages/scoria_text_loader_great_day.d.ts +17 -0
  542. package/dist/paraglide/messages/scoria_text_loader_great_day.js +50 -0
  543. package/dist/paraglide/messages/scoria_text_loader_hang_tight.d.ts +17 -0
  544. package/dist/paraglide/messages/scoria_text_loader_hang_tight.js +50 -0
  545. package/dist/paraglide/messages/scoria_text_loader_hold_tight.d.ts +17 -0
  546. package/dist/paraglide/messages/scoria_text_loader_hold_tight.js +50 -0
  547. package/dist/paraglide/messages/scoria_text_loader_making_happen.d.ts +17 -0
  548. package/dist/paraglide/messages/scoria_text_loader_making_happen.js +50 -0
  549. package/dist/paraglide/messages/scoria_text_loader_nearly_done.d.ts +17 -0
  550. package/dist/paraglide/messages/scoria_text_loader_nearly_done.js +50 -0
  551. package/dist/paraglide/messages/scoria_text_loader_on_way.d.ts +17 -0
  552. package/dist/paraglide/messages/scoria_text_loader_on_way.js +50 -0
  553. package/dist/paraglide/messages/scoria_text_loader_sit_back.d.ts +17 -0
  554. package/dist/paraglide/messages/scoria_text_loader_sit_back.js +50 -0
  555. package/dist/paraglide/messages/scoria_text_loader_thanks_waiting.d.ts +17 -0
  556. package/dist/paraglide/messages/scoria_text_loader_thanks_waiting.js +50 -0
  557. package/dist/paraglide/messages/scoria_text_loader_worth_wait.d.ts +17 -0
  558. package/dist/paraglide/messages/scoria_text_loader_worth_wait.js +50 -0
  559. package/dist/paraglide/messages/scoria_text_loader_you_rock.d.ts +17 -0
  560. package/dist/paraglide/messages/scoria_text_loader_you_rock.js +50 -0
  561. package/dist/paraglide/messages/scoria_text_loader_youre_star.d.ts +17 -0
  562. package/dist/paraglide/messages/scoria_text_loader_youre_star.js +50 -0
  563. package/dist/paraglide/messages/scoria_text_loading_inline.d.ts +17 -0
  564. package/dist/paraglide/messages/scoria_text_loading_inline.js +50 -0
  565. package/dist/paraglide/messages/scoria_text_no_columns_match.d.ts +19 -0
  566. package/dist/paraglide/messages/scoria_text_no_columns_match.js +50 -0
  567. package/dist/paraglide/messages/scoria_text_no_data.d.ts +17 -0
  568. package/dist/paraglide/messages/scoria_text_no_data.js +50 -0
  569. package/dist/paraglide/messages/scoria_text_no_filterable_columns.d.ts +17 -0
  570. package/dist/paraglide/messages/scoria_text_no_filterable_columns.js +50 -0
  571. package/dist/paraglide/messages/scoria_text_no_filters_match.d.ts +19 -0
  572. package/dist/paraglide/messages/scoria_text_no_filters_match.js +50 -0
  573. package/dist/paraglide/messages/scoria_text_no_filters_saved.d.ts +17 -0
  574. package/dist/paraglide/messages/scoria_text_no_filters_saved.js +50 -0
  575. package/dist/paraglide/messages/scoria_text_no_filters_shared.d.ts +17 -0
  576. package/dist/paraglide/messages/scoria_text_no_filters_shared.js +50 -0
  577. package/dist/paraglide/messages/scoria_text_no_further_filters.d.ts +17 -0
  578. package/dist/paraglide/messages/scoria_text_no_further_filters.js +50 -0
  579. package/dist/paraglide/messages/scoria_text_no_further_layouts.d.ts +17 -0
  580. package/dist/paraglide/messages/scoria_text_no_further_layouts.js +50 -0
  581. package/dist/paraglide/messages/scoria_text_no_layouts_saved.d.ts +17 -0
  582. package/dist/paraglide/messages/scoria_text_no_layouts_saved.js +50 -0
  583. package/dist/paraglide/messages/scoria_text_no_layouts_shared.d.ts +17 -0
  584. package/dist/paraglide/messages/scoria_text_no_layouts_shared.js +50 -0
  585. package/dist/paraglide/messages/scoria_text_no_results.d.ts +17 -0
  586. package/dist/paraglide/messages/scoria_text_no_results.js +50 -0
  587. package/dist/paraglide/messages/scoria_text_no_step_selected.d.ts +17 -0
  588. package/dist/paraglide/messages/scoria_text_no_step_selected.js +50 -0
  589. package/dist/paraglide/messages/scoria_text_no_tab_selected.d.ts +17 -0
  590. package/dist/paraglide/messages/scoria_text_no_tab_selected.js +50 -0
  591. package/dist/paraglide/messages/scoria_text_no_users_filter.d.ts +17 -0
  592. package/dist/paraglide/messages/scoria_text_no_users_filter.js +50 -0
  593. package/dist/paraglide/messages/scoria_text_no_users_layout.d.ts +17 -0
  594. package/dist/paraglide/messages/scoria_text_no_users_layout.js +50 -0
  595. package/dist/paraglide/messages/scoria_text_options_not_retrieved.d.ts +17 -0
  596. package/dist/paraglide/messages/scoria_text_options_not_retrieved.js +50 -0
  597. package/dist/paraglide/messages/scoria_text_page_count.d.ts +20 -0
  598. package/dist/paraglide/messages/scoria_text_page_count.js +64 -0
  599. package/dist/paraglide/messages/scoria_text_records_selected.d.ts +20 -0
  600. package/dist/paraglide/messages/scoria_text_records_selected.js +64 -0
  601. package/dist/paraglide/messages/scoria_text_row_count.d.ts +20 -0
  602. package/dist/paraglide/messages/scoria_text_row_count.js +64 -0
  603. package/dist/paraglide/messages/scoria_text_save_filter_intro.d.ts +17 -0
  604. package/dist/paraglide/messages/scoria_text_save_filter_intro.js +50 -0
  605. package/dist/paraglide/messages/scoria_text_save_layout_intro.d.ts +17 -0
  606. package/dist/paraglide/messages/scoria_text_save_layout_intro.js +50 -0
  607. package/dist/paraglide/messages/scoria_text_selected_count.d.ts +20 -0
  608. package/dist/paraglide/messages/scoria_text_selected_count.js +64 -0
  609. package/dist/paraglide/messages/scoria_text_selected_count_named.d.ts +21 -0
  610. package/dist/paraglide/messages/scoria_text_selected_count_named.js +64 -0
  611. package/dist/paraglide/messages/scoria_text_share_filter_subtitle.d.ts +17 -0
  612. package/dist/paraglide/messages/scoria_text_share_filter_subtitle.js +50 -0
  613. package/dist/paraglide/messages/scoria_text_share_layout_subtitle.d.ts +17 -0
  614. package/dist/paraglide/messages/scoria_text_share_layout_subtitle.js +50 -0
  615. package/dist/paraglide/messages/scoria_text_unknown_cell_type.d.ts +17 -0
  616. package/dist/paraglide/messages/scoria_text_unknown_cell_type.js +50 -0
  617. package/dist/paraglide/messages/scoria_text_unknown_cell_value_type.d.ts +17 -0
  618. package/dist/paraglide/messages/scoria_text_unknown_cell_value_type.js +50 -0
  619. package/dist/paraglide/messages/scoria_text_unknown_error.d.ts +17 -0
  620. package/dist/paraglide/messages/scoria_text_unknown_error.js +50 -0
  621. package/dist/paraglide/messages/scoria_text_unrecognised_input.d.ts +19 -0
  622. package/dist/paraglide/messages/scoria_text_unrecognised_input.js +50 -0
  623. package/dist/paraglide/messages/scoria_text_update_filter_subtitle.d.ts +17 -0
  624. package/dist/paraglide/messages/scoria_text_update_filter_subtitle.js +50 -0
  625. package/dist/paraglide/messages/scoria_text_update_layout_subtitle.d.ts +17 -0
  626. package/dist/paraglide/messages/scoria_text_update_layout_subtitle.js +50 -0
  627. package/dist/paraglide/messages/scoria_text_views_unavailable.d.ts +17 -0
  628. package/dist/paraglide/messages/scoria_text_views_unavailable.js +50 -0
  629. package/dist/paraglide/messages.d.ts +2 -0
  630. package/dist/paraglide/messages.js +4 -0
  631. package/dist/paraglide/registry.d.ts +34 -0
  632. package/dist/paraglide/registry.js +46 -0
  633. package/dist/paraglide/runtime.d.ts +822 -0
  634. package/dist/paraglide/runtime.js +2325 -0
  635. package/dist/paraglide/server.d.ts +96 -0
  636. package/dist/paraglide/server.js +294 -0
  637. package/dist/scss/_mixins.scss +3406 -3392
  638. package/package.json +14 -7
@@ -0,0 +1,2325 @@
1
+ /* eslint-disable */
2
+
3
+ /** @type {any} */
4
+ const URLPattern = {}
5
+
6
+ /**
7
+ * The project's base locale.
8
+ *
9
+ * @example
10
+ * if (locale === baseLocale) {
11
+ * // do something
12
+ * }
13
+ */
14
+ export const baseLocale = "en";
15
+ /**
16
+ * The project's locales that have been specified in the settings.
17
+ *
18
+ * @example
19
+ * if (locales.includes(userSelectedLocale) === false) {
20
+ * throw new Error('Locale is not available');
21
+ * }
22
+ */
23
+ export const locales = /** @type {const} */ (["en","es","fr","de","hi","ur"]);
24
+ /** @type {string} */
25
+ export const cookieName = "PARAGLIDE_LOCALE";
26
+ /** @type {number} */
27
+ export const cookieMaxAge = 34560000;
28
+ /** @type {string} */
29
+ export const cookieDomain = "";
30
+ /** @type {string} */
31
+ export const localStorageKey = "PARAGLIDE_LOCALE";
32
+ /**
33
+ * @type {Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>}
34
+ */
35
+ export const strategy = [
36
+ "baseLocale"
37
+ ];
38
+ /**
39
+ * Route-level strategy overrides.
40
+ *
41
+ * `match` uses URLPattern syntax.
42
+ *
43
+ * @type {Array<{
44
+ * match: string;
45
+ * strategy?: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
46
+ * exclude?: boolean;
47
+ * }>}
48
+ */
49
+ export const routeStrategies = [];
50
+ /**
51
+ * The used URL patterns.
52
+ *
53
+ * @type {Array<{ pattern: string, localized: Array<[Locale, string]> }>}
54
+ */
55
+ export const urlPatterns = [
56
+ {
57
+ "pattern": ":protocol://:domain(.*)::port?/:path(.*)?",
58
+ "localized": [
59
+ [
60
+ "es",
61
+ ":protocol://:domain(.*)::port?/es/:path(.*)?"
62
+ ],
63
+ [
64
+ "fr",
65
+ ":protocol://:domain(.*)::port?/fr/:path(.*)?"
66
+ ],
67
+ [
68
+ "de",
69
+ ":protocol://:domain(.*)::port?/de/:path(.*)?"
70
+ ],
71
+ [
72
+ "hi",
73
+ ":protocol://:domain(.*)::port?/hi/:path(.*)?"
74
+ ],
75
+ [
76
+ "ur",
77
+ ":protocol://:domain(.*)::port?/ur/:path(.*)?"
78
+ ],
79
+ [
80
+ "en",
81
+ ":protocol://:domain(.*)::port?/:path(.*)?"
82
+ ]
83
+ ]
84
+ }
85
+ ];
86
+ /**
87
+ * Controls trailing slash canonicalization for localized URLs.
88
+ *
89
+ * @type {"always" | "never" | undefined}
90
+ */
91
+ export const trailingSlash = undefined;
92
+ /**
93
+ * @typedef {{
94
+ * getStore(): {
95
+ * locale?: Locale,
96
+ * origin?: string,
97
+ * messageCalls?: Set<string>
98
+ * } | undefined,
99
+ * run: (store: { locale?: Locale, origin?: string, messageCalls?: Set<string>},
100
+ * cb: any) => any
101
+ * }} ParaglideAsyncLocalStorage
102
+ */
103
+ /**
104
+ * Server side async local storage that is set by `serverMiddleware()`.
105
+ *
106
+ * The variable is used to retrieve the locale and origin in a server-side
107
+ * rendering context without effecting other requests.
108
+ *
109
+ * @type {ParaglideAsyncLocalStorage | undefined}
110
+ */
111
+ export let serverAsyncLocalStorage = undefined;
112
+ /**
113
+ * Returns the current server-side async local storage instance.
114
+ *
115
+ * Accessing the mutable value through a function keeps it observable when
116
+ * module interceptors wrap exported bindings and snapshot their initial value.
117
+ *
118
+ * @returns {ParaglideAsyncLocalStorage | undefined}
119
+ */
120
+ export function getServerAsyncLocalStorage() {
121
+ return serverAsyncLocalStorage;
122
+ }
123
+ export const disableAsyncLocalStorage = false;
124
+ export const experimentalMiddlewareLocaleSplitting = false;
125
+ export const isServer = typeof window === 'undefined';
126
+ /** @type {Locale | undefined} */
127
+ export const experimentalStaticLocale = undefined;
128
+ /**
129
+ * Sets the server side async local storage.
130
+ *
131
+ * The function is needed because the `runtime.js` file
132
+ * must define the `serverAsyncLocalStorage` variable to
133
+ * avoid a circular import between `runtime.js` and
134
+ * `server.js` files.
135
+ *
136
+ * @param {ParaglideAsyncLocalStorage | undefined} value
137
+ */
138
+ export function overwriteServerAsyncLocalStorage(value) {
139
+ serverAsyncLocalStorage = value;
140
+ }
141
+ const TREE_SHAKE_COOKIE_STRATEGY_USED = false;
142
+ const TREE_SHAKE_URL_STRATEGY_USED = false;
143
+ const TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
144
+ const TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = false;
145
+ const TREE_SHAKE_DEFAULT_URL_PATTERN_USED = true;
146
+ const TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
147
+
148
+ /** @type {any} */ (globalThis).__paraglide =
149
+ /** @type {any} */ (globalThis).__paraglide ?? {};
150
+ /** @type {any} */ (globalThis).__paraglide.ssr =
151
+ /** @type {any} */ (globalThis).__paraglide.ssr ?? {};
152
+
153
+ /**
154
+ * This is a fallback to get started with a custom
155
+ * strategy and avoid type errors.
156
+ *
157
+ * The implementation is overwritten
158
+ * by `overwriteGetLocale()` and `defineSetLocale()`.
159
+ *
160
+ * @type {Locale | undefined}
161
+ */
162
+ let _locale;
163
+ let localeInitiallySet = false;
164
+ /**
165
+ * Get the current locale.
166
+ *
167
+ * The locale is resolved using your configured strategies (URL, cookie, localStorage, etc.)
168
+ * in the order they are defined. In SSR contexts, the locale is retrieved from AsyncLocalStorage
169
+ * which is set by the `paraglideMiddleware()`.
170
+ *
171
+ * @see https://paraglidejs.com/strategy - Configure locale detection strategies
172
+ *
173
+ * @example
174
+ * if (getLocale() === 'de') {
175
+ * console.log('Germany 🇩🇪');
176
+ * } else if (getLocale() === 'nl') {
177
+ * console.log('Netherlands 🇳🇱');
178
+ * }
179
+ *
180
+ * @returns {Locale} The current locale.
181
+ */
182
+ export let getLocale = () => {
183
+ if (experimentalStaticLocale !== undefined) {
184
+ return experimentalStaticLocale;
185
+ }
186
+ // if running in a server-side rendering context
187
+ // retrieve the locale from the async local storage
188
+ if (serverAsyncLocalStorage) {
189
+ const locale = serverAsyncLocalStorage?.getStore()?.locale;
190
+ if (locale) {
191
+ return locale;
192
+ }
193
+ }
194
+ let strategyToUse = strategy;
195
+ if (!isServer && typeof window !== "undefined" && window.location?.href) {
196
+ strategyToUse = getStrategyForUrl(window.location.href);
197
+ }
198
+ const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
199
+ if (resolved) {
200
+ if (!localeInitiallySet) {
201
+ _locale = resolved;
202
+ // https://github.com/opral/inlang-paraglide-js/issues/455
203
+ localeInitiallySet = true;
204
+ setLocale(resolved, { reload: false });
205
+ }
206
+ return resolved;
207
+ }
208
+ throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
209
+ };
210
+ /**
211
+ * Resolve locale for a given URL using route-aware strategies.
212
+ *
213
+ * @param {string | URL} url
214
+ * @returns {Locale}
215
+ */
216
+ export function getLocaleForUrl(url) {
217
+ if (experimentalStaticLocale !== undefined) {
218
+ return experimentalStaticLocale;
219
+ }
220
+ const strategyToUse = getStrategyForUrl(url);
221
+ const resolved = resolveLocaleWithStrategies(strategyToUse, typeof url === "string" ? url : url.href);
222
+ if (resolved) {
223
+ return resolved;
224
+ }
225
+ throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
226
+ }
227
+ /**
228
+ * @param {typeof strategy} strategyToUse
229
+ * @param {string | undefined} urlForUrlStrategy
230
+ * @returns {Locale | undefined}
231
+ */
232
+ function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
233
+ /** @type {string | undefined} */
234
+ let locale;
235
+ for (const strat of strategyToUse) {
236
+ if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
237
+ locale = extractLocaleFromCookie();
238
+ }
239
+ else if (strat === "baseLocale") {
240
+ locale = baseLocale;
241
+ }
242
+ else if (TREE_SHAKE_URL_STRATEGY_USED &&
243
+ strat === "url" &&
244
+ !isServer &&
245
+ typeof urlForUrlStrategy === "string") {
246
+ locale = extractLocaleFromUrl(urlForUrlStrategy);
247
+ }
248
+ else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED &&
249
+ strat === "globalVariable" &&
250
+ _locale !== undefined) {
251
+ locale = _locale;
252
+ }
253
+ else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED &&
254
+ strat === "preferredLanguage" &&
255
+ !isServer) {
256
+ locale = extractLocaleFromNavigator();
257
+ }
258
+ else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED &&
259
+ strat === "localStorage" &&
260
+ !isServer) {
261
+ locale = localStorage.getItem(localStorageKey) ?? undefined;
262
+ }
263
+ else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
264
+ const handler = customClientStrategies.get(strat);
265
+ if (handler) {
266
+ const result = handler.getLocale();
267
+ // Handle both sync and async results - skip async in sync getLocale
268
+ if (result instanceof Promise) {
269
+ // Can't await in sync function, skip async strategies
270
+ continue;
271
+ }
272
+ if (result !== undefined) {
273
+ return assertIsLocale(result);
274
+ }
275
+ }
276
+ }
277
+ const matchedLocale = toLocale(locale);
278
+ if (matchedLocale) {
279
+ return matchedLocale;
280
+ }
281
+ }
282
+ return undefined;
283
+ }
284
+ /**
285
+ * Overwrite the `getLocale()` function.
286
+ *
287
+ * Use this function to overwrite how the locale is resolved. This is useful
288
+ * for custom locale resolution or advanced use cases like SSG with concurrent rendering.
289
+ *
290
+ * @see https://paraglidejs.com/strategy
291
+ *
292
+ * @example
293
+ * overwriteGetLocale(() => {
294
+ * return Cookies.get('locale') ?? baseLocale
295
+ * });
296
+ *
297
+ * @param {() => Locale} fn - The new implementation for `getLocale()`.
298
+ */
299
+ export const overwriteGetLocale = (fn) => {
300
+ getLocale = fn;
301
+ };
302
+
303
+ const rtlLanguages = new Set([
304
+ "ar",
305
+ "dv",
306
+ "fa",
307
+ "he",
308
+ "ks",
309
+ "ku",
310
+ "ps",
311
+ "sd",
312
+ "ug",
313
+ "ur",
314
+ "yi",
315
+ ]);
316
+ /**
317
+ * Get writing direction for a locale.
318
+ *
319
+ * Uses `Intl.Locale` text info when available and falls back to a
320
+ * language-based RTL check for runtimes without `getTextInfo()`.
321
+ *
322
+ * @example
323
+ * getTextDirection(); // "ltr" or "rtl" for current locale
324
+ * getTextDirection("ar"); // "rtl"
325
+ * getTextDirection("en"); // "ltr"
326
+ *
327
+ * @param {string} [locale] - Target locale. If not provided, uses `getLocale()`
328
+ * @returns {"ltr" | "rtl"}
329
+ */
330
+ export function getTextDirection(locale = getLocale()) {
331
+ try {
332
+ const intlLocale = /** @type {Intl.Locale & {
333
+ getTextInfo?: () => { direction?: string };
334
+ textInfo?: { direction?: string };
335
+ }} */ (new Intl.Locale(locale));
336
+ const direction = intlLocale.getTextInfo?.().direction ?? intlLocale.textInfo?.direction;
337
+ if (direction === "ltr" || direction === "rtl") {
338
+ return direction;
339
+ }
340
+ }
341
+ catch {
342
+ // Ignore Intl.Locale parsing/runtime errors and use fallback below.
343
+ }
344
+ const language = locale.split("-")[0]?.toLowerCase();
345
+ return rtlLanguages.has(language ?? "") ? "rtl" : "ltr";
346
+ }
347
+
348
+ /**
349
+ * Navigates to the localized URL, or reloads the current page
350
+ *
351
+ * @param {string} [newLocation] The new location
352
+ */
353
+ const navigateOrReload = (newLocation) => {
354
+ if (newLocation) {
355
+ // reload the page by navigating to the new url
356
+ window.location.href = newLocation;
357
+ }
358
+ else {
359
+ // reload the page to reflect the new locale
360
+ window.location.reload();
361
+ }
362
+ };
363
+ /**
364
+ * @typedef {(newLocale: Locale, options?: { reload?: boolean }) => void | Promise<void>} SetLocaleFn
365
+ */
366
+ /**
367
+ * Set the locale.
368
+ *
369
+ * Updates the locale using your configured strategies (cookie, localStorage, URL, etc.).
370
+ * By default, this navigates the client to the localized URL or reloads the current
371
+ * document to reflect the new locale. `reload: false` is a narrow browser-only escape
372
+ * hatch for a fully client-rendered, non-URL-routed surface that owns its reactive
373
+ * updates and document state. It does not re-render the UI or update the document.
374
+ * Do not use it for normal locale pickers, URL-routed pages, or switching an SSR,
375
+ * SSG, or hydrated document. It is incompatible with per-locale builds.
376
+ *
377
+ * If any custom strategy's `setLocale` function is async, then this function
378
+ * will become async as well.
379
+ *
380
+ * @see https://paraglidejs.com/strategy
381
+ *
382
+ * @example
383
+ * setLocale('en');
384
+ *
385
+ * @example
386
+ * setLocale('en', { reload: false });
387
+ *
388
+ * @type {SetLocaleFn}
389
+ */
390
+ export let setLocale = (newLocale, options) => {
391
+ const optionsWithDefaults = {
392
+ reload: true,
393
+ ...options,
394
+ };
395
+ if (experimentalStaticLocale !== undefined &&
396
+ newLocale !== experimentalStaticLocale &&
397
+ optionsWithDefaults.reload === false) {
398
+ console.warn(`Paraglide: setLocale(${JSON.stringify(newLocale)}, { reload: false }) cannot switch away from the statically built locale ${JSON.stringify(experimentalStaticLocale)}. A document navigation is required; reload has been forced to true.`);
399
+ optionsWithDefaults.reload = true;
400
+ }
401
+ // locale is already set
402
+ // https://github.com/opral/inlang-paraglide-js/issues/430
403
+ /** @type {Locale | undefined} */
404
+ let currentLocale;
405
+ try {
406
+ currentLocale = getLocale();
407
+ }
408
+ catch {
409
+ // do nothing, no locale has been set yet.
410
+ }
411
+ /** @type {Array<Promise<void>>} */
412
+ const customSetLocalePromises = [];
413
+ /** @type {string | undefined} */
414
+ let newLocation = undefined;
415
+ let strategyToUse = strategy;
416
+ if (!isServer && typeof window !== "undefined" && window.location?.href) {
417
+ strategyToUse = getStrategyForUrl(window.location.href);
418
+ }
419
+ for (const strat of strategyToUse) {
420
+ if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED &&
421
+ strat === "globalVariable") {
422
+ // a default for a custom strategy to get started quickly
423
+ // is likely overwritten by `defineSetLocale()`
424
+ _locale = newLocale;
425
+ }
426
+ else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
427
+ if (isServer ||
428
+ typeof document === "undefined" ||
429
+ typeof window === "undefined") {
430
+ continue;
431
+ }
432
+ // set the cookie
433
+ const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
434
+ document.cookie = cookieDomain
435
+ ? `${cookieString}; domain=${cookieDomain}`
436
+ : cookieString;
437
+ clearLocaleCookieCache();
438
+ }
439
+ else if (strat === "baseLocale") {
440
+ // nothing to be set here. baseLocale is only a fallback
441
+ continue;
442
+ }
443
+ else if (TREE_SHAKE_URL_STRATEGY_USED &&
444
+ strat === "url" &&
445
+ typeof window !== "undefined") {
446
+ // route to the new url
447
+ //
448
+ // this triggers a page reload but a user rarely
449
+ // switches locales, so this should be fine.
450
+ //
451
+ // if the behavior is not desired, the implementation
452
+ // can be overwritten by `defineSetLocale()` to avoid
453
+ // a full page reload.
454
+ newLocation = localizeUrl(window.location.href, {
455
+ locale: newLocale,
456
+ }).href;
457
+ }
458
+ else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED &&
459
+ strat === "localStorage" &&
460
+ typeof window !== "undefined") {
461
+ // set the localStorage
462
+ localStorage.setItem(localStorageKey, newLocale);
463
+ }
464
+ else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
465
+ const handler = customClientStrategies.get(strat);
466
+ if (handler) {
467
+ let result = handler.setLocale(newLocale);
468
+ // Handle async setLocale
469
+ if (result instanceof Promise) {
470
+ result = result.catch((error) => {
471
+ throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
472
+ cause: error,
473
+ });
474
+ });
475
+ customSetLocalePromises.push(result);
476
+ }
477
+ }
478
+ }
479
+ }
480
+ const runReload = () => {
481
+ if (!isServer &&
482
+ optionsWithDefaults.reload &&
483
+ window.location &&
484
+ newLocale !== currentLocale) {
485
+ navigateOrReload(newLocation);
486
+ }
487
+ };
488
+ if (customSetLocalePromises.length) {
489
+ return Promise.all(customSetLocalePromises).then(() => {
490
+ runReload();
491
+ });
492
+ }
493
+ runReload();
494
+ return;
495
+ };
496
+ /**
497
+ * Overwrite the `setLocale()` function.
498
+ *
499
+ * Use this function to overwrite how the locale is set. For example,
500
+ * modify a cookie, env variable, or a user's preference.
501
+ *
502
+ * @example
503
+ * overwriteSetLocale((newLocale) => {
504
+ * // set the locale in a cookie
505
+ * return Cookies.set('locale', newLocale)
506
+ * });
507
+ *
508
+ * @param {SetLocaleFn} fn
509
+ */
510
+ export const overwriteSetLocale = (fn) => {
511
+ setLocale = fn;
512
+ };
513
+
514
+ /**
515
+ * The origin of the current URL.
516
+ *
517
+ * Defaults to "http://example.com" in non-browser environments. If this
518
+ * behavior is not desired, the implementation can be overwritten
519
+ * by `overwriteGetUrlOrigin()`.
520
+ *
521
+ * @type {() => string}
522
+ */
523
+ export let getUrlOrigin = () => {
524
+ if (serverAsyncLocalStorage) {
525
+ return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
526
+ }
527
+ else if (typeof window !== "undefined") {
528
+ return window.location.origin;
529
+ }
530
+ return "http://fallback.com";
531
+ };
532
+ /**
533
+ * Overwrite the getUrlOrigin function.
534
+ *
535
+ * Use this function in server environments to
536
+ * define how the URL origin is resolved.
537
+ *
538
+ * @param {() => string} fn - The new implementation for `getUrlOrigin()`.
539
+ */
540
+ export let overwriteGetUrlOrigin = (fn) => {
541
+ getUrlOrigin = fn;
542
+ };
543
+
544
+ /**
545
+ * Coerces a locale-like string to the canonical locale value used by the runtime.
546
+ *
547
+ * @param {unknown} value
548
+ * @returns {Locale | undefined}
549
+ */
550
+ export function toLocale(value) {
551
+ if (typeof value !== "string") {
552
+ return undefined;
553
+ }
554
+ const lowerValue = value.toLowerCase();
555
+ for (const locale of locales) {
556
+ if (locale.toLowerCase() === lowerValue) {
557
+ return locale;
558
+ }
559
+ }
560
+ return undefined;
561
+ }
562
+ /**
563
+ * Check if something is an available locale with the canonical project casing.
564
+ *
565
+ * @example
566
+ * if (isLocale(params.locale)) {
567
+ * setLocale(params.locale);
568
+ * } else {
569
+ * setLocale('en');
570
+ * }
571
+ *
572
+ * Use `toLocale()` when you want case-insensitive matching and canonicalization.
573
+ *
574
+ * @param {unknown} locale
575
+ * @returns {locale is Locale}
576
+ */
577
+ export function isLocale(locale) {
578
+ return !!locale && locales.some((item) => item === locale);
579
+ }
580
+ /**
581
+ * Asserts that the input can be normalized to a locale.
582
+ *
583
+ * @param {unknown} input - The input to check.
584
+ * @returns {Locale} The input normalized to a Locale.
585
+ * @throws {Error} If the input is not a locale.
586
+ */
587
+ export function assertIsLocale(input) {
588
+ const locale = toLocale(input);
589
+ if (locale)
590
+ return locale;
591
+ throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
592
+ }
593
+
594
+ /**
595
+ * Applies the configured trailing slash policy to a URL.
596
+ *
597
+ * The root pathname always remains `/`. Query parameters and hashes are not
598
+ * modified.
599
+ *
600
+ * @param {URL} url
601
+ * @returns {URL}
602
+ */
603
+ function normalizeTrailingSlash(url) {
604
+ if (trailingSlash === undefined || url.pathname === "/") {
605
+ return url;
606
+ }
607
+ if (trailingSlash === "never") {
608
+ url.pathname = url.pathname.replace(/\/+$/, "") || "/";
609
+ }
610
+ else if (trailingSlash === "always") {
611
+ url.pathname = url.pathname.replace(/\/+$/, "") + "/";
612
+ }
613
+ return url;
614
+ }
615
+
616
+ /**
617
+ * Matches a canonical URL while allowing configured patterns to retain their
618
+ * existing trailing slash style.
619
+ *
620
+ * @param {URLPattern} pattern
621
+ * @param {URL} url
622
+ * @returns {any}
623
+ */
624
+ function execUrlPattern(pattern, url) {
625
+ if (trailingSlash === undefined || url.pathname === "/") {
626
+ return pattern.exec(url.href);
627
+ }
628
+ const alias = new URL(url);
629
+ if (trailingSlash === "always") {
630
+ alias.pathname = alias.pathname.replace(/\/+$/, "") || "/";
631
+ // Prefer the slashless alias so the canonical slash does not become part
632
+ // of a terminal wildcard capture.
633
+ return pattern.exec(alias.href) ?? pattern.exec(url.href);
634
+ }
635
+ else if (trailingSlash === "never") {
636
+ const match = pattern.exec(url.href);
637
+ if (match) {
638
+ return match;
639
+ }
640
+ alias.pathname = alias.pathname.replace(/\/+$/, "") + "/";
641
+ return pattern.exec(alias.href);
642
+ }
643
+ return pattern.exec(url.href);
644
+ }
645
+
646
+ /**
647
+ * @typedef {object} ExtractLocaleFromRequestOptions
648
+ * @property {string | URL} [effectiveRequestUrl] - Effective request URL to use for route matching and locale detection with the URL strategy.
649
+ */
650
+ /**
651
+ * Extracts a locale from a request.
652
+ *
653
+ * Use the function on the server to extract the locale
654
+ * from a request.
655
+ *
656
+ * The function goes through the strategies in the order
657
+ * they are defined. If a strategy returns an invalid locale,
658
+ * it will fall back to the next strategy.
659
+ *
660
+ * Note: Custom server strategies are not supported in this synchronous version.
661
+ * Use `extractLocaleFromRequestAsync` if you need custom server strategies with async getLocale methods.
662
+ *
663
+ * @example
664
+ * const locale = extractLocaleFromRequest(request);
665
+ *
666
+ * @param {Request} request
667
+ * @param {ExtractLocaleFromRequestOptions} [options]
668
+ * @returns {Locale}
669
+ */
670
+ export const extractLocaleFromRequest = (request, options = {}) => {
671
+ const effectiveRequestUrl = resolveEffectiveRequestUrl(request, options.effectiveRequestUrl);
672
+ return extractLocaleFromRequestWithStrategies(request, getStrategyForUrl(effectiveRequestUrl), effectiveRequestUrl);
673
+ };
674
+ /**
675
+ * Extracts a locale from a request using the provided strategy order.
676
+ *
677
+ * @param {Request} request
678
+ * @param {typeof strategy} strategies
679
+ * @param {string | URL} [url]
680
+ * @returns {Locale}
681
+ */
682
+ export const extractLocaleFromRequestWithStrategies = (request, strategies, url = request.url) => {
683
+ const effectiveRequestUrl = resolveEffectiveRequestUrl(request, url);
684
+ /** @type {string|undefined} */
685
+ let locale;
686
+ for (const strat of strategies) {
687
+ if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
688
+ const cookiePrefix = cookieName + "=";
689
+ locale = request.headers
690
+ .get("cookie")
691
+ ?.split(";")
692
+ .map((c) => c.trim())
693
+ .find((c) => c.startsWith(cookiePrefix))
694
+ ?.slice(cookiePrefix.length);
695
+ }
696
+ else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url") {
697
+ locale = extractLocaleFromUrl(effectiveRequestUrl);
698
+ }
699
+ else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED &&
700
+ strat === "preferredLanguage") {
701
+ locale = extractLocaleFromHeader(request);
702
+ }
703
+ else if (strat === "globalVariable") {
704
+ locale = _locale;
705
+ }
706
+ else if (strat === "baseLocale") {
707
+ return baseLocale;
708
+ }
709
+ else if (strat === "localStorage") {
710
+ continue;
711
+ }
712
+ else if (isCustomStrategy(strat)) {
713
+ // Custom strategies are not supported in sync version
714
+ // Use extractLocaleFromRequestAsync for custom server strategies
715
+ continue;
716
+ }
717
+ const matchedLocale = toLocale(locale);
718
+ if (matchedLocale) {
719
+ return matchedLocale;
720
+ }
721
+ }
722
+ throw new Error("No locale found. There is an error in your strategy. Try adding 'baseLocale' as the very last strategy. Read more here https://paraglidejs.com/errors#no-locale-found");
723
+ };
724
+ /**
725
+ * @param {Request} request
726
+ * @param {string | URL | undefined} effectiveRequestUrl
727
+ * @returns {URL}
728
+ */
729
+ function resolveEffectiveRequestUrl(request, effectiveRequestUrl = request.url) {
730
+ if (effectiveRequestUrl instanceof URL) {
731
+ return new URL(effectiveRequestUrl.href);
732
+ }
733
+ return new URL(effectiveRequestUrl, request.url);
734
+ }
735
+
736
+ /**
737
+ * Asynchronously extracts a locale from a request.
738
+ *
739
+ * This function supports async custom server strategies, unlike the synchronous
740
+ * `extractLocaleFromRequest`. Use this function when you have custom server strategies
741
+ * that need to perform asynchronous operations (like database calls) in their getLocale method.
742
+ *
743
+ * The function first processes any custom server strategies asynchronously, then falls back
744
+ * to the synchronous `extractLocaleFromRequest` for all other strategies.
745
+ *
746
+ * @see {@link https://github.com/opral/inlang-paraglide-js/issues/527#issuecomment-2978151022}
747
+ *
748
+ * @example
749
+ * // Basic usage
750
+ * const locale = await extractLocaleFromRequestAsync(request);
751
+ *
752
+ * @example
753
+ * // With custom async server strategy
754
+ * defineCustomServerStrategy("custom-database", {
755
+ * getLocale: async (request) => {
756
+ * const userId = extractUserIdFromRequest(request);
757
+ * return await getUserLocaleFromDatabase(userId);
758
+ * }
759
+ * });
760
+ *
761
+ * const locale = await extractLocaleFromRequestAsync(request);
762
+ *
763
+ * @param {Request} request - The request object to extract the locale from.
764
+ * @param {{ effectiveRequestUrl?: string | URL }} [options] - Effective request URL to use for route matching and locale detection with the URL strategy.
765
+ * @returns {Promise<Locale>} The extracted locale.
766
+ */
767
+ export const extractLocaleFromRequestAsync = async (request, options = {}) => {
768
+ /** @type {string|undefined} */
769
+ let locale;
770
+ const effectiveRequestUrl = resolveEffectiveRequestUrlFromRequestAsync(request, options.effectiveRequestUrl);
771
+ const strategy = getStrategyForUrl(effectiveRequestUrl);
772
+ // Process custom strategies first, in order
773
+ for (const strat of strategy) {
774
+ if (isCustomStrategy(strat) && customServerStrategies.has(strat)) {
775
+ const handler = customServerStrategies.get(strat);
776
+ if (handler) {
777
+ /** @type {string|undefined} */
778
+ locale = await handler.getLocale(request);
779
+ }
780
+ // If we got a valid locale from this custom strategy, use it
781
+ const matchedLocale = toLocale(locale);
782
+ if (matchedLocale) {
783
+ return matchedLocale;
784
+ }
785
+ }
786
+ }
787
+ // If no custom strategy provided a valid locale, fall back to sync version
788
+ return extractLocaleFromRequestWithStrategies(request, strategy, effectiveRequestUrl);
789
+ };
790
+ /**
791
+ * @param {Request} request
792
+ * @param {string | URL | undefined} effectiveRequestUrl
793
+ * @returns {URL}
794
+ */
795
+ function resolveEffectiveRequestUrlFromRequestAsync(request, effectiveRequestUrl = request.url) {
796
+ if (effectiveRequestUrl instanceof URL) {
797
+ return new URL(effectiveRequestUrl.href);
798
+ }
799
+ return new URL(effectiveRequestUrl, request.url);
800
+ }
801
+
802
+ const cookieNamePattern = cookieName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
803
+ const localeCookiePattern = new RegExp(`(?:^|;\\s*)${cookieNamePattern}=([^;]*)`);
804
+ const noCachedLocale = Symbol();
805
+ /** @type {Locale | undefined | typeof noCachedLocale} */
806
+ let cachedLocaleFromCookie = noCachedLocale;
807
+ /**
808
+ * Clears the cached locale from `document.cookie`.
809
+ */
810
+ function clearLocaleCookieCache() {
811
+ cachedLocaleFromCookie = noCachedLocale;
812
+ }
813
+ function scheduleLocaleCookieCacheClear() {
814
+ if (typeof queueMicrotask === "function") {
815
+ queueMicrotask(clearLocaleCookieCache);
816
+ }
817
+ else {
818
+ Promise.resolve().then(clearLocaleCookieCache);
819
+ }
820
+ }
821
+ /**
822
+ * Extracts a cookie from the document.
823
+ *
824
+ * Will return undefined if the document is not available or if the cookie is not set.
825
+ * The `document` object is not available in server-side rendering, so this function should not be called in that context.
826
+ *
827
+ * @returns {Locale | undefined}
828
+ */
829
+ export function extractLocaleFromCookie() {
830
+ if (typeof document === "undefined") {
831
+ return;
832
+ }
833
+ if (cachedLocaleFromCookie !== noCachedLocale) {
834
+ return cachedLocaleFromCookie;
835
+ }
836
+ const match = document.cookie.match(localeCookiePattern);
837
+ const locale = match?.[1];
838
+ cachedLocaleFromCookie = toLocale(locale);
839
+ scheduleLocaleCookieCacheClear();
840
+ return cachedLocaleFromCookie;
841
+ }
842
+
843
+ /**
844
+ * Extracts a locale from the accept-language header.
845
+ *
846
+ * Use the function on the server to extract the locale
847
+ * from the accept-language header that is sent by the client.
848
+ *
849
+ * @example
850
+ * const locale = extractLocaleFromHeader(request);
851
+ *
852
+ * @param {Request} request - The request object to extract the locale from.
853
+ * @returns {Locale | undefined} The negotiated preferred language.
854
+ */
855
+ export function extractLocaleFromHeader(request) {
856
+ const acceptLanguageHeader = request.headers.get("accept-language");
857
+ if (acceptLanguageHeader) {
858
+ // Parse language preferences with their q-values and base language codes
859
+ const languages = acceptLanguageHeader
860
+ .split(",")
861
+ .map((lang) => {
862
+ const [tag, q = "1"] = lang.trim().split(";q=");
863
+ // Get both the full tag and base language code
864
+ const baseTag = tag?.split("-")[0];
865
+ return {
866
+ fullTag: tag,
867
+ baseTag,
868
+ q: Number(q),
869
+ };
870
+ })
871
+ .sort((a, b) => b.q - a.q);
872
+ for (const lang of languages) {
873
+ const fullLocale = toLocale(lang.fullTag);
874
+ if (fullLocale) {
875
+ return fullLocale;
876
+ }
877
+ const baseLocale = toLocale(lang.baseTag);
878
+ if (baseLocale) {
879
+ return baseLocale;
880
+ }
881
+ }
882
+ return undefined;
883
+ }
884
+ return undefined;
885
+ }
886
+
887
+ /**
888
+ * Negotiates a preferred language from navigator.languages.
889
+ *
890
+ * Use the function on the client to extract the locale
891
+ * from the navigator.languages array.
892
+ *
893
+ * @example
894
+ * const locale = extractLocaleFromNavigator();
895
+ *
896
+ * @returns {Locale | undefined}
897
+ */
898
+ export function extractLocaleFromNavigator() {
899
+ if (!navigator?.languages?.length) {
900
+ return undefined;
901
+ }
902
+ const languages = navigator.languages.map((lang) => ({
903
+ fullTag: lang,
904
+ baseTag: lang.split("-")[0],
905
+ }));
906
+ for (const lang of languages) {
907
+ const fullLocale = toLocale(lang.fullTag);
908
+ if (fullLocale) {
909
+ return fullLocale;
910
+ }
911
+ const baseLocale = toLocale(lang.baseTag);
912
+ if (baseLocale) {
913
+ return baseLocale;
914
+ }
915
+ }
916
+ return undefined;
917
+ }
918
+
919
+ /**
920
+ * If extractLocaleFromUrl is called many times on the same page and the URL
921
+ * hasn't changed, we don't need to recompute it every time which can get expensive.
922
+ * We might use a LRU cache if needed, but for now storing only the last result is enough.
923
+ * https://github.com/opral/monorepo/pull/3575#discussion_r2066731243
924
+ */
925
+ /** @type {string|undefined} */
926
+ let cachedUrl;
927
+ /** @type {Locale|undefined} */
928
+ let cachedLocale;
929
+ /**
930
+ * Extracts the locale from a given URL using native URLPattern.
931
+ *
932
+ * The built-in default `/:locale/...` routing is case-insensitive because it
933
+ * canonicalizes the first path segment with `toLocale()`. Custom `urlPatterns`
934
+ * keep URLPattern's normal exact matching semantics for path segments.
935
+ *
936
+ * @param {URL|string} url - The full URL from which to extract the locale.
937
+ * @returns {Locale|undefined} The extracted locale, or undefined if no locale is found.
938
+ */
939
+ export function extractLocaleFromUrl(url) {
940
+ const urlString = typeof url === "string" ? url : url.href;
941
+ if (cachedUrl === urlString) {
942
+ return cachedLocale;
943
+ }
944
+ /** @type {Locale | undefined} */
945
+ let result;
946
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
947
+ const urlObj = typeof url === "string"
948
+ ? new URL(url, "http://example.com")
949
+ : new URL(url);
950
+ result = defaultUrlPatternExtractLocale(normalizeTrailingSlash(urlObj));
951
+ }
952
+ else {
953
+ const urlObj = normalizeTrailingSlash(typeof url === "string" ? new URL(url) : new URL(url));
954
+ // Iterate over URL patterns
955
+ for (const element of urlPatterns) {
956
+ for (const [locale, localizedPattern] of element.localized) {
957
+ const match = execUrlPattern(new URLPattern(localizedPattern, urlObj.href), urlObj);
958
+ if (match) {
959
+ result = locale;
960
+ break;
961
+ }
962
+ }
963
+ if (result)
964
+ break;
965
+ }
966
+ }
967
+ cachedUrl = urlString;
968
+ cachedLocale = result;
969
+ return result;
970
+ }
971
+ /**
972
+ * https://github.com/opral/inlang-paraglide-js/issues/381
973
+ *
974
+ * @param {URL | string} url - The full URL from which to extract the locale.
975
+ * @returns {Locale | undefined} The extracted locale, or undefined if no locale is found.
976
+ */
977
+ function defaultUrlPatternExtractLocale(url) {
978
+ const urlObj = new URL(url, "http://example.com");
979
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
980
+ return toLocale(pathSegments[0]) || baseLocale;
981
+ }
982
+
983
+ /**
984
+ * Lower-level URL localization function, primarily used in server contexts.
985
+ *
986
+ * This function is designed for server-side usage where you need precise control
987
+ * over URL localization, such as in middleware or request handlers. It works with
988
+ * URL objects and always returns absolute URLs.
989
+ *
990
+ * For client-side UI components, use `localizeHref()` instead, which provides
991
+ * a more convenient API with relative paths and automatic locale detection.
992
+ *
993
+ * @see https://paraglidejs.com/i18n-routing
994
+ *
995
+ * @example
996
+ * ```typescript
997
+ * // Server middleware example
998
+ * app.use((req, res, next) => {
999
+ * const url = new URL(req.url, `${req.protocol}://${req.headers.host}`);
1000
+ * const localized = localizeUrl(url, { locale: "de" });
1001
+ *
1002
+ * if (localized.href !== url.href) {
1003
+ * return res.redirect(localized.href);
1004
+ * }
1005
+ * next();
1006
+ * });
1007
+ * ```
1008
+ *
1009
+ * @example
1010
+ * ```typescript
1011
+ * // Using with URL patterns
1012
+ * const url = new URL("https://example.com/about");
1013
+ * localizeUrl(url, { locale: "de" });
1014
+ * // => URL("https://example.com/de/about")
1015
+ *
1016
+ * // Using with domain-based localization
1017
+ * const url = new URL("https://example.com/store");
1018
+ * localizeUrl(url, { locale: "de" });
1019
+ * // => URL("https://de.example.com/store")
1020
+ * ```
1021
+ *
1022
+ * @param {string | URL} url - The URL to localize. If string, must be absolute.
1023
+ * @param {object} [options] - Options for localization
1024
+ * @param {Locale} [options.locale] - Target locale. If not provided, uses getLocale()
1025
+ * @returns {URL} The localized URL, always absolute
1026
+ */
1027
+ export function localizeUrl(url, options) {
1028
+ const targetLocale = options?.locale
1029
+ ? assertIsLocale(options?.locale)
1030
+ : getLocale();
1031
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
1032
+ return localizeUrlDefaultPattern(url, targetLocale);
1033
+ }
1034
+ const originalUrl = typeof url === "string" ? new URL(url) : url;
1035
+ const urlObj = trailingSlash === undefined
1036
+ ? originalUrl
1037
+ : normalizeTrailingSlash(new URL(originalUrl));
1038
+ // Iterate over URL patterns
1039
+ for (const element of urlPatterns) {
1040
+ // Most applications use a locale prefix (and sometimes a fixed domain)
1041
+ // with a trailing catch-all path. Those routes do not need URLPattern's
1042
+ // parser or matcher on every call. Keep the generic matcher below as the
1043
+ // fallback for every other URLPattern shape. This stays inside the outer
1044
+ // loop so specific patterns retain precedence over a later catch-all.
1045
+ const fastPathLocalized = localizeUrlFastPath(urlObj, targetLocale, element);
1046
+ if (fastPathLocalized !== undefined) {
1047
+ return fastPathLocalized;
1048
+ }
1049
+ // match localized patterns
1050
+ for (const [, localizedPattern] of element.localized) {
1051
+ const match = execUrlPattern(getUrlPattern(localizedPattern, urlObj), urlObj);
1052
+ if (!match) {
1053
+ continue;
1054
+ }
1055
+ const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
1056
+ if (!targetPattern) {
1057
+ continue;
1058
+ }
1059
+ const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
1060
+ return normalizeTrailingSlash(fillMissingUrlParts(localizedUrl, match));
1061
+ }
1062
+ const unlocalizedMatch = execUrlPattern(getUrlPattern(element.pattern, urlObj), urlObj);
1063
+ if (unlocalizedMatch) {
1064
+ const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
1065
+ if (targetPattern) {
1066
+ const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
1067
+ return normalizeTrailingSlash(fillMissingUrlParts(localizedUrl, unlocalizedMatch));
1068
+ }
1069
+ }
1070
+ }
1071
+ // If no match found, return the original URL
1072
+ return originalUrl;
1073
+ }
1074
+ /**
1075
+ * https://github.com/opral/inlang-paraglide-js/issues/381
1076
+ *
1077
+ * @param {string | URL} url
1078
+ * @param {Locale} locale
1079
+ * @returns {URL}
1080
+ */
1081
+ function localizeUrlDefaultPattern(url, locale) {
1082
+ const urlObj = normalizeTrailingSlash(typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url));
1083
+ const currentLocale = extractLocaleFromUrl(urlObj);
1084
+ // If current locale matches target locale, no change needed
1085
+ if (currentLocale === locale) {
1086
+ return normalizeTrailingSlash(urlObj);
1087
+ }
1088
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
1089
+ // If current path starts with a locale, remove it
1090
+ if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
1091
+ pathSegments.shift();
1092
+ }
1093
+ // For base locale, don't add prefix
1094
+ if (locale === baseLocale) {
1095
+ urlObj.pathname = "/" + pathSegments.join("/");
1096
+ }
1097
+ else {
1098
+ // For other locales, add prefix
1099
+ urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
1100
+ }
1101
+ return normalizeTrailingSlash(urlObj);
1102
+ }
1103
+ /**
1104
+ * Low-level URL de-localization function, primarily used in server contexts.
1105
+ *
1106
+ * This function is designed for server-side usage where you need precise control
1107
+ * over URL de-localization, such as in middleware or request handlers. It works with
1108
+ * URL objects and always returns absolute URLs.
1109
+ *
1110
+ * For client-side UI components, use `deLocalizeHref()` instead, which provides
1111
+ * a more convenient API with relative paths.
1112
+ *
1113
+ * @see https://paraglidejs.com/i18n-routing
1114
+ *
1115
+ * @example
1116
+ * ```typescript
1117
+ * // Server middleware example
1118
+ * app.use((req, res, next) => {
1119
+ * const url = new URL(req.url, `${req.protocol}://${req.headers.host}`);
1120
+ * const baseUrl = deLocalizeUrl(url);
1121
+ *
1122
+ * // Store the base URL for later use
1123
+ * req.baseUrl = baseUrl;
1124
+ * next();
1125
+ * });
1126
+ * ```
1127
+ *
1128
+ * @example
1129
+ * ```typescript
1130
+ * // Using with URL patterns
1131
+ * const url = new URL("https://example.com/de/about");
1132
+ * deLocalizeUrl(url); // => URL("https://example.com/about")
1133
+ *
1134
+ * // Using with domain-based localization
1135
+ * const url = new URL("https://de.example.com/store");
1136
+ * deLocalizeUrl(url); // => URL("https://example.com/store")
1137
+ * ```
1138
+ *
1139
+ * @param {string | URL} url - The URL to de-localize. If string, must be absolute.
1140
+ * @returns {URL} The de-localized URL, always absolute
1141
+ */
1142
+ export function deLocalizeUrl(url) {
1143
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
1144
+ return deLocalizeUrlDefaultPattern(url);
1145
+ }
1146
+ const originalUrl = typeof url === "string" ? new URL(url) : url;
1147
+ const urlObj = trailingSlash === undefined
1148
+ ? originalUrl
1149
+ : normalizeTrailingSlash(new URL(originalUrl));
1150
+ // Iterate over URL patterns
1151
+ for (const element of urlPatterns) {
1152
+ const fastPathDeLocalized = deLocalizeUrlFastPath(urlObj, element);
1153
+ if (fastPathDeLocalized !== undefined) {
1154
+ return fastPathDeLocalized;
1155
+ }
1156
+ // Iterate over localized versions
1157
+ for (const [, localizedPattern] of element.localized) {
1158
+ const match = execUrlPattern(getUrlPattern(localizedPattern, urlObj), urlObj);
1159
+ if (match) {
1160
+ // Convert localized URL back to the base pattern
1161
+ const groups = aggregateGroups(match);
1162
+ const baseUrl = fillPattern(element.pattern, groups, urlObj.origin);
1163
+ return normalizeTrailingSlash(fillMissingUrlParts(baseUrl, match));
1164
+ }
1165
+ }
1166
+ // match unlocalized pattern
1167
+ const unlocalizedMatch = execUrlPattern(getUrlPattern(element.pattern, urlObj), urlObj);
1168
+ if (unlocalizedMatch) {
1169
+ const baseUrl = fillPattern(element.pattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
1170
+ return normalizeTrailingSlash(fillMissingUrlParts(baseUrl, unlocalizedMatch));
1171
+ }
1172
+ }
1173
+ // no match found return the original url
1174
+ return originalUrl;
1175
+ }
1176
+ /**
1177
+ * De-localizes a URL using the default pattern (/:locale/*)
1178
+ * @param {string|URL} url
1179
+ * @returns {URL}
1180
+ */
1181
+ function deLocalizeUrlDefaultPattern(url) {
1182
+ const urlObj = normalizeTrailingSlash(typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url));
1183
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
1184
+ // If first segment is a locale, remove it
1185
+ if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
1186
+ urlObj.pathname = "/" + pathSegments.slice(1).join("/");
1187
+ }
1188
+ return normalizeTrailingSlash(urlObj);
1189
+ }
1190
+ /**
1191
+ * Takes matches of implicit wildcards in the UrlPattern (when a part is missing
1192
+ * it is equal to '*') and adds them back to the result of fillPattern.
1193
+ *
1194
+ * At least protocol and hostname are required to create a valid URL inside fillPattern.
1195
+ *
1196
+ * @param {URL} url
1197
+ * @param {any} match
1198
+ * @returns {URL}
1199
+ */
1200
+ function fillMissingUrlParts(url, match) {
1201
+ if (match.protocol.groups["0"]) {
1202
+ url.protocol = match.protocol.groups["0"] ?? "";
1203
+ }
1204
+ if (match.hostname.groups["0"]) {
1205
+ url.hostname = match.hostname.groups["0"] ?? "";
1206
+ }
1207
+ if (match.username.groups["0"]) {
1208
+ url.username = match.username.groups["0"] ?? "";
1209
+ }
1210
+ if (match.password.groups["0"]) {
1211
+ url.password = match.password.groups["0"] ?? "";
1212
+ }
1213
+ if (match.port.groups["0"]) {
1214
+ url.port = match.port.groups["0"] ?? "";
1215
+ }
1216
+ if (match.pathname.groups["0"]) {
1217
+ url.pathname = match.pathname.groups["0"] ?? "";
1218
+ }
1219
+ if (match.search.groups["0"]) {
1220
+ url.search = match.search.groups["0"] ?? "";
1221
+ }
1222
+ if (match.hash.groups["0"]) {
1223
+ url.hash = match.hash.groups["0"] ?? "";
1224
+ }
1225
+ return url;
1226
+ }
1227
+ /**
1228
+ * Fills a URL pattern with values for named groups, supporting all URLPattern-style modifiers.
1229
+ *
1230
+ * This function will eventually be replaced by https://github.com/whatwg/urlpattern/issues/73
1231
+ *
1232
+ * Matches:
1233
+ * - :name -> Simple
1234
+ * - :name? -> Optional
1235
+ * - :name+ -> One or more
1236
+ * - :name* -> Zero or more
1237
+ * - :name(...) -> Regex group
1238
+ * - {text} -> Group delimiter
1239
+ * - {text}? -> Optional group delimiter
1240
+ *
1241
+ * If the value is `null`, the segment is removed.
1242
+ *
1243
+ * @param {string} pattern - The URL pattern containing named groups.
1244
+ * @param {Record<string, string | null | undefined>} values - Object of values for named groups.
1245
+ * @param {string} origin - Base URL to use for URL construction.
1246
+ * @returns {URL} - The constructed URL with named groups filled.
1247
+ */
1248
+ function fillPattern(pattern, values, origin) {
1249
+ // Pre-process the pattern to handle explicit port numbers
1250
+ // This detects patterns like "http://localhost:5173" and protects the port number
1251
+ // from being interpreted as a parameter
1252
+ let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
1253
+ // Replace ":5173" with "#PORT-5173#" to protect it from parameter replacement
1254
+ return `${protocol}#PORT-${port}#${slash}`;
1255
+ });
1256
+ // First, handle group delimiters with curly braces
1257
+ let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
1258
+ // For optional group delimiters
1259
+ if (modifier === "?") {
1260
+ // For optional groups, we'll include the content
1261
+ return content;
1262
+ }
1263
+ // For non-optional group delimiters, always include the content
1264
+ return content;
1265
+ });
1266
+ // Then handle named groups
1267
+ let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
1268
+ const value = values[name];
1269
+ if (value === null) {
1270
+ // If value is null, remove the entire segment including the preceding slash
1271
+ return "";
1272
+ }
1273
+ if (modifier === "?") {
1274
+ // Optional segment
1275
+ return value !== undefined ? `${slash}${value}` : "";
1276
+ }
1277
+ if (modifier === "+" || modifier === "*") {
1278
+ // Repeatable segments
1279
+ if (value === undefined && modifier === "+") {
1280
+ throw new Error(`Missing value for "${name}" (one or more required)`);
1281
+ }
1282
+ return value ? `${slash}${value}` : "";
1283
+ }
1284
+ // Simple named group (no modifier)
1285
+ if (value === undefined) {
1286
+ throw new Error(`Missing value for "${name}"`);
1287
+ }
1288
+ return `${slash}${value}`;
1289
+ });
1290
+ // Restore port numbers
1291
+ filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
1292
+ return new URL(filled, origin);
1293
+ }
1294
+ /**
1295
+ * Aggregates named groups from various parts of the URLPattern match result.
1296
+ *
1297
+ *
1298
+ * @param {any} match - The URLPattern match result object.
1299
+ * @returns {Record<string, string | null | undefined>} An object containing all named groups from the match.
1300
+ */
1301
+ export function aggregateGroups(match) {
1302
+ return {
1303
+ ...match.hash.groups,
1304
+ ...match.hostname.groups,
1305
+ ...match.password.groups,
1306
+ ...match.pathname.groups,
1307
+ ...match.port.groups,
1308
+ ...match.protocol.groups,
1309
+ ...match.search.groups,
1310
+ ...match.username.groups,
1311
+ };
1312
+ }
1313
+ /** @type {Map<string, URLPattern>} */
1314
+ const urlPatternCache = new Map();
1315
+ const URL_PATTERN_CACHE_LIMIT = 128;
1316
+ const ABSOLUTE_URL_PATTERN = /^(?:[A-Za-z][A-Za-z\d+.-]*|:[A-Za-z][A-Za-z\d_-]*):\/\//;
1317
+ /**
1318
+ * URLPattern's base URL affects relative patterns. Absolute patterns only
1319
+ * depend on the pattern itself, while root-relative patterns also depend on
1320
+ * the URL origin. Other relative patterns are deliberately not cached because
1321
+ * their semantics depend on the complete base URL.
1322
+ *
1323
+ * @param {string} pattern
1324
+ * @param {URL} url
1325
+ * @returns {URLPattern}
1326
+ */
1327
+ function getUrlPattern(pattern, url) {
1328
+ const isAbsolutePattern = ABSOLUTE_URL_PATTERN.test(pattern);
1329
+ const isRootRelativePattern = pattern.startsWith("/");
1330
+ if (!isAbsolutePattern && !isRootRelativePattern) {
1331
+ return new URLPattern(pattern, url.href);
1332
+ }
1333
+ const key = isAbsolutePattern
1334
+ ? pattern
1335
+ : JSON.stringify([url.origin, pattern]);
1336
+ const cached = urlPatternCache.get(key);
1337
+ if (cached !== undefined) {
1338
+ // Refresh the entry so frequently used patterns stay in the bounded cache.
1339
+ urlPatternCache.delete(key);
1340
+ urlPatternCache.set(key, cached);
1341
+ return cached;
1342
+ }
1343
+ const compiled = new URLPattern(pattern, url.href);
1344
+ if (urlPatternCache.size >= URL_PATTERN_CACHE_LIMIT) {
1345
+ const oldestKey = urlPatternCache.keys().next().value;
1346
+ if (oldestKey !== undefined)
1347
+ urlPatternCache.delete(oldestKey);
1348
+ }
1349
+ urlPatternCache.set(key, compiled);
1350
+ return compiled;
1351
+ }
1352
+ /**
1353
+ * A small, deliberately conservative subset of URLPattern routing.
1354
+ *
1355
+ * The compiler emits routes such as `/:path(.*)?`, `/de/:path*`, or
1356
+ * `https://example.com/:path*`. For those routes matching is equivalent to a
1357
+ * pathname prefix check and (optionally) an origin check. Everything that has
1358
+ * a dynamic host, a custom path regexp, or another URLPattern modifier keeps
1359
+ * using the generic implementation above.
1360
+ *
1361
+ * @typedef {{
1362
+ * protocol: string | undefined;
1363
+ * hostname: string | undefined;
1364
+ * port: string | undefined;
1365
+ * pathnamePrefix: string;
1366
+ * pathMode: "segments" | "catch-all-optional" | "catch-all-required";
1367
+ * }} FastPathPattern
1368
+ * @typedef {{
1369
+ * base: FastPathPattern;
1370
+ * localized: Array<{ locale: string; pattern: FastPathPattern }>;
1371
+ * }} FastPathRoute
1372
+ */
1373
+ /** @type {WeakMap<object, FastPathRoute | null>} */
1374
+ const fastPathRouteCache = new WeakMap();
1375
+ /**
1376
+ * @param {URL} urlObj
1377
+ * @param {string} targetLocale
1378
+ * @param {{ pattern: string; localized: Array<[string, string]> }} element
1379
+ * @returns {URL | undefined}
1380
+ */
1381
+ function localizeUrlFastPath(urlObj, targetLocale, element) {
1382
+ const route = getFastPathRoute(element);
1383
+ if (route === null)
1384
+ return undefined;
1385
+ // Preserve URLPattern's ordering: localized patterns are checked before
1386
+ // the unlocalized pattern, and the first matching pattern wins.
1387
+ for (const localized of route.localized) {
1388
+ const suffix = matchFastPathPattern(localized.pattern, urlObj);
1389
+ if (suffix === undefined)
1390
+ continue;
1391
+ const target = route.localized.find((candidate) => candidate.locale === targetLocale)?.pattern;
1392
+ if (target === undefined)
1393
+ continue;
1394
+ return applyFastPathPattern(target, suffix, urlObj);
1395
+ }
1396
+ const suffix = matchFastPathPattern(route.base, urlObj);
1397
+ if (suffix !== undefined) {
1398
+ const target = route.localized.find((candidate) => candidate.locale === targetLocale)?.pattern;
1399
+ if (target !== undefined) {
1400
+ return applyFastPathPattern(target, suffix, urlObj);
1401
+ }
1402
+ }
1403
+ return undefined;
1404
+ }
1405
+ /**
1406
+ * @param {URL} urlObj
1407
+ * @param {{ pattern: string; localized: Array<[string, string]> }} element
1408
+ * @returns {URL | undefined}
1409
+ */
1410
+ function deLocalizeUrlFastPath(urlObj, element) {
1411
+ const route = getFastPathRoute(element);
1412
+ if (route === null)
1413
+ return undefined;
1414
+ for (const localized of route.localized) {
1415
+ const suffix = matchFastPathPattern(localized.pattern, urlObj);
1416
+ if (suffix !== undefined) {
1417
+ return applyFastPathPattern(route.base, suffix, urlObj);
1418
+ }
1419
+ }
1420
+ const suffix = matchFastPathPattern(route.base, urlObj);
1421
+ if (suffix !== undefined) {
1422
+ return applyFastPathPattern(route.base, suffix, urlObj);
1423
+ }
1424
+ return undefined;
1425
+ }
1426
+ /**
1427
+ * @param {{ pattern: string; localized: Array<[string, string]> }} element
1428
+ * @returns {FastPathRoute | null}
1429
+ */
1430
+ function getFastPathRoute(element) {
1431
+ const cached = fastPathRouteCache.get(element);
1432
+ if (cached !== undefined)
1433
+ return cached;
1434
+ const base = parseFastPathPattern(element.pattern);
1435
+ if (base === undefined) {
1436
+ fastPathRouteCache.set(element, null);
1437
+ return null;
1438
+ }
1439
+ const localized = [];
1440
+ for (const [locale, pattern] of element.localized) {
1441
+ const parsed = parseFastPathPattern(pattern);
1442
+ if (parsed === undefined || parsed.pathMode !== base.pathMode) {
1443
+ fastPathRouteCache.set(element, null);
1444
+ return null;
1445
+ }
1446
+ localized.push({ locale, pattern: parsed });
1447
+ }
1448
+ const route = { base, localized };
1449
+ fastPathRouteCache.set(element, route);
1450
+ return route;
1451
+ }
1452
+ /**
1453
+ * Parse only catch-all path patterns. In particular, do not treat `:path(.)?`
1454
+ * as a catch-all: URLPattern's `(.)` means exactly one character and cannot be
1455
+ * represented by this prefix matcher without changing routing semantics.
1456
+ *
1457
+ * @param {string} pattern
1458
+ * @returns {FastPathPattern | undefined}
1459
+ */
1460
+ function parseFastPathPattern(pattern) {
1461
+ const wildcard = pattern.match(/\/:path(?:\(\.\*\)(?:\?)?|\*)$/);
1462
+ if (wildcard === null || wildcard.index === undefined)
1463
+ return undefined;
1464
+ const prefix = pattern.slice(0, wildcard.index);
1465
+ const originAndPath = parseFastPathOriginAndPath(prefix);
1466
+ if (originAndPath === undefined)
1467
+ return undefined;
1468
+ const pathMode = wildcard[0].endsWith("*")
1469
+ ? "segments"
1470
+ : wildcard[0].endsWith("?")
1471
+ ? "catch-all-optional"
1472
+ : "catch-all-required";
1473
+ return { ...originAndPath, pathMode };
1474
+ }
1475
+ /**
1476
+ * @param {string} prefix
1477
+ * @returns {FastPathPattern | undefined}
1478
+ */
1479
+ function parseFastPathOriginAndPath(prefix) {
1480
+ if (prefix === "" || prefix.startsWith("/")) {
1481
+ if (hasUrlPatternSyntax(prefix))
1482
+ return undefined;
1483
+ return {
1484
+ protocol: undefined,
1485
+ hostname: undefined,
1486
+ port: undefined,
1487
+ pathnamePrefix: normalizePathPrefix(prefix),
1488
+ pathMode: "catch-all-optional",
1489
+ };
1490
+ }
1491
+ // A `:protocol://host` pattern is common in generated configurations. The
1492
+ // protocol is intentionally left unconstrained, just like URLPattern.
1493
+ const dynamicProtocol = prefix.match(/^:protocol:\/\/([^/]+)(\/.*)?$/);
1494
+ const staticOrigin = prefix.match(/^([A-Za-z][A-Za-z\d+.-]*):\/\/([^/]+)(\/.*)?$/);
1495
+ if (dynamicProtocol !== null) {
1496
+ const dynamicHost = dynamicProtocol[1] ?? "";
1497
+ const hostMatch = dynamicHost.match(/^([^:(){}?*+]+)(?::(\d+))?$/);
1498
+ if (hostMatch === null ||
1499
+ (dynamicProtocol[2] !== undefined &&
1500
+ hasUrlPatternSyntax(dynamicProtocol[2]))) {
1501
+ return undefined;
1502
+ }
1503
+ return {
1504
+ protocol: undefined,
1505
+ hostname: (hostMatch[1] ?? "").toLowerCase(),
1506
+ port: hostMatch[2],
1507
+ pathnamePrefix: normalizePathPrefix(dynamicProtocol[2] ?? ""),
1508
+ pathMode: "catch-all-optional",
1509
+ };
1510
+ }
1511
+ if (staticOrigin === null)
1512
+ return undefined;
1513
+ const host = staticOrigin[2] ?? "";
1514
+ const pathname = staticOrigin[3];
1515
+ const hostMatch = host.match(/^([^:(){}?*+]+)(?::(\d+))?$/);
1516
+ if (hostMatch === null ||
1517
+ (pathname !== undefined && hasUrlPatternSyntax(pathname))) {
1518
+ return undefined;
1519
+ }
1520
+ return {
1521
+ protocol: `${staticOrigin[1]}:`,
1522
+ hostname: (hostMatch[1] ?? "").toLowerCase(),
1523
+ port: normalizePatternPort(hostMatch[2], `${staticOrigin[1]}:`),
1524
+ pathnamePrefix: normalizePathPrefix(pathname ?? ""),
1525
+ pathMode: "catch-all-optional",
1526
+ };
1527
+ }
1528
+ /**
1529
+ * @param {string | undefined} port
1530
+ * @param {string} protocol
1531
+ * @returns {string | undefined}
1532
+ */
1533
+ function normalizePatternPort(port, protocol) {
1534
+ if (port === "80" && protocol === "http:")
1535
+ return "";
1536
+ if (port === "443" && protocol === "https:")
1537
+ return "";
1538
+ return port;
1539
+ }
1540
+ /**
1541
+ * @param {string} value
1542
+ * @returns {boolean}
1543
+ */
1544
+ function hasUrlPatternSyntax(value) {
1545
+ return /[:(){}?*+]/.test(value);
1546
+ }
1547
+ /**
1548
+ * @param {string} pathname
1549
+ * @returns {string}
1550
+ */
1551
+ function normalizePathPrefix(pathname) {
1552
+ if (pathname === "" || pathname === "/")
1553
+ return "/";
1554
+ return pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
1555
+ }
1556
+ /**
1557
+ * @param {FastPathPattern} pattern
1558
+ * @param {URL} urlObj
1559
+ * @returns {string | undefined}
1560
+ */
1561
+ function matchFastPathPattern(pattern, urlObj) {
1562
+ if (pattern.protocol !== undefined && pattern.protocol !== urlObj.protocol) {
1563
+ return undefined;
1564
+ }
1565
+ if (pattern.hostname !== undefined &&
1566
+ pattern.hostname !== urlObj.hostname.toLowerCase()) {
1567
+ return undefined;
1568
+ }
1569
+ if (pattern.hostname !== undefined) {
1570
+ const expectedPort = pattern.port ?? defaultPortForProtocol(pattern.protocol ?? urlObj.protocol);
1571
+ if (expectedPort !== urlObj.port)
1572
+ return undefined;
1573
+ }
1574
+ const prefix = pattern.pathnamePrefix;
1575
+ if (prefix === "/") {
1576
+ if (urlObj.pathname.startsWith("//"))
1577
+ return undefined;
1578
+ if (pattern.pathMode === "segments") {
1579
+ return isNonEmptyPathSegments(urlObj.pathname)
1580
+ ? urlObj.pathname
1581
+ : undefined;
1582
+ }
1583
+ return urlObj.pathname;
1584
+ }
1585
+ if (urlObj.pathname === prefix) {
1586
+ return pattern.pathMode === "catch-all-required" ? undefined : "";
1587
+ }
1588
+ if (urlObj.pathname.startsWith(`${prefix}/`)) {
1589
+ const suffix = urlObj.pathname.slice(prefix.length);
1590
+ if (suffix.startsWith("//"))
1591
+ return undefined;
1592
+ if (pattern.pathMode === "segments" &&
1593
+ !isNonEmptyPathSegments(suffix)) {
1594
+ return undefined;
1595
+ }
1596
+ return suffix;
1597
+ }
1598
+ return undefined;
1599
+ }
1600
+ /**
1601
+ * @param {string} pathname
1602
+ * @returns {boolean}
1603
+ */
1604
+ function isNonEmptyPathSegments(pathname) {
1605
+ return pathname.length > 1 && !pathname.endsWith("/") && !pathname.includes("//");
1606
+ }
1607
+ /**
1608
+ * URLPattern treats the default port as empty in URL instances.
1609
+ *
1610
+ * @param {string} protocol
1611
+ * @returns {string}
1612
+ */
1613
+ function defaultPortForProtocol(protocol) {
1614
+ if (protocol === "http:")
1615
+ return "";
1616
+ if (protocol === "https:")
1617
+ return "";
1618
+ return "";
1619
+ }
1620
+ /**
1621
+ * @param {FastPathPattern} pattern
1622
+ * @param {string} suffix
1623
+ * @param {URL} source
1624
+ * @returns {URL}
1625
+ */
1626
+ function applyFastPathPattern(pattern, suffix, source) {
1627
+ const localized = new URL(source.href);
1628
+ if (pattern.protocol !== undefined)
1629
+ localized.protocol = pattern.protocol;
1630
+ if (pattern.hostname !== undefined) {
1631
+ localized.hostname = pattern.hostname;
1632
+ localized.port =
1633
+ pattern.port ?? defaultPortForProtocol(localized.protocol);
1634
+ }
1635
+ localized.pathname = joinFastPathPrefix(pattern.pathnamePrefix, suffix);
1636
+ return localized;
1637
+ }
1638
+ /**
1639
+ * @param {string} prefix
1640
+ * @param {string} suffix
1641
+ * @returns {string}
1642
+ */
1643
+ function joinFastPathPrefix(prefix, suffix) {
1644
+ if (prefix === "/")
1645
+ return suffix === "" ? "/" : suffix;
1646
+ if (suffix === "")
1647
+ return prefix;
1648
+ return `${prefix}${suffix.startsWith("/") ? suffix : `/${suffix}`}`;
1649
+ }
1650
+
1651
+ /** @type {string | undefined} */
1652
+ let cachedRouteStrategyUrl;
1653
+ /** @type {{ match: string; strategy?: typeof strategy; exclude?: boolean } | undefined} */
1654
+ let cachedRouteStrategy;
1655
+ /**
1656
+ * Match route policy against both the public URL and its canonical URL.
1657
+ *
1658
+ * The function is deliberately separate from variables.js: configuration is
1659
+ * inert data, while canonicalization and route selection form a routing layer.
1660
+ *
1661
+ * @param {string | URL} url
1662
+ * @returns {{ match: string; strategy?: typeof strategy; exclude?: boolean } | undefined}
1663
+ */
1664
+ export function findMatchingRouteStrategy(url) {
1665
+ if (routeStrategies.length === 0) {
1666
+ return undefined;
1667
+ }
1668
+ const urlString = typeof url === "string" ? url : url.href;
1669
+ if (cachedRouteStrategyUrl === urlString) {
1670
+ return cachedRouteStrategy;
1671
+ }
1672
+ const publicUrl = normalizeTrailingSlash(new URL(urlString, "http://example.com"));
1673
+ const canonicalUrl = deLocalizeUrl(publicUrl);
1674
+ const candidateUrls = canonicalUrl.href === publicUrl.href
1675
+ ? [publicUrl]
1676
+ : [publicUrl, canonicalUrl];
1677
+ let match;
1678
+ for (const candidateUrl of candidateUrls) {
1679
+ for (const routeStrategy of routeStrategies) {
1680
+ const pattern = new URLPattern(routeStrategy.match, candidateUrl.href);
1681
+ if (execUrlPattern(pattern, candidateUrl)) {
1682
+ match = routeStrategy;
1683
+ break;
1684
+ }
1685
+ }
1686
+ if (match)
1687
+ break;
1688
+ }
1689
+ cachedRouteStrategyUrl = urlString;
1690
+ cachedRouteStrategy = match;
1691
+ return match;
1692
+ }
1693
+ /**
1694
+ * Returns the strategy to use for a specific URL.
1695
+ *
1696
+ * If no route strategy matches (or the matching rule is `exclude: true`),
1697
+ * the global strategy is returned.
1698
+ *
1699
+ * @param {string | URL} url
1700
+ * @returns {typeof strategy}
1701
+ */
1702
+ export function getStrategyForUrl(url) {
1703
+ const routeStrategy = findMatchingRouteStrategy(url);
1704
+ if (routeStrategy &&
1705
+ routeStrategy.exclude !== true &&
1706
+ Array.isArray(routeStrategy.strategy)) {
1707
+ return routeStrategy.strategy;
1708
+ }
1709
+ return strategy;
1710
+ }
1711
+ /**
1712
+ * Returns whether the given URL is excluded from middleware i18n processing.
1713
+ *
1714
+ * @param {string | URL} url
1715
+ * @returns {boolean}
1716
+ */
1717
+ export function isExcludedByRouteStrategy(url) {
1718
+ return findMatchingRouteStrategy(url)?.exclude === true;
1719
+ }
1720
+
1721
+ /**
1722
+ * @typedef {object} ShouldRedirectServerInput
1723
+ * @property {Request} request
1724
+ * @property {string | URL} [effectiveRequestUrl] - Effective request URL to use for route matching, locale detection with the URL strategy, and redirect targets.
1725
+ * @property {Locale} [locale]
1726
+ *
1727
+ * @typedef {object} ShouldRedirectClientInput
1728
+ * @property {undefined} [request]
1729
+ * @property {string | URL} [url]
1730
+ * @property {Locale} [locale]
1731
+ *
1732
+ * @typedef {ShouldRedirectServerInput | ShouldRedirectClientInput} ShouldRedirectInput
1733
+ *
1734
+ * @typedef {object} ShouldRedirectResult
1735
+ * @property {boolean} shouldRedirect - Indicates whether the consumer should perform a redirect.
1736
+ * @property {Locale} locale - Locale resolved using the configured strategies.
1737
+ * @property {URL | undefined} redirectUrl - Destination URL when a redirect is required.
1738
+ */
1739
+ /**
1740
+ * Determines whether a redirect is required to align the current URL with the active locale.
1741
+ *
1742
+ * This helper mirrors the logic that powers `paraglideMiddleware`, but works in both server
1743
+ * and client environments. It evaluates the configured strategies in order, computes the
1744
+ * canonical localized URL, and reports when the current URL does not match.
1745
+ *
1746
+ * When called in the browser without arguments, the current `window.location.href` is used.
1747
+ *
1748
+ * @see https://paraglidejs.com/i18n-routing#redirects
1749
+ *
1750
+ * @example
1751
+ * // Client side usage (e.g. TanStack Router beforeLoad hook)
1752
+ * async function beforeLoad({ location }) {
1753
+ * const decision = await shouldRedirect({ url: location.href });
1754
+ *
1755
+ * if (decision.shouldRedirect) {
1756
+ * throw redirect({ to: decision.redirectUrl.href });
1757
+ * }
1758
+ * }
1759
+ *
1760
+ * @example
1761
+ * // Server side usage with a Request
1762
+ * export async function handle(request) {
1763
+ * const decision = await shouldRedirect({ request });
1764
+ *
1765
+ * if (decision.shouldRedirect) {
1766
+ * return Response.redirect(decision.redirectUrl, 307);
1767
+ * }
1768
+ *
1769
+ * return render(request, decision.locale);
1770
+ * }
1771
+ *
1772
+ * @example
1773
+ * // Server side usage behind a proxy where request.url is not public-facing
1774
+ * export async function handle(request) {
1775
+ * const effectiveRequestUrl = new URL(request.url);
1776
+ * effectiveRequestUrl.protocol = "https:";
1777
+ * effectiveRequestUrl.host = "example.com";
1778
+ *
1779
+ * const decision = await shouldRedirect({
1780
+ * request,
1781
+ * effectiveRequestUrl,
1782
+ * });
1783
+ *
1784
+ * if (decision.shouldRedirect) {
1785
+ * return Response.redirect(decision.redirectUrl, 307);
1786
+ * }
1787
+ * }
1788
+ *
1789
+ * @param {ShouldRedirectInput} [input]
1790
+ * @returns {Promise<ShouldRedirectResult>}
1791
+ */
1792
+ export async function shouldRedirect(input = {}) {
1793
+ const currentUrl = resolveUrl(input);
1794
+ const locale = await resolveLocale(input, currentUrl);
1795
+ const strategy = getStrategyForUrl(currentUrl.href);
1796
+ if (isExcludedByRouteStrategy(currentUrl.href) || !strategy.includes("url")) {
1797
+ return { shouldRedirect: false, locale, redirectUrl: undefined };
1798
+ }
1799
+ const localizedUrl = localizeUrl(currentUrl.href, { locale });
1800
+ const shouldRedirectToLocalizedUrl = normalizeUrl(localizedUrl.href) !== normalizeUrl(currentUrl.href);
1801
+ return {
1802
+ shouldRedirect: shouldRedirectToLocalizedUrl,
1803
+ locale,
1804
+ redirectUrl: shouldRedirectToLocalizedUrl ? localizedUrl : undefined,
1805
+ };
1806
+ }
1807
+ /**
1808
+ * Resolves the locale either from the provided input or by using the configured strategies.
1809
+ *
1810
+ * @param {ShouldRedirectInput} input
1811
+ * @param {URL} currentUrl
1812
+ * @returns {Promise<Locale>}
1813
+ */
1814
+ async function resolveLocale(input, currentUrl) {
1815
+ const locale = toLocale(input.locale);
1816
+ if (locale) {
1817
+ return locale;
1818
+ }
1819
+ if (input.request) {
1820
+ return extractLocaleFromRequestAsync(input.request, {
1821
+ effectiveRequestUrl: currentUrl,
1822
+ });
1823
+ }
1824
+ if ("url" in input && typeof input.url !== "undefined") {
1825
+ return getLocaleForUrl(currentUrl.href);
1826
+ }
1827
+ return getLocale();
1828
+ }
1829
+ /**
1830
+ * Resolves the current URL from the provided input or runtime context.
1831
+ *
1832
+ * @param {ShouldRedirectInput} input
1833
+ * @returns {URL}
1834
+ */
1835
+ function resolveUrl(input) {
1836
+ if ("effectiveRequestUrl" in input &&
1837
+ input.effectiveRequestUrl instanceof URL) {
1838
+ return new URL(input.effectiveRequestUrl.href);
1839
+ }
1840
+ if ("effectiveRequestUrl" in input &&
1841
+ typeof input.effectiveRequestUrl === "string") {
1842
+ return new URL(input.effectiveRequestUrl, input.request ? input.request.url : getUrlOrigin());
1843
+ }
1844
+ if (input.request) {
1845
+ return new URL(input.request.url);
1846
+ }
1847
+ if ("url" in input && input.url instanceof URL) {
1848
+ return new URL(input.url.href);
1849
+ }
1850
+ if ("url" in input && typeof input.url === "string") {
1851
+ return new URL(input.url, getUrlOrigin());
1852
+ }
1853
+ if (typeof window !== "undefined" && window?.location?.href) {
1854
+ return new URL(window.location.href);
1855
+ }
1856
+ throw new Error("shouldRedirect() requires either a request, an absolute URL, or must run in a browser environment.");
1857
+ }
1858
+ /**
1859
+ * Normalize url for comparison by stripping the trailing slash.
1860
+ *
1861
+ * @param {string} url
1862
+ * @returns {string}
1863
+ */
1864
+ function normalizeUrl(url) {
1865
+ const urlObj = new URL(url);
1866
+ if (trailingSlash === undefined) {
1867
+ urlObj.pathname = urlObj.pathname.replace(/\/$/, "");
1868
+ }
1869
+ return urlObj.href;
1870
+ }
1871
+
1872
+ /**
1873
+ * High-level URL localization function optimized for client-side UI usage.
1874
+ *
1875
+ * This is a convenience wrapper around `localizeUrl()` that provides features
1876
+ * needed in UI:
1877
+ *
1878
+ * - Accepts relative paths (e.g., "/about")
1879
+ * - Returns relative paths when possible
1880
+ * - Automatically detects current locale if not specified
1881
+ * - Handles string input/output instead of URL objects
1882
+ *
1883
+ * @see https://paraglidejs.com/i18n-routing
1884
+ *
1885
+ * @example
1886
+ * ```typescript
1887
+ * // In a React/Vue/Svelte component
1888
+ * const NavLink = ({ href }) => {
1889
+ * // Automatically uses current locale, keeps path relative
1890
+ * return <a href={localizeHref(href)}>...</a>;
1891
+ * };
1892
+ *
1893
+ * // Examples:
1894
+ * localizeHref("/about")
1895
+ * // => "/de/about" (if current locale is "de")
1896
+ * localizeHref("/store", { locale: "fr" })
1897
+ * // => "/fr/store" (explicit locale)
1898
+ *
1899
+ * // Cross-origin links remain absolute
1900
+ * localizeHref("https://other-site.com/about")
1901
+ * // => "https://other-site.com/de/about"
1902
+ * ```
1903
+ *
1904
+ * For server-side URL localization (e.g., in middleware), use `localizeUrl()`
1905
+ * which provides more precise control over URL handling.
1906
+ *
1907
+ * @param {string} href - The href to localize (can be relative or absolute)
1908
+ * @param {object} [options] - Options for localization
1909
+ * @param {Locale} [options.locale] - Target locale. If not provided, uses `getLocale()`
1910
+ * @returns {string} The localized href, relative if input was relative
1911
+ */
1912
+ export function localizeHref(href, options) {
1913
+ const currentLocale = getLocale();
1914
+ const locale = options?.locale ?? currentLocale;
1915
+ const url = new URL(href, getUrlOrigin());
1916
+ const localized = localizeUrl(url, { locale });
1917
+ // if the origin is identical and the href is relative,
1918
+ // return the relative path
1919
+ if (href.startsWith("/") && url.origin === localized.origin) {
1920
+ // check for cross origin localization in which case an absolute URL must be returned.
1921
+ if (locale !== currentLocale) {
1922
+ const localizedCurrentLocale = localizeUrl(url, {
1923
+ locale: currentLocale,
1924
+ });
1925
+ if (localizedCurrentLocale.origin !== localized.origin) {
1926
+ return localized.href;
1927
+ }
1928
+ }
1929
+ return localized.pathname + localized.search + localized.hash;
1930
+ }
1931
+ return localized.href;
1932
+ }
1933
+ /**
1934
+ * High-level URL de-localization function optimized for client-side UI usage.
1935
+ *
1936
+ * This is a convenience wrapper around `deLocalizeUrl()` that provides features
1937
+ * needed in the UI:
1938
+ *
1939
+ * - Accepts relative paths (e.g., "/de/about")
1940
+ * - Returns relative paths when possible
1941
+ * - Handles string input/output instead of URL objects
1942
+ *
1943
+ * @see https://paraglidejs.com/i18n-routing
1944
+ *
1945
+ * @example
1946
+ * ```typescript
1947
+ * // In a React/Vue/Svelte component
1948
+ * const LocaleSwitcher = ({ href }) => {
1949
+ * // Remove locale prefix before switching
1950
+ * const baseHref = deLocalizeHref(href);
1951
+ * return locales.map(locale =>
1952
+ * <a href={localizeHref(baseHref, { locale })}>
1953
+ * Switch to {locale}
1954
+ * </a>
1955
+ * );
1956
+ * };
1957
+ *
1958
+ * // Examples:
1959
+ * deLocalizeHref("/de/about") // => "/about"
1960
+ * deLocalizeHref("/fr/store") // => "/store"
1961
+ *
1962
+ * // Cross-origin links remain absolute
1963
+ * deLocalizeHref("https://example.com/de/about")
1964
+ * // => "https://example.com/about"
1965
+ * ```
1966
+ *
1967
+ * For server-side URL de-localization (e.g., in middleware), use `deLocalizeUrl()`
1968
+ * which provides more precise control over URL handling.
1969
+ *
1970
+ * @param {string} href - The href to de-localize (can be relative or absolute)
1971
+ * @returns {string} The de-localized href, relative if input was relative
1972
+ */
1973
+ export function deLocalizeHref(href) {
1974
+ const url = new URL(href, getUrlOrigin());
1975
+ const deLocalized = deLocalizeUrl(url);
1976
+ // If the origin is identical and the href is relative,
1977
+ // return the relative path instead of the full URL.
1978
+ if (href.startsWith("/") && url.origin === deLocalized.origin) {
1979
+ return deLocalized.pathname + deLocalized.search + deLocalized.hash;
1980
+ }
1981
+ return deLocalized.href;
1982
+ }
1983
+
1984
+ /**
1985
+ * @param {string} safeModuleId
1986
+ * @param {Locale} locale
1987
+ */
1988
+ export function trackMessageCall(safeModuleId, locale) {
1989
+ if (isServer === false)
1990
+ return;
1991
+ const store = serverAsyncLocalStorage?.getStore();
1992
+ if (store) {
1993
+ store.messageCalls?.add(`${safeModuleId}:${locale}`);
1994
+ }
1995
+ }
1996
+
1997
+ /**
1998
+ * Generates localized URL variants for all provided URLs based on your configured locales and URL patterns.
1999
+ *
2000
+ * This function is essential for Static Site Generation (SSG) where you need to tell your framework
2001
+ * which pages to pre-render at build time. It's also useful for generating sitemaps and
2002
+ * `<link rel="alternate" hreflang>` tags for SEO.
2003
+ *
2004
+ * The function respects your `urlPatterns` configuration - if you have translated pathnames
2005
+ * (e.g., `/about` → `/ueber-uns` for German), it will generate the correct localized paths.
2006
+ *
2007
+ * @see https://paraglidejs.com/static-site-generation
2008
+ *
2009
+ * @example
2010
+ * // Basic usage - generate all locale variants for a list of paths
2011
+ * const localizedUrls = generateStaticLocalizedUrls([
2012
+ * "/",
2013
+ * "/about",
2014
+ * "/blog/post-1",
2015
+ * ]);
2016
+ * // Returns URL objects for each locale:
2017
+ * // ["/en/", "/de/", "/en/about", "/de/about", "/en/blog/post-1", "/de/blog/post-1"]
2018
+ *
2019
+ * @example
2020
+ * // Use with framework SSG APIs
2021
+ * // SvelteKit
2022
+ * export function entries() {
2023
+ * const paths = ["/", "/about", "/contact"];
2024
+ * return generateStaticLocalizedUrls(paths).map(url => ({
2025
+ * locale: extractLocaleFromUrl(url)
2026
+ * }));
2027
+ * }
2028
+ *
2029
+ * @example
2030
+ * // Sitemap generation
2031
+ * const allPages = ["/", "/about", "/blog"];
2032
+ * const sitemapUrls = generateStaticLocalizedUrls(allPages);
2033
+ *
2034
+ * @param {(string | URL)[]} urls - List of canonical URLs or paths to generate localized versions for.
2035
+ * Can be absolute URLs (`https://example.com/about`) or paths (`/about`).
2036
+ * Paths are resolved against `http://localhost` internally.
2037
+ * @returns {URL[]} Array of URL objects representing all localized variants.
2038
+ * The order follows each input URL with all its locale variants before moving to the next URL.
2039
+ */
2040
+ export function generateStaticLocalizedUrls(urls) {
2041
+ /** @type {Set<URL>} */
2042
+ const localizedUrls = new Set();
2043
+ // For default URL pattern, we can optimize the generation
2044
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
2045
+ for (const urlInput of urls) {
2046
+ const originalUrl = urlInput instanceof URL
2047
+ ? urlInput
2048
+ : new URL(urlInput, "http://localhost");
2049
+ const url = trailingSlash === undefined
2050
+ ? originalUrl
2051
+ : normalizeTrailingSlash(new URL(originalUrl));
2052
+ // Base locale doesn't get a prefix
2053
+ localizedUrls.add(url);
2054
+ // Other locales get their code as prefix
2055
+ for (const locale of locales) {
2056
+ if (locale !== baseLocale) {
2057
+ const localizedPath = `/${locale}${url.pathname}${url.search}${url.hash}`;
2058
+ const localizedUrl = new URL(localizedPath, url.origin);
2059
+ localizedUrls.add(normalizeTrailingSlash(localizedUrl));
2060
+ }
2061
+ }
2062
+ }
2063
+ return Array.from(localizedUrls);
2064
+ }
2065
+ // For custom URL patterns, we need to use localizeUrl for each URL and locale
2066
+ for (const urlInput of urls) {
2067
+ const originalUrl = urlInput instanceof URL
2068
+ ? urlInput
2069
+ : new URL(urlInput, "http://localhost");
2070
+ const url = normalizeTrailingSlash(new URL(originalUrl));
2071
+ // Try each URL pattern to find one that matches
2072
+ let patternFound = false;
2073
+ for (const pattern of urlPatterns) {
2074
+ try {
2075
+ // Try to match the unlocalized pattern
2076
+ const unlocalizedMatch = execUrlPattern(new URLPattern(pattern.pattern, url.href), url);
2077
+ if (!unlocalizedMatch)
2078
+ continue;
2079
+ patternFound = true;
2080
+ // Track unique localized URLs to avoid duplicates when patterns are the same
2081
+ const seenUrls = new Set();
2082
+ // Generate localized URL for each locale
2083
+ for (const [locale] of pattern.localized) {
2084
+ try {
2085
+ const localizedUrl = localizeUrl(url, { locale });
2086
+ const urlString = localizedUrl.href;
2087
+ // Only add if we haven't seen this exact URL before
2088
+ if (!seenUrls.has(urlString)) {
2089
+ seenUrls.add(urlString);
2090
+ localizedUrls.add(localizedUrl);
2091
+ }
2092
+ }
2093
+ catch {
2094
+ // Skip if localization fails for this locale
2095
+ continue;
2096
+ }
2097
+ }
2098
+ break;
2099
+ }
2100
+ catch {
2101
+ // Skip if pattern matching fails
2102
+ continue;
2103
+ }
2104
+ }
2105
+ // If no pattern matched, use the URL as is
2106
+ if (!patternFound) {
2107
+ localizedUrls.add(originalUrl);
2108
+ }
2109
+ }
2110
+ return Array.from(localizedUrls);
2111
+ }
2112
+
2113
+ /**
2114
+ * @typedef {"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage"} BuiltInStrategy
2115
+ */
2116
+ /**
2117
+ * @typedef {`custom_${string}`} CustomStrategy
2118
+ */
2119
+ /**
2120
+ * @typedef {BuiltInStrategy | CustomStrategy} Strategy
2121
+ */
2122
+ /**
2123
+ * @typedef {Array<Strategy>} Strategies
2124
+ */
2125
+ /**
2126
+ * @typedef {{ getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined) }} CustomServerStrategyHandler
2127
+ */
2128
+ /**
2129
+ * @typedef {{ getLocale: () => Promise<string|undefined> | (string | undefined), setLocale: (locale: string) => Promise<void> | void }} CustomClientStrategyHandler
2130
+ */
2131
+ /** @type {Map<string, CustomServerStrategyHandler>} */
2132
+ export const customServerStrategies = new Map();
2133
+ /** @type {Map<string, CustomClientStrategyHandler>} */
2134
+ export const customClientStrategies = new Map();
2135
+ /**
2136
+ * Checks if the given strategy is a custom strategy.
2137
+ *
2138
+ * @param {unknown} strategy The name of the custom strategy to validate.
2139
+ * Must be a string that starts with "custom-" followed by alphanumeric characters, hyphens, or underscores.
2140
+ * @returns {boolean} Returns true if it is a custom strategy, false otherwise.
2141
+ */
2142
+ export function isCustomStrategy(strategy) {
2143
+ return (typeof strategy === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy));
2144
+ }
2145
+ /**
2146
+ * Defines a custom strategy that is executed on the server.
2147
+ *
2148
+ * @see https://paraglidejs.com/strategy#write-your-own-strategy
2149
+ *
2150
+ * @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.
2151
+ * @param {CustomServerStrategyHandler} handler The handler for the custom strategy, which should implement
2152
+ * the method getLocale.
2153
+ * @returns {void}
2154
+ */
2155
+ export function defineCustomServerStrategy(strategy, handler) {
2156
+ if (!isCustomStrategy(strategy)) {
2157
+ throw new Error(`Invalid custom strategy: "${strategy}". Must be a custom strategy following the pattern custom-name.`);
2158
+ }
2159
+ customServerStrategies.set(strategy, handler);
2160
+ }
2161
+ /**
2162
+ * Defines a custom strategy that is executed on the client.
2163
+ *
2164
+ * @see https://paraglidejs.com/strategy#write-your-own-strategy
2165
+ *
2166
+ * @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.
2167
+ * @param {CustomClientStrategyHandler} handler The handler for the custom strategy, which should implement the
2168
+ * methods getLocale and setLocale.
2169
+ * @returns {void}
2170
+ */
2171
+ export function defineCustomClientStrategy(strategy, handler) {
2172
+ if (!isCustomStrategy(strategy)) {
2173
+ throw new Error(`Invalid custom strategy: "${strategy}". Must be a custom strategy following the pattern custom-name.`);
2174
+ }
2175
+ customClientStrategies.set(strategy, handler);
2176
+ }
2177
+
2178
+ // ------ TYPES ------
2179
+ export {};
2180
+ /**
2181
+ * A locale that is available in the project.
2182
+ *
2183
+ * @example
2184
+ * setLocale(request.locale as Locale)
2185
+ *
2186
+ * @typedef {typeof locales[number]} Locale
2187
+ */
2188
+ /**
2189
+ * A branded type representing a localized string.
2190
+ *
2191
+ * Message functions return this type instead of \`string\`, enabling TypeScript
2192
+ * to distinguish translated strings from regular strings at compile time.
2193
+ * This allows you to enforce that only properly localized content is used
2194
+ * in your UI components.
2195
+ *
2196
+ * Since \`LocalizedString\` is a branded subtype of \`string\`, it remains fully
2197
+ * backward compatible—you can pass it anywhere a \`string\` is expected.
2198
+ *
2199
+ * @example
2200
+ * // Enforce localized strings in your components
2201
+ * function PageTitle(props: { title: LocalizedString }) {
2202
+ * return <h1>{props.title}</h1>
2203
+ * }
2204
+ *
2205
+ * // ✅ Correct: using a message function
2206
+ * <PageTitle title={m.welcome_title()} />
2207
+ *
2208
+ * // ❌ Type error: raw strings are not LocalizedString
2209
+ * <PageTitle title="Welcome" />
2210
+ *
2211
+ * @example
2212
+ * // LocalizedString is assignable to string (backward compatible)
2213
+ * const localized: LocalizedString = m.greeting()
2214
+ * const str: string = localized // ✅ works fine
2215
+ *
2216
+ * // But string is not assignable to LocalizedString
2217
+ * const raw: LocalizedString = "Hello" // ❌ Type error
2218
+ *
2219
+ * @example
2220
+ * // Catches accidental string concatenation
2221
+ * function showMessage(msg: LocalizedString) { ... }
2222
+ *
2223
+ * showMessage(m.hello()) // ✅
2224
+ * showMessage("Hello " + userName) // ❌ Type error
2225
+ * showMessage(m.hello_user({ name: userName })) // ✅ use params instead
2226
+ *
2227
+ * @typedef {string & { readonly __brand: 'LocalizedString' }} LocalizedString
2228
+ */
2229
+ /**
2230
+ * A single markup option passed to a tag instance.
2231
+ *
2232
+ * @typedef {{
2233
+ * name: string;
2234
+ * value: unknown;
2235
+ * }} MessageMarkupOption
2236
+ */
2237
+ /**
2238
+ * A single static markup attribute attached to a tag instance.
2239
+ *
2240
+ * @typedef {{
2241
+ * name: string;
2242
+ * value: string | true;
2243
+ * }} MessageMarkupAttribute
2244
+ */
2245
+ /**
2246
+ * Record of markup options for a tag instance.
2247
+ *
2248
+ * @typedef {Record<string, unknown>} MessageMarkupOptions
2249
+ */
2250
+ /**
2251
+ * Record of markup attributes for a tag instance.
2252
+ *
2253
+ * @typedef {Record<string, string | true>} MessageMarkupAttributes
2254
+ */
2255
+ /**
2256
+ * Type-level schema for a single markup tag.
2257
+ *
2258
+ * @typedef {{
2259
+ * options: MessageMarkupOptions;
2260
+ * attributes: MessageMarkupAttributes;
2261
+ * children: boolean;
2262
+ * }} MessageMarkupTag
2263
+ */
2264
+ /**
2265
+ * Type-level schema for all markup tags in a message.
2266
+ *
2267
+ * @typedef {Record<string, MessageMarkupTag>} MessageMarkupSchema
2268
+ */
2269
+ /**
2270
+ * Type-only metadata attached to compiled message functions.
2271
+ *
2272
+ * @template Inputs
2273
+ * @template Options
2274
+ * @template {MessageMarkupSchema} [Markup = MessageMarkupSchema]
2275
+ * @typedef {{
2276
+ * readonly __paraglide?: {
2277
+ * inputs: Inputs;
2278
+ * options: Options;
2279
+ * markup: Markup;
2280
+ * };
2281
+ * }} MessageMetadata
2282
+ */
2283
+ /**
2284
+ * A compiled, framework-neutral message part.
2285
+ *
2286
+ * @typedef {{
2287
+ * type: "text";
2288
+ * value: string;
2289
+ * } | {
2290
+ * type: "markup-start";
2291
+ * name: string;
2292
+ * options: MessageMarkupOptions;
2293
+ * attributes: MessageMarkupAttributes;
2294
+ * } | {
2295
+ * type: "markup-end";
2296
+ * name: string;
2297
+ * options: MessageMarkupOptions;
2298
+ * attributes: MessageMarkupAttributes;
2299
+ * } | {
2300
+ * type: "markup-standalone";
2301
+ * name: string;
2302
+ * options: MessageMarkupOptions;
2303
+ * attributes: MessageMarkupAttributes;
2304
+ * }} MessagePart
2305
+ */
2306
+ /**
2307
+ * A message function is a message for a specific locale.
2308
+ *
2309
+ * @example
2310
+ * m.hello({ name: 'world' })
2311
+ *
2312
+ * @typedef {(inputs?: Record<string, never>) => LocalizedString} MessageFunction
2313
+ */
2314
+ /**
2315
+ * A message bundle function that selects the message to be returned.
2316
+ *
2317
+ * Uses `getLocale()` under the hood to determine the locale with an option.
2318
+ *
2319
+ * @template {string} T
2320
+ *
2321
+ * @example
2322
+ * * m.hello({ name: 'world' }, { locale: "en" })
2323
+ *
2324
+ * @typedef {(params: Record<string, never>, options: { locale: T }) => LocalizedString} MessageBundleFunction
2325
+ */